aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/CodingStyle49
-rw-r--r--Documentation/DocBook/gadget.tmpl2
-rw-r--r--Documentation/DocBook/usb.tmpl28
-rw-r--r--Documentation/HOWTO20
-rw-r--r--Documentation/block/capability.txt15
-rw-r--r--Documentation/dontdiff42
-rw-r--r--Documentation/feature-removal-schedule.txt2
-rw-r--r--Documentation/filesystems/directory-locking5
-rw-r--r--Documentation/filesystems/porting8
-rw-r--r--Documentation/i386/boot.txt32
-rw-r--r--Documentation/initrd.txt74
-rw-r--r--Documentation/kernel-parameters.txt24
-rw-r--r--Documentation/memory-barriers.txt98
-rw-r--r--Documentation/spi/spi-summary53
-rw-r--r--MAINTAINERS31
-rw-r--r--Makefile4
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/mach-generic/bigsmp.c6
-rw-r--r--arch/ia64/kernel/acpi-processor.c2
-rw-r--r--arch/ia64/kernel/acpi.c3
-rw-r--r--arch/ia64/kernel/process.c5
-rw-r--r--arch/ia64/kernel/smpboot.c4
-rw-r--r--arch/ia64/kernel/unwind.c21
-rw-r--r--arch/ia64/pci/pci.c11
-rw-r--r--arch/ia64/sn/kernel/setup.c2
-rw-r--r--arch/mips/sgi-ip32/Makefile2
-rw-r--r--arch/mips/sgi-ip32/ip32-platform.c20
-rw-r--r--arch/sh/boards/landisk/gio.c2
-rw-r--r--arch/sh/boards/landisk/setup.c6
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile5
-rw-r--r--arch/sh/boards/snapgear/rtc.c2
-rw-r--r--arch/sh/boards/superh/microdev/io.c6
-rw-r--r--arch/sh/boards/superh/microdev/irq.c6
-rw-r--r--arch/sh/boards/superh/microdev/setup.c2
-rw-r--r--arch/sh/boards/unknown/setup.c2
-rw-r--r--arch/sh/drivers/dma/dma-api.c2
-rw-r--r--arch/sh/drivers/dma/dma-isa.c2
-rw-r--r--arch/sh/drivers/dma/dmabrg.c2
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c2
-rw-r--r--arch/sh/drivers/pci/pci-st40.c6
-rw-r--r--arch/sh/drivers/pci/pci-st40.h2
-rw-r--r--arch/sh/drivers/superhyway/ops-sh4-202.c2
-rw-r--r--arch/sh/kernel/cf-enabler.c2
-rw-r--r--arch/sh/kernel/cpu/clock.c7
-rw-r--r--arch/sh/kernel/cpu/irq/maskreg.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/fpu.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c34
-rw-r--r--arch/sh/kernel/kgdb_stub.c4
-rw-r--r--arch/sh/kernel/process.c33
-rw-r--r--arch/sh/kernel/syscalls.S3
-rw-r--r--arch/sh/kernel/traps.c13
-rw-r--r--arch/sh/math-emu/math.c2
-rw-r--r--arch/sh/mm/copy_page.S1
-rw-r--r--arch/sh/mm/fault.c39
-rw-r--r--arch/sh/mm/init.c3
-rw-r--r--arch/sh/mm/pmb.c79
-rw-r--r--arch/sh/tools/mach-types5
-rw-r--r--arch/um/os-Linux/start_up.c24
-rw-r--r--arch/x86_64/Kconfig7
-rw-r--r--arch/x86_64/kernel/k8.c7
-rw-r--r--block/genhd.c33
-rw-r--r--drivers/ata/ata_piix.c1
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-scsi.c5
-rw-r--r--drivers/ata/pata_artop.c2
-rw-r--r--drivers/ata/pata_hpt37x.c27
-rw-r--r--drivers/ata/pata_hpt3x2n.c4
-rw-r--r--drivers/ata/pata_it821x.c3
-rw-r--r--drivers/ata/pata_scc.c46
-rw-r--r--drivers/ata/pata_sis.c46
-rw-r--r--drivers/ata/pata_via.c38
-rw-r--r--drivers/ata/sata_mv.c44
-rw-r--r--drivers/ata/sata_promise.c2
-rw-r--r--drivers/ata/sata_sis.c2
-rw-r--r--drivers/ata/sata_via.c3
-rw-r--r--drivers/atm/idt77252.c27
-rw-r--r--drivers/atm/idt77252.h4
-rw-r--r--drivers/block/floppy.c2
-rw-r--r--drivers/bluetooth/hci_usb.c16
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/cyclades.c1
-rw-r--r--drivers/crypto/geode-aes.c12
-rw-r--r--drivers/crypto/geode-aes.h3
-rw-r--r--drivers/hwmon/applesmc.c10
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c3
-rw-r--r--drivers/i2c/busses/i2c-tiny-usb.c2
-rw-r--r--drivers/i2c/i2c-core.c5
-rw-r--r--drivers/ide/ide-dma.c4
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/ide/pci/atiixp.c1
-rw-r--r--drivers/ide/pci/serverworks.c14
-rw-r--r--drivers/infiniband/hw/ehca/hcp_if.c2
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c59
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c3
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c31
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c4
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c10
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c5
-rw-r--r--drivers/input/misc/input-polldev.c5
-rw-r--r--drivers/input/mouse/alps.c58
-rw-r--r--drivers/input/mouse/logips2pp.c1
-rw-r--r--drivers/input/touchscreen/Kconfig8
-rw-r--r--drivers/input/touchscreen/ads7846.c3
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c7
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c4
-rw-r--r--drivers/isdn/hardware/eicon/capifunc.c16
-rw-r--r--drivers/isdn/hardware/eicon/message.c13
-rw-r--r--drivers/isdn/hisax/config.c2
-rw-r--r--drivers/isdn/hisax/hfc_usb.c43
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c6
-rw-r--r--drivers/isdn/hisax/st5481_init.c7
-rw-r--r--drivers/isdn/hisax/st5481_usb.c1
-rw-r--r--drivers/macintosh/adbhid.c16
-rw-r--r--drivers/md/bitmap.c17
-rw-r--r--drivers/md/linear.c10
-rw-r--r--drivers/md/md.c20
-rw-r--r--drivers/md/raid0.c3
-rw-r--r--drivers/media/dvb/bt8xx/dst.c3
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c15
-rw-r--r--drivers/media/video/cafe_ccic-regs.h6
-rw-r--r--drivers/media/video/cafe_ccic.c18
-rw-r--r--drivers/media/video/em28xx/Kconfig3
-rw-r--r--drivers/media/video/ivtv/Kconfig2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h8
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c12
-rw-r--r--drivers/media/video/ov7670.c21
-rw-r--r--drivers/media/video/tuner-simple.c10
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptscsih.c8
-rw-r--r--drivers/message/i2o/driver.c26
-rw-r--r--drivers/mfd/ucb1x00-ts.c11
-rw-r--r--drivers/misc/phantom.c29
-rw-r--r--drivers/mmc/card/block.c18
-rw-r--r--drivers/mmc/card/queue.c35
-rw-r--r--drivers/mmc/card/queue.h8
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/arcnet/Kconfig17
-rw-r--r--drivers/net/cassini.c5
-rw-r--r--drivers/net/chelsio/suni1x10gexp_regs.h2
-rw-r--r--drivers/net/forcedeth.c2
-rw-r--r--drivers/net/meth.c68
-rw-r--r--drivers/net/phy/fixed.c4
-rw-r--r--drivers/net/spider_net.c6
-rw-r--r--drivers/net/tokenring/Kconfig33
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/ucc_geth_mii.c2
-rw-r--r--drivers/net/usb/asix.c4
-rw-r--r--drivers/net/usb/cdc_ether.c16
-rw-r--r--drivers/net/usb/rndis_host.c1
-rw-r--r--drivers/net/usb/usbnet.c25
-rw-r--r--drivers/net/usb/usbnet.h1
-rw-r--r--drivers/net/wireless/libertas/decl.h2
-rw-r--r--drivers/net/wireless/libertas/fw.c14
-rw-r--r--drivers/net/wireless/libertas/rx.c24
-rw-r--r--drivers/s390/scsi/zfcp_aux.c1
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c5
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c40
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c3
-rw-r--r--drivers/scsi/aacraid/aachba.c15
-rw-r--r--drivers/scsi/aacraid/aacraid.h3
-rw-r--r--drivers/scsi/aacraid/rx.c8
-rw-r--r--drivers/scsi/aacraid/sa.c9
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_gram.y1
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_tmf.c14
-rw-r--r--drivers/scsi/ipr.c7
-rw-r--r--drivers/scsi/libsrp.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c67
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h14
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/scsi/sd.c18
-rw-r--r--drivers/scsi/stex.c90
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c25
-rw-r--r--drivers/spi/omap_uwire.c4
-rw-r--r--drivers/spi/spidev.c13
-rw-r--r--drivers/usb/class/usblp.c2
-rw-r--r--drivers/usb/core/config.c10
-rw-r--r--drivers/usb/core/driver.c18
-rw-r--r--drivers/usb/core/hcd.c8
-rw-r--r--drivers/usb/core/hub.c53
-rw-r--r--drivers/usb/core/message.c9
-rw-r--r--drivers/usb/core/sysfs.c7
-rw-r--r--drivers/usb/core/usb.c10
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c8
-rw-r--r--drivers/usb/host/ehci-fsl.c13
-rw-r--r--drivers/usb/host/ehci-fsl.h1
-rw-r--r--drivers/usb/host/ohci-pci.c2
-rw-r--r--drivers/usb/host/pci-quirks.c9
-rw-r--r--drivers/usb/host/u132-hcd.c12
-rw-r--r--drivers/usb/misc/auerswald.c10
-rw-r--r--drivers/usb/misc/ftdi-elan.c12
-rw-r--r--drivers/usb/misc/ldusb.c35
-rw-r--r--drivers/usb/serial/ark3116.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c40
-rw-r--r--drivers/usb/serial/ftdi_sio.h12
-rw-r--r--drivers/usb/serial/mos7840.c5
-rw-r--r--drivers/usb/serial/omninet.c2
-rw-r--r--drivers/usb/serial/option.c1
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/storage/onetouch.c9
-rw-r--r--drivers/usb/storage/unusual_devs.h10
-rw-r--r--drivers/video/Kconfig183
-rw-r--r--drivers/video/imxfb.c24
-rw-r--r--drivers/video/pm2fb.c17
-rw-r--r--drivers/video/pm3fb.c333
-rw-r--r--drivers/video/ps3fb.c8
-rw-r--r--drivers/video/w100fb.c14
-rw-r--r--fs/Kconfig.binfmt2
-rw-r--r--fs/compat.c17
-rw-r--r--fs/compat_ioctl.c33
-rw-r--r--fs/ecryptfs/file.c59
-rw-r--r--fs/ecryptfs/mmap.c38
-rw-r--r--fs/exec.c3
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/file.c4
-rw-r--r--fs/fuse/inode.c1
-rw-r--r--fs/nfs/direct.c53
-rw-r--r--fs/nfs/pagelist.c20
-rw-r--r--fs/nfs/write.c6
-rw-r--r--fs/ocfs2/aops.c11
-rw-r--r--fs/ocfs2/file.c33
-rw-r--r--fs/ocfs2/localalloc.c7
-rw-r--r--fs/reiserfs/dir.c2
-rw-r--r--fs/signalfd.c120
-rw-r--r--include/asm-generic/bug.h2
-rw-r--r--include/asm-i386/atomic.h2
-rw-r--r--include/asm-i386/local.h2
-rw-r--r--include/asm-ia64/acpi.h7
-rw-r--r--include/asm-ia64/unistd.h13
-rw-r--r--include/asm-sh/dreamcast/sysasic.h2
-rw-r--r--include/asm-sh/kdebug.h4
-rw-r--r--include/asm-sh/landisk/gio.h10
-rw-r--r--include/asm-sh/landisk/iodata_landisk.h37
-rw-r--r--include/asm-sh/unistd.h5
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/freezer.h69
-rw-r--r--include/linux/genhd.h5
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h3
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h23
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/raid/bitmap.h1
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/dst.h7
-rw-r--r--include/net/ipv6.h3
-rw-r--r--kernel/exit.c7
-rw-r--r--kernel/fork.c3
-rw-r--r--kernel/irq/spurious.c46
-rw-r--r--kernel/kthread.c7
-rw-r--r--kernel/power/process.c57
-rw-r--r--kernel/power/swap.c2
-rw-r--r--kernel/sched.c4
-rw-r--r--kernel/signal.c24
-rw-r--r--kernel/time/tick-broadcast.c17
-rw-r--r--kernel/time/tick-sched.c12
-rw-r--r--kernel/workqueue.c84
-rw-r--r--lib/Kconfig.debug3
-rw-r--r--mm/page_alloc.c45
-rw-r--r--mm/slub.c4
-rw-r--r--net/bluetooth/l2cap.c144
-rw-r--r--net/core/rtnetlink.c38
-rw-r--r--net/core/sock.c14
-rw-r--r--net/core/sysctl_net_core.c9
-rw-r--r--net/dccp/Kconfig15
-rw-r--r--net/dccp/ccids/ccid3.c3
-rw-r--r--net/dccp/ipv6.c10
-rw-r--r--net/ipv4/fib_hash.c6
-rw-r--r--net/ipv4/fib_lookup.h3
-rw-r--r--net/ipv4/fib_semantics.c5
-rw-r--r--net/ipv4/fib_trie.c6
-rw-r--r--net/ipv4/ipvs/Kconfig30
-rw-r--r--net/ipv4/netfilter/nf_nat_ftp.c20
-rw-r--r--net/ipv4/netfilter/nf_nat_h323.c6
-rw-r--r--net/ipv4/route.c71
-rw-r--r--net/ipv6/addrconf.c31
-rw-r--r--net/ipv6/datagram.c8
-rw-r--r--net/ipv6/raw.c8
-rw-r--r--net/ipv6/route.c63
-rw-r--r--net/ipv6/tcp_ipv6.c8
-rw-r--r--net/ipv6/udp.c8
-rw-r--r--net/netfilter/nf_conntrack_ftp.c13
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c41
-rw-r--r--net/netfilter/nf_conntrack_h323_types.c31
-rw-r--r--net/rxrpc/Kconfig2
-rw-r--r--net/rxrpc/ar-call.c19
-rw-r--r--net/rxrpc/ar-proc.c19
-rw-r--r--net/sched/sch_generic.c2
-rw-r--r--net/sched/sch_htb.c5
-rw-r--r--net/sctp/Kconfig14
-rw-r--r--net/tipc/Kconfig24
-rw-r--r--net/tipc/eth_media.c10
-rw-r--r--net/xfrm/xfrm_algo.c8
-rw-r--r--net/xfrm/xfrm_policy.c28
297 files changed, 2950 insertions, 2014 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index afc286775891..b49b92edb396 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -495,29 +495,40 @@ re-formatting you may want to take a look at the man page. But
495remember: "indent" is not a fix for bad programming. 495remember: "indent" is not a fix for bad programming.
496 496
497 497
498 Chapter 10: Configuration-files 498 Chapter 10: Kconfig configuration files
499 499
500For configuration options (arch/xxx/Kconfig, and all the Kconfig files), 500For all of the Kconfig* configuration files throughout the source tree,
501somewhat different indentation is used. 501the indentation is somewhat different. Lines under a "config" definition
502are indented with one tab, while help text is indented an additional two
503spaces. Example:
502 504
503Help text is indented with 2 spaces. 505config AUDIT
504 506 bool "Auditing support"
505if CONFIG_EXPERIMENTAL 507 depends on NET
506 tristate CONFIG_BOOM
507 default n
508 help
509 Apply nitroglycerine inside the keyboard (DANGEROUS)
510 bool CONFIG_CHEER
511 depends on CONFIG_BOOM
512 default y
513 help 508 help
514 Output nice messages when you explode 509 Enable auditing infrastructure that can be used with another
515endif 510 kernel subsystem, such as SELinux (which requires this for
511 logging of avc messages output). Does not do system-call
512 auditing without CONFIG_AUDITSYSCALL.
513
514Features that might still be considered unstable should be defined as
515dependent on "EXPERIMENTAL":
516
517config SLUB
518 depends on EXPERIMENTAL && !ARCH_USES_SLAB_PAGE_STRUCT
519 bool "SLUB (Unqueued Allocator)"
520 ...
521
522while seriously dangerous features (such as write support for certain
523filesystems) should advertise this prominently in their prompt string:
524
525config ADFS_FS_RW
526 bool "ADFS write support (DANGEROUS)"
527 depends on ADFS_FS
528 ...
516 529
517Generally, CONFIG_EXPERIMENTAL should surround all options not considered 530For full documentation on the configuration files, see the file
518stable. All options that are known to trash data (experimental write- 531Documentation/kbuild/kconfig-language.txt.
519support for file-systems, for instance) should be denoted (DANGEROUS), other
520experimental options should be denoted (EXPERIMENTAL).
521 532
522 533
523 Chapter 11: Data structures 534 Chapter 11: Data structures
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl
index e7fc96433408..6996d977bf8f 100644
--- a/Documentation/DocBook/gadget.tmpl
+++ b/Documentation/DocBook/gadget.tmpl
@@ -52,7 +52,7 @@
52 52
53<toc></toc> 53<toc></toc>
54 54
55<chapter><title>Introduction</title> 55<chapter id="intro"><title>Introduction</title>
56 56
57<para>This document presents a Linux-USB "Gadget" 57<para>This document presents a Linux-USB "Gadget"
58kernel mode 58kernel mode
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl
index a2ebd651b05a..af293606fbe3 100644
--- a/Documentation/DocBook/usb.tmpl
+++ b/Documentation/DocBook/usb.tmpl
@@ -185,7 +185,7 @@
185 185
186 </chapter> 186 </chapter>
187 187
188<chapter><title>USB-Standard Types</title> 188<chapter id="types"><title>USB-Standard Types</title>
189 189
190 <para>In <filename>&lt;linux/usb/ch9.h&gt;</filename> you will find 190 <para>In <filename>&lt;linux/usb/ch9.h&gt;</filename> you will find
191 the USB data types defined in chapter 9 of the USB specification. 191 the USB data types defined in chapter 9 of the USB specification.
@@ -197,7 +197,7 @@
197 197
198 </chapter> 198 </chapter>
199 199
200<chapter><title>Host-Side Data Types and Macros</title> 200<chapter id="hostside"><title>Host-Side Data Types and Macros</title>
201 201
202 <para>The host side API exposes several layers to drivers, some of 202 <para>The host side API exposes several layers to drivers, some of
203 which are more necessary than others. 203 which are more necessary than others.
@@ -211,7 +211,7 @@
211 211
212 </chapter> 212 </chapter>
213 213
214 <chapter><title>USB Core APIs</title> 214 <chapter id="usbcore"><title>USB Core APIs</title>
215 215
216 <para>There are two basic I/O models in the USB API. 216 <para>There are two basic I/O models in the USB API.
217 The most elemental one is asynchronous: drivers submit requests 217 The most elemental one is asynchronous: drivers submit requests
@@ -248,7 +248,7 @@
248!Edrivers/usb/core/hub.c 248!Edrivers/usb/core/hub.c
249 </chapter> 249 </chapter>
250 250
251 <chapter><title>Host Controller APIs</title> 251 <chapter id="hcd"><title>Host Controller APIs</title>
252 252
253 <para>These APIs are only for use by host controller drivers, 253 <para>These APIs are only for use by host controller drivers,
254 most of which implement standard register interfaces such as 254 most of which implement standard register interfaces such as
@@ -285,7 +285,7 @@
285!Idrivers/usb/core/buffer.c 285!Idrivers/usb/core/buffer.c
286 </chapter> 286 </chapter>
287 287
288 <chapter> 288 <chapter id="usbfs">
289 <title>The USB Filesystem (usbfs)</title> 289 <title>The USB Filesystem (usbfs)</title>
290 290
291 <para>This chapter presents the Linux <emphasis>usbfs</emphasis>. 291 <para>This chapter presents the Linux <emphasis>usbfs</emphasis>.
@@ -317,7 +317,7 @@
317 not it has a kernel driver. 317 not it has a kernel driver.
318 </para> 318 </para>
319 319
320 <sect1> 320 <sect1 id="usbfs-files">
321 <title>What files are in "usbfs"?</title> 321 <title>What files are in "usbfs"?</title>
322 322
323 <para>Conventionally mounted at 323 <para>Conventionally mounted at
@@ -356,7 +356,7 @@
356 356
357 </sect1> 357 </sect1>
358 358
359 <sect1> 359 <sect1 id="usbfs-fstab">
360 <title>Mounting and Access Control</title> 360 <title>Mounting and Access Control</title>
361 361
362 <para>There are a number of mount options for usbfs, which will 362 <para>There are a number of mount options for usbfs, which will
@@ -439,7 +439,7 @@
439 439
440 </sect1> 440 </sect1>
441 441
442 <sect1> 442 <sect1 id="usbfs-devices">
443 <title>/proc/bus/usb/devices</title> 443 <title>/proc/bus/usb/devices</title>
444 444
445 <para>This file is handy for status viewing tools in user 445 <para>This file is handy for status viewing tools in user
@@ -473,7 +473,7 @@ for (;;) {
473 </para> 473 </para>
474 </sect1> 474 </sect1>
475 475
476 <sect1> 476 <sect1 id="usbfs-bbbddd">
477 <title>/proc/bus/usb/BBB/DDD</title> 477 <title>/proc/bus/usb/BBB/DDD</title>
478 478
479 <para>Use these files in one of these basic ways: 479 <para>Use these files in one of these basic ways:
@@ -510,7 +510,7 @@ for (;;) {
510 </sect1> 510 </sect1>
511 511
512 512
513 <sect1> 513 <sect1 id="usbfs-lifecycle">
514 <title>Life Cycle of User Mode Drivers</title> 514 <title>Life Cycle of User Mode Drivers</title>
515 515
516 <para>Such a driver first needs to find a device file 516 <para>Such a driver first needs to find a device file
@@ -565,7 +565,7 @@ for (;;) {
565 565
566 </sect1> 566 </sect1>
567 567
568 <sect1><title>The ioctl() Requests</title> 568 <sect1 id="usbfs-ioctl"><title>The ioctl() Requests</title>
569 569
570 <para>To use these ioctls, you need to include the following 570 <para>To use these ioctls, you need to include the following
571 headers in your userspace program: 571 headers in your userspace program:
@@ -604,7 +604,7 @@ for (;;) {
604 </para> 604 </para>
605 605
606 606
607 <sect2> 607 <sect2 id="usbfs-mgmt">
608 <title>Management/Status Requests</title> 608 <title>Management/Status Requests</title>
609 609
610 <para>A number of usbfs requests don't deal very directly 610 <para>A number of usbfs requests don't deal very directly
@@ -736,7 +736,7 @@ usbdev_ioctl (int fd, int ifno, unsigned request, void *param)
736 736
737 </sect2> 737 </sect2>
738 738
739 <sect2> 739 <sect2 id="usbfs-sync">
740 <title>Synchronous I/O Support</title> 740 <title>Synchronous I/O Support</title>
741 741
742 <para>Synchronous requests involve the kernel blocking 742 <para>Synchronous requests involve the kernel blocking
@@ -865,7 +865,7 @@ usbdev_ioctl (int fd, int ifno, unsigned request, void *param)
865 </variablelist> 865 </variablelist>
866 </sect2> 866 </sect2>
867 867
868 <sect2> 868 <sect2 id="usbfs-async">
869 <title>Asynchronous I/O Support</title> 869 <title>Asynchronous I/O Support</title>
870 870
871 <para>As mentioned above, there are situations where it may be 871 <para>As mentioned above, there are situations where it may be
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index 48123dba5e6a..ced9207bedcf 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -396,26 +396,6 @@ bugme-janitor mailing list (every change in the bugzilla is mailed here)
396 396
397 397
398 398
399Managing bug reports
400--------------------
401
402One of the best ways to put into practice your hacking skills is by fixing
403bugs reported by other people. Not only you will help to make the kernel
404more stable, you'll learn to fix real world problems and you will improve
405your skills, and other developers will be aware of your presence. Fixing
406bugs is one of the best ways to get merits among other developers, because
407not many people like wasting time fixing other people's bugs.
408
409To work in the already reported bug reports, go to http://bugzilla.kernel.org.
410If you want to be advised of the future bug reports, you can subscribe to the
411bugme-new mailing list (only new bug reports are mailed here) or to the
412bugme-janitor mailing list (every change in the bugzilla is mailed here)
413
414 http://lists.osdl.org/mailman/listinfo/bugme-new
415 http://lists.osdl.org/mailman/listinfo/bugme-janitors
416
417
418
419Mailing lists 399Mailing lists
420------------- 400-------------
421 401
diff --git a/Documentation/block/capability.txt b/Documentation/block/capability.txt
new file mode 100644
index 000000000000..2f1729424ef4
--- /dev/null
+++ b/Documentation/block/capability.txt
@@ -0,0 +1,15 @@
1Generic Block Device Capability
2===============================================================================
3This file documents the sysfs file block/<disk>/capability
4
5capability is a hex word indicating which capabilities a specific disk
6supports. For more information on bits not listed here, see
7include/linux/genhd.h
8
9Capability Value
10-------------------------------------------------------------------------------
11GENHD_FL_MEDIA_CHANGE_NOTIFY 4
12 When this bit is set, the disk supports Asynchronous Notification
13 of media change events. These events will be broadcast to user
14 space via kernel uevent.
15
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index 64e9f6c4826b..595a5ea4c690 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -10,10 +10,12 @@
10*.grp 10*.grp
11*.gz 11*.gz
12*.html 12*.html
13*.i
13*.jpeg 14*.jpeg
14*.ko 15*.ko
15*.log 16*.log
16*.lst 17*.lst
18*.moc
17*.mod.c 19*.mod.c
18*.o 20*.o
19*.orig 21*.orig
@@ -25,6 +27,9 @@
25*.s 27*.s
26*.sgml 28*.sgml
27*.so 29*.so
30*.symtypes
31*.tab.c
32*.tab.h
28*.tex 33*.tex
29*.ver 34*.ver
30*.xml 35*.xml
@@ -32,9 +37,13 @@
32*_vga16.c 37*_vga16.c
33*cscope* 38*cscope*
34*~ 39*~
40*.9
41*.9.gz
35.* 42.*
36.cscope 43.cscope
3753c700_d.h 4453c700_d.h
4553c7xx_d.h
4653c7xx_u.h
3853c8xx_d.h* 4753c8xx_d.h*
39BitKeeper 48BitKeeper
40COPYING 49COPYING
@@ -70,9 +79,11 @@ bzImage*
70classlist.h* 79classlist.h*
71comp*.log 80comp*.log
72compile.h* 81compile.h*
82conf
73config 83config
74config-* 84config-*
75config_data.h* 85config_data.h*
86config_data.gz*
76conmakehash 87conmakehash
77consolemap_deftbl.c* 88consolemap_deftbl.c*
78crc32table.h* 89crc32table.h*
@@ -81,18 +92,23 @@ defkeymap.c*
81devlist.h* 92devlist.h*
82docproc 93docproc
83dummy_sym.c* 94dummy_sym.c*
95elf2ecoff
84elfconfig.h* 96elfconfig.h*
85filelist 97filelist
86fixdep 98fixdep
87fore200e_mkfirm 99fore200e_mkfirm
88fore200e_pca_fw.c* 100fore200e_pca_fw.c*
101gconf
89gen-devlist 102gen-devlist
90gen-kdb_cmds.c* 103gen-kdb_cmds.c*
91gen_crc32table 104gen_crc32table
92gen_init_cpio 105gen_init_cpio
93genksyms 106genksyms
94gentbl 107gentbl
108*_gray256.c
95ikconfig.h* 109ikconfig.h*
110initramfs_data.cpio
111initramfs_data.cpio.gz
96initramfs_list 112initramfs_list
97kallsyms 113kallsyms
98kconfig 114kconfig
@@ -100,19 +116,30 @@ kconfig.tk
100keywords.c* 116keywords.c*
101ksym.c* 117ksym.c*
102ksym.h* 118ksym.h*
119kxgettext
120lkc_defs.h
103lex.c* 121lex.c*
122lex.*.c
123lk201-map.c
104logo_*.c 124logo_*.c
105logo_*_clut224.c 125logo_*_clut224.c
106logo_*_mono.c 126logo_*_mono.c
107lxdialog 127lxdialog
108mach-types 128mach-types
109mach-types.h 129mach-types.h
130machtypes.h
110make_times_h 131make_times_h
111map 132map
112maui_boot.h 133maui_boot.h
134mconf
135miboot*
113mk_elfconfig 136mk_elfconfig
137mkboot
138mkbugboot
114mkdep 139mkdep
140mkprep
115mktables 141mktables
142mktree
116modpost 143modpost
117modversions.h* 144modversions.h*
118offset.h 145offset.h
@@ -120,18 +147,28 @@ offsets.h
120oui.c* 147oui.c*
121parse.c* 148parse.c*
122parse.h* 149parse.h*
150patches*
151pca200e.bin
152pca200e_ecd.bin2
153piggy.gz
154piggyback
123pnmtologo 155pnmtologo
124ppc_defs.h* 156ppc_defs.h*
125promcon_tbl.c* 157promcon_tbl.c*
126pss_boot.h 158pss_boot.h
159qconf
127raid6altivec*.c 160raid6altivec*.c
128raid6int*.c 161raid6int*.c
129raid6tables.c 162raid6tables.c
163relocs
164series
130setup 165setup
131sim710_d.h* 166sim710_d.h*
167sImage
132sm_tbl* 168sm_tbl*
133split-include 169split-include
134tags 170tags
171tftpboot.img
135times.h* 172times.h*
136tkparse 173tkparse
137trix_boot.h 174trix_boot.h
@@ -139,8 +176,11 @@ utsrelease.h*
139version.h* 176version.h*
140vmlinux 177vmlinux
141vmlinux-* 178vmlinux-*
179vmlinux.aout
142vmlinux.lds 180vmlinux.lds
143vsyscall.lds 181vsyscall.lds
144wanxlfw.inc 182wanxlfw.inc
145uImage 183uImage
146zImage 184unifdef
185zImage*
186zconf.hash.c
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 5c8695a3d139..2d7ea85075ba 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -62,7 +62,7 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
62What: old NCR53C9x driver 62What: old NCR53C9x driver
63When: October 2007 63When: October 2007
64Why: Replaced by the much better esp_scsi driver. Actual low-level 64Why: Replaced by the much better esp_scsi driver. Actual low-level
65 driver can ported over almost trivially. 65 driver can be ported over almost trivially.
66Who: David Miller <davem@davemloft.net> 66Who: David Miller <davem@davemloft.net>
67 Christoph Hellwig <hch@lst.de> 67 Christoph Hellwig <hch@lst.de>
68 68
diff --git a/Documentation/filesystems/directory-locking b/Documentation/filesystems/directory-locking
index d7099a9266fb..ff7b611abf33 100644
--- a/Documentation/filesystems/directory-locking
+++ b/Documentation/filesystems/directory-locking
@@ -1,5 +1,6 @@
1 Locking scheme used for directory operations is based on two 1 Locking scheme used for directory operations is based on two
2kinds of locks - per-inode (->i_sem) and per-filesystem (->s_vfs_rename_sem). 2kinds of locks - per-inode (->i_mutex) and per-filesystem
3(->s_vfs_rename_mutex).
3 4
4 For our purposes all operations fall in 5 classes: 5 For our purposes all operations fall in 5 classes:
5 6
@@ -63,7 +64,7 @@ objects - A < B iff A is an ancestor of B.
63attempt to acquire some lock and already holds at least one lock. Let's 64attempt to acquire some lock and already holds at least one lock. Let's
64consider the set of contended locks. First of all, filesystem lock is 65consider the set of contended locks. First of all, filesystem lock is
65not contended, since any process blocked on it is not holding any locks. 66not contended, since any process blocked on it is not holding any locks.
66Thus all processes are blocked on ->i_sem. 67Thus all processes are blocked on ->i_mutex.
67 68
68 Non-directory objects are not contended due to (3). Thus link 69 Non-directory objects are not contended due to (3). Thus link
69creation can't be a part of deadlock - it can't be blocked on source 70creation can't be a part of deadlock - it can't be blocked on source
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 5531694059ab..dac45c92d872 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -107,7 +107,7 @@ free to drop it...
107--- 107---
108[informational] 108[informational]
109 109
110->link() callers hold ->i_sem on the object we are linking to. Some of your 110->link() callers hold ->i_mutex on the object we are linking to. Some of your
111problems might be over... 111problems might be over...
112 112
113--- 113---
@@ -130,9 +130,9 @@ went in - and hadn't been documented ;-/). Just remove it from fs_flags
130--- 130---
131[mandatory] 131[mandatory]
132 132
133->setattr() is called without BKL now. Caller _always_ holds ->i_sem, so 133->setattr() is called without BKL now. Caller _always_ holds ->i_mutex, so
134watch for ->i_sem-grabbing code that might be used by your ->setattr(). 134watch for ->i_mutex-grabbing code that might be used by your ->setattr().
135Callers of notify_change() need ->i_sem now. 135Callers of notify_change() need ->i_mutex now.
136 136
137--- 137---
138[recommended] 138[recommended]
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt
index 66fa67fec2a7..35985b34d5a6 100644
--- a/Documentation/i386/boot.txt
+++ b/Documentation/i386/boot.txt
@@ -2,7 +2,7 @@
2 ---------------------------- 2 ----------------------------
3 3
4 H. Peter Anvin <hpa@zytor.com> 4 H. Peter Anvin <hpa@zytor.com>
5 Last update 2007-05-16 5 Last update 2007-05-23
6 6
7On the i386 platform, the Linux kernel uses a rather complicated boot 7On the i386 platform, the Linux kernel uses a rather complicated boot
8convention. This has evolved partially due to historical aspects, as 8convention. This has evolved partially due to historical aspects, as
@@ -202,6 +202,8 @@ All general purpose boot loaders should write the fields marked
202nonstandard address should fill in the fields marked (reloc); other 202nonstandard address should fill in the fields marked (reloc); other
203boot loaders can ignore those fields. 203boot loaders can ignore those fields.
204 204
205The byte order of all fields is littleendian (this is x86, after all.)
206
205Field name: setup_secs 207Field name: setup_secs
206Type: read 208Type: read
207Offset/size: 0x1f1/1 209Offset/size: 0x1f1/1
@@ -280,14 +282,16 @@ Type: read
280Offset/size: 0x206/2 282Offset/size: 0x206/2
281Protocol: 2.00+ 283Protocol: 2.00+
282 284
283 Contains the boot protocol version, e.g. 0x0204 for version 2.04. 285 Contains the boot protocol version, in (major << 8)+minor format,
286 e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
287 10.17.
284 288
285Field name: readmode_swtch 289Field name: readmode_swtch
286Type: modify (optional) 290Type: modify (optional)
287Offset/size: 0x208/4 291Offset/size: 0x208/4
288Protocol: 2.00+ 292Protocol: 2.00+
289 293
290 Boot loader hook (see separate chapter.) 294 Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
291 295
292Field name: start_sys 296Field name: start_sys
293Type: read 297Type: read
@@ -304,10 +308,17 @@ Protocol: 2.00+
304 If set to a nonzero value, contains a pointer to a NUL-terminated 308 If set to a nonzero value, contains a pointer to a NUL-terminated
305 human-readable kernel version number string, less 0x200. This can 309 human-readable kernel version number string, less 0x200. This can
306 be used to display the kernel version to the user. This value 310 be used to display the kernel version to the user. This value
307 should be less than (0x200*setup_sects). For example, if this value 311 should be less than (0x200*setup_sects).
308 is set to 0x1c00, the kernel version number string can be found at 312
309 offset 0x1e00 in the kernel file. This is a valid value if and only 313 For example, if this value is set to 0x1c00, the kernel version
310 if the "setup_sects" field contains the value 14 or higher. 314 number string can be found at offset 0x1e00 in the kernel file.
315 This is a valid value if and only if the "setup_sects" field
316 contains the value 15 or higher, as:
317
318 0x1c00 < 15*0x200 (= 0x1e00) but
319 0x1c00 >= 14*0x200 (= 0x1c00)
320
321 0x1c00 >> 9 = 14, so the minimum value for setup_secs is 15.
311 322
312Field name: type_of_loader 323Field name: type_of_loader
313Type: write (obligatory) 324Type: write (obligatory)
@@ -377,7 +388,7 @@ Protocol: 2.00+
377 388
378 This field can be modified for two purposes: 389 This field can be modified for two purposes:
379 390
380 1. as a boot loader hook (see separate chapter.) 391 1. as a boot loader hook (see ADVANCED BOOT LOADER HOOKS below.)
381 392
382 2. if a bootloader which does not install a hook loads a 393 2. if a bootloader which does not install a hook loads a
383 relocatable kernel at a nonstandard address it will have to modify 394 relocatable kernel at a nonstandard address it will have to modify
@@ -715,7 +726,7 @@ switched off, especially if the loaded kernel has the floppy driver as
715a demand-loaded module! 726a demand-loaded module!
716 727
717 728
718**** ADVANCED BOOT TIME HOOKS 729**** ADVANCED BOOT LOADER HOOKS
719 730
720If the boot loader runs in a particularly hostile environment (such as 731If the boot loader runs in a particularly hostile environment (such as
721LOADLIN, which runs under DOS) it may be impossible to follow the 732LOADLIN, which runs under DOS) it may be impossible to follow the
@@ -740,4 +751,5 @@ IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and
740 set them up to BOOT_DS (0x18) yourself. 751 set them up to BOOT_DS (0x18) yourself.
741 752
742 After completing your hook, you should jump to the address 753 After completing your hook, you should jump to the address
743 that was in this field before your boot loader overwrote it. 754 that was in this field before your boot loader overwrote it
755 (relocated, if appropriate.)
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt
index 15f1b35deb34..d3dc505104da 100644
--- a/Documentation/initrd.txt
+++ b/Documentation/initrd.txt
@@ -27,16 +27,20 @@ When using initrd, the system typically boots as follows:
27 1) the boot loader loads the kernel and the initial RAM disk 27 1) the boot loader loads the kernel and the initial RAM disk
28 2) the kernel converts initrd into a "normal" RAM disk and 28 2) the kernel converts initrd into a "normal" RAM disk and
29 frees the memory used by initrd 29 frees the memory used by initrd
30 3) initrd is mounted read-write as root 30 3) if the root device is not /dev/ram0, the old (deprecated)
31 4) /linuxrc is executed (this can be any valid executable, including 31 change_root procedure is followed. see the "Obsolete root change
32 mechanism" section below.
33 4) root device is mounted. if it is /dev/ram0, the initrd image is
34 then mounted as root
35 5) /sbin/init is executed (this can be any valid executable, including
32 shell scripts; it is run with uid 0 and can do basically everything 36 shell scripts; it is run with uid 0 and can do basically everything
33 init can do) 37 init can do).
34 5) linuxrc mounts the "real" root file system 38 6) init mounts the "real" root file system
35 6) linuxrc places the root file system at the root directory using the 39 7) init places the root file system at the root directory using the
36 pivot_root system call 40 pivot_root system call
37 7) the usual boot sequence (e.g. invocation of /sbin/init) is performed 41 8) init execs the /sbin/init on the new root filesystem, performing
38 on the root file system 42 the usual boot sequence
39 8) the initrd file system is removed 43 9) the initrd file system is removed
40 44
41Note that changing the root directory does not involve unmounting it. 45Note that changing the root directory does not involve unmounting it.
42It is therefore possible to leave processes running on initrd during that 46It is therefore possible to leave processes running on initrd during that
@@ -70,7 +74,7 @@ initrd adds the following new options:
70 root=/dev/ram0 74 root=/dev/ram0
71 75
72 initrd is mounted as root, and the normal boot procedure is followed, 76 initrd is mounted as root, and the normal boot procedure is followed,
73 with the RAM disk still mounted as root. 77 with the RAM disk mounted as root.
74 78
75Compressed cpio images 79Compressed cpio images
76---------------------- 80----------------------
@@ -137,11 +141,11 @@ We'll describe the loopback device method:
137 # mkdir /mnt/dev 141 # mkdir /mnt/dev
138 # mknod /mnt/dev/console c 5 1 142 # mknod /mnt/dev/console c 5 1
139 5) copy all the files that are needed to properly use the initrd 143 5) copy all the files that are needed to properly use the initrd
140 environment. Don't forget the most important file, /linuxrc 144 environment. Don't forget the most important file, /sbin/init
141 Note that /linuxrc's permissions must include "x" (execute). 145 Note that /sbin/init's permissions must include "x" (execute).
142 6) correct operation the initrd environment can frequently be tested 146 6) correct operation the initrd environment can frequently be tested
143 even without rebooting with the command 147 even without rebooting with the command
144 # chroot /mnt /linuxrc 148 # chroot /mnt /sbin/init
145 This is of course limited to initrds that do not interfere with the 149 This is of course limited to initrds that do not interfere with the
146 general system state (e.g. by reconfiguring network interfaces, 150 general system state (e.g. by reconfiguring network interfaces,
147 overwriting mounted devices, trying to start already running demons, 151 overwriting mounted devices, trying to start already running demons,
@@ -154,7 +158,7 @@ We'll describe the loopback device method:
154 # gzip -9 initrd 158 # gzip -9 initrd
155 159
156For experimenting with initrd, you may want to take a rescue floppy and 160For experimenting with initrd, you may want to take a rescue floppy and
157only add a symbolic link from /linuxrc to /bin/sh. Alternatively, you 161only add a symbolic link from /sbin/init to /bin/sh. Alternatively, you
158can try the experimental newlib environment [2] to create a small 162can try the experimental newlib environment [2] to create a small
159initrd. 163initrd.
160 164
@@ -163,15 +167,14 @@ boot loaders support initrd. Since the boot process is still compatible
163with an older mechanism, the following boot command line parameters 167with an older mechanism, the following boot command line parameters
164have to be given: 168have to be given:
165 169
166 root=/dev/ram0 init=/linuxrc rw 170 root=/dev/ram0 rw
167 171
168(rw is only necessary if writing to the initrd file system.) 172(rw is only necessary if writing to the initrd file system.)
169 173
170With LOADLIN, you simply execute 174With LOADLIN, you simply execute
171 175
172 LOADLIN <kernel> initrd=<disk_image> 176 LOADLIN <kernel> initrd=<disk_image>
173e.g. LOADLIN C:\LINUX\BZIMAGE initrd=C:\LINUX\INITRD.GZ root=/dev/ram0 177e.g. LOADLIN C:\LINUX\BZIMAGE initrd=C:\LINUX\INITRD.GZ root=/dev/ram0 rw
174 init=/linuxrc rw
175 178
176With LILO, you add the option INITRD=<path> to either the global section 179With LILO, you add the option INITRD=<path> to either the global section
177or to the section of the respective kernel in /etc/lilo.conf, and pass 180or to the section of the respective kernel in /etc/lilo.conf, and pass
@@ -179,7 +182,7 @@ the options using APPEND, e.g.
179 182
180 image = /bzImage 183 image = /bzImage
181 initrd = /boot/initrd.gz 184 initrd = /boot/initrd.gz
182 append = "root=/dev/ram0 init=/linuxrc rw" 185 append = "root=/dev/ram0 rw"
183 186
184and run /sbin/lilo 187and run /sbin/lilo
185 188
@@ -191,7 +194,7 @@ Now you can boot and enjoy using initrd.
191Changing the root device 194Changing the root device
192------------------------ 195------------------------
193 196
194When finished with its duties, linuxrc typically changes the root device 197When finished with its duties, init typically changes the root device
195and proceeds with starting the Linux system on the "real" root device. 198and proceeds with starting the Linux system on the "real" root device.
196 199
197The procedure involves the following steps: 200The procedure involves the following steps:
@@ -217,7 +220,7 @@ must exist before calling pivot_root. Example:
217# mkdir initrd 220# mkdir initrd
218# pivot_root . initrd 221# pivot_root . initrd
219 222
220Now, the linuxrc process may still access the old root via its 223Now, the init process may still access the old root via its
221executable, shared libraries, standard input/output/error, and its 224executable, shared libraries, standard input/output/error, and its
222current root directory. All these references are dropped by the 225current root directory. All these references are dropped by the
223following command: 226following command:
@@ -249,10 +252,6 @@ disk can be freed:
249It is also possible to use initrd with an NFS-mounted root, see the 252It is also possible to use initrd with an NFS-mounted root, see the
250pivot_root(8) man page for details. 253pivot_root(8) man page for details.
251 254
252Note: if linuxrc or any program exec'ed from it terminates for some
253reason, the old change_root mechanism is invoked (see section "Obsolete
254root change mechanism").
255
256 255
257Usage scenarios 256Usage scenarios
258--------------- 257---------------
@@ -264,15 +263,15 @@ as follows:
264 1) system boots from floppy or other media with a minimal kernel 263 1) system boots from floppy or other media with a minimal kernel
265 (e.g. support for RAM disks, initrd, a.out, and the Ext2 FS) and 264 (e.g. support for RAM disks, initrd, a.out, and the Ext2 FS) and
266 loads initrd 265 loads initrd
267 2) /linuxrc determines what is needed to (1) mount the "real" root FS 266 2) /sbin/init determines what is needed to (1) mount the "real" root FS
268 (i.e. device type, device drivers, file system) and (2) the 267 (i.e. device type, device drivers, file system) and (2) the
269 distribution media (e.g. CD-ROM, network, tape, ...). This can be 268 distribution media (e.g. CD-ROM, network, tape, ...). This can be
270 done by asking the user, by auto-probing, or by using a hybrid 269 done by asking the user, by auto-probing, or by using a hybrid
271 approach. 270 approach.
272 3) /linuxrc loads the necessary kernel modules 271 3) /sbin/init loads the necessary kernel modules
273 4) /linuxrc creates and populates the root file system (this doesn't 272 4) /sbin/init creates and populates the root file system (this doesn't
274 have to be a very usable system yet) 273 have to be a very usable system yet)
275 5) /linuxrc invokes pivot_root to change the root file system and 274 5) /sbin/init invokes pivot_root to change the root file system and
276 execs - via chroot - a program that continues the installation 275 execs - via chroot - a program that continues the installation
277 6) the boot loader is installed 276 6) the boot loader is installed
278 7) the boot loader is configured to load an initrd with the set of 277 7) the boot loader is configured to load an initrd with the set of
@@ -291,7 +290,7 @@ different hardware configurations in a single administrative domain. In
291such cases, it is desirable to generate only a small set of kernels 290such cases, it is desirable to generate only a small set of kernels
292(ideally only one) and to keep the system-specific part of configuration 291(ideally only one) and to keep the system-specific part of configuration
293information as small as possible. In this case, a common initrd could be 292information as small as possible. In this case, a common initrd could be
294generated with all the necessary modules. Then, only /linuxrc or a file 293generated with all the necessary modules. Then, only /sbin/init or a file
295read by it would have to be different. 294read by it would have to be different.
296 295
297A third scenario are more convenient recovery disks, because information 296A third scenario are more convenient recovery disks, because information
@@ -337,6 +336,25 @@ This old, deprecated mechanism is commonly called "change_root", while
337the new, supported mechanism is called "pivot_root". 336the new, supported mechanism is called "pivot_root".
338 337
339 338
339Mixed change_root and pivot_root mechanism
340------------------------------------------
341
342In case you did not want to use root=/dev/ram0 to trig the pivot_root mechanism,
343you may create both /linuxrc and /sbin/init in your initrd image.
344
345/linuxrc would contain only the following:
346
347#! /bin/sh
348mount -n -t proc proc /proc
349echo 0x0100 >/proc/sys/kernel/real-root-dev
350umount -n /proc
351
352Once linuxrc exited, the kernel would mount again your initrd as root,
353this time executing /sbin/init. Again, it would be duty of this init
354to build the right environment (maybe using the root= device passed on
355the cmdline) before the final execution of the real /sbin/init.
356
357
340Resources 358Resources
341--------- 359---------
342 360
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 09220a1e22d9..aae2282600ca 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -396,6 +396,26 @@ and is between 256 and 4096 characters. It is defined in the file
396 clocksource is not available, it defaults to PIT. 396 clocksource is not available, it defaults to PIT.
397 Format: { pit | tsc | cyclone | pmtmr } 397 Format: { pit | tsc | cyclone | pmtmr }
398 398
399 clocksource= [GENERIC_TIME] Override the default clocksource
400 Format: <string>
401 Override the default clocksource and use the clocksource
402 with the name specified.
403 Some clocksource names to choose from, depending on
404 the platform:
405 [all] jiffies (this is the base, fallback clocksource)
406 [ACPI] acpi_pm
407 [ARM] imx_timer1,OSTS,netx_timer,mpu_timer2,
408 pxa_timer,timer3,32k_counter,timer0_1
409 [AVR32] avr32
410 [IA-32] pit,hpet,tsc,vmi-timer;
411 scx200_hrt on Geode; cyclone on IBM x440
412 [MIPS] MIPS
413 [PARISC] cr16
414 [S390] tod
415 [SH] SuperH
416 [SPARC64] tick
417 [X86-64] hpet,tsc
418
399 code_bytes [IA32] How many bytes of object code to print in an 419 code_bytes [IA32] How many bytes of object code to print in an
400 oops report. 420 oops report.
401 Range: 0 - 8192 421 Range: 0 - 8192
@@ -1807,10 +1827,6 @@ and is between 256 and 4096 characters. It is defined in the file
1807 1827
1808 time Show timing data prefixed to each printk message line 1828 time Show timing data prefixed to each printk message line
1809 1829
1810 clocksource= [GENERIC_TIME] Override the default clocksource
1811 Override the default clocksource and use the clocksource
1812 with the name specified.
1813
1814 tipar.timeout= [HW,PPT] 1830 tipar.timeout= [HW,PPT]
1815 Set communications timeout in tenths of a second 1831 Set communications timeout in tenths of a second
1816 (default 15). 1832 (default 15).
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 58408dd023c7..650657c54733 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -24,7 +24,7 @@ Contents:
24 (*) Explicit kernel barriers. 24 (*) Explicit kernel barriers.
25 25
26 - Compiler barrier. 26 - Compiler barrier.
27 - The CPU memory barriers. 27 - CPU memory barriers.
28 - MMIO write barrier. 28 - MMIO write barrier.
29 29
30 (*) Implicit kernel memory barriers. 30 (*) Implicit kernel memory barriers.
@@ -265,7 +265,7 @@ Memory barriers are such interventions. They impose a perceived partial
265ordering over the memory operations on either side of the barrier. 265ordering over the memory operations on either side of the barrier.
266 266
267Such enforcement is important because the CPUs and other devices in a system 267Such enforcement is important because the CPUs and other devices in a system
268can use a variety of tricks to improve performance - including reordering, 268can use a variety of tricks to improve performance, including reordering,
269deferral and combination of memory operations; speculative loads; speculative 269deferral and combination of memory operations; speculative loads; speculative
270branch prediction and various types of caching. Memory barriers are used to 270branch prediction and various types of caching. Memory barriers are used to
271override or suppress these tricks, allowing the code to sanely control the 271override or suppress these tricks, allowing the code to sanely control the
@@ -457,7 +457,7 @@ sequence, Q must be either &A or &B, and that:
457 (Q == &A) implies (D == 1) 457 (Q == &A) implies (D == 1)
458 (Q == &B) implies (D == 4) 458 (Q == &B) implies (D == 4)
459 459
460But! CPU 2's perception of P may be updated _before_ its perception of B, thus 460But! CPU 2's perception of P may be updated _before_ its perception of B, thus
461leading to the following situation: 461leading to the following situation:
462 462
463 (Q == &B) and (D == 2) ???? 463 (Q == &B) and (D == 2) ????
@@ -573,7 +573,7 @@ Basically, the read barrier always has to be there, even though it can be of
573the "weaker" type. 573the "weaker" type.
574 574
575[!] Note that the stores before the write barrier would normally be expected to 575[!] Note that the stores before the write barrier would normally be expected to
576match the loads after the read barrier or data dependency barrier, and vice 576match the loads after the read barrier or the data dependency barrier, and vice
577versa: 577versa:
578 578
579 CPU 1 CPU 2 579 CPU 1 CPU 2
@@ -588,7 +588,7 @@ versa:
588EXAMPLES OF MEMORY BARRIER SEQUENCES 588EXAMPLES OF MEMORY BARRIER SEQUENCES
589------------------------------------ 589------------------------------------
590 590
591Firstly, write barriers act as a partial orderings on store operations. 591Firstly, write barriers act as partial orderings on store operations.
592Consider the following sequence of events: 592Consider the following sequence of events:
593 593
594 CPU 1 594 CPU 1
@@ -608,15 +608,15 @@ STORE B, STORE C } all occurring before the unordered set of { STORE D, STORE E
608 +-------+ : : 608 +-------+ : :
609 | | +------+ 609 | | +------+
610 | |------>| C=3 | } /\ 610 | |------>| C=3 | } /\
611 | | : +------+ }----- \ -----> Events perceptible 611 | | : +------+ }----- \ -----> Events perceptible to
612 | | : | A=1 | } \/ to rest of system 612 | | : | A=1 | } \/ the rest of the system
613 | | : +------+ } 613 | | : +------+ }
614 | CPU 1 | : | B=2 | } 614 | CPU 1 | : | B=2 | }
615 | | +------+ } 615 | | +------+ }
616 | | wwwwwwwwwwwwwwww } <--- At this point the write barrier 616 | | wwwwwwwwwwwwwwww } <--- At this point the write barrier
617 | | +------+ } requires all stores prior to the 617 | | +------+ } requires all stores prior to the
618 | | : | E=5 | } barrier to be committed before 618 | | : | E=5 | } barrier to be committed before
619 | | : +------+ } further stores may be take place. 619 | | : +------+ } further stores may take place
620 | |------>| D=4 | } 620 | |------>| D=4 | }
621 | | +------+ 621 | | +------+
622 +-------+ : : 622 +-------+ : :
@@ -626,7 +626,7 @@ STORE B, STORE C } all occurring before the unordered set of { STORE D, STORE E
626 V 626 V
627 627
628 628
629Secondly, data dependency barriers act as a partial orderings on data-dependent 629Secondly, data dependency barriers act as partial orderings on data-dependent
630loads. Consider the following sequence of events: 630loads. Consider the following sequence of events:
631 631
632 CPU 1 CPU 2 632 CPU 1 CPU 2
@@ -975,7 +975,7 @@ compiler from moving the memory accesses either side of it to the other side:
975 975
976 barrier(); 976 barrier();
977 977
978This a general barrier - lesser varieties of compiler barrier do not exist. 978This is a general barrier - lesser varieties of compiler barrier do not exist.
979 979
980The compiler barrier has no direct effect on the CPU, which may then reorder 980The compiler barrier has no direct effect on the CPU, which may then reorder
981things however it wishes. 981things however it wishes.
@@ -997,7 +997,7 @@ The Linux kernel has eight basic CPU memory barriers:
997All CPU memory barriers unconditionally imply compiler barriers. 997All CPU memory barriers unconditionally imply compiler barriers.
998 998
999SMP memory barriers are reduced to compiler barriers on uniprocessor compiled 999SMP memory barriers are reduced to compiler barriers on uniprocessor compiled
1000systems because it is assumed that a CPU will be appear to be self-consistent, 1000systems because it is assumed that a CPU will appear to be self-consistent,
1001and will order overlapping accesses correctly with respect to itself. 1001and will order overlapping accesses correctly with respect to itself.
1002 1002
1003[!] Note that SMP memory barriers _must_ be used to control the ordering of 1003[!] Note that SMP memory barriers _must_ be used to control the ordering of
@@ -1146,9 +1146,9 @@ for each construct. These operations all imply certain barriers:
1146Therefore, from (1), (2) and (4) an UNLOCK followed by an unconditional LOCK is 1146Therefore, from (1), (2) and (4) an UNLOCK followed by an unconditional LOCK is
1147equivalent to a full barrier, but a LOCK followed by an UNLOCK is not. 1147equivalent to a full barrier, but a LOCK followed by an UNLOCK is not.
1148 1148
1149[!] Note: one of the consequence of LOCKs and UNLOCKs being only one-way 1149[!] Note: one of the consequences of LOCKs and UNLOCKs being only one-way
1150 barriers is that the effects instructions outside of a critical section may 1150 barriers is that the effects of instructions outside of a critical section
1151 seep into the inside of the critical section. 1151 may seep into the inside of the critical section.
1152 1152
1153A LOCK followed by an UNLOCK may not be assumed to be full memory barrier 1153A LOCK followed by an UNLOCK may not be assumed to be full memory barrier
1154because it is possible for an access preceding the LOCK to happen after the 1154because it is possible for an access preceding the LOCK to happen after the
@@ -1239,7 +1239,7 @@ three CPUs; then should the following sequence of events occur:
1239 UNLOCK M UNLOCK Q 1239 UNLOCK M UNLOCK Q
1240 *D = d; *H = h; 1240 *D = d; *H = h;
1241 1241
1242Then there is no guarantee as to what order CPU #3 will see the accesses to *A 1242Then there is no guarantee as to what order CPU 3 will see the accesses to *A
1243through *H occur in, other than the constraints imposed by the separate locks 1243through *H occur in, other than the constraints imposed by the separate locks
1244on the separate CPUs. It might, for example, see: 1244on the separate CPUs. It might, for example, see:
1245 1245
@@ -1269,12 +1269,12 @@ However, if the following occurs:
1269 UNLOCK M [2] 1269 UNLOCK M [2]
1270 *H = h; 1270 *H = h;
1271 1271
1272CPU #3 might see: 1272CPU 3 might see:
1273 1273
1274 *E, LOCK M [1], *C, *B, *A, UNLOCK M [1], 1274 *E, LOCK M [1], *C, *B, *A, UNLOCK M [1],
1275 LOCK M [2], *H, *F, *G, UNLOCK M [2], *D 1275 LOCK M [2], *H, *F, *G, UNLOCK M [2], *D
1276 1276
1277But assuming CPU #1 gets the lock first, it won't see any of: 1277But assuming CPU 1 gets the lock first, CPU 3 won't see any of:
1278 1278
1279 *B, *C, *D, *F, *G or *H preceding LOCK M [1] 1279 *B, *C, *D, *F, *G or *H preceding LOCK M [1]
1280 *A, *B or *C following UNLOCK M [1] 1280 *A, *B or *C following UNLOCK M [1]
@@ -1327,12 +1327,12 @@ spinlock, for example:
1327 mmiowb(); 1327 mmiowb();
1328 spin_unlock(Q); 1328 spin_unlock(Q);
1329 1329
1330this will ensure that the two stores issued on CPU #1 appear at the PCI bridge 1330this will ensure that the two stores issued on CPU 1 appear at the PCI bridge
1331before either of the stores issued on CPU #2. 1331before either of the stores issued on CPU 2.
1332 1332
1333 1333
1334Furthermore, following a store by a load to the same device obviates the need 1334Furthermore, following a store by a load from the same device obviates the need
1335for an mmiowb(), because the load forces the store to complete before the load 1335for the mmiowb(), because the load forces the store to complete before the load
1336is performed: 1336is performed:
1337 1337
1338 CPU 1 CPU 2 1338 CPU 1 CPU 2
@@ -1363,7 +1363,7 @@ circumstances in which reordering definitely _could_ be a problem:
1363 1363
1364 (*) Atomic operations. 1364 (*) Atomic operations.
1365 1365
1366 (*) Accessing devices (I/O). 1366 (*) Accessing devices.
1367 1367
1368 (*) Interrupts. 1368 (*) Interrupts.
1369 1369
@@ -1399,7 +1399,7 @@ To wake up a particular waiter, the up_read() or up_write() functions have to:
1399 (1) read the next pointer from this waiter's record to know as to where the 1399 (1) read the next pointer from this waiter's record to know as to where the
1400 next waiter record is; 1400 next waiter record is;
1401 1401
1402 (4) read the pointer to the waiter's task structure; 1402 (2) read the pointer to the waiter's task structure;
1403 1403
1404 (3) clear the task pointer to tell the waiter it has been given the semaphore; 1404 (3) clear the task pointer to tell the waiter it has been given the semaphore;
1405 1405
@@ -1407,7 +1407,7 @@ To wake up a particular waiter, the up_read() or up_write() functions have to:
1407 1407
1408 (5) release the reference held on the waiter's task struct. 1408 (5) release the reference held on the waiter's task struct.
1409 1409
1410In otherwords, it has to perform this sequence of events: 1410In other words, it has to perform this sequence of events:
1411 1411
1412 LOAD waiter->list.next; 1412 LOAD waiter->list.next;
1413 LOAD waiter->task; 1413 LOAD waiter->task;
@@ -1502,7 +1502,7 @@ operations and adjusting reference counters towards object destruction, and as
1502such the implicit memory barrier effects are necessary. 1502such the implicit memory barrier effects are necessary.
1503 1503
1504 1504
1505The following operation are potential problems as they do _not_ imply memory 1505The following operations are potential problems as they do _not_ imply memory
1506barriers, but might be used for implementing such things as UNLOCK-class 1506barriers, but might be used for implementing such things as UNLOCK-class
1507operations: 1507operations:
1508 1508
@@ -1517,7 +1517,7 @@ With these the appropriate explicit memory barrier should be used if necessary
1517 1517
1518The following also do _not_ imply memory barriers, and so may require explicit 1518The following also do _not_ imply memory barriers, and so may require explicit
1519memory barriers under some circumstances (smp_mb__before_atomic_dec() for 1519memory barriers under some circumstances (smp_mb__before_atomic_dec() for
1520instance)): 1520instance):
1521 1521
1522 atomic_add(); 1522 atomic_add();
1523 atomic_sub(); 1523 atomic_sub();
@@ -1641,8 +1641,8 @@ functions:
1641 indeed have special I/O space access cycles and instructions, but many 1641 indeed have special I/O space access cycles and instructions, but many
1642 CPUs don't have such a concept. 1642 CPUs don't have such a concept.
1643 1643
1644 The PCI bus, amongst others, defines an I/O space concept - which on such 1644 The PCI bus, amongst others, defines an I/O space concept which - on such
1645 CPUs as i386 and x86_64 cpus readily maps to the CPU's concept of I/O 1645 CPUs as i386 and x86_64 - readily maps to the CPU's concept of I/O
1646 space. However, it may also be mapped as a virtual I/O space in the CPU's 1646 space. However, it may also be mapped as a virtual I/O space in the CPU's
1647 memory map, particularly on those CPUs that don't support alternate I/O 1647 memory map, particularly on those CPUs that don't support alternate I/O
1648 spaces. 1648 spaces.
@@ -1664,7 +1664,7 @@ functions:
1664 i386 architecture machines, for example, this is controlled by way of the 1664 i386 architecture machines, for example, this is controlled by way of the
1665 MTRR registers. 1665 MTRR registers.
1666 1666
1667 Ordinarily, these will be guaranteed to be fully ordered and uncombined,, 1667 Ordinarily, these will be guaranteed to be fully ordered and uncombined,
1668 provided they're not accessing a prefetchable device. 1668 provided they're not accessing a prefetchable device.
1669 1669
1670 However, intermediary hardware (such as a PCI bridge) may indulge in 1670 However, intermediary hardware (such as a PCI bridge) may indulge in
@@ -1689,7 +1689,7 @@ functions:
1689 1689
1690 (*) ioreadX(), iowriteX() 1690 (*) ioreadX(), iowriteX()
1691 1691
1692 These will perform as appropriate for the type of access they're actually 1692 These will perform appropriately for the type of access they're actually
1693 doing, be it inX()/outX() or readX()/writeX(). 1693 doing, be it inX()/outX() or readX()/writeX().
1694 1694
1695 1695
@@ -1705,7 +1705,7 @@ of arch-specific code.
1705 1705
1706This means that it must be considered that the CPU will execute its instruction 1706This means that it must be considered that the CPU will execute its instruction
1707stream in any order it feels like - or even in parallel - provided that if an 1707stream in any order it feels like - or even in parallel - provided that if an
1708instruction in the stream depends on the an earlier instruction, then that 1708instruction in the stream depends on an earlier instruction, then that
1709earlier instruction must be sufficiently complete[*] before the later 1709earlier instruction must be sufficiently complete[*] before the later
1710instruction may proceed; in other words: provided that the appearance of 1710instruction may proceed; in other words: provided that the appearance of
1711causality is maintained. 1711causality is maintained.
@@ -1795,8 +1795,8 @@ eventually become visible on all CPUs, there's no guarantee that they will
1795become apparent in the same order on those other CPUs. 1795become apparent in the same order on those other CPUs.
1796 1796
1797 1797
1798Consider dealing with a system that has pair of CPUs (1 & 2), each of which has 1798Consider dealing with a system that has a pair of CPUs (1 & 2), each of which
1799a pair of parallel data caches (CPU 1 has A/B, and CPU 2 has C/D): 1799has a pair of parallel data caches (CPU 1 has A/B, and CPU 2 has C/D):
1800 1800
1801 : 1801 :
1802 : +--------+ 1802 : +--------+
@@ -1835,7 +1835,7 @@ Imagine the system has the following properties:
1835 1835
1836 (*) the coherency queue is not flushed by normal loads to lines already 1836 (*) the coherency queue is not flushed by normal loads to lines already
1837 present in the cache, even though the contents of the queue may 1837 present in the cache, even though the contents of the queue may
1838 potentially effect those loads. 1838 potentially affect those loads.
1839 1839
1840Imagine, then, that two writes are made on the first CPU, with a write barrier 1840Imagine, then, that two writes are made on the first CPU, with a write barrier
1841between them to guarantee that they will appear to reach that CPU's caches in 1841between them to guarantee that they will appear to reach that CPU's caches in
@@ -1845,7 +1845,7 @@ the requisite order:
1845 =============== =============== ======================================= 1845 =============== =============== =======================================
1846 u == 0, v == 1 and p == &u, q == &u 1846 u == 0, v == 1 and p == &u, q == &u
1847 v = 2; 1847 v = 2;
1848 smp_wmb(); Make sure change to v visible before 1848 smp_wmb(); Make sure change to v is visible before
1849 change to p 1849 change to p
1850 <A:modify v=2> v is now in cache A exclusively 1850 <A:modify v=2> v is now in cache A exclusively
1851 p = &v; 1851 p = &v;
@@ -1853,7 +1853,7 @@ the requisite order:
1853 1853
1854The write memory barrier forces the other CPUs in the system to perceive that 1854The write memory barrier forces the other CPUs in the system to perceive that
1855the local CPU's caches have apparently been updated in the correct order. But 1855the local CPU's caches have apparently been updated in the correct order. But
1856now imagine that the second CPU that wants to read those values: 1856now imagine that the second CPU wants to read those values:
1857 1857
1858 CPU 1 CPU 2 COMMENT 1858 CPU 1 CPU 2 COMMENT
1859 =============== =============== ======================================= 1859 =============== =============== =======================================
@@ -1861,7 +1861,7 @@ now imagine that the second CPU that wants to read those values:
1861 q = p; 1861 q = p;
1862 x = *q; 1862 x = *q;
1863 1863
1864The above pair of reads may then fail to happen in expected order, as the 1864The above pair of reads may then fail to happen in the expected order, as the
1865cacheline holding p may get updated in one of the second CPU's caches whilst 1865cacheline holding p may get updated in one of the second CPU's caches whilst
1866the update to the cacheline holding v is delayed in the other of the second 1866the update to the cacheline holding v is delayed in the other of the second
1867CPU's caches by some other cache event: 1867CPU's caches by some other cache event:
@@ -1916,7 +1916,7 @@ access depends on a read, not all do, so it may not be relied on.
1916 1916
1917Other CPUs may also have split caches, but must coordinate between the various 1917Other CPUs may also have split caches, but must coordinate between the various
1918cachelets for normal memory accesses. The semantics of the Alpha removes the 1918cachelets for normal memory accesses. The semantics of the Alpha removes the
1919need for coordination in absence of memory barriers. 1919need for coordination in the absence of memory barriers.
1920 1920
1921 1921
1922CACHE COHERENCY VS DMA 1922CACHE COHERENCY VS DMA
@@ -1931,10 +1931,10 @@ invalidate them as well).
1931 1931
1932In addition, the data DMA'd to RAM by a device may be overwritten by dirty 1932In addition, the data DMA'd to RAM by a device may be overwritten by dirty
1933cache lines being written back to RAM from a CPU's cache after the device has 1933cache lines being written back to RAM from a CPU's cache after the device has
1934installed its own data, or cache lines simply present in a CPUs cache may 1934installed its own data, or cache lines present in the CPU's cache may simply
1935simply obscure the fact that RAM has been updated, until at such time as the 1935obscure the fact that RAM has been updated, until at such time as the cacheline
1936cacheline is discarded from the CPU's cache and reloaded. To deal with this, 1936is discarded from the CPU's cache and reloaded. To deal with this, the
1937the appropriate part of the kernel must invalidate the overlapping bits of the 1937appropriate part of the kernel must invalidate the overlapping bits of the
1938cache on each CPU. 1938cache on each CPU.
1939 1939
1940See Documentation/cachetlb.txt for more information on cache management. 1940See Documentation/cachetlb.txt for more information on cache management.
@@ -1944,7 +1944,7 @@ CACHE COHERENCY VS MMIO
1944----------------------- 1944-----------------------
1945 1945
1946Memory mapped I/O usually takes place through memory locations that are part of 1946Memory mapped I/O usually takes place through memory locations that are part of
1947a window in the CPU's memory space that have different properties assigned than 1947a window in the CPU's memory space that has different properties assigned than
1948the usual RAM directed window. 1948the usual RAM directed window.
1949 1949
1950Amongst these properties is usually the fact that such accesses bypass the 1950Amongst these properties is usually the fact that such accesses bypass the
@@ -1960,7 +1960,7 @@ THE THINGS CPUS GET UP TO
1960========================= 1960=========================
1961 1961
1962A programmer might take it for granted that the CPU will perform memory 1962A programmer might take it for granted that the CPU will perform memory
1963operations in exactly the order specified, so that if a CPU is, for example, 1963operations in exactly the order specified, so that if the CPU is, for example,
1964given the following piece of code to execute: 1964given the following piece of code to execute:
1965 1965
1966 a = *A; 1966 a = *A;
@@ -1969,7 +1969,7 @@ given the following piece of code to execute:
1969 d = *D; 1969 d = *D;
1970 *E = e; 1970 *E = e;
1971 1971
1972They would then expect that the CPU will complete the memory operation for each 1972they would then expect that the CPU will complete the memory operation for each
1973instruction before moving on to the next one, leading to a definite sequence of 1973instruction before moving on to the next one, leading to a definite sequence of
1974operations as seen by external observers in the system: 1974operations as seen by external observers in the system:
1975 1975
@@ -1986,8 +1986,8 @@ assumption doesn't hold because:
1986 (*) loads may be done speculatively, and the result discarded should it prove 1986 (*) loads may be done speculatively, and the result discarded should it prove
1987 to have been unnecessary; 1987 to have been unnecessary;
1988 1988
1989 (*) loads may be done speculatively, leading to the result having being 1989 (*) loads may be done speculatively, leading to the result having been fetched
1990 fetched at the wrong time in the expected sequence of events; 1990 at the wrong time in the expected sequence of events;
1991 1991
1992 (*) the order of the memory accesses may be rearranged to promote better use 1992 (*) the order of the memory accesses may be rearranged to promote better use
1993 of the CPU buses and caches; 1993 of the CPU buses and caches;
@@ -2069,12 +2069,12 @@ AND THEN THERE'S THE ALPHA
2069 2069
2070The DEC Alpha CPU is one of the most relaxed CPUs there is. Not only that, 2070The DEC Alpha CPU is one of the most relaxed CPUs there is. Not only that,
2071some versions of the Alpha CPU have a split data cache, permitting them to have 2071some versions of the Alpha CPU have a split data cache, permitting them to have
2072two semantically related cache lines updating at separate times. This is where 2072two semantically-related cache lines updated at separate times. This is where
2073the data dependency barrier really becomes necessary as this synchronises both 2073the data dependency barrier really becomes necessary as this synchronises both
2074caches with the memory coherence system, thus making it seem like pointer 2074caches with the memory coherence system, thus making it seem like pointer
2075changes vs new data occur in the right order. 2075changes vs new data occur in the right order.
2076 2076
2077The Alpha defines the Linux's kernel's memory barrier model. 2077The Alpha defines the Linux kernel's memory barrier model.
2078 2078
2079See the subsection on "Cache Coherency" above. 2079See the subsection on "Cache Coherency" above.
2080 2080
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index 795fbb48ffa7..76ea6c837be5 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -1,26 +1,30 @@
1Overview of Linux kernel SPI support 1Overview of Linux kernel SPI support
2==================================== 2====================================
3 3
402-Dec-2005 421-May-2007
5 5
6What is SPI? 6What is SPI?
7------------ 7------------
8The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial 8The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial
9link used to connect microcontrollers to sensors, memory, and peripherals. 9link used to connect microcontrollers to sensors, memory, and peripherals.
10It's a simple "de facto" standard, not complicated enough to acquire a
11standardization body. SPI uses a master/slave configuration.
10 12
11The three signal wires hold a clock (SCK, often on the order of 10 MHz), 13The three signal wires hold a clock (SCK, often on the order of 10 MHz),
12and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In, 14and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In,
13Slave Out" (MISO) signals. (Other names are also used.) There are four 15Slave Out" (MISO) signals. (Other names are also used.) There are four
14clocking modes through which data is exchanged; mode-0 and mode-3 are most 16clocking modes through which data is exchanged; mode-0 and mode-3 are most
15commonly used. Each clock cycle shifts data out and data in; the clock 17commonly used. Each clock cycle shifts data out and data in; the clock
16doesn't cycle except when there is data to shift. 18doesn't cycle except when there is a data bit to shift. Not all data bits
19are used though; not every protocol uses those full duplex capabilities.
17 20
18SPI masters may use a "chip select" line to activate a given SPI slave 21SPI masters use a fourth "chip select" line to activate a given SPI slave
19device, so those three signal wires may be connected to several chips 22device, so those three signal wires may be connected to several chips
20in parallel. All SPI slaves support chipselects. Some devices have 23in parallel. All SPI slaves support chipselects; they are usually active
24low signals, labeled nCSx for slave 'x' (e.g. nCS0). Some devices have
21other signals, often including an interrupt to the master. 25other signals, often including an interrupt to the master.
22 26
23Unlike serial busses like USB or SMBUS, even low level protocols for 27Unlike serial busses like USB or SMBus, even low level protocols for
24SPI slave functions are usually not interoperable between vendors 28SPI slave functions are usually not interoperable between vendors
25(except for commodities like SPI memory chips). 29(except for commodities like SPI memory chips).
26 30
@@ -33,6 +37,11 @@ SPI slave functions are usually not interoperable between vendors
33 - Some devices may use eight bit words. Others may different word 37 - Some devices may use eight bit words. Others may different word
34 lengths, such as streams of 12-bit or 20-bit digital samples. 38 lengths, such as streams of 12-bit or 20-bit digital samples.
35 39
40 - Words are usually sent with their most significant bit (MSB) first,
41 but sometimes the least significant bit (LSB) goes first instead.
42
43 - Sometimes SPI is used to daisy-chain devices, like shift registers.
44
36In the same way, SPI slaves will only rarely support any kind of automatic 45In the same way, SPI slaves will only rarely support any kind of automatic
37discovery/enumeration protocol. The tree of slave devices accessible from 46discovery/enumeration protocol. The tree of slave devices accessible from
38a given SPI master will normally be set up manually, with configuration 47a given SPI master will normally be set up manually, with configuration
@@ -44,6 +53,14 @@ half-duplex SPI, for request/response protocols), SSP ("Synchronous
44Serial Protocol"), PSP ("Programmable Serial Protocol"), and other 53Serial Protocol"), PSP ("Programmable Serial Protocol"), and other
45related protocols. 54related protocols.
46 55
56Some chips eliminate a signal line by combining MOSI and MISO, and
57limiting themselves to half-duplex at the hardware level. In fact
58some SPI chips have this signal mode as a strapping option. These
59can be accessed using the same programming interface as SPI, but of
60course they won't handle full duplex transfers. You may find such
61chips described as using "three wire" signaling: SCK, data, nCSx.
62(That data line is sometimes called MOMI or SISO.)
63
47Microcontrollers often support both master and slave sides of the SPI 64Microcontrollers often support both master and slave sides of the SPI
48protocol. This document (and Linux) currently only supports the master 65protocol. This document (and Linux) currently only supports the master
49side of SPI interactions. 66side of SPI interactions.
@@ -74,6 +91,32 @@ interfaces with SPI modes. Given SPI support, they could use MMC or SD
74cards without needing a special purpose MMC/SD/SDIO controller. 91cards without needing a special purpose MMC/SD/SDIO controller.
75 92
76 93
94I'm confused. What are these four SPI "clock modes"?
95-----------------------------------------------------
96It's easy to be confused here, and the vendor documentation you'll
97find isn't necessarily helpful. The four modes combine two mode bits:
98
99 - CPOL indicates the initial clock polarity. CPOL=0 means the
100 clock starts low, so the first (leading) edge is rising, and
101 the second (trailing) edge is falling. CPOL=1 means the clock
102 starts high, so the first (leading) edge is falling.
103
104 - CPHA indicates the clock phase used to sample data; CPHA=0 says
105 sample on the leading edge, CPHA=1 means the trailing edge.
106
107 Since the signal needs to stablize before it's sampled, CPHA=0
108 implies that its data is written half a clock before the first
109 clock edge. The chipselect may have made it become available.
110
111Chip specs won't always say "uses SPI mode X" in as many words,
112but their timing diagrams will make the CPOL and CPHA modes clear.
113
114In the SPI mode number, CPOL is the high order bit and CPHA is the
115low order bit. So when a chip's timing diagram shows the clock
116starting low (CPOL=0) and data stabilized for sampling during the
117trailing clock edge (CPHA=1), that's SPI mode 1.
118
119
77How do these driver programming interfaces work? 120How do these driver programming interfaces work?
78------------------------------------------------ 121------------------------------------------------
79The <linux/spi/spi.h> header file includes kerneldoc, as does the 122The <linux/spi/spi.h> header file includes kerneldoc, as does the
diff --git a/MAINTAINERS b/MAINTAINERS
index 22ab4019972b..4cc17b993b6a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -332,6 +332,9 @@ L: linux-usb-devel@lists.sourceforge.net
332W: http://www.linux-usb.org/SpeedTouch/ 332W: http://www.linux-usb.org/SpeedTouch/
333S: Maintained 333S: Maintained
334 334
335ALCHEMY AU1XX0 MMC DRIVER
336S: Orphan
337
335ALI1563 I2C DRIVER 338ALI1563 I2C DRIVER
336P: Rudolf Marek 339P: Rudolf Marek
337M: r.marek@assembler.cz 340M: r.marek@assembler.cz
@@ -418,6 +421,12 @@ P: Ian Molton
418M: spyro@f2s.com 421M: spyro@f2s.com
419S: Maintained 422S: Maintained
420 423
424ARM PRIMECELL MMCI PL180/1 DRIVER
425P: Russell King
426M: rmk@arm.linux.org.uk
427L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
428S: Maintained
429
421ARM/ADI ROADRUNNER MACHINE SUPPORT 430ARM/ADI ROADRUNNER MACHINE SUPPORT
422P: Lennert Buytenhek 431P: Lennert Buytenhek
423M: kernel@wantstofly.org 432M: kernel@wantstofly.org
@@ -649,6 +658,9 @@ L: linux-atm-general@lists.sourceforge.net (subscribers-only)
649W: http://linux-atm.sourceforge.net 658W: http://linux-atm.sourceforge.net
650S: Maintained 659S: Maintained
651 660
661ATMEL AT91 MCI DRIVER
662S: Orphan
663
652ATMEL MACB ETHERNET DRIVER 664ATMEL MACB ETHERNET DRIVER
653P: Haavard Skinnemoen 665P: Haavard Skinnemoen
654M: hskinnemoen@atmel.com 666M: hskinnemoen@atmel.com
@@ -2322,7 +2334,7 @@ S: Maintained
2322 2334
2323MEGARAID SCSI DRIVERS 2335MEGARAID SCSI DRIVERS
2324P: Neela Syam Kolli 2336P: Neela Syam Kolli
2325M: Neela.Kolli@engenio.com 2337M: megaraidlinux@lsi.com
2326S: linux-scsi@vger.kernel.org 2338S: linux-scsi@vger.kernel.org
2327W: http://megaraid.lsilogic.com 2339W: http://megaraid.lsilogic.com
2328S: Maintained 2340S: Maintained
@@ -2380,6 +2392,13 @@ M: stelian@popies.net
2380W: http://popies.net/meye/ 2392W: http://popies.net/meye/
2381S: Maintained 2393S: Maintained
2382 2394
2395MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER
2396P: Pavel Pisa
2397M: ppisa@pikron.com
2398L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
2399W: http://mmc.drzeus.cx/wiki/Controllers/Freescale/SDHC
2400S: Maintained
2401
2383MOUSE AND MISC DEVICES [GENERAL] 2402MOUSE AND MISC DEVICES [GENERAL]
2384P: Alessandro Rubini 2403P: Alessandro Rubini
2385M: rubini@ipvvis.unipv.it 2404M: rubini@ipvvis.unipv.it
@@ -2900,6 +2919,9 @@ M: nico@cam.org
2900L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 2919L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
2901S: Maintained 2920S: Maintained
2902 2921
2922PXA MMCI DRIVER
2923S: Orphan
2924
2903QLOGIC QLA2XXX FC-SCSI DRIVER 2925QLOGIC QLA2XXX FC-SCSI DRIVER
2904P: Andrew Vasquez 2926P: Andrew Vasquez
2905M: linux-driver@qlogic.com 2927M: linux-driver@qlogic.com
@@ -3416,6 +3438,13 @@ P: Alex Dubov
3416M: oakad@yahoo.com 3438M: oakad@yahoo.com
3417S: Maintained 3439S: Maintained
3418 3440
3441TI OMAP MMC INTERFACE DRIVER
3442P: Carlos Aguiar, Anderson Briglia and Syed Khasim
3443M: linux-omap-open-source@linux.omap.com
3444W: http://linux.omap.com
3445W: http://www.muru.com/linux/omap/
3446S: Maintained
3447
3419TI OMAP RANDOM NUMBER GENERATOR SUPPORT 3448TI OMAP RANDOM NUMBER GENERATOR SUPPORT
3420P: Deepak Saxena 3449P: Deepak Saxena
3421M: dsaxena@plexity.net 3450M: dsaxena@plexity.net
diff --git a/Makefile b/Makefile
index 34210af91ce2..562a90902cf6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 22 3SUBLEVEL = 22
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc3
5NAME = Nocturnal Monster Puppy 5NAME = Jeff Thinks I Should Change This, But To What?
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index c2d54b802232..8770a5d0b143 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -891,7 +891,7 @@ config PHYSICAL_ALIGN
891 Don't change this unless you know what you are doing. 891 Don't change this unless you know what you are doing.
892 892
893config HOTPLUG_CPU 893config HOTPLUG_CPU
894 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 894 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
895 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER 895 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
896 ---help--- 896 ---help---
897 Say Y here to experiment with turning CPUs off and on, and to 897 Say Y here to experiment with turning CPUs off and on, and to
diff --git a/arch/i386/mach-generic/bigsmp.c b/arch/i386/mach-generic/bigsmp.c
index e932d3485ae2..58a477baec30 100644
--- a/arch/i386/mach-generic/bigsmp.c
+++ b/arch/i386/mach-generic/bigsmp.c
@@ -21,7 +21,7 @@
21 21
22static int dmi_bigsmp; /* can be set by dmi scanners */ 22static int dmi_bigsmp; /* can be set by dmi scanners */
23 23
24static __init int hp_ht_bigsmp(struct dmi_system_id *d) 24static int hp_ht_bigsmp(struct dmi_system_id *d)
25{ 25{
26#ifdef CONFIG_X86_GENERICARCH 26#ifdef CONFIG_X86_GENERICARCH
27 printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); 27 printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
@@ -31,7 +31,7 @@ static __init int hp_ht_bigsmp(struct dmi_system_id *d)
31} 31}
32 32
33 33
34static struct dmi_system_id __initdata bigsmp_dmi_table[] = { 34static struct dmi_system_id bigsmp_dmi_table[] = {
35 { hp_ht_bigsmp, "HP ProLiant DL760 G2", { 35 { hp_ht_bigsmp, "HP ProLiant DL760 G2", {
36 DMI_MATCH(DMI_BIOS_VENDOR, "HP"), 36 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
37 DMI_MATCH(DMI_BIOS_VERSION, "P44-"), 37 DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
@@ -45,7 +45,7 @@ static struct dmi_system_id __initdata bigsmp_dmi_table[] = {
45}; 45};
46 46
47 47
48static int __init probe_bigsmp(void) 48static int probe_bigsmp(void)
49{ 49{
50 if (def_to_bigsmp) 50 if (def_to_bigsmp)
51 dmi_bigsmp = 1; 51 dmi_bigsmp = 1;
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
index 4d4993a47e55..5a216c019924 100644
--- a/arch/ia64/kernel/acpi-processor.c
+++ b/arch/ia64/kernel/acpi-processor.c
@@ -44,7 +44,7 @@ static void init_intel_pdc(struct acpi_processor *pr)
44 44
45 buf[0] = ACPI_PDC_REVISION_ID; 45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1; 46 buf[1] = 1;
47 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; 47 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
48 48
49 obj->type = ACPI_TYPE_BUFFER; 49 obj->type = ACPI_TYPE_BUFFER;
50 obj->buffer.length = 12; 50 obj->buffer.length = 12;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index c4784494970e..103dd8edda71 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -67,7 +67,8 @@ EXPORT_SYMBOL(pm_power_off);
67unsigned int acpi_cpei_override; 67unsigned int acpi_cpei_override;
68unsigned int acpi_cpei_phys_cpuid; 68unsigned int acpi_cpei_phys_cpuid;
69 69
70const char *acpi_get_sysname(void) 70const char __init *
71acpi_get_sysname(void)
71{ 72{
72#ifdef CONFIG_IA64_GENERIC 73#ifdef CONFIG_IA64_GENERIC
73 unsigned long rsdp_phys; 74 unsigned long rsdp_phys;
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index d1c3ed9943e5..af73b8dfde28 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -763,6 +763,9 @@ get_wchan (struct task_struct *p)
763 unsigned long ip; 763 unsigned long ip;
764 int count = 0; 764 int count = 0;
765 765
766 if (!p || p == current || p->state == TASK_RUNNING)
767 return 0;
768
766 /* 769 /*
767 * Note: p may not be a blocked task (it could be current or 770 * Note: p may not be a blocked task (it could be current or
768 * another process running on some other CPU. Rather than 771 * another process running on some other CPU. Rather than
@@ -773,6 +776,8 @@ get_wchan (struct task_struct *p)
773 */ 776 */
774 unw_init_from_blocked_task(&info, p); 777 unw_init_from_blocked_task(&info, p);
775 do { 778 do {
779 if (p->state == TASK_RUNNING)
780 return 0;
776 if (unw_unwind(&info) < 0) 781 if (unw_unwind(&info) < 0)
777 return 0; 782 return 0;
778 unw_get_ip(&info, &ip); 783 unw_get_ip(&info, &ip);
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 542958079f1b..3c9d8e6089cf 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -370,7 +370,7 @@ smp_setup_percpu_timer (void)
370{ 370{
371} 371}
372 372
373static void __devinit 373static void __cpuinit
374smp_callin (void) 374smp_callin (void)
375{ 375{
376 int cpuid, phys_id, itc_master; 376 int cpuid, phys_id, itc_master;
@@ -456,7 +456,7 @@ smp_callin (void)
456/* 456/*
457 * Activate a secondary processor. head.S calls this. 457 * Activate a secondary processor. head.S calls this.
458 */ 458 */
459int __devinit 459int __cpuinit
460start_secondary (void *unused) 460start_secondary (void *unused)
461{ 461{
462 /* Early console may use I/O ports */ 462 /* Early console may use I/O ports */
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 7d3dd6cdafa4..b0b08b5f3eca 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -1860,7 +1860,7 @@ int
1860unw_unwind (struct unw_frame_info *info) 1860unw_unwind (struct unw_frame_info *info)
1861{ 1861{
1862 unsigned long prev_ip, prev_sp, prev_bsp; 1862 unsigned long prev_ip, prev_sp, prev_bsp;
1863 unsigned long ip, pr, num_regs; 1863 unsigned long ip, pr, num_regs, rp_loc, pfs_loc;
1864 STAT(unsigned long start, flags;) 1864 STAT(unsigned long start, flags;)
1865 int retval; 1865 int retval;
1866 1866
@@ -1870,14 +1870,16 @@ unw_unwind (struct unw_frame_info *info)
1870 prev_sp = info->sp; 1870 prev_sp = info->sp;
1871 prev_bsp = info->bsp; 1871 prev_bsp = info->bsp;
1872 1872
1873 /* restore the ip */ 1873 /* validate the return IP pointer */
1874 if (!info->rp_loc) { 1874 rp_loc = (unsigned long) info->rp_loc;
1875 if ((rp_loc < info->regstk.limit) || (rp_loc > info->regstk.top)) {
1875 /* FIXME: should really be level 0 but it occurs too often. KAO */ 1876 /* FIXME: should really be level 0 but it occurs too often. KAO */
1876 UNW_DPRINT(1, "unwind.%s: failed to locate return link (ip=0x%lx)!\n", 1877 UNW_DPRINT(1, "unwind.%s: failed to locate return link (ip=0x%lx)!\n",
1877 __FUNCTION__, info->ip); 1878 __FUNCTION__, info->ip);
1878 STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; local_irq_restore(flags)); 1879 STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; local_irq_restore(flags));
1879 return -1; 1880 return -1;
1880 } 1881 }
1882 /* restore the ip */
1881 ip = info->ip = *info->rp_loc; 1883 ip = info->ip = *info->rp_loc;
1882 if (ip < GATE_ADDR) { 1884 if (ip < GATE_ADDR) {
1883 UNW_DPRINT(2, "unwind.%s: reached user-space (ip=0x%lx)\n", __FUNCTION__, ip); 1885 UNW_DPRINT(2, "unwind.%s: reached user-space (ip=0x%lx)\n", __FUNCTION__, ip);
@@ -1885,12 +1887,14 @@ unw_unwind (struct unw_frame_info *info)
1885 return -1; 1887 return -1;
1886 } 1888 }
1887 1889
1888 /* restore the cfm: */ 1890 /* validate the previous stack frame pointer */
1889 if (!info->pfs_loc) { 1891 pfs_loc = (unsigned long) info->pfs_loc;
1892 if ((pfs_loc < info->regstk.limit) || (pfs_loc > info->regstk.top)) {
1890 UNW_DPRINT(0, "unwind.%s: failed to locate ar.pfs!\n", __FUNCTION__); 1893 UNW_DPRINT(0, "unwind.%s: failed to locate ar.pfs!\n", __FUNCTION__);
1891 STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; local_irq_restore(flags)); 1894 STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; local_irq_restore(flags));
1892 return -1; 1895 return -1;
1893 } 1896 }
1897 /* restore the cfm: */
1894 info->cfm_loc = info->pfs_loc; 1898 info->cfm_loc = info->pfs_loc;
1895 1899
1896 /* restore the bsp: */ 1900 /* restore the bsp: */
@@ -1992,13 +1996,16 @@ init_frame_info (struct unw_frame_info *info, struct task_struct *t,
1992 memset(info, 0, sizeof(*info)); 1996 memset(info, 0, sizeof(*info));
1993 1997
1994 rbslimit = (unsigned long) t + IA64_RBS_OFFSET; 1998 rbslimit = (unsigned long) t + IA64_RBS_OFFSET;
1999 stklimit = (unsigned long) t + IA64_STK_OFFSET;
2000
1995 rbstop = sw->ar_bspstore; 2001 rbstop = sw->ar_bspstore;
1996 if (rbstop - (unsigned long) t >= IA64_STK_OFFSET) 2002 if (rbstop > stklimit || rbstop < rbslimit)
1997 rbstop = rbslimit; 2003 rbstop = rbslimit;
1998 2004
1999 stklimit = (unsigned long) t + IA64_STK_OFFSET;
2000 if (stktop <= rbstop) 2005 if (stktop <= rbstop)
2001 stktop = rbstop; 2006 stktop = rbstop;
2007 if (stktop > stklimit)
2008 stktop = stklimit;
2002 2009
2003 info->regstk.limit = rbslimit; 2010 info->regstk.limit = rbslimit;
2004 info->regstk.top = rbstop; 2011 info->regstk.top = rbstop;
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 3549f3b42592..73696b4a2eed 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -354,10 +354,13 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
354 354
355 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 355 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
356 &windows); 356 &windows);
357 controller->window = kmalloc_node(sizeof(*controller->window) * windows, 357 if (windows) {
358 GFP_KERNEL, controller->node); 358 controller->window =
359 if (!controller->window) 359 kmalloc_node(sizeof(*controller->window) * windows,
360 goto out2; 360 GFP_KERNEL, controller->node);
361 if (!controller->window)
362 goto out2;
363 }
361 364
362 name = kmalloc(16, GFP_KERNEL); 365 name = kmalloc(16, GFP_KERNEL);
363 if (!name) 366 if (!name)
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index a574fcd163dd..684b1c984a44 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -194,7 +194,7 @@ void __init early_sn_setup(void)
194} 194}
195 195
196extern int platform_intr_list[]; 196extern int platform_intr_list[];
197static int __initdata shub_1_1_found; 197static int __cpuinitdata shub_1_1_found;
198 198
199/* 199/*
200 * sn_check_for_wars 200 * sn_check_for_wars
diff --git a/arch/mips/sgi-ip32/Makefile b/arch/mips/sgi-ip32/Makefile
index 7e1416768a60..60f0227425e7 100644
--- a/arch/mips/sgi-ip32/Makefile
+++ b/arch/mips/sgi-ip32/Makefile
@@ -3,5 +3,5 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y += ip32-berr.o ip32-irq.o ip32-setup.o ip32-reset.o \ 6obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \
7 crime.o ip32-memory.o 7 crime.o ip32-memory.o
diff --git a/arch/mips/sgi-ip32/ip32-platform.c b/arch/mips/sgi-ip32/ip32-platform.c
new file mode 100644
index 000000000000..120b15932caf
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-platform.c
@@ -0,0 +1,20 @@
1#include <linux/init.h>
2#include <linux/platform_device.h>
3
4static __init int meth_devinit(void)
5{
6 struct platform_device *pd;
7 int ret;
8
9 pd = platform_device_alloc("meth", -1);
10 if (!pd)
11 return -ENOMEM;
12
13 ret = platform_device_add(pd);
14 if (ret)
15 platform_device_put(pd);
16
17 return ret;
18}
19
20device_initcall(meth_devinit);
diff --git a/arch/sh/boards/landisk/gio.c b/arch/sh/boards/landisk/gio.c
index 50d38be62f01..a37643d002b2 100644
--- a/arch/sh/boards/landisk/gio.c
+++ b/arch/sh/boards/landisk/gio.c
@@ -69,7 +69,7 @@ static int gio_ioctl(struct inode *inode, struct file *filp,
69 } 69 }
70 70
71 switch (cmd) { 71 switch (cmd) {
72 case GIODRV_IOCSGIOSETADDR: /* addres set */ 72 case GIODRV_IOCSGIOSETADDR: /* address set */
73 addr = data; 73 addr = data;
74 break; 74 break;
75 75
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
index 4058b4f50d44..f953c7427769 100644
--- a/arch/sh/boards/landisk/setup.c
+++ b/arch/sh/boards/landisk/setup.c
@@ -44,8 +44,14 @@ static struct platform_device cf_ide_device = {
44 }, 44 },
45}; 45};
46 46
47static struct platform_device rtc_device = {
48 .name = "rs5c313",
49 .id = -1,
50};
51
47static struct platform_device *landisk_devices[] __initdata = { 52static struct platform_device *landisk_devices[] __initdata = {
48 &cf_ide_device, 53 &cf_ide_device,
54 &rtc_device,
49}; 55};
50 56
51static int __init landisk_devices_setup(void) 57static int __init landisk_devices_setup(void)
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile
index 609e5d50dde8..b1d20afb4eb3 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/renesas/r7780rp/Makefile
@@ -3,5 +3,8 @@
3# 3#
4irqinit-y := irq-r7780rp.o 4irqinit-y := irq-r7780rp.o
5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o 5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
6obj-y := setup.o irq.o $(irqinit-y)
7
8ifneq ($(CONFIG_SH_R7785RP),y)
6obj-$(CONFIG_PUSH_SWITCH) += psw.o 9obj-$(CONFIG_PUSH_SWITCH) += psw.o
7obj-y := setup.o irq.o $(irqinit-y) 10endif
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c
index 1659fdd6695a..edb3dd936cbb 100644
--- a/arch/sh/boards/snapgear/rtc.c
+++ b/arch/sh/boards/snapgear/rtc.c
@@ -108,7 +108,7 @@ static void ds1302_writebyte(unsigned int addr, unsigned int val)
108static void ds1302_reset(void) 108static void ds1302_reset(void)
109{ 109{
110 unsigned long flags; 110 unsigned long flags;
111 /* Hardware dependant reset/init */ 111 /* Hardware dependent reset/init */
112 local_irq_save(flags); 112 local_irq_save(flags);
113 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK); 113 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
114 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK)); 114 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
diff --git a/arch/sh/boards/superh/microdev/io.c b/arch/sh/boards/superh/microdev/io.c
index 83419bf4c834..b704e20d7e4d 100644
--- a/arch/sh/boards/superh/microdev/io.c
+++ b/arch/sh/boards/superh/microdev/io.c
@@ -198,12 +198,12 @@ void microdev_outb(unsigned char b, unsigned long port)
198 /* 198 /*
199 * There is a board feature with the current SH4-202 MicroDev in 199 * There is a board feature with the current SH4-202 MicroDev in
200 * that the 2 byte enables (nBE0 and nBE1) are tied together (and 200 * that the 2 byte enables (nBE0 and nBE1) are tied together (and
201 * to the Chip Select Line (Ethernet_CS)). Due to this conectivity, 201 * to the Chip Select Line (Ethernet_CS)). Due to this connectivity,
202 * it is not possible to safely perform 8-bit writes to the 202 * it is not possible to safely perform 8-bit writes to the
203 * Ethernet registers, as 16-bits will be consumed from the Data 203 * Ethernet registers, as 16-bits will be consumed from the Data
204 * lines (corrupting the other byte). Hence, this function is 204 * lines (corrupting the other byte). Hence, this function is
205 * written to impliment 16-bit read/modify/write for all byte-wide 205 * written to implement 16-bit read/modify/write for all byte-wide
206 * acceses. 206 * accesses.
207 * 207 *
208 * Note: there is no problem with byte READS (even or odd). 208 * Note: there is no problem with byte READS (even or odd).
209 * 209 *
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c
index 8c64baa30364..cc1cb04fa618 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/superh/microdev/irq.c
@@ -100,7 +100,7 @@ static void disable_microdev_irq(unsigned int irq)
100 100
101 fpgaIrq = fpgaIrqTable[irq].fpgaIrq; 101 fpgaIrq = fpgaIrqTable[irq].fpgaIrq;
102 102
103 /* disable interupts on the FPGA INTC register */ 103 /* disable interrupts on the FPGA INTC register */
104 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG); 104 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG);
105} 105}
106 106
@@ -125,7 +125,7 @@ static void enable_microdev_irq(unsigned int irq)
125 priorities |= MICRODEV_FPGA_INTPRI_LEVEL(fpgaIrq, pri); 125 priorities |= MICRODEV_FPGA_INTPRI_LEVEL(fpgaIrq, pri);
126 ctrl_outl(priorities, priorityReg); 126 ctrl_outl(priorities, priorityReg);
127 127
128 /* enable interupts on the FPGA INTC register */ 128 /* enable interrupts on the FPGA INTC register */
129 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); 129 ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
130} 130}
131 131
@@ -152,7 +152,7 @@ extern void __init init_microdev_irq(void)
152{ 152{
153 int i; 153 int i;
154 154
155 /* disable interupts on the FPGA INTC register */ 155 /* disable interrupts on the FPGA INTC register */
156 ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG); 156 ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG);
157 157
158 for (i = 0; i < NUM_EXTERNAL_IRQS; i++) 158 for (i = 0; i < NUM_EXTERNAL_IRQS; i++)
diff --git a/arch/sh/boards/superh/microdev/setup.c b/arch/sh/boards/superh/microdev/setup.c
index 031c814e6e76..6396cea1c896 100644
--- a/arch/sh/boards/superh/microdev/setup.c
+++ b/arch/sh/boards/superh/microdev/setup.c
@@ -349,7 +349,7 @@ static int __init smsc_superio_setup(void)
349 SMSC_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */ 349 SMSC_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
350 SMSC_WRITE_INDEXED(0x08, 0xe8); /* GP20 = nIDE2_OE */ 350 SMSC_WRITE_INDEXED(0x08, 0xe8); /* GP20 = nIDE2_OE */
351 351
352 /* Exit the configuraton state */ 352 /* Exit the configuration state */
353 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR); 353 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
354 354
355 return 0; 355 return 0;
diff --git a/arch/sh/boards/unknown/setup.c b/arch/sh/boards/unknown/setup.c
index 1c941370a2e3..bee4612de59b 100644
--- a/arch/sh/boards/unknown/setup.c
+++ b/arch/sh/boards/unknown/setup.c
@@ -6,7 +6,7 @@
6 * May be copied or modified under the terms of the GNU General Public 6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information. 7 * License. See linux/COPYING for more information.
8 * 8 *
9 * Setup code for an unknown machine (internal peripherials only) 9 * Setup code for an unknown machine (internal peripherals only)
10 * 10 *
11 * This is the simplest of all boards, and serves only as a quick and dirty 11 * This is the simplest of all boards, and serves only as a quick and dirty
12 * method to start debugging a new board during bring-up until proper board 12 * method to start debugging a new board during bring-up until proper board
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index e062067edd24..8057a27a1bc6 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -115,7 +115,7 @@ static int search_cap(const char **haystack, const char *needle)
115/** 115/**
116 * request_dma_bycap - Allocate a DMA channel based on its capabilities 116 * request_dma_bycap - Allocate a DMA channel based on its capabilities
117 * @dmac: List of DMA controllers to search 117 * @dmac: List of DMA controllers to search
118 * @caps: List of capabilites 118 * @caps: List of capabilities
119 * 119 *
120 * Search all channels of all DMA controllers to find a channel which 120 * Search all channels of all DMA controllers to find a channel which
121 * matches the requested capabilities. The result is the channel 121 * matches the requested capabilities. The result is the channel
diff --git a/arch/sh/drivers/dma/dma-isa.c b/arch/sh/drivers/dma/dma-isa.c
index 05a74ffdb68d..5fb044b791c3 100644
--- a/arch/sh/drivers/dma/dma-isa.c
+++ b/arch/sh/drivers/dma/dma-isa.c
@@ -28,7 +28,7 @@
28 * NOTE: ops->xfer() is the preferred way of doing things. However, there 28 * NOTE: ops->xfer() is the preferred way of doing things. However, there
29 * are some users of the ISA DMA API that exist in common code that we 29 * are some users of the ISA DMA API that exist in common code that we
30 * don't necessarily want to go out of our way to break, so we still 30 * don't necessarily want to go out of our way to break, so we still
31 * allow for some compatability at that level. Any new code is strongly 31 * allow for some compatibility at that level. Any new code is strongly
32 * advised to run far away from the ISA DMA API and use the SH DMA API 32 * advised to run far away from the ISA DMA API and use the SH DMA API
33 * directly. 33 * directly.
34 */ 34 */
diff --git a/arch/sh/drivers/dma/dmabrg.c b/arch/sh/drivers/dma/dmabrg.c
index 9d0a29370f21..5e22689c2fcf 100644
--- a/arch/sh/drivers/dma/dmabrg.c
+++ b/arch/sh/drivers/dma/dmabrg.c
@@ -33,7 +33,7 @@
33 * 9 | HAC1/SSI1 | rec | half done | DMABRGI2 33 * 9 | HAC1/SSI1 | rec | half done | DMABRGI2
34 * 34 *
35 * all can be enabled/disabled in the DMABRGCR register, 35 * all can be enabled/disabled in the DMABRGCR register,
36 * as well as checked if they occured. 36 * as well as checked if they occurred.
37 * 37 *
38 * DMABRGI0 services USB DMA Address errors, but it still must be 38 * DMABRGI0 services USB DMA Address errors, but it still must be
39 * enabled/acked in the DMABRGCR register. USB-DMA complete indicator 39 * enabled/acked in the DMABRGCR register. USB-DMA complete indicator
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index 381306cf5425..e1284fc69361 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -57,7 +57,7 @@ struct pci_channel board_pci_channels[] = {
57 * 57 *
58 * Also, we could very easily support both Type 0 and Type 1 configurations 58 * Also, we could very easily support both Type 0 and Type 1 configurations
59 * here, but since it doesn't seem that there is any such implementation in 59 * here, but since it doesn't seem that there is any such implementation in
60 * existance, we don't bother. 60 * existence, we don't bother.
61 * 61 *
62 * I suppose if someone actually gets around to ripping the chip out of 62 * I suppose if someone actually gets around to ripping the chip out of
63 * the BBA and hanging some more devices off of it, then this might be 63 * the BBA and hanging some more devices off of it, then this might be
diff --git a/arch/sh/drivers/pci/pci-st40.c b/arch/sh/drivers/pci/pci-st40.c
index d67656a44b15..543417ff8314 100644
--- a/arch/sh/drivers/pci/pci-st40.c
+++ b/arch/sh/drivers/pci/pci-st40.c
@@ -292,7 +292,7 @@ int __init st40pci_init(unsigned memStart, unsigned memSize)
292 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | 292 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
293 PCI_COMMAND_IO); 293 PCI_COMMAND_IO);
294 294
295 /* Accesse to the 0xb0000000 -> 0xb6000000 area will go through to 0x10000000 -> 0x16000000 295 /* Access to the 0xb0000000 -> 0xb6000000 area will go through to 0x10000000 -> 0x16000000
296 * on the PCI bus. This allows a nice 1-1 bus to phys mapping. 296 * on the PCI bus. This allows a nice 1-1 bus to phys mapping.
297 */ 297 */
298 298
@@ -315,7 +315,7 @@ int __init st40pci_init(unsigned memStart, unsigned memSize)
315 ST40PCI_WRITE(CSR_MBAR0, 0); 315 ST40PCI_WRITE(CSR_MBAR0, 0);
316 ST40PCI_WRITE(LSR0, 0x0fff0001); 316 ST40PCI_WRITE(LSR0, 0x0fff0001);
317 317
318 /* ... and set up the initial incomming window to expose all of RAM */ 318 /* ... and set up the initial incoming window to expose all of RAM */
319 pci_set_rbar_region(7, memStart, memStart, memSize); 319 pci_set_rbar_region(7, memStart, memStart, memSize);
320 320
321 /* Maximise timeout values */ 321 /* Maximise timeout values */
@@ -473,7 +473,7 @@ static void pci_set_rbar_region(unsigned int region, unsigned long localAddr
473 473
474 mask = r2p2(regionSize) - 0x10000; 474 mask = r2p2(regionSize) - 0x10000;
475 475
476 /* Diable the region (in case currently in use, should never happen) */ 476 /* Disable the region (in case currently in use, should never happen) */
477 ST40PCI_WRITE_INDEXED(RSR, region, 0); 477 ST40PCI_WRITE_INDEXED(RSR, region, 0);
478 478
479 /* Start of local address space to publish */ 479 /* Start of local address space to publish */
diff --git a/arch/sh/drivers/pci/pci-st40.h b/arch/sh/drivers/pci/pci-st40.h
index d729e0c2d5fe..cf0d35bd135c 100644
--- a/arch/sh/drivers/pci/pci-st40.h
+++ b/arch/sh/drivers/pci/pci-st40.h
@@ -4,7 +4,7 @@
4 * May be copied or modified under the terms of the GNU General Public 4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information. 5 * License. See linux/COPYING for more information.
6 * 6 *
7 * Defintions for the ST40 PCI hardware. 7 * Definitions for the ST40 PCI hardware.
8 */ 8 */
9 9
10#ifndef __PCI_ST40_H__ 10#ifndef __PCI_ST40_H__
diff --git a/arch/sh/drivers/superhyway/ops-sh4-202.c b/arch/sh/drivers/superhyway/ops-sh4-202.c
index a55c98a9052b..3b14bf860db6 100644
--- a/arch/sh/drivers/superhyway/ops-sh4-202.c
+++ b/arch/sh/drivers/superhyway/ops-sh4-202.c
@@ -130,7 +130,7 @@ static int sh4202_read_vcr(unsigned long base, struct superhyway_vcr_info *vcr)
130 * Some modules (PBR and ePBR for instance) also appear to have 130 * Some modules (PBR and ePBR for instance) also appear to have
131 * VCRL/VCRH flipped in the documentation, but on the SH4-202 131 * VCRL/VCRH flipped in the documentation, but on the SH4-202
132 * itself it appears that these are all consistently mapped with 132 * itself it appears that these are all consistently mapped with
133 * VCRH preceeding VCRL. 133 * VCRH preceding VCRL.
134 * 134 *
135 * Do not trust the documentation, for it is evil. 135 * Do not trust the documentation, for it is evil.
136 */ 136 */
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c
index 0758d48147a0..849a9e191391 100644
--- a/arch/sh/kernel/cf-enabler.c
+++ b/arch/sh/kernel/cf-enabler.c
@@ -31,7 +31,7 @@
31 */ 31 */
32#if defined(CONFIG_CPU_SH4) 32#if defined(CONFIG_CPU_SH4)
33/* SH4 can't access PCMCIA interface through P2 area. 33/* SH4 can't access PCMCIA interface through P2 area.
34 * we must remap it with appropreate attribute bit of the page set. 34 * we must remap it with appropriate attribute bit of the page set.
35 * this part is based on Greg Banks' hd64465_ss.c implementation - Masahiro Abe */ 35 * this part is based on Greg Banks' hd64465_ss.c implementation - Masahiro Abe */
36 36
37#if defined(CONFIG_CF_AREA6) 37#if defined(CONFIG_CF_AREA6)
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 014f318f5a05..63251549e9a8 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -278,6 +278,11 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
278{ 278{
279} 279}
280 280
281void __init __attribute__ ((weak))
282arch_clk_init(void)
283{
284}
285
281static int show_clocks(char *buf, char **start, off_t off, 286static int show_clocks(char *buf, char **start, off_t off,
282 int len, int *eof, void *data) 287 int len, int *eof, void *data)
283{ 288{
@@ -314,6 +319,8 @@ int __init clk_init(void)
314 ret |= clk_register(clk); 319 ret |= clk_register(clk);
315 } 320 }
316 321
322 arch_clk_init();
323
317 /* Kick the child clocks.. */ 324 /* Kick the child clocks.. */
318 propagate_rate(&master_clk); 325 propagate_rate(&master_clk);
319 propagate_rate(&bus_clk); 326 propagate_rate(&bus_clk);
diff --git a/arch/sh/kernel/cpu/irq/maskreg.c b/arch/sh/kernel/cpu/irq/maskreg.c
index 492db31b3cab..978992e367a5 100644
--- a/arch/sh/kernel/cpu/irq/maskreg.c
+++ b/arch/sh/kernel/cpu/irq/maskreg.c
@@ -38,7 +38,7 @@ static struct hw_interrupt_type maskreg_irq_type = {
38 .end = end_maskreg_irq 38 .end = end_maskreg_irq
39}; 39};
40 40
41/* actual implementatin */ 41/* actual implementation */
42static unsigned int startup_maskreg_irq(unsigned int irq) 42static unsigned int startup_maskreg_irq(unsigned int irq)
43{ 43{
44 enable_maskreg_irq(irq); 44 enable_maskreg_irq(irq);
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c
index d61dd599169f..c5a4fc77fa06 100644
--- a/arch/sh/kernel/cpu/sh4/fpu.c
+++ b/arch/sh/kernel/cpu/sh4/fpu.c
@@ -138,7 +138,7 @@ restore_fpu(struct task_struct *tsk)
138/* 138/*
139 * Load the FPU with signalling NANS. This bit pattern we're using 139 * Load the FPU with signalling NANS. This bit pattern we're using
140 * has the property that no matter wether considered as single or as 140 * has the property that no matter wether considered as single or as
141 * double precission represents signaling NANS. 141 * double precision represents signaling NANS.
142 */ 142 */
143 143
144static void 144static void
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index 6f8f458912c7..03b14cf78ddf 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -106,6 +106,7 @@ static struct ipr_data sh7750_ipr_map[] = {
106 { 38, 2, 8, 7 }, /* DMAC DMAE */ 106 { 38, 2, 8, 7 }, /* DMAC DMAE */
107}; 107};
108 108
109#ifdef CONFIG_CPU_SUBTYPE_SH7751
109static struct ipr_data sh7751_ipr_map[] = { 110static struct ipr_data sh7751_ipr_map[] = {
110 { 44, 2, 8, 7 }, /* DMAC DMTE4 */ 111 { 44, 2, 8, 7 }, /* DMAC DMTE4 */
111 { 45, 2, 8, 7 }, /* DMAC DMTE5 */ 112 { 45, 2, 8, 7 }, /* DMAC DMTE5 */
@@ -117,6 +118,7 @@ static struct ipr_data sh7751_ipr_map[] = {
117 /*{ 72, INTPRI00, 8, ? },*/ /* TMU3 TUNI */ 118 /*{ 72, INTPRI00, 8, ? },*/ /* TMU3 TUNI */
118 /*{ 76, INTPRI00, 12, ? },*/ /* TMU4 TUNI */ 119 /*{ 76, INTPRI00, 12, ? },*/ /* TMU4 TUNI */
119}; 120};
121#endif
120 122
121static unsigned long ipr_offsets[] = { 123static unsigned long ipr_offsets[] = {
122 0xffd00004UL, /* 0: IPRA */ 124 0xffd00004UL, /* 0: IPRA */
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 29090035bc5b..51b386d454de 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -17,7 +17,6 @@
17#include <asm/clock.h> 17#include <asm/clock.h>
18#include <asm/freq.h> 18#include <asm/freq.h>
19 19
20#define SH7722_PLL_FREQ (32000000/8)
21#define N (-1) 20#define N (-1)
22#define NM (-2) 21#define NM (-2)
23#define ROUND_NEAREST 0 22#define ROUND_NEAREST 0
@@ -141,28 +140,36 @@ static void adjust_clocks(int originate, int *l, unsigned long v[],
141*/ 140*/
142static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 }; 141static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 };
143 142
143static void master_clk_recalc(struct clk *clk)
144{
145 unsigned frqcr = ctrl_inl(FRQCR);
146
147 clk->rate = CONFIG_SH_PCLK_FREQ * (((frqcr >> 24) & 0x1f) + 1);
148}
149
144static void master_clk_init(struct clk *clk) 150static void master_clk_init(struct clk *clk)
145{ 151{
146 clk_set_rate(clk, clk_get_rate(clk)); 152 clk->parent = NULL;
153 clk->flags |= CLK_RATE_PROPAGATES;
154 clk->rate = CONFIG_SH_PCLK_FREQ;
155 master_clk_recalc(clk);
147} 156}
148 157
149static void master_clk_recalc(struct clk *clk) 158
159static void module_clk_recalc(struct clk *clk)
150{ 160{
151 unsigned long frqcr = ctrl_inl(FRQCR); 161 unsigned long frqcr = ctrl_inl(FRQCR);
152 162
153 clk->rate = CONFIG_SH_PCLK_FREQ * (1 + (frqcr >> 24 & 0xF)); 163 clk->rate = clk->parent->rate / (((frqcr >> 24) & 0x1f) + 1);
154} 164}
155 165
156static int master_clk_setrate(struct clk *clk, unsigned long rate, int id) 166static int master_clk_setrate(struct clk *clk, unsigned long rate, int id)
157{ 167{
158 int div = rate / SH7722_PLL_FREQ; 168 int div = rate / clk->rate;
159 int master_divs[] = { 2, 3, 4, 6, 8, 16 }; 169 int master_divs[] = { 2, 3, 4, 6, 8, 16 };
160 int index; 170 int index;
161 unsigned long frqcr; 171 unsigned long frqcr;
162 172
163 if (rate < SH7722_PLL_FREQ * 2)
164 return -EINVAL;
165
166 for (index = 1; index < ARRAY_SIZE(master_divs); index++) 173 for (index = 1; index < ARRAY_SIZE(master_divs); index++)
167 if (div >= master_divs[index - 1] && div < master_divs[index]) 174 if (div >= master_divs[index - 1] && div < master_divs[index])
168 break; 175 break;
@@ -185,6 +192,10 @@ static struct clk_ops sh7722_master_clk_ops = {
185 .set_rate = master_clk_setrate, 192 .set_rate = master_clk_setrate,
186}; 193};
187 194
195static struct clk_ops sh7722_module_clk_ops = {
196 .recalc = module_clk_recalc,
197};
198
188struct frqcr_context { 199struct frqcr_context {
189 unsigned mask; 200 unsigned mask;
190 unsigned shift; 201 unsigned shift;
@@ -489,7 +500,7 @@ static void sh7722_siu_recalc(struct clk *clk)
489 500
490 if (siu < 0) 501 if (siu < 0)
491 return /* siu */ ; 502 return /* siu */ ;
492 BUG_ON(siu > 1); 503 BUG_ON(siu > 2);
493 r = ctrl_inl(sh7722_siu_regs[siu]); 504 r = ctrl_inl(sh7722_siu_regs[siu]);
494 clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF]; 505 clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF];
495} 506}
@@ -571,7 +582,7 @@ static struct clk *sh7722_clocks[] = {
571 */ 582 */
572struct clk_ops *onchip_ops[] = { 583struct clk_ops *onchip_ops[] = {
573 &sh7722_master_clk_ops, 584 &sh7722_master_clk_ops,
574 &sh7722_frqcr_clk_ops, 585 &sh7722_module_clk_ops,
575 &sh7722_frqcr_clk_ops, 586 &sh7722_frqcr_clk_ops,
576 &sh7722_frqcr_clk_ops, 587 &sh7722_frqcr_clk_ops,
577}; 588};
@@ -583,7 +594,7 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
583 *ops = onchip_ops[type]; 594 *ops = onchip_ops[type];
584} 595}
585 596
586int __init sh7722_clock_init(void) 597int __init arch_clk_init(void)
587{ 598{
588 struct clk *master; 599 struct clk *master;
589 int i; 600 int i;
@@ -597,4 +608,3 @@ int __init sh7722_clock_init(void)
597 clk_put(master); 608 clk_put(master);
598 return 0; 609 return 0;
599} 610}
600arch_initcall(sh7722_clock_init);
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index a5323364cbca..edd1ec214e6d 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -2,7 +2,7 @@
2 * May be copied or modified under the terms of the GNU General Public 2 * May be copied or modified under the terms of the GNU General Public
3 * License. See linux/COPYING for more information. 3 * License. See linux/COPYING for more information.
4 * 4 *
5 * Containes extracts from code by Glenn Engel, Jim Kingdon, 5 * Contains extracts from code by Glenn Engel, Jim Kingdon,
6 * David Grothe <dave@gcom.com>, Tigran Aivazian <tigran@sco.com>, 6 * David Grothe <dave@gcom.com>, Tigran Aivazian <tigran@sco.com>,
7 * Amit S. Kale <akale@veritas.com>, William Gatliff <bgat@open-widgets.com>, 7 * Amit S. Kale <akale@veritas.com>, William Gatliff <bgat@open-widgets.com>,
8 * Ben Lee, Steve Chamberlain and Benoit Miller <fulg@iname.com>. 8 * Ben Lee, Steve Chamberlain and Benoit Miller <fulg@iname.com>.
@@ -85,7 +85,7 @@
85 * 85 *
86 * Responses can be run-length encoded to save space. A '*' means that 86 * Responses can be run-length encoded to save space. A '*' means that
87 * the next character is an ASCII encoding giving a repeat count which 87 * the next character is an ASCII encoding giving a repeat count which
88 * stands for that many repititions of the character preceding the '*'. 88 * stands for that many repetitions of the character preceding the '*'.
89 * The encoding is n+29, yielding a printable character where n >=3 89 * The encoding is n+29, yielding a printable character where n >=3
90 * (which is where RLE starts to win). Don't use an n > 126. 90 * (which is where RLE starts to win). Don't use an n > 126.
91 * 91 *
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 6b4f5748d0be..a11e2aa73cbc 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -26,8 +26,6 @@
26static int hlt_counter; 26static int hlt_counter;
27int ubc_usercnt = 0; 27int ubc_usercnt = 0;
28 28
29#define HARD_IDLE_TIMEOUT (HZ / 3)
30
31void (*pm_idle)(void); 29void (*pm_idle)(void);
32void (*pm_power_off)(void); 30void (*pm_power_off)(void);
33EXPORT_SYMBOL(pm_power_off); 31EXPORT_SYMBOL(pm_power_off);
@@ -44,16 +42,39 @@ void enable_hlt(void)
44} 42}
45EXPORT_SYMBOL(enable_hlt); 43EXPORT_SYMBOL(enable_hlt);
46 44
45static int __init nohlt_setup(char *__unused)
46{
47 hlt_counter = 1;
48 return 1;
49}
50__setup("nohlt", nohlt_setup);
51
52static int __init hlt_setup(char *__unused)
53{
54 hlt_counter = 0;
55 return 1;
56}
57__setup("hlt", hlt_setup);
58
47void default_idle(void) 59void default_idle(void)
48{ 60{
49 if (!hlt_counter) 61 if (!hlt_counter) {
50 cpu_sleep(); 62 clear_thread_flag(TIF_POLLING_NRFLAG);
51 else 63 smp_mb__after_clear_bit();
52 cpu_relax(); 64 set_bl_bit();
65 while (!need_resched())
66 cpu_sleep();
67 clear_bl_bit();
68 set_thread_flag(TIF_POLLING_NRFLAG);
69 } else
70 while (!need_resched())
71 cpu_relax();
53} 72}
54 73
55void cpu_idle(void) 74void cpu_idle(void)
56{ 75{
76 set_thread_flag(TIF_POLLING_NRFLAG);
77
57 /* endless idle loop with no priority at all */ 78 /* endless idle loop with no priority at all */
58 while (1) { 79 while (1) {
59 void (*idle)(void) = pm_idle; 80 void (*idle)(void) = pm_idle;
diff --git a/arch/sh/kernel/syscalls.S b/arch/sh/kernel/syscalls.S
index 4357d1a6358f..7db1c2dc5992 100644
--- a/arch/sh/kernel/syscalls.S
+++ b/arch/sh/kernel/syscalls.S
@@ -355,3 +355,6 @@ ENTRY(sys_call_table)
355 .long sys_getcpu 355 .long sys_getcpu
356 .long sys_epoll_pwait 356 .long sys_epoll_pwait
357 .long sys_utimensat /* 320 */ 357 .long sys_utimensat /* 320 */
358 .long sys_signalfd
359 .long sys_timerfd
360 .long sys_eventfd
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 3a197649cd83..5b75cb6f8f9b 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -21,6 +21,7 @@
21#include <linux/bug.h> 21#include <linux/bug.h>
22#include <linux/debug_locks.h> 22#include <linux/debug_locks.h>
23#include <linux/kdebug.h> 23#include <linux/kdebug.h>
24#include <linux/kexec.h>
24#include <linux/limits.h> 25#include <linux/limits.h>
25#include <asm/system.h> 26#include <asm/system.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
@@ -101,6 +102,16 @@ void die(const char * str, struct pt_regs * regs, long err)
101 102
102 bust_spinlocks(0); 103 bust_spinlocks(0);
103 spin_unlock_irq(&die_lock); 104 spin_unlock_irq(&die_lock);
105
106 if (kexec_should_crash(current))
107 crash_kexec(regs);
108
109 if (in_interrupt())
110 panic("Fatal exception in interrupt");
111
112 if (panic_on_oops)
113 panic("Fatal exception");
114
104 do_exit(SIGSEGV); 115 do_exit(SIGSEGV);
105} 116}
106 117
@@ -513,7 +524,7 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
513 * misaligned data access 524 * misaligned data access
514 * access to >= 0x80000000 is user mode 525 * access to >= 0x80000000 is user mode
515 * Unfortuntaly we can't distinguish between instruction address error 526 * Unfortuntaly we can't distinguish between instruction address error
516 * and data address errors caused by read acceses. 527 * and data address errors caused by read accesses.
517 */ 528 */
518asmlinkage void do_address_error(struct pt_regs *regs, 529asmlinkage void do_address_error(struct pt_regs *regs,
519 unsigned long writeaccess, 530 unsigned long writeaccess,
diff --git a/arch/sh/math-emu/math.c b/arch/sh/math-emu/math.c
index 1efbac15ff4e..a38e1eed9e77 100644
--- a/arch/sh/math-emu/math.c
+++ b/arch/sh/math-emu/math.c
@@ -148,7 +148,7 @@ fmac(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n)
148 return 0; 148 return 0;
149} 149}
150 150
151// to process fmov's extention (odd n for DR access XD). 151// to process fmov's extension (odd n for DR access XD).
152#define FMOV_EXT(x) if(x&1) x+=16-1 152#define FMOV_EXT(x) if(x&1) x+=16-1
153 153
154static int 154static int
diff --git a/arch/sh/mm/copy_page.S b/arch/sh/mm/copy_page.S
index 397c94c97315..ae039f2da162 100644
--- a/arch/sh/mm/copy_page.S
+++ b/arch/sh/mm/copy_page.S
@@ -129,6 +129,7 @@ ENTRY(__copy_user_page)
129 rts 129 rts
130 nop 130 nop
131#endif 131#endif
132 .align 2
132.Lpsz: .long PAGE_SIZE 133.Lpsz: .long PAGE_SIZE
133/* 134/*
134 * __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); 135 * __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 9207da67ff8a..c878faa4ae46 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -15,43 +15,11 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/hardirq.h> 16#include <linux/hardirq.h>
17#include <linux/kprobes.h> 17#include <linux/kprobes.h>
18#include <linux/kdebug.h>
19#include <asm/system.h> 18#include <asm/system.h>
20#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
21#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
22#include <asm/kgdb.h> 21#include <asm/kgdb.h>
23 22
24#ifdef CONFIG_KPROBES
25ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
26
27/* Hook to register for page fault notifications */
28int register_page_fault_notifier(struct notifier_block *nb)
29{
30 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
31}
32
33int unregister_page_fault_notifier(struct notifier_block *nb)
34{
35 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
36}
37
38static inline int notify_page_fault(enum die_val val, struct pt_regs *regs,
39 int trap, int sig)
40{
41 struct die_args args = {
42 .regs = regs,
43 .trapnr = trap,
44 };
45 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
46}
47#else
48static inline int notify_page_fault(enum die_val val, struct pt_regs *regs,
49 int trap, int sig)
50{
51 return NOTIFY_DONE;
52}
53#endif
54
55/* 23/*
56 * This routine handles page faults. It determines the address, 24 * This routine handles page faults. It determines the address,
57 * and the problem, and then passes it off to one of the appropriate 25 * and the problem, and then passes it off to one of the appropriate
@@ -69,11 +37,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
69 siginfo_t info; 37 siginfo_t info;
70 38
71 trace_hardirqs_on(); 39 trace_hardirqs_on();
72
73 if (notify_page_fault(DIE_PAGE_FAULT, regs,
74 writeaccess, SIGSEGV) == NOTIFY_STOP)
75 return;
76
77 local_irq_enable(); 40 local_irq_enable();
78 41
79#ifdef CONFIG_SH_KGDB 42#ifdef CONFIG_SH_KGDB
@@ -285,7 +248,7 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
285 pte_t *pte; 248 pte_t *pte;
286 pte_t entry; 249 pte_t entry;
287 struct mm_struct *mm = current->mm; 250 struct mm_struct *mm = current->mm;
288 spinlock_t *ptl; 251 spinlock_t *ptl = NULL;
289 int ret = 1; 252 int ret = 1;
290 253
291#ifdef CONFIG_SH_KGDB 254#ifdef CONFIG_SH_KGDB
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 8fe223a890ed..e0e644ff3204 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/pagemap.h>
15#include <linux/percpu.h> 16#include <linux/percpu.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
@@ -112,7 +113,7 @@ static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
112 * As a performance optimization, other platforms preserve the fixmap mapping 113 * As a performance optimization, other platforms preserve the fixmap mapping
113 * across a context switch, we don't presently do this, but this could be done 114 * across a context switch, we don't presently do this, but this could be done
114 * in a similar fashion as to the wired TLB interface that sh64 uses (by way 115 * in a similar fashion as to the wired TLB interface that sh64 uses (by way
115 * of the memorry mapped UTLB configuration) -- this unfortunately forces us to 116 * of the memory mapped UTLB configuration) -- this unfortunately forces us to
116 * give up a TLB entry for each mapping we want to preserve. While this may be 117 * give up a TLB entry for each mapping we want to preserve. While this may be
117 * viable for a small number of fixmaps, it's not particularly useful for 118 * viable for a small number of fixmaps, it's not particularly useful for
118 * everything and needs to be carefully evaluated. (ie, we may want this for 119 * everything and needs to be carefully evaluated. (ie, we may want this for
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 02aae06527dc..b6a5a338145b 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Privileged Space Mapping Buffer (PMB) Support. 4 * Privileged Space Mapping Buffer (PMB) Support.
5 * 5 *
6 * Copyright (C) 2005, 2006 Paul Mundt 6 * Copyright (C) 2005, 2006, 2007 Paul Mundt
7 * 7 *
8 * P1/P2 Section mapping definitions from map32.h, which was: 8 * P1/P2 Section mapping definitions from map32.h, which was:
9 * 9 *
@@ -68,6 +68,32 @@ static inline unsigned long mk_pmb_data(unsigned int entry)
68 return mk_pmb_entry(entry) | PMB_DATA; 68 return mk_pmb_entry(entry) | PMB_DATA;
69} 69}
70 70
71static DEFINE_SPINLOCK(pmb_list_lock);
72static struct pmb_entry *pmb_list;
73
74static inline void pmb_list_add(struct pmb_entry *pmbe)
75{
76 struct pmb_entry **p, *tmp;
77
78 p = &pmb_list;
79 while ((tmp = *p) != NULL)
80 p = &tmp->next;
81
82 pmbe->next = tmp;
83 *p = pmbe;
84}
85
86static inline void pmb_list_del(struct pmb_entry *pmbe)
87{
88 struct pmb_entry **p, *tmp;
89
90 for (p = &pmb_list; (tmp = *p); p = &tmp->next)
91 if (tmp == pmbe) {
92 *p = tmp->next;
93 return;
94 }
95}
96
71struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn, 97struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
72 unsigned long flags) 98 unsigned long flags)
73{ 99{
@@ -81,11 +107,19 @@ struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
81 pmbe->ppn = ppn; 107 pmbe->ppn = ppn;
82 pmbe->flags = flags; 108 pmbe->flags = flags;
83 109
110 spin_lock_irq(&pmb_list_lock);
111 pmb_list_add(pmbe);
112 spin_unlock_irq(&pmb_list_lock);
113
84 return pmbe; 114 return pmbe;
85} 115}
86 116
87void pmb_free(struct pmb_entry *pmbe) 117void pmb_free(struct pmb_entry *pmbe)
88{ 118{
119 spin_lock_irq(&pmb_list_lock);
120 pmb_list_del(pmbe);
121 spin_unlock_irq(&pmb_list_lock);
122
89 kmem_cache_free(pmb_cache, pmbe); 123 kmem_cache_free(pmb_cache, pmbe);
90} 124}
91 125
@@ -167,31 +201,6 @@ void clear_pmb_entry(struct pmb_entry *pmbe)
167 clear_bit(entry, &pmb_map); 201 clear_bit(entry, &pmb_map);
168} 202}
169 203
170static DEFINE_SPINLOCK(pmb_list_lock);
171static struct pmb_entry *pmb_list;
172
173static inline void pmb_list_add(struct pmb_entry *pmbe)
174{
175 struct pmb_entry **p, *tmp;
176
177 p = &pmb_list;
178 while ((tmp = *p) != NULL)
179 p = &tmp->next;
180
181 pmbe->next = tmp;
182 *p = pmbe;
183}
184
185static inline void pmb_list_del(struct pmb_entry *pmbe)
186{
187 struct pmb_entry **p, *tmp;
188
189 for (p = &pmb_list; (tmp = *p); p = &tmp->next)
190 if (tmp == pmbe) {
191 *p = tmp->next;
192 return;
193 }
194}
195 204
196static struct { 205static struct {
197 unsigned long size; 206 unsigned long size;
@@ -283,25 +292,14 @@ void pmb_unmap(unsigned long addr)
283 } while (pmbe); 292 } while (pmbe);
284} 293}
285 294
286static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep, unsigned long flags) 295static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep,
296 unsigned long flags)
287{ 297{
288 struct pmb_entry *pmbe = pmb; 298 struct pmb_entry *pmbe = pmb;
289 299
290 memset(pmb, 0, sizeof(struct pmb_entry)); 300 memset(pmb, 0, sizeof(struct pmb_entry));
291 301
292 spin_lock_irq(&pmb_list_lock);
293
294 pmbe->entry = PMB_NO_ENTRY; 302 pmbe->entry = PMB_NO_ENTRY;
295 pmb_list_add(pmbe);
296
297 spin_unlock_irq(&pmb_list_lock);
298}
299
300static void pmb_cache_dtor(void *pmb, struct kmem_cache *cachep, unsigned long flags)
301{
302 spin_lock_irq(&pmb_list_lock);
303 pmb_list_del(pmb);
304 spin_unlock_irq(&pmb_list_lock);
305} 303}
306 304
307static int __init pmb_init(void) 305static int __init pmb_init(void)
@@ -312,8 +310,7 @@ static int __init pmb_init(void)
312 BUG_ON(unlikely(nr_entries >= NR_PMB_ENTRIES)); 310 BUG_ON(unlikely(nr_entries >= NR_PMB_ENTRIES));
313 311
314 pmb_cache = kmem_cache_create("pmb", sizeof(struct pmb_entry), 0, 312 pmb_cache = kmem_cache_create("pmb", sizeof(struct pmb_entry), 0,
315 SLAB_PANIC, pmb_cache_ctor, 313 SLAB_PANIC, pmb_cache_ctor, NULL);
316 pmb_cache_dtor);
317 314
318 jump_to_P2(); 315 jump_to_P2();
319 316
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 554f801db67b..fb40f188aff9 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -7,8 +7,11 @@
7# 7#
8SE SH_SOLUTION_ENGINE 8SE SH_SOLUTION_ENGINE
97751SE SH_7751_SOLUTION_ENGINE 97751SE SH_7751_SOLUTION_ENGINE
107722SE SH_7722_SOLUTION_ENGINE
107300SE SH_7300_SOLUTION_ENGINE 117300SE SH_7300_SOLUTION_ENGINE
117343SE SH_7343_SOLUTION_ENGINE 127343SE SH_7343_SOLUTION_ENGINE
137206SE SH_7206_SOLUTION_ENGINE
147619SE SH_7619_SOLUTION_ENGINE
127780SE SH_7780_SOLUTION_ENGINE 157780SE SH_7780_SOLUTION_ENGINE
1373180SE SH_73180_SOLUTION_ENGINE 1673180SE SH_73180_SOLUTION_ENGINE
147751SYSTEMH SH_7751_SYSTEMH 177751SYSTEMH SH_7751_SYSTEMH
@@ -31,5 +34,3 @@ R7785RP SH_R7785RP
31TITAN SH_TITAN 34TITAN SH_TITAN
32SHMIN SH_SHMIN 35SHMIN SH_SHMIN
337710VOIPGW SH_7710VOIPGW 367710VOIPGW SH_7710VOIPGW
347206SE SH_7206_SOLUTION_ENGINE
357619SE SH_7619_SOLUTION_ENGINE
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 79471f85eb89..3fc13fa8729d 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -144,9 +144,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
144 int exit_with = WEXITSTATUS(status); 144 int exit_with = WEXITSTATUS(status);
145 if (exit_with == 2) 145 if (exit_with == 2)
146 non_fatal("check_ptrace : child exited with status 2. " 146 non_fatal("check_ptrace : child exited with status 2. "
147 "Serious trouble happening! Try updating " 147 "\nDisabling SYSEMU support.\n");
148 "your host skas patch!\nDisabling SYSEMU "
149 "support.");
150 non_fatal("check_ptrace : child exited with exitcode %d, while " 148 non_fatal("check_ptrace : child exited with exitcode %d, while "
151 "expecting %d; status 0x%x\n", exit_with, 149 "expecting %d; status 0x%x\n", exit_with,
152 exitcode, status); 150 exitcode, status);
@@ -209,6 +207,7 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
209static void __init check_sysemu(void) 207static void __init check_sysemu(void)
210{ 208{
211 void *stack; 209 void *stack;
210 unsigned long regs[MAX_REG_NR];
212 int pid, n, status, count=0; 211 int pid, n, status, count=0;
213 212
214 non_fatal("Checking syscall emulation patch for ptrace..."); 213 non_fatal("Checking syscall emulation patch for ptrace...");
@@ -225,11 +224,20 @@ static void __init check_sysemu(void)
225 fatal("check_sysemu : expected SIGTRAP, got status = %d", 224 fatal("check_sysemu : expected SIGTRAP, got status = %d",
226 status); 225 status);
227 226
228 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 227 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
229 os_getpid()); 228 fatal_perror("check_sysemu : PTRACE_GETREGS failed");
230 if(n < 0) 229 if(PT_SYSCALL_NR(regs) != __NR_getpid){
231 fatal_perror("check_sysemu : failed to modify system call " 230 non_fatal("check_sysemu got system call number %d, "
232 "return"); 231 "expected %d...", PT_SYSCALL_NR(regs), __NR_getpid);
232 goto fail;
233 }
234
235 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
236 if(n < 0){
237 non_fatal("check_sysemu : failed to modify system call "
238 "return");
239 goto fail;
240 }
233 241
234 if (stop_ptraced_child(pid, stack, 0, 0) < 0) 242 if (stop_ptraced_child(pid, stack, 0, 0) < 0)
235 goto fail_stopped; 243 goto fail_stopped;
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 145bb824b2a8..5ce94430c019 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -428,12 +428,15 @@ config NR_CPUS
428 memory in the static kernel configuration. 428 memory in the static kernel configuration.
429 429
430config HOTPLUG_CPU 430config HOTPLUG_CPU
431 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 431 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
432 depends on SMP && HOTPLUG && EXPERIMENTAL 432 depends on SMP && HOTPLUG && EXPERIMENTAL
433 help 433 help
434 Say Y here to experiment with turning CPUs off and on. CPUs 434 Say Y here to experiment with turning CPUs off and on. CPUs
435 can be controlled through /sys/devices/system/cpu/cpu#. 435 can be controlled through /sys/devices/system/cpu/cpu#.
436 Say N if you want to disable CPU hotplug. 436 This is also required for suspend/hibernation on SMP systems.
437
438 Say N if you want to disable CPU hotplug and don't need to
439 suspend.
437 440
438config ARCH_ENABLE_MEMORY_HOTPLUG 441config ARCH_ENABLE_MEMORY_HOTPLUG
439 def_bool y 442 def_bool y
diff --git a/arch/x86_64/kernel/k8.c b/arch/x86_64/kernel/k8.c
index bc11b32e8b4d..7377ccb21335 100644
--- a/arch/x86_64/kernel/k8.c
+++ b/arch/x86_64/kernel/k8.c
@@ -39,10 +39,10 @@ int cache_k8_northbridges(void)
39{ 39{
40 int i; 40 int i;
41 struct pci_dev *dev; 41 struct pci_dev *dev;
42
42 if (num_k8_northbridges) 43 if (num_k8_northbridges)
43 return 0; 44 return 0;
44 45
45 num_k8_northbridges = 0;
46 dev = NULL; 46 dev = NULL;
47 while ((dev = next_k8_northbridge(dev)) != NULL) 47 while ((dev = next_k8_northbridge(dev)) != NULL)
48 num_k8_northbridges++; 48 num_k8_northbridges++;
@@ -52,6 +52,11 @@ int cache_k8_northbridges(void)
52 if (!k8_northbridges) 52 if (!k8_northbridges)
53 return -ENOMEM; 53 return -ENOMEM;
54 54
55 if (!num_k8_northbridges) {
56 k8_northbridges[0] = NULL;
57 return 0;
58 }
59
55 flush_words = kmalloc(num_k8_northbridges * sizeof(u32), GFP_KERNEL); 60 flush_words = kmalloc(num_k8_northbridges * sizeof(u32), GFP_KERNEL);
56 if (!flush_words) { 61 if (!flush_words) {
57 kfree(k8_northbridges); 62 kfree(k8_northbridges);
diff --git a/block/genhd.c b/block/genhd.c
index 93a2cf654597..863a8c0623ed 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -423,7 +423,10 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page)
423{ 423{
424 return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk)); 424 return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
425} 425}
426 426static ssize_t disk_capability_read(struct gendisk *disk, char *page)
427{
428 return sprintf(page, "%x\n", disk->flags);
429}
427static ssize_t disk_stats_read(struct gendisk * disk, char *page) 430static ssize_t disk_stats_read(struct gendisk * disk, char *page)
428{ 431{
429 preempt_disable(); 432 preempt_disable();
@@ -466,6 +469,10 @@ static struct disk_attribute disk_attr_size = {
466 .attr = {.name = "size", .mode = S_IRUGO }, 469 .attr = {.name = "size", .mode = S_IRUGO },
467 .show = disk_size_read 470 .show = disk_size_read
468}; 471};
472static struct disk_attribute disk_attr_capability = {
473 .attr = {.name = "capability", .mode = S_IRUGO },
474 .show = disk_capability_read
475};
469static struct disk_attribute disk_attr_stat = { 476static struct disk_attribute disk_attr_stat = {
470 .attr = {.name = "stat", .mode = S_IRUGO }, 477 .attr = {.name = "stat", .mode = S_IRUGO },
471 .show = disk_stats_read 478 .show = disk_stats_read
@@ -506,6 +513,7 @@ static struct attribute * default_attrs[] = {
506 &disk_attr_removable.attr, 513 &disk_attr_removable.attr,
507 &disk_attr_size.attr, 514 &disk_attr_size.attr,
508 &disk_attr_stat.attr, 515 &disk_attr_stat.attr,
516 &disk_attr_capability.attr,
509#ifdef CONFIG_FAIL_MAKE_REQUEST 517#ifdef CONFIG_FAIL_MAKE_REQUEST
510 &disk_attr_fail.attr, 518 &disk_attr_fail.attr,
511#endif 519#endif
@@ -688,6 +696,27 @@ struct seq_operations diskstats_op = {
688 .show = diskstats_show 696 .show = diskstats_show
689}; 697};
690 698
699static void media_change_notify_thread(struct work_struct *work)
700{
701 struct gendisk *gd = container_of(work, struct gendisk, async_notify);
702 char event[] = "MEDIA_CHANGE=1";
703 char *envp[] = { event, NULL };
704
705 /*
706 * set enviroment vars to indicate which event this is for
707 * so that user space will know to go check the media status.
708 */
709 kobject_uevent_env(&gd->kobj, KOBJ_CHANGE, envp);
710 put_device(gd->driverfs_dev);
711}
712
713void genhd_media_change_notify(struct gendisk *disk)
714{
715 get_device(disk->driverfs_dev);
716 schedule_work(&disk->async_notify);
717}
718EXPORT_SYMBOL_GPL(genhd_media_change_notify);
719
691struct gendisk *alloc_disk(int minors) 720struct gendisk *alloc_disk(int minors)
692{ 721{
693 return alloc_disk_node(minors, -1); 722 return alloc_disk_node(minors, -1);
@@ -717,6 +746,8 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
717 kobj_set_kset_s(disk,block_subsys); 746 kobj_set_kset_s(disk,block_subsys);
718 kobject_init(&disk->kobj); 747 kobject_init(&disk->kobj);
719 rand_initialize_disk(disk); 748 rand_initialize_disk(disk);
749 INIT_WORK(&disk->async_notify,
750 media_change_notify_thread);
720 } 751 }
721 return disk; 752 return disk;
722} 753}
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 0458811010fd..9c07b88631be 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -578,6 +578,7 @@ static const struct ich_laptop ich_laptop[] = {
578 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 578 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
579 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 579 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
580 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 580 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
581 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */
581 /* end marker */ 582 /* end marker */
582 { 0, } 583 { 0, }
583}; 584};
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a6de57e02047..3ca9c610c110 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3022,7 +3022,7 @@ int ata_wait_ready(struct ata_port *ap, unsigned long deadline)
3022 3022
3023 if (!(status & ATA_BUSY)) 3023 if (!(status & ATA_BUSY))
3024 return 0; 3024 return 0;
3025 if (status == 0xff) 3025 if (!ata_port_online(ap) && status == 0xff)
3026 return -ENODEV; 3026 return -ENODEV;
3027 if (time_after(now, deadline)) 3027 if (time_after(now, deadline))
3028 return -EBUSY; 3028 return -EBUSY;
@@ -3368,7 +3368,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3368 */ 3368 */
3369 if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) { 3369 if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) {
3370 rc = ata_wait_ready(ap, deadline); 3370 rc = ata_wait_ready(ap, deadline);
3371 if (rc) { 3371 if (rc && rc != -ENODEV) {
3372 ata_port_printk(ap, KERN_WARNING, "device not ready " 3372 ata_port_printk(ap, KERN_WARNING, "device not ready "
3373 "(errno=%d), forcing hardreset\n", rc); 3373 "(errno=%d), forcing hardreset\n", rc);
3374 ehc->i.action |= ATA_EH_HARDRESET; 3374 ehc->i.action |= ATA_EH_HARDRESET;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 242c43eef807..b3900cfbd880 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1050,14 +1050,15 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
1050static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen) 1050static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
1051{ 1051{
1052 u64 lba = 0; 1052 u64 lba = 0;
1053 u32 len = 0; 1053 u32 len;
1054 1054
1055 VPRINTK("six-byte command\n"); 1055 VPRINTK("six-byte command\n");
1056 1056
1057 lba |= ((u64)(cdb[1] & 0x1f)) << 16;
1057 lba |= ((u64)cdb[2]) << 8; 1058 lba |= ((u64)cdb[2]) << 8;
1058 lba |= ((u64)cdb[3]); 1059 lba |= ((u64)cdb[3]);
1059 1060
1060 len |= ((u32)cdb[4]); 1061 len = cdb[4];
1061 1062
1062 *plba = lba; 1063 *plba = lba;
1063 *plen = len; 1064 *plen = len;
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 7b4810c171b7..03b6ddd2abd2 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -97,7 +97,7 @@ static int artop6260_pre_reset(struct ata_port *ap, unsigned long deadline)
97 * artop6260_cable_detect - identify cable type 97 * artop6260_cable_detect - identify cable type
98 * @ap: Port 98 * @ap: Port
99 * 99 *
100 * Identify the cable type for the ARTOp interface in question 100 * Identify the cable type for the ARTOP interface in question
101 */ 101 */
102 102
103static int artop6260_cable_detect(struct ata_port *ap) 103static int artop6260_cable_detect(struct ata_port *ap)
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index a54c17433eef..6446735a46e0 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -26,7 +26,7 @@
26#include <linux/libata.h> 26#include <linux/libata.h>
27 27
28#define DRV_NAME "pata_hpt37x" 28#define DRV_NAME "pata_hpt37x"
29#define DRV_VERSION "0.6.5" 29#define DRV_VERSION "0.6.6"
30 30
31struct hpt_clock { 31struct hpt_clock {
32 u8 xfer_speed; 32 u8 xfer_speed;
@@ -931,15 +931,6 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
931 .udma_mask = 0x7f, 931 .udma_mask = 0x7f,
932 .port_ops = &hpt372_port_ops 932 .port_ops = &hpt372_port_ops
933 }; 933 };
934 /* HPT371, 372 and friends - UDMA100 at 50MHz clock */
935 static const struct ata_port_info info_hpt372_50 = {
936 .sht = &hpt37x_sht,
937 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
938 .pio_mask = 0x1f,
939 .mwdma_mask = 0x07,
940 .udma_mask = 0x3f,
941 .port_ops = &hpt372_port_ops
942 };
943 /* HPT374 - UDMA133 */ 934 /* HPT374 - UDMA133 */
944 static const struct ata_port_info info_hpt374 = { 935 static const struct ata_port_info info_hpt374 = {
945 .sht = &hpt37x_sht, 936 .sht = &hpt37x_sht,
@@ -1098,17 +1089,21 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1098 * use a 50MHz DPLL by choice 1089 * use a 50MHz DPLL by choice
1099 */ 1090 */
1100 unsigned int f_low, f_high; 1091 unsigned int f_low, f_high;
1101 int adjust; 1092 int dpll, adjust;
1102 1093
1103 clock_slot = 2; 1094 /* Compute DPLL */
1095 dpll = 2;
1104 if (port->udma_mask & 0xE0) 1096 if (port->udma_mask & 0xE0)
1105 clock_slot = 3; 1097 dpll = 3;
1106 1098
1107 f_low = (MHz[clock_slot] * chip_table->base) / 192; 1099 f_low = (MHz[clock_slot] * 48) / MHz[dpll];
1108 f_high = f_low + 2; 1100 f_high = f_low + 2;
1101 if (clock_slot > 1)
1102 f_high += 2;
1109 1103
1110 /* Select the DPLL clock. */ 1104 /* Select the DPLL clock. */
1111 pci_write_config_byte(dev, 0x5b, 0x21); 1105 pci_write_config_byte(dev, 0x5b, 0x21);
1106 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
1112 1107
1113 for(adjust = 0; adjust < 8; adjust++) { 1108 for(adjust = 0; adjust < 8; adjust++) {
1114 if (hpt37x_calibrate_dpll(dev)) 1109 if (hpt37x_calibrate_dpll(dev))
@@ -1124,12 +1119,12 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1124 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n"); 1119 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n");
1125 return -ENODEV; 1120 return -ENODEV;
1126 } 1121 }
1127 if (clock_slot == 3) 1122 if (dpll == 3)
1128 private_data = (void *)hpt37x_timings_66; 1123 private_data = (void *)hpt37x_timings_66;
1129 else 1124 else
1130 private_data = (void *)hpt37x_timings_50; 1125 private_data = (void *)hpt37x_timings_50;
1131 1126
1132 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); 1127 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[dpll]);
1133 } else { 1128 } else {
1134 private_data = (void *)chip_table->clocks[clock_slot]; 1129 private_data = (void *)chip_table->clocks[clock_slot];
1135 /* 1130 /*
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index f25154aed75d..e947433cb37d 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -521,8 +521,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
521 /* 371N if rev > 1 */ 521 /* 371N if rev > 1 */
522 break; 522 break;
523 case PCI_DEVICE_ID_TTI_HPT372: 523 case PCI_DEVICE_ID_TTI_HPT372:
524 /* 372N if rev >= 1*/ 524 /* 372N if rev >= 2*/
525 if (class_rev == 0) 525 if (class_rev < 2)
526 return -ENODEV; 526 return -ENODEV;
527 break; 527 break;
528 case PCI_DEVICE_ID_TTI_HPT302: 528 case PCI_DEVICE_ID_TTI_HPT302:
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index ff9a6fd36657..b3456d7a592c 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * ata-it821x.c - IT821x PATA for new ATA layer 2 * pata_it821x.c - IT821x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@redhat.com>
5 * 5 *
@@ -65,7 +65,6 @@
65 * 65 *
66 * TODO 66 * TODO
67 * - ATAPI and other speed filtering 67 * - ATAPI and other speed filtering
68 * - Command filter in smart mode
69 * - RAID configuration ioctls 68 * - RAID configuration ioctls
70 */ 69 */
71 70
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index aa138d211b09..61502bc7bf1d 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -489,23 +489,26 @@ static unsigned int scc_devchk (struct ata_port *ap,
489 * Note: Original code is ata_bus_post_reset(). 489 * Note: Original code is ata_bus_post_reset().
490 */ 490 */
491 491
492static void scc_bus_post_reset (struct ata_port *ap, unsigned int devmask) 492static int scc_bus_post_reset(struct ata_port *ap, unsigned int devmask,
493 unsigned long deadline)
493{ 494{
494 struct ata_ioports *ioaddr = &ap->ioaddr; 495 struct ata_ioports *ioaddr = &ap->ioaddr;
495 unsigned int dev0 = devmask & (1 << 0); 496 unsigned int dev0 = devmask & (1 << 0);
496 unsigned int dev1 = devmask & (1 << 1); 497 unsigned int dev1 = devmask & (1 << 1);
497 unsigned long timeout; 498 int rc;
498 499
499 /* if device 0 was found in ata_devchk, wait for its 500 /* if device 0 was found in ata_devchk, wait for its
500 * BSY bit to clear 501 * BSY bit to clear
501 */ 502 */
502 if (dev0) 503 if (dev0) {
503 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); 504 rc = ata_wait_ready(ap, deadline);
505 if (rc && rc != -ENODEV)
506 return rc;
507 }
504 508
505 /* if device 1 was found in ata_devchk, wait for 509 /* if device 1 was found in ata_devchk, wait for
506 * register access, then wait for BSY to clear 510 * register access, then wait for BSY to clear
507 */ 511 */
508 timeout = jiffies + ATA_TMOUT_BOOT;
509 while (dev1) { 512 while (dev1) {
510 u8 nsect, lbal; 513 u8 nsect, lbal;
511 514
@@ -514,14 +517,15 @@ static void scc_bus_post_reset (struct ata_port *ap, unsigned int devmask)
514 lbal = in_be32(ioaddr->lbal_addr); 517 lbal = in_be32(ioaddr->lbal_addr);
515 if ((nsect == 1) && (lbal == 1)) 518 if ((nsect == 1) && (lbal == 1))
516 break; 519 break;
517 if (time_after(jiffies, timeout)) { 520 if (time_after(jiffies, deadline))
518 dev1 = 0; 521 return -EBUSY;
519 break;
520 }
521 msleep(50); /* give drive a breather */ 522 msleep(50); /* give drive a breather */
522 } 523 }
523 if (dev1) 524 if (dev1) {
524 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); 525 rc = ata_wait_ready(ap, deadline);
526 if (rc && rc != -ENODEV)
527 return rc;
528 }
525 529
526 /* is all this really necessary? */ 530 /* is all this really necessary? */
527 ap->ops->dev_select(ap, 0); 531 ap->ops->dev_select(ap, 0);
@@ -529,6 +533,8 @@ static void scc_bus_post_reset (struct ata_port *ap, unsigned int devmask)
529 ap->ops->dev_select(ap, 1); 533 ap->ops->dev_select(ap, 1);
530 if (dev0) 534 if (dev0)
531 ap->ops->dev_select(ap, 0); 535 ap->ops->dev_select(ap, 0);
536
537 return 0;
532} 538}
533 539
534/** 540/**
@@ -537,8 +543,8 @@ static void scc_bus_post_reset (struct ata_port *ap, unsigned int devmask)
537 * Note: Original code is ata_bus_softreset(). 543 * Note: Original code is ata_bus_softreset().
538 */ 544 */
539 545
540static unsigned int scc_bus_softreset (struct ata_port *ap, 546static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
541 unsigned int devmask) 547 unsigned long deadline)
542{ 548{
543 struct ata_ioports *ioaddr = &ap->ioaddr; 549 struct ata_ioports *ioaddr = &ap->ioaddr;
544 550
@@ -570,7 +576,7 @@ static unsigned int scc_bus_softreset (struct ata_port *ap,
570 if (scc_check_status(ap) == 0xFF) 576 if (scc_check_status(ap) == 0xFF)
571 return 0; 577 return 0;
572 578
573 scc_bus_post_reset(ap, devmask); 579 scc_bus_post_reset(ap, devmask, deadline);
574 580
575 return 0; 581 return 0;
576} 582}
@@ -579,11 +585,13 @@ static unsigned int scc_bus_softreset (struct ata_port *ap,
579 * scc_std_softreset - reset host port via ATA SRST 585 * scc_std_softreset - reset host port via ATA SRST
580 * @ap: port to reset 586 * @ap: port to reset
581 * @classes: resulting classes of attached devices 587 * @classes: resulting classes of attached devices
588 * @deadline: deadline jiffies for the operation
582 * 589 *
583 * Note: Original code is ata_std_softreset(). 590 * Note: Original code is ata_std_softreset().
584 */ 591 */
585 592
586static int scc_std_softreset (struct ata_port *ap, unsigned int *classes) 593static int scc_std_softreset (struct ata_port *ap, unsigned int *classes,
594 unsigned long deadline)
587{ 595{
588 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 596 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
589 unsigned int devmask = 0, err_mask; 597 unsigned int devmask = 0, err_mask;
@@ -607,7 +615,7 @@ static int scc_std_softreset (struct ata_port *ap, unsigned int *classes)
607 615
608 /* issue bus reset */ 616 /* issue bus reset */
609 DPRINTK("about to softreset, devmask=%x\n", devmask); 617 DPRINTK("about to softreset, devmask=%x\n", devmask);
610 err_mask = scc_bus_softreset(ap, devmask); 618 err_mask = scc_bus_softreset(ap, devmask, deadline);
611 if (err_mask) { 619 if (err_mask) {
612 ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n", 620 ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
613 err_mask); 621 err_mask);
@@ -676,10 +684,11 @@ static void scc_bmdma_stop (struct ata_queued_cmd *qc)
676 684
677 if (reg & INTSTS_BMSINT) { 685 if (reg & INTSTS_BMSINT) {
678 unsigned int classes; 686 unsigned int classes;
687 unsigned long deadline = jiffies + ATA_TMOUT_BOOT;
679 printk(KERN_WARNING "%s: Internal Bus Error\n", DRV_NAME); 688 printk(KERN_WARNING "%s: Internal Bus Error\n", DRV_NAME);
680 out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMSINT); 689 out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMSINT);
681 /* TBD: SW reset */ 690 /* TBD: SW reset */
682 scc_std_softreset(ap, &classes); 691 scc_std_softreset(ap, &classes, deadline);
683 continue; 692 continue;
684 } 693 }
685 694
@@ -862,9 +871,10 @@ static void scc_bmdma_freeze (struct ata_port *ap)
862/** 871/**
863 * scc_pata_prereset - prepare for reset 872 * scc_pata_prereset - prepare for reset
864 * @ap: ATA port to be reset 873 * @ap: ATA port to be reset
874 * @deadline: deadline jiffies for the operation
865 */ 875 */
866 876
867static int scc_pata_prereset (struct ata_port *ap, unsigned long deadline) 877static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
868{ 878{
869 ap->cbl = ATA_CBL_PATA80; 879 ap->cbl = ATA_CBL_PATA80;
870 return ata_std_prereset(ap, deadline); 880 return ata_std_prereset(ap, deadline);
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index f2231267e011..ec3ae9375015 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -73,14 +73,14 @@ static int sis_short_ata40(struct pci_dev *dev)
73} 73}
74 74
75/** 75/**
76 * sis_port_base - return PCI configuration base for dev 76 * sis_old_port_base - return PCI configuration base for dev
77 * @adev: device 77 * @adev: device
78 * 78 *
79 * Returns the base of the PCI configuration registers for this port 79 * Returns the base of the PCI configuration registers for this port
80 * number. 80 * number.
81 */ 81 */
82 82
83static int sis_port_base(struct ata_device *adev) 83static int sis_old_port_base(struct ata_device *adev)
84{ 84{
85 return 0x40 + (4 * adev->ap->port_no) + (2 * adev->devno); 85 return 0x40 + (4 * adev->ap->port_no) + (2 * adev->devno);
86} 86}
@@ -211,7 +211,7 @@ static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev)
211static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) 211static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev)
212{ 212{
213 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 213 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
214 int port = sis_port_base(adev); 214 int port = sis_old_port_base(adev);
215 u8 t1, t2; 215 u8 t1, t2;
216 int speed = adev->pio_mode - XFER_PIO_0; 216 int speed = adev->pio_mode - XFER_PIO_0;
217 217
@@ -248,7 +248,7 @@ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev)
248static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) 248static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev)
249{ 249{
250 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 250 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
251 int port = sis_port_base(adev); 251 int port = sis_old_port_base(adev);
252 int speed = adev->pio_mode - XFER_PIO_0; 252 int speed = adev->pio_mode - XFER_PIO_0;
253 253
254 const u8 actrec[] = { 0x00, 0x67, 0x44, 0x33, 0x31 }; 254 const u8 actrec[] = { 0x00, 0x67, 0x44, 0x33, 0x31 };
@@ -328,7 +328,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev)
328{ 328{
329 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 329 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
330 int speed = adev->dma_mode - XFER_MW_DMA_0; 330 int speed = adev->dma_mode - XFER_MW_DMA_0;
331 int drive_pci = sis_port_base(adev); 331 int drive_pci = sis_old_port_base(adev);
332 u16 timing; 332 u16 timing;
333 333
334 const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; 334 const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 };
@@ -367,7 +367,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev)
367{ 367{
368 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 368 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
369 int speed = adev->dma_mode - XFER_MW_DMA_0; 369 int speed = adev->dma_mode - XFER_MW_DMA_0;
370 int drive_pci = sis_port_base(adev); 370 int drive_pci = sis_old_port_base(adev);
371 u16 timing; 371 u16 timing;
372 372
373 const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; 373 const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 };
@@ -378,12 +378,12 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev)
378 if (adev->dma_mode < XFER_UDMA_0) { 378 if (adev->dma_mode < XFER_UDMA_0) {
379 /* bits 3-0 hold recovery timing bits 8-10 active timing and 379 /* bits 3-0 hold recovery timing bits 8-10 active timing and
380 the higer bits are dependant on the device, bit 15 udma */ 380 the higer bits are dependant on the device, bit 15 udma */
381 timing &= ~ 0x870F; 381 timing &= ~0x870F;
382 timing |= mwdma_bits[speed]; 382 timing |= mwdma_bits[speed];
383 } else { 383 } else {
384 /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ 384 /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */
385 speed = adev->dma_mode - XFER_UDMA_0; 385 speed = adev->dma_mode - XFER_UDMA_0;
386 timing &= ~0x6000; 386 timing &= ~0xF000;
387 timing |= udma_bits[speed]; 387 timing |= udma_bits[speed];
388 } 388 }
389 pci_write_config_word(pdev, drive_pci, timing); 389 pci_write_config_word(pdev, drive_pci, timing);
@@ -405,22 +405,22 @@ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev)
405{ 405{
406 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 406 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
407 int speed = adev->dma_mode - XFER_MW_DMA_0; 407 int speed = adev->dma_mode - XFER_MW_DMA_0;
408 int drive_pci = sis_port_base(adev); 408 int drive_pci = sis_old_port_base(adev);
409 u16 timing; 409 u8 timing;
410 410
411 const u16 udma_bits[] = { 0x8B00, 0x8700, 0x8500, 0x8300, 0x8200, 0x8100}; 411 const u8 udma_bits[] = { 0x8B, 0x87, 0x85, 0x83, 0x82, 0x81};
412 412
413 pci_read_config_word(pdev, drive_pci, &timing); 413 pci_read_config_byte(pdev, drive_pci + 1, &timing);
414 414
415 if (adev->dma_mode < XFER_UDMA_0) { 415 if (adev->dma_mode < XFER_UDMA_0) {
416 /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ 416 /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */
417 } else { 417 } else {
418 /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ 418 /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */
419 speed = adev->dma_mode - XFER_UDMA_0; 419 speed = adev->dma_mode - XFER_UDMA_0;
420 timing &= ~0x0F00; 420 timing &= ~0x8F;
421 timing |= udma_bits[speed]; 421 timing |= udma_bits[speed];
422 } 422 }
423 pci_write_config_word(pdev, drive_pci, timing); 423 pci_write_config_byte(pdev, drive_pci + 1, timing);
424} 424}
425 425
426/** 426/**
@@ -440,22 +440,22 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a
440{ 440{
441 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 441 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
442 int speed = adev->dma_mode - XFER_MW_DMA_0; 442 int speed = adev->dma_mode - XFER_MW_DMA_0;
443 int drive_pci = sis_port_base(adev); 443 int drive_pci = sis_old_port_base(adev);
444 u16 timing; 444 u8 timing;
445 445 /* Low 4 bits are timing */
446 static const u16 udma_bits[] = { 0x8F00, 0x8A00, 0x8700, 0x8500, 0x8300, 0x8200, 0x8100}; 446 static const u8 udma_bits[] = { 0x8F, 0x8A, 0x87, 0x85, 0x83, 0x82, 0x81};
447 447
448 pci_read_config_word(pdev, drive_pci, &timing); 448 pci_read_config_byte(pdev, drive_pci + 1, &timing);
449 449
450 if (adev->dma_mode < XFER_UDMA_0) { 450 if (adev->dma_mode < XFER_UDMA_0) {
451 /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */ 451 /* NOT SUPPORTED YET: NEED DATA SHEET. DITTO IN OLD DRIVER */
452 } else { 452 } else {
453 /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ 453 /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */
454 speed = adev->dma_mode - XFER_UDMA_0; 454 speed = adev->dma_mode - XFER_UDMA_0;
455 timing &= ~0x0F00; 455 timing &= ~0x8F;
456 timing |= udma_bits[speed]; 456 timing |= udma_bits[speed];
457 } 457 }
458 pci_write_config_word(pdev, drive_pci, timing); 458 pci_write_config_byte(pdev, drive_pci + 1, timing);
459} 459}
460 460
461/** 461/**
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index e4c71f76bd55..a8462f1e890b 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -60,6 +60,7 @@
60#include <linux/delay.h> 60#include <linux/delay.h>
61#include <scsi/scsi_host.h> 61#include <scsi/scsi_host.h>
62#include <linux/libata.h> 62#include <linux/libata.h>
63#include <linux/dmi.h>
63 64
64#define DRV_NAME "pata_via" 65#define DRV_NAME "pata_via"
65#define DRV_VERSION "0.3.1" 66#define DRV_VERSION "0.3.1"
@@ -122,6 +123,31 @@ static const struct via_isa_bridge {
122 { NULL } 123 { NULL }
123}; 124};
124 125
126
127/*
128 * Cable special cases
129 */
130
131static struct dmi_system_id cable_dmi_table[] = {
132 {
133 .ident = "Acer Ferrari 3400",
134 .matches = {
135 DMI_MATCH(DMI_BOARD_VENDOR, "Acer,Inc."),
136 DMI_MATCH(DMI_BOARD_NAME, "Ferrari 3400"),
137 },
138 },
139 { }
140};
141
142static int via_cable_override(struct pci_dev *pdev)
143{
144 /* Systems by DMI */
145 if (dmi_check_system(cable_dmi_table))
146 return 1;
147 return 0;
148}
149
150
125/** 151/**
126 * via_cable_detect - cable detection 152 * via_cable_detect - cable detection
127 * @ap: ATA port 153 * @ap: ATA port
@@ -139,6 +165,9 @@ static int via_cable_detect(struct ata_port *ap) {
139 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 165 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
140 u32 ata66; 166 u32 ata66;
141 167
168 if (via_cable_override(pdev))
169 return ATA_CBL_PATA40_SHORT;
170
142 /* Early chips are 40 wire */ 171 /* Early chips are 40 wire */
143 if ((config->flags & VIA_UDMA) < VIA_UDMA_66) 172 if ((config->flags & VIA_UDMA) < VIA_UDMA_66)
144 return ATA_CBL_PATA40; 173 return ATA_CBL_PATA40;
@@ -592,10 +621,11 @@ static int via_reinit_one(struct pci_dev *pdev)
592#endif 621#endif
593 622
594static const struct pci_device_id via[] = { 623static const struct pci_device_id via[] = {
595 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), }, 624 { PCI_VDEVICE(VIA, 0x0571), },
596 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C586_1), }, 625 { PCI_VDEVICE(VIA, 0x0581), },
597 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_6410), }, 626 { PCI_VDEVICE(VIA, 0x1571), },
598 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_SATA_EIDE), }, 627 { PCI_VDEVICE(VIA, 0x3164), },
628 { PCI_VDEVICE(VIA, 0x5324), },
599 629
600 { }, 630 { },
601}; 631};
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 705a020e1597..c957e6e54ba1 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -21,6 +21,50 @@
21 * 21 *
22 */ 22 */
23 23
24/*
25 sata_mv TODO list:
26
27 1) Needs a full errata audit for all chipsets. I implemented most
28 of the errata workarounds found in the Marvell vendor driver, but
29 I distinctly remember a couple workarounds (one related to PCI-X)
30 are still needed.
31
32 2) Convert to LibATA new EH. Required for hotplug, NCQ, and sane
33 probing/error handling in general. MUST HAVE.
34
35 3) Add hotplug support (easy, once new-EH support appears)
36
37 4) Add NCQ support (easy to intermediate, once new-EH support appears)
38
39 5) Investigate problems with PCI Message Signalled Interrupts (MSI).
40
41 6) Add port multiplier support (intermediate)
42
43 7) Test and verify 3.0 Gbps support
44
45 8) Develop a low-power-consumption strategy, and implement it.
46
47 9) [Experiment, low priority] See if ATAPI can be supported using
48 "unknown FIS" or "vendor-specific FIS" support, or something creative
49 like that.
50
51 10) [Experiment, low priority] Investigate interrupt coalescing.
52 Quite often, especially with PCI Message Signalled Interrupts (MSI),
53 the overhead reduced by interrupt mitigation is quite often not
54 worth the latency cost.
55
56 11) [Experiment, Marvell value added] Is it possible to use target
57 mode to cross-connect two Linux boxes with Marvell cards? If so,
58 creating LibATA target mode support would be very interesting.
59
60 Target mode, for those without docs, is the ability to directly
61 connect two SATA controllers.
62
63 13) Verify that 7042 is fully supported. I only have a 6042.
64
65*/
66
67
24#include <linux/kernel.h> 68#include <linux/kernel.h>
25#include <linux/module.h> 69#include <linux/module.h>
26#include <linux/pci.h> 70#include <linux/pci.h>
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 3a7d9b5332af..2b924a69b365 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -297,7 +297,7 @@ static const struct ata_port_info pdc_port_info[] = {
297 297
298 /* board_2057x_pata */ 298 /* board_2057x_pata */
299 { 299 {
300 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, 300 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS |
301 PDC_FLAG_GEN_II, 301 PDC_FLAG_GEN_II,
302 .pio_mask = 0x1f, /* pio0-4 */ 302 .pio_mask = 0x1f, /* pio0-4 */
303 .mwdma_mask = 0x07, /* mwdma0-2 */ 303 .mwdma_mask = 0x07, /* mwdma0-2 */
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 51d9251b0898..221099d1d08f 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -255,7 +255,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
255{ 255{
256 static int printed_version; 256 static int printed_version;
257 struct ata_port_info pi = sis_port_info; 257 struct ata_port_info pi = sis_port_info;
258 const struct ata_port_info *ppi[] = { &pi, NULL }; 258 const struct ata_port_info *ppi[] = { &pi, &pi };
259 struct ata_host *host; 259 struct ata_host *host;
260 u32 genctl, val; 260 u32 genctl, val;
261 u8 pmr; 261 u8 pmr;
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 01bba26d8d1a..e8b90e7b42dd 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -85,6 +85,9 @@ static const struct pci_device_id svia_pci_tbl[] = {
85 { PCI_VDEVICE(VIA, 0x0591), vt6420 }, 85 { PCI_VDEVICE(VIA, 0x0591), vt6420 },
86 { PCI_VDEVICE(VIA, 0x3149), vt6420 }, 86 { PCI_VDEVICE(VIA, 0x3149), vt6420 },
87 { PCI_VDEVICE(VIA, 0x3249), vt6421 }, 87 { PCI_VDEVICE(VIA, 0x3249), vt6421 },
88 { PCI_VDEVICE(VIA, 0x5287), vt6420 },
89 { PCI_VDEVICE(VIA, 0x5372), vt6420 },
90 { PCI_VDEVICE(VIA, 0x7372), vt6420 },
88 91
89 { } /* terminate list */ 92 { } /* terminate list */
90}; 93};
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 057efbc55d38..3800bc0cb2ef 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -47,7 +47,8 @@ static char const rcsid[] =
47#include <linux/bitops.h> 47#include <linux/bitops.h>
48#include <linux/wait.h> 48#include <linux/wait.h>
49#include <linux/jiffies.h> 49#include <linux/jiffies.h>
50#include <asm/semaphore.h> 50#include <linux/mutex.h>
51
51#include <asm/io.h> 52#include <asm/io.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/atomic.h> 54#include <asm/atomic.h>
@@ -2435,7 +2436,7 @@ idt77252_open(struct atm_vcc *vcc)
2435 2436
2436 set_bit(ATM_VF_ADDR, &vcc->flags); 2437 set_bit(ATM_VF_ADDR, &vcc->flags);
2437 2438
2438 down(&card->mutex); 2439 mutex_lock(&card->mutex);
2439 2440
2440 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci); 2441 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci);
2441 2442
@@ -2446,7 +2447,7 @@ idt77252_open(struct atm_vcc *vcc)
2446 break; 2447 break;
2447 default: 2448 default:
2448 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal); 2449 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
2449 up(&card->mutex); 2450 mutex_unlock(&card->mutex);
2450 return -EPROTONOSUPPORT; 2451 return -EPROTONOSUPPORT;
2451 } 2452 }
2452 2453
@@ -2455,7 +2456,7 @@ idt77252_open(struct atm_vcc *vcc)
2455 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL); 2456 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2456 if (!card->vcs[index]) { 2457 if (!card->vcs[index]) {
2457 printk("%s: can't alloc vc in open()\n", card->name); 2458 printk("%s: can't alloc vc in open()\n", card->name);
2458 up(&card->mutex); 2459 mutex_unlock(&card->mutex);
2459 return -ENOMEM; 2460 return -ENOMEM;
2460 } 2461 }
2461 card->vcs[index]->card = card; 2462 card->vcs[index]->card = card;
@@ -2484,14 +2485,14 @@ idt77252_open(struct atm_vcc *vcc)
2484 if (inuse) { 2485 if (inuse) {
2485 printk("%s: %s vci already in use.\n", card->name, 2486 printk("%s: %s vci already in use.\n", card->name,
2486 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx"); 2487 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
2487 up(&card->mutex); 2488 mutex_unlock(&card->mutex);
2488 return -EADDRINUSE; 2489 return -EADDRINUSE;
2489 } 2490 }
2490 2491
2491 if (vcc->qos.txtp.traffic_class != ATM_NONE) { 2492 if (vcc->qos.txtp.traffic_class != ATM_NONE) {
2492 error = idt77252_init_tx(card, vc, vcc, &vcc->qos); 2493 error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
2493 if (error) { 2494 if (error) {
2494 up(&card->mutex); 2495 mutex_unlock(&card->mutex);
2495 return error; 2496 return error;
2496 } 2497 }
2497 } 2498 }
@@ -2499,14 +2500,14 @@ idt77252_open(struct atm_vcc *vcc)
2499 if (vcc->qos.rxtp.traffic_class != ATM_NONE) { 2500 if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
2500 error = idt77252_init_rx(card, vc, vcc, &vcc->qos); 2501 error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
2501 if (error) { 2502 if (error) {
2502 up(&card->mutex); 2503 mutex_unlock(&card->mutex);
2503 return error; 2504 return error;
2504 } 2505 }
2505 } 2506 }
2506 2507
2507 set_bit(ATM_VF_READY, &vcc->flags); 2508 set_bit(ATM_VF_READY, &vcc->flags);
2508 2509
2509 up(&card->mutex); 2510 mutex_unlock(&card->mutex);
2510 return 0; 2511 return 0;
2511} 2512}
2512 2513
@@ -2520,7 +2521,7 @@ idt77252_close(struct atm_vcc *vcc)
2520 unsigned long addr; 2521 unsigned long addr;
2521 unsigned long timeout; 2522 unsigned long timeout;
2522 2523
2523 down(&card->mutex); 2524 mutex_lock(&card->mutex);
2524 2525
2525 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n", 2526 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
2526 card->name, vc->index, vcc->vpi, vcc->vci); 2527 card->name, vc->index, vcc->vpi, vcc->vci);
@@ -2591,7 +2592,7 @@ done:
2591 free_scq(card, vc->scq); 2592 free_scq(card, vc->scq);
2592 } 2593 }
2593 2594
2594 up(&card->mutex); 2595 mutex_unlock(&card->mutex);
2595} 2596}
2596 2597
2597static int 2598static int
@@ -2602,7 +2603,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2602 struct vc_map *vc = vcc->dev_data; 2603 struct vc_map *vc = vcc->dev_data;
2603 int error = 0; 2604 int error = 0;
2604 2605
2605 down(&card->mutex); 2606 mutex_lock(&card->mutex);
2606 2607
2607 if (qos->txtp.traffic_class != ATM_NONE) { 2608 if (qos->txtp.traffic_class != ATM_NONE) {
2608 if (!test_bit(VCF_TX, &vc->flags)) { 2609 if (!test_bit(VCF_TX, &vc->flags)) {
@@ -2648,7 +2649,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2648 set_bit(ATM_VF_HASQOS, &vcc->flags); 2649 set_bit(ATM_VF_HASQOS, &vcc->flags);
2649 2650
2650out: 2651out:
2651 up(&card->mutex); 2652 mutex_unlock(&card->mutex);
2652 return error; 2653 return error;
2653} 2654}
2654 2655
@@ -3709,7 +3710,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3709 membase = pci_resource_start(pcidev, 1); 3710 membase = pci_resource_start(pcidev, 1);
3710 srambase = pci_resource_start(pcidev, 2); 3711 srambase = pci_resource_start(pcidev, 2);
3711 3712
3712 init_MUTEX(&card->mutex); 3713 mutex_init(&card->mutex);
3713 spin_lock_init(&card->cmd_lock); 3714 spin_lock_init(&card->cmd_lock);
3714 spin_lock_init(&card->tst_lock); 3715 spin_lock_init(&card->tst_lock);
3715 3716
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h
index 544b39738291..6f2b4a5875fb 100644
--- a/drivers/atm/idt77252.h
+++ b/drivers/atm/idt77252.h
@@ -37,7 +37,7 @@
37#include <linux/ptrace.h> 37#include <linux/ptrace.h>
38#include <linux/skbuff.h> 38#include <linux/skbuff.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40 40#include <linux/mutex.h>
41 41
42/*****************************************************************************/ 42/*****************************************************************************/
43/* */ 43/* */
@@ -359,7 +359,7 @@ struct idt77252_dev
359 unsigned long srambase; /* SAR's sram base address */ 359 unsigned long srambase; /* SAR's sram base address */
360 void __iomem *fbq[4]; /* FBQ fill addresses */ 360 void __iomem *fbq[4]; /* FBQ fill addresses */
361 361
362 struct semaphore mutex; 362 struct mutex mutex;
363 spinlock_t cmd_lock; /* for r/w utility/sram */ 363 spinlock_t cmd_lock; /* for r/w utility/sram */
364 364
365 unsigned long softstat; 365 unsigned long softstat;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 3587cb434371..fe088045dd08 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -670,7 +670,7 @@ static void __reschedule_timeout(int drive, const char *message, int marg)
670 if (drive == current_reqD) 670 if (drive == current_reqD)
671 drive = current_drive; 671 drive = current_drive;
672 del_timer(&fd_timeout); 672 del_timer(&fd_timeout);
673 if (drive < 0 || drive > N_DRIVE) { 673 if (drive < 0 || drive >= N_DRIVE) {
674 fd_timeout.expires = jiffies + 20UL * HZ; 674 fd_timeout.expires = jiffies + 20UL * HZ;
675 drive = 0; 675 drive = 0;
676 } else 676 } else
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index b0238b46dded..7e04dd69f609 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -115,11 +115,11 @@ static struct usb_device_id blacklist_ids[] = {
115 { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 }, 115 { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 },
116 116
117 /* Broadcom BCM2045 */ 117 /* Broadcom BCM2045 */
118 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_WRONG_SCO_MTU }, 118 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
119 119
120 /* IBM/Lenovo ThinkPad with Broadcom chip */ 120 /* IBM/Lenovo ThinkPad with Broadcom chip */
121 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, 121 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
122 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU }, 122 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
123 123
124 /* Targus ACB10US */ 124 /* Targus ACB10US */
125 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET }, 125 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET },
@@ -128,17 +128,17 @@ static struct usb_device_id blacklist_ids[] = {
128 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET }, 128 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
129 129
130 /* HP laptop with Broadcom chip */ 130 /* HP laptop with Broadcom chip */
131 { USB_DEVICE(0x03f0, 0x171d), .driver_info = HCI_WRONG_SCO_MTU }, 131 { USB_DEVICE(0x03f0, 0x171d), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
132 132
133 /* Dell laptop with Broadcom chip */ 133 /* Dell laptop with Broadcom chip */
134 { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_WRONG_SCO_MTU }, 134 { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
135 135
136 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ 136 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
137 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, 137 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
138 138
139 /* Kensington Bluetooth USB adapter */ 139 /* Kensington Bluetooth USB adapter */
140 { USB_DEVICE(0x047d, 0x105d), .driver_info = HCI_RESET }, 140 { USB_DEVICE(0x047d, 0x105d), .driver_info = HCI_RESET },
141 { USB_DEVICE(0x047d, 0x105e), .driver_info = HCI_WRONG_SCO_MTU }, 141 { USB_DEVICE(0x047d, 0x105e), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
142 142
143 /* ISSC Bluetooth Adapter v3.1 */ 143 /* ISSC Bluetooth Adapter v3.1 */
144 { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, 144 { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET },
@@ -148,8 +148,8 @@ static struct usb_device_id blacklist_ids[] = {
148 { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, 148 { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC },
149 149
150 /* Belkin F8T012 and F8T013 devices */ 150 /* Belkin F8T012 and F8T013 devices */
151 { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_WRONG_SCO_MTU }, 151 { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
152 { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_WRONG_SCO_MTU }, 152 { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
153 153
154 /* Digianswer devices */ 154 /* Digianswer devices */
155 { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER }, 155 { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index abcafac64738..ef683ebd367c 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -815,7 +815,7 @@ config SGI_IP27_RTC
815 815
816config GEN_RTC 816config GEN_RTC
817 tristate "Generic /dev/rtc emulation" 817 tristate "Generic /dev/rtc emulation"
818 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV && !S390 818 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV && !S390 && !SUPERH
819 ---help--- 819 ---help---
820 If you say Y here and create a character special file /dev/rtc with 820 If you say Y here and create a character special file /dev/rtc with
821 major number 10 and minor number 135 using mknod ("man mknod"), you 821 major number 10 and minor number 135 using mknod ("man mknod"), you
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index c72ee97d3892..ca376b92162c 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1061,6 +1061,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
1061 1061
1062 if (data & info->ignore_status_mask) { 1062 if (data & info->ignore_status_mask) {
1063 info->icount.rx++; 1063 info->icount.rx++;
1064 spin_unlock(&cinfo->card_lock);
1064 return; 1065 return;
1065 } 1066 }
1066 if (tty_buffer_request_room(tty, 1)) { 1067 if (tty_buffer_request_room(tty, 1)) {
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 6d3840e629de..6a86958b577f 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op)
102 u32 flags = 0; 102 u32 flags = 0;
103 unsigned long iflags; 103 unsigned long iflags;
104 104
105 if (op->len == 0 || op->src == op->dst) 105 if (op->len == 0)
106 return 0; 106 return 0;
107 107
108 if (op->flags & AES_FLAGS_COHERENT) 108 /* If the source and destination is the same, then
109 * we need to turn on the coherent flags, otherwise
110 * we don't need to worry
111 */
112
113 if (op->src == op->dst)
109 flags |= (AES_CTRL_DCA | AES_CTRL_SCA); 114 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
110 115
111 if (op->dir == AES_DIR_ENCRYPT) 116 if (op->dir == AES_DIR_ENCRYPT)
@@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
120 _writefield(AES_WRITEIV0_REG, op->iv); 125 _writefield(AES_WRITEIV0_REG, op->iv);
121 } 126 }
122 127
123 if (op->flags & AES_FLAGS_USRKEY) { 128 if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
124 flags |= AES_CTRL_WRKEY; 129 flags |= AES_CTRL_WRKEY;
125 _writefield(AES_WRITEKEY0_REG, op->key); 130 _writefield(AES_WRITEKEY0_REG, op->key);
126 } 131 }
@@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = {
289 .setkey = geode_setkey, 294 .setkey = geode_setkey,
290 .encrypt = geode_cbc_encrypt, 295 .encrypt = geode_cbc_encrypt,
291 .decrypt = geode_cbc_decrypt, 296 .decrypt = geode_cbc_decrypt,
297 .ivsize = AES_IV_LENGTH,
292 } 298 }
293 } 299 }
294}; 300};
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h
index 8003a36f3a83..f47968671ae7 100644
--- a/drivers/crypto/geode-aes.h
+++ b/drivers/crypto/geode-aes.h
@@ -20,8 +20,7 @@
20#define AES_DIR_DECRYPT 0 20#define AES_DIR_DECRYPT 0
21#define AES_DIR_ENCRYPT 1 21#define AES_DIR_ENCRYPT 1
22 22
23#define AES_FLAGS_USRKEY (1 << 0) 23#define AES_FLAGS_HIDDENKEY (1 << 0)
24#define AES_FLAGS_COHERENT (1 << 1)
25 24
26struct geode_aes_op { 25struct geode_aes_op {
27 26
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0c160675b3ac..366f4a1a2cb8 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -491,6 +491,12 @@ out:
491 491
492/* Sysfs Files */ 492/* Sysfs Files */
493 493
494static ssize_t applesmc_name_show(struct device *dev,
495 struct device_attribute *attr, char *buf)
496{
497 return snprintf(buf, PAGE_SIZE, "applesmc\n");
498}
499
494static ssize_t applesmc_position_show(struct device *dev, 500static ssize_t applesmc_position_show(struct device *dev,
495 struct device_attribute *attr, char *buf) 501 struct device_attribute *attr, char *buf)
496{ 502{
@@ -913,6 +919,8 @@ static struct led_classdev applesmc_backlight = {
913 .brightness_set = applesmc_brightness_set, 919 .brightness_set = applesmc_brightness_set,
914}; 920};
915 921
922static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
923
916static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL); 924static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
917static DEVICE_ATTR(calibrate, 0644, 925static DEVICE_ATTR(calibrate, 0644,
918 applesmc_calibrate_show, applesmc_calibrate_store); 926 applesmc_calibrate_show, applesmc_calibrate_store);
@@ -1197,6 +1205,8 @@ static int __init applesmc_init(void)
1197 goto out_driver; 1205 goto out_driver;
1198 } 1206 }
1199 1207
1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr);
1209
1200 /* Create key enumeration sysfs files */ 1210 /* Create key enumeration sysfs files */
1201 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); 1211 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group);
1202 if (ret) 1212 if (ret)
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index e68a96f589fd..e4540fcf6476 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -830,7 +830,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
830 830
831 i2c->irq = res; 831 i2c->irq = res;
832 832
833 dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start); 833 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
834 (unsigned long)res->start);
834 835
835 ret = i2c_add_adapter(&i2c->adap); 836 ret = i2c_add_adapter(&i2c->adap);
836 if (ret < 0) { 837 if (ret < 0) {
diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index 907999049d50..cb9abe7565a7 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -208,7 +208,7 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
208 dev->adapter.class = I2C_CLASS_HWMON; 208 dev->adapter.class = I2C_CLASS_HWMON;
209 dev->adapter.algo = &usb_algorithm; 209 dev->adapter.algo = &usb_algorithm;
210 dev->adapter.algo_data = dev; 210 dev->adapter.algo_data = dev;
211 snprintf(dev->adapter.name, I2C_NAME_SIZE, 211 snprintf(dev->adapter.name, sizeof(dev->adapter.name),
212 "i2c-tiny-usb at bus %03d device %03d", 212 "i2c-tiny-usb at bus %03d device %03d",
213 dev->usb_dev->bus->busnum, dev->usb_dev->devnum); 213 dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
214 214
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 64f8e56d300e..435925eba437 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -697,9 +697,10 @@ int i2c_attach_client(struct i2c_client *client)
697 if (client->driver) 697 if (client->driver)
698 client->dev.driver = &client->driver->driver; 698 client->dev.driver = &client->driver->driver;
699 699
700 if (client->driver && !is_newstyle_driver(client->driver)) 700 if (client->driver && !is_newstyle_driver(client->driver)) {
701 client->dev.release = i2c_client_release; 701 client->dev.release = i2c_client_release;
702 else 702 client->dev.uevent_suppress = 1;
703 } else
703 client->dev.release = i2c_client_dev_release; 704 client->dev.release = i2c_client_dev_release;
704 705
705 snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), 706 snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index b77b7d138c49..ead141e2db9e 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -119,15 +119,17 @@ static const struct drive_list_entry drive_blacklist [] = {
119 { "HITACHI CDR-8335" , "ALL" }, 119 { "HITACHI CDR-8335" , "ALL" },
120 { "HITACHI CDR-8435" , "ALL" }, 120 { "HITACHI CDR-8435" , "ALL" },
121 { "Toshiba CD-ROM XM-6202B" , "ALL" }, 121 { "Toshiba CD-ROM XM-6202B" , "ALL" },
122 { "TOSHIBA CD-ROM XM-1702BC", "ALL" },
122 { "CD-532E-A" , "ALL" }, 123 { "CD-532E-A" , "ALL" },
123 { "E-IDE CD-ROM CR-840", "ALL" }, 124 { "E-IDE CD-ROM CR-840", "ALL" },
124 { "CD-ROM Drive/F5A", "ALL" }, 125 { "CD-ROM Drive/F5A", "ALL" },
125 { "WPI CDD-820", "ALL" }, 126 { "WPI CDD-820", "ALL" },
126 { "SAMSUNG CD-ROM SC-148C", "ALL" }, 127 { "SAMSUNG CD-ROM SC-148C", "ALL" },
127 { "SAMSUNG CD-ROM SC", "ALL" }, 128 { "SAMSUNG CD-ROM SC", "ALL" },
128 { "SanDisk SDP3B-64" , "ALL" },
129 { "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" }, 129 { "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" },
130 { "_NEC DV5800A", "ALL" }, 130 { "_NEC DV5800A", "ALL" },
131 { "SAMSUNG CD-ROM SN-124", "N001" },
132 { "Seagate STT20000A", "ALL" },
131 { NULL , NULL } 133 { NULL , NULL }
132 134
133}; 135};
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index d50bd996ff22..ea94c9aa1220 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -67,6 +67,8 @@ static int proc_ide_read_imodel
67 case ide_4drives: name = "4drives"; break; 67 case ide_4drives: name = "4drives"; break;
68 case ide_pmac: name = "mac-io"; break; 68 case ide_pmac: name = "mac-io"; break;
69 case ide_au1xxx: name = "au1xxx"; break; 69 case ide_au1xxx: name = "au1xxx"; break;
70 case ide_etrax100: name = "etrax100"; break;
71 case ide_acorn: name = "acorn"; break;
70 default: name = "(unknown)"; break; 72 default: name = "(unknown)"; break;
71 } 73 }
72 len = sprintf(page, "%s\n", name); 74 len = sprintf(page, "%s\n", name);
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 0e52ad722a72..8ab33faf6f76 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -317,6 +317,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
317 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 317 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
318 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 318 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
319 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 319 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
320 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
320 { 0, }, 321 { 0, },
321}; 322};
322MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); 323MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 6234f806c6b5..47bcd91c9b5f 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -158,6 +158,12 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
158 pci_read_config_word(dev, 0x4A, &csb5_pio); 158 pci_read_config_word(dev, 0x4A, &csb5_pio);
159 pci_read_config_byte(dev, 0x54, &ultra_enable); 159 pci_read_config_byte(dev, 0x54, &ultra_enable);
160 160
161 /* If we are in RAID mode (eg AMI MegaIDE) then we can't it
162 turns out trust the firmware configuration */
163
164 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
165 goto oem_setup_failed;
166
161 /* Per Specified Design by OEM, and ASIC Architect */ 167 /* Per Specified Design by OEM, and ASIC Architect */
162 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || 168 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
163 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) { 169 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
@@ -173,7 +179,7 @@ dma_pio:
173 ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) { 179 ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) {
174 u8 dmaspeed = dma_timing; 180 u8 dmaspeed = dma_timing;
175 181
176 dma_timing &= ~0xFF; 182 dma_timing &= ~0xFFU;
177 if ((dmaspeed & 0x20) == 0x20) 183 if ((dmaspeed & 0x20) == 0x20)
178 dmaspeed = XFER_MW_DMA_2; 184 dmaspeed = XFER_MW_DMA_2;
179 else if ((dmaspeed & 0x21) == 0x21) 185 else if ((dmaspeed & 0x21) == 0x21)
@@ -187,7 +193,7 @@ dma_pio:
187 } else if (pio_timing) { 193 } else if (pio_timing) {
188 u8 piospeed = pio_timing; 194 u8 piospeed = pio_timing;
189 195
190 pio_timing &= ~0xFF; 196 pio_timing &= ~0xFFU;
191 if ((piospeed & 0x20) == 0x20) 197 if ((piospeed & 0x20) == 0x20)
192 piospeed = XFER_PIO_4; 198 piospeed = XFER_PIO_4;
193 else if ((piospeed & 0x22) == 0x22) 199 else if ((piospeed & 0x22) == 0x22)
@@ -208,8 +214,8 @@ dma_pio:
208 214
209oem_setup_failed: 215oem_setup_failed:
210 216
211 pio_timing &= ~0xFF; 217 pio_timing &= ~0xFFU;
212 dma_timing &= ~0xFF; 218 dma_timing &= ~0xFFU;
213 ultra_timing &= ~(0x0F << (4*unit)); 219 ultra_timing &= ~(0x0F << (4*unit));
214 ultra_enable &= ~(0x01 << drive->dn); 220 ultra_enable &= ~(0x01 << drive->dn);
215 csb5_pio &= ~(0x0F << (4*drive->dn)); 221 csb5_pio &= ~(0x0F << (4*drive->dn));
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c
index 7f0beec74f70..5766ae3a2029 100644
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -331,7 +331,7 @@ u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
331 0); 331 0);
332 qp->ipz_qp_handle.handle = outs[0]; 332 qp->ipz_qp_handle.handle = outs[0];
333 qp->real_qp_num = (u32)outs[1]; 333 qp->real_qp_num = (u32)outs[1];
334 parms->act_nr_send_sges = 334 parms->act_nr_send_wqes =
335 (u16)EHCA_BMASK_GET(H_ALL_RES_QP_ACT_OUTST_SEND_WR, outs[2]); 335 (u16)EHCA_BMASK_GET(H_ALL_RES_QP_ACT_OUTST_SEND_WR, outs[2]);
336 parms->act_nr_recv_wqes = 336 parms->act_nr_recv_wqes =
337 (u16)EHCA_BMASK_GET(H_ALL_RES_QP_ACT_OUTST_RECV_WR, outs[2]); 337 (u16)EHCA_BMASK_GET(H_ALL_RES_QP_ACT_OUTST_RECV_WR, outs[2]);
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index a824bc5f79fd..dc137dec2308 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -270,9 +270,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
270 struct ib_qp_init_attr *init_attr, 270 struct ib_qp_init_attr *init_attr,
271 struct ib_udata *udata, int sqpn, struct mlx4_ib_qp *qp) 271 struct ib_udata *udata, int sqpn, struct mlx4_ib_qp *qp)
272{ 272{
273 struct mlx4_wqe_ctrl_seg *ctrl;
274 int err; 273 int err;
275 int i;
276 274
277 mutex_init(&qp->mutex); 275 mutex_init(&qp->mutex);
278 spin_lock_init(&qp->sq.lock); 276 spin_lock_init(&qp->sq.lock);
@@ -319,20 +317,24 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
319 if (err) 317 if (err)
320 goto err_mtt; 318 goto err_mtt;
321 319
322 err = mlx4_ib_db_map_user(to_mucontext(pd->uobject->context), 320 if (!init_attr->srq) {
323 ucmd.db_addr, &qp->db); 321 err = mlx4_ib_db_map_user(to_mucontext(pd->uobject->context),
324 if (err) 322 ucmd.db_addr, &qp->db);
325 goto err_mtt; 323 if (err)
324 goto err_mtt;
325 }
326 } else { 326 } else {
327 err = set_kernel_sq_size(dev, &init_attr->cap, init_attr->qp_type, qp); 327 err = set_kernel_sq_size(dev, &init_attr->cap, init_attr->qp_type, qp);
328 if (err) 328 if (err)
329 goto err; 329 goto err;
330 330
331 err = mlx4_ib_db_alloc(dev, &qp->db, 0); 331 if (!init_attr->srq) {
332 if (err) 332 err = mlx4_ib_db_alloc(dev, &qp->db, 0);
333 goto err; 333 if (err)
334 goto err;
334 335
335 *qp->db.db = 0; 336 *qp->db.db = 0;
337 }
336 338
337 if (mlx4_buf_alloc(dev->dev, qp->buf_size, PAGE_SIZE * 2, &qp->buf)) { 339 if (mlx4_buf_alloc(dev->dev, qp->buf_size, PAGE_SIZE * 2, &qp->buf)) {
338 err = -ENOMEM; 340 err = -ENOMEM;
@@ -348,11 +350,6 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
348 if (err) 350 if (err)
349 goto err_mtt; 351 goto err_mtt;
350 352
351 for (i = 0; i < qp->sq.max; ++i) {
352 ctrl = get_send_wqe(qp, i);
353 ctrl->owner_opcode = cpu_to_be32(1 << 31);
354 }
355
356 qp->sq.wrid = kmalloc(qp->sq.max * sizeof (u64), GFP_KERNEL); 353 qp->sq.wrid = kmalloc(qp->sq.max * sizeof (u64), GFP_KERNEL);
357 qp->rq.wrid = kmalloc(qp->rq.max * sizeof (u64), GFP_KERNEL); 354 qp->rq.wrid = kmalloc(qp->rq.max * sizeof (u64), GFP_KERNEL);
358 355
@@ -386,7 +383,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
386 return 0; 383 return 0;
387 384
388err_wrid: 385err_wrid:
389 if (pd->uobject) 386 if (pd->uobject && !init_attr->srq)
390 mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &qp->db); 387 mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &qp->db);
391 else { 388 else {
392 kfree(qp->sq.wrid); 389 kfree(qp->sq.wrid);
@@ -403,7 +400,7 @@ err_buf:
403 mlx4_buf_free(dev->dev, qp->buf_size, &qp->buf); 400 mlx4_buf_free(dev->dev, qp->buf_size, &qp->buf);
404 401
405err_db: 402err_db:
406 if (!pd->uobject) 403 if (!pd->uobject && !init_attr->srq)
407 mlx4_ib_db_free(dev, &qp->db); 404 mlx4_ib_db_free(dev, &qp->db);
408 405
409err: 406err:
@@ -481,14 +478,16 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp,
481 mlx4_mtt_cleanup(dev->dev, &qp->mtt); 478 mlx4_mtt_cleanup(dev->dev, &qp->mtt);
482 479
483 if (is_user) { 480 if (is_user) {
484 mlx4_ib_db_unmap_user(to_mucontext(qp->ibqp.uobject->context), 481 if (!qp->ibqp.srq)
485 &qp->db); 482 mlx4_ib_db_unmap_user(to_mucontext(qp->ibqp.uobject->context),
483 &qp->db);
486 ib_umem_release(qp->umem); 484 ib_umem_release(qp->umem);
487 } else { 485 } else {
488 kfree(qp->sq.wrid); 486 kfree(qp->sq.wrid);
489 kfree(qp->rq.wrid); 487 kfree(qp->rq.wrid);
490 mlx4_buf_free(dev->dev, qp->buf_size, &qp->buf); 488 mlx4_buf_free(dev->dev, qp->buf_size, &qp->buf);
491 mlx4_ib_db_free(dev, &qp->db); 489 if (!qp->ibqp.srq)
490 mlx4_ib_db_free(dev, &qp->db);
492 } 491 }
493} 492}
494 493
@@ -852,7 +851,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
852 if (ibqp->srq) 851 if (ibqp->srq)
853 context->srqn = cpu_to_be32(1 << 24 | to_msrq(ibqp->srq)->msrq.srqn); 852 context->srqn = cpu_to_be32(1 << 24 | to_msrq(ibqp->srq)->msrq.srqn);
854 853
855 if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) 854 if (!ibqp->srq && cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT)
856 context->db_rec_addr = cpu_to_be64(qp->db.dma); 855 context->db_rec_addr = cpu_to_be64(qp->db.dma);
857 856
858 if (cur_state == IB_QPS_INIT && 857 if (cur_state == IB_QPS_INIT &&
@@ -872,6 +871,21 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
872 else 871 else
873 sqd_event = 0; 872 sqd_event = 0;
874 873
874 /*
875 * Before passing a kernel QP to the HW, make sure that the
876 * ownership bits of the send queue are set so that the
877 * hardware doesn't start processing stale work requests.
878 */
879 if (!ibqp->uobject && cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
880 struct mlx4_wqe_ctrl_seg *ctrl;
881 int i;
882
883 for (i = 0; i < qp->sq.max; ++i) {
884 ctrl = get_send_wqe(qp, i);
885 ctrl->owner_opcode = cpu_to_be32(1 << 31);
886 }
887 }
888
875 err = mlx4_qp_modify(dev->dev, &qp->mtt, to_mlx4_state(cur_state), 889 err = mlx4_qp_modify(dev->dev, &qp->mtt, to_mlx4_state(cur_state),
876 to_mlx4_state(new_state), context, optpar, 890 to_mlx4_state(new_state), context, optpar,
877 sqd_event, &qp->mqp); 891 sqd_event, &qp->mqp);
@@ -919,7 +933,8 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
919 qp->rq.tail = 0; 933 qp->rq.tail = 0;
920 qp->sq.head = 0; 934 qp->sq.head = 0;
921 qp->sq.tail = 0; 935 qp->sq.tail = 0;
922 *qp->db.db = 0; 936 if (!ibqp->srq)
937 *qp->db.db = 0;
923 } 938 }
924 939
925out: 940out:
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index a0b3782c7625..158759e28a5b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -429,6 +429,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);
429 429
430void ipoib_pkey_poll(struct work_struct *work); 430void ipoib_pkey_poll(struct work_struct *work);
431int ipoib_pkey_dev_delay_open(struct net_device *dev); 431int ipoib_pkey_dev_delay_open(struct net_device *dev);
432void ipoib_drain_cq(struct net_device *dev);
432 433
433#ifdef CONFIG_INFINIBAND_IPOIB_CM 434#ifdef CONFIG_INFINIBAND_IPOIB_CM
434 435
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index ffec794b7913..f133b56fd978 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -713,7 +713,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)
713 while (!list_empty(&priv->cm.rx_error_list) || 713 while (!list_empty(&priv->cm.rx_error_list) ||
714 !list_empty(&priv->cm.rx_flush_list) || 714 !list_empty(&priv->cm.rx_flush_list) ||
715 !list_empty(&priv->cm.rx_drain_list)) { 715 !list_empty(&priv->cm.rx_drain_list)) {
716 if (!time_after(jiffies, begin + 5 * HZ)) { 716 if (time_after(jiffies, begin + 5 * HZ)) {
717 ipoib_warn(priv, "RX drain timing out\n"); 717 ipoib_warn(priv, "RX drain timing out\n");
718 718
719 /* 719 /*
@@ -726,6 +726,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)
726 } 726 }
727 spin_unlock_irq(&priv->lock); 727 spin_unlock_irq(&priv->lock);
728 msleep(1); 728 msleep(1);
729 ipoib_drain_cq(dev);
729 spin_lock_irq(&priv->lock); 730 spin_lock_irq(&priv->lock);
730 } 731 }
731 732
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index c1aad06eb4e9..8404f05b2b6e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -550,13 +550,30 @@ static int recvs_pending(struct net_device *dev)
550 return pending; 550 return pending;
551} 551}
552 552
553void ipoib_drain_cq(struct net_device *dev)
554{
555 struct ipoib_dev_priv *priv = netdev_priv(dev);
556 int i, n;
557 do {
558 n = ib_poll_cq(priv->cq, IPOIB_NUM_WC, priv->ibwc);
559 for (i = 0; i < n; ++i) {
560 if (priv->ibwc[i].wr_id & IPOIB_CM_OP_SRQ)
561 ipoib_cm_handle_rx_wc(dev, priv->ibwc + i);
562 else if (priv->ibwc[i].wr_id & IPOIB_OP_RECV)
563 ipoib_ib_handle_rx_wc(dev, priv->ibwc + i);
564 else
565 ipoib_ib_handle_tx_wc(dev, priv->ibwc + i);
566 }
567 } while (n == IPOIB_NUM_WC);
568}
569
553int ipoib_ib_dev_stop(struct net_device *dev, int flush) 570int ipoib_ib_dev_stop(struct net_device *dev, int flush)
554{ 571{
555 struct ipoib_dev_priv *priv = netdev_priv(dev); 572 struct ipoib_dev_priv *priv = netdev_priv(dev);
556 struct ib_qp_attr qp_attr; 573 struct ib_qp_attr qp_attr;
557 unsigned long begin; 574 unsigned long begin;
558 struct ipoib_tx_buf *tx_req; 575 struct ipoib_tx_buf *tx_req;
559 int i, n; 576 int i;
560 577
561 clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); 578 clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags);
562 netif_poll_disable(dev); 579 netif_poll_disable(dev);
@@ -611,17 +628,7 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush)
611 goto timeout; 628 goto timeout;
612 } 629 }
613 630
614 do { 631 ipoib_drain_cq(dev);
615 n = ib_poll_cq(priv->cq, IPOIB_NUM_WC, priv->ibwc);
616 for (i = 0; i < n; ++i) {
617 if (priv->ibwc[i].wr_id & IPOIB_CM_OP_SRQ)
618 ipoib_cm_handle_rx_wc(dev, priv->ibwc + i);
619 else if (priv->ibwc[i].wr_id & IPOIB_OP_RECV)
620 ipoib_ib_handle_rx_wc(dev, priv->ibwc + i);
621 else
622 ipoib_ib_handle_tx_wc(dev, priv->ibwc + i);
623 }
624 } while (n == IPOIB_NUM_WC);
625 632
626 msleep(1); 633 msleep(1);
627 } 634 }
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index fb129c479a66..682244b1c042 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -370,10 +370,8 @@ int iforce_init_device(struct iforce *iforce)
370 370
371/* 371/*
372 * Disable spring, enable force feedback. 372 * Disable spring, enable force feedback.
373 * FIXME: We should use iforce_set_autocenter() et al here.
374 */ 373 */
375 374 iforce_set_autocenter(input_dev, 0);
376 iforce_send_packet(iforce, FF_CMD_AUTOCENTER, "\004\000");
377 375
378/* 376/*
379 * Find appropriate device entry 377 * Find appropriate device entry
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
index 21c4e13d3a50..3154ccd74000 100644
--- a/drivers/input/joystick/iforce/iforce-packets.c
+++ b/drivers/input/joystick/iforce/iforce-packets.c
@@ -246,6 +246,8 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
246 246
247int iforce_get_id_packet(struct iforce *iforce, char *packet) 247int iforce_get_id_packet(struct iforce *iforce, char *packet)
248{ 248{
249 int status;
250
249 switch (iforce->bus) { 251 switch (iforce->bus) {
250 252
251 case IFORCE_USB: 253 case IFORCE_USB:
@@ -254,18 +256,22 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
254 iforce->cr.bRequest = packet[0]; 256 iforce->cr.bRequest = packet[0];
255 iforce->ctrl->dev = iforce->usbdev; 257 iforce->ctrl->dev = iforce->usbdev;
256 258
257 if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC)) 259 status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC);
260 if (status) {
261 err("usb_submit_urb failed %d", status);
258 return -1; 262 return -1;
263 }
259 264
260 wait_event_interruptible_timeout(iforce->wait, 265 wait_event_interruptible_timeout(iforce->wait,
261 iforce->ctrl->status != -EINPROGRESS, HZ); 266 iforce->ctrl->status != -EINPROGRESS, HZ);
262 267
263 if (iforce->ctrl->status) { 268 if (iforce->ctrl->status) {
269 dbg("iforce->ctrl->status = %d", iforce->ctrl->status);
264 usb_unlink_urb(iforce->ctrl); 270 usb_unlink_urb(iforce->ctrl);
265 return -1; 271 return -1;
266 } 272 }
267#else 273#else
268 err("iforce_get_id_packet: iforce->bus = USB!"); 274 dbg("iforce_get_id_packet: iforce->bus = USB!");
269#endif 275#endif
270 break; 276 break;
271 277
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 750099d8e3c6..1457b73850e7 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -65,6 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce)
65 XMIT_INC(iforce->xmit.tail, n); 65 XMIT_INC(iforce->xmit.tail, n);
66 66
67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { 67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) {
68 clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
68 warn("usb_submit_urb failed %d\n", n); 69 warn("usb_submit_urb failed %d\n", n);
69 } 70 }
70 71
@@ -163,8 +164,8 @@ static int iforce_usb_probe(struct usb_interface *intf,
163 usb_fill_int_urb(iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress), 164 usb_fill_int_urb(iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress),
164 iforce->data, 16, iforce_usb_irq, iforce, epirq->bInterval); 165 iforce->data, 16, iforce_usb_irq, iforce, epirq->bInterval);
165 166
166 usb_fill_bulk_urb(iforce->out, dev, usb_sndbulkpipe(dev, epout->bEndpointAddress), 167 usb_fill_int_urb(iforce->out, dev, usb_sndintpipe(dev, epout->bEndpointAddress),
167 iforce + 1, 32, iforce_usb_out, iforce); 168 iforce + 1, 32, iforce_usb_out, iforce, epout->bInterval);
168 169
169 usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0), 170 usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0),
170 (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce); 171 (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce);
diff --git a/drivers/input/misc/input-polldev.c b/drivers/input/misc/input-polldev.c
index 1b2b9c9c5d88..b773d4c756a6 100644
--- a/drivers/input/misc/input-polldev.c
+++ b/drivers/input/misc/input-polldev.c
@@ -12,6 +12,11 @@
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <linux/input-polldev.h> 13#include <linux/input-polldev.h>
14 14
15MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>");
16MODULE_DESCRIPTION("Generic implementation of a polled input device");
17MODULE_LICENSE("GPL v2");
18MODULE_VERSION("0.1");
19
15static DEFINE_MUTEX(polldev_mutex); 20static DEFINE_MUTEX(polldev_mutex);
16static int polldev_users; 21static int polldev_users;
17static struct workqueue_struct *polldev_wq; 22static struct workqueue_struct *polldev_wq;
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cf3e4664e72b..2c5f11a4f6b4 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -251,11 +251,15 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
251 251
252 dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); 252 dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]);
253 253
254 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++); 254 if (version) {
255 *version = (param[0] << 8) | (param[1] << 4) | i; 255 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++)
256 /* empty */;
257 *version = (param[0] << 8) | (param[1] << 4) | i;
258 }
256 259
257 for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) 260 for (i = 0; i < ARRAY_SIZE(alps_model_data); i++)
258 if (!memcmp(param, alps_model_data[i].signature, sizeof(alps_model_data[i].signature))) 261 if (!memcmp(param, alps_model_data[i].signature,
262 sizeof(alps_model_data[i].signature)))
259 return alps_model_data + i; 263 return alps_model_data + i;
260 264
261 return NULL; 265 return NULL;
@@ -380,32 +384,46 @@ static int alps_poll(struct psmouse *psmouse)
380 return 0; 384 return 0;
381} 385}
382 386
383static int alps_reconnect(struct psmouse *psmouse) 387static int alps_hw_init(struct psmouse *psmouse, int *version)
384{ 388{
385 struct alps_data *priv = psmouse->private; 389 struct alps_data *priv = psmouse->private;
386 int version;
387
388 psmouse_reset(psmouse);
389 390
390 if (!(priv->i = alps_get_model(psmouse, &version))) 391 priv->i = alps_get_model(psmouse, version);
392 if (!priv->i)
391 return -1; 393 return -1;
392 394
393 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 395 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
394 return -1; 396 return -1;
395 397
396 if (alps_tap_mode(psmouse, 1)) { 398 if (alps_tap_mode(psmouse, 1)) {
397 printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n"); 399 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
398 return -1; 400 return -1;
399 } 401 }
400 402
401 if (alps_absolute_mode(psmouse)) { 403 if (alps_absolute_mode(psmouse)) {
402 printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n"); 404 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
403 return -1; 405 return -1;
404 } 406 }
405 407
406 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0)) 408 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
407 return -1; 409 return -1;
408 410
411 /* ALPS needs stream mode, otherwise it won't report any data */
412 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) {
413 printk(KERN_ERR "alps.c: Failed to enable stream mode\n");
414 return -1;
415 }
416
417 return 0;
418}
419
420static int alps_reconnect(struct psmouse *psmouse)
421{
422 psmouse_reset(psmouse);
423
424 if (alps_hw_init(psmouse, NULL))
425 return -1;
426
409 return 0; 427 return 0;
410} 428}
411 429
@@ -430,23 +448,9 @@ int alps_init(struct psmouse *psmouse)
430 goto init_fail; 448 goto init_fail;
431 449
432 priv->dev2 = dev2; 450 priv->dev2 = dev2;
451 psmouse->private = priv;
433 452
434 priv->i = alps_get_model(psmouse, &version); 453 if (alps_hw_init(psmouse, &version))
435 if (!priv->i)
436 goto init_fail;
437
438 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
439 goto init_fail;
440
441 if (alps_tap_mode(psmouse, 1))
442 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
443
444 if (alps_absolute_mode(psmouse)) {
445 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
446 goto init_fail;
447 }
448
449 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
450 goto init_fail; 454 goto init_fail;
451 455
452 dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY); 456 dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
@@ -493,13 +497,13 @@ int alps_init(struct psmouse *psmouse)
493 /* We are having trouble resyncing ALPS touchpads so disable it for now */ 497 /* We are having trouble resyncing ALPS touchpads so disable it for now */
494 psmouse->resync_time = 0; 498 psmouse->resync_time = 0;
495 499
496 psmouse->private = priv;
497 return 0; 500 return 0;
498 501
499init_fail: 502init_fail:
500 psmouse_reset(psmouse); 503 psmouse_reset(psmouse);
501 input_free_device(dev2); 504 input_free_device(dev2);
502 kfree(priv); 505 kfree(priv);
506 psmouse->private = NULL;
503 return -1; 507 return -1;
504} 508}
505 509
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 9df74b72e6c4..0c5660d28caa 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -221,6 +221,7 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
221 { 66, PS2PP_KIND_MX, /* MX3100 reciver */ 221 { 66, PS2PP_KIND_MX, /* MX3100 reciver */
222 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 222 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
223 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL }, 223 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL },
224 { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */
224 { 73, 0, PS2PP_SIDE_BTN }, 225 { 73, 0, PS2PP_SIDE_BTN },
225 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 226 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
226 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 227 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 4f091800bfeb..e5cca9bd0406 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -12,17 +12,17 @@ menuconfig INPUT_TOUCHSCREEN
12if INPUT_TOUCHSCREEN 12if INPUT_TOUCHSCREEN
13 13
14config TOUCHSCREEN_ADS7846 14config TOUCHSCREEN_ADS7846
15 tristate "ADS 7846/7843 based touchscreens" 15 tristate "ADS7846/TSC2046 and ADS7843 based touchscreens"
16 depends on SPI_MASTER 16 depends on SPI_MASTER
17 depends on HWMON = n || HWMON 17 depends on HWMON = n || HWMON
18 help 18 help
19 Say Y here if you have a touchscreen interface using the 19 Say Y here if you have a touchscreen interface using the
20 ADS7846 or ADS7843 controller, and your board-specific setup 20 ADS7846/TSC2046 or ADS7843 controller, and your board-specific
21 code includes that in its table of SPI devices. 21 setup code includes that in its table of SPI devices.
22 22
23 If HWMON is selected, and the driver is told the reference voltage 23 If HWMON is selected, and the driver is told the reference voltage
24 on your board, you will also get hwmon interfaces for the voltage 24 on your board, you will also get hwmon interfaces for the voltage
25 (and on ads7846, temperature) sensors of this chip. 25 (and on ads7846/tsc2046, temperature) sensors of this chip.
26 26
27 If unsure, say N (but it's safe to say "Y"). 27 If unsure, say N (but it's safe to say "Y").
28 28
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 693e3b2a65a3..1c9069cd3bae 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -39,6 +39,7 @@
39/* 39/*
40 * This code has been heavily tested on a Nokia 770, and lightly 40 * This code has been heavily tested on a Nokia 770, and lightly
41 * tested on other ads7846 devices (OSK/Mistral, Lubbock). 41 * tested on other ads7846 devices (OSK/Mistral, Lubbock).
42 * TSC2046 is just newer ads7846 silicon.
42 * Support for ads7843 tested on Atmel at91sam926x-EK. 43 * Support for ads7843 tested on Atmel at91sam926x-EK.
43 * Support for ads7845 has only been stubbed in. 44 * Support for ads7845 has only been stubbed in.
44 * 45 *
@@ -847,7 +848,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
847 * may not. So we stick to very-portable 8 bit words, both RX and TX. 848 * may not. So we stick to very-portable 8 bit words, both RX and TX.
848 */ 849 */
849 spi->bits_per_word = 8; 850 spi->bits_per_word = 8;
850 spi->mode = SPI_MODE_1; 851 spi->mode = SPI_MODE_0;
851 err = spi_setup(spi); 852 err = spi_setup(spi);
852 if (err < 0) 853 if (err < 0)
853 return err; 854 return err;
diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c
index 61c15024c2a0..1a15475aedfc 100644
--- a/drivers/input/touchscreen/hp680_ts_input.c
+++ b/drivers/input/touchscreen/hp680_ts_input.c
@@ -1,7 +1,6 @@
1#include <linux/input.h> 1#include <linux/input.h>
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/init.h> 3#include <linux/init.h>
4
5#include <linux/interrupt.h> 4#include <linux/interrupt.h>
6#include <asm/io.h> 5#include <asm/io.h>
7#include <asm/delay.h> 6#include <asm/delay.h>
@@ -18,12 +17,12 @@
18#define PHDR 0xa400012e 17#define PHDR 0xa400012e
19#define SCPDR 0xa4000136 18#define SCPDR 0xa4000136
20 19
21static void do_softint(void *data); 20static void do_softint(struct work_struct *work);
22 21
23static struct input_dev *hp680_ts_dev; 22static struct input_dev *hp680_ts_dev;
24static DECLARE_WORK(work, do_softint); 23static DECLARE_DELAYED_WORK(work, do_softint);
25 24
26static void do_softint(void *data) 25static void do_softint(struct work_struct *work)
27{ 26{
28 int absx = 0, absy = 0; 27 int absx = 0, absy = 0;
29 u8 scpdr; 28 u8 scpdr;
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 6582816a0477..f0cbcdb008ed 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -288,9 +288,9 @@ static int ucb1400_ts_thread(void *_ucb)
288 struct ucb1400 *ucb = _ucb; 288 struct ucb1400 *ucb = _ucb;
289 struct task_struct *tsk = current; 289 struct task_struct *tsk = current;
290 int valid = 0; 290 int valid = 0;
291 struct sched_param param = { .sched_priority = 1 };
291 292
292 tsk->policy = SCHED_FIFO; 293 sched_setscheduler(tsk, SCHED_FIFO, &param);
293 tsk->rt_priority = 1;
294 294
295 while (!kthread_should_stop()) { 295 while (!kthread_should_stop()) {
296 unsigned int x, y, p; 296 unsigned int x, y, p;
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index ff284aeb8fbb..82edc1c1db7a 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -189,21 +189,21 @@ void *TransmitBufferSet(APPL * appl, dword ref)
189{ 189{
190 appl->xbuffer_used[ref] = true; 190 appl->xbuffer_used[ref] = true;
191 DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1)) 191 DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1))
192 return (void *) ref; 192 return (void *)(long)ref;
193} 193}
194 194
195void *TransmitBufferGet(APPL * appl, void *p) 195void *TransmitBufferGet(APPL * appl, void *p)
196{ 196{
197 if (appl->xbuffer_internal[(dword) p]) 197 if (appl->xbuffer_internal[(dword)(long)p])
198 return appl->xbuffer_internal[(dword) p]; 198 return appl->xbuffer_internal[(dword)(long)p];
199 199
200 return appl->xbuffer_ptr[(dword) p]; 200 return appl->xbuffer_ptr[(dword)(long)p];
201} 201}
202 202
203void TransmitBufferFree(APPL * appl, void *p) 203void TransmitBufferFree(APPL * appl, void *p)
204{ 204{
205 appl->xbuffer_used[(dword) p] = false; 205 appl->xbuffer_used[(dword)(long)p] = false;
206 DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword) p) + 1)) 206 DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword)(long)p) + 1))
207} 207}
208 208
209void *ReceiveBufferGet(APPL * appl, int Num) 209void *ReceiveBufferGet(APPL * appl, int Num)
@@ -301,7 +301,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
301 /* if DATA_B3_IND, copy data too */ 301 /* if DATA_B3_IND, copy data too */
302 if (command == _DATA_B3_I) { 302 if (command == _DATA_B3_I) {
303 dword data = GET_DWORD(&msg.info.data_b3_ind.Data); 303 dword data = GET_DWORD(&msg.info.data_b3_ind.Data);
304 memcpy(write + length, (void *) data, dlength); 304 memcpy(write + length, (void *)(long)data, dlength);
305 } 305 }
306 306
307#ifndef DIVA_NO_DEBUGLIB 307#ifndef DIVA_NO_DEBUGLIB
@@ -318,7 +318,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
318 if (myDriverDebugHandle.dbgMask & DL_BLK) { 318 if (myDriverDebugHandle.dbgMask & DL_BLK) {
319 xlog("\x00\x02", &msg, 0x81, length); 319 xlog("\x00\x02", &msg, 0x81, length);
320 for (i = 0; i < dlength; i += 256) { 320 for (i = 0; i < dlength; i += 256) {
321 DBG_BLK((((char *) GET_DWORD(&msg.info.data_b3_ind.Data)) + i, 321 DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
322 ((dlength - i) < 256) ? (dlength - i) : 256)) 322 ((dlength - i) < 256) ? (dlength - i) : 256))
323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) 323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
324 break; /* not more if not explicitely requested */ 324 break; /* not more if not explicitely requested */
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 784232a144c8..ccd35d047ec8 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * 2 *
4 Copyright (c) Eicon Networks, 2002. 3 Copyright (c) Eicon Networks, 2002.
@@ -533,7 +532,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
533 if (m->header.command == _DATA_B3_R) 532 if (m->header.command == _DATA_B3_R)
534 { 533 {
535 534
536 m->info.data_b3_req.Data = (dword)(TransmitBufferSet (appl, m->info.data_b3_req.Data)); 535 m->info.data_b3_req.Data = (dword)(long)(TransmitBufferSet (appl, m->info.data_b3_req.Data));
537 536
538 } 537 }
539 538
@@ -1032,7 +1031,7 @@ static void plci_free_msg_in_queue (PLCI *plci)
1032 { 1031 {
1033 1032
1034 TransmitBufferFree (plci->appl, 1033 TransmitBufferFree (plci->appl,
1035 (byte *)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data)); 1034 (byte *)(long)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data));
1036 1035
1037 } 1036 }
1038 1037
@@ -3118,7 +3117,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci,
3118 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) 3117 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue)))
3119 { 3118 {
3120 3119
3121 data->P = (byte *)(*((dword *)(parms[0].info))); 3120 data->P = (byte *)(long)(*((dword *)(parms[0].info)));
3122 3121
3123 } 3122 }
3124 else 3123 else
@@ -3151,7 +3150,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci,
3151 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) 3150 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue)))
3152 { 3151 {
3153 3152
3154 TransmitBufferFree (appl, (byte *)(*((dword *)(parms[0].info)))); 3153 TransmitBufferFree (appl, (byte *)(long)(*((dword *)(parms[0].info))));
3155 3154
3156 } 3155 }
3157 } 3156 }
@@ -4057,7 +4056,7 @@ capi_callback_suffix:
4057 { 4056 {
4058 if (m->header.command == _DATA_B3_R) 4057 if (m->header.command == _DATA_B3_R)
4059 4058
4060 TransmitBufferFree (appl, (byte *)(m->info.data_b3_req.Data)); 4059 TransmitBufferFree (appl, (byte *)(long)(m->info.data_b3_req.Data));
4061 4060
4062 dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command)); 4061 dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command));
4063 break; 4062 break;
@@ -7134,7 +7133,7 @@ void nl_ind(PLCI * plci)
7134 case N_UDATA: 7133 case N_UDATA:
7135 if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f)))) 7134 if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f))))
7136 { 7135 {
7137 plci->RData[0].P = plci->internal_ind_buffer + (-((int)(plci->internal_ind_buffer)) & 3); 7136 plci->RData[0].P = plci->internal_ind_buffer + (-((int)(long)(plci->internal_ind_buffer)) & 3);
7138 plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE; 7137 plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE;
7139 plci->NL.R = plci->RData; 7138 plci->NL.R = plci->RData;
7140 plci->NL.RNum = 1; 7139 plci->NL.RNum = 1;
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index da4196f21e0f..8d53a7fd2671 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1551,7 +1551,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
1551 if (retval == 0) { // yuck 1551 if (retval == 0) { // yuck
1552 cards[i].typ = 0; 1552 cards[i].typ = 0;
1553 nrcards--; 1553 nrcards--;
1554 return retval; 1554 return -EINVAL;
1555 } 1555 }
1556 cs = cards[i].cs; 1556 cs = cards[i].cs;
1557 hisax_d_if->cs = cs; 1557 hisax_d_if->cs = cs;
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 1f18f1993387..b1a26e02df02 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -485,7 +485,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
485{ 485{
486 int k; 486 int k;
487 487
488 spin_lock_init(&urb->lock);
489 urb->dev = dev; 488 urb->dev = dev;
490 urb->pipe = pipe; 489 urb->pipe = pipe;
491 urb->complete = complete; 490 urb->complete = complete;
@@ -578,16 +577,14 @@ stop_isoc_chain(usb_fifo * fifo)
578 "HFC-S USB: Stopping iso chain for fifo %i.%i", 577 "HFC-S USB: Stopping iso chain for fifo %i.%i",
579 fifo->fifonum, i); 578 fifo->fifonum, i);
580#endif 579#endif
581 usb_unlink_urb(fifo->iso[i].purb); 580 usb_kill_urb(fifo->iso[i].purb);
582 usb_free_urb(fifo->iso[i].purb); 581 usb_free_urb(fifo->iso[i].purb);
583 fifo->iso[i].purb = NULL; 582 fifo->iso[i].purb = NULL;
584 } 583 }
585 } 584 }
586 if (fifo->urb) { 585 usb_kill_urb(fifo->urb);
587 usb_unlink_urb(fifo->urb); 586 usb_free_urb(fifo->urb);
588 usb_free_urb(fifo->urb); 587 fifo->urb = NULL;
589 fifo->urb = NULL;
590 }
591 fifo->active = 0; 588 fifo->active = 0;
592} 589}
593 590
@@ -1305,7 +1302,11 @@ usb_init(hfcusb_data * hfc)
1305 } 1302 }
1306 /* default Prot: EURO ISDN, should be a module_param */ 1303 /* default Prot: EURO ISDN, should be a module_param */
1307 hfc->protocol = 2; 1304 hfc->protocol = 2;
1308 hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); 1305 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
1306 if (i) {
1307 printk(KERN_INFO "HFC-S USB: hisax_register -> %d\n", i);
1308 return i;
1309 }
1309 1310
1310#ifdef CONFIG_HISAX_DEBUG 1311#ifdef CONFIG_HISAX_DEBUG
1311 hfc_debug = debug; 1312 hfc_debug = debug;
@@ -1626,11 +1627,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1626#endif 1627#endif
1627 /* init the chip and register the driver */ 1628 /* init the chip and register the driver */
1628 if (usb_init(context)) { 1629 if (usb_init(context)) {
1629 if (context->ctrl_urb) { 1630 usb_kill_urb(context->ctrl_urb);
1630 usb_unlink_urb(context->ctrl_urb); 1631 usb_free_urb(context->ctrl_urb);
1631 usb_free_urb(context->ctrl_urb); 1632 context->ctrl_urb = NULL;
1632 context->ctrl_urb = NULL;
1633 }
1634 kfree(context); 1633 kfree(context);
1635 return (-EIO); 1634 return (-EIO);
1636 } 1635 }
@@ -1682,21 +1681,15 @@ hfc_usb_disconnect(struct usb_interface
1682 i); 1681 i);
1683#endif 1682#endif
1684 } 1683 }
1685 if (context->fifos[i].urb) { 1684 usb_kill_urb(context->fifos[i].urb);
1686 usb_unlink_urb(context->fifos[i].urb); 1685 usb_free_urb(context->fifos[i].urb);
1687 usb_free_urb(context->fifos[i].urb); 1686 context->fifos[i].urb = NULL;
1688 context->fifos[i].urb = NULL;
1689 }
1690 } 1687 }
1691 context->fifos[i].active = 0; 1688 context->fifos[i].active = 0;
1692 } 1689 }
1693 /* wait for all URBS to terminate */ 1690 usb_kill_urb(context->ctrl_urb);
1694 mdelay(10); 1691 usb_free_urb(context->ctrl_urb);
1695 if (context->ctrl_urb) { 1692 context->ctrl_urb = NULL;
1696 usb_unlink_urb(context->ctrl_urb);
1697 usb_free_urb(context->ctrl_urb);
1698 context->ctrl_urb = NULL;
1699 }
1700 hisax_unregister(&context->d_if); 1693 hisax_unregister(&context->d_if);
1701 kfree(context); /* free our structure again */ 1694 kfree(context); /* free our structure again */
1702} /* hfc_usb_disconnect */ 1695} /* hfc_usb_disconnect */
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 9e088fce8c3a..7993e01f9fc5 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -859,7 +859,11 @@ new_adapter(void)
859 for (i = 0; i < 2; i++) 859 for (i = 0; i < 2; i++)
860 b_if[i] = &adapter->bcs[i].b_if; 860 b_if[i] = &adapter->bcs[i].b_if;
861 861
862 hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", protocol); 862 if (hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp",
863 protocol) != 0) {
864 kfree(adapter);
865 adapter = NULL;
866 }
863 867
864 return adapter; 868 return adapter;
865} 869}
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c
index bb3a28a53ff4..13751237bfcd 100644
--- a/drivers/isdn/hisax/st5481_init.c
+++ b/drivers/isdn/hisax/st5481_init.c
@@ -107,12 +107,17 @@ static int probe_st5481(struct usb_interface *intf,
107 for (i = 0; i < 2; i++) 107 for (i = 0; i < 2; i++)
108 b_if[i] = &adapter->bcs[i].b_if; 108 b_if[i] = &adapter->bcs[i].b_if;
109 109
110 hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol); 110 if (hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb",
111 protocol) != 0)
112 goto err_b1;
113
111 st5481_start(adapter); 114 st5481_start(adapter);
112 115
113 usb_set_intfdata(intf, adapter); 116 usb_set_intfdata(intf, adapter);
114 return 0; 117 return 0;
115 118
119 err_b1:
120 st5481_release_b(&adapter->bcs[1]);
116 err_b: 121 err_b:
117 st5481_release_b(&adapter->bcs[0]); 122 st5481_release_b(&adapter->bcs[0]);
118 err_d: 123 err_d:
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
index ff1595122048..4ada66b8b679 100644
--- a/drivers/isdn/hisax/st5481_usb.c
+++ b/drivers/isdn/hisax/st5481_usb.c
@@ -407,7 +407,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev,
407{ 407{
408 int k; 408 int k;
409 409
410 spin_lock_init(&urb->lock);
411 urb->dev=dev; 410 urb->dev=dev;
412 urb->pipe=pipe; 411 urb->pipe=pipe;
413 urb->interval = 1; 412 urb->interval = 1;
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index b77ef5187d6d..b46817f699f1 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -628,16 +628,16 @@ static void real_leds(unsigned char leds, int device)
628 */ 628 */
629static int adbhid_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 629static int adbhid_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
630{ 630{
631 struct adbhid *adbhid = dev->private; 631 struct adbhid *adbhid = input_get_drvdata(dev);
632 unsigned char leds; 632 unsigned char leds;
633 633
634 switch (type) { 634 switch (type) {
635 case EV_LED: 635 case EV_LED:
636 leds = (test_bit(LED_SCROLLL, dev->led) ? 4 : 0) 636 leds = (test_bit(LED_SCROLLL, dev->led) ? 4 : 0) |
637 | (test_bit(LED_NUML, dev->led) ? 1 : 0) 637 (test_bit(LED_NUML, dev->led) ? 1 : 0) |
638 | (test_bit(LED_CAPSL, dev->led) ? 2 : 0); 638 (test_bit(LED_CAPSL, dev->led) ? 2 : 0);
639 real_leds(leds, adbhid->id); 639 real_leds(leds, adbhid->id);
640 return 0; 640 return 0;
641 } 641 }
642 642
643 return -1; 643 return -1;
@@ -649,7 +649,7 @@ adb_message_handler(struct notifier_block *this, unsigned long code, void *x)
649 switch (code) { 649 switch (code) {
650 case ADB_MSG_PRE_RESET: 650 case ADB_MSG_PRE_RESET:
651 case ADB_MSG_POWERDOWN: 651 case ADB_MSG_POWERDOWN:
652 /* Stop the repeat timer. Autopoll is already off at this point */ 652 /* Stop the repeat timer. Autopoll is already off at this point */
653 { 653 {
654 int i; 654 int i;
655 for (i = 1; i < 16; i++) { 655 for (i = 1; i < 16; i++) {
@@ -699,7 +699,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
699 hid->current_handler_id = current_handler_id; 699 hid->current_handler_id = current_handler_id;
700 hid->mouse_kind = mouse_kind; 700 hid->mouse_kind = mouse_kind;
701 hid->flags = 0; 701 hid->flags = 0;
702 input_dev->private = hid; 702 input_set_drvdata(input_dev, hid);
703 input_dev->name = hid->name; 703 input_dev->name = hid->name;
704 input_dev->phys = hid->phys; 704 input_dev->phys = hid->phys;
705 input_dev->id.bustype = BUS_ADB; 705 input_dev->id.bustype = BUS_ADB;
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5a4a74c1097c..9620d452d030 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -255,19 +255,25 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde
255 255
256} 256}
257 257
258static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait) 258static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
259{ 259{
260 mdk_rdev_t *rdev; 260 mdk_rdev_t *rdev;
261 struct list_head *tmp; 261 struct list_head *tmp;
262 mddev_t *mddev = bitmap->mddev;
262 263
263 ITERATE_RDEV(mddev, rdev, tmp) 264 ITERATE_RDEV(mddev, rdev, tmp)
264 if (test_bit(In_sync, &rdev->flags) 265 if (test_bit(In_sync, &rdev->flags)
265 && !test_bit(Faulty, &rdev->flags)) 266 && !test_bit(Faulty, &rdev->flags)) {
267 int size = PAGE_SIZE;
268 if (page->index == bitmap->file_pages-1)
269 size = roundup(bitmap->last_page_size,
270 bdev_hardsect_size(rdev->bdev));
266 md_super_write(mddev, rdev, 271 md_super_write(mddev, rdev,
267 (rdev->sb_offset<<1) + offset 272 (rdev->sb_offset<<1) + bitmap->offset
268 + page->index * (PAGE_SIZE/512), 273 + page->index * (PAGE_SIZE/512),
269 PAGE_SIZE, 274 size,
270 page); 275 page);
276 }
271 277
272 if (wait) 278 if (wait)
273 md_super_wait(mddev); 279 md_super_wait(mddev);
@@ -282,7 +288,7 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait)
282 struct buffer_head *bh; 288 struct buffer_head *bh;
283 289
284 if (bitmap->file == NULL) 290 if (bitmap->file == NULL)
285 return write_sb_page(bitmap->mddev, bitmap->offset, page, wait); 291 return write_sb_page(bitmap, page, wait);
286 292
287 bh = page_buffers(page); 293 bh = page_buffers(page);
288 294
@@ -923,6 +929,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
923 } 929 }
924 930
925 bitmap->filemap[bitmap->file_pages++] = page; 931 bitmap->filemap[bitmap->file_pages++] = page;
932 bitmap->last_page_size = count;
926 } 933 }
927 paddr = kmap_atomic(page, KM_USER0); 934 paddr = kmap_atomic(page, KM_USER0);
928 if (bitmap->flags & BITMAP_HOSTENDIAN) 935 if (bitmap->flags & BITMAP_HOSTENDIAN)
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index d5ecd2d53046..192741083196 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -139,8 +139,6 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
139 if (!conf) 139 if (!conf)
140 return NULL; 140 return NULL;
141 141
142 mddev->private = conf;
143
144 cnt = 0; 142 cnt = 0;
145 conf->array_size = 0; 143 conf->array_size = 0;
146 144
@@ -232,7 +230,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
232 * First calculate the device offsets. 230 * First calculate the device offsets.
233 */ 231 */
234 conf->disks[0].offset = 0; 232 conf->disks[0].offset = 0;
235 for (i=1; i<mddev->raid_disks; i++) 233 for (i = 1; i < raid_disks; i++)
236 conf->disks[i].offset = 234 conf->disks[i].offset =
237 conf->disks[i-1].offset + 235 conf->disks[i-1].offset +
238 conf->disks[i-1].size; 236 conf->disks[i-1].size;
@@ -244,7 +242,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
244 curr_offset < conf->array_size; 242 curr_offset < conf->array_size;
245 curr_offset += conf->hash_spacing) { 243 curr_offset += conf->hash_spacing) {
246 244
247 while (i < mddev->raid_disks-1 && 245 while (i < raid_disks-1 &&
248 curr_offset >= conf->disks[i+1].offset) 246 curr_offset >= conf->disks[i+1].offset)
249 i++; 247 i++;
250 248
@@ -299,9 +297,11 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
299 */ 297 */
300 linear_conf_t *newconf; 298 linear_conf_t *newconf;
301 299
302 if (rdev->raid_disk != mddev->raid_disks) 300 if (rdev->saved_raid_disk != mddev->raid_disks)
303 return -EINVAL; 301 return -EINVAL;
304 302
303 rdev->raid_disk = rdev->saved_raid_disk;
304
305 newconf = linear_conf(mddev,mddev->raid_disks+1); 305 newconf = linear_conf(mddev,mddev->raid_disks+1);
306 306
307 if (!newconf) 307 if (!newconf)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c10ce91b64e9..1c54f3c1cca7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1298,8 +1298,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1298 ITERATE_RDEV(mddev,rdev2,tmp) 1298 ITERATE_RDEV(mddev,rdev2,tmp)
1299 if (rdev2->desc_nr+1 > max_dev) 1299 if (rdev2->desc_nr+1 > max_dev)
1300 max_dev = rdev2->desc_nr+1; 1300 max_dev = rdev2->desc_nr+1;
1301 1301
1302 sb->max_dev = cpu_to_le32(max_dev); 1302 if (max_dev > le32_to_cpu(sb->max_dev))
1303 sb->max_dev = cpu_to_le32(max_dev);
1303 for (i=0; i<max_dev;i++) 1304 for (i=0; i<max_dev;i++)
1304 sb->dev_roles[i] = cpu_to_le16(0xfffe); 1305 sb->dev_roles[i] = cpu_to_le16(0xfffe);
1305 1306
@@ -1365,10 +1366,14 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1365 } 1366 }
1366 /* make sure rdev->size exceeds mddev->size */ 1367 /* make sure rdev->size exceeds mddev->size */
1367 if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) { 1368 if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) {
1368 if (mddev->pers) 1369 if (mddev->pers) {
1369 /* Cannot change size, so fail */ 1370 /* Cannot change size, so fail
1370 return -ENOSPC; 1371 * If mddev->level <= 0, then we don't care
1371 else 1372 * about aligning sizes (e.g. linear)
1373 */
1374 if (mddev->level > 0)
1375 return -ENOSPC;
1376 } else
1372 mddev->size = rdev->size; 1377 mddev->size = rdev->size;
1373 } 1378 }
1374 1379
@@ -2142,6 +2147,9 @@ static void analyze_sbs(mddev_t * mddev)
2142 rdev->desc_nr = i++; 2147 rdev->desc_nr = i++;
2143 rdev->raid_disk = rdev->desc_nr; 2148 rdev->raid_disk = rdev->desc_nr;
2144 set_bit(In_sync, &rdev->flags); 2149 set_bit(In_sync, &rdev->flags);
2150 } else if (rdev->raid_disk >= mddev->raid_disks) {
2151 rdev->raid_disk = -1;
2152 clear_bit(In_sync, &rdev->flags);
2145 } 2153 }
2146 } 2154 }
2147 2155
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index dfe32149ad3a..2c404f73a377 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -415,7 +415,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
415 raid0_conf_t *conf = mddev_to_conf(mddev); 415 raid0_conf_t *conf = mddev_to_conf(mddev);
416 struct strip_zone *zone; 416 struct strip_zone *zone;
417 mdk_rdev_t *tmp_dev; 417 mdk_rdev_t *tmp_dev;
418 unsigned long chunk; 418 sector_t chunk;
419 sector_t block, rsect; 419 sector_t block, rsect;
420 const int rw = bio_data_dir(bio); 420 const int rw = bio_data_dir(bio);
421 421
@@ -470,7 +470,6 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
470 470
471 sector_div(x, zone->nb_dev); 471 sector_div(x, zone->nb_dev);
472 chunk = x; 472 chunk = x;
473 BUG_ON(x != (sector_t)chunk);
474 473
475 x = block >> chunksize_bits; 474 x = block >> chunksize_bits;
476 tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; 475 tmp_dev = zone->dev[sector_div(x, zone->nb_dev)];
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 0393a3d19920..e908e3cf1e50 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1721,9 +1721,6 @@ static void dst_release(struct dvb_frontend *fe)
1721 symbol_put(dst_ca_attach); 1721 symbol_put(dst_ca_attach);
1722#endif 1722#endif
1723 } 1723 }
1724#ifdef CONFIG_DVB_CORE_ATTACH
1725 symbol_put(dst_attach);
1726#endif
1727 kfree(state); 1724 kfree(state);
1728} 1725}
1729 1726
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index e23d8a0ea1d3..a9fa3337dd81 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -200,7 +200,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
200{ 200{
201 struct dvb_device *dvbdev; 201 struct dvb_device *dvbdev;
202 struct file_operations *dvbdevfops; 202 struct file_operations *dvbdevfops;
203 203 struct class_device *clsdev;
204 int id; 204 int id;
205 205
206 mutex_lock(&dvbdev_register_lock); 206 mutex_lock(&dvbdev_register_lock);
@@ -242,8 +242,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
242 242
243 mutex_unlock(&dvbdev_register_lock); 243 mutex_unlock(&dvbdev_register_lock);
244 244
245 class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 245 clsdev = class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR,
246 adap->device, "dvb%d.%s%d", adap->num, dnames[type], id); 246 nums2minor(adap->num, type, id)),
247 adap->device, "dvb%d.%s%d", adap->num,
248 dnames[type], id);
249 if (IS_ERR(clsdev)) {
250 printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n",
251 __FUNCTION__, adap->num, dnames[type], id, PTR_ERR(clsdev));
252 return PTR_ERR(clsdev);
253 }
247 254
248 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", 255 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
249 adap->num, dnames[type], id, nums2minor(adap->num, type, id), 256 adap->num, dnames[type], id, nums2minor(adap->num, type, id),
@@ -431,7 +438,7 @@ static void __exit exit_dvbdev(void)
431 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); 438 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
432} 439}
433 440
434module_init(init_dvbdev); 441subsys_initcall(init_dvbdev);
435module_exit(exit_dvbdev); 442module_exit(exit_dvbdev);
436 443
437MODULE_DESCRIPTION("DVB Core Driver"); 444MODULE_DESCRIPTION("DVB Core Driver");
diff --git a/drivers/media/video/cafe_ccic-regs.h b/drivers/media/video/cafe_ccic-regs.h
index b2c22a0d6643..8e2a87cdc791 100644
--- a/drivers/media/video/cafe_ccic-regs.h
+++ b/drivers/media/video/cafe_ccic-regs.h
@@ -150,6 +150,12 @@
150#define REG_GL_IMASK 0x300c /* Interrupt mask register */ 150#define REG_GL_IMASK 0x300c /* Interrupt mask register */
151#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ 151#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */
152 152
153#define REG_GL_FCR 0x3038 /* GPIO functional control register */
154#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */
155#define REG_GL_GPIOR 0x315c /* GPIO register */
156#define GGPIO_OUT 0x80000 /* GPIO output */
157#define GGPIO_VAL 0x00008 /* Output pin value */
158
153#define REG_LEN REG_GL_IMASK + 4 159#define REG_LEN REG_GL_IMASK + 4
154 160
155 161
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 96254dbaf625..c08f650df423 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -775,6 +775,12 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam)
775 spin_lock_irqsave(&cam->dev_lock, flags); 775 spin_lock_irqsave(&cam->dev_lock, flags);
776 cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); 776 cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN);
777 /* 777 /*
778 * Part one of the sensor dance: turn the global
779 * GPIO signal on.
780 */
781 cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON);
782 cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL);
783 /*
778 * Put the sensor into operational mode (assumes OLPC-style 784 * Put the sensor into operational mode (assumes OLPC-style
779 * wiring). Control 0 is reset - set to 1 to operate. 785 * wiring). Control 0 is reset - set to 1 to operate.
780 * Control 1 is power down, set to 0 to operate. 786 * Control 1 is power down, set to 0 to operate.
@@ -784,6 +790,7 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam)
784 cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); 790 cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0);
785// mdelay(1); /* Enough? */ 791// mdelay(1); /* Enough? */
786 spin_unlock_irqrestore(&cam->dev_lock, flags); 792 spin_unlock_irqrestore(&cam->dev_lock, flags);
793 msleep(5); /* Just to be sure */
787} 794}
788 795
789static void cafe_ctlr_power_down(struct cafe_camera *cam) 796static void cafe_ctlr_power_down(struct cafe_camera *cam)
@@ -792,6 +799,8 @@ static void cafe_ctlr_power_down(struct cafe_camera *cam)
792 799
793 spin_lock_irqsave(&cam->dev_lock, flags); 800 spin_lock_irqsave(&cam->dev_lock, flags);
794 cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); 801 cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1);
802 cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON);
803 cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT);
795 cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); 804 cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN);
796 spin_unlock_irqrestore(&cam->dev_lock, flags); 805 spin_unlock_irqrestore(&cam->dev_lock, flags);
797} 806}
@@ -851,6 +860,7 @@ static int cafe_cam_init(struct cafe_camera *cam)
851 ret = 0; 860 ret = 0;
852 cam->state = S_IDLE; 861 cam->state = S_IDLE;
853 out: 862 out:
863 cafe_ctlr_power_down(cam);
854 mutex_unlock(&cam->s_mutex); 864 mutex_unlock(&cam->s_mutex);
855 return ret; 865 return ret;
856} 866}
@@ -2103,10 +2113,16 @@ static int cafe_pci_probe(struct pci_dev *pdev,
2103 ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); 2113 ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam);
2104 if (ret) 2114 if (ret)
2105 goto out_iounmap; 2115 goto out_iounmap;
2116 /*
2117 * Initialize the controller and leave it powered up. It will
2118 * stay that way until the sensor driver shows up.
2119 */
2106 cafe_ctlr_init(cam); 2120 cafe_ctlr_init(cam);
2107 cafe_ctlr_power_up(cam); 2121 cafe_ctlr_power_up(cam);
2108 /* 2122 /*
2109 * Set up I2C/SMBUS communications 2123 * Set up I2C/SMBUS communications. We have to drop the mutex here
2124 * because the sensor could attach in this call chain, leading to
2125 * unsightly deadlocks.
2110 */ 2126 */
2111 mutex_unlock(&cam->s_mutex); /* attach can deadlock */ 2127 mutex_unlock(&cam->s_mutex); /* attach can deadlock */
2112 ret = cafe_smbus_setup(cam); 2128 ret = cafe_smbus_setup(cam);
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 2c450bd05af5..5b6a40371602 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,7 +1,6 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM2800/2820/2840 USB video capture support" 2 tristate "Empia EM2800/2820/2840 USB video capture support"
3 depends on VIDEO_V4L1 && I2C && PCI 3 depends on VIDEO_V4L1 && I2C
4 select VIDEO_BUF
5 select VIDEO_TUNER 4 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
7 select VIDEO_IR 6 select VIDEO_IR
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig
index 0cc98a0e2496..1aaeaa02f158 100644
--- a/drivers/media/video/ivtv/Kconfig
+++ b/drivers/media/video/ivtv/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_IVTV 1config VIDEO_IVTV
2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" 2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
3 depends on VIDEO_V4L1 && VIDEO_V4L2 && USB && I2C && EXPERIMENTAL && PCI 3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL
4 select FW_LOADER 4 select FW_LOADER
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 9a412d6c6d06..552f04511ead 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -67,14 +67,6 @@
67 67
68#include <media/ivtv.h> 68#include <media/ivtv.h>
69 69
70#ifdef CONFIG_LIRC_I2C
71# error "This driver is not compatible with the LIRC I2C kernel configuration option."
72#endif /* CONFIG_LIRC_I2C */
73
74#ifndef CONFIG_PCI
75# error "This driver requires kernel PCI support."
76#endif /* CONFIG_PCI */
77
78#define IVTV_ENCODER_OFFSET 0x00000000 70#define IVTV_ENCODER_OFFSET 0x00000000
79#define IVTV_ENCODER_SIZE 0x00800000 /* Last half isn't needed 0x01000000 */ 71#define IVTV_ENCODER_SIZE 0x00800000 /* Last half isn't needed 0x01000000 */
80 72
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 794a6a02f82f..1989ec1cb973 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -362,8 +362,6 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm
362 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 362 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
363 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) 363 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
364 return -EINVAL; 364 return -EINVAL;
365 fmt->fmt.pix.left = itv->main_rect.left;
366 fmt->fmt.pix.top = itv->main_rect.top;
367 fmt->fmt.pix.width = itv->main_rect.width; 365 fmt->fmt.pix.width = itv->main_rect.width;
368 fmt->fmt.pix.height = itv->main_rect.height; 366 fmt->fmt.pix.height = itv->main_rect.height;
369 fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 367 fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
@@ -402,8 +400,6 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm
402 break; 400 break;
403 401
404 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 402 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
405 fmt->fmt.pix.left = 0;
406 fmt->fmt.pix.top = 0;
407 fmt->fmt.pix.width = itv->params.width; 403 fmt->fmt.pix.width = itv->params.width;
408 fmt->fmt.pix.height = itv->params.height; 404 fmt->fmt.pix.height = itv->params.height;
409 fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 405 fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
@@ -498,15 +494,13 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
498 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) 494 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
499 return -EINVAL; 495 return -EINVAL;
500 field = fmt->fmt.pix.field; 496 field = fmt->fmt.pix.field;
501 r.top = fmt->fmt.pix.top; 497 r.top = 0;
502 r.left = fmt->fmt.pix.left; 498 r.left = 0;
503 r.width = fmt->fmt.pix.width; 499 r.width = fmt->fmt.pix.width;
504 r.height = fmt->fmt.pix.height; 500 r.height = fmt->fmt.pix.height;
505 ivtv_get_fmt(itv, streamtype, fmt); 501 ivtv_get_fmt(itv, streamtype, fmt);
506 if (itv->output_mode != OUT_UDMA_YUV) { 502 if (itv->output_mode != OUT_UDMA_YUV) {
507 /* TODO: would setting the rect also be valid for this mode? */ 503 /* TODO: would setting the rect also be valid for this mode? */
508 fmt->fmt.pix.top = r.top;
509 fmt->fmt.pix.left = r.left;
510 fmt->fmt.pix.width = r.width; 504 fmt->fmt.pix.width = r.width;
511 fmt->fmt.pix.height = r.height; 505 fmt->fmt.pix.height = r.height;
512 } 506 }
@@ -1141,8 +1135,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1141 fb->fmt.pixelformat = itv->osd_pixelformat; 1135 fb->fmt.pixelformat = itv->osd_pixelformat;
1142 fb->fmt.width = itv->osd_rect.width; 1136 fb->fmt.width = itv->osd_rect.width;
1143 fb->fmt.height = itv->osd_rect.height; 1137 fb->fmt.height = itv->osd_rect.height;
1144 fb->fmt.left = itv->osd_rect.left;
1145 fb->fmt.top = itv->osd_rect.top;
1146 fb->base = (void *)itv->osd_video_pbase; 1138 fb->base = (void *)itv->osd_video_pbase;
1147 if (itv->osd_global_alpha_state) 1139 if (itv->osd_global_alpha_state)
1148 fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA; 1140 fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA;
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index 03bc369a9e49..3ceb8a6249dd 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -720,12 +720,22 @@ static int ov7670_s_fmt(struct i2c_client *c, struct v4l2_format *fmt)
720 struct ov7670_format_struct *ovfmt; 720 struct ov7670_format_struct *ovfmt;
721 struct ov7670_win_size *wsize; 721 struct ov7670_win_size *wsize;
722 struct ov7670_info *info = i2c_get_clientdata(c); 722 struct ov7670_info *info = i2c_get_clientdata(c);
723 unsigned char com7; 723 unsigned char com7, clkrc;
724 724
725 ret = ov7670_try_fmt(c, fmt, &ovfmt, &wsize); 725 ret = ov7670_try_fmt(c, fmt, &ovfmt, &wsize);
726 if (ret) 726 if (ret)
727 return ret; 727 return ret;
728 /* 728 /*
729 * HACK: if we're running rgb565 we need to grab then rewrite
730 * CLKRC. If we're *not*, however, then rewriting clkrc hoses
731 * the colors.
732 */
733 if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565) {
734 ret = ov7670_read(c, REG_CLKRC, &clkrc);
735 if (ret)
736 return ret;
737 }
738 /*
729 * COM7 is a pain in the ass, it doesn't like to be read then 739 * COM7 is a pain in the ass, it doesn't like to be read then
730 * quickly written afterward. But we have everything we need 740 * quickly written afterward. But we have everything we need
731 * to set it absolutely here, as long as the format-specific 741 * to set it absolutely here, as long as the format-specific
@@ -744,7 +754,10 @@ static int ov7670_s_fmt(struct i2c_client *c, struct v4l2_format *fmt)
744 if (wsize->regs) 754 if (wsize->regs)
745 ret = ov7670_write_array(c, wsize->regs); 755 ret = ov7670_write_array(c, wsize->regs);
746 info->fmt = ovfmt; 756 info->fmt = ovfmt;
747 return 0; 757
758 if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565 && ret == 0)
759 ret = ov7670_write(c, REG_CLKRC, clkrc);
760 return ret;
748} 761}
749 762
750/* 763/*
@@ -1267,7 +1280,9 @@ static int ov7670_attach(struct i2c_adapter *adapter)
1267 ret = ov7670_detect(client); 1280 ret = ov7670_detect(client);
1268 if (ret) 1281 if (ret)
1269 goto out_free_info; 1282 goto out_free_info;
1270 i2c_attach_client(client); 1283 ret = i2c_attach_client(client);
1284 if (ret)
1285 goto out_free_info;
1271 return 0; 1286 return 0;
1272 1287
1273 out_free_info: 1288 out_free_info:
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 1b9b0742f753..c40b92ce1fad 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -205,9 +205,13 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
205 /* 0x01 -> ??? no change ??? */ 205 /* 0x01 -> ??? no change ??? */
206 /* 0x02 -> PAL BDGHI / SECAM L */ 206 /* 0x02 -> PAL BDGHI / SECAM L */
207 /* 0x04 -> ??? PAL others / SECAM others ??? */ 207 /* 0x04 -> ??? PAL others / SECAM others ??? */
208 cb &= ~0x02; 208 cb &= ~0x03;
209 if (t->std & V4L2_STD_SECAM) 209 if (t->std & V4L2_STD_SECAM_L) //also valid for V4L2_STD_SECAM
210 cb |= 0x02; 210 cb |= PHILIPS_MF_SET_PAL_L;
211 else if (t->std & V4L2_STD_SECAM_LC)
212 cb |= PHILIPS_MF_SET_PAL_L2;
213 else /* V4L2_STD_B|V4L2_STD_GH */
214 cb |= PHILIPS_MF_SET_BG;
211 break; 215 break;
212 216
213 case TUNER_TEMIC_4046FM5: 217 case TUNER_TEMIC_4046FM5:
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index d25d3be8fcd2..165f81d16d00 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -436,7 +436,7 @@ typedef struct _MPT_SAS_MGMT {
436typedef struct _mpt_ioctl_events { 436typedef struct _mpt_ioctl_events {
437 u32 event; /* Specified by define above */ 437 u32 event; /* Specified by define above */
438 u32 eventContext; /* Index or counter */ 438 u32 eventContext; /* Index or counter */
439 int data[2]; /* First 8 bytes of Event Data */ 439 u32 data[2]; /* First 8 bytes of Event Data */
440} MPT_IOCTL_EVENTS; 440} MPT_IOCTL_EVENTS;
441 441
442/* 442/*
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index fa0f7761652a..3bd94f11e7d6 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2463,11 +2463,11 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
2463 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; 2463 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE;
2464 ioc->events[idx].eventContext = ioc->eventContext; 2464 ioc->events[idx].eventContext = ioc->eventContext;
2465 2465
2466 ioc->events[idx].data[0] = (pReq->LUN[1] << 24) || 2466 ioc->events[idx].data[0] = (pReq->LUN[1] << 24) |
2467 (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) || 2467 (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) |
2468 (sc->device->channel << 8) || sc->device->id; 2468 (sc->device->channel << 8) | sc->device->id;
2469 2469
2470 ioc->events[idx].data[1] = (sense_data[13] << 8) || sense_data[12]; 2470 ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12];
2471 2471
2472 ioc->eventContext++; 2472 ioc->eventContext++;
2473 if (hd->ioc->pcidev->vendor == 2473 if (hd->ioc->pcidev->vendor ==
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index d3235f213c89..e0d474b17433 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -123,8 +123,12 @@ int i2o_driver_register(struct i2o_driver *drv)
123 } 123 }
124 124
125 rc = driver_register(&drv->driver); 125 rc = driver_register(&drv->driver);
126 if (rc) 126 if (rc) {
127 destroy_workqueue(drv->event_queue); 127 if (drv->event) {
128 destroy_workqueue(drv->event_queue);
129 drv->event_queue = NULL;
130 }
131 }
128 132
129 return rc; 133 return rc;
130}; 134};
@@ -256,7 +260,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c)
256 int i; 260 int i;
257 struct i2o_driver *drv; 261 struct i2o_driver *drv;
258 262
259 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 263 for (i = 0; i < i2o_max_drivers; i++) {
260 drv = i2o_drivers[i]; 264 drv = i2o_drivers[i];
261 265
262 if (drv) 266 if (drv)
@@ -276,7 +280,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c)
276 int i; 280 int i;
277 struct i2o_driver *drv; 281 struct i2o_driver *drv;
278 282
279 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 283 for (i = 0; i < i2o_max_drivers; i++) {
280 drv = i2o_drivers[i]; 284 drv = i2o_drivers[i];
281 285
282 if (drv) 286 if (drv)
@@ -295,7 +299,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev)
295 int i; 299 int i;
296 struct i2o_driver *drv; 300 struct i2o_driver *drv;
297 301
298 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 302 for (i = 0; i < i2o_max_drivers; i++) {
299 drv = i2o_drivers[i]; 303 drv = i2o_drivers[i];
300 304
301 if (drv) 305 if (drv)
@@ -314,7 +318,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
314 int i; 318 int i;
315 struct i2o_driver *drv; 319 struct i2o_driver *drv;
316 320
317 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 321 for (i = 0; i < i2o_max_drivers; i++) {
318 drv = i2o_drivers[i]; 322 drv = i2o_drivers[i];
319 323
320 if (drv) 324 if (drv)
@@ -335,17 +339,15 @@ int __init i2o_driver_init(void)
335 339
336 spin_lock_init(&i2o_drivers_lock); 340 spin_lock_init(&i2o_drivers_lock);
337 341
338 if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || 342 if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) {
339 ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != 343 osm_warn("max_drivers set to %d, but must be >=2 and <= 64\n",
340 (2 * i2o_max_drivers - 1))) { 344 i2o_max_drivers);
341 osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and "
342 "a power of 2\n", i2o_max_drivers);
343 i2o_max_drivers = I2O_MAX_DRIVERS; 345 i2o_max_drivers = I2O_MAX_DRIVERS;
344 } 346 }
345 osm_info("max drivers = %d\n", i2o_max_drivers); 347 osm_info("max drivers = %d\n", i2o_max_drivers);
346 348
347 i2o_drivers = 349 i2o_drivers =
348 kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); 350 kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL);
349 if (!i2o_drivers) 351 if (!i2o_drivers)
350 return -ENOMEM; 352 return -ENOMEM;
351 353
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index cb8c264eaff0..7772bd1d92b4 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -207,16 +207,7 @@ static int ucb1x00_thread(void *_ts)
207 struct ucb1x00_ts *ts = _ts; 207 struct ucb1x00_ts *ts = _ts;
208 struct task_struct *tsk = current; 208 struct task_struct *tsk = current;
209 DECLARE_WAITQUEUE(wait, tsk); 209 DECLARE_WAITQUEUE(wait, tsk);
210 int valid; 210 int valid = 0;
211
212 /*
213 * We could run as a real-time thread. However, thus far
214 * this doesn't seem to be necessary.
215 */
216// tsk->policy = SCHED_FIFO;
217// tsk->rt_priority = 1;
218
219 valid = 0;
220 211
221 add_wait_queue(&ts->irq_wait, &wait); 212 add_wait_queue(&ts->irq_wait, &wait);
222 while (!kthread_should_stop()) { 213 while (!kthread_should_stop()) {
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 35b139b0e5f2..5108b7c576df 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -47,6 +47,7 @@ struct phantom_device {
47 struct cdev cdev; 47 struct cdev cdev;
48 48
49 struct mutex open_lock; 49 struct mutex open_lock;
50 spinlock_t ioctl_lock;
50}; 51};
51 52
52static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; 53static unsigned char phantom_devices[PHANTOM_MAX_MINORS];
@@ -59,8 +60,11 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat)
59 atomic_set(&dev->counter, 0); 60 atomic_set(&dev->counter, 0);
60 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL); 61 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL);
61 iowrite32(0x43, dev->caddr + PHN_IRQCTL); 62 iowrite32(0x43, dev->caddr + PHN_IRQCTL);
62 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) 63 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
64 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) {
63 iowrite32(0, dev->caddr + PHN_IRQCTL); 65 iowrite32(0, dev->caddr + PHN_IRQCTL);
66 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
67 }
64 68
65 dev->status = newstat; 69 dev->status = newstat;
66 70
@@ -71,8 +75,8 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat)
71 * File ops 75 * File ops
72 */ 76 */
73 77
74static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd, 78static long phantom_ioctl(struct file *file, unsigned int cmd,
75 u_long arg) 79 unsigned long arg)
76{ 80{
77 struct phantom_device *dev = file->private_data; 81 struct phantom_device *dev = file->private_data;
78 struct phm_regs rs; 82 struct phm_regs rs;
@@ -92,24 +96,32 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd,
92 if (r.reg > 7) 96 if (r.reg > 7)
93 return -EINVAL; 97 return -EINVAL;
94 98
99 spin_lock(&dev->ioctl_lock);
95 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && 100 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) &&
96 phantom_status(dev, dev->status | PHB_RUNNING)) 101 phantom_status(dev, dev->status | PHB_RUNNING)){
102 spin_unlock(&dev->ioctl_lock);
97 return -ENODEV; 103 return -ENODEV;
104 }
98 105
99 pr_debug("phantom: writing %x to %u\n", r.value, r.reg); 106 pr_debug("phantom: writing %x to %u\n", r.value, r.reg);
100 iowrite32(r.value, dev->iaddr + r.reg); 107 iowrite32(r.value, dev->iaddr + r.reg);
108 ioread32(dev->iaddr); /* PCI posting */
101 109
102 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) 110 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ))
103 phantom_status(dev, dev->status & ~PHB_RUNNING); 111 phantom_status(dev, dev->status & ~PHB_RUNNING);
112 spin_unlock(&dev->ioctl_lock);
104 break; 113 break;
105 case PHN_SET_REGS: 114 case PHN_SET_REGS:
106 if (copy_from_user(&rs, argp, sizeof(rs))) 115 if (copy_from_user(&rs, argp, sizeof(rs)))
107 return -EFAULT; 116 return -EFAULT;
108 117
109 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); 118 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask);
119 spin_lock(&dev->ioctl_lock);
110 for (i = 0; i < min(rs.count, 8U); i++) 120 for (i = 0; i < min(rs.count, 8U); i++)
111 if ((1 << i) & rs.mask) 121 if ((1 << i) & rs.mask)
112 iowrite32(rs.values[i], dev->oaddr + i); 122 iowrite32(rs.values[i], dev->oaddr + i);
123 ioread32(dev->iaddr); /* PCI posting */
124 spin_unlock(&dev->ioctl_lock);
113 break; 125 break;
114 case PHN_GET_REG: 126 case PHN_GET_REG:
115 if (copy_from_user(&r, argp, sizeof(r))) 127 if (copy_from_user(&r, argp, sizeof(r)))
@@ -128,9 +140,11 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd,
128 return -EFAULT; 140 return -EFAULT;
129 141
130 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); 142 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask);
143 spin_lock(&dev->ioctl_lock);
131 for (i = 0; i < min(rs.count, 8U); i++) 144 for (i = 0; i < min(rs.count, 8U); i++)
132 if ((1 << i) & rs.mask) 145 if ((1 << i) & rs.mask)
133 rs.values[i] = ioread32(dev->iaddr + i); 146 rs.values[i] = ioread32(dev->iaddr + i);
147 spin_unlock(&dev->ioctl_lock);
134 148
135 if (copy_to_user(argp, &rs, sizeof(rs))) 149 if (copy_to_user(argp, &rs, sizeof(rs)))
136 return -EFAULT; 150 return -EFAULT;
@@ -199,7 +213,7 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait)
199static struct file_operations phantom_file_ops = { 213static struct file_operations phantom_file_ops = {
200 .open = phantom_open, 214 .open = phantom_open,
201 .release = phantom_release, 215 .release = phantom_release,
202 .ioctl = phantom_ioctl, 216 .unlocked_ioctl = phantom_ioctl,
203 .poll = phantom_poll, 217 .poll = phantom_poll,
204}; 218};
205 219
@@ -212,6 +226,7 @@ static irqreturn_t phantom_isr(int irq, void *data)
212 226
213 iowrite32(0, dev->iaddr); 227 iowrite32(0, dev->iaddr);
214 iowrite32(0xc0, dev->iaddr); 228 iowrite32(0xc0, dev->iaddr);
229 ioread32(dev->iaddr); /* PCI posting */
215 230
216 atomic_inc(&dev->counter); 231 atomic_inc(&dev->counter);
217 wake_up_interruptible(&dev->wait); 232 wake_up_interruptible(&dev->wait);
@@ -282,11 +297,13 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
282 } 297 }
283 298
284 mutex_init(&pht->open_lock); 299 mutex_init(&pht->open_lock);
300 spin_lock_init(&pht->ioctl_lock);
285 init_waitqueue_head(&pht->wait); 301 init_waitqueue_head(&pht->wait);
286 cdev_init(&pht->cdev, &phantom_file_ops); 302 cdev_init(&pht->cdev, &phantom_file_ops);
287 pht->cdev.owner = THIS_MODULE; 303 pht->cdev.owner = THIS_MODULE;
288 304
289 iowrite32(0, pht->caddr + PHN_IRQCTL); 305 iowrite32(0, pht->caddr + PHN_IRQCTL);
306 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
290 retval = request_irq(pdev->irq, phantom_isr, 307 retval = request_irq(pdev->irq, phantom_isr,
291 IRQF_SHARED | IRQF_DISABLED, "phantom", pht); 308 IRQF_SHARED | IRQF_DISABLED, "phantom", pht);
292 if (retval) { 309 if (retval) {
@@ -337,6 +354,7 @@ static void __devexit phantom_remove(struct pci_dev *pdev)
337 cdev_del(&pht->cdev); 354 cdev_del(&pht->cdev);
338 355
339 iowrite32(0, pht->caddr + PHN_IRQCTL); 356 iowrite32(0, pht->caddr + PHN_IRQCTL);
357 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
340 free_irq(pdev->irq, pht); 358 free_irq(pdev->irq, pht);
341 359
342 pci_iounmap(pdev, pht->oaddr); 360 pci_iounmap(pdev, pht->oaddr);
@@ -358,6 +376,7 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state)
358 struct phantom_device *dev = pci_get_drvdata(pdev); 376 struct phantom_device *dev = pci_get_drvdata(pdev);
359 377
360 iowrite32(0, dev->caddr + PHN_IRQCTL); 378 iowrite32(0, dev->caddr + PHN_IRQCTL);
379 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
361 380
362 return 0; 381 return 0;
363} 382}
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index a7562f7fc0b3..540ff4bea54c 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -135,23 +135,6 @@ struct mmc_blk_request {
135 struct mmc_data data; 135 struct mmc_data data;
136}; 136};
137 137
138static int mmc_blk_prep_rq(struct mmc_queue *mq, struct request *req)
139{
140 struct mmc_blk_data *md = mq->data;
141 int stat = BLKPREP_OK;
142
143 /*
144 * If we have no device, we haven't finished initialising.
145 */
146 if (!md || !mq->card) {
147 printk(KERN_ERR "%s: killing request - no device/host\n",
148 req->rq_disk->disk_name);
149 stat = BLKPREP_KILL;
150 }
151
152 return stat;
153}
154
155static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) 138static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
156{ 139{
157 int err; 140 int err;
@@ -460,7 +443,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
460 if (ret) 443 if (ret)
461 goto err_putdisk; 444 goto err_putdisk;
462 445
463 md->queue.prep_fn = mmc_blk_prep_rq;
464 md->queue.issue_fn = mmc_blk_issue_rq; 446 md->queue.issue_fn = mmc_blk_issue_rq;
465 md->queue.data = md; 447 md->queue.data = md;
466 448
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 2e77963db334..dd97bc798409 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -20,40 +20,21 @@
20#define MMC_QUEUE_SUSPENDED (1 << 0) 20#define MMC_QUEUE_SUSPENDED (1 << 0)
21 21
22/* 22/*
23 * Prepare a MMC request. Essentially, this means passing the 23 * Prepare a MMC request. This just filters out odd stuff.
24 * preparation off to the media driver. The media driver will
25 * create a mmc_io_request in req->special.
26 */ 24 */
27static int mmc_prep_request(struct request_queue *q, struct request *req) 25static int mmc_prep_request(struct request_queue *q, struct request *req)
28{ 26{
29 struct mmc_queue *mq = q->queuedata; 27 /*
30 int ret = BLKPREP_KILL; 28 * We only like normal block requests.
31 29 */
32 if (blk_special_request(req)) { 30 if (!blk_fs_request(req) && !blk_pc_request(req)) {
33 /*
34 * Special commands already have the command
35 * blocks already setup in req->special.
36 */
37 BUG_ON(!req->special);
38
39 ret = BLKPREP_OK;
40 } else if (blk_fs_request(req) || blk_pc_request(req)) {
41 /*
42 * Block I/O requests need translating according
43 * to the protocol.
44 */
45 ret = mq->prep_fn(mq, req);
46 } else {
47 /*
48 * Everything else is invalid.
49 */
50 blk_dump_rq_flags(req, "MMC bad request"); 31 blk_dump_rq_flags(req, "MMC bad request");
32 return BLKPREP_KILL;
51 } 33 }
52 34
53 if (ret == BLKPREP_OK) 35 req->cmd_flags |= REQ_DONTPREP;
54 req->cmd_flags |= REQ_DONTPREP;
55 36
56 return ret; 37 return BLKPREP_OK;
57} 38}
58 39
59static int mmc_queue_thread(void *d) 40static int mmc_queue_thread(void *d)
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index c9f139e764f6..1590b3f3f1f7 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -10,20 +10,12 @@ struct mmc_queue {
10 struct semaphore thread_sem; 10 struct semaphore thread_sem;
11 unsigned int flags; 11 unsigned int flags;
12 struct request *req; 12 struct request *req;
13 int (*prep_fn)(struct mmc_queue *, struct request *);
14 int (*issue_fn)(struct mmc_queue *, struct request *); 13 int (*issue_fn)(struct mmc_queue *, struct request *);
15 void *data; 14 void *data;
16 struct request_queue *queue; 15 struct request_queue *queue;
17 struct scatterlist *sg; 16 struct scatterlist *sg;
18}; 17};
19 18
20struct mmc_io_request {
21 struct request *rq;
22 int num;
23 struct mmc_command selcmd; /* mmc_queue private */
24 struct mmc_command cmd[4]; /* max 4 commands */
25};
26
27extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); 19extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
28extern void mmc_cleanup_queue(struct mmc_queue *); 20extern void mmc_cleanup_queue(struct mmc_queue *);
29extern void mmc_queue_suspend(struct mmc_queue *); 21extern void mmc_queue_suspend(struct mmc_queue *);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3b204bac1a1d..1798a9f9fb25 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2218,7 +2218,7 @@ config SK98LIN
2218 2218
2219config VIA_VELOCITY 2219config VIA_VELOCITY
2220 tristate "VIA Velocity support" 2220 tristate "VIA Velocity support"
2221 depends on NET_PCI && PCI 2221 depends on PCI
2222 select CRC32 2222 select CRC32
2223 select CRC_CCITT 2223 select CRC_CCITT
2224 select MII 2224 select MII
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index 7284ccad0b91..4030274fe788 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -2,10 +2,8 @@
2# Arcnet configuration 2# Arcnet configuration
3# 3#
4 4
5menu "ARCnet devices" 5menuconfig ARCNET
6 depends on NETDEVICES && (ISA || PCI) 6 depends on NETDEVICES && (ISA || PCI)
7
8config ARCNET
9 tristate "ARCnet support" 7 tristate "ARCnet support"
10 ---help--- 8 ---help---
11 If you have a network card of this type, say Y and check out the 9 If you have a network card of this type, say Y and check out the
@@ -25,9 +23,10 @@ config ARCNET
25 <file:Documentation/networking/net-modules.txt>. The module will 23 <file:Documentation/networking/net-modules.txt>. The module will
26 be called arcnet. 24 be called arcnet.
27 25
26if ARCNET
27
28config ARCNET_1201 28config ARCNET_1201
29 tristate "Enable standard ARCNet packet format (RFC 1201)" 29 tristate "Enable standard ARCNet packet format (RFC 1201)"
30 depends on ARCNET
31 help 30 help
32 This allows you to use RFC1201 with your ARCnet card via the virtual 31 This allows you to use RFC1201 with your ARCnet card via the virtual
33 arc0 device. You need to say Y here to communicate with 32 arc0 device. You need to say Y here to communicate with
@@ -38,7 +37,6 @@ config ARCNET_1201
38 37
39config ARCNET_1051 38config ARCNET_1051
40 tristate "Enable old ARCNet packet format (RFC 1051)" 39 tristate "Enable old ARCNet packet format (RFC 1051)"
41 depends on ARCNET
42 ---help--- 40 ---help---
43 This allows you to use RFC1051 with your ARCnet card via the virtual 41 This allows you to use RFC1051 with your ARCnet card via the virtual
44 arc0s device. You only need arc0s if you want to talk to ARCnet 42 arc0s device. You only need arc0s if you want to talk to ARCnet
@@ -53,7 +51,6 @@ config ARCNET_1051
53 51
54config ARCNET_RAW 52config ARCNET_RAW
55 tristate "Enable raw mode packet interface" 53 tristate "Enable raw mode packet interface"
56 depends on ARCNET
57 help 54 help
58 ARCnet "raw mode" packet encapsulation, no soft headers. Unlikely 55 ARCnet "raw mode" packet encapsulation, no soft headers. Unlikely
59 to work unless talking to a copy of the same Linux arcnet driver, 56 to work unless talking to a copy of the same Linux arcnet driver,
@@ -61,7 +58,6 @@ config ARCNET_RAW
61 58
62config ARCNET_CAP 59config ARCNET_CAP
63 tristate "Enable CAP mode packet interface" 60 tristate "Enable CAP mode packet interface"
64 depends on ARCNET
65 help 61 help
66 ARCnet "cap mode" packet encapsulation. Used to get the hardware 62 ARCnet "cap mode" packet encapsulation. Used to get the hardware
67 acknowledge back to userspace. After the initial protocol byte every 63 acknowledge back to userspace. After the initial protocol byte every
@@ -80,7 +76,6 @@ config ARCNET_CAP
80 76
81config ARCNET_COM90xx 77config ARCNET_COM90xx
82 tristate "ARCnet COM90xx (normal) chipset driver" 78 tristate "ARCnet COM90xx (normal) chipset driver"
83 depends on ARCNET
84 help 79 help
85 This is the chipset driver for the standard COM90xx cards. If you 80 This is the chipset driver for the standard COM90xx cards. If you
86 have always used the old ARCnet driver without knowing what type of 81 have always used the old ARCnet driver without knowing what type of
@@ -92,7 +87,6 @@ config ARCNET_COM90xx
92 87
93config ARCNET_COM90xxIO 88config ARCNET_COM90xxIO
94 tristate "ARCnet COM90xx (IO mapped) chipset driver" 89 tristate "ARCnet COM90xx (IO mapped) chipset driver"
95 depends on ARCNET
96 ---help--- 90 ---help---
97 This is the chipset driver for the COM90xx cards, using them in 91 This is the chipset driver for the COM90xx cards, using them in
98 IO-mapped mode instead of memory-mapped mode. This is slower than 92 IO-mapped mode instead of memory-mapped mode. This is slower than
@@ -105,7 +99,6 @@ config ARCNET_COM90xxIO
105 99
106config ARCNET_RIM_I 100config ARCNET_RIM_I
107 tristate "ARCnet COM90xx (RIM I) chipset driver" 101 tristate "ARCnet COM90xx (RIM I) chipset driver"
108 depends on ARCNET
109 ---help--- 102 ---help---
110 This is yet another chipset driver for the COM90xx cards, but this 103 This is yet another chipset driver for the COM90xx cards, but this
111 time only using memory-mapped mode, and no IO ports at all. This 104 time only using memory-mapped mode, and no IO ports at all. This
@@ -118,7 +111,6 @@ config ARCNET_RIM_I
118 111
119config ARCNET_COM20020 112config ARCNET_COM20020
120 tristate "ARCnet COM20020 chipset driver" 113 tristate "ARCnet COM20020 chipset driver"
121 depends on ARCNET
122 help 114 help
123 This is the driver for the new COM20020 chipset. It supports such 115 This is the driver for the new COM20020 chipset. It supports such
124 things as promiscuous mode, so packet sniffing is possible, and 116 things as promiscuous mode, so packet sniffing is possible, and
@@ -136,5 +128,4 @@ config ARCNET_COM20020_PCI
136 tristate "Support for COM20020 on PCI" 128 tristate "Support for COM20020 on PCI"
137 depends on ARCNET_COM20020 && PCI 129 depends on ARCNET_COM20020 && PCI
138 130
139endmenu 131endif # ARCNET
140
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 4aec747d9e43..9fe3a38883ee 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4919,7 +4919,10 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
4919 pci_cmd &= ~PCI_COMMAND_SERR; 4919 pci_cmd &= ~PCI_COMMAND_SERR;
4920 pci_cmd |= PCI_COMMAND_PARITY; 4920 pci_cmd |= PCI_COMMAND_PARITY;
4921 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); 4921 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
4922 pci_set_mwi(pdev); 4922 if (pci_set_mwi(pdev))
4923 printk(KERN_WARNING PFX "Could enable MWI for %s\n",
4924 pci_name(pdev));
4925
4923 /* 4926 /*
4924 * On some architectures, the default cache line size set 4927 * On some architectures, the default cache line size set
4925 * by pci_set_mwi reduces perforamnce. We have to increase 4928 * by pci_set_mwi reduces perforamnce. We have to increase
diff --git a/drivers/net/chelsio/suni1x10gexp_regs.h b/drivers/net/chelsio/suni1x10gexp_regs.h
index 269d097dd927..d0f87d82566a 100644
--- a/drivers/net/chelsio/suni1x10gexp_regs.h
+++ b/drivers/net/chelsio/suni1x10gexp_regs.h
@@ -105,7 +105,7 @@
105#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_LOW(filterId) (0x204A + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId)) 105#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_LOW(filterId) (0x204A + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId))
106#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_MID(filterId) (0x204B + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId)) 106#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_MID(filterId) (0x204B + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId))
107#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_HIGH(filterId)(0x204C + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId)) 107#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_HIGH(filterId)(0x204C + mSUNI1x10GEXP_MAC_FILTER_OFFSET(filterId))
108#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_VID(filterId) (0x2062 + mSUNI1x10GEXP_MAC_VID_FILTER_OFFSET(filterId) 108#define mSUNI1x10GEXP_REG_RXXG_EXACT_MATCH_VID(filterId) (0x2062 + mSUNI1x10GEXP_MAC_VID_FILTER_OFFSET(filterId))
109#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_LOW 0x204A 109#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_LOW 0x204A
110#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_MID 0x204B 110#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_MID 0x204B
111#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_HIGH 0x204C 111#define SUNI1x10GEXP_REG_RXXG_EXACT_MATCH_ADDR_0_HIGH 0x204C
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 7a018027fcc0..4154fd000746 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -195,7 +195,7 @@ enum {
195#define NVREG_IRQ_TX_FORCED 0x0100 195#define NVREG_IRQ_TX_FORCED 0x0100
196#define NVREG_IRQ_RECOVER_ERROR 0x8000 196#define NVREG_IRQ_RECOVER_ERROR 0x8000
197#define NVREG_IRQMASK_THROUGHPUT 0x00df 197#define NVREG_IRQMASK_THROUGHPUT 0x00df
198#define NVREG_IRQMASK_CPU 0x0040 198#define NVREG_IRQMASK_CPU 0x0060
199#define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED) 199#define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED)
200#define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED) 200#define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED)
201#define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RECOVER_ERROR) 201#define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RECOVER_ERROR)
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index 0343ea12b299..92b403bf38b0 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -8,15 +8,16 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/module.h>
12#include <linux/init.h>
13
14#include <linux/kernel.h> /* printk() */
15#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/dma-mapping.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <linux/errno.h> /* error codes */ 18#include <linux/errno.h>
18#include <linux/types.h> /* size_t */ 19#include <linux/types.h>
19#include <linux/interrupt.h> /* mark_bh */ 20#include <linux/interrupt.h>
20 21
21#include <linux/in.h> 22#include <linux/in.h>
22#include <linux/in6.h> 23#include <linux/in6.h>
@@ -33,7 +34,6 @@
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/scatterlist.h> 36#include <asm/scatterlist.h>
36#include <linux/dma-mapping.h>
37 37
38#include "meth.h" 38#include "meth.h"
39 39
@@ -51,8 +51,6 @@
51 51
52 52
53static const char *meth_str="SGI O2 Fast Ethernet"; 53static const char *meth_str="SGI O2 Fast Ethernet";
54MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
55MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
56 54
57#define HAVE_TX_TIMEOUT 55#define HAVE_TX_TIMEOUT
58/* The maximum time waited (in jiffies) before assuming a Tx failed. (400ms) */ 56/* The maximum time waited (in jiffies) before assuming a Tx failed. (400ms) */
@@ -784,15 +782,15 @@ static struct net_device_stats *meth_stats(struct net_device *dev)
784/* 782/*
785 * The init function. 783 * The init function.
786 */ 784 */
787static struct net_device *meth_init(void) 785static int __init meth_probe(struct platform_device *pdev)
788{ 786{
789 struct net_device *dev; 787 struct net_device *dev;
790 struct meth_private *priv; 788 struct meth_private *priv;
791 int ret; 789 int err;
792 790
793 dev = alloc_etherdev(sizeof(struct meth_private)); 791 dev = alloc_etherdev(sizeof(struct meth_private));
794 if (!dev) 792 if (!dev)
795 return ERR_PTR(-ENOMEM); 793 return -ENOMEM;
796 794
797 dev->open = meth_open; 795 dev->open = meth_open;
798 dev->stop = meth_release; 796 dev->stop = meth_release;
@@ -808,11 +806,12 @@ static struct net_device *meth_init(void)
808 806
809 priv = netdev_priv(dev); 807 priv = netdev_priv(dev);
810 spin_lock_init(&priv->meth_lock); 808 spin_lock_init(&priv->meth_lock);
809 SET_NETDEV_DEV(dev, &pdev->dev);
811 810
812 ret = register_netdev(dev); 811 err = register_netdev(dev);
813 if (ret) { 812 if (err) {
814 free_netdev(dev); 813 free_netdev(dev);
815 return ERR_PTR(ret); 814 return err;
816 } 815 }
817 816
818 printk(KERN_INFO "%s: SGI MACE Ethernet rev. %d\n", 817 printk(KERN_INFO "%s: SGI MACE Ethernet rev. %d\n",
@@ -820,21 +819,44 @@ static struct net_device *meth_init(void)
820 return 0; 819 return 0;
821} 820}
822 821
823static struct net_device *meth_dev; 822static int __exit meth_remove(struct platform_device *pdev)
823{
824 struct net_device *dev = platform_get_drvdata(pdev);
825
826 unregister_netdev(dev);
827 free_netdev(dev);
828 platform_set_drvdata(pdev, NULL);
829
830 return 0;
831}
832
833static struct platform_driver meth_driver = {
834 .probe = meth_probe,
835 .remove = __devexit_p(meth_remove),
836 .driver = {
837 .name = "meth",
838 }
839};
824 840
825static int __init meth_init_module(void) 841static int __init meth_init_module(void)
826{ 842{
827 meth_dev = meth_init(); 843 int err;
828 if (IS_ERR(meth_dev)) 844
829 return PTR_ERR(meth_dev); 845 err = platform_driver_register(&meth_driver);
830 return 0; 846 if (err)
847 printk(KERN_ERR "Driver registration failed\n");
848
849 return err;
831} 850}
832 851
833static void __exit meth_exit_module(void) 852static void __exit meth_exit_module(void)
834{ 853{
835 unregister_netdev(meth_dev); 854 platform_driver_unregister(&meth_driver);
836 free_netdev(meth_dev);
837} 855}
838 856
839module_init(meth_init_module); 857module_init(meth_init_module);
840module_exit(meth_exit_module); 858module_exit(meth_exit_module);
859
860MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
861MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
862MODULE_LICENSE("GPL");
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 68c99b4c5255..bb966911a137 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -89,6 +89,7 @@ EXPORT_SYMBOL(fixed_mdio_set_link_update);
89/*----------------------------------------------------------------------------- 89/*-----------------------------------------------------------------------------
90 * This is used for updating internal mii regs from the status 90 * This is used for updating internal mii regs from the status
91 *-----------------------------------------------------------------------------*/ 91 *-----------------------------------------------------------------------------*/
92#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX)
92static int fixed_mdio_update_regs(struct fixed_info *fixed) 93static int fixed_mdio_update_regs(struct fixed_info *fixed)
93{ 94{
94 u16 *regs = fixed->regs; 95 u16 *regs = fixed->regs;
@@ -165,6 +166,7 @@ static int fixed_mii_reset(struct mii_bus *bus)
165 /*nothing here - no way/need to reset it*/ 166 /*nothing here - no way/need to reset it*/
166 return 0; 167 return 0;
167} 168}
169#endif
168 170
169static int fixed_config_aneg(struct phy_device *phydev) 171static int fixed_config_aneg(struct phy_device *phydev)
170{ 172{
@@ -194,6 +196,7 @@ static struct phy_driver fixed_mdio_driver = {
194 * number is used to create multiple fixed PHYs, so that several devices can 196 * number is used to create multiple fixed PHYs, so that several devices can
195 * utilize them simultaneously. 197 * utilize them simultaneously.
196 *-----------------------------------------------------------------------------*/ 198 *-----------------------------------------------------------------------------*/
199#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX)
197static int fixed_mdio_register_device(int number, int speed, int duplex) 200static int fixed_mdio_register_device(int number, int speed, int duplex)
198{ 201{
199 struct mii_bus *new_bus; 202 struct mii_bus *new_bus;
@@ -301,6 +304,7 @@ device_create_fail:
301 304
302 return err; 305 return err;
303} 306}
307#endif
304 308
305 309
306MODULE_DESCRIPTION("Fixed PHY device & driver for PAL"); 310MODULE_DESCRIPTION("Fixed PHY device & driver for PAL");
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index c3964c3d89d9..ef84d7c757a0 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1014,12 +1014,12 @@ spider_net_pass_skb_up(struct spider_net_descr *descr,
1014 */ 1014 */
1015 } 1015 }
1016 1016
1017 /* pass skb up to stack */
1018 netif_receive_skb(skb);
1019
1020 /* update netdevice statistics */ 1017 /* update netdevice statistics */
1021 card->netdev_stats.rx_packets++; 1018 card->netdev_stats.rx_packets++;
1022 card->netdev_stats.rx_bytes += skb->len; 1019 card->netdev_stats.rx_bytes += skb->len;
1020
1021 /* pass skb up to stack */
1022 netif_receive_skb(skb);
1023} 1023}
1024 1024
1025#ifdef DEBUG 1025#ifdef DEBUG
diff --git a/drivers/net/tokenring/Kconfig b/drivers/net/tokenring/Kconfig
index 99c4c1922f19..e6b2e06493e7 100644
--- a/drivers/net/tokenring/Kconfig
+++ b/drivers/net/tokenring/Kconfig
@@ -2,12 +2,10 @@
2# Token Ring driver configuration 2# Token Ring driver configuration
3# 3#
4 4
5menu "Token Ring devices"
6 depends on NETDEVICES && !UML
7
8# So far, we only have PCI, ISA, and MCA token ring devices 5# So far, we only have PCI, ISA, and MCA token ring devices
9config TR 6menuconfig TR
10 bool "Token Ring driver support" 7 bool "Token Ring driver support"
8 depends on NETDEVICES && !UML
11 depends on (PCI || ISA || MCA || CCW) 9 depends on (PCI || ISA || MCA || CCW)
12 select LLC 10 select LLC
13 help 11 help
@@ -20,9 +18,11 @@ config TR
20 from <http://www.tldp.org/docs.html#howto>. Most people can 18 from <http://www.tldp.org/docs.html#howto>. Most people can
21 say N here. 19 say N here.
22 20
21if TR
22
23config IBMTR 23config IBMTR
24 tristate "IBM Tropic chipset based adapter support" 24 tristate "IBM Tropic chipset based adapter support"
25 depends on TR && (ISA || MCA) 25 depends on ISA || MCA
26 ---help--- 26 ---help---
27 This is support for all IBM Token Ring cards that don't use DMA. If 27 This is support for all IBM Token Ring cards that don't use DMA. If
28 you have such a beast, say Y and read the Token-Ring mini-HOWTO, 28 you have such a beast, say Y and read the Token-Ring mini-HOWTO,
@@ -36,7 +36,7 @@ config IBMTR
36 36
37config IBMOL 37config IBMOL
38 tristate "IBM Olympic chipset PCI adapter support" 38 tristate "IBM Olympic chipset PCI adapter support"
39 depends on TR && PCI 39 depends on PCI
40 ---help--- 40 ---help---
41 This is support for all non-Lanstreamer IBM PCI Token Ring Cards. 41 This is support for all non-Lanstreamer IBM PCI Token Ring Cards.
42 Specifically this is all IBM PCI, PCI Wake On Lan, PCI II, PCI II 42 Specifically this is all IBM PCI, PCI Wake On Lan, PCI II, PCI II
@@ -54,7 +54,7 @@ config IBMOL
54 54
55config IBMLS 55config IBMLS
56 tristate "IBM Lanstreamer chipset PCI adapter support" 56 tristate "IBM Lanstreamer chipset PCI adapter support"
57 depends on TR && PCI && !64BIT 57 depends on PCI && !64BIT
58 help 58 help
59 This is support for IBM Lanstreamer PCI Token Ring Cards. 59 This is support for IBM Lanstreamer PCI Token Ring Cards.
60 60
@@ -66,7 +66,7 @@ config IBMLS
66 66
67config 3C359 67config 3C359
68 tristate "3Com 3C359 Token Link Velocity XL adapter support" 68 tristate "3Com 3C359 Token Link Velocity XL adapter support"
69 depends on TR && PCI 69 depends on PCI
70 ---help--- 70 ---help---
71 This is support for the 3Com PCI Velocity XL cards, specifically 71 This is support for the 3Com PCI Velocity XL cards, specifically
72 the 3Com 3C359, please note this is not for the 3C339 cards, you 72 the 3Com 3C359, please note this is not for the 3C339 cards, you
@@ -84,7 +84,7 @@ config 3C359
84 84
85config TMS380TR 85config TMS380TR
86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support" 86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support"
87 depends on TR && (PCI || ISA && ISA_DMA_API || MCA) 87 depends on PCI || ISA && ISA_DMA_API || MCA
88 select FW_LOADER 88 select FW_LOADER
89 ---help--- 89 ---help---
90 This driver provides generic support for token ring adapters 90 This driver provides generic support for token ring adapters
@@ -108,7 +108,7 @@ config TMS380TR
108 108
109config TMSPCI 109config TMSPCI
110 tristate "Generic TMS380 PCI support" 110 tristate "Generic TMS380 PCI support"
111 depends on TR && TMS380TR && PCI 111 depends on TMS380TR && PCI
112 ---help--- 112 ---help---
113 This tms380 module supports generic TMS380-based PCI cards. 113 This tms380 module supports generic TMS380-based PCI cards.
114 114
@@ -123,7 +123,7 @@ config TMSPCI
123 123
124config SKISA 124config SKISA
125 tristate "SysKonnect TR4/16 ISA support" 125 tristate "SysKonnect TR4/16 ISA support"
126 depends on TR && TMS380TR && ISA 126 depends on TMS380TR && ISA
127 help 127 help
128 This tms380 module supports SysKonnect TR4/16 ISA cards. 128 This tms380 module supports SysKonnect TR4/16 ISA cards.
129 129
@@ -135,7 +135,7 @@ config SKISA
135 135
136config PROTEON 136config PROTEON
137 tristate "Proteon ISA support" 137 tristate "Proteon ISA support"
138 depends on TR && TMS380TR && ISA 138 depends on TMS380TR && ISA
139 help 139 help
140 This tms380 module supports Proteon ISA cards. 140 This tms380 module supports Proteon ISA cards.
141 141
@@ -148,7 +148,7 @@ config PROTEON
148 148
149config ABYSS 149config ABYSS
150 tristate "Madge Smart 16/4 PCI Mk2 support" 150 tristate "Madge Smart 16/4 PCI Mk2 support"
151 depends on TR && TMS380TR && PCI 151 depends on TMS380TR && PCI
152 help 152 help
153 This tms380 module supports the Madge Smart 16/4 PCI Mk2 153 This tms380 module supports the Madge Smart 16/4 PCI Mk2
154 cards (51-02). 154 cards (51-02).
@@ -158,7 +158,7 @@ config ABYSS
158 158
159config MADGEMC 159config MADGEMC
160 tristate "Madge Smart 16/4 Ringnode MicroChannel" 160 tristate "Madge Smart 16/4 Ringnode MicroChannel"
161 depends on TR && TMS380TR && MCA 161 depends on TMS380TR && MCA
162 help 162 help
163 This tms380 module supports the Madge Smart 16/4 MC16 and MC32 163 This tms380 module supports the Madge Smart 16/4 MC16 and MC32
164 MicroChannel adapters. 164 MicroChannel adapters.
@@ -168,7 +168,7 @@ config MADGEMC
168 168
169config SMCTR 169config SMCTR
170 tristate "SMC ISA/MCA adapter support" 170 tristate "SMC ISA/MCA adapter support"
171 depends on TR && (ISA || MCA_LEGACY) && (BROKEN || !64BIT) 171 depends on (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
172 ---help--- 172 ---help---
173 This is support for the ISA and MCA SMC Token Ring cards, 173 This is support for the ISA and MCA SMC Token Ring cards,
174 specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A 174 specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A
@@ -182,5 +182,4 @@ config SMCTR
182 To compile this driver as a module, choose M here: the module will be 182 To compile this driver as a module, choose M here: the module will be
183 called smctr. 183 called smctr.
184 184
185endmenu 185endif # TR
186
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index c2ccbd098f53..18b731bb4da1 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -23,11 +23,8 @@
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/ethtool.h>
27#include <linux/delay.h>
28#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
29#include <linux/fsl_devices.h> 27#include <linux/fsl_devices.h>
30#include <linux/ethtool.h>
31#include <linux/mii.h> 28#include <linux/mii.h>
32#include <linux/phy.h> 29#include <linux/phy.h>
33#include <linux/workqueue.h> 30#include <linux/workqueue.h>
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index f96966d4bcc2..7bcb82f50cf7 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -260,8 +260,6 @@ static struct of_device_id uec_mdio_match[] = {
260 {}, 260 {},
261}; 261};
262 262
263MODULE_DEVICE_TABLE(of, uec_mdio_match);
264
265static struct of_platform_driver uec_mdio_driver = { 263static struct of_platform_driver uec_mdio_driver = {
266 .name = DRV_NAME, 264 .name = DRV_NAME,
267 .probe = uec_mdio_probe, 265 .probe = uec_mdio_probe,
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index d5ef97bc4d01..6d95cacd5284 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1458,6 +1458,10 @@ static const struct usb_device_id products [] = {
1458 // IO-DATA ETG-US2 1458 // IO-DATA ETG-US2
1459 USB_DEVICE (0x04bb, 0x0930), 1459 USB_DEVICE (0x04bb, 0x0930),
1460 .driver_info = (unsigned long) &ax88178_info, 1460 .driver_info = (unsigned long) &ax88178_info,
1461}, {
1462 // Belkin F5D5055
1463 USB_DEVICE(0x050d, 0x5055),
1464 .driver_info = (unsigned long) &ax88178_info,
1461}, 1465},
1462 { }, // END 1466 { }, // END
1463}; 1467};
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 5a21f06bf8a5..675ac99a79c6 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -91,6 +91,22 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
91 "CDC descriptors on config\n"); 91 "CDC descriptors on config\n");
92 } 92 }
93 93
94 /* Maybe CDC descriptors are after the endpoint? This bug has
95 * been seen on some 2Wire Inc RNDIS-ish products.
96 */
97 if (len == 0) {
98 struct usb_host_endpoint *hep;
99
100 hep = intf->cur_altsetting->endpoint;
101 if (hep) {
102 buf = hep->extra;
103 len = hep->extralen;
104 }
105 if (len)
106 dev_dbg(&intf->dev,
107 "CDC descriptors on endpoint\n");
108 }
109
94 /* this assumes that if there's a non-RNDIS vendor variant 110 /* this assumes that if there's a non-RNDIS vendor variant
95 * of cdc-acm, it'll fail RNDIS requests cleanly. 111 * of cdc-acm, it'll fail RNDIS requests cleanly.
96 */ 112 */
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 980e4aaa97aa..cd991a0f75bb 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -515,6 +515,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
515 dev_err(&intf->dev, 515 dev_err(&intf->dev,
516 "dev can't take %u byte packets (max %u)\n", 516 "dev can't take %u byte packets (max %u)\n",
517 dev->hard_mtu, tmp); 517 dev->hard_mtu, tmp);
518 retval = -EINVAL;
518 goto fail_and_release; 519 goto fail_and_release;
519 } 520 }
520 521
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index f9cd42d058b0..5b16d9a1269a 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1252,20 +1252,23 @@ EXPORT_SYMBOL_GPL(usbnet_probe);
1252 1252
1253/*-------------------------------------------------------------------------*/ 1253/*-------------------------------------------------------------------------*/
1254 1254
1255/* FIXME these suspend/resume methods assume non-CDC style 1255/*
1256 * devices, with only one interface. 1256 * suspend the whole driver as soon as the first interface is suspended
1257 * resume only when the last interface is resumed
1257 */ 1258 */
1258 1259
1259int usbnet_suspend (struct usb_interface *intf, pm_message_t message) 1260int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
1260{ 1261{
1261 struct usbnet *dev = usb_get_intfdata(intf); 1262 struct usbnet *dev = usb_get_intfdata(intf);
1262 1263
1263 /* accelerate emptying of the rx and queues, to avoid 1264 if (!dev->suspend_count++) {
1264 * having everything error out. 1265 /* accelerate emptying of the rx and queues, to avoid
1265 */ 1266 * having everything error out.
1266 netif_device_detach (dev->net); 1267 */
1267 (void) unlink_urbs (dev, &dev->rxq); 1268 netif_device_detach (dev->net);
1268 (void) unlink_urbs (dev, &dev->txq); 1269 (void) unlink_urbs (dev, &dev->rxq);
1270 (void) unlink_urbs (dev, &dev->txq);
1271 }
1269 return 0; 1272 return 0;
1270} 1273}
1271EXPORT_SYMBOL_GPL(usbnet_suspend); 1274EXPORT_SYMBOL_GPL(usbnet_suspend);
@@ -1274,8 +1277,10 @@ int usbnet_resume (struct usb_interface *intf)
1274{ 1277{
1275 struct usbnet *dev = usb_get_intfdata(intf); 1278 struct usbnet *dev = usb_get_intfdata(intf);
1276 1279
1277 netif_device_attach (dev->net); 1280 if (!--dev->suspend_count) {
1278 tasklet_schedule (&dev->bh); 1281 netif_device_attach (dev->net);
1282 tasklet_schedule (&dev->bh);
1283 }
1279 return 0; 1284 return 0;
1280} 1285}
1281EXPORT_SYMBOL_GPL(usbnet_resume); 1286EXPORT_SYMBOL_GPL(usbnet_resume);
diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
index 82db5a8e528e..a3f8b9e7bc00 100644
--- a/drivers/net/usb/usbnet.h
+++ b/drivers/net/usb/usbnet.h
@@ -32,6 +32,7 @@ struct usbnet {
32 const char *driver_name; 32 const char *driver_name;
33 wait_queue_head_t *wait; 33 wait_queue_head_t *wait;
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count;
35 36
36 /* i/o info: pipes etc */ 37 /* i/o info: pipes etc */
37 unsigned in, out; 38 unsigned in, out;
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 606bdd002be7..dfe27642322c 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -46,7 +46,7 @@ u32 libertas_index_to_data_rate(u8 index);
46u8 libertas_data_rate_to_index(u32 rate); 46u8 libertas_data_rate_to_index(u32 rate);
47void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen); 47void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen);
48 48
49int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb); 49void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb);
50 50
51/** The proc fs interface */ 51/** The proc fs interface */
52int libertas_process_rx_command(wlan_private * priv); 52int libertas_process_rx_command(wlan_private * priv);
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 441123c85e62..5c63c9b1659c 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -333,18 +333,22 @@ static void command_timer_fn(unsigned long data)
333 unsigned long flags; 333 unsigned long flags;
334 334
335 ptempnode = adapter->cur_cmd; 335 ptempnode = adapter->cur_cmd;
336 if (ptempnode == NULL) {
337 lbs_pr_debug(1, "PTempnode Empty\n");
338 return;
339 }
340
336 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; 341 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
342 if (!cmd) {
343 lbs_pr_debug(1, "cmd is NULL\n");
344 return;
345 }
337 346
338 lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); 347 lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command);
339 348
340 if (!adapter->fw_ready) 349 if (!adapter->fw_ready)
341 return; 350 return;
342 351
343 if (ptempnode == NULL) {
344 lbs_pr_debug(1, "PTempnode Empty\n");
345 return;
346 }
347
348 spin_lock_irqsave(&adapter->driver_lock, flags); 352 spin_lock_irqsave(&adapter->driver_lock, flags);
349 adapter->cur_cmd = NULL; 353 adapter->cur_cmd = NULL;
350 spin_unlock_irqrestore(&adapter->driver_lock, flags); 354 spin_unlock_irqrestore(&adapter->driver_lock, flags);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index d17924f764e5..96619a32951b 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -136,7 +136,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
136 LEAVE(); 136 LEAVE();
137} 137}
138 138
139int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) 139void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
140{ 140{
141 lbs_pr_debug(1, "skb->data=%p\n", skb->data); 141 lbs_pr_debug(1, "skb->data=%p\n", skb->data);
142 142
@@ -148,8 +148,6 @@ int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
148 skb->ip_summed = CHECKSUM_UNNECESSARY; 148 skb->ip_summed = CHECKSUM_UNNECESSARY;
149 149
150 netif_rx(skb); 150 netif_rx(skb);
151
152 return 0;
153} 151}
154 152
155/** 153/**
@@ -269,15 +267,11 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
269 wlan_compute_rssi(priv, p_rx_pd); 267 wlan_compute_rssi(priv, p_rx_pd);
270 268
271 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 269 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
272 if (libertas_upload_rx_packet(priv, skb)) {
273 lbs_pr_debug(1, "RX error: libertas_upload_rx_packet"
274 " returns failure\n");
275 ret = -1;
276 goto done;
277 }
278 priv->stats.rx_bytes += skb->len; 270 priv->stats.rx_bytes += skb->len;
279 priv->stats.rx_packets++; 271 priv->stats.rx_packets++;
280 272
273 libertas_upload_rx_packet(priv, skb);
274
281 ret = 0; 275 ret = 0;
282done: 276done:
283 LEAVE(); 277 LEAVE();
@@ -438,22 +432,14 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
438 wlan_compute_rssi(priv, prxpd); 432 wlan_compute_rssi(priv, prxpd);
439 433
440 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 434 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
441
442 if (libertas_upload_rx_packet(priv, skb)) {
443 lbs_pr_debug(1, "RX error: libertas_upload_rx_packet "
444 "returns failure\n");
445 ret = -1;
446 goto done;
447 }
448
449 priv->stats.rx_bytes += skb->len; 435 priv->stats.rx_bytes += skb->len;
450 priv->stats.rx_packets++; 436 priv->stats.rx_packets++;
451 437
438 libertas_upload_rx_packet(priv, skb);
439
452 ret = 0; 440 ret = 0;
453done: 441done:
454 LEAVE(); 442 LEAVE();
455 443
456 skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
457
458 return (ret); 444 return (ret);
459} 445}
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index ddff40c4212c..821cde65e369 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1127,6 +1127,7 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
1127 int retval = 0; 1127 int retval = 0;
1128 unsigned long flags; 1128 unsigned long flags;
1129 1129
1130 zfcp_adapter_scsi_unregister(adapter);
1130 device_unregister(&adapter->generic_services); 1131 device_unregister(&adapter->generic_services);
1131 zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); 1132 zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev);
1132 dev_set_drvdata(&adapter->ccw_device->dev, NULL); 1133 dev_set_drvdata(&adapter->ccw_device->dev, NULL);
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 81680efa1721..1c8f71a59855 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -189,9 +189,7 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
189 * @ccw_device: pointer to belonging ccw device 189 * @ccw_device: pointer to belonging ccw device
190 * 190 *
191 * This function gets called by the common i/o layer and sets an adapter 191 * This function gets called by the common i/o layer and sets an adapter
192 * into state offline. Setting an fcp device offline means that it will be 192 * into state offline.
193 * unregistered from the SCSI stack and that the adapter will be shut down
194 * asynchronously.
195 */ 193 */
196static int 194static int
197zfcp_ccw_set_offline(struct ccw_device *ccw_device) 195zfcp_ccw_set_offline(struct ccw_device *ccw_device)
@@ -202,7 +200,6 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device)
202 adapter = dev_get_drvdata(&ccw_device->dev); 200 adapter = dev_get_drvdata(&ccw_device->dev);
203 zfcp_erp_adapter_shutdown(adapter, 0); 201 zfcp_erp_adapter_shutdown(adapter, 0);
204 zfcp_erp_wait(adapter); 202 zfcp_erp_wait(adapter);
205 zfcp_adapter_scsi_unregister(adapter);
206 zfcp_erp_thread_kill(adapter); 203 zfcp_erp_thread_kill(adapter);
207 zfcp_adapter_debug_unregister(adapter); 204 zfcp_adapter_debug_unregister(adapter);
208 up(&zfcp_data.config_sema); 205 up(&zfcp_data.config_sema);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index a8b02542ac2d..0eb31e162b15 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -156,44 +156,30 @@ zfcp_fsf_req_free(struct zfcp_fsf_req *fsf_req)
156 kfree(fsf_req); 156 kfree(fsf_req);
157} 157}
158 158
159/** 159/*
160 * zfcp_fsf_req_dismiss - dismiss a single fsf request 160 * Never ever call this without shutting down the adapter first.
161 */ 161 * Otherwise the adapter would continue using and corrupting s390 storage.
162static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter, 162 * Included BUG_ON() call to ensure this is done.
163 struct zfcp_fsf_req *fsf_req, 163 * ERP is supposed to be the only user of this function.
164 unsigned int counter)
165{
166 u64 dbg_tmp[2];
167
168 dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active);
169 dbg_tmp[1] = (u64) counter;
170 debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16);
171 list_del(&fsf_req->list);
172 fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
173 zfcp_fsf_req_complete(fsf_req);
174}
175
176/**
177 * zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests
178 */ 164 */
179void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) 165void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
180{ 166{
181 struct zfcp_fsf_req *request, *tmp; 167 struct zfcp_fsf_req *fsf_req, *tmp;
182 unsigned long flags; 168 unsigned long flags;
183 LIST_HEAD(remove_queue); 169 LIST_HEAD(remove_queue);
184 unsigned int i, counter; 170 unsigned int i;
185 171
172 BUG_ON(atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status));
186 spin_lock_irqsave(&adapter->req_list_lock, flags); 173 spin_lock_irqsave(&adapter->req_list_lock, flags);
187 atomic_set(&adapter->reqs_active, 0); 174 atomic_set(&adapter->reqs_active, 0);
188 for (i=0; i<REQUEST_LIST_SIZE; i++) 175 for (i = 0; i < REQUEST_LIST_SIZE; i++)
189 list_splice_init(&adapter->req_list[i], &remove_queue); 176 list_splice_init(&adapter->req_list[i], &remove_queue);
190
191 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 177 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
192 178
193 counter = 0; 179 list_for_each_entry_safe(fsf_req, tmp, &remove_queue, list) {
194 list_for_each_entry_safe(request, tmp, &remove_queue, list) { 180 list_del(&fsf_req->list);
195 zfcp_fsf_req_dismiss(adapter, request, counter); 181 fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
196 counter++; 182 zfcp_fsf_req_complete(fsf_req);
197 } 183 }
198} 184}
199 185
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 16e2d64658af..0acf6db0a08d 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -569,6 +569,9 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
569 int retval = 0; 569 int retval = 0;
570 static unsigned int unique_id = 0; 570 static unsigned int unique_id = 0;
571 571
572 if (adapter->scsi_host)
573 goto out;
574
572 /* register adapter as SCSI host with mid layer of SCSI stack */ 575 /* register adapter as SCSI host with mid layer of SCSI stack */
573 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, 576 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
574 sizeof (struct zfcp_adapter *)); 577 sizeof (struct zfcp_adapter *));
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 1e82c69b36b0..8dcfe4ec35c2 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -146,7 +146,7 @@ static char *aac_get_status_string(u32 status);
146static int nondasd = -1; 146static int nondasd = -1;
147static int dacmode = -1; 147static int dacmode = -1;
148 148
149static int commit = -1; 149int aac_commit = -1;
150int startup_timeout = 180; 150int startup_timeout = 180;
151int aif_timeout = 120; 151int aif_timeout = 120;
152 152
@@ -154,7 +154,7 @@ module_param(nondasd, int, S_IRUGO|S_IWUSR);
154MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); 154MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
155module_param(dacmode, int, S_IRUGO|S_IWUSR); 155module_param(dacmode, int, S_IRUGO|S_IWUSR);
156MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); 156MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
157module_param(commit, int, S_IRUGO|S_IWUSR); 157module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR);
158MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); 158MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on");
159module_param(startup_timeout, int, S_IRUGO|S_IWUSR); 159module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
160MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); 160MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS.");
@@ -173,6 +173,9 @@ int expose_physicals = -1;
173module_param(expose_physicals, int, S_IRUGO|S_IWUSR); 173module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); 174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on");
175 175
176int aac_reset_devices = 0;
177module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR);
178MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization.");
176 179
177static inline int aac_valid_context(struct scsi_cmnd *scsicmd, 180static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
178 struct fib *fibptr) { 181 struct fib *fibptr) {
@@ -246,7 +249,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
246 aac_fib_complete(fibptr); 249 aac_fib_complete(fibptr);
247 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ 250 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */
248 if (status >= 0) { 251 if (status >= 0) {
249 if ((commit == 1) || commit_flag) { 252 if ((aac_commit == 1) || commit_flag) {
250 struct aac_commit_config * dinfo; 253 struct aac_commit_config * dinfo;
251 aac_fib_init(fibptr); 254 aac_fib_init(fibptr);
252 dinfo = (struct aac_commit_config *) fib_data(fibptr); 255 dinfo = (struct aac_commit_config *) fib_data(fibptr);
@@ -261,7 +264,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
261 1, 1, 264 1, 1,
262 NULL, NULL); 265 NULL, NULL);
263 aac_fib_complete(fibptr); 266 aac_fib_complete(fibptr);
264 } else if (commit == 0) { 267 } else if (aac_commit == 0) {
265 printk(KERN_WARNING 268 printk(KERN_WARNING
266 "aac_get_config_status: Foreign device configurations are being ignored\n"); 269 "aac_get_config_status: Foreign device configurations are being ignored\n");
267 } 270 }
@@ -340,7 +343,7 @@ int aac_get_containers(struct aac_dev *dev)
340static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) 343static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len)
341{ 344{
342 void *buf; 345 void *buf;
343 unsigned int transfer_len; 346 int transfer_len;
344 struct scatterlist *sg = scsicmd->request_buffer; 347 struct scatterlist *sg = scsicmd->request_buffer;
345 348
346 if (scsicmd->use_sg) { 349 if (scsicmd->use_sg) {
@@ -351,7 +354,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne
351 transfer_len = min(scsicmd->request_bufflen, len + offset); 354 transfer_len = min(scsicmd->request_bufflen, len + offset);
352 } 355 }
353 transfer_len -= offset; 356 transfer_len -= offset;
354 if (buf && transfer_len) 357 if (buf && transfer_len > 0)
355 memcpy(buf + offset, data, transfer_len); 358 memcpy(buf + offset, data, transfer_len);
356 359
357 if (scsicmd->use_sg) 360 if (scsicmd->use_sg)
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 45ca3e801619..c81edf36913f 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1823,9 +1823,12 @@ int aac_send_shutdown(struct aac_dev *dev);
1823int aac_probe_container(struct aac_dev *dev, int cid); 1823int aac_probe_container(struct aac_dev *dev, int cid);
1824int _aac_rx_init(struct aac_dev *dev); 1824int _aac_rx_init(struct aac_dev *dev);
1825int aac_rx_select_comm(struct aac_dev *dev, int comm); 1825int aac_rx_select_comm(struct aac_dev *dev, int comm);
1826int aac_rx_deliver_producer(struct fib * fib);
1826extern int numacb; 1827extern int numacb;
1827extern int acbsize; 1828extern int acbsize;
1828extern char aac_driver_version[]; 1829extern char aac_driver_version[];
1829extern int startup_timeout; 1830extern int startup_timeout;
1830extern int aif_timeout; 1831extern int aif_timeout;
1831extern int expose_physicals; 1832extern int expose_physicals;
1833extern int aac_reset_devices;
1834extern int aac_commit;
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 291cd14f4e98..ae978a373c56 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -378,7 +378,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
378 * 378 *
379 * Will send a fib, returning 0 if successful. 379 * Will send a fib, returning 0 if successful.
380 */ 380 */
381static int aac_rx_deliver_producer(struct fib * fib) 381int aac_rx_deliver_producer(struct fib * fib)
382{ 382{
383 struct aac_dev *dev = fib->dev; 383 struct aac_dev *dev = fib->dev;
384 struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; 384 struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
@@ -488,6 +488,8 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
488 return -EINVAL; 488 return -EINVAL;
489 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) 489 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC)
490 return -ENODEV; 490 return -ENODEV;
491 if (startup_timeout < 300)
492 startup_timeout = 300;
491 return 0; 493 return 0;
492} 494}
493 495
@@ -542,7 +544,7 @@ int _aac_rx_init(struct aac_dev *dev)
542 dev->a_ops.adapter_sync_cmd = rx_sync_cmd; 544 dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
543 dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; 545 dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
544 dev->OIMR = status = rx_readb (dev, MUnit.OIMR); 546 dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
545 if ((((status & 0x0c) != 0x0c) || reset_devices) && 547 if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) &&
546 !aac_rx_restart_adapter(dev, 0)) 548 !aac_rx_restart_adapter(dev, 0))
547 ++restart; 549 ++restart;
548 /* 550 /*
@@ -594,6 +596,8 @@ int _aac_rx_init(struct aac_dev *dev)
594 } 596 }
595 msleep(1); 597 msleep(1);
596 } 598 }
599 if (restart)
600 aac_commit = 1;
597 /* 601 /*
598 * Fill in the common function dispatch table. 602 * Fill in the common function dispatch table.
599 */ 603 */
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index f4b5e9742ab0..85b91bc578c9 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -257,6 +257,11 @@ static void aac_sa_start_adapter(struct aac_dev *dev)
257 NULL, NULL, NULL, NULL, NULL); 257 NULL, NULL, NULL, NULL, NULL);
258} 258}
259 259
260static int aac_sa_restart_adapter(struct aac_dev *dev, int bled)
261{
262 return -EINVAL;
263}
264
260/** 265/**
261 * aac_sa_check_health 266 * aac_sa_check_health
262 * @dev: device to check if healthy 267 * @dev: device to check if healthy
@@ -366,7 +371,9 @@ int aac_sa_init(struct aac_dev *dev)
366 dev->a_ops.adapter_notify = aac_sa_notify_adapter; 371 dev->a_ops.adapter_notify = aac_sa_notify_adapter;
367 dev->a_ops.adapter_sync_cmd = sa_sync_cmd; 372 dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
368 dev->a_ops.adapter_check_health = aac_sa_check_health; 373 dev->a_ops.adapter_check_health = aac_sa_check_health;
374 dev->a_ops.adapter_restart = aac_sa_restart_adapter;
369 dev->a_ops.adapter_intr = aac_sa_intr; 375 dev->a_ops.adapter_intr = aac_sa_intr;
376 dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
370 dev->a_ops.adapter_ioremap = aac_sa_ioremap; 377 dev->a_ops.adapter_ioremap = aac_sa_ioremap;
371 378
372 /* 379 /*
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
index c328596def3c..6066998ed562 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
@@ -106,6 +106,7 @@ static void make_expression(expression_t *immed, int value);
106static void add_conditional(symbol_t *symbol); 106static void add_conditional(symbol_t *symbol);
107static void add_version(const char *verstring); 107static void add_version(const char *verstring);
108static int is_download_const(expression_t *immed); 108static int is_download_const(expression_t *immed);
109void yyerror(const char *string);
109 110
110#define SRAM_SYMNAME "SRAM_BASE" 111#define SRAM_SYMNAME "SRAM_BASE"
111#define SCB_SYMNAME "SCB_BASE" 112#define SCB_SYMNAME "SCB_BASE"
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
index 439f760b34b5..ff46aa6801bf 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
@@ -65,6 +65,7 @@
65static symbol_t *macro_symbol; 65static symbol_t *macro_symbol;
66 66
67static void add_macro_arg(const char *argtext, int position); 67static void add_macro_arg(const char *argtext, int position);
68void mmerror(const char *string);
68 69
69%} 70%}
70 71
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c
index 9a14a6d97275..c0d0b7d7a8ce 100644
--- a/drivers/scsi/aic94xx/aic94xx_tmf.c
+++ b/drivers/scsi/aic94xx/aic94xx_tmf.c
@@ -290,6 +290,7 @@ static void asd_tmf_tasklet_complete(struct asd_ascb *ascb,
290static inline int asd_clear_nexus(struct sas_task *task) 290static inline int asd_clear_nexus(struct sas_task *task)
291{ 291{
292 int res = TMF_RESP_FUNC_FAILED; 292 int res = TMF_RESP_FUNC_FAILED;
293 int leftover;
293 struct asd_ascb *tascb = task->lldd_task; 294 struct asd_ascb *tascb = task->lldd_task;
294 unsigned long flags; 295 unsigned long flags;
295 296
@@ -298,10 +299,12 @@ static inline int asd_clear_nexus(struct sas_task *task)
298 res = asd_clear_nexus_tag(task); 299 res = asd_clear_nexus_tag(task);
299 else 300 else
300 res = asd_clear_nexus_index(task); 301 res = asd_clear_nexus_index(task);
301 wait_for_completion_timeout(&tascb->completion, 302 leftover = wait_for_completion_timeout(&tascb->completion,
302 AIC94XX_SCB_TIMEOUT); 303 AIC94XX_SCB_TIMEOUT);
303 ASD_DPRINTK("came back from clear nexus\n"); 304 ASD_DPRINTK("came back from clear nexus\n");
304 spin_lock_irqsave(&task->task_state_lock, flags); 305 spin_lock_irqsave(&task->task_state_lock, flags);
306 if (leftover < 1)
307 res = TMF_RESP_FUNC_FAILED;
305 if (task->task_state_flags & SAS_TASK_STATE_DONE) 308 if (task->task_state_flags & SAS_TASK_STATE_DONE)
306 res = TMF_RESP_FUNC_COMPLETE; 309 res = TMF_RESP_FUNC_COMPLETE;
307 spin_unlock_irqrestore(&task->task_state_lock, flags); 310 spin_unlock_irqrestore(&task->task_state_lock, flags);
@@ -350,6 +353,7 @@ int asd_abort_task(struct sas_task *task)
350 unsigned long flags; 353 unsigned long flags;
351 struct asd_ascb *ascb = NULL; 354 struct asd_ascb *ascb = NULL;
352 struct scb *scb; 355 struct scb *scb;
356 int leftover;
353 357
354 spin_lock_irqsave(&task->task_state_lock, flags); 358 spin_lock_irqsave(&task->task_state_lock, flags);
355 if (task->task_state_flags & SAS_TASK_STATE_DONE) { 359 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
@@ -455,9 +459,11 @@ int asd_abort_task(struct sas_task *task)
455 break; 459 break;
456 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ 460 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */
457 res = TMF_RESP_FUNC_FAILED; 461 res = TMF_RESP_FUNC_FAILED;
458 wait_for_completion_timeout(&tascb->completion, 462 leftover = wait_for_completion_timeout(&tascb->completion,
459 AIC94XX_SCB_TIMEOUT); 463 AIC94XX_SCB_TIMEOUT);
460 spin_lock_irqsave(&task->task_state_lock, flags); 464 spin_lock_irqsave(&task->task_state_lock, flags);
465 if (leftover < 1)
466 res = TMF_RESP_FUNC_FAILED;
461 if (task->task_state_flags & SAS_TASK_STATE_DONE) 467 if (task->task_state_flags & SAS_TASK_STATE_DONE)
462 res = TMF_RESP_FUNC_COMPLETE; 468 res = TMF_RESP_FUNC_COMPLETE;
463 spin_unlock_irqrestore(&task->task_state_lock, flags); 469 spin_unlock_irqrestore(&task->task_state_lock, flags);
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4baa79e68679..fa6ff295e568 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3954,6 +3954,13 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
3954 spin_unlock_irq(scsi_cmd->device->host->host_lock); 3954 spin_unlock_irq(scsi_cmd->device->host->host_lock);
3955 ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); 3955 ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL);
3956 spin_lock_irq(scsi_cmd->device->host->host_lock); 3956 spin_lock_irq(scsi_cmd->device->host->host_lock);
3957
3958 list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) {
3959 if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) {
3960 rc = -EIO;
3961 break;
3962 }
3963 }
3957 } else 3964 } else
3958 rc = ipr_device_reset(ioa_cfg, res); 3965 rc = ipr_device_reset(ioa_cfg, res);
3959 res->resetting_device = 0; 3966 res->resetting_device = 0;
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 5631c199a8eb..732446e63963 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -254,6 +254,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
254 254
255 sg_init_one(&dummy, md, id->table_desc.len); 255 sg_init_one(&dummy, md, id->table_desc.len);
256 sg_dma_address(&dummy) = token; 256 sg_dma_address(&dummy) = token;
257 sg_dma_len(&dummy) = id->table_desc.len;
257 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, 258 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE,
258 id->table_desc.len); 259 id->table_desc.len);
259 if (err) { 260 if (err) {
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7a812677ff8a..e2cf12ef3688 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.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_sas.c 12 * FILE : megaraid_sas.c
13 * Version : v00.00.03.10-rc1 13 * Version : v00.00.03.10-rc5
14 * 14 *
15 * Authors: 15 * Authors:
16 * (email-id : megaraidlinux@lsi.com) 16 * (email-id : megaraidlinux@lsi.com)
@@ -886,6 +886,7 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
886 goto out_return_cmd; 886 goto out_return_cmd;
887 887
888 cmd->scmd = scmd; 888 cmd->scmd = scmd;
889 scmd->SCp.ptr = (char *)cmd;
889 890
890 /* 891 /*
891 * Issue the command to the FW 892 * Issue the command to the FW
@@ -919,7 +920,7 @@ static int megasas_slave_configure(struct scsi_device *sdev)
919 * The RAID firmware may require extended timeouts. 920 * The RAID firmware may require extended timeouts.
920 */ 921 */
921 if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) 922 if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS)
922 sdev->timeout = 90 * HZ; 923 sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;
923 return 0; 924 return 0;
924} 925}
925 926
@@ -981,8 +982,8 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
981 982
982 instance = (struct megasas_instance *)scmd->device->host->hostdata; 983 instance = (struct megasas_instance *)scmd->device->host->hostdata;
983 984
984 scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x\n", 985 scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x retries=%x\n",
985 scmd->serial_number, scmd->cmnd[0]); 986 scmd->serial_number, scmd->cmnd[0], scmd->retries);
986 987
987 if (instance->hw_crit_error) { 988 if (instance->hw_crit_error) {
988 printk(KERN_ERR "megasas: cannot recover from previous reset " 989 printk(KERN_ERR "megasas: cannot recover from previous reset "
@@ -1000,6 +1001,39 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
1000} 1001}
1001 1002
1002/** 1003/**
1004 * megasas_reset_timer - quiesce the adapter if required
1005 * @scmd: scsi cmnd
1006 *
1007 * Sets the FW busy flag and reduces the host->can_queue if the
1008 * cmd has not been completed within the timeout period.
1009 */
1010static enum
1011scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
1012{
1013 struct megasas_cmd *cmd = (struct megasas_cmd *)scmd->SCp.ptr;
1014 struct megasas_instance *instance;
1015 unsigned long flags;
1016
1017 if (time_after(jiffies, scmd->jiffies_at_alloc +
1018 (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) {
1019 return EH_NOT_HANDLED;
1020 }
1021
1022 instance = cmd->instance;
1023 if (!(instance->flag & MEGASAS_FW_BUSY)) {
1024 /* FW is busy, throttle IO */
1025 spin_lock_irqsave(instance->host->host_lock, flags);
1026
1027 instance->host->can_queue = 16;
1028 instance->last_time = jiffies;
1029 instance->flag |= MEGASAS_FW_BUSY;
1030
1031 spin_unlock_irqrestore(instance->host->host_lock, flags);
1032 }
1033 return EH_RESET_TIMER;
1034}
1035
1036/**
1003 * megasas_reset_device - Device reset handler entry point 1037 * megasas_reset_device - Device reset handler entry point
1004 */ 1038 */
1005static int megasas_reset_device(struct scsi_cmnd *scmd) 1039static int megasas_reset_device(struct scsi_cmnd *scmd)
@@ -1112,6 +1146,7 @@ static struct scsi_host_template megasas_template = {
1112 .eh_device_reset_handler = megasas_reset_device, 1146 .eh_device_reset_handler = megasas_reset_device,
1113 .eh_bus_reset_handler = megasas_reset_bus_host, 1147 .eh_bus_reset_handler = megasas_reset_bus_host,
1114 .eh_host_reset_handler = megasas_reset_bus_host, 1148 .eh_host_reset_handler = megasas_reset_bus_host,
1149 .eh_timed_out = megasas_reset_timer,
1115 .bios_param = megasas_bios_param, 1150 .bios_param = megasas_bios_param,
1116 .use_clustering = ENABLE_CLUSTERING, 1151 .use_clustering = ENABLE_CLUSTERING,
1117}; 1152};
@@ -1215,9 +1250,8 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1215 int exception = 0; 1250 int exception = 0;
1216 struct megasas_header *hdr = &cmd->frame->hdr; 1251 struct megasas_header *hdr = &cmd->frame->hdr;
1217 1252
1218 if (cmd->scmd) { 1253 if (cmd->scmd)
1219 cmd->scmd->SCp.ptr = (char *)0; 1254 cmd->scmd->SCp.ptr = NULL;
1220 }
1221 1255
1222 switch (hdr->cmd) { 1256 switch (hdr->cmd) {
1223 1257
@@ -1806,6 +1840,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
1806 u32 context; 1840 u32 context;
1807 struct megasas_cmd *cmd; 1841 struct megasas_cmd *cmd;
1808 struct megasas_instance *instance = (struct megasas_instance *)instance_addr; 1842 struct megasas_instance *instance = (struct megasas_instance *)instance_addr;
1843 unsigned long flags;
1809 1844
1810 /* If we have already declared adapter dead, donot complete cmds */ 1845 /* If we have already declared adapter dead, donot complete cmds */
1811 if (instance->hw_crit_error) 1846 if (instance->hw_crit_error)
@@ -1828,6 +1863,22 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
1828 } 1863 }
1829 1864
1830 *instance->consumer = producer; 1865 *instance->consumer = producer;
1866
1867 /*
1868 * Check if we can restore can_queue
1869 */
1870 if (instance->flag & MEGASAS_FW_BUSY
1871 && time_after(jiffies, instance->last_time + 5 * HZ)
1872 && atomic_read(&instance->fw_outstanding) < 17) {
1873
1874 spin_lock_irqsave(instance->host->host_lock, flags);
1875 instance->flag &= ~MEGASAS_FW_BUSY;
1876 instance->host->can_queue =
1877 instance->max_fw_cmds - MEGASAS_INT_CMDS;
1878
1879 spin_unlock_irqrestore(instance->host->host_lock, flags);
1880 }
1881
1831} 1882}
1832 1883
1833/** 1884/**
@@ -2398,6 +2449,8 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2398 instance->init_id = MEGASAS_DEFAULT_INIT_ID; 2449 instance->init_id = MEGASAS_DEFAULT_INIT_ID;
2399 2450
2400 megasas_dbg_lvl = 0; 2451 megasas_dbg_lvl = 0;
2452 instance->flag = 0;
2453 instance->last_time = 0;
2401 2454
2402 /* 2455 /*
2403 * Initialize MFI Firmware 2456 * Initialize MFI Firmware
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index e862992ee377..4dffc918a414 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,9 +18,9 @@
18/* 18/*
19 * MegaRAID SAS Driver meta data 19 * MegaRAID SAS Driver meta data
20 */ 20 */
21#define MEGASAS_VERSION "00.00.03.10-rc1" 21#define MEGASAS_VERSION "00.00.03.10-rc5"
22#define MEGASAS_RELDATE "Feb 14, 2007" 22#define MEGASAS_RELDATE "May 17, 2007"
23#define MEGASAS_EXT_VERSION "Wed Feb 14 10:14:25 PST 2007" 23#define MEGASAS_EXT_VERSION "Thu May 17 10:09:32 PDT 2007"
24 24
25/* 25/*
26 * Device IDs 26 * Device IDs
@@ -539,6 +539,8 @@ struct megasas_ctrl_info {
539 539
540#define MEGASAS_DBG_LVL 1 540#define MEGASAS_DBG_LVL 1
541 541
542#define MEGASAS_FW_BUSY 1
543
542/* 544/*
543 * When SCSI mid-layer calls driver's reset routine, driver waits for 545 * When SCSI mid-layer calls driver's reset routine, driver waits for
544 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 546 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
@@ -549,8 +551,8 @@ struct megasas_ctrl_info {
549#define MEGASAS_RESET_WAIT_TIME 180 551#define MEGASAS_RESET_WAIT_TIME 180
550#define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 552#define MEGASAS_INTERNAL_CMD_WAIT_TIME 180
551#define MEGASAS_RESET_NOTICE_INTERVAL 5 553#define MEGASAS_RESET_NOTICE_INTERVAL 5
552
553#define MEGASAS_IOCTL_CMD 0 554#define MEGASAS_IOCTL_CMD 0
555#define MEGASAS_DEFAULT_CMD_TIMEOUT 90
554 556
555/* 557/*
556 * FW reports the maximum of number of commands that it can accept (maximum 558 * FW reports the maximum of number of commands that it can accept (maximum
@@ -1073,7 +1075,6 @@ struct megasas_instance {
1073 struct megasas_register_set __iomem *reg_set; 1075 struct megasas_register_set __iomem *reg_set;
1074 1076
1075 s8 init_id; 1077 s8 init_id;
1076 u8 reserved[3];
1077 1078
1078 u16 max_num_sge; 1079 u16 max_num_sge;
1079 u16 max_fw_cmds; 1080 u16 max_fw_cmds;
@@ -1104,6 +1105,9 @@ struct megasas_instance {
1104 1105
1105 struct megasas_instance_template *instancet; 1106 struct megasas_instance_template *instancet;
1106 struct tasklet_struct isr_tasklet; 1107 struct tasklet_struct isr_tasklet;
1108
1109 u8 flag;
1110 unsigned long last_time;
1107}; 1111};
1108 1112
1109#define MEGASAS_IS_LOGICAL(scp) \ 1113#define MEGASAS_IS_LOGICAL(scp) \
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index ce63044b1ec8..18dd5cc4d7c6 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -209,6 +209,7 @@ static struct {
209 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 209 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
210 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 210 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
211 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 211 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
212 {"Promise", "", NULL, BLIST_SPARSELUN},
212 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, 213 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
213 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, 214 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
214 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ 215 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 00e46662296f..3d8c9cb24f91 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev)
1789static int sd_suspend(struct device *dev, pm_message_t mesg) 1789static int sd_suspend(struct device *dev, pm_message_t mesg)
1790{ 1790{
1791 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1791 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1792 int ret; 1792 int ret = 0;
1793 1793
1794 if (!sdkp) 1794 if (!sdkp)
1795 return 0; /* this can happen */ 1795 return 0; /* this can happen */
@@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
1798 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); 1798 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
1799 ret = sd_sync_cache(sdkp); 1799 ret = sd_sync_cache(sdkp);
1800 if (ret) 1800 if (ret)
1801 return ret; 1801 goto done;
1802 } 1802 }
1803 1803
1804 if (mesg.event == PM_EVENT_SUSPEND && 1804 if (mesg.event == PM_EVENT_SUSPEND &&
1805 sdkp->device->manage_start_stop) { 1805 sdkp->device->manage_start_stop) {
1806 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); 1806 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
1807 ret = sd_start_stop_device(sdkp, 0); 1807 ret = sd_start_stop_device(sdkp, 0);
1808 if (ret)
1809 return ret;
1810 } 1808 }
1811 1809
1812 return 0; 1810done:
1811 scsi_disk_put(sdkp);
1812 return ret;
1813} 1813}
1814 1814
1815static int sd_resume(struct device *dev) 1815static int sd_resume(struct device *dev)
1816{ 1816{
1817 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1817 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1818 int ret = 0;
1818 1819
1819 if (!sdkp->device->manage_start_stop) 1820 if (!sdkp->device->manage_start_stop)
1820 return 0; 1821 goto done;
1821 1822
1822 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 1823 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
1824 ret = sd_start_stop_device(sdkp, 1);
1823 1825
1824 return sd_start_stop_device(sdkp, 1); 1826done:
1827 scsi_disk_put(sdkp);
1828 return ret;
1825} 1829}
1826 1830
1827/** 1831/**
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 69be1324b114..9ac83abc4028 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -32,11 +32,12 @@
32#include <scsi/scsi_cmnd.h> 32#include <scsi/scsi_cmnd.h>
33#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
34#include <scsi/scsi_tcq.h> 34#include <scsi/scsi_tcq.h>
35#include <scsi/scsi_dbg.h>
35 36
36#define DRV_NAME "stex" 37#define DRV_NAME "stex"
37#define ST_DRIVER_VERSION "3.1.0.1" 38#define ST_DRIVER_VERSION "3.6.0000.1"
38#define ST_VER_MAJOR 3 39#define ST_VER_MAJOR 3
39#define ST_VER_MINOR 1 40#define ST_VER_MINOR 6
40#define ST_OEM 0 41#define ST_OEM 0
41#define ST_BUILD_VER 1 42#define ST_BUILD_VER 1
42 43
@@ -113,10 +114,6 @@ enum {
113 SG_CF_64B = 0x40, /* 64 bit item */ 114 SG_CF_64B = 0x40, /* 64 bit item */
114 SG_CF_HOST = 0x20, /* sg in host memory */ 115 SG_CF_HOST = 0x20, /* sg in host memory */
115 116
116 ST_MAX_ARRAY_SUPPORTED = 16,
117 ST_MAX_TARGET_NUM = (ST_MAX_ARRAY_SUPPORTED+1),
118 ST_MAX_LUN_PER_TARGET = 16,
119
120 st_shasta = 0, 117 st_shasta = 0,
121 st_vsc = 1, 118 st_vsc = 1,
122 st_vsc1 = 2, 119 st_vsc1 = 2,
@@ -586,7 +583,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
586 u16 tag; 583 u16 tag;
587 host = cmd->device->host; 584 host = cmd->device->host;
588 id = cmd->device->id; 585 id = cmd->device->id;
589 lun = cmd->device->channel; /* firmware lun issue work around */ 586 lun = cmd->device->lun;
590 hba = (struct st_hba *) &host->hostdata[0]; 587 hba = (struct st_hba *) &host->hostdata[0];
591 588
592 switch (cmd->cmnd[0]) { 589 switch (cmd->cmnd[0]) {
@@ -605,8 +602,26 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
605 stex_invalid_field(cmd, done); 602 stex_invalid_field(cmd, done);
606 return 0; 603 return 0;
607 } 604 }
605 case REPORT_LUNS:
606 /*
607 * The shasta firmware does not report actual luns in the
608 * target, so fail the command to force sequential lun scan.
609 * Also, the console device does not support this command.
610 */
611 if (hba->cardtype == st_shasta || id == host->max_id - 1) {
612 stex_invalid_field(cmd, done);
613 return 0;
614 }
615 break;
616 case TEST_UNIT_READY:
617 if (id == host->max_id - 1) {
618 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
619 done(cmd);
620 return 0;
621 }
622 break;
608 case INQUIRY: 623 case INQUIRY:
609 if (id != ST_MAX_ARRAY_SUPPORTED) 624 if (id != host->max_id - 1)
610 break; 625 break;
611 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { 626 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
612 stex_direct_copy(cmd, console_inq_page, 627 stex_direct_copy(cmd, console_inq_page,
@@ -624,7 +639,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
624 ver.oem = ST_OEM; 639 ver.oem = ST_OEM;
625 ver.build = ST_BUILD_VER; 640 ver.build = ST_BUILD_VER;
626 ver.signature[0] = PASSTHRU_SIGNATURE; 641 ver.signature[0] = PASSTHRU_SIGNATURE;
627 ver.console_id = ST_MAX_ARRAY_SUPPORTED; 642 ver.console_id = host->max_id - 1;
628 ver.host_no = hba->host->host_no; 643 ver.host_no = hba->host->host_no;
629 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? 644 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ?
630 DID_OK << 16 | COMMAND_COMPLETE << 8 : 645 DID_OK << 16 | COMMAND_COMPLETE << 8 :
@@ -645,13 +660,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
645 660
646 req = stex_alloc_req(hba); 661 req = stex_alloc_req(hba);
647 662
648 if (hba->cardtype == st_yosemite) { 663 req->lun = lun;
649 req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; 664 req->target = id;
650 req->target = 0;
651 } else {
652 req->lun = lun;
653 req->target = id;
654 }
655 665
656 /* cdb */ 666 /* cdb */
657 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); 667 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH);
@@ -767,18 +777,6 @@ static void stex_ys_commands(struct st_hba *hba,
767 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; 777 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT;
768 else 778 else
769 ccb->srb_status = SRB_STATUS_SUCCESS; 779 ccb->srb_status = SRB_STATUS_SUCCESS;
770 } else if (ccb->cmd->cmnd[0] == REPORT_LUNS) {
771 u8 *report_lun_data = (u8 *)hba->copy_buffer;
772
773 count = STEX_EXTRA_SIZE;
774 stex_internal_copy(ccb->cmd, report_lun_data,
775 &count, ccb->sg_count, ST_FROM_CMD);
776 if (report_lun_data[2] || report_lun_data[3]) {
777 report_lun_data[2] = 0x00;
778 report_lun_data[3] = 0x08;
779 stex_internal_copy(ccb->cmd, report_lun_data,
780 &count, ccb->sg_count, ST_TO_CMD);
781 }
782 } 780 }
783} 781}
784 782
@@ -995,6 +993,11 @@ static int stex_abort(struct scsi_cmnd *cmd)
995 u32 data; 993 u32 data;
996 int result = SUCCESS; 994 int result = SUCCESS;
997 unsigned long flags; 995 unsigned long flags;
996
997 printk(KERN_INFO DRV_NAME
998 "(%s): aborting command\n", pci_name(hba->pdev));
999 scsi_print_command(cmd);
1000
998 base = hba->mmio_base; 1001 base = hba->mmio_base;
999 spin_lock_irqsave(host->host_lock, flags); 1002 spin_lock_irqsave(host->host_lock, flags);
1000 if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) 1003 if (tag < host->can_queue && hba->ccb[tag].cmd == cmd)
@@ -1051,7 +1054,12 @@ static void stex_hard_reset(struct st_hba *hba)
1051 pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); 1054 pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl);
1052 pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; 1055 pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET;
1053 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); 1056 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl);
1054 msleep(1); 1057
1058 /*
1059 * 1 ms may be enough for 8-port controllers. But 16-port controllers
1060 * require more time to finish bus reset. Use 100 ms here for safety
1061 */
1062 msleep(100);
1055 pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; 1063 pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET;
1056 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); 1064 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl);
1057 1065
@@ -1075,6 +1083,10 @@ static int stex_reset(struct scsi_cmnd *cmd)
1075 unsigned long before; 1083 unsigned long before;
1076 hba = (struct st_hba *) &cmd->device->host->hostdata[0]; 1084 hba = (struct st_hba *) &cmd->device->host->hostdata[0];
1077 1085
1086 printk(KERN_INFO DRV_NAME
1087 "(%s): resetting host\n", pci_name(hba->pdev));
1088 scsi_print_command(cmd);
1089
1078 hba->mu_status = MU_STATE_RESETTING; 1090 hba->mu_status = MU_STATE_RESETTING;
1079 1091
1080 if (hba->cardtype == st_shasta) 1092 if (hba->cardtype == st_shasta)
@@ -1194,7 +1206,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1194 goto out_scsi_host_put; 1206 goto out_scsi_host_put;
1195 } 1207 }
1196 1208
1197 hba->mmio_base = ioremap(pci_resource_start(pdev, 0), 1209 hba->mmio_base = ioremap_nocache(pci_resource_start(pdev, 0),
1198 pci_resource_len(pdev, 0)); 1210 pci_resource_len(pdev, 0));
1199 if ( !hba->mmio_base) { 1211 if ( !hba->mmio_base) {
1200 printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", 1212 printk(KERN_ERR DRV_NAME "(%s): memory map failed\n",
@@ -1229,12 +1241,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1229 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; 1241 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE;
1230 hba->mu_status = MU_STATE_STARTING; 1242 hba->mu_status = MU_STATE_STARTING;
1231 1243
1232 /* firmware uses id/lun pair for a logical drive, but lun would be 1244 if (hba->cardtype == st_shasta) {
1233 always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use 1245 host->max_lun = 8;
1234 channel to map lun here */ 1246 host->max_id = 16 + 1;
1235 host->max_channel = ST_MAX_LUN_PER_TARGET - 1; 1247 } else if (hba->cardtype == st_yosemite) {
1236 host->max_id = ST_MAX_TARGET_NUM; 1248 host->max_lun = 128;
1237 host->max_lun = 1; 1249 host->max_id = 1 + 1;
1250 } else {
1251 /* st_vsc and st_vsc1 */
1252 host->max_lun = 1;
1253 host->max_id = 128 + 1;
1254 }
1255 host->max_channel = 0;
1238 host->unique_id = host->host_no; 1256 host->unique_id = host->host_no;
1239 host->max_cmd_len = STEX_CDB_LENGTH; 1257 host->max_cmd_len = STEX_CDB_LENGTH;
1240 1258
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 052359fc41ee..11f36bef3057 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
329 int ret = 0; 329 int ret = 0;
330 330
331#if defined(CONFIG_PPC_MERGE) 331#if defined(CONFIG_PPC_MERGE)
332 cdm = mpc52xx_find_and_map("mpc52xx-cdm"); 332 cdm = mpc52xx_find_and_map("mpc5200-cdm");
333 gpio = mpc52xx_find_and_map("mpc52xx-gpio"); 333 gpio = mpc52xx_find_and_map("mpc5200-gpio");
334#else 334#else
335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); 335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
336 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 336 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
@@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
445 struct spi_master *master; 445 struct spi_master *master;
446 int ret; 446 int ret;
447 447
448 if (pdata == NULL)
449 return -ENODEV;
450
451 master = spi_alloc_master(dev, sizeof *mps); 448 master = spi_alloc_master(dev, sizeof *mps);
452 if (master == NULL) 449 if (master == NULL)
453 return -ENOMEM; 450 return -ENOMEM;
@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
594 } 591 }
595 regaddr64 = of_translate_address(op->node, regaddr_p); 592 regaddr64 = of_translate_address(op->node, regaddr_p);
596 593
594 /* get PSC id (1..6, used by port_config) */
597 if (op->dev.platform_data == NULL) { 595 if (op->dev.platform_data == NULL) {
598 struct device_node *np; 596 const u32 *psc_nump;
599 int i = 0;
600 597
601 for_each_node_by_type(np, "spi") { 598 psc_nump = of_get_property(op->node, "cell-index", NULL);
602 if (of_find_device_by_node(np) == op) { 599 if (!psc_nump || *psc_nump > 5) {
603 id = i; 600 printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
604 break; 601 "cell-index property\n", op->node->full_name);
605 } 602 return -EINVAL;
606 i++;
607 } 603 }
604 id = *psc_nump + 1;
608 } 605 }
609 606
610 return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, 607 return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
@@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
617} 614}
618 615
619static struct of_device_id mpc52xx_psc_spi_of_match[] = { 616static struct of_device_id mpc52xx_psc_spi_of_match[] = {
620 { .type = "spi", .compatible = "mpc52xx-psc-spi", }, 617 { .type = "spi", .compatible = "mpc5200-psc-spi", },
621 {}, 618 {},
622}; 619};
623 620
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index 96f62b2df300..95183e1df525 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -358,11 +358,11 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
358 switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { 358 switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
359 case SPI_MODE_0: 359 case SPI_MODE_0:
360 case SPI_MODE_3: 360 case SPI_MODE_3:
361 flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE; 361 flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE;
362 break; 362 break;
363 case SPI_MODE_1: 363 case SPI_MODE_1:
364 case SPI_MODE_2: 364 case SPI_MODE_2:
365 flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE; 365 flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE;
366 break; 366 break;
367 } 367 }
368 368
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 225d6b2f82dd..d04242aee40d 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_data *spidev,
168 n--, k_tmp++, u_tmp++) { 168 n--, k_tmp++, u_tmp++) {
169 k_tmp->len = u_tmp->len; 169 k_tmp->len = u_tmp->len;
170 170
171 total += k_tmp->len;
172 if (total > bufsiz) {
173 status = -EMSGSIZE;
174 goto done;
175 }
176
171 if (u_tmp->rx_buf) { 177 if (u_tmp->rx_buf) {
172 k_tmp->rx_buf = buf; 178 k_tmp->rx_buf = buf;
173 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) 179 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len))
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_data *spidev,
179 u_tmp->len)) 185 u_tmp->len))
180 goto done; 186 goto done;
181 } 187 }
182
183 total += k_tmp->len;
184 if (total > bufsiz) {
185 status = -EMSGSIZE;
186 goto done;
187 }
188 buf += k_tmp->len; 188 buf += k_tmp->len;
189 189
190 k_tmp->cs_change = !!u_tmp->cs_change; 190 k_tmp->cs_change = !!u_tmp->cs_change;
@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
364 break; 364 break;
365 } 365 }
366 if (__copy_from_user(ioc, (void __user *)arg, tmp)) { 366 if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
367 kfree(ioc);
367 retval = -EFAULT; 368 retval = -EFAULT;
368 break; 369 break;
369 } 370 }
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 15e740e3a5c4..7b1edfe46b28 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1003,7 +1003,7 @@ abort:
1003 usblp->writebuf, usblp->writeurb->transfer_dma); 1003 usblp->writebuf, usblp->writeurb->transfer_dma);
1004 if (usblp->readbuf) 1004 if (usblp->readbuf)
1005 usb_buffer_free (usblp->dev, USBLP_BUF_SIZE, 1005 usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
1006 usblp->readbuf, usblp->writeurb->transfer_dma); 1006 usblp->readbuf, usblp->readurb->transfer_dma);
1007 kfree(usblp->statusbuf); 1007 kfree(usblp->statusbuf);
1008 kfree(usblp->device_id_string); 1008 kfree(usblp->device_id_string);
1009 usb_free_urb(usblp->writeurb); 1009 usb_free_urb(usblp->writeurb);
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index bfb3731d42db..2d4fd530e5e4 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -185,10 +185,12 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
185 num_ep = USB_MAXENDPOINTS; 185 num_ep = USB_MAXENDPOINTS;
186 } 186 }
187 187
188 len = sizeof(struct usb_host_endpoint) * num_ep; 188 if (num_ep > 0) { /* Can't allocate 0 bytes */
189 alt->endpoint = kzalloc(len, GFP_KERNEL); 189 len = sizeof(struct usb_host_endpoint) * num_ep;
190 if (!alt->endpoint) 190 alt->endpoint = kzalloc(len, GFP_KERNEL);
191 return -ENOMEM; 191 if (!alt->endpoint)
192 return -ENOMEM;
193 }
192 194
193 /* Parse all the endpoint descriptors */ 195 /* Parse all the endpoint descriptors */
194 n = 0; 196 n = 0;
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index b9f7f90aef82..2619986e5300 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -983,7 +983,10 @@ static int autosuspend_check(struct usb_device *udev)
983 983
984#else 984#else
985 985
986#define autosuspend_check(udev) 0 986static inline int autosuspend_check(struct usb_device *udev)
987{
988 return 0;
989}
987 990
988#endif /* CONFIG_USB_SUSPEND */ 991#endif /* CONFIG_USB_SUSPEND */
989 992
@@ -1041,7 +1044,6 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1041 if (status < 0) 1044 if (status < 0)
1042 goto done; 1045 goto done;
1043 } 1046 }
1044 cancel_delayed_work(&udev->autosuspend);
1045 1047
1046 /* Suspend all the interfaces and then udev itself */ 1048 /* Suspend all the interfaces and then udev itself */
1047 if (udev->actconfig) { 1049 if (udev->actconfig) {
@@ -1062,9 +1064,16 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1062 usb_resume_interface(intf); 1064 usb_resume_interface(intf);
1063 } 1065 }
1064 1066
1067 /* Try another autosuspend when the interfaces aren't busy */
1068 if (udev->auto_pm)
1069 autosuspend_check(udev);
1070
1065 /* If the suspend succeeded, propagate it up the tree */ 1071 /* If the suspend succeeded, propagate it up the tree */
1066 } else if (parent) 1072 } else {
1067 usb_autosuspend_device(parent); 1073 cancel_delayed_work(&udev->autosuspend);
1074 if (parent)
1075 usb_autosuspend_device(parent);
1076 }
1068 1077
1069 done: 1078 done:
1070 // dev_dbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); 1079 // dev_dbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status);
@@ -1475,6 +1484,7 @@ int usb_external_resume_device(struct usb_device *udev)
1475 usb_pm_lock(udev); 1484 usb_pm_lock(udev);
1476 udev->auto_pm = 0; 1485 udev->auto_pm = 0;
1477 status = usb_resume_both(udev); 1486 status = usb_resume_both(udev);
1487 udev->last_busy = jiffies;
1478 usb_pm_unlock(udev); 1488 usb_pm_unlock(udev);
1479 1489
1480 /* Now that the device is awake, we can start trying to autosuspend 1490 /* Now that the device is awake, we can start trying to autosuspend
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 40cf882293e6..8969e42434b9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1018,8 +1018,8 @@ done:
1018 atomic_dec (&urb->use_count); 1018 atomic_dec (&urb->use_count);
1019 if (urb->reject) 1019 if (urb->reject)
1020 wake_up (&usb_kill_urb_queue); 1020 wake_up (&usb_kill_urb_queue);
1021 usb_put_urb (urb);
1022 usbmon_urb_submit_error(&hcd->self, urb, status); 1021 usbmon_urb_submit_error(&hcd->self, urb, status);
1022 usb_put_urb (urb);
1023 } 1023 }
1024 return status; 1024 return status;
1025} 1025}
@@ -1175,10 +1175,6 @@ void usb_hcd_endpoint_disable (struct usb_device *udev,
1175 struct urb *urb; 1175 struct urb *urb;
1176 1176
1177 hcd = bus_to_hcd(udev->bus); 1177 hcd = bus_to_hcd(udev->bus);
1178
1179 WARN_ON (!HC_IS_RUNNING (hcd->state) && hcd->state != HC_STATE_HALT &&
1180 udev->state != USB_STATE_NOTATTACHED);
1181
1182 local_irq_disable (); 1178 local_irq_disable ();
1183 1179
1184 /* ep is already gone from udev->ep_{in,out}[]; no more submits */ 1180 /* ep is already gone from udev->ep_{in,out}[]; no more submits */
@@ -1685,7 +1681,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
1685 spin_unlock_irq (&hcd_root_hub_lock); 1681 spin_unlock_irq (&hcd_root_hub_lock);
1686 1682
1687#ifdef CONFIG_PM 1683#ifdef CONFIG_PM
1688 flush_workqueue(ksuspend_usb_wq); 1684 cancel_work_sync(&hcd->wakeup_work);
1689#endif 1685#endif
1690 1686
1691 mutex_lock(&usb_bus_list_lock); 1687 mutex_lock(&usb_bus_list_lock);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f6b74a678de5..24f10a19dbdb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1158,6 +1158,30 @@ static void release_address(struct usb_device *udev)
1158 } 1158 }
1159} 1159}
1160 1160
1161#ifdef CONFIG_USB_SUSPEND
1162
1163static void usb_stop_pm(struct usb_device *udev)
1164{
1165 /* Synchronize with the ksuspend thread to prevent any more
1166 * autosuspend requests from being submitted, and decrement
1167 * the parent's count of unsuspended children.
1168 */
1169 usb_pm_lock(udev);
1170 if (udev->parent && !udev->discon_suspended)
1171 usb_autosuspend_device(udev->parent);
1172 usb_pm_unlock(udev);
1173
1174 /* Stop any autosuspend requests already submitted */
1175 cancel_rearming_delayed_work(&udev->autosuspend);
1176}
1177
1178#else
1179
1180static inline void usb_stop_pm(struct usb_device *udev)
1181{ }
1182
1183#endif
1184
1161/** 1185/**
1162 * usb_disconnect - disconnect a device (usbcore-internal) 1186 * usb_disconnect - disconnect a device (usbcore-internal)
1163 * @pdev: pointer to device being disconnected 1187 * @pdev: pointer to device being disconnected
@@ -1224,13 +1248,7 @@ void usb_disconnect(struct usb_device **pdev)
1224 *pdev = NULL; 1248 *pdev = NULL;
1225 spin_unlock_irq(&device_state_lock); 1249 spin_unlock_irq(&device_state_lock);
1226 1250
1227 /* Decrement the parent's count of unsuspended children */ 1251 usb_stop_pm(udev);
1228 if (udev->parent) {
1229 usb_pm_lock(udev);
1230 if (!udev->discon_suspended)
1231 usb_autosuspend_device(udev->parent);
1232 usb_pm_unlock(udev);
1233 }
1234 1252
1235 put_device(&udev->dev); 1253 put_device(&udev->dev);
1236} 1254}
@@ -2201,14 +2219,9 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2201 continue; 2219 continue;
2202 } 2220 }
2203 2221
2204 /* Use a short timeout the first time through, 2222 /* Retry on all errors; some devices are flakey.
2205 * so that recalcitrant full-speed devices with 2223 * 255 is for WUSB devices, we actually need to use
2206 * 8- or 16-byte ep0-maxpackets won't slow things 2224 * 512 (WUSB1.0[4.8.1]).
2207 * down tremendously by NAKing the unexpectedly
2208 * early status stage. Also, retry on all errors;
2209 * some devices are flakey.
2210 * 255 is for WUSB devices, we actually need to use 512.
2211 * WUSB1.0[4.8.1].
2212 */ 2225 */
2213 for (j = 0; j < 3; ++j) { 2226 for (j = 0; j < 3; ++j) {
2214 buf->bMaxPacketSize0 = 0; 2227 buf->bMaxPacketSize0 = 0;
@@ -2216,7 +2229,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2216 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, 2229 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
2217 USB_DT_DEVICE << 8, 0, 2230 USB_DT_DEVICE << 8, 0,
2218 buf, GET_DESCRIPTOR_BUFSIZE, 2231 buf, GET_DESCRIPTOR_BUFSIZE,
2219 (i ? USB_CTRL_GET_TIMEOUT : 1000)); 2232 USB_CTRL_GET_TIMEOUT);
2220 switch (buf->bMaxPacketSize0) { 2233 switch (buf->bMaxPacketSize0) {
2221 case 8: case 16: case 32: case 64: case 255: 2234 case 8: case 16: case 32: case 64: case 255:
2222 if (buf->bDescriptorType == 2235 if (buf->bDescriptorType ==
@@ -2426,10 +2439,10 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2426 2439
2427 if (portchange & USB_PORT_STAT_C_CONNECTION) { 2440 if (portchange & USB_PORT_STAT_C_CONNECTION) {
2428 status = hub_port_debounce(hub, port1); 2441 status = hub_port_debounce(hub, port1);
2429 if (status < 0 && printk_ratelimit()) { 2442 if (status < 0) {
2430 dev_err (hub_dev, 2443 if (printk_ratelimit())
2431 "connect-debounce failed, port %d disabled\n", 2444 dev_err (hub_dev, "connect-debounce failed, "
2432 port1); 2445 "port %d disabled\n", port1);
2433 goto done; 2446 goto done;
2434 } 2447 }
2435 portstatus = status; 2448 portstatus = status;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b7434787db5f..f9fed34bf7d8 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -221,15 +221,10 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
221 221
222 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 222 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
223 USB_ENDPOINT_XFER_INT) { 223 USB_ENDPOINT_XFER_INT) {
224 int interval;
225
226 if (usb_dev->speed == USB_SPEED_HIGH)
227 interval = 1 << min(15, ep->desc.bInterval - 1);
228 else
229 interval = ep->desc.bInterval;
230 pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); 224 pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
231 usb_fill_int_urb(urb, usb_dev, pipe, data, len, 225 usb_fill_int_urb(urb, usb_dev, pipe, data, len,
232 usb_api_blocking_completion, NULL, interval); 226 usb_api_blocking_completion, NULL,
227 ep->desc.bInterval);
233 } else 228 } else
234 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, 229 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
235 usb_api_blocking_completion, NULL); 230 usb_api_blocking_completion, NULL);
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index e7c982377488..be37c863fdfb 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -232,12 +232,15 @@ set_level(struct device *dev, struct device_attribute *attr,
232 int len = count; 232 int len = count;
233 char *cp; 233 char *cp;
234 int rc = 0; 234 int rc = 0;
235 int old_autosuspend_disabled, old_autoresume_disabled;
235 236
236 cp = memchr(buf, '\n', count); 237 cp = memchr(buf, '\n', count);
237 if (cp) 238 if (cp)
238 len = cp - buf; 239 len = cp - buf;
239 240
240 usb_lock_device(udev); 241 usb_lock_device(udev);
242 old_autosuspend_disabled = udev->autosuspend_disabled;
243 old_autoresume_disabled = udev->autoresume_disabled;
241 244
242 /* Setting the flags without calling usb_pm_lock is a subject to 245 /* Setting the flags without calling usb_pm_lock is a subject to
243 * races, but who cares... 246 * races, but who cares...
@@ -263,6 +266,10 @@ set_level(struct device *dev, struct device_attribute *attr,
263 } else 266 } else
264 rc = -EINVAL; 267 rc = -EINVAL;
265 268
269 if (rc) {
270 udev->autosuspend_disabled = old_autosuspend_disabled;
271 udev->autoresume_disabled = old_autoresume_disabled;
272 }
266 usb_unlock_device(udev); 273 usb_unlock_device(udev);
267 return (rc < 0 ? rc : count); 274 return (rc < 0 ? rc : count);
268} 275}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 18ddc5e67e39..4a6299bd0047 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -184,10 +184,6 @@ static void usb_release_dev(struct device *dev)
184 184
185 udev = to_usb_device(dev); 185 udev = to_usb_device(dev);
186 186
187#ifdef CONFIG_USB_SUSPEND
188 cancel_delayed_work(&udev->autosuspend);
189 flush_workqueue(ksuspend_usb_wq);
190#endif
191 usb_destroy_configuration(udev); 187 usb_destroy_configuration(udev);
192 usb_put_hcd(bus_to_hcd(udev->bus)); 188 usb_put_hcd(bus_to_hcd(udev->bus));
193 kfree(udev->product); 189 kfree(udev->product);
@@ -205,7 +201,11 @@ struct device_type usb_device_type = {
205 201
206static int ksuspend_usb_init(void) 202static int ksuspend_usb_init(void)
207{ 203{
208 ksuspend_usb_wq = create_singlethread_workqueue("ksuspend_usbd"); 204 /* This workqueue is supposed to be both freezable and
205 * singlethreaded. Its job doesn't justify running on more
206 * than one CPU.
207 */
208 ksuspend_usb_wq = create_freezeable_workqueue("ksuspend_usbd");
209 if (!ksuspend_usb_wq) 209 if (!ksuspend_usb_wq)
210 return -ENOMEM; 210 return -ENOMEM;
211 return 0; 211 return 0;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 157054ea3978..3ca2b3159f00 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -228,13 +228,15 @@ static int dr_controller_setup(struct fsl_udc *udc)
228 228
229 /* Config PHY interface */ 229 /* Config PHY interface */
230 portctrl = fsl_readl(&dr_regs->portsc1); 230 portctrl = fsl_readl(&dr_regs->portsc1);
231 portctrl &= ~PORTSCX_PHY_TYPE_SEL; 231 portctrl &= ~(PORTSCX_PHY_TYPE_SEL & PORTSCX_PORT_WIDTH);
232 switch (udc->phy_mode) { 232 switch (udc->phy_mode) {
233 case FSL_USB2_PHY_ULPI: 233 case FSL_USB2_PHY_ULPI:
234 portctrl |= PORTSCX_PTS_ULPI; 234 portctrl |= PORTSCX_PTS_ULPI;
235 break; 235 break;
236 case FSL_USB2_PHY_UTMI:
237 case FSL_USB2_PHY_UTMI_WIDE: 236 case FSL_USB2_PHY_UTMI_WIDE:
237 portctrl |= PORTSCX_PTW_16BIT;
238 /* fall through */
239 case FSL_USB2_PHY_UTMI:
238 portctrl |= PORTSCX_PTS_UTMI; 240 portctrl |= PORTSCX_PTS_UTMI;
239 break; 241 break;
240 case FSL_USB2_PHY_SERIAL: 242 case FSL_USB2_PHY_SERIAL:
@@ -625,7 +627,7 @@ static void fsl_free_buffer(struct usb_ep *_ep, void *buf,
625 struct fsl_ep *ep; 627 struct fsl_ep *ep;
626 628
627 if (!_ep) 629 if (!_ep)
628 return NULL; 630 return;
629 631
630 ep = container_of(_ep, struct fsl_ep, ep); 632 ep = container_of(_ep, struct fsl_ep, ep);
631 633
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index a52480505f78..c7a7c590426f 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -193,6 +193,19 @@ static void mpc83xx_usb_setup(struct usb_hcd *hcd)
193 out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004); 193 out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004);
194 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b); 194 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b);
195 195
196#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
197 /*
198 * Turn on cache snooping hardware, since some PowerPC platforms
199 * wholly rely on hardware to deal with cache coherent
200 */
201
202 /* Setup Snooping for all the 4GB space */
203 /* SNOOP1 starts from 0x0, size 2G */
204 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB);
205 /* SNOOP2 starts from 0x80000000, size 2G */
206 out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x80000000 | SNOOP_SIZE_2GB);
207#endif
208
196 if (pdata->operating_mode == FSL_USB2_DR_HOST) 209 if (pdata->operating_mode == FSL_USB2_DR_HOST)
197 mpc83xx_setup_phy(ehci, pdata->phy_mode, 0); 210 mpc83xx_setup_phy(ehci, pdata->phy_mode, 0);
198 211
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h
index f28736a917e4..b5e59db53347 100644
--- a/drivers/usb/host/ehci-fsl.h
+++ b/drivers/usb/host/ehci-fsl.h
@@ -34,4 +34,5 @@
34#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ 34#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */
35#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ 35#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */
36#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ 36#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
37#define SNOOP_SIZE_2GB 0x1e
37#endif /* _EHCI_FSL_H */ 38#endif /* _EHCI_FSL_H */
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 79705609fd0c..ca62cb583221 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -137,7 +137,7 @@ static const struct pci_device_id ohci_pci_quirks[] = {
137 /* Toshiba portege 4000 */ 137 /* Toshiba portege 4000 */
138 .vendor = PCI_VENDOR_ID_AL, 138 .vendor = PCI_VENDOR_ID_AL,
139 .device = 0x5237, 139 .device = 0x5237,
140 .subvendor = PCI_VENDOR_ID_TOSHIBA_2, 140 .subvendor = PCI_VENDOR_ID_TOSHIBA,
141 .subdevice = 0x0004, 141 .subdevice = 0x0004,
142 .driver_data = (unsigned long) broken_suspend, 142 .driver_data = (unsigned long) broken_suspend,
143 }, 143 },
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 20861650905e..c225159ca3d3 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -44,6 +44,7 @@
44#define EHCI_USBSTS 4 /* status register */ 44#define EHCI_USBSTS 4 /* status register */
45#define EHCI_USBSTS_HALTED (1 << 12) /* HCHalted bit */ 45#define EHCI_USBSTS_HALTED (1 << 12) /* HCHalted bit */
46#define EHCI_USBINTR 8 /* interrupt register */ 46#define EHCI_USBINTR 8 /* interrupt register */
47#define EHCI_CONFIGFLAG 0x40 /* configured flag register */
47#define EHCI_USBLEGSUP 0 /* legacy support register */ 48#define EHCI_USBLEGSUP 0 /* legacy support register */
48#define EHCI_USBLEGSUP_BIOS (1 << 16) /* BIOS semaphore */ 49#define EHCI_USBLEGSUP_BIOS (1 << 16) /* BIOS semaphore */
49#define EHCI_USBLEGSUP_OS (1 << 24) /* OS semaphore */ 50#define EHCI_USBLEGSUP_OS (1 << 24) /* OS semaphore */
@@ -216,6 +217,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
216 u32 hcc_params, val; 217 u32 hcc_params, val;
217 u8 offset, cap_length; 218 u8 offset, cap_length;
218 int count = 256/4; 219 int count = 256/4;
220 int tried_handoff = 0;
219 221
220 if (!mmio_resource_enabled(pdev, 0)) 222 if (!mmio_resource_enabled(pdev, 0))
221 return; 223 return;
@@ -273,6 +275,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
273 */ 275 */
274 msec = 5000; 276 msec = 5000;
275 while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) { 277 while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) {
278 tried_handoff = 1;
276 msleep(10); 279 msleep(10);
277 msec -= 10; 280 msec -= 10;
278 pci_read_config_dword(pdev, offset, &cap); 281 pci_read_config_dword(pdev, offset, &cap);
@@ -292,6 +295,12 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
292 pci_write_config_dword(pdev, 295 pci_write_config_dword(pdev,
293 offset + EHCI_USBLEGCTLSTS, 296 offset + EHCI_USBLEGCTLSTS,
294 0); 297 0);
298
299 /* If the BIOS ever owned the controller then we
300 * can't expect any power sessions to remain intact.
301 */
302 if (tried_handoff)
303 writel(0, op_reg_base + EHCI_CONFIGFLAG);
295 break; 304 break;
296 case 0: /* illegal reserved capability */ 305 case 0: /* illegal reserved capability */
297 cap = 0; 306 cap = 0;
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index ff0dba01f1c7..e98df2ee9901 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -57,6 +57,13 @@
57#include <asm/system.h> 57#include <asm/system.h>
58#include <asm/byteorder.h> 58#include <asm/byteorder.h>
59#include "../core/hcd.h" 59#include "../core/hcd.h"
60
61 /* FIXME ohci.h is ONLY for internal use by the OHCI driver.
62 * If you're going to try stuff like this, you need to split
63 * out shareable stuff (register declarations?) into its own
64 * file, maybe name <linux/usb/ohci.h>
65 */
66
60#include "ohci.h" 67#include "ohci.h"
61#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR 68#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
62#define OHCI_INTR_INIT (OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | \ 69#define OHCI_INTR_INIT (OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | \
@@ -173,11 +180,6 @@ struct u132_ring {
173 struct u132_endp *curr_endp; 180 struct u132_endp *curr_endp;
174 struct delayed_work scheduler; 181 struct delayed_work scheduler;
175}; 182};
176#define OHCI_QUIRK_AMD756 0x01
177#define OHCI_QUIRK_SUPERIO 0x02
178#define OHCI_QUIRK_INITRESET 0x04
179#define OHCI_BIG_ENDIAN 0x08
180#define OHCI_QUIRK_ZFMICRO 0x10
181struct u132 { 183struct u132 {
182 struct kref kref; 184 struct kref kref;
183 struct list_head u132_list; 185 struct list_head u132_list;
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 88fb56d5db8f..cac1500cba62 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -1822,16 +1822,10 @@ static int auerchar_release (struct inode *inode, struct file *file)
1822 pauerswald_t cp; 1822 pauerswald_t cp;
1823 dbg("release"); 1823 dbg("release");
1824 1824
1825 /* get the mutexes */ 1825 down(&ccp->mutex);
1826 if (down_interruptible (&ccp->mutex)) {
1827 return -ERESTARTSYS;
1828 }
1829 cp = ccp->auerdev; 1826 cp = ccp->auerdev;
1830 if (cp) { 1827 if (cp) {
1831 if (down_interruptible (&cp->mutex)) { 1828 down(&cp->mutex);
1832 up (&ccp->mutex);
1833 return -ERESTARTSYS;
1834 }
1835 /* remove an open service */ 1829 /* remove an open service */
1836 auerswald_removeservice (cp, &ccp->scontext); 1830 auerswald_removeservice (cp, &ccp->scontext);
1837 /* detach from device */ 1831 /* detach from device */
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index e2172e5cf152..e0f122e131d7 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -73,6 +73,13 @@ static struct list_head ftdi_static_list;
73#include "usb_u132.h" 73#include "usb_u132.h"
74#include <asm/io.h> 74#include <asm/io.h>
75#include "../core/hcd.h" 75#include "../core/hcd.h"
76
77 /* FIXME ohci.h is ONLY for internal use by the OHCI driver.
78 * If you're going to try stuff like this, you need to split
79 * out shareable stuff (register declarations?) into its own
80 * file, maybe name <linux/usb/ohci.h>
81 */
82
76#include "../host/ohci.h" 83#include "../host/ohci.h"
77/* Define these values to match your devices*/ 84/* Define these values to match your devices*/
78#define USB_FTDI_ELAN_VENDOR_ID 0x0403 85#define USB_FTDI_ELAN_VENDOR_ID 0x0403
@@ -2300,10 +2307,7 @@ static int ftdi_elan_checkingPCI(struct usb_ftdi *ftdi)
2300 offsetof(struct ohci_regs, member), 0, data); 2307 offsetof(struct ohci_regs, member), 0, data);
2301#define ftdi_write_pcimem(ftdi, member, data) ftdi_elan_write_pcimem(ftdi, \ 2308#define ftdi_write_pcimem(ftdi, member, data) ftdi_elan_write_pcimem(ftdi, \
2302 offsetof(struct ohci_regs, member), 0, data); 2309 offsetof(struct ohci_regs, member), 0, data);
2303#define OHCI_QUIRK_AMD756 0x01 2310
2304#define OHCI_QUIRK_SUPERIO 0x02
2305#define OHCI_QUIRK_INITRESET 0x04
2306#define OHCI_BIG_ENDIAN 0x08
2307#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR 2311#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
2308#define OHCI_INTR_INIT (OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | \ 2312#define OHCI_INTR_INIT (OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | \
2309 OHCI_INTR_WDH) 2313 OHCI_INTR_WDH)
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 11555bde655b..7bad49404762 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -165,6 +165,8 @@ struct ld_usb {
165 size_t interrupt_in_endpoint_size; 165 size_t interrupt_in_endpoint_size;
166 int interrupt_in_running; 166 int interrupt_in_running;
167 int interrupt_in_done; 167 int interrupt_in_done;
168 int buffer_overflow;
169 spinlock_t rbsl;
168 170
169 char* interrupt_out_buffer; 171 char* interrupt_out_buffer;
170 struct usb_endpoint_descriptor* interrupt_out_endpoint; 172 struct usb_endpoint_descriptor* interrupt_out_endpoint;
@@ -230,10 +232,12 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
230 } else { 232 } else {
231 dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", 233 dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n",
232 __FUNCTION__, urb->status); 234 __FUNCTION__, urb->status);
235 spin_lock(&dev->rbsl);
233 goto resubmit; /* maybe we can recover */ 236 goto resubmit; /* maybe we can recover */
234 } 237 }
235 } 238 }
236 239
240 spin_lock(&dev->rbsl);
237 if (urb->actual_length > 0) { 241 if (urb->actual_length > 0) {
238 next_ring_head = (dev->ring_head+1) % ring_buffer_size; 242 next_ring_head = (dev->ring_head+1) % ring_buffer_size;
239 if (next_ring_head != dev->ring_tail) { 243 if (next_ring_head != dev->ring_tail) {
@@ -244,21 +248,25 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
244 dev->ring_head = next_ring_head; 248 dev->ring_head = next_ring_head;
245 dbg_info(&dev->intf->dev, "%s: received %d bytes\n", 249 dbg_info(&dev->intf->dev, "%s: received %d bytes\n",
246 __FUNCTION__, urb->actual_length); 250 __FUNCTION__, urb->actual_length);
247 } else 251 } else {
248 dev_warn(&dev->intf->dev, 252 dev_warn(&dev->intf->dev,
249 "Ring buffer overflow, %d bytes dropped\n", 253 "Ring buffer overflow, %d bytes dropped\n",
250 urb->actual_length); 254 urb->actual_length);
255 dev->buffer_overflow = 1;
256 }
251 } 257 }
252 258
253resubmit: 259resubmit:
254 /* resubmit if we're still running */ 260 /* resubmit if we're still running */
255 if (dev->interrupt_in_running && dev->intf) { 261 if (dev->interrupt_in_running && !dev->buffer_overflow && dev->intf) {
256 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); 262 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC);
257 if (retval) 263 if (retval) {
258 dev_err(&dev->intf->dev, 264 dev_err(&dev->intf->dev,
259 "usb_submit_urb failed (%d)\n", retval); 265 "usb_submit_urb failed (%d)\n", retval);
266 dev->buffer_overflow = 1;
267 }
260 } 268 }
261 269 spin_unlock(&dev->rbsl);
262exit: 270exit:
263 dev->interrupt_in_done = 1; 271 dev->interrupt_in_done = 1;
264 wake_up_interruptible(&dev->read_wait); 272 wake_up_interruptible(&dev->read_wait);
@@ -330,6 +338,7 @@ static int ld_usb_open(struct inode *inode, struct file *file)
330 /* initialize in direction */ 338 /* initialize in direction */
331 dev->ring_head = 0; 339 dev->ring_head = 0;
332 dev->ring_tail = 0; 340 dev->ring_tail = 0;
341 dev->buffer_overflow = 0;
333 usb_fill_int_urb(dev->interrupt_in_urb, 342 usb_fill_int_urb(dev->interrupt_in_urb,
334 interface_to_usbdev(interface), 343 interface_to_usbdev(interface),
335 usb_rcvintpipe(interface_to_usbdev(interface), 344 usb_rcvintpipe(interface_to_usbdev(interface),
@@ -439,6 +448,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
439 size_t *actual_buffer; 448 size_t *actual_buffer;
440 size_t bytes_to_read; 449 size_t bytes_to_read;
441 int retval = 0; 450 int retval = 0;
451 int rv;
442 452
443 dev = file->private_data; 453 dev = file->private_data;
444 454
@@ -460,7 +470,10 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
460 } 470 }
461 471
462 /* wait for data */ 472 /* wait for data */
473 spin_lock_irq(&dev->rbsl);
463 if (dev->ring_head == dev->ring_tail) { 474 if (dev->ring_head == dev->ring_tail) {
475 dev->interrupt_in_done = 0;
476 spin_unlock_irq(&dev->rbsl);
464 if (file->f_flags & O_NONBLOCK) { 477 if (file->f_flags & O_NONBLOCK) {
465 retval = -EAGAIN; 478 retval = -EAGAIN;
466 goto unlock_exit; 479 goto unlock_exit;
@@ -468,6 +481,8 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
468 retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done); 481 retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done);
469 if (retval < 0) 482 if (retval < 0)
470 goto unlock_exit; 483 goto unlock_exit;
484 } else {
485 spin_unlock_irq(&dev->rbsl);
471 } 486 }
472 487
473 /* actual_buffer contains actual_length + interrupt_in_buffer */ 488 /* actual_buffer contains actual_length + interrupt_in_buffer */
@@ -486,6 +501,17 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
486 501
487 retval = bytes_to_read; 502 retval = bytes_to_read;
488 503
504 spin_lock_irq(&dev->rbsl);
505 if (dev->buffer_overflow) {
506 dev->buffer_overflow = 0;
507 spin_unlock_irq(&dev->rbsl);
508 rv = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
509 if (rv < 0)
510 dev->buffer_overflow = 1;
511 } else {
512 spin_unlock_irq(&dev->rbsl);
513 }
514
489unlock_exit: 515unlock_exit:
490 /* unlock the device */ 516 /* unlock the device */
491 up(&dev->sem); 517 up(&dev->sem);
@@ -635,6 +661,7 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
635 goto exit; 661 goto exit;
636 } 662 }
637 init_MUTEX(&dev->sem); 663 init_MUTEX(&dev->sem);
664 spin_lock_init(&dev->rbsl);
638 dev->intf = intf; 665 dev->intf = intf;
639 init_waitqueue_head(&dev->read_wait); 666 init_waitqueue_head(&dev->read_wait);
640 init_waitqueue_head(&dev->write_wait); 667 init_waitqueue_head(&dev->write_wait);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index ea2175bb2274..fe437125f14b 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -63,7 +63,8 @@ static inline void ARK3116_RCV(struct usb_serial *serial, int seq,
63 request, requesttype, value, index, 63 request, requesttype, value, index,
64 buf, 0x0000001, 1000); 64 buf, 0x0000001, 1000);
65 if (result) 65 if (result)
66 dbg("%03d < %d bytes [0x%02X]", seq, result, buf[0]); 66 dbg("%03d < %d bytes [0x%02X]", seq, result,
67 ((unsigned char *)buf)[0]);
67 else 68 else
68 dbg("%03d < 0 bytes", seq); 69 dbg("%03d < 0 bytes", seq);
69} 70}
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 95a1805b064f..2353679f601e 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -273,12 +273,18 @@ static __u16 product;
273 273
274/* struct ftdi_sio_quirk is used by devices requiring special attention. */ 274/* struct ftdi_sio_quirk is used by devices requiring special attention. */
275struct ftdi_sio_quirk { 275struct ftdi_sio_quirk {
276 int (*probe)(struct usb_serial *);
276 void (*setup)(struct usb_serial *); /* Special settings during startup. */ 277 void (*setup)(struct usb_serial *); /* Special settings during startup. */
277}; 278};
278 279
280static int ftdi_olimex_probe (struct usb_serial *serial);
279static void ftdi_USB_UIRT_setup (struct usb_serial *serial); 281static void ftdi_USB_UIRT_setup (struct usb_serial *serial);
280static void ftdi_HE_TIRA1_setup (struct usb_serial *serial); 282static void ftdi_HE_TIRA1_setup (struct usb_serial *serial);
281 283
284static struct ftdi_sio_quirk ftdi_olimex_quirk = {
285 .probe = ftdi_olimex_probe,
286};
287
282static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { 288static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
283 .setup = ftdi_USB_UIRT_setup, 289 .setup = ftdi_USB_UIRT_setup,
284}; 290};
@@ -319,6 +325,7 @@ static struct usb_device_id id_table_combined [] = {
319 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, 325 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
320 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, 326 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
321 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 327 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
328 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
322 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 329 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
323 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 330 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
324 { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) }, 331 { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
@@ -525,6 +532,9 @@ static struct usb_device_id id_table_combined [] = {
525 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, 532 { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) },
526 { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, 533 { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
527 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 534 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
535 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
536 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
537 .driver_info = (kernel_ulong_t)&ftdi_olimex_quirk },
528 { }, /* Optional parameter entry */ 538 { }, /* Optional parameter entry */
529 { } /* Terminating entry */ 539 { } /* Terminating entry */
530}; 540};
@@ -669,7 +679,7 @@ static struct usb_serial_driver ftdi_sio_device = {
669 679
670/* 680/*
671 * *************************************************************************** 681 * ***************************************************************************
672 * Utlity functions 682 * Utility functions
673 * *************************************************************************** 683 * ***************************************************************************
674 */ 684 */
675 685
@@ -1171,9 +1181,17 @@ static void remove_sysfs_attrs(struct usb_serial_port *port)
1171/* Probe function to check for special devices */ 1181/* Probe function to check for special devices */
1172static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id) 1182static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id)
1173{ 1183{
1184 struct ftdi_sio_quirk *quirk = (struct ftdi_sio_quirk *)id->driver_info;
1185
1186 if (quirk && quirk->probe) {
1187 int ret = quirk->probe(serial);
1188 if (ret != 0)
1189 return ret;
1190 }
1191
1174 usb_set_serial_data(serial, (void *)id->driver_info); 1192 usb_set_serial_data(serial, (void *)id->driver_info);
1175 1193
1176 return (0); 1194 return 0;
1177} 1195}
1178 1196
1179static int ftdi_sio_port_probe(struct usb_serial_port *port) 1197static int ftdi_sio_port_probe(struct usb_serial_port *port)
@@ -1268,6 +1286,24 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
1268 priv->force_rtscts = 1; 1286 priv->force_rtscts = 1;
1269} /* ftdi_HE_TIRA1_setup */ 1287} /* ftdi_HE_TIRA1_setup */
1270 1288
1289/*
1290 * First port on Olimex arm-usb-ocd is reserved for JTAG interface
1291 * and can be accessed from userspace using openocd.
1292 */
1293static int ftdi_olimex_probe(struct usb_serial *serial)
1294{
1295 struct usb_device *udev = serial->dev;
1296 struct usb_interface *interface = serial->interface;
1297
1298 dbg("%s",__FUNCTION__);
1299
1300 if (interface == udev->actconfig->interface[0]) {
1301 info("Ignoring reserved serial port on Olimex arm-usb-ocd\n");
1302 return -ENODEV;
1303 }
1304
1305 return 0;
1306}
1271 1307
1272/* ftdi_shutdown is called from usbserial:usb_serial_disconnect 1308/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
1273 * it is called when the usb device is disconnected 1309 * it is called when the usb device is disconnected
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 77ad0a09b384..33aee9047242 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -60,6 +60,9 @@
60/* DMX4ALL DMX Interfaces */ 60/* DMX4ALL DMX Interfaces */
61#define FTDI_DMX4ALL 0xC850 61#define FTDI_DMX4ALL 0xC850
62 62
63/* OpenDCC (www.opendcc.de) product id */
64#define FTDI_OPENDCC_PID 0xBFD8
65
63/* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ 66/* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */
64/* they use the ftdi chipset for the USB interface and the vendor id is the same */ 67/* they use the ftdi chipset for the USB interface and the vendor id is the same */
65#define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ 68#define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */
@@ -518,6 +521,15 @@
518#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */ 521#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */
519#define FTDI_IBS_PROD_PID 0xff3f /* future device */ 522#define FTDI_IBS_PROD_PID 0xff3f /* future device */
520 523
524/*
525 * MaxStream devices www.maxstream.net
526 */
527#define FTDI_MAXSTREAM_PID 0xEE18 /* Xbee PKG-U Module */
528
529/* Olimex */
530#define OLIMEX_VID 0x15BA
531#define OLIMEX_ARM_USB_OCD_PID 0x0003
532
521/* Commands */ 533/* Commands */
522#define FTDI_SIO_RESET 0 /* Reset the port */ 534#define FTDI_SIO_RESET 0 /* Reset the port */
523#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 535#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 2366e7b63ece..36620c651079 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -769,11 +769,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
769 return; 769 return;
770 } 770 }
771 771
772 if (!mos7840_port) {
773 dbg("%s", "NULL mos7840_port pointer \n");
774 return;
775 }
776
777 if (mos7840_port_paranoia_check(mos7840_port->port, __FUNCTION__)) { 772 if (mos7840_port_paranoia_check(mos7840_port->port, __FUNCTION__)) {
778 dbg("%s", "Port Paranoia failed \n"); 773 dbg("%s", "Port Paranoia failed \n");
779 return; 774 return;
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 4adfab988e86..00afc1712c39 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -165,12 +165,10 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
165{ 165{
166 struct usb_serial *serial = port->serial; 166 struct usb_serial *serial = port->serial;
167 struct usb_serial_port *wport; 167 struct usb_serial_port *wport;
168 struct omninet_data *od = usb_get_serial_port_data(port);
169 int result = 0; 168 int result = 0;
170 169
171 dbg("%s - port %d", __FUNCTION__, port->number); 170 dbg("%s - port %d", __FUNCTION__, port->number);
172 171
173 od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL );
174 wport = serial->port[1]; 172 wport = serial->port[1];
175 wport->tty = port->tty; 173 wport->tty = port->tty;
176 174
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 8c3f55b080b4..89f067d95076 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -165,7 +165,6 @@ static struct usb_device_id option_ids[] = {
165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */ 165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */
166 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */ 166 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */
167 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ 167 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
168 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel XU870 */
169 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */ 168 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */
170 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ 169 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */
171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 170 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 644607de4c11..ac1829c6e8f0 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -35,6 +35,7 @@ static struct usb_device_id id_table [] = {
35 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 35 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
36 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 36 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
37 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 37 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
38 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
38 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 39 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
39 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 40 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
40 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ 41 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
@@ -60,6 +61,7 @@ static struct usb_device_id id_table_3port [] = {
60 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 61 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
61 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 62 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
62 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 63 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
64 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
63 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 65 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
64 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 66 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
65 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ 67 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index 6d3dad3d1dae..d35369392fed 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -84,7 +84,7 @@ resubmit:
84 84
85static int usb_onetouch_open(struct input_dev *dev) 85static int usb_onetouch_open(struct input_dev *dev)
86{ 86{
87 struct usb_onetouch *onetouch = dev->private; 87 struct usb_onetouch *onetouch = input_get_drvdata(dev);
88 88
89 onetouch->is_open = 1; 89 onetouch->is_open = 1;
90 onetouch->irq->dev = onetouch->udev; 90 onetouch->irq->dev = onetouch->udev;
@@ -98,7 +98,7 @@ static int usb_onetouch_open(struct input_dev *dev)
98 98
99static void usb_onetouch_close(struct input_dev *dev) 99static void usb_onetouch_close(struct input_dev *dev)
100{ 100{
101 struct usb_onetouch *onetouch = dev->private; 101 struct usb_onetouch *onetouch = input_get_drvdata(dev);
102 102
103 usb_kill_urb(onetouch->irq); 103 usb_kill_urb(onetouch->irq);
104 onetouch->is_open = 0; 104 onetouch->is_open = 0;
@@ -185,13 +185,14 @@ int onetouch_connect_input(struct us_data *ss)
185 input_dev->name = onetouch->name; 185 input_dev->name = onetouch->name;
186 input_dev->phys = onetouch->phys; 186 input_dev->phys = onetouch->phys;
187 usb_to_input_id(udev, &input_dev->id); 187 usb_to_input_id(udev, &input_dev->id);
188 input_dev->cdev.dev = &udev->dev; 188 input_dev->dev.parent = &udev->dev;
189 189
190 set_bit(EV_KEY, input_dev->evbit); 190 set_bit(EV_KEY, input_dev->evbit);
191 set_bit(ONETOUCH_BUTTON, input_dev->keybit); 191 set_bit(ONETOUCH_BUTTON, input_dev->keybit);
192 clear_bit(0, input_dev->keybit); 192 clear_bit(0, input_dev->keybit);
193 193
194 input_dev->private = onetouch; 194 input_set_drvdata(input_dev, onetouch);
195
195 input_dev->open = usb_onetouch_open; 196 input_dev->open = usb_onetouch_open;
196 input_dev->close = usb_onetouch_close; 197 input_dev->close = usb_onetouch_close;
197 198
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 8b3145ab7757..d230ee72f9cd 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1179,14 +1179,20 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1179 US_SC_DEVICE, US_PR_DEVICE, NULL, 1179 US_SC_DEVICE, US_PR_DEVICE, NULL,
1180 US_FL_FIX_INQUIRY ), 1180 US_FL_FIX_INQUIRY ),
1181 1181
1182/* This is a virtual windows driver CD, which the zd1211rw driver automatically 1182/* These are virtual windows driver CDs, which the zd1211rw driver automatically
1183 * converts into a WLAN device. */ 1183 * converts into a WLAN devices. */
1184UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, 1184UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
1185 "ZyXEL", 1185 "ZyXEL",
1186 "G-220F USB-WLAN Install", 1186 "G-220F USB-WLAN Install",
1187 US_SC_DEVICE, US_PR_DEVICE, NULL, 1187 US_SC_DEVICE, US_PR_DEVICE, NULL,
1188 US_FL_IGNORE_DEVICE ), 1188 US_FL_IGNORE_DEVICE ),
1189 1189
1190UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
1191 "SiteCom",
1192 "WL-117 USB-WLAN Install",
1193 US_SC_DEVICE, US_PR_DEVICE, NULL,
1194 US_FL_IGNORE_DEVICE ),
1195
1190#ifdef CONFIG_USB_STORAGE_ISD200 1196#ifdef CONFIG_USB_STORAGE_ISD200
1191UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1197UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1192 "ATI", 1198 "ATI",
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4d7485fa553f..6e1f1ea21b38 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -704,6 +704,91 @@ config FB_CG6
704 This is the frame buffer device driver for the CGsix (GX, TurboGX) 704 This is the frame buffer device driver for the CGsix (GX, TurboGX)
705 frame buffer. 705 frame buffer.
706 706
707config FB_FFB
708 bool "Creator/Creator3D/Elite3D support"
709 depends on FB_SBUS && SPARC64
710 select FB_CFB_COPYAREA
711 select FB_CFB_IMAGEBLIT
712 help
713 This is the frame buffer device driver for the Creator, Creator3D,
714 and Elite3D graphics boards.
715
716config FB_TCX
717 bool "TCX (SS4/SS5 only) support"
718 depends on FB_SBUS
719 select FB_CFB_FILLRECT
720 select FB_CFB_COPYAREA
721 select FB_CFB_IMAGEBLIT
722 help
723 This is the frame buffer device driver for the TCX 24/8bit frame
724 buffer.
725
726config FB_CG14
727 bool "CGfourteen (SX) support"
728 depends on FB_SBUS
729 select FB_CFB_FILLRECT
730 select FB_CFB_COPYAREA
731 select FB_CFB_IMAGEBLIT
732 help
733 This is the frame buffer device driver for the CGfourteen frame
734 buffer on Desktop SPARCsystems with the SX graphics option.
735
736config FB_P9100
737 bool "P9100 (Sparcbook 3 only) support"
738 depends on FB_SBUS
739 select FB_CFB_FILLRECT
740 select FB_CFB_COPYAREA
741 select FB_CFB_IMAGEBLIT
742 help
743 This is the frame buffer device driver for the P9100 card
744 supported on Sparcbook 3 machines.
745
746config FB_LEO
747 bool "Leo (ZX) support"
748 depends on FB_SBUS
749 select FB_CFB_FILLRECT
750 select FB_CFB_COPYAREA
751 select FB_CFB_IMAGEBLIT
752 help
753 This is the frame buffer device driver for the SBUS-based Sun ZX
754 (leo) frame buffer cards.
755
756config FB_IGA
757 bool "IGA 168x display support"
758 depends on FB && SPARC32
759 select FB_CFB_FILLRECT
760 select FB_CFB_COPYAREA
761 select FB_CFB_IMAGEBLIT
762 help
763 This is the framebuffer device for the INTERGRAPHICS 1680 and
764 successor frame buffer cards.
765
766config FB_XVR500
767 bool "Sun XVR-500 3DLABS Wildcat support"
768 depends on FB && PCI && SPARC64
769 select FB_CFB_FILLRECT
770 select FB_CFB_COPYAREA
771 select FB_CFB_IMAGEBLIT
772 help
773 This is the framebuffer device for the Sun XVR-500 and similar
774 graphics cards based upon the 3DLABS Wildcat chipset. The driver
775 only works on sparc64 systems where the system firwmare has
776 mostly initialized the card already. It is treated as a
777 completely dumb framebuffer device.
778
779config FB_XVR2500
780 bool "Sun XVR-2500 3DLABS Wildcat support"
781 depends on FB && PCI && SPARC64
782 select FB_CFB_FILLRECT
783 select FB_CFB_COPYAREA
784 select FB_CFB_IMAGEBLIT
785 help
786 This is the framebuffer device for the Sun XVR-2500 and similar
787 graphics cards based upon the 3DLABS Wildcat chipset. The driver
788 only works on sparc64 systems where the system firwmare has
789 mostly initialized the card already. It is treated as a
790 completely dumb framebuffer device.
791
707config FB_PVR2 792config FB_PVR2
708 tristate "NEC PowerVR 2 display support" 793 tristate "NEC PowerVR 2 display support"
709 depends on FB && SH_DREAMCAST 794 depends on FB && SH_DREAMCAST
@@ -1195,7 +1280,7 @@ config FB_ATY
1195config FB_ATY_CT 1280config FB_ATY_CT
1196 bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" 1281 bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
1197 depends on PCI && FB_ATY 1282 depends on PCI && FB_ATY
1198 default y if SPARC64 && FB_PCI 1283 default y if SPARC64 && PCI
1199 help 1284 help
1200 Say Y here to support use of ATI's 64-bit Rage boards (or other 1285 Say Y here to support use of ATI's 64-bit Rage boards (or other
1201 boards based on the Mach64 CT, VT, GT, and LT chipsets) as a 1286 boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
@@ -1484,95 +1569,6 @@ config FB_AU1200
1484 1569
1485source "drivers/video/geode/Kconfig" 1570source "drivers/video/geode/Kconfig"
1486 1571
1487config FB_FFB
1488 bool "Creator/Creator3D/Elite3D support"
1489 depends on FB_SBUS && SPARC64
1490 select FB_CFB_COPYAREA
1491 select FB_CFB_IMAGEBLIT
1492 help
1493 This is the frame buffer device driver for the Creator, Creator3D,
1494 and Elite3D graphics boards.
1495
1496config FB_TCX
1497 bool "TCX (SS4/SS5 only) support"
1498 depends on FB_SBUS
1499 select FB_CFB_FILLRECT
1500 select FB_CFB_COPYAREA
1501 select FB_CFB_IMAGEBLIT
1502 help
1503 This is the frame buffer device driver for the TCX 24/8bit frame
1504 buffer.
1505
1506config FB_CG14
1507 bool "CGfourteen (SX) support"
1508 depends on FB_SBUS
1509 select FB_CFB_FILLRECT
1510 select FB_CFB_COPYAREA
1511 select FB_CFB_IMAGEBLIT
1512 help
1513 This is the frame buffer device driver for the CGfourteen frame
1514 buffer on Desktop SPARCsystems with the SX graphics option.
1515
1516config FB_P9100
1517 bool "P9100 (Sparcbook 3 only) support"
1518 depends on FB_SBUS
1519 select FB_CFB_FILLRECT
1520 select FB_CFB_COPYAREA
1521 select FB_CFB_IMAGEBLIT
1522 help
1523 This is the frame buffer device driver for the P9100 card
1524 supported on Sparcbook 3 machines.
1525
1526config FB_LEO
1527 bool "Leo (ZX) support"
1528 depends on FB_SBUS
1529 select FB_CFB_FILLRECT
1530 select FB_CFB_COPYAREA
1531 select FB_CFB_IMAGEBLIT
1532 help
1533 This is the frame buffer device driver for the SBUS-based Sun ZX
1534 (leo) frame buffer cards.
1535
1536config FB_XVR500
1537 bool "Sun XVR-500 3DLABS Wildcat support"
1538 depends on (FB = y) && PCI && SPARC64
1539 select FB_CFB_FILLRECT
1540 select FB_CFB_COPYAREA
1541 select FB_CFB_IMAGEBLIT
1542 help
1543 This is the framebuffer device for the Sun XVR-500 and similar
1544 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1545 only works on sparc64 systems where the system firwmare has
1546 mostly initialized the card already. It is treated as a
1547 completely dumb framebuffer device.
1548
1549config FB_XVR2500
1550 bool "Sun XVR-2500 3DLABS Wildcat support"
1551 depends on (FB = y) && PCI && SPARC64
1552 select FB_CFB_FILLRECT
1553 select FB_CFB_COPYAREA
1554 select FB_CFB_IMAGEBLIT
1555 help
1556 This is the framebuffer device for the Sun XVR-2500 and similar
1557 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1558 only works on sparc64 systems where the system firwmare has
1559 mostly initialized the card already. It is treated as a
1560 completely dumb framebuffer device.
1561
1562config FB_PCI
1563 bool "PCI framebuffers"
1564 depends on (FB = y) && PCI && SPARC
1565
1566config FB_IGA
1567 bool "IGA 168x display support"
1568 depends on SPARC32 && FB_PCI
1569 select FB_CFB_FILLRECT
1570 select FB_CFB_COPYAREA
1571 select FB_CFB_IMAGEBLIT
1572 help
1573 This is the framebuffer device for the INTERGRAPHICS 1680 and
1574 successor frame buffer cards.
1575
1576config FB_HIT 1572config FB_HIT
1577 tristate "HD64461 Frame Buffer support" 1573 tristate "HD64461 Frame Buffer support"
1578 depends on FB && HD64461 1574 depends on FB && HD64461
@@ -1796,9 +1792,10 @@ config FB_IBM_GXT4500
1796config FB_PS3 1792config FB_PS3
1797 bool "PS3 GPU framebuffer driver" 1793 bool "PS3 GPU framebuffer driver"
1798 depends on (FB = y) && PS3_PS3AV 1794 depends on (FB = y) && PS3_PS3AV
1799 select FB_CFB_FILLRECT 1795 select FB_SYS_FILLRECT
1800 select FB_CFB_COPYAREA 1796 select FB_SYS_COPYAREA
1801 select FB_CFB_IMAGEBLIT 1797 select FB_SYS_IMAGEBLIT
1798 select FB_SYS_FOPS
1802 ---help--- 1799 ---help---
1803 Include support for the virtual frame buffer in the PS3 platform. 1800 Include support for the virtual frame buffer in the PS3 platform.
1804 1801
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 267c1ff9ebd9..a12589898597 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -394,26 +394,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi)
394 394
395 /* initialize GPIOs */ 395 /* initialize GPIOs */
396 imx_gpio_mode(PD6_PF_LSCLK); 396 imx_gpio_mode(PD6_PF_LSCLK);
397 imx_gpio_mode(PD10_PF_SPL_SPR);
398 imx_gpio_mode(PD11_PF_CONTRAST); 397 imx_gpio_mode(PD11_PF_CONTRAST);
399 imx_gpio_mode(PD14_PF_FLM_VSYNC); 398 imx_gpio_mode(PD14_PF_FLM_VSYNC);
400 imx_gpio_mode(PD13_PF_LP_HSYNC); 399 imx_gpio_mode(PD13_PF_LP_HSYNC);
401 imx_gpio_mode(PD7_PF_REV);
402 imx_gpio_mode(PD8_PF_CLS);
403
404#ifndef CONFIG_MACH_PIMX1
405 /* on PiMX1 used as buffers enable signal
406 */
407 imx_gpio_mode(PD9_PF_PS);
408#endif
409
410#ifndef CONFIG_MACH_MX1FS2
411 /* on mx1fs2 this pin is used to (de)activate the display, so we need
412 * it as a normal gpio
413 */
414 imx_gpio_mode(PD12_PF_ACD_OE); 400 imx_gpio_mode(PD12_PF_ACD_OE);
415#endif
416 401
402 /* These are only needed for Sharp HR TFT displays */
403 if (fbi->pcr & PCR_SHARP) {
404 imx_gpio_mode(PD7_PF_REV);
405 imx_gpio_mode(PD8_PF_CLS);
406 imx_gpio_mode(PD9_PF_PS);
407 imx_gpio_mode(PD10_PF_SPL_SPR);
408 }
417} 409}
418 410
419#ifdef CONFIG_PM 411#ifdef CONFIG_PM
@@ -476,7 +468,6 @@ static int __init imxfb_init_fbinfo(struct device *dev)
476 468
477 info->fbops = &imxfb_ops; 469 info->fbops = &imxfb_ops;
478 info->flags = FBINFO_FLAG_DEFAULT; 470 info->flags = FBINFO_FLAG_DEFAULT;
479 info->pseudo_palette = (fbi + 1);
480 471
481 fbi->rgb[RGB_16] = &def_rgb_16; 472 fbi->rgb[RGB_16] = &def_rgb_16;
482 fbi->rgb[RGB_8] = &def_rgb_8; 473 fbi->rgb[RGB_8] = &def_rgb_8;
@@ -499,6 +490,7 @@ static int __init imxfb_init_fbinfo(struct device *dev)
499 info->var.sync = inf->sync; 490 info->var.sync = inf->sync;
500 info->var.grayscale = inf->cmap_greyscale; 491 info->var.grayscale = inf->cmap_greyscale;
501 fbi->cmap_inverse = inf->cmap_inverse; 492 fbi->cmap_inverse = inf->cmap_inverse;
493 fbi->cmap_static = inf->cmap_static;
502 fbi->pcr = inf->pcr; 494 fbi->pcr = inf->pcr;
503 fbi->lscr1 = inf->lscr1; 495 fbi->lscr1 = inf->lscr1;
504 fbi->dmacr = inf->dmacr; 496 fbi->dmacr = inf->dmacr;
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index ab5e66890e4e..0a04483aa3e0 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -183,15 +183,17 @@ static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
183 index = PM2VR_RD_INDEXED_DATA; 183 index = PM2VR_RD_INDEXED_DATA;
184 break; 184 break;
185 } 185 }
186 mb(); 186 wmb();
187 pm2_WR(p, index, v); 187 pm2_WR(p, index, v);
188 wmb();
188} 189}
189 190
190static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 191static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
191{ 192{
192 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 193 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
193 mb(); 194 wmb();
194 pm2_WR(p, PM2VR_RD_INDEXED_DATA, v); 195 pm2_WR(p, PM2VR_RD_INDEXED_DATA, v);
196 wmb();
195} 197}
196 198
197#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT 199#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
@@ -466,11 +468,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk)
466 WAIT_FIFO(par, 8); 468 WAIT_FIFO(par, 8);
467 pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8); 469 pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8);
468 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0); 470 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0);
469 wmb();
470 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m); 471 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m);
471 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n); 472 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n);
472 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p); 473 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p);
473 wmb();
474 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1); 474 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1);
475 rmb(); 475 rmb();
476 for (i = 256; 476 for (i = 256;
@@ -483,12 +483,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk)
483 pm2_mnp(clk, &m, &n, &p); 483 pm2_mnp(clk, &m, &n, &p);
484 WAIT_FIFO(par, 10); 484 WAIT_FIFO(par, 10);
485 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6); 485 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6);
486 wmb();
487 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m); 486 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m);
488 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n); 487 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n);
489 wmb();
490 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p); 488 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p);
491 wmb();
492 pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS); 489 pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS);
493 rmb(); 490 rmb();
494 for (i = 256; 491 for (i = 256;
@@ -509,12 +506,9 @@ static void set_pixclock(struct pm2fb_par* par, u32 clk)
509 pm2_mnp(clk, &m, &n, &p); 506 pm2_mnp(clk, &m, &n, &p);
510 WAIT_FIFO(par, 8); 507 WAIT_FIFO(par, 8);
511 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0); 508 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0);
512 wmb();
513 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m); 509 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m);
514 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n); 510 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n);
515 wmb();
516 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p); 511 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p);
517 wmb();
518 pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS); 512 pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS);
519 rmb(); 513 rmb();
520 for (i = 256; 514 for (i = 256;
@@ -1066,10 +1060,9 @@ static void pm2fb_block_op(struct fb_info* info, int copy,
1066 1060
1067 if (!w || !h) 1061 if (!w || !h)
1068 return; 1062 return;
1069 WAIT_FIFO(par, 6); 1063 WAIT_FIFO(par, 5);
1070 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE | 1064 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE |
1071 PM2F_CONFIG_FB_READ_SOURCE_ENABLE); 1065 PM2F_CONFIG_FB_READ_SOURCE_ENABLE);
1072 pm2_WR(par, PM2R_FB_PIXEL_OFFSET, 0);
1073 if (copy) 1066 if (copy)
1074 pm2_WR(par, PM2R_FB_SOURCE_DELTA, 1067 pm2_WR(par, PM2R_FB_SOURCE_DELTA,
1075 ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff)); 1068 ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff));
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index c77a1a1fd46b..616a0c08e30c 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -52,11 +52,6 @@
52static char *mode_option __devinitdata; 52static char *mode_option __devinitdata;
53 53
54/* 54/*
55 * If your driver supports multiple boards, you should make the
56 * below data types arrays, or allocate them dynamically (using kmalloc()).
57 */
58
59/*
60 * This structure defines the hardware state of the graphics card. Normally 55 * This structure defines the hardware state of the graphics card. Normally
61 * you place this in a header file in linux/include/video. This file usually 56 * you place this in a header file in linux/include/video. This file usually
62 * also includes register information. That allows other driver subsystems 57 * also includes register information. That allows other driver subsystems
@@ -67,7 +62,7 @@ struct pm3_par {
67 unsigned char __iomem *v_regs;/* virtual address of p_regs */ 62 unsigned char __iomem *v_regs;/* virtual address of p_regs */
68 u32 video; /* video flags before blanking */ 63 u32 video; /* video flags before blanking */
69 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */ 64 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */
70 u32 palette[16]; 65 u32 palette[16];
71}; 66};
72 67
73/* 68/*
@@ -104,36 +99,28 @@ static inline void PM3_WAIT(struct pm3_par *par, u32 n)
104 while (PM3_READ_REG(par, PM3InFIFOSpace) < n); 99 while (PM3_READ_REG(par, PM3InFIFOSpace) < n);
105} 100}
106 101
107static inline void PM3_SLOW_WRITE_REG(struct pm3_par *par, s32 off, u32 v)
108{
109 if (par->v_regs) {
110 mb();
111 PM3_WAIT(par, 1);
112 wmb();
113 PM3_WRITE_REG(par, off, v);
114 }
115}
116
117static inline void PM3_SET_INDEX(struct pm3_par *par, unsigned index)
118{
119 PM3_SLOW_WRITE_REG(par, PM3RD_IndexHigh, (index >> 8) & 0xff);
120 PM3_SLOW_WRITE_REG(par, PM3RD_IndexLow, index & 0xff);
121}
122
123static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v) 102static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v)
124{ 103{
125 PM3_SET_INDEX(par, r); 104 PM3_WAIT(par, 3);
105 PM3_WRITE_REG(par, PM3RD_IndexHigh, (r >> 8) & 0xff);
106 PM3_WRITE_REG(par, PM3RD_IndexLow, r & 0xff);
126 wmb(); 107 wmb();
127 PM3_WRITE_REG(par, PM3RD_IndexedData, v); 108 PM3_WRITE_REG(par, PM3RD_IndexedData, v);
109 wmb();
128} 110}
129 111
130static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno, 112static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno,
131 unsigned char r, unsigned char g, unsigned char b) 113 unsigned char r, unsigned char g, unsigned char b)
132{ 114{
133 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno); 115 PM3_WAIT(par, 4);
134 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, r); 116 PM3_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno);
135 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, g); 117 wmb();
136 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, b); 118 PM3_WRITE_REG(par, PM3RD_PaletteData, r);
119 wmb();
120 PM3_WRITE_REG(par, PM3RD_PaletteData, g);
121 wmb();
122 PM3_WRITE_REG(par, PM3RD_PaletteData, b);
123 wmb();
137} 124}
138 125
139static void pm3fb_clear_colormap(struct pm3_par *par, 126static void pm3fb_clear_colormap(struct pm3_par *par,
@@ -141,7 +128,7 @@ static void pm3fb_clear_colormap(struct pm3_par *par,
141{ 128{
142 int i; 129 int i;
143 130
144 for (i = 0; i < 256 ; i++) /* fill color map with white */ 131 for (i = 0; i < 256 ; i++)
145 pm3fb_set_color(par, i, r, g, b); 132 pm3fb_set_color(par, i, r, g, b);
146 133
147} 134}
@@ -175,19 +162,26 @@ static void pm3fb_calculate_clock(unsigned long reqclock,
175 } 162 }
176} 163}
177 164
178static inline int pm3fb_shift_bpp(unsigned long depth, int v) 165static inline int pm3fb_depth(const struct fb_var_screeninfo *var)
179{ 166{
180 switch (depth) { 167 if ( var->bits_per_pixel == 16 )
168 return var->red.length + var->green.length
169 + var->blue.length;
170
171 return var->bits_per_pixel;
172}
173
174static inline int pm3fb_shift_bpp(unsigned bpp, int v)
175{
176 switch (bpp) {
181 case 8: 177 case 8:
182 return (v >> 4); 178 return (v >> 4);
183 case 12:
184 case 15:
185 case 16: 179 case 16:
186 return (v >> 3); 180 return (v >> 3);
187 case 32: 181 case 32:
188 return (v >> 2); 182 return (v >> 2);
189 } 183 }
190 DPRINTK("Unsupported depth %ld\n", depth); 184 DPRINTK("Unsupported depth %u\n", bpp);
191 return 0; 185 return 0;
192} 186}
193 187
@@ -206,56 +200,50 @@ static void pm3fb_write_mode(struct fb_info *info)
206 const u32 vbend = vsend + info->var.upper_margin; 200 const u32 vbend = vsend + info->var.upper_margin;
207 const u32 vtotal = info->var.yres + vbend; 201 const u32 vtotal = info->var.yres + vbend;
208 const u32 width = (info->var.xres_virtual + 7) & ~7; 202 const u32 width = (info->var.xres_virtual + 7) & ~7;
209 203 const unsigned bpp = info->var.bits_per_pixel;
210 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff); 204
211 PM3_SLOW_WRITE_REG(par, PM3Aperture0, 0x00000000); 205 PM3_WAIT(par, 20);
212 PM3_SLOW_WRITE_REG(par, PM3Aperture1, 0x00000000); 206 PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff);
213 PM3_SLOW_WRITE_REG(par, PM3FIFODis, 0x00000007); 207 PM3_WRITE_REG(par, PM3Aperture0, 0x00000000);
214 208 PM3_WRITE_REG(par, PM3Aperture1, 0x00000000);
215 PM3_SLOW_WRITE_REG(par, PM3HTotal, 209 PM3_WRITE_REG(par, PM3FIFODis, 0x00000007);
216 pm3fb_shift_bpp(info->var.bits_per_pixel, 210
217 htotal - 1)); 211 PM3_WRITE_REG(par, PM3HTotal,
218 PM3_SLOW_WRITE_REG(par, PM3HsEnd, 212 pm3fb_shift_bpp(bpp, htotal - 1));
219 pm3fb_shift_bpp(info->var.bits_per_pixel, 213 PM3_WRITE_REG(par, PM3HsEnd,
220 hsend)); 214 pm3fb_shift_bpp(bpp, hsend));
221 PM3_SLOW_WRITE_REG(par, PM3HsStart, 215 PM3_WRITE_REG(par, PM3HsStart,
222 pm3fb_shift_bpp(info->var.bits_per_pixel, 216 pm3fb_shift_bpp(bpp, hsstart));
223 hsstart)); 217 PM3_WRITE_REG(par, PM3HbEnd,
224 PM3_SLOW_WRITE_REG(par, PM3HbEnd, 218 pm3fb_shift_bpp(bpp, hbend));
225 pm3fb_shift_bpp(info->var.bits_per_pixel, 219 PM3_WRITE_REG(par, PM3HgEnd,
226 hbend)); 220 pm3fb_shift_bpp(bpp, hbend));
227 PM3_SLOW_WRITE_REG(par, PM3HgEnd, 221 PM3_WRITE_REG(par, PM3ScreenStride,
228 pm3fb_shift_bpp(info->var.bits_per_pixel, 222 pm3fb_shift_bpp(bpp, width));
229 hbend)); 223 PM3_WRITE_REG(par, PM3VTotal, vtotal - 1);
230 PM3_SLOW_WRITE_REG(par, PM3ScreenStride, 224 PM3_WRITE_REG(par, PM3VsEnd, vsend - 1);
231 pm3fb_shift_bpp(info->var.bits_per_pixel, 225 PM3_WRITE_REG(par, PM3VsStart, vsstart - 1);
232 width)); 226 PM3_WRITE_REG(par, PM3VbEnd, vbend);
233 PM3_SLOW_WRITE_REG(par, PM3VTotal, vtotal - 1); 227
234 PM3_SLOW_WRITE_REG(par, PM3VsEnd, vsend - 1); 228 switch (bpp) {
235 PM3_SLOW_WRITE_REG(par, PM3VsStart, vsstart - 1);
236 PM3_SLOW_WRITE_REG(par, PM3VbEnd, vbend);
237
238 switch (info->var.bits_per_pixel) {
239 case 8: 229 case 8:
240 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 230 PM3_WRITE_REG(par, PM3ByAperture1Mode,
241 PM3ByApertureMode_PIXELSIZE_8BIT); 231 PM3ByApertureMode_PIXELSIZE_8BIT);
242 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 232 PM3_WRITE_REG(par, PM3ByAperture2Mode,
243 PM3ByApertureMode_PIXELSIZE_8BIT); 233 PM3ByApertureMode_PIXELSIZE_8BIT);
244 break; 234 break;
245 235
246 case 12:
247 case 15:
248 case 16: 236 case 16:
249#ifndef __BIG_ENDIAN 237#ifndef __BIG_ENDIAN
250 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 238 PM3_WRITE_REG(par, PM3ByAperture1Mode,
251 PM3ByApertureMode_PIXELSIZE_16BIT); 239 PM3ByApertureMode_PIXELSIZE_16BIT);
252 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 240 PM3_WRITE_REG(par, PM3ByAperture2Mode,
253 PM3ByApertureMode_PIXELSIZE_16BIT); 241 PM3ByApertureMode_PIXELSIZE_16BIT);
254#else 242#else
255 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 243 PM3_WRITE_REG(par, PM3ByAperture1Mode,
256 PM3ByApertureMode_PIXELSIZE_16BIT | 244 PM3ByApertureMode_PIXELSIZE_16BIT |
257 PM3ByApertureMode_BYTESWAP_BADC); 245 PM3ByApertureMode_BYTESWAP_BADC);
258 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 246 PM3_WRITE_REG(par, PM3ByAperture2Mode,
259 PM3ByApertureMode_PIXELSIZE_16BIT | 247 PM3ByApertureMode_PIXELSIZE_16BIT |
260 PM3ByApertureMode_BYTESWAP_BADC); 248 PM3ByApertureMode_BYTESWAP_BADC);
261#endif /* ! __BIG_ENDIAN */ 249#endif /* ! __BIG_ENDIAN */
@@ -263,23 +251,22 @@ static void pm3fb_write_mode(struct fb_info *info)
263 251
264 case 32: 252 case 32:
265#ifndef __BIG_ENDIAN 253#ifndef __BIG_ENDIAN
266 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 254 PM3_WRITE_REG(par, PM3ByAperture1Mode,
267 PM3ByApertureMode_PIXELSIZE_32BIT); 255 PM3ByApertureMode_PIXELSIZE_32BIT);
268 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 256 PM3_WRITE_REG(par, PM3ByAperture2Mode,
269 PM3ByApertureMode_PIXELSIZE_32BIT); 257 PM3ByApertureMode_PIXELSIZE_32BIT);
270#else 258#else
271 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 259 PM3_WRITE_REG(par, PM3ByAperture1Mode,
272 PM3ByApertureMode_PIXELSIZE_32BIT | 260 PM3ByApertureMode_PIXELSIZE_32BIT |
273 PM3ByApertureMode_BYTESWAP_DCBA); 261 PM3ByApertureMode_BYTESWAP_DCBA);
274 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 262 PM3_WRITE_REG(par, PM3ByAperture2Mode,
275 PM3ByApertureMode_PIXELSIZE_32BIT | 263 PM3ByApertureMode_PIXELSIZE_32BIT |
276 PM3ByApertureMode_BYTESWAP_DCBA); 264 PM3ByApertureMode_BYTESWAP_DCBA);
277#endif /* ! __BIG_ENDIAN */ 265#endif /* ! __BIG_ENDIAN */
278 break; 266 break;
279 267
280 default: 268 default:
281 DPRINTK("Unsupported depth %d\n", 269 DPRINTK("Unsupported depth %d\n", bpp);
282 info->var.bits_per_pixel);
283 break; 270 break;
284 } 271 }
285 272
@@ -296,14 +283,15 @@ static void pm3fb_write_mode(struct fb_info *info)
296 PM3VideoControl_VSYNC_MASK); 283 PM3VideoControl_VSYNC_MASK);
297 video |= PM3VideoControl_HSYNC_ACTIVE_HIGH | 284 video |= PM3VideoControl_HSYNC_ACTIVE_HIGH |
298 PM3VideoControl_VSYNC_ACTIVE_HIGH; 285 PM3VideoControl_VSYNC_ACTIVE_HIGH;
299 PM3_SLOW_WRITE_REG(par, PM3VideoControl, video); 286 PM3_WRITE_REG(par, PM3VideoControl, video);
300 } 287 }
301 PM3_SLOW_WRITE_REG(par, PM3VClkCtl, 288 PM3_WRITE_REG(par, PM3VClkCtl,
302 (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC)); 289 (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC));
303 PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); 290 PM3_WRITE_REG(par, PM3ScreenBase, par->base);
304 PM3_SLOW_WRITE_REG(par, PM3ChipConfig, 291 PM3_WRITE_REG(par, PM3ChipConfig,
305 (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD)); 292 (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD));
306 293
294 wmb();
307 { 295 {
308 unsigned char uninitialized_var(m); /* ClkPreScale */ 296 unsigned char uninitialized_var(m); /* ClkPreScale */
309 unsigned char uninitialized_var(n); /* ClkFeedBackScale */ 297 unsigned char uninitialized_var(n); /* ClkFeedBackScale */
@@ -337,7 +325,7 @@ static void pm3fb_write_mode(struct fb_info *info)
337 325
338 PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00); 326 PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00);
339 327
340 switch (info->var.bits_per_pixel) { 328 switch (pm3fb_depth(&info->var)) {
341 case 8: 329 case 8:
342 PM3_WRITE_DAC_REG(par, PM3RD_PixelSize, 330 PM3_WRITE_DAC_REG(par, PM3RD_PixelSize,
343 PM3RD_PixelSize_8_BIT_PIXELS); 331 PM3RD_PixelSize_8_BIT_PIXELS);
@@ -393,57 +381,44 @@ static void pm3fb_write_mode(struct fb_info *info)
393 * hardware independent functions 381 * hardware independent functions
394 */ 382 */
395int pm3fb_init(void); 383int pm3fb_init(void);
396int pm3fb_setup(char*);
397 384
398static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 385static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
399{ 386{
400 u32 lpitch; 387 u32 lpitch;
388 unsigned bpp = var->red.length + var->green.length
389 + var->blue.length + var->transp.length;
401 390
402 var->transp.offset = 0; 391 if ( bpp != var->bits_per_pixel ) {
403 var->transp.length = 0; 392 /* set predefined mode for bits_per_pixel settings */
404 switch(var->bits_per_pixel) { 393
405 case 8: 394 switch(var->bits_per_pixel) {
406 var->red.length = var->green.length = var->blue.length = 8; 395 case 8:
407 var->red.offset = var->green.offset = var->blue.offset = 0; 396 var->red.length = var->green.length = var->blue.length = 8;
408 break; 397 var->red.offset = var->green.offset = var->blue.offset = 0;
409 case 12: 398 var->transp.offset = 0;
410 var->red.offset = 8; 399 var->transp.length = 0;
411 var->red.length = 4; 400 break;
412 var->green.offset = 4; 401 case 16:
413 var->green.length = 4; 402 var->red.length = var->blue.length = 5;
414 var->blue.offset = 0; 403 var->green.length = 6;
415 var->blue.length = 4; 404 var->transp.length = 0;
416 var->transp.offset = 12; 405 break;
417 var->transp.length = 4; 406 case 32:
418 case 15: 407 var->red.length = var->green.length = var->blue.length = 8;
419 var->red.offset = 10; 408 var->transp.length = 8;
420 var->red.length = 5; 409 break;
421 var->green.offset = 5; 410 default:
422 var->green.length = 5; 411 DPRINTK("depth not supported: %u\n", var->bits_per_pixel);
423 var->blue.offset = 0; 412 return -EINVAL;
424 var->blue.length = 5; 413 }
425 var->transp.offset = 15; 414 }
426 var->transp.length = 1; 415 /* it is assumed BGRA order */
427 break; 416 if (var->bits_per_pixel > 8 )
428 case 16: 417 {
429 var->red.offset = 11; 418 var->blue.offset = 0;
430 var->red.length = 5; 419 var->green.offset = var->blue.length;
431 var->green.offset = 5; 420 var->red.offset = var->green.offset + var->green.length;
432 var->green.length = 6; 421 var->transp.offset = var->red.offset + var->red.length;
433 var->blue.offset = 0;
434 var->blue.length = 5;
435 break;
436 case 32:
437 var->transp.offset = 24;
438 var->transp.length = 8;
439 var->red.offset = 16;
440 var->green.offset = 8;
441 var->blue.offset = 0;
442 var->red.length = var->green.length = var->blue.length = 8;
443 break;
444 default:
445 DPRINTK("depth not supported: %u\n", var->bits_per_pixel);
446 return -EINVAL;
447 } 422 }
448 var->height = var->width = -1; 423 var->height = var->width = -1;
449 424
@@ -502,10 +477,9 @@ static int pm3fb_set_par(struct fb_info *info)
502{ 477{
503 struct pm3_par *par = info->par; 478 struct pm3_par *par = info->par;
504 const u32 xres = (info->var.xres + 31) & ~31; 479 const u32 xres = (info->var.xres + 31) & ~31;
505 const int depth = (info->var.bits_per_pixel + 7) & ~7; 480 const unsigned bpp = info->var.bits_per_pixel;
506 481
507 par->base = pm3fb_shift_bpp(info->var.bits_per_pixel, 482 par->base = pm3fb_shift_bpp(bpp,(info->var.yoffset * xres)
508 (info->var.yoffset * xres)
509 + info->var.xoffset); 483 + info->var.xoffset);
510 par->video = 0; 484 par->video = 0;
511 485
@@ -530,12 +504,10 @@ static int pm3fb_set_par(struct fb_info *info)
530 par->video |= PM3VideoControl_DISABLE; 504 par->video |= PM3VideoControl_DISABLE;
531 DPRINTK("PM3Video disabled\n"); 505 DPRINTK("PM3Video disabled\n");
532 } 506 }
533 switch (depth) { 507 switch (bpp) {
534 case 8: 508 case 8:
535 par->video |= PM3VideoControl_PIXELSIZE_8BIT; 509 par->video |= PM3VideoControl_PIXELSIZE_8BIT;
536 break; 510 break;
537 case 12:
538 case 15:
539 case 16: 511 case 16:
540 par->video |= PM3VideoControl_PIXELSIZE_16BIT; 512 par->video |= PM3VideoControl_PIXELSIZE_16BIT;
541 break; 513 break;
@@ -548,9 +520,9 @@ static int pm3fb_set_par(struct fb_info *info)
548 } 520 }
549 521
550 info->fix.visual = 522 info->fix.visual =
551 (depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; 523 (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
552 info->fix.line_length = ((info->var.xres_virtual + 7) & ~7) 524 info->fix.line_length = ((info->var.xres_virtual + 7) & ~7)
553 * depth / 8; 525 * bpp / 8;
554 526
555/* pm3fb_clear_memory(info, 0);*/ 527/* pm3fb_clear_memory(info, 0);*/
556 pm3fb_clear_colormap(par, 0, 0, 0); 528 pm3fb_clear_colormap(par, 0, 0, 0);
@@ -580,8 +552,8 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green,
580 * var->{color}.length contains length of bitfield 552 * var->{color}.length contains length of bitfield
581 * {hardwarespecific} contains width of DAC 553 * {hardwarespecific} contains width of DAC
582 * pseudo_palette[X] is programmed to (X << red.offset) | 554 * pseudo_palette[X] is programmed to (X << red.offset) |
583 * (X << green.offset) | 555 * (X << green.offset) |
584 * (X << blue.offset) 556 * (X << blue.offset)
585 * RAMDAC[X] is programmed to (red, green, blue) 557 * RAMDAC[X] is programmed to (red, green, blue)
586 * color depth = SUM(var->{color}.length) 558 * color depth = SUM(var->{color}.length)
587 * 559 *
@@ -621,7 +593,6 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green,
621 case 8: 593 case 8:
622 break; 594 break;
623 case 16: 595 case 16:
624 case 24:
625 case 32: 596 case 32:
626 ((u32*)(info->pseudo_palette))[regno] = v; 597 ((u32*)(info->pseudo_palette))[regno] = v;
627 break; 598 break;
@@ -643,7 +614,8 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var,
643 par->base = pm3fb_shift_bpp(var->bits_per_pixel, 614 par->base = pm3fb_shift_bpp(var->bits_per_pixel,
644 (var->yoffset * xres) 615 (var->yoffset * xres)
645 + var->xoffset); 616 + var->xoffset);
646 PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); 617 PM3_WAIT(par, 1);
618 PM3_WRITE_REG(par, PM3ScreenBase, par->base);
647 return 0; 619 return 0;
648} 620}
649 621
@@ -665,31 +637,31 @@ static int pm3fb_blank(int blank_mode, struct fb_info *info)
665 637
666 switch (blank_mode) { 638 switch (blank_mode) {
667 case FB_BLANK_UNBLANK: 639 case FB_BLANK_UNBLANK:
668 video = video | PM3VideoControl_ENABLE; 640 video |= PM3VideoControl_ENABLE;
669 break; 641 break;
670 case FB_BLANK_NORMAL: /* FIXME */ 642 case FB_BLANK_NORMAL:
671 video = video & ~(PM3VideoControl_ENABLE); 643 video &= ~(PM3VideoControl_ENABLE);
672 break; 644 break;
673 case FB_BLANK_HSYNC_SUSPEND: 645 case FB_BLANK_HSYNC_SUSPEND:
674 video = video & ~(PM3VideoControl_HSYNC_MASK | 646 video &= ~(PM3VideoControl_HSYNC_MASK |
675 PM3VideoControl_BLANK_ACTIVE_LOW); 647 PM3VideoControl_BLANK_ACTIVE_LOW);
676 break; 648 break;
677 case FB_BLANK_VSYNC_SUSPEND: 649 case FB_BLANK_VSYNC_SUSPEND:
678 video = video & ~(PM3VideoControl_VSYNC_MASK | 650 video &= ~(PM3VideoControl_VSYNC_MASK |
679 PM3VideoControl_BLANK_ACTIVE_LOW); 651 PM3VideoControl_BLANK_ACTIVE_LOW);
680 break; 652 break;
681 case FB_BLANK_POWERDOWN: 653 case FB_BLANK_POWERDOWN:
682 video = video & ~(PM3VideoControl_HSYNC_MASK | 654 video &= ~(PM3VideoControl_HSYNC_MASK |
683 PM3VideoControl_VSYNC_MASK | 655 PM3VideoControl_VSYNC_MASK |
684 PM3VideoControl_BLANK_ACTIVE_LOW); 656 PM3VideoControl_BLANK_ACTIVE_LOW);
685 break; 657 break;
686 default: 658 default:
687 DPRINTK("Unsupported blanking %d\n", blank_mode); 659 DPRINTK("Unsupported blanking %d\n", blank_mode);
688 return 1; 660 return 1;
689 } 661 }
690 662
691 PM3_SLOW_WRITE_REG(par,PM3VideoControl, video); 663 PM3_WAIT(par, 1);
692 664 PM3_WRITE_REG(par,PM3VideoControl, video);
693 return 0; 665 return 0;
694} 666}
695 667
@@ -703,9 +675,9 @@ static struct fb_ops pm3fb_ops = {
703 .fb_set_par = pm3fb_set_par, 675 .fb_set_par = pm3fb_set_par,
704 .fb_setcolreg = pm3fb_setcolreg, 676 .fb_setcolreg = pm3fb_setcolreg,
705 .fb_pan_display = pm3fb_pan_display, 677 .fb_pan_display = pm3fb_pan_display,
706 .fb_fillrect = cfb_fillrect, /* Needed !!! */ 678 .fb_fillrect = cfb_fillrect,
707 .fb_copyarea = cfb_copyarea, /* Needed !!! */ 679 .fb_copyarea = cfb_copyarea,
708 .fb_imageblit = cfb_imageblit, /* Needed !!! */ 680 .fb_imageblit = cfb_imageblit,
709 .fb_blank = pm3fb_blank, 681 .fb_blank = pm3fb_blank,
710}; 682};
711 683
@@ -722,7 +694,7 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
722 unsigned long memsize = 0, tempBypass, i, temp1, temp2; 694 unsigned long memsize = 0, tempBypass, i, temp1, temp2;
723 unsigned char __iomem *screen_mem; 695 unsigned char __iomem *screen_mem;
724 696
725 pm3fb_fix.smem_len = 64 * 1024 * 1024; /* request full aperture size */ 697 pm3fb_fix.smem_len = 64 * 1024l * 1024; /* request full aperture size */
726 /* Linear frame buffer - request region and map it. */ 698 /* Linear frame buffer - request region and map it. */
727 if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len, 699 if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len,
728 "pm3fb smem")) { 700 "pm3fb smem")) {
@@ -744,7 +716,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
744 716
745 DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass); 717 DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass);
746 718
747 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF); 719 PM3_WAIT(par, 1);
720 PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF);
748 721
749 /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */ 722 /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */
750 for (i = 0; i < 32; i++) { 723 for (i = 0; i < 32; i++) {
@@ -765,10 +738,9 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
765 if (memsize + 1 == i) { 738 if (memsize + 1 == i) {
766 for (i = 0; i < 32; i++) { 739 for (i = 0; i < 32; i++) {
767 /* Clear first 32MB ; 0 is 0, no need to byteswap */ 740 /* Clear first 32MB ; 0 is 0, no need to byteswap */
768 writel(0x0000000, 741 writel(0x0000000, (screen_mem + (i * 1048576)));
769 (screen_mem + (i * 1048576)));
770 mb();
771 } 742 }
743 wmb();
772 744
773 for (i = 32; i < 64; i++) { 745 for (i = 32; i < 64; i++) {
774 fb_writel(i * 0x00345678, 746 fb_writel(i * 0x00345678,
@@ -787,7 +759,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
787 } 759 }
788 DPRINTK("Second detect pass got %ld MB\n", memsize + 1); 760 DPRINTK("Second detect pass got %ld MB\n", memsize + 1);
789 761
790 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass); 762 PM3_WAIT(par, 1);
763 PM3_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass);
791 764
792 iounmap(screen_mem); 765 iounmap(screen_mem);
793 release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); 766 release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len);
@@ -890,7 +863,6 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
890 goto err_exit_both; 863 goto err_exit_both;
891 } 864 }
892 865
893 /* This has to been done !!! */
894 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { 866 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
895 retval = -ENOMEM; 867 retval = -ENOMEM;
896 goto err_exit_both; 868 goto err_exit_both;
@@ -907,7 +879,7 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
907 } 879 }
908 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, 880 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
909 info->fix.id); 881 info->fix.id);
910 pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ 882 pci_set_drvdata(dev, info);
911 return 0; 883 return 0;
912 884
913 err_exit_all: 885 err_exit_all:
@@ -949,8 +921,7 @@ static void __devexit pm3fb_remove(struct pci_dev *dev)
949 921
950static struct pci_device_id pm3fb_id_table[] = { 922static struct pci_device_id pm3fb_id_table[] = {
951 { PCI_VENDOR_ID_3DLABS, 0x0a, 923 { PCI_VENDOR_ID_3DLABS, 0x0a,
952 PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, 924 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
953 0xff0000, 0 },
954 { 0, } 925 { 0, }
955}; 926};
956 927
@@ -964,6 +935,22 @@ static struct pci_driver pm3fb_driver = {
964 935
965MODULE_DEVICE_TABLE(pci, pm3fb_id_table); 936MODULE_DEVICE_TABLE(pci, pm3fb_id_table);
966 937
938#ifndef MODULE
939 /*
940 * Setup
941 */
942
943/*
944 * Only necessary if your driver takes special options,
945 * otherwise we fall back on the generic fb_setup().
946 */
947static int __init pm3fb_setup(char *options)
948{
949 /* Parse user speficied options (`video=pm3fb:') */
950 return 0;
951}
952#endif /* MODULE */
953
967int __init pm3fb_init(void) 954int __init pm3fb_init(void)
968{ 955{
969 /* 956 /*
@@ -985,22 +972,6 @@ static void __exit pm3fb_exit(void)
985 pci_unregister_driver(&pm3fb_driver); 972 pci_unregister_driver(&pm3fb_driver);
986} 973}
987 974
988#ifndef MODULE
989 /*
990 * Setup
991 */
992
993/*
994 * Only necessary if your driver takes special options,
995 * otherwise we fall back on the generic fb_setup().
996 */
997int __init pm3fb_setup(char *options)
998{
999 /* Parse user speficied options (`video=pm3fb:') */
1000 return 0;
1001}
1002#endif /* MODULE */
1003
1004module_init(pm3fb_init); 975module_init(pm3fb_init);
1005module_exit(pm3fb_exit); 976module_exit(pm3fb_exit);
1006 977
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 9756a728b74f..9cf92ba5d6e3 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -951,12 +951,14 @@ static int ps3fb_xdr_settings(u64 xdr_lpar)
951static struct fb_ops ps3fb_ops = { 951static struct fb_ops ps3fb_ops = {
952 .fb_open = ps3fb_open, 952 .fb_open = ps3fb_open,
953 .fb_release = ps3fb_release, 953 .fb_release = ps3fb_release,
954 .fb_read = fb_sys_read,
955 .fb_write = fb_sys_write,
954 .fb_check_var = ps3fb_check_var, 956 .fb_check_var = ps3fb_check_var,
955 .fb_set_par = ps3fb_set_par, 957 .fb_set_par = ps3fb_set_par,
956 .fb_setcolreg = ps3fb_setcolreg, 958 .fb_setcolreg = ps3fb_setcolreg,
957 .fb_fillrect = cfb_fillrect, 959 .fb_fillrect = sys_fillrect,
958 .fb_copyarea = cfb_copyarea, 960 .fb_copyarea = sys_copyarea,
959 .fb_imageblit = cfb_imageblit, 961 .fb_imageblit = sys_imageblit,
960 .fb_mmap = ps3fb_mmap, 962 .fb_mmap = ps3fb_mmap,
961 .fb_blank = ps3fb_blank, 963 .fb_blank = ps3fb_blank,
962 .fb_ioctl = ps3fb_ioctl, 964 .fb_ioctl = ps3fb_ioctl,
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 5fc86ea20692..003c49a490eb 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -660,7 +660,7 @@ int __init w100fb_probe(struct platform_device *pdev)
660 err = -ENODEV; 660 err = -ENODEV;
661 goto out; 661 goto out;
662 } 662 }
663 printk(" at 0x%08lx.\n", mem->start+W100_CFG_BASE); 663 printk(" at 0x%08lx.\n", (unsigned long) mem->start+W100_CFG_BASE);
664 664
665 /* Remap the framebuffer */ 665 /* Remap the framebuffer */
666 remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); 666 remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE);
@@ -753,10 +753,14 @@ int __init w100fb_probe(struct platform_device *pdev)
753 goto out; 753 goto out;
754 } 754 }
755 755
756 device_create_file(&pdev->dev, &dev_attr_fastpllclk); 756 err = device_create_file(&pdev->dev, &dev_attr_fastpllclk);
757 device_create_file(&pdev->dev, &dev_attr_reg_read); 757 err |= device_create_file(&pdev->dev, &dev_attr_reg_read);
758 device_create_file(&pdev->dev, &dev_attr_reg_write); 758 err |= device_create_file(&pdev->dev, &dev_attr_reg_write);
759 device_create_file(&pdev->dev, &dev_attr_flip); 759 err |= device_create_file(&pdev->dev, &dev_attr_flip);
760
761 if (err != 0)
762 printk(KERN_WARNING "fb%d: failed to register attributes (%d)\n",
763 info->node, err);
760 764
761 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); 765 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
762 return 0; 766 return 0;
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 74c64409ddbc..d4fc6095466d 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -38,7 +38,7 @@ config BINFMT_ELF_FDPIC
38 38
39config BINFMT_FLAT 39config BINFMT_FLAT
40 tristate "Kernel support for flat binaries" 40 tristate "Kernel support for flat binaries"
41 depends on !MMU || SUPERH 41 depends on !MMU
42 help 42 help
43 Support uClinux FLAT format binaries. 43 Support uClinux FLAT format binaries.
44 44
diff --git a/fs/compat.c b/fs/compat.c
index 1de2331db844..4db6216e5266 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1544,9 +1544,10 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1544 compat_ulong_t __user *outp, compat_ulong_t __user *exp, s64 *timeout) 1544 compat_ulong_t __user *outp, compat_ulong_t __user *exp, s64 *timeout)
1545{ 1545{
1546 fd_set_bits fds; 1546 fd_set_bits fds;
1547 char *bits; 1547 void *bits;
1548 int size, max_fds, ret = -EINVAL; 1548 int size, max_fds, ret = -EINVAL;
1549 struct fdtable *fdt; 1549 struct fdtable *fdt;
1550 long stack_fds[SELECT_STACK_ALLOC/sizeof(long)];
1550 1551
1551 if (n < 0) 1552 if (n < 0)
1552 goto out_nofds; 1553 goto out_nofds;
@@ -1564,11 +1565,14 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1564 * since we used fdset we need to allocate memory in units of 1565 * since we used fdset we need to allocate memory in units of
1565 * long-words. 1566 * long-words.
1566 */ 1567 */
1567 ret = -ENOMEM;
1568 size = FDS_BYTES(n); 1568 size = FDS_BYTES(n);
1569 bits = kmalloc(6 * size, GFP_KERNEL); 1569 bits = stack_fds;
1570 if (!bits) 1570 if (size > sizeof(stack_fds) / 6) {
1571 goto out_nofds; 1571 bits = kmalloc(6 * size, GFP_KERNEL);
1572 ret = -ENOMEM;
1573 if (!bits)
1574 goto out_nofds;
1575 }
1572 fds.in = (unsigned long *) bits; 1576 fds.in = (unsigned long *) bits;
1573 fds.out = (unsigned long *) (bits + size); 1577 fds.out = (unsigned long *) (bits + size);
1574 fds.ex = (unsigned long *) (bits + 2*size); 1578 fds.ex = (unsigned long *) (bits + 2*size);
@@ -1600,7 +1604,8 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1600 compat_set_fd_set(n, exp, fds.res_ex)) 1604 compat_set_fd_set(n, exp, fds.res_ex))
1601 ret = -EFAULT; 1605 ret = -EFAULT;
1602out: 1606out:
1603 kfree(bits); 1607 if (bits != stack_fds)
1608 kfree(bits);
1604out_nofds: 1609out_nofds:
1605 return ret; 1610 return ret;
1606} 1611}
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 65643def3182..6b44cdc96fac 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1194,6 +1194,7 @@ static int vt_check(struct file *file)
1194{ 1194{
1195 struct tty_struct *tty; 1195 struct tty_struct *tty;
1196 struct inode *inode = file->f_path.dentry->d_inode; 1196 struct inode *inode = file->f_path.dentry->d_inode;
1197 struct vc_data *vc;
1197 1198
1198 if (file->f_op->ioctl != tty_ioctl) 1199 if (file->f_op->ioctl != tty_ioctl)
1199 return -EINVAL; 1200 return -EINVAL;
@@ -1204,12 +1205,16 @@ static int vt_check(struct file *file)
1204 1205
1205 if (tty->driver->ioctl != vt_ioctl) 1206 if (tty->driver->ioctl != vt_ioctl)
1206 return -EINVAL; 1207 return -EINVAL;
1207 1208
1209 vc = (struct vc_data *)tty->driver_data;
1210 if (!vc_cons_allocated(vc->vc_num)) /* impossible? */
1211 return -ENOIOCTLCMD;
1212
1208 /* 1213 /*
1209 * To have permissions to do most of the vt ioctls, we either have 1214 * To have permissions to do most of the vt ioctls, we either have
1210 * to be the owner of the tty, or super-user. 1215 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
1211 */ 1216 */
1212 if (current->signal->tty == tty || capable(CAP_SYS_ADMIN)) 1217 if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))
1213 return 1; 1218 return 1;
1214 return 0; 1219 return 0;
1215} 1220}
@@ -1310,16 +1315,28 @@ static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
1310 struct unimapdesc32 tmp; 1315 struct unimapdesc32 tmp;
1311 struct unimapdesc32 __user *user_ud = compat_ptr(arg); 1316 struct unimapdesc32 __user *user_ud = compat_ptr(arg);
1312 int perm = vt_check(file); 1317 int perm = vt_check(file);
1313 1318 struct vc_data *vc;
1314 if (perm < 0) return perm; 1319
1320 if (perm < 0)
1321 return perm;
1315 if (copy_from_user(&tmp, user_ud, sizeof tmp)) 1322 if (copy_from_user(&tmp, user_ud, sizeof tmp))
1316 return -EFAULT; 1323 return -EFAULT;
1324 if (tmp.entries)
1325 if (!access_ok(VERIFY_WRITE, compat_ptr(tmp.entries),
1326 tmp.entry_ct*sizeof(struct unipair)))
1327 return -EFAULT;
1328 vc = ((struct tty_struct *)file->private_data)->driver_data;
1317 switch (cmd) { 1329 switch (cmd) {
1318 case PIO_UNIMAP: 1330 case PIO_UNIMAP:
1319 if (!perm) return -EPERM; 1331 if (!perm)
1320 return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries)); 1332 return -EPERM;
1333 return con_set_unimap(vc, tmp.entry_ct,
1334 compat_ptr(tmp.entries));
1321 case GIO_UNIMAP: 1335 case GIO_UNIMAP:
1322 return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries)); 1336 if (!perm && fg_console != vc->vc_num)
1337 return -EPERM;
1338 return con_get_unimap(vc, tmp.entry_ct, &(user_ud->entry_ct),
1339 compat_ptr(tmp.entries));
1323 } 1340 }
1324 return 0; 1341 return 0;
1325} 1342}
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 9881b5c5de59..59288d817078 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -33,63 +33,6 @@
33#include "ecryptfs_kernel.h" 33#include "ecryptfs_kernel.h"
34 34
35/** 35/**
36 * ecryptfs_llseek
37 * @file: File we are seeking in
38 * @offset: The offset to seek to
39 * @origin: 2 - offset from i_size; 1 - offset from f_pos
40 *
41 * Returns the position we have seeked to, or negative on error
42 */
43static loff_t ecryptfs_llseek(struct file *file, loff_t offset, int origin)
44{
45 loff_t rv;
46 loff_t new_end_pos;
47 int rc;
48 int expanding_file = 0;
49 struct inode *inode = file->f_mapping->host;
50
51 /* If our offset is past the end of our file, we're going to
52 * need to grow it so we have a valid length of 0's */
53 new_end_pos = offset;
54 switch (origin) {
55 case 2:
56 new_end_pos += i_size_read(inode);
57 expanding_file = 1;
58 break;
59 case 1:
60 new_end_pos += file->f_pos;
61 if (new_end_pos > i_size_read(inode)) {
62 ecryptfs_printk(KERN_DEBUG, "new_end_pos(=[0x%.16x]) "
63 "> i_size_read(inode)(=[0x%.16x])\n",
64 new_end_pos, i_size_read(inode));
65 expanding_file = 1;
66 }
67 break;
68 default:
69 if (new_end_pos > i_size_read(inode)) {
70 ecryptfs_printk(KERN_DEBUG, "new_end_pos(=[0x%.16x]) "
71 "> i_size_read(inode)(=[0x%.16x])\n",
72 new_end_pos, i_size_read(inode));
73 expanding_file = 1;
74 }
75 }
76 ecryptfs_printk(KERN_DEBUG, "new_end_pos = [0x%.16x]\n", new_end_pos);
77 if (expanding_file) {
78 rc = ecryptfs_truncate(file->f_path.dentry, new_end_pos);
79 if (rc) {
80 rv = rc;
81 ecryptfs_printk(KERN_ERR, "Error on attempt to "
82 "truncate to (higher) offset [0x%.16x];"
83 " rc = [%d]\n", new_end_pos, rc);
84 goto out;
85 }
86 }
87 rv = generic_file_llseek(file, offset, origin);
88out:
89 return rv;
90}
91
92/**
93 * ecryptfs_read_update_atime 36 * ecryptfs_read_update_atime
94 * 37 *
95 * generic_file_read updates the atime of upper layer inode. But, it 38 * generic_file_read updates the atime of upper layer inode. But, it
@@ -425,7 +368,7 @@ const struct file_operations ecryptfs_dir_fops = {
425}; 368};
426 369
427const struct file_operations ecryptfs_main_fops = { 370const struct file_operations ecryptfs_main_fops = {
428 .llseek = ecryptfs_llseek, 371 .llseek = generic_file_llseek,
429 .read = do_sync_read, 372 .read = do_sync_read,
430 .aio_read = ecryptfs_read_update_atime, 373 .aio_read = ecryptfs_read_update_atime,
431 .write = do_sync_write, 374 .write = do_sync_write,
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 88ea6697908f..55cec98a84e7 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -376,9 +376,31 @@ out:
376 return 0; 376 return 0;
377} 377}
378 378
379/**
380 * eCryptfs does not currently support holes. When writing after a
381 * seek past the end of the file, eCryptfs fills in 0's through to the
382 * current location. The code to fill in the 0's to all the
383 * intermediate pages calls ecryptfs_prepare_write_no_truncate().
384 */
385static int
386ecryptfs_prepare_write_no_truncate(struct file *file, struct page *page,
387 unsigned from, unsigned to)
388{
389 int rc = 0;
390
391 if (from == 0 && to == PAGE_CACHE_SIZE)
392 goto out; /* If we are writing a full page, it will be
393 up to date. */
394 if (!PageUptodate(page))
395 rc = ecryptfs_do_readpage(file, page, page->index);
396out:
397 return rc;
398}
399
379static int ecryptfs_prepare_write(struct file *file, struct page *page, 400static int ecryptfs_prepare_write(struct file *file, struct page *page,
380 unsigned from, unsigned to) 401 unsigned from, unsigned to)
381{ 402{
403 loff_t pos;
382 int rc = 0; 404 int rc = 0;
383 405
384 if (from == 0 && to == PAGE_CACHE_SIZE) 406 if (from == 0 && to == PAGE_CACHE_SIZE)
@@ -386,6 +408,16 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
386 up to date. */ 408 up to date. */
387 if (!PageUptodate(page)) 409 if (!PageUptodate(page))
388 rc = ecryptfs_do_readpage(file, page, page->index); 410 rc = ecryptfs_do_readpage(file, page, page->index);
411 pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
412 if (pos > i_size_read(page->mapping->host)) {
413 rc = ecryptfs_truncate(file->f_path.dentry, pos);
414 if (rc) {
415 printk(KERN_ERR "Error on attempt to "
416 "truncate to (higher) offset [%lld];"
417 " rc = [%d]\n", pos, rc);
418 goto out;
419 }
420 }
389out: 421out:
390 return rc; 422 return rc;
391} 423}
@@ -744,10 +776,10 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
744 rc = PTR_ERR(tmp_page); 776 rc = PTR_ERR(tmp_page);
745 goto out; 777 goto out;
746 } 778 }
747 rc = ecryptfs_prepare_write(file, tmp_page, start, start + num_zeros); 779 if ((rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start,
748 if (rc) { 780 (start + num_zeros)))) {
749 ecryptfs_printk(KERN_ERR, "Error preparing to write zero's " 781 ecryptfs_printk(KERN_ERR, "Error preparing to write zero's "
750 "to remainder of page at index [0x%.16x]\n", 782 "to page at index [0x%.16x]\n",
751 index); 783 index);
752 page_cache_release(tmp_page); 784 page_cache_release(tmp_page);
753 goto out; 785 goto out;
diff --git a/fs/exec.c b/fs/exec.c
index 0b685888ff6f..f20561ff4528 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -134,6 +134,9 @@ asmlinkage long sys_uselib(const char __user * library)
134 if (error) 134 if (error)
135 goto out; 135 goto out;
136 136
137 error = -EACCES;
138 if (nd.mnt->mnt_flags & MNT_NOEXEC)
139 goto exit;
137 error = -EINVAL; 140 error = -EINVAL;
138 if (!S_ISREG(nd.dentry->d_inode->i_mode)) 141 if (!S_ISREG(nd.dentry->d_inode->i_mode))
139 goto exit; 142 goto exit;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 8890eba1db52..bd5a772d8ccf 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -485,7 +485,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode,
485static int fuse_create(struct inode *dir, struct dentry *entry, int mode, 485static int fuse_create(struct inode *dir, struct dentry *entry, int mode,
486 struct nameidata *nd) 486 struct nameidata *nd)
487{ 487{
488 if (nd && (nd->flags & LOOKUP_CREATE)) { 488 if (nd && (nd->flags & LOOKUP_OPEN)) {
489 int err = fuse_create_open(dir, entry, mode, nd); 489 int err = fuse_create_open(dir, entry, mode, nd);
490 if (err != -ENOSYS) 490 if (err != -ENOSYS)
491 return err; 491 return err;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d0ed60bc3188..adf7995232b8 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -610,7 +610,9 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
610 ssize_t res; 610 ssize_t res;
611 /* Don't allow parallel writes to the same file */ 611 /* Don't allow parallel writes to the same file */
612 mutex_lock(&inode->i_mutex); 612 mutex_lock(&inode->i_mutex);
613 res = fuse_direct_io(file, buf, count, ppos, 1); 613 res = generic_write_checks(file, ppos, &count, 0);
614 if (!res)
615 res = fuse_direct_io(file, buf, count, ppos, 1);
614 mutex_unlock(&inode->i_mutex); 616 mutex_unlock(&inode->i_mutex);
615 return res; 617 return res;
616} 618}
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 78f7a1dc90dd..9804c0cdcb42 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -454,6 +454,7 @@ static const struct super_operations fuse_super_operations = {
454 .destroy_inode = fuse_destroy_inode, 454 .destroy_inode = fuse_destroy_inode,
455 .read_inode = fuse_read_inode, 455 .read_inode = fuse_read_inode,
456 .clear_inode = fuse_clear_inode, 456 .clear_inode = fuse_clear_inode,
457 .drop_inode = generic_delete_inode,
457 .remount_fs = fuse_remount_fs, 458 .remount_fs = fuse_remount_fs,
458 .put_super = fuse_put_super, 459 .put_super = fuse_put_super,
459 .umount_begin = fuse_umount_begin, 460 .umount_begin = fuse_umount_begin,
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 345aa5c0f382..0c542ec92d5b 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -122,19 +122,25 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_
122 return -EINVAL; 122 return -EINVAL;
123} 123}
124 124
125static void nfs_direct_dirty_pages(struct page **pages, int npages) 125static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, size_t count)
126{ 126{
127 int i; 127 unsigned int npages;
128 unsigned int i;
129
130 if (count == 0)
131 return;
132 pages += (pgbase >> PAGE_SHIFT);
133 npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
128 for (i = 0; i < npages; i++) { 134 for (i = 0; i < npages; i++) {
129 struct page *page = pages[i]; 135 struct page *page = pages[i];
130 if (!PageCompound(page)) 136 if (!PageCompound(page))
131 set_page_dirty_lock(page); 137 set_page_dirty(page);
132 } 138 }
133} 139}
134 140
135static void nfs_direct_release_pages(struct page **pages, int npages) 141static void nfs_direct_release_pages(struct page **pages, unsigned int npages)
136{ 142{
137 int i; 143 unsigned int i;
138 for (i = 0; i < npages; i++) 144 for (i = 0; i < npages; i++)
139 page_cache_release(pages[i]); 145 page_cache_release(pages[i]);
140} 146}
@@ -224,17 +230,18 @@ static void nfs_direct_read_result(struct rpc_task *task, void *calldata)
224 if (nfs_readpage_result(task, data) != 0) 230 if (nfs_readpage_result(task, data) != 0)
225 return; 231 return;
226 232
227 nfs_direct_dirty_pages(data->pagevec, data->npages);
228 nfs_direct_release_pages(data->pagevec, data->npages);
229
230 spin_lock(&dreq->lock); 233 spin_lock(&dreq->lock);
231 234 if (unlikely(task->tk_status < 0)) {
232 if (likely(task->tk_status >= 0))
233 dreq->count += data->res.count;
234 else
235 dreq->error = task->tk_status; 235 dreq->error = task->tk_status;
236 236 spin_unlock(&dreq->lock);
237 spin_unlock(&dreq->lock); 237 } else {
238 dreq->count += data->res.count;
239 spin_unlock(&dreq->lock);
240 nfs_direct_dirty_pages(data->pagevec,
241 data->args.pgbase,
242 data->res.count);
243 }
244 nfs_direct_release_pages(data->pagevec, data->npages);
238 245
239 if (put_dreq(dreq)) 246 if (put_dreq(dreq))
240 nfs_direct_complete(dreq); 247 nfs_direct_complete(dreq);
@@ -279,9 +286,12 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
279 result = get_user_pages(current, current->mm, user_addr, 286 result = get_user_pages(current, current->mm, user_addr,
280 data->npages, 1, 0, data->pagevec, NULL); 287 data->npages, 1, 0, data->pagevec, NULL);
281 up_read(&current->mm->mmap_sem); 288 up_read(&current->mm->mmap_sem);
282 if (unlikely(result < data->npages)) { 289 if (result < 0) {
283 if (result > 0) 290 nfs_readdata_release(data);
284 nfs_direct_release_pages(data->pagevec, result); 291 break;
292 }
293 if ((unsigned)result < data->npages) {
294 nfs_direct_release_pages(data->pagevec, result);
285 nfs_readdata_release(data); 295 nfs_readdata_release(data);
286 break; 296 break;
287 } 297 }
@@ -610,9 +620,12 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
610 result = get_user_pages(current, current->mm, user_addr, 620 result = get_user_pages(current, current->mm, user_addr,
611 data->npages, 0, 0, data->pagevec, NULL); 621 data->npages, 0, 0, data->pagevec, NULL);
612 up_read(&current->mm->mmap_sem); 622 up_read(&current->mm->mmap_sem);
613 if (unlikely(result < data->npages)) { 623 if (result < 0) {
614 if (result > 0) 624 nfs_writedata_release(data);
615 nfs_direct_release_pages(data->pagevec, result); 625 break;
626 }
627 if ((unsigned)result < data->npages) {
628 nfs_direct_release_pages(data->pagevec, result);
616 nfs_writedata_release(data); 629 nfs_writedata_release(data);
617 break; 630 break;
618 } 631 }
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index cbdd1c6aaa94..c5bb51a29e80 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -355,6 +355,26 @@ void nfs_pageio_complete(struct nfs_pageio_descriptor *desc)
355 nfs_pageio_doio(desc); 355 nfs_pageio_doio(desc);
356} 356}
357 357
358/**
359 * nfs_pageio_cond_complete - Conditional I/O completion
360 * @desc: pointer to io descriptor
361 * @index: page index
362 *
363 * It is important to ensure that processes don't try to take locks
364 * on non-contiguous ranges of pages as that might deadlock. This
365 * function should be called before attempting to wait on a locked
366 * nfs_page. It will complete the I/O if the page index 'index'
367 * is not contiguous with the existing list of pages in 'desc'.
368 */
369void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
370{
371 if (!list_empty(&desc->pg_list)) {
372 struct nfs_page *prev = nfs_list_entry(desc->pg_list.prev);
373 if (index != prev->wb_index + 1)
374 nfs_pageio_doio(desc);
375 }
376}
377
358#define NFS_SCAN_MAXENTRIES 16 378#define NFS_SCAN_MAXENTRIES 16
359/** 379/**
360 * nfs_scan_list - Scan a list for matching requests 380 * nfs_scan_list - Scan a list for matching requests
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b084c03ce493..af344a158e01 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -273,8 +273,6 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
273 * request as dirty (in which case we don't care). 273 * request as dirty (in which case we don't care).
274 */ 274 */
275 spin_unlock(req_lock); 275 spin_unlock(req_lock);
276 /* Prevent deadlock! */
277 nfs_pageio_complete(pgio);
278 ret = nfs_wait_on_request(req); 276 ret = nfs_wait_on_request(req);
279 nfs_release_request(req); 277 nfs_release_request(req);
280 if (ret != 0) 278 if (ret != 0)
@@ -321,6 +319,8 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc
321 pgio = &mypgio; 319 pgio = &mypgio;
322 } 320 }
323 321
322 nfs_pageio_cond_complete(pgio, page->index);
323
324 err = nfs_page_async_flush(pgio, page); 324 err = nfs_page_async_flush(pgio, page);
325 if (err <= 0) 325 if (err <= 0)
326 goto out; 326 goto out;
@@ -329,6 +329,8 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc
329 if (!offset) 329 if (!offset)
330 goto out; 330 goto out;
331 331
332 nfs_pageio_cond_complete(pgio, page->index);
333
332 ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE); 334 ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE);
333 if (ctx == NULL) { 335 if (ctx == NULL) {
334 err = -EBADF; 336 err = -EBADF;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 8e7cafb5fc6c..0023b31e48a8 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -222,7 +222,10 @@ static int ocfs2_readpage(struct file *file, struct page *page)
222 goto out; 222 goto out;
223 } 223 }
224 224
225 down_read(&OCFS2_I(inode)->ip_alloc_sem); 225 if (down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem) == 0) {
226 ret = AOP_TRUNCATED_PAGE;
227 goto out_meta_unlock;
228 }
226 229
227 /* 230 /*
228 * i_size might have just been updated as we grabed the meta lock. We 231 * i_size might have just been updated as we grabed the meta lock. We
@@ -235,10 +238,7 @@ static int ocfs2_readpage(struct file *file, struct page *page)
235 * XXX sys_readahead() seems to get that wrong? 238 * XXX sys_readahead() seems to get that wrong?
236 */ 239 */
237 if (start >= i_size_read(inode)) { 240 if (start >= i_size_read(inode)) {
238 char *addr = kmap(page); 241 zero_user_page(page, 0, PAGE_SIZE, KM_USER0);
239 memset(addr, 0, PAGE_SIZE);
240 flush_dcache_page(page);
241 kunmap(page);
242 SetPageUptodate(page); 242 SetPageUptodate(page);
243 ret = 0; 243 ret = 0;
244 goto out_alloc; 244 goto out_alloc;
@@ -258,6 +258,7 @@ static int ocfs2_readpage(struct file *file, struct page *page)
258 ocfs2_data_unlock(inode, 0); 258 ocfs2_data_unlock(inode, 0);
259out_alloc: 259out_alloc:
260 up_read(&OCFS2_I(inode)->ip_alloc_sem); 260 up_read(&OCFS2_I(inode)->ip_alloc_sem);
261out_meta_unlock:
261 ocfs2_meta_unlock(inode, 0); 262 ocfs2_meta_unlock(inode, 0);
262out: 263out:
263 if (unlock) 264 if (unlock)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 9395b4fa547d..ac6c96431bbc 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -326,6 +326,7 @@ static int ocfs2_truncate_file(struct inode *inode,
326 (unsigned long long)OCFS2_I(inode)->ip_blkno, 326 (unsigned long long)OCFS2_I(inode)->ip_blkno,
327 (unsigned long long)new_i_size); 327 (unsigned long long)new_i_size);
328 328
329 unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1);
329 truncate_inode_pages(inode->i_mapping, new_i_size); 330 truncate_inode_pages(inode->i_mapping, new_i_size);
330 331
331 fe = (struct ocfs2_dinode *) di_bh->b_data; 332 fe = (struct ocfs2_dinode *) di_bh->b_data;
@@ -1418,36 +1419,6 @@ out:
1418 return total ? total : ret; 1419 return total ? total : ret;
1419} 1420}
1420 1421
1421static int ocfs2_check_iovec(const struct iovec *iov, size_t *counted,
1422 unsigned long *nr_segs)
1423{
1424 size_t ocount; /* original count */
1425 unsigned long seg;
1426
1427 ocount = 0;
1428 for (seg = 0; seg < *nr_segs; seg++) {
1429 const struct iovec *iv = &iov[seg];
1430
1431 /*
1432 * If any segment has a negative length, or the cumulative
1433 * length ever wraps negative then return -EINVAL.
1434 */
1435 ocount += iv->iov_len;
1436 if (unlikely((ssize_t)(ocount|iv->iov_len) < 0))
1437 return -EINVAL;
1438 if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len))
1439 continue;
1440 if (seg == 0)
1441 return -EFAULT;
1442 *nr_segs = seg;
1443 ocount -= iv->iov_len; /* This segment is no good */
1444 break;
1445 }
1446
1447 *counted = ocount;
1448 return 0;
1449}
1450
1451static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, 1422static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1452 const struct iovec *iov, 1423 const struct iovec *iov,
1453 unsigned long nr_segs, 1424 unsigned long nr_segs,
@@ -1470,7 +1441,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1470 if (iocb->ki_left == 0) 1441 if (iocb->ki_left == 0)
1471 return 0; 1442 return 0;
1472 1443
1473 ret = ocfs2_check_iovec(iov, &ocount, &nr_segs); 1444 ret = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
1474 if (ret) 1445 if (ret)
1475 return ret; 1446 return ret;
1476 1447
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 4dedd9789108..545f7892cdf3 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -471,9 +471,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
471 471
472 mutex_lock(&local_alloc_inode->i_mutex); 472 mutex_lock(&local_alloc_inode->i_mutex);
473 473
474 ac->ac_inode = local_alloc_inode;
475 ac->ac_which = OCFS2_AC_USE_LOCAL;
476
477 if (osb->local_alloc_state != OCFS2_LA_ENABLED) { 474 if (osb->local_alloc_state != OCFS2_LA_ENABLED) {
478 status = -ENOSPC; 475 status = -ENOSPC;
479 goto bail; 476 goto bail;
@@ -511,10 +508,14 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
511 } 508 }
512 } 509 }
513 510
511 ac->ac_inode = local_alloc_inode;
512 ac->ac_which = OCFS2_AC_USE_LOCAL;
514 get_bh(osb->local_alloc_bh); 513 get_bh(osb->local_alloc_bh);
515 ac->ac_bh = osb->local_alloc_bh; 514 ac->ac_bh = osb->local_alloc_bh;
516 status = 0; 515 status = 0;
517bail: 516bail:
517 if (status < 0 && local_alloc_inode)
518 iput(local_alloc_inode);
518 519
519 mlog_exit(status); 520 mlog_exit(status);
520 return status; 521 return status;
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 9c23fee3bae9..ffbfc2caaf20 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -10,7 +10,7 @@
10#include <linux/buffer_head.h> 10#include <linux/buffer_head.h>
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12 12
13extern struct reiserfs_key MIN_KEY; 13extern const struct reiserfs_key MIN_KEY;
14 14
15static int reiserfs_readdir(struct file *, void *, filldir_t); 15static int reiserfs_readdir(struct file *, void *, filldir_t);
16static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, 16static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 7cfeab412b45..f1da89203a9a 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -11,6 +11,8 @@
11 * Now using anonymous inode source. 11 * Now using anonymous inode source.
12 * Thanks to Oleg Nesterov for useful code review and suggestions. 12 * Thanks to Oleg Nesterov for useful code review and suggestions.
13 * More comments and suggestions from Arnd Bergmann. 13 * More comments and suggestions from Arnd Bergmann.
14 * Sat May 19, 2007: Davi E. M. Arnaut <davi@haxent.com.br>
15 * Retrieve multiple signals with one read() call
14 */ 16 */
15 17
16#include <linux/file.h> 18#include <linux/file.h>
@@ -206,6 +208,59 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
206 return err ? -EFAULT: sizeof(*uinfo); 208 return err ? -EFAULT: sizeof(*uinfo);
207} 209}
208 210
211static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, siginfo_t *info,
212 int nonblock)
213{
214 ssize_t ret;
215 struct signalfd_lockctx lk;
216 DECLARE_WAITQUEUE(wait, current);
217
218 if (!signalfd_lock(ctx, &lk))
219 return 0;
220
221 ret = dequeue_signal(lk.tsk, &ctx->sigmask, info);
222 switch (ret) {
223 case 0:
224 if (!nonblock)
225 break;
226 ret = -EAGAIN;
227 default:
228 signalfd_unlock(&lk);
229 return ret;
230 }
231
232 add_wait_queue(&ctx->wqh, &wait);
233 for (;;) {
234 set_current_state(TASK_INTERRUPTIBLE);
235 ret = dequeue_signal(lk.tsk, &ctx->sigmask, info);
236 signalfd_unlock(&lk);
237 if (ret != 0)
238 break;
239 if (signal_pending(current)) {
240 ret = -ERESTARTSYS;
241 break;
242 }
243 schedule();
244 ret = signalfd_lock(ctx, &lk);
245 if (unlikely(!ret)) {
246 /*
247 * Let the caller read zero byte, ala socket
248 * recv() when the peer disconnect. This test
249 * must be done before doing a dequeue_signal(),
250 * because if the sighand has been orphaned,
251 * the dequeue_signal() call is going to crash
252 * because ->sighand will be long gone.
253 */
254 break;
255 }
256 }
257
258 remove_wait_queue(&ctx->wqh, &wait);
259 __set_current_state(TASK_RUNNING);
260
261 return ret;
262}
263
209/* 264/*
210 * Returns either the size of a "struct signalfd_siginfo", or zero if the 265 * Returns either the size of a "struct signalfd_siginfo", or zero if the
211 * sighand we are attached to, has been orphaned. The "count" parameter 266 * sighand we are attached to, has been orphaned. The "count" parameter
@@ -215,55 +270,30 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count,
215 loff_t *ppos) 270 loff_t *ppos)
216{ 271{
217 struct signalfd_ctx *ctx = file->private_data; 272 struct signalfd_ctx *ctx = file->private_data;
218 ssize_t res = 0; 273 struct signalfd_siginfo __user *siginfo;
219 int locked, signo; 274 int nonblock = file->f_flags & O_NONBLOCK;
275 ssize_t ret, total = 0;
220 siginfo_t info; 276 siginfo_t info;
221 struct signalfd_lockctx lk;
222 DECLARE_WAITQUEUE(wait, current);
223 277
224 if (count < sizeof(struct signalfd_siginfo)) 278 count /= sizeof(struct signalfd_siginfo);
279 if (!count)
225 return -EINVAL; 280 return -EINVAL;
226 locked = signalfd_lock(ctx, &lk);
227 if (!locked)
228 return 0;
229 res = -EAGAIN;
230 signo = dequeue_signal(lk.tsk, &ctx->sigmask, &info);
231 if (signo == 0 && !(file->f_flags & O_NONBLOCK)) {
232 add_wait_queue(&ctx->wqh, &wait);
233 for (;;) {
234 set_current_state(TASK_INTERRUPTIBLE);
235 signo = dequeue_signal(lk.tsk, &ctx->sigmask, &info);
236 if (signo != 0)
237 break;
238 if (signal_pending(current)) {
239 res = -ERESTARTSYS;
240 break;
241 }
242 signalfd_unlock(&lk);
243 schedule();
244 locked = signalfd_lock(ctx, &lk);
245 if (unlikely(!locked)) {
246 /*
247 * Let the caller read zero byte, ala socket
248 * recv() when the peer disconnect. This test
249 * must be done before doing a dequeue_signal(),
250 * because if the sighand has been orphaned,
251 * the dequeue_signal() call is going to crash.
252 */
253 res = 0;
254 break;
255 }
256 }
257 remove_wait_queue(&ctx->wqh, &wait);
258 __set_current_state(TASK_RUNNING);
259 }
260 if (likely(locked))
261 signalfd_unlock(&lk);
262 if (likely(signo))
263 res = signalfd_copyinfo((struct signalfd_siginfo __user *) buf,
264 &info);
265 281
266 return res; 282 siginfo = (struct signalfd_siginfo __user *) buf;
283
284 do {
285 ret = signalfd_dequeue(ctx, &info, nonblock);
286 if (unlikely(ret <= 0))
287 break;
288 ret = signalfd_copyinfo(siginfo, &info);
289 if (ret < 0)
290 break;
291 siginfo++;
292 total += ret;
293 nonblock = 1;
294 } while (--count);
295
296 return total ? total : ret;
267} 297}
268 298
269static const struct file_operations signalfd_fops = { 299static const struct file_operations signalfd_fops = {
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 14fae1fa87df..7f30cce52857 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -35,7 +35,7 @@ struct bug_entry {
35#define WARN_ON(condition) ({ \ 35#define WARN_ON(condition) ({ \
36 typeof(condition) __ret_warn_on = (condition); \ 36 typeof(condition) __ret_warn_on = (condition); \
37 if (unlikely(__ret_warn_on)) { \ 37 if (unlikely(__ret_warn_on)) { \
38 printk("BUG: at %s:%d %s()\n", __FILE__, \ 38 printk("WARNING: at %s:%d %s()\n", __FILE__, \
39 __LINE__, __FUNCTION__); \ 39 __LINE__, __FUNCTION__); \
40 dump_stack(); \ 40 dump_stack(); \
41 } \ 41 } \
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index 0baa2f89463c..437aac801711 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -182,7 +182,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
182 int __i; 182 int __i;
183#ifdef CONFIG_M386 183#ifdef CONFIG_M386
184 unsigned long flags; 184 unsigned long flags;
185 if(unlikely(boot_cpu_data.x86==3)) 185 if(unlikely(boot_cpu_data.x86 <= 3))
186 goto no_xadd; 186 goto no_xadd;
187#endif 187#endif
188 /* Modern 486+ processor */ 188 /* Modern 486+ processor */
diff --git a/include/asm-i386/local.h b/include/asm-i386/local.h
index e13d3e98823f..6e85975b9ed2 100644
--- a/include/asm-i386/local.h
+++ b/include/asm-i386/local.h
@@ -135,7 +135,7 @@ static __inline__ long local_add_return(long i, local_t *l)
135 long __i; 135 long __i;
136#ifdef CONFIG_M386 136#ifdef CONFIG_M386
137 unsigned long flags; 137 unsigned long flags;
138 if(unlikely(boot_cpu_data.x86==3)) 138 if(unlikely(boot_cpu_data.x86 <= 3))
139 goto no_xadd; 139 goto no_xadd;
140#endif 140#endif
141 /* Modern 486+ processor */ 141 /* Modern 486+ processor */
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 5d03792d4f65..5b526357d178 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -30,6 +30,8 @@
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33#include <acpi/pdc_intel.h>
34
33#include <linux/init.h> 35#include <linux/init.h>
34#include <linux/numa.h> 36#include <linux/numa.h>
35#include <asm/system.h> 37#include <asm/system.h>
@@ -119,11 +121,6 @@ extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
119extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 121extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
120#endif 122#endif
121 123
122/*
123 * Refer Intel ACPI _PDC support document for bit definitions
124 */
125#define ACPI_PDC_EST_CAPABILITY_SMP 0x8
126
127#endif /*__KERNEL__*/ 124#endif /*__KERNEL__*/
128 125
129#endif /*_ASM_ACPI_H*/ 126#endif /*_ASM_ACPI_H*/
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index d7781a2ddefe..441c9e001776 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -305,6 +305,19 @@
305 305
306#define NR_syscalls 286 /* length of syscall table */ 306#define NR_syscalls 286 /* length of syscall table */
307 307
308/*
309 * The following defines stop scripts/checksyscalls.sh from complaining about
310 * unimplemented system calls. Glibc provides for each of these by using
311 * more modern equivalent system calls.
312 */
313#define __IGNORE_fork /* clone() */
314#define __IGNORE_time /* gettimeofday() */
315#define __IGNORE_alarm /* setitimer(ITIMER_REAL, ... */
316#define __IGNORE_pause /* rt_sigprocmask(), rt_sigsuspend() */
317#define __IGNORE_utime /* utimes() */
318#define __IGNORE_getpgrp /* getpgid() */
319#define __IGNORE_vfork /* clone() */
320
308#define __ARCH_WANT_SYS_RT_SIGACTION 321#define __ARCH_WANT_SYS_RT_SIGACTION
309#define __ARCH_WANT_SYS_RT_SIGSUSPEND 322#define __ARCH_WANT_SYS_RT_SIGSUSPEND
310 323
diff --git a/include/asm-sh/dreamcast/sysasic.h b/include/asm-sh/dreamcast/sysasic.h
index 7874e3dac736..f33426608a87 100644
--- a/include/asm-sh/dreamcast/sysasic.h
+++ b/include/asm-sh/dreamcast/sysasic.h
@@ -23,7 +23,7 @@
23 takes. 23 takes.
24*/ 24*/
25 25
26#define HW_EVENT_IRQ_BASE OFFCHIP_IRQ_BASE /* 48 */ 26#define HW_EVENT_IRQ_BASE 48
27 27
28/* IRQ 13 */ 28/* IRQ 13 */
29#define HW_EVENT_VSYNC (HW_EVENT_IRQ_BASE + 5) /* VSync */ 29#define HW_EVENT_VSYNC (HW_EVENT_IRQ_BASE + 5) /* VSync */
diff --git a/include/asm-sh/kdebug.h b/include/asm-sh/kdebug.h
index 16578b7c9da1..382cfc7deb73 100644
--- a/include/asm-sh/kdebug.h
+++ b/include/asm-sh/kdebug.h
@@ -6,10 +6,6 @@
6/* Grossly misnamed. */ 6/* Grossly misnamed. */
7enum die_val { 7enum die_val {
8 DIE_TRAP, 8 DIE_TRAP,
9 DIE_PAGE_FAULT,
10}; 9};
11 10
12int register_page_fault_notifier(struct notifier_block *nb);
13int unregister_page_fault_notifier(struct notifier_block *nb);
14
15#endif /* __ASM_SH_KDEBUG_H */ 11#endif /* __ASM_SH_KDEBUG_H */
diff --git a/include/asm-sh/landisk/gio.h b/include/asm-sh/landisk/gio.h
index 3fce4c451a46..35d7368b718a 100644
--- a/include/asm-sh/landisk/gio.h
+++ b/include/asm-sh/landisk/gio.h
@@ -29,16 +29,8 @@
29#define GIODRV_IOCGGIODATA4 _IOR(GIODRV_IOC_MAGIC, 6, unsigned long *) 29#define GIODRV_IOCGGIODATA4 _IOR(GIODRV_IOC_MAGIC, 6, unsigned long *)
30#define GIODRV_IOCSGIOSETADDR _IOW(GIODRV_IOC_MAGIC, 7, unsigned long *) 30#define GIODRV_IOCSGIOSETADDR _IOW(GIODRV_IOC_MAGIC, 7, unsigned long *)
31#define GIODRV_IOCHARDRESET _IO(GIODRV_IOC_MAGIC, 8) /* debugging tool */ 31#define GIODRV_IOCHARDRESET _IO(GIODRV_IOC_MAGIC, 8) /* debugging tool */
32
33#define GIODRV_IOCSGIO_LED _IOW(GIODRV_IOC_MAGIC, 9, unsigned long *)
34#define GIODRV_IOCGGIO_LED _IOR(GIODRV_IOC_MAGIC, 10, unsigned long *)
35#define GIODRV_IOCSGIO_BUZZER _IOW(GIODRV_IOC_MAGIC, 11, unsigned long *)
36#define GIODRV_IOCGGIO_LANDISK _IOR(GIODRV_IOC_MAGIC, 14, unsigned long *)
37#define GIODRV_IOCGGIO_BTN _IOR(GIODRV_IOC_MAGIC, 22, unsigned long *)
38#define GIODRV_IOCSGIO_BTNPID _IOW(GIODRV_IOC_MAGIC, 23, unsigned long *)
39#define GIODRV_IOCGGIO_BTNPID _IOR(GIODRV_IOC_MAGIC, 24, unsigned long *)
40
41#define GIODRV_IOC_MAXNR 8 32#define GIODRV_IOC_MAXNR 8
33
42#define GIO_READ 0x00000000 34#define GIO_READ 0x00000000
43#define GIO_WRITE 0x00000001 35#define GIO_WRITE 0x00000001
44 36
diff --git a/include/asm-sh/landisk/iodata_landisk.h b/include/asm-sh/landisk/iodata_landisk.h
index c74d3c73f377..6fb04ab38b9f 100644
--- a/include/asm-sh/landisk/iodata_landisk.h
+++ b/include/asm-sh/landisk/iodata_landisk.h
@@ -22,16 +22,6 @@
22/* 2003.10.31 I-O DATA NSD NWG add. for shutdown port clear */ 22/* 2003.10.31 I-O DATA NSD NWG add. for shutdown port clear */
23#define PA_PWRINT_CLR 0xb0000006 /* Shutdown Interrupt clear Register */ 23#define PA_PWRINT_CLR 0xb0000006 /* Shutdown Interrupt clear Register */
24 24
25#define PA_LCD_CLRDSP 0x00 /* LCD Clear Display Offset */
26#define PA_LCD_RTNHOME 0x00 /* LCD Return Home Offset */
27#define PA_LCD_ENTMODE 0x00 /* LCD Entry Mode Offset */
28#define PA_LCD_DSPCTL 0x00 /* LCD Display ON/OFF Control Offset */
29#define PA_LCD_FUNC 0x00 /* LCD Function Set Offset */
30#define PA_LCD_CGRAM 0x00 /* LCD Set CGRAM Address Offset */
31#define PA_LCD_DDRAM 0x00 /* LCD Set DDRAM Address Offset */
32#define PA_LCD_RDFLAG 0x01 /* LCD Read Busy Flag Offset */
33#define PA_LCD_WTDATA 0x02 /* LCD Write Datat to RAM Offset */
34#define PA_LCD_RDDATA 0x03 /* LCD Read Data from RAM Offset */
35#define PA_PIDE_OFFSET 0x40 /* CF IDE Offset */ 25#define PA_PIDE_OFFSET 0x40 /* CF IDE Offset */
36#define PA_SIDE_OFFSET 0x40 /* HDD IDE Offset */ 26#define PA_SIDE_OFFSET 0x40 /* HDD IDE Offset */
37 27
@@ -45,33 +35,6 @@
45#define IRQ_BUTTON 12 /* USL-5P Button IRQ */ 35#define IRQ_BUTTON 12 /* USL-5P Button IRQ */
46#define IRQ_FAULT 13 /* USL-5P Fault IRQ */ 36#define IRQ_FAULT 13 /* USL-5P Fault IRQ */
47 37
48#define SHUTDOWN_BTN_MAJOR 99 /* Shutdown button device major no. */
49
50#define SHUTDOWN_LOOP_CNT 5 /* Shutdown button Detection loop */
51#define SHUTDOWN_DELAY 200 /* Shutdown button delay value(ms) */
52
53
54/* added by kogiidena */
55/*
56 * landisk_ledparam
57 *
58 * led ------10 -6543210 -6543210 -6543210
59 * |000000..|0.......|0.......|U.......|
60 * | HARD |fastblik| blink | on |
61 *
62 * led0: power U:update flag
63 * led1: error
64 * led2: usb1
65 * led3: usb2
66 * led4: usb3
67 * led5: usb4
68 * led6: usb5
69 *
70 */
71extern int landisk_ledparam; /* from setup.c */
72extern int landisk_buzzerparam; /* from setup.c */
73extern int landisk_arch; /* from setup.c */
74
75#define __IO_PREFIX landisk 38#define __IO_PREFIX landisk
76#include <asm/io_generic.h> 39#include <asm/io_generic.h>
77 40
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index af71e379a5ee..77bcb09d6ac8 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -329,8 +329,11 @@
329#define __NR_getcpu 318 329#define __NR_getcpu 318
330#define __NR_epoll_pwait 319 330#define __NR_epoll_pwait 319
331#define __NR_utimensat 320 331#define __NR_utimensat 320
332#define __NR_signalfd 321
333#define __NR_timerfd 322
334#define __NR_eventfd 323
332 335
333#define NR_syscalls 321 336#define NR_syscalls 324
334 337
335#ifdef __KERNEL__ 338#ifdef __KERNEL__
336 339
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 6548b35ab9f6..bbf8df7de28f 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -16,6 +16,8 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18 18
19struct task_struct;
20
19/* User-level do most of the mapping between kernel and user 21/* User-level do most of the mapping between kernel and user
20 capabilities based on the version tag given by the kernel. The 22 capabilities based on the version tag given by the kernel. The
21 kernel might be somewhat backwards compatible, but don't bet on 23 kernel might be somewhat backwards compatible, but don't bet on
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 5e75e26d4787..4631086f5060 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -37,25 +37,25 @@ static inline void do_not_freeze(struct task_struct *p)
37 37
38/* 38/*
39 * Wake up a frozen process 39 * Wake up a frozen process
40 *
41 * task_lock() is taken to prevent the race with refrigerator() which may
42 * occur if the freezing of tasks fails. Namely, without the lock, if the
43 * freezing of tasks failed, thaw_tasks() might have run before a task in
44 * refrigerator() could call frozen_process(), in which case the task would be
45 * frozen and no one would thaw it.
40 */ 46 */
41static inline int thaw_process(struct task_struct *p) 47static inline int thaw_process(struct task_struct *p)
42{ 48{
49 task_lock(p);
43 if (frozen(p)) { 50 if (frozen(p)) {
44 p->flags &= ~PF_FROZEN; 51 p->flags &= ~PF_FROZEN;
52 task_unlock(p);
45 wake_up_process(p); 53 wake_up_process(p);
46 return 1; 54 return 1;
47 } 55 }
48 return 0;
49}
50
51/*
52 * freezing is complete, mark process as frozen
53 */
54static inline void frozen_process(struct task_struct *p)
55{
56 p->flags |= PF_FROZEN;
57 wmb();
58 clear_tsk_thread_flag(p, TIF_FREEZE); 56 clear_tsk_thread_flag(p, TIF_FREEZE);
57 task_unlock(p);
58 return 0;
59} 59}
60 60
61extern void refrigerator(void); 61extern void refrigerator(void);
@@ -71,14 +71,55 @@ static inline int try_to_freeze(void)
71 return 0; 71 return 0;
72} 72}
73 73
74extern void thaw_some_processes(int all); 74/*
75 * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it
76 * calls wait_for_completion(&vfork) and reset right after it returns from this
77 * function. Next, the parent should call try_to_freeze() to freeze itself
78 * appropriately in case the child has exited before the freezing of tasks is
79 * complete. However, we don't want kernel threads to be frozen in unexpected
80 * places, so we allow them to block freeze_processes() instead or to set
81 * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork
82 * parents. Fortunately, in the ____call_usermodehelper() case the parent won't
83 * really block freeze_processes(), since ____call_usermodehelper() (the child)
84 * does a little before exec/exit and it can't be frozen before waking up the
85 * parent.
86 */
87
88/*
89 * If the current task is a user space one, tell the freezer not to count it as
90 * freezable.
91 */
92static inline void freezer_do_not_count(void)
93{
94 if (current->mm)
95 current->flags |= PF_FREEZER_SKIP;
96}
97
98/*
99 * If the current task is a user space one, tell the freezer to count it as
100 * freezable again and try to freeze it.
101 */
102static inline void freezer_count(void)
103{
104 if (current->mm) {
105 current->flags &= ~PF_FREEZER_SKIP;
106 try_to_freeze();
107 }
108}
109
110/*
111 * Check if the task should be counted as freezeable by the freezer
112 */
113static inline int freezer_should_skip(struct task_struct *p)
114{
115 return !!(p->flags & PF_FREEZER_SKIP);
116}
75 117
76#else 118#else
77static inline int frozen(struct task_struct *p) { return 0; } 119static inline int frozen(struct task_struct *p) { return 0; }
78static inline int freezing(struct task_struct *p) { return 0; } 120static inline int freezing(struct task_struct *p) { return 0; }
79static inline void freeze(struct task_struct *p) { BUG(); } 121static inline void freeze(struct task_struct *p) { BUG(); }
80static inline int thaw_process(struct task_struct *p) { return 1; } 122static inline int thaw_process(struct task_struct *p) { return 1; }
81static inline void frozen_process(struct task_struct *p) { BUG(); }
82 123
83static inline void refrigerator(void) {} 124static inline void refrigerator(void) {}
84static inline int freeze_processes(void) { BUG(); return 0; } 125static inline int freeze_processes(void) { BUG(); return 0; }
@@ -86,5 +127,7 @@ static inline void thaw_processes(void) {}
86 127
87static inline int try_to_freeze(void) { return 0; } 128static inline int try_to_freeze(void) { return 0; }
88 129
89 130static inline void freezer_do_not_count(void) {}
131static inline void freezer_count(void) {}
132static inline int freezer_should_skip(struct task_struct *p) { return 0; }
90#endif 133#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4c03ee353e78..9756fc102a83 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -66,6 +66,7 @@ struct partition {
66#include <linux/smp.h> 66#include <linux/smp.h>
67#include <linux/string.h> 67#include <linux/string.h>
68#include <linux/fs.h> 68#include <linux/fs.h>
69#include <linux/workqueue.h>
69 70
70struct partition { 71struct partition {
71 unsigned char boot_ind; /* 0x80 - active */ 72 unsigned char boot_ind; /* 0x80 - active */
@@ -94,6 +95,7 @@ struct hd_struct {
94 95
95#define GENHD_FL_REMOVABLE 1 96#define GENHD_FL_REMOVABLE 1
96#define GENHD_FL_DRIVERFS 2 97#define GENHD_FL_DRIVERFS 2
98#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
97#define GENHD_FL_CD 8 99#define GENHD_FL_CD 8
98#define GENHD_FL_UP 16 100#define GENHD_FL_UP 16
99#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 101#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
@@ -138,6 +140,7 @@ struct gendisk {
138#else 140#else
139 struct disk_stats dkstats; 141 struct disk_stats dkstats;
140#endif 142#endif
143 struct work_struct async_notify;
141}; 144};
142 145
143/* Structure for sysfs attributes on block devices */ 146/* Structure for sysfs attributes on block devices */
@@ -419,7 +422,7 @@ extern struct gendisk *alloc_disk_node(int minors, int node_id);
419extern struct gendisk *alloc_disk(int minors); 422extern struct gendisk *alloc_disk(int minors);
420extern struct kobject *get_disk(struct gendisk *disk); 423extern struct kobject *get_disk(struct gendisk *disk);
421extern void put_disk(struct gendisk *disk); 424extern void put_disk(struct gendisk *disk);
422 425extern void genhd_media_change_notify(struct gendisk *disk);
423extern void blk_register_region(dev_t dev, unsigned long range, 426extern void blk_register_region(dev_t dev, unsigned long range,
424 struct module *module, 427 struct module *module,
425 struct kobject *(*probe)(dev_t, int *, void *), 428 struct kobject *(*probe)(dev_t, int *, void *),
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index 81453ea7e4c2..b7c360ffd0d0 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -37,8 +37,7 @@ extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
37 enum nf_ct_ftp_type type, 37 enum nf_ct_ftp_type type,
38 unsigned int matchoff, 38 unsigned int matchoff,
39 unsigned int matchlen, 39 unsigned int matchlen,
40 struct nf_conntrack_expect *exp, 40 struct nf_conntrack_expect *exp);
41 u32 *seq);
42#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
43 42
44#endif /* _NF_CONNTRACK_FTP_H */ 43#endif /* _NF_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index 38d74d5c9700..f35b6b4801e7 100644
--- a/include/linux/netfilter/nf_conntrack_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -1,4 +1,4 @@
1/* Generated by Jing Min Zhao's ASN.1 parser, Apr 20 2006 1/* Generated by Jing Min Zhao's ASN.1 parser, May 16 2007
2 * 2 *
3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> 3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
4 * 4 *
@@ -12,7 +12,7 @@ typedef struct TransportAddress_ipAddress { /* SEQUENCE */
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */ 13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */ 14 int options; /* No use */
15 unsigned ip6; 15 unsigned ip;
16} TransportAddress_ip6Address; 16} TransportAddress_ip6Address;
17 17
18typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
@@ -364,23 +364,6 @@ typedef struct Alerting_UUIE { /* SEQUENCE */
364 Alerting_UUIE_fastStart fastStart; 364 Alerting_UUIE_fastStart fastStart;
365} Alerting_UUIE; 365} Alerting_UUIE;
366 366
367typedef struct Information_UUIE_fastStart { /* SEQUENCE OF */
368 int count;
369 OpenLogicalChannel item[30];
370} Information_UUIE_fastStart;
371
372typedef struct Information_UUIE { /* SEQUENCE */
373 enum {
374 eInformation_UUIE_callIdentifier = (1 << 31),
375 eInformation_UUIE_tokens = (1 << 30),
376 eInformation_UUIE_cryptoTokens = (1 << 29),
377 eInformation_UUIE_fastStart = (1 << 28),
378 eInformation_UUIE_fastConnectRefused = (1 << 27),
379 eInformation_UUIE_circuitInfo = (1 << 26),
380 } options;
381 Information_UUIE_fastStart fastStart;
382} Information_UUIE;
383
384typedef struct FacilityReason { /* CHOICE */ 367typedef struct FacilityReason { /* CHOICE */
385 enum { 368 enum {
386 eFacilityReason_routeCallToGatekeeper, 369 eFacilityReason_routeCallToGatekeeper,
@@ -471,7 +454,6 @@ typedef struct H323_UU_PDU_h323_message_body { /* CHOICE */
471 CallProceeding_UUIE callProceeding; 454 CallProceeding_UUIE callProceeding;
472 Connect_UUIE connect; 455 Connect_UUIE connect;
473 Alerting_UUIE alerting; 456 Alerting_UUIE alerting;
474 Information_UUIE information;
475 Facility_UUIE facility; 457 Facility_UUIE facility;
476 Progress_UUIE progress; 458 Progress_UUIE progress;
477 }; 459 };
@@ -561,6 +543,7 @@ typedef struct OpenLogicalChannelAck { /* SEQUENCE */
561 } options; 543 } options;
562 OpenLogicalChannelAck_reverseLogicalChannelParameters 544 OpenLogicalChannelAck_reverseLogicalChannelParameters
563 reverseLogicalChannelParameters; 545 reverseLogicalChannelParameters;
546 NetworkAccessParameters separateStack;
564 OpenLogicalChannelAck_forwardMultiplexAckParameters 547 OpenLogicalChannelAck_forwardMultiplexAckParameters
565 forwardMultiplexAckParameters; 548 forwardMultiplexAckParameters;
566} OpenLogicalChannelAck; 549} OpenLogicalChannelAck;
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 41afab6b5f09..bd193af80162 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -81,6 +81,7 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
81extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 81extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
82 struct nfs_page *); 82 struct nfs_page *);
83extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 83extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
84extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
84extern int nfs_wait_on_request(struct nfs_page *); 85extern int nfs_wait_on_request(struct nfs_page *);
85extern void nfs_unlock_request(struct nfs_page *req); 86extern void nfs_unlock_request(struct nfs_page *req);
86extern int nfs_set_page_writeback_locked(struct nfs_page *req); 87extern int nfs_set_page_writeback_locked(struct nfs_page *req);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 62b3e008e641..4712e269d8d3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -371,6 +371,7 @@
371#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385 371#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385
372#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c 372#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
373#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 373#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390
374#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c
374 375
375#define PCI_VENDOR_ID_VLSI 0x1004 376#define PCI_VENDOR_ID_VLSI 0x1004
376#define PCI_DEVICE_ID_VLSI_82C592 0x0005 377#define PCI_DEVICE_ID_VLSI_82C592 0x0005
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 6db9a4c15355..dd5a05d03d4f 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -232,6 +232,7 @@ struct bitmap {
232 struct page **filemap; /* list of cache pages for the file */ 232 struct page **filemap; /* list of cache pages for the file */
233 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ 233 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
234 unsigned long file_pages; /* number of pages in the file */ 234 unsigned long file_pages; /* number of pages in the file */
235 int last_page_size; /* bytes in the last page */
235 236
236 unsigned long flags; 237 unsigned long flags;
237 238
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a81897e2a244..d58e74b98367 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1182,6 +1182,7 @@ static inline void put_task_struct(struct task_struct *t)
1182#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1182#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1183#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1183#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1184#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1184#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1185#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
1185 1186
1186/* 1187/*
1187 * Only the _current_ task can read/write to tsk->flags, but other 1188 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1615,11 +1616,13 @@ static inline int lock_need_resched(spinlock_t *lock)
1615 return 0; 1616 return 0;
1616} 1617}
1617 1618
1618/* Reevaluate whether the task has signals pending delivery. 1619/*
1619 This is required every time the blocked sigset_t changes. 1620 * Reevaluate whether the task has signals pending delivery.
1620 callers must hold sighand->siglock. */ 1621 * Wake the task if so.
1621 1622 * This is required every time the blocked sigset_t changes.
1622extern FASTCALL(void recalc_sigpending_tsk(struct task_struct *t)); 1623 * callers must hold sighand->siglock.
1624 */
1625extern void recalc_sigpending_and_wake(struct task_struct *t);
1623extern void recalc_sigpending(void); 1626extern void recalc_sigpending(void);
1624 1627
1625extern void signal_wake_up(struct task_struct *t, int resume_stopped); 1628extern void signal_wake_up(struct task_struct *t, int resume_stopped);
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a25c2afa67e1..e7560389079c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -267,8 +267,6 @@ struct v4l2_pix_format
267 __u32 sizeimage; 267 __u32 sizeimage;
268 enum v4l2_colorspace colorspace; 268 enum v4l2_colorspace colorspace;
269 __u32 priv; /* private data, depends on pixelformat */ 269 __u32 priv; /* private data, depends on pixelformat */
270 __u32 left; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
271 __u32 top; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
272}; 270};
273 271
274/* Pixel format FOURCC depth Description */ 272/* Pixel format FOURCC depth Description */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 8242a0ee1f58..87df4e87622d 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -129,8 +129,10 @@ struct l2cap_conf_rsp {
129 __u8 data[0]; 129 __u8 data[0];
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
131 131
132#define L2CAP_CONF_SUCCESS 0x00 132#define L2CAP_CONF_SUCCESS 0x0000
133#define L2CAP_CONF_UNACCEPT 0x01 133#define L2CAP_CONF_UNACCEPT 0x0001
134#define L2CAP_CONF_REJECT 0x0002
135#define L2CAP_CONF_UNKNOWN 0x0003
134 136
135struct l2cap_conf_opt { 137struct l2cap_conf_opt {
136 __u8 type; 138 __u8 type;
@@ -215,6 +217,8 @@ struct l2cap_pinfo {
215 217
216 __u32 link_mode; 218 __u32 link_mode;
217 219
220 __u8 conf_req[64];
221 __u8 conf_len;
218 __u8 conf_state; 222 __u8 conf_state;
219 __u8 conf_retry; 223 __u8 conf_retry;
220 __u16 conf_mtu; 224 __u16 conf_mtu;
diff --git a/include/net/dst.h b/include/net/dst.h
index e12a8ce0b9b3..82270f9332db 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -265,9 +265,16 @@ static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
265{ 265{
266 return 0; 266 return 0;
267} 267}
268static inline int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
269 struct sock *sk, int flags)
270{
271 return 0;
272}
268#else 273#else
269extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 274extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
270 struct sock *sk, int flags); 275 struct sock *sk, int flags);
276extern int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
277 struct sock *sk, int flags);
271#endif 278#endif
272#endif 279#endif
273 280
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4fa5dfe886c4..78a0d06d98d5 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -469,6 +469,9 @@ extern void ip6_flush_pending_frames(struct sock *sk);
469extern int ip6_dst_lookup(struct sock *sk, 469extern int ip6_dst_lookup(struct sock *sk,
470 struct dst_entry **dst, 470 struct dst_entry **dst,
471 struct flowi *fl); 471 struct flowi *fl);
472extern int ip6_dst_blackhole(struct sock *sk,
473 struct dst_entry **dst,
474 struct flowi *fl);
472extern int ip6_sk_dst_lookup(struct sock *sk, 475extern int ip6_sk_dst_lookup(struct sock *sk,
473 struct dst_entry **dst, 476 struct dst_entry **dst,
474 struct flowi *fl); 477 struct flowi *fl);
diff --git a/kernel/exit.c b/kernel/exit.c
index c6d14b8008dd..5b888c24e43e 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -762,11 +762,8 @@ static void exit_notify(struct task_struct *tsk)
762 read_lock(&tasklist_lock); 762 read_lock(&tasklist_lock);
763 spin_lock_irq(&tsk->sighand->siglock); 763 spin_lock_irq(&tsk->sighand->siglock);
764 for (t = next_thread(tsk); t != tsk; t = next_thread(t)) 764 for (t = next_thread(tsk); t != tsk; t = next_thread(t))
765 if (!signal_pending(t) && !(t->flags & PF_EXITING)) { 765 if (!signal_pending(t) && !(t->flags & PF_EXITING))
766 recalc_sigpending_tsk(t); 766 recalc_sigpending_and_wake(t);
767 if (signal_pending(t))
768 signal_wake_up(t, 0);
769 }
770 spin_unlock_irq(&tsk->sighand->siglock); 767 spin_unlock_irq(&tsk->sighand->siglock);
771 read_unlock(&tasklist_lock); 768 read_unlock(&tasklist_lock);
772 } 769 }
diff --git a/kernel/fork.c b/kernel/fork.c
index 87069cfc18a1..73ad5cda1bcd 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -45,6 +45,7 @@
45#include <linux/acct.h> 45#include <linux/acct.h>
46#include <linux/tsacct_kern.h> 46#include <linux/tsacct_kern.h>
47#include <linux/cn_proc.h> 47#include <linux/cn_proc.h>
48#include <linux/freezer.h>
48#include <linux/delayacct.h> 49#include <linux/delayacct.h>
49#include <linux/taskstats_kern.h> 50#include <linux/taskstats_kern.h>
50#include <linux/random.h> 51#include <linux/random.h>
@@ -1405,7 +1406,9 @@ long do_fork(unsigned long clone_flags,
1405 } 1406 }
1406 1407
1407 if (clone_flags & CLONE_VFORK) { 1408 if (clone_flags & CLONE_VFORK) {
1409 freezer_do_not_count();
1408 wait_for_completion(&vfork); 1410 wait_for_completion(&vfork);
1411 freezer_count();
1409 if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { 1412 if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) {
1410 current->ptrace_message = nr; 1413 current->ptrace_message = nr;
1411 ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); 1414 ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index b0d81aae472f..bd9e272d55e9 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -135,6 +135,39 @@ report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret)
135 } 135 }
136} 136}
137 137
138static inline int try_misrouted_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret)
139{
140 struct irqaction *action;
141
142 if (!irqfixup)
143 return 0;
144
145 /* We didn't actually handle the IRQ - see if it was misrouted? */
146 if (action_ret == IRQ_NONE)
147 return 1;
148
149 /*
150 * But for 'irqfixup == 2' we also do it for handled interrupts if
151 * they are marked as IRQF_IRQPOLL (or for irq zero, which is the
152 * traditional PC timer interrupt.. Legacy)
153 */
154 if (irqfixup < 2)
155 return 0;
156
157 if (!irq)
158 return 1;
159
160 /*
161 * Since we don't get the descriptor lock, "action" can
162 * change under us. We don't really care, but we don't
163 * want to follow a NULL pointer. So tell the compiler to
164 * just load it once by using a barrier.
165 */
166 action = desc->action;
167 barrier();
168 return action && (action->flags & IRQF_IRQPOLL);
169}
170
138void note_interrupt(unsigned int irq, struct irq_desc *desc, 171void note_interrupt(unsigned int irq, struct irq_desc *desc,
139 irqreturn_t action_ret) 172 irqreturn_t action_ret)
140{ 173{
@@ -144,15 +177,10 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
144 report_bad_irq(irq, desc, action_ret); 177 report_bad_irq(irq, desc, action_ret);
145 } 178 }
146 179
147 if (unlikely(irqfixup)) { 180 if (unlikely(try_misrouted_irq(irq, desc, action_ret))) {
148 /* Don't punish working computers */ 181 int ok = misrouted_irq(irq);
149 if ((irqfixup == 2 && ((irq == 0) || 182 if (action_ret == IRQ_NONE)
150 (desc->action->flags & IRQF_IRQPOLL))) || 183 desc->irqs_unhandled -= ok;
151 action_ret == IRQ_NONE) {
152 int ok = misrouted_irq(irq);
153 if (action_ret == IRQ_NONE)
154 desc->irqs_unhandled -= ok;
155 }
156 } 184 }
157 185
158 desc->irq_count++; 186 desc->irq_count++;
diff --git a/kernel/kthread.c b/kernel/kthread.c
index df8a8e8f6ca4..bbd51b81a3e8 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -70,7 +70,7 @@ static int kthread(void *_create)
70 data = create->data; 70 data = create->data;
71 71
72 /* OK, tell user we're spawned, wait for stop or wakeup */ 72 /* OK, tell user we're spawned, wait for stop or wakeup */
73 __set_current_state(TASK_INTERRUPTIBLE); 73 __set_current_state(TASK_UNINTERRUPTIBLE);
74 complete(&create->started); 74 complete(&create->started);
75 schedule(); 75 schedule();
76 76
@@ -162,7 +162,10 @@ EXPORT_SYMBOL(kthread_create);
162 */ 162 */
163void kthread_bind(struct task_struct *k, unsigned int cpu) 163void kthread_bind(struct task_struct *k, unsigned int cpu)
164{ 164{
165 BUG_ON(k->state != TASK_INTERRUPTIBLE); 165 if (k->state != TASK_UNINTERRUPTIBLE) {
166 WARN_ON(1);
167 return;
168 }
166 /* Must have done schedule() in kthread() before we set_task_cpu */ 169 /* Must have done schedule() in kthread() before we set_task_cpu */
167 wait_task_inactive(k); 170 wait_task_inactive(k);
168 set_task_cpu(k, cpu); 171 set_task_cpu(k, cpu);
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 088419387388..e0233d8422b9 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -31,16 +31,36 @@ static inline int freezeable(struct task_struct * p)
31 return 1; 31 return 1;
32} 32}
33 33
34/*
35 * freezing is complete, mark current process as frozen
36 */
37static inline void frozen_process(void)
38{
39 if (!unlikely(current->flags & PF_NOFREEZE)) {
40 current->flags |= PF_FROZEN;
41 wmb();
42 }
43 clear_tsk_thread_flag(current, TIF_FREEZE);
44}
45
34/* Refrigerator is place where frozen processes are stored :-). */ 46/* Refrigerator is place where frozen processes are stored :-). */
35void refrigerator(void) 47void refrigerator(void)
36{ 48{
37 /* Hmm, should we be allowed to suspend when there are realtime 49 /* Hmm, should we be allowed to suspend when there are realtime
38 processes around? */ 50 processes around? */
39 long save; 51 long save;
52
53 task_lock(current);
54 if (freezing(current)) {
55 frozen_process();
56 task_unlock(current);
57 } else {
58 task_unlock(current);
59 return;
60 }
40 save = current->state; 61 save = current->state;
41 pr_debug("%s entered refrigerator\n", current->comm); 62 pr_debug("%s entered refrigerator\n", current->comm);
42 63
43 frozen_process(current);
44 spin_lock_irq(&current->sighand->siglock); 64 spin_lock_irq(&current->sighand->siglock);
45 recalc_sigpending(); /* We sent fake signal, clean it up */ 65 recalc_sigpending(); /* We sent fake signal, clean it up */
46 spin_unlock_irq(&current->sighand->siglock); 66 spin_unlock_irq(&current->sighand->siglock);
@@ -81,7 +101,7 @@ static void cancel_freezing(struct task_struct *p)
81 pr_debug(" clean up: %s\n", p->comm); 101 pr_debug(" clean up: %s\n", p->comm);
82 do_not_freeze(p); 102 do_not_freeze(p);
83 spin_lock_irqsave(&p->sighand->siglock, flags); 103 spin_lock_irqsave(&p->sighand->siglock, flags);
84 recalc_sigpending_tsk(p); 104 recalc_sigpending_and_wake(p);
85 spin_unlock_irqrestore(&p->sighand->siglock, flags); 105 spin_unlock_irqrestore(&p->sighand->siglock, flags);
86 } 106 }
87} 107}
@@ -112,22 +132,12 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
112 cancel_freezing(p); 132 cancel_freezing(p);
113 continue; 133 continue;
114 } 134 }
115 if (is_user_space(p)) { 135 if (freeze_user_space && !is_user_space(p))
116 if (!freeze_user_space) 136 continue;
117 continue; 137
118 138 freeze_process(p);
119 /* Freeze the task unless there is a vfork 139 if (!freezer_should_skip(p))
120 * completion pending 140 todo++;
121 */
122 if (!p->vfork_done)
123 freeze_process(p);
124 } else {
125 if (freeze_user_space)
126 continue;
127
128 freeze_process(p);
129 }
130 todo++;
131 } while_each_thread(g, p); 141 } while_each_thread(g, p);
132 read_unlock(&tasklist_lock); 142 read_unlock(&tasklist_lock);
133 yield(); /* Yield is okay here */ 143 yield(); /* Yield is okay here */
@@ -149,13 +159,16 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
149 TIMEOUT / HZ, todo); 159 TIMEOUT / HZ, todo);
150 read_lock(&tasklist_lock); 160 read_lock(&tasklist_lock);
151 do_each_thread(g, p) { 161 do_each_thread(g, p) {
152 if (is_user_space(p) == !freeze_user_space) 162 if (freeze_user_space && !is_user_space(p))
153 continue; 163 continue;
154 164
155 if (freezeable(p) && !frozen(p)) 165 task_lock(p);
166 if (freezeable(p) && !frozen(p) &&
167 !freezer_should_skip(p))
156 printk(KERN_ERR " %s\n", p->comm); 168 printk(KERN_ERR " %s\n", p->comm);
157 169
158 cancel_freezing(p); 170 cancel_freezing(p);
171 task_unlock(p);
159 } while_each_thread(g, p); 172 } while_each_thread(g, p);
160 read_unlock(&tasklist_lock); 173 read_unlock(&tasklist_lock);
161 } 174 }
@@ -200,9 +213,7 @@ static void thaw_tasks(int thaw_user_space)
200 if (is_user_space(p) == !thaw_user_space) 213 if (is_user_space(p) == !thaw_user_space)
201 continue; 214 continue;
202 215
203 if (!thaw_process(p)) 216 thaw_process(p);
204 printk(KERN_WARNING " Strange, %s not stopped\n",
205 p->comm );
206 } while_each_thread(g, p); 217 } while_each_thread(g, p);
207 read_unlock(&tasklist_lock); 218 read_unlock(&tasklist_lock);
208} 219}
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index b8b235cc19d1..8b1a1b837145 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -584,7 +584,7 @@ int swsusp_check(void)
584 resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); 584 resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ);
585 if (!IS_ERR(resume_bdev)) { 585 if (!IS_ERR(resume_bdev)) {
586 set_blocksize(resume_bdev, PAGE_SIZE); 586 set_blocksize(resume_bdev, PAGE_SIZE);
587 memset(swsusp_header, 0, sizeof(PAGE_SIZE)); 587 memset(swsusp_header, 0, PAGE_SIZE);
588 error = bio_read_page(swsusp_resume_block, 588 error = bio_read_page(swsusp_resume_block,
589 swsusp_header, NULL); 589 swsusp_header, NULL);
590 if (error) 590 if (error)
diff --git a/kernel/sched.c b/kernel/sched.c
index 799d23b4e35d..13cdab3b4c48 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4775,9 +4775,7 @@ int __sched cond_resched_softirq(void)
4775 BUG_ON(!in_softirq()); 4775 BUG_ON(!in_softirq());
4776 4776
4777 if (need_resched() && system_state == SYSTEM_RUNNING) { 4777 if (need_resched() && system_state == SYSTEM_RUNNING) {
4778 raw_local_irq_disable(); 4778 local_bh_enable();
4779 _local_bh_enable();
4780 raw_local_irq_enable();
4781 __cond_resched(); 4779 __cond_resched();
4782 local_bh_disable(); 4780 local_bh_disable();
4783 return 1; 4781 return 1;
diff --git a/kernel/signal.c b/kernel/signal.c
index 364fc95bf97c..acdfc0549c6f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -96,15 +96,27 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
96 96
97#define PENDING(p,b) has_pending_signals(&(p)->signal, (b)) 97#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
98 98
99fastcall void recalc_sigpending_tsk(struct task_struct *t) 99static int recalc_sigpending_tsk(struct task_struct *t)
100{ 100{
101 if (t->signal->group_stop_count > 0 || 101 if (t->signal->group_stop_count > 0 ||
102 (freezing(t)) || 102 (freezing(t)) ||
103 PENDING(&t->pending, &t->blocked) || 103 PENDING(&t->pending, &t->blocked) ||
104 PENDING(&t->signal->shared_pending, &t->blocked)) 104 PENDING(&t->signal->shared_pending, &t->blocked)) {
105 set_tsk_thread_flag(t, TIF_SIGPENDING); 105 set_tsk_thread_flag(t, TIF_SIGPENDING);
106 else 106 return 1;
107 clear_tsk_thread_flag(t, TIF_SIGPENDING); 107 }
108 clear_tsk_thread_flag(t, TIF_SIGPENDING);
109 return 0;
110}
111
112/*
113 * After recalculating TIF_SIGPENDING, we need to make sure the task wakes up.
114 * This is superfluous when called on current, the wakeup is a harmless no-op.
115 */
116void recalc_sigpending_and_wake(struct task_struct *t)
117{
118 if (recalc_sigpending_tsk(t))
119 signal_wake_up(t, 0);
108} 120}
109 121
110void recalc_sigpending(void) 122void recalc_sigpending(void)
@@ -744,7 +756,7 @@ force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
744 action->sa.sa_handler = SIG_DFL; 756 action->sa.sa_handler = SIG_DFL;
745 if (blocked) { 757 if (blocked) {
746 sigdelset(&t->blocked, sig); 758 sigdelset(&t->blocked, sig);
747 recalc_sigpending_tsk(t); 759 recalc_sigpending_and_wake(t);
748 } 760 }
749 } 761 }
750 ret = specific_send_sig_info(sig, info, t); 762 ret = specific_send_sig_info(sig, info, t);
@@ -2273,7 +2285,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2273 rm_from_queue_full(&mask, &t->signal->shared_pending); 2285 rm_from_queue_full(&mask, &t->signal->shared_pending);
2274 do { 2286 do {
2275 rm_from_queue_full(&mask, &t->pending); 2287 rm_from_queue_full(&mask, &t->pending);
2276 recalc_sigpending_tsk(t); 2288 recalc_sigpending_and_wake(t);
2277 t = next_thread(t); 2289 t = next_thread(t);
2278 } while (t != current); 2290 } while (t != current);
2279 } 2291 }
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index eadfce2fff74..8001d37071f5 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -243,11 +243,18 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu)
243{ 243{
244 int cpu = get_cpu(); 244 int cpu = get_cpu();
245 245
246 if (cpu == *oncpu) 246 if (!cpu_isset(*oncpu, cpu_online_map)) {
247 tick_do_broadcast_on_off(&reason); 247 printk(KERN_ERR "tick-braodcast: ignoring broadcast for "
248 else 248 "offline CPU #%d\n", *oncpu);
249 smp_call_function_single(*oncpu, tick_do_broadcast_on_off, 249 } else {
250 &reason, 1, 1); 250
251 if (cpu == *oncpu)
252 tick_do_broadcast_on_off(&reason);
253 else
254 smp_call_function_single(*oncpu,
255 tick_do_broadcast_on_off,
256 &reason, 1, 1);
257 }
251 put_cpu(); 258 put_cpu();
252} 259}
253 260
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3483e6cb9549..3e7ebc4646b7 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -167,9 +167,15 @@ void tick_nohz_stop_sched_tick(void)
167 goto end; 167 goto end;
168 168
169 cpu = smp_processor_id(); 169 cpu = smp_processor_id();
170 if (unlikely(local_softirq_pending())) 170 if (unlikely(local_softirq_pending())) {
171 printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n", 171 static int ratelimit;
172 local_softirq_pending()); 172
173 if (ratelimit < 10) {
174 printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
175 local_softirq_pending());
176 ratelimit++;
177 }
178 }
173 179
174 now = ktime_get(); 180 now = ktime_get();
175 /* 181 /*
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index fb56fedd5c02..3bebf73be976 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -47,7 +47,6 @@ struct cpu_workqueue_struct {
47 47
48 struct workqueue_struct *wq; 48 struct workqueue_struct *wq;
49 struct task_struct *thread; 49 struct task_struct *thread;
50 int should_stop;
51 50
52 int run_depth; /* Detect run_workqueue() recursion depth */ 51 int run_depth; /* Detect run_workqueue() recursion depth */
53} ____cacheline_aligned; 52} ____cacheline_aligned;
@@ -71,7 +70,13 @@ static LIST_HEAD(workqueues);
71 70
72static int singlethread_cpu __read_mostly; 71static int singlethread_cpu __read_mostly;
73static cpumask_t cpu_singlethread_map __read_mostly; 72static cpumask_t cpu_singlethread_map __read_mostly;
74/* optimization, we could use cpu_possible_map */ 73/*
74 * _cpu_down() first removes CPU from cpu_online_map, then CPU_DEAD
75 * flushes cwq->worklist. This means that flush_workqueue/wait_on_work
76 * which comes in between can't use for_each_online_cpu(). We could
77 * use cpu_possible_map, the cpumask below is more a documentation
78 * than optimization.
79 */
75static cpumask_t cpu_populated_map __read_mostly; 80static cpumask_t cpu_populated_map __read_mostly;
76 81
77/* If it's single threaded, it isn't in the list of workqueues. */ 82/* If it's single threaded, it isn't in the list of workqueues. */
@@ -272,24 +277,6 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
272 spin_unlock_irq(&cwq->lock); 277 spin_unlock_irq(&cwq->lock);
273} 278}
274 279
275/*
276 * NOTE: the caller must not touch *cwq if this func returns true
277 */
278static int cwq_should_stop(struct cpu_workqueue_struct *cwq)
279{
280 int should_stop = cwq->should_stop;
281
282 if (unlikely(should_stop)) {
283 spin_lock_irq(&cwq->lock);
284 should_stop = cwq->should_stop && list_empty(&cwq->worklist);
285 if (should_stop)
286 cwq->thread = NULL;
287 spin_unlock_irq(&cwq->lock);
288 }
289
290 return should_stop;
291}
292
293static int worker_thread(void *__cwq) 280static int worker_thread(void *__cwq)
294{ 281{
295 struct cpu_workqueue_struct *cwq = __cwq; 282 struct cpu_workqueue_struct *cwq = __cwq;
@@ -302,14 +289,15 @@ static int worker_thread(void *__cwq)
302 289
303 for (;;) { 290 for (;;) {
304 prepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE); 291 prepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE);
305 if (!freezing(current) && !cwq->should_stop 292 if (!freezing(current) &&
306 && list_empty(&cwq->worklist)) 293 !kthread_should_stop() &&
294 list_empty(&cwq->worklist))
307 schedule(); 295 schedule();
308 finish_wait(&cwq->more_work, &wait); 296 finish_wait(&cwq->more_work, &wait);
309 297
310 try_to_freeze(); 298 try_to_freeze();
311 299
312 if (cwq_should_stop(cwq)) 300 if (kthread_should_stop())
313 break; 301 break;
314 302
315 run_workqueue(cwq); 303 run_workqueue(cwq);
@@ -340,18 +328,21 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq,
340 insert_work(cwq, &barr->work, tail); 328 insert_work(cwq, &barr->work, tail);
341} 329}
342 330
343static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) 331static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
344{ 332{
333 int active;
334
345 if (cwq->thread == current) { 335 if (cwq->thread == current) {
346 /* 336 /*
347 * Probably keventd trying to flush its own queue. So simply run 337 * Probably keventd trying to flush its own queue. So simply run
348 * it by hand rather than deadlocking. 338 * it by hand rather than deadlocking.
349 */ 339 */
350 run_workqueue(cwq); 340 run_workqueue(cwq);
341 active = 1;
351 } else { 342 } else {
352 struct wq_barrier barr; 343 struct wq_barrier barr;
353 int active = 0;
354 344
345 active = 0;
355 spin_lock_irq(&cwq->lock); 346 spin_lock_irq(&cwq->lock);
356 if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) { 347 if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) {
357 insert_wq_barrier(cwq, &barr, 1); 348 insert_wq_barrier(cwq, &barr, 1);
@@ -362,6 +353,8 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
362 if (active) 353 if (active)
363 wait_for_completion(&barr.done); 354 wait_for_completion(&barr.done);
364 } 355 }
356
357 return active;
365} 358}
366 359
367/** 360/**
@@ -674,7 +667,6 @@ static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
674 return PTR_ERR(p); 667 return PTR_ERR(p);
675 668
676 cwq->thread = p; 669 cwq->thread = p;
677 cwq->should_stop = 0;
678 670
679 return 0; 671 return 0;
680} 672}
@@ -740,29 +732,27 @@ EXPORT_SYMBOL_GPL(__create_workqueue);
740 732
741static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) 733static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
742{ 734{
743 struct wq_barrier barr; 735 /*
744 int alive = 0; 736 * Our caller is either destroy_workqueue() or CPU_DEAD,
745 737 * workqueue_mutex protects cwq->thread
746 spin_lock_irq(&cwq->lock); 738 */
747 if (cwq->thread != NULL) { 739 if (cwq->thread == NULL)
748 insert_wq_barrier(cwq, &barr, 1); 740 return;
749 cwq->should_stop = 1;
750 alive = 1;
751 }
752 spin_unlock_irq(&cwq->lock);
753 741
754 if (alive) { 742 /*
755 wait_for_completion(&barr.done); 743 * If the caller is CPU_DEAD the single flush_cpu_workqueue()
744 * is not enough, a concurrent flush_workqueue() can insert a
745 * barrier after us.
746 * When ->worklist becomes empty it is safe to exit because no
747 * more work_structs can be queued on this cwq: flush_workqueue
748 * checks list_empty(), and a "normal" queue_work() can't use
749 * a dead CPU.
750 */
751 while (flush_cpu_workqueue(cwq))
752 ;
756 753
757 while (unlikely(cwq->thread != NULL)) 754 kthread_stop(cwq->thread);
758 cpu_relax(); 755 cwq->thread = NULL;
759 /*
760 * Wait until cwq->thread unlocks cwq->lock,
761 * it won't touch *cwq after that.
762 */
763 smp_rmb();
764 spin_unlock_wait(&cwq->lock);
765 }
766} 756}
767 757
768/** 758/**
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index fbc5c622acb0..1ba77ca7d165 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -378,14 +378,13 @@ config FORCED_INLINING
378config RCU_TORTURE_TEST 378config RCU_TORTURE_TEST
379 tristate "torture tests for RCU" 379 tristate "torture tests for RCU"
380 depends on DEBUG_KERNEL 380 depends on DEBUG_KERNEL
381 depends on m
381 default n 382 default n
382 help 383 help
383 This option provides a kernel module that runs torture tests 384 This option provides a kernel module that runs torture tests
384 on the RCU infrastructure. The kernel module may be built 385 on the RCU infrastructure. The kernel module may be built
385 after the fact on the running kernel to be tested, if desired. 386 after the fact on the running kernel to be tested, if desired.
386 387
387 Say Y here if you want RCU torture tests to start automatically
388 at boot time (you probably don't).
389 Say M if you want the RCU torture tests to build as a module. 388 Say M if you want the RCU torture tests to build as a module.
390 Say N if you are unsure. 389 Say N if you are unsure.
391 390
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8b000d6803c2..d8970623c566 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -136,6 +136,11 @@ static unsigned long __meminitdata dma_reserve;
136#endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */ 136#endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */
137#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 137#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
138 138
139#if MAX_NUMNODES > 1
140int nr_node_ids __read_mostly = MAX_NUMNODES;
141EXPORT_SYMBOL(nr_node_ids);
142#endif
143
139#ifdef CONFIG_DEBUG_VM 144#ifdef CONFIG_DEBUG_VM
140static int page_outside_zone_boundaries(struct zone *zone, struct page *page) 145static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
141{ 146{
@@ -669,26 +674,6 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
669 return i; 674 return i;
670} 675}
671 676
672#if MAX_NUMNODES > 1
673int nr_node_ids __read_mostly = MAX_NUMNODES;
674EXPORT_SYMBOL(nr_node_ids);
675
676/*
677 * Figure out the number of possible node ids.
678 */
679static void __init setup_nr_node_ids(void)
680{
681 unsigned int node;
682 unsigned int highest = 0;
683
684 for_each_node_mask(node, node_possible_map)
685 highest = node;
686 nr_node_ids = highest + 1;
687}
688#else
689static void __init setup_nr_node_ids(void) {}
690#endif
691
692#ifdef CONFIG_NUMA 677#ifdef CONFIG_NUMA
693/* 678/*
694 * Called from the vmstat counter updater to drain pagesets of this 679 * Called from the vmstat counter updater to drain pagesets of this
@@ -2733,6 +2718,26 @@ void __meminit free_area_init_node(int nid, struct pglist_data *pgdat,
2733} 2718}
2734 2719
2735#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 2720#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
2721
2722#if MAX_NUMNODES > 1
2723/*
2724 * Figure out the number of possible node ids.
2725 */
2726static void __init setup_nr_node_ids(void)
2727{
2728 unsigned int node;
2729 unsigned int highest = 0;
2730
2731 for_each_node_mask(node, node_possible_map)
2732 highest = node;
2733 nr_node_ids = highest + 1;
2734}
2735#else
2736static inline void setup_nr_node_ids(void)
2737{
2738}
2739#endif
2740
2736/** 2741/**
2737 * add_active_range - Register a range of PFNs backed by physical memory 2742 * add_active_range - Register a range of PFNs backed by physical memory
2738 * @nid: The node ID the range resides on 2743 * @nid: The node ID the range resides on
diff --git a/mm/slub.c b/mm/slub.c
index 98801d404d69..3e5aefcb4075 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -939,7 +939,7 @@ static void kmem_cache_open_debug_check(struct kmem_cache *s)
939 * Debugging or ctor may create a need to move the free 939 * Debugging or ctor may create a need to move the free
940 * pointer. Fail if this happens. 940 * pointer. Fail if this happens.
941 */ 941 */
942 if (s->size >= 65535 * sizeof(void *)) { 942 if (s->objsize >= 65535 * sizeof(void *)) {
943 BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON | 943 BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON |
944 SLAB_STORE_USER | SLAB_DESTROY_BY_RCU)); 944 SLAB_STORE_USER | SLAB_DESTROY_BY_RCU));
945 BUG_ON(s->ctor); 945 BUG_ON(s->ctor);
@@ -1917,7 +1917,6 @@ static int calculate_sizes(struct kmem_cache *s)
1917 */ 1917 */
1918 s->inuse = size; 1918 s->inuse = size;
1919 1919
1920#ifdef CONFIG_SLUB_DEBUG
1921 if (((flags & (SLAB_DESTROY_BY_RCU | SLAB_POISON)) || 1920 if (((flags & (SLAB_DESTROY_BY_RCU | SLAB_POISON)) ||
1922 s->ctor)) { 1921 s->ctor)) {
1923 /* 1922 /*
@@ -1932,6 +1931,7 @@ static int calculate_sizes(struct kmem_cache *s)
1932 size += sizeof(void *); 1931 size += sizeof(void *);
1933 } 1932 }
1934 1933
1934#ifdef CONFIG_SLUB_DEBUG
1935 if (flags & SLAB_STORE_USER) 1935 if (flags & SLAB_STORE_USER)
1936 /* 1936 /*
1937 * Need to store information about allocs and frees after 1937 * Need to store information about allocs and frees after
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index a59b1fb63b76..670ff95ca64b 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -507,6 +507,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
507 } 507 }
508 508
509 /* Default config options */ 509 /* Default config options */
510 pi->conf_len = 0;
510 pi->conf_mtu = L2CAP_DEFAULT_MTU; 511 pi->conf_mtu = L2CAP_DEFAULT_MTU;
511 pi->flush_to = L2CAP_DEFAULT_FLUSH_TO; 512 pi->flush_to = L2CAP_DEFAULT_FLUSH_TO;
512} 513}
@@ -1271,42 +1272,6 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned
1271 return len; 1272 return len;
1272} 1273}
1273 1274
1274static inline void l2cap_parse_conf_req(struct sock *sk, void *data, int len)
1275{
1276 int type, hint, olen;
1277 unsigned long val;
1278 void *ptr = data;
1279
1280 BT_DBG("sk %p len %d", sk, len);
1281
1282 while (len >= L2CAP_CONF_OPT_SIZE) {
1283 len -= l2cap_get_conf_opt(&ptr, &type, &olen, &val);
1284
1285 hint = type & 0x80;
1286 type &= 0x7f;
1287
1288 switch (type) {
1289 case L2CAP_CONF_MTU:
1290 l2cap_pi(sk)->conf_mtu = val;
1291 break;
1292
1293 case L2CAP_CONF_FLUSH_TO:
1294 l2cap_pi(sk)->flush_to = val;
1295 break;
1296
1297 case L2CAP_CONF_QOS:
1298 break;
1299
1300 default:
1301 if (hint)
1302 break;
1303
1304 /* FIXME: Reject unknown option */
1305 break;
1306 }
1307 }
1308}
1309
1310static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val) 1275static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
1311{ 1276{
1312 struct l2cap_conf_opt *opt = *ptr; 1277 struct l2cap_conf_opt *opt = *ptr;
@@ -1358,39 +1323,75 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
1358 return ptr - data; 1323 return ptr - data;
1359} 1324}
1360 1325
1361static inline int l2cap_conf_output(struct sock *sk, void **ptr) 1326static int l2cap_parse_conf_req(struct sock *sk, void *data)
1362{ 1327{
1363 struct l2cap_pinfo *pi = l2cap_pi(sk); 1328 struct l2cap_pinfo *pi = l2cap_pi(sk);
1364 int result = 0; 1329 struct l2cap_conf_rsp *rsp = data;
1330 void *ptr = rsp->data;
1331 void *req = pi->conf_req;
1332 int len = pi->conf_len;
1333 int type, hint, olen;
1334 unsigned long val;
1335 u16 result = L2CAP_CONF_SUCCESS;
1365 1336
1366 /* Configure output options and let the other side know 1337 BT_DBG("sk %p", sk);
1367 * which ones we don't like. */ 1338
1368 if (pi->conf_mtu < pi->omtu) 1339 while (len >= L2CAP_CONF_OPT_SIZE) {
1369 result = L2CAP_CONF_UNACCEPT; 1340 len -= l2cap_get_conf_opt(&req, &type, &olen, &val);
1370 else
1371 pi->omtu = pi->conf_mtu;
1372 1341
1373 l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu); 1342 hint = type & 0x80;
1343 type &= 0x7f;
1344
1345 switch (type) {
1346 case L2CAP_CONF_MTU:
1347 pi->conf_mtu = val;
1348 break;
1349
1350 case L2CAP_CONF_FLUSH_TO:
1351 pi->flush_to = val;
1352 break;
1353
1354 case L2CAP_CONF_QOS:
1355 break;
1356
1357 default:
1358 if (hint)
1359 break;
1360
1361 result = L2CAP_CONF_UNKNOWN;
1362 *((u8 *) ptr++) = type;
1363 break;
1364 }
1365 }
1366
1367 if (result == L2CAP_CONF_SUCCESS) {
1368 /* Configure output options and let the other side know
1369 * which ones we don't like. */
1370
1371 if (pi->conf_mtu < pi->omtu)
1372 result = L2CAP_CONF_UNACCEPT;
1373 else
1374 pi->omtu = pi->conf_mtu;
1375
1376 l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu);
1377 }
1374 1378
1375 BT_DBG("sk %p result %d", sk, result); 1379 rsp->scid = cpu_to_le16(pi->dcid);
1376 return result; 1380 rsp->result = cpu_to_le16(result);
1381 rsp->flags = cpu_to_le16(0x0000);
1382
1383 return ptr - data;
1377} 1384}
1378 1385
1379static int l2cap_build_conf_rsp(struct sock *sk, void *data, int *result) 1386static int l2cap_build_conf_rsp(struct sock *sk, void *data, u16 result, u16 flags)
1380{ 1387{
1381 struct l2cap_conf_rsp *rsp = data; 1388 struct l2cap_conf_rsp *rsp = data;
1382 void *ptr = rsp->data; 1389 void *ptr = rsp->data;
1383 u16 flags = 0;
1384
1385 BT_DBG("sk %p complete %d", sk, result ? 1 : 0);
1386 1390
1387 if (result) 1391 BT_DBG("sk %p", sk);
1388 *result = l2cap_conf_output(sk, &ptr);
1389 else
1390 flags = 0x0001;
1391 1392
1392 rsp->scid = cpu_to_le16(l2cap_pi(sk)->dcid); 1393 rsp->scid = cpu_to_le16(l2cap_pi(sk)->dcid);
1393 rsp->result = cpu_to_le16(result ? *result : 0); 1394 rsp->result = cpu_to_le16(result);
1394 rsp->flags = cpu_to_le16(flags); 1395 rsp->flags = cpu_to_le16(flags);
1395 1396
1396 return ptr - data; 1397 return ptr - data;
@@ -1535,7 +1536,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
1535 u16 dcid, flags; 1536 u16 dcid, flags;
1536 u8 rsp[64]; 1537 u8 rsp[64];
1537 struct sock *sk; 1538 struct sock *sk;
1538 int result; 1539 int len;
1539 1540
1540 dcid = __le16_to_cpu(req->dcid); 1541 dcid = __le16_to_cpu(req->dcid);
1541 flags = __le16_to_cpu(req->flags); 1542 flags = __le16_to_cpu(req->flags);
@@ -1548,25 +1549,40 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
1548 if (sk->sk_state == BT_DISCONN) 1549 if (sk->sk_state == BT_DISCONN)
1549 goto unlock; 1550 goto unlock;
1550 1551
1551 l2cap_parse_conf_req(sk, req->data, cmd->len - sizeof(*req)); 1552 /* Reject if config buffer is too small. */
1553 len = cmd->len - sizeof(*req);
1554 if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) {
1555 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
1556 l2cap_build_conf_rsp(sk, rsp,
1557 L2CAP_CONF_REJECT, flags), rsp);
1558 goto unlock;
1559 }
1560
1561 /* Store config. */
1562 memcpy(l2cap_pi(sk)->conf_req + l2cap_pi(sk)->conf_len, req->data, len);
1563 l2cap_pi(sk)->conf_len += len;
1552 1564
1553 if (flags & 0x0001) { 1565 if (flags & 0x0001) {
1554 /* Incomplete config. Send empty response. */ 1566 /* Incomplete config. Send empty response. */
1555 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, 1567 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
1556 l2cap_build_conf_rsp(sk, rsp, NULL), rsp); 1568 l2cap_build_conf_rsp(sk, rsp,
1569 L2CAP_CONF_SUCCESS, 0x0001), rsp);
1557 goto unlock; 1570 goto unlock;
1558 } 1571 }
1559 1572
1560 /* Complete config. */ 1573 /* Complete config. */
1561 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, 1574 len = l2cap_parse_conf_req(sk, rsp);
1562 l2cap_build_conf_rsp(sk, rsp, &result), rsp); 1575 if (len < 0)
1563
1564 if (result)
1565 goto unlock; 1576 goto unlock;
1566 1577
1567 /* Output config done */ 1578 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, len, rsp);
1579
1580 /* Output config done. */
1568 l2cap_pi(sk)->conf_state |= L2CAP_CONF_OUTPUT_DONE; 1581 l2cap_pi(sk)->conf_state |= L2CAP_CONF_OUTPUT_DONE;
1569 1582
1583 /* Reset config buffer. */
1584 l2cap_pi(sk)->conf_len = 0;
1585
1570 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { 1586 if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) {
1571 sk->sk_state = BT_CONNECTED; 1587 sk->sk_state = BT_CONNECTED;
1572 l2cap_chan_ready(sk); 1588 l2cap_chan_ready(sk);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8c971a2efe2a..27da9cdec6a8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -437,7 +437,7 @@ static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
437 a->tx_compressed = b->tx_compressed; 437 a->tx_compressed = b->tx_compressed;
438}; 438};
439 439
440static inline size_t if_nlmsg_size(int iwbuflen) 440static inline size_t if_nlmsg_size(void)
441{ 441{
442 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 442 return NLMSG_ALIGN(sizeof(struct ifinfomsg))
443 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 443 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */
@@ -452,13 +452,12 @@ static inline size_t if_nlmsg_size(int iwbuflen)
452 + nla_total_size(4) /* IFLA_LINK */ 452 + nla_total_size(4) /* IFLA_LINK */
453 + nla_total_size(4) /* IFLA_MASTER */ 453 + nla_total_size(4) /* IFLA_MASTER */
454 + nla_total_size(1) /* IFLA_OPERSTATE */ 454 + nla_total_size(1) /* IFLA_OPERSTATE */
455 + nla_total_size(1) /* IFLA_LINKMODE */ 455 + nla_total_size(1); /* IFLA_LINKMODE */
456 + nla_total_size(iwbuflen);
457} 456}
458 457
459static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 458static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
460 void *iwbuf, int iwbuflen, int type, u32 pid, 459 int type, u32 pid, u32 seq, u32 change,
461 u32 seq, u32 change, unsigned int flags) 460 unsigned int flags)
462{ 461{
463 struct ifinfomsg *ifm; 462 struct ifinfomsg *ifm;
464 struct nlmsghdr *nlh; 463 struct nlmsghdr *nlh;
@@ -523,9 +522,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
523 } 522 }
524 } 523 }
525 524
526 if (iwbuf)
527 NLA_PUT(skb, IFLA_WIRELESS, iwbuflen, iwbuf);
528
529 return nlmsg_end(skb, nlh); 525 return nlmsg_end(skb, nlh);
530 526
531nla_put_failure: 527nla_put_failure:
@@ -543,7 +539,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
543 for_each_netdev(dev) { 539 for_each_netdev(dev) {
544 if (idx < s_idx) 540 if (idx < s_idx)
545 goto cont; 541 goto cont;
546 if (rtnl_fill_ifinfo(skb, dev, NULL, 0, RTM_NEWLINK, 542 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
547 NETLINK_CB(cb->skb).pid, 543 NETLINK_CB(cb->skb).pid,
548 cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0) 544 cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0)
549 break; 545 break;
@@ -689,8 +685,15 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
689 } 685 }
690 686
691 687
692 if (ifm->ifi_flags) 688 if (ifm->ifi_flags || ifm->ifi_change) {
693 dev_change_flags(dev, ifm->ifi_flags); 689 unsigned int flags = ifm->ifi_flags;
690
691 /* bugwards compatibility: ifi_change == 0 is treated as ~0 */
692 if (ifm->ifi_change)
693 flags = (flags & ifm->ifi_change) |
694 (dev->flags & ~ifm->ifi_change);
695 dev_change_flags(dev, flags);
696 }
694 697
695 if (tb[IFLA_TXQLEN]) 698 if (tb[IFLA_TXQLEN])
696 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 699 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
@@ -730,8 +733,6 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
730 struct nlattr *tb[IFLA_MAX+1]; 733 struct nlattr *tb[IFLA_MAX+1];
731 struct net_device *dev = NULL; 734 struct net_device *dev = NULL;
732 struct sk_buff *nskb; 735 struct sk_buff *nskb;
733 char *iw_buf = NULL, *iw = NULL;
734 int iw_buf_len = 0;
735 int err; 736 int err;
736 737
737 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 738 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
@@ -746,14 +747,14 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
746 } else 747 } else
747 return -EINVAL; 748 return -EINVAL;
748 749
749 nskb = nlmsg_new(if_nlmsg_size(iw_buf_len), GFP_KERNEL); 750 nskb = nlmsg_new(if_nlmsg_size(), GFP_KERNEL);
750 if (nskb == NULL) { 751 if (nskb == NULL) {
751 err = -ENOBUFS; 752 err = -ENOBUFS;
752 goto errout; 753 goto errout;
753 } 754 }
754 755
755 err = rtnl_fill_ifinfo(nskb, dev, iw, iw_buf_len, RTM_NEWLINK, 756 err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).pid,
756 NETLINK_CB(skb).pid, nlh->nlmsg_seq, 0, 0); 757 nlh->nlmsg_seq, 0, 0);
757 if (err < 0) { 758 if (err < 0) {
758 /* -EMSGSIZE implies BUG in if_nlmsg_size */ 759 /* -EMSGSIZE implies BUG in if_nlmsg_size */
759 WARN_ON(err == -EMSGSIZE); 760 WARN_ON(err == -EMSGSIZE);
@@ -762,7 +763,6 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
762 } 763 }
763 err = rtnl_unicast(nskb, NETLINK_CB(skb).pid); 764 err = rtnl_unicast(nskb, NETLINK_CB(skb).pid);
764errout: 765errout:
765 kfree(iw_buf);
766 dev_put(dev); 766 dev_put(dev);
767 767
768 return err; 768 return err;
@@ -797,11 +797,11 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
797 struct sk_buff *skb; 797 struct sk_buff *skb;
798 int err = -ENOBUFS; 798 int err = -ENOBUFS;
799 799
800 skb = nlmsg_new(if_nlmsg_size(0), GFP_KERNEL); 800 skb = nlmsg_new(if_nlmsg_size(), GFP_KERNEL);
801 if (skb == NULL) 801 if (skb == NULL)
802 goto errout; 802 goto errout;
803 803
804 err = rtnl_fill_ifinfo(skb, dev, NULL, 0, type, 0, 0, change, 0); 804 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0);
805 if (err < 0) { 805 if (err < 0) {
806 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 806 /* -EMSGSIZE implies BUG in if_nlmsg_size() */
807 WARN_ON(err == -EMSGSIZE); 807 WARN_ON(err == -EMSGSIZE);
diff --git a/net/core/sock.c b/net/core/sock.c
index 22183c2ef284..7e51d3a5e4f6 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -206,7 +206,19 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
206 return -EINVAL; 206 return -EINVAL;
207 if (copy_from_user(&tv, optval, sizeof(tv))) 207 if (copy_from_user(&tv, optval, sizeof(tv)))
208 return -EFAULT; 208 return -EFAULT;
209 209 if (tv.tv_usec < 0 || tv.tv_usec >= USEC_PER_SEC)
210 return -EDOM;
211
212 if (tv.tv_sec < 0) {
213 static int warned = 0;
214 *timeo_p = 0;
215 if (warned < 10 && net_ratelimit())
216 warned++;
217 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
218 "tries to set negative timeout\n",
219 current->comm, current->pid);
220 return 0;
221 }
210 *timeo_p = MAX_SCHEDULE_TIMEOUT; 222 *timeo_p = MAX_SCHEDULE_TIMEOUT;
211 if (tv.tv_sec == 0 && tv.tv_usec == 0) 223 if (tv.tv_sec == 0 && tv.tv_usec == 0)
212 return 0; 224 return 0;
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index b29712033dd4..f34aca041a25 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -24,6 +24,7 @@ extern int sysctl_core_destroy_delay;
24#ifdef CONFIG_XFRM 24#ifdef CONFIG_XFRM
25extern u32 sysctl_xfrm_aevent_etime; 25extern u32 sysctl_xfrm_aevent_etime;
26extern u32 sysctl_xfrm_aevent_rseqth; 26extern u32 sysctl_xfrm_aevent_rseqth;
27extern int sysctl_xfrm_larval_drop;
27#endif 28#endif
28 29
29ctl_table core_table[] = { 30ctl_table core_table[] = {
@@ -118,6 +119,14 @@ ctl_table core_table[] = {
118 .mode = 0644, 119 .mode = 0644,
119 .proc_handler = &proc_dointvec 120 .proc_handler = &proc_dointvec
120 }, 121 },
122 {
123 .ctl_name = CTL_UNNUMBERED,
124 .procname = "xfrm_larval_drop",
125 .data = &sysctl_xfrm_larval_drop,
126 .maxlen = sizeof(int),
127 .mode = 0644,
128 .proc_handler = &proc_dointvec
129 },
121#endif /* CONFIG_XFRM */ 130#endif /* CONFIG_XFRM */
122#endif /* CONFIG_NET */ 131#endif /* CONFIG_NET */
123 { 132 {
diff --git a/net/dccp/Kconfig b/net/dccp/Kconfig
index b8a68dd41000..0549e4719b13 100644
--- a/net/dccp/Kconfig
+++ b/net/dccp/Kconfig
@@ -1,8 +1,6 @@
1menu "DCCP Configuration (EXPERIMENTAL)" 1menuconfig IP_DCCP
2 depends on INET && EXPERIMENTAL
3
4config IP_DCCP
5 tristate "The DCCP Protocol (EXPERIMENTAL)" 2 tristate "The DCCP Protocol (EXPERIMENTAL)"
3 depends on INET && EXPERIMENTAL
6 ---help--- 4 ---help---
7 Datagram Congestion Control Protocol (RFC 4340) 5 Datagram Congestion Control Protocol (RFC 4340)
8 6
@@ -19,19 +17,20 @@ config IP_DCCP
19 17
20 If in doubt, say N. 18 If in doubt, say N.
21 19
20if IP_DCCP
21
22config INET_DCCP_DIAG 22config INET_DCCP_DIAG
23 depends on IP_DCCP && INET_DIAG 23 depends on INET_DIAG
24 def_tristate y if (IP_DCCP = y && INET_DIAG = y) 24 def_tristate y if (IP_DCCP = y && INET_DIAG = y)
25 def_tristate m 25 def_tristate m
26 26
27config IP_DCCP_ACKVEC 27config IP_DCCP_ACKVEC
28 depends on IP_DCCP
29 bool 28 bool
30 29
31source "net/dccp/ccids/Kconfig" 30source "net/dccp/ccids/Kconfig"
32 31
33menu "DCCP Kernel Hacking" 32menu "DCCP Kernel Hacking"
34 depends on IP_DCCP && DEBUG_KERNEL=y 33 depends on DEBUG_KERNEL=y
35 34
36config IP_DCCP_DEBUG 35config IP_DCCP_DEBUG
37 bool "DCCP debug messages" 36 bool "DCCP debug messages"
@@ -61,4 +60,4 @@ config NET_DCCPPROBE
61 60
62endmenu 61endmenu
63 62
64endmenu 63endif # IP_DDCP
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index d7d9ce737244..ec7fa4d67f08 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -419,7 +419,6 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more,
419 419
420static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) 420static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
421{ 421{
422 const struct dccp_sock *dp = dccp_sk(sk);
423 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 422 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
424 struct ccid3_options_received *opt_recv; 423 struct ccid3_options_received *opt_recv;
425 struct dccp_tx_hist_entry *packet; 424 struct dccp_tx_hist_entry *packet;
@@ -491,7 +490,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
491 ccid3_pr_debug("%s(%p), s=%u, MSS=%u, " 490 ccid3_pr_debug("%s(%p), s=%u, MSS=%u, "
492 "R_sample=%uus, X=%u\n", dccp_role(sk), 491 "R_sample=%uus, X=%u\n", dccp_role(sk),
493 sk, hctx->ccid3hctx_s, 492 sk, hctx->ccid3hctx_s,
494 dp->dccps_mss_cache, r_sample, 493 dccp_sk(sk)->dccps_mss_cache, r_sample,
495 (unsigned)(hctx->ccid3hctx_x >> 6)); 494 (unsigned)(hctx->ccid3hctx_x >> 6));
496 495
497 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); 496 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 64eac2515aa2..31737cdf156a 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -1043,9 +1043,13 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
1043 if (final_p) 1043 if (final_p)
1044 ipv6_addr_copy(&fl.fl6_dst, final_p); 1044 ipv6_addr_copy(&fl.fl6_dst, final_p);
1045 1045
1046 err = xfrm_lookup(&dst, &fl, sk, 1); 1046 err = __xfrm_lookup(&dst, &fl, sk, 1);
1047 if (err < 0) 1047 if (err < 0) {
1048 goto failure; 1048 if (err == -EREMOTE)
1049 err = ip6_dst_blackhole(sk, &dst, &fl);
1050 if (err < 0)
1051 goto failure;
1052 }
1049 1053
1050 if (saddr == NULL) { 1054 if (saddr == NULL) {
1051 saddr = &fl.fl6_src; 1055 saddr = &fl.fl6_src;
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 9cfecf1215c9..07e843a47dde 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -456,6 +456,8 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
456 fib_release_info(fi_drop); 456 fib_release_info(fi_drop);
457 if (state & FA_S_ACCESSED) 457 if (state & FA_S_ACCESSED)
458 rt_cache_flush(-1); 458 rt_cache_flush(-1);
459 rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id,
460 &cfg->fc_nlinfo, NLM_F_REPLACE);
459 return 0; 461 return 0;
460 } 462 }
461 463
@@ -523,7 +525,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
523 rt_cache_flush(-1); 525 rt_cache_flush(-1);
524 526
525 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id, 527 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id,
526 &cfg->fc_nlinfo); 528 &cfg->fc_nlinfo, 0);
527 return 0; 529 return 0;
528 530
529out_free_new_fa: 531out_free_new_fa:
@@ -589,7 +591,7 @@ static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg)
589 591
590 fa = fa_to_delete; 592 fa = fa_to_delete;
591 rtmsg_fib(RTM_DELROUTE, key, fa, cfg->fc_dst_len, 593 rtmsg_fib(RTM_DELROUTE, key, fa, cfg->fc_dst_len,
592 tb->tb_id, &cfg->fc_nlinfo); 594 tb->tb_id, &cfg->fc_nlinfo, 0);
593 595
594 kill_fn = 0; 596 kill_fn = 0;
595 write_lock_bh(&fib_hash_lock); 597 write_lock_bh(&fib_hash_lock);
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h
index 0e8b70bad4e1..eef9eec17e0c 100644
--- a/net/ipv4/fib_lookup.h
+++ b/net/ipv4/fib_lookup.h
@@ -30,7 +30,8 @@ extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
30 int dst_len, u8 tos, struct fib_info *fi, 30 int dst_len, u8 tos, struct fib_info *fi,
31 unsigned int); 31 unsigned int);
32extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, 32extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
33 int dst_len, u32 tb_id, struct nl_info *info); 33 int dst_len, u32 tb_id, struct nl_info *info,
34 unsigned int nlm_flags);
34extern struct fib_alias *fib_find_alias(struct list_head *fah, 35extern struct fib_alias *fib_find_alias(struct list_head *fah,
35 u8 tos, u32 prio); 36 u8 tos, u32 prio);
36extern int fib_detect_death(struct fib_info *fi, int order, 37extern int fib_detect_death(struct fib_info *fi, int order,
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 406ea7050aed..bb94550d95c3 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -301,7 +301,8 @@ static inline size_t fib_nlmsg_size(struct fib_info *fi)
301} 301}
302 302
303void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, 303void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
304 int dst_len, u32 tb_id, struct nl_info *info) 304 int dst_len, u32 tb_id, struct nl_info *info,
305 unsigned int nlm_flags)
305{ 306{
306 struct sk_buff *skb; 307 struct sk_buff *skb;
307 u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0; 308 u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0;
@@ -313,7 +314,7 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
313 314
314 err = fib_dump_info(skb, info->pid, seq, event, tb_id, 315 err = fib_dump_info(skb, info->pid, seq, event, tb_id,
315 fa->fa_type, fa->fa_scope, key, dst_len, 316 fa->fa_type, fa->fa_scope, key, dst_len,
316 fa->fa_tos, fa->fa_info, 0); 317 fa->fa_tos, fa->fa_info, nlm_flags);
317 if (err < 0) { 318 if (err < 0) {
318 /* -EMSGSIZE implies BUG in fib_nlmsg_size() */ 319 /* -EMSGSIZE implies BUG in fib_nlmsg_size() */
319 WARN_ON(err == -EMSGSIZE); 320 WARN_ON(err == -EMSGSIZE);
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 9be7da7c3a8f..30e332ade61b 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1226,6 +1226,8 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1226 fib_release_info(fi_drop); 1226 fib_release_info(fi_drop);
1227 if (state & FA_S_ACCESSED) 1227 if (state & FA_S_ACCESSED)
1228 rt_cache_flush(-1); 1228 rt_cache_flush(-1);
1229 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen,
1230 tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE);
1229 1231
1230 goto succeeded; 1232 goto succeeded;
1231 } 1233 }
@@ -1278,7 +1280,7 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1278 1280
1279 rt_cache_flush(-1); 1281 rt_cache_flush(-1);
1280 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, 1282 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
1281 &cfg->fc_nlinfo); 1283 &cfg->fc_nlinfo, 0);
1282succeeded: 1284succeeded:
1283 return 0; 1285 return 0;
1284 1286
@@ -1624,7 +1626,7 @@ static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
1624 1626
1625 fa = fa_to_delete; 1627 fa = fa_to_delete;
1626 rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id, 1628 rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id,
1627 &cfg->fc_nlinfo); 1629 &cfg->fc_nlinfo, 0);
1628 1630
1629 l = fib_find_node(t, key); 1631 l = fib_find_node(t, key);
1630 li = find_leaf_info(l, plen); 1632 li = find_leaf_info(l, plen);
diff --git a/net/ipv4/ipvs/Kconfig b/net/ipv4/ipvs/Kconfig
index 891b9355cf96..09d0c3f35669 100644
--- a/net/ipv4/ipvs/Kconfig
+++ b/net/ipv4/ipvs/Kconfig
@@ -1,10 +1,7 @@
1# 1#
2# IP Virtual Server configuration 2# IP Virtual Server configuration
3# 3#
4menu "IP: Virtual Server Configuration" 4menuconfig IP_VS
5 depends on NETFILTER
6
7config IP_VS
8 tristate "IP virtual server support (EXPERIMENTAL)" 5 tristate "IP virtual server support (EXPERIMENTAL)"
9 depends on NETFILTER 6 depends on NETFILTER
10 ---help--- 7 ---help---
@@ -25,9 +22,10 @@ config IP_VS
25 If you want to compile it in kernel, say Y. To compile it as a 22 If you want to compile it in kernel, say Y. To compile it as a
26 module, choose M here. If unsure, say N. 23 module, choose M here. If unsure, say N.
27 24
25if IP_VS
26
28config IP_VS_DEBUG 27config IP_VS_DEBUG
29 bool "IP virtual server debugging" 28 bool "IP virtual server debugging"
30 depends on IP_VS
31 ---help--- 29 ---help---
32 Say Y here if you want to get additional messages useful in 30 Say Y here if you want to get additional messages useful in
33 debugging the IP virtual server code. You can change the debug 31 debugging the IP virtual server code. You can change the debug
@@ -35,7 +33,6 @@ config IP_VS_DEBUG
35 33
36config IP_VS_TAB_BITS 34config IP_VS_TAB_BITS
37 int "IPVS connection table size (the Nth power of 2)" 35 int "IPVS connection table size (the Nth power of 2)"
38 depends on IP_VS
39 default "12" 36 default "12"
40 ---help--- 37 ---help---
41 The IPVS connection hash table uses the chaining scheme to handle 38 The IPVS connection hash table uses the chaining scheme to handle
@@ -61,42 +58,35 @@ config IP_VS_TAB_BITS
61 needed for your box. 58 needed for your box.
62 59
63comment "IPVS transport protocol load balancing support" 60comment "IPVS transport protocol load balancing support"
64 depends on IP_VS
65 61
66config IP_VS_PROTO_TCP 62config IP_VS_PROTO_TCP
67 bool "TCP load balancing support" 63 bool "TCP load balancing support"
68 depends on IP_VS
69 ---help--- 64 ---help---
70 This option enables support for load balancing TCP transport 65 This option enables support for load balancing TCP transport
71 protocol. Say Y if unsure. 66 protocol. Say Y if unsure.
72 67
73config IP_VS_PROTO_UDP 68config IP_VS_PROTO_UDP
74 bool "UDP load balancing support" 69 bool "UDP load balancing support"
75 depends on IP_VS
76 ---help--- 70 ---help---
77 This option enables support for load balancing UDP transport 71 This option enables support for load balancing UDP transport
78 protocol. Say Y if unsure. 72 protocol. Say Y if unsure.
79 73
80config IP_VS_PROTO_ESP 74config IP_VS_PROTO_ESP
81 bool "ESP load balancing support" 75 bool "ESP load balancing support"
82 depends on IP_VS
83 ---help--- 76 ---help---
84 This option enables support for load balancing ESP (Encapsulation 77 This option enables support for load balancing ESP (Encapsulation
85 Security Payload) transport protocol. Say Y if unsure. 78 Security Payload) transport protocol. Say Y if unsure.
86 79
87config IP_VS_PROTO_AH 80config IP_VS_PROTO_AH
88 bool "AH load balancing support" 81 bool "AH load balancing support"
89 depends on IP_VS
90 ---help--- 82 ---help---
91 This option enables support for load balancing AH (Authentication 83 This option enables support for load balancing AH (Authentication
92 Header) transport protocol. Say Y if unsure. 84 Header) transport protocol. Say Y if unsure.
93 85
94comment "IPVS scheduler" 86comment "IPVS scheduler"
95 depends on IP_VS
96 87
97config IP_VS_RR 88config IP_VS_RR
98 tristate "round-robin scheduling" 89 tristate "round-robin scheduling"
99 depends on IP_VS
100 ---help--- 90 ---help---
101 The robin-robin scheduling algorithm simply directs network 91 The robin-robin scheduling algorithm simply directs network
102 connections to different real servers in a round-robin manner. 92 connections to different real servers in a round-robin manner.
@@ -106,7 +96,6 @@ config IP_VS_RR
106 96
107config IP_VS_WRR 97config IP_VS_WRR
108 tristate "weighted round-robin scheduling" 98 tristate "weighted round-robin scheduling"
109 depends on IP_VS
110 ---help--- 99 ---help---
111 The weighted robin-robin scheduling algorithm directs network 100 The weighted robin-robin scheduling algorithm directs network
112 connections to different real servers based on server weights 101 connections to different real servers based on server weights
@@ -120,7 +109,6 @@ config IP_VS_WRR
120 109
121config IP_VS_LC 110config IP_VS_LC
122 tristate "least-connection scheduling" 111 tristate "least-connection scheduling"
123 depends on IP_VS
124 ---help--- 112 ---help---
125 The least-connection scheduling algorithm directs network 113 The least-connection scheduling algorithm directs network
126 connections to the server with the least number of active 114 connections to the server with the least number of active
@@ -131,7 +119,6 @@ config IP_VS_LC
131 119
132config IP_VS_WLC 120config IP_VS_WLC
133 tristate "weighted least-connection scheduling" 121 tristate "weighted least-connection scheduling"
134 depends on IP_VS
135 ---help--- 122 ---help---
136 The weighted least-connection scheduling algorithm directs network 123 The weighted least-connection scheduling algorithm directs network
137 connections to the server with the least active connections 124 connections to the server with the least active connections
@@ -142,7 +129,6 @@ config IP_VS_WLC
142 129
143config IP_VS_LBLC 130config IP_VS_LBLC
144 tristate "locality-based least-connection scheduling" 131 tristate "locality-based least-connection scheduling"
145 depends on IP_VS
146 ---help--- 132 ---help---
147 The locality-based least-connection scheduling algorithm is for 133 The locality-based least-connection scheduling algorithm is for
148 destination IP load balancing. It is usually used in cache cluster. 134 destination IP load balancing. It is usually used in cache cluster.
@@ -157,7 +143,6 @@ config IP_VS_LBLC
157 143
158config IP_VS_LBLCR 144config IP_VS_LBLCR
159 tristate "locality-based least-connection with replication scheduling" 145 tristate "locality-based least-connection with replication scheduling"
160 depends on IP_VS
161 ---help--- 146 ---help---
162 The locality-based least-connection with replication scheduling 147 The locality-based least-connection with replication scheduling
163 algorithm is also for destination IP load balancing. It is 148 algorithm is also for destination IP load balancing. It is
@@ -176,7 +161,6 @@ config IP_VS_LBLCR
176 161
177config IP_VS_DH 162config IP_VS_DH
178 tristate "destination hashing scheduling" 163 tristate "destination hashing scheduling"
179 depends on IP_VS
180 ---help--- 164 ---help---
181 The destination hashing scheduling algorithm assigns network 165 The destination hashing scheduling algorithm assigns network
182 connections to the servers through looking up a statically assigned 166 connections to the servers through looking up a statically assigned
@@ -187,7 +171,6 @@ config IP_VS_DH
187 171
188config IP_VS_SH 172config IP_VS_SH
189 tristate "source hashing scheduling" 173 tristate "source hashing scheduling"
190 depends on IP_VS
191 ---help--- 174 ---help---
192 The source hashing scheduling algorithm assigns network 175 The source hashing scheduling algorithm assigns network
193 connections to the servers through looking up a statically assigned 176 connections to the servers through looking up a statically assigned
@@ -198,7 +181,6 @@ config IP_VS_SH
198 181
199config IP_VS_SED 182config IP_VS_SED
200 tristate "shortest expected delay scheduling" 183 tristate "shortest expected delay scheduling"
201 depends on IP_VS
202 ---help--- 184 ---help---
203 The shortest expected delay scheduling algorithm assigns network 185 The shortest expected delay scheduling algorithm assigns network
204 connections to the server with the shortest expected delay. The 186 connections to the server with the shortest expected delay. The
@@ -212,7 +194,6 @@ config IP_VS_SED
212 194
213config IP_VS_NQ 195config IP_VS_NQ
214 tristate "never queue scheduling" 196 tristate "never queue scheduling"
215 depends on IP_VS
216 ---help--- 197 ---help---
217 The never queue scheduling algorithm adopts a two-speed model. 198 The never queue scheduling algorithm adopts a two-speed model.
218 When there is an idle server available, the job will be sent to 199 When there is an idle server available, the job will be sent to
@@ -225,11 +206,10 @@ config IP_VS_NQ
225 module, choose M here. If unsure, say N. 206 module, choose M here. If unsure, say N.
226 207
227comment 'IPVS application helper' 208comment 'IPVS application helper'
228 depends on IP_VS
229 209
230config IP_VS_FTP 210config IP_VS_FTP
231 tristate "FTP protocol helper" 211 tristate "FTP protocol helper"
232 depends on IP_VS && IP_VS_PROTO_TCP 212 depends on IP_VS_PROTO_TCP
233 ---help--- 213 ---help---
234 FTP is a protocol that transfers IP address and/or port number in 214 FTP is a protocol that transfers IP address and/or port number in
235 the payload. In the virtual server via Network Address Translation, 215 the payload. In the virtual server via Network Address Translation,
@@ -241,4 +221,4 @@ config IP_VS_FTP
241 If you want to compile it in kernel, say Y. To compile it as a 221 If you want to compile it in kernel, say Y. To compile it as a
242 module, choose M here. If unsure, say N. 222 module, choose M here. If unsure, say N.
243 223
244endmenu 224endif # IP_VS
diff --git a/net/ipv4/netfilter/nf_nat_ftp.c b/net/ipv4/netfilter/nf_nat_ftp.c
index 751b59801755..e6bc8e5a72f1 100644
--- a/net/ipv4/netfilter/nf_nat_ftp.c
+++ b/net/ipv4/netfilter/nf_nat_ftp.c
@@ -40,8 +40,7 @@ mangle_rfc959_packet(struct sk_buff **pskb,
40 unsigned int matchoff, 40 unsigned int matchoff,
41 unsigned int matchlen, 41 unsigned int matchlen,
42 struct nf_conn *ct, 42 struct nf_conn *ct,
43 enum ip_conntrack_info ctinfo, 43 enum ip_conntrack_info ctinfo)
44 u32 *seq)
45{ 44{
46 char buffer[sizeof("nnn,nnn,nnn,nnn,nnn,nnn")]; 45 char buffer[sizeof("nnn,nnn,nnn,nnn,nnn,nnn")];
47 46
@@ -50,7 +49,6 @@ mangle_rfc959_packet(struct sk_buff **pskb,
50 49
51 DEBUGP("calling nf_nat_mangle_tcp_packet\n"); 50 DEBUGP("calling nf_nat_mangle_tcp_packet\n");
52 51
53 *seq += strlen(buffer) - matchlen;
54 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, 52 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
55 matchlen, buffer, strlen(buffer)); 53 matchlen, buffer, strlen(buffer));
56} 54}
@@ -63,8 +61,7 @@ mangle_eprt_packet(struct sk_buff **pskb,
63 unsigned int matchoff, 61 unsigned int matchoff,
64 unsigned int matchlen, 62 unsigned int matchlen,
65 struct nf_conn *ct, 63 struct nf_conn *ct,
66 enum ip_conntrack_info ctinfo, 64 enum ip_conntrack_info ctinfo)
67 u32 *seq)
68{ 65{
69 char buffer[sizeof("|1|255.255.255.255|65535|")]; 66 char buffer[sizeof("|1|255.255.255.255|65535|")];
70 67
@@ -72,7 +69,6 @@ mangle_eprt_packet(struct sk_buff **pskb,
72 69
73 DEBUGP("calling nf_nat_mangle_tcp_packet\n"); 70 DEBUGP("calling nf_nat_mangle_tcp_packet\n");
74 71
75 *seq += strlen(buffer) - matchlen;
76 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, 72 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
77 matchlen, buffer, strlen(buffer)); 73 matchlen, buffer, strlen(buffer));
78} 74}
@@ -85,8 +81,7 @@ mangle_epsv_packet(struct sk_buff **pskb,
85 unsigned int matchoff, 81 unsigned int matchoff,
86 unsigned int matchlen, 82 unsigned int matchlen,
87 struct nf_conn *ct, 83 struct nf_conn *ct,
88 enum ip_conntrack_info ctinfo, 84 enum ip_conntrack_info ctinfo)
89 u32 *seq)
90{ 85{
91 char buffer[sizeof("|||65535|")]; 86 char buffer[sizeof("|||65535|")];
92 87
@@ -94,14 +89,13 @@ mangle_epsv_packet(struct sk_buff **pskb,
94 89
95 DEBUGP("calling nf_nat_mangle_tcp_packet\n"); 90 DEBUGP("calling nf_nat_mangle_tcp_packet\n");
96 91
97 *seq += strlen(buffer) - matchlen;
98 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, 92 return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
99 matchlen, buffer, strlen(buffer)); 93 matchlen, buffer, strlen(buffer));
100} 94}
101 95
102static int (*mangle[])(struct sk_buff **, __be32, u_int16_t, 96static int (*mangle[])(struct sk_buff **, __be32, u_int16_t,
103 unsigned int, unsigned int, struct nf_conn *, 97 unsigned int, unsigned int, struct nf_conn *,
104 enum ip_conntrack_info, u32 *seq) 98 enum ip_conntrack_info)
105= { 99= {
106 [NF_CT_FTP_PORT] = mangle_rfc959_packet, 100 [NF_CT_FTP_PORT] = mangle_rfc959_packet,
107 [NF_CT_FTP_PASV] = mangle_rfc959_packet, 101 [NF_CT_FTP_PASV] = mangle_rfc959_packet,
@@ -116,8 +110,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb,
116 enum nf_ct_ftp_type type, 110 enum nf_ct_ftp_type type,
117 unsigned int matchoff, 111 unsigned int matchoff,
118 unsigned int matchlen, 112 unsigned int matchlen,
119 struct nf_conntrack_expect *exp, 113 struct nf_conntrack_expect *exp)
120 u32 *seq)
121{ 114{
122 __be32 newip; 115 __be32 newip;
123 u_int16_t port; 116 u_int16_t port;
@@ -145,8 +138,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb,
145 if (port == 0) 138 if (port == 0)
146 return NF_DROP; 139 return NF_DROP;
147 140
148 if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo, 141 if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo)) {
149 seq)) {
150 nf_conntrack_unexpect_related(exp); 142 nf_conntrack_unexpect_related(exp);
151 return NF_DROP; 143 return NF_DROP;
152 } 144 }
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index fcebc968d37f..c5d2a2d690b8 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -455,9 +455,9 @@ static int nat_q931(struct sk_buff **pskb, struct nf_conn *ct,
455 if (idx > 0 && 455 if (idx > 0 &&
456 get_h225_addr(ct, *data, &taddr[0], &addr, &port) && 456 get_h225_addr(ct, *data, &taddr[0], &addr, &port) &&
457 (ntohl(addr.ip) & 0xff000000) == 0x7f000000) { 457 (ntohl(addr.ip) & 0xff000000) == 0x7f000000) {
458 set_h225_addr_hook(pskb, data, 0, &taddr[0], 458 set_h225_addr(pskb, data, 0, &taddr[0],
459 &ct->tuplehash[!dir].tuple.dst.u3, 459 &ct->tuplehash[!dir].tuple.dst.u3,
460 info->sig_port[!dir]); 460 info->sig_port[!dir]);
461 } 461 }
462 } else { 462 } else {
463 nf_conntrack_unexpect_related(exp); 463 nf_conntrack_unexpect_related(exp);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df9fe4f2e8cc..8603cfb271f2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2598,6 +2598,69 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
2598 2598
2599EXPORT_SYMBOL_GPL(__ip_route_output_key); 2599EXPORT_SYMBOL_GPL(__ip_route_output_key);
2600 2600
2601static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
2602{
2603}
2604
2605static struct dst_ops ipv4_dst_blackhole_ops = {
2606 .family = AF_INET,
2607 .protocol = __constant_htons(ETH_P_IP),
2608 .destroy = ipv4_dst_destroy,
2609 .check = ipv4_dst_check,
2610 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2611 .entry_size = sizeof(struct rtable),
2612};
2613
2614
2615static int ipv4_blackhole_output(struct sk_buff *skb)
2616{
2617 kfree_skb(skb);
2618 return 0;
2619}
2620
2621static int ipv4_dst_blackhole(struct rtable **rp, struct flowi *flp, struct sock *sk)
2622{
2623 struct rtable *ort = *rp;
2624 struct rtable *rt = (struct rtable *)
2625 dst_alloc(&ipv4_dst_blackhole_ops);
2626
2627 if (rt) {
2628 struct dst_entry *new = &rt->u.dst;
2629
2630 atomic_set(&new->__refcnt, 1);
2631 new->__use = 1;
2632 new->input = ipv4_blackhole_output;
2633 new->output = ipv4_blackhole_output;
2634 memcpy(new->metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32));
2635
2636 new->dev = ort->u.dst.dev;
2637 if (new->dev)
2638 dev_hold(new->dev);
2639
2640 rt->fl = ort->fl;
2641
2642 rt->idev = ort->idev;
2643 if (rt->idev)
2644 in_dev_hold(rt->idev);
2645 rt->rt_flags = ort->rt_flags;
2646 rt->rt_type = ort->rt_type;
2647 rt->rt_dst = ort->rt_dst;
2648 rt->rt_src = ort->rt_src;
2649 rt->rt_iif = ort->rt_iif;
2650 rt->rt_gateway = ort->rt_gateway;
2651 rt->rt_spec_dst = ort->rt_spec_dst;
2652 rt->peer = ort->peer;
2653 if (rt->peer)
2654 atomic_inc(&rt->peer->refcnt);
2655
2656 dst_free(new);
2657 }
2658
2659 dst_release(&(*rp)->u.dst);
2660 *rp = rt;
2661 return (rt ? 0 : -ENOMEM);
2662}
2663
2601int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) 2664int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags)
2602{ 2665{
2603 int err; 2666 int err;
@@ -2610,7 +2673,11 @@ int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk,
2610 flp->fl4_src = (*rp)->rt_src; 2673 flp->fl4_src = (*rp)->rt_src;
2611 if (!flp->fl4_dst) 2674 if (!flp->fl4_dst)
2612 flp->fl4_dst = (*rp)->rt_dst; 2675 flp->fl4_dst = (*rp)->rt_dst;
2613 return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags); 2676 err = __xfrm_lookup((struct dst_entry **)rp, flp, sk, flags);
2677 if (err == -EREMOTE)
2678 err = ipv4_dst_blackhole(rp, flp, sk);
2679
2680 return err;
2614 } 2681 }
2615 2682
2616 return 0; 2683 return 0;
@@ -3139,6 +3206,8 @@ int __init ip_rt_init(void)
3139 kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, 3206 kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0,
3140 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 3207 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
3141 3208
3209 ipv4_dst_blackhole_ops.kmem_cachep = ipv4_dst_ops.kmem_cachep;
3210
3142 rt_hash_table = (struct rt_hash_bucket *) 3211 rt_hash_table = (struct rt_hash_bucket *)
3143 alloc_large_system_hash("IP route cache", 3212 alloc_large_system_hash("IP route cache",
3144 sizeof(struct rt_hash_bucket), 3213 sizeof(struct rt_hash_bucket),
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c7ea248fae2e..329de679ac38 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2154,15 +2154,6 @@ static void addrconf_dev_config(struct net_device *dev)
2154 2154
2155 ASSERT_RTNL(); 2155 ASSERT_RTNL();
2156 2156
2157 if ((dev->type != ARPHRD_ETHER) &&
2158 (dev->type != ARPHRD_FDDI) &&
2159 (dev->type != ARPHRD_IEEE802_TR) &&
2160 (dev->type != ARPHRD_ARCNET) &&
2161 (dev->type != ARPHRD_INFINIBAND)) {
2162 /* Alas, we support only Ethernet autoconfiguration. */
2163 return;
2164 }
2165
2166 idev = addrconf_add_dev(dev); 2157 idev = addrconf_add_dev(dev);
2167 if (idev == NULL) 2158 if (idev == NULL)
2168 return; 2159 return;
@@ -2250,13 +2241,33 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
2250 ip6_tnl_add_linklocal(idev); 2241 ip6_tnl_add_linklocal(idev);
2251} 2242}
2252 2243
2244static int ipv6_hwtype(struct net_device *dev)
2245{
2246 if ((dev->type == ARPHRD_ETHER) ||
2247 (dev->type == ARPHRD_LOOPBACK) ||
2248 (dev->type == ARPHRD_SIT) ||
2249 (dev->type == ARPHRD_TUNNEL6) ||
2250 (dev->type == ARPHRD_FDDI) ||
2251 (dev->type == ARPHRD_IEEE802_TR) ||
2252 (dev->type == ARPHRD_ARCNET) ||
2253 (dev->type == ARPHRD_INFINIBAND))
2254 return 1;
2255
2256 return 0;
2257}
2258
2253static int addrconf_notify(struct notifier_block *this, unsigned long event, 2259static int addrconf_notify(struct notifier_block *this, unsigned long event,
2254 void * data) 2260 void * data)
2255{ 2261{
2256 struct net_device *dev = (struct net_device *) data; 2262 struct net_device *dev = (struct net_device *) data;
2257 struct inet6_dev *idev = __in6_dev_get(dev); 2263 struct inet6_dev *idev;
2258 int run_pending = 0; 2264 int run_pending = 0;
2259 2265
2266 if (!ipv6_hwtype(dev))
2267 return NOTIFY_OK;
2268
2269 idev = __in6_dev_get(dev);
2270
2260 switch(event) { 2271 switch(event) {
2261 case NETDEV_REGISTER: 2272 case NETDEV_REGISTER:
2262 if (!idev) { 2273 if (!idev) {
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 403eee66b9c5..b1fe7ac5dc90 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -177,8 +177,12 @@ ipv4_connected:
177 if (final_p) 177 if (final_p)
178 ipv6_addr_copy(&fl.fl6_dst, final_p); 178 ipv6_addr_copy(&fl.fl6_dst, final_p);
179 179
180 if ((err = xfrm_lookup(&dst, &fl, sk, 1)) < 0) 180 if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
181 goto out; 181 if (err == -EREMOTE)
182 err = ip6_dst_blackhole(sk, &dst, &fl);
183 if (err < 0)
184 goto out;
185 }
182 186
183 /* source address lookup done in ip6_dst_lookup */ 187 /* source address lookup done in ip6_dst_lookup */
184 188
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 009a1047fc3f..a58459a76684 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -818,8 +818,12 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
818 if (final_p) 818 if (final_p)
819 ipv6_addr_copy(&fl.fl6_dst, final_p); 819 ipv6_addr_copy(&fl.fl6_dst, final_p);
820 820
821 if ((err = xfrm_lookup(&dst, &fl, sk, 1)) < 0) 821 if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
822 goto out; 822 if (err == -EREMOTE)
823 err = ip6_dst_blackhole(sk, &dst, &fl);
824 if (err < 0)
825 goto out;
826 }
823 827
824 if (hlimit < 0) { 828 if (hlimit < 0) {
825 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 829 if (ipv6_addr_is_multicast(&fl.fl6_dst))
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b46ad53044ba..1324b06796c0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -119,6 +119,19 @@ static struct dst_ops ip6_dst_ops = {
119 .entry_size = sizeof(struct rt6_info), 119 .entry_size = sizeof(struct rt6_info),
120}; 120};
121 121
122static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
123{
124}
125
126static struct dst_ops ip6_dst_blackhole_ops = {
127 .family = AF_INET6,
128 .protocol = __constant_htons(ETH_P_IPV6),
129 .destroy = ip6_dst_destroy,
130 .check = ip6_dst_check,
131 .update_pmtu = ip6_rt_blackhole_update_pmtu,
132 .entry_size = sizeof(struct rt6_info),
133};
134
122struct rt6_info ip6_null_entry = { 135struct rt6_info ip6_null_entry = {
123 .u = { 136 .u = {
124 .dst = { 137 .dst = {
@@ -833,6 +846,54 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
833 846
834EXPORT_SYMBOL(ip6_route_output); 847EXPORT_SYMBOL(ip6_route_output);
835 848
849static int ip6_blackhole_output(struct sk_buff *skb)
850{
851 kfree_skb(skb);
852 return 0;
853}
854
855int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl)
856{
857 struct rt6_info *ort = (struct rt6_info *) *dstp;
858 struct rt6_info *rt = (struct rt6_info *)
859 dst_alloc(&ip6_dst_blackhole_ops);
860 struct dst_entry *new = NULL;
861
862 if (rt) {
863 new = &rt->u.dst;
864
865 atomic_set(&new->__refcnt, 1);
866 new->__use = 1;
867 new->input = ip6_blackhole_output;
868 new->output = ip6_blackhole_output;
869
870 memcpy(new->metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32));
871 new->dev = ort->u.dst.dev;
872 if (new->dev)
873 dev_hold(new->dev);
874 rt->rt6i_idev = ort->rt6i_idev;
875 if (rt->rt6i_idev)
876 in6_dev_hold(rt->rt6i_idev);
877 rt->rt6i_expires = 0;
878
879 ipv6_addr_copy(&rt->rt6i_gateway, &ort->rt6i_gateway);
880 rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES;
881 rt->rt6i_metric = 0;
882
883 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key));
884#ifdef CONFIG_IPV6_SUBTREES
885 memcpy(&rt->rt6i_src, &ort->rt6i_src, sizeof(struct rt6key));
886#endif
887
888 dst_free(new);
889 }
890
891 dst_release(*dstp);
892 *dstp = new;
893 return (new ? 0 : -ENOMEM);
894}
895EXPORT_SYMBOL_GPL(ip6_dst_blackhole);
896
836/* 897/*
837 * Destination cache support functions 898 * Destination cache support functions
838 */ 899 */
@@ -2495,6 +2556,8 @@ void __init ip6_route_init(void)
2495 ip6_dst_ops.kmem_cachep = 2556 ip6_dst_ops.kmem_cachep =
2496 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, 2557 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
2497 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 2558 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
2559 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep;
2560
2498 fib6_init(); 2561 fib6_init();
2499#ifdef CONFIG_PROC_FS 2562#ifdef CONFIG_PROC_FS
2500 p = proc_net_create("ipv6_route", 0, rt6_proc_info); 2563 p = proc_net_create("ipv6_route", 0, rt6_proc_info);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e2f25ea43b68..4f06a51ad4fd 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -265,8 +265,12 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
265 if (final_p) 265 if (final_p)
266 ipv6_addr_copy(&fl.fl6_dst, final_p); 266 ipv6_addr_copy(&fl.fl6_dst, final_p);
267 267
268 if ((err = xfrm_lookup(&dst, &fl, sk, 1)) < 0) 268 if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
269 goto failure; 269 if (err == -EREMOTE)
270 err = ip6_dst_blackhole(sk, &dst, &fl);
271 if (err < 0)
272 goto failure;
273 }
270 274
271 if (saddr == NULL) { 275 if (saddr == NULL) {
272 saddr = &fl.fl6_src; 276 saddr = &fl.fl6_src;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index a7ae59c954d5..d1fbddd172e7 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -767,8 +767,12 @@ do_udp_sendmsg:
767 if (final_p) 767 if (final_p)
768 ipv6_addr_copy(&fl.fl6_dst, final_p); 768 ipv6_addr_copy(&fl.fl6_dst, final_p);
769 769
770 if ((err = xfrm_lookup(&dst, &fl, sk, 1)) < 0) 770 if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
771 goto out; 771 if (err == -EREMOTE)
772 err = ip6_dst_blackhole(sk, &dst, &fl);
773 if (err < 0)
774 goto out;
775 }
772 776
773 if (hlimit < 0) { 777 if (hlimit < 0) {
774 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 778 if (ipv6_addr_is_multicast(&fl.fl6_dst))
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index a186799f6542..82db2aa53bfc 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -48,8 +48,7 @@ unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
48 enum nf_ct_ftp_type type, 48 enum nf_ct_ftp_type type,
49 unsigned int matchoff, 49 unsigned int matchoff,
50 unsigned int matchlen, 50 unsigned int matchlen,
51 struct nf_conntrack_expect *exp, 51 struct nf_conntrack_expect *exp);
52 u32 *seq);
53EXPORT_SYMBOL_GPL(nf_nat_ftp_hook); 52EXPORT_SYMBOL_GPL(nf_nat_ftp_hook);
54 53
55#if 0 54#if 0
@@ -335,15 +334,17 @@ static void update_nl_seq(u32 nl_seq, struct nf_ct_ftp_master *info, int dir,
335 if (info->seq_aft_nl[dir][i] == nl_seq) 334 if (info->seq_aft_nl[dir][i] == nl_seq)
336 return; 335 return;
337 336
338 if (oldest == info->seq_aft_nl_num[dir] 337 if (oldest == info->seq_aft_nl_num[dir] ||
339 || before(info->seq_aft_nl[dir][i], oldest)) 338 before(info->seq_aft_nl[dir][i],
339 info->seq_aft_nl[dir][oldest]))
340 oldest = i; 340 oldest = i;
341 } 341 }
342 342
343 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) { 343 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {
344 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq; 344 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;
345 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb); 345 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb);
346 } else if (oldest != NUM_SEQ_TO_REMEMBER) { 346 } else if (oldest != NUM_SEQ_TO_REMEMBER &&
347 after(nl_seq, info->seq_aft_nl[dir][oldest])) {
347 info->seq_aft_nl[dir][oldest] = nl_seq; 348 info->seq_aft_nl[dir][oldest] = nl_seq;
348 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb); 349 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb);
349 } 350 }
@@ -519,7 +520,7 @@ static int help(struct sk_buff **pskb,
519 nf_nat_ftp = rcu_dereference(nf_nat_ftp_hook); 520 nf_nat_ftp = rcu_dereference(nf_nat_ftp_hook);
520 if (nf_nat_ftp && ct->status & IPS_NAT_MASK) 521 if (nf_nat_ftp && ct->status & IPS_NAT_MASK)
521 ret = nf_nat_ftp(pskb, ctinfo, search[dir][i].ftptype, 522 ret = nf_nat_ftp(pskb, ctinfo, search[dir][i].ftptype,
522 matchoff, matchlen, exp, &seq); 523 matchoff, matchlen, exp);
523 else { 524 else {
524 /* Can't expect this? Best to drop packet now. */ 525 /* Can't expect this? Best to drop packet now. */
525 if (nf_conntrack_expect_related(exp) != 0) 526 if (nf_conntrack_expect_related(exp) != 0)
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index b284db73ca7c..a1b95acad297 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -520,6 +520,16 @@ static int process_olca(struct sk_buff **pskb, struct nf_conn *ct,
520 } 520 }
521 } 521 }
522 522
523 if ((olca->options & eOpenLogicalChannelAck_separateStack) &&
524 olca->separateStack.networkAddress.choice ==
525 eNetworkAccessParameters_networkAddress_localAreaAddress) {
526 ret = expect_t120(pskb, ct, ctinfo, data, dataoff,
527 &olca->separateStack.networkAddress.
528 localAreaAddress);
529 if (ret < 0)
530 return -1;
531 }
532
523 return 0; 533 return 0;
524} 534}
525 535
@@ -640,7 +650,7 @@ int get_h225_addr(struct nf_conn *ct, unsigned char *data,
640 case eTransportAddress_ip6Address: 650 case eTransportAddress_ip6Address:
641 if (family != AF_INET6) 651 if (family != AF_INET6)
642 return 0; 652 return 0;
643 p = data + taddr->ip6Address.ip6; 653 p = data + taddr->ip6Address.ip;
644 len = 16; 654 len = 16;
645 break; 655 break;
646 default: 656 default:
@@ -977,30 +987,6 @@ static int process_alerting(struct sk_buff **pskb, struct nf_conn *ct,
977} 987}
978 988
979/****************************************************************************/ 989/****************************************************************************/
980static int process_information(struct sk_buff **pskb,
981 struct nf_conn *ct,
982 enum ip_conntrack_info ctinfo,
983 unsigned char **data, int dataoff,
984 Information_UUIE *info)
985{
986 int ret;
987 int i;
988
989 DEBUGP("nf_ct_q931: Information\n");
990
991 if (info->options & eInformation_UUIE_fastStart) {
992 for (i = 0; i < info->fastStart.count; i++) {
993 ret = process_olc(pskb, ct, ctinfo, data, dataoff,
994 &info->fastStart.item[i]);
995 if (ret < 0)
996 return -1;
997 }
998 }
999
1000 return 0;
1001}
1002
1003/****************************************************************************/
1004static int process_facility(struct sk_buff **pskb, struct nf_conn *ct, 990static int process_facility(struct sk_buff **pskb, struct nf_conn *ct,
1005 enum ip_conntrack_info ctinfo, 991 enum ip_conntrack_info ctinfo,
1006 unsigned char **data, int dataoff, 992 unsigned char **data, int dataoff,
@@ -1096,11 +1082,6 @@ static int process_q931(struct sk_buff **pskb, struct nf_conn *ct,
1096 ret = process_alerting(pskb, ct, ctinfo, data, dataoff, 1082 ret = process_alerting(pskb, ct, ctinfo, data, dataoff,
1097 &pdu->h323_message_body.alerting); 1083 &pdu->h323_message_body.alerting);
1098 break; 1084 break;
1099 case eH323_UU_PDU_h323_message_body_information:
1100 ret = process_information(pskb, ct, ctinfo, data, dataoff,
1101 &pdu->h323_message_body.
1102 information);
1103 break;
1104 case eH323_UU_PDU_h323_message_body_facility: 1085 case eH323_UU_PDU_h323_message_body_facility:
1105 ret = process_facility(pskb, ct, ctinfo, data, dataoff, 1086 ret = process_facility(pskb, ct, ctinfo, data, dataoff,
1106 &pdu->h323_message_body.facility); 1087 &pdu->h323_message_body.facility);
diff --git a/net/netfilter/nf_conntrack_h323_types.c b/net/netfilter/nf_conntrack_h323_types.c
index 4c6f8b3b1208..3a21fdf1a265 100644
--- a/net/netfilter/nf_conntrack_h323_types.c
+++ b/net/netfilter/nf_conntrack_h323_types.c
@@ -1,4 +1,4 @@
1/* Generated by Jing Min Zhao's ASN.1 parser, Apr 20 2006 1/* Generated by Jing Min Zhao's ASN.1 parser, May 16 2007
2 * 2 *
3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> 3 * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
4 * 4 *
@@ -37,7 +37,7 @@ static field_t _TransportAddress_ipxAddress[] = { /* SEQUENCE */
37 37
38static field_t _TransportAddress_ip6Address[] = { /* SEQUENCE */ 38static field_t _TransportAddress_ip6Address[] = { /* SEQUENCE */
39 {FNAME("ip") OCTSTR, FIXD, 16, 0, DECODE, 39 {FNAME("ip") OCTSTR, FIXD, 16, 0, DECODE,
40 offsetof(TransportAddress_ip6Address, ip6), NULL}, 40 offsetof(TransportAddress_ip6Address, ip), NULL},
41 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL}, 41 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL},
42}; 42};
43 43
@@ -67,7 +67,8 @@ static field_t _TransportAddress[] = { /* CHOICE */
67 {FNAME("ipxAddress") SEQ, 0, 3, 3, SKIP, 0, 67 {FNAME("ipxAddress") SEQ, 0, 3, 3, SKIP, 0,
68 _TransportAddress_ipxAddress}, 68 _TransportAddress_ipxAddress},
69 {FNAME("ip6Address") SEQ, 0, 2, 2, DECODE | EXT, 69 {FNAME("ip6Address") SEQ, 0, 2, 2, DECODE | EXT,
70 offsetof(TransportAddress, ip6Address), _TransportAddress_ip6Address}, 70 offsetof(TransportAddress, ip6Address),
71 _TransportAddress_ip6Address},
71 {FNAME("netBios") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL}, 72 {FNAME("netBios") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL},
72 {FNAME("nsap") OCTSTR, 5, 1, 0, SKIP, 0, NULL}, 73 {FNAME("nsap") OCTSTR, 5, 1, 0, SKIP, 0, NULL},
73 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0, 74 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0,
@@ -638,7 +639,8 @@ static field_t _UnicastAddress_iPXAddress[] = { /* SEQUENCE */
638}; 639};
639 640
640static field_t _UnicastAddress_iP6Address[] = { /* SEQUENCE */ 641static field_t _UnicastAddress_iP6Address[] = { /* SEQUENCE */
641 {FNAME("network") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL}, 642 {FNAME("network") OCTSTR, FIXD, 16, 0, DECODE,
643 offsetof(UnicastAddress_iP6Address, network), NULL},
642 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL}, 644 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL},
643}; 645};
644 646
@@ -665,8 +667,8 @@ static field_t _UnicastAddress[] = { /* CHOICE */
665 offsetof(UnicastAddress, iPAddress), _UnicastAddress_iPAddress}, 667 offsetof(UnicastAddress, iPAddress), _UnicastAddress_iPAddress},
666 {FNAME("iPXAddress") SEQ, 0, 3, 3, SKIP | EXT, 0, 668 {FNAME("iPXAddress") SEQ, 0, 3, 3, SKIP | EXT, 0,
667 _UnicastAddress_iPXAddress}, 669 _UnicastAddress_iPXAddress},
668 {FNAME("iP6Address") SEQ, 0, 2, 2, SKIP | EXT, 0, 670 {FNAME("iP6Address") SEQ, 0, 2, 2, DECODE | EXT,
669 _UnicastAddress_iP6Address}, 671 offsetof(UnicastAddress, iP6Address), _UnicastAddress_iP6Address},
670 {FNAME("netBios") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL}, 672 {FNAME("netBios") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL},
671 {FNAME("iPSourceRouteAddress") SEQ, 0, 4, 4, SKIP | EXT, 0, 673 {FNAME("iPSourceRouteAddress") SEQ, 0, 4, 4, SKIP | EXT, 0,
672 _UnicastAddress_iPSourceRouteAddress}, 674 _UnicastAddress_iPSourceRouteAddress},
@@ -984,19 +986,12 @@ static field_t _Alerting_UUIE[] = { /* SEQUENCE */
984 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL}, 986 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL},
985}; 987};
986 988
987static field_t _Information_UUIE_fastStart[] = { /* SEQUENCE OF */
988 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
989 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
990 ,
991};
992
993static field_t _Information_UUIE[] = { /* SEQUENCE */ 989static field_t _Information_UUIE[] = { /* SEQUENCE */
994 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 990 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
995 {FNAME("callIdentifier") SEQ, 0, 1, 1, SKIP | EXT, 0, NULL}, 991 {FNAME("callIdentifier") SEQ, 0, 1, 1, SKIP | EXT, 0, NULL},
996 {FNAME("tokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 992 {FNAME("tokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
997 {FNAME("cryptoTokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 993 {FNAME("cryptoTokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
998 {FNAME("fastStart") SEQOF, SEMI, 0, 30, DECODE | OPT, 994 {FNAME("fastStart") SEQOF, SEMI, 0, 30, SKIP | OPT, 0, NULL},
999 offsetof(Information_UUIE, fastStart), _Information_UUIE_fastStart},
1000 {FNAME("fastConnectRefused") NUL, FIXD, 0, 0, SKIP | OPT, 0, NULL}, 995 {FNAME("fastConnectRefused") NUL, FIXD, 0, 0, SKIP | OPT, 0, NULL},
1001 {FNAME("circuitInfo") SEQ, 3, 3, 3, SKIP | EXT | OPT, 0, NULL}, 996 {FNAME("circuitInfo") SEQ, 3, 3, 3, SKIP | EXT | OPT, 0, NULL},
1002}; 997};
@@ -1343,9 +1338,7 @@ static field_t _H323_UU_PDU_h323_message_body[] = { /* CHOICE */
1343 offsetof(H323_UU_PDU_h323_message_body, connect), _Connect_UUIE}, 1338 offsetof(H323_UU_PDU_h323_message_body, connect), _Connect_UUIE},
1344 {FNAME("alerting") SEQ, 1, 3, 17, DECODE | EXT, 1339 {FNAME("alerting") SEQ, 1, 3, 17, DECODE | EXT,
1345 offsetof(H323_UU_PDU_h323_message_body, alerting), _Alerting_UUIE}, 1340 offsetof(H323_UU_PDU_h323_message_body, alerting), _Alerting_UUIE},
1346 {FNAME("information") SEQ, 0, 1, 7, DECODE | EXT, 1341 {FNAME("information") SEQ, 0, 1, 7, SKIP | EXT, 0, _Information_UUIE},
1347 offsetof(H323_UU_PDU_h323_message_body, information),
1348 _Information_UUIE},
1349 {FNAME("releaseComplete") SEQ, 1, 2, 11, SKIP | EXT, 0, 1342 {FNAME("releaseComplete") SEQ, 1, 2, 11, SKIP | EXT, 0,
1350 _ReleaseComplete_UUIE}, 1343 _ReleaseComplete_UUIE},
1351 {FNAME("facility") SEQ, 3, 5, 21, DECODE | EXT, 1344 {FNAME("facility") SEQ, 3, 5, 21, DECODE | EXT,
@@ -1430,7 +1423,9 @@ static field_t _OpenLogicalChannelAck[] = { /* SEQUENCE */
1430 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck, 1423 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck,
1431 reverseLogicalChannelParameters), 1424 reverseLogicalChannelParameters),
1432 _OpenLogicalChannelAck_reverseLogicalChannelParameters}, 1425 _OpenLogicalChannelAck_reverseLogicalChannelParameters},
1433 {FNAME("separateStack") SEQ, 2, 4, 5, SKIP | EXT | OPT, 0, NULL}, 1426 {FNAME("separateStack") SEQ, 2, 4, 5, DECODE | EXT | OPT,
1427 offsetof(OpenLogicalChannelAck, separateStack),
1428 _NetworkAccessParameters},
1434 {FNAME("forwardMultiplexAckParameters") CHOICE, 0, 1, 1, 1429 {FNAME("forwardMultiplexAckParameters") CHOICE, 0, 1, 1,
1435 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck, 1430 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck,
1436 forwardMultiplexAckParameters), 1431 forwardMultiplexAckParameters),
diff --git a/net/rxrpc/Kconfig b/net/rxrpc/Kconfig
index 91b3d52f6f1a..e662f1d07664 100644
--- a/net/rxrpc/Kconfig
+++ b/net/rxrpc/Kconfig
@@ -4,7 +4,7 @@
4 4
5config AF_RXRPC 5config AF_RXRPC
6 tristate "RxRPC session sockets" 6 tristate "RxRPC session sockets"
7 depends on EXPERIMENTAL 7 depends on INET && EXPERIMENTAL
8 select KEYS 8 select KEYS
9 help 9 help
10 Say Y or M here to include support for RxRPC session sockets (just 10 Say Y or M here to include support for RxRPC session sockets (just
diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c
index 4d92d88ff1fc..3c04b00dab74 100644
--- a/net/rxrpc/ar-call.c
+++ b/net/rxrpc/ar-call.c
@@ -15,6 +15,25 @@
15#include <net/af_rxrpc.h> 15#include <net/af_rxrpc.h>
16#include "ar-internal.h" 16#include "ar-internal.h"
17 17
18const char *rxrpc_call_states[] = {
19 [RXRPC_CALL_CLIENT_SEND_REQUEST] = "ClSndReq",
20 [RXRPC_CALL_CLIENT_AWAIT_REPLY] = "ClAwtRpl",
21 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl",
22 [RXRPC_CALL_CLIENT_FINAL_ACK] = "ClFnlACK",
23 [RXRPC_CALL_SERVER_SECURING] = "SvSecure",
24 [RXRPC_CALL_SERVER_ACCEPTING] = "SvAccept",
25 [RXRPC_CALL_SERVER_RECV_REQUEST] = "SvRcvReq",
26 [RXRPC_CALL_SERVER_ACK_REQUEST] = "SvAckReq",
27 [RXRPC_CALL_SERVER_SEND_REPLY] = "SvSndRpl",
28 [RXRPC_CALL_SERVER_AWAIT_ACK] = "SvAwtACK",
29 [RXRPC_CALL_COMPLETE] = "Complete",
30 [RXRPC_CALL_SERVER_BUSY] = "SvBusy ",
31 [RXRPC_CALL_REMOTELY_ABORTED] = "RmtAbort",
32 [RXRPC_CALL_LOCALLY_ABORTED] = "LocAbort",
33 [RXRPC_CALL_NETWORK_ERROR] = "NetError",
34 [RXRPC_CALL_DEAD] = "Dead ",
35};
36
18struct kmem_cache *rxrpc_call_jar; 37struct kmem_cache *rxrpc_call_jar;
19LIST_HEAD(rxrpc_calls); 38LIST_HEAD(rxrpc_calls);
20DEFINE_RWLOCK(rxrpc_call_lock); 39DEFINE_RWLOCK(rxrpc_call_lock);
diff --git a/net/rxrpc/ar-proc.c b/net/rxrpc/ar-proc.c
index 58f4b4e5cece..1c0be0e77b16 100644
--- a/net/rxrpc/ar-proc.c
+++ b/net/rxrpc/ar-proc.c
@@ -25,25 +25,6 @@ static const char *rxrpc_conn_states[] = {
25 [RXRPC_CONN_NETWORK_ERROR] = "NetError", 25 [RXRPC_CONN_NETWORK_ERROR] = "NetError",
26}; 26};
27 27
28const char *rxrpc_call_states[] = {
29 [RXRPC_CALL_CLIENT_SEND_REQUEST] = "ClSndReq",
30 [RXRPC_CALL_CLIENT_AWAIT_REPLY] = "ClAwtRpl",
31 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl",
32 [RXRPC_CALL_CLIENT_FINAL_ACK] = "ClFnlACK",
33 [RXRPC_CALL_SERVER_SECURING] = "SvSecure",
34 [RXRPC_CALL_SERVER_ACCEPTING] = "SvAccept",
35 [RXRPC_CALL_SERVER_RECV_REQUEST] = "SvRcvReq",
36 [RXRPC_CALL_SERVER_ACK_REQUEST] = "SvAckReq",
37 [RXRPC_CALL_SERVER_SEND_REPLY] = "SvSndRpl",
38 [RXRPC_CALL_SERVER_AWAIT_ACK] = "SvAwtACK",
39 [RXRPC_CALL_COMPLETE] = "Complete",
40 [RXRPC_CALL_SERVER_BUSY] = "SvBusy ",
41 [RXRPC_CALL_REMOTELY_ABORTED] = "RmtAbort",
42 [RXRPC_CALL_LOCALLY_ABORTED] = "LocAbort",
43 [RXRPC_CALL_NETWORK_ERROR] = "NetError",
44 [RXRPC_CALL_DEAD] = "Dead ",
45};
46
47/* 28/*
48 * generate a list of extant and dead calls in /proc/net/rxrpc_calls 29 * generate a list of extant and dead calls in /proc/net/rxrpc_calls
49 */ 30 */
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index f28bb2dc58d0..cbefe225581e 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -169,8 +169,8 @@ requeue:
169 else 169 else
170 q->ops->requeue(skb, q); 170 q->ops->requeue(skb, q);
171 netif_schedule(dev); 171 netif_schedule(dev);
172 return 0;
173 } 172 }
173 return 0;
174 174
175out: 175out:
176 BUG_ON((int) q->q.qlen < 0); 176 BUG_ON((int) q->q.qlen < 0);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 99bcec8dd04c..035788c5b7f8 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -976,8 +976,9 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
976 976
977 if (q->now >= q->near_ev_cache[level]) { 977 if (q->now >= q->near_ev_cache[level]) {
978 event = htb_do_events(q, level); 978 event = htb_do_events(q, level);
979 q->near_ev_cache[level] = event ? event : 979 if (!event)
980 PSCHED_TICKS_PER_SEC; 980 event = q->now + PSCHED_TICKS_PER_SEC;
981 q->near_ev_cache[level] = event;
981 } else 982 } else
982 event = q->near_ev_cache[level]; 983 event = q->near_ev_cache[level];
983 984
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 9cba49e2ad43..8210f549c492 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -2,11 +2,9 @@
2# SCTP configuration 2# SCTP configuration
3# 3#
4 4
5menu "SCTP Configuration (EXPERIMENTAL)" 5menuconfig IP_SCTP
6 depends on INET && EXPERIMENTAL
7
8config IP_SCTP
9 tristate "The SCTP Protocol (EXPERIMENTAL)" 6 tristate "The SCTP Protocol (EXPERIMENTAL)"
7 depends on INET && EXPERIMENTAL
10 depends on IPV6 || IPV6=n 8 depends on IPV6 || IPV6=n
11 select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 9 select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
12 select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 10 select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
@@ -36,9 +34,10 @@ config IP_SCTP
36 34
37 If in doubt, say N. 35 If in doubt, say N.
38 36
37if IP_SCTP
38
39config SCTP_DBG_MSG 39config SCTP_DBG_MSG
40 bool "SCTP: Debug messages" 40 bool "SCTP: Debug messages"
41 depends on IP_SCTP
42 help 41 help
43 If you say Y, this will enable verbose debugging messages. 42 If you say Y, this will enable verbose debugging messages.
44 43
@@ -47,7 +46,6 @@ config SCTP_DBG_MSG
47 46
48config SCTP_DBG_OBJCNT 47config SCTP_DBG_OBJCNT
49 bool "SCTP: Debug object counts" 48 bool "SCTP: Debug object counts"
50 depends on IP_SCTP
51 help 49 help
52 If you say Y, this will enable debugging support for counting the 50 If you say Y, this will enable debugging support for counting the
53 type of objects that are currently allocated. This is useful for 51 type of objects that are currently allocated. This is useful for
@@ -59,7 +57,6 @@ config SCTP_DBG_OBJCNT
59 57
60choice 58choice
61 prompt "SCTP: Cookie HMAC Algorithm" 59 prompt "SCTP: Cookie HMAC Algorithm"
62 depends on IP_SCTP
63 default SCTP_HMAC_MD5 60 default SCTP_HMAC_MD5
64 help 61 help
65 HMAC algorithm to be used during association initialization. It 62 HMAC algorithm to be used during association initialization. It
@@ -86,4 +83,5 @@ config SCTP_HMAC_MD5
86 advised to use either HMAC-MD5 or HMAC-SHA1. 83 advised to use either HMAC-MD5 or HMAC-SHA1.
87 84
88endchoice 85endchoice
89endmenu 86
87endif # IP_SCTP
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index f9e367d946eb..3b30d1130b61 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -2,11 +2,9 @@
2# TIPC configuration 2# TIPC configuration
3# 3#
4 4
5menu "TIPC Configuration (EXPERIMENTAL)" 5menuconfig TIPC
6 depends on INET && EXPERIMENTAL
7
8config TIPC
9 tristate "The TIPC Protocol (EXPERIMENTAL)" 6 tristate "The TIPC Protocol (EXPERIMENTAL)"
7 depends on INET && EXPERIMENTAL
10 ---help--- 8 ---help---
11 The Transparent Inter Process Communication (TIPC) protocol is 9 The Transparent Inter Process Communication (TIPC) protocol is
12 specially designed for intra cluster communication. This protocol 10 specially designed for intra cluster communication. This protocol
@@ -22,9 +20,10 @@ config TIPC
22 20
23 If in doubt, say N. 21 If in doubt, say N.
24 22
23if TIPC
24
25config TIPC_ADVANCED 25config TIPC_ADVANCED
26 bool "TIPC: Advanced configuration" 26 bool "TIPC: Advanced configuration"
27 depends on TIPC
28 default n 27 default n
29 help 28 help
30 Saying Y here will open some advanced configuration 29 Saying Y here will open some advanced configuration
@@ -33,7 +32,7 @@ config TIPC_ADVANCED
33 32
34config TIPC_ZONES 33config TIPC_ZONES
35 int "Maximum number of zones in network" 34 int "Maximum number of zones in network"
36 depends on TIPC && TIPC_ADVANCED 35 depends on TIPC_ADVANCED
37 default "3" 36 default "3"
38 help 37 help
39 Max number of zones inside TIPC network. Max supported value 38 Max number of zones inside TIPC network. Max supported value
@@ -44,7 +43,7 @@ config TIPC_ZONES
44 43
45config TIPC_CLUSTERS 44config TIPC_CLUSTERS
46 int "Maximum number of clusters in a zone" 45 int "Maximum number of clusters in a zone"
47 depends on TIPC && TIPC_ADVANCED 46 depends on TIPC_ADVANCED
48 default "1" 47 default "1"
49 help 48 help
50 ***Only 1 (one cluster in a zone) is supported by current code. 49 ***Only 1 (one cluster in a zone) is supported by current code.
@@ -59,7 +58,7 @@ config TIPC_CLUSTERS
59 58
60config TIPC_NODES 59config TIPC_NODES
61 int "Maximum number of nodes in cluster" 60 int "Maximum number of nodes in cluster"
62 depends on TIPC && TIPC_ADVANCED 61 depends on TIPC_ADVANCED
63 default "255" 62 default "255"
64 help 63 help
65 Maximum number of nodes inside a TIPC cluster. Maximum 64 Maximum number of nodes inside a TIPC cluster. Maximum
@@ -70,7 +69,7 @@ config TIPC_NODES
70 69
71config TIPC_SLAVE_NODES 70config TIPC_SLAVE_NODES
72 int "Maximum number of slave nodes in cluster" 71 int "Maximum number of slave nodes in cluster"
73 depends on TIPC && TIPC_ADVANCED 72 depends on TIPC_ADVANCED
74 default "0" 73 default "0"
75 help 74 help
76 ***This capability is not supported by current code.*** 75 ***This capability is not supported by current code.***
@@ -83,7 +82,7 @@ config TIPC_SLAVE_NODES
83 82
84config TIPC_PORTS 83config TIPC_PORTS
85 int "Maximum number of ports in a node" 84 int "Maximum number of ports in a node"
86 depends on TIPC && TIPC_ADVANCED 85 depends on TIPC_ADVANCED
87 default "8191" 86 default "8191"
88 help 87 help
89 Maximum number of ports within a node. Maximum 88 Maximum number of ports within a node. Maximum
@@ -94,7 +93,7 @@ config TIPC_PORTS
94 93
95config TIPC_LOG 94config TIPC_LOG
96 int "Size of log buffer" 95 int "Size of log buffer"
97 depends on TIPC && TIPC_ADVANCED 96 depends on TIPC_ADVANCED
98 default 0 97 default 0
99 help 98 help
100 Size (in bytes) of TIPC's internal log buffer, which records the 99 Size (in bytes) of TIPC's internal log buffer, which records the
@@ -106,7 +105,6 @@ config TIPC_LOG
106 105
107config TIPC_DEBUG 106config TIPC_DEBUG
108 bool "Enable debugging support" 107 bool "Enable debugging support"
109 depends on TIPC
110 default n 108 default n
111 help 109 help
112 This will enable debugging of TIPC. 110 This will enable debugging of TIPC.
@@ -114,4 +112,4 @@ config TIPC_DEBUG
114 Only say Y here if you are having trouble with TIPC. It will 112 Only say Y here if you are having trouble with TIPC. It will
115 enable the display of detailed information about what is going on. 113 enable the display of detailed information about what is going on.
116 114
117endmenu 115endif # TIPC
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 0ee6ded18f3a..77d2d9ce8962 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -120,18 +120,20 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
120 120
121static int enable_bearer(struct tipc_bearer *tb_ptr) 121static int enable_bearer(struct tipc_bearer *tb_ptr)
122{ 122{
123 struct net_device *dev, *pdev; 123 struct net_device *dev = NULL;
124 struct net_device *pdev = NULL;
124 struct eth_bearer *eb_ptr = &eth_bearers[0]; 125 struct eth_bearer *eb_ptr = &eth_bearers[0];
125 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS]; 126 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS];
126 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; 127 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1;
127 128
128 /* Find device with specified name */ 129 /* Find device with specified name */
129 dev = NULL; 130
130 for_each_netdev(pdev) 131 for_each_netdev(pdev){
131 if (!strncmp(dev->name, driver_name, IFNAMSIZ)) { 132 if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) {
132 dev = pdev; 133 dev = pdev;
133 break; 134 break;
134 } 135 }
136 }
135 if (!dev) 137 if (!dev)
136 return -ENODEV; 138 return -ENODEV;
137 139
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 8a72def25a34..5ced62c19c63 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -407,27 +407,27 @@ static struct xfrm_algo_desc *xfrm_find_algo(
407static int xfrm_alg_id_match(const struct xfrm_algo_desc *entry, 407static int xfrm_alg_id_match(const struct xfrm_algo_desc *entry,
408 const void *data) 408 const void *data)
409{ 409{
410 return entry->desc.sadb_alg_id == (int)data; 410 return entry->desc.sadb_alg_id == (unsigned long)data;
411} 411}
412 412
413struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id) 413struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id)
414{ 414{
415 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_id_match, 415 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_id_match,
416 (void *)alg_id, 1); 416 (void *)(unsigned long)alg_id, 1);
417} 417}
418EXPORT_SYMBOL_GPL(xfrm_aalg_get_byid); 418EXPORT_SYMBOL_GPL(xfrm_aalg_get_byid);
419 419
420struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id) 420struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id)
421{ 421{
422 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_id_match, 422 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_id_match,
423 (void *)alg_id, 1); 423 (void *)(unsigned long)alg_id, 1);
424} 424}
425EXPORT_SYMBOL_GPL(xfrm_ealg_get_byid); 425EXPORT_SYMBOL_GPL(xfrm_ealg_get_byid);
426 426
427struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id) 427struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id)
428{ 428{
429 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_id_match, 429 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_id_match,
430 (void *)alg_id, 1); 430 (void *)(unsigned long)alg_id, 1);
431} 431}
432EXPORT_SYMBOL_GPL(xfrm_calg_get_byid); 432EXPORT_SYMBOL_GPL(xfrm_calg_get_byid);
433 433
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index d0882e53b6fc..b8bab89616a0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -29,6 +29,8 @@
29 29
30#include "xfrm_hash.h" 30#include "xfrm_hash.h"
31 31
32int sysctl_xfrm_larval_drop;
33
32DEFINE_MUTEX(xfrm_cfg_mutex); 34DEFINE_MUTEX(xfrm_cfg_mutex);
33EXPORT_SYMBOL(xfrm_cfg_mutex); 35EXPORT_SYMBOL(xfrm_cfg_mutex);
34 36
@@ -1390,8 +1392,8 @@ static int stale_bundle(struct dst_entry *dst);
1390 * At the moment we eat a raw IP route. Mostly to speed up lookups 1392 * At the moment we eat a raw IP route. Mostly to speed up lookups
1391 * on interfaces with disabled IPsec. 1393 * on interfaces with disabled IPsec.
1392 */ 1394 */
1393int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 1395int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
1394 struct sock *sk, int flags) 1396 struct sock *sk, int flags)
1395{ 1397{
1396 struct xfrm_policy *policy; 1398 struct xfrm_policy *policy;
1397 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; 1399 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
@@ -1509,6 +1511,13 @@ restart:
1509 1511
1510 if (unlikely(nx<0)) { 1512 if (unlikely(nx<0)) {
1511 err = nx; 1513 err = nx;
1514 if (err == -EAGAIN && sysctl_xfrm_larval_drop) {
1515 /* EREMOTE tells the caller to generate
1516 * a one-shot blackhole route.
1517 */
1518 xfrm_pol_put(policy);
1519 return -EREMOTE;
1520 }
1512 if (err == -EAGAIN && flags) { 1521 if (err == -EAGAIN && flags) {
1513 DECLARE_WAITQUEUE(wait, current); 1522 DECLARE_WAITQUEUE(wait, current);
1514 1523
@@ -1598,6 +1607,21 @@ error:
1598 *dst_p = NULL; 1607 *dst_p = NULL;
1599 return err; 1608 return err;
1600} 1609}
1610EXPORT_SYMBOL(__xfrm_lookup);
1611
1612int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
1613 struct sock *sk, int flags)
1614{
1615 int err = __xfrm_lookup(dst_p, fl, sk, flags);
1616
1617 if (err == -EREMOTE) {
1618 dst_release(*dst_p);
1619 *dst_p = NULL;
1620 err = -EAGAIN;
1621 }
1622
1623 return err;
1624}
1601EXPORT_SYMBOL(xfrm_lookup); 1625EXPORT_SYMBOL(xfrm_lookup);
1602 1626
1603static inline int 1627static inline int