aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/HOWTO20
-rw-r--r--Documentation/MSI-HOWTO.txt63
-rw-r--r--Documentation/cpu-hotplug.txt148
-rw-r--r--Documentation/feature-removal-schedule.txt2
-rw-r--r--Documentation/hwmon/adm92402
-rw-r--r--Documentation/hwmon/f71805f2
-rw-r--r--Documentation/hwmon/k8temp13
-rw-r--r--Documentation/hwmon/smsc47m14
-rw-r--r--Documentation/hwmon/w83627ehf6
-rw-r--r--Documentation/input/xpad.txt115
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/memory-barriers.txt2
-rw-r--r--Documentation/s390/CommonIO2
-rw-r--r--Documentation/s390/cds.txt52
-rw-r--r--Documentation/s390/driver-model.txt3
-rw-r--r--MAINTAINERS25
-rw-r--r--Makefile3
-rw-r--r--arch/arm/mach-footbridge/dc21285.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c6
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c6
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c7
-rw-r--r--arch/arm/mach-lh7a40x/common.h2
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c10
-rw-r--r--arch/arm/oprofile/op_model_xscale.c3
-rw-r--r--arch/arm/tools/mach-types18
-rw-r--r--arch/i386/kernel/alternative.c4
-rw-r--r--arch/i386/kernel/apm.c37
-rw-r--r--arch/i386/kernel/i8253.c2
-rw-r--r--arch/i386/kernel/i8259.c7
-rw-r--r--arch/i386/kernel/io_apic.c17
-rw-r--r--arch/i386/kernel/irq.c2
-rw-r--r--arch/i386/kernel/tsc.c6
-rw-r--r--arch/i386/lib/usercopy.c3
-rw-r--r--arch/i386/pci/common.c59
-rw-r--r--arch/i386/pci/fixup.c45
-rw-r--r--arch/i386/pci/pci.h7
-rw-r--r--arch/ia64/configs/sn2_defconfig219
-rw-r--r--arch/ia64/kernel/acpi.c9
-rw-r--r--arch/ia64/kernel/irq_ia64.c20
-rw-r--r--arch/ia64/kernel/pal.S58
-rw-r--r--arch/ia64/kernel/perfmon.c3
-rw-r--r--arch/ia64/kernel/time.c6
-rw-r--r--arch/ia64/sn/kernel/setup.c12
-rw-r--r--arch/mips/au1000/common/dbdma.c2
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig384
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig441
-rw-r--r--arch/mips/configs/tb0287_defconfig182
-rw-r--r--arch/mips/kernel/linux32.c4
-rw-r--r--arch/mips/kernel/process.c8
-rw-r--r--arch/mips/kernel/scall32-o32.S3
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S3
-rw-r--r--arch/mips/kernel/scall64-o32.S3
-rw-r--r--arch/mips/kernel/stacktrace.c2
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c3
-rw-r--r--arch/mips/mm/ioremap.c2
-rw-r--r--arch/mips/oprofile/op_impl.h2
-rw-r--r--arch/mips/oprofile/op_model_rm9000.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c2
-rw-r--r--arch/mips/sibyte/sb1250/bcm1250_tbprof.c4
-rw-r--r--arch/mips/sibyte/sb1250/bus_watcher.c2
-rw-r--r--arch/powerpc/configs/mpc834x_itx_defconfig2
-rw-r--r--arch/powerpc/kernel/cputable.c2
-rw-r--r--arch/powerpc/kernel/pci_32.c12
-rw-r--r--arch/powerpc/kernel/pci_64.c10
-rw-r--r--arch/powerpc/kernel/process.c10
-rw-r--r--arch/powerpc/kernel/traps.c3
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig13
-rw-r--r--arch/powerpc/platforms/83xx/Makefile2
-rw-r--r--arch/powerpc/platforms/83xx/mpc8360e_pb.c19
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c15
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c1
-rw-r--r--arch/ppc/kernel/time.c4
-rw-r--r--arch/ppc/platforms/mpc8272ads_setup.c4
-rw-r--r--arch/ppc/platforms/mpc866ads_setup.c4
-rw-r--r--arch/ppc/platforms/mpc885ads_setup.c4
-rw-r--r--arch/s390/defconfig12
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/sparc/Kconfig7
-rw-r--r--arch/sparc/Makefile2
-rw-r--r--arch/sparc/kernel/irq.c2
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc/kernel/time.c2
-rw-r--r--arch/sparc/oprofile/Kconfig17
-rw-r--r--arch/sparc/oprofile/Makefile9
-rw-r--r--arch/sparc/oprofile/init.c23
-rw-r--r--arch/sparc64/defconfig25
-rw-r--r--arch/sparc64/kernel/of_device.c7
-rw-r--r--arch/sparc64/kernel/pci_common.c29
-rw-r--r--arch/sparc64/kernel/pci_sabre.c23
-rw-r--r--arch/sparc64/kernel/setup.c2
-rw-r--r--arch/um/Kconfig6
-rw-r--r--arch/um/Kconfig.char5
-rw-r--r--arch/um/drivers/cow_sys.h1
-rw-r--r--arch/um/drivers/daemon_user.c1
-rw-r--r--arch/um/drivers/fd.c1
-rw-r--r--arch/um/drivers/mcast_user.c1
-rw-r--r--arch/um/drivers/mmapper_kern.c3
-rw-r--r--arch/um/drivers/net_user.c1
-rw-r--r--arch/um/drivers/pcap_user.c1
-rw-r--r--arch/um/drivers/port_user.c1
-rw-r--r--arch/um/drivers/pty.c1
-rw-r--r--arch/um/drivers/slip_user.c1
-rw-r--r--arch/um/drivers/tty.c1
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/um_malloc.h17
-rw-r--r--arch/um/include/user.h6
-rw-r--r--arch/um/include/user_util.h1
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/kernel/process.c1
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c1
-rw-r--r--arch/um/os-Linux/helper.c54
-rw-r--r--arch/um/os-Linux/irq.c1
-rw-r--r--arch/um/os-Linux/main.c1
-rw-r--r--arch/um/os-Linux/sigio.c1
-rw-r--r--arch/um/os-Linux/time.c3
-rw-r--r--arch/x86_64/kernel/i8259.c7
-rw-r--r--arch/x86_64/kernel/io_apic.c15
-rw-r--r--arch/x86_64/kernel/irq.c2
-rw-r--r--block/ll_rw_blk.c83
-rw-r--r--crypto/Kconfig4
-rw-r--r--crypto/api.c15
-rw-r--r--drivers/Kconfig6
-rw-r--r--drivers/acpi/acpi_memhotplug.c14
-rw-r--r--drivers/acpi/processor_idle.c8
-rw-r--r--drivers/base/bus.c108
-rw-r--r--drivers/base/class.c5
-rw-r--r--drivers/base/core.c26
-rw-r--r--drivers/base/dd.c4
-rw-r--r--drivers/base/dmapool.c13
-rw-r--r--drivers/base/topology.c3
-rw-r--r--drivers/block/aoe/aoe.h30
-rw-r--r--drivers/block/aoe/aoeblk.c44
-rw-r--r--drivers/block/aoe/aoechr.c18
-rw-r--r--drivers/block/aoe/aoecmd.c303
-rw-r--r--drivers/block/aoe/aoedev.c52
-rw-r--r--drivers/block/aoe/aoemain.c10
-rw-r--r--drivers/block/aoe/aoenet.c9
-rw-r--r--drivers/block/rd.c12
-rw-r--r--drivers/bluetooth/bcm203x.c17
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/bluetooth/hci_usb.c3
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/epca.c32
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/random.c1
-rw-r--r--drivers/char/rio/rioctrl.c4
-rw-r--r--drivers/char/specialix.c15
-rw-r--r--drivers/char/sx.c2
-rw-r--r--drivers/char/synclink.c4
-rw-r--r--drivers/char/watchdog/alim7101_wdt.c13
-rw-r--r--drivers/firmware/dcdbas.c7
-rw-r--r--drivers/hwmon/Kconfig10
-rw-r--r--drivers/hwmon/adm9240.c4
-rw-r--r--drivers/hwmon/lm78.c12
-rw-r--r--drivers/hwmon/smsc47m1.c11
-rw-r--r--drivers/hwmon/w83627ehf.c11
-rw-r--r--drivers/hwmon/w83781d.c30
-rw-r--r--drivers/hwmon/w83791d.c85
-rw-r--r--drivers/i2c/busses/i2c-isa.c2
-rw-r--r--drivers/ide/ide-taskfile.c13
-rw-r--r--drivers/ide/pci/sgiioc4.c2
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c2
-rw-r--r--drivers/infiniband/hw/amso1100/c2_rnic.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c65
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c10
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c7
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c19
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c8
-rw-r--r--drivers/input/gameport/fm801-gp.c22
-rw-r--r--drivers/input/gameport/gameport.c18
-rw-r--r--drivers/input/keyboard/atkbd.c54
-rw-r--r--drivers/input/keyboard/corgikbd.c2
-rw-r--r--drivers/input/keyboard/locomokbd.c2
-rw-r--r--drivers/input/keyboard/spitzkbd.c2
-rw-r--r--drivers/input/serio/i8042.c13
-rw-r--r--drivers/input/serio/libps2.c3
-rw-r--r--drivers/input/serio/serio.c22
-rw-r--r--drivers/input/touchscreen/corgi_ts.c4
-rw-r--r--drivers/isdn/capi/capidrv.c3
-rw-r--r--drivers/isdn/hisax/config.c6
-rw-r--r--drivers/isdn/hisax/diva.c26
-rw-r--r--drivers/isdn/hysdn/boardergo.c34
-rw-r--r--drivers/isdn/hysdn/hysdn_defs.h2
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c17
-rw-r--r--drivers/isdn/hysdn/hysdn_sched.c9
-rw-r--r--drivers/isdn/i4l/isdn_common.c9
-rw-r--r--drivers/isdn/icn/icn.c3
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c73
-rw-r--r--drivers/isdn/isdnloop/isdnloop.h1
-rw-r--r--drivers/isdn/pcbit/drv.c16
-rw-r--r--drivers/leds/led-class.c26
-rw-r--r--drivers/leds/ledtrig-timer.c16
-rw-r--r--drivers/md/dm-crypt.c3
-rw-r--r--drivers/md/md.c1
-rw-r--r--drivers/message/i2o/bus-osm.c12
-rw-r--r--drivers/message/i2o/exec-osm.c17
-rw-r--r--drivers/misc/Kconfig11
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/ioc4.c (renamed from drivers/sn/ioc4.c)47
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/e100.c50
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/ioc3-eth.c4
-rw-r--r--drivers/net/loopback.c39
-rw-r--r--drivers/net/myri_code.h8
-rw-r--r--drivers/net/myri_sbus.c4
-rw-r--r--drivers/net/r8169.c7
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sky2.c233
-rw-r--r--drivers/net/sky2.h15
-rw-r--r--drivers/net/smc91x.h18
-rw-r--r--drivers/net/sunbmac.c2
-rw-r--r--drivers/net/tg3.c19
-rw-r--r--drivers/net/ucc_geth.c633
-rw-r--r--drivers/net/ucc_geth.h248
-rw-r--r--drivers/net/ucc_geth_phy.c26
-rw-r--r--drivers/net/ucc_geth_phy.h2
-rw-r--r--drivers/net/wan/pc300_drv.c24
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c2
-rw-r--r--drivers/pci/hotplug/acpiphp.h2
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c1
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c2
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c2
-rw-r--r--drivers/pci/hotplug/cpcihp_generic.c4
-rw-r--r--drivers/pci/hotplug/cpqphp.h1
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c1
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c1
-rw-r--r--drivers/pci/hotplug/cpqphp_nvram.c1
-rw-r--r--drivers/pci/hotplug/cpqphp_pci.c1
-rw-r--r--drivers/pci/hotplug/cpqphp_sysfs.c1
-rw-r--r--drivers/pci/hotplug/fakephp.c13
-rw-r--r--drivers/pci/hotplug/ibmphp.h2
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c11
-rw-r--r--drivers/pci/hotplug/pciehp.h11
-rw-r--r--drivers/pci/hotplug/pciehp_core.c6
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c104
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c2
-rw-r--r--drivers/pci/hotplug/pcihp_skeleton.c2
-rw-r--r--drivers/pci/hotplug/rpadlpar_sysfs.c2
-rw-r--r--drivers/pci/hotplug/rpaphp.h2
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c2
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c2
-rw-r--r--drivers/pci/hotplug/shpchp.h4
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c82
-rw-r--r--drivers/pci/msi.c16
-rw-r--r--drivers/pci/pcie/portdrv.h4
-rw-r--r--drivers/pci/pcie/portdrv_core.c3
-rw-r--r--drivers/pci/pcie/portdrv_pci.c2
-rw-r--r--drivers/pci/probe.c92
-rw-r--r--drivers/pci/quirks.c97
-rw-r--r--drivers/pci/rom.c5
-rw-r--r--drivers/pci/search.c72
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c41
-rw-r--r--drivers/rtc/rtc-max6902.c2
-rw-r--r--drivers/rtc/rtc-v3020.c4
-rw-r--r--drivers/s390/block/dasd.c1
-rw-r--r--drivers/s390/char/monwriter.c14
-rw-r--r--drivers/s390/cio/device_fsm.c4
-rw-r--r--drivers/s390/cio/qdio.c2
-rw-r--r--drivers/sbus/char/bbc_envctrl.c4
-rw-r--r--drivers/sbus/char/envctrl.c4
-rw-r--r--drivers/scsi/BusLogic.c11
-rw-r--r--drivers/scsi/eata_pio.c2
-rw-r--r--drivers/scsi/fdomain.c9
-rw-r--r--drivers/scsi/initio.c19
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c2
-rw-r--r--drivers/scsi/qlogicpti.c2
-rw-r--r--drivers/scsi/qlogicpti_asm.c4
-rw-r--r--drivers/serial/Kconfig12
-rw-r--r--drivers/serial/ioc4_serial.c2
-rw-r--r--drivers/sn/Kconfig13
-rw-r--r--drivers/sn/Makefile1
-rw-r--r--drivers/telephony/ixj.c11
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/atm/speedtch.c93
-rw-r--r--drivers/usb/atm/ueagle-atm.c83
-rw-r--r--drivers/usb/atm/usbatm.c5
-rw-r--r--drivers/usb/class/cdc-acm.c29
-rw-r--r--drivers/usb/class/usblp.c79
-rw-r--r--drivers/usb/core/devio.c8
-rw-r--r--drivers/usb/core/endpoint.c22
-rw-r--r--drivers/usb/gadget/net2280.c24
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c4
-rw-r--r--drivers/usb/host/ehci-hcd.c70
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ehci-pci.c2
-rw-r--r--drivers/usb/host/ehci-q.c6
-rw-r--r--drivers/usb/host/ehci.h22
-rw-r--r--drivers/usb/host/ohci-pnx4008.c9
-rw-r--r--drivers/usb/host/uhci-hcd.c44
-rw-r--r--drivers/usb/input/Kconfig10
-rw-r--r--drivers/usb/input/Makefile3
-rw-r--r--drivers/usb/input/hid-core.c29
-rw-r--r--drivers/usb/input/usbtouchscreen.c4
-rw-r--r--drivers/usb/input/wacom.h2
-rw-r--r--drivers/usb/input/wacom_sys.c20
-rw-r--r--drivers/usb/input/wacom_wac.c121
-rw-r--r--drivers/usb/input/wacom_wac.h2
-rw-r--r--drivers/usb/input/xpad.c139
-rw-r--r--drivers/usb/misc/Kconfig10
-rw-r--r--drivers/usb/misc/Makefile1
-rw-r--r--drivers/usb/misc/adutux.c3
-rw-r--r--drivers/usb/misc/ftdi-elan.c36
-rw-r--r--drivers/usb/misc/trancevibrator.c (renamed from drivers/usb/input/trancevibrator.c)0
-rw-r--r--drivers/usb/net/Kconfig8
-rw-r--r--drivers/usb/net/Makefile1
-rw-r--r--drivers/usb/net/asix.c48
-rw-r--r--drivers/usb/net/cdc_ether.c2
-rw-r--r--drivers/usb/net/kaweth.c204
-rw-r--r--drivers/usb/net/mcs7830.c534
-rw-r--r--drivers/usb/net/usbnet.c55
-rw-r--r--drivers/usb/net/usbnet.h5
-rw-r--r--drivers/usb/serial/Kconfig13
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/airprime.c7
-rw-r--r--drivers/usb/serial/cp2101.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c254
-rw-r--r--drivers/usb/serial/mos7720.c1683
-rw-r--r--drivers/usb/serial/mos7840.c3
-rw-r--r--drivers/usb/serial/sierra.c697
-rw-r--r--drivers/usb/storage/unusual_devs.h24
-rw-r--r--drivers/video/controlfb.c8
-rw-r--r--drivers/video/igafb.c7
-rw-r--r--drivers/video/platinumfb.c5
-rw-r--r--drivers/video/valkyriefb.c4
-rw-r--r--drivers/w1/Kconfig1
-rw-r--r--fs/Kconfig8
-rw-r--r--fs/autofs/autofs_i.h1
-rw-r--r--fs/autofs/dirhash.c1
-rw-r--r--fs/autofs/init.c2
-rw-r--r--fs/autofs/inode.c4
-rw-r--r--fs/buffer.c11
-rw-r--r--fs/configfs/file.c14
-rw-r--r--fs/dlm/lowcomms.c1
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/fat/file.c3
-rw-r--r--fs/fuse/dir.c107
-rw-r--r--fs/fuse/file.c12
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c15
-rw-r--r--fs/gfs2/bmap.c13
-rw-r--r--fs/gfs2/bmap.h2
-rw-r--r--fs/gfs2/dir.c10
-rw-r--r--fs/gfs2/log.c6
-rw-r--r--fs/gfs2/ops_address.c6
-rw-r--r--fs/gfs2/ops_fstype.c7
-rw-r--r--fs/gfs2/quota.c5
-rw-r--r--fs/gfs2/recovery.c5
-rw-r--r--fs/inode.c36
-rw-r--r--fs/jbd/transaction.c5
-rw-r--r--fs/jbd2/journal.c3
-rw-r--r--fs/jbd2/transaction.c5
-rw-r--r--fs/lockd/clntlock.c4
-rw-r--r--fs/lockd/mon.c12
-rw-r--r--fs/lockd/svc4proc.c56
-rw-r--r--fs/lockd/svclock.c10
-rw-r--r--fs/lockd/svcproc.c62
-rw-r--r--fs/lockd/svcshare.c4
-rw-r--r--fs/lockd/svcsubs.c21
-rw-r--r--fs/lockd/xdr.c76
-rw-r--r--fs/lockd/xdr4.c80
-rw-r--r--fs/nfs/callback.h10
-rw-r--r--fs/nfs/callback_proc.c6
-rw-r--r--fs/nfs/callback_xdr.c106
-rw-r--r--fs/nfs/client.c27
-rw-r--r--fs/nfs/dir.c16
-rw-r--r--fs/nfs/direct.c25
-rw-r--r--fs/nfs/inode.c30
-rw-r--r--fs/nfs/internal.h6
-rw-r--r--fs/nfs/mount_clnt.c6
-rw-r--r--fs/nfs/nfs2xdr.c78
-rw-r--r--fs/nfs/nfs3proc.c2
-rw-r--r--fs/nfs/nfs3xdr.c118
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c16
-rw-r--r--fs/nfs/nfs4xdr.c360
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/nfs/write.c8
-rw-r--r--fs/nfs_common/nfsacl.c4
-rw-r--r--fs/nfsd/export.c4
-rw-r--r--fs/nfsd/lockd.c16
-rw-r--r--fs/nfsd/nfs2acl.c34
-rw-r--r--fs/nfsd/nfs3acl.c20
-rw-r--r--fs/nfsd/nfs3proc.c90
-rw-r--r--fs/nfsd/nfs3xdr.c126
-rw-r--r--fs/nfsd/nfs4callback.c26
-rw-r--r--fs/nfsd/nfs4proc.c108
-rw-r--r--fs/nfsd/nfs4recover.c14
-rw-r--r--fs/nfsd/nfs4state.c119
-rw-r--r--fs/nfsd/nfs4xdr.c273
-rw-r--r--fs/nfsd/nfscache.c8
-rw-r--r--fs/nfsd/nfsfh.c10
-rw-r--r--fs/nfsd/nfsproc.c79
-rw-r--r--fs/nfsd/nfssvc.c10
-rw-r--r--fs/nfsd/nfsxdr.c72
-rw-r--r--fs/nfsd/vfs.c299
-rw-r--r--fs/ocfs2/cluster/nodemanager.c10
-rw-r--r--fs/ocfs2/file.c51
-rw-r--r--fs/ocfs2/namei.c8
-rw-r--r--fs/partitions/check.c50
-rw-r--r--fs/proc/base.c6
-rw-r--r--fs/reiserfs/journal.c3
-rw-r--r--fs/splice.c105
-rw-r--r--fs/sysfs/file.c7
-rw-r--r--fs/xfs/linux-2.6/kmem.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c3
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h1
-rw-r--r--include/asm-arm/arch-sa1100/jornada720.h14
-rw-r--r--include/asm-frv/highmem.h27
-rw-r--r--include/asm-generic/bug.h5
-rw-r--r--include/asm-ia64/io.h4
-rw-r--r--include/asm-ia64/pal.h11
-rw-r--r--include/asm-mips/io.h4
-rw-r--r--include/asm-mips/unistd.h15
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h2
-rw-r--r--include/asm-s390/pgtable.h50
-rw-r--r--include/asm-s390/unistd.h3
-rw-r--r--include/asm-sparc/elf.h41
-rw-r--r--include/asm-um/archparam-ppc.h9
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/backing-dev.h7
-rw-r--r--include/linux/blkdev.h22
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/fs.h13
-rw-r--r--include/linux/irq.h21
-rw-r--r--include/linux/lockd/bind.h5
-rw-r--r--include/linux/lockd/lockd.h12
-rw-r--r--include/linux/lockd/share.h4
-rw-r--r--include/linux/lockd/xdr.h30
-rw-r--r--include/linux/lockd/xdr4.h26
-rw-r--r--include/linux/lockdep.h17
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/net.h7
-rw-r--r--include/linux/nfs_fs.h3
-rw-r--r--include/linux/nfs_xdr.h10
-rw-r--r--include/linux/nfsd/cache.h6
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/nfsd/nfsd.h43
-rw-r--r--include/linux/nfsd/nfsfh.h8
-rw-r--r--include/linux/nfsd/state.h12
-rw-r--r--include/linux/nfsd/xdr.h50
-rw-r--r--include/linux/nfsd/xdr3.h114
-rw-r--r--include/linux/nfsd/xdr4.h54
-rw-r--r--include/linux/oom.h10
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/pci_hotplug.h (renamed from drivers/pci/hotplug/pci_hotplug.h)2
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/personality.h7
-rw-r--r--include/linux/random.h3
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/sunrpc/msg_prot.h4
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/xdr.h1
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/tipc.h1
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/net/bluetooth/hci_core.h17
-rw-r--r--include/net/inetpeer.h24
-rw-r--r--include/net/ip6_route.h7
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/cpu.c24
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/irq/chip.c33
-rw-r--r--kernel/lockdep.c18
-rw-r--r--kernel/mutex-debug.c2
-rw-r--r--kernel/nsproxy.c6
-rw-r--r--kernel/posix-cpu-timers.c27
-rw-r--r--kernel/power/swap.c3
-rw-r--r--kernel/sched.c18
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--kernel/sysctl.c4
-rw-r--r--kernel/time/jiffies.c2
-rw-r--r--lib/Makefile4
-rw-r--r--lib/carta_random32.c41
-rw-r--r--lib/cpumask.c16
-rw-r--r--lib/kobject.c1
-rw-r--r--lib/random32.c142
-rw-r--r--lib/rwsem-spinlock.c2
-rw-r--r--lib/rwsem.c2
-rw-r--r--lib/spinlock_debug.c4
-rw-r--r--mm/Makefile3
-rw-r--r--mm/backing-dev.c69
-rw-r--r--mm/filemap.c85
-rw-r--r--mm/memory.c1
-rw-r--r--mm/oom_kill.c1
-rw-r--r--mm/page-writeback.c17
-rw-r--r--mm/page_alloc.c21
-rw-r--r--mm/rmap.c36
-rw-r--r--mm/shmem.c84
-rw-r--r--mm/truncate.c1
-rw-r--r--mm/vmalloc.c7
-rw-r--r--mm/vmscan.c12
-rw-r--r--net/bluetooth/af_bluetooth.c38
-rw-r--r--net/bluetooth/bnep/core.c4
-rw-r--r--net/bluetooth/bnep/sock.c69
-rw-r--r--net/bluetooth/cmtp/sock.c35
-rw-r--r--net/bluetooth/hci_conn.c6
-rw-r--r--net/bluetooth/hci_event.c15
-rw-r--r--net/bluetooth/hci_sock.c2
-rw-r--r--net/bluetooth/hci_sysfs.c17
-rw-r--r--net/bluetooth/hidp/core.c14
-rw-r--r--net/bluetooth/hidp/sock.c80
-rw-r--r--net/bluetooth/l2cap.c5
-rw-r--r--net/bluetooth/rfcomm/core.c3
-rw-r--r--net/bluetooth/rfcomm/sock.c6
-rw-r--r--net/bluetooth/rfcomm/tty.c7
-rw-r--r--net/bluetooth/sco.c6
-rw-r--r--net/bridge/br_fdb.c7
-rw-r--r--net/bridge/br_if.c4
-rw-r--r--net/bridge/br_private.h2
-rw-r--r--net/bridge/br_stp_if.c2
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/netpoll.c8
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/utils.c116
-rw-r--r--net/core/wireless.c33
-rw-r--r--net/decnet/dn_route.c5
-rw-r--r--net/ipv4/cipso_ipv4.c22
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/inetpeer.c29
-rw-r--r--net/ipv4/netfilter/arp_tables.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c72
-rw-r--r--net/ipv4/netfilter/ip_tables.c3
-rw-r--r--net/ipv4/netfilter/ipt_ECN.c6
-rw-r--r--net/ipv4/netfilter/ipt_TOS.c6
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_output.c20
-rw-r--r--net/ipv6/Kconfig16
-rw-r--r--net/ipv6/fib6_rules.c11
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/route.c66
-rw-r--r--net/ipv6/sit.c1
-rw-r--r--net/ipv6/xfrm6_policy.c12
-rw-r--r--net/netfilter/Kconfig4
-rw-r--r--net/netfilter/nf_conntrack_netlink.c72
-rw-r--r--net/netfilter/xt_NFQUEUE.c2
-rw-r--r--net/netfilter/xt_connmark.c2
-rw-r--r--net/sctp/ipv6.c10
-rw-r--r--net/sctp/socket.c2
-rw-r--r--net/sunrpc/pmap_clnt.c14
-rw-r--r--net/sunrpc/svc.c5
-rw-r--r--net/sunrpc/svcsock.c2
-rw-r--r--net/sunrpc/xprtsock.c2
-rw-r--r--net/tipc/bearer.c8
-rw-r--r--net/tipc/config.c5
-rw-r--r--net/tipc/core.c4
-rw-r--r--net/tipc/core.h30
-rw-r--r--net/tipc/dbg.c136
-rw-r--r--net/tipc/dbg.h15
-rw-r--r--net/tipc/discover.c39
-rw-r--r--net/tipc/link.c8
-rw-r--r--net/tipc/name_distr.c2
-rw-r--r--net/tipc/node.c2
-rw-r--r--net/tipc/port.c7
-rw-r--r--net/tipc/socket.c13
-rw-r--r--net/tipc/subscr.c99
-rw-r--r--net/xfrm/xfrm_state.c17
-rw-r--r--scripts/Makefile.headersinst2
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--security/selinux/ss/ebitmap.c8
-rw-r--r--security/selinux/ss/mls.c17
-rw-r--r--security/selinux/ss/services.c18
571 files changed, 11239 insertions, 5167 deletions
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index d6f3dd1a3464..8d51c148f721 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -395,6 +395,26 @@ bugme-janitor mailing list (every change in the bugzilla is mailed here)
395 395
396 396
397 397
398Managing bug reports
399--------------------
400
401One of the best ways to put into practice your hacking skills is by fixing
402bugs reported by other people. Not only you will help to make the kernel
403more stable, you'll learn to fix real world problems and you will improve
404your skills, and other developers will be aware of your presence. Fixing
405bugs is one of the best ways to get merits among other developers, because
406not many people like wasting time fixing other people's bugs.
407
408To work in the already reported bug reports, go to http://bugzilla.kernel.org.
409If you want to be advised of the future bug reports, you can subscribe to the
410bugme-new mailing list (only new bug reports are mailed here) or to the
411bugme-janitor mailing list (every change in the bugzilla is mailed here)
412
413 http://lists.osdl.org/mailman/listinfo/bugme-new
414 http://lists.osdl.org/mailman/listinfo/bugme-janitors
415
416
417
398Mailing lists 418Mailing lists
399------------- 419-------------
400 420
diff --git a/Documentation/MSI-HOWTO.txt b/Documentation/MSI-HOWTO.txt
index c70306abb7b2..5c34910665d1 100644
--- a/Documentation/MSI-HOWTO.txt
+++ b/Documentation/MSI-HOWTO.txt
@@ -470,7 +470,68 @@ LOC: 324553 325068
470ERR: 0 470ERR: 0
471MIS: 0 471MIS: 0
472 472
4736. FAQ 4736. MSI quirks
474
475Several PCI chipsets or devices are known to not support MSI.
476The PCI stack provides 3 possible levels of MSI disabling:
477* on a single device
478* on all devices behind a specific bridge
479* globally
480
4816.1. Disabling MSI on a single device
482
483Under some circumstances, it might be required to disable MSI on a
484single device, It may be achived by either not calling pci_enable_msi()
485or all, or setting the pci_dev->no_msi flag before (most of the time
486in a quirk).
487
4886.2. Disabling MSI below a bridge
489
490The vast majority of MSI quirks are required by PCI bridges not
491being able to route MSI between busses. In this case, MSI have to be
492disabled on all devices behind this bridge. It is achieves by setting
493the PCI_BUS_FLAGS_NO_MSI flag in the pci_bus->bus_flags of the bridge
494subordinate bus. There is no need to set the same flag on bridges that
495are below the broken brigde. When pci_enable_msi() is called to enable
496MSI on a device, pci_msi_supported() takes care of checking the NO_MSI
497flag in all parent busses of the device.
498
499Some bridges actually support dynamic MSI support enabling/disabling
500by changing some bits in their PCI configuration space (especially
501the Hypertransport chipsets such as the nVidia nForce and Serverworks
502HT2000). It may then be required to update the NO_MSI flag on the
503corresponding devices in the sysfs hierarchy. To enable MSI support
504on device "0000:00:0e", do:
505
506 echo 1 > /sys/bus/pci/devices/0000:00:0e/msi_bus
507
508To disable MSI support, echo 0 instead of 1. Note that it should be
509used with caution since changing this value might break interrupts.
510
5116.3. Disabling MSI globally
512
513Some extreme cases may require to disable MSI globally on the system.
514For now, the only known case is a Serverworks PCI-X chipsets (MSI are
515not supported on several busses that are not all connected to the
516chipset in the Linux PCI hierarchy). In the vast majority of other
517cases, disabling only behind a specific bridge is enough.
518
519For debugging purpose, the user may also pass pci=nomsi on the kernel
520command-line to explicitly disable MSI globally. But, once the appro-
521priate quirks are added to the kernel, this option should not be
522required anymore.
523
5246.4. Finding why MSI cannot be enabled on a device
525
526Assuming that MSI are not enabled on a device, you should look at
527dmesg to find messages that quirks may output when disabling MSI
528on some devices, some bridges or even globally.
529Then, lspci -t gives the list of bridges above a device. Reading
530/sys/bus/pci/devices/0000:00:0e/msi_bus will tell you whether MSI
531are enabled (1) or disabled (0). In 0 is found in a single bridge
532msi_bus file above the device, MSI cannot be enabled.
533
5347. FAQ
474 535
475Q1. Are there any limitations on using the MSI? 536Q1. Are there any limitations on using the MSI?
476 537
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index bc107cb157a8..4868c34f7509 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -46,7 +46,7 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
46 maxcpus=2 will only boot 2. You can choose to bring the 46 maxcpus=2 will only boot 2. You can choose to bring the
47 other cpus later online, read FAQ's for more info. 47 other cpus later online, read FAQ's for more info.
48 48
49additional_cpus*=n Use this to limit hotpluggable cpus. This option sets 49additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
50 cpu_possible_map = cpu_present_map + additional_cpus 50 cpu_possible_map = cpu_present_map + additional_cpus
51 51
52(*) Option valid only for following architectures 52(*) Option valid only for following architectures
@@ -101,15 +101,15 @@ cpu_possible_map/for_each_possible_cpu() to iterate.
101 101
102Never use anything other than cpumask_t to represent bitmap of CPUs. 102Never use anything other than cpumask_t to represent bitmap of CPUs.
103 103
104#include <linux/cpumask.h> 104 #include <linux/cpumask.h>
105 105
106for_each_possible_cpu - Iterate over cpu_possible_map 106 for_each_possible_cpu - Iterate over cpu_possible_map
107for_each_online_cpu - Iterate over cpu_online_map 107 for_each_online_cpu - Iterate over cpu_online_map
108for_each_present_cpu - Iterate over cpu_present_map 108 for_each_present_cpu - Iterate over cpu_present_map
109for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. 109 for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.
110 110
111#include <linux/cpu.h> 111 #include <linux/cpu.h>
112lock_cpu_hotplug() and unlock_cpu_hotplug(): 112 lock_cpu_hotplug() and unlock_cpu_hotplug():
113 113
114The above calls are used to inhibit cpu hotplug operations. While holding the 114The above calls are used to inhibit cpu hotplug operations. While holding the
115cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid 115cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid
@@ -120,7 +120,7 @@ will work as long as stop_machine_run() is used to take a cpu down.
120 120
121CPU Hotplug - Frequently Asked Questions. 121CPU Hotplug - Frequently Asked Questions.
122 122
123Q: How to i enable my kernel to support CPU hotplug? 123Q: How to enable my kernel to support CPU hotplug?
124A: When doing make defconfig, Enable CPU hotplug support 124A: When doing make defconfig, Enable CPU hotplug support
125 125
126 "Processor type and Features" -> Support for Hotpluggable CPUs 126 "Processor type and Features" -> Support for Hotpluggable CPUs
@@ -141,39 +141,39 @@ A: You should now notice an entry in sysfs.
141Check if sysfs is mounted, using the "mount" command. You should notice 141Check if sysfs is mounted, using the "mount" command. You should notice
142an entry as shown below in the output. 142an entry as shown below in the output.
143 143
144.... 144 ....
145none on /sys type sysfs (rw) 145 none on /sys type sysfs (rw)
146.... 146 ....
147 147
148if this is not mounted, do the following. 148If this is not mounted, do the following.
149 149
150#mkdir /sysfs 150 #mkdir /sysfs
151#mount -t sysfs sys /sys 151 #mount -t sysfs sys /sys
152 152
153now you should see entries for all present cpu, the following is an example 153Now you should see entries for all present cpu, the following is an example
154in a 8-way system. 154in a 8-way system.
155 155
156#pwd 156 #pwd
157#/sys/devices/system/cpu 157 #/sys/devices/system/cpu
158#ls -l 158 #ls -l
159total 0 159 total 0
160drwxr-xr-x 10 root root 0 Sep 19 07:44 . 160 drwxr-xr-x 10 root root 0 Sep 19 07:44 .
161drwxr-xr-x 13 root root 0 Sep 19 07:45 .. 161 drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
162drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0 162 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
163drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1 163 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
164drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2 164 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
165drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3 165 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
166drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4 166 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
167drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5 167 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
168drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6 168 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
169drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7 169 drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7
170 170
171Under each directory you would find an "online" file which is the control 171Under each directory you would find an "online" file which is the control
172file to logically online/offline a processor. 172file to logically online/offline a processor.
173 173
174Q: Does hot-add/hot-remove refer to physical add/remove of cpus? 174Q: Does hot-add/hot-remove refer to physical add/remove of cpus?
175A: The usage of hot-add/remove may not be very consistently used in the code. 175A: The usage of hot-add/remove may not be very consistently used in the code.
176CONFIG_CPU_HOTPLUG enables logical online/offline capability in the kernel. 176CONFIG_HOTPLUG_CPU enables logical online/offline capability in the kernel.
177To support physical addition/removal, one would need some BIOS hooks and 177To support physical addition/removal, one would need some BIOS hooks and
178the platform should have something like an attention button in PCI hotplug. 178the platform should have something like an attention button in PCI hotplug.
179CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs. 179CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
@@ -181,17 +181,17 @@ CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
181Q: How do i logically offline a CPU? 181Q: How do i logically offline a CPU?
182A: Do the following. 182A: Do the following.
183 183
184#echo 0 > /sys/devices/system/cpu/cpuX/online 184 #echo 0 > /sys/devices/system/cpu/cpuX/online
185 185
186once the logical offline is successful, check 186Once the logical offline is successful, check
187 187
188#cat /proc/interrupts 188 #cat /proc/interrupts
189 189
190you should now not see the CPU that you removed. Also online file will report 190You should now not see the CPU that you removed. Also online file will report
191the state as 0 when a cpu if offline and 1 when its online. 191the state as 0 when a cpu if offline and 1 when its online.
192 192
193#To display the current cpu state. 193 #To display the current cpu state.
194#cat /sys/devices/system/cpu/cpuX/online 194 #cat /sys/devices/system/cpu/cpuX/online
195 195
196Q: Why cant i remove CPU0 on some systems? 196Q: Why cant i remove CPU0 on some systems?
197A: Some architectures may have some special dependency on a certain CPU. 197A: Some architectures may have some special dependency on a certain CPU.
@@ -234,8 +234,8 @@ Q: If i have some kernel code that needs to be aware of CPU arrival and
234 departure, how to i arrange for proper notification? 234 departure, how to i arrange for proper notification?
235A: This is what you would need in your kernel code to receive notifications. 235A: This is what you would need in your kernel code to receive notifications.
236 236
237 #include <linux/cpu.h> 237 #include <linux/cpu.h>
238 static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb, 238 static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
239 unsigned long action, void *hcpu) 239 unsigned long action, void *hcpu)
240 { 240 {
241 unsigned int cpu = (unsigned long)hcpu; 241 unsigned int cpu = (unsigned long)hcpu;
@@ -279,10 +279,10 @@ Q: I don't see my action being called for all CPUs already up and running?
279A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined. 279A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined.
280 If you need to perform some action for each cpu already in the system, then 280 If you need to perform some action for each cpu already in the system, then
281 281
282 for_each_online_cpu(i) { 282 for_each_online_cpu(i) {
283 foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i); 283 foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i);
284 foobar_cpu_callback(&foobar-cpu_notifier, CPU_ONLINE, i); 284 foobar_cpu_callback(&foobar_cpu_notifier, CPU_ONLINE, i);
285 } 285 }
286 286
287Q: If i would like to develop cpu hotplug support for a new architecture, 287Q: If i would like to develop cpu hotplug support for a new architecture,
288 what do i need at a minimum? 288 what do i need at a minimum?
@@ -307,38 +307,38 @@ Q: I need to ensure that a particular cpu is not removed when there is some
307 work specific to this cpu is in progress. 307 work specific to this cpu is in progress.
308A: First switch the current thread context to preferred cpu 308A: First switch the current thread context to preferred cpu
309 309
310 int my_func_on_cpu(int cpu) 310 int my_func_on_cpu(int cpu)
311 { 311 {
312 cpumask_t saved_mask, new_mask = CPU_MASK_NONE; 312 cpumask_t saved_mask, new_mask = CPU_MASK_NONE;
313 int curr_cpu, err = 0; 313 int curr_cpu, err = 0;
314 314
315 saved_mask = current->cpus_allowed; 315 saved_mask = current->cpus_allowed;
316 cpu_set(cpu, new_mask); 316 cpu_set(cpu, new_mask);
317 err = set_cpus_allowed(current, new_mask); 317 err = set_cpus_allowed(current, new_mask);
318 318
319 if (err) 319 if (err)
320 return err; 320 return err;
321 321
322 /* 322 /*
323 * If we got scheduled out just after the return from 323 * If we got scheduled out just after the return from
324 * set_cpus_allowed() before running the work, this ensures 324 * set_cpus_allowed() before running the work, this ensures
325 * we stay locked. 325 * we stay locked.
326 */ 326 */
327 curr_cpu = get_cpu(); 327 curr_cpu = get_cpu();
328 328
329 if (curr_cpu != cpu) { 329 if (curr_cpu != cpu) {
330 err = -EAGAIN; 330 err = -EAGAIN;
331 goto ret; 331 goto ret;
332 } else { 332 } else {
333 /* 333 /*
334 * Do work : But cant sleep, since get_cpu() disables preempt 334 * Do work : But cant sleep, since get_cpu() disables preempt
335 */ 335 */
336 } 336 }
337 ret: 337 ret:
338 put_cpu(); 338 put_cpu();
339 set_cpus_allowed(current, saved_mask); 339 set_cpus_allowed(current, saved_mask);
340 return err; 340 return err;
341 } 341 }
342 342
343 343
344Q: How do we determine how many CPUs are available for hotplug. 344Q: How do we determine how many CPUs are available for hotplug.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 24f3c63b3017..1ac3c74646e3 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -255,7 +255,7 @@ Who: Stephen Hemminger <shemminger@osdl.org>
255 255
256 256
257What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment 257What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment
258When: Oktober 2008 258When: October 2008
259Why: The stacking of class devices makes these values misleading and 259Why: The stacking of class devices makes these values misleading and
260 inconsistent. 260 inconsistent.
261 Class devices should not carry any of these properties, and bus 261 Class devices should not carry any of these properties, and bus
diff --git a/Documentation/hwmon/adm9240 b/Documentation/hwmon/adm9240
index 35f618f32896..2c6f1fed4618 100644
--- a/Documentation/hwmon/adm9240
+++ b/Documentation/hwmon/adm9240
@@ -24,7 +24,7 @@ Authors:
24 Frodo Looijaard <frodol@dds.nl>, 24 Frodo Looijaard <frodol@dds.nl>,
25 Philip Edelbrock <phil@netroedge.com>, 25 Philip Edelbrock <phil@netroedge.com>,
26 Michiel Rook <michiel@grendelproject.nl>, 26 Michiel Rook <michiel@grendelproject.nl>,
27 Grant Coady <gcoady@gmail.com> with guidance 27 Grant Coady <gcoady.lk@gmail.com> with guidance
28 from Jean Delvare <khali@linux-fr.org> 28 from Jean Delvare <khali@linux-fr.org>
29 29
30Interface 30Interface
diff --git a/Documentation/hwmon/f71805f b/Documentation/hwmon/f71805f
index 28c5b7d1eb90..2ca69df669c3 100644
--- a/Documentation/hwmon/f71805f
+++ b/Documentation/hwmon/f71805f
@@ -17,7 +17,7 @@ Thanks to Kris Chen from Fintek for answering technical questions and
17providing additional documentation. 17providing additional documentation.
18 18
19Thanks to Chris Lin from Jetway for providing wiring schematics and 19Thanks to Chris Lin from Jetway for providing wiring schematics and
20anwsering technical questions. 20answering technical questions.
21 21
22 22
23Description 23Description
diff --git a/Documentation/hwmon/k8temp b/Documentation/hwmon/k8temp
index bab445ab0f52..30d123b8d920 100644
--- a/Documentation/hwmon/k8temp
+++ b/Documentation/hwmon/k8temp
@@ -2,7 +2,7 @@ Kernel driver k8temp
2==================== 2====================
3 3
4Supported chips: 4Supported chips:
5 * AMD K8 CPU 5 * AMD Athlon64/FX or Opteron CPUs
6 Prefix: 'k8temp' 6 Prefix: 'k8temp'
7 Addresses scanned: PCI space 7 Addresses scanned: PCI space
8 Datasheet: http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf 8 Datasheet: http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf
@@ -13,10 +13,13 @@ Contact: Rudolf Marek <r.marek@sh.cvut.cz>
13Description 13Description
14----------- 14-----------
15 15
16This driver permits reading temperature sensor(s) embedded inside AMD K8 CPUs. 16This driver permits reading temperature sensor(s) embedded inside AMD K8
17Official documentation says that it works from revision F of K8 core, but 17family CPUs (Athlon64/FX, Opteron). Official documentation says that it works
18in fact it seems to be implemented for all revisions of K8 except the first 18from revision F of K8 core, but in fact it seems to be implemented for all
19two revisions (SH-B0 and SH-B3). 19revisions of K8 except the first two revisions (SH-B0 and SH-B3).
20
21Please note that you will need at least lm-sensors 2.10.1 for proper userspace
22support.
20 23
21There can be up to four temperature sensors inside single CPU. The driver 24There can be up to four temperature sensors inside single CPU. The driver
22will auto-detect the sensors and will display only temperatures from 25will auto-detect the sensors and will display only temperatures from
diff --git a/Documentation/hwmon/smsc47m1 b/Documentation/hwmon/smsc47m1
index c15bbe68264e..04a11124f667 100644
--- a/Documentation/hwmon/smsc47m1
+++ b/Documentation/hwmon/smsc47m1
@@ -2,12 +2,14 @@ Kernel driver smsc47m1
2====================== 2======================
3 3
4Supported chips: 4Supported chips:
5 * SMSC LPC47B27x, LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 5 * SMSC LPC47B27x, LPC47M112, LPC47M10x, LPC47M13x, LPC47M14x,
6 LPC47M15x and LPC47M192
6 Addresses scanned: none, address read from Super I/O config space 7 Addresses scanned: none, address read from Super I/O config space
7 Prefix: 'smsc47m1' 8 Prefix: 'smsc47m1'
8 Datasheets: 9 Datasheets:
9 http://www.smsc.com/main/datasheets/47b27x.pdf 10 http://www.smsc.com/main/datasheets/47b27x.pdf
10 http://www.smsc.com/main/datasheets/47m10x.pdf 11 http://www.smsc.com/main/datasheets/47m10x.pdf
12 http://www.smsc.com/main/datasheets/47m112.pdf
11 http://www.smsc.com/main/tools/discontinued/47m13x.pdf 13 http://www.smsc.com/main/tools/discontinued/47m13x.pdf
12 http://www.smsc.com/main/datasheets/47m14x.pdf 14 http://www.smsc.com/main/datasheets/47m14x.pdf
13 http://www.smsc.com/main/tools/discontinued/47m15x.pdf 15 http://www.smsc.com/main/tools/discontinued/47m15x.pdf
diff --git a/Documentation/hwmon/w83627ehf b/Documentation/hwmon/w83627ehf
index fae3b781d82d..caa610a297e8 100644
--- a/Documentation/hwmon/w83627ehf
+++ b/Documentation/hwmon/w83627ehf
@@ -26,7 +26,7 @@ fan control mode).
26Temperatures are measured in degrees Celsius and measurement resolution is 1 26Temperatures are measured in degrees Celsius and measurement resolution is 1
27degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when 27degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
28the temperature gets higher than high limit; it stays on until the temperature 28the temperature gets higher than high limit; it stays on until the temperature
29falls below the Hysteresis value. 29falls below the hysteresis value.
30 30
31Fan rotation speeds are reported in RPM (rotations per minute). An alarm is 31Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
32triggered if the rotation speed has dropped below a programmable limit. Fan 32triggered if the rotation speed has dropped below a programmable limit. Fan
@@ -67,9 +67,9 @@ Thermal Cruise mode
67 67
68If the temperature is in the range defined by: 68If the temperature is in the range defined by:
69 69
70pwm[1-4]_target - set target temperature, unit millidegree Celcius 70pwm[1-4]_target - set target temperature, unit millidegree Celsius
71 (range 0 - 127000) 71 (range 0 - 127000)
72pwm[1-4]_tolerance - tolerance, unit millidegree Celcius (range 0 - 15000) 72pwm[1-4]_tolerance - tolerance, unit millidegree Celsius (range 0 - 15000)
73 73
74there are no changes to fan speed. Once the temperature leaves the interval, 74there are no changes to fan speed. Once the temperature leaves the interval,
75fan speed increases (temp is higher) or decreases if lower than desired. 75fan speed increases (temp is higher) or decreases if lower than desired.
diff --git a/Documentation/input/xpad.txt b/Documentation/input/xpad.txt
index b9111a703ce0..5427bdf225ed 100644
--- a/Documentation/input/xpad.txt
+++ b/Documentation/input/xpad.txt
@@ -3,20 +3,37 @@ xpad - Linux USB driver for X-Box gamepads
3This is the very first release of a driver for X-Box gamepads. 3This is the very first release of a driver for X-Box gamepads.
4Basically, this was hacked away in just a few hours, so don't expect 4Basically, this was hacked away in just a few hours, so don't expect
5miracles. 5miracles.
6
6In particular, there is currently NO support for the rumble pack. 7In particular, there is currently NO support for the rumble pack.
7You won't find many ff-aware linux applications anyway. 8You won't find many ff-aware linux applications anyway.
8 9
9 10
100. Status 110. Notes
11--------- 12--------
13
14Driver updated for kernel 2.6.17.11. (Based on a patch for 2.6.11.4.)
12 15
13For now, this driver has only been tested on just one Linux-Box. 16The number of buttons/axes reported varies based on 3 things:
14This one is running a 2.4.18 kernel with usb-uhci on an amd athlon 600. 17- if you are using a known controller
18- if you are using a known dance pad
19- if using an unknown device (one not listed below), what you set in the
20 module configuration for "Map D-PAD to buttons rather than axes for unknown
21 pads" (module option dpad_to_buttons)
15 22
16The jstest-program from joystick-1.2.15 (jstest-version 2.1.0) reports 23If you set dpad_to_buttons to 0 and you are using an unknown device (one
178 axes and 10 buttons. 24not listed below), the driver will map the directional pad to axes (X/Y),
25if you said N it will map the d-pad to buttons, which is needed for dance
26style games to function correctly. The default is Y.
27
28dpad_to_buttons has no effect for known pads.
29
300.1 Normal Controllers
31----------------------
32With a normal controller, the directional pad is mapped to its own X/Y axes.
33The jstest-program from joystick-1.2.15 (jstest-version 2.1.0) will report 8
34axes and 10 buttons.
18 35
19Alls 8 axes work, though they all have the same range (-32768..32767) 36All 8 axes work, though they all have the same range (-32768..32767)
20and the zero-setting is not correct for the triggers (I don't know if that 37and the zero-setting is not correct for the triggers (I don't know if that
21is some limitation of jstest, since the input device setup should be fine. I 38is some limitation of jstest, since the input device setup should be fine. I
22didn't have a look at jstest itself yet). 39didn't have a look at jstest itself yet).
@@ -30,16 +47,50 @@ in game functionality were OK. However, I find it rather difficult to
30play first person shooters with a pad. Your mileage may vary. 47play first person shooters with a pad. Your mileage may vary.
31 48
32 49
500.2 Xbox Dance Pads
51-------------------
52When using a known dance pad, jstest will report 6 axes and 14 buttons.
53
54For dance style pads (like the redoctane pad) several changes
55have been made. The old driver would map the d-pad to axes, resulting
56in the driver being unable to report when the user was pressing both
57left+right or up+down, making DDR style games unplayable.
58
59Known dance pads automatically map the d-pad to buttons and will work
60correctly out of the box.
61
62If your dance pad is recognized by the driver but is using axes instead
63of buttons, see section 0.3 - Unknown Controllers
64
65I've tested this with Stepmania, and it works quite well.
66
67
680.3 Unkown Controllers
69----------------------
70If you have an unkown xbox controller, it should work just fine with
71the default settings.
72
73HOWEVER if you have an unknown dance pad not listed below, it will not
74work UNLESS you set "dpad_to_buttons" to 1 in the module configuration.
75
76PLEASE if you have an unkown controller, email Dom <binary1230@yahoo.com> with
77a dump from /proc/bus/usb and a description of the pad (manufacturer, country,
78whether it is a dance pad or normal controller) so that we can add your pad
79to the list of supported devices, ensuring that it will work out of the
80box in the future.
81
82
331. USB adapter 831. USB adapter
34-------------- 84--------------
35 85
36Before you can actually use the driver, you need to get yourself an 86Before you can actually use the driver, you need to get yourself an
37adapter cable to connect the X-Box controller to your Linux-Box. 87adapter cable to connect the X-Box controller to your Linux-Box. You
88can buy these online fairly cheap, or build your own.
38 89
39Such a cable is pretty easy to build. The Controller itself is a USB compound 90Such a cable is pretty easy to build. The Controller itself is a USB
40device (a hub with three ports for two expansion slots and the controller 91compound device (a hub with three ports for two expansion slots and
41device) with the only difference in a nonstandard connector (5 pins vs. 4 on 92the controller device) with the only difference in a nonstandard connector
42standard USB connector). 93(5 pins vs. 4 on standard USB connector).
43 94
44You just need to solder a USB connector onto the cable and keep the 95You just need to solder a USB connector onto the cable and keep the
45yellow wire unconnected. The other pins have the same order on both 96yellow wire unconnected. The other pins have the same order on both
@@ -51,36 +102,36 @@ original one. You can buy an extension cable and cut that instead. That way,
51you can still use the controller with your X-Box, if you have one ;) 102you can still use the controller with your X-Box, if you have one ;)
52 103
53 104
542. driver installation 1052. Driver Installation
55---------------------- 106----------------------
56 107
57Once you have the adapter cable and the controller is connected, you need 108Once you have the adapter cable and the controller is connected, you need
58to load your USB subsystem and should cat /proc/bus/usb/devices. 109to load your USB subsystem and should cat /proc/bus/usb/devices.
59There should be an entry like the one at the end [4]. 110There should be an entry like the one at the end [4].
60 111
61Currently (as of version 0.0.4), the following three devices are included: 112Currently (as of version 0.0.6), the following devices are included:
62 original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202 113 original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202
114 smaller Microsoft XBOX controller (US), vendor=0x045e, product=0x0289
63 original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285 115 original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285
64 InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a 116 InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a
117 RedOctane Xbox Dance Pad (US), vendor=0x0c12, product=0x8809
65 118
66If you have another controller that is not listed above and is not recognized 119The driver should work with xbox pads not listed above as well, however
67by the driver, please drop me a line with the appropriate info (that is, include 120you will need to do something extra for dance pads to work.
68the name, vendor and product ID, as well as the country where you bought it;
69sending the whole dump out of /proc/bus/usb/devices along would be even better).
70 121
71In theory, the driver should work with other controllers than mine 122If you have a controller not listed above, see 0.3 - Unknown Controllers
72(InterAct PowerPad pro, bought in Germany) just fine, but I cannot test this
73for I only have this one controller.
74 123
75If you compiled and installed the driver, test the functionality: 124If you compiled and installed the driver, test the functionality:
76> modprobe xpad 125> modprobe xpad
77> modprobe joydev 126> modprobe joydev
78> jstest /dev/js0 127> jstest /dev/js0
79 128
80There should be a single line showing 18 inputs (8 axes, 10 buttons), and 129If you're using a normal controller, there should be a single line showing
81it's values should change if you move the sticks and push the buttons. 13018 inputs (8 axes, 10 buttons), and its values should change if you move
131the sticks and push the buttons. If you're using a dance pad, it should
132show 20 inputs (6 axes, 14 buttons).
82 133
83It works? Voila, your done ;) 134It works? Voila, you're done ;)
84 135
85 136
863. Thanks 1373. Thanks
@@ -111,6 +162,22 @@ I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none)
111E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms 162E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms
112E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms 163E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms
113 164
1655. /proc/bus/usb/devices - dump from Redoctane Xbox Dance Pad (US):
166
167T: Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12 MxCh= 0
168D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
169P: Vendor=0c12 ProdID=8809 Rev= 0.01
170S: Product=XBOX DDR
171C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
172I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=xpad
173E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=4ms
174E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl=4ms
175
114-- 176--
115Marko Friedemann <mfr@bmx-chemnitz.de> 177Marko Friedemann <mfr@bmx-chemnitz.de>
1162002-07-16 1782002-07-16
179 - original doc
180
181Dominic Cerquetti <binary1230@yahoo.com>
1822005-03-19
183 - added stuff for dance pads, new d-pad->axes mappings
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index ff571f9298e0..dd00fd556a60 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1231,6 +1231,11 @@ and is between 256 and 4096 characters. It is defined in the file
1231 machine check when some devices' config space 1231 machine check when some devices' config space
1232 is read. But various workarounds are disabled 1232 is read. But various workarounds are disabled
1233 and some IOMMU drivers will not work. 1233 and some IOMMU drivers will not work.
1234 bfsort Sort PCI devices into breadth-first order.
1235 This sorting is done to get a device
1236 order compatible with older (<= 2.4) kernels.
1237 nobfsort Don't sort PCI devices into breadth-first order.
1238
1234 pcmv= [HW,PCMCIA] BadgePAD 4 1239 pcmv= [HW,PCMCIA] BadgePAD 4
1235 1240
1236 pd. [PARIDE] 1241 pd. [PARIDE]
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 994355b0cd19..7f790f66ec68 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1898,7 +1898,7 @@ queue before processing any further requests:
1898 smp_wmb(); 1898 smp_wmb();
1899 <A:modify v=2> <C:busy> 1899 <A:modify v=2> <C:busy>
1900 <C:queue v=2> 1900 <C:queue v=2>
1901 p = &b; q = p; 1901 p = &v; q = p;
1902 <D:request p> 1902 <D:request p>
1903 <B:modify p=&v> <D:commit p=&v> 1903 <B:modify p=&v> <D:commit p=&v>
1904 <D:read p> 1904 <D:read p>
diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO
index 59d1166d41ee..d684a6ac69a8 100644
--- a/Documentation/s390/CommonIO
+++ b/Documentation/s390/CommonIO
@@ -66,7 +66,7 @@ Command line parameters
66 66
67 When a device is un-ignored, device recognition and sensing is performed and 67 When a device is un-ignored, device recognition and sensing is performed and
68 the device driver will be notified if possible, so the device will become 68 the device driver will be notified if possible, so the device will become
69 available to the system. 69 available to the system. Note that un-ignoring is performed asynchronously.
70 70
71 You can also add ranges of devices to be ignored by piping to 71 You can also add ranges of devices to be ignored by piping to
72 /proc/cio_ignore; "add <device range>, <device range>, ..." will ignore the 72 /proc/cio_ignore; "add <device range>, <device range>, ..." will ignore the
diff --git a/Documentation/s390/cds.txt b/Documentation/s390/cds.txt
index d80e5733827d..32a96cc39215 100644
--- a/Documentation/s390/cds.txt
+++ b/Documentation/s390/cds.txt
@@ -174,14 +174,10 @@ read_dev_chars() - Read Device Characteristics
174 174
175This routine returns the characteristics for the device specified. 175This routine returns the characteristics for the device specified.
176 176
177The function is meant to be called with an irq handler in place; that is, 177The function is meant to be called with the device already enabled; that is,
178at earliest during set_online() processing. 178at earliest during set_online() processing.
179 179
180While the request is processed synchronously, the device interrupt 180The ccw_device must not be locked prior to calling read_dev_chars().
181handler is called for final ending status. In case of error situations the
182interrupt handler may recover appropriately. The device irq handler can
183recognize the corresponding interrupts by the interruption parameter be
1840x00524443. The ccw_device must not be locked prior to calling read_dev_chars().
185 181
186The function may be called enabled or disabled. 182The function may be called enabled or disabled.
187 183
@@ -410,26 +406,7 @@ individual flag meanings.
410 406
411Usage Notes : 407Usage Notes :
412 408
413Prior to call ccw_device_start() the device driver must assure disabled state, 409ccw_device_start() must be called disabled and with the ccw device lock held.
414i.e. the I/O mask value in the PSW must be disabled. This can be accomplished
415by calling local_save_flags( flags). The current PSW flags are preserved and
416can be restored by local_irq_restore( flags) at a later time.
417
418If the device driver violates this rule while running in a uni-processor
419environment an interrupt might be presented prior to the ccw_device_start()
420routine returning to the device driver main path. In this case we will end in a
421deadlock situation as the interrupt handler will try to obtain the irq
422lock the device driver still owns (see below) !
423
424The driver must assure to hold the device specific lock. This can be
425accomplished by
426
427(i) spin_lock(get_ccwdev_lock(cdev)), or
428(ii) spin_lock_irqsave(get_ccwdev_lock(cdev), flags)
429
430Option (i) should be used if the calling routine is running disabled for
431I/O interrupts (see above) already. Option (ii) obtains the device gate und
432puts the CPU into I/O disabled state by preserving the current PSW flags.
433 410
434The device driver is allowed to issue the next ccw_device_start() call from 411The device driver is allowed to issue the next ccw_device_start() call from
435within its interrupt handler already. It is not required to schedule a 412within its interrupt handler already. It is not required to schedule a
@@ -488,7 +465,7 @@ int ccw_device_resume(struct ccw_device *cdev);
488 465
489cdev - ccw_device the resume operation is requested for 466cdev - ccw_device the resume operation is requested for
490 467
491The resume_IO() function returns: 468The ccw_device_resume() function returns:
492 469
493 0 - suspended channel program is resumed 470 0 - suspended channel program is resumed
494-EBUSY - status pending 471-EBUSY - status pending
@@ -507,6 +484,8 @@ a long-running channel program or the device might require to initially issue
507a halt subchannel (HSCH) I/O command. For those purposes the ccw_device_halt() 484a halt subchannel (HSCH) I/O command. For those purposes the ccw_device_halt()
508command is provided. 485command is provided.
509 486
487ccw_device_halt() must be called disabled and with the ccw device lock held.
488
510int ccw_device_halt(struct ccw_device *cdev, 489int ccw_device_halt(struct ccw_device *cdev,
511 unsigned long intparm); 490 unsigned long intparm);
512 491
@@ -517,7 +496,7 @@ intparm : interruption parameter; value is only used if no I/O
517 496
518The ccw_device_halt() function returns : 497The ccw_device_halt() function returns :
519 498
520 0 - successful completion or request successfully initiated 499 0 - request successfully initiated
521-EBUSY - the device is currently busy, or status pending. 500-EBUSY - the device is currently busy, or status pending.
522-ENODEV - cdev invalid. 501-ENODEV - cdev invalid.
523-EINVAL - The device is not operational or the ccw device is not online. 502-EINVAL - The device is not operational or the ccw device is not online.
@@ -533,6 +512,23 @@ can then perform an appropriate action. Prior to interrupt of an outstanding
533read to a network device (with or without PCI flag) a ccw_device_halt() 512read to a network device (with or without PCI flag) a ccw_device_halt()
534is required to end the pending operation. 513is required to end the pending operation.
535 514
515ccw_device_clear() - Terminage I/O Request Processing
516
517In order to terminate all I/O processing at the subchannel, the clear subchannel
518(CSCH) command is used. It can be issued via ccw_device_clear().
519
520ccw_device_clear() must be called disabled and with the ccw device lock held.
521
522int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm);
523
524cdev: ccw_device the clear operation is requested for
525intparm: interruption parameter (see ccw_device_halt())
526
527The ccw_device_clear() function returns:
528
529 0 - request successfully initiated
530-ENODEV - cdev invalid
531-EINVAL - The device is not operational or the ccw device is not online.
536 532
537Miscellaneous Support Routines 533Miscellaneous Support Routines
538 534
diff --git a/Documentation/s390/driver-model.txt b/Documentation/s390/driver-model.txt
index 62c082387aea..77bf450ec39b 100644
--- a/Documentation/s390/driver-model.txt
+++ b/Documentation/s390/driver-model.txt
@@ -239,6 +239,9 @@ status - Can be 'online' or 'offline'.
239 239
240type - The physical type of the channel path. 240type - The physical type of the channel path.
241 241
242shared - Whether the channel path is shared.
243
244cmg - The channel measurement group.
242 245
2433. System devices 2463. System devices
244----------------- 247-----------------
diff --git a/MAINTAINERS b/MAINTAINERS
index a2b6d9fa3502..d708702aba2f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1668,6 +1668,12 @@ M: sct@redhat.com, akpm@osdl.org
1668L: ext2-devel@lists.sourceforge.net 1668L: ext2-devel@lists.sourceforge.net
1669S: Maintained 1669S: Maintained
1670 1670
1671K8TEMP HARDWARE MONITORING DRIVER
1672P: Rudolf Marek
1673M: r.marek@assembler.cz
1674L: lm-sensors@lm-sensors.org
1675S: Maintained
1676
1671KCONFIG 1677KCONFIG
1672P: Roman Zippel 1678P: Roman Zippel
1673M: zippel@linux-m68k.org 1679M: zippel@linux-m68k.org
@@ -2012,8 +2018,11 @@ L: linux-kernel@vger.kernel.org
2012W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html 2018W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html
2013S: Maintained 2019S: Maintained
2014 2020
2015MULTIMEDIA CARD (MMC) SUBSYSTEM 2021MULTIMEDIA CARD (MMC) AND SECURE DIGITAL (SD) SUBSYSTEM
2016S: Orphan 2022P: Pierre Ossman
2023M: drzeus-mmc@drzeus.cx
2024L: linux-kernel@vger.kernel.org
2025S: Maintained
2017 2026
2018MULTISOUND SOUND DRIVER 2027MULTISOUND SOUND DRIVER
2019P: Andrew Veliath 2028P: Andrew Veliath
@@ -2049,11 +2058,13 @@ P: Marc Boucher
2049P: James Morris 2058P: James Morris
2050P: Harald Welte 2059P: Harald Welte
2051P: Jozsef Kadlecsik 2060P: Jozsef Kadlecsik
2052M: coreteam@netfilter.org 2061P: Patrick McHardy
2062M: kaber@trash.net
2063L: netfilter-devel@lists.netfilter.org
2064L: netfilter@lists.netfilter.org
2065L: coreteam@netfilter.org
2053W: http://www.netfilter.org/ 2066W: http://www.netfilter.org/
2054W: http://www.iptables.org/ 2067W: http://www.iptables.org/
2055L: netfilter@lists.netfilter.org
2056L: netfilter-devel@lists.netfilter.org
2057S: Supported 2068S: Supported
2058 2069
2059NETLABEL 2070NETLABEL
@@ -2304,8 +2315,8 @@ T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
2304S: Supported 2315S: Supported
2305 2316
2306PCI HOTPLUG CORE 2317PCI HOTPLUG CORE
2307P: Greg Kroah-Hartman 2318P: Kristen Carlson Accardi
2308M: gregkh@suse.de 2319M: kristen.c.accardi@intel.com
2309S: Supported 2320S: Supported
2310 2321
2311PCI HOTPLUG COMPAQ DRIVER 2322PCI HOTPLUG COMPAQ DRIVER
diff --git a/Makefile b/Makefile
index 703d40a65e7e..62a1343cf327 100644
--- a/Makefile
+++ b/Makefile
@@ -1319,7 +1319,8 @@ define xtags
1319 $(all-sources) | xargs $1 -a \ 1319 $(all-sources) | xargs $1 -a \
1320 -I __initdata,__exitdata,__acquires,__releases \ 1320 -I __initdata,__exitdata,__acquires,__releases \
1321 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 1321 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
1322 --extra=+f --c-kinds=+px; \ 1322 --extra=+f --c-kinds=+px \
1323 --regex-asm='/ENTRY\(([^)]*)\).*/\1/'; \
1323 $(all-kconfigs) | xargs $1 -a \ 1324 $(all-kconfigs) | xargs $1 -a \
1324 --langdef=kconfig \ 1325 --langdef=kconfig \
1325 --language-force=kconfig \ 1326 --language-force=kconfig \
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index fa5d4976f514..1463330ed8ee 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/irq.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index a6f14801872d..9ee63834e603 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -133,11 +133,13 @@ static void ixdp2400_pci_postinit(void)
133 struct pci_dev *dev; 133 struct pci_dev *dev;
134 134
135 if (ixdp2x00_master_npu()) { 135 if (ixdp2x00_master_npu()) {
136 dev = pci_find_slot(1, IXDP2400_SLAVE_ENET_DEVFN); 136 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN);
137 pci_remove_bus_device(dev); 137 pci_remove_bus_device(dev);
138 pci_dev_put(dev)
138 } else { 139 } else {
139 dev = pci_find_slot(1, IXDP2400_MASTER_ENET_DEVFN); 140 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN);
140 pci_remove_bus_device(dev); 141 pci_remove_bus_device(dev);
142 pci_dev_put(dev)
141 143
142 ixdp2x00_slave_pci_postinit(); 144 ixdp2x00_slave_pci_postinit();
143 } 145 }
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index 91d36d91dac0..70d247f09a7e 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -261,14 +261,16 @@ int __init ixdp2800_pci_init(void)
261 261
262 pci_common_init(&ixdp2800_pci); 262 pci_common_init(&ixdp2800_pci);
263 if (ixdp2x00_master_npu()) { 263 if (ixdp2x00_master_npu()) {
264 dev = pci_find_slot(1, IXDP2800_SLAVE_ENET_DEVFN); 264 dev = pci_get_bus_and_slot(1, IXDP2800_SLAVE_ENET_DEVFN);
265 pci_remove_bus_device(dev); 265 pci_remove_bus_device(dev);
266 pci_dev_put(dev);
266 267
267 ixdp2800_master_enable_slave(); 268 ixdp2800_master_enable_slave();
268 ixdp2800_master_wait_for_slave_bus_scan(); 269 ixdp2800_master_wait_for_slave_bus_scan();
269 } else { 270 } else {
270 dev = pci_find_slot(1, IXDP2800_MASTER_ENET_DEVFN); 271 dev = pci_get_bus_and_slot(1, IXDP2800_MASTER_ENET_DEVFN);
271 pci_remove_bus_device(dev); 272 pci_remove_bus_device(dev);
273 pci_dev_put(dev);
272 } 274 }
273 } 275 }
274 276
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index af48cb52dfc4..aa2655092d2d 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -241,11 +241,14 @@ void ixdp2x00_slave_pci_postinit(void)
241 /* 241 /*
242 * Remove PMC device is there is one 242 * Remove PMC device is there is one
243 */ 243 */
244 if((dev = pci_find_slot(1, IXDP2X00_PMC_DEVFN))) 244 if((dev = pci_get_bus_and_slot(1, IXDP2X00_PMC_DEVFN))) {
245 pci_remove_bus_device(dev); 245 pci_remove_bus_device(dev);
246 pci_dev_put(dev);
247 }
246 248
247 dev = pci_find_slot(0, IXDP2X00_21555_DEVFN); 249 dev = pci_get_bus_and_slot(0, IXDP2X00_21555_DEVFN);
248 pci_remove_bus_device(dev); 250 pci_remove_bus_device(dev);
251 pci_dev_put(dev);
249} 252}
250 253
251/************************************************************************** 254/**************************************************************************
diff --git a/arch/arm/mach-lh7a40x/common.h b/arch/arm/mach-lh7a40x/common.h
index 18e8bb4eb202..0ca20c6c83b7 100644
--- a/arch/arm/mach-lh7a40x/common.h
+++ b/arch/arm/mach-lh7a40x/common.h
@@ -15,4 +15,4 @@ extern void lh7a404_init_irq (void);
15extern void lh7a40x_clcd_init (void); 15extern void lh7a40x_clcd_init (void);
16extern void lh7a40x_init_board_irq (void); 16extern void lh7a40x_init_board_irq (void);
17 17
18#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq), regs) 18#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq))
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index ee80d62119d3..142c33c3dff5 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -397,7 +397,7 @@ static void lubbock_mmc_poll(unsigned long data)
397 if (LUB_IRQ_SET_CLR & (1 << 0)) 397 if (LUB_IRQ_SET_CLR & (1 << 0))
398 mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE); 398 mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE);
399 else { 399 else {
400 (void) mmc_detect_int(LUBBOCK_SD_IRQ, (void *)data, NULL); 400 (void) mmc_detect_int(LUBBOCK_SD_IRQ, (void *)data);
401 enable_irq(LUBBOCK_SD_IRQ); 401 enable_irq(LUBBOCK_SD_IRQ);
402 } 402 }
403} 403}
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
index 639597729932..90a4130114a6 100644
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -82,6 +82,14 @@ static struct sdram_params sdram_tbl[] __initdata = {
82 .twr = 9, 82 .twr = 9,
83 .refresh = 64000, 83 .refresh = 64000,
84 .cas_latency = 3, 84 .cas_latency = 3,
85 }, { /* Samsung K4S281632B-1H */
86 .name = "K4S281632b-1H",
87 .rows = 12,
88 .tck = 10,
89 .trp = 20,
90 .twr = 10,
91 .refresh = 64000,
92 .cas_latency = 3,
85 }, { /* Samsung KM416S4030CT */ 93 }, { /* Samsung KM416S4030CT */
86 .name = "KM416S4030CT", 94 .name = "KM416S4030CT",
87 .rows = 13, 95 .rows = 13,
@@ -366,6 +374,8 @@ static int __init sa1110_clk_init(void)
366 374
367 if (machine_is_h3100()) 375 if (machine_is_h3100())
368 name = "KM416S4030CT"; 376 name = "KM416S4030CT";
377 if (machine_is_jornada720())
378 name = "K4S281632B-1H";
369 } 379 }
370 380
371 sdram = sa1110_find_sdram(name); 381 sdram = sa1110_find_sdram(name);
diff --git a/arch/arm/oprofile/op_model_xscale.c b/arch/arm/oprofile/op_model_xscale.c
index 7899d3ca75a3..7c3289c2acd7 100644
--- a/arch/arm/oprofile/op_model_xscale.c
+++ b/arch/arm/oprofile/op_model_xscale.c
@@ -20,7 +20,8 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/oprofile.h> 21#include <linux/oprofile.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <asm/irq.h> 23#include <linux/irq.h>
24
24#include <asm/system.h> 25#include <asm/system.h>
25 26
26#include "op_counter.h" 27#include "op_counter.h"
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index b02af1d740fa..579c69ae9ff7 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -4,7 +4,7 @@
4# 4#
5# Up to date versions of this file can be obtained from: 5# Up to date versions of this file can be obtained from:
6# 6#
7# http://www.arm.linux.org.uk/developer/machines/?action=download 7# http://www.arm.linux.org.uk/developer/machines/download.php
8# 8#
9# Please do not send patches to this file; it is automatically generated! 9# Please do not send patches to this file; it is automatically generated!
10# To add an entry into this database, please see Documentation/arm/README, 10# To add an entry into this database, please see Documentation/arm/README,
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Sat Sep 23 13:20:43 2006 15# Last update: Mon Oct 16 21:13:36 2006
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -1157,3 +1157,17 @@ adsturboxb MACH_ADSTURBOXB ADSTURBOXB 1143
1157oti4110 MACH_OTI4110 OTI4110 1144 1157oti4110 MACH_OTI4110 OTI4110 1144
1158hme_pxa MACH_HME_PXA HME_PXA 1145 1158hme_pxa MACH_HME_PXA HME_PXA 1145
1159deisterdca MACH_DEISTERDCA DEISTERDCA 1146 1159deisterdca MACH_DEISTERDCA DEISTERDCA 1146
1160ces_ssem2 MACH_CES_SSEM2 CES_SSEM2 1147
1161ces_mtr MACH_CES_MTR CES_MTR 1148
1162tds_avng_sbc MACH_TDS_AVNG_SBC TDS_AVNG_SBC 1149
1163everest MACH_EVEREST EVEREST 1150
1164pnx4010 MACH_PNX4010 PNX4010 1151
1165oxnas MACH_OXNAS OXNAS 1152
1166fiori MACH_FIORI FIORI 1153
1167ml1200 MACH_ML1200 ML1200 1154
1168cactus MACH_CACTUS CACTUS 1155
1169nb2xxx MACH_NB2XXX NB2XXX 1156
1170hw6900 MACH_HW6900 HW6900 1157
1171cdcs_quoll MACH_CDCS_QUOLL CDCS_QUOLL 1158
1172quicksilver MACH_QUICKSILVER QUICKSILVER 1159
1173uplat926 MACH_UPLAT926 UPLAT926 1160
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 28ab80649764..583c238e17fb 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -344,6 +344,7 @@ void alternatives_smp_switch(int smp)
344 344
345void __init alternative_instructions(void) 345void __init alternative_instructions(void)
346{ 346{
347 unsigned long flags;
347 if (no_replacement) { 348 if (no_replacement) {
348 printk(KERN_INFO "(SMP-)alternatives turned off\n"); 349 printk(KERN_INFO "(SMP-)alternatives turned off\n");
349 free_init_pages("SMP alternatives", 350 free_init_pages("SMP alternatives",
@@ -351,6 +352,8 @@ void __init alternative_instructions(void)
351 (unsigned long)__smp_alt_end); 352 (unsigned long)__smp_alt_end);
352 return; 353 return;
353 } 354 }
355
356 local_irq_save(flags);
354 apply_alternatives(__alt_instructions, __alt_instructions_end); 357 apply_alternatives(__alt_instructions, __alt_instructions_end);
355 358
356 /* switch to patch-once-at-boottime-only mode and free the 359 /* switch to patch-once-at-boottime-only mode and free the
@@ -386,4 +389,5 @@ void __init alternative_instructions(void)
386 alternatives_smp_switch(0); 389 alternatives_smp_switch(0);
387 } 390 }
388#endif 391#endif
392 local_irq_restore(flags);
389} 393}
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index b42f2d914af3..2af65858d322 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -540,11 +540,30 @@ static inline void apm_restore_cpus(cpumask_t mask)
540 * Also, we KNOW that for the non error case of apm_bios_call, there 540 * Also, we KNOW that for the non error case of apm_bios_call, there
541 * is no useful data returned in the low order 8 bits of eax. 541 * is no useful data returned in the low order 8 bits of eax.
542 */ 542 */
543#define APM_DO_CLI \ 543
544 if (apm_info.allow_ints) \ 544static inline unsigned long __apm_irq_save(void)
545 local_irq_enable(); \ 545{
546 else \ 546 unsigned long flags;
547 local_save_flags(flags);
548 if (apm_info.allow_ints) {
549 if (irqs_disabled_flags(flags))
550 local_irq_enable();
551 } else
552 local_irq_disable();
553
554 return flags;
555}
556
557#define apm_irq_save(flags) \
558 do { flags = __apm_irq_save(); } while (0)
559
560static inline void apm_irq_restore(unsigned long flags)
561{
562 if (irqs_disabled_flags(flags))
547 local_irq_disable(); 563 local_irq_disable();
564 else if (irqs_disabled())
565 local_irq_enable();
566}
548 567
549#ifdef APM_ZERO_SEGS 568#ifdef APM_ZERO_SEGS
550# define APM_DECL_SEGS \ 569# define APM_DECL_SEGS \
@@ -596,12 +615,11 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
596 save_desc_40 = gdt[0x40 / 8]; 615 save_desc_40 = gdt[0x40 / 8];
597 gdt[0x40 / 8] = bad_bios_desc; 616 gdt[0x40 / 8] = bad_bios_desc;
598 617
599 local_save_flags(flags); 618 apm_irq_save(flags);
600 APM_DO_CLI;
601 APM_DO_SAVE_SEGS; 619 APM_DO_SAVE_SEGS;
602 apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); 620 apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi);
603 APM_DO_RESTORE_SEGS; 621 APM_DO_RESTORE_SEGS;
604 local_irq_restore(flags); 622 apm_irq_restore(flags);
605 gdt[0x40 / 8] = save_desc_40; 623 gdt[0x40 / 8] = save_desc_40;
606 put_cpu(); 624 put_cpu();
607 apm_restore_cpus(cpus); 625 apm_restore_cpus(cpus);
@@ -640,12 +658,11 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
640 save_desc_40 = gdt[0x40 / 8]; 658 save_desc_40 = gdt[0x40 / 8];
641 gdt[0x40 / 8] = bad_bios_desc; 659 gdt[0x40 / 8] = bad_bios_desc;
642 660
643 local_save_flags(flags); 661 apm_irq_save(flags);
644 APM_DO_CLI;
645 APM_DO_SAVE_SEGS; 662 APM_DO_SAVE_SEGS;
646 error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax); 663 error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax);
647 APM_DO_RESTORE_SEGS; 664 APM_DO_RESTORE_SEGS;
648 local_irq_restore(flags); 665 apm_irq_restore(flags);
649 gdt[0x40 / 8] = save_desc_40; 666 gdt[0x40 / 8] = save_desc_40;
650 put_cpu(); 667 put_cpu();
651 apm_restore_cpus(cpus); 668 apm_restore_cpus(cpus);
diff --git a/arch/i386/kernel/i8253.c b/arch/i386/kernel/i8253.c
index 477b24daff53..9a0060b92e32 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pit = {
109 109
110static int __init init_pit_clocksource(void) 110static int __init init_pit_clocksource(void)
111{ 111{
112 if (num_possible_cpus() > 4) /* PIT does not scale! */ 112 if (num_possible_cpus() > 1) /* PIT does not scale! */
113 return 0; 113 return 0;
114 114
115 clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20); 115 clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20);
diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
index d53eafb6daa7..62996cd17084 100644
--- a/arch/i386/kernel/i8259.c
+++ b/arch/i386/kernel/i8259.c
@@ -113,7 +113,8 @@ void make_8259A_irq(unsigned int irq)
113{ 113{
114 disable_irq_nosync(irq); 114 disable_irq_nosync(irq);
115 io_apic_irqs &= ~(1<<irq); 115 io_apic_irqs &= ~(1<<irq);
116 set_irq_chip_and_handler(irq, &i8259A_chip, handle_level_irq); 116 set_irq_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq,
117 "XT");
117 enable_irq(irq); 118 enable_irq(irq);
118} 119}
119 120
@@ -369,8 +370,8 @@ void __init init_ISA_irqs (void)
369 /* 370 /*
370 * 16 old-style INTA-cycle interrupts: 371 * 16 old-style INTA-cycle interrupts:
371 */ 372 */
372 set_irq_chip_and_handler(i, &i8259A_chip, 373 set_irq_chip_and_handler_name(i, &i8259A_chip,
373 handle_level_irq); 374 handle_level_irq, "XT");
374 } else { 375 } else {
375 /* 376 /*
376 * 'high' PCI IRQs filled in on demand 377 * 'high' PCI IRQs filled in on demand
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 27bceaf5ce40..350192d6ab98 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1225,11 +1225,11 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
1225{ 1225{
1226 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) || 1226 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
1227 trigger == IOAPIC_LEVEL) 1227 trigger == IOAPIC_LEVEL)
1228 set_irq_chip_and_handler(irq, &ioapic_chip, 1228 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1229 handle_fasteoi_irq); 1229 handle_fasteoi_irq, "fasteoi");
1230 else 1230 else
1231 set_irq_chip_and_handler(irq, &ioapic_chip, 1231 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1232 handle_edge_irq); 1232 handle_edge_irq, "edge");
1233 set_intr_gate(vector, interrupt[irq]); 1233 set_intr_gate(vector, interrupt[irq]);
1234} 1234}
1235 1235
@@ -2235,7 +2235,8 @@ static inline void check_timer(void)
2235 printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); 2235 printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
2236 2236
2237 disable_8259A_irq(0); 2237 disable_8259A_irq(0);
2238 set_irq_chip_and_handler(0, &lapic_chip, handle_fasteoi_irq); 2238 set_irq_chip_and_handler_name(0, &lapic_chip, handle_fasteoi_irq,
2239 "fasteio");
2239 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ 2240 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
2240 enable_8259A_irq(0); 2241 enable_8259A_irq(0);
2241 2242
@@ -2541,7 +2542,8 @@ int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev)
2541 2542
2542 write_msi_msg(irq, &msg); 2543 write_msi_msg(irq, &msg);
2543 2544
2544 set_irq_chip_and_handler(irq, &msi_chip, handle_edge_irq); 2545 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq,
2546 "edge");
2545 2547
2546 return 0; 2548 return 0;
2547} 2549}
@@ -2636,7 +2638,8 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
2636 write_ht_irq_low(irq, low); 2638 write_ht_irq_low(irq, low);
2637 write_ht_irq_high(irq, high); 2639 write_ht_irq_high(irq, high);
2638 2640
2639 set_irq_chip_and_handler(irq, &ht_irq_chip, handle_edge_irq); 2641 set_irq_chip_and_handler_name(irq, &ht_irq_chip,
2642 handle_edge_irq, "edge");
2640 } 2643 }
2641 return vector; 2644 return vector;
2642} 2645}
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index 8cfc7dbec7b9..3201d421090a 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -258,7 +258,7 @@ int show_interrupts(struct seq_file *p, void *v)
258 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); 258 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
259#endif 259#endif
260 seq_printf(p, " %8s", irq_desc[i].chip->name); 260 seq_printf(p, " %8s", irq_desc[i].chip->name);
261 seq_printf(p, "-%s", handle_irq_name(irq_desc[i].handle_irq)); 261 seq_printf(p, "-%-8s", irq_desc[i].name);
262 seq_printf(p, " %s", action->name); 262 seq_printf(p, " %s", action->name);
263 263
264 for (action=action->next; action; action = action->next) 264 for (action=action->next; action; action = action->next)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index b8fa0a8b2e47..fbc95828cd74 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -349,8 +349,8 @@ static int tsc_update_callback(void)
349 int change = 0; 349 int change = 0;
350 350
351 /* check to see if we should switch to the safe clocksource: */ 351 /* check to see if we should switch to the safe clocksource: */
352 if (clocksource_tsc.rating != 50 && check_tsc_unstable()) { 352 if (clocksource_tsc.rating != 0 && check_tsc_unstable()) {
353 clocksource_tsc.rating = 50; 353 clocksource_tsc.rating = 0;
354 clocksource_reselect(); 354 clocksource_reselect();
355 change = 1; 355 change = 1;
356 } 356 }
@@ -461,7 +461,7 @@ static int __init init_tsc_clocksource(void)
461 clocksource_tsc.shift); 461 clocksource_tsc.shift);
462 /* lower the rating if we already know its unstable: */ 462 /* lower the rating if we already know its unstable: */
463 if (check_tsc_unstable()) 463 if (check_tsc_unstable())
464 clocksource_tsc.rating = 50; 464 clocksource_tsc.rating = 0;
465 465
466 init_timer(&verify_tsc_freq_timer); 466 init_timer(&verify_tsc_freq_timer);
467 verify_tsc_freq_timer.function = verify_tsc_freq; 467 verify_tsc_freq_timer.function = verify_tsc_freq;
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index 258df6b4d7d7..d22cfc9d656c 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -9,6 +9,7 @@
9#include <linux/highmem.h> 9#include <linux/highmem.h>
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/backing-dev.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13#include <asm/mmx.h> 14#include <asm/mmx.h>
14 15
@@ -741,7 +742,7 @@ survive:
741 742
742 if (retval == -ENOMEM && is_init(current)) { 743 if (retval == -ENOMEM && is_init(current)) {
743 up_read(&current->mm->mmap_sem); 744 up_read(&current->mm->mmap_sem);
744 blk_congestion_wait(WRITE, HZ/50); 745 congestion_wait(WRITE, HZ/50);
745 goto survive; 746 goto survive;
746 } 747 }
747 748
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 68bce194e688..6d5ace845e44 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -20,6 +20,7 @@
20unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | 20unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
21 PCI_PROBE_MMCONF; 21 PCI_PROBE_MMCONF;
22 22
23int pci_bf_sort;
23int pci_routeirq; 24int pci_routeirq;
24int pcibios_last_bus = -1; 25int pcibios_last_bus = -1;
25unsigned long pirq_table_addr; 26unsigned long pirq_table_addr;
@@ -118,6 +119,20 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b)
118} 119}
119 120
120/* 121/*
122 * Only use DMI information to set this if nothing was passed
123 * on the kernel command line (which was parsed earlier).
124 */
125
126static int __devinit set_bf_sort(struct dmi_system_id *d)
127{
128 if (pci_bf_sort == pci_bf_sort_default) {
129 pci_bf_sort = pci_dmi_bf;
130 printk(KERN_INFO "PCI: %s detected, enabling pci=bfsort.\n", d->ident);
131 }
132 return 0;
133}
134
135/*
121 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) 136 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
122 */ 137 */
123#ifdef __i386__ 138#ifdef __i386__
@@ -130,11 +145,11 @@ static int __devinit assign_all_busses(struct dmi_system_id *d)
130} 145}
131#endif 146#endif
132 147
148static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
149#ifdef __i386__
133/* 150/*
134 * Laptops which need pci=assign-busses to see Cardbus cards 151 * Laptops which need pci=assign-busses to see Cardbus cards
135 */ 152 */
136static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
137#ifdef __i386__
138 { 153 {
139 .callback = assign_all_busses, 154 .callback = assign_all_busses,
140 .ident = "Samsung X20 Laptop", 155 .ident = "Samsung X20 Laptop",
@@ -144,6 +159,38 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
144 }, 159 },
145 }, 160 },
146#endif /* __i386__ */ 161#endif /* __i386__ */
162 {
163 .callback = set_bf_sort,
164 .ident = "Dell PowerEdge 1950",
165 .matches = {
166 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
167 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1950"),
168 },
169 },
170 {
171 .callback = set_bf_sort,
172 .ident = "Dell PowerEdge 1955",
173 .matches = {
174 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
175 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1955"),
176 },
177 },
178 {
179 .callback = set_bf_sort,
180 .ident = "Dell PowerEdge 2900",
181 .matches = {
182 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
183 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2900"),
184 },
185 },
186 {
187 .callback = set_bf_sort,
188 .ident = "Dell PowerEdge 2950",
189 .matches = {
190 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
191 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2950"),
192 },
193 },
147 {} 194 {}
148}; 195};
149 196
@@ -189,6 +236,8 @@ static int __init pcibios_init(void)
189 236
190 pcibios_resource_survey(); 237 pcibios_resource_survey();
191 238
239 if (pci_bf_sort >= pci_force_bf)
240 pci_sort_breadthfirst();
192#ifdef CONFIG_PCI_BIOS 241#ifdef CONFIG_PCI_BIOS
193 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT)) 242 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
194 pcibios_sort(); 243 pcibios_sort();
@@ -203,6 +252,12 @@ char * __devinit pcibios_setup(char *str)
203 if (!strcmp(str, "off")) { 252 if (!strcmp(str, "off")) {
204 pci_probe = 0; 253 pci_probe = 0;
205 return NULL; 254 return NULL;
255 } else if (!strcmp(str, "bfsort")) {
256 pci_bf_sort = pci_force_bf;
257 return NULL;
258 } else if (!strcmp(str, "nobfsort")) {
259 pci_bf_sort = pci_force_nobf;
260 return NULL;
206 } 261 }
207#ifdef CONFIG_PCI_BIOS 262#ifdef CONFIG_PCI_BIOS
208 else if (!strcmp(str, "bios")) { 263 else if (!strcmp(str, "bios")) {
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index b60d7e8689ed..908b410f4c93 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -343,51 +343,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC, pcie_ro
343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk ); 343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk );
344 344
345/* 345/*
346 * Fixup to mark boot BIOS video selected by BIOS before it changes
347 *
348 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
349 *
350 * The standard boot ROM sequence for an x86 machine uses the BIOS
351 * to select an initial video card for boot display. This boot video
352 * card will have it's BIOS copied to C0000 in system RAM.
353 * IORESOURCE_ROM_SHADOW is used to associate the boot video
354 * card with this copy. On laptops this copy has to be used since
355 * the main ROM may be compressed or combined with another image.
356 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
357 * is marked here since the boot video device will be the only enabled
358 * video device at this point.
359 */
360
361static void __devinit pci_fixup_video(struct pci_dev *pdev)
362{
363 struct pci_dev *bridge;
364 struct pci_bus *bus;
365 u16 config;
366
367 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
368 return;
369
370 /* Is VGA routed to us? */
371 bus = pdev->bus;
372 while (bus) {
373 bridge = bus->self;
374 if (bridge) {
375 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
376 &config);
377 if (!(config & PCI_BRIDGE_CTL_VGA))
378 return;
379 }
380 bus = bus->parent;
381 }
382 pci_read_config_word(pdev, PCI_COMMAND, &config);
383 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
384 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
385 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
386 }
387}
388DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
389
390/*
391 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A. 346 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
392 * 347 *
393 * We pretend to bring them out of full D3 state, and restore the proper 348 * We pretend to bring them out of full D3 state, and restore the proper
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index 1814f74569c6..ad065cebd7b9 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -30,6 +30,13 @@
30extern unsigned int pci_probe; 30extern unsigned int pci_probe;
31extern unsigned long pirq_table_addr; 31extern unsigned long pirq_table_addr;
32 32
33enum pci_bf_sort_state {
34 pci_bf_sort_default,
35 pci_force_nobf,
36 pci_force_bf,
37 pci_dmi_bf,
38};
39
33/* pci-i386.c */ 40/* pci-i386.c */
34 41
35extern unsigned int pcibios_max_latency; 42extern unsigned int pcibios_max_latency;
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 0f14a82b856e..64e951de4e57 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -1,8 +1,9 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc3 3# Linux kernel version: 2.6.19-rc1
4# Thu Apr 27 11:48:23 2006 4# Mon Oct 9 10:53:59 2006
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
6 7
7# 8#
8# Code maturity level options 9# Code maturity level options
@@ -18,16 +19,22 @@ CONFIG_LOCALVERSION=""
18# CONFIG_LOCALVERSION_AUTO is not set 19# CONFIG_LOCALVERSION_AUTO is not set
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set
21CONFIG_POSIX_MQUEUE=y 23CONFIG_POSIX_MQUEUE=y
22# CONFIG_BSD_PROCESS_ACCT is not set 24# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y 25CONFIG_TASKSTATS=y
26# CONFIG_TASK_DELAY_ACCT is not set
27# CONFIG_UTS_NS is not set
24# CONFIG_AUDIT is not set 28# CONFIG_AUDIT is not set
25# CONFIG_IKCONFIG is not set 29# CONFIG_IKCONFIG is not set
26CONFIG_CPUSETS=y 30CONFIG_CPUSETS=y
27CONFIG_RELAY=y 31CONFIG_RELAY=y
28CONFIG_INITRAMFS_SOURCE="" 32CONFIG_INITRAMFS_SOURCE=""
29CONFIG_CC_OPTIMIZE_FOR_SIZE=y 33CONFIG_CC_OPTIMIZE_FOR_SIZE=y
34CONFIG_TASK_XACCT=y
35CONFIG_SYSCTL=y
30# CONFIG_EMBEDDED is not set 36# CONFIG_EMBEDDED is not set
37# CONFIG_SYSCTL_SYSCALL is not set
31CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y 39CONFIG_KALLSYMS_ALL=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set 40# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -40,6 +47,8 @@ CONFIG_FUTEX=y
40CONFIG_EPOLL=y 47CONFIG_EPOLL=y
41CONFIG_SHMEM=y 48CONFIG_SHMEM=y
42CONFIG_SLAB=y 49CONFIG_SLAB=y
50CONFIG_VM_EVENT_COUNTERS=y
51CONFIG_RT_MUTEXES=y
43# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
44CONFIG_BASE_SMALL=0 53CONFIG_BASE_SMALL=0
45# CONFIG_SLOB is not set 54# CONFIG_SLOB is not set
@@ -58,6 +67,7 @@ CONFIG_STOP_MACHINE=y
58# 67#
59# Block layer 68# Block layer
60# 69#
70CONFIG_BLOCK=y
61# CONFIG_BLK_DEV_IO_TRACE is not set 71# CONFIG_BLK_DEV_IO_TRACE is not set
62 72
63# 73#
@@ -89,7 +99,7 @@ CONFIG_EFI=y
89CONFIG_GENERIC_IOMAP=y 99CONFIG_GENERIC_IOMAP=y
90CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 100CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
91CONFIG_IA64_UNCACHED_ALLOCATOR=y 101CONFIG_IA64_UNCACHED_ALLOCATOR=y
92CONFIG_DMA_IS_DMA32=y 102CONFIG_AUDIT_ARCH=y
93# CONFIG_IA64_GENERIC is not set 103# CONFIG_IA64_GENERIC is not set
94# CONFIG_IA64_DIG is not set 104# CONFIG_IA64_DIG is not set
95# CONFIG_IA64_HP_ZX1 is not set 105# CONFIG_IA64_HP_ZX1 is not set
@@ -116,6 +126,7 @@ CONFIG_FORCE_MAX_ZONEORDER=17
116CONFIG_SMP=y 126CONFIG_SMP=y
117CONFIG_NR_CPUS=1024 127CONFIG_NR_CPUS=1024
118# CONFIG_HOTPLUG_CPU is not set 128# CONFIG_HOTPLUG_CPU is not set
129CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
119CONFIG_SCHED_SMT=y 130CONFIG_SCHED_SMT=y
120CONFIG_PREEMPT=y 131CONFIG_PREEMPT=y
121CONFIG_SELECT_MEMORY_MODEL=y 132CONFIG_SELECT_MEMORY_MODEL=y
@@ -128,6 +139,7 @@ CONFIG_NEED_MULTIPLE_NODES=y
128# CONFIG_SPARSEMEM_STATIC is not set 139# CONFIG_SPARSEMEM_STATIC is not set
129CONFIG_SPLIT_PTLOCK_CPUS=4 140CONFIG_SPLIT_PTLOCK_CPUS=4
130CONFIG_MIGRATION=y 141CONFIG_MIGRATION=y
142CONFIG_RESOURCES_64BIT=y
131CONFIG_ARCH_SELECT_MEMORY_MODEL=y 143CONFIG_ARCH_SELECT_MEMORY_MODEL=y
132CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 144CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
133CONFIG_ARCH_FLATMEM_ENABLE=y 145CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -135,15 +147,24 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
135CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y 147CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
136CONFIG_NUMA=y 148CONFIG_NUMA=y
137CONFIG_NODES_SHIFT=10 149CONFIG_NODES_SHIFT=10
150CONFIG_ARCH_POPULATES_NODE_MAP=y
138CONFIG_VIRTUAL_MEM_MAP=y 151CONFIG_VIRTUAL_MEM_MAP=y
139CONFIG_HOLES_IN_ZONE=y 152CONFIG_HOLES_IN_ZONE=y
140CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 153CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
154CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
141CONFIG_IA32_SUPPORT=y 155CONFIG_IA32_SUPPORT=y
142CONFIG_COMPAT=y 156CONFIG_COMPAT=y
143CONFIG_IA64_MCA_RECOVERY=y 157CONFIG_IA64_MCA_RECOVERY=y
144CONFIG_PERFMON=y 158CONFIG_PERFMON=y
145CONFIG_IA64_PALINFO=y 159CONFIG_IA64_PALINFO=y
146CONFIG_SGI_SN=y 160CONFIG_SGI_SN=y
161# CONFIG_IA64_ESI is not set
162
163#
164# SN Devices
165#
166CONFIG_SGI_IOC4=y
167CONFIG_SGI_IOC3=y
147 168
148# 169#
149# Firmware Drivers 170# Firmware Drivers
@@ -159,6 +180,7 @@ CONFIG_BINFMT_ELF=y
159CONFIG_PM=y 180CONFIG_PM=y
160# CONFIG_PM_LEGACY is not set 181# CONFIG_PM_LEGACY is not set
161# CONFIG_PM_DEBUG is not set 182# CONFIG_PM_DEBUG is not set
183# CONFIG_PM_SYSFS_DEPRECATED is not set
162 184
163# 185#
164# ACPI (Advanced Configuration and Power Interface) Support 186# ACPI (Advanced Configuration and Power Interface) Support
@@ -166,6 +188,7 @@ CONFIG_PM=y
166CONFIG_ACPI=y 188CONFIG_ACPI=y
167# CONFIG_ACPI_BUTTON is not set 189# CONFIG_ACPI_BUTTON is not set
168# CONFIG_ACPI_FAN is not set 190# CONFIG_ACPI_FAN is not set
191# CONFIG_ACPI_DOCK is not set
169# CONFIG_ACPI_PROCESSOR is not set 192# CONFIG_ACPI_PROCESSOR is not set
170CONFIG_ACPI_NUMA=y 193CONFIG_ACPI_NUMA=y
171CONFIG_ACPI_BLACKLIST_YEAR=0 194CONFIG_ACPI_BLACKLIST_YEAR=0
@@ -185,7 +208,12 @@ CONFIG_ACPI_SYSTEM=y
185# 208#
186CONFIG_PCI=y 209CONFIG_PCI=y
187CONFIG_PCI_DOMAINS=y 210CONFIG_PCI_DOMAINS=y
211CONFIG_PCIEPORTBUS=y
212CONFIG_HOTPLUG_PCI_PCIE=y
213# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
214CONFIG_PCIEAER=y
188# CONFIG_PCI_MSI is not set 215# CONFIG_PCI_MSI is not set
216# CONFIG_PCI_MULTITHREAD_PROBE is not set
189# CONFIG_PCI_DEBUG is not set 217# CONFIG_PCI_DEBUG is not set
190 218
191# 219#
@@ -215,6 +243,9 @@ CONFIG_NET=y
215CONFIG_PACKET=y 243CONFIG_PACKET=y
216CONFIG_PACKET_MMAP=y 244CONFIG_PACKET_MMAP=y
217CONFIG_UNIX=y 245CONFIG_UNIX=y
246CONFIG_XFRM=y
247# CONFIG_XFRM_USER is not set
248# CONFIG_XFRM_SUB_POLICY is not set
218# CONFIG_NET_KEY is not set 249# CONFIG_NET_KEY is not set
219CONFIG_INET=y 250CONFIG_INET=y
220CONFIG_IP_MULTICAST=y 251CONFIG_IP_MULTICAST=y
@@ -231,19 +262,31 @@ CONFIG_SYN_COOKIES=y
231# CONFIG_INET_IPCOMP is not set 262# CONFIG_INET_IPCOMP is not set
232# CONFIG_INET_XFRM_TUNNEL is not set 263# CONFIG_INET_XFRM_TUNNEL is not set
233# CONFIG_INET_TUNNEL is not set 264# CONFIG_INET_TUNNEL is not set
265CONFIG_INET_XFRM_MODE_TRANSPORT=y
266CONFIG_INET_XFRM_MODE_TUNNEL=y
267CONFIG_INET_XFRM_MODE_BEET=y
234CONFIG_INET_DIAG=m 268CONFIG_INET_DIAG=m
235CONFIG_INET_TCP_DIAG=m 269CONFIG_INET_TCP_DIAG=m
236# CONFIG_TCP_CONG_ADVANCED is not set 270# CONFIG_TCP_CONG_ADVANCED is not set
237CONFIG_TCP_CONG_BIC=y 271CONFIG_TCP_CONG_CUBIC=y
272CONFIG_DEFAULT_TCP_CONG="cubic"
238CONFIG_IPV6=m 273CONFIG_IPV6=m
239# CONFIG_IPV6_PRIVACY is not set 274# CONFIG_IPV6_PRIVACY is not set
240# CONFIG_IPV6_ROUTER_PREF is not set 275# CONFIG_IPV6_ROUTER_PREF is not set
241# CONFIG_INET6_AH is not set 276# CONFIG_INET6_AH is not set
242# CONFIG_INET6_ESP is not set 277# CONFIG_INET6_ESP is not set
243# CONFIG_INET6_IPCOMP is not set 278# CONFIG_INET6_IPCOMP is not set
279# CONFIG_IPV6_MIP6 is not set
244# CONFIG_INET6_XFRM_TUNNEL is not set 280# CONFIG_INET6_XFRM_TUNNEL is not set
245# CONFIG_INET6_TUNNEL is not set 281# CONFIG_INET6_TUNNEL is not set
282CONFIG_INET6_XFRM_MODE_TRANSPORT=m
283CONFIG_INET6_XFRM_MODE_TUNNEL=m
284CONFIG_INET6_XFRM_MODE_BEET=m
285# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
246# CONFIG_IPV6_TUNNEL is not set 286# CONFIG_IPV6_TUNNEL is not set
287# CONFIG_IPV6_SUBTREES is not set
288# CONFIG_IPV6_MULTIPLE_TABLES is not set
289# CONFIG_NETWORK_SECMARK is not set
247# CONFIG_NETFILTER is not set 290# CONFIG_NETFILTER is not set
248 291
249# 292#
@@ -269,7 +312,6 @@ CONFIG_IPV6=m
269# CONFIG_ATALK is not set 312# CONFIG_ATALK is not set
270# CONFIG_X25 is not set 313# CONFIG_X25 is not set
271# CONFIG_LAPB is not set 314# CONFIG_LAPB is not set
272# CONFIG_NET_DIVERT is not set
273# CONFIG_ECONET is not set 315# CONFIG_ECONET is not set
274# CONFIG_WAN_ROUTER is not set 316# CONFIG_WAN_ROUTER is not set
275 317
@@ -298,6 +340,7 @@ CONFIG_STANDALONE=y
298CONFIG_PREVENT_FIRMWARE_BUILD=y 340CONFIG_PREVENT_FIRMWARE_BUILD=y
299CONFIG_FW_LOADER=y 341CONFIG_FW_LOADER=y
300# CONFIG_DEBUG_DRIVER is not set 342# CONFIG_DEBUG_DRIVER is not set
343# CONFIG_SYS_HYPERVISOR is not set
301 344
302# 345#
303# Connector - unified userspace <-> kernelspace linker 346# Connector - unified userspace <-> kernelspace linker
@@ -335,6 +378,7 @@ CONFIG_BLK_DEV_NBD=m
335CONFIG_BLK_DEV_RAM=y 378CONFIG_BLK_DEV_RAM=y
336CONFIG_BLK_DEV_RAM_COUNT=16 379CONFIG_BLK_DEV_RAM_COUNT=16
337CONFIG_BLK_DEV_RAM_SIZE=4096 380CONFIG_BLK_DEV_RAM_SIZE=4096
381CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
338CONFIG_BLK_DEV_INITRD=y 382CONFIG_BLK_DEV_INITRD=y
339# CONFIG_CDROM_PKTCDVD is not set 383# CONFIG_CDROM_PKTCDVD is not set
340CONFIG_ATA_OVER_ETH=m 384CONFIG_ATA_OVER_ETH=m
@@ -381,6 +425,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
381# CONFIG_BLK_DEV_CS5530 is not set 425# CONFIG_BLK_DEV_CS5530 is not set
382# CONFIG_BLK_DEV_HPT34X is not set 426# CONFIG_BLK_DEV_HPT34X is not set
383# CONFIG_BLK_DEV_HPT366 is not set 427# CONFIG_BLK_DEV_HPT366 is not set
428# CONFIG_BLK_DEV_JMICRON is not set
384# CONFIG_BLK_DEV_SC1200 is not set 429# CONFIG_BLK_DEV_SC1200 is not set
385# CONFIG_BLK_DEV_PIIX is not set 430# CONFIG_BLK_DEV_PIIX is not set
386# CONFIG_BLK_DEV_IT821X is not set 431# CONFIG_BLK_DEV_IT821X is not set
@@ -404,6 +449,7 @@ CONFIG_IDEDMA_AUTO=y
404# 449#
405# CONFIG_RAID_ATTRS is not set 450# CONFIG_RAID_ATTRS is not set
406CONFIG_SCSI=y 451CONFIG_SCSI=y
452CONFIG_SCSI_NETLINK=y
407CONFIG_SCSI_PROC_FS=y 453CONFIG_SCSI_PROC_FS=y
408 454
409# 455#
@@ -425,12 +471,14 @@ CONFIG_SCSI_CONSTANTS=y
425# CONFIG_SCSI_LOGGING is not set 471# CONFIG_SCSI_LOGGING is not set
426 472
427# 473#
428# SCSI Transport Attributes 474# SCSI Transports
429# 475#
430CONFIG_SCSI_SPI_ATTRS=y 476CONFIG_SCSI_SPI_ATTRS=y
431CONFIG_SCSI_FC_ATTRS=y 477CONFIG_SCSI_FC_ATTRS=y
432CONFIG_SCSI_ISCSI_ATTRS=m 478CONFIG_SCSI_ISCSI_ATTRS=m
433CONFIG_SCSI_SAS_ATTRS=y 479CONFIG_SCSI_SAS_ATTRS=y
480CONFIG_SCSI_SAS_LIBSAS=y
481# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
434 482
435# 483#
436# SCSI low-level drivers 484# SCSI low-level drivers
@@ -443,46 +491,82 @@ CONFIG_ISCSI_TCP=m
443# CONFIG_SCSI_AIC7XXX is not set 491# CONFIG_SCSI_AIC7XXX is not set
444# CONFIG_SCSI_AIC7XXX_OLD is not set 492# CONFIG_SCSI_AIC7XXX_OLD is not set
445# CONFIG_SCSI_AIC79XX is not set 493# CONFIG_SCSI_AIC79XX is not set
494# CONFIG_SCSI_AIC94XX is not set
495# CONFIG_SCSI_ARCMSR is not set
446# CONFIG_MEGARAID_NEWGEN is not set 496# CONFIG_MEGARAID_NEWGEN is not set
447# CONFIG_MEGARAID_LEGACY is not set 497# CONFIG_MEGARAID_LEGACY is not set
448# CONFIG_MEGARAID_SAS is not set 498# CONFIG_MEGARAID_SAS is not set
449CONFIG_SCSI_SATA=y 499# CONFIG_SCSI_HPTIOP is not set
450# CONFIG_SCSI_SATA_AHCI is not set
451# CONFIG_SCSI_SATA_SVW is not set
452# CONFIG_SCSI_ATA_PIIX is not set
453# CONFIG_SCSI_SATA_MV is not set
454# CONFIG_SCSI_SATA_NV is not set
455# CONFIG_SCSI_PDC_ADMA is not set
456# CONFIG_SCSI_SATA_QSTOR is not set
457# CONFIG_SCSI_SATA_PROMISE is not set
458# CONFIG_SCSI_SATA_SX4 is not set
459# CONFIG_SCSI_SATA_SIL is not set
460# CONFIG_SCSI_SATA_SIL24 is not set
461# CONFIG_SCSI_SATA_SIS is not set
462# CONFIG_SCSI_SATA_ULI is not set
463# CONFIG_SCSI_SATA_VIA is not set
464CONFIG_SCSI_SATA_VITESSE=y
465# CONFIG_SCSI_DMX3191D is not set 500# CONFIG_SCSI_DMX3191D is not set
466# CONFIG_SCSI_FUTURE_DOMAIN is not set 501# CONFIG_SCSI_FUTURE_DOMAIN is not set
467# CONFIG_SCSI_IPS is not set 502# CONFIG_SCSI_IPS is not set
468# CONFIG_SCSI_INITIO is not set 503# CONFIG_SCSI_INITIO is not set
469# CONFIG_SCSI_INIA100 is not set 504# CONFIG_SCSI_INIA100 is not set
505# CONFIG_SCSI_STEX is not set
470# CONFIG_SCSI_SYM53C8XX_2 is not set 506# CONFIG_SCSI_SYM53C8XX_2 is not set
471# CONFIG_SCSI_IPR is not set 507# CONFIG_SCSI_IPR is not set
472CONFIG_SCSI_QLOGIC_1280=y 508CONFIG_SCSI_QLOGIC_1280=y
473CONFIG_SCSI_QLA_FC=y 509CONFIG_SCSI_QLA_FC=y
474CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE=y 510# CONFIG_SCSI_QLA_ISCSI is not set
475# CONFIG_SCSI_QLA21XX is not set
476CONFIG_SCSI_QLA22XX=y
477CONFIG_SCSI_QLA2300=y
478CONFIG_SCSI_QLA2322=y
479# CONFIG_SCSI_QLA24XX is not set
480# CONFIG_SCSI_LPFC is not set 511# CONFIG_SCSI_LPFC is not set
481# CONFIG_SCSI_DC395x is not set 512# CONFIG_SCSI_DC395x is not set
482# CONFIG_SCSI_DC390T is not set 513# CONFIG_SCSI_DC390T is not set
483# CONFIG_SCSI_DEBUG is not set 514# CONFIG_SCSI_DEBUG is not set
484 515
485# 516#
517# Serial ATA (prod) and Parallel ATA (experimental) drivers
518#
519CONFIG_ATA=y
520# CONFIG_SATA_AHCI is not set
521# CONFIG_SATA_SVW is not set
522# CONFIG_ATA_PIIX is not set
523# CONFIG_SATA_MV is not set
524# CONFIG_SATA_NV is not set
525# CONFIG_PDC_ADMA is not set
526# CONFIG_SATA_QSTOR is not set
527# CONFIG_SATA_PROMISE is not set
528# CONFIG_SATA_SX4 is not set
529# CONFIG_SATA_SIL is not set
530# CONFIG_SATA_SIL24 is not set
531# CONFIG_SATA_SIS is not set
532# CONFIG_SATA_ULI is not set
533# CONFIG_SATA_VIA is not set
534CONFIG_SATA_VITESSE=y
535# CONFIG_PATA_ALI is not set
536# CONFIG_PATA_AMD is not set
537# CONFIG_PATA_ARTOP is not set
538# CONFIG_PATA_ATIIXP is not set
539# CONFIG_PATA_CMD64X is not set
540# CONFIG_PATA_CS5520 is not set
541# CONFIG_PATA_CS5530 is not set
542# CONFIG_PATA_CYPRESS is not set
543# CONFIG_PATA_EFAR is not set
544# CONFIG_ATA_GENERIC is not set
545# CONFIG_PATA_HPT366 is not set
546# CONFIG_PATA_HPT37X is not set
547# CONFIG_PATA_HPT3X2N is not set
548# CONFIG_PATA_HPT3X3 is not set
549# CONFIG_PATA_IT821X is not set
550# CONFIG_PATA_JMICRON is not set
551# CONFIG_PATA_TRIFLEX is not set
552# CONFIG_PATA_MPIIX is not set
553# CONFIG_PATA_OLDPIIX is not set
554# CONFIG_PATA_NETCELL is not set
555# CONFIG_PATA_NS87410 is not set
556# CONFIG_PATA_OPTI is not set
557# CONFIG_PATA_OPTIDMA is not set
558# CONFIG_PATA_PDC_OLD is not set
559# CONFIG_PATA_RADISYS is not set
560# CONFIG_PATA_RZ1000 is not set
561# CONFIG_PATA_SC1200 is not set
562# CONFIG_PATA_SERVERWORKS is not set
563# CONFIG_PATA_PDC2027X is not set
564# CONFIG_PATA_SIL680 is not set
565# CONFIG_PATA_SIS is not set
566# CONFIG_PATA_VIA is not set
567# CONFIG_PATA_WINBOND is not set
568
569#
486# Multi-device support (RAID and LVM) 570# Multi-device support (RAID and LVM)
487# 571#
488CONFIG_MD=y 572CONFIG_MD=y
@@ -491,12 +575,12 @@ CONFIG_MD_LINEAR=y
491CONFIG_MD_RAID0=y 575CONFIG_MD_RAID0=y
492CONFIG_MD_RAID1=y 576CONFIG_MD_RAID1=y
493# CONFIG_MD_RAID10 is not set 577# CONFIG_MD_RAID10 is not set
494CONFIG_MD_RAID5=y 578CONFIG_MD_RAID456=y
495# CONFIG_MD_RAID5_RESHAPE is not set 579# CONFIG_MD_RAID5_RESHAPE is not set
496# CONFIG_MD_RAID6 is not set
497CONFIG_MD_MULTIPATH=y 580CONFIG_MD_MULTIPATH=y
498# CONFIG_MD_FAULTY is not set 581# CONFIG_MD_FAULTY is not set
499CONFIG_BLK_DEV_DM=y 582CONFIG_BLK_DEV_DM=y
583# CONFIG_DM_DEBUG is not set
500CONFIG_DM_CRYPT=m 584CONFIG_DM_CRYPT=m
501CONFIG_DM_SNAPSHOT=m 585CONFIG_DM_SNAPSHOT=m
502CONFIG_DM_MIRROR=m 586CONFIG_DM_MIRROR=m
@@ -563,6 +647,7 @@ CONFIG_NETDEVICES=y
563# CONFIG_SK98LIN is not set 647# CONFIG_SK98LIN is not set
564CONFIG_TIGON3=y 648CONFIG_TIGON3=y
565# CONFIG_BNX2 is not set 649# CONFIG_BNX2 is not set
650# CONFIG_QLA3XXX is not set
566 651
567# 652#
568# Ethernet (10000 Mbit) 653# Ethernet (10000 Mbit)
@@ -571,6 +656,7 @@ CONFIG_CHELSIO_T1=m
571# CONFIG_IXGB is not set 656# CONFIG_IXGB is not set
572CONFIG_S2IO=m 657CONFIG_S2IO=m
573# CONFIG_S2IO_NAPI is not set 658# CONFIG_S2IO_NAPI is not set
659# CONFIG_MYRI10GE is not set
574 660
575# 661#
576# Token Ring devices 662# Token Ring devices
@@ -612,6 +698,7 @@ CONFIG_NET_POLL_CONTROLLER=y
612# Input device support 698# Input device support
613# 699#
614CONFIG_INPUT=y 700CONFIG_INPUT=y
701# CONFIG_INPUT_FF_MEMLESS is not set
615 702
616# 703#
617# Userland interfaces 704# Userland interfaces
@@ -646,6 +733,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
646CONFIG_VT=y 733CONFIG_VT=y
647CONFIG_VT_CONSOLE=y 734CONFIG_VT_CONSOLE=y
648CONFIG_HW_CONSOLE=y 735CONFIG_HW_CONSOLE=y
736# CONFIG_VT_HW_CONSOLE_BINDING is not set
649CONFIG_SERIAL_NONSTANDARD=y 737CONFIG_SERIAL_NONSTANDARD=y
650# CONFIG_COMPUTONE is not set 738# CONFIG_COMPUTONE is not set
651# CONFIG_ROCKETPORT is not set 739# CONFIG_ROCKETPORT is not set
@@ -659,10 +747,12 @@ CONFIG_SERIAL_NONSTANDARD=y
659# CONFIG_N_HDLC is not set 747# CONFIG_N_HDLC is not set
660# CONFIG_SPECIALIX is not set 748# CONFIG_SPECIALIX is not set
661# CONFIG_SX is not set 749# CONFIG_SX is not set
750# CONFIG_RIO is not set
662# CONFIG_STALDRV is not set 751# CONFIG_STALDRV is not set
663CONFIG_SGI_SNSC=y 752CONFIG_SGI_SNSC=y
664CONFIG_SGI_TIOCX=y 753CONFIG_SGI_TIOCX=y
665CONFIG_SGI_MBCS=m 754CONFIG_SGI_MBCS=m
755CONFIG_MSPEC=y
666 756
667# 757#
668# Serial drivers 758# Serial drivers
@@ -701,6 +791,7 @@ CONFIG_EFI_RTC=y
701# Ftape, the floppy tape device driver 791# Ftape, the floppy tape device driver
702# 792#
703CONFIG_AGP=y 793CONFIG_AGP=y
794# CONFIG_AGP_SIS is not set
704# CONFIG_AGP_VIA is not set 795# CONFIG_AGP_VIA is not set
705CONFIG_AGP_SGI_TIOCA=y 796CONFIG_AGP_SGI_TIOCA=y
706# CONFIG_DRM is not set 797# CONFIG_DRM is not set
@@ -730,7 +821,6 @@ CONFIG_MMTIMER=y
730# 821#
731# Dallas's 1-wire bus 822# Dallas's 1-wire bus
732# 823#
733# CONFIG_W1 is not set
734 824
735# 825#
736# Hardware Monitoring support 826# Hardware Monitoring support
@@ -741,6 +831,7 @@ CONFIG_MMTIMER=y
741# 831#
742# Misc devices 832# Misc devices
743# 833#
834# CONFIG_TIFM_CORE is not set
744 835
745# 836#
746# Multimedia devices 837# Multimedia devices
@@ -756,6 +847,7 @@ CONFIG_MMTIMER=y
756# 847#
757# Graphics support 848# Graphics support
758# 849#
850CONFIG_FIRMWARE_EDID=y
759# CONFIG_FB is not set 851# CONFIG_FB is not set
760 852
761# 853#
@@ -764,6 +856,7 @@ CONFIG_MMTIMER=y
764CONFIG_VGA_CONSOLE=y 856CONFIG_VGA_CONSOLE=y
765# CONFIG_VGACON_SOFT_SCROLLBACK is not set 857# CONFIG_VGACON_SOFT_SCROLLBACK is not set
766CONFIG_DUMMY_CONSOLE=y 858CONFIG_DUMMY_CONSOLE=y
859# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
767 860
768# 861#
769# Sound 862# Sound
@@ -794,6 +887,7 @@ CONFIG_USB=m
794CONFIG_USB_EHCI_HCD=m 887CONFIG_USB_EHCI_HCD=m
795# CONFIG_USB_EHCI_SPLIT_ISO is not set 888# CONFIG_USB_EHCI_SPLIT_ISO is not set
796# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 889# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
890# CONFIG_USB_EHCI_TT_NEWSCHED is not set
797# CONFIG_USB_ISP116X_HCD is not set 891# CONFIG_USB_ISP116X_HCD is not set
798CONFIG_USB_OHCI_HCD=m 892CONFIG_USB_OHCI_HCD=m
799# CONFIG_USB_OHCI_BIG_ENDIAN is not set 893# CONFIG_USB_OHCI_BIG_ENDIAN is not set
@@ -843,6 +937,7 @@ CONFIG_USB_HIDINPUT=y
843# CONFIG_USB_ATI_REMOTE2 is not set 937# CONFIG_USB_ATI_REMOTE2 is not set
844# CONFIG_USB_KEYSPAN_REMOTE is not set 938# CONFIG_USB_KEYSPAN_REMOTE is not set
845# CONFIG_USB_APPLETOUCH is not set 939# CONFIG_USB_APPLETOUCH is not set
940# CONFIG_USB_TRANCEVIBRATOR is not set
846 941
847# 942#
848# USB Imaging devices 943# USB Imaging devices
@@ -874,15 +969,18 @@ CONFIG_USB_MON=y
874# 969#
875# CONFIG_USB_EMI62 is not set 970# CONFIG_USB_EMI62 is not set
876# CONFIG_USB_EMI26 is not set 971# CONFIG_USB_EMI26 is not set
972# CONFIG_USB_ADUTUX is not set
877# CONFIG_USB_AUERSWALD is not set 973# CONFIG_USB_AUERSWALD is not set
878# CONFIG_USB_RIO500 is not set 974# CONFIG_USB_RIO500 is not set
879# CONFIG_USB_LEGOTOWER is not set 975# CONFIG_USB_LEGOTOWER is not set
880# CONFIG_USB_LCD is not set 976# CONFIG_USB_LCD is not set
881# CONFIG_USB_LED is not set 977# CONFIG_USB_LED is not set
978# CONFIG_USB_CYPRESS_CY7C63 is not set
882# CONFIG_USB_CYTHERM is not set 979# CONFIG_USB_CYTHERM is not set
883# CONFIG_USB_PHIDGETKIT is not set 980# CONFIG_USB_PHIDGET is not set
884# CONFIG_USB_PHIDGETSERVO is not set
885# CONFIG_USB_IDMOUSE is not set 981# CONFIG_USB_IDMOUSE is not set
982# CONFIG_USB_FTDI_ELAN is not set
983# CONFIG_USB_APPLEDISPLAY is not set
886# CONFIG_USB_SISUSBVGA is not set 984# CONFIG_USB_SISUSBVGA is not set
887# CONFIG_USB_LD is not set 985# CONFIG_USB_LD is not set
888 986
@@ -919,18 +1017,15 @@ CONFIG_USB_MON=y
919CONFIG_INFINIBAND=m 1017CONFIG_INFINIBAND=m
920# CONFIG_INFINIBAND_USER_MAD is not set 1018# CONFIG_INFINIBAND_USER_MAD is not set
921CONFIG_INFINIBAND_USER_ACCESS=m 1019CONFIG_INFINIBAND_USER_ACCESS=m
1020CONFIG_INFINIBAND_ADDR_TRANS=y
922CONFIG_INFINIBAND_MTHCA=m 1021CONFIG_INFINIBAND_MTHCA=m
923CONFIG_INFINIBAND_MTHCA_DEBUG=y 1022CONFIG_INFINIBAND_MTHCA_DEBUG=y
1023# CONFIG_INFINIBAND_AMSO1100 is not set
924CONFIG_INFINIBAND_IPOIB=m 1024CONFIG_INFINIBAND_IPOIB=m
925CONFIG_INFINIBAND_IPOIB_DEBUG=y 1025CONFIG_INFINIBAND_IPOIB_DEBUG=y
926# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set 1026# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
927CONFIG_INFINIBAND_SRP=m 1027CONFIG_INFINIBAND_SRP=m
928 1028# CONFIG_INFINIBAND_ISER is not set
929#
930# SN Devices
931#
932CONFIG_SGI_IOC4=y
933CONFIG_SGI_IOC3=y
934 1029
935# 1030#
936# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1031# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -942,6 +1037,19 @@ CONFIG_SGI_IOC3=y
942# CONFIG_RTC_CLASS is not set 1037# CONFIG_RTC_CLASS is not set
943 1038
944# 1039#
1040# DMA Engine support
1041#
1042# CONFIG_DMA_ENGINE is not set
1043
1044#
1045# DMA Clients
1046#
1047
1048#
1049# DMA Devices
1050#
1051
1052#
945# File systems 1053# File systems
946# 1054#
947CONFIG_EXT2_FS=y 1055CONFIG_EXT2_FS=y
@@ -965,15 +1073,16 @@ CONFIG_REISERFS_FS_SECURITY=y
965# CONFIG_JFS_FS is not set 1073# CONFIG_JFS_FS is not set
966CONFIG_FS_POSIX_ACL=y 1074CONFIG_FS_POSIX_ACL=y
967CONFIG_XFS_FS=y 1075CONFIG_XFS_FS=y
968CONFIG_XFS_EXPORT=y
969CONFIG_XFS_QUOTA=y 1076CONFIG_XFS_QUOTA=y
970# CONFIG_XFS_SECURITY is not set 1077# CONFIG_XFS_SECURITY is not set
971CONFIG_XFS_POSIX_ACL=y 1078CONFIG_XFS_POSIX_ACL=y
972CONFIG_XFS_RT=y 1079CONFIG_XFS_RT=y
1080# CONFIG_GFS2_FS is not set
973# CONFIG_OCFS2_FS is not set 1081# CONFIG_OCFS2_FS is not set
974# CONFIG_MINIX_FS is not set 1082# CONFIG_MINIX_FS is not set
975# CONFIG_ROMFS_FS is not set 1083# CONFIG_ROMFS_FS is not set
976CONFIG_INOTIFY=y 1084CONFIG_INOTIFY=y
1085CONFIG_INOTIFY_USER=y
977CONFIG_QUOTA=y 1086CONFIG_QUOTA=y
978# CONFIG_QFMT_V1 is not set 1087# CONFIG_QFMT_V1 is not set
979# CONFIG_QFMT_V2 is not set 1088# CONFIG_QFMT_V2 is not set
@@ -1007,8 +1116,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1007# 1116#
1008CONFIG_PROC_FS=y 1117CONFIG_PROC_FS=y
1009CONFIG_PROC_KCORE=y 1118CONFIG_PROC_KCORE=y
1119CONFIG_PROC_SYSCTL=y
1010CONFIG_SYSFS=y 1120CONFIG_SYSFS=y
1011CONFIG_TMPFS=y 1121CONFIG_TMPFS=y
1122# CONFIG_TMPFS_POSIX_ACL is not set
1012CONFIG_HUGETLBFS=y 1123CONFIG_HUGETLBFS=y
1013CONFIG_HUGETLB_PAGE=y 1124CONFIG_HUGETLB_PAGE=y
1014CONFIG_RAMFS=y 1125CONFIG_RAMFS=y
@@ -1046,7 +1157,7 @@ CONFIG_NFSD_V4=y
1046CONFIG_NFSD_TCP=y 1157CONFIG_NFSD_TCP=y
1047CONFIG_LOCKD=m 1158CONFIG_LOCKD=m
1048CONFIG_LOCKD_V4=y 1159CONFIG_LOCKD_V4=y
1049CONFIG_EXPORTFS=y 1160CONFIG_EXPORTFS=m
1050CONFIG_NFS_COMMON=y 1161CONFIG_NFS_COMMON=y
1051CONFIG_SUNRPC=m 1162CONFIG_SUNRPC=m
1052CONFIG_SUNRPC_GSS=m 1163CONFIG_SUNRPC_GSS=m
@@ -1056,7 +1167,9 @@ CONFIG_SMB_FS=m
1056# CONFIG_SMB_NLS_DEFAULT is not set 1167# CONFIG_SMB_NLS_DEFAULT is not set
1057CONFIG_CIFS=m 1168CONFIG_CIFS=m
1058# CONFIG_CIFS_STATS is not set 1169# CONFIG_CIFS_STATS is not set
1170# CONFIG_CIFS_WEAK_PW_HASH is not set
1059# CONFIG_CIFS_XATTR is not set 1171# CONFIG_CIFS_XATTR is not set
1172# CONFIG_CIFS_DEBUG2 is not set
1060# CONFIG_CIFS_EXPERIMENTAL is not set 1173# CONFIG_CIFS_EXPERIMENTAL is not set
1061# CONFIG_NCP_FS is not set 1174# CONFIG_NCP_FS is not set
1062# CONFIG_CODA_FS is not set 1175# CONFIG_CODA_FS is not set
@@ -1129,6 +1242,10 @@ CONFIG_NLS_ISO8859_1=y
1129CONFIG_NLS_UTF8=y 1242CONFIG_NLS_UTF8=y
1130 1243
1131# 1244#
1245# Distributed Lock Manager
1246#
1247
1248#
1132# Library routines 1249# Library routines
1133# 1250#
1134# CONFIG_CRC_CCITT is not set 1251# CONFIG_CRC_CCITT is not set
@@ -1138,9 +1255,11 @@ CONFIG_LIBCRC32C=m
1138CONFIG_ZLIB_INFLATE=m 1255CONFIG_ZLIB_INFLATE=m
1139CONFIG_ZLIB_DEFLATE=m 1256CONFIG_ZLIB_DEFLATE=m
1140CONFIG_GENERIC_ALLOCATOR=y 1257CONFIG_GENERIC_ALLOCATOR=y
1258CONFIG_PLIST=y
1141CONFIG_GENERIC_HARDIRQS=y 1259CONFIG_GENERIC_HARDIRQS=y
1142CONFIG_GENERIC_IRQ_PROBE=y 1260CONFIG_GENERIC_IRQ_PROBE=y
1143CONFIG_GENERIC_PENDING_IRQ=y 1261CONFIG_GENERIC_PENDING_IRQ=y
1262CONFIG_IRQ_PER_CPU=y
1144 1263
1145# 1264#
1146# Instrumentation Support 1265# Instrumentation Support
@@ -1152,20 +1271,26 @@ CONFIG_GENERIC_PENDING_IRQ=y
1152# Kernel hacking 1271# Kernel hacking
1153# 1272#
1154# CONFIG_PRINTK_TIME is not set 1273# CONFIG_PRINTK_TIME is not set
1274CONFIG_ENABLE_MUST_CHECK=y
1155CONFIG_MAGIC_SYSRQ=y 1275CONFIG_MAGIC_SYSRQ=y
1276# CONFIG_UNUSED_SYMBOLS is not set
1156CONFIG_DEBUG_KERNEL=y 1277CONFIG_DEBUG_KERNEL=y
1157CONFIG_LOG_BUF_SHIFT=20 1278CONFIG_LOG_BUF_SHIFT=20
1158CONFIG_DETECT_SOFTLOCKUP=y 1279CONFIG_DETECT_SOFTLOCKUP=y
1159# CONFIG_SCHEDSTATS is not set 1280# CONFIG_SCHEDSTATS is not set
1160# CONFIG_DEBUG_SLAB is not set 1281# CONFIG_DEBUG_SLAB is not set
1161CONFIG_DEBUG_PREEMPT=y 1282# CONFIG_DEBUG_RT_MUTEXES is not set
1162# CONFIG_DEBUG_MUTEXES is not set 1283# CONFIG_RT_MUTEX_TESTER is not set
1163# CONFIG_DEBUG_SPINLOCK is not set 1284# CONFIG_DEBUG_SPINLOCK is not set
1285# CONFIG_DEBUG_MUTEXES is not set
1286# CONFIG_DEBUG_RWSEMS is not set
1164# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1287# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1288# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1165# CONFIG_DEBUG_KOBJECT is not set 1289# CONFIG_DEBUG_KOBJECT is not set
1166CONFIG_DEBUG_INFO=y 1290CONFIG_DEBUG_INFO=y
1167# CONFIG_DEBUG_FS is not set 1291# CONFIG_DEBUG_FS is not set
1168# CONFIG_DEBUG_VM is not set 1292# CONFIG_DEBUG_VM is not set
1293# CONFIG_DEBUG_LIST is not set
1169CONFIG_FORCED_INLINING=y 1294CONFIG_FORCED_INLINING=y
1170# CONFIG_RCU_TORTURE_TEST is not set 1295# CONFIG_RCU_TORTURE_TEST is not set
1171CONFIG_IA64_GRANULE_16MB=y 1296CONFIG_IA64_GRANULE_16MB=y
@@ -1186,6 +1311,10 @@ CONFIG_SYSVIPC_COMPAT=y
1186# Cryptographic options 1311# Cryptographic options
1187# 1312#
1188CONFIG_CRYPTO=y 1313CONFIG_CRYPTO=y
1314CONFIG_CRYPTO_ALGAPI=y
1315CONFIG_CRYPTO_BLKCIPHER=m
1316CONFIG_CRYPTO_HASH=y
1317CONFIG_CRYPTO_MANAGER=m
1189CONFIG_CRYPTO_HMAC=y 1318CONFIG_CRYPTO_HMAC=y
1190# CONFIG_CRYPTO_NULL is not set 1319# CONFIG_CRYPTO_NULL is not set
1191# CONFIG_CRYPTO_MD4 is not set 1320# CONFIG_CRYPTO_MD4 is not set
@@ -1195,6 +1324,8 @@ CONFIG_CRYPTO_SHA1=m
1195# CONFIG_CRYPTO_SHA512 is not set 1324# CONFIG_CRYPTO_SHA512 is not set
1196# CONFIG_CRYPTO_WP512 is not set 1325# CONFIG_CRYPTO_WP512 is not set
1197# CONFIG_CRYPTO_TGR192 is not set 1326# CONFIG_CRYPTO_TGR192 is not set
1327CONFIG_CRYPTO_ECB=m
1328CONFIG_CRYPTO_CBC=m
1198CONFIG_CRYPTO_DES=m 1329CONFIG_CRYPTO_DES=m
1199# CONFIG_CRYPTO_BLOWFISH is not set 1330# CONFIG_CRYPTO_BLOWFISH is not set
1200# CONFIG_CRYPTO_TWOFISH is not set 1331# CONFIG_CRYPTO_TWOFISH is not set
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 32c3abededc6..73ef4a85b861 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -64,9 +64,6 @@ EXPORT_SYMBOL(pm_idle);
64void (*pm_power_off) (void); 64void (*pm_power_off) (void);
65EXPORT_SYMBOL(pm_power_off); 65EXPORT_SYMBOL(pm_power_off);
66 66
67unsigned char acpi_kbd_controller_present = 1;
68unsigned char acpi_legacy_devices;
69
70unsigned int acpi_cpei_override; 67unsigned int acpi_cpei_override;
71unsigned int acpi_cpei_phys_cpuid; 68unsigned int acpi_cpei_phys_cpuid;
72 69
@@ -628,12 +625,6 @@ static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
628 625
629 fadt = (struct fadt_descriptor *)fadt_header; 626 fadt = (struct fadt_descriptor *)fadt_header;
630 627
631 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
632 acpi_kbd_controller_present = 0;
633
634 if (fadt->iapc_boot_arch & BAF_LEGACY_DEVICES)
635 acpi_legacy_devices = 1;
636
637 acpi_register_gsi(fadt->sci_int, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); 628 acpi_register_gsi(fadt->sci_int, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
638 return 0; 629 return 0;
639} 630}
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 68339dd0c9e2..9c6dafa2d0df 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -180,7 +180,9 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
180 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR); 180 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
181 ia64_srlz_d(); 181 ia64_srlz_d();
182 while (vector != IA64_SPURIOUS_INT_VECTOR) { 182 while (vector != IA64_SPURIOUS_INT_VECTOR) {
183 if (!IS_RESCHEDULE(vector)) { 183 if (unlikely(IS_RESCHEDULE(vector)))
184 kstat_this_cpu.irqs[vector]++;
185 else {
184 ia64_setreg(_IA64_REG_CR_TPR, vector); 186 ia64_setreg(_IA64_REG_CR_TPR, vector);
185 ia64_srlz_d(); 187 ia64_srlz_d();
186 188
@@ -225,7 +227,9 @@ void ia64_process_pending_intr(void)
225 * Perform normal interrupt style processing 227 * Perform normal interrupt style processing
226 */ 228 */
227 while (vector != IA64_SPURIOUS_INT_VECTOR) { 229 while (vector != IA64_SPURIOUS_INT_VECTOR) {
228 if (!IS_RESCHEDULE(vector)) { 230 if (unlikely(IS_RESCHEDULE(vector)))
231 kstat_this_cpu.irqs[vector]++;
232 else {
229 struct pt_regs *old_regs = set_irq_regs(NULL); 233 struct pt_regs *old_regs = set_irq_regs(NULL);
230 234
231 ia64_setreg(_IA64_REG_CR_TPR, vector); 235 ia64_setreg(_IA64_REG_CR_TPR, vector);
@@ -258,11 +262,22 @@ void ia64_process_pending_intr(void)
258#ifdef CONFIG_SMP 262#ifdef CONFIG_SMP
259extern irqreturn_t handle_IPI (int irq, void *dev_id); 263extern irqreturn_t handle_IPI (int irq, void *dev_id);
260 264
265static irqreturn_t dummy_handler (int irq, void *dev_id)
266{
267 BUG();
268}
269
261static struct irqaction ipi_irqaction = { 270static struct irqaction ipi_irqaction = {
262 .handler = handle_IPI, 271 .handler = handle_IPI,
263 .flags = IRQF_DISABLED, 272 .flags = IRQF_DISABLED,
264 .name = "IPI" 273 .name = "IPI"
265}; 274};
275
276static struct irqaction resched_irqaction = {
277 .handler = dummy_handler,
278 .flags = SA_INTERRUPT,
279 .name = "resched"
280};
266#endif 281#endif
267 282
268void 283void
@@ -287,6 +302,7 @@ init_IRQ (void)
287 register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL); 302 register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
288#ifdef CONFIG_SMP 303#ifdef CONFIG_SMP
289 register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction); 304 register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
305 register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
290#endif 306#endif
291#ifdef CONFIG_PERFMON 307#ifdef CONFIG_PERFMON
292 pfm_init_percpu(); 308 pfm_init_percpu();
diff --git a/arch/ia64/kernel/pal.S b/arch/ia64/kernel/pal.S
index ebaf1e685f5e..0b533441c3c9 100644
--- a/arch/ia64/kernel/pal.S
+++ b/arch/ia64/kernel/pal.S
@@ -21,11 +21,12 @@ pal_entry_point:
21 .text 21 .text
22 22
23/* 23/*
24 * Set the PAL entry point address. This could be written in C code, but we do it here 24 * Set the PAL entry point address. This could be written in C code, but we
25 * to keep it all in one module (besides, it's so trivial that it's 25 * do it here to keep it all in one module (besides, it's so trivial that it's
26 * not a big deal). 26 * not a big deal).
27 * 27 *
28 * in0 Address of the PAL entry point (text address, NOT a function descriptor). 28 * in0 Address of the PAL entry point (text address, NOT a function
29 * descriptor).
29 */ 30 */
30GLOBAL_ENTRY(ia64_pal_handler_init) 31GLOBAL_ENTRY(ia64_pal_handler_init)
31 alloc r3=ar.pfs,1,0,0,0 32 alloc r3=ar.pfs,1,0,0,0
@@ -36,9 +37,9 @@ GLOBAL_ENTRY(ia64_pal_handler_init)
36END(ia64_pal_handler_init) 37END(ia64_pal_handler_init)
37 38
38/* 39/*
39 * Default PAL call handler. This needs to be coded in assembly because it uses 40 * Default PAL call handler. This needs to be coded in assembly because it
40 * the static calling convention, i.e., the RSE may not be used and calls are 41 * uses the static calling convention, i.e., the RSE may not be used and
41 * done via "br.cond" (not "br.call"). 42 * calls are done via "br.cond" (not "br.call").
42 */ 43 */
43GLOBAL_ENTRY(ia64_pal_default_handler) 44GLOBAL_ENTRY(ia64_pal_default_handler)
44 mov r8=-1 45 mov r8=-1
@@ -50,12 +51,10 @@ END(ia64_pal_default_handler)
50 * 51 *
51 * in0 Index of PAL service 52 * in0 Index of PAL service
52 * in1 - in3 Remaining PAL arguments 53 * in1 - in3 Remaining PAL arguments
53 * in4 1 ==> clear psr.ic, 0 ==> don't clear psr.ic
54 *
55 */ 54 */
56GLOBAL_ENTRY(ia64_pal_call_static) 55GLOBAL_ENTRY(ia64_pal_call_static)
57 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5) 56 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
58 alloc loc1 = ar.pfs,5,5,0,0 57 alloc loc1 = ar.pfs,4,5,0,0
59 movl loc2 = pal_entry_point 58 movl loc2 = pal_entry_point
601: { 591: {
61 mov r28 = in0 60 mov r28 = in0
@@ -64,7 +63,6 @@ GLOBAL_ENTRY(ia64_pal_call_static)
64 } 63 }
65 ;; 64 ;;
66 ld8 loc2 = [loc2] // loc2 <- entry point 65 ld8 loc2 = [loc2] // loc2 <- entry point
67 tbit.nz p6,p7 = in4, 0
68 adds r8 = 1f-1b,r8 66 adds r8 = 1f-1b,r8
69 mov loc4=ar.rsc // save RSE configuration 67 mov loc4=ar.rsc // save RSE configuration
70 ;; 68 ;;
@@ -74,13 +72,11 @@ GLOBAL_ENTRY(ia64_pal_call_static)
74 .body 72 .body
75 mov r30 = in2 73 mov r30 = in2
76 74
77(p6) rsm psr.i | psr.ic
78 mov r31 = in3 75 mov r31 = in3
79 mov b7 = loc2 76 mov b7 = loc2
80 77
81(p7) rsm psr.i 78 rsm psr.i
82 ;; 79 ;;
83(p6) srlz.i
84 mov rp = r8 80 mov rp = r8
85 br.cond.sptk.many b7 81 br.cond.sptk.many b7
861: mov psr.l = loc3 821: mov psr.l = loc3
@@ -96,8 +92,8 @@ END(ia64_pal_call_static)
96 * Make a PAL call using the stacked registers calling convention. 92 * Make a PAL call using the stacked registers calling convention.
97 * 93 *
98 * Inputs: 94 * Inputs:
99 * in0 Index of PAL service 95 * in0 Index of PAL service
100 * in2 - in3 Remaning PAL arguments 96 * in2 - in3 Remaining PAL arguments
101 */ 97 */
102GLOBAL_ENTRY(ia64_pal_call_stacked) 98GLOBAL_ENTRY(ia64_pal_call_stacked)
103 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4) 99 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
@@ -131,18 +127,18 @@ END(ia64_pal_call_stacked)
131 * Make a physical mode PAL call using the static registers calling convention. 127 * Make a physical mode PAL call using the static registers calling convention.
132 * 128 *
133 * Inputs: 129 * Inputs:
134 * in0 Index of PAL service 130 * in0 Index of PAL service
135 * in2 - in3 Remaning PAL arguments 131 * in2 - in3 Remaining PAL arguments
136 * 132 *
137 * PSR_LP, PSR_TB, PSR_ID, PSR_DA are never set by the kernel. 133 * PSR_LP, PSR_TB, PSR_ID, PSR_DA are never set by the kernel.
138 * So we don't need to clear them. 134 * So we don't need to clear them.
139 */ 135 */
140#define PAL_PSR_BITS_TO_CLEAR \ 136#define PAL_PSR_BITS_TO_CLEAR \
141 (IA64_PSR_I | IA64_PSR_IT | IA64_PSR_DT | IA64_PSR_DB | IA64_PSR_RT | \ 137 (IA64_PSR_I | IA64_PSR_IT | IA64_PSR_DT | IA64_PSR_DB | IA64_PSR_RT |\
142 IA64_PSR_DD | IA64_PSR_SS | IA64_PSR_RI | IA64_PSR_ED | \ 138 IA64_PSR_DD | IA64_PSR_SS | IA64_PSR_RI | IA64_PSR_ED | \
143 IA64_PSR_DFL | IA64_PSR_DFH) 139 IA64_PSR_DFL | IA64_PSR_DFH)
144 140
145#define PAL_PSR_BITS_TO_SET \ 141#define PAL_PSR_BITS_TO_SET \
146 (IA64_PSR_BN) 142 (IA64_PSR_BN)
147 143
148 144
@@ -178,7 +174,7 @@ GLOBAL_ENTRY(ia64_pal_call_phys_static)
178 ;; 174 ;;
179 andcm r16=loc3,r16 // removes bits to clear from psr 175 andcm r16=loc3,r16 // removes bits to clear from psr
180 br.call.sptk.many rp=ia64_switch_mode_phys 176 br.call.sptk.many rp=ia64_switch_mode_phys
181.ret1: mov rp = r8 // install return address (physical) 177 mov rp = r8 // install return address (physical)
182 mov loc5 = r19 178 mov loc5 = r19
183 mov loc6 = r20 179 mov loc6 = r20
184 br.cond.sptk.many b7 180 br.cond.sptk.many b7
@@ -188,7 +184,6 @@ GLOBAL_ENTRY(ia64_pal_call_phys_static)
188 mov r19=loc5 184 mov r19=loc5
189 mov r20=loc6 185 mov r20=loc6
190 br.call.sptk.many rp=ia64_switch_mode_virt // return to virtual mode 186 br.call.sptk.many rp=ia64_switch_mode_virt // return to virtual mode
191.ret2:
192 mov psr.l = loc3 // restore init PSR 187 mov psr.l = loc3 // restore init PSR
193 188
194 mov ar.pfs = loc1 189 mov ar.pfs = loc1
@@ -203,8 +198,8 @@ END(ia64_pal_call_phys_static)
203 * Make a PAL call using the stacked registers in physical mode. 198 * Make a PAL call using the stacked registers in physical mode.
204 * 199 *
205 * Inputs: 200 * Inputs:
206 * in0 Index of PAL service 201 * in0 Index of PAL service
207 * in2 - in3 Remaning PAL arguments 202 * in2 - in3 Remaining PAL arguments
208 */ 203 */
209GLOBAL_ENTRY(ia64_pal_call_phys_stacked) 204GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
210 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5) 205 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
@@ -212,7 +207,7 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
212 movl loc2 = pal_entry_point 207 movl loc2 = pal_entry_point
2131: { 2081: {
214 mov r28 = in0 // copy procedure index 209 mov r28 = in0 // copy procedure index
215 mov loc0 = rp // save rp 210 mov loc0 = rp // save rp
216 } 211 }
217 .body 212 .body
218 ;; 213 ;;
@@ -245,7 +240,7 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
245 mov r16=loc3 // r16= original psr 240 mov r16=loc3 // r16= original psr
246 mov r19=loc5 241 mov r19=loc5
247 mov r20=loc6 242 mov r20=loc6
248 br.call.sptk.many rp=ia64_switch_mode_virt // return to virtual mode 243 br.call.sptk.many rp=ia64_switch_mode_virt // return to virtual mode
249 244
250 mov psr.l = loc3 // restore init PSR 245 mov psr.l = loc3 // restore init PSR
251 mov ar.pfs = loc1 246 mov ar.pfs = loc1
@@ -257,10 +252,11 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
257END(ia64_pal_call_phys_stacked) 252END(ia64_pal_call_phys_stacked)
258 253
259/* 254/*
260 * Save scratch fp scratch regs which aren't saved in pt_regs already (fp10-fp15). 255 * Save scratch fp scratch regs which aren't saved in pt_regs already
256 * (fp10-fp15).
261 * 257 *
262 * NOTE: We need to do this since firmware (SAL and PAL) may use any of the scratch 258 * NOTE: We need to do this since firmware (SAL and PAL) may use any of the
263 * regs fp-low partition. 259 * scratch regs fp-low partition.
264 * 260 *
265 * Inputs: 261 * Inputs:
266 * in0 Address of stack storage for fp regs 262 * in0 Address of stack storage for fp regs
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 281004ff7b00..3aaede0d6981 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5558,12 +5558,13 @@ report_spurious2:
5558} 5558}
5559 5559
5560static irqreturn_t 5560static irqreturn_t
5561pfm_interrupt_handler(int irq, void *arg, struct pt_regs *regs) 5561pfm_interrupt_handler(int irq, void *arg)
5562{ 5562{
5563 unsigned long start_cycles, total_cycles; 5563 unsigned long start_cycles, total_cycles;
5564 unsigned long min, max; 5564 unsigned long min, max;
5565 int this_cpu; 5565 int this_cpu;
5566 int ret; 5566 int ret;
5567 struct pt_regs *regs = get_irq_regs();
5567 5568
5568 this_cpu = get_cpu(); 5569 this_cpu = get_cpu();
5569 if (likely(!pfm_alt_intr_handler)) { 5570 if (likely(!pfm_alt_intr_handler)) {
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 41169a9bc301..39e0cd3a0884 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -84,6 +84,12 @@ timer_interrupt (int irq, void *dev_id)
84 84
85 if (time_after(new_itm, ia64_get_itc())) 85 if (time_after(new_itm, ia64_get_itc()))
86 break; 86 break;
87
88 /*
89 * Allow IPIs to interrupt the timer loop.
90 */
91 local_irq_enable();
92 local_irq_disable();
87 } 93 }
88 94
89 do { 95 do {
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 5f2dcba7fa8d..7a2d824c5ce3 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -65,7 +65,6 @@ extern void sn_timer_init(void);
65extern unsigned long last_time_offset; 65extern unsigned long last_time_offset;
66extern void (*ia64_mark_idle) (int); 66extern void (*ia64_mark_idle) (int);
67extern void snidle(int); 67extern void snidle(int);
68extern unsigned char acpi_kbd_controller_present;
69extern unsigned long long (*ia64_printk_clock)(void); 68extern unsigned long long (*ia64_printk_clock)(void);
70 69
71unsigned long sn_rtc_cycles_per_second; 70unsigned long sn_rtc_cycles_per_second;
@@ -452,17 +451,6 @@ void __init sn_setup(char **cmdline_p)
452 451
453 ia64_printk_clock = ia64_sn2_printk_clock; 452 ia64_printk_clock = ia64_sn2_printk_clock;
454 453
455 /*
456 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
457 * support here so we don't have to listen to failed keyboard probe
458 * messages.
459 */
460 if (is_shub1() && version <= 0x0209 && acpi_kbd_controller_present) {
461 printk(KERN_INFO "Disabling legacy keyboard support as prom "
462 "is too old and doesn't provide FADT\n");
463 acpi_kbd_controller_present = 0;
464 }
465
466 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 454 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
467 455
468 /* 456 /*
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index c4fae8ff4671..626de44bd888 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -849,7 +849,7 @@ au1xxx_dbdma_chan_free(u32 chanid)
849EXPORT_SYMBOL(au1xxx_dbdma_chan_free); 849EXPORT_SYMBOL(au1xxx_dbdma_chan_free);
850 850
851static irqreturn_t 851static irqreturn_t
852dbdma_interrupt(int irq, void *dev_id, struct pt_regs *regs) 852dbdma_interrupt(int irq, void *dev_id)
853{ 853{
854 u32 intstat; 854 u32 intstat;
855 u32 chan_index; 855 u32 chan_index;
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 26b0b9883496..280a8001eacf 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.19-rc2
4# Thu Jul 6 10:04:18 2006 4# Sat Oct 14 23:01:16 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -25,8 +25,6 @@ CONFIG_MIPS=y
25# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
26# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
27# CONFIG_MIPS_EV64120 is not set 27# CONFIG_MIPS_EV64120 is not set
28# CONFIG_MIPS_IVR is not set
29# CONFIG_MIPS_ITE8172 is not set
30# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set 29# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set 30# CONFIG_MIPS_ATLAS is not set
@@ -41,13 +39,13 @@ CONFIG_MIPS=y
41# CONFIG_MOMENCO_OCELOT_G is not set 39# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set 40# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set 41# CONFIG_PNX8550_V2PCI is not set
44# CONFIG_PNX8550_JBS is not set 42CONFIG_PNX8550_JBS=y
45# CONFIG_DDB5477 is not set 43# CONFIG_DDB5477 is not set
46# CONFIG_MACH_VR41XX is not set 44# CONFIG_MACH_VR41XX is not set
47# CONFIG_PMC_YOSEMITE is not set 45# CONFIG_PMC_YOSEMITE is not set
48# CONFIG_QEMU is not set 46# CONFIG_QEMU is not set
49# CONFIG_MARKEINS is not set 47# CONFIG_MARKEINS is not set
50CONFIG_SGI_IP22=y 48# CONFIG_SGI_IP22 is not set
51# CONFIG_SGI_IP27 is not set 49# CONFIG_SGI_IP27 is not set
52# CONFIG_SGI_IP32 is not set 50# CONFIG_SGI_IP32 is not set
53# CONFIG_SIBYTE_BIGSUR is not set 51# CONFIG_SIBYTE_BIGSUR is not set
@@ -67,25 +65,21 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
67CONFIG_GENERIC_FIND_NEXT_BIT=y 65CONFIG_GENERIC_FIND_NEXT_BIT=y
68CONFIG_GENERIC_HWEIGHT=y 66CONFIG_GENERIC_HWEIGHT=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y 67CONFIG_GENERIC_CALIBRATE_DELAY=y
68CONFIG_GENERIC_TIME=y
70CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 69CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
71CONFIG_ARC=y
72CONFIG_DMA_NONCOHERENT=y 70CONFIG_DMA_NONCOHERENT=y
73CONFIG_DMA_NEED_PCI_MAP_STATE=y 71CONFIG_DMA_NEED_PCI_MAP_STATE=y
74CONFIG_CPU_BIG_ENDIAN=y 72# CONFIG_CPU_BIG_ENDIAN is not set
75# CONFIG_CPU_LITTLE_ENDIAN is not set 73CONFIG_CPU_LITTLE_ENDIAN=y
76CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y 74CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
77CONFIG_IRQ_CPU=y 75CONFIG_PNX8550=y
78CONFIG_SWAP_IO_SPACE=y 76CONFIG_SOC_PNX8550=y
79CONFIG_ARC32=y
80CONFIG_BOOT_ELF32=y
81CONFIG_MIPS_L1_CACHE_SHIFT=5 77CONFIG_MIPS_L1_CACHE_SHIFT=5
82# CONFIG_ARC_CONSOLE is not set
83CONFIG_ARC_PROMLIB=y
84 78
85# 79#
86# CPU selection 80# CPU selection
87# 81#
88# CONFIG_CPU_MIPS32_R1 is not set 82CONFIG_CPU_MIPS32_R1=y
89# CONFIG_CPU_MIPS32_R2 is not set 83# CONFIG_CPU_MIPS32_R2 is not set
90# CONFIG_CPU_MIPS64_R1 is not set 84# CONFIG_CPU_MIPS64_R1 is not set
91# CONFIG_CPU_MIPS64_R2 is not set 85# CONFIG_CPU_MIPS64_R2 is not set
@@ -93,7 +87,7 @@ CONFIG_ARC_PROMLIB=y
93# CONFIG_CPU_TX39XX is not set 87# CONFIG_CPU_TX39XX is not set
94# CONFIG_CPU_VR41XX is not set 88# CONFIG_CPU_VR41XX is not set
95# CONFIG_CPU_R4300 is not set 89# CONFIG_CPU_R4300 is not set
96CONFIG_CPU_R4X00=y 90# CONFIG_CPU_R4X00 is not set
97# CONFIG_CPU_TX49XX is not set 91# CONFIG_CPU_TX49XX is not set
98# CONFIG_CPU_R5000 is not set 92# CONFIG_CPU_R5000 is not set
99# CONFIG_CPU_R5432 is not set 93# CONFIG_CPU_R5432 is not set
@@ -104,12 +98,11 @@ CONFIG_CPU_R4X00=y
104# CONFIG_CPU_RM7000 is not set 98# CONFIG_CPU_RM7000 is not set
105# CONFIG_CPU_RM9000 is not set 99# CONFIG_CPU_RM9000 is not set
106# CONFIG_CPU_SB1 is not set 100# CONFIG_CPU_SB1 is not set
107CONFIG_SYS_HAS_CPU_R4X00=y 101CONFIG_SYS_HAS_CPU_MIPS32_R1=y
108CONFIG_SYS_HAS_CPU_R5000=y 102CONFIG_CPU_MIPS32=y
103CONFIG_CPU_MIPSR1=y
109CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 104CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
110CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
111CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 105CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
112CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
113 106
114# 107#
115# Kernel type 108# Kernel type
@@ -120,17 +113,17 @@ CONFIG_PAGE_SIZE_4KB=y
120# CONFIG_PAGE_SIZE_8KB is not set 113# CONFIG_PAGE_SIZE_8KB is not set
121# CONFIG_PAGE_SIZE_16KB is not set 114# CONFIG_PAGE_SIZE_16KB is not set
122# CONFIG_PAGE_SIZE_64KB is not set 115# CONFIG_PAGE_SIZE_64KB is not set
123CONFIG_BOARD_SCACHE=y 116CONFIG_CPU_HAS_PREFETCH=y
124CONFIG_IP22_CPU_SCACHE=y
125CONFIG_MIPS_MT_DISABLED=y 117CONFIG_MIPS_MT_DISABLED=y
126# CONFIG_MIPS_MT_SMTC is not set
127# CONFIG_MIPS_MT_SMP is not set 118# CONFIG_MIPS_MT_SMP is not set
119# CONFIG_MIPS_MT_SMTC is not set
128# CONFIG_MIPS_VPE_LOADER is not set 120# CONFIG_MIPS_VPE_LOADER is not set
129# CONFIG_64BIT_PHYS_ADDR is not set 121# CONFIG_64BIT_PHYS_ADDR is not set
130CONFIG_CPU_HAS_LLSC=y 122CONFIG_CPU_HAS_LLSC=y
131CONFIG_CPU_HAS_SYNC=y 123CONFIG_CPU_HAS_SYNC=y
132CONFIG_GENERIC_HARDIRQS=y 124CONFIG_GENERIC_HARDIRQS=y
133CONFIG_GENERIC_IRQ_PROBE=y 125CONFIG_GENERIC_IRQ_PROBE=y
126CONFIG_CPU_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y 127CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_SELECT_MEMORY_MODEL=y 128CONFIG_SELECT_MEMORY_MODEL=y
136CONFIG_FLATMEM_MANUAL=y 129CONFIG_FLATMEM_MANUAL=y
@@ -144,12 +137,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
144# CONFIG_HZ_48 is not set 137# CONFIG_HZ_48 is not set
145# CONFIG_HZ_100 is not set 138# CONFIG_HZ_100 is not set
146# CONFIG_HZ_128 is not set 139# CONFIG_HZ_128 is not set
147# CONFIG_HZ_250 is not set 140CONFIG_HZ_250=y
148# CONFIG_HZ_256 is not set 141# CONFIG_HZ_256 is not set
149CONFIG_HZ_1000=y 142# CONFIG_HZ_1000 is not set
150# CONFIG_HZ_1024 is not set 143# CONFIG_HZ_1024 is not set
151CONFIG_SYS_SUPPORTS_ARBIT_HZ=y 144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
152CONFIG_HZ=1000 145CONFIG_HZ=250
153CONFIG_PREEMPT_NONE=y 146CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
@@ -171,16 +164,20 @@ CONFIG_LOCALVERSION=""
171CONFIG_LOCALVERSION_AUTO=y 164CONFIG_LOCALVERSION_AUTO=y
172CONFIG_SWAP=y 165CONFIG_SWAP=y
173CONFIG_SYSVIPC=y 166CONFIG_SYSVIPC=y
167# CONFIG_IPC_NS is not set
174# CONFIG_POSIX_MQUEUE is not set 168# CONFIG_POSIX_MQUEUE is not set
175# CONFIG_BSD_PROCESS_ACCT is not set 169# CONFIG_BSD_PROCESS_ACCT is not set
176CONFIG_SYSCTL=y 170# CONFIG_TASKSTATS is not set
171# CONFIG_UTS_NS is not set
177# CONFIG_AUDIT is not set 172# CONFIG_AUDIT is not set
178CONFIG_IKCONFIG=y 173CONFIG_IKCONFIG=y
179CONFIG_IKCONFIG_PROC=y 174CONFIG_IKCONFIG_PROC=y
180# CONFIG_RELAY is not set 175# CONFIG_RELAY is not set
181CONFIG_INITRAMFS_SOURCE="" 176CONFIG_INITRAMFS_SOURCE=""
182# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 177# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
178CONFIG_SYSCTL=y
183CONFIG_EMBEDDED=y 179CONFIG_EMBEDDED=y
180# CONFIG_SYSCTL_SYSCALL is not set
184CONFIG_KALLSYMS=y 181CONFIG_KALLSYMS=y
185# CONFIG_KALLSYMS_ALL is not set 182# CONFIG_KALLSYMS_ALL is not set
186# CONFIG_KALLSYMS_EXTRA_PASS is not set 183# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -189,12 +186,12 @@ CONFIG_PRINTK=y
189CONFIG_BUG=y 186CONFIG_BUG=y
190CONFIG_ELF_CORE=y 187CONFIG_ELF_CORE=y
191CONFIG_BASE_FULL=y 188CONFIG_BASE_FULL=y
192CONFIG_RT_MUTEXES=y
193CONFIG_FUTEX=y 189CONFIG_FUTEX=y
194CONFIG_EPOLL=y 190CONFIG_EPOLL=y
195CONFIG_SHMEM=y 191CONFIG_SHMEM=y
196CONFIG_SLAB=y 192CONFIG_SLAB=y
197CONFIG_VM_EVENT_COUNTERS=y 193CONFIG_VM_EVENT_COUNTERS=y
194CONFIG_RT_MUTEXES=y
198# CONFIG_TINY_SHMEM is not set 195# CONFIG_TINY_SHMEM is not set
199CONFIG_BASE_SMALL=0 196CONFIG_BASE_SMALL=0
200# CONFIG_SLOB is not set 197# CONFIG_SLOB is not set
@@ -211,6 +208,7 @@ CONFIG_KMOD=y
211# 208#
212# Block layer 209# Block layer
213# 210#
211CONFIG_BLOCK=y
214# CONFIG_LBD is not set 212# CONFIG_LBD is not set
215# CONFIG_BLK_DEV_IO_TRACE is not set 213# CONFIG_BLK_DEV_IO_TRACE is not set
216# CONFIG_LSF is not set 214# CONFIG_LSF is not set
@@ -231,8 +229,10 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
231# 229#
232# Bus options (PCI, PCMCIA, EISA, ISA, TC) 230# Bus options (PCI, PCMCIA, EISA, ISA, TC)
233# 231#
234CONFIG_HW_HAS_EISA=y 232CONFIG_HW_HAS_PCI=y
235# CONFIG_EISA is not set 233CONFIG_PCI=y
234# CONFIG_PCI_MULTITHREAD_PROBE is not set
235# CONFIG_PCI_DEBUG is not set
236CONFIG_MMU=y 236CONFIG_MMU=y
237 237
238# 238#
@@ -243,6 +243,7 @@ CONFIG_MMU=y
243# 243#
244# PCI Hotplug Support 244# PCI Hotplug Support
245# 245#
246# CONFIG_HOTPLUG_PCI is not set
246 247
247# 248#
248# Executable file formats 249# Executable file formats
@@ -265,6 +266,7 @@ CONFIG_PACKET=y
265CONFIG_UNIX=y 266CONFIG_UNIX=y
266CONFIG_XFRM=y 267CONFIG_XFRM=y
267# CONFIG_XFRM_USER is not set 268# CONFIG_XFRM_USER is not set
269# CONFIG_XFRM_SUB_POLICY is not set
268# CONFIG_NET_KEY is not set 270# CONFIG_NET_KEY is not set
269CONFIG_INET=y 271CONFIG_INET=y
270# CONFIG_IP_MULTICAST is not set 272# CONFIG_IP_MULTICAST is not set
@@ -283,16 +285,18 @@ CONFIG_IP_PNP_BOOTP=y
283# CONFIG_INET_IPCOMP is not set 285# CONFIG_INET_IPCOMP is not set
284# CONFIG_INET_XFRM_TUNNEL is not set 286# CONFIG_INET_XFRM_TUNNEL is not set
285# CONFIG_INET_TUNNEL is not set 287# CONFIG_INET_TUNNEL is not set
286CONFIG_INET_XFRM_MODE_TRANSPORT=m 288CONFIG_INET_XFRM_MODE_TRANSPORT=y
287CONFIG_INET_XFRM_MODE_TUNNEL=m 289CONFIG_INET_XFRM_MODE_TUNNEL=y
290CONFIG_INET_XFRM_MODE_BEET=y
288CONFIG_INET_DIAG=y 291CONFIG_INET_DIAG=y
289CONFIG_INET_TCP_DIAG=y 292CONFIG_INET_TCP_DIAG=y
290# CONFIG_TCP_CONG_ADVANCED is not set 293# CONFIG_TCP_CONG_ADVANCED is not set
291CONFIG_TCP_CONG_BIC=y 294CONFIG_TCP_CONG_CUBIC=y
295CONFIG_DEFAULT_TCP_CONG="cubic"
292# CONFIG_IPV6 is not set 296# CONFIG_IPV6 is not set
293# CONFIG_INET6_XFRM_TUNNEL is not set 297# CONFIG_INET6_XFRM_TUNNEL is not set
294# CONFIG_INET6_TUNNEL is not set 298# CONFIG_INET6_TUNNEL is not set
295CONFIG_NETWORK_SECMARK=y 299# CONFIG_NETWORK_SECMARK is not set
296# CONFIG_NETFILTER is not set 300# CONFIG_NETFILTER is not set
297 301
298# 302#
@@ -318,7 +322,6 @@ CONFIG_NETWORK_SECMARK=y
318# CONFIG_ATALK is not set 322# CONFIG_ATALK is not set
319# CONFIG_X25 is not set 323# CONFIG_X25 is not set
320# CONFIG_LAPB is not set 324# CONFIG_LAPB is not set
321# CONFIG_NET_DIVERT is not set
322# CONFIG_ECONET is not set 325# CONFIG_ECONET is not set
323# CONFIG_WAN_ROUTER is not set 326# CONFIG_WAN_ROUTER is not set
324 327
@@ -371,13 +374,20 @@ CONFIG_FW_LOADER=y
371# 374#
372# Block devices 375# Block devices
373# 376#
377# CONFIG_BLK_CPQ_DA is not set
378# CONFIG_BLK_CPQ_CISS_DA is not set
379# CONFIG_BLK_DEV_DAC960 is not set
380# CONFIG_BLK_DEV_UMEM is not set
374# CONFIG_BLK_DEV_COW_COMMON is not set 381# CONFIG_BLK_DEV_COW_COMMON is not set
375CONFIG_BLK_DEV_LOOP=y 382CONFIG_BLK_DEV_LOOP=y
376# CONFIG_BLK_DEV_CRYPTOLOOP is not set 383# CONFIG_BLK_DEV_CRYPTOLOOP is not set
377# CONFIG_BLK_DEV_NBD is not set 384# CONFIG_BLK_DEV_NBD is not set
385# CONFIG_BLK_DEV_SX8 is not set
386# CONFIG_BLK_DEV_UB is not set
378CONFIG_BLK_DEV_RAM=y 387CONFIG_BLK_DEV_RAM=y
379CONFIG_BLK_DEV_RAM_COUNT=16 388CONFIG_BLK_DEV_RAM_COUNT=16
380CONFIG_BLK_DEV_RAM_SIZE=8192 389CONFIG_BLK_DEV_RAM_SIZE=8192
390CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
381CONFIG_BLK_DEV_INITRD=y 391CONFIG_BLK_DEV_INITRD=y
382# CONFIG_CDROM_PKTCDVD is not set 392# CONFIG_CDROM_PKTCDVD is not set
383# CONFIG_ATA_OVER_ETH is not set 393# CONFIG_ATA_OVER_ETH is not set
@@ -386,6 +396,7 @@ CONFIG_BLK_DEV_INITRD=y
386# ATA/ATAPI/MFM/RLL support 396# ATA/ATAPI/MFM/RLL support
387# 397#
388CONFIG_IDE=y 398CONFIG_IDE=y
399CONFIG_IDE_MAX_HWIFS=4
389CONFIG_BLK_DEV_IDE=y 400CONFIG_BLK_DEV_IDE=y
390 401
391# 402#
@@ -404,8 +415,39 @@ CONFIG_BLK_DEV_IDESCSI=y
404# IDE chipset support/bugfixes 415# IDE chipset support/bugfixes
405# 416#
406CONFIG_IDE_GENERIC=y 417CONFIG_IDE_GENERIC=y
418CONFIG_BLK_DEV_IDEPCI=y
419CONFIG_IDEPCI_SHARE_IRQ=y
420CONFIG_BLK_DEV_OFFBOARD=y
421CONFIG_BLK_DEV_GENERIC=y
422# CONFIG_BLK_DEV_OPTI621 is not set
423CONFIG_BLK_DEV_IDEDMA_PCI=y
424# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
425# CONFIG_IDEDMA_PCI_AUTO is not set
426# CONFIG_BLK_DEV_AEC62XX is not set
427# CONFIG_BLK_DEV_ALI15X3 is not set
428# CONFIG_BLK_DEV_AMD74XX is not set
429# CONFIG_BLK_DEV_CMD64X is not set
430# CONFIG_BLK_DEV_TRIFLEX is not set
431# CONFIG_BLK_DEV_CY82C693 is not set
432# CONFIG_BLK_DEV_CS5520 is not set
433# CONFIG_BLK_DEV_CS5530 is not set
434# CONFIG_BLK_DEV_HPT34X is not set
435CONFIG_BLK_DEV_HPT366=y
436# CONFIG_BLK_DEV_JMICRON is not set
437# CONFIG_BLK_DEV_SC1200 is not set
438# CONFIG_BLK_DEV_PIIX is not set
439# CONFIG_BLK_DEV_IT821X is not set
440# CONFIG_BLK_DEV_NS87415 is not set
441# CONFIG_BLK_DEV_PDC202XX_OLD is not set
442# CONFIG_BLK_DEV_PDC202XX_NEW is not set
443# CONFIG_BLK_DEV_SVWKS is not set
444# CONFIG_BLK_DEV_SIIMAGE is not set
445# CONFIG_BLK_DEV_SLC90E66 is not set
446# CONFIG_BLK_DEV_TRM290 is not set
447# CONFIG_BLK_DEV_VIA82CXXX is not set
407# CONFIG_IDE_ARM is not set 448# CONFIG_IDE_ARM is not set
408# CONFIG_BLK_DEV_IDEDMA is not set 449CONFIG_BLK_DEV_IDEDMA=y
450# CONFIG_IDEDMA_IVB is not set
409# CONFIG_IDEDMA_AUTO is not set 451# CONFIG_IDEDMA_AUTO is not set
410# CONFIG_BLK_DEV_HD is not set 452# CONFIG_BLK_DEV_HD is not set
411 453
@@ -414,6 +456,7 @@ CONFIG_IDE_GENERIC=y
414# 456#
415# CONFIG_RAID_ATTRS is not set 457# CONFIG_RAID_ATTRS is not set
416CONFIG_SCSI=y 458CONFIG_SCSI=y
459CONFIG_SCSI_NETLINK=y
417CONFIG_SCSI_PROC_FS=y 460CONFIG_SCSI_PROC_FS=y
418 461
419# 462#
@@ -434,22 +477,54 @@ CONFIG_SCSI_CONSTANTS=y
434# CONFIG_SCSI_LOGGING is not set 477# CONFIG_SCSI_LOGGING is not set
435 478
436# 479#
437# SCSI Transport Attributes 480# SCSI Transports
438# 481#
439# CONFIG_SCSI_SPI_ATTRS is not set 482# CONFIG_SCSI_SPI_ATTRS is not set
440CONFIG_SCSI_FC_ATTRS=y 483CONFIG_SCSI_FC_ATTRS=y
441CONFIG_SCSI_ISCSI_ATTRS=m 484CONFIG_SCSI_ISCSI_ATTRS=m
442# CONFIG_SCSI_SAS_ATTRS is not set 485# CONFIG_SCSI_SAS_ATTRS is not set
486# CONFIG_SCSI_SAS_LIBSAS is not set
443 487
444# 488#
445# SCSI low-level drivers 489# SCSI low-level drivers
446# 490#
447CONFIG_ISCSI_TCP=m 491CONFIG_ISCSI_TCP=m
448# CONFIG_SGIWD93_SCSI is not set 492# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
449# CONFIG_SCSI_SATA is not set 493# CONFIG_SCSI_3W_9XXX is not set
494# CONFIG_SCSI_ACARD is not set
495# CONFIG_SCSI_AACRAID is not set
496# CONFIG_SCSI_AIC7XXX is not set
497# CONFIG_SCSI_AIC7XXX_OLD is not set
498# CONFIG_SCSI_AIC79XX is not set
499# CONFIG_SCSI_AIC94XX is not set
500# CONFIG_SCSI_DPT_I2O is not set
501# CONFIG_SCSI_ARCMSR is not set
502# CONFIG_MEGARAID_NEWGEN is not set
503# CONFIG_MEGARAID_LEGACY is not set
504# CONFIG_MEGARAID_SAS is not set
505# CONFIG_SCSI_HPTIOP is not set
506# CONFIG_SCSI_DMX3191D is not set
507# CONFIG_SCSI_FUTURE_DOMAIN is not set
508# CONFIG_SCSI_IPS is not set
509# CONFIG_SCSI_INITIO is not set
510# CONFIG_SCSI_INIA100 is not set
511# CONFIG_SCSI_STEX is not set
512# CONFIG_SCSI_SYM53C8XX_2 is not set
513# CONFIG_SCSI_QLOGIC_1280 is not set
514# CONFIG_SCSI_QLA_FC is not set
515# CONFIG_SCSI_QLA_ISCSI is not set
516# CONFIG_SCSI_LPFC is not set
517# CONFIG_SCSI_DC395x is not set
518# CONFIG_SCSI_DC390T is not set
519# CONFIG_SCSI_NSP32 is not set
450# CONFIG_SCSI_DEBUG is not set 520# CONFIG_SCSI_DEBUG is not set
451 521
452# 522#
523# Serial ATA (prod) and Parallel ATA (experimental) drivers
524#
525# CONFIG_ATA is not set
526
527#
453# Multi-device support (RAID and LVM) 528# Multi-device support (RAID and LVM)
454# 529#
455# CONFIG_MD is not set 530# CONFIG_MD is not set
@@ -458,14 +533,19 @@ CONFIG_ISCSI_TCP=m
458# Fusion MPT device support 533# Fusion MPT device support
459# 534#
460# CONFIG_FUSION is not set 535# CONFIG_FUSION is not set
536# CONFIG_FUSION_SPI is not set
537# CONFIG_FUSION_FC is not set
538# CONFIG_FUSION_SAS is not set
461 539
462# 540#
463# IEEE 1394 (FireWire) support 541# IEEE 1394 (FireWire) support
464# 542#
543# CONFIG_IEEE1394 is not set
465 544
466# 545#
467# I2O device support 546# I2O device support
468# 547#
548# CONFIG_I2O is not set
469 549
470# 550#
471# Network device support 551# Network device support
@@ -477,6 +557,11 @@ CONFIG_NETDEVICES=y
477# CONFIG_TUN is not set 557# CONFIG_TUN is not set
478 558
479# 559#
560# ARCnet devices
561#
562# CONFIG_ARCNET is not set
563
564#
480# PHY device support 565# PHY device support
481# 566#
482# CONFIG_PHYLIB is not set 567# CONFIG_PHYLIB is not set
@@ -486,20 +571,73 @@ CONFIG_NETDEVICES=y
486# 571#
487CONFIG_NET_ETHERNET=y 572CONFIG_NET_ETHERNET=y
488CONFIG_MII=y 573CONFIG_MII=y
574# CONFIG_HAPPYMEAL is not set
575# CONFIG_SUNGEM is not set
576# CONFIG_CASSINI is not set
577# CONFIG_NET_VENDOR_3COM is not set
489# CONFIG_DM9000 is not set 578# CONFIG_DM9000 is not set
490# CONFIG_SGISEEQ is not set 579
580#
581# Tulip family network device support
582#
583# CONFIG_NET_TULIP is not set
584# CONFIG_HP100 is not set
585CONFIG_NET_PCI=y
586# CONFIG_PCNET32 is not set
587# CONFIG_AMD8111_ETH is not set
588# CONFIG_ADAPTEC_STARFIRE is not set
589# CONFIG_B44 is not set
590# CONFIG_FORCEDETH is not set
591# CONFIG_DGRS is not set
592# CONFIG_EEPRO100 is not set
593# CONFIG_E100 is not set
594# CONFIG_FEALNX is not set
595# CONFIG_NATSEMI is not set
596# CONFIG_NE2K_PCI is not set
597# CONFIG_8139CP is not set
598CONFIG_8139TOO=y
599# CONFIG_8139TOO_PIO is not set
600CONFIG_8139TOO_TUNE_TWISTER=y
601CONFIG_8139TOO_8129=y
602# CONFIG_8139_OLD_RX_RESET is not set
603# CONFIG_SIS900 is not set
604# CONFIG_EPIC100 is not set
605# CONFIG_SUNDANCE is not set
606# CONFIG_TLAN is not set
607# CONFIG_VIA_RHINE is not set
608# CONFIG_LAN_SAA9730 is not set
491 609
492# 610#
493# Ethernet (1000 Mbit) 611# Ethernet (1000 Mbit)
494# 612#
613# CONFIG_ACENIC is not set
614# CONFIG_DL2K is not set
615# CONFIG_E1000 is not set
616# CONFIG_NS83820 is not set
617# CONFIG_HAMACHI is not set
618# CONFIG_YELLOWFIN is not set
619# CONFIG_R8169 is not set
620# CONFIG_SIS190 is not set
621# CONFIG_SKGE is not set
622# CONFIG_SKY2 is not set
623# CONFIG_SK98LIN is not set
624# CONFIG_VIA_VELOCITY is not set
625# CONFIG_TIGON3 is not set
626# CONFIG_BNX2 is not set
627# CONFIG_QLA3XXX is not set
495 628
496# 629#
497# Ethernet (10000 Mbit) 630# Ethernet (10000 Mbit)
498# 631#
632# CONFIG_CHELSIO_T1 is not set
633# CONFIG_IXGB is not set
634# CONFIG_S2IO is not set
635# CONFIG_MYRI10GE is not set
499 636
500# 637#
501# Token Ring devices 638# Token Ring devices
502# 639#
640# CONFIG_TR is not set
503 641
504# 642#
505# Wireless LAN (non-hamradio) 643# Wireless LAN (non-hamradio)
@@ -510,8 +648,11 @@ CONFIG_MII=y
510# Wan interfaces 648# Wan interfaces
511# 649#
512# CONFIG_WAN is not set 650# CONFIG_WAN is not set
651# CONFIG_FDDI is not set
652# CONFIG_HIPPI is not set
513# CONFIG_PPP is not set 653# CONFIG_PPP is not set
514# CONFIG_SLIP is not set 654# CONFIG_SLIP is not set
655# CONFIG_NET_FC is not set
515# CONFIG_SHAPER is not set 656# CONFIG_SHAPER is not set
516# CONFIG_NETCONSOLE is not set 657# CONFIG_NETCONSOLE is not set
517# CONFIG_NETPOLL is not set 658# CONFIG_NETPOLL is not set
@@ -531,6 +672,7 @@ CONFIG_MII=y
531# Input device support 672# Input device support
532# 673#
533CONFIG_INPUT=y 674CONFIG_INPUT=y
675# CONFIG_INPUT_FF_MEMLESS is not set
534 676
535# 677#
536# Userland interfaces 678# Userland interfaces
@@ -556,6 +698,7 @@ CONFIG_INPUT=y
556CONFIG_SERIO=y 698CONFIG_SERIO=y
557# CONFIG_SERIO_I8042 is not set 699# CONFIG_SERIO_I8042 is not set
558# CONFIG_SERIO_SERPORT is not set 700# CONFIG_SERIO_SERPORT is not set
701# CONFIG_SERIO_PCIPS2 is not set
559CONFIG_SERIO_LIBPS2=y 702CONFIG_SERIO_LIBPS2=y
560# CONFIG_SERIO_RAW is not set 703# CONFIG_SERIO_RAW is not set
561# CONFIG_GAMEPORT is not set 704# CONFIG_GAMEPORT is not set
@@ -566,7 +709,7 @@ CONFIG_SERIO_LIBPS2=y
566CONFIG_VT=y 709CONFIG_VT=y
567CONFIG_VT_CONSOLE=y 710CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y 711CONFIG_HW_CONSOLE=y
569CONFIG_VT_HW_CONSOLE_BINDING=y 712# CONFIG_VT_HW_CONSOLE_BINDING is not set
570# CONFIG_SERIAL_NONSTANDARD is not set 713# CONFIG_SERIAL_NONSTANDARD is not set
571 714
572# 715#
@@ -577,7 +720,8 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
577# 720#
578# Non-8250 serial port support 721# Non-8250 serial port support
579# 722#
580# CONFIG_SERIAL_IP22_ZILOG is not set 723# CONFIG_SERIAL_IP3106 is not set
724# CONFIG_SERIAL_JSM is not set
581CONFIG_UNIX98_PTYS=y 725CONFIG_UNIX98_PTYS=y
582CONFIG_LEGACY_PTYS=y 726CONFIG_LEGACY_PTYS=y
583CONFIG_LEGACY_PTY_COUNT=256 727CONFIG_LEGACY_PTY_COUNT=256
@@ -591,16 +735,17 @@ CONFIG_LEGACY_PTY_COUNT=256
591# Watchdog Cards 735# Watchdog Cards
592# 736#
593# CONFIG_WATCHDOG is not set 737# CONFIG_WATCHDOG is not set
594# CONFIG_HW_RANDOM is not set 738CONFIG_HW_RANDOM=y
595# CONFIG_RTC is not set 739# CONFIG_RTC is not set
596# CONFIG_SGI_DS1286 is not set
597# CONFIG_GEN_RTC is not set 740# CONFIG_GEN_RTC is not set
598# CONFIG_DTLK is not set 741# CONFIG_DTLK is not set
599# CONFIG_R3964 is not set 742# CONFIG_R3964 is not set
743# CONFIG_APPLICOM is not set
600 744
601# 745#
602# Ftape, the floppy tape device driver 746# Ftape, the floppy tape device driver
603# 747#
748# CONFIG_DRM is not set
604# CONFIG_RAW_DRIVER is not set 749# CONFIG_RAW_DRIVER is not set
605 750
606# 751#
@@ -631,35 +776,37 @@ CONFIG_HWMON=y
631# CONFIG_HWMON_VID is not set 776# CONFIG_HWMON_VID is not set
632# CONFIG_SENSORS_ABITUGURU is not set 777# CONFIG_SENSORS_ABITUGURU is not set
633# CONFIG_SENSORS_F71805F is not set 778# CONFIG_SENSORS_F71805F is not set
779# CONFIG_SENSORS_VT1211 is not set
634# CONFIG_HWMON_DEBUG_CHIP is not set 780# CONFIG_HWMON_DEBUG_CHIP is not set
635 781
636# 782#
637# Misc devices 783# Misc devices
638# 784#
785# CONFIG_TIFM_CORE is not set
639 786
640# 787#
641# Multimedia devices 788# Multimedia devices
642# 789#
643# CONFIG_VIDEO_DEV is not set 790# CONFIG_VIDEO_DEV is not set
644CONFIG_VIDEO_V4L2=y
645 791
646# 792#
647# Digital Video Broadcasting Devices 793# Digital Video Broadcasting Devices
648# 794#
649# CONFIG_DVB is not set 795# CONFIG_DVB is not set
796# CONFIG_USB_DABUSB is not set
650 797
651# 798#
652# Graphics support 799# Graphics support
653# 800#
654# CONFIG_FIRMWARE_EDID is not set 801CONFIG_FIRMWARE_EDID=y
655# CONFIG_FB is not set 802# CONFIG_FB is not set
656 803
657# 804#
658# Console display driver support 805# Console display driver support
659# 806#
660# CONFIG_VGA_CONSOLE is not set 807# CONFIG_VGA_CONSOLE is not set
661# CONFIG_SGI_NEWPORT_CONSOLE is not set
662CONFIG_DUMMY_CONSOLE=y 808CONFIG_DUMMY_CONSOLE=y
809# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
663 810
664# 811#
665# Sound 812# Sound
@@ -669,15 +816,131 @@ CONFIG_DUMMY_CONSOLE=y
669# 816#
670# USB support 817# USB support
671# 818#
672# CONFIG_USB_ARCH_HAS_HCD is not set 819CONFIG_USB_ARCH_HAS_HCD=y
673# CONFIG_USB_ARCH_HAS_OHCI is not set 820CONFIG_USB_ARCH_HAS_OHCI=y
674# CONFIG_USB_ARCH_HAS_EHCI is not set 821CONFIG_USB_ARCH_HAS_EHCI=y
822CONFIG_USB=y
823# CONFIG_USB_DEBUG is not set
824
825#
826# Miscellaneous USB options
827#
828# CONFIG_USB_DEVICEFS is not set
829# CONFIG_USB_BANDWIDTH is not set
830# CONFIG_USB_DYNAMIC_MINORS is not set
831# CONFIG_USB_OTG is not set
832
833#
834# USB Host Controller Drivers
835#
836# CONFIG_USB_EHCI_HCD is not set
837# CONFIG_USB_ISP116X_HCD is not set
838CONFIG_USB_OHCI_HCD=y
839# CONFIG_USB_OHCI_BIG_ENDIAN is not set
840CONFIG_USB_OHCI_LITTLE_ENDIAN=y
841# CONFIG_USB_UHCI_HCD is not set
842# CONFIG_USB_SL811_HCD is not set
843
844#
845# USB Device Class drivers
846#
847# CONFIG_USB_ACM is not set
848# CONFIG_USB_PRINTER is not set
675 849
676# 850#
677# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 851# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
678# 852#
679 853
680# 854#
855# may also be needed; see USB_STORAGE Help for more information
856#
857CONFIG_USB_STORAGE=y
858# CONFIG_USB_STORAGE_DEBUG is not set
859CONFIG_USB_STORAGE_DATAFAB=y
860CONFIG_USB_STORAGE_FREECOM=y
861CONFIG_USB_STORAGE_ISD200=y
862CONFIG_USB_STORAGE_DPCM=y
863CONFIG_USB_STORAGE_USBAT=y
864CONFIG_USB_STORAGE_SDDR09=y
865CONFIG_USB_STORAGE_SDDR55=y
866CONFIG_USB_STORAGE_JUMPSHOT=y
867# CONFIG_USB_STORAGE_ALAUDA is not set
868# CONFIG_USB_STORAGE_KARMA is not set
869# CONFIG_USB_LIBUSUAL is not set
870
871#
872# USB Input Devices
873#
874# CONFIG_USB_HID is not set
875
876#
877# USB HID Boot Protocol drivers
878#
879# CONFIG_USB_KBD is not set
880# CONFIG_USB_MOUSE is not set
881# CONFIG_USB_AIPTEK is not set
882# CONFIG_USB_WACOM is not set
883# CONFIG_USB_ACECAD is not set
884# CONFIG_USB_KBTAB is not set
885# CONFIG_USB_POWERMATE is not set
886# CONFIG_USB_TOUCHSCREEN is not set
887# CONFIG_USB_YEALINK is not set
888# CONFIG_USB_XPAD is not set
889# CONFIG_USB_ATI_REMOTE is not set
890# CONFIG_USB_ATI_REMOTE2 is not set
891# CONFIG_USB_KEYSPAN_REMOTE is not set
892# CONFIG_USB_APPLETOUCH is not set
893# CONFIG_USB_TRANCEVIBRATOR is not set
894
895#
896# USB Imaging devices
897#
898# CONFIG_USB_MDC800 is not set
899# CONFIG_USB_MICROTEK is not set
900
901#
902# USB Network Adapters
903#
904# CONFIG_USB_CATC is not set
905# CONFIG_USB_KAWETH is not set
906# CONFIG_USB_PEGASUS is not set
907# CONFIG_USB_RTL8150 is not set
908# CONFIG_USB_USBNET is not set
909CONFIG_USB_MON=y
910
911#
912# USB port drivers
913#
914
915#
916# USB Serial Converter support
917#
918# CONFIG_USB_SERIAL is not set
919
920#
921# USB Miscellaneous drivers
922#
923# CONFIG_USB_EMI62 is not set
924# CONFIG_USB_EMI26 is not set
925# CONFIG_USB_ADUTUX is not set
926# CONFIG_USB_AUERSWALD is not set
927# CONFIG_USB_RIO500 is not set
928# CONFIG_USB_LEGOTOWER is not set
929# CONFIG_USB_LCD is not set
930# CONFIG_USB_LED is not set
931# CONFIG_USB_CYPRESS_CY7C63 is not set
932# CONFIG_USB_CYTHERM is not set
933# CONFIG_USB_PHIDGET is not set
934# CONFIG_USB_IDMOUSE is not set
935# CONFIG_USB_FTDI_ELAN is not set
936# CONFIG_USB_APPLEDISPLAY is not set
937# CONFIG_USB_LD is not set
938
939#
940# USB DSL modem support
941#
942
943#
681# USB Gadget Support 944# USB Gadget Support
682# 945#
683# CONFIG_USB_GADGET is not set 946# CONFIG_USB_GADGET is not set
@@ -703,6 +966,7 @@ CONFIG_DUMMY_CONSOLE=y
703# 966#
704# InfiniBand support 967# InfiniBand support
705# 968#
969# CONFIG_INFINIBAND is not set
706 970
707# 971#
708# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 972# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -733,10 +997,12 @@ CONFIG_EXT2_FS=y
733# CONFIG_EXT2_FS_XATTR is not set 997# CONFIG_EXT2_FS_XATTR is not set
734# CONFIG_EXT2_FS_XIP is not set 998# CONFIG_EXT2_FS_XIP is not set
735# CONFIG_EXT3_FS is not set 999# CONFIG_EXT3_FS is not set
1000# CONFIG_EXT4DEV_FS is not set
736# CONFIG_REISERFS_FS is not set 1001# CONFIG_REISERFS_FS is not set
737# CONFIG_JFS_FS is not set 1002# CONFIG_JFS_FS is not set
738# CONFIG_FS_POSIX_ACL is not set 1003# CONFIG_FS_POSIX_ACL is not set
739# CONFIG_XFS_FS is not set 1004# CONFIG_XFS_FS is not set
1005# CONFIG_GFS2_FS is not set
740# CONFIG_OCFS2_FS is not set 1006# CONFIG_OCFS2_FS is not set
741# CONFIG_MINIX_FS is not set 1007# CONFIG_MINIX_FS is not set
742# CONFIG_ROMFS_FS is not set 1008# CONFIG_ROMFS_FS is not set
@@ -769,8 +1035,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
769# 1035#
770CONFIG_PROC_FS=y 1036CONFIG_PROC_FS=y
771# CONFIG_PROC_KCORE is not set 1037# CONFIG_PROC_KCORE is not set
1038CONFIG_PROC_SYSCTL=y
772CONFIG_SYSFS=y 1039CONFIG_SYSFS=y
773CONFIG_TMPFS=y 1040CONFIG_TMPFS=y
1041# CONFIG_TMPFS_POSIX_ACL is not set
774# CONFIG_HUGETLB_PAGE is not set 1042# CONFIG_HUGETLB_PAGE is not set
775CONFIG_RAMFS=y 1043CONFIG_RAMFS=y
776# CONFIG_CONFIGFS_FS is not set 1044# CONFIG_CONFIGFS_FS is not set
@@ -813,7 +1081,6 @@ CONFIG_SUNRPC=y
813# CONFIG_RPCSEC_GSS_SPKM3 is not set 1081# CONFIG_RPCSEC_GSS_SPKM3 is not set
814# CONFIG_SMB_FS is not set 1082# CONFIG_SMB_FS is not set
815# CONFIG_CIFS is not set 1083# CONFIG_CIFS is not set
816# CONFIG_CIFS_DEBUG2 is not set
817# CONFIG_NCP_FS is not set 1084# CONFIG_NCP_FS is not set
818# CONFIG_CODA_FS is not set 1085# CONFIG_CODA_FS is not set
819# CONFIG_AFS_FS is not set 1086# CONFIG_AFS_FS is not set
@@ -824,7 +1091,6 @@ CONFIG_SUNRPC=y
824# 1091#
825# CONFIG_PARTITION_ADVANCED is not set 1092# CONFIG_PARTITION_ADVANCED is not set
826CONFIG_MSDOS_PARTITION=y 1093CONFIG_MSDOS_PARTITION=y
827CONFIG_SGI_PARTITION=y
828 1094
829# 1095#
830# Native Language Support 1096# Native Language Support
@@ -880,6 +1146,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
880# 1146#
881CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1147CONFIG_TRACE_IRQFLAGS_SUPPORT=y
882# CONFIG_PRINTK_TIME is not set 1148# CONFIG_PRINTK_TIME is not set
1149CONFIG_ENABLE_MUST_CHECK=y
883CONFIG_MAGIC_SYSRQ=y 1150CONFIG_MAGIC_SYSRQ=y
884# CONFIG_UNUSED_SYMBOLS is not set 1151# CONFIG_UNUSED_SYMBOLS is not set
885CONFIG_DEBUG_KERNEL=y 1152CONFIG_DEBUG_KERNEL=y
@@ -893,13 +1160,17 @@ CONFIG_DEBUG_SLAB=y
893# CONFIG_DEBUG_SPINLOCK is not set 1160# CONFIG_DEBUG_SPINLOCK is not set
894CONFIG_DEBUG_MUTEXES=y 1161CONFIG_DEBUG_MUTEXES=y
895# CONFIG_DEBUG_RWSEMS is not set 1162# CONFIG_DEBUG_RWSEMS is not set
1163# CONFIG_DEBUG_LOCK_ALLOC is not set
1164# CONFIG_PROVE_LOCKING is not set
896# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1165# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
897# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1166# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
898# CONFIG_DEBUG_KOBJECT is not set 1167# CONFIG_DEBUG_KOBJECT is not set
899# CONFIG_DEBUG_INFO is not set 1168# CONFIG_DEBUG_INFO is not set
900# CONFIG_DEBUG_FS is not set 1169# CONFIG_DEBUG_FS is not set
901# CONFIG_DEBUG_VM is not set 1170# CONFIG_DEBUG_VM is not set
1171# CONFIG_DEBUG_LIST is not set
902CONFIG_FORCED_INLINING=y 1172CONFIG_FORCED_INLINING=y
1173# CONFIG_HEADERS_CHECK is not set
903# CONFIG_RCU_TORTURE_TEST is not set 1174# CONFIG_RCU_TORTURE_TEST is not set
904CONFIG_CROSSCOMPILE=y 1175CONFIG_CROSSCOMPILE=y
905CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp" 1176CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
@@ -918,6 +1189,9 @@ CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
918# Cryptographic options 1189# Cryptographic options
919# 1190#
920CONFIG_CRYPTO=y 1191CONFIG_CRYPTO=y
1192CONFIG_CRYPTO_ALGAPI=m
1193CONFIG_CRYPTO_BLKCIPHER=m
1194CONFIG_CRYPTO_MANAGER=m
921# CONFIG_CRYPTO_HMAC is not set 1195# CONFIG_CRYPTO_HMAC is not set
922# CONFIG_CRYPTO_NULL is not set 1196# CONFIG_CRYPTO_NULL is not set
923# CONFIG_CRYPTO_MD4 is not set 1197# CONFIG_CRYPTO_MD4 is not set
@@ -927,6 +1201,8 @@ CONFIG_CRYPTO_MD5=m
927# CONFIG_CRYPTO_SHA512 is not set 1201# CONFIG_CRYPTO_SHA512 is not set
928# CONFIG_CRYPTO_WP512 is not set 1202# CONFIG_CRYPTO_WP512 is not set
929# CONFIG_CRYPTO_TGR192 is not set 1203# CONFIG_CRYPTO_TGR192 is not set
1204CONFIG_CRYPTO_ECB=m
1205CONFIG_CRYPTO_CBC=m
930# CONFIG_CRYPTO_DES is not set 1206# CONFIG_CRYPTO_DES is not set
931# CONFIG_CRYPTO_BLOWFISH is not set 1207# CONFIG_CRYPTO_BLOWFISH is not set
932# CONFIG_CRYPTO_TWOFISH is not set 1208# CONFIG_CRYPTO_TWOFISH is not set
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index e93266b37dd9..64b9fbf44a64 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.19-rc2
4# Thu Jul 6 10:04:18 2006 4# Sat Oct 14 23:12:15 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -25,8 +25,6 @@ CONFIG_MIPS=y
25# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
26# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
27# CONFIG_MIPS_EV64120 is not set 27# CONFIG_MIPS_EV64120 is not set
28# CONFIG_MIPS_IVR is not set
29# CONFIG_MIPS_ITE8172 is not set
30# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set 29# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set 30# CONFIG_MIPS_ATLAS is not set
@@ -40,14 +38,14 @@ CONFIG_MIPS=y
40# CONFIG_MOMENCO_OCELOT_C is not set 38# CONFIG_MOMENCO_OCELOT_C is not set
41# CONFIG_MOMENCO_OCELOT_G is not set 39# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set 40# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set 41CONFIG_PNX8550_V2PCI=y
44# CONFIG_PNX8550_JBS is not set 42# CONFIG_PNX8550_JBS is not set
45# CONFIG_DDB5477 is not set 43# CONFIG_DDB5477 is not set
46# CONFIG_MACH_VR41XX is not set 44# CONFIG_MACH_VR41XX is not set
47# CONFIG_PMC_YOSEMITE is not set 45# CONFIG_PMC_YOSEMITE is not set
48# CONFIG_QEMU is not set 46# CONFIG_QEMU is not set
49# CONFIG_MARKEINS is not set 47# CONFIG_MARKEINS is not set
50CONFIG_SGI_IP22=y 48# CONFIG_SGI_IP22 is not set
51# CONFIG_SGI_IP27 is not set 49# CONFIG_SGI_IP27 is not set
52# CONFIG_SGI_IP32 is not set 50# CONFIG_SGI_IP32 is not set
53# CONFIG_SIBYTE_BIGSUR is not set 51# CONFIG_SIBYTE_BIGSUR is not set
@@ -67,25 +65,21 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
67CONFIG_GENERIC_FIND_NEXT_BIT=y 65CONFIG_GENERIC_FIND_NEXT_BIT=y
68CONFIG_GENERIC_HWEIGHT=y 66CONFIG_GENERIC_HWEIGHT=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y 67CONFIG_GENERIC_CALIBRATE_DELAY=y
68CONFIG_GENERIC_TIME=y
70CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 69CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
71CONFIG_ARC=y
72CONFIG_DMA_NONCOHERENT=y 70CONFIG_DMA_NONCOHERENT=y
73CONFIG_DMA_NEED_PCI_MAP_STATE=y 71CONFIG_DMA_NEED_PCI_MAP_STATE=y
74CONFIG_CPU_BIG_ENDIAN=y 72# CONFIG_CPU_BIG_ENDIAN is not set
75# CONFIG_CPU_LITTLE_ENDIAN is not set 73CONFIG_CPU_LITTLE_ENDIAN=y
76CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y 74CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
77CONFIG_IRQ_CPU=y 75CONFIG_PNX8550=y
78CONFIG_SWAP_IO_SPACE=y 76CONFIG_SOC_PNX8550=y
79CONFIG_ARC32=y
80CONFIG_BOOT_ELF32=y
81CONFIG_MIPS_L1_CACHE_SHIFT=5 77CONFIG_MIPS_L1_CACHE_SHIFT=5
82# CONFIG_ARC_CONSOLE is not set
83CONFIG_ARC_PROMLIB=y
84 78
85# 79#
86# CPU selection 80# CPU selection
87# 81#
88# CONFIG_CPU_MIPS32_R1 is not set 82CONFIG_CPU_MIPS32_R1=y
89# CONFIG_CPU_MIPS32_R2 is not set 83# CONFIG_CPU_MIPS32_R2 is not set
90# CONFIG_CPU_MIPS64_R1 is not set 84# CONFIG_CPU_MIPS64_R1 is not set
91# CONFIG_CPU_MIPS64_R2 is not set 85# CONFIG_CPU_MIPS64_R2 is not set
@@ -93,7 +87,7 @@ CONFIG_ARC_PROMLIB=y
93# CONFIG_CPU_TX39XX is not set 87# CONFIG_CPU_TX39XX is not set
94# CONFIG_CPU_VR41XX is not set 88# CONFIG_CPU_VR41XX is not set
95# CONFIG_CPU_R4300 is not set 89# CONFIG_CPU_R4300 is not set
96CONFIG_CPU_R4X00=y 90# CONFIG_CPU_R4X00 is not set
97# CONFIG_CPU_TX49XX is not set 91# CONFIG_CPU_TX49XX is not set
98# CONFIG_CPU_R5000 is not set 92# CONFIG_CPU_R5000 is not set
99# CONFIG_CPU_R5432 is not set 93# CONFIG_CPU_R5432 is not set
@@ -104,12 +98,11 @@ CONFIG_CPU_R4X00=y
104# CONFIG_CPU_RM7000 is not set 98# CONFIG_CPU_RM7000 is not set
105# CONFIG_CPU_RM9000 is not set 99# CONFIG_CPU_RM9000 is not set
106# CONFIG_CPU_SB1 is not set 100# CONFIG_CPU_SB1 is not set
107CONFIG_SYS_HAS_CPU_R4X00=y 101CONFIG_SYS_HAS_CPU_MIPS32_R1=y
108CONFIG_SYS_HAS_CPU_R5000=y 102CONFIG_CPU_MIPS32=y
103CONFIG_CPU_MIPSR1=y
109CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 104CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
110CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
111CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 105CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
112CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
113 106
114# 107#
115# Kernel type 108# Kernel type
@@ -120,17 +113,17 @@ CONFIG_PAGE_SIZE_4KB=y
120# CONFIG_PAGE_SIZE_8KB is not set 113# CONFIG_PAGE_SIZE_8KB is not set
121# CONFIG_PAGE_SIZE_16KB is not set 114# CONFIG_PAGE_SIZE_16KB is not set
122# CONFIG_PAGE_SIZE_64KB is not set 115# CONFIG_PAGE_SIZE_64KB is not set
123CONFIG_BOARD_SCACHE=y 116CONFIG_CPU_HAS_PREFETCH=y
124CONFIG_IP22_CPU_SCACHE=y
125CONFIG_MIPS_MT_DISABLED=y 117CONFIG_MIPS_MT_DISABLED=y
126# CONFIG_MIPS_MT_SMTC is not set
127# CONFIG_MIPS_MT_SMP is not set 118# CONFIG_MIPS_MT_SMP is not set
119# CONFIG_MIPS_MT_SMTC is not set
128# CONFIG_MIPS_VPE_LOADER is not set 120# CONFIG_MIPS_VPE_LOADER is not set
129# CONFIG_64BIT_PHYS_ADDR is not set 121# CONFIG_64BIT_PHYS_ADDR is not set
130CONFIG_CPU_HAS_LLSC=y 122CONFIG_CPU_HAS_LLSC=y
131CONFIG_CPU_HAS_SYNC=y 123CONFIG_CPU_HAS_SYNC=y
132CONFIG_GENERIC_HARDIRQS=y 124CONFIG_GENERIC_HARDIRQS=y
133CONFIG_GENERIC_IRQ_PROBE=y 125CONFIG_GENERIC_IRQ_PROBE=y
126CONFIG_CPU_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y 127CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_SELECT_MEMORY_MODEL=y 128CONFIG_SELECT_MEMORY_MODEL=y
136CONFIG_FLATMEM_MANUAL=y 129CONFIG_FLATMEM_MANUAL=y
@@ -144,12 +137,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
144# CONFIG_HZ_48 is not set 137# CONFIG_HZ_48 is not set
145# CONFIG_HZ_100 is not set 138# CONFIG_HZ_100 is not set
146# CONFIG_HZ_128 is not set 139# CONFIG_HZ_128 is not set
147# CONFIG_HZ_250 is not set 140CONFIG_HZ_250=y
148# CONFIG_HZ_256 is not set 141# CONFIG_HZ_256 is not set
149CONFIG_HZ_1000=y 142# CONFIG_HZ_1000 is not set
150# CONFIG_HZ_1024 is not set 143# CONFIG_HZ_1024 is not set
151CONFIG_SYS_SUPPORTS_ARBIT_HZ=y 144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
152CONFIG_HZ=1000 145CONFIG_HZ=250
153CONFIG_PREEMPT_NONE=y 146CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
@@ -171,16 +164,20 @@ CONFIG_LOCALVERSION=""
171CONFIG_LOCALVERSION_AUTO=y 164CONFIG_LOCALVERSION_AUTO=y
172CONFIG_SWAP=y 165CONFIG_SWAP=y
173CONFIG_SYSVIPC=y 166CONFIG_SYSVIPC=y
167# CONFIG_IPC_NS is not set
174# CONFIG_POSIX_MQUEUE is not set 168# CONFIG_POSIX_MQUEUE is not set
175# CONFIG_BSD_PROCESS_ACCT is not set 169# CONFIG_BSD_PROCESS_ACCT is not set
176CONFIG_SYSCTL=y 170# CONFIG_TASKSTATS is not set
171# CONFIG_UTS_NS is not set
177# CONFIG_AUDIT is not set 172# CONFIG_AUDIT is not set
178CONFIG_IKCONFIG=y 173CONFIG_IKCONFIG=y
179CONFIG_IKCONFIG_PROC=y 174CONFIG_IKCONFIG_PROC=y
180# CONFIG_RELAY is not set 175# CONFIG_RELAY is not set
181CONFIG_INITRAMFS_SOURCE="" 176CONFIG_INITRAMFS_SOURCE=""
182# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 177# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
178CONFIG_SYSCTL=y
183CONFIG_EMBEDDED=y 179CONFIG_EMBEDDED=y
180# CONFIG_SYSCTL_SYSCALL is not set
184CONFIG_KALLSYMS=y 181CONFIG_KALLSYMS=y
185# CONFIG_KALLSYMS_EXTRA_PASS is not set 182# CONFIG_KALLSYMS_EXTRA_PASS is not set
186CONFIG_HOTPLUG=y 183CONFIG_HOTPLUG=y
@@ -188,12 +185,12 @@ CONFIG_PRINTK=y
188CONFIG_BUG=y 185CONFIG_BUG=y
189CONFIG_ELF_CORE=y 186CONFIG_ELF_CORE=y
190CONFIG_BASE_FULL=y 187CONFIG_BASE_FULL=y
191CONFIG_RT_MUTEXES=y
192CONFIG_FUTEX=y 188CONFIG_FUTEX=y
193CONFIG_EPOLL=y 189CONFIG_EPOLL=y
194CONFIG_SHMEM=y 190CONFIG_SHMEM=y
195CONFIG_SLAB=y 191CONFIG_SLAB=y
196CONFIG_VM_EVENT_COUNTERS=y 192CONFIG_VM_EVENT_COUNTERS=y
193CONFIG_RT_MUTEXES=y
197# CONFIG_TINY_SHMEM is not set 194# CONFIG_TINY_SHMEM is not set
198CONFIG_BASE_SMALL=0 195CONFIG_BASE_SMALL=0
199# CONFIG_SLOB is not set 196# CONFIG_SLOB is not set
@@ -210,6 +207,7 @@ CONFIG_KMOD=y
210# 207#
211# Block layer 208# Block layer
212# 209#
210CONFIG_BLOCK=y
213# CONFIG_LBD is not set 211# CONFIG_LBD is not set
214# CONFIG_BLK_DEV_IO_TRACE is not set 212# CONFIG_BLK_DEV_IO_TRACE is not set
215# CONFIG_LSF is not set 213# CONFIG_LSF is not set
@@ -230,8 +228,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
230# 228#
231# Bus options (PCI, PCMCIA, EISA, ISA, TC) 229# Bus options (PCI, PCMCIA, EISA, ISA, TC)
232# 230#
233CONFIG_HW_HAS_EISA=y 231CONFIG_HW_HAS_PCI=y
234# CONFIG_EISA is not set 232CONFIG_PCI=y
233# CONFIG_PCI_MULTITHREAD_PROBE is not set
235CONFIG_MMU=y 234CONFIG_MMU=y
236 235
237# 236#
@@ -242,6 +241,7 @@ CONFIG_MMU=y
242# 241#
243# PCI Hotplug Support 242# PCI Hotplug Support
244# 243#
244# CONFIG_HOTPLUG_PCI is not set
245 245
246# 246#
247# Executable file formats 247# Executable file formats
@@ -264,6 +264,7 @@ CONFIG_PACKET=y
264CONFIG_UNIX=y 264CONFIG_UNIX=y
265CONFIG_XFRM=y 265CONFIG_XFRM=y
266# CONFIG_XFRM_USER is not set 266# CONFIG_XFRM_USER is not set
267# CONFIG_XFRM_SUB_POLICY is not set
267# CONFIG_NET_KEY is not set 268# CONFIG_NET_KEY is not set
268CONFIG_INET=y 269CONFIG_INET=y
269# CONFIG_IP_MULTICAST is not set 270# CONFIG_IP_MULTICAST is not set
@@ -282,12 +283,14 @@ CONFIG_IP_PNP=y
282# CONFIG_INET_IPCOMP is not set 283# CONFIG_INET_IPCOMP is not set
283# CONFIG_INET_XFRM_TUNNEL is not set 284# CONFIG_INET_XFRM_TUNNEL is not set
284# CONFIG_INET_TUNNEL is not set 285# CONFIG_INET_TUNNEL is not set
285CONFIG_INET_XFRM_MODE_TRANSPORT=m 286CONFIG_INET_XFRM_MODE_TRANSPORT=y
286CONFIG_INET_XFRM_MODE_TUNNEL=m 287CONFIG_INET_XFRM_MODE_TUNNEL=y
288CONFIG_INET_XFRM_MODE_BEET=y
287CONFIG_INET_DIAG=y 289CONFIG_INET_DIAG=y
288CONFIG_INET_TCP_DIAG=y 290CONFIG_INET_TCP_DIAG=y
289# CONFIG_TCP_CONG_ADVANCED is not set 291# CONFIG_TCP_CONG_ADVANCED is not set
290CONFIG_TCP_CONG_BIC=y 292CONFIG_TCP_CONG_CUBIC=y
293CONFIG_DEFAULT_TCP_CONG="cubic"
291 294
292# 295#
293# IP: Virtual Server Configuration 296# IP: Virtual Server Configuration
@@ -300,12 +303,18 @@ CONFIG_IPV6_ROUTE_INFO=y
300# CONFIG_INET6_AH is not set 303# CONFIG_INET6_AH is not set
301# CONFIG_INET6_ESP is not set 304# CONFIG_INET6_ESP is not set
302# CONFIG_INET6_IPCOMP is not set 305# CONFIG_INET6_IPCOMP is not set
306# CONFIG_IPV6_MIP6 is not set
303# CONFIG_INET6_XFRM_TUNNEL is not set 307# CONFIG_INET6_XFRM_TUNNEL is not set
304# CONFIG_INET6_TUNNEL is not set 308# CONFIG_INET6_TUNNEL is not set
305CONFIG_INET6_XFRM_MODE_TRANSPORT=m 309CONFIG_INET6_XFRM_MODE_TRANSPORT=m
306CONFIG_INET6_XFRM_MODE_TUNNEL=m 310CONFIG_INET6_XFRM_MODE_TUNNEL=m
311CONFIG_INET6_XFRM_MODE_BEET=m
312# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
313CONFIG_IPV6_SIT=m
307# CONFIG_IPV6_TUNNEL is not set 314# CONFIG_IPV6_TUNNEL is not set
308CONFIG_NETWORK_SECMARK=y 315# CONFIG_IPV6_SUBTREES is not set
316# CONFIG_IPV6_MULTIPLE_TABLES is not set
317# CONFIG_NETWORK_SECMARK is not set
309CONFIG_NETFILTER=y 318CONFIG_NETFILTER=y
310# CONFIG_NETFILTER_DEBUG is not set 319# CONFIG_NETFILTER_DEBUG is not set
311 320
@@ -318,9 +327,9 @@ CONFIG_NETFILTER_XTABLES=m
318CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m 327CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
319CONFIG_NETFILTER_XT_TARGET_MARK=m 328CONFIG_NETFILTER_XT_TARGET_MARK=m
320CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 329CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
321CONFIG_NETFILTER_XT_TARGET_SECMARK=m
322CONFIG_NETFILTER_XT_MATCH_COMMENT=m 330CONFIG_NETFILTER_XT_MATCH_COMMENT=m
323CONFIG_NETFILTER_XT_MATCH_DCCP=m 331CONFIG_NETFILTER_XT_MATCH_DCCP=m
332# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
324CONFIG_NETFILTER_XT_MATCH_ESP=m 333CONFIG_NETFILTER_XT_MATCH_ESP=m
325CONFIG_NETFILTER_XT_MATCH_LENGTH=m 334CONFIG_NETFILTER_XT_MATCH_LENGTH=m
326CONFIG_NETFILTER_XT_MATCH_LIMIT=m 335CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -329,10 +338,10 @@ CONFIG_NETFILTER_XT_MATCH_MARK=m
329# CONFIG_NETFILTER_XT_MATCH_POLICY is not set 338# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
330CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m 339CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
331CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m 340CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
332CONFIG_NETFILTER_XT_MATCH_QUOTA=m 341# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
333CONFIG_NETFILTER_XT_MATCH_REALM=m 342CONFIG_NETFILTER_XT_MATCH_REALM=m
334CONFIG_NETFILTER_XT_MATCH_SCTP=m 343CONFIG_NETFILTER_XT_MATCH_SCTP=m
335CONFIG_NETFILTER_XT_MATCH_STATISTIC=m 344# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
336CONFIG_NETFILTER_XT_MATCH_STRING=m 345CONFIG_NETFILTER_XT_MATCH_STRING=m
337CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 346CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
338 347
@@ -373,7 +382,6 @@ CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
373# CONFIG_ATALK is not set 382# CONFIG_ATALK is not set
374# CONFIG_X25 is not set 383# CONFIG_X25 is not set
375# CONFIG_LAPB is not set 384# CONFIG_LAPB is not set
376# CONFIG_NET_DIVERT is not set
377# CONFIG_ECONET is not set 385# CONFIG_ECONET is not set
378# CONFIG_WAN_ROUTER is not set 386# CONFIG_WAN_ROUTER is not set
379 387
@@ -426,13 +434,20 @@ CONFIG_FW_LOADER=y
426# 434#
427# Block devices 435# Block devices
428# 436#
437# CONFIG_BLK_CPQ_DA is not set
438# CONFIG_BLK_CPQ_CISS_DA is not set
439# CONFIG_BLK_DEV_DAC960 is not set
440# CONFIG_BLK_DEV_UMEM is not set
429# CONFIG_BLK_DEV_COW_COMMON is not set 441# CONFIG_BLK_DEV_COW_COMMON is not set
430CONFIG_BLK_DEV_LOOP=y 442CONFIG_BLK_DEV_LOOP=y
431# CONFIG_BLK_DEV_CRYPTOLOOP is not set 443# CONFIG_BLK_DEV_CRYPTOLOOP is not set
432# CONFIG_BLK_DEV_NBD is not set 444# CONFIG_BLK_DEV_NBD is not set
445# CONFIG_BLK_DEV_SX8 is not set
446# CONFIG_BLK_DEV_UB is not set
433CONFIG_BLK_DEV_RAM=y 447CONFIG_BLK_DEV_RAM=y
434CONFIG_BLK_DEV_RAM_COUNT=16 448CONFIG_BLK_DEV_RAM_COUNT=16
435CONFIG_BLK_DEV_RAM_SIZE=8192 449CONFIG_BLK_DEV_RAM_SIZE=8192
450CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
436CONFIG_BLK_DEV_INITRD=y 451CONFIG_BLK_DEV_INITRD=y
437# CONFIG_CDROM_PKTCDVD is not set 452# CONFIG_CDROM_PKTCDVD is not set
438# CONFIG_ATA_OVER_ETH is not set 453# CONFIG_ATA_OVER_ETH is not set
@@ -441,6 +456,7 @@ CONFIG_BLK_DEV_INITRD=y
441# ATA/ATAPI/MFM/RLL support 456# ATA/ATAPI/MFM/RLL support
442# 457#
443CONFIG_IDE=y 458CONFIG_IDE=y
459CONFIG_IDE_MAX_HWIFS=4
444CONFIG_BLK_DEV_IDE=y 460CONFIG_BLK_DEV_IDE=y
445 461
446# 462#
@@ -459,9 +475,41 @@ CONFIG_IDEDISK_MULTI_MODE=y
459# IDE chipset support/bugfixes 475# IDE chipset support/bugfixes
460# 476#
461CONFIG_IDE_GENERIC=y 477CONFIG_IDE_GENERIC=y
478CONFIG_BLK_DEV_IDEPCI=y
479CONFIG_IDEPCI_SHARE_IRQ=y
480# CONFIG_BLK_DEV_OFFBOARD is not set
481# CONFIG_BLK_DEV_GENERIC is not set
482# CONFIG_BLK_DEV_OPTI621 is not set
483CONFIG_BLK_DEV_IDEDMA_PCI=y
484# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
485CONFIG_IDEDMA_PCI_AUTO=y
486# CONFIG_IDEDMA_ONLYDISK is not set
487# CONFIG_BLK_DEV_AEC62XX is not set
488# CONFIG_BLK_DEV_ALI15X3 is not set
489# CONFIG_BLK_DEV_AMD74XX is not set
490CONFIG_BLK_DEV_CMD64X=y
491# CONFIG_BLK_DEV_TRIFLEX is not set
492# CONFIG_BLK_DEV_CY82C693 is not set
493# CONFIG_BLK_DEV_CS5520 is not set
494# CONFIG_BLK_DEV_CS5530 is not set
495# CONFIG_BLK_DEV_HPT34X is not set
496# CONFIG_BLK_DEV_HPT366 is not set
497# CONFIG_BLK_DEV_JMICRON is not set
498# CONFIG_BLK_DEV_SC1200 is not set
499# CONFIG_BLK_DEV_PIIX is not set
500# CONFIG_BLK_DEV_IT821X is not set
501# CONFIG_BLK_DEV_NS87415 is not set
502# CONFIG_BLK_DEV_PDC202XX_OLD is not set
503# CONFIG_BLK_DEV_PDC202XX_NEW is not set
504# CONFIG_BLK_DEV_SVWKS is not set
505# CONFIG_BLK_DEV_SIIMAGE is not set
506# CONFIG_BLK_DEV_SLC90E66 is not set
507# CONFIG_BLK_DEV_TRM290 is not set
508# CONFIG_BLK_DEV_VIA82CXXX is not set
462# CONFIG_IDE_ARM is not set 509# CONFIG_IDE_ARM is not set
463# CONFIG_BLK_DEV_IDEDMA is not set 510CONFIG_BLK_DEV_IDEDMA=y
464# CONFIG_IDEDMA_AUTO is not set 511# CONFIG_IDEDMA_IVB is not set
512CONFIG_IDEDMA_AUTO=y
465# CONFIG_BLK_DEV_HD is not set 513# CONFIG_BLK_DEV_HD is not set
466 514
467# 515#
@@ -469,6 +517,7 @@ CONFIG_IDE_GENERIC=y
469# 517#
470# CONFIG_RAID_ATTRS is not set 518# CONFIG_RAID_ATTRS is not set
471CONFIG_SCSI=y 519CONFIG_SCSI=y
520CONFIG_SCSI_NETLINK=y
472CONFIG_SCSI_PROC_FS=y 521CONFIG_SCSI_PROC_FS=y
473 522
474# 523#
@@ -489,22 +538,59 @@ CONFIG_BLK_DEV_SD=y
489# CONFIG_SCSI_LOGGING is not set 538# CONFIG_SCSI_LOGGING is not set
490 539
491# 540#
492# SCSI Transport Attributes 541# SCSI Transports
493# 542#
494CONFIG_SCSI_SPI_ATTRS=m 543CONFIG_SCSI_SPI_ATTRS=m
495CONFIG_SCSI_FC_ATTRS=y 544CONFIG_SCSI_FC_ATTRS=y
496CONFIG_SCSI_ISCSI_ATTRS=m 545CONFIG_SCSI_ISCSI_ATTRS=m
497# CONFIG_SCSI_SAS_ATTRS is not set 546# CONFIG_SCSI_SAS_ATTRS is not set
547# CONFIG_SCSI_SAS_LIBSAS is not set
498 548
499# 549#
500# SCSI low-level drivers 550# SCSI low-level drivers
501# 551#
502CONFIG_ISCSI_TCP=m 552CONFIG_ISCSI_TCP=m
503# CONFIG_SGIWD93_SCSI is not set 553# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
504# CONFIG_SCSI_SATA is not set 554# CONFIG_SCSI_3W_9XXX is not set
555# CONFIG_SCSI_ACARD is not set
556# CONFIG_SCSI_AACRAID is not set
557CONFIG_SCSI_AIC7XXX=m
558CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
559CONFIG_AIC7XXX_RESET_DELAY_MS=15000
560# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
561CONFIG_AIC7XXX_DEBUG_MASK=0
562# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
563# CONFIG_SCSI_AIC7XXX_OLD is not set
564# CONFIG_SCSI_AIC79XX is not set
565# CONFIG_SCSI_AIC94XX is not set
566# CONFIG_SCSI_DPT_I2O is not set
567# CONFIG_SCSI_ARCMSR is not set
568# CONFIG_MEGARAID_NEWGEN is not set
569# CONFIG_MEGARAID_LEGACY is not set
570# CONFIG_MEGARAID_SAS is not set
571# CONFIG_SCSI_HPTIOP is not set
572# CONFIG_SCSI_DMX3191D is not set
573# CONFIG_SCSI_FUTURE_DOMAIN is not set
574# CONFIG_SCSI_IPS is not set
575# CONFIG_SCSI_INITIO is not set
576# CONFIG_SCSI_INIA100 is not set
577# CONFIG_SCSI_STEX is not set
578# CONFIG_SCSI_SYM53C8XX_2 is not set
579# CONFIG_SCSI_QLOGIC_1280 is not set
580# CONFIG_SCSI_QLA_FC is not set
581# CONFIG_SCSI_QLA_ISCSI is not set
582# CONFIG_SCSI_LPFC is not set
583# CONFIG_SCSI_DC395x is not set
584# CONFIG_SCSI_DC390T is not set
585# CONFIG_SCSI_NSP32 is not set
505# CONFIG_SCSI_DEBUG is not set 586# CONFIG_SCSI_DEBUG is not set
506 587
507# 588#
589# Serial ATA (prod) and Parallel ATA (experimental) drivers
590#
591# CONFIG_ATA is not set
592
593#
508# Multi-device support (RAID and LVM) 594# Multi-device support (RAID and LVM)
509# 595#
510# CONFIG_MD is not set 596# CONFIG_MD is not set
@@ -513,14 +599,19 @@ CONFIG_ISCSI_TCP=m
513# Fusion MPT device support 599# Fusion MPT device support
514# 600#
515# CONFIG_FUSION is not set 601# CONFIG_FUSION is not set
602# CONFIG_FUSION_SPI is not set
603# CONFIG_FUSION_FC is not set
604# CONFIG_FUSION_SAS is not set
516 605
517# 606#
518# IEEE 1394 (FireWire) support 607# IEEE 1394 (FireWire) support
519# 608#
609# CONFIG_IEEE1394 is not set
520 610
521# 611#
522# I2O device support 612# I2O device support
523# 613#
614# CONFIG_I2O is not set
524 615
525# 616#
526# Network device support 617# Network device support
@@ -532,6 +623,11 @@ CONFIG_NETDEVICES=y
532CONFIG_TUN=m 623CONFIG_TUN=m
533 624
534# 625#
626# ARCnet devices
627#
628# CONFIG_ARCNET is not set
629
630#
535# PHY device support 631# PHY device support
536# 632#
537# CONFIG_PHYLIB is not set 633# CONFIG_PHYLIB is not set
@@ -541,20 +637,73 @@ CONFIG_TUN=m
541# 637#
542CONFIG_NET_ETHERNET=y 638CONFIG_NET_ETHERNET=y
543CONFIG_MII=y 639CONFIG_MII=y
640# CONFIG_HAPPYMEAL is not set
641# CONFIG_SUNGEM is not set
642# CONFIG_CASSINI is not set
643# CONFIG_NET_VENDOR_3COM is not set
544# CONFIG_DM9000 is not set 644# CONFIG_DM9000 is not set
545# CONFIG_SGISEEQ is not set 645
646#
647# Tulip family network device support
648#
649# CONFIG_NET_TULIP is not set
650# CONFIG_HP100 is not set
651CONFIG_NET_PCI=y
652# CONFIG_PCNET32 is not set
653# CONFIG_AMD8111_ETH is not set
654# CONFIG_ADAPTEC_STARFIRE is not set
655# CONFIG_B44 is not set
656# CONFIG_FORCEDETH is not set
657# CONFIG_DGRS is not set
658# CONFIG_EEPRO100 is not set
659# CONFIG_E100 is not set
660# CONFIG_FEALNX is not set
661CONFIG_NATSEMI=y
662# CONFIG_NE2K_PCI is not set
663# CONFIG_8139CP is not set
664CONFIG_8139TOO=y
665# CONFIG_8139TOO_PIO is not set
666# CONFIG_8139TOO_TUNE_TWISTER is not set
667# CONFIG_8139TOO_8129 is not set
668# CONFIG_8139_OLD_RX_RESET is not set
669# CONFIG_SIS900 is not set
670# CONFIG_EPIC100 is not set
671# CONFIG_SUNDANCE is not set
672# CONFIG_TLAN is not set
673# CONFIG_VIA_RHINE is not set
674# CONFIG_LAN_SAA9730 is not set
546 675
547# 676#
548# Ethernet (1000 Mbit) 677# Ethernet (1000 Mbit)
549# 678#
679# CONFIG_ACENIC is not set
680# CONFIG_DL2K is not set
681# CONFIG_E1000 is not set
682# CONFIG_NS83820 is not set
683# CONFIG_HAMACHI is not set
684# CONFIG_YELLOWFIN is not set
685# CONFIG_R8169 is not set
686# CONFIG_SIS190 is not set
687# CONFIG_SKGE is not set
688# CONFIG_SKY2 is not set
689# CONFIG_SK98LIN is not set
690# CONFIG_VIA_VELOCITY is not set
691# CONFIG_TIGON3 is not set
692# CONFIG_BNX2 is not set
693# CONFIG_QLA3XXX is not set
550 694
551# 695#
552# Ethernet (10000 Mbit) 696# Ethernet (10000 Mbit)
553# 697#
698# CONFIG_CHELSIO_T1 is not set
699# CONFIG_IXGB is not set
700# CONFIG_S2IO is not set
701# CONFIG_MYRI10GE is not set
554 702
555# 703#
556# Token Ring devices 704# Token Ring devices
557# 705#
706# CONFIG_TR is not set
558 707
559# 708#
560# Wireless LAN (non-hamradio) 709# Wireless LAN (non-hamradio)
@@ -565,6 +714,8 @@ CONFIG_MII=y
565# Wan interfaces 714# Wan interfaces
566# 715#
567# CONFIG_WAN is not set 716# CONFIG_WAN is not set
717# CONFIG_FDDI is not set
718# CONFIG_HIPPI is not set
568CONFIG_PPP=m 719CONFIG_PPP=m
569# CONFIG_PPP_MULTILINK is not set 720# CONFIG_PPP_MULTILINK is not set
570# CONFIG_PPP_FILTER is not set 721# CONFIG_PPP_FILTER is not set
@@ -575,6 +726,8 @@ CONFIG_PPP_DEFLATE=m
575CONFIG_PPP_MPPE=m 726CONFIG_PPP_MPPE=m
576# CONFIG_PPPOE is not set 727# CONFIG_PPPOE is not set
577# CONFIG_SLIP is not set 728# CONFIG_SLIP is not set
729CONFIG_SLHC=m
730# CONFIG_NET_FC is not set
578# CONFIG_SHAPER is not set 731# CONFIG_SHAPER is not set
579# CONFIG_NETCONSOLE is not set 732# CONFIG_NETCONSOLE is not set
580# CONFIG_NETPOLL is not set 733# CONFIG_NETPOLL is not set
@@ -594,6 +747,7 @@ CONFIG_PPP_MPPE=m
594# Input device support 747# Input device support
595# 748#
596CONFIG_INPUT=y 749CONFIG_INPUT=y
750# CONFIG_INPUT_FF_MEMLESS is not set
597 751
598# 752#
599# Userland interfaces 753# Userland interfaces
@@ -616,6 +770,7 @@ CONFIG_KEYBOARD_ATKBD=y
616# CONFIG_KEYBOARD_LKKBD is not set 770# CONFIG_KEYBOARD_LKKBD is not set
617# CONFIG_KEYBOARD_XTKBD is not set 771# CONFIG_KEYBOARD_XTKBD is not set
618# CONFIG_KEYBOARD_NEWTON is not set 772# CONFIG_KEYBOARD_NEWTON is not set
773# CONFIG_KEYBOARD_STOWAWAY is not set
619CONFIG_INPUT_MOUSE=y 774CONFIG_INPUT_MOUSE=y
620CONFIG_MOUSE_PS2=y 775CONFIG_MOUSE_PS2=y
621# CONFIG_MOUSE_SERIAL is not set 776# CONFIG_MOUSE_SERIAL is not set
@@ -630,6 +785,7 @@ CONFIG_MOUSE_PS2=y
630CONFIG_SERIO=y 785CONFIG_SERIO=y
631CONFIG_SERIO_I8042=y 786CONFIG_SERIO_I8042=y
632CONFIG_SERIO_SERPORT=y 787CONFIG_SERIO_SERPORT=y
788# CONFIG_SERIO_PCIPS2 is not set
633CONFIG_SERIO_LIBPS2=y 789CONFIG_SERIO_LIBPS2=y
634# CONFIG_SERIO_RAW is not set 790# CONFIG_SERIO_RAW is not set
635# CONFIG_GAMEPORT is not set 791# CONFIG_GAMEPORT is not set
@@ -640,7 +796,7 @@ CONFIG_SERIO_LIBPS2=y
640CONFIG_VT=y 796CONFIG_VT=y
641# CONFIG_VT_CONSOLE is not set 797# CONFIG_VT_CONSOLE is not set
642CONFIG_HW_CONSOLE=y 798CONFIG_HW_CONSOLE=y
643CONFIG_VT_HW_CONSOLE_BINDING=y 799# CONFIG_VT_HW_CONSOLE_BINDING is not set
644CONFIG_SERIAL_NONSTANDARD=y 800CONFIG_SERIAL_NONSTANDARD=y
645# CONFIG_COMPUTONE is not set 801# CONFIG_COMPUTONE is not set
646# CONFIG_ROCKETPORT is not set 802# CONFIG_ROCKETPORT is not set
@@ -650,6 +806,7 @@ CONFIG_SERIAL_NONSTANDARD=y
650# CONFIG_MOXA_SMARTIO is not set 806# CONFIG_MOXA_SMARTIO is not set
651# CONFIG_ISI is not set 807# CONFIG_ISI is not set
652# CONFIG_SYNCLINKMP is not set 808# CONFIG_SYNCLINKMP is not set
809# CONFIG_SYNCLINK_GT is not set
653# CONFIG_N_HDLC is not set 810# CONFIG_N_HDLC is not set
654# CONFIG_RISCOM8 is not set 811# CONFIG_RISCOM8 is not set
655# CONFIG_SPECIALIX is not set 812# CONFIG_SPECIALIX is not set
@@ -665,7 +822,8 @@ CONFIG_SERIAL_NONSTANDARD=y
665# 822#
666# Non-8250 serial port support 823# Non-8250 serial port support
667# 824#
668# CONFIG_SERIAL_IP22_ZILOG is not set 825# CONFIG_SERIAL_IP3106 is not set
826# CONFIG_SERIAL_JSM is not set
669CONFIG_UNIX98_PTYS=y 827CONFIG_UNIX98_PTYS=y
670CONFIG_LEGACY_PTYS=y 828CONFIG_LEGACY_PTYS=y
671CONFIG_LEGACY_PTY_COUNT=256 829CONFIG_LEGACY_PTY_COUNT=256
@@ -679,16 +837,17 @@ CONFIG_LEGACY_PTY_COUNT=256
679# Watchdog Cards 837# Watchdog Cards
680# 838#
681# CONFIG_WATCHDOG is not set 839# CONFIG_WATCHDOG is not set
682# CONFIG_HW_RANDOM is not set 840CONFIG_HW_RANDOM=y
683# CONFIG_RTC is not set 841# CONFIG_RTC is not set
684# CONFIG_SGI_DS1286 is not set
685# CONFIG_GEN_RTC is not set 842# CONFIG_GEN_RTC is not set
686# CONFIG_DTLK is not set 843# CONFIG_DTLK is not set
687# CONFIG_R3964 is not set 844# CONFIG_R3964 is not set
845# CONFIG_APPLICOM is not set
688 846
689# 847#
690# Ftape, the floppy tape device driver 848# Ftape, the floppy tape device driver
691# 849#
850# CONFIG_DRM is not set
692# CONFIG_RAW_DRIVER is not set 851# CONFIG_RAW_DRIVER is not set
693 852
694# 853#
@@ -709,14 +868,30 @@ CONFIG_I2C_CHARDEV=m
709CONFIG_I2C_ALGOBIT=m 868CONFIG_I2C_ALGOBIT=m
710# CONFIG_I2C_ALGOPCF is not set 869# CONFIG_I2C_ALGOPCF is not set
711# CONFIG_I2C_ALGOPCA is not set 870# CONFIG_I2C_ALGOPCA is not set
712# CONFIG_I2C_ALGO_SGI is not set
713 871
714# 872#
715# I2C Hardware Bus support 873# I2C Hardware Bus support
716# 874#
875# CONFIG_I2C_ALI1535 is not set
876# CONFIG_I2C_ALI1563 is not set
877# CONFIG_I2C_ALI15X3 is not set
878# CONFIG_I2C_AMD756 is not set
879# CONFIG_I2C_AMD8111 is not set
880# CONFIG_I2C_I801 is not set
881# CONFIG_I2C_I810 is not set
882# CONFIG_I2C_PIIX4 is not set
883# CONFIG_I2C_NFORCE2 is not set
717# CONFIG_I2C_OCORES is not set 884# CONFIG_I2C_OCORES is not set
718# CONFIG_I2C_PARPORT_LIGHT is not set 885# CONFIG_I2C_PARPORT_LIGHT is not set
886# CONFIG_I2C_PROSAVAGE is not set
887# CONFIG_I2C_SAVAGE4 is not set
888# CONFIG_I2C_SIS5595 is not set
889# CONFIG_I2C_SIS630 is not set
890# CONFIG_I2C_SIS96X is not set
719# CONFIG_I2C_STUB is not set 891# CONFIG_I2C_STUB is not set
892# CONFIG_I2C_VIA is not set
893# CONFIG_I2C_VIAPRO is not set
894# CONFIG_I2C_VOODOO3 is not set
720# CONFIG_I2C_PCA_ISA is not set 895# CONFIG_I2C_PCA_ISA is not set
721 896
722# 897#
@@ -776,9 +951,13 @@ CONFIG_HWMON=y
776# CONFIG_SENSORS_LM92 is not set 951# CONFIG_SENSORS_LM92 is not set
777# CONFIG_SENSORS_MAX1619 is not set 952# CONFIG_SENSORS_MAX1619 is not set
778# CONFIG_SENSORS_PC87360 is not set 953# CONFIG_SENSORS_PC87360 is not set
954# CONFIG_SENSORS_SIS5595 is not set
779# CONFIG_SENSORS_SMSC47M1 is not set 955# CONFIG_SENSORS_SMSC47M1 is not set
780# CONFIG_SENSORS_SMSC47M192 is not set 956# CONFIG_SENSORS_SMSC47M192 is not set
781# CONFIG_SENSORS_SMSC47B397 is not set 957# CONFIG_SENSORS_SMSC47B397 is not set
958# CONFIG_SENSORS_VIA686A is not set
959# CONFIG_SENSORS_VT1211 is not set
960# CONFIG_SENSORS_VT8231 is not set
782# CONFIG_SENSORS_W83781D is not set 961# CONFIG_SENSORS_W83781D is not set
783# CONFIG_SENSORS_W83791D is not set 962# CONFIG_SENSORS_W83791D is not set
784# CONFIG_SENSORS_W83792D is not set 963# CONFIG_SENSORS_W83792D is not set
@@ -790,23 +969,25 @@ CONFIG_HWMON=y
790# 969#
791# Misc devices 970# Misc devices
792# 971#
972# CONFIG_TIFM_CORE is not set
793 973
794# 974#
795# Multimedia devices 975# Multimedia devices
796# 976#
797# CONFIG_VIDEO_DEV is not set 977# CONFIG_VIDEO_DEV is not set
798CONFIG_VIDEO_V4L2=y
799 978
800# 979#
801# Digital Video Broadcasting Devices 980# Digital Video Broadcasting Devices
802# 981#
803# CONFIG_DVB is not set 982# CONFIG_DVB is not set
983# CONFIG_USB_DABUSB is not set
804 984
805# 985#
806# Graphics support 986# Graphics support
807# 987#
808# CONFIG_FIRMWARE_EDID is not set 988CONFIG_FIRMWARE_EDID=y
809CONFIG_FB=y 989CONFIG_FB=y
990# CONFIG_FB_DDC is not set
810# CONFIG_FB_CFB_FILLRECT is not set 991# CONFIG_FB_CFB_FILLRECT is not set
811# CONFIG_FB_CFB_COPYAREA is not set 992# CONFIG_FB_CFB_COPYAREA is not set
812# CONFIG_FB_CFB_IMAGEBLIT is not set 993# CONFIG_FB_CFB_IMAGEBLIT is not set
@@ -814,14 +995,32 @@ CONFIG_FB=y
814# CONFIG_FB_BACKLIGHT is not set 995# CONFIG_FB_BACKLIGHT is not set
815# CONFIG_FB_MODE_HELPERS is not set 996# CONFIG_FB_MODE_HELPERS is not set
816# CONFIG_FB_TILEBLITTING is not set 997# CONFIG_FB_TILEBLITTING is not set
998# CONFIG_FB_CIRRUS is not set
999# CONFIG_FB_PM2 is not set
1000# CONFIG_FB_CYBER2000 is not set
1001# CONFIG_FB_ASILIANT is not set
1002# CONFIG_FB_IMSTT is not set
817# CONFIG_FB_S1D13XXX is not set 1003# CONFIG_FB_S1D13XXX is not set
1004# CONFIG_FB_NVIDIA is not set
1005# CONFIG_FB_RIVA is not set
1006# CONFIG_FB_MATROX is not set
1007# CONFIG_FB_RADEON is not set
1008# CONFIG_FB_ATY128 is not set
1009# CONFIG_FB_ATY is not set
1010# CONFIG_FB_SAVAGE is not set
1011# CONFIG_FB_SIS is not set
1012# CONFIG_FB_NEOMAGIC is not set
1013# CONFIG_FB_KYRO is not set
1014# CONFIG_FB_3DFX is not set
1015# CONFIG_FB_VOODOO1 is not set
1016# CONFIG_FB_SMIVGX is not set
1017# CONFIG_FB_TRIDENT is not set
818# CONFIG_FB_VIRTUAL is not set 1018# CONFIG_FB_VIRTUAL is not set
819 1019
820# 1020#
821# Console display driver support 1021# Console display driver support
822# 1022#
823# CONFIG_VGA_CONSOLE is not set 1023# CONFIG_VGA_CONSOLE is not set
824# CONFIG_SGI_NEWPORT_CONSOLE is not set
825CONFIG_DUMMY_CONSOLE=y 1024CONFIG_DUMMY_CONSOLE=y
826# CONFIG_FRAMEBUFFER_CONSOLE is not set 1025# CONFIG_FRAMEBUFFER_CONSOLE is not set
827 1026
@@ -839,15 +1038,129 @@ CONFIG_DUMMY_CONSOLE=y
839# 1038#
840# USB support 1039# USB support
841# 1040#
842# CONFIG_USB_ARCH_HAS_HCD is not set 1041CONFIG_USB_ARCH_HAS_HCD=y
843# CONFIG_USB_ARCH_HAS_OHCI is not set 1042CONFIG_USB_ARCH_HAS_OHCI=y
844# CONFIG_USB_ARCH_HAS_EHCI is not set 1043CONFIG_USB_ARCH_HAS_EHCI=y
1044CONFIG_USB=y
1045# CONFIG_USB_DEBUG is not set
1046
1047#
1048# Miscellaneous USB options
1049#
1050CONFIG_USB_DEVICEFS=y
1051# CONFIG_USB_BANDWIDTH is not set
1052# CONFIG_USB_DYNAMIC_MINORS is not set
1053# CONFIG_USB_OTG is not set
1054
1055#
1056# USB Host Controller Drivers
1057#
1058# CONFIG_USB_EHCI_HCD is not set
1059# CONFIG_USB_ISP116X_HCD is not set
1060# CONFIG_USB_OHCI_HCD is not set
1061# CONFIG_USB_UHCI_HCD is not set
1062# CONFIG_USB_SL811_HCD is not set
1063
1064#
1065# USB Device Class drivers
1066#
1067# CONFIG_USB_ACM is not set
1068# CONFIG_USB_PRINTER is not set
845 1069
846# 1070#
847# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1071# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
848# 1072#
849 1073
850# 1074#
1075# may also be needed; see USB_STORAGE Help for more information
1076#
1077CONFIG_USB_STORAGE=y
1078# CONFIG_USB_STORAGE_DEBUG is not set
1079# CONFIG_USB_STORAGE_DATAFAB is not set
1080# CONFIG_USB_STORAGE_FREECOM is not set
1081# CONFIG_USB_STORAGE_ISD200 is not set
1082# CONFIG_USB_STORAGE_DPCM is not set
1083# CONFIG_USB_STORAGE_USBAT is not set
1084# CONFIG_USB_STORAGE_SDDR09 is not set
1085# CONFIG_USB_STORAGE_SDDR55 is not set
1086# CONFIG_USB_STORAGE_JUMPSHOT is not set
1087# CONFIG_USB_STORAGE_ALAUDA is not set
1088# CONFIG_USB_STORAGE_ONETOUCH is not set
1089# CONFIG_USB_STORAGE_KARMA is not set
1090# CONFIG_USB_LIBUSUAL is not set
1091
1092#
1093# USB Input Devices
1094#
1095CONFIG_USB_HID=y
1096CONFIG_USB_HIDINPUT=y
1097# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1098# CONFIG_HID_FF is not set
1099CONFIG_USB_HIDDEV=y
1100# CONFIG_USB_AIPTEK is not set
1101# CONFIG_USB_WACOM is not set
1102# CONFIG_USB_ACECAD is not set
1103# CONFIG_USB_KBTAB is not set
1104# CONFIG_USB_POWERMATE is not set
1105# CONFIG_USB_TOUCHSCREEN is not set
1106# CONFIG_USB_YEALINK is not set
1107# CONFIG_USB_XPAD is not set
1108# CONFIG_USB_ATI_REMOTE is not set
1109# CONFIG_USB_ATI_REMOTE2 is not set
1110# CONFIG_USB_KEYSPAN_REMOTE is not set
1111# CONFIG_USB_APPLETOUCH is not set
1112# CONFIG_USB_TRANCEVIBRATOR is not set
1113
1114#
1115# USB Imaging devices
1116#
1117# CONFIG_USB_MDC800 is not set
1118# CONFIG_USB_MICROTEK is not set
1119
1120#
1121# USB Network Adapters
1122#
1123# CONFIG_USB_CATC is not set
1124# CONFIG_USB_KAWETH is not set
1125# CONFIG_USB_PEGASUS is not set
1126# CONFIG_USB_RTL8150 is not set
1127# CONFIG_USB_USBNET is not set
1128CONFIG_USB_MON=y
1129
1130#
1131# USB port drivers
1132#
1133
1134#
1135# USB Serial Converter support
1136#
1137# CONFIG_USB_SERIAL is not set
1138
1139#
1140# USB Miscellaneous drivers
1141#
1142# CONFIG_USB_EMI62 is not set
1143# CONFIG_USB_EMI26 is not set
1144# CONFIG_USB_ADUTUX is not set
1145# CONFIG_USB_AUERSWALD is not set
1146# CONFIG_USB_RIO500 is not set
1147# CONFIG_USB_LEGOTOWER is not set
1148# CONFIG_USB_LCD is not set
1149# CONFIG_USB_LED is not set
1150# CONFIG_USB_CYPRESS_CY7C63 is not set
1151# CONFIG_USB_CYTHERM is not set
1152# CONFIG_USB_PHIDGET is not set
1153# CONFIG_USB_IDMOUSE is not set
1154# CONFIG_USB_FTDI_ELAN is not set
1155# CONFIG_USB_APPLEDISPLAY is not set
1156# CONFIG_USB_LD is not set
1157# CONFIG_USB_TEST is not set
1158
1159#
1160# USB DSL modem support
1161#
1162
1163#
851# USB Gadget Support 1164# USB Gadget Support
852# 1165#
853# CONFIG_USB_GADGET is not set 1166# CONFIG_USB_GADGET is not set
@@ -873,6 +1186,7 @@ CONFIG_DUMMY_CONSOLE=y
873# 1186#
874# InfiniBand support 1187# InfiniBand support
875# 1188#
1189# CONFIG_INFINIBAND is not set
876 1190
877# 1191#
878# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1192# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -906,6 +1220,7 @@ CONFIG_EXT3_FS=y
906CONFIG_EXT3_FS_XATTR=y 1220CONFIG_EXT3_FS_XATTR=y
907# CONFIG_EXT3_FS_POSIX_ACL is not set 1221# CONFIG_EXT3_FS_POSIX_ACL is not set
908# CONFIG_EXT3_FS_SECURITY is not set 1222# CONFIG_EXT3_FS_SECURITY is not set
1223# CONFIG_EXT4DEV_FS is not set
909CONFIG_JBD=y 1224CONFIG_JBD=y
910# CONFIG_JBD_DEBUG is not set 1225# CONFIG_JBD_DEBUG is not set
911CONFIG_FS_MBCACHE=y 1226CONFIG_FS_MBCACHE=y
@@ -917,6 +1232,7 @@ CONFIG_XFS_FS=m
917# CONFIG_XFS_SECURITY is not set 1232# CONFIG_XFS_SECURITY is not set
918# CONFIG_XFS_POSIX_ACL is not set 1233# CONFIG_XFS_POSIX_ACL is not set
919# CONFIG_XFS_RT is not set 1234# CONFIG_XFS_RT is not set
1235# CONFIG_GFS2_FS is not set
920# CONFIG_OCFS2_FS is not set 1236# CONFIG_OCFS2_FS is not set
921# CONFIG_MINIX_FS is not set 1237# CONFIG_MINIX_FS is not set
922# CONFIG_ROMFS_FS is not set 1238# CONFIG_ROMFS_FS is not set
@@ -949,8 +1265,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
949# 1265#
950CONFIG_PROC_FS=y 1266CONFIG_PROC_FS=y
951# CONFIG_PROC_KCORE is not set 1267# CONFIG_PROC_KCORE is not set
1268CONFIG_PROC_SYSCTL=y
952CONFIG_SYSFS=y 1269CONFIG_SYSFS=y
953CONFIG_TMPFS=y 1270CONFIG_TMPFS=y
1271# CONFIG_TMPFS_POSIX_ACL is not set
954# CONFIG_HUGETLB_PAGE is not set 1272# CONFIG_HUGETLB_PAGE is not set
955CONFIG_RAMFS=y 1273CONFIG_RAMFS=y
956# CONFIG_CONFIGFS_FS is not set 1274# CONFIG_CONFIGFS_FS is not set
@@ -994,7 +1312,6 @@ CONFIG_SUNRPC=y
994CONFIG_SMB_FS=m 1312CONFIG_SMB_FS=m
995# CONFIG_SMB_NLS_DEFAULT is not set 1313# CONFIG_SMB_NLS_DEFAULT is not set
996# CONFIG_CIFS is not set 1314# CONFIG_CIFS is not set
997# CONFIG_CIFS_DEBUG2 is not set
998# CONFIG_NCP_FS is not set 1315# CONFIG_NCP_FS is not set
999# CONFIG_CODA_FS is not set 1316# CONFIG_CODA_FS is not set
1000# CONFIG_AFS_FS is not set 1317# CONFIG_AFS_FS is not set
@@ -1005,7 +1322,6 @@ CONFIG_SMB_FS=m
1005# 1322#
1006# CONFIG_PARTITION_ADVANCED is not set 1323# CONFIG_PARTITION_ADVANCED is not set
1007CONFIG_MSDOS_PARTITION=y 1324CONFIG_MSDOS_PARTITION=y
1008CONFIG_SGI_PARTITION=y
1009 1325
1010# 1326#
1011# Native Language Support 1327# Native Language Support
@@ -1061,11 +1377,13 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1061# 1377#
1062CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1378CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1063# CONFIG_PRINTK_TIME is not set 1379# CONFIG_PRINTK_TIME is not set
1380CONFIG_ENABLE_MUST_CHECK=y
1064# CONFIG_MAGIC_SYSRQ is not set 1381# CONFIG_MAGIC_SYSRQ is not set
1065# CONFIG_UNUSED_SYMBOLS is not set 1382# CONFIG_UNUSED_SYMBOLS is not set
1066# CONFIG_DEBUG_KERNEL is not set 1383# CONFIG_DEBUG_KERNEL is not set
1067CONFIG_LOG_BUF_SHIFT=14 1384CONFIG_LOG_BUF_SHIFT=14
1068# CONFIG_DEBUG_FS is not set 1385# CONFIG_DEBUG_FS is not set
1386# CONFIG_HEADERS_CHECK is not set
1069CONFIG_CROSSCOMPILE=y 1387CONFIG_CROSSCOMPILE=y
1070CONFIG_CMDLINE="" 1388CONFIG_CMDLINE=""
1071 1389
@@ -1079,6 +1397,9 @@ CONFIG_CMDLINE=""
1079# Cryptographic options 1397# Cryptographic options
1080# 1398#
1081CONFIG_CRYPTO=y 1399CONFIG_CRYPTO=y
1400CONFIG_CRYPTO_ALGAPI=m
1401CONFIG_CRYPTO_BLKCIPHER=m
1402CONFIG_CRYPTO_MANAGER=m
1082# CONFIG_CRYPTO_HMAC is not set 1403# CONFIG_CRYPTO_HMAC is not set
1083# CONFIG_CRYPTO_NULL is not set 1404# CONFIG_CRYPTO_NULL is not set
1084# CONFIG_CRYPTO_MD4 is not set 1405# CONFIG_CRYPTO_MD4 is not set
@@ -1088,6 +1409,8 @@ CONFIG_CRYPTO_SHA1=m
1088# CONFIG_CRYPTO_SHA512 is not set 1409# CONFIG_CRYPTO_SHA512 is not set
1089# CONFIG_CRYPTO_WP512 is not set 1410# CONFIG_CRYPTO_WP512 is not set
1090# CONFIG_CRYPTO_TGR192 is not set 1411# CONFIG_CRYPTO_TGR192 is not set
1412CONFIG_CRYPTO_ECB=m
1413CONFIG_CRYPTO_CBC=m
1091# CONFIG_CRYPTO_DES is not set 1414# CONFIG_CRYPTO_DES is not set
1092# CONFIG_CRYPTO_BLOWFISH is not set 1415# CONFIG_CRYPTO_BLOWFISH is not set
1093# CONFIG_CRYPTO_TWOFISH is not set 1416# CONFIG_CRYPTO_TWOFISH is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index ad7271b3f266..f7e8194809a1 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.19-rc2
4# Thu Jul 6 10:04:21 2006 4# Wed Oct 18 12:57:11 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -25,8 +25,6 @@ CONFIG_MIPS=y
25# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
26# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
27# CONFIG_MIPS_EV64120 is not set 27# CONFIG_MIPS_EV64120 is not set
28# CONFIG_MIPS_IVR is not set
29# CONFIG_MIPS_ITE8172 is not set
30# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set 29# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set 30# CONFIG_MIPS_ATLAS is not set
@@ -72,11 +70,11 @@ CONFIG_TANBAC_TB0287=y
72# CONFIG_VICTOR_MPC30X is not set 70# CONFIG_VICTOR_MPC30X is not set
73# CONFIG_ZAO_CAPCELLA is not set 71# CONFIG_ZAO_CAPCELLA is not set
74CONFIG_PCI_VR41XX=y 72CONFIG_PCI_VR41XX=y
75# CONFIG_VRC4173 is not set
76CONFIG_RWSEM_GENERIC_SPINLOCK=y 73CONFIG_RWSEM_GENERIC_SPINLOCK=y
77CONFIG_GENERIC_FIND_NEXT_BIT=y 74CONFIG_GENERIC_FIND_NEXT_BIT=y
78CONFIG_GENERIC_HWEIGHT=y 75CONFIG_GENERIC_HWEIGHT=y
79CONFIG_GENERIC_CALIBRATE_DELAY=y 76CONFIG_GENERIC_CALIBRATE_DELAY=y
77CONFIG_GENERIC_TIME=y
80CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 78CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
81CONFIG_DMA_NONCOHERENT=y 79CONFIG_DMA_NONCOHERENT=y
82CONFIG_DMA_NEED_PCI_MAP_STATE=y 80CONFIG_DMA_NEED_PCI_MAP_STATE=y
@@ -123,8 +121,8 @@ CONFIG_PAGE_SIZE_4KB=y
123# CONFIG_PAGE_SIZE_16KB is not set 121# CONFIG_PAGE_SIZE_16KB is not set
124# CONFIG_PAGE_SIZE_64KB is not set 122# CONFIG_PAGE_SIZE_64KB is not set
125CONFIG_MIPS_MT_DISABLED=y 123CONFIG_MIPS_MT_DISABLED=y
126# CONFIG_MIPS_MT_SMTC is not set
127# CONFIG_MIPS_MT_SMP is not set 124# CONFIG_MIPS_MT_SMP is not set
125# CONFIG_MIPS_MT_SMTC is not set
128# CONFIG_MIPS_VPE_LOADER is not set 126# CONFIG_MIPS_VPE_LOADER is not set
129CONFIG_CPU_HAS_SYNC=y 127CONFIG_CPU_HAS_SYNC=y
130CONFIG_GENERIC_HARDIRQS=y 128CONFIG_GENERIC_HARDIRQS=y
@@ -169,15 +167,19 @@ CONFIG_LOCALVERSION=""
169CONFIG_LOCALVERSION_AUTO=y 167CONFIG_LOCALVERSION_AUTO=y
170CONFIG_SWAP=y 168CONFIG_SWAP=y
171CONFIG_SYSVIPC=y 169CONFIG_SYSVIPC=y
170# CONFIG_IPC_NS is not set
172# CONFIG_POSIX_MQUEUE is not set 171# CONFIG_POSIX_MQUEUE is not set
173# CONFIG_BSD_PROCESS_ACCT is not set 172# CONFIG_BSD_PROCESS_ACCT is not set
174CONFIG_SYSCTL=y 173# CONFIG_TASKSTATS is not set
174# CONFIG_UTS_NS is not set
175# CONFIG_AUDIT is not set 175# CONFIG_AUDIT is not set
176# CONFIG_IKCONFIG is not set 176# CONFIG_IKCONFIG is not set
177# CONFIG_RELAY is not set 177# CONFIG_RELAY is not set
178CONFIG_INITRAMFS_SOURCE="" 178CONFIG_INITRAMFS_SOURCE=""
179# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 179# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
180CONFIG_SYSCTL=y
180CONFIG_EMBEDDED=y 181CONFIG_EMBEDDED=y
182# CONFIG_SYSCTL_SYSCALL is not set
181CONFIG_KALLSYMS=y 183CONFIG_KALLSYMS=y
182# CONFIG_KALLSYMS_EXTRA_PASS is not set 184# CONFIG_KALLSYMS_EXTRA_PASS is not set
183# CONFIG_HOTPLUG is not set 185# CONFIG_HOTPLUG is not set
@@ -185,12 +187,12 @@ CONFIG_PRINTK=y
185CONFIG_BUG=y 187CONFIG_BUG=y
186CONFIG_ELF_CORE=y 188CONFIG_ELF_CORE=y
187CONFIG_BASE_FULL=y 189CONFIG_BASE_FULL=y
188CONFIG_RT_MUTEXES=y
189CONFIG_FUTEX=y 190CONFIG_FUTEX=y
190CONFIG_EPOLL=y 191CONFIG_EPOLL=y
191CONFIG_SHMEM=y 192CONFIG_SHMEM=y
192CONFIG_SLAB=y 193CONFIG_SLAB=y
193CONFIG_VM_EVENT_COUNTERS=y 194CONFIG_VM_EVENT_COUNTERS=y
195CONFIG_RT_MUTEXES=y
194# CONFIG_TINY_SHMEM is not set 196# CONFIG_TINY_SHMEM is not set
195CONFIG_BASE_SMALL=0 197CONFIG_BASE_SMALL=0
196# CONFIG_SLOB is not set 198# CONFIG_SLOB is not set
@@ -208,6 +210,7 @@ CONFIG_KMOD=y
208# 210#
209# Block layer 211# Block layer
210# 212#
213CONFIG_BLOCK=y
211# CONFIG_LBD is not set 214# CONFIG_LBD is not set
212# CONFIG_BLK_DEV_IO_TRACE is not set 215# CONFIG_BLK_DEV_IO_TRACE is not set
213# CONFIG_LSF is not set 216# CONFIG_LSF is not set
@@ -230,17 +233,16 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
230# 233#
231CONFIG_HW_HAS_PCI=y 234CONFIG_HW_HAS_PCI=y
232CONFIG_PCI=y 235CONFIG_PCI=y
236# CONFIG_PCI_MULTITHREAD_PROBE is not set
233CONFIG_MMU=y 237CONFIG_MMU=y
234 238
235# 239#
236# PCCARD (PCMCIA/CardBus) support 240# PCCARD (PCMCIA/CardBus) support
237# 241#
238# CONFIG_PCCARD is not set
239 242
240# 243#
241# PCI Hotplug Support 244# PCI Hotplug Support
242# 245#
243# CONFIG_HOTPLUG_PCI is not set
244 246
245# 247#
246# Executable file formats 248# Executable file formats
@@ -263,6 +265,7 @@ CONFIG_PACKET=y
263CONFIG_UNIX=y 265CONFIG_UNIX=y
264CONFIG_XFRM=y 266CONFIG_XFRM=y
265# CONFIG_XFRM_USER is not set 267# CONFIG_XFRM_USER is not set
268# CONFIG_XFRM_SUB_POLICY is not set
266# CONFIG_NET_KEY is not set 269# CONFIG_NET_KEY is not set
267CONFIG_INET=y 270CONFIG_INET=y
268CONFIG_IP_MULTICAST=y 271CONFIG_IP_MULTICAST=y
@@ -291,13 +294,10 @@ CONFIG_SYN_COOKIES=y
291CONFIG_INET_TUNNEL=m 294CONFIG_INET_TUNNEL=m
292CONFIG_INET_XFRM_MODE_TRANSPORT=m 295CONFIG_INET_XFRM_MODE_TRANSPORT=m
293CONFIG_INET_XFRM_MODE_TUNNEL=m 296CONFIG_INET_XFRM_MODE_TUNNEL=m
297CONFIG_INET_XFRM_MODE_BEET=y
294CONFIG_INET_DIAG=y 298CONFIG_INET_DIAG=y
295CONFIG_INET_TCP_DIAG=y 299CONFIG_INET_TCP_DIAG=y
296CONFIG_TCP_CONG_ADVANCED=y 300CONFIG_TCP_CONG_ADVANCED=y
297
298#
299# TCP congestion control
300#
301CONFIG_TCP_CONG_BIC=y 301CONFIG_TCP_CONG_BIC=y
302CONFIG_TCP_CONG_CUBIC=m 302CONFIG_TCP_CONG_CUBIC=m
303CONFIG_TCP_CONG_WESTWOOD=m 303CONFIG_TCP_CONG_WESTWOOD=m
@@ -308,7 +308,13 @@ CONFIG_TCP_CONG_HTCP=m
308# CONFIG_TCP_CONG_SCALABLE is not set 308# CONFIG_TCP_CONG_SCALABLE is not set
309# CONFIG_TCP_CONG_LP is not set 309# CONFIG_TCP_CONG_LP is not set
310# CONFIG_TCP_CONG_VENO is not set 310# CONFIG_TCP_CONG_VENO is not set
311# CONFIG_TCP_CONG_COMPOUND is not set 311CONFIG_DEFAULT_BIC=y
312# CONFIG_DEFAULT_CUBIC is not set
313# CONFIG_DEFAULT_HTCP is not set
314# CONFIG_DEFAULT_VEGAS is not set
315# CONFIG_DEFAULT_WESTWOOD is not set
316# CONFIG_DEFAULT_RENO is not set
317CONFIG_DEFAULT_TCP_CONG="bic"
312# CONFIG_IPV6 is not set 318# CONFIG_IPV6 is not set
313# CONFIG_INET6_XFRM_TUNNEL is not set 319# CONFIG_INET6_XFRM_TUNNEL is not set
314# CONFIG_INET6_TUNNEL is not set 320# CONFIG_INET6_TUNNEL is not set
@@ -338,7 +344,6 @@ CONFIG_NETWORK_SECMARK=y
338# CONFIG_ATALK is not set 344# CONFIG_ATALK is not set
339# CONFIG_X25 is not set 345# CONFIG_X25 is not set
340# CONFIG_LAPB is not set 346# CONFIG_LAPB is not set
341# CONFIG_NET_DIVERT is not set
342# CONFIG_ECONET is not set 347# CONFIG_ECONET is not set
343# CONFIG_WAN_ROUTER is not set 348# CONFIG_WAN_ROUTER is not set
344 349
@@ -355,6 +360,7 @@ CONFIG_NETWORK_SECMARK=y
355# CONFIG_IRDA is not set 360# CONFIG_IRDA is not set
356# CONFIG_BT is not set 361# CONFIG_BT is not set
357# CONFIG_IEEE80211 is not set 362# CONFIG_IEEE80211 is not set
363CONFIG_FIB_RULES=y
358 364
359# 365#
360# Device Drivers 366# Device Drivers
@@ -365,7 +371,6 @@ CONFIG_NETWORK_SECMARK=y
365# 371#
366CONFIG_STANDALONE=y 372CONFIG_STANDALONE=y
367CONFIG_PREVENT_FIRMWARE_BUILD=y 373CONFIG_PREVENT_FIRMWARE_BUILD=y
368# CONFIG_FW_LOADER is not set
369# CONFIG_SYS_HYPERVISOR is not set 374# CONFIG_SYS_HYPERVISOR is not set
370 375
371# 376#
@@ -403,6 +408,7 @@ CONFIG_BLK_DEV_NBD=m
403CONFIG_BLK_DEV_RAM=y 408CONFIG_BLK_DEV_RAM=y
404CONFIG_BLK_DEV_RAM_COUNT=16 409CONFIG_BLK_DEV_RAM_COUNT=16
405CONFIG_BLK_DEV_RAM_SIZE=4096 410CONFIG_BLK_DEV_RAM_SIZE=4096
411CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
406# CONFIG_BLK_DEV_INITRD is not set 412# CONFIG_BLK_DEV_INITRD is not set
407# CONFIG_CDROM_PKTCDVD is not set 413# CONFIG_CDROM_PKTCDVD is not set
408# CONFIG_ATA_OVER_ETH is not set 414# CONFIG_ATA_OVER_ETH is not set
@@ -410,65 +416,14 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
410# 416#
411# ATA/ATAPI/MFM/RLL support 417# ATA/ATAPI/MFM/RLL support
412# 418#
413CONFIG_IDE=y 419# CONFIG_IDE is not set
414CONFIG_BLK_DEV_IDE=y
415
416#
417# Please see Documentation/ide.txt for help/info on IDE drives
418#
419# CONFIG_BLK_DEV_IDE_SATA is not set
420CONFIG_BLK_DEV_IDEDISK=y
421# CONFIG_IDEDISK_MULTI_MODE is not set
422# CONFIG_BLK_DEV_IDECD is not set
423# CONFIG_BLK_DEV_IDETAPE is not set
424# CONFIG_BLK_DEV_IDEFLOPPY is not set
425# CONFIG_BLK_DEV_IDESCSI is not set
426# CONFIG_IDE_TASK_IOCTL is not set
427
428#
429# IDE chipset support/bugfixes
430#
431CONFIG_IDE_GENERIC=y
432CONFIG_BLK_DEV_IDEPCI=y
433# CONFIG_IDEPCI_SHARE_IRQ is not set
434# CONFIG_BLK_DEV_OFFBOARD is not set
435# CONFIG_BLK_DEV_GENERIC is not set
436# CONFIG_BLK_DEV_OPTI621 is not set
437CONFIG_BLK_DEV_IDEDMA_PCI=y
438# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
439# CONFIG_IDEDMA_PCI_AUTO is not set
440# CONFIG_BLK_DEV_AEC62XX is not set
441# CONFIG_BLK_DEV_ALI15X3 is not set
442# CONFIG_BLK_DEV_AMD74XX is not set
443# CONFIG_BLK_DEV_CMD64X is not set
444# CONFIG_BLK_DEV_TRIFLEX is not set
445# CONFIG_BLK_DEV_CY82C693 is not set
446# CONFIG_BLK_DEV_CS5520 is not set
447# CONFIG_BLK_DEV_CS5530 is not set
448# CONFIG_BLK_DEV_HPT34X is not set
449# CONFIG_BLK_DEV_HPT366 is not set
450# CONFIG_BLK_DEV_SC1200 is not set
451# CONFIG_BLK_DEV_PIIX is not set
452# CONFIG_BLK_DEV_IT821X is not set
453# CONFIG_BLK_DEV_NS87415 is not set
454# CONFIG_BLK_DEV_PDC202XX_OLD is not set
455# CONFIG_BLK_DEV_PDC202XX_NEW is not set
456# CONFIG_BLK_DEV_SVWKS is not set
457CONFIG_BLK_DEV_SIIMAGE=y
458# CONFIG_BLK_DEV_SLC90E66 is not set
459# CONFIG_BLK_DEV_TRM290 is not set
460# CONFIG_BLK_DEV_VIA82CXXX is not set
461# CONFIG_IDE_ARM is not set
462CONFIG_BLK_DEV_IDEDMA=y
463# CONFIG_IDEDMA_IVB is not set
464# CONFIG_IDEDMA_AUTO is not set
465# CONFIG_BLK_DEV_HD is not set
466 420
467# 421#
468# SCSI device support 422# SCSI device support
469# 423#
470# CONFIG_RAID_ATTRS is not set 424# CONFIG_RAID_ATTRS is not set
471CONFIG_SCSI=y 425CONFIG_SCSI=y
426# CONFIG_SCSI_NETLINK is not set
472CONFIG_SCSI_PROC_FS=y 427CONFIG_SCSI_PROC_FS=y
473 428
474# 429#
@@ -489,12 +444,13 @@ CONFIG_BLK_DEV_SD=y
489# CONFIG_SCSI_LOGGING is not set 444# CONFIG_SCSI_LOGGING is not set
490 445
491# 446#
492# SCSI Transport Attributes 447# SCSI Transports
493# 448#
494# CONFIG_SCSI_SPI_ATTRS is not set 449# CONFIG_SCSI_SPI_ATTRS is not set
495# CONFIG_SCSI_FC_ATTRS is not set 450# CONFIG_SCSI_FC_ATTRS is not set
496# CONFIG_SCSI_ISCSI_ATTRS is not set 451# CONFIG_SCSI_ISCSI_ATTRS is not set
497# CONFIG_SCSI_SAS_ATTRS is not set 452# CONFIG_SCSI_SAS_ATTRS is not set
453# CONFIG_SCSI_SAS_LIBSAS is not set
498 454
499# 455#
500# SCSI low-level drivers 456# SCSI low-level drivers
@@ -507,21 +463,24 @@ CONFIG_BLK_DEV_SD=y
507# CONFIG_SCSI_AIC7XXX is not set 463# CONFIG_SCSI_AIC7XXX is not set
508# CONFIG_SCSI_AIC7XXX_OLD is not set 464# CONFIG_SCSI_AIC7XXX_OLD is not set
509# CONFIG_SCSI_AIC79XX is not set 465# CONFIG_SCSI_AIC79XX is not set
466# CONFIG_SCSI_AIC94XX is not set
510# CONFIG_SCSI_DPT_I2O is not set 467# CONFIG_SCSI_DPT_I2O is not set
468# CONFIG_SCSI_ARCMSR is not set
511# CONFIG_MEGARAID_NEWGEN is not set 469# CONFIG_MEGARAID_NEWGEN is not set
512# CONFIG_MEGARAID_LEGACY is not set 470# CONFIG_MEGARAID_LEGACY is not set
513# CONFIG_MEGARAID_SAS is not set 471# CONFIG_MEGARAID_SAS is not set
514# CONFIG_SCSI_SATA is not set
515# CONFIG_SCSI_HPTIOP is not set 472# CONFIG_SCSI_HPTIOP is not set
516# CONFIG_SCSI_DMX3191D is not set 473# CONFIG_SCSI_DMX3191D is not set
517# CONFIG_SCSI_FUTURE_DOMAIN is not set 474# CONFIG_SCSI_FUTURE_DOMAIN is not set
518# CONFIG_SCSI_IPS is not set 475# CONFIG_SCSI_IPS is not set
519# CONFIG_SCSI_INITIO is not set 476# CONFIG_SCSI_INITIO is not set
520# CONFIG_SCSI_INIA100 is not set 477# CONFIG_SCSI_INIA100 is not set
478# CONFIG_SCSI_STEX is not set
521# CONFIG_SCSI_SYM53C8XX_2 is not set 479# CONFIG_SCSI_SYM53C8XX_2 is not set
522# CONFIG_SCSI_IPR is not set 480# CONFIG_SCSI_IPR is not set
523# CONFIG_SCSI_QLOGIC_1280 is not set 481# CONFIG_SCSI_QLOGIC_1280 is not set
524# CONFIG_SCSI_QLA_FC is not set 482# CONFIG_SCSI_QLA_FC is not set
483# CONFIG_SCSI_QLA_ISCSI is not set
525# CONFIG_SCSI_LPFC is not set 484# CONFIG_SCSI_LPFC is not set
526# CONFIG_SCSI_DC395x is not set 485# CONFIG_SCSI_DC395x is not set
527# CONFIG_SCSI_DC390T is not set 486# CONFIG_SCSI_DC390T is not set
@@ -529,6 +488,59 @@ CONFIG_BLK_DEV_SD=y
529# CONFIG_SCSI_DEBUG is not set 488# CONFIG_SCSI_DEBUG is not set
530 489
531# 490#
491# Serial ATA (prod) and Parallel ATA (experimental) drivers
492#
493CONFIG_ATA=y
494# CONFIG_SATA_AHCI is not set
495# CONFIG_SATA_SVW is not set
496# CONFIG_ATA_PIIX is not set
497# CONFIG_SATA_MV is not set
498# CONFIG_SATA_NV is not set
499# CONFIG_PDC_ADMA is not set
500# CONFIG_SATA_QSTOR is not set
501# CONFIG_SATA_PROMISE is not set
502# CONFIG_SATA_SX4 is not set
503# CONFIG_SATA_SIL is not set
504# CONFIG_SATA_SIL24 is not set
505# CONFIG_SATA_SIS is not set
506# CONFIG_SATA_ULI is not set
507# CONFIG_SATA_VIA is not set
508# CONFIG_SATA_VITESSE is not set
509# CONFIG_PATA_ALI is not set
510# CONFIG_PATA_AMD is not set
511# CONFIG_PATA_ARTOP is not set
512# CONFIG_PATA_ATIIXP is not set
513# CONFIG_PATA_CMD64X is not set
514# CONFIG_PATA_CS5520 is not set
515# CONFIG_PATA_CS5530 is not set
516# CONFIG_PATA_CYPRESS is not set
517# CONFIG_PATA_EFAR is not set
518# CONFIG_ATA_GENERIC is not set
519# CONFIG_PATA_HPT366 is not set
520# CONFIG_PATA_HPT37X is not set
521# CONFIG_PATA_HPT3X2N is not set
522# CONFIG_PATA_HPT3X3 is not set
523# CONFIG_PATA_IT821X is not set
524# CONFIG_PATA_JMICRON is not set
525# CONFIG_PATA_TRIFLEX is not set
526# CONFIG_PATA_MPIIX is not set
527# CONFIG_PATA_OLDPIIX is not set
528# CONFIG_PATA_NETCELL is not set
529# CONFIG_PATA_NS87410 is not set
530# CONFIG_PATA_OPTI is not set
531# CONFIG_PATA_OPTIDMA is not set
532# CONFIG_PATA_PDC_OLD is not set
533# CONFIG_PATA_RADISYS is not set
534# CONFIG_PATA_RZ1000 is not set
535# CONFIG_PATA_SC1200 is not set
536# CONFIG_PATA_SERVERWORKS is not set
537# CONFIG_PATA_PDC2027X is not set
538CONFIG_PATA_SIL680=y
539# CONFIG_PATA_SIS is not set
540# CONFIG_PATA_VIA is not set
541# CONFIG_PATA_WINBOND is not set
542
543#
532# Multi-device support (RAID and LVM) 544# Multi-device support (RAID and LVM)
533# 545#
534# CONFIG_MD is not set 546# CONFIG_MD is not set
@@ -632,6 +644,7 @@ CONFIG_R8169=y
632# CONFIG_SK98LIN is not set 644# CONFIG_SK98LIN is not set
633# CONFIG_TIGON3 is not set 645# CONFIG_TIGON3 is not set
634# CONFIG_BNX2 is not set 646# CONFIG_BNX2 is not set
647# CONFIG_QLA3XXX is not set
635 648
636# 649#
637# Ethernet (10000 Mbit) 650# Ethernet (10000 Mbit)
@@ -679,6 +692,7 @@ CONFIG_R8169=y
679# Input device support 692# Input device support
680# 693#
681CONFIG_INPUT=y 694CONFIG_INPUT=y
695# CONFIG_INPUT_FF_MEMLESS is not set
682 696
683# 697#
684# Userland interfaces 698# Userland interfaces
@@ -758,7 +772,6 @@ CONFIG_GPIO_VR41XX=y
758# TPM devices 772# TPM devices
759# 773#
760# CONFIG_TCG_TPM is not set 774# CONFIG_TCG_TPM is not set
761# CONFIG_TELCLOCK is not set
762 775
763# 776#
764# I2C support 777# I2C support
@@ -784,12 +797,12 @@ CONFIG_GPIO_VR41XX=y
784# 797#
785# Misc devices 798# Misc devices
786# 799#
800# CONFIG_TIFM_CORE is not set
787 801
788# 802#
789# Multimedia devices 803# Multimedia devices
790# 804#
791# CONFIG_VIDEO_DEV is not set 805# CONFIG_VIDEO_DEV is not set
792CONFIG_VIDEO_V4L2=y
793 806
794# 807#
795# Digital Video Broadcasting Devices 808# Digital Video Broadcasting Devices
@@ -897,13 +910,13 @@ CONFIG_USB_STORAGE=m
897# CONFIG_USB_STORAGE_DEBUG is not set 910# CONFIG_USB_STORAGE_DEBUG is not set
898# CONFIG_USB_STORAGE_DATAFAB is not set 911# CONFIG_USB_STORAGE_DATAFAB is not set
899# CONFIG_USB_STORAGE_FREECOM is not set 912# CONFIG_USB_STORAGE_FREECOM is not set
900# CONFIG_USB_STORAGE_ISD200 is not set
901# CONFIG_USB_STORAGE_DPCM is not set 913# CONFIG_USB_STORAGE_DPCM is not set
902# CONFIG_USB_STORAGE_USBAT is not set 914# CONFIG_USB_STORAGE_USBAT is not set
903# CONFIG_USB_STORAGE_SDDR09 is not set 915# CONFIG_USB_STORAGE_SDDR09 is not set
904# CONFIG_USB_STORAGE_SDDR55 is not set 916# CONFIG_USB_STORAGE_SDDR55 is not set
905# CONFIG_USB_STORAGE_JUMPSHOT is not set 917# CONFIG_USB_STORAGE_JUMPSHOT is not set
906# CONFIG_USB_STORAGE_ALAUDA is not set 918# CONFIG_USB_STORAGE_ALAUDA is not set
919# CONFIG_USB_STORAGE_KARMA is not set
907# CONFIG_USB_LIBUSUAL is not set 920# CONFIG_USB_LIBUSUAL is not set
908 921
909# 922#
@@ -932,6 +945,7 @@ CONFIG_USB_HIDINPUT=y
932# CONFIG_USB_ATI_REMOTE2 is not set 945# CONFIG_USB_ATI_REMOTE2 is not set
933# CONFIG_USB_KEYSPAN_REMOTE is not set 946# CONFIG_USB_KEYSPAN_REMOTE is not set
934# CONFIG_USB_APPLETOUCH is not set 947# CONFIG_USB_APPLETOUCH is not set
948# CONFIG_USB_TRANCEVIBRATOR is not set
935 949
936# 950#
937# USB Imaging devices 951# USB Imaging devices
@@ -963,16 +977,17 @@ CONFIG_USB_MON=y
963# 977#
964# CONFIG_USB_EMI62 is not set 978# CONFIG_USB_EMI62 is not set
965# CONFIG_USB_EMI26 is not set 979# CONFIG_USB_EMI26 is not set
980# CONFIG_USB_ADUTUX is not set
966# CONFIG_USB_AUERSWALD is not set 981# CONFIG_USB_AUERSWALD is not set
967# CONFIG_USB_RIO500 is not set 982# CONFIG_USB_RIO500 is not set
968# CONFIG_USB_LEGOTOWER is not set 983# CONFIG_USB_LEGOTOWER is not set
969# CONFIG_USB_LCD is not set 984# CONFIG_USB_LCD is not set
970# CONFIG_USB_LED is not set 985# CONFIG_USB_LED is not set
971# CONFIG_USB_CY7C63 is not set 986# CONFIG_USB_CYPRESS_CY7C63 is not set
972# CONFIG_USB_CYTHERM is not set 987# CONFIG_USB_CYTHERM is not set
973# CONFIG_USB_PHIDGETKIT is not set 988# CONFIG_USB_PHIDGET is not set
974# CONFIG_USB_PHIDGETSERVO is not set
975# CONFIG_USB_IDMOUSE is not set 989# CONFIG_USB_IDMOUSE is not set
990# CONFIG_USB_FTDI_ELAN is not set
976# CONFIG_USB_APPLEDISPLAY is not set 991# CONFIG_USB_APPLEDISPLAY is not set
977# CONFIG_USB_SISUSBVGA is not set 992# CONFIG_USB_SISUSBVGA is not set
978# CONFIG_USB_LD is not set 993# CONFIG_USB_LD is not set
@@ -1041,6 +1056,7 @@ CONFIG_EXT3_FS=y
1041CONFIG_EXT3_FS_XATTR=y 1056CONFIG_EXT3_FS_XATTR=y
1042# CONFIG_EXT3_FS_POSIX_ACL is not set 1057# CONFIG_EXT3_FS_POSIX_ACL is not set
1043# CONFIG_EXT3_FS_SECURITY is not set 1058# CONFIG_EXT3_FS_SECURITY is not set
1059# CONFIG_EXT4DEV_FS is not set
1044CONFIG_JBD=y 1060CONFIG_JBD=y
1045# CONFIG_JBD_DEBUG is not set 1061# CONFIG_JBD_DEBUG is not set
1046CONFIG_FS_MBCACHE=y 1062CONFIG_FS_MBCACHE=y
@@ -1052,6 +1068,7 @@ CONFIG_XFS_QUOTA=y
1052# CONFIG_XFS_SECURITY is not set 1068# CONFIG_XFS_SECURITY is not set
1053CONFIG_XFS_POSIX_ACL=y 1069CONFIG_XFS_POSIX_ACL=y
1054# CONFIG_XFS_RT is not set 1070# CONFIG_XFS_RT is not set
1071# CONFIG_GFS2_FS is not set
1055# CONFIG_OCFS2_FS is not set 1072# CONFIG_OCFS2_FS is not set
1056# CONFIG_MINIX_FS is not set 1073# CONFIG_MINIX_FS is not set
1057CONFIG_ROMFS_FS=m 1074CONFIG_ROMFS_FS=m
@@ -1082,8 +1099,10 @@ CONFIG_AUTOFS4_FS=y
1082# 1099#
1083CONFIG_PROC_FS=y 1100CONFIG_PROC_FS=y
1084CONFIG_PROC_KCORE=y 1101CONFIG_PROC_KCORE=y
1102CONFIG_PROC_SYSCTL=y
1085CONFIG_SYSFS=y 1103CONFIG_SYSFS=y
1086CONFIG_TMPFS=y 1104CONFIG_TMPFS=y
1105# CONFIG_TMPFS_POSIX_ACL is not set
1087# CONFIG_HUGETLB_PAGE is not set 1106# CONFIG_HUGETLB_PAGE is not set
1088CONFIG_RAMFS=y 1107CONFIG_RAMFS=y
1089# CONFIG_CONFIGFS_FS is not set 1108# CONFIG_CONFIGFS_FS is not set
@@ -1123,7 +1142,6 @@ CONFIG_SUNRPC=y
1123# CONFIG_RPCSEC_GSS_SPKM3 is not set 1142# CONFIG_RPCSEC_GSS_SPKM3 is not set
1124# CONFIG_SMB_FS is not set 1143# CONFIG_SMB_FS is not set
1125# CONFIG_CIFS is not set 1144# CONFIG_CIFS is not set
1126# CONFIG_CIFS_DEBUG2 is not set
1127# CONFIG_NCP_FS is not set 1145# CONFIG_NCP_FS is not set
1128# CONFIG_CODA_FS is not set 1146# CONFIG_CODA_FS is not set
1129# CONFIG_AFS_FS is not set 1147# CONFIG_AFS_FS is not set
@@ -1150,11 +1168,13 @@ CONFIG_MSDOS_PARTITION=y
1150# 1168#
1151CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1169CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1152# CONFIG_PRINTK_TIME is not set 1170# CONFIG_PRINTK_TIME is not set
1171CONFIG_ENABLE_MUST_CHECK=y
1153# CONFIG_MAGIC_SYSRQ is not set 1172# CONFIG_MAGIC_SYSRQ is not set
1154# CONFIG_UNUSED_SYMBOLS is not set 1173# CONFIG_UNUSED_SYMBOLS is not set
1155# CONFIG_DEBUG_KERNEL is not set 1174# CONFIG_DEBUG_KERNEL is not set
1156CONFIG_LOG_BUF_SHIFT=14 1175CONFIG_LOG_BUF_SHIFT=14
1157# CONFIG_DEBUG_FS is not set 1176# CONFIG_DEBUG_FS is not set
1177# CONFIG_HEADERS_CHECK is not set
1158CONFIG_CROSSCOMPILE=y 1178CONFIG_CROSSCOMPILE=y
1159CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs" 1179CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
1160 1180
@@ -1170,10 +1190,6 @@ CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
1170# CONFIG_CRYPTO is not set 1190# CONFIG_CRYPTO is not set
1171 1191
1172# 1192#
1173# Hardware crypto devices
1174#
1175
1176#
1177# Library routines 1193# Library routines
1178# 1194#
1179# CONFIG_CRC_CCITT is not set 1195# CONFIG_CRC_CCITT is not set
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 53f4171fc188..7a3ebbeba1f3 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -1055,7 +1055,9 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name)
1055asmlinkage int sys32_personality(unsigned long personality) 1055asmlinkage int sys32_personality(unsigned long personality)
1056{ 1056{
1057 int ret; 1057 int ret;
1058 if (current->personality == PER_LINUX32 && personality == PER_LINUX) 1058 personality &= 0xffffffff;
1059 if (personality(current->personality) == PER_LINUX32 &&
1060 personality == PER_LINUX)
1059 personality = PER_LINUX32; 1061 personality = PER_LINUX32;
1060 ret = sys_personality(personality); 1062 ret = sys_personality(personality);
1061 if (ret == PER_LINUX32) 1063 if (ret == PER_LINUX32)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 9f307eb1a31e..ec8209f3a0c6 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -358,10 +358,8 @@ static int __init frame_info_init(void)
358 unsigned long size = 0; 358 unsigned long size = 0;
359#ifdef CONFIG_KALLSYMS 359#ifdef CONFIG_KALLSYMS
360 unsigned long ofs; 360 unsigned long ofs;
361 char *modname;
362 char namebuf[KSYM_NAME_LEN + 1];
363 361
364 kallsyms_lookup((unsigned long)schedule, &size, &ofs, &modname, namebuf); 362 kallsyms_lookup_size_offset((unsigned long)schedule, &size, &ofs);
365#endif 363#endif
366 schedule_mfi.func = schedule; 364 schedule_mfi.func = schedule;
367 schedule_mfi.func_size = size; 365 schedule_mfi.func_size = size;
@@ -403,8 +401,6 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
403{ 401{
404 unsigned long stack_page; 402 unsigned long stack_page;
405 struct mips_frame_info info; 403 struct mips_frame_info info;
406 char *modname;
407 char namebuf[KSYM_NAME_LEN + 1];
408 unsigned long size, ofs; 404 unsigned long size, ofs;
409 int leaf; 405 int leaf;
410 extern void ret_from_irq(void); 406 extern void ret_from_irq(void);
@@ -433,7 +429,7 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
433 } 429 }
434 return 0; 430 return 0;
435 } 431 }
436 if (!kallsyms_lookup(pc, &size, &ofs, &modname, namebuf)) 432 if (!kallsyms_lookup_size_offset(pc, &size, &ofs))
437 return 0; 433 return 0;
438 /* 434 /*
439 * Return ra if an exception occured at the first instruction 435 * Return ra if an exception occured at the first instruction
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 61362e6fa9ec..720fac3435d5 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -652,7 +652,8 @@ einval: li v0, -EINVAL
652 sys sys_vmsplice 4 652 sys sys_vmsplice 4
653 sys sys_move_pages 6 653 sys sys_move_pages 6
654 sys sys_set_robust_list 2 654 sys sys_set_robust_list 2
655 sys sys_get_robust_list 3 655 sys sys_get_robust_list 3 /* 4310 */
656 sys sys_ni_syscall 0
656 .endm 657 .endm
657 658
658 /* We pre-compute the number of _instruction_ bytes needed to 659 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 6c7b5ed0ea6e..3a34f62c8b1b 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -468,3 +468,4 @@ sys_call_table:
468 PTR sys_move_pages 468 PTR sys_move_pages
469 PTR sys_set_robust_list 469 PTR sys_set_robust_list
470 PTR sys_get_robust_list 470 PTR sys_get_robust_list
471 PTR sys_ni_syscall /* 5270 */
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6d9f18727ac5..67b92a1d6c72 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -280,7 +280,7 @@ EXPORT(sysn32_call_table)
280 PTR sys_sync 280 PTR sys_sync
281 PTR sys_acct 281 PTR sys_acct
282 PTR sys32_settimeofday 282 PTR sys32_settimeofday
283 PTR sys_mount /* 6160 */ 283 PTR compat_sys_mount /* 6160 */
284 PTR sys_umount 284 PTR sys_umount
285 PTR sys_swapon 285 PTR sys_swapon
286 PTR sys_swapoff 286 PTR sys_swapoff
@@ -394,3 +394,4 @@ EXPORT(sysn32_call_table)
394 PTR sys_move_pages 394 PTR sys_move_pages
395 PTR compat_sys_set_robust_list 395 PTR compat_sys_set_robust_list
396 PTR compat_sys_get_robust_list 396 PTR compat_sys_get_robust_list
397 PTR sys_ni_syscall
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 2e6d0673163e..2875c4a3fa58 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -226,7 +226,7 @@ sys_call_table:
226 PTR sys_ni_syscall /* was sys_stat */ 226 PTR sys_ni_syscall /* was sys_stat */
227 PTR sys_lseek 227 PTR sys_lseek
228 PTR sys_getpid /* 4020 */ 228 PTR sys_getpid /* 4020 */
229 PTR sys_mount 229 PTR compat_sys_mount
230 PTR sys_oldumount 230 PTR sys_oldumount
231 PTR sys_setuid 231 PTR sys_setuid
232 PTR sys_getuid 232 PTR sys_getuid
@@ -516,4 +516,5 @@ sys_call_table:
516 PTR compat_sys_move_pages 516 PTR compat_sys_move_pages
517 PTR compat_sys_set_robust_list 517 PTR compat_sys_set_robust_list
518 PTR compat_sys_get_robust_list /* 4310 */ 518 PTR compat_sys_get_robust_list /* 4310 */
519 PTR sys_ni_syscall
519 .size sys_call_table,.-sys_call_table 520 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 4aabe526a68e..a586aba337a7 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -57,7 +57,7 @@ static void save_context_stack(struct stack_trace *trace,
57 pc = unwind_stack(task, &sp, pc, &ra); 57 pc = unwind_stack(task, &sp, pc, &ra);
58 } while (pc); 58 } while (pc);
59#else 59#else
60 save_raw_context_stack(sp); 60 save_raw_context_stack(trace, sp);
61#endif 61#endif
62} 62}
63 63
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
index 6244d0e2c7de..90ad5bf3e2f1 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -32,6 +32,7 @@
32#include <asm/i8259.h> 32#include <asm/i8259.h>
33#include <asm/irq_cpu.h> 33#include <asm/irq_cpu.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/irq_regs.h>
35#include <asm/mips-boards/malta.h> 36#include <asm/mips-boards/malta.h>
36#include <asm/mips-boards/maltaint.h> 37#include <asm/mips-boards/maltaint.h>
37#include <asm/mips-boards/piix4.h> 38#include <asm/mips-boards/piix4.h>
@@ -131,7 +132,7 @@ static void corehi_irqdispatch(void)
131 unsigned int intedge, intsteer, pcicmd, pcibadaddr; 132 unsigned int intedge, intsteer, pcicmd, pcibadaddr;
132 unsigned int pcimstat, intisr, inten, intpol; 133 unsigned int pcimstat, intisr, inten, intpol;
133 unsigned int intrcause,datalo,datahi; 134 unsigned int intrcause,datalo,datahi;
134 struct pt_regs *regs; 135 struct pt_regs *regs = get_irq_regs();
135 136
136 printk("CoreHI interrupt, shouldn't happen, so we die here!!!\n"); 137 printk("CoreHI interrupt, shouldn't happen, so we die here!!!\n");
137 printk("epc : %08lx\nStatus: %08lx\n" 138 printk("epc : %08lx\nStatus: %08lx\n"
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index 3101d1db5592..cea7d0ea36e4 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -176,7 +176,7 @@ void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
176 176
177#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) 177#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
178 178
179void __iounmap(volatile void __iomem *addr) 179void __iounmap(const volatile void __iomem *addr)
180{ 180{
181 struct vm_struct *p; 181 struct vm_struct *p;
182 182
diff --git a/arch/mips/oprofile/op_impl.h b/arch/mips/oprofile/op_impl.h
index 354e54496406..fa6b4aae7523 100644
--- a/arch/mips/oprofile/op_impl.h
+++ b/arch/mips/oprofile/op_impl.h
@@ -10,8 +10,6 @@
10#ifndef OP_IMPL_H 10#ifndef OP_IMPL_H
11#define OP_IMPL_H 1 11#define OP_IMPL_H 1
12 12
13struct pt_regs;
14
15extern int null_perf_irq(void); 13extern int null_perf_irq(void);
16extern int (*perf_irq)(void); 14extern int (*perf_irq)(void);
17 15
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c
index b7063fefa65b..7dc9bf6f1321 100644
--- a/arch/mips/oprofile/op_model_rm9000.c
+++ b/arch/mips/oprofile/op_model_rm9000.c
@@ -80,8 +80,7 @@ static void rm9000_cpu_stop(void *args)
80 write_c0_perfcontrol(0); 80 write_c0_perfcontrol(0);
81} 81}
82 82
83static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id, 83static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id)
84 struct pt_regs *regs)
85{ 84{
86 unsigned int control = read_c0_perfcontrol(); 85 unsigned int control = read_c0_perfcontrol();
87 uint32_t counter1, counter2; 86 uint32_t counter1, counter2;
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index fd0932b2d521..db8084411538 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -135,7 +135,7 @@ static inline void ip32_power_button(void)
135 add_timer(&power_timer); 135 add_timer(&power_timer);
136} 136}
137 137
138static irqreturn_t ip32_rtc_int(int irq, void *dev_id, struct pt_regs *regs) 138static irqreturn_t ip32_rtc_int(int irq, void *dev_id)
139{ 139{
140 volatile unsigned char reg_c; 140 volatile unsigned char reg_c;
141 141
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
index 992e0d8dbb67..d1a906e683b2 100644
--- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
+++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
@@ -88,7 +88,7 @@ static void arm_tb(void)
88 sbp.tb_armed = 1; 88 sbp.tb_armed = 1;
89} 89}
90 90
91static irqreturn_t sbprof_tb_intr(int irq, void *dev_id, struct pt_regs *regs) 91static irqreturn_t sbprof_tb_intr(int irq, void *dev_id)
92{ 92{
93 int i; 93 int i;
94 DBG(printk(DEVNAME ": tb_intr\n")); 94 DBG(printk(DEVNAME ": tb_intr\n"));
@@ -138,7 +138,7 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id, struct pt_regs *regs)
138 return IRQ_HANDLED; 138 return IRQ_HANDLED;
139} 139}
140 140
141static irqreturn_t sbprof_pc_intr(int irq, void *dev_id, struct pt_regs *regs) 141static irqreturn_t sbprof_pc_intr(int irq, void *dev_id)
142{ 142{
143 printk(DEVNAME ": unexpected pc_intr"); 143 printk(DEVNAME ": unexpected pc_intr");
144 return IRQ_NONE; 144 return IRQ_NONE;
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c
index bb90649fbc48..45274bd3cd8b 100644
--- a/arch/mips/sibyte/sb1250/bus_watcher.c
+++ b/arch/mips/sibyte/sb1250/bus_watcher.c
@@ -171,7 +171,7 @@ static void create_proc_decoder(struct bw_stats_struct *stats)
171 * notes: possible re-entry due to multiple sources 171 * notes: possible re-entry due to multiple sources
172 * should check/indicate saturation 172 * should check/indicate saturation
173 */ 173 */
174static irqreturn_t sibyte_bw_int(int irq, void *data, struct pt_regs *regs) 174static irqreturn_t sibyte_bw_int(int irq, void *data)
175{ 175{
176 struct bw_stats_struct *stats = data; 176 struct bw_stats_struct *stats = data;
177 unsigned long cntr; 177 unsigned long cntr;
diff --git a/arch/powerpc/configs/mpc834x_itx_defconfig b/arch/powerpc/configs/mpc834x_itx_defconfig
index cd3535e1a095..0561b73a918f 100644
--- a/arch/powerpc/configs/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/mpc834x_itx_defconfig
@@ -1248,7 +1248,7 @@ CONFIG_PARTITION_ADVANCED=y
1248# CONFIG_AMIGA_PARTITION is not set 1248# CONFIG_AMIGA_PARTITION is not set
1249# CONFIG_ATARI_PARTITION is not set 1249# CONFIG_ATARI_PARTITION is not set
1250# CONFIG_MAC_PARTITION is not set 1250# CONFIG_MAC_PARTITION is not set
1251# CONFIG_MSDOS_PARTITION is not set 1251CONFIG_MSDOS_PARTITION=y
1252# CONFIG_LDM_PARTITION is not set 1252# CONFIG_LDM_PARTITION is not set
1253# CONFIG_SGI_PARTITION is not set 1253# CONFIG_SGI_PARTITION is not set
1254# CONFIG_ULTRIX_PARTITION is not set 1254# CONFIG_ULTRIX_PARTITION is not set
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 47a613cdd775..95382f994404 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -268,7 +268,7 @@ struct cpu_spec cpu_specs[] = {
268 .cpu_user_features = COMMON_USER_POWER6, 268 .cpu_user_features = COMMON_USER_POWER6,
269 .icache_bsize = 128, 269 .icache_bsize = 128,
270 .dcache_bsize = 128, 270 .dcache_bsize = 128,
271 .num_pmcs = 8, 271 .num_pmcs = 6,
272 .oprofile_cpu_type = "ppc64/power6", 272 .oprofile_cpu_type = "ppc64/power6",
273 .oprofile_type = PPC_OPROFILE_POWER4, 273 .oprofile_type = PPC_OPROFILE_POWER4,
274 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV, 274 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 9b49f8691d29..0d9ff72e2852 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -441,14 +441,14 @@ update_bridge_base(struct pci_bus *bus, int i)
441 end = res->end - off; 441 end = res->end - off;
442 io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK; 442 io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK;
443 io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK; 443 io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK;
444 if (end > 0xffff) { 444 if (end > 0xffff)
445 pci_write_config_word(dev, PCI_IO_BASE_UPPER16,
446 start >> 16);
447 pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16,
448 end >> 16);
449 io_base_lo |= PCI_IO_RANGE_TYPE_32; 445 io_base_lo |= PCI_IO_RANGE_TYPE_32;
450 } else 446 else
451 io_base_lo |= PCI_IO_RANGE_TYPE_16; 447 io_base_lo |= PCI_IO_RANGE_TYPE_16;
448 pci_write_config_word(dev, PCI_IO_BASE_UPPER16,
449 start >> 16);
450 pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16,
451 end >> 16);
452 pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo); 452 pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo);
453 pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo); 453 pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo);
454 454
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 78d3c0fc8dfb..9bae8a5bf671 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -199,8 +199,14 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
199 pci_setup_pci_controller(phb); 199 pci_setup_pci_controller(phb);
200 phb->arch_data = dev; 200 phb->arch_data = dev;
201 phb->is_dynamic = mem_init_done; 201 phb->is_dynamic = mem_init_done;
202 if (dev) 202 if (dev) {
203 PHB_SET_NODE(phb, of_node_to_nid(dev)); 203 int nid = of_node_to_nid(dev);
204
205 if (nid < 0 || !node_online(nid))
206 nid = -1;
207
208 PHB_SET_NODE(phb, nid);
209 }
204 return phb; 210 return phb;
205} 211}
206 212
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 7b2f6452ba72..f3d4dd580dd6 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -341,13 +341,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
341 341
342static int instructions_to_print = 16; 342static int instructions_to_print = 16;
343 343
344#ifdef CONFIG_PPC64
345#define BAD_PC(pc) ((REGION_ID(pc) != KERNEL_REGION_ID) && \
346 (REGION_ID(pc) != VMALLOC_REGION_ID))
347#else
348#define BAD_PC(pc) ((pc) < KERNELBASE)
349#endif
350
351static void show_instructions(struct pt_regs *regs) 344static void show_instructions(struct pt_regs *regs)
352{ 345{
353 int i; 346 int i;
@@ -366,7 +359,8 @@ static void show_instructions(struct pt_regs *regs)
366 * bad address because the pc *should* only be a 359 * bad address because the pc *should* only be a
367 * kernel address. 360 * kernel address.
368 */ 361 */
369 if (BAD_PC(pc) || __get_user(instr, (unsigned int __user *)pc)) { 362 if (!__kernel_text_address(pc) ||
363 __get_user(instr, (unsigned int __user *)pc)) {
370 printk("XXXXXXXX "); 364 printk("XXXXXXXX ");
371 } else { 365 } else {
372 if (regs->nip == pc) 366 if (regs->nip == pc)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index d9f10f2fc372..5ed4c2ceb5ca 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -900,14 +900,13 @@ void kernel_fp_unavailable_exception(struct pt_regs *regs)
900 900
901void altivec_unavailable_exception(struct pt_regs *regs) 901void altivec_unavailable_exception(struct pt_regs *regs)
902{ 902{
903#if !defined(CONFIG_ALTIVEC)
904 if (user_mode(regs)) { 903 if (user_mode(regs)) {
905 /* A user program has executed an altivec instruction, 904 /* A user program has executed an altivec instruction,
906 but this kernel doesn't support altivec. */ 905 but this kernel doesn't support altivec. */
907 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 906 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
908 return; 907 return;
909 } 908 }
910#endif 909
911 printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception " 910 printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception "
912 "%lx at %lx\n", regs->trap, regs->nip); 911 "%lx at %lx\n", regs->trap, regs->nip);
913 die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); 912 die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT);
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 0975e94ac7c4..7edb6b461382 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -32,6 +32,13 @@ config MPC834x_ITX
32 Be aware that PCI initialization is the bootloader's 32 Be aware that PCI initialization is the bootloader's
33 responsiblilty. 33 responsiblilty.
34 34
35config MPC8360E_PB
36 bool "Freescale MPC8360E PB"
37 select DEFAULT_UIMAGE
38 select QUICC_ENGINE
39 help
40 This option enables support for the MPC836x EMDS Processor Board.
41
35endchoice 42endchoice
36 43
37config PPC_MPC832x 44config PPC_MPC832x
@@ -46,4 +53,10 @@ config MPC834x
46 select PPC_INDIRECT_PCI 53 select PPC_INDIRECT_PCI
47 default y if MPC834x_SYS || MPC834x_ITX 54 default y if MPC834x_SYS || MPC834x_ITX
48 55
56config PPC_MPC836x
57 bool
58 select PPC_UDBG_16550
59 select PPC_INDIRECT_PCI
60 default y if MPC8360E_PB
61
49endmenu 62endmenu
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index 9387a110d28a..f1aa7e24a938 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -5,3 +5,5 @@ obj-y := misc.o
5obj-$(CONFIG_PCI) += pci.o 5obj-$(CONFIG_PCI) += pci.o
6obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o 6obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
7obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o 7obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
8obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o
9obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
index c0191900fc25..1a523c81c06e 100644
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
@@ -30,6 +30,7 @@
30#include <linux/root_dev.h> 30#include <linux/root_dev.h>
31#include <linux/initrd.h> 31#include <linux/initrd.h>
32 32
33#include <asm/of_device.h>
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/atomic.h> 35#include <asm/atomic.h>
35#include <asm/time.h> 36#include <asm/time.h>
@@ -141,6 +142,24 @@ static void __init mpc8360_sys_setup_arch(void)
141#endif 142#endif
142} 143}
143 144
145static int __init mpc8360_declare_of_platform_devices(void)
146{
147 struct device_node *np;
148
149 for (np = NULL; (np = of_find_compatible_node(np, "network",
150 "ucc_geth")) != NULL;) {
151 int ucc_num;
152 char bus_id[BUS_ID_SIZE];
153
154 ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
155 snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
156 of_platform_device_create(np, bus_id, NULL);
157 }
158
159 return 0;
160}
161device_initcall(mpc8360_declare_of_platform_devices);
162
144void __init mpc8360_sys_init_IRQ(void) 163void __init mpc8360_sys_init_IRQ(void)
145{ 164{
146 165
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index ccfd0c4db874..d0fb959e3ef1 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -781,6 +781,17 @@ static int __init create_spu(struct device_node *spe)
781 if (!spu) 781 if (!spu)
782 goto out; 782 goto out;
783 783
784 spu->node = find_spu_node_id(spe);
785 if (spu->node >= MAX_NUMNODES) {
786 printk(KERN_WARNING "SPE %s on node %d ignored,"
787 " node number too big\n", spe->full_name, spu->node);
788 printk(KERN_WARNING "Check if CONFIG_NUMA is enabled.\n");
789 return -ENODEV;
790 }
791 spu->nid = of_node_to_nid(spe);
792 if (spu->nid == -1)
793 spu->nid = 0;
794
784 ret = spu_map_device(spu, spe); 795 ret = spu_map_device(spu, spe);
785 /* try old method */ 796 /* try old method */
786 if (ret) 797 if (ret)
@@ -788,10 +799,6 @@ static int __init create_spu(struct device_node *spe)
788 if (ret) 799 if (ret)
789 goto out_free; 800 goto out_free;
790 801
791 spu->node = find_spu_node_id(spe);
792 spu->nid = of_node_to_nid(spe);
793 if (spu->nid == -1)
794 spu->nid = 0;
795 ret = spu_map_interrupts(spu, spe); 802 ret = spu_map_interrupts(spu, spe);
796 if (ret) 803 if (ret)
797 ret = spu_map_interrupts_old(spu, spe); 804 ret = spu_map_interrupts_old(spu, spe);
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index e0d730045260..0de8e114e6b6 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -246,6 +246,7 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
246 246
247static struct file_operations spufs_cntl_fops = { 247static struct file_operations spufs_cntl_fops = {
248 .open = spufs_cntl_open, 248 .open = spufs_cntl_open,
249 .release = simple_attr_close,
249 .read = simple_attr_read, 250 .read = simple_attr_read,
250 .write = simple_attr_write, 251 .write = simple_attr_write,
251 .mmap = spufs_cntl_mmap, 252 .mmap = spufs_cntl_mmap,
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index d4b2cf74da6a..18ee851e33e3 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -62,6 +62,7 @@
62#include <asm/cache.h> 62#include <asm/cache.h>
63#include <asm/8xx_immap.h> 63#include <asm/8xx_immap.h>
64#include <asm/machdep.h> 64#include <asm/machdep.h>
65#include <asm/irq_regs.h>
65 66
66#include <asm/time.h> 67#include <asm/time.h>
67 68
@@ -129,6 +130,7 @@ void wakeup_decrementer(void)
129 */ 130 */
130void timer_interrupt(struct pt_regs * regs) 131void timer_interrupt(struct pt_regs * regs)
131{ 132{
133 struct pt_regs *old_regs;
132 int next_dec; 134 int next_dec;
133 unsigned long cpu = smp_processor_id(); 135 unsigned long cpu = smp_processor_id();
134 unsigned jiffy_stamp = last_jiffy_stamp(cpu); 136 unsigned jiffy_stamp = last_jiffy_stamp(cpu);
@@ -137,6 +139,7 @@ void timer_interrupt(struct pt_regs * regs)
137 if (atomic_read(&ppc_n_lost_interrupts) != 0) 139 if (atomic_read(&ppc_n_lost_interrupts) != 0)
138 do_IRQ(regs); 140 do_IRQ(regs);
139 141
142 old_regs = set_irq_regs(regs);
140 irq_enter(); 143 irq_enter();
141 144
142 while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) { 145 while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) {
@@ -188,6 +191,7 @@ void timer_interrupt(struct pt_regs * regs)
188 ppc_md.heartbeat(); 191 ppc_md.heartbeat();
189 192
190 irq_exit(); 193 irq_exit();
194 set_irq_regs(old_regs);
191} 195}
192 196
193/* 197/*
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c
index d7b3a6afa78f..1f9ea36837b1 100644
--- a/arch/ppc/platforms/mpc8272ads_setup.c
+++ b/arch/ppc/platforms/mpc8272ads_setup.c
@@ -196,7 +196,7 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev,
196 bd_t* bi = (void*)__res; 196 bd_t* bi = (void*)__res;
197 int fs_no = fsid_fcc1+pdev->id-1; 197 int fs_no = fsid_fcc1+pdev->id-1;
198 198
199 if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) { 199 if(fs_no >= ARRAY_SIZE(mpc82xx_enet_pdata)) {
200 return; 200 return;
201 } 201 }
202 202
@@ -222,7 +222,7 @@ static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev,
222 int id = fs_uart_id_scc2fsid(idx); 222 int id = fs_uart_id_scc2fsid(idx);
223 223
224 /* no need to alter anything if console */ 224 /* no need to alter anything if console */
225 if ((id <= num) && (!pdev->dev.platform_data)) { 225 if ((id < num) && (!pdev->dev.platform_data)) {
226 pinfo = &mpc8272_uart_pdata[id]; 226 pinfo = &mpc8272_uart_pdata[id];
227 pinfo->uart_clk = bd->bi_intfreq; 227 pinfo->uart_clk = bd->bi_intfreq;
228 pdev->dev.platform_data = pinfo; 228 pdev->dev.platform_data = pinfo;
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c
index 5f130dca3770..e95d2c111747 100644
--- a/arch/ppc/platforms/mpc866ads_setup.c
+++ b/arch/ppc/platforms/mpc866ads_setup.c
@@ -259,7 +259,7 @@ static void mpc866ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no)
259 /* Get pointer to Communication Processor */ 259 /* Get pointer to Communication Processor */
260 cp = cpmp; 260 cp = cpmp;
261 261
262 if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { 262 if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) {
263 printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); 263 printk(KERN_ERR"No network-suitable #%d device on bus", fs_no);
264 return; 264 return;
265 } 265 }
@@ -305,7 +305,7 @@ static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev,
305 int id = fs_uart_id_smc2fsid(idx); 305 int id = fs_uart_id_smc2fsid(idx);
306 306
307 /* no need to alter anything if console */ 307 /* no need to alter anything if console */
308 if ((id <= num) && (!pdev->dev.platform_data)) { 308 if ((id < num) && (!pdev->dev.platform_data)) {
309 pinfo = &mpc866_uart_pdata[id]; 309 pinfo = &mpc866_uart_pdata[id];
310 pinfo->uart_clk = bd->bi_intfreq; 310 pinfo->uart_clk = bd->bi_intfreq;
311 pdev->dev.platform_data = pinfo; 311 pdev->dev.platform_data = pinfo;
diff --git a/arch/ppc/platforms/mpc885ads_setup.c b/arch/ppc/platforms/mpc885ads_setup.c
index 02293141efb5..f8161f3557f5 100644
--- a/arch/ppc/platforms/mpc885ads_setup.c
+++ b/arch/ppc/platforms/mpc885ads_setup.c
@@ -263,7 +263,7 @@ static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no)
263 char *e; 263 char *e;
264 int i; 264 int i;
265 265
266 if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { 266 if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) {
267 printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); 267 printk(KERN_ERR"No network-suitable #%d device on bus", fs_no);
268 return; 268 return;
269 } 269 }
@@ -371,7 +371,7 @@ static void __init mpc885ads_fixup_uart_pdata(struct platform_device *pdev,
371 int id = fs_uart_id_smc2fsid(idx); 371 int id = fs_uart_id_smc2fsid(idx);
372 372
373 /* no need to alter anything if console */ 373 /* no need to alter anything if console */
374 if ((id <= num) && (!pdev->dev.platform_data)) { 374 if ((id < num) && (!pdev->dev.platform_data)) {
375 pinfo = &mpc885_uart_pdata[id]; 375 pinfo = &mpc885_uart_pdata[id];
376 pinfo->uart_clk = bd->bi_intfreq; 376 pinfo->uart_clk = bd->bi_intfreq;
377 pdev->dev.platform_data = pinfo; 377 pdev->dev.platform_data = pinfo;
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index a3257398ea8d..c313e9a9304f 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.19-rc2
4# Wed Oct 4 19:45:46 2006 4# Wed Oct 18 17:11:10 2006
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_LOCKDEP_SUPPORT=y 7CONFIG_LOCKDEP_SUPPORT=y
@@ -211,6 +211,7 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=y
211CONFIG_INET6_XFRM_MODE_TUNNEL=y 211CONFIG_INET6_XFRM_MODE_TUNNEL=y
212CONFIG_INET6_XFRM_MODE_BEET=y 212CONFIG_INET6_XFRM_MODE_BEET=y
213# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 213# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
214CONFIG_IPV6_SIT=y
214# CONFIG_IPV6_TUNNEL is not set 215# CONFIG_IPV6_TUNNEL is not set
215# CONFIG_IPV6_SUBTREES is not set 216# CONFIG_IPV6_SUBTREES is not set
216# CONFIG_IPV6_MULTIPLE_TABLES is not set 217# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -528,6 +529,7 @@ CONFIG_EXT3_FS=y
528CONFIG_EXT3_FS_XATTR=y 529CONFIG_EXT3_FS_XATTR=y
529# CONFIG_EXT3_FS_POSIX_ACL is not set 530# CONFIG_EXT3_FS_POSIX_ACL is not set
530# CONFIG_EXT3_FS_SECURITY is not set 531# CONFIG_EXT3_FS_SECURITY is not set
532# CONFIG_EXT4DEV_FS is not set
531CONFIG_JBD=y 533CONFIG_JBD=y
532# CONFIG_JBD_DEBUG is not set 534# CONFIG_JBD_DEBUG is not set
533CONFIG_FS_MBCACHE=y 535CONFIG_FS_MBCACHE=y
@@ -646,10 +648,6 @@ CONFIG_MSDOS_PARTITION=y
646# CONFIG_NLS is not set 648# CONFIG_NLS is not set
647 649
648# 650#
649# Distributed Lock Manager
650#
651
652#
653# Instrumentation Support 651# Instrumentation Support
654# 652#
655 653
@@ -669,7 +667,6 @@ CONFIG_MAGIC_SYSRQ=y
669# CONFIG_UNUSED_SYMBOLS is not set 667# CONFIG_UNUSED_SYMBOLS is not set
670CONFIG_DEBUG_KERNEL=y 668CONFIG_DEBUG_KERNEL=y
671CONFIG_LOG_BUF_SHIFT=17 669CONFIG_LOG_BUF_SHIFT=17
672# CONFIG_DETECT_SOFTLOCKUP is not set
673# CONFIG_SCHEDSTATS is not set 670# CONFIG_SCHEDSTATS is not set
674# CONFIG_DEBUG_SLAB is not set 671# CONFIG_DEBUG_SLAB is not set
675CONFIG_DEBUG_PREEMPT=y 672CONFIG_DEBUG_PREEMPT=y
@@ -690,6 +687,7 @@ CONFIG_DEBUG_FS=y
690# CONFIG_FRAME_POINTER is not set 687# CONFIG_FRAME_POINTER is not set
691# CONFIG_UNWIND_INFO is not set 688# CONFIG_UNWIND_INFO is not set
692CONFIG_FORCED_INLINING=y 689CONFIG_FORCED_INLINING=y
690CONFIG_HEADERS_CHECK=y
693# CONFIG_RCU_TORTURE_TEST is not set 691# CONFIG_RCU_TORTURE_TEST is not set
694# CONFIG_LKDTM is not set 692# CONFIG_LKDTM is not set
695 693
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index e15e1489aef5..2001767e1dc7 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -295,6 +295,7 @@ static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
295 * 295 *
296 * This is really horribly ugly. 296 * This is really horribly ugly.
297 */ 297 */
298#ifdef CONFIG_SYSVIPC
298asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr) 299asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
299{ 300{
300 if (call >> 16) /* hack for backward compatibility */ 301 if (call >> 16) /* hack for backward compatibility */
@@ -338,6 +339,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
338 339
339 return -ENOSYS; 340 return -ENOSYS;
340} 341}
342#endif
341 343
342asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
343{ 345{
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index e59baec56520..a4ceae3dbcf1 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -320,3 +320,4 @@ SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper) 320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper)
321NI_SYSCALL /* 310 sys_move_pages */ 321NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,sys_ni_syscall)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9431e967aa45..2f96610a83e9 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -289,6 +289,13 @@ endmenu
289 289
290source "fs/Kconfig" 290source "fs/Kconfig"
291 291
292menu "Instrumentation Support"
293 depends on EXPERIMENTAL
294
295source "arch/sparc/oprofile/Kconfig"
296
297endmenu
298
292source "arch/sparc/Kconfig.debug" 299source "arch/sparc/Kconfig.debug"
293 300
294source "security/Kconfig" 301source "security/Kconfig"
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 4cdbb2d59ed0..f33c3817f014 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -30,6 +30,8 @@ HEAD_Y := $(head-y)
30core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ 30core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/
31libs-y += arch/sparc/prom/ arch/sparc/lib/ 31libs-y += arch/sparc/prom/ arch/sparc/lib/
32 32
33drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
34
33# Export what is needed by arch/sparc/boot/Makefile 35# Export what is needed by arch/sparc/boot/Makefile
34# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) 36# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-)
35INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) 37INIT_Y := $(patsubst %/, %/built-in.o, $(init-y))
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index b3b6680a2a30..c8cb211b9072 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -351,7 +351,7 @@ void handler_irq(int irq, struct pt_regs * regs)
351} 351}
352 352
353#ifdef CONFIG_BLK_DEV_FD 353#ifdef CONFIG_BLK_DEV_FD
354extern void floppy_interrupt(int irq, void *dev_id) 354extern void floppy_interrupt(int irq, void *dev_id);
355 355
356void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) 356void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
357{ 357{
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index f5ee1ac834bc..383526ad94fc 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -103,7 +103,6 @@ void prom_sync_me(void)
103 103
104unsigned int boot_flags __initdata = 0; 104unsigned int boot_flags __initdata = 0;
105#define BOOTME_DEBUG 0x1 105#define BOOTME_DEBUG 0x1
106#define BOOTME_SINGLE 0x2
107 106
108/* Exported for mm/init.c:paging_init. */ 107/* Exported for mm/init.c:paging_init. */
109unsigned long cmdline_memory_size __initdata = 0; 108unsigned long cmdline_memory_size __initdata = 0;
@@ -132,7 +131,6 @@ static void __init process_switch(char c)
132 boot_flags |= BOOTME_DEBUG; 131 boot_flags |= BOOTME_DEBUG;
133 break; 132 break;
134 case 's': 133 case 's':
135 boot_flags |= BOOTME_SINGLE;
136 break; 134 break;
137 case 'h': 135 case 'h':
138 prom_printf("boot_flags_init: Halt!\n"); 136 prom_printf("boot_flags_init: Halt!\n");
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 7dcd1a16c6e4..6c7aa51b590f 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -95,6 +95,8 @@ unsigned long profile_pc(struct pt_regs *regs)
95 return pc; 95 return pc;
96} 96}
97 97
98EXPORT_SYMBOL(profile_pc);
99
98__volatile__ unsigned int *master_l10_counter; 100__volatile__ unsigned int *master_l10_counter;
99__volatile__ unsigned int *master_l10_limit; 101__volatile__ unsigned int *master_l10_limit;
100 102
diff --git a/arch/sparc/oprofile/Kconfig b/arch/sparc/oprofile/Kconfig
new file mode 100644
index 000000000000..d8a84088471a
--- /dev/null
+++ b/arch/sparc/oprofile/Kconfig
@@ -0,0 +1,17 @@
1config PROFILING
2 bool "Profiling support (EXPERIMENTAL)"
3 help
4 Say Y here to enable the extended profiling support mechanisms used
5 by profilers such as OProfile.
6
7
8config OPROFILE
9 tristate "OProfile system profiling (EXPERIMENTAL)"
10 depends on PROFILING
11 help
12 OProfile is a profiling system capable of profiling the
13 whole system, include the kernel, kernel modules, libraries,
14 and applications.
15
16 If unsure, say N.
17
diff --git a/arch/sparc/oprofile/Makefile b/arch/sparc/oprofile/Makefile
new file mode 100644
index 000000000000..e9feca1ca28b
--- /dev/null
+++ b/arch/sparc/oprofile/Makefile
@@ -0,0 +1,9 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o
2
3DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
4 oprof.o cpu_buffer.o buffer_sync.o \
5 event_buffer.o oprofile_files.o \
6 oprofilefs.o oprofile_stats.o \
7 timer_int.o )
8
9oprofile-y := $(DRIVER_OBJS) init.o
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c
new file mode 100644
index 000000000000..9ab815b95b5a
--- /dev/null
+++ b/arch/sparc/oprofile/init.c
@@ -0,0 +1,23 @@
1/**
2 * @file init.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
10#include <linux/kernel.h>
11#include <linux/oprofile.h>
12#include <linux/errno.h>
13#include <linux/init.h>
14
15int __init oprofile_arch_init(struct oprofile_operations * ops)
16{
17 return -ENODEV;
18}
19
20
21void oprofile_arch_exit(void)
22{
23}
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index dcae559879ae..2f4612fa81f2 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc1 3# Linux kernel version: 2.6.19-rc2
4# Thu Oct 5 02:08:41 2006 4# Tue Oct 17 19:29:20 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -217,6 +217,7 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=m
217CONFIG_INET6_XFRM_MODE_TUNNEL=m 217CONFIG_INET6_XFRM_MODE_TUNNEL=m
218CONFIG_INET6_XFRM_MODE_BEET=m 218CONFIG_INET6_XFRM_MODE_BEET=m
219# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 219# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
220CONFIG_IPV6_SIT=m
220CONFIG_IPV6_TUNNEL=m 221CONFIG_IPV6_TUNNEL=m
221# CONFIG_IPV6_SUBTREES is not set 222# CONFIG_IPV6_SUBTREES is not set
222# CONFIG_IPV6_MULTIPLE_TABLES is not set 223# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -334,6 +335,12 @@ CONFIG_CDROM_PKTCDVD_WCACHE=y
334CONFIG_ATA_OVER_ETH=m 335CONFIG_ATA_OVER_ETH=m
335 336
336# 337#
338# Misc devices
339#
340# CONFIG_SGI_IOC4 is not set
341# CONFIG_TIFM_CORE is not set
342
343#
337# ATA/ATAPI/MFM/RLL support 344# ATA/ATAPI/MFM/RLL support
338# 345#
339CONFIG_IDE=y 346CONFIG_IDE=y
@@ -728,7 +735,6 @@ CONFIG_RTC=y
728# TPM devices 735# TPM devices
729# 736#
730# CONFIG_TCG_TPM is not set 737# CONFIG_TCG_TPM is not set
731# CONFIG_TELCLOCK is not set
732 738
733# 739#
734# I2C support 740# I2C support
@@ -842,11 +848,6 @@ CONFIG_HWMON=y
842# CONFIG_HWMON_DEBUG_CHIP is not set 848# CONFIG_HWMON_DEBUG_CHIP is not set
843 849
844# 850#
845# Misc devices
846#
847# CONFIG_TIFM_CORE is not set
848
849#
850# Multimedia devices 851# Multimedia devices
851# 852#
852# CONFIG_VIDEO_DEV is not set 853# CONFIG_VIDEO_DEV is not set
@@ -1104,7 +1105,6 @@ CONFIG_USB_HIDDEV=y
1104# CONFIG_USB_ATI_REMOTE2 is not set 1105# CONFIG_USB_ATI_REMOTE2 is not set
1105# CONFIG_USB_KEYSPAN_REMOTE is not set 1106# CONFIG_USB_KEYSPAN_REMOTE is not set
1106# CONFIG_USB_APPLETOUCH is not set 1107# CONFIG_USB_APPLETOUCH is not set
1107# CONFIG_USB_TRANCEVIBRATOR is not set
1108 1108
1109# 1109#
1110# USB Imaging devices 1110# USB Imaging devices
@@ -1150,6 +1150,7 @@ CONFIG_USB_HIDDEV=y
1150# CONFIG_USB_APPLEDISPLAY is not set 1150# CONFIG_USB_APPLEDISPLAY is not set
1151# CONFIG_USB_SISUSBVGA is not set 1151# CONFIG_USB_SISUSBVGA is not set
1152# CONFIG_USB_LD is not set 1152# CONFIG_USB_LD is not set
1153# CONFIG_USB_TRANCEVIBRATOR is not set
1153# CONFIG_USB_TEST is not set 1154# CONFIG_USB_TEST is not set
1154 1155
1155# 1156#
@@ -1234,6 +1235,7 @@ CONFIG_EXT3_FS=y
1234CONFIG_EXT3_FS_XATTR=y 1235CONFIG_EXT3_FS_XATTR=y
1235CONFIG_EXT3_FS_POSIX_ACL=y 1236CONFIG_EXT3_FS_POSIX_ACL=y
1236CONFIG_EXT3_FS_SECURITY=y 1237CONFIG_EXT3_FS_SECURITY=y
1238# CONFIG_EXT4DEV_FS is not set
1237CONFIG_JBD=y 1239CONFIG_JBD=y
1238# CONFIG_JBD_DEBUG is not set 1240# CONFIG_JBD_DEBUG is not set
1239CONFIG_FS_MBCACHE=y 1241CONFIG_FS_MBCACHE=y
@@ -1362,10 +1364,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1362# CONFIG_NLS_UTF8 is not set 1364# CONFIG_NLS_UTF8 is not set
1363 1365
1364# 1366#
1365# Distributed Lock Manager
1366#
1367
1368#
1369# Instrumentation Support 1367# Instrumentation Support
1370# 1368#
1371CONFIG_PROFILING=y 1369CONFIG_PROFILING=y
@@ -1399,6 +1397,7 @@ CONFIG_DEBUG_FS=y
1399# CONFIG_DEBUG_LIST is not set 1397# CONFIG_DEBUG_LIST is not set
1400# CONFIG_UNWIND_INFO is not set 1398# CONFIG_UNWIND_INFO is not set
1401CONFIG_FORCED_INLINING=y 1399CONFIG_FORCED_INLINING=y
1400# CONFIG_HEADERS_CHECK is not set
1402# CONFIG_RCU_TORTURE_TEST is not set 1401# CONFIG_RCU_TORTURE_TEST is not set
1403# CONFIG_LKDTM is not set 1402# CONFIG_LKDTM is not set
1404# CONFIG_DEBUG_STACK_USAGE is not set 1403# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index d822c7c18e1f..d3dfb2a36d47 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -131,8 +131,13 @@ static int of_device_resume(struct device * dev)
131void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name) 131void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name)
132{ 132{
133 unsigned long ret = res->start + offset; 133 unsigned long ret = res->start + offset;
134 struct resource *r;
134 135
135 if (!request_region(ret, size, name)) 136 if (res->flags & IORESOURCE_MEM)
137 r = request_mem_region(ret, size, name);
138 else
139 r = request_region(ret, size, name);
140 if (!r)
136 ret = 0; 141 ret = 0;
137 142
138 return (void __iomem *) ret; 143 return (void __iomem *) ret;
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 7a59cc72c844..827ae30aa497 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -330,19 +330,6 @@ __init get_device_resource(struct linux_prom_pci_registers *ap,
330 return res; 330 return res;
331} 331}
332 332
333static int __init pdev_resource_collisions_expected(struct pci_dev *pdev)
334{
335 if (pdev->vendor != PCI_VENDOR_ID_SUN)
336 return 0;
337
338 if (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS ||
339 pdev->device == PCI_DEVICE_ID_SUN_RIO_1394 ||
340 pdev->device == PCI_DEVICE_ID_SUN_RIO_USB)
341 return 1;
342
343 return 0;
344}
345
346static void __init pdev_record_assignments(struct pci_pbm_info *pbm, 333static void __init pdev_record_assignments(struct pci_pbm_info *pbm,
347 struct pci_dev *pdev) 334 struct pci_dev *pdev)
348{ 335{
@@ -400,19 +387,23 @@ static void __init pdev_record_assignments(struct pci_pbm_info *pbm,
400 pbm->parent->resource_adjust(pdev, res, root); 387 pbm->parent->resource_adjust(pdev, res, root);
401 388
402 if (request_resource(root, res) < 0) { 389 if (request_resource(root, res) < 0) {
390 int rnum;
391
403 /* OK, there is some conflict. But this is fine 392 /* OK, there is some conflict. But this is fine
404 * since we'll reassign it in the fixup pass. 393 * since we'll reassign it in the fixup pass.
405 * 394 *
406 * We notify the user that OBP made an error if it 395 * Do not print the warning for ROM resources
407 * is a case we don't expect. 396 * as such a conflict is quite common and
397 * harmless as the ROM bar is disabled.
408 */ 398 */
409 if (!pdev_resource_collisions_expected(pdev)) { 399 rnum = (res - &pdev->resource[0]);
410 printk(KERN_ERR "PCI: Address space collision on region %ld " 400 if (rnum != PCI_ROM_RESOURCE)
401 printk(KERN_ERR "PCI: Resource collision, "
402 "region %d "
411 "[%016lx:%016lx] of device %s\n", 403 "[%016lx:%016lx] of device %s\n",
412 (res - &pdev->resource[0]), 404 rnum,
413 res->start, res->end, 405 res->start, res->end,
414 pci_name(pdev)); 406 pci_name(pdev));
415 }
416 } 407 }
417 } 408 }
418} 409}
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 6ec569828c29..94bb681f2323 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -1196,7 +1196,7 @@ static void pbm_register_toplevel_resources(struct pci_controller_info *p,
1196 &pbm->mem_space); 1196 &pbm->mem_space);
1197} 1197}
1198 1198
1199static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_begin) 1199static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_start, u32 dma_end)
1200{ 1200{
1201 struct pci_pbm_info *pbm; 1201 struct pci_pbm_info *pbm;
1202 struct device_node *node; 1202 struct device_node *node;
@@ -1261,6 +1261,8 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1261 node = node->sibling; 1261 node = node->sibling;
1262 } 1262 }
1263 if (simbas_found == 0) { 1263 if (simbas_found == 0) {
1264 struct resource *rp;
1265
1264 /* No APBs underneath, probably this is a hummingbird 1266 /* No APBs underneath, probably this is a hummingbird
1265 * system. 1267 * system.
1266 */ 1268 */
@@ -1302,8 +1304,10 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1302 pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL; 1304 pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL;
1303 pbm->io_space.flags = IORESOURCE_IO; 1305 pbm->io_space.flags = IORESOURCE_IO;
1304 1306
1305 pbm->mem_space.start = p->pbm_A.controller_regs + SABRE_MEMSPACE; 1307 pbm->mem_space.start =
1306 pbm->mem_space.end = pbm->mem_space.start + (unsigned long)dma_begin - 1UL; 1308 (p->pbm_A.controller_regs + SABRE_MEMSPACE);
1309 pbm->mem_space.end =
1310 (pbm->mem_space.start + ((1UL << 32UL) - 1UL));
1307 pbm->mem_space.flags = IORESOURCE_MEM; 1311 pbm->mem_space.flags = IORESOURCE_MEM;
1308 1312
1309 if (request_resource(&ioport_resource, &pbm->io_space) < 0) { 1313 if (request_resource(&ioport_resource, &pbm->io_space) < 0) {
@@ -1315,6 +1319,17 @@ static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp
1315 prom_halt(); 1319 prom_halt();
1316 } 1320 }
1317 1321
1322 rp = kmalloc(sizeof(*rp), GFP_KERNEL);
1323 if (!rp) {
1324 prom_printf("Cannot allocate IOMMU resource.\n");
1325 prom_halt();
1326 }
1327 rp->name = "IOMMU";
1328 rp->start = pbm->mem_space.start + (unsigned long) dma_start;
1329 rp->end = pbm->mem_space.start + (unsigned long) dma_end - 1UL;
1330 rp->flags = IORESOURCE_BUSY;
1331 request_resource(&pbm->mem_space, rp);
1332
1318 pci_register_legacy_regions(&pbm->io_space, 1333 pci_register_legacy_regions(&pbm->io_space,
1319 &pbm->mem_space); 1334 &pbm->mem_space);
1320 } 1335 }
@@ -1450,5 +1465,5 @@ void sabre_init(struct device_node *dp, char *model_name)
1450 /* 1465 /*
1451 * Look for APB underneath. 1466 * Look for APB underneath.
1452 */ 1467 */
1453 sabre_pbm_init(p, dp, vdma[0]); 1468 sabre_pbm_init(p, dp, vdma[0], vdma[0] + vdma[1]);
1454} 1469}
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index cc8ad480a204..bf033b31d437 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -74,7 +74,6 @@ prom_console_write(struct console *con, const char *s, unsigned n)
74 74
75unsigned int boot_flags = 0; 75unsigned int boot_flags = 0;
76#define BOOTME_DEBUG 0x1 76#define BOOTME_DEBUG 0x1
77#define BOOTME_SINGLE 0x2
78 77
79/* Exported for mm/init.c:paging_init. */ 78/* Exported for mm/init.c:paging_init. */
80unsigned long cmdline_memory_size = 0; 79unsigned long cmdline_memory_size = 0;
@@ -102,7 +101,6 @@ static void __init process_switch(char c)
102 boot_flags |= BOOTME_DEBUG; 101 boot_flags |= BOOTME_DEBUG;
103 break; 102 break;
104 case 's': 103 case 's':
105 boot_flags |= BOOTME_SINGLE;
106 break; 104 break;
107 case 'h': 105 case 'h':
108 prom_printf("boot_flags_init: Halt!\n"); 106 prom_printf("boot_flags_init: Halt!\n");
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 78fb619bdb73..5ac1f2963ae3 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -1,3 +1,8 @@
1config DEFCONFIG_LIST
2 string
3 option defconfig_list
4 default "arch/$ARCH/defconfig"
5
1# UML uses the generic IRQ sugsystem 6# UML uses the generic IRQ sugsystem
2config GENERIC_HARDIRQS 7config GENERIC_HARDIRQS
3 bool 8 bool
@@ -52,6 +57,7 @@ menu "UML-specific options"
52config MODE_TT 57config MODE_TT
53 bool "Tracing thread support (DEPRECATED)" 58 bool "Tracing thread support (DEPRECATED)"
54 default n 59 default n
60 depends on BROKEN
55 help 61 help
56 This option controls whether tracing thread support is compiled 62 This option controls whether tracing thread support is compiled
57 into UML. This option is largely obsolete, given that skas0 provides 63 into UML. This option is largely obsolete, given that skas0 provides
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 62d87b71179b..e03e40c7aac3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -190,6 +190,11 @@ config HOSTAUDIO
190 tristate 190 tristate
191 default UML_SOUND 191 default UML_SOUND
192 192
193#It is selected elsewhere, so kconfig would warn without this.
194config HW_RANDOM
195 tristate
196 default n
197
193config UML_RANDOM 198config UML_RANDOM
194 tristate "Hardware random number generator" 199 tristate "Hardware random number generator"
195 help 200 help
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index 7a5b4afde692..c6a308464acb 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -5,6 +5,7 @@
5#include "user_util.h" 5#include "user_util.h"
6#include "os.h" 6#include "os.h"
7#include "user.h" 7#include "user.h"
8#include "um_malloc.h"
8 9
9static inline void *cow_malloc(int size) 10static inline void *cow_malloc(int size)
10{ 11{
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 77954ea77043..310af0f1e49e 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -17,6 +17,7 @@
17#include "user_util.h" 17#include "user_util.h"
18#include "user.h" 18#include "user.h"
19#include "os.h" 19#include "os.h"
20#include "um_malloc.h"
20 21
21#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 22#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
22 23
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 108b7dafbd0e..218aa0e9b792 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -12,6 +12,7 @@
12#include "user_util.h" 12#include "user_util.h"
13#include "chan_user.h" 13#include "chan_user.h"
14#include "os.h" 14#include "os.h"
15#include "um_malloc.h"
15 16
16struct fd_chan { 17struct fd_chan {
17 int fd; 18 int fd;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 4d2bd39a85bc..8138f5ea1bf7 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -23,6 +23,7 @@
23#include "user_util.h" 23#include "user_util.h"
24#include "user.h" 24#include "user.h"
25#include "os.h" 25#include "os.h"
26#include "um_malloc.h"
26 27
27#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 28#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
28 29
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index 9a3b5daf6250..df3516e47d4d 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -95,7 +95,8 @@ static const struct file_operations mmapper_fops = {
95 .release = mmapper_release, 95 .release = mmapper_release,
96}; 96};
97 97
98static const struct miscdevice mmapper_dev = { 98/* No locking needed - only used (and modified) by below initcall and exitcall. */
99static struct miscdevice mmapper_dev = {
99 .minor = MISC_DYNAMIC_MINOR, 100 .minor = MISC_DYNAMIC_MINOR,
100 .name = "mmapper", 101 .name = "mmapper",
101 .fops = &mmapper_fops 102 .fops = &mmapper_fops
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index f3a3f8a29c7a..0ffd7ac295d4 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -18,6 +18,7 @@
18#include "kern_util.h" 18#include "kern_util.h"
19#include "net_user.h" 19#include "net_user.h"
20#include "os.h" 20#include "os.h"
21#include "um_malloc.h"
21 22
22int tap_open_common(void *dev, char *gate_addr) 23int tap_open_common(void *dev, char *gate_addr)
23{ 24{
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index 2ef641ded960..11921a7baa7b 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -12,6 +12,7 @@
12#include "net_user.h" 12#include "net_user.h"
13#include "pcap_user.h" 13#include "pcap_user.h"
14#include "user.h" 14#include "user.h"
15#include "um_malloc.h"
15 16
16#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 17#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
17 18
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index f2e8fc42ecc2..bc6afaf74c1a 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -19,6 +19,7 @@
19#include "chan_user.h" 19#include "chan_user.h"
20#include "port.h" 20#include "port.h"
21#include "os.h" 21#include "os.h"
22#include "um_malloc.h"
22 23
23struct port_chan { 24struct port_chan {
24 int raw; 25 int raw;
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index abec620e8380..829a5eca8c07 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -13,6 +13,7 @@
13#include "user_util.h" 13#include "user_util.h"
14#include "kern_util.h" 14#include "kern_util.h"
15#include "os.h" 15#include "os.h"
16#include "um_malloc.h"
16 17
17struct pty_chan { 18struct pty_chan {
18 void (*announce)(char *dev_name, int dev); 19 void (*announce)(char *dev_name, int dev);
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 8460285c69a5..7eddacc53b6e 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -15,6 +15,7 @@
15#include "slip.h" 15#include "slip.h"
16#include "slip_common.h" 16#include "slip_common.h"
17#include "os.h" 17#include "os.h"
18#include "um_malloc.h"
18 19
19void slip_user_init(void *data, void *dev) 20void slip_user_init(void *data, void *dev)
20{ 21{
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index 11de3ac1eb5c..d95d64309eaf 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -11,6 +11,7 @@
11#include "user_util.h" 11#include "user_util.h"
12#include "user.h" 12#include "user.h"
13#include "os.h" 13#include "os.h"
14#include "um_malloc.h"
14 15
15struct tty_chan { 16struct tty_chan {
16 char *dev; 17 char *dev;
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 386f8b952982..850221d9b4c9 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -136,8 +136,6 @@ int xterm_open(int input, int output, int primary, void *d,
136 return(pid); 136 return(pid);
137 } 137 }
138 138
139 if(data->stack == 0) free_stack(stack, 0);
140
141 if (data->direct_rcv) { 139 if (data->direct_rcv) {
142 new = os_rcv_fd(fd, &data->helper_pid); 140 new = os_rcv_fd(fd, &data->helper_pid);
143 } else { 141 } else {
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
new file mode 100644
index 000000000000..0363a9b53f8d
--- /dev/null
+++ b/arch/um/include/um_malloc.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_MALLOC_H__
7#define __UM_MALLOC_H__
8
9extern void *um_kmalloc(int size);
10extern void *um_kmalloc_atomic(int size);
11extern void kfree(const void *ptr);
12
13extern void *um_vmalloc(int size);
14extern void *um_vmalloc_atomic(int size);
15extern void vfree(void *ptr);
16
17#endif /* __UM_MALLOC_H__ */
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 39f8c8801076..acadce3f271f 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -11,17 +11,11 @@ extern void panic(const char *fmt, ...)
11extern int printk(const char *fmt, ...) 11extern int printk(const char *fmt, ...)
12 __attribute__ ((format (printf, 1, 2))); 12 __attribute__ ((format (printf, 1, 2)));
13extern void schedule(void); 13extern void schedule(void);
14extern void *um_kmalloc(int size);
15extern void *um_kmalloc_atomic(int size);
16extern void kfree(void *ptr);
17extern int in_aton(char *str); 14extern int in_aton(char *str);
18extern int open_gdb_chan(void); 15extern int open_gdb_chan(void);
19/* These use size_t, however unsigned long is correct on both i386 and x86_64. */ 16/* These use size_t, however unsigned long is correct on both i386 and x86_64. */
20extern unsigned long strlcpy(char *, const char *, unsigned long); 17extern unsigned long strlcpy(char *, const char *, unsigned long);
21extern unsigned long strlcat(char *, const char *, unsigned long); 18extern unsigned long strlcat(char *, const char *, unsigned long);
22extern void *um_vmalloc(int size);
23extern void *um_vmalloc_atomic(int size);
24extern void vfree(void *ptr);
25 19
26#endif 20#endif
27 21
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index 802d7842514d..06625fefef33 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -52,7 +52,6 @@ extern int linux_main(int argc, char **argv);
52extern void set_cmdline(char *cmd); 52extern void set_cmdline(char *cmd);
53extern void input_cb(void (*proc)(void *), void *arg, int arg_len); 53extern void input_cb(void (*proc)(void *), void *arg, int arg_len);
54extern int get_pty(void); 54extern int get_pty(void);
55extern void *um_kmalloc(int size);
56extern int switcheroo(int fd, int prot, void *from, void *to, int size); 55extern int switcheroo(int fd, int prot, void *from, void *to, int size);
57extern void do_exec(int old_pid, int new_pid); 56extern void do_exec(int old_pid, int new_pid);
58extern void tracer_panic(char *msg, ...) 57extern void tracer_panic(char *msg, ...)
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index ef259569fd8c..5c1e611f628d 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -31,6 +31,7 @@
31#include "irq_kern.h" 31#include "irq_kern.h"
32#include "os.h" 32#include "os.h"
33#include "sigio.h" 33#include "sigio.h"
34#include "um_malloc.h"
34#include "misc_constants.h" 35#include "misc_constants.h"
35 36
36/* 37/*
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fe6c64abda5b..348b272bb766 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -46,6 +46,7 @@
46#include "mode.h" 46#include "mode.h"
47#include "mode_kern.h" 47#include "mode_kern.h"
48#include "choose-mode.h" 48#include "choose-mode.h"
49#include "um_malloc.h"
49 50
50/* This is a per-cpu array. A processor only modifies its entry and it only 51/* This is a per-cpu array. A processor only modifies its entry and it only
51 * cares about its entry, so it's OK if another processor is modifying its 52 * cares about its entry, so it's OK if another processor is modifying its
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index f559bdf746e6..863981ba1468 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -20,6 +20,7 @@
20#include "net_user.h" 20#include "net_user.h"
21#include "etap.h" 21#include "etap.h"
22#include "os.h" 22#include "os.h"
23#include "um_malloc.h"
23 24
24#define MAX_PACKET ETH_MAX_PACKET 25#define MAX_PACKET ETH_MAX_PACKET
25 26
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index cd15b9df5b5c..d13299cfa318 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -35,22 +35,23 @@ static int helper_child(void *arg)
35 char **argv = data->argv; 35 char **argv = data->argv;
36 int errval; 36 int errval;
37 37
38 if(helper_pause){ 38 if (helper_pause){
39 signal(SIGHUP, helper_hup); 39 signal(SIGHUP, helper_hup);
40 pause(); 40 pause();
41 } 41 }
42 if(data->pre_exec != NULL) 42 if (data->pre_exec != NULL)
43 (*data->pre_exec)(data->pre_data); 43 (*data->pre_exec)(data->pre_data);
44 execvp(argv[0], argv); 44 execvp(argv[0], argv);
45 errval = -errno; 45 errval = -errno;
46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); 46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno);
47 os_write_file(data->fd, &errval, sizeof(errval)); 47 os_write_file(data->fd, &errval, sizeof(errval));
48 kill(os_getpid(), SIGKILL); 48 kill(os_getpid(), SIGKILL);
49 return(0); 49 return 0;
50} 50}
51 51
52/* Returns either the pid of the child process we run or -E* on failure. 52/* Returns either the pid of the child process we run or -E* on failure.
53 * XXX The alloc_stack here breaks if this is called in the tracing thread */ 53 * XXX The alloc_stack here breaks if this is called in the tracing thread, so
54 * we need to receive a preallocated stack (a local buffer is ok). */
54int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, 55int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
55 unsigned long *stack_out) 56 unsigned long *stack_out)
56{ 57{
@@ -58,20 +59,21 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
58 unsigned long stack, sp; 59 unsigned long stack, sp;
59 int pid, fds[2], ret, n; 60 int pid, fds[2], ret, n;
60 61
61 if((stack_out != NULL) && (*stack_out != 0)) 62 if ((stack_out != NULL) && (*stack_out != 0))
62 stack = *stack_out; 63 stack = *stack_out;
63 else stack = alloc_stack(0, __cant_sleep()); 64 else
64 if(stack == 0) 65 stack = alloc_stack(0, __cant_sleep());
66 if (stack == 0)
65 return -ENOMEM; 67 return -ENOMEM;
66 68
67 ret = os_pipe(fds, 1, 0); 69 ret = os_pipe(fds, 1, 0);
68 if(ret < 0){ 70 if (ret < 0) {
69 printk("run_helper : pipe failed, ret = %d\n", -ret); 71 printk("run_helper : pipe failed, ret = %d\n", -ret);
70 goto out_free; 72 goto out_free;
71 } 73 }
72 74
73 ret = os_set_exec_close(fds[1], 1); 75 ret = os_set_exec_close(fds[1], 1);
74 if(ret < 0){ 76 if (ret < 0) {
75 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", 77 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n",
76 -ret); 78 -ret);
77 goto out_close; 79 goto out_close;
@@ -83,7 +85,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
83 data.argv = argv; 85 data.argv = argv;
84 data.fd = fds[1]; 86 data.fd = fds[1];
85 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); 87 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data);
86 if(pid < 0){ 88 if (pid < 0) {
87 ret = -errno; 89 ret = -errno;
88 printk("run_helper : clone failed, errno = %d\n", errno); 90 printk("run_helper : clone failed, errno = %d\n", errno);
89 goto out_close; 91 goto out_close;
@@ -95,10 +97,10 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
95 /* Read the errno value from the child, if the exec failed, or get 0 if 97 /* Read the errno value from the child, if the exec failed, or get 0 if
96 * the exec succeeded because the pipe fd was set as close-on-exec. */ 98 * the exec succeeded because the pipe fd was set as close-on-exec. */
97 n = os_read_file(fds[0], &ret, sizeof(ret)); 99 n = os_read_file(fds[0], &ret, sizeof(ret));
98 if(n == 0) 100 if (n == 0) {
99 ret = pid; 101 ret = pid;
100 else { 102 } else {
101 if(n < 0){ 103 if (n < 0) {
102 printk("run_helper : read on pipe failed, ret = %d\n", 104 printk("run_helper : read on pipe failed, ret = %d\n",
103 -n); 105 -n);
104 ret = n; 106 ret = n;
@@ -112,10 +114,9 @@ out_close:
112 close(fds[1]); 114 close(fds[1]);
113 close(fds[0]); 115 close(fds[0]);
114out_free: 116out_free:
115 if(stack_out == NULL) 117 if ((stack_out == NULL) || (*stack_out == 0))
116 free_stack(stack, 0); 118 free_stack(stack, 0);
117 else *stack_out = stack; 119 return ret;
118 return(ret);
119} 120}
120 121
121int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, 122int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
@@ -125,31 +126,32 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
125 int pid, status, err; 126 int pid, status, err;
126 127
127 stack = alloc_stack(stack_order, __cant_sleep()); 128 stack = alloc_stack(stack_order, __cant_sleep());
128 if(stack == 0) return(-ENOMEM); 129 if (stack == 0)
130 return -ENOMEM;
129 131
130 sp = stack + (page_size() << stack_order) - sizeof(void *); 132 sp = stack + (page_size() << stack_order) - sizeof(void *);
131 pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); 133 pid = clone(proc, (void *) sp, flags | SIGCHLD, arg);
132 if(pid < 0){ 134 if (pid < 0) {
133 err = -errno; 135 err = -errno;
134 printk("run_helper_thread : clone failed, errno = %d\n", 136 printk("run_helper_thread : clone failed, errno = %d\n",
135 errno); 137 errno);
136 return err; 138 return err;
137 } 139 }
138 if(stack_out == NULL){ 140 if (stack_out == NULL) {
139 CATCH_EINTR(pid = waitpid(pid, &status, 0)); 141 CATCH_EINTR(pid = waitpid(pid, &status, 0));
140 if(pid < 0){ 142 if (pid < 0) {
141 err = -errno; 143 err = -errno;
142 printk("run_helper_thread - wait failed, errno = %d\n", 144 printk("run_helper_thread - wait failed, errno = %d\n",
143 errno); 145 errno);
144 pid = err; 146 pid = err;
145 } 147 }
146 if(!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) 148 if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0))
147 printk("run_helper_thread - thread returned status " 149 printk("run_helper_thread - thread returned status "
148 "0x%x\n", status); 150 "0x%x\n", status);
149 free_stack(stack, stack_order); 151 free_stack(stack, stack_order);
150 } 152 } else
151 else *stack_out = stack; 153 *stack_out = stack;
152 return(pid); 154 return pid;
153} 155}
154 156
155int helper_wait(int pid) 157int helper_wait(int pid)
@@ -157,9 +159,9 @@ int helper_wait(int pid)
157 int ret; 159 int ret;
158 160
159 CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); 161 CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG));
160 if(ret < 0){ 162 if (ret < 0) {
161 ret = -errno; 163 ret = -errno;
162 printk("helper_wait : waitpid failed, errno = %d\n", errno); 164 printk("helper_wait : waitpid failed, errno = %d\n", errno);
163 } 165 }
164 return(ret); 166 return ret;
165} 167}
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index a97206df5b52..d46b818c1311 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -18,6 +18,7 @@
18#include "sigio.h" 18#include "sigio.h"
19#include "irq_user.h" 19#include "irq_user.h"
20#include "os.h" 20#include "os.h"
21#include "um_malloc.h"
21 22
22static struct pollfd *pollfds = NULL; 23static struct pollfd *pollfds = NULL;
23static int pollfds_num = 0; 24static int pollfds_num = 0;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index d1c5670787dc..685feaab65d2 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -23,6 +23,7 @@
23#include "choose-mode.h" 23#include "choose-mode.h"
24#include "uml-config.h" 24#include "uml-config.h"
25#include "os.h" 25#include "os.h"
26#include "um_malloc.h"
26 27
27/* Set in set_stklim, which is called from main and __wrap_malloc. 28/* Set in set_stklim, which is called from main and __wrap_malloc.
28 * __wrap_malloc only calls it if main hasn't started. 29 * __wrap_malloc only calls it if main hasn't started.
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index f6457765b17d..925a65240cfe 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -19,6 +19,7 @@
19#include "user_util.h" 19#include "user_util.h"
20#include "sigio.h" 20#include "sigio.h"
21#include "os.h" 21#include "os.h"
22#include "um_malloc.h"
22 23
23/* Protected by sigio_lock(), also used by sigio_cleanup, which is an 24/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
24 * exitcall. 25 * exitcall.
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 38be096e750f..2115b8beb541 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -16,6 +16,7 @@
16#include "process.h" 16#include "process.h"
17#include "kern_constants.h" 17#include "kern_constants.h"
18#include "os.h" 18#include "os.h"
19#include "uml-config.h"
19 20
20int set_interval(int is_virtual) 21int set_interval(int is_virtual)
21{ 22{
@@ -30,7 +31,7 @@ int set_interval(int is_virtual)
30 return 0; 31 return 0;
31} 32}
32 33
33#ifdef CONFIG_MODE_TT 34#ifdef UML_CONFIG_MODE_TT
34void enable_timer(void) 35void enable_timer(void)
35{ 36{
36 set_interval(1); 37 set_interval(1);
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 0612a33bb896..c4ef801b765b 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -178,7 +178,8 @@ void make_8259A_irq(unsigned int irq)
178{ 178{
179 disable_irq_nosync(irq); 179 disable_irq_nosync(irq);
180 io_apic_irqs &= ~(1<<irq); 180 io_apic_irqs &= ~(1<<irq);
181 set_irq_chip_and_handler(irq, &i8259A_chip, handle_level_irq); 181 set_irq_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq,
182 "XT");
182 enable_irq(irq); 183 enable_irq(irq);
183} 184}
184 185
@@ -431,8 +432,8 @@ void __init init_ISA_irqs (void)
431 /* 432 /*
432 * 16 old-style INTA-cycle interrupts: 433 * 16 old-style INTA-cycle interrupts:
433 */ 434 */
434 set_irq_chip_and_handler(i, &i8259A_chip, 435 set_irq_chip_and_handler_name(i, &i8259A_chip,
435 handle_level_irq); 436 handle_level_irq, "XT");
436 } else { 437 } else {
437 /* 438 /*
438 * 'high' PCI IRQs filled in on demand 439 * 'high' PCI IRQs filled in on demand
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 44b55f833875..49e94f7994c5 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -696,11 +696,11 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
696{ 696{
697 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) || 697 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
698 trigger == IOAPIC_LEVEL) 698 trigger == IOAPIC_LEVEL)
699 set_irq_chip_and_handler(irq, &ioapic_chip, 699 set_irq_chip_and_handler_name(irq, &ioapic_chip,
700 handle_fasteoi_irq); 700 handle_fasteoi_irq, "fasteoi");
701 else 701 else
702 set_irq_chip_and_handler(irq, &ioapic_chip, 702 set_irq_chip_and_handler_name(irq, &ioapic_chip,
703 handle_edge_irq); 703 handle_edge_irq, "edge");
704} 704}
705 705
706static void __init setup_IO_APIC_irqs(void) 706static void __init setup_IO_APIC_irqs(void)
@@ -806,7 +806,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
806 * The timer IRQ doesn't have to know that behind the 806 * The timer IRQ doesn't have to know that behind the
807 * scene we have a 8259A-master in AEOI mode ... 807 * scene we have a 8259A-master in AEOI mode ...
808 */ 808 */
809 set_irq_chip_and_handler(0, &ioapic_chip, handle_edge_irq); 809 set_irq_chip_and_handler_name(0, &ioapic_chip, handle_edge_irq, "edge");
810 810
811 /* 811 /*
812 * Add it to the IO-APIC irq-routing table: 812 * Add it to the IO-APIC irq-routing table:
@@ -1839,7 +1839,7 @@ int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev)
1839 1839
1840 write_msi_msg(irq, &msg); 1840 write_msi_msg(irq, &msg);
1841 1841
1842 set_irq_chip_and_handler(irq, &msi_chip, handle_edge_irq); 1842 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
1843 1843
1844 return 0; 1844 return 0;
1845} 1845}
@@ -1936,7 +1936,8 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
1936 write_ht_irq_low(irq, low); 1936 write_ht_irq_low(irq, low);
1937 write_ht_irq_high(irq, high); 1937 write_ht_irq_high(irq, high);
1938 1938
1939 set_irq_chip_and_handler(irq, &ht_irq_chip, handle_edge_irq); 1939 set_irq_chip_and_handler_name(irq, &ht_irq_chip,
1940 handle_edge_irq, "edge");
1940 } 1941 }
1941 return vector; 1942 return vector;
1942} 1943}
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index dff68eb2b787..e46c55856d40 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -75,7 +75,7 @@ int show_interrupts(struct seq_file *p, void *v)
75 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); 75 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
76#endif 76#endif
77 seq_printf(p, " %8s", irq_desc[i].chip->name); 77 seq_printf(p, " %8s", irq_desc[i].chip->name);
78 seq_printf(p, "-%s", handle_irq_name(irq_desc[i].handle_irq)); 78 seq_printf(p, "-%-8s", irq_desc[i].name);
79 79
80 seq_printf(p, " %s", action->name); 80 seq_printf(p, " %s", action->name);
81 for (action=action->next; action; action = action->next) 81 for (action=action->next; action; action = action->next)
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index c847e17e5caa..136066583c68 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -56,11 +56,6 @@ static kmem_cache_t *requestq_cachep;
56 */ 56 */
57static kmem_cache_t *iocontext_cachep; 57static kmem_cache_t *iocontext_cachep;
58 58
59static wait_queue_head_t congestion_wqh[2] = {
60 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
61 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
62 };
63
64/* 59/*
65 * Controlling structure to kblockd 60 * Controlling structure to kblockd
66 */ 61 */
@@ -112,35 +107,6 @@ static void blk_queue_congestion_threshold(struct request_queue *q)
112 q->nr_congestion_off = nr; 107 q->nr_congestion_off = nr;
113} 108}
114 109
115/*
116 * A queue has just exitted congestion. Note this in the global counter of
117 * congested queues, and wake up anyone who was waiting for requests to be
118 * put back.
119 */
120static void clear_queue_congested(request_queue_t *q, int rw)
121{
122 enum bdi_state bit;
123 wait_queue_head_t *wqh = &congestion_wqh[rw];
124
125 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
126 clear_bit(bit, &q->backing_dev_info.state);
127 smp_mb__after_clear_bit();
128 if (waitqueue_active(wqh))
129 wake_up(wqh);
130}
131
132/*
133 * A queue has just entered congestion. Flag that in the queue's VM-visible
134 * state flags and increment the global gounter of congested queues.
135 */
136static void set_queue_congested(request_queue_t *q, int rw)
137{
138 enum bdi_state bit;
139
140 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
141 set_bit(bit, &q->backing_dev_info.state);
142}
143
144/** 110/**
145 * blk_get_backing_dev_info - get the address of a queue's backing_dev_info 111 * blk_get_backing_dev_info - get the address of a queue's backing_dev_info
146 * @bdev: device 112 * @bdev: device
@@ -159,7 +125,6 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev)
159 ret = &q->backing_dev_info; 125 ret = &q->backing_dev_info;
160 return ret; 126 return ret;
161} 127}
162
163EXPORT_SYMBOL(blk_get_backing_dev_info); 128EXPORT_SYMBOL(blk_get_backing_dev_info);
164 129
165void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data) 130void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
@@ -167,7 +132,6 @@ void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
167 q->activity_fn = fn; 132 q->activity_fn = fn;
168 q->activity_data = data; 133 q->activity_data = data;
169} 134}
170
171EXPORT_SYMBOL(blk_queue_activity_fn); 135EXPORT_SYMBOL(blk_queue_activity_fn);
172 136
173/** 137/**
@@ -2067,7 +2031,7 @@ static void __freed_request(request_queue_t *q, int rw)
2067 struct request_list *rl = &q->rq; 2031 struct request_list *rl = &q->rq;
2068 2032
2069 if (rl->count[rw] < queue_congestion_off_threshold(q)) 2033 if (rl->count[rw] < queue_congestion_off_threshold(q))
2070 clear_queue_congested(q, rw); 2034 blk_clear_queue_congested(q, rw);
2071 2035
2072 if (rl->count[rw] + 1 <= q->nr_requests) { 2036 if (rl->count[rw] + 1 <= q->nr_requests) {
2073 if (waitqueue_active(&rl->wait[rw])) 2037 if (waitqueue_active(&rl->wait[rw]))
@@ -2137,7 +2101,7 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
2137 } 2101 }
2138 } 2102 }
2139 } 2103 }
2140 set_queue_congested(q, rw); 2104 blk_set_queue_congested(q, rw);
2141 } 2105 }
2142 2106
2143 /* 2107 /*
@@ -2755,41 +2719,6 @@ void blk_end_sync_rq(struct request *rq, int error)
2755} 2719}
2756EXPORT_SYMBOL(blk_end_sync_rq); 2720EXPORT_SYMBOL(blk_end_sync_rq);
2757 2721
2758/**
2759 * blk_congestion_wait - wait for a queue to become uncongested
2760 * @rw: READ or WRITE
2761 * @timeout: timeout in jiffies
2762 *
2763 * Waits for up to @timeout jiffies for a queue (any queue) to exit congestion.
2764 * If no queues are congested then just wait for the next request to be
2765 * returned.
2766 */
2767long blk_congestion_wait(int rw, long timeout)
2768{
2769 long ret;
2770 DEFINE_WAIT(wait);
2771 wait_queue_head_t *wqh = &congestion_wqh[rw];
2772
2773 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
2774 ret = io_schedule_timeout(timeout);
2775 finish_wait(wqh, &wait);
2776 return ret;
2777}
2778
2779EXPORT_SYMBOL(blk_congestion_wait);
2780
2781/**
2782 * blk_congestion_end - wake up sleepers on a congestion queue
2783 * @rw: READ or WRITE
2784 */
2785void blk_congestion_end(int rw)
2786{
2787 wait_queue_head_t *wqh = &congestion_wqh[rw];
2788
2789 if (waitqueue_active(wqh))
2790 wake_up(wqh);
2791}
2792
2793/* 2722/*
2794 * Has to be called with the request spinlock acquired 2723 * Has to be called with the request spinlock acquired
2795 */ 2724 */
@@ -3765,14 +3694,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
3765 blk_queue_congestion_threshold(q); 3694 blk_queue_congestion_threshold(q);
3766 3695
3767 if (rl->count[READ] >= queue_congestion_on_threshold(q)) 3696 if (rl->count[READ] >= queue_congestion_on_threshold(q))
3768 set_queue_congested(q, READ); 3697 blk_set_queue_congested(q, READ);
3769 else if (rl->count[READ] < queue_congestion_off_threshold(q)) 3698 else if (rl->count[READ] < queue_congestion_off_threshold(q))
3770 clear_queue_congested(q, READ); 3699 blk_clear_queue_congested(q, READ);
3771 3700
3772 if (rl->count[WRITE] >= queue_congestion_on_threshold(q)) 3701 if (rl->count[WRITE] >= queue_congestion_on_threshold(q))
3773 set_queue_congested(q, WRITE); 3702 blk_set_queue_congested(q, WRITE);
3774 else if (rl->count[WRITE] < queue_congestion_off_threshold(q)) 3703 else if (rl->count[WRITE] < queue_congestion_off_threshold(q))
3775 clear_queue_congested(q, WRITE); 3704 blk_clear_queue_congested(q, WRITE);
3776 3705
3777 if (rl->count[READ] >= q->nr_requests) { 3706 if (rl->count[READ] >= q->nr_requests) {
3778 blk_set_queue_full(q, READ); 3707 blk_set_queue_full(q, READ);
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 1e2f39c21180..cbae8392ce11 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -27,7 +27,6 @@ config CRYPTO_HASH
27config CRYPTO_MANAGER 27config CRYPTO_MANAGER
28 tristate "Cryptographic algorithm manager" 28 tristate "Cryptographic algorithm manager"
29 select CRYPTO_ALGAPI 29 select CRYPTO_ALGAPI
30 default m
31 help 30 help
32 Create default cryptographic template instantiations such as 31 Create default cryptographic template instantiations such as
33 cbc(aes). 32 cbc(aes).
@@ -35,6 +34,7 @@ config CRYPTO_MANAGER
35config CRYPTO_HMAC 34config CRYPTO_HMAC
36 tristate "HMAC support" 35 tristate "HMAC support"
37 select CRYPTO_HASH 36 select CRYPTO_HASH
37 select CRYPTO_MANAGER
38 help 38 help
39 HMAC: Keyed-Hashing for Message Authentication (RFC2104). 39 HMAC: Keyed-Hashing for Message Authentication (RFC2104).
40 This is required for IPSec. 40 This is required for IPSec.
@@ -131,6 +131,7 @@ config CRYPTO_TGR192
131config CRYPTO_ECB 131config CRYPTO_ECB
132 tristate "ECB support" 132 tristate "ECB support"
133 select CRYPTO_BLKCIPHER 133 select CRYPTO_BLKCIPHER
134 select CRYPTO_MANAGER
134 default m 135 default m
135 help 136 help
136 ECB: Electronic CodeBook mode 137 ECB: Electronic CodeBook mode
@@ -140,6 +141,7 @@ config CRYPTO_ECB
140config CRYPTO_CBC 141config CRYPTO_CBC
141 tristate "CBC support" 142 tristate "CBC support"
142 select CRYPTO_BLKCIPHER 143 select CRYPTO_BLKCIPHER
144 select CRYPTO_MANAGER
143 default m 145 default m
144 help 146 help
145 CBC: Cipher Block Chaining mode 147 CBC: Cipher Block Chaining mode
diff --git a/crypto/api.c b/crypto/api.c
index 2e84d4b54790..4fb7fa45cb0d 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -331,7 +331,7 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags)
331 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags); 331 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
332 tfm = kzalloc(tfm_size, GFP_KERNEL); 332 tfm = kzalloc(tfm_size, GFP_KERNEL);
333 if (tfm == NULL) 333 if (tfm == NULL)
334 goto out; 334 goto out_err;
335 335
336 tfm->__crt_alg = alg; 336 tfm->__crt_alg = alg;
337 337
@@ -355,6 +355,7 @@ cra_init_failed:
355 crypto_exit_ops(tfm); 355 crypto_exit_ops(tfm);
356out_free_tfm: 356out_free_tfm:
357 kfree(tfm); 357 kfree(tfm);
358out_err:
358 tfm = ERR_PTR(err); 359 tfm = ERR_PTR(err);
359out: 360out:
360 return tfm; 361 return tfm;
@@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
414 struct crypto_alg *alg; 415 struct crypto_alg *alg;
415 416
416 alg = crypto_alg_mod_lookup(alg_name, type, mask); 417 alg = crypto_alg_mod_lookup(alg_name, type, mask);
417 err = PTR_ERR(alg); 418 if (IS_ERR(alg)) {
418 tfm = ERR_PTR(err); 419 err = PTR_ERR(alg);
419 if (IS_ERR(alg))
420 goto err; 420 goto err;
421 }
421 422
422 tfm = __crypto_alloc_tfm(alg, 0); 423 tfm = __crypto_alloc_tfm(alg, 0);
423 if (!IS_ERR(tfm)) 424 if (!IS_ERR(tfm))
424 break; 425 return tfm;
425 426
426 crypto_mod_put(alg); 427 crypto_mod_put(alg);
427 err = PTR_ERR(tfm); 428 err = PTR_ERR(tfm);
@@ -433,9 +434,9 @@ err:
433 err = -EINTR; 434 err = -EINTR;
434 break; 435 break;
435 } 436 }
436 }; 437 }
437 438
438 return tfm; 439 return ERR_PTR(err);
439} 440}
440EXPORT_SYMBOL_GPL(crypto_alloc_base); 441EXPORT_SYMBOL_GPL(crypto_alloc_base);
441 442
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 263e86ddc1a4..f39463418904 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -14,6 +14,10 @@ source "drivers/pnp/Kconfig"
14 14
15source "drivers/block/Kconfig" 15source "drivers/block/Kconfig"
16 16
17# misc before ide - BLK_DEV_SGIIOC4 depends on SGI_IOC4
18
19source "drivers/misc/Kconfig"
20
17source "drivers/ide/Kconfig" 21source "drivers/ide/Kconfig"
18 22
19source "drivers/scsi/Kconfig" 23source "drivers/scsi/Kconfig"
@@ -52,8 +56,6 @@ source "drivers/w1/Kconfig"
52 56
53source "drivers/hwmon/Kconfig" 57source "drivers/hwmon/Kconfig"
54 58
55source "drivers/misc/Kconfig"
56
57source "drivers/mfd/Kconfig" 59source "drivers/mfd/Kconfig"
58 60
59source "drivers/media/Kconfig" 61source "drivers/media/Kconfig"
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 98099de59b45..6bcd9e8e7bcb 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -85,6 +85,8 @@ struct acpi_memory_device {
85 struct list_head res_list; 85 struct list_head res_list;
86}; 86};
87 87
88static int acpi_hotmem_initialized;
89
88static acpi_status 90static acpi_status
89acpi_memory_get_resource(struct acpi_resource *resource, void *context) 91acpi_memory_get_resource(struct acpi_resource *resource, void *context)
90{ 92{
@@ -414,7 +416,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
414 /* Set the device state */ 416 /* Set the device state */
415 mem_device->state = MEMORY_POWER_ON_STATE; 417 mem_device->state = MEMORY_POWER_ON_STATE;
416 418
417 printk(KERN_INFO "%s \n", acpi_device_name(device)); 419 printk(KERN_DEBUG "%s \n", acpi_device_name(device));
418 420
419 return result; 421 return result;
420} 422}
@@ -438,6 +440,15 @@ static int acpi_memory_device_start (struct acpi_device *device)
438 struct acpi_memory_device *mem_device; 440 struct acpi_memory_device *mem_device;
439 int result = 0; 441 int result = 0;
440 442
443 /*
444 * Early boot code has recognized memory area by EFI/E820.
445 * If DSDT shows these memory devices on boot, hotplug is not necessary
446 * for them. So, it just returns until completion of this driver's
447 * start up.
448 */
449 if (!acpi_hotmem_initialized)
450 return 0;
451
441 mem_device = acpi_driver_data(device); 452 mem_device = acpi_driver_data(device);
442 453
443 if (!acpi_memory_check_device(mem_device)) { 454 if (!acpi_memory_check_device(mem_device)) {
@@ -537,6 +548,7 @@ static int __init acpi_memory_device_init(void)
537 return -ENODEV; 548 return -ENODEV;
538 } 549 }
539 550
551 acpi_hotmem_initialized = 1;
540 return 0; 552 return 0;
541} 553}
542 554
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 526387dc3799..65b3f056ad89 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -962,7 +962,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
962 962
963 result = acpi_processor_get_power_info_cst(pr); 963 result = acpi_processor_get_power_info_cst(pr);
964 if (result == -ENODEV) 964 if (result == -ENODEV)
965 acpi_processor_get_power_info_fadt(pr); 965 result = acpi_processor_get_power_info_fadt(pr);
966 966
967 if (result) 967 if (result)
968 return result; 968 return result;
@@ -1108,6 +1108,7 @@ static const struct file_operations acpi_processor_power_fops = {
1108 .release = single_release, 1108 .release = single_release,
1109}; 1109};
1110 1110
1111#ifdef CONFIG_SMP
1111static void smp_callback(void *v) 1112static void smp_callback(void *v)
1112{ 1113{
1113 /* we already woke the CPU up, nothing more to do */ 1114 /* we already woke the CPU up, nothing more to do */
@@ -1129,6 +1130,7 @@ static int acpi_processor_latency_notify(struct notifier_block *b,
1129static struct notifier_block acpi_processor_latency_notifier = { 1130static struct notifier_block acpi_processor_latency_notifier = {
1130 .notifier_call = acpi_processor_latency_notify, 1131 .notifier_call = acpi_processor_latency_notify,
1131}; 1132};
1133#endif
1132 1134
1133int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, 1135int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1134 struct acpi_device *device) 1136 struct acpi_device *device)
@@ -1146,7 +1148,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1146 "ACPI: processor limited to max C-state %d\n", 1148 "ACPI: processor limited to max C-state %d\n",
1147 max_cstate); 1149 max_cstate);
1148 first_run++; 1150 first_run++;
1151#ifdef CONFIG_SMP
1149 register_latency_notifier(&acpi_processor_latency_notifier); 1152 register_latency_notifier(&acpi_processor_latency_notifier);
1153#endif
1150 } 1154 }
1151 1155
1152 if (!pr) 1156 if (!pr)
@@ -1218,7 +1222,9 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1218 * copies of pm_idle before proceeding. 1222 * copies of pm_idle before proceeding.
1219 */ 1223 */
1220 cpu_idle_wait(); 1224 cpu_idle_wait();
1225#ifdef CONFIG_SMP
1221 unregister_latency_notifier(&acpi_processor_latency_notifier); 1226 unregister_latency_notifier(&acpi_processor_latency_notifier);
1227#endif
1222 } 1228 }
1223 1229
1224 return 0; 1230 return 0;
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 12173d16bea7..7d8a7ce73fb3 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -372,19 +372,30 @@ int bus_add_device(struct device * dev)
372 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); 372 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
373 error = device_add_attrs(bus, dev); 373 error = device_add_attrs(bus, dev);
374 if (error) 374 if (error)
375 goto out; 375 goto out_put;
376 error = sysfs_create_link(&bus->devices.kobj, 376 error = sysfs_create_link(&bus->devices.kobj,
377 &dev->kobj, dev->bus_id); 377 &dev->kobj, dev->bus_id);
378 if (error) 378 if (error)
379 goto out; 379 goto out_id;
380 error = sysfs_create_link(&dev->kobj, 380 error = sysfs_create_link(&dev->kobj,
381 &dev->bus->subsys.kset.kobj, "subsystem"); 381 &dev->bus->subsys.kset.kobj, "subsystem");
382 if (error) 382 if (error)
383 goto out; 383 goto out_subsys;
384 error = sysfs_create_link(&dev->kobj, 384 error = sysfs_create_link(&dev->kobj,
385 &dev->bus->subsys.kset.kobj, "bus"); 385 &dev->bus->subsys.kset.kobj, "bus");
386 if (error)
387 goto out_deprecated;
386 } 388 }
387out: 389 return 0;
390
391out_deprecated:
392 sysfs_remove_link(&dev->kobj, "subsystem");
393out_subsys:
394 sysfs_remove_link(&bus->devices.kobj, dev->bus_id);
395out_id:
396 device_remove_attrs(bus, dev);
397out_put:
398 put_bus(dev->bus);
388 return error; 399 return error;
389} 400}
390 401
@@ -428,8 +439,10 @@ void bus_remove_device(struct device * dev)
428 sysfs_remove_link(&dev->kobj, "bus"); 439 sysfs_remove_link(&dev->kobj, "bus");
429 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); 440 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
430 device_remove_attrs(dev->bus, dev); 441 device_remove_attrs(dev->bus, dev);
431 dev->is_registered = 0; 442 if (dev->is_registered) {
432 klist_del(&dev->knode_bus); 443 dev->is_registered = 0;
444 klist_del(&dev->knode_bus);
445 }
433 pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); 446 pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
434 device_release_driver(dev); 447 device_release_driver(dev);
435 put_bus(dev->bus); 448 put_bus(dev->bus);
@@ -505,34 +518,36 @@ int bus_add_driver(struct device_driver *drv)
505 struct bus_type * bus = get_bus(drv->bus); 518 struct bus_type * bus = get_bus(drv->bus);
506 int error = 0; 519 int error = 0;
507 520
508 if (bus) { 521 if (!bus)
509 pr_debug("bus %s: add driver %s\n", bus->name, drv->name); 522 return 0;
510 error = kobject_set_name(&drv->kobj, "%s", drv->name); 523
511 if (error) 524 pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
512 goto out_put_bus; 525 error = kobject_set_name(&drv->kobj, "%s", drv->name);
513 drv->kobj.kset = &bus->drivers; 526 if (error)
514 if ((error = kobject_register(&drv->kobj))) 527 goto out_put_bus;
515 goto out_put_bus; 528 drv->kobj.kset = &bus->drivers;
516 529 if ((error = kobject_register(&drv->kobj)))
517 error = driver_attach(drv); 530 goto out_put_bus;
518 if (error) 531
519 goto out_unregister; 532 error = driver_attach(drv);
520 klist_add_tail(&drv->knode_bus, &bus->klist_drivers); 533 if (error)
521 module_add_driver(drv->owner, drv); 534 goto out_unregister;
522 535 klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
523 error = driver_add_attrs(bus, drv); 536 module_add_driver(drv->owner, drv);
524 if (error) { 537
525 /* How the hell do we get out of this pickle? Give up */ 538 error = driver_add_attrs(bus, drv);
526 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", 539 if (error) {
527 __FUNCTION__, drv->name); 540 /* How the hell do we get out of this pickle? Give up */
528 } 541 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
529 error = add_bind_files(drv); 542 __FUNCTION__, drv->name);
530 if (error) {
531 /* Ditto */
532 printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
533 __FUNCTION__, drv->name);
534 }
535 } 543 }
544 error = add_bind_files(drv);
545 if (error) {
546 /* Ditto */
547 printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
548 __FUNCTION__, drv->name);
549 }
550
536 return error; 551 return error;
537out_unregister: 552out_unregister:
538 kobject_unregister(&drv->kobj); 553 kobject_unregister(&drv->kobj);
@@ -552,16 +567,17 @@ out_put_bus:
552 567
553void bus_remove_driver(struct device_driver * drv) 568void bus_remove_driver(struct device_driver * drv)
554{ 569{
555 if (drv->bus) { 570 if (!drv->bus)
556 remove_bind_files(drv); 571 return;
557 driver_remove_attrs(drv->bus, drv); 572
558 klist_remove(&drv->knode_bus); 573 remove_bind_files(drv);
559 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); 574 driver_remove_attrs(drv->bus, drv);
560 driver_detach(drv); 575 klist_remove(&drv->knode_bus);
561 module_remove_driver(drv); 576 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
562 kobject_unregister(&drv->kobj); 577 driver_detach(drv);
563 put_bus(drv->bus); 578 module_remove_driver(drv);
564 } 579 kobject_unregister(&drv->kobj);
580 put_bus(drv->bus);
565} 581}
566 582
567 583
@@ -732,11 +748,15 @@ int bus_register(struct bus_type * bus)
732 748
733 klist_init(&bus->klist_devices, klist_devices_get, klist_devices_put); 749 klist_init(&bus->klist_devices, klist_devices_get, klist_devices_put);
734 klist_init(&bus->klist_drivers, NULL, NULL); 750 klist_init(&bus->klist_drivers, NULL, NULL);
735 bus_add_attrs(bus); 751 retval = bus_add_attrs(bus);
752 if (retval)
753 goto bus_attrs_fail;
736 754
737 pr_debug("bus type '%s' registered\n", bus->name); 755 pr_debug("bus type '%s' registered\n", bus->name);
738 return 0; 756 return 0;
739 757
758bus_attrs_fail:
759 kset_unregister(&bus->drivers);
740bus_drivers_fail: 760bus_drivers_fail:
741 kset_unregister(&bus->devices); 761 kset_unregister(&bus->devices);
742bus_devices_fail: 762bus_devices_fail:
diff --git a/drivers/base/class.c b/drivers/base/class.c
index b32b77ff2dcd..0ff267a248db 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -562,7 +562,10 @@ int class_device_add(struct class_device *class_dev)
562 goto out2; 562 goto out2;
563 563
564 /* add the needed attributes to this device */ 564 /* add the needed attributes to this device */
565 sysfs_create_link(&class_dev->kobj, &parent_class->subsys.kset.kobj, "subsystem"); 565 error = sysfs_create_link(&class_dev->kobj,
566 &parent_class->subsys.kset.kobj, "subsystem");
567 if (error)
568 goto out3;
566 class_dev->uevent_attr.attr.name = "uevent"; 569 class_dev->uevent_attr.attr.name = "uevent";
567 class_dev->uevent_attr.attr.mode = S_IWUSR; 570 class_dev->uevent_attr.attr.mode = S_IWUSR;
568 class_dev->uevent_attr.attr.owner = parent_class->owner; 571 class_dev->uevent_attr.attr.owner = parent_class->owner;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b224bb43ff63..68ad11af22b4 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -44,7 +44,7 @@ const char *dev_driver_string(struct device *dev)
44 return dev->driver ? dev->driver->name : 44 return dev->driver ? dev->driver->name :
45 (dev->bus ? dev->bus->name : ""); 45 (dev->bus ? dev->bus->name : "");
46} 46}
47EXPORT_SYMBOL_GPL(dev_driver_string); 47EXPORT_SYMBOL(dev_driver_string);
48 48
49#define to_dev(obj) container_of(obj, struct device, kobj) 49#define to_dev(obj) container_of(obj, struct device, kobj)
50#define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr) 50#define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
@@ -433,14 +433,16 @@ int device_add(struct device *dev)
433 if (dev->driver) 433 if (dev->driver)
434 dev->uevent_attr.attr.owner = dev->driver->owner; 434 dev->uevent_attr.attr.owner = dev->driver->owner;
435 dev->uevent_attr.store = store_uevent; 435 dev->uevent_attr.store = store_uevent;
436 device_create_file(dev, &dev->uevent_attr); 436 error = device_create_file(dev, &dev->uevent_attr);
437 if (error)
438 goto attrError;
437 439
438 if (MAJOR(dev->devt)) { 440 if (MAJOR(dev->devt)) {
439 struct device_attribute *attr; 441 struct device_attribute *attr;
440 attr = kzalloc(sizeof(*attr), GFP_KERNEL); 442 attr = kzalloc(sizeof(*attr), GFP_KERNEL);
441 if (!attr) { 443 if (!attr) {
442 error = -ENOMEM; 444 error = -ENOMEM;
443 goto PMError; 445 goto ueventattrError;
444 } 446 }
445 attr->attr.name = "dev"; 447 attr->attr.name = "dev";
446 attr->attr.mode = S_IRUGO; 448 attr->attr.mode = S_IRUGO;
@@ -450,7 +452,7 @@ int device_add(struct device *dev)
450 error = device_create_file(dev, attr); 452 error = device_create_file(dev, attr);
451 if (error) { 453 if (error) {
452 kfree(attr); 454 kfree(attr);
453 goto attrError; 455 goto ueventattrError;
454 } 456 }
455 457
456 dev->devt_attr = attr; 458 dev->devt_attr = attr;
@@ -477,7 +479,8 @@ int device_add(struct device *dev)
477 if ((error = bus_add_device(dev))) 479 if ((error = bus_add_device(dev)))
478 goto BusError; 480 goto BusError;
479 kobject_uevent(&dev->kobj, KOBJ_ADD); 481 kobject_uevent(&dev->kobj, KOBJ_ADD);
480 bus_attach_device(dev); 482 if ((error = bus_attach_device(dev)))
483 goto AttachError;
481 if (parent) 484 if (parent)
482 klist_add_tail(&dev->knode_parent, &parent->klist_children); 485 klist_add_tail(&dev->knode_parent, &parent->klist_children);
483 486
@@ -496,6 +499,8 @@ int device_add(struct device *dev)
496 kfree(class_name); 499 kfree(class_name);
497 put_device(dev); 500 put_device(dev);
498 return error; 501 return error;
502 AttachError:
503 bus_remove_device(dev);
499 BusError: 504 BusError:
500 device_pm_remove(dev); 505 device_pm_remove(dev);
501 PMError: 506 PMError:
@@ -507,6 +512,8 @@ int device_add(struct device *dev)
507 device_remove_file(dev, dev->devt_attr); 512 device_remove_file(dev, dev->devt_attr);
508 kfree(dev->devt_attr); 513 kfree(dev->devt_attr);
509 } 514 }
515 ueventattrError:
516 device_remove_file(dev, &dev->uevent_attr);
510 attrError: 517 attrError:
511 kobject_uevent(&dev->kobj, KOBJ_REMOVE); 518 kobject_uevent(&dev->kobj, KOBJ_REMOVE);
512 kobject_del(&dev->kobj); 519 kobject_del(&dev->kobj);
@@ -805,8 +812,10 @@ int device_rename(struct device *dev, char *new_name)
805 812
806 if (dev->class) { 813 if (dev->class) {
807 old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL); 814 old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
808 if (!old_symlink_name) 815 if (!old_symlink_name) {
809 return -ENOMEM; 816 error = -ENOMEM;
817 goto out_free_old_class;
818 }
810 strlcpy(old_symlink_name, dev->bus_id, BUS_ID_SIZE); 819 strlcpy(old_symlink_name, dev->bus_id, BUS_ID_SIZE);
811 } 820 }
812 821
@@ -830,9 +839,10 @@ int device_rename(struct device *dev, char *new_name)
830 } 839 }
831 put_device(dev); 840 put_device(dev);
832 841
833 kfree(old_class_name);
834 kfree(new_class_name); 842 kfree(new_class_name);
835 kfree(old_symlink_name); 843 kfree(old_symlink_name);
844 out_free_old_class:
845 kfree(old_class_name);
836 846
837 return error; 847 return error;
838} 848}
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index b5f43c3e44fa..db01b95a47a5 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -171,6 +171,8 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
171 drv->bus->name, dev->bus_id, drv->name); 171 drv->bus->name, dev->bus_id, drv->name);
172 172
173 data = kmalloc(sizeof(*data), GFP_KERNEL); 173 data = kmalloc(sizeof(*data), GFP_KERNEL);
174 if (!data)
175 return -ENOMEM;
174 data->drv = drv; 176 data->drv = drv;
175 data->dev = dev; 177 data->dev = dev;
176 178
@@ -178,7 +180,7 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
178 probe_task = kthread_run(really_probe, data, 180 probe_task = kthread_run(really_probe, data,
179 "probe-%s", dev->bus_id); 181 "probe-%s", dev->bus_id);
180 if (IS_ERR(probe_task)) 182 if (IS_ERR(probe_task))
181 ret = PTR_ERR(probe_task); 183 ret = really_probe(data);
182 } else 184 } else
183 ret = really_probe(data); 185 ret = really_probe(data);
184 186
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 33c5cce1560b..b2efbd4cf710 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -141,11 +141,20 @@ dma_pool_create (const char *name, struct device *dev,
141 init_waitqueue_head (&retval->waitq); 141 init_waitqueue_head (&retval->waitq);
142 142
143 if (dev) { 143 if (dev) {
144 int ret;
145
144 down (&pools_lock); 146 down (&pools_lock);
145 if (list_empty (&dev->dma_pools)) 147 if (list_empty (&dev->dma_pools))
146 device_create_file (dev, &dev_attr_pools); 148 ret = device_create_file (dev, &dev_attr_pools);
149 else
150 ret = 0;
147 /* note: not currently insisting "name" be unique */ 151 /* note: not currently insisting "name" be unique */
148 list_add (&retval->pools, &dev->dma_pools); 152 if (!ret)
153 list_add (&retval->pools, &dev->dma_pools);
154 else {
155 kfree(retval);
156 retval = NULL;
157 }
149 up (&pools_lock); 158 up (&pools_lock);
150 } else 159 } else
151 INIT_LIST_HEAD (&retval->pools); 160 INIT_LIST_HEAD (&retval->pools);
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 3ef9d514b916..28dccb730af9 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -97,8 +97,7 @@ static struct attribute_group topology_attr_group = {
97/* Add/Remove cpu_topology interface for CPU device */ 97/* Add/Remove cpu_topology interface for CPU device */
98static int __cpuinit topology_add_dev(struct sys_device * sys_dev) 98static int __cpuinit topology_add_dev(struct sys_device * sys_dev)
99{ 99{
100 sysfs_create_group(&sys_dev->kobj, &topology_attr_group); 100 return sysfs_create_group(&sys_dev->kobj, &topology_attr_group);
101 return 0;
102} 101}
103 102
104static int __cpuinit topology_remove_dev(struct sys_device * sys_dev) 103static int __cpuinit topology_remove_dev(struct sys_device * sys_dev)
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index 6eebcb7be97e..6d111228cfac 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -1,5 +1,5 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2#define VERSION "22" 2#define VERSION "32"
3#define AOE_MAJOR 152 3#define AOE_MAJOR 152
4#define DEVICE_NAME "aoe" 4#define DEVICE_NAME "aoe"
5 5
@@ -65,7 +65,7 @@ struct aoe_atahdr {
65struct aoe_cfghdr { 65struct aoe_cfghdr {
66 __be16 bufcnt; 66 __be16 bufcnt;
67 __be16 fwver; 67 __be16 fwver;
68 unsigned char res; 68 unsigned char scnt;
69 unsigned char aoeccmd; 69 unsigned char aoeccmd;
70 unsigned char cslen[2]; 70 unsigned char cslen[2];
71}; 71};
@@ -78,12 +78,14 @@ enum {
78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */ 78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
79 DEVFL_PAUSE = (1<<5), 79 DEVFL_PAUSE = (1<<5),
80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */ 80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
81 DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
82 DEVFL_KICKME = (1<<8),
81 83
82 BUFFL_FAIL = 1, 84 BUFFL_FAIL = 1,
83}; 85};
84 86
85enum { 87enum {
86 MAXATADATA = 1024, 88 DEFAULTBCNT = 2 * 512, /* 2 sectors */
87 NPERSHELF = 16, /* number of slots per shelf address */ 89 NPERSHELF = 16, /* number of slots per shelf address */
88 FREETAG = -1, 90 FREETAG = -1,
89 MIN_BUFS = 8, 91 MIN_BUFS = 8,
@@ -107,11 +109,9 @@ struct frame {
107 ulong waited; 109 ulong waited;
108 struct buf *buf; 110 struct buf *buf;
109 char *bufaddr; 111 char *bufaddr;
110 int writedatalen; 112 ulong bcnt;
111 int ndata; 113 sector_t lba;
112 114 struct sk_buff *skb;
113 /* largest possible */
114 unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
115}; 115};
116 116
117struct aoedev { 117struct aoedev {
@@ -121,9 +121,12 @@ struct aoedev {
121 ulong sysminor; 121 ulong sysminor;
122 ulong aoemajor; 122 ulong aoemajor;
123 ulong aoeminor; 123 ulong aoeminor;
124 ulong nopen; /* (bd_openers isn't available without sleeping) */ 124 u16 nopen; /* (bd_openers isn't available without sleeping) */
125 ulong rttavg; /* round trip average of requests/responses */ 125 u16 lasttag; /* last tag sent */
126 u16 rttavg; /* round trip average of requests/responses */
127 u16 mintimer;
126 u16 fw_ver; /* version of blade's firmware */ 128 u16 fw_ver; /* version of blade's firmware */
129 u16 maxbcnt;
127 struct work_struct work;/* disk create work struct */ 130 struct work_struct work;/* disk create work struct */
128 struct gendisk *gd; 131 struct gendisk *gd;
129 request_queue_t blkq; 132 request_queue_t blkq;
@@ -137,8 +140,8 @@ struct aoedev {
137 mempool_t *bufpool; /* for deadlock-free Buf allocation */ 140 mempool_t *bufpool; /* for deadlock-free Buf allocation */
138 struct list_head bufq; /* queue of bios to work on */ 141 struct list_head bufq; /* queue of bios to work on */
139 struct buf *inprocess; /* the one we're currently working on */ 142 struct buf *inprocess; /* the one we're currently working on */
140 ulong lasttag; /* last tag sent */ 143 ushort lostjumbo;
141 ulong nframes; /* number of frames below */ 144 ushort nframes; /* number of frames below */
142 struct frame *frames; 145 struct frame *frames;
143}; 146};
144 147
@@ -157,6 +160,7 @@ void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
157void aoecmd_ata_rsp(struct sk_buff *); 160void aoecmd_ata_rsp(struct sk_buff *);
158void aoecmd_cfg_rsp(struct sk_buff *); 161void aoecmd_cfg_rsp(struct sk_buff *);
159void aoecmd_sleepwork(void *vp); 162void aoecmd_sleepwork(void *vp);
163struct sk_buff *new_skb(ulong);
160 164
161int aoedev_init(void); 165int aoedev_init(void);
162void aoedev_exit(void); 166void aoedev_exit(void);
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 393b86a3dbf8..d433f27e0ce2 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoeblk.c 3 * aoeblk.c
4 * block device routines 4 * block device routines
@@ -14,7 +14,6 @@
14 14
15static kmem_cache_t *buf_pool_cache; 15static kmem_cache_t *buf_pool_cache;
16 16
17/* add attributes for our block devices in sysfs */
18static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) 17static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
19{ 18{
20 struct aoedev *d = disk->private_data; 19 struct aoedev *d = disk->private_data;
@@ -64,21 +63,26 @@ static struct disk_attribute disk_attr_fwver = {
64 .show = aoedisk_show_fwver 63 .show = aoedisk_show_fwver
65}; 64};
66 65
67static void 66static struct attribute *aoe_attrs[] = {
67 &disk_attr_state.attr,
68 &disk_attr_mac.attr,
69 &disk_attr_netif.attr,
70 &disk_attr_fwver.attr,
71};
72
73static const struct attribute_group attr_group = {
74 .attrs = aoe_attrs,
75};
76
77static int
68aoedisk_add_sysfs(struct aoedev *d) 78aoedisk_add_sysfs(struct aoedev *d)
69{ 79{
70 sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr); 80 return sysfs_create_group(&d->gd->kobj, &attr_group);
71 sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
72 sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
73 sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
74} 81}
75void 82void
76aoedisk_rm_sysfs(struct aoedev *d) 83aoedisk_rm_sysfs(struct aoedev *d)
77{ 84{
78 sysfs_remove_link(&d->gd->kobj, "state"); 85 sysfs_remove_group(&d->gd->kobj, &attr_group);
79 sysfs_remove_link(&d->gd->kobj, "mac");
80 sysfs_remove_link(&d->gd->kobj, "netif");
81 sysfs_remove_link(&d->gd->kobj, "firmware-version");
82} 86}
83 87
84static int 88static int
@@ -132,8 +136,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
132 d = bio->bi_bdev->bd_disk->private_data; 136 d = bio->bi_bdev->bd_disk->private_data;
133 buf = mempool_alloc(d->bufpool, GFP_NOIO); 137 buf = mempool_alloc(d->bufpool, GFP_NOIO);
134 if (buf == NULL) { 138 if (buf == NULL) {
135 printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation " 139 printk(KERN_INFO "aoe: buf allocation failure\n");
136 "failure\n");
137 bio_endio(bio, bio->bi_size, -ENOMEM); 140 bio_endio(bio, bio->bi_size, -ENOMEM);
138 return 0; 141 return 0;
139 } 142 }
@@ -143,14 +146,15 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
143 buf->bio = bio; 146 buf->bio = bio;
144 buf->resid = bio->bi_size; 147 buf->resid = bio->bi_size;
145 buf->sector = bio->bi_sector; 148 buf->sector = bio->bi_sector;
146 buf->bv = buf->bio->bi_io_vec; 149 buf->bv = &bio->bi_io_vec[bio->bi_idx];
150 WARN_ON(buf->bv->bv_len == 0);
147 buf->bv_resid = buf->bv->bv_len; 151 buf->bv_resid = buf->bv->bv_len;
148 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset; 152 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
149 153
150 spin_lock_irqsave(&d->lock, flags); 154 spin_lock_irqsave(&d->lock, flags);
151 155
152 if ((d->flags & DEVFL_UP) == 0) { 156 if ((d->flags & DEVFL_UP) == 0) {
153 printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n", 157 printk(KERN_INFO "aoe: device %ld.%ld is not up\n",
154 d->aoemajor, d->aoeminor); 158 d->aoemajor, d->aoeminor);
155 spin_unlock_irqrestore(&d->lock, flags); 159 spin_unlock_irqrestore(&d->lock, flags);
156 mempool_free(buf, d->bufpool); 160 mempool_free(buf, d->bufpool);
@@ -176,7 +180,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
176 struct aoedev *d = bdev->bd_disk->private_data; 180 struct aoedev *d = bdev->bd_disk->private_data;
177 181
178 if ((d->flags & DEVFL_UP) == 0) { 182 if ((d->flags & DEVFL_UP) == 0) {
179 printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n"); 183 printk(KERN_ERR "aoe: disk not up\n");
180 return -ENODEV; 184 return -ENODEV;
181 } 185 }
182 186
@@ -203,8 +207,8 @@ aoeblk_gdalloc(void *vp)
203 207
204 gd = alloc_disk(AOE_PARTITIONS); 208 gd = alloc_disk(AOE_PARTITIONS);
205 if (gd == NULL) { 209 if (gd == NULL) {
206 printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk " 210 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
207 "structure for %ld.%ld\n", d->aoemajor, d->aoeminor); 211 d->aoemajor, d->aoeminor);
208 spin_lock_irqsave(&d->lock, flags); 212 spin_lock_irqsave(&d->lock, flags);
209 d->flags &= ~DEVFL_GDALLOC; 213 d->flags &= ~DEVFL_GDALLOC;
210 spin_unlock_irqrestore(&d->lock, flags); 214 spin_unlock_irqrestore(&d->lock, flags);
@@ -213,8 +217,8 @@ aoeblk_gdalloc(void *vp)
213 217
214 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 218 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
215 if (d->bufpool == NULL) { 219 if (d->bufpool == NULL) {
216 printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool " 220 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
217 "for %ld.%ld\n", d->aoemajor, d->aoeminor); 221 d->aoemajor, d->aoeminor);
218 put_disk(gd); 222 put_disk(gd);
219 spin_lock_irqsave(&d->lock, flags); 223 spin_lock_irqsave(&d->lock, flags);
220 d->flags &= ~DEVFL_GDALLOC; 224 d->flags &= ~DEVFL_GDALLOC;
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 1bc1cf9603f1..e22b4c9520a9 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoechr.c 3 * aoechr.c
4 * AoE character device driver 4 * AoE character device driver
@@ -15,7 +15,6 @@ enum {
15 MINOR_INTERFACES, 15 MINOR_INTERFACES,
16 MINOR_REVALIDATE, 16 MINOR_REVALIDATE,
17 MSGSZ = 2048, 17 MSGSZ = 2048,
18 NARGS = 10,
19 NMSG = 100, /* message backlog to retain */ 18 NMSG = 100, /* message backlog to retain */
20}; 19};
21 20
@@ -56,9 +55,8 @@ static int
56interfaces(const char __user *str, size_t size) 55interfaces(const char __user *str, size_t size)
57{ 56{
58 if (set_aoe_iflist(str, size)) { 57 if (set_aoe_iflist(str, size)) {
59 printk(KERN_CRIT 58 printk(KERN_ERR
60 "%s: could not set interface list: %s\n", 59 "aoe: could not set interface list: too many interfaces\n");
61 __FUNCTION__, "too many interfaces");
62 return -EINVAL; 60 return -EINVAL;
63 } 61 }
64 return 0; 62 return 0;
@@ -81,8 +79,7 @@ revalidate(const char __user *str, size_t size)
81 /* should be e%d.%d format */ 79 /* should be e%d.%d format */
82 n = sscanf(buf, "e%d.%d", &major, &minor); 80 n = sscanf(buf, "e%d.%d", &major, &minor);
83 if (n != 2) { 81 if (n != 2) {
84 printk(KERN_ERR "aoe: %s: invalid device specification\n", 82 printk(KERN_ERR "aoe: invalid device specification\n");
85 __FUNCTION__);
86 return -EINVAL; 83 return -EINVAL;
87 } 84 }
88 d = aoedev_by_aoeaddr(major, minor); 85 d = aoedev_by_aoeaddr(major, minor);
@@ -90,6 +87,7 @@ revalidate(const char __user *str, size_t size)
90 return -EINVAL; 87 return -EINVAL;
91 88
92 spin_lock_irqsave(&d->lock, flags); 89 spin_lock_irqsave(&d->lock, flags);
90 d->flags &= ~DEVFL_MAXBCNT;
93 d->flags |= DEVFL_PAUSE; 91 d->flags |= DEVFL_PAUSE;
94 spin_unlock_irqrestore(&d->lock, flags); 92 spin_unlock_irqrestore(&d->lock, flags);
95 aoecmd_cfg(major, minor); 93 aoecmd_cfg(major, minor);
@@ -116,7 +114,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
116 114
117 mp = kmalloc(n, GFP_ATOMIC); 115 mp = kmalloc(n, GFP_ATOMIC);
118 if (mp == NULL) { 116 if (mp == NULL) {
119 printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n); 117 printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
120 goto bail; 118 goto bail;
121 } 119 }
122 120
@@ -141,7 +139,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
141 139
142 switch ((unsigned long) filp->private_data) { 140 switch ((unsigned long) filp->private_data) {
143 default: 141 default:
144 printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n"); 142 printk(KERN_INFO "aoe: can't write to that file.\n");
145 break; 143 break;
146 case MINOR_DISCOVER: 144 case MINOR_DISCOVER:
147 ret = discover(); 145 ret = discover();
@@ -250,7 +248,7 @@ aoechr_init(void)
250 248
251 n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops); 249 n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
252 if (n < 0) { 250 if (n < 0) {
253 printk(KERN_ERR "aoe: aoechr_init: can't register char device\n"); 251 printk(KERN_ERR "aoe: can't register char device\n");
254 return n; 252 return n;
255 } 253 }
256 sema_init(&emsgs_sema, 0); 254 sema_init(&emsgs_sema, 0);
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 39da28d344fe..8a13b1af8bab 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoecmd.c 3 * aoecmd.c
4 * Filesystem request handling methods 4 * Filesystem request handling methods
@@ -15,17 +15,19 @@
15#define TIMERTICK (HZ / 10) 15#define TIMERTICK (HZ / 10)
16#define MINTIMER (2 * TIMERTICK) 16#define MINTIMER (2 * TIMERTICK)
17#define MAXTIMER (HZ << 1) 17#define MAXTIMER (HZ << 1)
18#define MAXWAIT (60 * 3) /* After MAXWAIT seconds, give up and fail dev */
19 18
20static struct sk_buff * 19static int aoe_deadsecs = 60 * 3;
21new_skb(struct net_device *if_dev, ulong len) 20module_param(aoe_deadsecs, int, 0644);
21MODULE_PARM_DESC(aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev.");
22
23struct sk_buff *
24new_skb(ulong len)
22{ 25{
23 struct sk_buff *skb; 26 struct sk_buff *skb;
24 27
25 skb = alloc_skb(len, GFP_ATOMIC); 28 skb = alloc_skb(len, GFP_ATOMIC);
26 if (skb) { 29 if (skb) {
27 skb->nh.raw = skb->mac.raw = skb->data; 30 skb->nh.raw = skb->mac.raw = skb->data;
28 skb->dev = if_dev;
29 skb->protocol = __constant_htons(ETH_P_AOE); 31 skb->protocol = __constant_htons(ETH_P_AOE);
30 skb->priority = 0; 32 skb->priority = 0;
31 skb_put(skb, len); 33 skb_put(skb, len);
@@ -40,29 +42,6 @@ new_skb(struct net_device *if_dev, ulong len)
40 return skb; 42 return skb;
41} 43}
42 44
43static struct sk_buff *
44skb_prepare(struct aoedev *d, struct frame *f)
45{
46 struct sk_buff *skb;
47 char *p;
48
49 skb = new_skb(d->ifp, f->ndata + f->writedatalen);
50 if (!skb) {
51 printk(KERN_INFO "aoe: skb_prepare: failure to allocate skb\n");
52 return NULL;
53 }
54
55 p = skb->mac.raw;
56 memcpy(p, f->data, f->ndata);
57
58 if (f->writedatalen) {
59 p += sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr);
60 memcpy(p, f->bufaddr, f->writedatalen);
61 }
62
63 return skb;
64}
65
66static struct frame * 45static struct frame *
67getframe(struct aoedev *d, int tag) 46getframe(struct aoedev *d, int tag)
68{ 47{
@@ -107,6 +86,17 @@ aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h)
107 return host_tag; 86 return host_tag;
108} 87}
109 88
89static inline void
90put_lba(struct aoe_atahdr *ah, sector_t lba)
91{
92 ah->lba0 = lba;
93 ah->lba1 = lba >>= 8;
94 ah->lba2 = lba >>= 8;
95 ah->lba3 = lba >>= 8;
96 ah->lba4 = lba >>= 8;
97 ah->lba5 = lba >>= 8;
98}
99
110static void 100static void
111aoecmd_ata_rw(struct aoedev *d, struct frame *f) 101aoecmd_ata_rw(struct aoedev *d, struct frame *f)
112{ 102{
@@ -125,29 +115,27 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
125 115
126 sector = buf->sector; 116 sector = buf->sector;
127 bcnt = buf->bv_resid; 117 bcnt = buf->bv_resid;
128 if (bcnt > MAXATADATA) 118 if (bcnt > d->maxbcnt)
129 bcnt = MAXATADATA; 119 bcnt = d->maxbcnt;
130 120
131 /* initialize the headers & frame */ 121 /* initialize the headers & frame */
132 h = (struct aoe_hdr *) f->data; 122 skb = f->skb;
123 h = (struct aoe_hdr *) skb->mac.raw;
133 ah = (struct aoe_atahdr *) (h+1); 124 ah = (struct aoe_atahdr *) (h+1);
134 f->ndata = sizeof *h + sizeof *ah; 125 skb->len = sizeof *h + sizeof *ah;
135 memset(h, 0, f->ndata); 126 memset(h, 0, ETH_ZLEN);
136 f->tag = aoehdr_atainit(d, h); 127 f->tag = aoehdr_atainit(d, h);
137 f->waited = 0; 128 f->waited = 0;
138 f->buf = buf; 129 f->buf = buf;
139 f->bufaddr = buf->bufaddr; 130 f->bufaddr = buf->bufaddr;
131 f->bcnt = bcnt;
132 f->lba = sector;
140 133
141 /* set up ata header */ 134 /* set up ata header */
142 ah->scnt = bcnt >> 9; 135 ah->scnt = bcnt >> 9;
143 ah->lba0 = sector; 136 put_lba(ah, sector);
144 ah->lba1 = sector >>= 8;
145 ah->lba2 = sector >>= 8;
146 ah->lba3 = sector >>= 8;
147 if (d->flags & DEVFL_EXT) { 137 if (d->flags & DEVFL_EXT) {
148 ah->aflags |= AOEAFL_EXT; 138 ah->aflags |= AOEAFL_EXT;
149 ah->lba4 = sector >>= 8;
150 ah->lba5 = sector >>= 8;
151 } else { 139 } else {
152 extbit = 0; 140 extbit = 0;
153 ah->lba3 &= 0x0f; 141 ah->lba3 &= 0x0f;
@@ -155,11 +143,14 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
155 } 143 }
156 144
157 if (bio_data_dir(buf->bio) == WRITE) { 145 if (bio_data_dir(buf->bio) == WRITE) {
146 skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
147 offset_in_page(f->bufaddr), bcnt);
158 ah->aflags |= AOEAFL_WRITE; 148 ah->aflags |= AOEAFL_WRITE;
159 f->writedatalen = bcnt; 149 skb->len += bcnt;
150 skb->data_len = bcnt;
160 } else { 151 } else {
152 skb->len = ETH_ZLEN;
161 writebit = 0; 153 writebit = 0;
162 f->writedatalen = 0;
163 } 154 }
164 155
165 ah->cmdstat = WIN_READ | writebit | extbit; 156 ah->cmdstat = WIN_READ | writebit | extbit;
@@ -168,26 +159,27 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
168 buf->nframesout += 1; 159 buf->nframesout += 1;
169 buf->bufaddr += bcnt; 160 buf->bufaddr += bcnt;
170 buf->bv_resid -= bcnt; 161 buf->bv_resid -= bcnt;
171/* printk(KERN_INFO "aoe: bv_resid=%ld\n", buf->bv_resid); */ 162/* printk(KERN_DEBUG "aoe: bv_resid=%ld\n", buf->bv_resid); */
172 buf->resid -= bcnt; 163 buf->resid -= bcnt;
173 buf->sector += bcnt >> 9; 164 buf->sector += bcnt >> 9;
174 if (buf->resid == 0) { 165 if (buf->resid == 0) {
175 d->inprocess = NULL; 166 d->inprocess = NULL;
176 } else if (buf->bv_resid == 0) { 167 } else if (buf->bv_resid == 0) {
177 buf->bv++; 168 buf->bv++;
169 WARN_ON(buf->bv->bv_len == 0);
178 buf->bv_resid = buf->bv->bv_len; 170 buf->bv_resid = buf->bv->bv_len;
179 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset; 171 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
180 } 172 }
181 173
182 skb = skb_prepare(d, f); 174 skb->dev = d->ifp;
183 if (skb) { 175 skb = skb_clone(skb, GFP_ATOMIC);
184 skb->next = NULL; 176 if (skb == NULL)
185 if (d->sendq_hd) 177 return;
186 d->sendq_tl->next = skb; 178 if (d->sendq_hd)
187 else 179 d->sendq_tl->next = skb;
188 d->sendq_hd = skb; 180 else
189 d->sendq_tl = skb; 181 d->sendq_hd = skb;
190 } 182 d->sendq_tl = skb;
191} 183}
192 184
193/* some callers cannot sleep, and they can call this function, 185/* some callers cannot sleep, and they can call this function,
@@ -209,11 +201,12 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
209 if (!is_aoe_netif(ifp)) 201 if (!is_aoe_netif(ifp))
210 continue; 202 continue;
211 203
212 skb = new_skb(ifp, sizeof *h + sizeof *ch); 204 skb = new_skb(sizeof *h + sizeof *ch);
213 if (skb == NULL) { 205 if (skb == NULL) {
214 printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n"); 206 printk(KERN_INFO "aoe: skb alloc failure\n");
215 continue; 207 continue;
216 } 208 }
209 skb->dev = ifp;
217 if (sl_tail == NULL) 210 if (sl_tail == NULL)
218 sl_tail = skb; 211 sl_tail = skb;
219 h = (struct aoe_hdr *) skb->mac.raw; 212 h = (struct aoe_hdr *) skb->mac.raw;
@@ -237,6 +230,29 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
237 return sl; 230 return sl;
238} 231}
239 232
233static struct frame *
234freeframe(struct aoedev *d)
235{
236 struct frame *f, *e;
237 int n = 0;
238
239 f = d->frames;
240 e = f + d->nframes;
241 for (; f<e; f++) {
242 if (f->tag != FREETAG)
243 continue;
244 if (atomic_read(&skb_shinfo(f->skb)->dataref) == 1) {
245 skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
246 return f;
247 }
248 n++;
249 }
250 if (n == d->nframes) /* wait for network layer */
251 d->flags |= DEVFL_KICKME;
252
253 return NULL;
254}
255
240/* enters with d->lock held */ 256/* enters with d->lock held */
241void 257void
242aoecmd_work(struct aoedev *d) 258aoecmd_work(struct aoedev *d)
@@ -252,7 +268,7 @@ aoecmd_work(struct aoedev *d)
252 } 268 }
253 269
254loop: 270loop:
255 f = getframe(d, FREETAG); 271 f = freeframe(d);
256 if (f == NULL) 272 if (f == NULL)
257 return; 273 return;
258 if (d->inprocess == NULL) { 274 if (d->inprocess == NULL) {
@@ -260,7 +276,7 @@ loop:
260 return; 276 return;
261 buf = container_of(d->bufq.next, struct buf, bufs); 277 buf = container_of(d->bufq.next, struct buf, bufs);
262 list_del(d->bufq.next); 278 list_del(d->bufq.next);
263/*printk(KERN_INFO "aoecmd_work: bi_size=%ld\n", buf->bio->bi_size); */ 279/*printk(KERN_DEBUG "aoe: bi_size=%ld\n", buf->bio->bi_size); */
264 d->inprocess = buf; 280 d->inprocess = buf;
265 } 281 }
266 aoecmd_ata_rw(d, f); 282 aoecmd_ata_rw(d, f);
@@ -272,6 +288,7 @@ rexmit(struct aoedev *d, struct frame *f)
272{ 288{
273 struct sk_buff *skb; 289 struct sk_buff *skb;
274 struct aoe_hdr *h; 290 struct aoe_hdr *h;
291 struct aoe_atahdr *ah;
275 char buf[128]; 292 char buf[128];
276 u32 n; 293 u32 n;
277 294
@@ -283,21 +300,41 @@ rexmit(struct aoedev *d, struct frame *f)
283 d->aoemajor, d->aoeminor, f->tag, jiffies, n); 300 d->aoemajor, d->aoeminor, f->tag, jiffies, n);
284 aoechr_error(buf); 301 aoechr_error(buf);
285 302
286 h = (struct aoe_hdr *) f->data; 303 skb = f->skb;
304 h = (struct aoe_hdr *) skb->mac.raw;
305 ah = (struct aoe_atahdr *) (h+1);
287 f->tag = n; 306 f->tag = n;
288 h->tag = cpu_to_be32(n); 307 h->tag = cpu_to_be32(n);
289 memcpy(h->dst, d->addr, sizeof h->dst); 308 memcpy(h->dst, d->addr, sizeof h->dst);
290 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 309 memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
291 310
292 skb = skb_prepare(d, f); 311 n = DEFAULTBCNT / 512;
293 if (skb) { 312 if (ah->scnt > n) {
294 skb->next = NULL; 313 ah->scnt = n;
295 if (d->sendq_hd) 314 if (ah->aflags & AOEAFL_WRITE) {
296 d->sendq_tl->next = skb; 315 skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
297 else 316 offset_in_page(f->bufaddr), DEFAULTBCNT);
298 d->sendq_hd = skb; 317 skb->len = sizeof *h + sizeof *ah + DEFAULTBCNT;
299 d->sendq_tl = skb; 318 skb->data_len = DEFAULTBCNT;
319 }
320 if (++d->lostjumbo > (d->nframes << 1))
321 if (d->maxbcnt != DEFAULTBCNT) {
322 printk(KERN_INFO "aoe: e%ld.%ld: too many lost jumbo on %s - using 1KB frames.\n",
323 d->aoemajor, d->aoeminor, d->ifp->name);
324 d->maxbcnt = DEFAULTBCNT;
325 d->flags |= DEVFL_MAXBCNT;
326 }
300 } 327 }
328
329 skb->dev = d->ifp;
330 skb = skb_clone(skb, GFP_ATOMIC);
331 if (skb == NULL)
332 return;
333 if (d->sendq_hd)
334 d->sendq_tl->next = skb;
335 else
336 d->sendq_hd = skb;
337 d->sendq_tl = skb;
301} 338}
302 339
303static int 340static int
@@ -340,13 +377,17 @@ rexmit_timer(ulong vp)
340 if (f->tag != FREETAG && tsince(f->tag) >= timeout) { 377 if (f->tag != FREETAG && tsince(f->tag) >= timeout) {
341 n = f->waited += timeout; 378 n = f->waited += timeout;
342 n /= HZ; 379 n /= HZ;
343 if (n > MAXWAIT) { /* waited too long. device failure. */ 380 if (n > aoe_deadsecs) { /* waited too long for response */
344 aoedev_downdev(d); 381 aoedev_downdev(d);
345 break; 382 break;
346 } 383 }
347 rexmit(d, f); 384 rexmit(d, f);
348 } 385 }
349 } 386 }
387 if (d->flags & DEVFL_KICKME) {
388 d->flags &= ~DEVFL_KICKME;
389 aoecmd_work(d);
390 }
350 391
351 sl = d->sendq_hd; 392 sl = d->sendq_hd;
352 d->sendq_hd = d->sendq_tl = NULL; 393 d->sendq_hd = d->sendq_tl = NULL;
@@ -431,8 +472,8 @@ ataid_complete(struct aoedev *d, unsigned char *id)
431 } 472 }
432 473
433 if (d->ssize != ssize) 474 if (d->ssize != ssize)
434 printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu " 475 printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu sectors\n",
435 "sectors\n", (unsigned long long)mac_addr(d->addr), 476 (unsigned long long)mac_addr(d->addr),
436 d->aoemajor, d->aoeminor, 477 d->aoemajor, d->aoeminor,
437 d->fw_ver, (long long)ssize); 478 d->fw_ver, (long long)ssize);
438 d->ssize = ssize; 479 d->ssize = ssize;
@@ -442,11 +483,9 @@ ataid_complete(struct aoedev *d, unsigned char *id)
442 d->flags |= DEVFL_NEWSIZE; 483 d->flags |= DEVFL_NEWSIZE;
443 } else { 484 } else {
444 if (d->flags & DEVFL_GDALLOC) { 485 if (d->flags & DEVFL_GDALLOC) {
445 printk(KERN_INFO "aoe: %s: %s e%lu.%lu, %s\n", 486 printk(KERN_ERR "aoe: can't schedule work for e%lu.%lu, %s\n",
446 __FUNCTION__,
447 "can't schedule work for",
448 d->aoemajor, d->aoeminor, 487 d->aoemajor, d->aoeminor,
449 "it's already on! (This really shouldn't happen).\n"); 488 "it's already on! This shouldn't happen.\n");
450 return; 489 return;
451 } 490 }
452 d->flags |= DEVFL_GDALLOC; 491 d->flags |= DEVFL_GDALLOC;
@@ -460,8 +499,15 @@ calc_rttavg(struct aoedev *d, int rtt)
460 register long n; 499 register long n;
461 500
462 n = rtt; 501 n = rtt;
463 if (n < MINTIMER) 502 if (n < 0) {
464 n = MINTIMER; 503 n = -rtt;
504 if (n < MINTIMER)
505 n = MINTIMER;
506 else if (n > MAXTIMER)
507 n = MAXTIMER;
508 d->mintimer += (n - d->mintimer) >> 1;
509 } else if (n < d->mintimer)
510 n = d->mintimer;
465 else if (n > MAXTIMER) 511 else if (n > MAXTIMER)
466 n = MAXTIMER; 512 n = MAXTIMER;
467 513
@@ -474,7 +520,7 @@ void
474aoecmd_ata_rsp(struct sk_buff *skb) 520aoecmd_ata_rsp(struct sk_buff *skb)
475{ 521{
476 struct aoedev *d; 522 struct aoedev *d;
477 struct aoe_hdr *hin; 523 struct aoe_hdr *hin, *hout;
478 struct aoe_atahdr *ahin, *ahout; 524 struct aoe_atahdr *ahin, *ahout;
479 struct frame *f; 525 struct frame *f;
480 struct buf *buf; 526 struct buf *buf;
@@ -497,8 +543,10 @@ aoecmd_ata_rsp(struct sk_buff *skb)
497 543
498 spin_lock_irqsave(&d->lock, flags); 544 spin_lock_irqsave(&d->lock, flags);
499 545
500 f = getframe(d, be32_to_cpu(hin->tag)); 546 n = be32_to_cpu(hin->tag);
547 f = getframe(d, n);
501 if (f == NULL) { 548 if (f == NULL) {
549 calc_rttavg(d, -tsince(n));
502 spin_unlock_irqrestore(&d->lock, flags); 550 spin_unlock_irqrestore(&d->lock, flags);
503 snprintf(ebuf, sizeof ebuf, 551 snprintf(ebuf, sizeof ebuf,
504 "%15s e%d.%d tag=%08x@%08lx\n", 552 "%15s e%d.%d tag=%08x@%08lx\n",
@@ -514,26 +562,27 @@ aoecmd_ata_rsp(struct sk_buff *skb)
514 calc_rttavg(d, tsince(f->tag)); 562 calc_rttavg(d, tsince(f->tag));
515 563
516 ahin = (struct aoe_atahdr *) (hin+1); 564 ahin = (struct aoe_atahdr *) (hin+1);
517 ahout = (struct aoe_atahdr *) (f->data + sizeof(struct aoe_hdr)); 565 hout = (struct aoe_hdr *) f->skb->mac.raw;
566 ahout = (struct aoe_atahdr *) (hout+1);
518 buf = f->buf; 567 buf = f->buf;
519 568
520 if (ahout->cmdstat == WIN_IDENTIFY) 569 if (ahout->cmdstat == WIN_IDENTIFY)
521 d->flags &= ~DEVFL_PAUSE; 570 d->flags &= ~DEVFL_PAUSE;
522 if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */ 571 if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */
523 printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh " 572 printk(KERN_ERR
524 "stat=%2.2Xh from e%ld.%ld\n", 573 "aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%ld\n",
525 ahout->cmdstat, ahin->cmdstat, 574 ahout->cmdstat, ahin->cmdstat,
526 d->aoemajor, d->aoeminor); 575 d->aoemajor, d->aoeminor);
527 if (buf) 576 if (buf)
528 buf->flags |= BUFFL_FAIL; 577 buf->flags |= BUFFL_FAIL;
529 } else { 578 } else {
579 n = ahout->scnt << 9;
530 switch (ahout->cmdstat) { 580 switch (ahout->cmdstat) {
531 case WIN_READ: 581 case WIN_READ:
532 case WIN_READ_EXT: 582 case WIN_READ_EXT:
533 n = ahout->scnt << 9;
534 if (skb->len - sizeof *hin - sizeof *ahin < n) { 583 if (skb->len - sizeof *hin - sizeof *ahin < n) {
535 printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt " 584 printk(KERN_ERR
536 "ata data size in read. skb->len=%d\n", 585 "aoe: runt data size in read. skb->len=%d\n",
537 skb->len); 586 skb->len);
538 /* fail frame f? just returning will rexmit. */ 587 /* fail frame f? just returning will rexmit. */
539 spin_unlock_irqrestore(&d->lock, flags); 588 spin_unlock_irqrestore(&d->lock, flags);
@@ -542,22 +591,49 @@ aoecmd_ata_rsp(struct sk_buff *skb)
542 memcpy(f->bufaddr, ahin+1, n); 591 memcpy(f->bufaddr, ahin+1, n);
543 case WIN_WRITE: 592 case WIN_WRITE:
544 case WIN_WRITE_EXT: 593 case WIN_WRITE_EXT:
594 if (f->bcnt -= n) {
595 skb = f->skb;
596 f->bufaddr += n;
597 put_lba(ahout, f->lba += ahout->scnt);
598 n = f->bcnt;
599 if (n > DEFAULTBCNT)
600 n = DEFAULTBCNT;
601 ahout->scnt = n >> 9;
602 if (ahout->aflags & AOEAFL_WRITE) {
603 skb_fill_page_desc(skb, 0,
604 virt_to_page(f->bufaddr),
605 offset_in_page(f->bufaddr), n);
606 skb->len = sizeof *hout + sizeof *ahout + n;
607 skb->data_len = n;
608 }
609 f->tag = newtag(d);
610 hout->tag = cpu_to_be32(f->tag);
611 skb->dev = d->ifp;
612 skb = skb_clone(skb, GFP_ATOMIC);
613 spin_unlock_irqrestore(&d->lock, flags);
614 if (skb)
615 aoenet_xmit(skb);
616 return;
617 }
618 if (n > DEFAULTBCNT)
619 d->lostjumbo = 0;
545 break; 620 break;
546 case WIN_IDENTIFY: 621 case WIN_IDENTIFY:
547 if (skb->len - sizeof *hin - sizeof *ahin < 512) { 622 if (skb->len - sizeof *hin - sizeof *ahin < 512) {
548 printk(KERN_INFO "aoe: aoecmd_ata_rsp: runt data size " 623 printk(KERN_INFO
549 "in ataid. skb->len=%d\n", skb->len); 624 "aoe: runt data size in ataid. skb->len=%d\n",
625 skb->len);
550 spin_unlock_irqrestore(&d->lock, flags); 626 spin_unlock_irqrestore(&d->lock, flags);
551 return; 627 return;
552 } 628 }
553 ataid_complete(d, (char *) (ahin+1)); 629 ataid_complete(d, (char *) (ahin+1));
554 break; 630 break;
555 default: 631 default:
556 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 632 printk(KERN_INFO
557 "outbound ata command %2.2Xh for %d.%d\n", 633 "aoe: unrecognized ata command %2.2Xh for %d.%d\n",
558 ahout->cmdstat, 634 ahout->cmdstat,
559 be16_to_cpu(hin->major), 635 be16_to_cpu(hin->major),
560 hin->minor); 636 hin->minor);
561 } 637 }
562 } 638 }
563 639
@@ -612,33 +688,32 @@ aoecmd_ata_id(struct aoedev *d)
612 struct frame *f; 688 struct frame *f;
613 struct sk_buff *skb; 689 struct sk_buff *skb;
614 690
615 f = getframe(d, FREETAG); 691 f = freeframe(d);
616 if (f == NULL) { 692 if (f == NULL) {
617 printk(KERN_CRIT "aoe: aoecmd_ata_id: can't get a frame. " 693 printk(KERN_ERR "aoe: can't get a frame. This shouldn't happen.\n");
618 "This shouldn't happen.\n");
619 return NULL; 694 return NULL;
620 } 695 }
621 696
622 /* initialize the headers & frame */ 697 /* initialize the headers & frame */
623 h = (struct aoe_hdr *) f->data; 698 skb = f->skb;
699 h = (struct aoe_hdr *) skb->mac.raw;
624 ah = (struct aoe_atahdr *) (h+1); 700 ah = (struct aoe_atahdr *) (h+1);
625 f->ndata = sizeof *h + sizeof *ah; 701 skb->len = ETH_ZLEN;
626 memset(h, 0, f->ndata); 702 memset(h, 0, ETH_ZLEN);
627 f->tag = aoehdr_atainit(d, h); 703 f->tag = aoehdr_atainit(d, h);
628 f->waited = 0; 704 f->waited = 0;
629 f->writedatalen = 0;
630 705
631 /* set up ata header */ 706 /* set up ata header */
632 ah->scnt = 1; 707 ah->scnt = 1;
633 ah->cmdstat = WIN_IDENTIFY; 708 ah->cmdstat = WIN_IDENTIFY;
634 ah->lba3 = 0xa0; 709 ah->lba3 = 0xa0;
635 710
636 skb = skb_prepare(d, f); 711 skb->dev = d->ifp;
637 712
638 d->rttavg = MAXTIMER; 713 d->rttavg = MAXTIMER;
639 d->timer.function = rexmit_timer; 714 d->timer.function = rexmit_timer;
640 715
641 return skb; 716 return skb_clone(skb, GFP_ATOMIC);
642} 717}
643 718
644void 719void
@@ -648,9 +723,9 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
648 struct aoe_hdr *h; 723 struct aoe_hdr *h;
649 struct aoe_cfghdr *ch; 724 struct aoe_cfghdr *ch;
650 ulong flags, sysminor, aoemajor; 725 ulong flags, sysminor, aoemajor;
651 u16 bufcnt;
652 struct sk_buff *sl; 726 struct sk_buff *sl;
653 enum { MAXFRAMES = 16 }; 727 enum { MAXFRAMES = 16 };
728 u16 n;
654 729
655 h = (struct aoe_hdr *) skb->mac.raw; 730 h = (struct aoe_hdr *) skb->mac.raw;
656 ch = (struct aoe_cfghdr *) (h+1); 731 ch = (struct aoe_cfghdr *) (h+1);
@@ -661,26 +736,25 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
661 */ 736 */
662 aoemajor = be16_to_cpu(h->major); 737 aoemajor = be16_to_cpu(h->major);
663 if (aoemajor == 0xfff) { 738 if (aoemajor == 0xfff) {
664 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 739 printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
665 "address is all ones. Check shelf dip switches\n"); 740 "Check shelf dip switches.\n");
666 return; 741 return;
667 } 742 }
668 743
669 sysminor = SYSMINOR(aoemajor, h->minor); 744 sysminor = SYSMINOR(aoemajor, h->minor);
670 if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { 745 if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
671 printk(KERN_INFO 746 printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n",
672 "aoe: e%ld.%d: minor number too large\n",
673 aoemajor, (int) h->minor); 747 aoemajor, (int) h->minor);
674 return; 748 return;
675 } 749 }
676 750
677 bufcnt = be16_to_cpu(ch->bufcnt); 751 n = be16_to_cpu(ch->bufcnt);
678 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 752 if (n > MAXFRAMES) /* keep it reasonable */
679 bufcnt = MAXFRAMES; 753 n = MAXFRAMES;
680 754
681 d = aoedev_by_sysminor_m(sysminor, bufcnt); 755 d = aoedev_by_sysminor_m(sysminor, n);
682 if (d == NULL) { 756 if (d == NULL) {
683 printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n"); 757 printk(KERN_INFO "aoe: device sysminor_m failure\n");
684 return; 758 return;
685 } 759 }
686 760
@@ -689,6 +763,20 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
689 /* permit device to migrate mac and network interface */ 763 /* permit device to migrate mac and network interface */
690 d->ifp = skb->dev; 764 d->ifp = skb->dev;
691 memcpy(d->addr, h->src, sizeof d->addr); 765 memcpy(d->addr, h->src, sizeof d->addr);
766 if (!(d->flags & DEVFL_MAXBCNT)) {
767 n = d->ifp->mtu;
768 n -= sizeof (struct aoe_hdr) + sizeof (struct aoe_atahdr);
769 n /= 512;
770 if (n > ch->scnt)
771 n = ch->scnt;
772 n = n ? n * 512 : DEFAULTBCNT;
773 if (n != d->maxbcnt) {
774 printk(KERN_INFO
775 "aoe: e%ld.%ld: setting %d byte data frames on %s\n",
776 d->aoemajor, d->aoeminor, n, d->ifp->name);
777 d->maxbcnt = n;
778 }
779 }
692 780
693 /* don't change users' perspective */ 781 /* don't change users' perspective */
694 if (d->nopen && !(d->flags & DEVFL_PAUSE)) { 782 if (d->nopen && !(d->flags & DEVFL_PAUSE)) {
@@ -696,6 +784,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
696 return; 784 return;
697 } 785 }
698 d->flags |= DEVFL_PAUSE; /* force pause */ 786 d->flags |= DEVFL_PAUSE; /* force pause */
787 d->mintimer = MINTIMER;
699 d->fw_ver = be16_to_cpu(ch->fwver); 788 d->fw_ver = be16_to_cpu(ch->fwver);
700 789
701 /* check for already outstanding ataid */ 790 /* check for already outstanding ataid */
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index ed4258a62df5..6125921bbec4 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoedev.c 3 * aoedev.c
4 * AoE device utility functions; maintains device list. 4 * AoE device utility functions; maintains device list.
@@ -20,11 +20,8 @@ aoedev_isbusy(struct aoedev *d)
20 f = d->frames; 20 f = d->frames;
21 e = f + d->nframes; 21 e = f + d->nframes;
22 do { 22 do {
23 if (f->tag != FREETAG) { 23 if (f->tag != FREETAG)
24 printk(KERN_DEBUG "aoe: %ld.%ld isbusy\n",
25 d->aoemajor, d->aoeminor);
26 return 1; 24 return 1;
27 }
28 } while (++f < e); 25 } while (++f < e);
29 26
30 return 0; 27 return 0;
@@ -66,22 +63,32 @@ aoedev_newdev(ulong nframes)
66 struct frame *f, *e; 63 struct frame *f, *e;
67 64
68 d = kzalloc(sizeof *d, GFP_ATOMIC); 65 d = kzalloc(sizeof *d, GFP_ATOMIC);
69 if (d == NULL)
70 return NULL;
71 f = kcalloc(nframes, sizeof *f, GFP_ATOMIC); 66 f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
72 if (f == NULL) { 67 switch (!d || !f) {
73 kfree(d); 68 case 0:
69 d->nframes = nframes;
70 d->frames = f;
71 e = f + nframes;
72 for (; f<e; f++) {
73 f->tag = FREETAG;
74 f->skb = new_skb(ETH_ZLEN);
75 if (!f->skb)
76 break;
77 }
78 if (f == e)
79 break;
80 while (f > d->frames) {
81 f--;
82 dev_kfree_skb(f->skb);
83 }
84 default:
85 if (f)
86 kfree(f);
87 if (d)
88 kfree(d);
74 return NULL; 89 return NULL;
75 } 90 }
76
77 INIT_WORK(&d->work, aoecmd_sleepwork, d); 91 INIT_WORK(&d->work, aoecmd_sleepwork, d);
78
79 d->nframes = nframes;
80 d->frames = f;
81 e = f + nframes;
82 for (; f<e; f++)
83 f->tag = FREETAG;
84
85 spin_lock_init(&d->lock); 92 spin_lock_init(&d->lock);
86 init_timer(&d->timer); 93 init_timer(&d->timer);
87 d->timer.data = (ulong) d; 94 d->timer.data = (ulong) d;
@@ -114,6 +121,7 @@ aoedev_downdev(struct aoedev *d)
114 mempool_free(buf, d->bufpool); 121 mempool_free(buf, d->bufpool);
115 bio_endio(bio, bio->bi_size, -EIO); 122 bio_endio(bio, bio->bi_size, -EIO);
116 } 123 }
124 skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
117 } 125 }
118 d->inprocess = NULL; 126 d->inprocess = NULL;
119 127
@@ -148,7 +156,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
148 d = aoedev_newdev(bufcnt); 156 d = aoedev_newdev(bufcnt);
149 if (d == NULL) { 157 if (d == NULL) {
150 spin_unlock_irqrestore(&devlist_lock, flags); 158 spin_unlock_irqrestore(&devlist_lock, flags);
151 printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n"); 159 printk(KERN_INFO "aoe: aoedev_newdev failure.\n");
152 return NULL; 160 return NULL;
153 } 161 }
154 d->sysminor = sysminor; 162 d->sysminor = sysminor;
@@ -163,11 +171,19 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
163static void 171static void
164aoedev_freedev(struct aoedev *d) 172aoedev_freedev(struct aoedev *d)
165{ 173{
174 struct frame *f, *e;
175
166 if (d->gd) { 176 if (d->gd) {
167 aoedisk_rm_sysfs(d); 177 aoedisk_rm_sysfs(d);
168 del_gendisk(d->gd); 178 del_gendisk(d->gd);
169 put_disk(d->gd); 179 put_disk(d->gd);
170 } 180 }
181 f = d->frames;
182 e = f + d->nframes;
183 for (; f<e; f++) {
184 skb_shinfo(f->skb)->nr_frags = 0;
185 dev_kfree_skb(f->skb);
186 }
171 kfree(d->frames); 187 kfree(d->frames);
172 if (d->bufpool) 188 if (d->bufpool)
173 mempool_destroy(d->bufpool); 189 mempool_destroy(d->bufpool);
diff --git a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
index de08491ebe66..a04b7d613299 100644
--- a/drivers/block/aoe/aoemain.c
+++ b/drivers/block/aoe/aoemain.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoemain.c 3 * aoemain.c
4 * Module initialization routines, discover timer 4 * Module initialization routines, discover timer
@@ -84,13 +84,11 @@ aoe_init(void)
84 goto net_fail; 84 goto net_fail;
85 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME); 85 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
86 if (ret < 0) { 86 if (ret < 0) {
87 printk(KERN_ERR "aoe: aoeblk_init: can't register major\n"); 87 printk(KERN_ERR "aoe: can't register major\n");
88 goto blkreg_fail; 88 goto blkreg_fail;
89 } 89 }
90 90
91 printk(KERN_INFO 91 printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
92 "aoe: aoe_init: AoE v%s initialised.\n",
93 VERSION);
94 discover_timer(TINIT); 92 discover_timer(TINIT);
95 return 0; 93 return 0;
96 94
@@ -103,7 +101,7 @@ aoe_init(void)
103 chr_fail: 101 chr_fail:
104 aoedev_exit(); 102 aoedev_exit();
105 103
106 printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n"); 104 printk(KERN_INFO "aoe: initialisation failure.\n");
107 return ret; 105 return ret;
108} 106}
109 107
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index c1434ed11880..9626e0f5da9d 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoenet.c 3 * aoenet.c
4 * Ethernet portion of AoE driver 4 * Ethernet portion of AoE driver
@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)
74 return -EINVAL; 74 return -EINVAL;
75 75
76 if (copy_from_user(aoe_iflist, user_str, size)) { 76 if (copy_from_user(aoe_iflist, user_str, size)) {
77 printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__); 77 printk(KERN_INFO "aoe: copy from user failed\n");
78 return -EFAULT; 78 return -EFAULT;
79 } 79 }
80 aoe_iflist[size] = 0x00; 80 aoe_iflist[size] = 0x00;
@@ -132,8 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
132 if (n > NECODES) 132 if (n > NECODES)
133 n = 0; 133 n = 0;
134 if (net_ratelimit()) 134 if (net_ratelimit())
135 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 135 printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
136 "ecode=%d '%s'\n",
137 be16_to_cpu(h->major), h->minor, 136 be16_to_cpu(h->major), h->minor,
138 h->err, aoe_errlist[n]); 137 h->err, aoe_errlist[n]);
139 goto exit; 138 goto exit;
@@ -147,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
147 aoecmd_cfg_rsp(skb); 146 aoecmd_cfg_rsp(skb);
148 break; 147 break;
149 default: 148 default:
150 printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd); 149 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
151 } 150 }
152exit: 151exit:
153 dev_kfree_skb(skb); 152 dev_kfree_skb(skb);
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index a3f64bfe6b58..485aa87e9bcd 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -432,6 +432,12 @@ static int __init rd_init(void)
432 rd_disks[i] = alloc_disk(1); 432 rd_disks[i] = alloc_disk(1);
433 if (!rd_disks[i]) 433 if (!rd_disks[i])
434 goto out; 434 goto out;
435
436 rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
437 if (!rd_queue[i]) {
438 put_disk(rd_disks[i]);
439 goto out;
440 }
435 } 441 }
436 442
437 if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) { 443 if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) {
@@ -442,10 +448,6 @@ static int __init rd_init(void)
442 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) { 448 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
443 struct gendisk *disk = rd_disks[i]; 449 struct gendisk *disk = rd_disks[i];
444 450
445 rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
446 if (!rd_queue[i])
447 goto out_queue;
448
449 blk_queue_make_request(rd_queue[i], &rd_make_request); 451 blk_queue_make_request(rd_queue[i], &rd_make_request);
450 blk_queue_hardsect_size(rd_queue[i], rd_blocksize); 452 blk_queue_hardsect_size(rd_queue[i], rd_blocksize);
451 453
@@ -466,8 +468,6 @@ static int __init rd_init(void)
466 CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize); 468 CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize);
467 469
468 return 0; 470 return 0;
469out_queue:
470 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
471out: 471out:
472 while (i--) { 472 while (i--) {
473 put_disk(rd_disks[i]); 473 put_disk(rd_disks[i]);
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
index 67cdda43f229..516751754aa9 100644
--- a/drivers/bluetooth/bcm203x.c
+++ b/drivers/bluetooth/bcm203x.c
@@ -29,7 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <linux/timer.h>
33 32
34#include <linux/device.h> 33#include <linux/device.h>
35#include <linux/firmware.h> 34#include <linux/firmware.h>
@@ -43,7 +42,7 @@
43#define BT_DBG(D...) 42#define BT_DBG(D...)
44#endif 43#endif
45 44
46#define VERSION "1.0" 45#define VERSION "1.1"
47 46
48static int ignore = 0; 47static int ignore = 0;
49 48
@@ -72,7 +71,7 @@ struct bcm203x_data {
72 71
73 unsigned long state; 72 unsigned long state;
74 73
75 struct timer_list timer; 74 struct work_struct work;
76 75
77 struct urb *urb; 76 struct urb *urb;
78 unsigned char *buffer; 77 unsigned char *buffer;
@@ -105,7 +104,7 @@ static void bcm203x_complete(struct urb *urb)
105 104
106 data->state = BCM203X_SELECT_MEMORY; 105 data->state = BCM203X_SELECT_MEMORY;
107 106
108 mod_timer(&data->timer, jiffies + (HZ / 10)); 107 schedule_work(&data->work);
109 break; 108 break;
110 109
111 case BCM203X_SELECT_MEMORY: 110 case BCM203X_SELECT_MEMORY:
@@ -158,9 +157,9 @@ static void bcm203x_complete(struct urb *urb)
158 } 157 }
159} 158}
160 159
161static void bcm203x_timer(unsigned long user_data) 160static void bcm203x_work(void *user_data)
162{ 161{
163 struct bcm203x_data *data = (struct bcm203x_data *) user_data; 162 struct bcm203x_data *data = user_data;
164 163
165 if (usb_submit_urb(data->urb, GFP_ATOMIC) < 0) 164 if (usb_submit_urb(data->urb, GFP_ATOMIC) < 0)
166 BT_ERR("Can't submit URB"); 165 BT_ERR("Can't submit URB");
@@ -247,13 +246,11 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
247 246
248 release_firmware(firmware); 247 release_firmware(firmware);
249 248
250 init_timer(&data->timer); 249 INIT_WORK(&data->work, bcm203x_work, (void *) data);
251 data->timer.function = bcm203x_timer;
252 data->timer.data = (unsigned long) data;
253 250
254 usb_set_intfdata(intf, data); 251 usb_set_intfdata(intf, data);
255 252
256 mod_timer(&data->timer, jiffies + HZ); 253 schedule_work(&data->work);
257 254
258 return 0; 255 return 0;
259} 256}
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index e7c800f4c3ad..07eafbc5dc3a 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -711,6 +711,7 @@ static void dtl1_release(struct pcmcia_device *link)
711 711
712static struct pcmcia_device_id dtl1_ids[] = { 712static struct pcmcia_device_id dtl1_ids[] = {
713 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 713 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
714 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82),
714 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863), 715 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863),
715 PCMCIA_DEVICE_PROD_ID12("Socket", "CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3), 716 PCMCIA_DEVICE_PROD_ID12("Socket", "CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3),
716 PCMCIA_DEVICE_NULL 717 PCMCIA_DEVICE_NULL
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 7565642a007a..fdea58ae16b2 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -118,6 +118,9 @@ static struct usb_device_id blacklist_ids[] = {
118 /* IBM/Lenovo ThinkPad with Broadcom chip */ 118 /* IBM/Lenovo ThinkPad with Broadcom chip */
119 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, 119 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU },
120 120
121 /* ANYCOM Bluetooth USB-200 and USB-250 */
122 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
123
121 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ 124 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
122 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, 125 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
123 126
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 0e6f35fcc2eb..39a9f8cc6412 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -1046,7 +1046,7 @@ source "drivers/char/tpm/Kconfig"
1046 1046
1047config TELCLOCK 1047config TELCLOCK
1048 tristate "Telecom clock driver for MPBL0010 ATCA SBC" 1048 tristate "Telecom clock driver for MPBL0010 ATCA SBC"
1049 depends on EXPERIMENTAL 1049 depends on EXPERIMENTAL && X86
1050 default n 1050 default n
1051 help 1051 help
1052 The telecom clock device is specific to the MPBL0010 ATCA computer and 1052 The telecom clock device is specific to the MPBL0010 ATCA computer and
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index c3f95583a120..706733c0b36a 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1157,6 +1157,7 @@ static int __init pc_init(void)
1157 int crd; 1157 int crd;
1158 struct board_info *bd; 1158 struct board_info *bd;
1159 unsigned char board_id = 0; 1159 unsigned char board_id = 0;
1160 int err = -ENOMEM;
1160 1161
1161 int pci_boards_found, pci_count; 1162 int pci_boards_found, pci_count;
1162 1163
@@ -1164,13 +1165,11 @@ static int __init pc_init(void)
1164 1165
1165 pc_driver = alloc_tty_driver(MAX_ALLOC); 1166 pc_driver = alloc_tty_driver(MAX_ALLOC);
1166 if (!pc_driver) 1167 if (!pc_driver)
1167 return -ENOMEM; 1168 goto out1;
1168 1169
1169 pc_info = alloc_tty_driver(MAX_ALLOC); 1170 pc_info = alloc_tty_driver(MAX_ALLOC);
1170 if (!pc_info) { 1171 if (!pc_info)
1171 put_tty_driver(pc_driver); 1172 goto out2;
1172 return -ENOMEM;
1173 }
1174 1173
1175 /* ----------------------------------------------------------------------- 1174 /* -----------------------------------------------------------------------
1176 If epca_setup has not been ran by LILO set num_cards to defaults; copy 1175 If epca_setup has not been ran by LILO set num_cards to defaults; copy
@@ -1370,11 +1369,17 @@ static int __init pc_init(void)
1370 1369
1371 } /* End for each card */ 1370 } /* End for each card */
1372 1371
1373 if (tty_register_driver(pc_driver)) 1372 err = tty_register_driver(pc_driver);
1374 panic("Couldn't register Digi PC/ driver"); 1373 if (err) {
1374 printk(KERN_ERR "Couldn't register Digi PC/ driver");
1375 goto out3;
1376 }
1375 1377
1376 if (tty_register_driver(pc_info)) 1378 err = tty_register_driver(pc_info);
1377 panic("Couldn't register Digi PC/ info "); 1379 if (err) {
1380 printk(KERN_ERR "Couldn't register Digi PC/ info ");
1381 goto out4;
1382 }
1378 1383
1379 /* ------------------------------------------------------------------- 1384 /* -------------------------------------------------------------------
1380 Start up the poller to check for events on all enabled boards 1385 Start up the poller to check for events on all enabled boards
@@ -1385,6 +1390,15 @@ static int __init pc_init(void)
1385 mod_timer(&epca_timer, jiffies + HZ/25); 1390 mod_timer(&epca_timer, jiffies + HZ/25);
1386 return 0; 1391 return 0;
1387 1392
1393out4:
1394 tty_unregister_driver(pc_driver);
1395out3:
1396 put_tty_driver(pc_info);
1397out2:
1398 put_tty_driver(pc_driver);
1399out1:
1400 return err;
1401
1388} /* End pc_init */ 1402} /* End pc_init */
1389 1403
1390/* ------------------ Begin post_fep_init ---------------------- */ 1404/* ------------------ Begin post_fep_init ---------------------- */
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 24825bdca8f4..e5cfb1fa47d1 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1789,7 +1789,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
1789 1789
1790 info = kzalloc(sizeof(*info), GFP_KERNEL); 1790 info = kzalloc(sizeof(*info), GFP_KERNEL);
1791 if (!info) 1791 if (!info)
1792 return ENOMEM; 1792 return -ENOMEM;
1793 1793
1794 info->addr_source = "PCI"; 1794 info->addr_source = "PCI";
1795 1795
@@ -1810,7 +1810,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
1810 kfree(info); 1810 kfree(info);
1811 printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", 1811 printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n",
1812 pci_name(pdev), class_type); 1812 pci_name(pdev), class_type);
1813 return ENOMEM; 1813 return -ENOMEM;
1814 } 1814 }
1815 1815
1816 rv = pci_enable_device(pdev); 1816 rv = pci_enable_device(pdev);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 07f47a0208a7..eb6b13f4211a 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -645,6 +645,7 @@ void add_input_randomness(unsigned int type, unsigned int code,
645 add_timer_randomness(&input_timer_state, 645 add_timer_randomness(&input_timer_state,
646 (type << 4) ^ code ^ (code >> 4) ^ value); 646 (type << 4) ^ code ^ (code >> 4) ^ value);
647} 647}
648EXPORT_SYMBOL_GPL(add_input_randomness);
648 649
649void add_interrupt_randomness(int irq) 650void add_interrupt_randomness(int irq)
650{ 651{
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index 052e8120a471..7ce77619707c 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -662,7 +662,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
662 p->RIOError.Error = COPYIN_FAILED; 662 p->RIOError.Error = COPYIN_FAILED;
663 return -EFAULT; 663 return -EFAULT;
664 } 664 }
665 if (portStats.port >= RIO_PORTS) { 665 if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
666 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 666 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
667 return -ENXIO; 667 return -ENXIO;
668 } 668 }
@@ -702,7 +702,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
702 p->RIOError.Error = COPYIN_FAILED; 702 p->RIOError.Error = COPYIN_FAILED;
703 return -EFAULT; 703 return -EFAULT;
704 } 704 }
705 if (portStats.port >= RIO_PORTS) { 705 if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
706 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 706 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
707 return -ENXIO; 707 return -ENXIO;
708 } 708 }
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index d0b88d0e87fd..7e1bd9562c2a 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -183,11 +183,6 @@ static int sx_poll = HZ;
183 183
184static struct tty_driver *specialix_driver; 184static struct tty_driver *specialix_driver;
185 185
186static unsigned long baud_table[] = {
187 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
188 9600, 19200, 38400, 57600, 115200, 0,
189};
190
191static struct specialix_board sx_board[SX_NBOARD] = { 186static struct specialix_board sx_board[SX_NBOARD] = {
192 { 0, SX_IOBASE1, 9, }, 187 { 0, SX_IOBASE1, 9, },
193 { 0, SX_IOBASE2, 11, }, 188 { 0, SX_IOBASE2, 11, },
@@ -1090,9 +1085,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1090 1085
1091 if (baud == 38400) { 1086 if (baud == 38400) {
1092 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1087 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1093 baud ++; 1088 baud = 57600;
1094 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1089 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1095 baud += 2; 1090 baud = 115200;
1096 } 1091 }
1097 1092
1098 if (!baud) { 1093 if (!baud) {
@@ -1150,11 +1145,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1150 sx_out(bp, CD186x_RBPRL, tmp & 0xff); 1145 sx_out(bp, CD186x_RBPRL, tmp & 0xff);
1151 sx_out(bp, CD186x_TBPRL, tmp & 0xff); 1146 sx_out(bp, CD186x_TBPRL, tmp & 0xff);
1152 spin_unlock_irqrestore(&bp->lock, flags); 1147 spin_unlock_irqrestore(&bp->lock, flags);
1153 if (port->custom_divisor) { 1148 if (port->custom_divisor)
1154 baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; 1149 baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor;
1155 baud = ( baud + 5 ) / 10; 1150 baud = (baud + 5) / 10; /* Estimated CPS */
1156 } else
1157 baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */
1158 1151
1159 /* Two timer ticks seems enough to wakeup something like SLIP driver */ 1152 /* Two timer ticks seems enough to wakeup something like SLIP driver */
1160 tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; 1153 tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO;
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 5fec626598cd..cc10af08cb05 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -2602,7 +2602,7 @@ static void __exit sx_exit (void)
2602 } 2602 }
2603 } 2603 }
2604 if (misc_deregister(&sx_fw_device) < 0) { 2604 if (misc_deregister(&sx_fw_device) < 0) {
2605 printk (KERN_INFO "sx: couldn't deregister firmware loader devic\n"); 2605 printk (KERN_INFO "sx: couldn't deregister firmware loader device\n");
2606 } 2606 }
2607 sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized); 2607 sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized);
2608 if (sx_initialized) 2608 if (sx_initialized)
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index f2864cc64240..06784adcc35c 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -133,8 +133,8 @@ static MGSL_PARAMS default_params = {
133}; 133};
134 134
135#define SHARED_MEM_ADDRESS_SIZE 0x40000 135#define SHARED_MEM_ADDRESS_SIZE 0x40000
136#define BUFFERLISTSIZE (PAGE_SIZE) 136#define BUFFERLISTSIZE 4096
137#define DMABUFFERSIZE (PAGE_SIZE) 137#define DMABUFFERSIZE 4096
138#define MAXRXFRAMES 7 138#define MAXRXFRAMES 7
139 139
140typedef struct _DMABUFFERENTRY 140typedef struct _DMABUFFERENTRY
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c
index 5948863b592b..bf25d0a55a99 100644
--- a/drivers/char/watchdog/alim7101_wdt.c
+++ b/drivers/char/watchdog/alim7101_wdt.c
@@ -77,7 +77,8 @@ static struct pci_dev *alim7101_pmu;
77 77
78static int nowayout = WATCHDOG_NOWAYOUT; 78static int nowayout = WATCHDOG_NOWAYOUT;
79module_param(nowayout, int, 0); 79module_param(nowayout, int, 0);
80MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 80MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
81 __stringify(CONFIG_WATCHDOG_NOWAYOUT) ")");
81 82
82/* 83/*
83 * Whack the dog 84 * Whack the dog
@@ -415,6 +416,16 @@ err_out:
415module_init(alim7101_wdt_init); 416module_init(alim7101_wdt_init);
416module_exit(alim7101_wdt_unload); 417module_exit(alim7101_wdt_unload);
417 418
419static struct pci_device_id alim7101_pci_tbl[] __devinitdata = {
420 { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
421 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
422 { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
423 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
424 { }
425};
426
427MODULE_DEVICE_TABLE(pci, alim7101_pci_tbl);
428
418MODULE_AUTHOR("Steve Hill"); 429MODULE_AUTHOR("Steve Hill");
419MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver"); 430MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver");
420MODULE_LICENSE("GPL"); 431MODULE_LICENSE("GPL");
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 8bcb58cd4ac0..1865b56fb141 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * See Documentation/dcdbas.txt for more information. 9 * See Documentation/dcdbas.txt for more information.
10 * 10 *
11 * Copyright (C) 1995-2005 Dell Inc. 11 * Copyright (C) 1995-2006 Dell Inc.
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License v2.0 as published by 14 * it under the terms of the GNU General Public License v2.0 as published by
@@ -40,7 +40,7 @@
40#include "dcdbas.h" 40#include "dcdbas.h"
41 41
42#define DRIVER_NAME "dcdbas" 42#define DRIVER_NAME "dcdbas"
43#define DRIVER_VERSION "5.6.0-2" 43#define DRIVER_VERSION "5.6.0-3.2"
44#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver" 44#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver"
45 45
46static struct platform_device *dcdbas_pdev; 46static struct platform_device *dcdbas_pdev;
@@ -175,6 +175,9 @@ static ssize_t smi_data_write(struct kobject *kobj, char *buf, loff_t pos,
175{ 175{
176 ssize_t ret; 176 ssize_t ret;
177 177
178 if ((pos + count) > MAX_SMI_DATA_BUF_SIZE)
179 return -EINVAL;
180
178 mutex_lock(&smi_data_lock); 181 mutex_lock(&smi_data_lock);
179 182
180 ret = smi_data_buf_realloc(pos + count); 183 ret = smi_data_buf_realloc(pos + count);
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 9b88b25b6edb..e76d91906c99 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -95,11 +95,13 @@ config SENSORS_ADM9240
95 will be called adm9240. 95 will be called adm9240.
96 96
97config SENSORS_K8TEMP 97config SENSORS_K8TEMP
98 tristate "AMD K8 processor sensor" 98 tristate "AMD Athlon64/FX or Opteron temperature sensor"
99 depends on HWMON && X86 && PCI && EXPERIMENTAL 99 depends on HWMON && X86 && PCI && EXPERIMENTAL
100 help 100 help
101 If you say yes here you get support for the temperature 101 If you say yes here you get support for the temperature
102 sensor(s) inside your AMD K8 CPU. 102 sensor(s) inside your CPU. Supported is whole AMD K8
103 microarchitecture. Please note that you will need at least
104 lm-sensors 2.10.1 for proper userspace support.
103 105
104 This driver can also be built as a module. If so, the module 106 This driver can also be built as a module. If so, the module
105 will be called k8temp. 107 will be called k8temp.
@@ -369,8 +371,8 @@ config SENSORS_SMSC47M1
369 help 371 help
370 If you say yes here you get support for the integrated fan 372 If you say yes here you get support for the integrated fan
371 monitoring and control capabilities of the SMSC LPC47B27x, 373 monitoring and control capabilities of the SMSC LPC47B27x,
372 LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x, LPC47M192 and 374 LPC47M10x, LPC47M112, LPC47M13x, LPC47M14x, LPC47M15x,
373 LPC47M997 chips. 375 LPC47M192 and LPC47M997 chips.
374 376
375 The temperature and voltage sensor features of the LPC47M192 377 The temperature and voltage sensor features of the LPC47M192
376 and LPC47M997 are supported by another driver, select also 378 and LPC47M997 are supported by another driver, select also
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 377961c4a41e..aad594adf0c7 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999 Frodo Looijaard <frodol@dds.nl> 5 * Copyright (C) 1999 Frodo Looijaard <frodol@dds.nl>
6 * Philip Edelbrock <phil@netroedge.com> 6 * Philip Edelbrock <phil@netroedge.com>
7 * Copyright (C) 2003 Michiel Rook <michiel@grendelproject.nl> 7 * Copyright (C) 2003 Michiel Rook <michiel@grendelproject.nl>
8 * Copyright (C) 2005 Grant Coady <gcoady@gmail.com> with valuable 8 * Copyright (C) 2005 Grant Coady <gcoady.lk@gmail.com> with valuable
9 * guidance from Jean Delvare 9 * guidance from Jean Delvare
10 * 10 *
11 * Driver supports Analog Devices ADM9240 11 * Driver supports Analog Devices ADM9240
@@ -774,7 +774,7 @@ static void __exit sensors_adm9240_exit(void)
774} 774}
775 775
776MODULE_AUTHOR("Michiel Rook <michiel@grendelproject.nl>, " 776MODULE_AUTHOR("Michiel Rook <michiel@grendelproject.nl>, "
777 "Grant Coady <gcoady@gmail.com> and others"); 777 "Grant Coady <gcoady.lk@gmail.com> and others");
778MODULE_DESCRIPTION("ADM9240/DS1780/LM81 driver"); 778MODULE_DESCRIPTION("ADM9240/DS1780/LM81 driver");
779MODULE_LICENSE("GPL"); 779MODULE_LICENSE("GPL");
780 780
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index ac1b746df6d0..73bc2ffc598d 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -815,18 +815,18 @@ static int __init sm_lm78_init(void)
815 if (res) 815 if (res)
816 return res; 816 return res;
817 817
818 res = i2c_isa_add_driver(&lm78_isa_driver); 818 /* Don't exit if this one fails, we still want the I2C variants
819 if (res) { 819 to work! */
820 i2c_del_driver(&lm78_driver); 820 if (i2c_isa_add_driver(&lm78_isa_driver))
821 return res; 821 isa_address = 0;
822 }
823 822
824 return 0; 823 return 0;
825} 824}
826 825
827static void __exit sm_lm78_exit(void) 826static void __exit sm_lm78_exit(void)
828{ 827{
829 i2c_isa_del_driver(&lm78_isa_driver); 828 if (isa_address)
829 i2c_isa_del_driver(&lm78_isa_driver);
830 i2c_del_driver(&lm78_driver); 830 i2c_del_driver(&lm78_driver);
831} 831}
832 832
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 47132fd26b1b..beb881c4b2e8 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -2,8 +2,8 @@
2 smsc47m1.c - Part of lm_sensors, Linux kernel modules 2 smsc47m1.c - Part of lm_sensors, Linux kernel modules
3 for hardware monitoring 3 for hardware monitoring
4 4
5 Supports the SMSC LPC47B27x, LPC47M10x, LPC47M13x, LPC47M14x, 5 Supports the SMSC LPC47B27x, LPC47M10x, LPC47M112, LPC47M13x,
6 LPC47M15x, LPC47M192 and LPC47M997 Super-I/O chips. 6 LPC47M14x, LPC47M15x, LPC47M192 and LPC47M997 Super-I/O chips.
7 7
8 Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> 8 Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
9 Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> 9 Copyright (C) 2004 Jean Delvare <khali@linux-fr.org>
@@ -380,8 +380,8 @@ static int __init smsc47m1_find(unsigned short *addr)
380 val = superio_inb(SUPERIO_REG_DEVID); 380 val = superio_inb(SUPERIO_REG_DEVID);
381 381
382 /* 382 /*
383 * SMSC LPC47M10x/LPC47M13x (device id 0x59), LPC47M14x (device id 383 * SMSC LPC47M10x/LPC47M112/LPC47M13x (device id 0x59), LPC47M14x
384 * 0x5F) and LPC47B27x (device id 0x51) have fan control. 384 * (device id 0x5F) and LPC47B27x (device id 0x51) have fan control.
385 * The LPC47M15x and LPC47M192 chips "with hardware monitoring block" 385 * The LPC47M15x and LPC47M192 chips "with hardware monitoring block"
386 * can do much more besides (device id 0x60). 386 * can do much more besides (device id 0x60).
387 * The LPC47M997 is undocumented, but seems to be compatible with 387 * The LPC47M997 is undocumented, but seems to be compatible with
@@ -390,7 +390,8 @@ static int __init smsc47m1_find(unsigned short *addr)
390 if (val == 0x51) 390 if (val == 0x51)
391 printk(KERN_INFO "smsc47m1: Found SMSC LPC47B27x\n"); 391 printk(KERN_INFO "smsc47m1: Found SMSC LPC47B27x\n");
392 else if (val == 0x59) 392 else if (val == 0x59)
393 printk(KERN_INFO "smsc47m1: Found SMSC LPC47M10x/LPC47M13x\n"); 393 printk(KERN_INFO "smsc47m1: Found SMSC "
394 "LPC47M10x/LPC47M112/LPC47M13x\n");
394 else if (val == 0x5F) 395 else if (val == 0x5F)
395 printk(KERN_INFO "smsc47m1: Found SMSC LPC47M14x\n"); 396 printk(KERN_INFO "smsc47m1: Found SMSC LPC47M14x\n");
396 else if (val == 0x60) 397 else if (val == 0x60)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 833faa275ffa..2257806d0102 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -354,6 +354,8 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr)
354 case 0: 354 case 0:
355 reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0xcf) 355 reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0xcf)
356 | ((data->fan_div[0] & 0x03) << 4); 356 | ((data->fan_div[0] & 0x03) << 4);
357 /* fan5 input control bit is write only, compute the value */
358 reg |= (data->has_fan & (1 << 4)) ? 1 : 0;
357 w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); 359 w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg);
358 reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xdf) 360 reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xdf)
359 | ((data->fan_div[0] & 0x04) << 3); 361 | ((data->fan_div[0] & 0x04) << 3);
@@ -362,6 +364,8 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr)
362 case 1: 364 case 1:
363 reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0x3f) 365 reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0x3f)
364 | ((data->fan_div[1] & 0x03) << 6); 366 | ((data->fan_div[1] & 0x03) << 6);
367 /* fan5 input control bit is write only, compute the value */
368 reg |= (data->has_fan & (1 << 4)) ? 1 : 0;
365 w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); 369 w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg);
366 reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xbf) 370 reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xbf)
367 | ((data->fan_div[1] & 0x04) << 4); 371 | ((data->fan_div[1] & 0x04) << 4);
@@ -1216,13 +1220,16 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
1216 superio_exit(); 1220 superio_exit();
1217 1221
1218 /* It looks like fan4 and fan5 pins can be alternatively used 1222 /* It looks like fan4 and fan5 pins can be alternatively used
1219 as fan on/off switches */ 1223 as fan on/off switches, but fan5 control is write only :/
1224 We assume that if the serial interface is disabled, designers
1225 connected fan5 as input unless they are emitting log 1, which
1226 is not the default. */
1220 1227
1221 data->has_fan = 0x07; /* fan1, fan2 and fan3 */ 1228 data->has_fan = 0x07; /* fan1, fan2 and fan3 */
1222 i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1); 1229 i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1);
1223 if ((i & (1 << 2)) && (!fan4pin)) 1230 if ((i & (1 << 2)) && (!fan4pin))
1224 data->has_fan |= (1 << 3); 1231 data->has_fan |= (1 << 3);
1225 if ((i & (1 << 0)) && (!fan5pin)) 1232 if (!(i & (1 << 1)) && (!fan5pin))
1226 data->has_fan |= (1 << 4); 1233 data->has_fan |= (1 << 4);
1227 1234
1228 /* Register sysfs hooks */ 1235 /* Register sysfs hooks */
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index a4584ec69842..1232171c3aad 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1099,7 +1099,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
1099 bank. */ 1099 bank. */
1100 if (kind < 0) { 1100 if (kind < 0) {
1101 if (w83781d_read_value(client, W83781D_REG_CONFIG) & 0x80) { 1101 if (w83781d_read_value(client, W83781D_REG_CONFIG) & 0x80) {
1102 dev_dbg(dev, "Detection failed at step 3\n"); 1102 dev_dbg(&adapter->dev, "Detection of w83781d chip "
1103 "failed at step 3\n");
1103 err = -ENODEV; 1104 err = -ENODEV;
1104 goto ERROR2; 1105 goto ERROR2;
1105 } 1106 }
@@ -1109,7 +1110,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
1109 if ((!(val1 & 0x07)) && 1110 if ((!(val1 & 0x07)) &&
1110 (((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3)) 1111 (((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3))
1111 || ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)))) { 1112 || ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)))) {
1112 dev_dbg(dev, "Detection failed at step 4\n"); 1113 dev_dbg(&adapter->dev, "Detection of w83781d chip "
1114 "failed at step 4\n");
1113 err = -ENODEV; 1115 err = -ENODEV;
1114 goto ERROR2; 1116 goto ERROR2;
1115 } 1117 }
@@ -1119,7 +1121,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
1119 ((val1 & 0x80) && (val2 == 0x5c)))) { 1121 ((val1 & 0x80) && (val2 == 0x5c)))) {
1120 if (w83781d_read_value 1122 if (w83781d_read_value
1121 (client, W83781D_REG_I2C_ADDR) != address) { 1123 (client, W83781D_REG_I2C_ADDR) != address) {
1122 dev_dbg(dev, "Detection failed at step 5\n"); 1124 dev_dbg(&adapter->dev, "Detection of w83781d "
1125 "chip failed at step 5\n");
1123 err = -ENODEV; 1126 err = -ENODEV;
1124 goto ERROR2; 1127 goto ERROR2;
1125 } 1128 }
@@ -1141,8 +1144,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
1141 else if (val2 == 0x12) 1144 else if (val2 == 0x12)
1142 vendid = asus; 1145 vendid = asus;
1143 else { 1146 else {
1144 dev_dbg(dev, "Chip was made by neither " 1147 dev_dbg(&adapter->dev, "w83781d chip vendor is "
1145 "Winbond nor Asus?\n"); 1148 "neither Winbond nor Asus\n");
1146 err = -ENODEV; 1149 err = -ENODEV;
1147 goto ERROR2; 1150 goto ERROR2;
1148 } 1151 }
@@ -1161,10 +1164,9 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
1161 kind = as99127f; 1164 kind = as99127f;
1162 else { 1165 else {
1163 if (kind == 0) 1166 if (kind == 0)
1164 dev_warn(dev, "Ignoring 'force' " 1167 dev_warn(&adapter->dev, "Ignoring 'force' "
1165 "parameter for unknown chip at " 1168 "parameter for unknown chip at "
1166 "adapter %d, address 0x%02x\n", 1169 "address 0x%02x\n", address);
1167 i2c_adapter_id(adapter), address);
1168 err = -EINVAL; 1170 err = -EINVAL;
1169 goto ERROR2; 1171 goto ERROR2;
1170 } 1172 }
@@ -1685,11 +1687,10 @@ sensors_w83781d_init(void)
1685 if (res) 1687 if (res)
1686 return res; 1688 return res;
1687 1689
1688 res = i2c_isa_add_driver(&w83781d_isa_driver); 1690 /* Don't exit if this one fails, we still want the I2C variants
1689 if (res) { 1691 to work! */
1690 i2c_del_driver(&w83781d_driver); 1692 if (i2c_isa_add_driver(&w83781d_isa_driver))
1691 return res; 1693 isa_address = 0;
1692 }
1693 1694
1694 return 0; 1695 return 0;
1695} 1696}
@@ -1697,7 +1698,8 @@ sensors_w83781d_init(void)
1697static void __exit 1698static void __exit
1698sensors_w83781d_exit(void) 1699sensors_w83781d_exit(void)
1699{ 1700{
1700 i2c_isa_del_driver(&w83781d_isa_driver); 1701 if (isa_address)
1702 i2c_isa_del_driver(&w83781d_isa_driver);
1701 i2c_del_driver(&w83781d_driver); 1703 i2c_del_driver(&w83781d_driver);
1702} 1704}
1703 1705
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 371ed4f69a97..9e5f885368b4 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -746,6 +746,52 @@ static ssize_t store_vrm_reg(struct device *dev,
746 746
747static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 747static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
748 748
749#define IN_UNIT_ATTRS(X) \
750 &sda_in_input[X].dev_attr.attr, \
751 &sda_in_min[X].dev_attr.attr, \
752 &sda_in_max[X].dev_attr.attr
753
754#define FAN_UNIT_ATTRS(X) \
755 &sda_fan_input[X].dev_attr.attr, \
756 &sda_fan_min[X].dev_attr.attr, \
757 &sda_fan_div[X].dev_attr.attr
758
759#define TEMP_UNIT_ATTRS(X) \
760 &sda_temp_input[X].dev_attr.attr, \
761 &sda_temp_max[X].dev_attr.attr, \
762 &sda_temp_max_hyst[X].dev_attr.attr
763
764static struct attribute *w83791d_attributes[] = {
765 IN_UNIT_ATTRS(0),
766 IN_UNIT_ATTRS(1),
767 IN_UNIT_ATTRS(2),
768 IN_UNIT_ATTRS(3),
769 IN_UNIT_ATTRS(4),
770 IN_UNIT_ATTRS(5),
771 IN_UNIT_ATTRS(6),
772 IN_UNIT_ATTRS(7),
773 IN_UNIT_ATTRS(8),
774 IN_UNIT_ATTRS(9),
775 FAN_UNIT_ATTRS(0),
776 FAN_UNIT_ATTRS(1),
777 FAN_UNIT_ATTRS(2),
778 FAN_UNIT_ATTRS(3),
779 FAN_UNIT_ATTRS(4),
780 TEMP_UNIT_ATTRS(0),
781 TEMP_UNIT_ATTRS(1),
782 TEMP_UNIT_ATTRS(2),
783 &dev_attr_alarms.attr,
784 &sda_beep_ctrl[0].dev_attr.attr,
785 &sda_beep_ctrl[1].dev_attr.attr,
786 &dev_attr_cpu0_vid.attr,
787 &dev_attr_vrm.attr,
788 NULL
789};
790
791static const struct attribute_group w83791d_group = {
792 .attrs = w83791d_attributes,
793};
794
749/* This function is called when: 795/* This function is called when:
750 * w83791d_driver is inserted (when this module is loaded), for each 796 * w83791d_driver is inserted (when this module is loaded), for each
751 available adapter 797 available adapter
@@ -967,41 +1013,20 @@ static int w83791d_detect(struct i2c_adapter *adapter, int address, int kind)
967 } 1013 }
968 1014
969 /* Register sysfs hooks */ 1015 /* Register sysfs hooks */
1016 if ((err = sysfs_create_group(&client->dev.kobj, &w83791d_group)))
1017 goto error3;
1018
1019 /* Everything is ready, now register the working device */
970 data->class_dev = hwmon_device_register(dev); 1020 data->class_dev = hwmon_device_register(dev);
971 if (IS_ERR(data->class_dev)) { 1021 if (IS_ERR(data->class_dev)) {
972 err = PTR_ERR(data->class_dev); 1022 err = PTR_ERR(data->class_dev);
973 goto error3; 1023 goto error4;
974 } 1024 }
975 1025
976 for (i = 0; i < NUMBER_OF_VIN; i++) {
977 device_create_file(dev, &sda_in_input[i].dev_attr);
978 device_create_file(dev, &sda_in_min[i].dev_attr);
979 device_create_file(dev, &sda_in_max[i].dev_attr);
980 }
981
982 for (i = 0; i < NUMBER_OF_FANIN; i++) {
983 device_create_file(dev, &sda_fan_input[i].dev_attr);
984 device_create_file(dev, &sda_fan_div[i].dev_attr);
985 device_create_file(dev, &sda_fan_min[i].dev_attr);
986 }
987
988 for (i = 0; i < NUMBER_OF_TEMPIN; i++) {
989 device_create_file(dev, &sda_temp_input[i].dev_attr);
990 device_create_file(dev, &sda_temp_max[i].dev_attr);
991 device_create_file(dev, &sda_temp_max_hyst[i].dev_attr);
992 }
993
994 device_create_file(dev, &dev_attr_alarms);
995
996 for (i = 0; i < ARRAY_SIZE(sda_beep_ctrl); i++) {
997 device_create_file(dev, &sda_beep_ctrl[i].dev_attr);
998 }
999
1000 device_create_file(dev, &dev_attr_cpu0_vid);
1001 device_create_file(dev, &dev_attr_vrm);
1002
1003 return 0; 1026 return 0;
1004 1027
1028error4:
1029 sysfs_remove_group(&client->dev.kobj, &w83791d_group);
1005error3: 1030error3:
1006 if (data->lm75[0] != NULL) { 1031 if (data->lm75[0] != NULL) {
1007 i2c_detach_client(data->lm75[0]); 1032 i2c_detach_client(data->lm75[0]);
@@ -1025,8 +1050,10 @@ static int w83791d_detach_client(struct i2c_client *client)
1025 int err; 1050 int err;
1026 1051
1027 /* main client */ 1052 /* main client */
1028 if (data) 1053 if (data) {
1029 hwmon_device_unregister(data->class_dev); 1054 hwmon_device_unregister(data->class_dev);
1055 sysfs_remove_group(&client->dev.kobj, &w83791d_group);
1056 }
1030 1057
1031 if ((err = i2c_detach_client(client))) 1058 if ((err = i2c_detach_client(client)))
1032 return err; 1059 return err;
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 4380653748a4..8ed59a2dff53 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -91,7 +91,7 @@ int i2c_isa_add_driver(struct i2c_driver *driver)
91 /* Now look for clients */ 91 /* Now look for clients */
92 res = driver->attach_adapter(&isa_adapter); 92 res = driver->attach_adapter(&isa_adapter);
93 if (res) { 93 if (res) {
94 dev_err(&isa_adapter.dev, 94 dev_dbg(&isa_adapter.dev,
95 "Driver %s failed to attach adapter, unregistering\n", 95 "Driver %s failed to attach adapter, unregistering\n",
96 driver->driver.name); 96 driver->driver.name);
97 driver_unregister(&driver->driver); 97 driver_unregister(&driver->driver);
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 1d0470c1f957..30175c7688e8 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -524,8 +524,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
524 task_ioreg_t *hobsptr = args.hobRegister; 524 task_ioreg_t *hobsptr = args.hobRegister;
525 int err = 0; 525 int err = 0;
526 int tasksize = sizeof(struct ide_task_request_s); 526 int tasksize = sizeof(struct ide_task_request_s);
527 int taskin = 0; 527 unsigned int taskin = 0;
528 int taskout = 0; 528 unsigned int taskout = 0;
529 u8 io_32bit = drive->io_32bit; 529 u8 io_32bit = drive->io_32bit;
530 char __user *buf = (char __user *)arg; 530 char __user *buf = (char __user *)arg;
531 531
@@ -538,8 +538,13 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
538 return -EFAULT; 538 return -EFAULT;
539 } 539 }
540 540
541 taskout = (int) req_task->out_size; 541 taskout = req_task->out_size;
542 taskin = (int) req_task->in_size; 542 taskin = req_task->in_size;
543
544 if (taskin > 65536 || taskout > 65536) {
545 err = -EINVAL;
546 goto abort;
547 }
543 548
544 if (taskout) { 549 if (taskout) {
545 int outtotal = tasksize; 550 int outtotal = tasksize;
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index f3fe287fbd89..244f7eb7006d 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -774,7 +774,7 @@ ioc4_ide_exit(void)
774 ioc4_unregister_submodule(&ioc4_ide_submodule); 774 ioc4_unregister_submodule(&ioc4_ide_submodule);
775} 775}
776 776
777module_init(ioc4_ide_init); 777late_initcall(ioc4_ide_init); /* Call only after IDE init is done */
778module_exit(ioc4_ide_exit); 778module_exit(ioc4_ide_exit);
779 779
780MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); 780MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon");
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index dc1ebeac35c7..9e7bd94b958a 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -1243,7 +1243,7 @@ static struct pci_driver c2_pci_driver = {
1243 1243
1244static int __init c2_init_module(void) 1244static int __init c2_init_module(void)
1245{ 1245{
1246 return pci_module_init(&c2_pci_driver); 1246 return pci_register_driver(&c2_pci_driver);
1247} 1247}
1248 1248
1249static void __exit c2_exit_module(void) 1249static void __exit c2_exit_module(void)
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index e37c5688c214..30409e179606 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -150,8 +150,8 @@ static int c2_rnic_query(struct c2_dev *c2dev, struct ib_device_attr *props)
150 (struct c2wr_rnic_query_rep *) (unsigned long) (vq_req->reply_msg); 150 (struct c2wr_rnic_query_rep *) (unsigned long) (vq_req->reply_msg);
151 if (!reply) 151 if (!reply)
152 err = -ENOMEM; 152 err = -ENOMEM;
153 153 else
154 err = c2_errno(reply); 154 err = c2_errno(reply);
155 if (err) 155 if (err)
156 goto bail2; 156 goto bail2;
157 157
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index 29958b6e0214..28c087b824c2 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -67,19 +67,54 @@ static struct file_operations diag_file_ops = {
67 .release = ipath_diag_release 67 .release = ipath_diag_release
68}; 68};
69 69
70static ssize_t ipath_diagpkt_write(struct file *fp,
71 const char __user *data,
72 size_t count, loff_t *off);
73
74static struct file_operations diagpkt_file_ops = {
75 .owner = THIS_MODULE,
76 .write = ipath_diagpkt_write,
77};
78
79static atomic_t diagpkt_count = ATOMIC_INIT(0);
80static struct cdev *diagpkt_cdev;
81static struct class_device *diagpkt_class_dev;
82
70int ipath_diag_add(struct ipath_devdata *dd) 83int ipath_diag_add(struct ipath_devdata *dd)
71{ 84{
72 char name[16]; 85 char name[16];
86 int ret = 0;
87
88 if (atomic_inc_return(&diagpkt_count) == 1) {
89 ret = ipath_cdev_init(IPATH_DIAGPKT_MINOR,
90 "ipath_diagpkt", &diagpkt_file_ops,
91 &diagpkt_cdev, &diagpkt_class_dev);
92
93 if (ret) {
94 ipath_dev_err(dd, "Couldn't create ipath_diagpkt "
95 "device: %d", ret);
96 goto done;
97 }
98 }
73 99
74 snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit); 100 snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit);
75 101
76 return ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, 102 ret = ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name,
77 &diag_file_ops, &dd->diag_cdev, 103 &diag_file_ops, &dd->diag_cdev,
78 &dd->diag_class_dev); 104 &dd->diag_class_dev);
105 if (ret)
106 ipath_dev_err(dd, "Couldn't create %s device: %d",
107 name, ret);
108
109done:
110 return ret;
79} 111}
80 112
81void ipath_diag_remove(struct ipath_devdata *dd) 113void ipath_diag_remove(struct ipath_devdata *dd)
82{ 114{
115 if (atomic_dec_and_test(&diagpkt_count))
116 ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
117
83 ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev); 118 ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev);
84} 119}
85 120
@@ -275,30 +310,6 @@ bail:
275 return ret; 310 return ret;
276} 311}
277 312
278static ssize_t ipath_diagpkt_write(struct file *fp,
279 const char __user *data,
280 size_t count, loff_t *off);
281
282static struct file_operations diagpkt_file_ops = {
283 .owner = THIS_MODULE,
284 .write = ipath_diagpkt_write,
285};
286
287static struct cdev *diagpkt_cdev;
288static struct class_device *diagpkt_class_dev;
289
290int __init ipath_diagpkt_add(void)
291{
292 return ipath_cdev_init(IPATH_DIAGPKT_MINOR,
293 "ipath_diagpkt", &diagpkt_file_ops,
294 &diagpkt_cdev, &diagpkt_class_dev);
295}
296
297void __exit ipath_diagpkt_remove(void)
298{
299 ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
300}
301
302/** 313/**
303 * ipath_diagpkt_write - write an IB packet 314 * ipath_diagpkt_write - write an IB packet
304 * @fp: the diag data device file pointer 315 * @fp: the diag data device file pointer
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 12cefa658f3b..b4ffaa7bcbb7 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -2005,18 +2005,8 @@ static int __init infinipath_init(void)
2005 goto bail_group; 2005 goto bail_group;
2006 } 2006 }
2007 2007
2008 ret = ipath_diagpkt_add();
2009 if (ret < 0) {
2010 printk(KERN_ERR IPATH_DRV_NAME ": Unable to create "
2011 "diag data device: error %d\n", -ret);
2012 goto bail_ipathfs;
2013 }
2014
2015 goto bail; 2008 goto bail;
2016 2009
2017bail_ipathfs:
2018 ipath_exit_ipathfs();
2019
2020bail_group: 2010bail_group:
2021 ipath_driver_remove_group(&ipath_driver.driver); 2011 ipath_driver_remove_group(&ipath_driver.driver);
2022 2012
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 7c436697d0e4..06d5020a2f60 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -869,9 +869,6 @@ int ipath_device_create_group(struct device *, struct ipath_devdata *);
869void ipath_device_remove_group(struct device *, struct ipath_devdata *); 869void ipath_device_remove_group(struct device *, struct ipath_devdata *);
870int ipath_expose_reset(struct device *); 870int ipath_expose_reset(struct device *);
871 871
872int ipath_diagpkt_add(void);
873void ipath_diagpkt_remove(void);
874
875int ipath_init_ipathfs(void); 872int ipath_init_ipathfs(void);
876void ipath_exit_ipathfs(void); 873void ipath_exit_ipathfs(void);
877int ipathfs_add_device(struct ipath_devdata *); 874int ipathfs_add_device(struct ipath_devdata *);
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index e393681ba7d4..149b36901239 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -39,6 +39,8 @@
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/hardirq.h> 40#include <linux/hardirq.h>
41 41
42#include <asm/io.h>
43
42#include <rdma/ib_pack.h> 44#include <rdma/ib_pack.h>
43 45
44#include "mthca_dev.h" 46#include "mthca_dev.h"
@@ -210,6 +212,11 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
210 mthca_write64(doorbell, 212 mthca_write64(doorbell,
211 dev->kar + MTHCA_CQ_DOORBELL, 213 dev->kar + MTHCA_CQ_DOORBELL,
212 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 214 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
215 /*
216 * Make sure doorbells don't leak out of CQ spinlock
217 * and reach the HCA out of order:
218 */
219 mmiowb();
213 } 220 }
214} 221}
215 222
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 5e5c58b9920b..6a7822e0fc19 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -39,6 +39,8 @@
39#include <linux/string.h> 39#include <linux/string.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41 41
42#include <asm/io.h>
43
42#include <rdma/ib_verbs.h> 44#include <rdma/ib_verbs.h>
43#include <rdma/ib_cache.h> 45#include <rdma/ib_cache.h>
44#include <rdma/ib_pack.h> 46#include <rdma/ib_pack.h>
@@ -1732,6 +1734,11 @@ out:
1732 mthca_write64(doorbell, 1734 mthca_write64(doorbell,
1733 dev->kar + MTHCA_SEND_DOORBELL, 1735 dev->kar + MTHCA_SEND_DOORBELL,
1734 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 1736 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
1737 /*
1738 * Make sure doorbells don't leak out of SQ spinlock
1739 * and reach the HCA out of order:
1740 */
1741 mmiowb();
1735 } 1742 }
1736 1743
1737 qp->sq.next_ind = ind; 1744 qp->sq.next_ind = ind;
@@ -1851,6 +1858,12 @@ out:
1851 qp->rq.next_ind = ind; 1858 qp->rq.next_ind = ind;
1852 qp->rq.head += nreq; 1859 qp->rq.head += nreq;
1853 1860
1861 /*
1862 * Make sure doorbells don't leak out of RQ spinlock and reach
1863 * the HCA out of order:
1864 */
1865 mmiowb();
1866
1854 spin_unlock_irqrestore(&qp->rq.lock, flags); 1867 spin_unlock_irqrestore(&qp->rq.lock, flags);
1855 return err; 1868 return err;
1856} 1869}
@@ -2112,6 +2125,12 @@ out:
2112 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 2125 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
2113 } 2126 }
2114 2127
2128 /*
2129 * Make sure doorbells don't leak out of SQ spinlock and reach
2130 * the HCA out of order:
2131 */
2132 mmiowb();
2133
2115 spin_unlock_irqrestore(&qp->sq.lock, flags); 2134 spin_unlock_irqrestore(&qp->sq.lock, flags);
2116 return err; 2135 return err;
2117} 2136}
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 92a72f521528..f5d7677d1079 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -35,6 +35,8 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/string.h> 36#include <linux/string.h>
37 37
38#include <asm/io.h>
39
38#include "mthca_dev.h" 40#include "mthca_dev.h"
39#include "mthca_cmd.h" 41#include "mthca_cmd.h"
40#include "mthca_memfree.h" 42#include "mthca_memfree.h"
@@ -595,6 +597,12 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
595 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 597 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
596 } 598 }
597 599
600 /*
601 * Make sure doorbells don't leak out of SRQ spinlock and
602 * reach the HCA out of order:
603 */
604 mmiowb();
605
598 spin_unlock_irqrestore(&srq->lock, flags); 606 spin_unlock_irqrestore(&srq->lock, flags);
599 return err; 607 return err;
600} 608}
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
index 90de5afe03c2..1dec00e20dbc 100644
--- a/drivers/input/gameport/fm801-gp.c
+++ b/drivers/input/gameport/fm801-gp.c
@@ -82,17 +82,19 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
82{ 82{
83 struct fm801_gp *gp; 83 struct fm801_gp *gp;
84 struct gameport *port; 84 struct gameport *port;
85 int error;
85 86
86 gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL); 87 gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL);
87 port = gameport_allocate_port(); 88 port = gameport_allocate_port();
88 if (!gp || !port) { 89 if (!gp || !port) {
89 printk(KERN_ERR "fm801-gp: Memory allocation failed\n"); 90 printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
90 kfree(gp); 91 error = -ENOMEM;
91 gameport_free_port(port); 92 goto err_out_free;
92 return -ENOMEM;
93 } 93 }
94 94
95 pci_enable_device(pci); 95 error = pci_enable_device(pci);
96 if (error)
97 goto err_out_free;
96 98
97 port->open = fm801_gp_open; 99 port->open = fm801_gp_open;
98#ifdef HAVE_COOKED 100#ifdef HAVE_COOKED
@@ -108,9 +110,8 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
108 if (!gp->res_port) { 110 if (!gp->res_port) {
109 printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", 111 printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
110 port->io, port->io + 0x0f); 112 port->io, port->io + 0x0f);
111 gameport_free_port(port); 113 error = -EBUSY;
112 kfree(gp); 114 goto err_out_disable_dev;
113 return -EBUSY;
114 } 115 }
115 116
116 pci_set_drvdata(pci, gp); 117 pci_set_drvdata(pci, gp);
@@ -119,6 +120,13 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
119 gameport_register_port(port); 120 gameport_register_port(port);
120 121
121 return 0; 122 return 0;
123
124 err_out_disable_dev:
125 pci_disable_device(pci);
126 err_out_free:
127 gameport_free_port(port);
128 kfree(gp);
129 return error;
122} 130}
123 131
124static void __devexit fm801_gp_remove(struct pci_dev *pci) 132static void __devexit fm801_gp_remove(struct pci_dev *pci)
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 3f47ae55c6f3..a0af97efe6ac 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -191,6 +191,8 @@ static void gameport_run_poll_handler(unsigned long d)
191 191
192static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv) 192static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv)
193{ 193{
194 int error;
195
194 down_write(&gameport_bus.subsys.rwsem); 196 down_write(&gameport_bus.subsys.rwsem);
195 197
196 gameport->dev.driver = &drv->driver; 198 gameport->dev.driver = &drv->driver;
@@ -198,8 +200,20 @@ static void gameport_bind_driver(struct gameport *gameport, struct gameport_driv
198 gameport->dev.driver = NULL; 200 gameport->dev.driver = NULL;
199 goto out; 201 goto out;
200 } 202 }
201 device_bind_driver(&gameport->dev); 203
202out: 204 error = device_bind_driver(&gameport->dev);
205 if (error) {
206 printk(KERN_WARNING
207 "gameport: device_bind_driver() failed "
208 "for %s (%s) and %s, error: %d\n",
209 gameport->phys, gameport->name,
210 drv->description, error);
211 drv->disconnect(gameport);
212 gameport->dev.driver = NULL;
213 goto out;
214 }
215
216 out:
203 up_write(&gameport_bus.subsys.rwsem); 217 up_write(&gameport_bus.subsys.rwsem);
204} 218}
205 219
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index b6ef9eaad1dc..cbb93669d1ce 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -221,6 +221,7 @@ struct atkbd {
221 unsigned long xl_bit; 221 unsigned long xl_bit;
222 unsigned int last; 222 unsigned int last;
223 unsigned long time; 223 unsigned long time;
224 unsigned long err_count;
224 225
225 struct work_struct event_work; 226 struct work_struct event_work;
226 struct mutex event_mutex; 227 struct mutex event_mutex;
@@ -234,11 +235,13 @@ static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t
234#define ATKBD_DEFINE_ATTR(_name) \ 235#define ATKBD_DEFINE_ATTR(_name) \
235static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ 236static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
236static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ 237static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \
237static ssize_t atkbd_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ 238static ssize_t atkbd_do_show_##_name(struct device *d, \
239 struct device_attribute *attr, char *b) \
238{ \ 240{ \
239 return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ 241 return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \
240} \ 242} \
241static ssize_t atkbd_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s) \ 243static ssize_t atkbd_do_set_##_name(struct device *d, \
244 struct device_attribute *attr, const char *b, size_t s) \
242{ \ 245{ \
243 return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ 246 return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \
244} \ 247} \
@@ -251,6 +254,32 @@ ATKBD_DEFINE_ATTR(set);
251ATKBD_DEFINE_ATTR(softrepeat); 254ATKBD_DEFINE_ATTR(softrepeat);
252ATKBD_DEFINE_ATTR(softraw); 255ATKBD_DEFINE_ATTR(softraw);
253 256
257#define ATKBD_DEFINE_RO_ATTR(_name) \
258static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
259static ssize_t atkbd_do_show_##_name(struct device *d, \
260 struct device_attribute *attr, char *b) \
261{ \
262 return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \
263} \
264static struct device_attribute atkbd_attr_##_name = \
265 __ATTR(_name, S_IRUGO, atkbd_do_show_##_name, NULL);
266
267ATKBD_DEFINE_RO_ATTR(err_count);
268
269static struct attribute *atkbd_attributes[] = {
270 &atkbd_attr_extra.attr,
271 &atkbd_attr_scroll.attr,
272 &atkbd_attr_set.attr,
273 &atkbd_attr_softrepeat.attr,
274 &atkbd_attr_softraw.attr,
275 &atkbd_attr_err_count.attr,
276 NULL
277};
278
279static struct attribute_group atkbd_attribute_group = {
280 .attrs = atkbd_attributes,
281};
282
254static const unsigned int xl_table[] = { 283static const unsigned int xl_table[] = {
255 ATKBD_RET_BAT, ATKBD_RET_ERR, ATKBD_RET_ACK, 284 ATKBD_RET_BAT, ATKBD_RET_ERR, ATKBD_RET_ACK,
256 ATKBD_RET_NAK, ATKBD_RET_HANJA, ATKBD_RET_HANGEUL, 285 ATKBD_RET_NAK, ATKBD_RET_HANJA, ATKBD_RET_HANGEUL,
@@ -396,7 +425,10 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
396 add_release_event = 1; 425 add_release_event = 1;
397 break; 426 break;
398 case ATKBD_RET_ERR: 427 case ATKBD_RET_ERR:
428 atkbd->err_count++;
429#ifdef ATKBD_DEBUG
399 printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); 430 printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys);
431#endif
400 goto out; 432 goto out;
401 } 433 }
402 434
@@ -786,12 +818,7 @@ static void atkbd_disconnect(struct serio *serio)
786 synchronize_sched(); /* Allow atkbd_interrupt()s to complete. */ 818 synchronize_sched(); /* Allow atkbd_interrupt()s to complete. */
787 flush_scheduled_work(); 819 flush_scheduled_work();
788 820
789 device_remove_file(&serio->dev, &atkbd_attr_extra); 821 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
790 device_remove_file(&serio->dev, &atkbd_attr_scroll);
791 device_remove_file(&serio->dev, &atkbd_attr_set);
792 device_remove_file(&serio->dev, &atkbd_attr_softrepeat);
793 device_remove_file(&serio->dev, &atkbd_attr_softraw);
794
795 input_unregister_device(atkbd->dev); 822 input_unregister_device(atkbd->dev);
796 serio_close(serio); 823 serio_close(serio);
797 serio_set_drvdata(serio, NULL); 824 serio_set_drvdata(serio, NULL);
@@ -961,11 +988,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
961 atkbd_set_keycode_table(atkbd); 988 atkbd_set_keycode_table(atkbd);
962 atkbd_set_device_attrs(atkbd); 989 atkbd_set_device_attrs(atkbd);
963 990
964 device_create_file(&serio->dev, &atkbd_attr_extra); 991 sysfs_create_group(&serio->dev.kobj, &atkbd_attribute_group);
965 device_create_file(&serio->dev, &atkbd_attr_scroll);
966 device_create_file(&serio->dev, &atkbd_attr_set);
967 device_create_file(&serio->dev, &atkbd_attr_softrepeat);
968 device_create_file(&serio->dev, &atkbd_attr_softraw);
969 992
970 atkbd_enable(atkbd); 993 atkbd_enable(atkbd);
971 994
@@ -1259,6 +1282,11 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co
1259 return count; 1282 return count;
1260} 1283}
1261 1284
1285static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf)
1286{
1287 return sprintf(buf, "%lu\n", atkbd->err_count);
1288}
1289
1262 1290
1263static int __init atkbd_init(void) 1291static int __init atkbd_init(void)
1264{ 1292{
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index cb70970625b5..befdd6006b50 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -207,7 +207,7 @@ static irqreturn_t corgikbd_interrupt(int irq, void *dev_id)
207static void corgikbd_timer_callback(unsigned long data) 207static void corgikbd_timer_callback(unsigned long data)
208{ 208{
209 struct corgikbd *corgikbd_data = (struct corgikbd *) data; 209 struct corgikbd *corgikbd_data = (struct corgikbd *) data;
210 corgikbd_scankeyboard(corgikbd_data, NULL); 210 corgikbd_scankeyboard(corgikbd_data);
211} 211}
212 212
213/* 213/*
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index fd33c9cc3272..5788dbc317bb 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -186,7 +186,7 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
186static void locomokbd_timer_callback(unsigned long data) 186static void locomokbd_timer_callback(unsigned long data)
187{ 187{
188 struct locomokbd *locomokbd = (struct locomokbd *) data; 188 struct locomokbd *locomokbd = (struct locomokbd *) data;
189 locomokbd_scankeyboard(locomokbd, NULL); 189 locomokbd_scankeyboard(locomokbd);
190} 190}
191 191
192static int locomokbd_probe(struct locomo_dev *dev) 192static int locomokbd_probe(struct locomo_dev *dev)
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 8b18c009e3e0..28b2748e82d0 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -257,7 +257,7 @@ static void spitzkbd_timer_callback(unsigned long data)
257{ 257{
258 struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data; 258 struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data;
259 259
260 spitzkbd_scankeyboard(spitzkbd_data, NULL); 260 spitzkbd_scankeyboard(spitzkbd_data);
261} 261}
262 262
263/* 263/*
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 09b06e605b50..7e3141f37e32 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -106,6 +106,7 @@ static unsigned char i8042_ctr;
106static unsigned char i8042_mux_present; 106static unsigned char i8042_mux_present;
107static unsigned char i8042_kbd_irq_registered; 107static unsigned char i8042_kbd_irq_registered;
108static unsigned char i8042_aux_irq_registered; 108static unsigned char i8042_aux_irq_registered;
109static unsigned char i8042_suppress_kbd_ack;
109static struct platform_device *i8042_platform_device; 110static struct platform_device *i8042_platform_device;
110 111
111static irqreturn_t i8042_interrupt(int irq, void *dev_id); 112static irqreturn_t i8042_interrupt(int irq, void *dev_id);
@@ -316,7 +317,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
316 unsigned char str, data; 317 unsigned char str, data;
317 unsigned int dfl; 318 unsigned int dfl;
318 unsigned int port_no; 319 unsigned int port_no;
319 int ret; 320 int ret = 1;
320 321
321 spin_lock_irqsave(&i8042_lock, flags); 322 spin_lock_irqsave(&i8042_lock, flags);
322 str = i8042_read_status(); 323 str = i8042_read_status();
@@ -378,10 +379,16 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
378 dfl & SERIO_PARITY ? ", bad parity" : "", 379 dfl & SERIO_PARITY ? ", bad parity" : "",
379 dfl & SERIO_TIMEOUT ? ", timeout" : ""); 380 dfl & SERIO_TIMEOUT ? ", timeout" : "");
380 381
382 if (unlikely(i8042_suppress_kbd_ack))
383 if (port_no == I8042_KBD_PORT_NO &&
384 (data == 0xfa || data == 0xfe)) {
385 i8042_suppress_kbd_ack = 0;
386 goto out;
387 }
388
381 if (likely(port->exists)) 389 if (likely(port->exists))
382 serio_interrupt(port->serio, data, dfl); 390 serio_interrupt(port->serio, data, dfl);
383 391
384 ret = 1;
385 out: 392 out:
386 return IRQ_RETVAL(ret); 393 return IRQ_RETVAL(ret);
387} 394}
@@ -842,11 +849,13 @@ static long i8042_panic_blink(long count)
842 led ^= 0x01 | 0x04; 849 led ^= 0x01 | 0x04;
843 while (i8042_read_status() & I8042_STR_IBF) 850 while (i8042_read_status() & I8042_STR_IBF)
844 DELAY; 851 DELAY;
852 i8042_suppress_kbd_ack = 1;
845 i8042_write_data(0xed); /* set leds */ 853 i8042_write_data(0xed); /* set leds */
846 DELAY; 854 DELAY;
847 while (i8042_read_status() & I8042_STR_IBF) 855 while (i8042_read_status() & I8042_STR_IBF)
848 DELAY; 856 DELAY;
849 DELAY; 857 DELAY;
858 i8042_suppress_kbd_ack = 1;
850 i8042_write_data(led); 859 i8042_write_data(led);
851 DELAY; 860 DELAY;
852 last_blink = count; 861 last_blink = count;
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index dcb16b5cbec0..e5b1b60757bb 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -189,7 +189,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
189 return -1; 189 return -1;
190 } 190 }
191 191
192 mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); 192 mutex_lock(&ps2dev->cmd_mutex);
193 193
194 serio_pause_rx(ps2dev->serio); 194 serio_pause_rx(ps2dev->serio);
195 ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; 195 ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0;
@@ -296,6 +296,7 @@ EXPORT_SYMBOL(ps2_schedule_command);
296void ps2_init(struct ps2dev *ps2dev, struct serio *serio) 296void ps2_init(struct ps2dev *ps2dev, struct serio *serio)
297{ 297{
298 mutex_init(&ps2dev->cmd_mutex); 298 mutex_init(&ps2dev->cmd_mutex);
299 lockdep_set_subclass(&ps2dev->cmd_mutex, serio->depth);
299 init_waitqueue_head(&ps2dev->wait); 300 init_waitqueue_head(&ps2dev->wait);
300 ps2dev->serio = serio; 301 ps2dev->serio = serio;
301} 302}
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 960fae3c3cea..211943f85cb6 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -118,6 +118,8 @@ static int serio_match_port(const struct serio_device_id *ids, struct serio *ser
118 118
119static void serio_bind_driver(struct serio *serio, struct serio_driver *drv) 119static void serio_bind_driver(struct serio *serio, struct serio_driver *drv)
120{ 120{
121 int error;
122
121 down_write(&serio_bus.subsys.rwsem); 123 down_write(&serio_bus.subsys.rwsem);
122 124
123 if (serio_match_port(drv->id_table, serio)) { 125 if (serio_match_port(drv->id_table, serio)) {
@@ -126,9 +128,19 @@ static void serio_bind_driver(struct serio *serio, struct serio_driver *drv)
126 serio->dev.driver = NULL; 128 serio->dev.driver = NULL;
127 goto out; 129 goto out;
128 } 130 }
129 device_bind_driver(&serio->dev); 131 error = device_bind_driver(&serio->dev);
132 if (error) {
133 printk(KERN_WARNING
134 "serio: device_bind_driver() failed "
135 "for %s (%s) and %s, error: %d\n",
136 serio->phys, serio->name,
137 drv->description, error);
138 serio_disconnect_driver(serio);
139 serio->dev.driver = NULL;
140 goto out;
141 }
130 } 142 }
131out: 143 out:
132 up_write(&serio_bus.subsys.rwsem); 144 up_write(&serio_bus.subsys.rwsem);
133} 145}
134 146
@@ -538,8 +550,12 @@ static void serio_init_port(struct serio *serio)
538 "serio%ld", (long)atomic_inc_return(&serio_no) - 1); 550 "serio%ld", (long)atomic_inc_return(&serio_no) - 1);
539 serio->dev.bus = &serio_bus; 551 serio->dev.bus = &serio_bus;
540 serio->dev.release = serio_release_port; 552 serio->dev.release = serio_release_port;
541 if (serio->parent) 553 if (serio->parent) {
542 serio->dev.parent = &serio->parent->dev; 554 serio->dev.parent = &serio->parent->dev;
555 serio->depth = serio->parent->depth + 1;
556 } else
557 serio->depth = 0;
558 lockdep_set_subclass(&serio->lock, serio->depth);
543} 559}
544 560
545/* 561/*
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index ca79b2246195..66121f6a89ad 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -219,7 +219,7 @@ static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer)
219static void corgi_ts_timer(unsigned long data) 219static void corgi_ts_timer(unsigned long data)
220{ 220{
221 struct corgi_ts *corgits_data = (struct corgi_ts *) data; 221 struct corgi_ts *corgits_data = (struct corgi_ts *) data;
222 ts_interrupt_main(corgits_data, 1, NULL); 222 ts_interrupt_main(corgits_data, 1);
223} 223}
224 224
225static irqreturn_t ts_interrupt(int irq, void *dev_id) 225static irqreturn_t ts_interrupt(int irq, void *dev_id)
@@ -237,7 +237,7 @@ static int corgits_suspend(struct platform_device *dev, pm_message_t state)
237 if (corgi_ts->pendown) { 237 if (corgi_ts->pendown) {
238 del_timer_sync(&corgi_ts->timer); 238 del_timer_sync(&corgi_ts->timer);
239 corgi_ts->tc.pressure = 0; 239 corgi_ts->tc.pressure = 0;
240 new_data(corgi_ts, NULL); 240 new_data(corgi_ts);
241 corgi_ts->pendown = 0; 241 corgi_ts->pendown = 0;
242 } 242 }
243 corgi_ts->power_mode = PWR_MODE_SUSPEND; 243 corgi_ts->power_mode = PWR_MODE_SUSPEND;
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index d10c8b82e6aa..b6f9476c0501 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1907,7 +1907,8 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel)
1907 } 1907 }
1908 1908
1909 for (p=buf, count=0; count < len; p++, count++) { 1909 for (p=buf, count=0; count < len; p++, count++) {
1910 put_user(*card->q931_read++, p); 1910 if (put_user(*card->q931_read++, p))
1911 return -EFAULT;
1911 if (card->q931_read > card->q931_end) 1912 if (card->q931_read > card->q931_end)
1912 card->q931_read = card->q931_buf; 1913 card->q931_read = card->q931_buf;
1913 } 1914 }
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index e4823ab2b127..785b08554fca 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -631,7 +631,8 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
631 count = cs->status_end - cs->status_read + 1; 631 count = cs->status_end - cs->status_read + 1;
632 if (count >= len) 632 if (count >= len)
633 count = len; 633 count = len;
634 copy_to_user(p, cs->status_read, count); 634 if (copy_to_user(p, cs->status_read, count))
635 return -EFAULT;
635 cs->status_read += count; 636 cs->status_read += count;
636 if (cs->status_read > cs->status_end) 637 if (cs->status_read > cs->status_end)
637 cs->status_read = cs->status_buf; 638 cs->status_read = cs->status_buf;
@@ -642,7 +643,8 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
642 cnt = HISAX_STATUS_BUFSIZE; 643 cnt = HISAX_STATUS_BUFSIZE;
643 else 644 else
644 cnt = count; 645 cnt = count;
645 copy_to_user(p, cs->status_read, cnt); 646 if (copy_to_user(p, cs->status_read, cnt))
647 return -EFAULT;
646 p += cnt; 648 p += cnt;
647 cs->status_read += cnt % HISAX_STATUS_BUFSIZE; 649 cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
648 count -= cnt; 650 count -= cnt;
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 7e95f04f13da..3dacfff93f5f 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs)
716 716
717 *cfg = 0; /* disable INT0/1 */ 717 *cfg = 0; /* disable INT0/1 */
718 *cfg = 2; /* reset pending INT0 */ 718 *cfg = 2; /* reset pending INT0 */
719 iounmap((void *)cs->hw.diva.cfg_reg); 719 if (cs->hw.diva.cfg_reg)
720 iounmap((void *)cs->hw.diva.pci_cfg); 720 iounmap((void *)cs->hw.diva.cfg_reg);
721 if (cs->hw.diva.pci_cfg)
722 iounmap((void *)cs->hw.diva.pci_cfg);
721 return; 723 return;
722 } else if (cs->subtyp != DIVA_IPAC_ISA) { 724 } else if (cs->subtyp != DIVA_IPAC_ISA) {
723 del_timer(&cs->hw.diva.tl); 725 del_timer(&cs->hw.diva.tl);
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs)
734} 736}
735 737
736static void 738static void
739iounmap_diva(struct IsdnCardState *cs)
740{
741 if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_IPACX_PCI)) {
742 if (cs->hw.diva.cfg_reg) {
743 iounmap((void *)cs->hw.diva.cfg_reg);
744 cs->hw.diva.cfg_reg = 0;
745 }
746 if (cs->hw.diva.pci_cfg) {
747 iounmap((void *)cs->hw.diva.pci_cfg);
748 cs->hw.diva.pci_cfg = 0;
749 }
750 }
751
752 return;
753}
754
755static void
737reset_diva(struct IsdnCardState *cs) 756reset_diva(struct IsdnCardState *cs)
738{ 757{
739 if (cs->subtyp == DIVA_IPAC_ISA) { 758 if (cs->subtyp == DIVA_IPAC_ISA) {
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card)
1069 1088
1070 if (!cs->irq) { 1089 if (!cs->irq) {
1071 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n"); 1090 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
1091 iounmap_diva(cs);
1072 return(0); 1092 return(0);
1073 } 1093 }
1074 1094
1075 if (!cs->hw.diva.cfg_reg) { 1095 if (!cs->hw.diva.cfg_reg) {
1076 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); 1096 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
1097 iounmap_diva(cs);
1077 return(0); 1098 return(0);
1078 } 1099 }
1079 cs->irq_flags |= IRQF_SHARED; 1100 cs->irq_flags |= IRQF_SHARED;
@@ -1123,6 +1144,7 @@ ready:
1123 CardType[card->typ], 1144 CardType[card->typ],
1124 cs->hw.diva.cfg_reg, 1145 cs->hw.diva.cfg_reg,
1125 cs->hw.diva.cfg_reg + bytecnt); 1146 cs->hw.diva.cfg_reg + bytecnt);
1147 iounmap_diva(cs);
1126 return (0); 1148 return (0);
1127 } 1149 }
1128 } 1150 }
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 160f22fa5941..82e42a80dc4b 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -45,11 +45,10 @@ ergo_interrupt(int intno, void *dev_id)
45 if (!card->irq_enabled) 45 if (!card->irq_enabled)
46 return IRQ_NONE; /* other device interrupting or irq switched off */ 46 return IRQ_NONE; /* other device interrupting or irq switched off */
47 47
48 save_flags(flags); 48 spin_lock_irqsave(&card->hysdn_lock, flags); /* no further irqs allowed */
49 cli(); /* no further irqs allowed */
50 49
51 if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) { 50 if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) {
52 restore_flags(flags); /* restore old state */ 51 spin_unlock_irqrestore(&card->hysdn_lock, flags); /* restore old state */
53 return IRQ_NONE; /* no interrupt requested by E1 */ 52 return IRQ_NONE; /* no interrupt requested by E1 */
54 } 53 }
55 /* clear any pending ints on the board */ 54 /* clear any pending ints on the board */
@@ -61,7 +60,7 @@ ergo_interrupt(int intno, void *dev_id)
61 /* start kernel task immediately after leaving all interrupts */ 60 /* start kernel task immediately after leaving all interrupts */
62 if (!card->hw_lock) 61 if (!card->hw_lock)
63 schedule_work(&card->irq_queue); 62 schedule_work(&card->irq_queue);
64 restore_flags(flags); 63 spin_unlock_irqrestore(&card->hysdn_lock, flags);
65 return IRQ_HANDLED; 64 return IRQ_HANDLED;
66} /* ergo_interrupt */ 65} /* ergo_interrupt */
67 66
@@ -83,10 +82,9 @@ ergo_irq_bh(hysdn_card * card)
83 82
84 dpr = card->dpram; /* point to DPRAM */ 83 dpr = card->dpram; /* point to DPRAM */
85 84
86 save_flags(flags); 85 spin_lock_irqsave(&card->hysdn_lock, flags);
87 cli();
88 if (card->hw_lock) { 86 if (card->hw_lock) {
89 restore_flags(flags); /* hardware currently unavailable */ 87 spin_unlock_irqrestore(&card->hysdn_lock, flags); /* hardware currently unavailable */
90 return; 88 return;
91 } 89 }
92 card->hw_lock = 1; /* we now lock the hardware */ 90 card->hw_lock = 1; /* we now lock the hardware */
@@ -120,7 +118,7 @@ ergo_irq_bh(hysdn_card * card)
120 card->hw_lock = 0; /* free hardware again */ 118 card->hw_lock = 0; /* free hardware again */
121 } while (again); /* until nothing more to do */ 119 } while (again); /* until nothing more to do */
122 120
123 restore_flags(flags); 121 spin_unlock_irqrestore(&card->hysdn_lock, flags);
124} /* ergo_irq_bh */ 122} /* ergo_irq_bh */
125 123
126 124
@@ -137,8 +135,7 @@ ergo_stopcard(hysdn_card * card)
137#ifdef CONFIG_HYSDN_CAPI 135#ifdef CONFIG_HYSDN_CAPI
138 hycapi_capi_stop(card); 136 hycapi_capi_stop(card);
139#endif /* CONFIG_HYSDN_CAPI */ 137#endif /* CONFIG_HYSDN_CAPI */
140 save_flags(flags); 138 spin_lock_irqsave(&card->hysdn_lock, flags);
141 cli();
142 val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */ 139 val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */
143 val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */ 140 val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */
144 byteout(card->iobase + PCI9050_INTR_REG, val); 141 byteout(card->iobase + PCI9050_INTR_REG, val);
@@ -147,7 +144,7 @@ ergo_stopcard(hysdn_card * card)
147 card->state = CARD_STATE_UNUSED; 144 card->state = CARD_STATE_UNUSED;
148 card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */ 145 card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */
149 146
150 restore_flags(flags); 147 spin_unlock_irqrestore(&card->hysdn_lock, flags);
151} /* ergo_stopcard */ 148} /* ergo_stopcard */
152 149
153/**************************************************************************/ 150/**************************************************************************/
@@ -162,12 +159,11 @@ ergo_set_errlog_state(hysdn_card * card, int on)
162 card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ 159 card->err_log_state = ERRLOG_STATE_OFF; /* must be off */
163 return; 160 return;
164 } 161 }
165 save_flags(flags); 162 spin_lock_irqsave(&card->hysdn_lock, flags);
166 cli();
167 163
168 if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) || 164 if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) ||
169 ((card->err_log_state == ERRLOG_STATE_ON) && on)) { 165 ((card->err_log_state == ERRLOG_STATE_ON) && on)) {
170 restore_flags(flags); 166 spin_unlock_irqrestore(&card->hysdn_lock, flags);
171 return; /* nothing to do */ 167 return; /* nothing to do */
172 } 168 }
173 if (on) 169 if (on)
@@ -175,7 +171,7 @@ ergo_set_errlog_state(hysdn_card * card, int on)
175 else 171 else
176 card->err_log_state = ERRLOG_STATE_STOP; /* request stop */ 172 card->err_log_state = ERRLOG_STATE_STOP; /* request stop */
177 173
178 restore_flags(flags); 174 spin_unlock_irqrestore(&card->hysdn_lock, flags);
179 schedule_work(&card->irq_queue); 175 schedule_work(&card->irq_queue);
180} /* ergo_set_errlog_state */ 176} /* ergo_set_errlog_state */
181 177
@@ -356,8 +352,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
356 352
357 if (card->debug_flags & LOG_POF_RECORD) 353 if (card->debug_flags & LOG_POF_RECORD)
358 hysdn_addlog(card, "ERGO: pof boot success"); 354 hysdn_addlog(card, "ERGO: pof boot success");
359 save_flags(flags); 355 spin_lock_irqsave(&card->hysdn_lock, flags);
360 cli();
361 356
362 card->state = CARD_STATE_RUN; /* now card is running */ 357 card->state = CARD_STATE_RUN; /* now card is running */
363 /* enable the cards interrupt */ 358 /* enable the cards interrupt */
@@ -370,7 +365,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
370 dpr->ToHyInt = 1; 365 dpr->ToHyInt = 1;
371 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ 366 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */
372 367
373 restore_flags(flags); 368 spin_unlock_irqrestore(&card->hysdn_lock, flags);
374 if ((hynet_enable & (1 << card->myid)) 369 if ((hynet_enable & (1 << card->myid))
375 && (i = hysdn_net_create(card))) 370 && (i = hysdn_net_create(card)))
376 { 371 {
@@ -408,7 +403,7 @@ ergo_releasehardware(hysdn_card * card)
408 free_irq(card->irq, card); /* release interrupt */ 403 free_irq(card->irq, card); /* release interrupt */
409 release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */ 404 release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */
410 release_region(card->iobase + PCI9050_USER_IO, 1); 405 release_region(card->iobase + PCI9050_USER_IO, 1);
411 vfree(card->dpram); 406 iounmap(card->dpram);
412 card->dpram = NULL; /* release shared mem */ 407 card->dpram = NULL; /* release shared mem */
413} /* ergo_releasehardware */ 408} /* ergo_releasehardware */
414 409
@@ -448,6 +443,7 @@ ergo_inithardware(hysdn_card * card)
448 card->waitpofready = ergo_waitpofready; 443 card->waitpofready = ergo_waitpofready;
449 card->set_errlog_state = ergo_set_errlog_state; 444 card->set_errlog_state = ergo_set_errlog_state;
450 INIT_WORK(&card->irq_queue, (void *) (void *) ergo_irq_bh, card); 445 INIT_WORK(&card->irq_queue, (void *) (void *) ergo_irq_bh, card);
446 card->hysdn_lock = SPIN_LOCK_UNLOCKED;
451 447
452 return (0); 448 return (0);
453} /* ergo_inithardware */ 449} /* ergo_inithardware */
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h
index 461e831592dd..729df4089385 100644
--- a/drivers/isdn/hysdn/hysdn_defs.h
+++ b/drivers/isdn/hysdn/hysdn_defs.h
@@ -188,6 +188,8 @@ typedef struct HYSDN_CARD {
188 /* init and deinit stopcard for booting, too */ 188 /* init and deinit stopcard for booting, too */
189 void (*stopcard) (struct HYSDN_CARD *); 189 void (*stopcard) (struct HYSDN_CARD *);
190 void (*releasehardware) (struct HYSDN_CARD *); 190 void (*releasehardware) (struct HYSDN_CARD *);
191
192 spinlock_t hysdn_lock;
191#ifdef CONFIG_HYSDN_CAPI 193#ifdef CONFIG_HYSDN_CAPI
192 struct hycapictrl_info { 194 struct hycapictrl_info {
193 char cardname[32]; 195 char cardname[32];
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index c4301e8338ef..fcd49920b220 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -116,8 +116,7 @@ put_log_buffer(hysdn_card * card, char *cp)
116 strcpy(ib->log_start, cp); /* set output string */ 116 strcpy(ib->log_start, cp); /* set output string */
117 ib->next = NULL; 117 ib->next = NULL;
118 ib->proc_ctrl = pd; /* point to own control structure */ 118 ib->proc_ctrl = pd; /* point to own control structure */
119 save_flags(flags); 119 spin_lock_irqsave(&card->hysdn_lock, flags);
120 cli();
121 ib->usage_cnt = pd->if_used; 120 ib->usage_cnt = pd->if_used;
122 if (!pd->log_head) 121 if (!pd->log_head)
123 pd->log_head = ib; /* new head */ 122 pd->log_head = ib; /* new head */
@@ -125,7 +124,7 @@ put_log_buffer(hysdn_card * card, char *cp)
125 pd->log_tail->next = ib; /* follows existing messages */ 124 pd->log_tail->next = ib; /* follows existing messages */
126 pd->log_tail = ib; /* new tail */ 125 pd->log_tail = ib; /* new tail */
127 i = pd->del_lock++; /* get lock state */ 126 i = pd->del_lock++; /* get lock state */
128 restore_flags(flags); 127 spin_unlock_irqrestore(&card->hysdn_lock, flags);
129 128
130 /* delete old entrys */ 129 /* delete old entrys */
131 if (!i) 130 if (!i)
@@ -270,14 +269,13 @@ hysdn_log_open(struct inode *ino, struct file *filep)
270 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { 269 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
271 270
272 /* read access -> log/debug read */ 271 /* read access -> log/debug read */
273 save_flags(flags); 272 spin_lock_irqsave(&card->hysdn_lock, flags);
274 cli();
275 pd->if_used++; 273 pd->if_used++;
276 if (pd->log_head) 274 if (pd->log_head)
277 filep->private_data = &pd->log_tail->next; 275 filep->private_data = &pd->log_tail->next;
278 else 276 else
279 filep->private_data = &pd->log_head; 277 filep->private_data = &pd->log_head;
280 restore_flags(flags); 278 spin_unlock_irqrestore(&card->hysdn_lock, flags);
281 } else { /* simultaneous read/write access forbidden ! */ 279 } else { /* simultaneous read/write access forbidden ! */
282 unlock_kernel(); 280 unlock_kernel();
283 return (-EPERM); /* no permission this time */ 281 return (-EPERM); /* no permission this time */
@@ -301,7 +299,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
301 hysdn_card *card; 299 hysdn_card *card;
302 int retval = 0; 300 int retval = 0;
303 unsigned long flags; 301 unsigned long flags;
304 302 spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
305 303
306 lock_kernel(); 304 lock_kernel();
307 if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { 305 if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
@@ -311,8 +309,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
311 /* read access -> log/debug read, mark one further file as closed */ 309 /* read access -> log/debug read, mark one further file as closed */
312 310
313 pd = NULL; 311 pd = NULL;
314 save_flags(flags); 312 spin_lock_irqsave(&hysdn_lock, flags);
315 cli();
316 inf = *((struct log_data **) filep->private_data); /* get first log entry */ 313 inf = *((struct log_data **) filep->private_data); /* get first log entry */
317 if (inf) 314 if (inf)
318 pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ 315 pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
@@ -335,7 +332,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
335 inf->usage_cnt--; /* decrement usage count for buffers */ 332 inf->usage_cnt--; /* decrement usage count for buffers */
336 inf = inf->next; 333 inf = inf->next;
337 } 334 }
338 restore_flags(flags); 335 spin_unlock_irqrestore(&hysdn_lock, flags);
339 336
340 if (pd) 337 if (pd)
341 if (pd->if_used <= 0) /* delete buffers if last file closed */ 338 if (pd->if_used <= 0) /* delete buffers if last file closed */
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c
index 1c0d54ac12ab..1fadf0133e9b 100644
--- a/drivers/isdn/hysdn/hysdn_sched.c
+++ b/drivers/isdn/hysdn/hysdn_sched.c
@@ -155,8 +155,7 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan)
155 if (card->debug_flags & LOG_SCHED_ASYN) 155 if (card->debug_flags & LOG_SCHED_ASYN)
156 hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); 156 hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1);
157 157
158 save_flags(flags); 158 spin_lock_irqsave(&card->hysdn_lock, flags);
159 cli();
160 while (card->async_busy) { 159 while (card->async_busy) {
161 sti(); 160 sti();
162 161
@@ -165,7 +164,7 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan)
165 164
166 msleep_interruptible(20); /* Timeout 20ms */ 165 msleep_interruptible(20); /* Timeout 20ms */
167 if (!--cnt) { 166 if (!--cnt) {
168 restore_flags(flags); 167 spin_unlock_irqrestore(&card->hysdn_lock, flags);
169 return (-ERR_ASYNC_TIME); /* timed out */ 168 return (-ERR_ASYNC_TIME); /* timed out */
170 } 169 }
171 cli(); 170 cli();
@@ -194,13 +193,13 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan)
194 193
195 msleep_interruptible(20); /* Timeout 20ms */ 194 msleep_interruptible(20); /* Timeout 20ms */
196 if (!--cnt) { 195 if (!--cnt) {
197 restore_flags(flags); 196 spin_unlock_irqrestore(&card->hysdn_lock, flags);
198 return (-ERR_ASYNC_TIME); /* timed out */ 197 return (-ERR_ASYNC_TIME); /* timed out */
199 } 198 }
200 cli(); 199 cli();
201 } /* wait for buffer to become free again */ 200 } /* wait for buffer to become free again */
202 201
203 restore_flags(flags); 202 spin_unlock_irqrestore(&card->hysdn_lock, flags);
204 203
205 if (card->debug_flags & LOG_SCHED_ASYN) 204 if (card->debug_flags & LOG_SCHED_ASYN)
206 hysdn_addlog(card, "async tx-cfg data send"); 205 hysdn_addlog(card, "async tx-cfg data send");
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index c3d79eef9e32..69aee2602aa6 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1134,9 +1134,12 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
1134 if (dev->drv[drvidx]->interface->readstat) { 1134 if (dev->drv[drvidx]->interface->readstat) {
1135 if (count > dev->drv[drvidx]->stavail) 1135 if (count > dev->drv[drvidx]->stavail)
1136 count = dev->drv[drvidx]->stavail; 1136 count = dev->drv[drvidx]->stavail;
1137 len = dev->drv[drvidx]->interface-> 1137 len = dev->drv[drvidx]->interface->readstat(buf, count,
1138 readstat(buf, count, drvidx, 1138 drvidx, isdn_minor2chan(minor));
1139 isdn_minor2chan(minor)); 1139 if (len < 0) {
1140 retval = len;
1141 goto out;
1142 }
1140 } else { 1143 } else {
1141 len = 0; 1144 len = 0;
1142 } 1145 }
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6649f8bc9951..730bbd07ebc7 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1010,7 +1010,8 @@ icn_readstatus(u_char __user *buf, int len, icn_card * card)
1010 for (p = buf, count = 0; count < len; p++, count++) { 1010 for (p = buf, count = 0; count < len; p++, count++) {
1011 if (card->msg_buf_read == card->msg_buf_write) 1011 if (card->msg_buf_read == card->msg_buf_write)
1012 return count; 1012 return count;
1013 put_user(*card->msg_buf_read++, p); 1013 if (put_user(*card->msg_buf_read++, p))
1014 return -EFAULT;
1014 if (card->msg_buf_read > card->msg_buf_end) 1015 if (card->msg_buf_read > card->msg_buf_end)
1015 card->msg_buf_read = card->msg_buf; 1016 card->msg_buf_read = card->msg_buf;
1016 } 1017 }
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index fabbd461603e..c3ae2edaf6fa 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -100,12 +100,11 @@ isdnloop_pollbchan(unsigned long data)
100 isdnloop_bchan_send(card, 1); 100 isdnloop_bchan_send(card, 1);
101 if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) { 101 if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) {
102 /* schedule b-channel polling again */ 102 /* schedule b-channel polling again */
103 save_flags(flags); 103 spin_lock_irqsave(&card->isdnloop_lock, flags);
104 cli();
105 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; 104 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
106 add_timer(&card->rb_timer); 105 add_timer(&card->rb_timer);
107 card->flags |= ISDNLOOP_FLAGS_RBTIMER; 106 card->flags |= ISDNLOOP_FLAGS_RBTIMER;
108 restore_flags(flags); 107 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
109 } else 108 } else
110 card->flags &= ~ISDNLOOP_FLAGS_RBTIMER; 109 card->flags &= ~ISDNLOOP_FLAGS_RBTIMER;
111} 110}
@@ -281,8 +280,7 @@ isdnloop_putmsg(isdnloop_card * card, unsigned char c)
281{ 280{
282 ulong flags; 281 ulong flags;
283 282
284 save_flags(flags); 283 spin_lock_irqsave(&card->isdnloop_lock, flags);
285 cli();
286 *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; 284 *card->msg_buf_write++ = (c == 0xff) ? '\n' : c;
287 if (card->msg_buf_write == card->msg_buf_read) { 285 if (card->msg_buf_write == card->msg_buf_read) {
288 if (++card->msg_buf_read > card->msg_buf_end) 286 if (++card->msg_buf_read > card->msg_buf_end)
@@ -290,7 +288,7 @@ isdnloop_putmsg(isdnloop_card * card, unsigned char c)
290 } 288 }
291 if (card->msg_buf_write > card->msg_buf_end) 289 if (card->msg_buf_write > card->msg_buf_end)
292 card->msg_buf_write = card->msg_buf; 290 card->msg_buf_write = card->msg_buf;
293 restore_flags(flags); 291 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
294} 292}
295 293
296/* 294/*
@@ -372,21 +370,19 @@ isdnloop_polldchan(unsigned long data)
372 if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) { 370 if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) {
373 /* schedule b-channel polling */ 371 /* schedule b-channel polling */
374 card->flags |= ISDNLOOP_FLAGS_RBTIMER; 372 card->flags |= ISDNLOOP_FLAGS_RBTIMER;
375 save_flags(flags); 373 spin_lock_irqsave(&card->isdnloop_lock, flags);
376 cli();
377 del_timer(&card->rb_timer); 374 del_timer(&card->rb_timer);
378 card->rb_timer.function = isdnloop_pollbchan; 375 card->rb_timer.function = isdnloop_pollbchan;
379 card->rb_timer.data = (unsigned long) card; 376 card->rb_timer.data = (unsigned long) card;
380 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; 377 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
381 add_timer(&card->rb_timer); 378 add_timer(&card->rb_timer);
382 restore_flags(flags); 379 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
383 } 380 }
384 /* schedule again */ 381 /* schedule again */
385 save_flags(flags); 382 spin_lock_irqsave(&card->isdnloop_lock, flags);
386 cli();
387 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; 383 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD;
388 add_timer(&card->st_timer); 384 add_timer(&card->st_timer);
389 restore_flags(flags); 385 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
390} 386}
391 387
392/* 388/*
@@ -416,8 +412,7 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card)
416 return 0; 412 return 0;
417 if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE) 413 if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE)
418 return 0; 414 return 0;
419 save_flags(flags); 415 spin_lock_irqsave(&card->isdnloop_lock, flags);
420 cli();
421 nskb = dev_alloc_skb(skb->len); 416 nskb = dev_alloc_skb(skb->len);
422 if (nskb) { 417 if (nskb) {
423 memcpy(skb_put(nskb, len), skb->data, len); 418 memcpy(skb_put(nskb, len), skb->data, len);
@@ -426,7 +421,7 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card)
426 } else 421 } else
427 len = 0; 422 len = 0;
428 card->sndcount[channel] += len; 423 card->sndcount[channel] += len;
429 restore_flags(flags); 424 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
430 } 425 }
431 return len; 426 return len;
432} 427}
@@ -451,7 +446,8 @@ isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card)
451 for (p = buf, count = 0; count < len; p++, count++) { 446 for (p = buf, count = 0; count < len; p++, count++) {
452 if (card->msg_buf_read == card->msg_buf_write) 447 if (card->msg_buf_read == card->msg_buf_write)
453 return count; 448 return count;
454 put_user(*card->msg_buf_read++, p); 449 if (put_user(*card->msg_buf_read++, p))
450 return -EFAULT;
455 if (card->msg_buf_read > card->msg_buf_end) 451 if (card->msg_buf_read > card->msg_buf_end)
456 card->msg_buf_read = card->msg_buf; 452 card->msg_buf_read = card->msg_buf;
457 } 453 }
@@ -576,8 +572,7 @@ isdnloop_atimeout(isdnloop_card * card, int ch)
576 unsigned long flags; 572 unsigned long flags;
577 char buf[60]; 573 char buf[60];
578 574
579 save_flags(flags); 575 spin_lock_irqsave(&card->isdnloop_lock, flags);
580 cli();
581 if (card->rcard) { 576 if (card->rcard) {
582 isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); 577 isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1);
583 card->rcard[ch]->rcard[card->rch[ch]] = NULL; 578 card->rcard[ch]->rcard[card->rch[ch]] = NULL;
@@ -587,7 +582,7 @@ isdnloop_atimeout(isdnloop_card * card, int ch)
587 /* No user responding */ 582 /* No user responding */
588 sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3)); 583 sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3));
589 isdnloop_fake(card, buf, ch + 1); 584 isdnloop_fake(card, buf, ch + 1);
590 restore_flags(flags); 585 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
591} 586}
592 587
593/* 588/*
@@ -622,8 +617,7 @@ isdnloop_start_ctimer(isdnloop_card * card, int ch)
622{ 617{
623 unsigned long flags; 618 unsigned long flags;
624 619
625 save_flags(flags); 620 spin_lock_irqsave(&card->isdnloop_lock, flags);
626 cli();
627 init_timer(&card->c_timer[ch]); 621 init_timer(&card->c_timer[ch]);
628 card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; 622 card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;
629 if (ch) 623 if (ch)
@@ -632,7 +626,7 @@ isdnloop_start_ctimer(isdnloop_card * card, int ch)
632 card->c_timer[ch].function = isdnloop_atimeout0; 626 card->c_timer[ch].function = isdnloop_atimeout0;
633 card->c_timer[ch].data = (unsigned long) card; 627 card->c_timer[ch].data = (unsigned long) card;
634 add_timer(&card->c_timer[ch]); 628 add_timer(&card->c_timer[ch]);
635 restore_flags(flags); 629 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
636} 630}
637 631
638/* 632/*
@@ -647,10 +641,9 @@ isdnloop_kill_ctimer(isdnloop_card * card, int ch)
647{ 641{
648 unsigned long flags; 642 unsigned long flags;
649 643
650 save_flags(flags); 644 spin_lock_irqsave(&card->isdnloop_lock, flags);
651 cli();
652 del_timer(&card->c_timer[ch]); 645 del_timer(&card->c_timer[ch]);
653 restore_flags(flags); 646 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
654} 647}
655 648
656static u_char si2bit[] = 649static u_char si2bit[] =
@@ -706,13 +699,12 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd)
706 } 699 }
707 } 700 }
708 if (num_match) { 701 if (num_match) {
709 save_flags(flags); 702 spin_lock_irqsave(&card->isdnloop_lock, flags);
710 cli();
711 /* channel idle? */ 703 /* channel idle? */
712 if (!(cc->rcard[ch])) { 704 if (!(cc->rcard[ch])) {
713 /* Check SI */ 705 /* Check SI */
714 if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) { 706 if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) {
715 restore_flags(flags); 707 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
716 return 3; 708 return 3;
717 } 709 }
718 /* ch is idle, si and number matches */ 710 /* ch is idle, si and number matches */
@@ -720,10 +712,10 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd)
720 cc->rch[ch] = lch; 712 cc->rch[ch] = lch;
721 card->rcard[lch] = cc; 713 card->rcard[lch] = cc;
722 card->rch[lch] = ch; 714 card->rch[lch] = ch;
723 restore_flags(flags); 715 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
724 return 0; 716 return 0;
725 } else { 717 } else {
726 restore_flags(flags); 718 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
727 /* num matches, but busy */ 719 /* num matches, but busy */
728 if (ch == 1) 720 if (ch == 1)
729 return 1; 721 return 1;
@@ -1027,8 +1019,7 @@ isdnloop_stopcard(isdnloop_card * card)
1027 unsigned long flags; 1019 unsigned long flags;
1028 isdn_ctrl cmd; 1020 isdn_ctrl cmd;
1029 1021
1030 save_flags(flags); 1022 spin_lock_irqsave(&card->isdnloop_lock, flags);
1031 cli();
1032 if (card->flags & ISDNLOOP_FLAGS_RUNNING) { 1023 if (card->flags & ISDNLOOP_FLAGS_RUNNING) {
1033 card->flags &= ~ISDNLOOP_FLAGS_RUNNING; 1024 card->flags &= ~ISDNLOOP_FLAGS_RUNNING;
1034 del_timer(&card->st_timer); 1025 del_timer(&card->st_timer);
@@ -1039,7 +1030,7 @@ isdnloop_stopcard(isdnloop_card * card)
1039 cmd.driver = card->myid; 1030 cmd.driver = card->myid;
1040 card->interface.statcallb(&cmd); 1031 card->interface.statcallb(&cmd);
1041 } 1032 }
1042 restore_flags(flags); 1033 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1043} 1034}
1044 1035
1045/* 1036/*
@@ -1078,18 +1069,17 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp)
1078 return -EBUSY; 1069 return -EBUSY;
1079 if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef))) 1070 if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
1080 return -EFAULT; 1071 return -EFAULT;
1081 save_flags(flags); 1072 spin_lock_irqsave(&card->isdnloop_lock, flags);
1082 cli();
1083 switch (sdef.ptype) { 1073 switch (sdef.ptype) {
1084 case ISDN_PTYPE_EURO: 1074 case ISDN_PTYPE_EURO:
1085 if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", 1075 if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96",
1086 -1)) { 1076 -1)) {
1087 restore_flags(flags); 1077 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1088 return -ENOMEM; 1078 return -ENOMEM;
1089 } 1079 }
1090 card->sil[0] = card->sil[1] = 4; 1080 card->sil[0] = card->sil[1] = 4;
1091 if (isdnloop_fake(card, "TEI OK", 0)) { 1081 if (isdnloop_fake(card, "TEI OK", 0)) {
1092 restore_flags(flags); 1082 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1093 return -ENOMEM; 1083 return -ENOMEM;
1094 } 1084 }
1095 for (i = 0; i < 3; i++) 1085 for (i = 0; i < 3; i++)
@@ -1098,12 +1088,12 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp)
1098 case ISDN_PTYPE_1TR6: 1088 case ISDN_PTYPE_1TR6:
1099 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", 1089 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95",
1100 -1)) { 1090 -1)) {
1101 restore_flags(flags); 1091 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1102 return -ENOMEM; 1092 return -ENOMEM;
1103 } 1093 }
1104 card->sil[0] = card->sil[1] = 4; 1094 card->sil[0] = card->sil[1] = 4;
1105 if (isdnloop_fake(card, "TEI OK", 0)) { 1095 if (isdnloop_fake(card, "TEI OK", 0)) {
1106 restore_flags(flags); 1096 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1107 return -ENOMEM; 1097 return -ENOMEM;
1108 } 1098 }
1109 strcpy(card->s0num[0], sdef.num[0]); 1099 strcpy(card->s0num[0], sdef.num[0]);
@@ -1111,7 +1101,7 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp)
1111 card->s0num[2][0] = '\0'; 1101 card->s0num[2][0] = '\0';
1112 break; 1102 break;
1113 default: 1103 default:
1114 restore_flags(flags); 1104 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1115 printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n", 1105 printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n",
1116 sdef.ptype); 1106 sdef.ptype);
1117 return -EINVAL; 1107 return -EINVAL;
@@ -1122,7 +1112,7 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp)
1122 card->st_timer.data = (unsigned long) card; 1112 card->st_timer.data = (unsigned long) card;
1123 add_timer(&card->st_timer); 1113 add_timer(&card->st_timer);
1124 card->flags |= ISDNLOOP_FLAGS_RUNNING; 1114 card->flags |= ISDNLOOP_FLAGS_RUNNING;
1125 restore_flags(flags); 1115 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1126 return 0; 1116 return 0;
1127} 1117}
1128 1118
@@ -1472,6 +1462,7 @@ isdnloop_initcard(char *id)
1472 skb_queue_head_init(&card->bqueue[i]); 1462 skb_queue_head_init(&card->bqueue[i]);
1473 } 1463 }
1474 skb_queue_head_init(&card->dqueue); 1464 skb_queue_head_init(&card->dqueue);
1465 card->isdnloop_lock = SPIN_LOCK_UNLOCKED;
1475 card->next = cards; 1466 card->next = cards;
1476 cards = card; 1467 cards = card;
1477 if (!register_isdn(&card->interface)) { 1468 if (!register_isdn(&card->interface)) {
diff --git a/drivers/isdn/isdnloop/isdnloop.h b/drivers/isdn/isdnloop/isdnloop.h
index d699fe53e1c3..0d458a86f529 100644
--- a/drivers/isdn/isdnloop/isdnloop.h
+++ b/drivers/isdn/isdnloop/isdnloop.h
@@ -94,6 +94,7 @@ typedef struct isdnloop_card {
94 struct sk_buff_head 94 struct sk_buff_head
95 bqueue[ISDNLOOP_BCH]; /* B-Channel queues */ 95 bqueue[ISDNLOOP_BCH]; /* B-Channel queues */
96 struct sk_buff_head dqueue; /* D-Channel queue */ 96 struct sk_buff_head dqueue; /* D-Channel queue */
97 spinlock_t isdnloop_lock;
97} isdnloop_card; 98} isdnloop_card;
98 99
99/* 100/*
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index 94f21486bb24..6ead5e1508b7 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -725,23 +725,27 @@ static int pcbit_stat(u_char __user *buf, int len, int driver, int channel)
725 725
726 if (stat_st < stat_end) 726 if (stat_st < stat_end)
727 { 727 {
728 copy_to_user(buf, statbuf + stat_st, len); 728 if (copy_to_user(buf, statbuf + stat_st, len))
729 return -EFAULT;
729 stat_st += len; 730 stat_st += len;
730 } 731 }
731 else 732 else
732 { 733 {
733 if (len > STATBUF_LEN - stat_st) 734 if (len > STATBUF_LEN - stat_st)
734 { 735 {
735 copy_to_user(buf, statbuf + stat_st, 736 if (copy_to_user(buf, statbuf + stat_st,
736 STATBUF_LEN - stat_st); 737 STATBUF_LEN - stat_st))
737 copy_to_user(buf, statbuf, 738 return -EFAULT;
738 len - (STATBUF_LEN - stat_st)); 739 if (copy_to_user(buf, statbuf,
740 len - (STATBUF_LEN - stat_st)))
741 return -EFAULT;
739 742
740 stat_st = len - (STATBUF_LEN - stat_st); 743 stat_st = len - (STATBUF_LEN - stat_st);
741 } 744 }
742 else 745 else
743 { 746 {
744 copy_to_user(buf, statbuf + stat_st, len); 747 if (copy_to_user(buf, statbuf + stat_st, len))
748 return -EFAULT;
745 749
746 stat_st += len; 750 stat_st += len;
747 751
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index aecbbe2e89a9..3c1711210e38 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -91,6 +91,8 @@ EXPORT_SYMBOL_GPL(led_classdev_resume);
91 */ 91 */
92int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) 92int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
93{ 93{
94 int rc;
95
94 led_cdev->class_dev = class_device_create(leds_class, NULL, 0, 96 led_cdev->class_dev = class_device_create(leds_class, NULL, 0,
95 parent, "%s", led_cdev->name); 97 parent, "%s", led_cdev->name);
96 if (unlikely(IS_ERR(led_cdev->class_dev))) 98 if (unlikely(IS_ERR(led_cdev->class_dev)))
@@ -99,8 +101,10 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
99 class_set_devdata(led_cdev->class_dev, led_cdev); 101 class_set_devdata(led_cdev->class_dev, led_cdev);
100 102
101 /* register the attributes */ 103 /* register the attributes */
102 class_device_create_file(led_cdev->class_dev, 104 rc = class_device_create_file(led_cdev->class_dev,
103 &class_device_attr_brightness); 105 &class_device_attr_brightness);
106 if (rc)
107 goto err_out;
104 108
105 /* add to the list of leds */ 109 /* add to the list of leds */
106 write_lock(&leds_list_lock); 110 write_lock(&leds_list_lock);
@@ -110,16 +114,28 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
110#ifdef CONFIG_LEDS_TRIGGERS 114#ifdef CONFIG_LEDS_TRIGGERS
111 rwlock_init(&led_cdev->trigger_lock); 115 rwlock_init(&led_cdev->trigger_lock);
112 116
113 led_trigger_set_default(led_cdev); 117 rc = class_device_create_file(led_cdev->class_dev,
118 &class_device_attr_trigger);
119 if (rc)
120 goto err_out_led_list;
114 121
115 class_device_create_file(led_cdev->class_dev, 122 led_trigger_set_default(led_cdev);
116 &class_device_attr_trigger);
117#endif 123#endif
118 124
119 printk(KERN_INFO "Registered led device: %s\n", 125 printk(KERN_INFO "Registered led device: %s\n",
120 led_cdev->class_dev->class_id); 126 led_cdev->class_dev->class_id);
121 127
122 return 0; 128 return 0;
129
130#ifdef CONFIG_LEDS_TRIGGERS
131err_out_led_list:
132 class_device_remove_file(led_cdev->class_dev,
133 &class_device_attr_brightness);
134 list_del(&led_cdev->node);
135#endif
136err_out:
137 class_device_unregister(led_cdev->class_dev);
138 return rc;
123} 139}
124EXPORT_SYMBOL_GPL(led_classdev_register); 140EXPORT_SYMBOL_GPL(led_classdev_register);
125 141
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index 179c2876b541..29a8818a32ec 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -123,6 +123,7 @@ static CLASS_DEVICE_ATTR(delay_off, 0644, led_delay_off_show,
123static void timer_trig_activate(struct led_classdev *led_cdev) 123static void timer_trig_activate(struct led_classdev *led_cdev)
124{ 124{
125 struct timer_trig_data *timer_data; 125 struct timer_trig_data *timer_data;
126 int rc;
126 127
127 timer_data = kzalloc(sizeof(struct timer_trig_data), GFP_KERNEL); 128 timer_data = kzalloc(sizeof(struct timer_trig_data), GFP_KERNEL);
128 if (!timer_data) 129 if (!timer_data)
@@ -134,10 +135,21 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
134 timer_data->timer.function = led_timer_function; 135 timer_data->timer.function = led_timer_function;
135 timer_data->timer.data = (unsigned long) led_cdev; 136 timer_data->timer.data = (unsigned long) led_cdev;
136 137
137 class_device_create_file(led_cdev->class_dev, 138 rc = class_device_create_file(led_cdev->class_dev,
138 &class_device_attr_delay_on); 139 &class_device_attr_delay_on);
139 class_device_create_file(led_cdev->class_dev, 140 if (rc) goto err_out;
141 rc = class_device_create_file(led_cdev->class_dev,
140 &class_device_attr_delay_off); 142 &class_device_attr_delay_off);
143 if (rc) goto err_out_delayon;
144
145 return;
146
147err_out_delayon:
148 class_device_remove_file(led_cdev->class_dev,
149 &class_device_attr_delay_on);
150err_out:
151 led_cdev->trigger_data = NULL;
152 kfree(timer_data);
141} 153}
142 154
143static void timer_trig_deactivate(struct led_classdev *led_cdev) 155static void timer_trig_deactivate(struct led_classdev *led_cdev)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 655d816760e5..a625576fdeeb 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/crypto.h> 17#include <linux/crypto.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/backing-dev.h>
19#include <asm/atomic.h> 20#include <asm/atomic.h>
20#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
21#include <asm/page.h> 22#include <asm/page.h>
@@ -602,7 +603,7 @@ static void process_write(struct crypt_io *io)
602 603
603 /* out of memory -> run queues */ 604 /* out of memory -> run queues */
604 if (remaining) 605 if (remaining)
605 blk_congestion_wait(bio_data_dir(clone), HZ/100); 606 congestion_wait(bio_data_dir(clone), HZ/100);
606 } 607 }
607} 608}
608 609
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 57fa64f93e5f..f7f19088f3be 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4912,6 +4912,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
4912} 4912}
4913 4913
4914static struct file_operations md_seq_fops = { 4914static struct file_operations md_seq_fops = {
4915 .owner = THIS_MODULE,
4915 .open = md_seq_open, 4916 .open = md_seq_open,
4916 .read = seq_read, 4917 .read = seq_read,
4917 .llseek = seq_lseek, 4918 .llseek = seq_lseek,
diff --git a/drivers/message/i2o/bus-osm.c b/drivers/message/i2o/bus-osm.c
index ac06f10c54ec..d96c687aee93 100644
--- a/drivers/message/i2o/bus-osm.c
+++ b/drivers/message/i2o/bus-osm.c
@@ -80,18 +80,26 @@ static DEVICE_ATTR(scan, S_IWUSR, NULL, i2o_bus_store_scan);
80 * @dev: device to verify if it is a I2O Bus Adapter device 80 * @dev: device to verify if it is a I2O Bus Adapter device
81 * 81 *
82 * Because we want all Bus Adapters always return 0. 82 * Because we want all Bus Adapters always return 0.
83 * Except when we fail. Then we are sad.
83 * 84 *
84 * Returns 0. 85 * Returns 0, except when we fail to excel.
85 */ 86 */
86static int i2o_bus_probe(struct device *dev) 87static int i2o_bus_probe(struct device *dev)
87{ 88{
88 struct i2o_device *i2o_dev = to_i2o_device(get_device(dev)); 89 struct i2o_device *i2o_dev = to_i2o_device(get_device(dev));
90 int rc;
89 91
90 device_create_file(dev, &dev_attr_scan); 92 rc = device_create_file(dev, &dev_attr_scan);
93 if (rc)
94 goto err_out;
91 95
92 osm_info("device added (TID: %03x)\n", i2o_dev->lct_data.tid); 96 osm_info("device added (TID: %03x)\n", i2o_dev->lct_data.tid);
93 97
94 return 0; 98 return 0;
99
100err_out:
101 put_device(dev);
102 return rc;
95}; 103};
96 104
97/** 105/**
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 7bd4d85d0b42..91f95d172ca5 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -325,13 +325,24 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL);
325static int i2o_exec_probe(struct device *dev) 325static int i2o_exec_probe(struct device *dev)
326{ 326{
327 struct i2o_device *i2o_dev = to_i2o_device(dev); 327 struct i2o_device *i2o_dev = to_i2o_device(dev);
328 int rc;
328 329
329 i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); 330 rc = i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
331 if (rc) goto err_out;
330 332
331 device_create_file(dev, &dev_attr_vendor_id); 333 rc = device_create_file(dev, &dev_attr_vendor_id);
332 device_create_file(dev, &dev_attr_product_id); 334 if (rc) goto err_evtreg;
335 rc = device_create_file(dev, &dev_attr_product_id);
336 if (rc) goto err_vid;
333 337
334 return 0; 338 return 0;
339
340err_vid:
341 device_remove_file(dev, &dev_attr_vendor_id);
342err_evtreg:
343 i2o_event_register(to_i2o_device(dev), &i2o_exec_driver, 0, 0);
344err_out:
345 return rc;
335}; 346};
336 347
337/** 348/**
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index fa7acc2c5c6d..b6c045dc97b4 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -28,6 +28,17 @@ config IBM_ASM
28 28
29 If unsure, say N. 29 If unsure, say N.
30 30
31config SGI_IOC4
32 tristate "SGI IOC4 Base IO support"
33 ---help---
34 This option enables basic support for the IOC4 chip on certain
35 SGI IO controller cards (IO9, IO10, and PCI-RT). This option
36 does not enable any specific functions on such a card, but provides
37 necessary infrastructure for other drivers to utilize.
38
39 If you have an SGI Altix with an IOC4-based card say Y.
40 Otherwise say N.
41
31config TIFM_CORE 42config TIFM_CORE
32 tristate "TI Flash Media interface support (EXPERIMENTAL)" 43 tristate "TI Flash Media interface support (EXPERIMENTAL)"
33 depends on EXPERIMENTAL 44 depends on EXPERIMENTAL
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 9a91c1ee8497..c9e98ab021c5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
9obj-$(CONFIG_LKDTM) += lkdtm.o 9obj-$(CONFIG_LKDTM) += lkdtm.o
10obj-$(CONFIG_TIFM_CORE) += tifm_core.o 10obj-$(CONFIG_TIFM_CORE) += tifm_core.o
11obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 11obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
12obj-$(CONFIG_SGI_IOC4) += ioc4.o
diff --git a/drivers/sn/ioc4.c b/drivers/misc/ioc4.c
index 8562821e6498..1c3c14a3839c 100644
--- a/drivers/sn/ioc4.c
+++ b/drivers/misc/ioc4.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (C) 2005-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9/* This file contains the master driver module for use by SGI IOC4 subdrivers. 9/* This file contains the master driver module for use by SGI IOC4 subdrivers.
@@ -29,12 +29,9 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/ioc4.h> 31#include <linux/ioc4.h>
32#include <linux/mmtimer.h> 32#include <linux/ktime.h>
33#include <linux/rtc.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
35#include <asm/sn/addrs.h> 34#include <linux/time.h>
36#include <asm/sn/clksupport.h>
37#include <asm/sn/shub_mmr.h>
38 35
39/*************** 36/***************
40 * Definitions * 37 * Definitions *
@@ -43,7 +40,7 @@
43/* Tweakable values */ 40/* Tweakable values */
44 41
45/* PCI bus speed detection/calibration */ 42/* PCI bus speed detection/calibration */
46#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */ 43#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */
47#define IOC4_CALIBRATE_CYCLES 256 /* Average over this many cycles */ 44#define IOC4_CALIBRATE_CYCLES 256 /* Average over this many cycles */
48#define IOC4_CALIBRATE_DISCARD 2 /* Discard first few cycles */ 45#define IOC4_CALIBRATE_DISCARD 2 /* Discard first few cycles */
49#define IOC4_CALIBRATE_LOW_MHZ 25 /* Lower bound on bus speed sanity */ 46#define IOC4_CALIBRATE_LOW_MHZ 25 /* Lower bound on bus speed sanity */
@@ -143,11 +140,11 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
143static void 140static void
144ioc4_clock_calibrate(struct ioc4_driver_data *idd) 141ioc4_clock_calibrate(struct ioc4_driver_data *idd)
145{ 142{
146 extern unsigned long sn_rtc_cycles_per_second;
147 union ioc4_int_out int_out; 143 union ioc4_int_out int_out;
148 union ioc4_gpcr gpcr; 144 union ioc4_gpcr gpcr;
149 unsigned int state, last_state = 1; 145 unsigned int state, last_state = 1;
150 uint64_t start = 0, end, period; 146 struct timespec start_ts, end_ts;
147 uint64_t start, end, period;
151 unsigned int count = 0; 148 unsigned int count = 0;
152 149
153 /* Enable output */ 150 /* Enable output */
@@ -175,30 +172,28 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
175 if (!last_state && state) { 172 if (!last_state && state) {
176 count++; 173 count++;
177 if (count == IOC4_CALIBRATE_END) { 174 if (count == IOC4_CALIBRATE_END) {
178 end = rtc_time(); 175 ktime_get_ts(&end_ts);
179 break; 176 break;
180 } else if (count == IOC4_CALIBRATE_DISCARD) 177 } else if (count == IOC4_CALIBRATE_DISCARD)
181 start = rtc_time(); 178 ktime_get_ts(&start_ts);
182 } 179 }
183 last_state = state; 180 last_state = state;
184 } while (1); 181 } while (1);
185 182
186 /* Calculation rearranged to preserve intermediate precision. 183 /* Calculation rearranged to preserve intermediate precision.
187 * Logically: 184 * Logically:
188 * 1. "end - start" gives us number of RTC cycles over all the 185 * 1. "end - start" gives us the measurement period over all
189 * square wave cycles measured. 186 * the square wave cycles.
190 * 2. Divide by number of square wave cycles to get number of 187 * 2. Divide by number of square wave cycles to get the period
191 * RTC cycles per square wave cycle. 188 * of a square wave cycle.
192 * 3. Divide by 2*(int_out.fields.count+1), which is the formula 189 * 3. Divide by 2*(int_out.fields.count+1), which is the formula
193 * by which the IOC4 generates the square wave, to get the 190 * by which the IOC4 generates the square wave, to get the
194 * number of RTC cycles per IOC4 INT_OUT count. 191 * period of an IOC4 INT_OUT count.
195 * 4. Divide by sn_rtc_cycles_per_second to get seconds per
196 * count.
197 * 5. Multiply by 1E9 to get nanoseconds per count.
198 */ 192 */
199 period = ((end - start) * 1000000000) / 193 end = end_ts.tv_sec * NSEC_PER_SEC + end_ts.tv_nsec;
200 (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1) 194 start = start_ts.tv_sec * NSEC_PER_SEC + start_ts.tv_nsec;
201 * sn_rtc_cycles_per_second); 195 period = (end - start) /
196 (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1));
202 197
203 /* Bounds check the result. */ 198 /* Bounds check the result. */
204 if (period > IOC4_CALIBRATE_LOW_LIMIT || 199 if (period > IOC4_CALIBRATE_LOW_LIMIT ||
@@ -210,10 +205,12 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
210 IOC4_CALIBRATE_DEFAULT / IOC4_EXTINT_COUNT_DIVISOR); 205 IOC4_CALIBRATE_DEFAULT / IOC4_EXTINT_COUNT_DIVISOR);
211 period = IOC4_CALIBRATE_DEFAULT; 206 period = IOC4_CALIBRATE_DEFAULT;
212 } else { 207 } else {
208 u64 ns = period;
209
210 do_div(ns, IOC4_EXTINT_COUNT_DIVISOR);
213 printk(KERN_DEBUG 211 printk(KERN_DEBUG
214 "IOC4 %s: PCI clock is %ld ns.\n", 212 "IOC4 %s: PCI clock is %lld ns.\n",
215 pci_name(idd->idd_pdev), 213 pci_name(idd->idd_pdev), ns);
216 period / IOC4_EXTINT_COUNT_DIVISOR);
217 } 214 }
218 215
219 /* Remember results. We store the extint clock period rather 216 /* Remember results. We store the extint clock period rather
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index ab92cc794c64..e2ed24918a58 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2288,7 +2288,7 @@ config UGETH_TX_ON_DEMOND
2288 2288
2289config UGETH_HAS_GIGA 2289config UGETH_HAS_GIGA
2290 bool 2290 bool
2291 depends on UCC_GETH && MPC836x 2291 depends on UCC_GETH && PPC_MPC836x
2292 2292
2293config MV643XX_ETH 2293config MV643XX_ETH
2294 tristate "MV-643XX Ethernet support" 2294 tristate "MV-643XX Ethernet support"
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 27d5d2f02533..a3a08a5dd185 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2039,7 +2039,6 @@ static int e100_change_mtu(struct net_device *netdev, int new_mtu)
2039 return 0; 2039 return 0;
2040} 2040}
2041 2041
2042#ifdef CONFIG_PM
2043static int e100_asf(struct nic *nic) 2042static int e100_asf(struct nic *nic)
2044{ 2043{
2045 /* ASF can be enabled from eeprom */ 2044 /* ASF can be enabled from eeprom */
@@ -2048,7 +2047,6 @@ static int e100_asf(struct nic *nic)
2048 !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && 2047 !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) &&
2049 ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE)); 2048 ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE));
2050} 2049}
2051#endif
2052 2050
2053static int e100_up(struct nic *nic) 2051static int e100_up(struct nic *nic)
2054{ 2052{
@@ -2715,34 +2713,32 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2715 } 2713 }
2716} 2714}
2717 2715
2716#ifdef CONFIG_PM
2718static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2717static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2719{ 2718{
2720 struct net_device *netdev = pci_get_drvdata(pdev); 2719 struct net_device *netdev = pci_get_drvdata(pdev);
2721 struct nic *nic = netdev_priv(netdev); 2720 struct nic *nic = netdev_priv(netdev);
2722 2721
2723 if (netif_running(netdev)) 2722 netif_poll_disable(nic->netdev);
2724 e100_down(nic); 2723 del_timer_sync(&nic->watchdog);
2725 e100_hw_reset(nic); 2724 netif_carrier_off(nic->netdev);
2726 netif_device_detach(netdev);
2727 2725
2728#ifdef CONFIG_PM
2729 pci_save_state(pdev); 2726 pci_save_state(pdev);
2730 if (nic->flags & (wol_magic | e100_asf(nic))) 2727
2731#else 2728 if ((nic->flags & wol_magic) | e100_asf(nic)) {
2732 if (nic->flags & (wol_magic)) 2729 pci_enable_wake(pdev, PCI_D3hot, 1);
2733#endif 2730 pci_enable_wake(pdev, PCI_D3cold, 1);
2734 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); 2731 } else {
2735 else 2732 pci_enable_wake(pdev, PCI_D3hot, 0);
2736 /* disable PME */ 2733 pci_enable_wake(pdev, PCI_D3cold, 0);
2737 pci_enable_wake(pdev, 0, 0); 2734 }
2738 2735
2739 pci_disable_device(pdev); 2736 pci_disable_device(pdev);
2740 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2737 pci_set_power_state(pdev, PCI_D3hot);
2741 2738
2742 return 0; 2739 return 0;
2743} 2740}
2744 2741
2745#ifdef CONFIG_PM
2746static int e100_resume(struct pci_dev *pdev) 2742static int e100_resume(struct pci_dev *pdev)
2747{ 2743{
2748 struct net_device *netdev = pci_get_drvdata(pdev); 2744 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2764,7 +2760,23 @@ static int e100_resume(struct pci_dev *pdev)
2764 2760
2765static void e100_shutdown(struct pci_dev *pdev) 2761static void e100_shutdown(struct pci_dev *pdev)
2766{ 2762{
2767 e100_suspend(pdev, PMSG_SUSPEND); 2763 struct net_device *netdev = pci_get_drvdata(pdev);
2764 struct nic *nic = netdev_priv(netdev);
2765
2766 netif_poll_disable(nic->netdev);
2767 del_timer_sync(&nic->watchdog);
2768 netif_carrier_off(nic->netdev);
2769
2770 if ((nic->flags & wol_magic) | e100_asf(nic)) {
2771 pci_enable_wake(pdev, PCI_D3hot, 1);
2772 pci_enable_wake(pdev, PCI_D3cold, 1);
2773 } else {
2774 pci_enable_wake(pdev, PCI_D3hot, 0);
2775 pci_enable_wake(pdev, PCI_D3cold, 0);
2776 }
2777
2778 pci_disable_device(pdev);
2779 pci_set_power_state(pdev, PCI_D3hot);
2768} 2780}
2769 2781
2770/* ------------------ PCI Error Recovery infrastructure -------------- */ 2782/* ------------------ PCI Error Recovery infrastructure -------------- */
@@ -2848,9 +2860,9 @@ static struct pci_driver e100_driver = {
2848 .id_table = e100_id_table, 2860 .id_table = e100_id_table,
2849 .probe = e100_probe, 2861 .probe = e100_probe,
2850 .remove = __devexit_p(e100_remove), 2862 .remove = __devexit_p(e100_remove),
2863#ifdef CONFIG_PM
2851 /* Power Management hooks */ 2864 /* Power Management hooks */
2852 .suspend = e100_suspend, 2865 .suspend = e100_suspend,
2853#ifdef CONFIG_PM
2854 .resume = e100_resume, 2866 .resume = e100_resume,
2855#endif 2867#endif
2856 .shutdown = e100_shutdown, 2868 .shutdown = e100_shutdown,
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ce0d35fe3947..fa849831d099 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4914,10 +4914,6 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
4914 pci_enable_wake(pdev, PCI_D3hot, 0); 4914 pci_enable_wake(pdev, PCI_D3hot, 0);
4915 pci_enable_wake(pdev, PCI_D3cold, 0); 4915 pci_enable_wake(pdev, PCI_D3cold, 0);
4916 4916
4917 /* Perform card reset only on one instance of the card */
4918 if (PCI_FUNC (pdev->devfn) != 0)
4919 return PCI_ERS_RESULT_RECOVERED;
4920
4921 e1000_reset(adapter); 4917 e1000_reset(adapter);
4922 E1000_WRITE_REG(&adapter->hw, WUS, ~0); 4918 E1000_WRITE_REG(&adapter->hw, WUS, ~0);
4923 4919
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index e963dbf816be..f56b00ee385e 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1017,7 +1017,7 @@ static void ioc3_init(struct net_device *dev)
1017 struct ioc3_private *ip = netdev_priv(dev); 1017 struct ioc3_private *ip = netdev_priv(dev);
1018 struct ioc3 *ioc3 = ip->regs; 1018 struct ioc3 *ioc3 = ip->regs;
1019 1019
1020 del_timer(&ip->ioc3_timer); /* Kill if running */ 1020 del_timer_sync(&ip->ioc3_timer); /* Kill if running */
1021 1021
1022 ioc3_w_emcr(EMCR_RST); /* Reset */ 1022 ioc3_w_emcr(EMCR_RST); /* Reset */
1023 (void) ioc3_r_emcr(); /* Flush WB */ 1023 (void) ioc3_r_emcr(); /* Flush WB */
@@ -1081,7 +1081,7 @@ static int ioc3_close(struct net_device *dev)
1081{ 1081{
1082 struct ioc3_private *ip = netdev_priv(dev); 1082 struct ioc3_private *ip = netdev_priv(dev);
1083 1083
1084 del_timer(&ip->ioc3_timer); 1084 del_timer_sync(&ip->ioc3_timer);
1085 1085
1086 netif_stop_queue(dev); 1086 netif_stop_queue(dev);
1087 1087
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 4178b4b1d2df..82c10dec1b5a 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -58,7 +58,11 @@
58#include <linux/tcp.h> 58#include <linux/tcp.h>
59#include <linux/percpu.h> 59#include <linux/percpu.h>
60 60
61static DEFINE_PER_CPU(struct net_device_stats, loopback_stats); 61struct pcpu_lstats {
62 unsigned long packets;
63 unsigned long bytes;
64};
65static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats);
62 66
63#define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16) 67#define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16)
64 68
@@ -128,7 +132,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
128 */ 132 */
129static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) 133static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
130{ 134{
131 struct net_device_stats *lb_stats; 135 struct pcpu_lstats *lb_stats;
132 136
133 skb_orphan(skb); 137 skb_orphan(skb);
134 138
@@ -149,16 +153,14 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
149#endif 153#endif
150 dev->last_rx = jiffies; 154 dev->last_rx = jiffies;
151 155
152 lb_stats = &per_cpu(loopback_stats, get_cpu()); 156 /* it's OK to use __get_cpu_var() because BHs are off */
153 lb_stats->rx_bytes += skb->len; 157 lb_stats = &__get_cpu_var(pcpu_lstats);
154 lb_stats->tx_bytes = lb_stats->rx_bytes; 158 lb_stats->bytes += skb->len;
155 lb_stats->rx_packets++; 159 lb_stats->packets++;
156 lb_stats->tx_packets = lb_stats->rx_packets;
157 put_cpu();
158 160
159 netif_rx(skb); 161 netif_rx(skb);
160 162
161 return(0); 163 return 0;
162} 164}
163 165
164static struct net_device_stats loopback_stats; 166static struct net_device_stats loopback_stats;
@@ -166,20 +168,21 @@ static struct net_device_stats loopback_stats;
166static struct net_device_stats *get_stats(struct net_device *dev) 168static struct net_device_stats *get_stats(struct net_device *dev)
167{ 169{
168 struct net_device_stats *stats = &loopback_stats; 170 struct net_device_stats *stats = &loopback_stats;
171 unsigned long bytes = 0;
172 unsigned long packets = 0;
169 int i; 173 int i;
170 174
171 memset(stats, 0, sizeof(struct net_device_stats));
172
173 for_each_possible_cpu(i) { 175 for_each_possible_cpu(i) {
174 struct net_device_stats *lb_stats; 176 const struct pcpu_lstats *lb_stats;
175 177
176 lb_stats = &per_cpu(loopback_stats, i); 178 lb_stats = &per_cpu(pcpu_lstats, i);
177 stats->rx_bytes += lb_stats->rx_bytes; 179 bytes += lb_stats->bytes;
178 stats->tx_bytes += lb_stats->tx_bytes; 180 packets += lb_stats->packets;
179 stats->rx_packets += lb_stats->rx_packets;
180 stats->tx_packets += lb_stats->tx_packets;
181 } 181 }
182 182 stats->rx_packets = packets;
183 stats->tx_packets = packets;
184 stats->rx_bytes = bytes;
185 stats->tx_bytes = bytes;
183 return stats; 186 return stats;
184} 187}
185 188
diff --git a/drivers/net/myri_code.h b/drivers/net/myri_code.h
index e21ec9b2c706..ba7b8652c501 100644
--- a/drivers/net/myri_code.h
+++ b/drivers/net/myri_code.h
@@ -1,8 +1,8 @@
1/* This is the Myrinet MCP code for LANai4.x */ 1/* This is the Myrinet MCP code for LANai4.x */
2/* Generated by cat $MYRI_HOME/lib/lanai/mcp4.dat > myri_code4.h */ 2/* Generated by cat $MYRI_HOME/lib/lanai/mcp4.dat > myri_code4.h */
3 3
4static unsigned int lanai4_code_off = 0x0000; /* half-word offset */ 4static unsigned int __devinitdata lanai4_code_off = 0x0000; /* half-word offset */
5static unsigned char lanai4_code[76256] __initdata = { 5static unsigned char __devinitdata lanai4_code[76256] = {
60xF2,0x0E, 60xF2,0x0E,
70xFE,0x00, 0xC2,0x90, 0x00,0x00, 0x07,0x88, 0x00,0x08, 0xE0,0x01, 0x01,0x4C, 0x97,0x93, 70xFE,0x00, 0xC2,0x90, 0x00,0x00, 0x07,0x88, 0x00,0x08, 0xE0,0x01, 0x01,0x4C, 0x97,0x93,
80xFF,0xFC, 0xE0,0x00, 0x00,0x14, 0x00,0x00, 0x00,0x01, 0x00,0x00, 0x00,0x00, 0x92,0x93, 80xFF,0xFC, 0xE0,0x00, 0x00,0x14, 0x00,0x00, 0x00,0x01, 0x00,0x00, 0x00,0x00, 0x92,0x93,
@@ -4774,8 +4774,8 @@ static unsigned char lanai4_code[76256] __initdata = {
4774 4774
4775/* This is the LANai data */ 4775/* This is the LANai data */
4776 4776
4777static unsigned int lanai4_data_off = 0x94F0; /* half-word offset */ 4777static unsigned int __devinitdata lanai4_data_off = 0x94F0; /* half-word offset */
4778static unsigned char lanai4_data[20472] __initdata; 4778static unsigned char __devinitdata lanai4_data[20472];
4779 4779
4780 4780
4781#ifdef SYMBOL_DEFINES_COMPILED 4781#ifdef SYMBOL_DEFINES_COMPILED
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 466b484c9fa4..7747bfd99f91 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -168,7 +168,7 @@ static int myri_do_handshake(struct myri_eth *mp)
168 return 0; 168 return 0;
169} 169}
170 170
171static int myri_load_lanai(struct myri_eth *mp) 171static int __devinit myri_load_lanai(struct myri_eth *mp)
172{ 172{
173 struct net_device *dev = mp->dev; 173 struct net_device *dev = mp->dev;
174 struct myri_shmem __iomem *shmem = mp->shmem; 174 struct myri_shmem __iomem *shmem = mp->shmem;
@@ -891,7 +891,7 @@ static void dump_eeprom(struct myri_eth *mp)
891} 891}
892#endif 892#endif
893 893
894static int __init myri_ether_init(struct sbus_dev *sdev) 894static int __devinit myri_ether_init(struct sbus_dev *sdev)
895{ 895{
896 static int num; 896 static int num;
897 static unsigned version_printed; 897 static unsigned version_printed;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index f1c75751cab7..d132fe7d475e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -214,6 +214,7 @@ static struct pci_device_id rtl8169_pci_tbl[] = {
214 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_2 }, 214 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_2 },
215 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, 215 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },
216 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 }, 216 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 },
217 { PCI_DEVICE(0x1259, 0xc107), 0, 0, RTL_CFG_0 },
217 { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, 218 { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 },
218 { PCI_VENDOR_ID_LINKSYS, 0x1032, 219 { PCI_VENDOR_ID_LINKSYS, 0x1032,
219 PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, 220 PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 },
@@ -2700,6 +2701,7 @@ static void rtl8169_down(struct net_device *dev)
2700 struct rtl8169_private *tp = netdev_priv(dev); 2701 struct rtl8169_private *tp = netdev_priv(dev);
2701 void __iomem *ioaddr = tp->mmio_addr; 2702 void __iomem *ioaddr = tp->mmio_addr;
2702 unsigned int poll_locked = 0; 2703 unsigned int poll_locked = 0;
2704 unsigned int intrmask;
2703 2705
2704 rtl8169_delete_timer(dev); 2706 rtl8169_delete_timer(dev);
2705 2707
@@ -2738,8 +2740,11 @@ core_down:
2738 * 2) dev->change_mtu 2740 * 2) dev->change_mtu
2739 * -> rtl8169_poll can not be issued again and re-enable the 2741 * -> rtl8169_poll can not be issued again and re-enable the
2740 * interruptions. Let's simply issue the IRQ down sequence again. 2742 * interruptions. Let's simply issue the IRQ down sequence again.
2743 *
2744 * No loop if hotpluged or major error (0xffff).
2741 */ 2745 */
2742 if (RTL_R16(IntrMask)) 2746 intrmask = RTL_R16(IntrMask);
2747 if (intrmask && (intrmask != 0xffff))
2743 goto core_down; 2748 goto core_down;
2744 2749
2745 rtl8169_tx_clear(tp); 2750 rtl8169_tx_clear(tp);
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index db2324939b69..1eae16b72b4b 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2903,7 +2903,7 @@ sbmac_init_module(void)
2903 2903
2904 dev = alloc_etherdev(sizeof(struct sbmac_softc)); 2904 dev = alloc_etherdev(sizeof(struct sbmac_softc));
2905 if (!dev) 2905 if (!dev)
2906 return -ENOMEM; /* return ENOMEM */ 2906 return -ENOMEM;
2907 2907
2908 printk(KERN_DEBUG "sbmac: configuring MAC at %lx\n", port); 2908 printk(KERN_DEBUG "sbmac: configuring MAC at %lx\n", port);
2909 2909
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c10e7f5faa5f..95efdb5bbbe1 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -50,7 +50,7 @@
50#include "sky2.h" 50#include "sky2.h"
51 51
52#define DRV_NAME "sky2" 52#define DRV_NAME "sky2"
53#define DRV_VERSION "1.9" 53#define DRV_VERSION "1.10"
54#define PFX DRV_NAME " " 54#define PFX DRV_NAME " "
55 55
56/* 56/*
@@ -96,9 +96,9 @@ static int disable_msi = 0;
96module_param(disable_msi, int, 0); 96module_param(disable_msi, int, 0);
97MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); 97MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
98 98
99static int idle_timeout = 100; 99static int idle_timeout = 0;
100module_param(idle_timeout, int, 0); 100module_param(idle_timeout, int, 0);
101MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)"); 101MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)");
102 102
103static const struct pci_device_id sky2_id_table[] = { 103static const struct pci_device_id sky2_id_table[] = {
104 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, 104 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
@@ -284,6 +284,31 @@ static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port)
284 gma_write16(hw, port, GM_RX_CTRL, reg); 284 gma_write16(hw, port, GM_RX_CTRL, reg);
285} 285}
286 286
287/* flow control to advertise bits */
288static const u16 copper_fc_adv[] = {
289 [FC_NONE] = 0,
290 [FC_TX] = PHY_M_AN_ASP,
291 [FC_RX] = PHY_M_AN_PC,
292 [FC_BOTH] = PHY_M_AN_PC | PHY_M_AN_ASP,
293};
294
295/* flow control to advertise bits when using 1000BaseX */
296static const u16 fiber_fc_adv[] = {
297 [FC_BOTH] = PHY_M_P_BOTH_MD_X,
298 [FC_TX] = PHY_M_P_ASYM_MD_X,
299 [FC_RX] = PHY_M_P_SYM_MD_X,
300 [FC_NONE] = PHY_M_P_NO_PAUSE_X,
301};
302
303/* flow control to GMA disable bits */
304static const u16 gm_fc_disable[] = {
305 [FC_NONE] = GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS,
306 [FC_TX] = GM_GPCR_FC_RX_DIS,
307 [FC_RX] = GM_GPCR_FC_TX_DIS,
308 [FC_BOTH] = 0,
309};
310
311
287static void sky2_phy_init(struct sky2_hw *hw, unsigned port) 312static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
288{ 313{
289 struct sky2_port *sky2 = netdev_priv(hw->dev[port]); 314 struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
@@ -356,16 +381,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
356 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 381 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
357 } 382 }
358 383
359 ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); 384 ctrl = PHY_CT_RESET;
360 if (sky2->autoneg == AUTONEG_DISABLE)
361 ctrl &= ~PHY_CT_ANE;
362 else
363 ctrl |= PHY_CT_ANE;
364
365 ctrl |= PHY_CT_RESET;
366 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
367
368 ctrl = 0;
369 ct1000 = 0; 385 ct1000 = 0;
370 adv = PHY_AN_CSMA; 386 adv = PHY_AN_CSMA;
371 reg = 0; 387 reg = 0;
@@ -384,20 +400,16 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
384 adv |= PHY_M_AN_10_FD; 400 adv |= PHY_M_AN_10_FD;
385 if (sky2->advertising & ADVERTISED_10baseT_Half) 401 if (sky2->advertising & ADVERTISED_10baseT_Half)
386 adv |= PHY_M_AN_10_HD; 402 adv |= PHY_M_AN_10_HD;
403
404 adv |= copper_fc_adv[sky2->flow_mode];
387 } else { /* special defines for FIBER (88E1040S only) */ 405 } else { /* special defines for FIBER (88E1040S only) */
388 if (sky2->advertising & ADVERTISED_1000baseT_Full) 406 if (sky2->advertising & ADVERTISED_1000baseT_Full)
389 adv |= PHY_M_AN_1000X_AFD; 407 adv |= PHY_M_AN_1000X_AFD;
390 if (sky2->advertising & ADVERTISED_1000baseT_Half) 408 if (sky2->advertising & ADVERTISED_1000baseT_Half)
391 adv |= PHY_M_AN_1000X_AHD; 409 adv |= PHY_M_AN_1000X_AHD;
392 }
393 410
394 /* Set Flow-control capabilities */ 411 adv |= fiber_fc_adv[sky2->flow_mode];
395 if (sky2->tx_pause && sky2->rx_pause) 412 }
396 adv |= PHY_AN_PAUSE_CAP; /* symmetric */
397 else if (sky2->rx_pause && !sky2->tx_pause)
398 adv |= PHY_AN_PAUSE_ASYM | PHY_AN_PAUSE_CAP;
399 else if (!sky2->rx_pause && sky2->tx_pause)
400 adv |= PHY_AN_PAUSE_ASYM; /* local */
401 413
402 /* Restart Auto-negotiation */ 414 /* Restart Auto-negotiation */
403 ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG; 415 ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG;
@@ -422,25 +434,17 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
422 if (sky2->duplex == DUPLEX_FULL) { 434 if (sky2->duplex == DUPLEX_FULL) {
423 reg |= GM_GPCR_DUP_FULL; 435 reg |= GM_GPCR_DUP_FULL;
424 ctrl |= PHY_CT_DUP_MD; 436 ctrl |= PHY_CT_DUP_MD;
425 } else if (sky2->speed != SPEED_1000 && hw->chip_id != CHIP_ID_YUKON_EC_U) { 437 } else if (sky2->speed < SPEED_1000)
426 /* Turn off flow control for 10/100mbps */ 438 sky2->flow_mode = FC_NONE;
427 sky2->rx_pause = 0;
428 sky2->tx_pause = 0;
429 }
430 439
431 if (!sky2->rx_pause)
432 reg |= GM_GPCR_FC_RX_DIS;
433 440
434 if (!sky2->tx_pause) 441 reg |= gm_fc_disable[sky2->flow_mode];
435 reg |= GM_GPCR_FC_TX_DIS;
436 442
437 /* Forward pause packets to GMAC? */ 443 /* Forward pause packets to GMAC? */
438 if (sky2->tx_pause || sky2->rx_pause) 444 if (sky2->flow_mode & FC_RX)
439 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); 445 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON);
440 else 446 else
441 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 447 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
442
443 ctrl |= PHY_CT_RESET;
444 } 448 }
445 449
446 gma_write16(hw, port, GM_GP_CTRL, reg); 450 gma_write16(hw, port, GM_GP_CTRL, reg);
@@ -695,16 +699,10 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
695 699
696} 700}
697 701
698/* Assign Ram Buffer allocation. 702/* Assign Ram Buffer allocation in units of 64bit (8 bytes) */
699 * start and end are in units of 4k bytes 703static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
700 * ram registers are in units of 64bit words
701 */
702static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
703{ 704{
704 u32 start, end; 705 pr_debug(PFX "q %d %#x %#x\n", q, start, end);
705
706 start = startk * 4096/8;
707 end = (endk * 4096/8) - 1;
708 706
709 sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); 707 sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
710 sky2_write32(hw, RB_ADDR(q, RB_START), start); 708 sky2_write32(hw, RB_ADDR(q, RB_START), start);
@@ -713,7 +711,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
713 sky2_write32(hw, RB_ADDR(q, RB_RP), start); 711 sky2_write32(hw, RB_ADDR(q, RB_RP), start);
714 712
715 if (q == Q_R1 || q == Q_R2) { 713 if (q == Q_R1 || q == Q_R2) {
716 u32 space = (endk - startk) * 4096/8; 714 u32 space = end - start + 1;
717 u32 tp = space - space/4; 715 u32 tp = space - space/4;
718 716
719 /* On receive queue's set the thresholds 717 /* On receive queue's set the thresholds
@@ -1195,19 +1193,16 @@ static int sky2_up(struct net_device *dev)
1195 1193
1196 sky2_mac_init(hw, port); 1194 sky2_mac_init(hw, port);
1197 1195
1198 /* Determine available ram buffer space (in 4K blocks). 1196 /* Determine available ram buffer space in qwords. */
1199 * Note: not sure about the FE setting below yet 1197 ramsize = sky2_read8(hw, B2_E_0) * 4096/8;
1200 */
1201 if (hw->chip_id == CHIP_ID_YUKON_FE)
1202 ramsize = 4;
1203 else
1204 ramsize = sky2_read8(hw, B2_E_0);
1205 1198
1206 /* Give transmitter one third (rounded up) */ 1199 if (ramsize > 6*1024/8)
1207 rxspace = ramsize - (ramsize + 2) / 3; 1200 rxspace = ramsize - (ramsize + 2) / 3;
1201 else
1202 rxspace = ramsize / 2;
1208 1203
1209 sky2_ramset(hw, rxqaddr[port], 0, rxspace); 1204 sky2_ramset(hw, rxqaddr[port], 0, rxspace-1);
1210 sky2_ramset(hw, txqaddr[port], rxspace, ramsize); 1205 sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1);
1211 1206
1212 /* Make sure SyncQ is disabled */ 1207 /* Make sure SyncQ is disabled */
1213 sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL), 1208 sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
@@ -1499,6 +1494,11 @@ static int sky2_down(struct net_device *dev)
1499 /* Stop more packets from being queued */ 1494 /* Stop more packets from being queued */
1500 netif_stop_queue(dev); 1495 netif_stop_queue(dev);
1501 1496
1497 /* Disable port IRQ */
1498 imask = sky2_read32(hw, B0_IMSK);
1499 imask &= ~portirq_msk[port];
1500 sky2_write32(hw, B0_IMSK, imask);
1501
1502 sky2_gmac_reset(hw, port); 1502 sky2_gmac_reset(hw, port);
1503 1503
1504 /* Stop transmitter */ 1504 /* Stop transmitter */
@@ -1549,11 +1549,6 @@ static int sky2_down(struct net_device *dev)
1549 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 1549 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
1550 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 1550 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
1551 1551
1552 /* Disable port IRQ */
1553 imask = sky2_read32(hw, B0_IMSK);
1554 imask &= ~portirq_msk[port];
1555 sky2_write32(hw, B0_IMSK, imask);
1556
1557 sky2_phy_power(hw, port, 0); 1552 sky2_phy_power(hw, port, 0);
1558 1553
1559 /* turn off LED's */ 1554 /* turn off LED's */
@@ -1605,6 +1600,12 @@ static void sky2_link_up(struct sky2_port *sky2)
1605 struct sky2_hw *hw = sky2->hw; 1600 struct sky2_hw *hw = sky2->hw;
1606 unsigned port = sky2->port; 1601 unsigned port = sky2->port;
1607 u16 reg; 1602 u16 reg;
1603 static const char *fc_name[] = {
1604 [FC_NONE] = "none",
1605 [FC_TX] = "tx",
1606 [FC_RX] = "rx",
1607 [FC_BOTH] = "both",
1608 };
1608 1609
1609 /* enable Rx/Tx */ 1610 /* enable Rx/Tx */
1610 reg = gma_read16(hw, port, GM_GP_CTRL); 1611 reg = gma_read16(hw, port, GM_GP_CTRL);
@@ -1648,8 +1649,7 @@ static void sky2_link_up(struct sky2_port *sky2)
1648 "%s: Link is up at %d Mbps, %s duplex, flow control %s\n", 1649 "%s: Link is up at %d Mbps, %s duplex, flow control %s\n",
1649 sky2->netdev->name, sky2->speed, 1650 sky2->netdev->name, sky2->speed,
1650 sky2->duplex == DUPLEX_FULL ? "full" : "half", 1651 sky2->duplex == DUPLEX_FULL ? "full" : "half",
1651 (sky2->tx_pause && sky2->rx_pause) ? "both" : 1652 fc_name[sky2->flow_status]);
1652 sky2->tx_pause ? "tx" : sky2->rx_pause ? "rx" : "none");
1653} 1653}
1654 1654
1655static void sky2_link_down(struct sky2_port *sky2) 1655static void sky2_link_down(struct sky2_port *sky2)
@@ -1664,7 +1664,7 @@ static void sky2_link_down(struct sky2_port *sky2)
1664 reg &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); 1664 reg &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
1665 gma_write16(hw, port, GM_GP_CTRL, reg); 1665 gma_write16(hw, port, GM_GP_CTRL, reg);
1666 1666
1667 if (sky2->rx_pause && !sky2->tx_pause) { 1667 if (sky2->flow_status == FC_RX) {
1668 /* restore Asymmetric Pause bit */ 1668 /* restore Asymmetric Pause bit */
1669 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, 1669 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV,
1670 gm_phy_read(hw, port, PHY_MARV_AUNE_ADV) 1670 gm_phy_read(hw, port, PHY_MARV_AUNE_ADV)
@@ -1683,6 +1683,14 @@ static void sky2_link_down(struct sky2_port *sky2)
1683 sky2_phy_init(hw, port); 1683 sky2_phy_init(hw, port);
1684} 1684}
1685 1685
1686static enum flow_control sky2_flow(int rx, int tx)
1687{
1688 if (rx)
1689 return tx ? FC_BOTH : FC_RX;
1690 else
1691 return tx ? FC_TX : FC_NONE;
1692}
1693
1686static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux) 1694static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1687{ 1695{
1688 struct sky2_hw *hw = sky2->hw; 1696 struct sky2_hw *hw = sky2->hw;
@@ -1703,39 +1711,20 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1703 } 1711 }
1704 1712
1705 sky2->speed = sky2_phy_speed(hw, aux); 1713 sky2->speed = sky2_phy_speed(hw, aux);
1706 if (sky2->speed == SPEED_1000) { 1714 sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
1707 u16 ctl2 = gm_phy_read(hw, port, PHY_MARV_1000T_CTRL);
1708 u16 lpa2 = gm_phy_read(hw, port, PHY_MARV_1000T_STAT);
1709 if (lpa2 & PHY_B_1000S_MSF) {
1710 printk(KERN_ERR PFX "%s: master/slave fault",
1711 sky2->netdev->name);
1712 return -1;
1713 }
1714
1715 if ((ctl2 & PHY_M_1000C_AFD) && (lpa2 & PHY_B_1000S_LP_FD))
1716 sky2->duplex = DUPLEX_FULL;
1717 else
1718 sky2->duplex = DUPLEX_HALF;
1719 } else {
1720 u16 adv = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
1721 if ((aux & adv) & PHY_AN_FULL)
1722 sky2->duplex = DUPLEX_FULL;
1723 else
1724 sky2->duplex = DUPLEX_HALF;
1725 }
1726 1715
1727 /* Pause bits are offset (9..8) */ 1716 /* Pause bits are offset (9..8) */
1728 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) 1717 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)
1729 aux >>= 6; 1718 aux >>= 6;
1730 1719
1731 sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0; 1720 sky2->flow_status = sky2_flow(aux & PHY_M_PS_RX_P_EN,
1732 sky2->tx_pause = (aux & PHY_M_PS_TX_P_EN) != 0; 1721 aux & PHY_M_PS_TX_P_EN);
1733 1722
1734 if (sky2->duplex == DUPLEX_HALF && sky2->speed != SPEED_1000 1723 if (sky2->duplex == DUPLEX_HALF && sky2->speed < SPEED_1000
1735 && hw->chip_id != CHIP_ID_YUKON_EC_U) 1724 && hw->chip_id != CHIP_ID_YUKON_EC_U)
1736 sky2->rx_pause = sky2->tx_pause = 0; 1725 sky2->flow_status = FC_NONE;
1737 1726
1738 if (sky2->rx_pause || sky2->tx_pause) 1727 if (aux & PHY_M_PS_RX_P_EN)
1739 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); 1728 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON);
1740 else 1729 else
1741 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1730 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
@@ -1750,13 +1739,13 @@ static void sky2_phy_intr(struct sky2_hw *hw, unsigned port)
1750 struct sky2_port *sky2 = netdev_priv(dev); 1739 struct sky2_port *sky2 = netdev_priv(dev);
1751 u16 istatus, phystat; 1740 u16 istatus, phystat;
1752 1741
1742 if (!netif_running(dev))
1743 return;
1744
1753 spin_lock(&sky2->phy_lock); 1745 spin_lock(&sky2->phy_lock);
1754 istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT); 1746 istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT);
1755 phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT); 1747 phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT);
1756 1748
1757 if (!netif_running(dev))
1758 goto out;
1759
1760 if (netif_msg_intr(sky2)) 1749 if (netif_msg_intr(sky2))
1761 printk(KERN_INFO PFX "%s: phy interrupt status 0x%x 0x%x\n", 1750 printk(KERN_INFO PFX "%s: phy interrupt status 0x%x 0x%x\n",
1762 sky2->netdev->name, istatus, phystat); 1751 sky2->netdev->name, istatus, phystat);
@@ -2016,6 +2005,10 @@ oversize:
2016 2005
2017error: 2006error:
2018 ++sky2->net_stats.rx_errors; 2007 ++sky2->net_stats.rx_errors;
2008 if (status & GMR_FS_RX_FF_OV) {
2009 sky2->net_stats.rx_fifo_errors++;
2010 goto resubmit;
2011 }
2019 2012
2020 if (netif_msg_rx_err(sky2) && net_ratelimit()) 2013 if (netif_msg_rx_err(sky2) && net_ratelimit())
2021 printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n", 2014 printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n",
@@ -2027,8 +2020,6 @@ error:
2027 sky2->net_stats.rx_frame_errors++; 2020 sky2->net_stats.rx_frame_errors++;
2028 if (status & GMR_FS_CRC_ERR) 2021 if (status & GMR_FS_CRC_ERR)
2029 sky2->net_stats.rx_crc_errors++; 2022 sky2->net_stats.rx_crc_errors++;
2030 if (status & GMR_FS_RX_FF_OV)
2031 sky2->net_stats.rx_fifo_errors++;
2032 2023
2033 goto resubmit; 2024 goto resubmit;
2034} 2025}
@@ -2748,7 +2739,7 @@ static int sky2_nway_reset(struct net_device *dev)
2748{ 2739{
2749 struct sky2_port *sky2 = netdev_priv(dev); 2740 struct sky2_port *sky2 = netdev_priv(dev);
2750 2741
2751 if (sky2->autoneg != AUTONEG_ENABLE) 2742 if (!netif_running(dev) || sky2->autoneg != AUTONEG_ENABLE)
2752 return -EINVAL; 2743 return -EINVAL;
2753 2744
2754 sky2_phy_reinit(sky2); 2745 sky2_phy_reinit(sky2);
@@ -2850,6 +2841,14 @@ static int sky2_set_mac_address(struct net_device *dev, void *p)
2850 return 0; 2841 return 0;
2851} 2842}
2852 2843
2844static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
2845{
2846 u32 bit;
2847
2848 bit = ether_crc(ETH_ALEN, addr) & 63;
2849 filter[bit >> 3] |= 1 << (bit & 7);
2850}
2851
2853static void sky2_set_multicast(struct net_device *dev) 2852static void sky2_set_multicast(struct net_device *dev)
2854{ 2853{
2855 struct sky2_port *sky2 = netdev_priv(dev); 2854 struct sky2_port *sky2 = netdev_priv(dev);
@@ -2858,7 +2857,10 @@ static void sky2_set_multicast(struct net_device *dev)
2858 struct dev_mc_list *list = dev->mc_list; 2857 struct dev_mc_list *list = dev->mc_list;
2859 u16 reg; 2858 u16 reg;
2860 u8 filter[8]; 2859 u8 filter[8];
2860 int rx_pause;
2861 static const u8 pause_mc_addr[ETH_ALEN] = { 0x1, 0x80, 0xc2, 0x0, 0x0, 0x1 };
2861 2862
2863 rx_pause = (sky2->flow_status == FC_RX || sky2->flow_status == FC_BOTH);
2862 memset(filter, 0, sizeof(filter)); 2864 memset(filter, 0, sizeof(filter));
2863 2865
2864 reg = gma_read16(hw, port, GM_RX_CTRL); 2866 reg = gma_read16(hw, port, GM_RX_CTRL);
@@ -2866,18 +2868,19 @@ static void sky2_set_multicast(struct net_device *dev)
2866 2868
2867 if (dev->flags & IFF_PROMISC) /* promiscuous */ 2869 if (dev->flags & IFF_PROMISC) /* promiscuous */
2868 reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); 2870 reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
2869 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 16) /* all multicast */ 2871 else if (dev->flags & IFF_ALLMULTI)
2870 memset(filter, 0xff, sizeof(filter)); 2872 memset(filter, 0xff, sizeof(filter));
2871 else if (dev->mc_count == 0) /* no multicast */ 2873 else if (dev->mc_count == 0 && !rx_pause)
2872 reg &= ~GM_RXCR_MCF_ENA; 2874 reg &= ~GM_RXCR_MCF_ENA;
2873 else { 2875 else {
2874 int i; 2876 int i;
2875 reg |= GM_RXCR_MCF_ENA; 2877 reg |= GM_RXCR_MCF_ENA;
2876 2878
2877 for (i = 0; list && i < dev->mc_count; i++, list = list->next) { 2879 if (rx_pause)
2878 u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f; 2880 sky2_add_filter(filter, pause_mc_addr);
2879 filter[bit / 8] |= 1 << (bit % 8); 2881
2880 } 2882 for (i = 0; list && i < dev->mc_count; i++, list = list->next)
2883 sky2_add_filter(filter, list->dmi_addr);
2881 } 2884 }
2882 2885
2883 gma_write16(hw, port, GM_MC_ADDR_H1, 2886 gma_write16(hw, port, GM_MC_ADDR_H1,
@@ -2990,8 +2993,20 @@ static void sky2_get_pauseparam(struct net_device *dev,
2990{ 2993{
2991 struct sky2_port *sky2 = netdev_priv(dev); 2994 struct sky2_port *sky2 = netdev_priv(dev);
2992 2995
2993 ecmd->tx_pause = sky2->tx_pause; 2996 switch (sky2->flow_mode) {
2994 ecmd->rx_pause = sky2->rx_pause; 2997 case FC_NONE:
2998 ecmd->tx_pause = ecmd->rx_pause = 0;
2999 break;
3000 case FC_TX:
3001 ecmd->tx_pause = 1, ecmd->rx_pause = 0;
3002 break;
3003 case FC_RX:
3004 ecmd->tx_pause = 0, ecmd->rx_pause = 1;
3005 break;
3006 case FC_BOTH:
3007 ecmd->tx_pause = ecmd->rx_pause = 1;
3008 }
3009
2995 ecmd->autoneg = sky2->autoneg; 3010 ecmd->autoneg = sky2->autoneg;
2996} 3011}
2997 3012
@@ -3001,10 +3016,10 @@ static int sky2_set_pauseparam(struct net_device *dev,
3001 struct sky2_port *sky2 = netdev_priv(dev); 3016 struct sky2_port *sky2 = netdev_priv(dev);
3002 3017
3003 sky2->autoneg = ecmd->autoneg; 3018 sky2->autoneg = ecmd->autoneg;
3004 sky2->tx_pause = ecmd->tx_pause != 0; 3019 sky2->flow_mode = sky2_flow(ecmd->rx_pause, ecmd->tx_pause);
3005 sky2->rx_pause = ecmd->rx_pause != 0;
3006 3020
3007 sky2_phy_reinit(sky2); 3021 if (netif_running(dev))
3022 sky2_phy_reinit(sky2);
3008 3023
3009 return 0; 3024 return 0;
3010} 3025}
@@ -3234,8 +3249,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3234 3249
3235 /* Auto speed and flow control */ 3250 /* Auto speed and flow control */
3236 sky2->autoneg = AUTONEG_ENABLE; 3251 sky2->autoneg = AUTONEG_ENABLE;
3237 sky2->tx_pause = 1; 3252 sky2->flow_mode = FC_BOTH;
3238 sky2->rx_pause = 1; 3253
3239 sky2->duplex = -1; 3254 sky2->duplex = -1;
3240 sky2->speed = -1; 3255 sky2->speed = -1;
3241 sky2->advertising = sky2_supported_modes(hw); 3256 sky2->advertising = sky2_supported_modes(hw);
@@ -3326,9 +3341,8 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
3326 3341
3327 if (!hw->msi_detected) { 3342 if (!hw->msi_detected) {
3328 /* MSI test failed, go back to INTx mode */ 3343 /* MSI test failed, go back to INTx mode */
3329 printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, " 3344 printk(KERN_INFO PFX "%s: No interrupt generated using MSI, "
3330 "switching to INTx mode. Please report this failure to " 3345 "switching to INTx mode.\n",
3331 "the PCI maintainer and include system chipset information.\n",
3332 pci_name(pdev)); 3346 pci_name(pdev));
3333 3347
3334 err = -EOPNOTSUPP; 3348 err = -EOPNOTSUPP;
@@ -3336,6 +3350,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
3336 } 3350 }
3337 3351
3338 sky2_write32(hw, B0_IMSK, 0); 3352 sky2_write32(hw, B0_IMSK, 0);
3353 sky2_read32(hw, B0_IMSK);
3339 3354
3340 free_irq(pdev->irq, hw); 3355 free_irq(pdev->irq, hw);
3341 3356
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 43d2accf60e1..6d2a23f66c9a 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1576,7 +1576,7 @@ enum {
1576 1576
1577 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR | 1577 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR |
1578 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR | 1578 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR |
1579 GMR_FS_MII_ERR | GMR_FS_BAD_FC | 1579 GMR_FS_MII_ERR | GMR_FS_GOOD_FC | GMR_FS_BAD_FC |
1580 GMR_FS_UN_SIZE | GMR_FS_JABBER, 1580 GMR_FS_UN_SIZE | GMR_FS_JABBER,
1581}; 1581};
1582 1582
@@ -1828,6 +1828,13 @@ struct rx_ring_info {
1828 dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT]; 1828 dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
1829}; 1829};
1830 1830
1831enum flow_control {
1832 FC_NONE = 0,
1833 FC_TX = 1,
1834 FC_RX = 2,
1835 FC_BOTH = 3,
1836};
1837
1831struct sky2_port { 1838struct sky2_port {
1832 struct sky2_hw *hw; 1839 struct sky2_hw *hw;
1833 struct net_device *netdev; 1840 struct net_device *netdev;
@@ -1860,13 +1867,13 @@ struct sky2_port {
1860 1867
1861 dma_addr_t rx_le_map; 1868 dma_addr_t rx_le_map;
1862 dma_addr_t tx_le_map; 1869 dma_addr_t tx_le_map;
1863 u32 advertising; /* ADVERTISED_ bits */ 1870 u16 advertising; /* ADVERTISED_ bits */
1864 u16 speed; /* SPEED_1000, SPEED_100, ... */ 1871 u16 speed; /* SPEED_1000, SPEED_100, ... */
1865 u8 autoneg; /* AUTONEG_ENABLE, AUTONEG_DISABLE */ 1872 u8 autoneg; /* AUTONEG_ENABLE, AUTONEG_DISABLE */
1866 u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ 1873 u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */
1867 u8 rx_pause;
1868 u8 tx_pause;
1869 u8 rx_csum; 1874 u8 rx_csum;
1875 enum flow_control flow_mode;
1876 enum flow_control flow_status;
1870 1877
1871 struct net_device_stats net_stats; 1878 struct net_device_stats net_stats;
1872 1879
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 0c9f1e7dab2e..a8640169fc77 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -416,6 +416,24 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
416 416
417#define SMC_IRQ_FLAGS (0) 417#define SMC_IRQ_FLAGS (0)
418 418
419#elif defined(CONFIG_ARCH_VERSATILE)
420
421#define SMC_CAN_USE_8BIT 1
422#define SMC_CAN_USE_16BIT 1
423#define SMC_CAN_USE_32BIT 1
424#define SMC_NOWAIT 1
425
426#define SMC_inb(a, r) readb((a) + (r))
427#define SMC_inw(a, r) readw((a) + (r))
428#define SMC_inl(a, r) readl((a) + (r))
429#define SMC_outb(v, a, r) writeb(v, (a) + (r))
430#define SMC_outw(v, a, r) writew(v, (a) + (r))
431#define SMC_outl(v, a, r) writel(v, (a) + (r))
432#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
433#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
434
435#define SMC_IRQ_FLAGS (0)
436
419#else 437#else
420 438
421#define SMC_CAN_USE_8BIT 1 439#define SMC_CAN_USE_8BIT 1
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 6439b0cef1e4..18f88853e1e5 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -42,7 +42,7 @@
42#define DRV_RELDATE "11/24/03" 42#define DRV_RELDATE "11/24/03"
43#define DRV_AUTHOR "David S. Miller (davem@redhat.com)" 43#define DRV_AUTHOR "David S. Miller (davem@redhat.com)"
44 44
45static char version[] __initdata = 45static char version[] =
46 DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " " DRV_AUTHOR "\n"; 46 DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " " DRV_AUTHOR "\n";
47 47
48MODULE_VERSION(DRV_VERSION); 48MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 327836b1014e..8e398499c045 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.66" 71#define DRV_MODULE_VERSION "3.67"
72#define DRV_MODULE_RELDATE "September 23, 2006" 72#define DRV_MODULE_RELDATE "October 18, 2006"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -129,7 +129,7 @@
129#define RX_JUMBO_PKT_BUF_SZ (9046 + tp->rx_offset + 64) 129#define RX_JUMBO_PKT_BUF_SZ (9046 + tp->rx_offset + 64)
130 130
131/* minimum number of free TX descriptors required to wake up TX process */ 131/* minimum number of free TX descriptors required to wake up TX process */
132#define TG3_TX_WAKEUP_THRESH (TG3_TX_RING_SIZE / 4) 132#define TG3_TX_WAKEUP_THRESH(tp) ((tp)->tx_pending / 4)
133 133
134/* number of ETHTOOL_GSTATS u64's */ 134/* number of ETHTOOL_GSTATS u64's */
135#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64)) 135#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64))
@@ -3075,10 +3075,10 @@ static void tg3_tx(struct tg3 *tp)
3075 smp_mb(); 3075 smp_mb();
3076 3076
3077 if (unlikely(netif_queue_stopped(tp->dev) && 3077 if (unlikely(netif_queue_stopped(tp->dev) &&
3078 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH))) { 3078 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))) {
3079 netif_tx_lock(tp->dev); 3079 netif_tx_lock(tp->dev);
3080 if (netif_queue_stopped(tp->dev) && 3080 if (netif_queue_stopped(tp->dev) &&
3081 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH)) 3081 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))
3082 netif_wake_queue(tp->dev); 3082 netif_wake_queue(tp->dev);
3083 netif_tx_unlock(tp->dev); 3083 netif_tx_unlock(tp->dev);
3084 } 3084 }
@@ -3928,7 +3928,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3928 tp->tx_prod = entry; 3928 tp->tx_prod = entry;
3929 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { 3929 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) {
3930 netif_stop_queue(dev); 3930 netif_stop_queue(dev);
3931 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) 3931 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp))
3932 netif_wake_queue(tp->dev); 3932 netif_wake_queue(tp->dev);
3933 } 3933 }
3934 3934
@@ -4143,7 +4143,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4143 tp->tx_prod = entry; 4143 tp->tx_prod = entry;
4144 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { 4144 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) {
4145 netif_stop_queue(dev); 4145 netif_stop_queue(dev);
4146 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) 4146 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp))
4147 netif_wake_queue(tp->dev); 4147 netif_wake_queue(tp->dev);
4148 } 4148 }
4149 4149
@@ -8106,7 +8106,10 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
8106 8106
8107 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 8107 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
8108 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 8108 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
8109 (ering->tx_pending > TG3_TX_RING_SIZE - 1)) 8109 (ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
8110 (ering->tx_pending <= MAX_SKB_FRAGS) ||
8111 ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_1_BUG) &&
8112 (ering->tx_pending <= (MAX_SKB_FRAGS * 3))))
8110 return -EINVAL; 8113 return -EINVAL;
8111 8114
8112 if (netif_running(dev)) { 8115 if (netif_running(dev)) {
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 12cd7b561f35..b37888011067 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2,14 +2,11 @@
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
3 * 3 *
4 * Author: Shlomi Gridish <gridish@freescale.com> 4 * Author: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
5 * 6 *
6 * Description: 7 * Description:
7 * QE UCC Gigabit Ethernet Driver 8 * QE UCC Gigabit Ethernet Driver
8 * 9 *
9 * Changelog:
10 * Jul 6, 2006 Li Yang <LeoLi@freescale.com>
11 * - Rearrange code and style fixes
12 *
13 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the 11 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your 12 * Free Software Foundation; either version 2 of the License, or (at your
@@ -31,9 +28,9 @@
31#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
32#include <linux/fsl_devices.h> 29#include <linux/fsl_devices.h>
33#include <linux/ethtool.h> 30#include <linux/ethtool.h>
34#include <linux/platform_device.h>
35#include <linux/mii.h> 31#include <linux/mii.h>
36 32
33#include <asm/of_device.h>
37#include <asm/uaccess.h> 34#include <asm/uaccess.h>
38#include <asm/irq.h> 35#include <asm/irq.h>
39#include <asm/io.h> 36#include <asm/io.h>
@@ -70,7 +67,7 @@
70 67
71static DEFINE_SPINLOCK(ugeth_lock); 68static DEFINE_SPINLOCK(ugeth_lock);
72 69
73static ucc_geth_info_t ugeth_primary_info = { 70static struct ucc_geth_info ugeth_primary_info = {
74 .uf_info = { 71 .uf_info = {
75 .bd_mem_part = MEM_PART_SYSTEM, 72 .bd_mem_part = MEM_PART_SYSTEM,
76 .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, 73 .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES,
@@ -163,7 +160,7 @@ static ucc_geth_info_t ugeth_primary_info = {
163 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, 160 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
164}; 161};
165 162
166static ucc_geth_info_t ugeth_info[8]; 163static struct ucc_geth_info ugeth_info[8];
167 164
168#ifdef DEBUG 165#ifdef DEBUG
169static void mem_disp(u8 *addr, int size) 166static void mem_disp(u8 *addr, int size)
@@ -219,8 +216,8 @@ static struct list_head *dequeue(struct list_head *lh)
219 } 216 }
220} 217}
221 218
222static int get_interface_details(enet_interface_e enet_interface, 219static int get_interface_details(enum enet_interface enet_interface,
223 enet_speed_e *speed, 220 enum enet_speed *speed,
224 int *r10m, 221 int *r10m,
225 int *rmm, 222 int *rmm,
226 int *rpm, 223 int *rpm,
@@ -283,7 +280,7 @@ static int get_interface_details(enet_interface_e enet_interface,
283 return 0; 280 return 0;
284} 281}
285 282
286static struct sk_buff *get_new_skb(ucc_geth_private_t *ugeth, u8 *bd) 283static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, u8 *bd)
287{ 284{
288 struct sk_buff *skb = NULL; 285 struct sk_buff *skb = NULL;
289 286
@@ -303,21 +300,19 @@ static struct sk_buff *get_new_skb(ucc_geth_private_t *ugeth, u8 *bd)
303 300
304 skb->dev = ugeth->dev; 301 skb->dev = ugeth->dev;
305 302
306 BD_BUFFER_SET(bd, 303 out_be32(&((struct qe_bd *)bd)->buf,
307 dma_map_single(NULL, 304 dma_map_single(NULL,
308 skb->data, 305 skb->data,
309 ugeth->ug_info->uf_info.max_rx_buf_length + 306 ugeth->ug_info->uf_info.max_rx_buf_length +
310 UCC_GETH_RX_DATA_BUF_ALIGNMENT, 307 UCC_GETH_RX_DATA_BUF_ALIGNMENT,
311 DMA_FROM_DEVICE)); 308 DMA_FROM_DEVICE));
312 309
313 BD_STATUS_AND_LENGTH_SET(bd, 310 out_be32((u32 *)bd, (R_E | R_I | (in_be32((u32 *)bd) & R_W)));
314 (R_E | R_I |
315 (BD_STATUS_AND_LENGTH(bd) & R_W)));
316 311
317 return skb; 312 return skb;
318} 313}
319 314
320static int rx_bd_buffer_set(ucc_geth_private_t *ugeth, u8 rxQ) 315static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ)
321{ 316{
322 u8 *bd; 317 u8 *bd;
323 u32 bd_status; 318 u32 bd_status;
@@ -328,7 +323,7 @@ static int rx_bd_buffer_set(ucc_geth_private_t *ugeth, u8 rxQ)
328 i = 0; 323 i = 0;
329 324
330 do { 325 do {
331 bd_status = BD_STATUS_AND_LENGTH(bd); 326 bd_status = in_be32((u32*)bd);
332 skb = get_new_skb(ugeth, bd); 327 skb = get_new_skb(ugeth, bd);
333 328
334 if (!skb) /* If can not allocate data buffer, 329 if (!skb) /* If can not allocate data buffer,
@@ -338,19 +333,19 @@ static int rx_bd_buffer_set(ucc_geth_private_t *ugeth, u8 rxQ)
338 ugeth->rx_skbuff[rxQ][i] = skb; 333 ugeth->rx_skbuff[rxQ][i] = skb;
339 334
340 /* advance the BD pointer */ 335 /* advance the BD pointer */
341 bd += UCC_GETH_SIZE_OF_BD; 336 bd += sizeof(struct qe_bd);
342 i++; 337 i++;
343 } while (!(bd_status & R_W)); 338 } while (!(bd_status & R_W));
344 339
345 return 0; 340 return 0;
346} 341}
347 342
348static int fill_init_enet_entries(ucc_geth_private_t *ugeth, 343static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
349 volatile u32 *p_start, 344 volatile u32 *p_start,
350 u8 num_entries, 345 u8 num_entries,
351 u32 thread_size, 346 u32 thread_size,
352 u32 thread_alignment, 347 u32 thread_alignment,
353 qe_risc_allocation_e risc, 348 enum qe_risc_allocation risc,
354 int skip_page_for_first_entry) 349 int skip_page_for_first_entry)
355{ 350{
356 u32 init_enet_offset; 351 u32 init_enet_offset;
@@ -383,10 +378,10 @@ static int fill_init_enet_entries(ucc_geth_private_t *ugeth,
383 return 0; 378 return 0;
384} 379}
385 380
386static int return_init_enet_entries(ucc_geth_private_t *ugeth, 381static int return_init_enet_entries(struct ucc_geth_private *ugeth,
387 volatile u32 *p_start, 382 volatile u32 *p_start,
388 u8 num_entries, 383 u8 num_entries,
389 qe_risc_allocation_e risc, 384 enum qe_risc_allocation risc,
390 int skip_page_for_first_entry) 385 int skip_page_for_first_entry)
391{ 386{
392 u32 init_enet_offset; 387 u32 init_enet_offset;
@@ -416,11 +411,11 @@ static int return_init_enet_entries(ucc_geth_private_t *ugeth,
416} 411}
417 412
418#ifdef DEBUG 413#ifdef DEBUG
419static int dump_init_enet_entries(ucc_geth_private_t *ugeth, 414static int dump_init_enet_entries(struct ucc_geth_private *ugeth,
420 volatile u32 *p_start, 415 volatile u32 *p_start,
421 u8 num_entries, 416 u8 num_entries,
422 u32 thread_size, 417 u32 thread_size,
423 qe_risc_allocation_e risc, 418 enum qe_risc_allocation risc,
424 int skip_page_for_first_entry) 419 int skip_page_for_first_entry)
425{ 420{
426 u32 init_enet_offset; 421 u32 init_enet_offset;
@@ -456,14 +451,14 @@ static int dump_init_enet_entries(ucc_geth_private_t *ugeth,
456#endif 451#endif
457 452
458#ifdef CONFIG_UGETH_FILTERING 453#ifdef CONFIG_UGETH_FILTERING
459static enet_addr_container_t *get_enet_addr_container(void) 454static struct enet_addr_container *get_enet_addr_container(void)
460{ 455{
461 enet_addr_container_t *enet_addr_cont; 456 struct enet_addr_container *enet_addr_cont;
462 457
463 /* allocate memory */ 458 /* allocate memory */
464 enet_addr_cont = kmalloc(sizeof(enet_addr_container_t), GFP_KERNEL); 459 enet_addr_cont = kmalloc(sizeof(struct enet_addr_container), GFP_KERNEL);
465 if (!enet_addr_cont) { 460 if (!enet_addr_cont) {
466 ugeth_err("%s: No memory for enet_addr_container_t object.", 461 ugeth_err("%s: No memory for enet_addr_container object.",
467 __FUNCTION__); 462 __FUNCTION__);
468 return NULL; 463 return NULL;
469 } 464 }
@@ -472,45 +467,43 @@ static enet_addr_container_t *get_enet_addr_container(void)
472} 467}
473#endif /* CONFIG_UGETH_FILTERING */ 468#endif /* CONFIG_UGETH_FILTERING */
474 469
475static void put_enet_addr_container(enet_addr_container_t *enet_addr_cont) 470static void put_enet_addr_container(struct enet_addr_container *enet_addr_cont)
476{ 471{
477 kfree(enet_addr_cont); 472 kfree(enet_addr_cont);
478} 473}
479 474
475static int set_mac_addr(__be16 __iomem *reg, u8 *mac)
476{
477 out_be16(&reg[0], ((u16)mac[5] << 8) | mac[4]);
478 out_be16(&reg[1], ((u16)mac[3] << 8) | mac[2]);
479 out_be16(&reg[2], ((u16)mac[1] << 8) | mac[0]);
480}
481
480#ifdef CONFIG_UGETH_FILTERING 482#ifdef CONFIG_UGETH_FILTERING
481static int hw_add_addr_in_paddr(ucc_geth_private_t *ugeth, 483static int hw_add_addr_in_paddr(struct ucc_geth_private *ugeth,
482 enet_addr_t *p_enet_addr, u8 paddr_num) 484 u8 *p_enet_addr, u8 paddr_num)
483{ 485{
484 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 486 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
485 487
486 if (!(paddr_num < NUM_OF_PADDRS)) { 488 if (!(paddr_num < NUM_OF_PADDRS)) {
487 ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); 489 ugeth_warn("%s: Illegal paddr_num.", __FUNCTION__);
488 return -EINVAL; 490 return -EINVAL;
489 } 491 }
490 492
491 p_82xx_addr_filt = 493 p_82xx_addr_filt =
492 (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> 494 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
493 addressfiltering; 495 addressfiltering;
494 496
495 /* Ethernet frames are defined in Little Endian mode, */ 497 /* Ethernet frames are defined in Little Endian mode, */
496 /* therefore to insert the address we reverse the bytes. */ 498 /* therefore to insert the address we reverse the bytes. */
497 out_be16(&p_82xx_addr_filt->paddr[paddr_num].h, 499 set_mac_addr(&p_82xx_addr_filt->paddr[paddr_num].h, p_enet_addr);
498 (u16) (((u16) (((u16) ((*p_enet_addr)[5])) << 8)) |
499 (u16) (*p_enet_addr)[4]));
500 out_be16(&p_82xx_addr_filt->paddr[paddr_num].m,
501 (u16) (((u16) (((u16) ((*p_enet_addr)[3])) << 8)) |
502 (u16) (*p_enet_addr)[2]));
503 out_be16(&p_82xx_addr_filt->paddr[paddr_num].l,
504 (u16) (((u16) (((u16) ((*p_enet_addr)[1])) << 8)) |
505 (u16) (*p_enet_addr)[0]));
506
507 return 0; 500 return 0;
508} 501}
509#endif /* CONFIG_UGETH_FILTERING */ 502#endif /* CONFIG_UGETH_FILTERING */
510 503
511static int hw_clear_addr_in_paddr(ucc_geth_private_t *ugeth, u8 paddr_num) 504static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num)
512{ 505{
513 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 506 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
514 507
515 if (!(paddr_num < NUM_OF_PADDRS)) { 508 if (!(paddr_num < NUM_OF_PADDRS)) {
516 ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); 509 ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__);
@@ -518,7 +511,7 @@ static int hw_clear_addr_in_paddr(ucc_geth_private_t *ugeth, u8 paddr_num)
518 } 511 }
519 512
520 p_82xx_addr_filt = 513 p_82xx_addr_filt =
521 (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> 514 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
522 addressfiltering; 515 addressfiltering;
523 516
524 /* Writing address ff.ff.ff.ff.ff.ff disables address 517 /* Writing address ff.ff.ff.ff.ff.ff disables address
@@ -530,14 +523,14 @@ static int hw_clear_addr_in_paddr(ucc_geth_private_t *ugeth, u8 paddr_num)
530 return 0; 523 return 0;
531} 524}
532 525
533static void hw_add_addr_in_hash(ucc_geth_private_t *ugeth, 526static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
534 enet_addr_t *p_enet_addr) 527 u8 *p_enet_addr)
535{ 528{
536 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 529 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
537 u32 cecr_subblock; 530 u32 cecr_subblock;
538 531
539 p_82xx_addr_filt = 532 p_82xx_addr_filt =
540 (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> 533 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
541 addressfiltering; 534 addressfiltering;
542 535
543 cecr_subblock = 536 cecr_subblock =
@@ -546,25 +539,18 @@ static void hw_add_addr_in_hash(ucc_geth_private_t *ugeth,
546 /* Ethernet frames are defined in Little Endian mode, 539 /* Ethernet frames are defined in Little Endian mode,
547 therefor to insert */ 540 therefor to insert */
548 /* the address to the hash (Big Endian mode), we reverse the bytes.*/ 541 /* the address to the hash (Big Endian mode), we reverse the bytes.*/
549 out_be16(&p_82xx_addr_filt->taddr.h, 542
550 (u16) (((u16) (((u16) ((*p_enet_addr)[5])) << 8)) | 543 set_mac_addr(&p_82xx_addr_filt->taddr.h, p_enet_addr);
551 (u16) (*p_enet_addr)[4]));
552 out_be16(&p_82xx_addr_filt->taddr.m,
553 (u16) (((u16) (((u16) ((*p_enet_addr)[3])) << 8)) |
554 (u16) (*p_enet_addr)[2]));
555 out_be16(&p_82xx_addr_filt->taddr.l,
556 (u16) (((u16) (((u16) ((*p_enet_addr)[1])) << 8)) |
557 (u16) (*p_enet_addr)[0]));
558 544
559 qe_issue_cmd(QE_SET_GROUP_ADDRESS, cecr_subblock, 545 qe_issue_cmd(QE_SET_GROUP_ADDRESS, cecr_subblock,
560 (u8) QE_CR_PROTOCOL_ETHERNET, 0); 546 QE_CR_PROTOCOL_ETHERNET, 0);
561} 547}
562 548
563#ifdef CONFIG_UGETH_MAGIC_PACKET 549#ifdef CONFIG_UGETH_MAGIC_PACKET
564static void magic_packet_detection_enable(ucc_geth_private_t *ugeth) 550static void magic_packet_detection_enable(struct ucc_geth_private *ugeth)
565{ 551{
566 ucc_fast_private_t *uccf; 552 struct ucc_fast_private *uccf;
567 ucc_geth_t *ug_regs; 553 struct ucc_geth *ug_regs;
568 u32 maccfg2, uccm; 554 u32 maccfg2, uccm;
569 555
570 uccf = ugeth->uccf; 556 uccf = ugeth->uccf;
@@ -581,10 +567,10 @@ static void magic_packet_detection_enable(ucc_geth_private_t *ugeth)
581 out_be32(&ug_regs->maccfg2, maccfg2); 567 out_be32(&ug_regs->maccfg2, maccfg2);
582} 568}
583 569
584static void magic_packet_detection_disable(ucc_geth_private_t *ugeth) 570static void magic_packet_detection_disable(struct ucc_geth_private *ugeth)
585{ 571{
586 ucc_fast_private_t *uccf; 572 struct ucc_fast_private *uccf;
587 ucc_geth_t *ug_regs; 573 struct ucc_geth *ug_regs;
588 u32 maccfg2, uccm; 574 u32 maccfg2, uccm;
589 575
590 uccf = ugeth->uccf; 576 uccf = ugeth->uccf;
@@ -602,26 +588,26 @@ static void magic_packet_detection_disable(ucc_geth_private_t *ugeth)
602} 588}
603#endif /* MAGIC_PACKET */ 589#endif /* MAGIC_PACKET */
604 590
605static inline int compare_addr(enet_addr_t *addr1, enet_addr_t *addr2) 591static inline int compare_addr(u8 **addr1, u8 **addr2)
606{ 592{
607 return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS); 593 return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS);
608} 594}
609 595
610#ifdef DEBUG 596#ifdef DEBUG
611static void get_statistics(ucc_geth_private_t *ugeth, 597static void get_statistics(struct ucc_geth_private *ugeth,
612 ucc_geth_tx_firmware_statistics_t * 598 struct ucc_geth_tx_firmware_statistics *
613 tx_firmware_statistics, 599 tx_firmware_statistics,
614 ucc_geth_rx_firmware_statistics_t * 600 struct ucc_geth_rx_firmware_statistics *
615 rx_firmware_statistics, 601 rx_firmware_statistics,
616 ucc_geth_hardware_statistics_t *hardware_statistics) 602 struct ucc_geth_hardware_statistics *hardware_statistics)
617{ 603{
618 ucc_fast_t *uf_regs; 604 struct ucc_fast *uf_regs;
619 ucc_geth_t *ug_regs; 605 struct ucc_geth *ug_regs;
620 ucc_geth_tx_firmware_statistics_pram_t *p_tx_fw_statistics_pram; 606 struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram;
621 ucc_geth_rx_firmware_statistics_pram_t *p_rx_fw_statistics_pram; 607 struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram;
622 608
623 ug_regs = ugeth->ug_regs; 609 ug_regs = ugeth->ug_regs;
624 uf_regs = (ucc_fast_t *) ug_regs; 610 uf_regs = (struct ucc_fast *) ug_regs;
625 p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram; 611 p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram;
626 p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram; 612 p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram;
627 613
@@ -727,7 +713,7 @@ static void get_statistics(ucc_geth_private_t *ugeth,
727 } 713 }
728} 714}
729 715
730static void dump_bds(ucc_geth_private_t *ugeth) 716static void dump_bds(struct ucc_geth_private *ugeth)
731{ 717{
732 int i; 718 int i;
733 int length; 719 int length;
@@ -736,7 +722,7 @@ static void dump_bds(ucc_geth_private_t *ugeth)
736 if (ugeth->p_tx_bd_ring[i]) { 722 if (ugeth->p_tx_bd_ring[i]) {
737 length = 723 length =
738 (ugeth->ug_info->bdRingLenTx[i] * 724 (ugeth->ug_info->bdRingLenTx[i] *
739 UCC_GETH_SIZE_OF_BD); 725 sizeof(struct qe_bd));
740 ugeth_info("TX BDs[%d]", i); 726 ugeth_info("TX BDs[%d]", i);
741 mem_disp(ugeth->p_tx_bd_ring[i], length); 727 mem_disp(ugeth->p_tx_bd_ring[i], length);
742 } 728 }
@@ -745,14 +731,14 @@ static void dump_bds(ucc_geth_private_t *ugeth)
745 if (ugeth->p_rx_bd_ring[i]) { 731 if (ugeth->p_rx_bd_ring[i]) {
746 length = 732 length =
747 (ugeth->ug_info->bdRingLenRx[i] * 733 (ugeth->ug_info->bdRingLenRx[i] *
748 UCC_GETH_SIZE_OF_BD); 734 sizeof(struct qe_bd));
749 ugeth_info("RX BDs[%d]", i); 735 ugeth_info("RX BDs[%d]", i);
750 mem_disp(ugeth->p_rx_bd_ring[i], length); 736 mem_disp(ugeth->p_rx_bd_ring[i], length);
751 } 737 }
752 } 738 }
753} 739}
754 740
755static void dump_regs(ucc_geth_private_t *ugeth) 741static void dump_regs(struct ucc_geth_private *ugeth)
756{ 742{
757 int i; 743 int i;
758 744
@@ -893,7 +879,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
893 ugeth_info("Base address: 0x%08x", 879 ugeth_info("Base address: 0x%08x",
894 (u32) & ugeth->p_thread_data_tx[i]); 880 (u32) & ugeth->p_thread_data_tx[i]);
895 mem_disp((u8 *) & ugeth->p_thread_data_tx[i], 881 mem_disp((u8 *) & ugeth->p_thread_data_tx[i],
896 sizeof(ucc_geth_thread_data_tx_t)); 882 sizeof(struct ucc_geth_thread_data_tx));
897 } 883 }
898 } 884 }
899 if (ugeth->p_thread_data_rx) { 885 if (ugeth->p_thread_data_rx) {
@@ -927,7 +913,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
927 ugeth_info("Base address: 0x%08x", 913 ugeth_info("Base address: 0x%08x",
928 (u32) & ugeth->p_thread_data_rx[i]); 914 (u32) & ugeth->p_thread_data_rx[i]);
929 mem_disp((u8 *) & ugeth->p_thread_data_rx[i], 915 mem_disp((u8 *) & ugeth->p_thread_data_rx[i],
930 sizeof(ucc_geth_thread_data_rx_t)); 916 sizeof(struct ucc_geth_thread_data_rx));
931 } 917 }
932 } 918 }
933 if (ugeth->p_exf_glbl_param) { 919 if (ugeth->p_exf_glbl_param) {
@@ -1105,7 +1091,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
1105 ugeth_info("Base address: 0x%08x", 1091 ugeth_info("Base address: 0x%08x",
1106 (u32) & ugeth->p_send_q_mem_reg->sqqd[i]); 1092 (u32) & ugeth->p_send_q_mem_reg->sqqd[i]);
1107 mem_disp((u8 *) & ugeth->p_send_q_mem_reg->sqqd[i], 1093 mem_disp((u8 *) & ugeth->p_send_q_mem_reg->sqqd[i],
1108 sizeof(ucc_geth_send_queue_qd_t)); 1094 sizeof(struct ucc_geth_send_queue_qd));
1109 } 1095 }
1110 } 1096 }
1111 if (ugeth->p_scheduler) { 1097 if (ugeth->p_scheduler) {
@@ -1187,7 +1173,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
1187 qe_muram_addr(in_be32 1173 qe_muram_addr(in_be32
1188 (&ugeth->p_rx_bd_qs_tbl[i]. 1174 (&ugeth->p_rx_bd_qs_tbl[i].
1189 bdbaseptr)), 1175 bdbaseptr)),
1190 sizeof(ucc_geth_rx_prefetched_bds_t)); 1176 sizeof(struct ucc_geth_rx_prefetched_bds));
1191 } 1177 }
1192 } 1178 }
1193 if (ugeth->p_init_enet_param_shadow) { 1179 if (ugeth->p_init_enet_param_shadow) {
@@ -1198,7 +1184,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
1198 mem_disp((u8 *) ugeth->p_init_enet_param_shadow, 1184 mem_disp((u8 *) ugeth->p_init_enet_param_shadow,
1199 sizeof(*ugeth->p_init_enet_param_shadow)); 1185 sizeof(*ugeth->p_init_enet_param_shadow));
1200 1186
1201 size = sizeof(ucc_geth_thread_rx_pram_t); 1187 size = sizeof(struct ucc_geth_thread_rx_pram);
1202 if (ugeth->ug_info->rxExtendedFiltering) { 1188 if (ugeth->ug_info->rxExtendedFiltering) {
1203 size += 1189 size +=
1204 THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; 1190 THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING;
@@ -1216,7 +1202,7 @@ static void dump_regs(ucc_geth_private_t *ugeth)
1216 &(ugeth->p_init_enet_param_shadow-> 1202 &(ugeth->p_init_enet_param_shadow->
1217 txthread[0]), 1203 txthread[0]),
1218 ENET_INIT_PARAM_MAX_ENTRIES_TX, 1204 ENET_INIT_PARAM_MAX_ENTRIES_TX,
1219 sizeof(ucc_geth_thread_tx_pram_t), 1205 sizeof(struct ucc_geth_thread_tx_pram),
1220 ugeth->ug_info->riscTx, 0); 1206 ugeth->ug_info->riscTx, 0);
1221 dump_init_enet_entries(ugeth, 1207 dump_init_enet_entries(ugeth,
1222 &(ugeth->p_init_enet_param_shadow-> 1208 &(ugeth->p_init_enet_param_shadow->
@@ -1578,12 +1564,12 @@ static int init_min_frame_len(u16 min_frame_length,
1578 return 0; 1564 return 0;
1579} 1565}
1580 1566
1581static int adjust_enet_interface(ucc_geth_private_t *ugeth) 1567static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1582{ 1568{
1583 ucc_geth_info_t *ug_info; 1569 struct ucc_geth_info *ug_info;
1584 ucc_geth_t *ug_regs; 1570 struct ucc_geth *ug_regs;
1585 ucc_fast_t *uf_regs; 1571 struct ucc_fast *uf_regs;
1586 enet_speed_e speed; 1572 enum enet_speed speed;
1587 int ret_val, rpm = 0, tbi = 0, r10m = 0, rmm = 1573 int ret_val, rpm = 0, tbi = 0, r10m = 0, rmm =
1588 0, limited_to_full_duplex = 0; 1574 0, limited_to_full_duplex = 0;
1589 u32 upsmr, maccfg2, utbipar, tbiBaseAddress; 1575 u32 upsmr, maccfg2, utbipar, tbiBaseAddress;
@@ -1691,8 +1677,8 @@ static int adjust_enet_interface(ucc_geth_private_t *ugeth)
1691 */ 1677 */
1692static void adjust_link(struct net_device *dev) 1678static void adjust_link(struct net_device *dev)
1693{ 1679{
1694 ucc_geth_private_t *ugeth = netdev_priv(dev); 1680 struct ucc_geth_private *ugeth = netdev_priv(dev);
1695 ucc_geth_t *ug_regs; 1681 struct ucc_geth *ug_regs;
1696 u32 tempval; 1682 u32 tempval;
1697 struct ugeth_mii_info *mii_info = ugeth->mii_info; 1683 struct ugeth_mii_info *mii_info = ugeth->mii_info;
1698 1684
@@ -1722,7 +1708,7 @@ static void adjust_link(struct net_device *dev)
1722 if (mii_info->speed != ugeth->oldspeed) { 1708 if (mii_info->speed != ugeth->oldspeed) {
1723 switch (mii_info->speed) { 1709 switch (mii_info->speed) {
1724 case 1000: 1710 case 1000:
1725#ifdef CONFIG_MPC836x 1711#ifdef CONFIG_PPC_MPC836x
1726/* FIXME: This code is for 100Mbs BUG fixing, 1712/* FIXME: This code is for 100Mbs BUG fixing,
1727remove this when it is fixed!!! */ 1713remove this when it is fixed!!! */
1728 if (ugeth->ug_info->enet_interface == 1714 if (ugeth->ug_info->enet_interface ==
@@ -1768,7 +1754,7 @@ remove this when it is fixed!!! */
1768 break; 1754 break;
1769 case 100: 1755 case 100:
1770 case 10: 1756 case 10:
1771#ifdef CONFIG_MPC836x 1757#ifdef CONFIG_PPC_MPC836x
1772/* FIXME: This code is for 100Mbs BUG fixing, 1758/* FIXME: This code is for 100Mbs BUG fixing,
1773remove this lines when it will be fixed!!! */ 1759remove this lines when it will be fixed!!! */
1774 ugeth->ug_info->enet_interface = ENET_100_RGMII; 1760 ugeth->ug_info->enet_interface = ENET_100_RGMII;
@@ -1827,9 +1813,9 @@ remove this lines when it will be fixed!!! */
1827 */ 1813 */
1828static int init_phy(struct net_device *dev) 1814static int init_phy(struct net_device *dev)
1829{ 1815{
1830 ucc_geth_private_t *ugeth = netdev_priv(dev); 1816 struct ucc_geth_private *ugeth = netdev_priv(dev);
1831 struct phy_info *curphy; 1817 struct phy_info *curphy;
1832 ucc_mii_mng_t *mii_regs; 1818 struct ucc_mii_mng *mii_regs;
1833 struct ugeth_mii_info *mii_info; 1819 struct ugeth_mii_info *mii_info;
1834 int err; 1820 int err;
1835 1821
@@ -1914,17 +1900,17 @@ static int init_phy(struct net_device *dev)
1914} 1900}
1915 1901
1916#ifdef CONFIG_UGETH_TX_ON_DEMOND 1902#ifdef CONFIG_UGETH_TX_ON_DEMOND
1917static int ugeth_transmit_on_demand(ucc_geth_private_t *ugeth) 1903static int ugeth_transmit_on_demand(struct ucc_geth_private *ugeth)
1918{ 1904{
1919 ucc_fast_transmit_on_demand(ugeth->uccf); 1905 struct ucc_fastransmit_on_demand(ugeth->uccf);
1920 1906
1921 return 0; 1907 return 0;
1922} 1908}
1923#endif 1909#endif
1924 1910
1925static int ugeth_graceful_stop_tx(ucc_geth_private_t *ugeth) 1911static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
1926{ 1912{
1927 ucc_fast_private_t *uccf; 1913 struct ucc_fast_private *uccf;
1928 u32 cecr_subblock; 1914 u32 cecr_subblock;
1929 u32 temp; 1915 u32 temp;
1930 1916
@@ -1940,7 +1926,7 @@ static int ugeth_graceful_stop_tx(ucc_geth_private_t *ugeth)
1940 cecr_subblock = 1926 cecr_subblock =
1941 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); 1927 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
1942 qe_issue_cmd(QE_GRACEFUL_STOP_TX, cecr_subblock, 1928 qe_issue_cmd(QE_GRACEFUL_STOP_TX, cecr_subblock,
1943 (u8) QE_CR_PROTOCOL_ETHERNET, 0); 1929 QE_CR_PROTOCOL_ETHERNET, 0);
1944 1930
1945 /* Wait for command to complete */ 1931 /* Wait for command to complete */
1946 do { 1932 do {
@@ -1952,9 +1938,9 @@ static int ugeth_graceful_stop_tx(ucc_geth_private_t *ugeth)
1952 return 0; 1938 return 0;
1953} 1939}
1954 1940
1955static int ugeth_graceful_stop_rx(ucc_geth_private_t * ugeth) 1941static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth)
1956{ 1942{
1957 ucc_fast_private_t *uccf; 1943 struct ucc_fast_private *uccf;
1958 u32 cecr_subblock; 1944 u32 cecr_subblock;
1959 u8 temp; 1945 u8 temp;
1960 1946
@@ -1973,7 +1959,7 @@ static int ugeth_graceful_stop_rx(ucc_geth_private_t * ugeth)
1973 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info. 1959 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.
1974 ucc_num); 1960 ucc_num);
1975 qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock, 1961 qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock,
1976 (u8) QE_CR_PROTOCOL_ETHERNET, 0); 1962 QE_CR_PROTOCOL_ETHERNET, 0);
1977 1963
1978 temp = ugeth->p_rx_glbl_pram->rxgstpack; 1964 temp = ugeth->p_rx_glbl_pram->rxgstpack;
1979 } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX)); 1965 } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX));
@@ -1983,41 +1969,40 @@ static int ugeth_graceful_stop_rx(ucc_geth_private_t * ugeth)
1983 return 0; 1969 return 0;
1984} 1970}
1985 1971
1986static int ugeth_restart_tx(ucc_geth_private_t *ugeth) 1972static int ugeth_restart_tx(struct ucc_geth_private *ugeth)
1987{ 1973{
1988 ucc_fast_private_t *uccf; 1974 struct ucc_fast_private *uccf;
1989 u32 cecr_subblock; 1975 u32 cecr_subblock;
1990 1976
1991 uccf = ugeth->uccf; 1977 uccf = ugeth->uccf;
1992 1978
1993 cecr_subblock = 1979 cecr_subblock =
1994 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); 1980 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
1995 qe_issue_cmd(QE_RESTART_TX, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, 1981 qe_issue_cmd(QE_RESTART_TX, cecr_subblock, QE_CR_PROTOCOL_ETHERNET, 0);
1996 0);
1997 uccf->stopped_tx = 0; 1982 uccf->stopped_tx = 0;
1998 1983
1999 return 0; 1984 return 0;
2000} 1985}
2001 1986
2002static int ugeth_restart_rx(ucc_geth_private_t *ugeth) 1987static int ugeth_restart_rx(struct ucc_geth_private *ugeth)
2003{ 1988{
2004 ucc_fast_private_t *uccf; 1989 struct ucc_fast_private *uccf;
2005 u32 cecr_subblock; 1990 u32 cecr_subblock;
2006 1991
2007 uccf = ugeth->uccf; 1992 uccf = ugeth->uccf;
2008 1993
2009 cecr_subblock = 1994 cecr_subblock =
2010 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); 1995 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
2011 qe_issue_cmd(QE_RESTART_RX, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, 1996 qe_issue_cmd(QE_RESTART_RX, cecr_subblock, QE_CR_PROTOCOL_ETHERNET,
2012 0); 1997 0);
2013 uccf->stopped_rx = 0; 1998 uccf->stopped_rx = 0;
2014 1999
2015 return 0; 2000 return 0;
2016} 2001}
2017 2002
2018static int ugeth_enable(ucc_geth_private_t *ugeth, comm_dir_e mode) 2003static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode)
2019{ 2004{
2020 ucc_fast_private_t *uccf; 2005 struct ucc_fast_private *uccf;
2021 int enabled_tx, enabled_rx; 2006 int enabled_tx, enabled_rx;
2022 2007
2023 uccf = ugeth->uccf; 2008 uccf = ugeth->uccf;
@@ -2044,9 +2029,9 @@ static int ugeth_enable(ucc_geth_private_t *ugeth, comm_dir_e mode)
2044 2029
2045} 2030}
2046 2031
2047static int ugeth_disable(ucc_geth_private_t * ugeth, comm_dir_e mode) 2032static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode)
2048{ 2033{
2049 ucc_fast_private_t *uccf; 2034 struct ucc_fast_private *uccf;
2050 2035
2051 uccf = ugeth->uccf; 2036 uccf = ugeth->uccf;
2052 2037
@@ -2069,7 +2054,7 @@ static int ugeth_disable(ucc_geth_private_t * ugeth, comm_dir_e mode)
2069 return 0; 2054 return 0;
2070} 2055}
2071 2056
2072static void ugeth_dump_regs(ucc_geth_private_t *ugeth) 2057static void ugeth_dump_regs(struct ucc_geth_private *ugeth)
2073{ 2058{
2074#ifdef DEBUG 2059#ifdef DEBUG
2075 ucc_fast_dump_regs(ugeth->uccf); 2060 ucc_fast_dump_regs(ugeth->uccf);
@@ -2079,9 +2064,9 @@ static void ugeth_dump_regs(ucc_geth_private_t *ugeth)
2079} 2064}
2080 2065
2081#ifdef CONFIG_UGETH_FILTERING 2066#ifdef CONFIG_UGETH_FILTERING
2082static int ugeth_ext_filtering_serialize_tad(ucc_geth_tad_params_t * 2067static int ugeth_ext_filtering_serialize_tad(struct ucc_geth_tad_params *
2083 p_UccGethTadParams, 2068 p_UccGethTadParams,
2084 qe_fltr_tad_t *qe_fltr_tad) 2069 struct qe_fltr_tad *qe_fltr_tad)
2085{ 2070{
2086 u16 temp; 2071 u16 temp;
2087 2072
@@ -2119,11 +2104,11 @@ static int ugeth_ext_filtering_serialize_tad(ucc_geth_tad_params_t *
2119 return 0; 2104 return 0;
2120} 2105}
2121 2106
2122static enet_addr_container_t 2107static struct enet_addr_container_t
2123 *ugeth_82xx_filtering_get_match_addr_in_hash(ucc_geth_private_t *ugeth, 2108 *ugeth_82xx_filtering_get_match_addr_in_hash(struct ucc_geth_private *ugeth,
2124 enet_addr_t *p_enet_addr) 2109 struct enet_addr *p_enet_addr)
2125{ 2110{
2126 enet_addr_container_t *enet_addr_cont; 2111 struct enet_addr_container *enet_addr_cont;
2127 struct list_head *p_lh; 2112 struct list_head *p_lh;
2128 u16 i, num; 2113 u16 i, num;
2129 int32_t j; 2114 int32_t j;
@@ -2144,7 +2129,7 @@ static enet_addr_container_t
2144 2129
2145 for (i = 0; i < num; i++) { 2130 for (i = 0; i < num; i++) {
2146 enet_addr_cont = 2131 enet_addr_cont =
2147 (enet_addr_container_t *) 2132 (struct enet_addr_container *)
2148 ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); 2133 ENET_ADDR_CONT_ENTRY(dequeue(p_lh));
2149 for (j = ENET_NUM_OCTETS_PER_ADDRESS - 1; j >= 0; j--) { 2134 for (j = ENET_NUM_OCTETS_PER_ADDRESS - 1; j >= 0; j--) {
2150 if ((*p_enet_addr)[j] != (enet_addr_cont->address)[j]) 2135 if ((*p_enet_addr)[j] != (enet_addr_cont->address)[j])
@@ -2157,11 +2142,11 @@ static enet_addr_container_t
2157 return NULL; 2142 return NULL;
2158} 2143}
2159 2144
2160static int ugeth_82xx_filtering_add_addr_in_hash(ucc_geth_private_t *ugeth, 2145static int ugeth_82xx_filtering_add_addr_in_hash(struct ucc_geth_private *ugeth,
2161 enet_addr_t *p_enet_addr) 2146 struct enet_addr *p_enet_addr)
2162{ 2147{
2163 ucc_geth_enet_address_recognition_location_e location; 2148 enum ucc_geth_enet_address_recognition_location location;
2164 enet_addr_container_t *enet_addr_cont; 2149 struct enet_addr_container *enet_addr_cont;
2165 struct list_head *p_lh; 2150 struct list_head *p_lh;
2166 u8 i; 2151 u8 i;
2167 u32 limit; 2152 u32 limit;
@@ -2196,18 +2181,17 @@ static int ugeth_82xx_filtering_add_addr_in_hash(ucc_geth_private_t *ugeth,
2196 enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ 2181 enqueue(p_lh, &enet_addr_cont->node); /* Put it back */
2197 ++(*p_counter); 2182 ++(*p_counter);
2198 2183
2199 hw_add_addr_in_hash(ugeth, &(enet_addr_cont->address)); 2184 hw_add_addr_in_hash(ugeth, enet_addr_cont->address);
2200
2201 return 0; 2185 return 0;
2202} 2186}
2203 2187
2204static int ugeth_82xx_filtering_clear_addr_in_hash(ucc_geth_private_t *ugeth, 2188static int ugeth_82xx_filtering_clear_addr_in_hash(struct ucc_geth_private *ugeth,
2205 enet_addr_t *p_enet_addr) 2189 struct enet_addr *p_enet_addr)
2206{ 2190{
2207 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 2191 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
2208 enet_addr_container_t *enet_addr_cont; 2192 struct enet_addr_container *enet_addr_cont;
2209 ucc_fast_private_t *uccf; 2193 struct ucc_fast_private *uccf;
2210 comm_dir_e comm_dir; 2194 enum comm_dir comm_dir;
2211 u16 i, num; 2195 u16 i, num;
2212 struct list_head *p_lh; 2196 struct list_head *p_lh;
2213 u32 *addr_h, *addr_l; 2197 u32 *addr_h, *addr_l;
@@ -2216,7 +2200,7 @@ static int ugeth_82xx_filtering_clear_addr_in_hash(ucc_geth_private_t *ugeth,
2216 uccf = ugeth->uccf; 2200 uccf = ugeth->uccf;
2217 2201
2218 p_82xx_addr_filt = 2202 p_82xx_addr_filt =
2219 (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> 2203 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
2220 addressfiltering; 2204 addressfiltering;
2221 2205
2222 if (! 2206 if (!
@@ -2256,9 +2240,9 @@ static int ugeth_82xx_filtering_clear_addr_in_hash(ucc_geth_private_t *ugeth,
2256 num = --(*p_counter); 2240 num = --(*p_counter);
2257 for (i = 0; i < num; i++) { 2241 for (i = 0; i < num; i++) {
2258 enet_addr_cont = 2242 enet_addr_cont =
2259 (enet_addr_container_t *) 2243 (struct enet_addr_container *)
2260 ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); 2244 ENET_ADDR_CONT_ENTRY(dequeue(p_lh));
2261 hw_add_addr_in_hash(ugeth, &(enet_addr_cont->address)); 2245 hw_add_addr_in_hash(ugeth, enet_addr_cont->address);
2262 enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ 2246 enqueue(p_lh, &enet_addr_cont->node); /* Put it back */
2263 } 2247 }
2264 2248
@@ -2269,14 +2253,14 @@ static int ugeth_82xx_filtering_clear_addr_in_hash(ucc_geth_private_t *ugeth,
2269} 2253}
2270#endif /* CONFIG_UGETH_FILTERING */ 2254#endif /* CONFIG_UGETH_FILTERING */
2271 2255
2272static int ugeth_82xx_filtering_clear_all_addr_in_hash(ucc_geth_private_t * 2256static int ugeth_82xx_filtering_clear_all_addr_in_hash(struct ucc_geth_private *
2273 ugeth, 2257 ugeth,
2274 enet_addr_type_e 2258 enum enet_addr_type
2275 enet_addr_type) 2259 enet_addr_type)
2276{ 2260{
2277 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 2261 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
2278 ucc_fast_private_t *uccf; 2262 struct ucc_fast_private *uccf;
2279 comm_dir_e comm_dir; 2263 enum comm_dir comm_dir;
2280 struct list_head *p_lh; 2264 struct list_head *p_lh;
2281 u16 i, num; 2265 u16 i, num;
2282 u32 *addr_h, *addr_l; 2266 u32 *addr_h, *addr_l;
@@ -2285,7 +2269,7 @@ static int ugeth_82xx_filtering_clear_all_addr_in_hash(ucc_geth_private_t *
2285 uccf = ugeth->uccf; 2269 uccf = ugeth->uccf;
2286 2270
2287 p_82xx_addr_filt = 2271 p_82xx_addr_filt =
2288 (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> 2272 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
2289 addressfiltering; 2273 addressfiltering;
2290 2274
2291 if (enet_addr_type == ENET_ADDR_TYPE_GROUP) { 2275 if (enet_addr_type == ENET_ADDR_TYPE_GROUP) {
@@ -2331,8 +2315,8 @@ static int ugeth_82xx_filtering_clear_all_addr_in_hash(ucc_geth_private_t *
2331} 2315}
2332 2316
2333#ifdef CONFIG_UGETH_FILTERING 2317#ifdef CONFIG_UGETH_FILTERING
2334static int ugeth_82xx_filtering_add_addr_in_paddr(ucc_geth_private_t *ugeth, 2318static int ugeth_82xx_filtering_add_addr_in_paddr(struct ucc_geth_private *ugeth,
2335 enet_addr_t *p_enet_addr, 2319 struct enet_addr *p_enet_addr,
2336 u8 paddr_num) 2320 u8 paddr_num)
2337{ 2321{
2338 int i; 2322 int i;
@@ -2352,14 +2336,14 @@ static int ugeth_82xx_filtering_add_addr_in_paddr(ucc_geth_private_t *ugeth,
2352} 2336}
2353#endif /* CONFIG_UGETH_FILTERING */ 2337#endif /* CONFIG_UGETH_FILTERING */
2354 2338
2355static int ugeth_82xx_filtering_clear_addr_in_paddr(ucc_geth_private_t *ugeth, 2339static int ugeth_82xx_filtering_clear_addr_in_paddr(struct ucc_geth_private *ugeth,
2356 u8 paddr_num) 2340 u8 paddr_num)
2357{ 2341{
2358 ugeth->indAddrRegUsed[paddr_num] = 0; /* mark this paddr as not used */ 2342 ugeth->indAddrRegUsed[paddr_num] = 0; /* mark this paddr as not used */
2359 return hw_clear_addr_in_paddr(ugeth, paddr_num);/* clear in hardware */ 2343 return hw_clear_addr_in_paddr(ugeth, paddr_num);/* clear in hardware */
2360} 2344}
2361 2345
2362static void ucc_geth_memclean(ucc_geth_private_t *ugeth) 2346static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
2363{ 2347{
2364 u16 i, j; 2348 u16 i, j;
2365 u8 *bd; 2349 u8 *bd;
@@ -2433,8 +2417,8 @@ static void ucc_geth_memclean(ucc_geth_private_t *ugeth)
2433 for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { 2417 for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
2434 if (ugeth->tx_skbuff[i][j]) { 2418 if (ugeth->tx_skbuff[i][j]) {
2435 dma_unmap_single(NULL, 2419 dma_unmap_single(NULL,
2436 BD_BUFFER_ARG(bd), 2420 ((qe_bd_t *)bd)->buf,
2437 (BD_STATUS_AND_LENGTH(bd) & 2421 (in_be32((u32 *)bd) &
2438 BD_LENGTH_MASK), 2422 BD_LENGTH_MASK),
2439 DMA_TO_DEVICE); 2423 DMA_TO_DEVICE);
2440 dev_kfree_skb_any(ugeth->tx_skbuff[i][j]); 2424 dev_kfree_skb_any(ugeth->tx_skbuff[i][j]);
@@ -2460,18 +2444,17 @@ static void ucc_geth_memclean(ucc_geth_private_t *ugeth)
2460 bd = ugeth->p_rx_bd_ring[i]; 2444 bd = ugeth->p_rx_bd_ring[i];
2461 for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { 2445 for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) {
2462 if (ugeth->rx_skbuff[i][j]) { 2446 if (ugeth->rx_skbuff[i][j]) {
2463 dma_unmap_single(NULL, BD_BUFFER(bd), 2447 dma_unmap_single(NULL,
2464 ugeth->ug_info-> 2448 ((struct qe_bd *)bd)->buf,
2465 uf_info. 2449 ugeth->ug_info->
2466 max_rx_buf_length + 2450 uf_info.max_rx_buf_length +
2467 UCC_GETH_RX_DATA_BUF_ALIGNMENT, 2451 UCC_GETH_RX_DATA_BUF_ALIGNMENT,
2468 DMA_FROM_DEVICE); 2452 DMA_FROM_DEVICE);
2469 2453 dev_kfree_skb_any(
2470 dev_kfree_skb_any(ugeth-> 2454 ugeth->rx_skbuff[i][j]);
2471 rx_skbuff[i][j]);
2472 ugeth->rx_skbuff[i][j] = NULL; 2455 ugeth->rx_skbuff[i][j] = NULL;
2473 } 2456 }
2474 bd += UCC_GETH_SIZE_OF_BD; 2457 bd += sizeof(struct qe_bd);
2475 } 2458 }
2476 2459
2477 kfree(ugeth->rx_skbuff[i]); 2460 kfree(ugeth->rx_skbuff[i]);
@@ -2496,11 +2479,11 @@ static void ucc_geth_memclean(ucc_geth_private_t *ugeth)
2496 2479
2497static void ucc_geth_set_multi(struct net_device *dev) 2480static void ucc_geth_set_multi(struct net_device *dev)
2498{ 2481{
2499 ucc_geth_private_t *ugeth; 2482 struct ucc_geth_private *ugeth;
2500 struct dev_mc_list *dmi; 2483 struct dev_mc_list *dmi;
2501 ucc_fast_t *uf_regs; 2484 struct ucc_fast *uf_regs;
2502 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 2485 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
2503 enet_addr_t tempaddr; 2486 u8 tempaddr[6];
2504 u8 *mcptr, *tdptr; 2487 u8 *mcptr, *tdptr;
2505 int i, j; 2488 int i, j;
2506 2489
@@ -2517,7 +2500,7 @@ static void ucc_geth_set_multi(struct net_device *dev)
2517 uf_regs->upsmr &= ~UPSMR_PRO; 2500 uf_regs->upsmr &= ~UPSMR_PRO;
2518 2501
2519 p_82xx_addr_filt = 2502 p_82xx_addr_filt =
2520 (ucc_geth_82xx_address_filtering_pram_t *) ugeth-> 2503 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->
2521 p_rx_glbl_pram->addressfiltering; 2504 p_rx_glbl_pram->addressfiltering;
2522 2505
2523 if (dev->flags & IFF_ALLMULTI) { 2506 if (dev->flags & IFF_ALLMULTI) {
@@ -2546,23 +2529,22 @@ static void ucc_geth_set_multi(struct net_device *dev)
2546 * copy bytes MSB first from dmi_addr. 2529 * copy bytes MSB first from dmi_addr.
2547 */ 2530 */
2548 mcptr = (u8 *) dmi->dmi_addr + 5; 2531 mcptr = (u8 *) dmi->dmi_addr + 5;
2549 tdptr = (u8 *) & tempaddr; 2532 tdptr = (u8 *) tempaddr;
2550 for (j = 0; j < 6; j++) 2533 for (j = 0; j < 6; j++)
2551 *tdptr++ = *mcptr--; 2534 *tdptr++ = *mcptr--;
2552 2535
2553 /* Ask CPM to run CRC and set bit in 2536 /* Ask CPM to run CRC and set bit in
2554 * filter mask. 2537 * filter mask.
2555 */ 2538 */
2556 hw_add_addr_in_hash(ugeth, &tempaddr); 2539 hw_add_addr_in_hash(ugeth, tempaddr);
2557
2558 } 2540 }
2559 } 2541 }
2560 } 2542 }
2561} 2543}
2562 2544
2563static void ucc_geth_stop(ucc_geth_private_t *ugeth) 2545static void ucc_geth_stop(struct ucc_geth_private *ugeth)
2564{ 2546{
2565 ucc_geth_t *ug_regs = ugeth->ug_regs; 2547 struct ucc_geth *ug_regs = ugeth->ug_regs;
2566 u32 tempval; 2548 u32 tempval;
2567 2549
2568 ugeth_vdbg("%s: IN", __FUNCTION__); 2550 ugeth_vdbg("%s: IN", __FUNCTION__);
@@ -2605,15 +2587,15 @@ static void ucc_geth_stop(ucc_geth_private_t *ugeth)
2605 ucc_geth_memclean(ugeth); 2587 ucc_geth_memclean(ugeth);
2606} 2588}
2607 2589
2608static int ucc_geth_startup(ucc_geth_private_t *ugeth) 2590static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2609{ 2591{
2610 ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; 2592 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
2611 ucc_geth_init_pram_t *p_init_enet_pram; 2593 struct ucc_geth_init_pram *p_init_enet_pram;
2612 ucc_fast_private_t *uccf; 2594 struct ucc_fast_private *uccf;
2613 ucc_geth_info_t *ug_info; 2595 struct ucc_geth_info *ug_info;
2614 ucc_fast_info_t *uf_info; 2596 struct ucc_fast_info *uf_info;
2615 ucc_fast_t *uf_regs; 2597 struct ucc_fast *uf_regs;
2616 ucc_geth_t *ug_regs; 2598 struct ucc_geth *ug_regs;
2617 int ret_val = -EINVAL; 2599 int ret_val = -EINVAL;
2618 u32 remoder = UCC_GETH_REMODER_INIT; 2600 u32 remoder = UCC_GETH_REMODER_INIT;
2619 u32 init_enet_pram_offset, cecr_subblock, command, maccfg1; 2601 u32 init_enet_pram_offset, cecr_subblock, command, maccfg1;
@@ -2788,7 +2770,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
2788 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP); 2770 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP);
2789 2771
2790 uf_regs = uccf->uf_regs; 2772 uf_regs = uccf->uf_regs;
2791 ug_regs = (ucc_geth_t *) (uccf->uf_regs); 2773 ug_regs = (struct ucc_geth *) (uccf->uf_regs);
2792 ugeth->ug_regs = ug_regs; 2774 ugeth->ug_regs = ug_regs;
2793 2775
2794 init_default_reg_vals(&uf_regs->upsmr, 2776 init_default_reg_vals(&uf_regs->upsmr,
@@ -2869,10 +2851,10 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
2869 /* Allocate in multiple of 2851 /* Allocate in multiple of
2870 UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT, 2852 UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT,
2871 according to spec */ 2853 according to spec */
2872 length = ((ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD) 2854 length = ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd))
2873 / UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) 2855 / UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT)
2874 * UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; 2856 * UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT;
2875 if ((ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD) % 2857 if ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) %
2876 UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) 2858 UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT)
2877 length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; 2859 length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT;
2878 if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { 2860 if (uf_info->bd_mem_part == MEM_PART_SYSTEM) {
@@ -2904,13 +2886,13 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
2904 } 2886 }
2905 /* Zero unused end of bd ring, according to spec */ 2887 /* Zero unused end of bd ring, according to spec */
2906 memset(ugeth->p_tx_bd_ring[j] + 2888 memset(ugeth->p_tx_bd_ring[j] +
2907 ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD, 0, 2889 ug_info->bdRingLenTx[j] * sizeof(struct qe_bd), 0,
2908 length - ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD); 2890 length - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd));
2909 } 2891 }
2910 2892
2911 /* Allocate Rx bds */ 2893 /* Allocate Rx bds */
2912 for (j = 0; j < ug_info->numQueuesRx; j++) { 2894 for (j = 0; j < ug_info->numQueuesRx; j++) {
2913 length = ug_info->bdRingLenRx[j] * UCC_GETH_SIZE_OF_BD; 2895 length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd);
2914 if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { 2896 if (uf_info->bd_mem_part == MEM_PART_SYSTEM) {
2915 u32 align = 4; 2897 u32 align = 4;
2916 if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4) 2898 if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4)
@@ -2960,12 +2942,15 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
2960 ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0; 2942 ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0;
2961 bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; 2943 bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j];
2962 for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { 2944 for (i = 0; i < ug_info->bdRingLenTx[j]; i++) {
2963 BD_BUFFER_CLEAR(bd); 2945 /* clear bd buffer */
2964 BD_STATUS_AND_LENGTH_SET(bd, 0); 2946 out_be32(&((struct qe_bd *)bd)->buf, 0);
2965 bd += UCC_GETH_SIZE_OF_BD; 2947 /* set bd status and length */
2948 out_be32((u32 *)bd, 0);
2949 bd += sizeof(struct qe_bd);
2966 } 2950 }
2967 bd -= UCC_GETH_SIZE_OF_BD; 2951 bd -= sizeof(struct qe_bd);
2968 BD_STATUS_AND_LENGTH_SET(bd, T_W);/* for last BD set Wrap bit */ 2952 /* set bd status and length */
2953 out_be32((u32 *)bd, T_W); /* for last BD set Wrap bit */
2969 } 2954 }
2970 2955
2971 /* Init Rx bds */ 2956 /* Init Rx bds */
@@ -2989,12 +2974,15 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
2989 ugeth->skb_currx[j] = 0; 2974 ugeth->skb_currx[j] = 0;
2990 bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; 2975 bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j];
2991 for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { 2976 for (i = 0; i < ug_info->bdRingLenRx[j]; i++) {
2992 BD_STATUS_AND_LENGTH_SET(bd, R_I); 2977 /* set bd status and length */
2993 BD_BUFFER_CLEAR(bd); 2978 out_be32((u32 *)bd, R_I);
2994 bd += UCC_GETH_SIZE_OF_BD; 2979 /* clear bd buffer */
2980 out_be32(&((struct qe_bd *)bd)->buf, 0);
2981 bd += sizeof(struct qe_bd);
2995 } 2982 }
2996 bd -= UCC_GETH_SIZE_OF_BD; 2983 bd -= sizeof(struct qe_bd);
2997 BD_STATUS_AND_LENGTH_SET(bd, R_W);/* for last BD set Wrap bit */ 2984 /* set bd status and length */
2985 out_be32((u32 *)bd, R_W); /* for last BD set Wrap bit */
2998 } 2986 }
2999 2987
3000 /* 2988 /*
@@ -3003,7 +2991,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3003 /* Tx global PRAM */ 2991 /* Tx global PRAM */
3004 /* Allocate global tx parameter RAM page */ 2992 /* Allocate global tx parameter RAM page */
3005 ugeth->tx_glbl_pram_offset = 2993 ugeth->tx_glbl_pram_offset =
3006 qe_muram_alloc(sizeof(ucc_geth_tx_global_pram_t), 2994 qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram),
3007 UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); 2995 UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT);
3008 if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) { 2996 if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) {
3009 ugeth_err 2997 ugeth_err
@@ -3013,10 +3001,10 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3013 return -ENOMEM; 3001 return -ENOMEM;
3014 } 3002 }
3015 ugeth->p_tx_glbl_pram = 3003 ugeth->p_tx_glbl_pram =
3016 (ucc_geth_tx_global_pram_t *) qe_muram_addr(ugeth-> 3004 (struct ucc_geth_tx_global_pram *) qe_muram_addr(ugeth->
3017 tx_glbl_pram_offset); 3005 tx_glbl_pram_offset);
3018 /* Zero out p_tx_glbl_pram */ 3006 /* Zero out p_tx_glbl_pram */
3019 memset(ugeth->p_tx_glbl_pram, 0, sizeof(ucc_geth_tx_global_pram_t)); 3007 memset(ugeth->p_tx_glbl_pram, 0, sizeof(struct ucc_geth_tx_global_pram));
3020 3008
3021 /* Fill global PRAM */ 3009 /* Fill global PRAM */
3022 3010
@@ -3024,7 +3012,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3024 /* Size varies with number of Tx threads */ 3012 /* Size varies with number of Tx threads */
3025 ugeth->thread_dat_tx_offset = 3013 ugeth->thread_dat_tx_offset =
3026 qe_muram_alloc(numThreadsTxNumerical * 3014 qe_muram_alloc(numThreadsTxNumerical *
3027 sizeof(ucc_geth_thread_data_tx_t) + 3015 sizeof(struct ucc_geth_thread_data_tx) +
3028 32 * (numThreadsTxNumerical == 1), 3016 32 * (numThreadsTxNumerical == 1),
3029 UCC_GETH_THREAD_DATA_ALIGNMENT); 3017 UCC_GETH_THREAD_DATA_ALIGNMENT);
3030 if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) { 3018 if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) {
@@ -3036,7 +3024,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3036 } 3024 }
3037 3025
3038 ugeth->p_thread_data_tx = 3026 ugeth->p_thread_data_tx =
3039 (ucc_geth_thread_data_tx_t *) qe_muram_addr(ugeth-> 3027 (struct ucc_geth_thread_data_tx *) qe_muram_addr(ugeth->
3040 thread_dat_tx_offset); 3028 thread_dat_tx_offset);
3041 out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset); 3029 out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset);
3042 3030
@@ -3053,7 +3041,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3053 /* Size varies with number of Tx queues */ 3041 /* Size varies with number of Tx queues */
3054 ugeth->send_q_mem_reg_offset = 3042 ugeth->send_q_mem_reg_offset =
3055 qe_muram_alloc(ug_info->numQueuesTx * 3043 qe_muram_alloc(ug_info->numQueuesTx *
3056 sizeof(ucc_geth_send_queue_qd_t), 3044 sizeof(struct ucc_geth_send_queue_qd),
3057 UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); 3045 UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT);
3058 if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) { 3046 if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) {
3059 ugeth_err 3047 ugeth_err
@@ -3064,7 +3052,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3064 } 3052 }
3065 3053
3066 ugeth->p_send_q_mem_reg = 3054 ugeth->p_send_q_mem_reg =
3067 (ucc_geth_send_queue_mem_region_t *) qe_muram_addr(ugeth-> 3055 (struct ucc_geth_send_queue_mem_region *) qe_muram_addr(ugeth->
3068 send_q_mem_reg_offset); 3056 send_q_mem_reg_offset);
3069 out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset); 3057 out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset);
3070 3058
@@ -3073,7 +3061,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3073 for (i = 0; i < ug_info->numQueuesTx; i++) { 3061 for (i = 0; i < ug_info->numQueuesTx; i++) {
3074 endOfRing = 3062 endOfRing =
3075 ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] - 3063 ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] -
3076 1) * UCC_GETH_SIZE_OF_BD; 3064 1) * sizeof(struct qe_bd);
3077 if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) { 3065 if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) {
3078 out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, 3066 out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
3079 (u32) virt_to_phys(ugeth->p_tx_bd_ring[i])); 3067 (u32) virt_to_phys(ugeth->p_tx_bd_ring[i]));
@@ -3096,7 +3084,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3096 if (ug_info->numQueuesTx > 1) { 3084 if (ug_info->numQueuesTx > 1) {
3097 /* scheduler exists only if more than 1 tx queue */ 3085 /* scheduler exists only if more than 1 tx queue */
3098 ugeth->scheduler_offset = 3086 ugeth->scheduler_offset =
3099 qe_muram_alloc(sizeof(ucc_geth_scheduler_t), 3087 qe_muram_alloc(sizeof(struct ucc_geth_scheduler),
3100 UCC_GETH_SCHEDULER_ALIGNMENT); 3088 UCC_GETH_SCHEDULER_ALIGNMENT);
3101 if (IS_MURAM_ERR(ugeth->scheduler_offset)) { 3089 if (IS_MURAM_ERR(ugeth->scheduler_offset)) {
3102 ugeth_err 3090 ugeth_err
@@ -3107,12 +3095,12 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3107 } 3095 }
3108 3096
3109 ugeth->p_scheduler = 3097 ugeth->p_scheduler =
3110 (ucc_geth_scheduler_t *) qe_muram_addr(ugeth-> 3098 (struct ucc_geth_scheduler *) qe_muram_addr(ugeth->
3111 scheduler_offset); 3099 scheduler_offset);
3112 out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer, 3100 out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer,
3113 ugeth->scheduler_offset); 3101 ugeth->scheduler_offset);
3114 /* Zero out p_scheduler */ 3102 /* Zero out p_scheduler */
3115 memset(ugeth->p_scheduler, 0, sizeof(ucc_geth_scheduler_t)); 3103 memset(ugeth->p_scheduler, 0, sizeof(struct ucc_geth_scheduler));
3116 3104
3117 /* Set values in scheduler */ 3105 /* Set values in scheduler */
3118 out_be32(&ugeth->p_scheduler->mblinterval, 3106 out_be32(&ugeth->p_scheduler->mblinterval,
@@ -3144,7 +3132,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3144 statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { 3132 statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
3145 ugeth->tx_fw_statistics_pram_offset = 3133 ugeth->tx_fw_statistics_pram_offset =
3146 qe_muram_alloc(sizeof 3134 qe_muram_alloc(sizeof
3147 (ucc_geth_tx_firmware_statistics_pram_t), 3135 (struct ucc_geth_tx_firmware_statistics_pram),
3148 UCC_GETH_TX_STATISTICS_ALIGNMENT); 3136 UCC_GETH_TX_STATISTICS_ALIGNMENT);
3149 if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) { 3137 if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) {
3150 ugeth_err 3138 ugeth_err
@@ -3154,11 +3142,11 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3154 return -ENOMEM; 3142 return -ENOMEM;
3155 } 3143 }
3156 ugeth->p_tx_fw_statistics_pram = 3144 ugeth->p_tx_fw_statistics_pram =
3157 (ucc_geth_tx_firmware_statistics_pram_t *) 3145 (struct ucc_geth_tx_firmware_statistics_pram *)
3158 qe_muram_addr(ugeth->tx_fw_statistics_pram_offset); 3146 qe_muram_addr(ugeth->tx_fw_statistics_pram_offset);
3159 /* Zero out p_tx_fw_statistics_pram */ 3147 /* Zero out p_tx_fw_statistics_pram */
3160 memset(ugeth->p_tx_fw_statistics_pram, 3148 memset(ugeth->p_tx_fw_statistics_pram,
3161 0, sizeof(ucc_geth_tx_firmware_statistics_pram_t)); 3149 0, sizeof(struct ucc_geth_tx_firmware_statistics_pram));
3162 } 3150 }
3163 3151
3164 /* temoder */ 3152 /* temoder */
@@ -3183,7 +3171,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3183 /* Rx global PRAM */ 3171 /* Rx global PRAM */
3184 /* Allocate global rx parameter RAM page */ 3172 /* Allocate global rx parameter RAM page */
3185 ugeth->rx_glbl_pram_offset = 3173 ugeth->rx_glbl_pram_offset =
3186 qe_muram_alloc(sizeof(ucc_geth_rx_global_pram_t), 3174 qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram),
3187 UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); 3175 UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT);
3188 if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) { 3176 if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) {
3189 ugeth_err 3177 ugeth_err
@@ -3193,10 +3181,10 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3193 return -ENOMEM; 3181 return -ENOMEM;
3194 } 3182 }
3195 ugeth->p_rx_glbl_pram = 3183 ugeth->p_rx_glbl_pram =
3196 (ucc_geth_rx_global_pram_t *) qe_muram_addr(ugeth-> 3184 (struct ucc_geth_rx_global_pram *) qe_muram_addr(ugeth->
3197 rx_glbl_pram_offset); 3185 rx_glbl_pram_offset);
3198 /* Zero out p_rx_glbl_pram */ 3186 /* Zero out p_rx_glbl_pram */
3199 memset(ugeth->p_rx_glbl_pram, 0, sizeof(ucc_geth_rx_global_pram_t)); 3187 memset(ugeth->p_rx_glbl_pram, 0, sizeof(struct ucc_geth_rx_global_pram));
3200 3188
3201 /* Fill global PRAM */ 3189 /* Fill global PRAM */
3202 3190
@@ -3204,7 +3192,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3204 /* Size varies with number of Rx threads */ 3192 /* Size varies with number of Rx threads */
3205 ugeth->thread_dat_rx_offset = 3193 ugeth->thread_dat_rx_offset =
3206 qe_muram_alloc(numThreadsRxNumerical * 3194 qe_muram_alloc(numThreadsRxNumerical *
3207 sizeof(ucc_geth_thread_data_rx_t), 3195 sizeof(struct ucc_geth_thread_data_rx),
3208 UCC_GETH_THREAD_DATA_ALIGNMENT); 3196 UCC_GETH_THREAD_DATA_ALIGNMENT);
3209 if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) { 3197 if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) {
3210 ugeth_err 3198 ugeth_err
@@ -3215,7 +3203,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3215 } 3203 }
3216 3204
3217 ugeth->p_thread_data_rx = 3205 ugeth->p_thread_data_rx =
3218 (ucc_geth_thread_data_rx_t *) qe_muram_addr(ugeth-> 3206 (struct ucc_geth_thread_data_rx *) qe_muram_addr(ugeth->
3219 thread_dat_rx_offset); 3207 thread_dat_rx_offset);
3220 out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset); 3208 out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset);
3221 3209
@@ -3227,7 +3215,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3227 statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) { 3215 statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) {
3228 ugeth->rx_fw_statistics_pram_offset = 3216 ugeth->rx_fw_statistics_pram_offset =
3229 qe_muram_alloc(sizeof 3217 qe_muram_alloc(sizeof
3230 (ucc_geth_rx_firmware_statistics_pram_t), 3218 (struct ucc_geth_rx_firmware_statistics_pram),
3231 UCC_GETH_RX_STATISTICS_ALIGNMENT); 3219 UCC_GETH_RX_STATISTICS_ALIGNMENT);
3232 if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) { 3220 if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) {
3233 ugeth_err 3221 ugeth_err
@@ -3237,11 +3225,11 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3237 return -ENOMEM; 3225 return -ENOMEM;
3238 } 3226 }
3239 ugeth->p_rx_fw_statistics_pram = 3227 ugeth->p_rx_fw_statistics_pram =
3240 (ucc_geth_rx_firmware_statistics_pram_t *) 3228 (struct ucc_geth_rx_firmware_statistics_pram *)
3241 qe_muram_addr(ugeth->rx_fw_statistics_pram_offset); 3229 qe_muram_addr(ugeth->rx_fw_statistics_pram_offset);
3242 /* Zero out p_rx_fw_statistics_pram */ 3230 /* Zero out p_rx_fw_statistics_pram */
3243 memset(ugeth->p_rx_fw_statistics_pram, 0, 3231 memset(ugeth->p_rx_fw_statistics_pram, 0,
3244 sizeof(ucc_geth_rx_firmware_statistics_pram_t)); 3232 sizeof(struct ucc_geth_rx_firmware_statistics_pram));
3245 } 3233 }
3246 3234
3247 /* intCoalescingPtr */ 3235 /* intCoalescingPtr */
@@ -3249,7 +3237,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3249 /* Size varies with number of Rx queues */ 3237 /* Size varies with number of Rx queues */
3250 ugeth->rx_irq_coalescing_tbl_offset = 3238 ugeth->rx_irq_coalescing_tbl_offset =
3251 qe_muram_alloc(ug_info->numQueuesRx * 3239 qe_muram_alloc(ug_info->numQueuesRx *
3252 sizeof(ucc_geth_rx_interrupt_coalescing_entry_t), 3240 sizeof(struct ucc_geth_rx_interrupt_coalescing_entry),
3253 UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); 3241 UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT);
3254 if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) { 3242 if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) {
3255 ugeth_err 3243 ugeth_err
@@ -3260,7 +3248,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3260 } 3248 }
3261 3249
3262 ugeth->p_rx_irq_coalescing_tbl = 3250 ugeth->p_rx_irq_coalescing_tbl =
3263 (ucc_geth_rx_interrupt_coalescing_table_t *) 3251 (struct ucc_geth_rx_interrupt_coalescing_table *)
3264 qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset); 3252 qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset);
3265 out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr, 3253 out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr,
3266 ugeth->rx_irq_coalescing_tbl_offset); 3254 ugeth->rx_irq_coalescing_tbl_offset);
@@ -3300,7 +3288,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3300 l3qt = 0; 3288 l3qt = 0;
3301 for (i = 0; i < 8; i++) 3289 for (i = 0; i < 8; i++)
3302 l3qt |= (ug_info->l3qt[j + i] << (28 - 4 * i)); 3290 l3qt |= (ug_info->l3qt[j + i] << (28 - 4 * i));
3303 out_be32(&ugeth->p_rx_glbl_pram->l3qt[j], l3qt); 3291 out_be32(&ugeth->p_rx_glbl_pram->l3qt[j/8], l3qt);
3304 } 3292 }
3305 3293
3306 /* vlantype */ 3294 /* vlantype */
@@ -3316,8 +3304,8 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3316 /* Size varies with number of Rx queues */ 3304 /* Size varies with number of Rx queues */
3317 ugeth->rx_bd_qs_tbl_offset = 3305 ugeth->rx_bd_qs_tbl_offset =
3318 qe_muram_alloc(ug_info->numQueuesRx * 3306 qe_muram_alloc(ug_info->numQueuesRx *
3319 (sizeof(ucc_geth_rx_bd_queues_entry_t) + 3307 (sizeof(struct ucc_geth_rx_bd_queues_entry) +
3320 sizeof(ucc_geth_rx_prefetched_bds_t)), 3308 sizeof(struct ucc_geth_rx_prefetched_bds)),
3321 UCC_GETH_RX_BD_QUEUES_ALIGNMENT); 3309 UCC_GETH_RX_BD_QUEUES_ALIGNMENT);
3322 if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) { 3310 if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) {
3323 ugeth_err 3311 ugeth_err
@@ -3328,14 +3316,14 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3328 } 3316 }
3329 3317
3330 ugeth->p_rx_bd_qs_tbl = 3318 ugeth->p_rx_bd_qs_tbl =
3331 (ucc_geth_rx_bd_queues_entry_t *) qe_muram_addr(ugeth-> 3319 (struct ucc_geth_rx_bd_queues_entry *) qe_muram_addr(ugeth->
3332 rx_bd_qs_tbl_offset); 3320 rx_bd_qs_tbl_offset);
3333 out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset); 3321 out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset);
3334 /* Zero out p_rx_bd_qs_tbl */ 3322 /* Zero out p_rx_bd_qs_tbl */
3335 memset(ugeth->p_rx_bd_qs_tbl, 3323 memset(ugeth->p_rx_bd_qs_tbl,
3336 0, 3324 0,
3337 ug_info->numQueuesRx * (sizeof(ucc_geth_rx_bd_queues_entry_t) + 3325 ug_info->numQueuesRx * (sizeof(struct ucc_geth_rx_bd_queues_entry) +
3338 sizeof(ucc_geth_rx_prefetched_bds_t))); 3326 sizeof(struct ucc_geth_rx_prefetched_bds)));
3339 3327
3340 /* Setup the table */ 3328 /* Setup the table */
3341 /* Assume BD rings are already established */ 3329 /* Assume BD rings are already established */
@@ -3406,7 +3394,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3406 /* Allocate memory for extended filtering Mode Global 3394 /* Allocate memory for extended filtering Mode Global
3407 Parameters */ 3395 Parameters */
3408 ugeth->exf_glbl_param_offset = 3396 ugeth->exf_glbl_param_offset =
3409 qe_muram_alloc(sizeof(ucc_geth_exf_global_pram_t), 3397 qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram),
3410 UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); 3398 UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT);
3411 if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) { 3399 if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) {
3412 ugeth_err 3400 ugeth_err
@@ -3417,7 +3405,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3417 } 3405 }
3418 3406
3419 ugeth->p_exf_glbl_param = 3407 ugeth->p_exf_glbl_param =
3420 (ucc_geth_exf_global_pram_t *) qe_muram_addr(ugeth-> 3408 (struct ucc_geth_exf_global_pram *) qe_muram_addr(ugeth->
3421 exf_glbl_param_offset); 3409 exf_glbl_param_offset);
3422 out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam, 3410 out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam,
3423 ugeth->exf_glbl_param_offset); 3411 ugeth->exf_glbl_param_offset);
@@ -3439,7 +3427,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3439 INIT_LIST_HEAD(&ugeth->ind_hash_q); 3427 INIT_LIST_HEAD(&ugeth->ind_hash_q);
3440 } 3428 }
3441 p_82xx_addr_filt = 3429 p_82xx_addr_filt =
3442 (ucc_geth_82xx_address_filtering_pram_t *) ugeth-> 3430 (struct ucc_geth_82xx_address_filtering_pram *) ugeth->
3443 p_rx_glbl_pram->addressfiltering; 3431 p_rx_glbl_pram->addressfiltering;
3444 3432
3445 ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth, 3433 ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth,
@@ -3462,7 +3450,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3462 * allocated resources can be released when the channel is freed. 3450 * allocated resources can be released when the channel is freed.
3463 */ 3451 */
3464 if (!(ugeth->p_init_enet_param_shadow = 3452 if (!(ugeth->p_init_enet_param_shadow =
3465 (ucc_geth_init_pram_t *) kmalloc(sizeof(ucc_geth_init_pram_t), 3453 (struct ucc_geth_init_pram *) kmalloc(sizeof(struct ucc_geth_init_pram),
3466 GFP_KERNEL))) { 3454 GFP_KERNEL))) {
3467 ugeth_err 3455 ugeth_err
3468 ("%s: Can not allocate memory for" 3456 ("%s: Can not allocate memory for"
@@ -3472,7 +3460,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3472 } 3460 }
3473 /* Zero out *p_init_enet_param_shadow */ 3461 /* Zero out *p_init_enet_param_shadow */
3474 memset((char *)ugeth->p_init_enet_param_shadow, 3462 memset((char *)ugeth->p_init_enet_param_shadow,
3475 0, sizeof(ucc_geth_init_pram_t)); 3463 0, sizeof(struct ucc_geth_init_pram));
3476 3464
3477 /* Fill shadow InitEnet command parameter structure */ 3465 /* Fill shadow InitEnet command parameter structure */
3478 3466
@@ -3506,7 +3494,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3506 } 3494 }
3507 ugeth->p_init_enet_param_shadow->largestexternallookupkeysize = 3495 ugeth->p_init_enet_param_shadow->largestexternallookupkeysize =
3508 ug_info->largestexternallookupkeysize; 3496 ug_info->largestexternallookupkeysize;
3509 size = sizeof(ucc_geth_thread_rx_pram_t); 3497 size = sizeof(struct ucc_geth_thread_rx_pram);
3510 if (ug_info->rxExtendedFiltering) { 3498 if (ug_info->rxExtendedFiltering) {
3511 size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; 3499 size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING;
3512 if (ug_info->largestexternallookupkeysize == 3500 if (ug_info->largestexternallookupkeysize ==
@@ -3537,7 +3525,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3537 fill_init_enet_entries(ugeth, 3525 fill_init_enet_entries(ugeth,
3538 &(ugeth->p_init_enet_param_shadow-> 3526 &(ugeth->p_init_enet_param_shadow->
3539 txthread[0]), numThreadsTxNumerical, 3527 txthread[0]), numThreadsTxNumerical,
3540 sizeof(ucc_geth_thread_tx_pram_t), 3528 sizeof(struct ucc_geth_thread_tx_pram),
3541 UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, 3529 UCC_GETH_THREAD_TX_PRAM_ALIGNMENT,
3542 ug_info->riscTx, 0)) != 0) { 3530 ug_info->riscTx, 0)) != 0) {
3543 ugeth_err("%s: Can not fill p_init_enet_param_shadow.", 3531 ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
@@ -3557,7 +3545,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3557 } 3545 }
3558 3546
3559 /* Allocate InitEnet command parameter structure */ 3547 /* Allocate InitEnet command parameter structure */
3560 init_enet_pram_offset = qe_muram_alloc(sizeof(ucc_geth_init_pram_t), 4); 3548 init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4);
3561 if (IS_MURAM_ERR(init_enet_pram_offset)) { 3549 if (IS_MURAM_ERR(init_enet_pram_offset)) {
3562 ugeth_err 3550 ugeth_err
3563 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", 3551 ("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
@@ -3566,7 +3554,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3566 return -ENOMEM; 3554 return -ENOMEM;
3567 } 3555 }
3568 p_init_enet_pram = 3556 p_init_enet_pram =
3569 (ucc_geth_init_pram_t *) qe_muram_addr(init_enet_pram_offset); 3557 (struct ucc_geth_init_pram *) qe_muram_addr(init_enet_pram_offset);
3570 3558
3571 /* Copy shadow InitEnet command parameter structure into PRAM */ 3559 /* Copy shadow InitEnet command parameter structure into PRAM */
3572 p_init_enet_pram->resinit1 = ugeth->p_init_enet_param_shadow->resinit1; 3560 p_init_enet_pram->resinit1 = ugeth->p_init_enet_param_shadow->resinit1;
@@ -3591,7 +3579,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3591 /* Issue QE command */ 3579 /* Issue QE command */
3592 cecr_subblock = 3580 cecr_subblock =
3593 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); 3581 ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
3594 qe_issue_cmd(command, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, 3582 qe_issue_cmd(command, cecr_subblock, QE_CR_PROTOCOL_ETHERNET,
3595 init_enet_pram_offset); 3583 init_enet_pram_offset);
3596 3584
3597 /* Free InitEnet command parameter */ 3585 /* Free InitEnet command parameter */
@@ -3603,7 +3591,7 @@ static int ucc_geth_startup(ucc_geth_private_t *ugeth)
3603/* returns a net_device_stats structure pointer */ 3591/* returns a net_device_stats structure pointer */
3604static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev) 3592static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev)
3605{ 3593{
3606 ucc_geth_private_t *ugeth = netdev_priv(dev); 3594 struct ucc_geth_private *ugeth = netdev_priv(dev);
3607 3595
3608 return &(ugeth->stats); 3596 return &(ugeth->stats);
3609} 3597}
@@ -3614,7 +3602,7 @@ static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev)
3614 * starting over will fix the problem. */ 3602 * starting over will fix the problem. */
3615static void ucc_geth_timeout(struct net_device *dev) 3603static void ucc_geth_timeout(struct net_device *dev)
3616{ 3604{
3617 ucc_geth_private_t *ugeth = netdev_priv(dev); 3605 struct ucc_geth_private *ugeth = netdev_priv(dev);
3618 3606
3619 ugeth_vdbg("%s: IN", __FUNCTION__); 3607 ugeth_vdbg("%s: IN", __FUNCTION__);
3620 3608
@@ -3634,7 +3622,7 @@ static void ucc_geth_timeout(struct net_device *dev)
3634/* It is pointed to by the dev->hard_start_xmit function pointer */ 3622/* It is pointed to by the dev->hard_start_xmit function pointer */
3635static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) 3623static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3636{ 3624{
3637 ucc_geth_private_t *ugeth = netdev_priv(dev); 3625 struct ucc_geth_private *ugeth = netdev_priv(dev);
3638 u8 *bd; /* BD pointer */ 3626 u8 *bd; /* BD pointer */
3639 u32 bd_status; 3627 u32 bd_status;
3640 u8 txQ = 0; 3628 u8 txQ = 0;
@@ -3647,7 +3635,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3647 3635
3648 /* Start from the next BD that should be filled */ 3636 /* Start from the next BD that should be filled */
3649 bd = ugeth->txBd[txQ]; 3637 bd = ugeth->txBd[txQ];
3650 bd_status = BD_STATUS_AND_LENGTH(bd); 3638 bd_status = in_be32((u32 *)bd);
3651 /* Save the skb pointer so we can free it later */ 3639 /* Save the skb pointer so we can free it later */
3652 ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb; 3640 ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb;
3653 3641
@@ -3657,20 +3645,21 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3657 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]); 3645 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
3658 3646
3659 /* set up the buffer descriptor */ 3647 /* set up the buffer descriptor */
3660 BD_BUFFER_SET(bd, 3648 out_be32(&((struct qe_bd *)bd)->buf,
3661 dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); 3649 dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE));
3662 3650
3663 //printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); 3651 /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */
3664 3652
3665 bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len; 3653 bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len;
3666 3654
3667 BD_STATUS_AND_LENGTH_SET(bd, bd_status); 3655 /* set bd status and length */
3656 out_be32((u32 *)bd, bd_status);
3668 3657
3669 dev->trans_start = jiffies; 3658 dev->trans_start = jiffies;
3670 3659
3671 /* Move to next BD in the ring */ 3660 /* Move to next BD in the ring */
3672 if (!(bd_status & T_W)) 3661 if (!(bd_status & T_W))
3673 ugeth->txBd[txQ] = bd + UCC_GETH_SIZE_OF_BD; 3662 ugeth->txBd[txQ] = bd + sizeof(struct qe_bd);
3674 else 3663 else
3675 ugeth->txBd[txQ] = ugeth->p_tx_bd_ring[txQ]; 3664 ugeth->txBd[txQ] = ugeth->p_tx_bd_ring[txQ];
3676 3665
@@ -3695,7 +3684,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3695 return 0; 3684 return 0;
3696} 3685}
3697 3686
3698static int ucc_geth_rx(ucc_geth_private_t *ugeth, u8 rxQ, int rx_work_limit) 3687static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit)
3699{ 3688{
3700 struct sk_buff *skb; 3689 struct sk_buff *skb;
3701 u8 *bd; 3690 u8 *bd;
@@ -3709,11 +3698,11 @@ static int ucc_geth_rx(ucc_geth_private_t *ugeth, u8 rxQ, int rx_work_limit)
3709 /* collect received buffers */ 3698 /* collect received buffers */
3710 bd = ugeth->rxBd[rxQ]; 3699 bd = ugeth->rxBd[rxQ];
3711 3700
3712 bd_status = BD_STATUS_AND_LENGTH(bd); 3701 bd_status = in_be32((u32 *)bd);
3713 3702
3714 /* while there are received buffers and BD is full (~R_E) */ 3703 /* while there are received buffers and BD is full (~R_E) */
3715 while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) { 3704 while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) {
3716 bdBuffer = (u8 *) BD_BUFFER(bd); 3705 bdBuffer = (u8 *) in_be32(&((struct qe_bd *)bd)->buf);
3717 length = (u16) ((bd_status & BD_LENGTH_MASK) - 4); 3706 length = (u16) ((bd_status & BD_LENGTH_MASK) - 4);
3718 skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]]; 3707 skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]];
3719 3708
@@ -3768,9 +3757,9 @@ static int ucc_geth_rx(ucc_geth_private_t *ugeth, u8 rxQ, int rx_work_limit)
3768 if (bd_status & R_W) 3757 if (bd_status & R_W)
3769 bd = ugeth->p_rx_bd_ring[rxQ]; 3758 bd = ugeth->p_rx_bd_ring[rxQ];
3770 else 3759 else
3771 bd += UCC_GETH_SIZE_OF_BD; 3760 bd += sizeof(struct qe_bd);
3772 3761
3773 bd_status = BD_STATUS_AND_LENGTH(bd); 3762 bd_status = in_be32((u32 *)bd);
3774 } 3763 }
3775 3764
3776 ugeth->rxBd[rxQ] = bd; 3765 ugeth->rxBd[rxQ] = bd;
@@ -3781,12 +3770,12 @@ static int ucc_geth_rx(ucc_geth_private_t *ugeth, u8 rxQ, int rx_work_limit)
3781static int ucc_geth_tx(struct net_device *dev, u8 txQ) 3770static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3782{ 3771{
3783 /* Start from the next BD that should be filled */ 3772 /* Start from the next BD that should be filled */
3784 ucc_geth_private_t *ugeth = netdev_priv(dev); 3773 struct ucc_geth_private *ugeth = netdev_priv(dev);
3785 u8 *bd; /* BD pointer */ 3774 u8 *bd; /* BD pointer */
3786 u32 bd_status; 3775 u32 bd_status;
3787 3776
3788 bd = ugeth->confBd[txQ]; 3777 bd = ugeth->confBd[txQ];
3789 bd_status = BD_STATUS_AND_LENGTH(bd); 3778 bd_status = in_be32((u32 *)bd);
3790 3779
3791 /* Normal processing. */ 3780 /* Normal processing. */
3792 while ((bd_status & T_R) == 0) { 3781 while ((bd_status & T_R) == 0) {
@@ -3813,7 +3802,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3813 3802
3814 /* Advance the confirmation BD pointer */ 3803 /* Advance the confirmation BD pointer */
3815 if (!(bd_status & T_W)) 3804 if (!(bd_status & T_W))
3816 ugeth->confBd[txQ] += UCC_GETH_SIZE_OF_BD; 3805 ugeth->confBd[txQ] += sizeof(struct qe_bd);
3817 else 3806 else
3818 ugeth->confBd[txQ] = ugeth->p_tx_bd_ring[txQ]; 3807 ugeth->confBd[txQ] = ugeth->p_tx_bd_ring[txQ];
3819 } 3808 }
@@ -3823,7 +3812,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3823#ifdef CONFIG_UGETH_NAPI 3812#ifdef CONFIG_UGETH_NAPI
3824static int ucc_geth_poll(struct net_device *dev, int *budget) 3813static int ucc_geth_poll(struct net_device *dev, int *budget)
3825{ 3814{
3826 ucc_geth_private_t *ugeth = netdev_priv(dev); 3815 struct ucc_geth_private *ugeth = netdev_priv(dev);
3827 int howmany; 3816 int howmany;
3828 int rx_work_limit = *budget; 3817 int rx_work_limit = *budget;
3829 u8 rxQ = 0; 3818 u8 rxQ = 0;
@@ -3847,9 +3836,9 @@ static int ucc_geth_poll(struct net_device *dev, int *budget)
3847static irqreturn_t ucc_geth_irq_handler(int irq, void *info) 3836static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3848{ 3837{
3849 struct net_device *dev = (struct net_device *)info; 3838 struct net_device *dev = (struct net_device *)info;
3850 ucc_geth_private_t *ugeth = netdev_priv(dev); 3839 struct ucc_geth_private *ugeth = netdev_priv(dev);
3851 ucc_fast_private_t *uccf; 3840 struct ucc_fast_private *uccf;
3852 ucc_geth_info_t *ug_info; 3841 struct ucc_geth_info *ug_info;
3853 register u32 ucce = 0; 3842 register u32 ucce = 0;
3854 register u32 bit_mask = UCCE_RXBF_SINGLE_MASK; 3843 register u32 bit_mask = UCCE_RXBF_SINGLE_MASK;
3855 register u32 tx_mask = UCCE_TXBF_SINGLE_MASK; 3844 register u32 tx_mask = UCCE_TXBF_SINGLE_MASK;
@@ -3912,7 +3901,7 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3912static irqreturn_t phy_interrupt(int irq, void *dev_id) 3901static irqreturn_t phy_interrupt(int irq, void *dev_id)
3913{ 3902{
3914 struct net_device *dev = (struct net_device *)dev_id; 3903 struct net_device *dev = (struct net_device *)dev_id;
3915 ucc_geth_private_t *ugeth = netdev_priv(dev); 3904 struct ucc_geth_private *ugeth = netdev_priv(dev);
3916 3905
3917 ugeth_vdbg("%s: IN", __FUNCTION__); 3906 ugeth_vdbg("%s: IN", __FUNCTION__);
3918 3907
@@ -3932,8 +3921,8 @@ static irqreturn_t phy_interrupt(int irq, void *dev_id)
3932static void ugeth_phy_change(void *data) 3921static void ugeth_phy_change(void *data)
3933{ 3922{
3934 struct net_device *dev = (struct net_device *)data; 3923 struct net_device *dev = (struct net_device *)data;
3935 ucc_geth_private_t *ugeth = netdev_priv(dev); 3924 struct ucc_geth_private *ugeth = netdev_priv(dev);
3936 ucc_geth_t *ug_regs; 3925 struct ucc_geth *ug_regs;
3937 int result = 0; 3926 int result = 0;
3938 3927
3939 ugeth_vdbg("%s: IN", __FUNCTION__); 3928 ugeth_vdbg("%s: IN", __FUNCTION__);
@@ -3963,7 +3952,7 @@ static void ugeth_phy_change(void *data)
3963static void ugeth_phy_timer(unsigned long data) 3952static void ugeth_phy_timer(unsigned long data)
3964{ 3953{
3965 struct net_device *dev = (struct net_device *)data; 3954 struct net_device *dev = (struct net_device *)data;
3966 ucc_geth_private_t *ugeth = netdev_priv(dev); 3955 struct ucc_geth_private *ugeth = netdev_priv(dev);
3967 3956
3968 schedule_work(&ugeth->tq); 3957 schedule_work(&ugeth->tq);
3969 3958
@@ -3979,7 +3968,7 @@ static void ugeth_phy_timer(unsigned long data)
3979static void ugeth_phy_startup_timer(unsigned long data) 3968static void ugeth_phy_startup_timer(unsigned long data)
3980{ 3969{
3981 struct ugeth_mii_info *mii_info = (struct ugeth_mii_info *)data; 3970 struct ugeth_mii_info *mii_info = (struct ugeth_mii_info *)data;
3982 ucc_geth_private_t *ugeth = netdev_priv(mii_info->dev); 3971 struct ucc_geth_private *ugeth = netdev_priv(mii_info->dev);
3983 static int secondary = UGETH_AN_TIMEOUT; 3972 static int secondary = UGETH_AN_TIMEOUT;
3984 int result; 3973 int result;
3985 3974
@@ -4034,7 +4023,7 @@ static void ugeth_phy_startup_timer(unsigned long data)
4034/* Returns 0 for success. */ 4023/* Returns 0 for success. */
4035static int ucc_geth_open(struct net_device *dev) 4024static int ucc_geth_open(struct net_device *dev)
4036{ 4025{
4037 ucc_geth_private_t *ugeth = netdev_priv(dev); 4026 struct ucc_geth_private *ugeth = netdev_priv(dev);
4038 int err; 4027 int err;
4039 4028
4040 ugeth_vdbg("%s: IN", __FUNCTION__); 4029 ugeth_vdbg("%s: IN", __FUNCTION__);
@@ -4111,7 +4100,7 @@ static int ucc_geth_open(struct net_device *dev)
4111/* Stops the kernel queue, and halts the controller */ 4100/* Stops the kernel queue, and halts the controller */
4112static int ucc_geth_close(struct net_device *dev) 4101static int ucc_geth_close(struct net_device *dev)
4113{ 4102{
4114 ucc_geth_private_t *ugeth = netdev_priv(dev); 4103 struct ucc_geth_private *ugeth = netdev_priv(dev);
4115 4104
4116 ugeth_vdbg("%s: IN", __FUNCTION__); 4105 ugeth_vdbg("%s: IN", __FUNCTION__);
4117 4106
@@ -4130,30 +4119,53 @@ static int ucc_geth_close(struct net_device *dev)
4130 4119
4131const struct ethtool_ops ucc_geth_ethtool_ops = { }; 4120const struct ethtool_ops ucc_geth_ethtool_ops = { };
4132 4121
4133static int ucc_geth_probe(struct device *device) 4122static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match)
4134{ 4123{
4135 struct platform_device *pdev = to_platform_device(device); 4124 struct device *device = &ofdev->dev;
4136 struct ucc_geth_platform_data *ugeth_pdata; 4125 struct device_node *np = ofdev->node;
4137 struct net_device *dev = NULL; 4126 struct net_device *dev = NULL;
4138 struct ucc_geth_private *ugeth = NULL; 4127 struct ucc_geth_private *ugeth = NULL;
4139 struct ucc_geth_info *ug_info; 4128 struct ucc_geth_info *ug_info;
4140 int err; 4129 struct resource res;
4130 struct device_node *phy;
4131 int err, ucc_num, phy_interface;
4141 static int mii_mng_configured = 0; 4132 static int mii_mng_configured = 0;
4133 const phandle *ph;
4134 const unsigned int *prop;
4142 4135
4143 ugeth_vdbg("%s: IN", __FUNCTION__); 4136 ugeth_vdbg("%s: IN", __FUNCTION__);
4144 4137
4145 ugeth_pdata = (struct ucc_geth_platform_data *)pdev->dev.platform_data; 4138 prop = get_property(np, "device-id", NULL);
4139 ucc_num = *prop - 1;
4140 if ((ucc_num < 0) || (ucc_num > 7))
4141 return -ENODEV;
4142
4143 ug_info = &ugeth_info[ucc_num];
4144 ug_info->uf_info.ucc_num = ucc_num;
4145 prop = get_property(np, "rx-clock", NULL);
4146 ug_info->uf_info.rx_clock = *prop;
4147 prop = get_property(np, "tx-clock", NULL);
4148 ug_info->uf_info.tx_clock = *prop;
4149 err = of_address_to_resource(np, 0, &res);
4150 if (err)
4151 return -EINVAL;
4152
4153 ug_info->uf_info.regs = res.start;
4154 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
4155
4156 ph = get_property(np, "phy-handle", NULL);
4157 phy = of_find_node_by_phandle(*ph);
4146 4158
4147 ug_info = &ugeth_info[pdev->id]; 4159 if (phy == NULL)
4148 ug_info->uf_info.ucc_num = pdev->id; 4160 return -ENODEV;
4149 ug_info->uf_info.rx_clock = ugeth_pdata->rx_clock; 4161
4150 ug_info->uf_info.tx_clock = ugeth_pdata->tx_clock; 4162 prop = get_property(phy, "reg", NULL);
4151 ug_info->uf_info.regs = ugeth_pdata->phy_reg_addr; 4163 ug_info->phy_address = *prop;
4152 ug_info->uf_info.irq = platform_get_irq(pdev, 0); 4164 prop = get_property(phy, "interface", NULL);
4153 ug_info->phy_address = ugeth_pdata->phy_id; 4165 ug_info->enet_interface = *prop;
4154 ug_info->enet_interface = ugeth_pdata->phy_interface; 4166 ug_info->phy_interrupt = irq_of_parse_and_map(phy, 0);
4155 ug_info->board_flags = ugeth_pdata->board_flags; 4167 ug_info->board_flags = (ug_info->phy_interrupt == NO_IRQ)?
4156 ug_info->phy_interrupt = ugeth_pdata->phy_interrupt; 4168 0:FSL_UGETH_BRD_HAS_PHY_INTR;
4157 4169
4158 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", 4170 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
4159 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, 4171 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
@@ -4161,12 +4173,44 @@ static int ucc_geth_probe(struct device *device)
4161 4173
4162 if (ug_info == NULL) { 4174 if (ug_info == NULL) {
4163 ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__, 4175 ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__,
4164 pdev->id); 4176 ucc_num);
4165 return -ENODEV; 4177 return -ENODEV;
4166 } 4178 }
4167 4179
4180 /* FIXME: Work around for early chip rev. */
4181 /* There's a bug in initial chip rev(s) in the RGMII ac */
4182 /* timing. */
4183 /* The following compensates by writing to the reserved */
4184 /* QE Port Output Hold Registers (CPOH1?). */
4185 prop = get_property(phy, "interface", NULL);
4186 phy_interface = *prop;
4187 if ((phy_interface == ENET_1000_RGMII) ||
4188 (phy_interface == ENET_100_RGMII) ||
4189 (phy_interface == ENET_10_RGMII)) {
4190 struct device_node *soc;
4191 phys_addr_t immrbase = -1;
4192 u32 *tmp_reg;
4193 u32 tmp_val;
4194
4195 soc = of_find_node_by_type(NULL, "soc");
4196 if (soc) {
4197 unsigned int size;
4198 const void *prop = get_property(soc, "reg", &size);
4199 immrbase = of_translate_address(soc, prop);
4200 of_node_put(soc);
4201 };
4202
4203 tmp_reg = (u32 *) ioremap(immrbase + 0x14A8, 0x4);
4204 tmp_val = in_be32(tmp_reg);
4205 if (ucc_num == 1)
4206 out_be32(tmp_reg, tmp_val | 0x00003000);
4207 else if (ucc_num == 2)
4208 out_be32(tmp_reg, tmp_val | 0x0c000000);
4209 iounmap(tmp_reg);
4210 }
4211
4168 if (!mii_mng_configured) { 4212 if (!mii_mng_configured) {
4169 ucc_set_qe_mux_mii_mng(ug_info->uf_info.ucc_num); 4213 ucc_set_qe_mux_mii_mng(ucc_num);
4170 mii_mng_configured = 1; 4214 mii_mng_configured = 1;
4171 } 4215 }
4172 4216
@@ -4213,13 +4257,14 @@ static int ucc_geth_probe(struct device *device)
4213 4257
4214 ugeth->ug_info = ug_info; 4258 ugeth->ug_info = ug_info;
4215 ugeth->dev = dev; 4259 ugeth->dev = dev;
4216 memcpy(dev->dev_addr, ugeth_pdata->mac_addr, 6); 4260 memcpy(dev->dev_addr, get_property(np, "mac-address", NULL), 6);
4217 4261
4218 return 0; 4262 return 0;
4219} 4263}
4220 4264
4221static int ucc_geth_remove(struct device *device) 4265static int ucc_geth_remove(struct of_device* ofdev)
4222{ 4266{
4267 struct device *device = &ofdev->dev;
4223 struct net_device *dev = dev_get_drvdata(device); 4268 struct net_device *dev = dev_get_drvdata(device);
4224 struct ucc_geth_private *ugeth = netdev_priv(dev); 4269 struct ucc_geth_private *ugeth = netdev_priv(dev);
4225 4270
@@ -4230,28 +4275,38 @@ static int ucc_geth_remove(struct device *device)
4230 return 0; 4275 return 0;
4231} 4276}
4232 4277
4233/* Structure for a device driver */ 4278static struct of_device_id ucc_geth_match[] = {
4234static struct device_driver ucc_geth_driver = { 4279 {
4235 .name = DRV_NAME, 4280 .type = "network",
4236 .bus = &platform_bus_type, 4281 .compatible = "ucc_geth",
4237 .probe = ucc_geth_probe, 4282 },
4238 .remove = ucc_geth_remove, 4283 {},
4284};
4285
4286MODULE_DEVICE_TABLE(of, ucc_geth_match);
4287
4288static struct of_platform_driver ucc_geth_driver = {
4289 .name = DRV_NAME,
4290 .match_table = ucc_geth_match,
4291 .probe = ucc_geth_probe,
4292 .remove = ucc_geth_remove,
4239}; 4293};
4240 4294
4241static int __init ucc_geth_init(void) 4295static int __init ucc_geth_init(void)
4242{ 4296{
4243 int i; 4297 int i;
4298
4244 printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); 4299 printk(KERN_INFO "ucc_geth: " DRV_DESC "\n");
4245 for (i = 0; i < 8; i++) 4300 for (i = 0; i < 8; i++)
4246 memcpy(&(ugeth_info[i]), &ugeth_primary_info, 4301 memcpy(&(ugeth_info[i]), &ugeth_primary_info,
4247 sizeof(ugeth_primary_info)); 4302 sizeof(ugeth_primary_info));
4248 4303
4249 return driver_register(&ucc_geth_driver); 4304 return of_register_driver(&ucc_geth_driver);
4250} 4305}
4251 4306
4252static void __exit ucc_geth_exit(void) 4307static void __exit ucc_geth_exit(void)
4253{ 4308{
4254 driver_unregister(&ucc_geth_driver); 4309 of_unregister_driver(&ucc_geth_driver);
4255} 4310}
4256 4311
4257module_init(ucc_geth_init); 4312module_init(ucc_geth_init);
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 005965f5dd9b..a66561253593 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -36,24 +36,24 @@
36#define ENET_INIT_PARAM_MAX_ENTRIES_RX 9 36#define ENET_INIT_PARAM_MAX_ENTRIES_RX 9
37#define ENET_INIT_PARAM_MAX_ENTRIES_TX 8 37#define ENET_INIT_PARAM_MAX_ENTRIES_TX 8
38 38
39typedef struct ucc_mii_mng { 39struct ucc_mii_mng {
40 u32 miimcfg; /* MII management configuration reg */ 40 u32 miimcfg; /* MII management configuration reg */
41 u32 miimcom; /* MII management command reg */ 41 u32 miimcom; /* MII management command reg */
42 u32 miimadd; /* MII management address reg */ 42 u32 miimadd; /* MII management address reg */
43 u32 miimcon; /* MII management control reg */ 43 u32 miimcon; /* MII management control reg */
44 u32 miimstat; /* MII management status reg */ 44 u32 miimstat; /* MII management status reg */
45 u32 miimind; /* MII management indication reg */ 45 u32 miimind; /* MII management indication reg */
46} __attribute__ ((packed)) ucc_mii_mng_t; 46} __attribute__ ((packed));
47 47
48typedef struct ucc_geth { 48struct ucc_geth {
49 ucc_fast_t uccf; 49 struct ucc_fast uccf;
50 50
51 u32 maccfg1; /* mac configuration reg. 1 */ 51 u32 maccfg1; /* mac configuration reg. 1 */
52 u32 maccfg2; /* mac configuration reg. 2 */ 52 u32 maccfg2; /* mac configuration reg. 2 */
53 u32 ipgifg; /* interframe gap reg. */ 53 u32 ipgifg; /* interframe gap reg. */
54 u32 hafdup; /* half-duplex reg. */ 54 u32 hafdup; /* half-duplex reg. */
55 u8 res1[0x10]; 55 u8 res1[0x10];
56 ucc_mii_mng_t miimng; /* MII management structure */ 56 struct ucc_mii_mng miimng; /* MII management structure */
57 u32 ifctl; /* interface control reg */ 57 u32 ifctl; /* interface control reg */
58 u32 ifstat; /* interface statux reg */ 58 u32 ifstat; /* interface statux reg */
59 u32 macstnaddr1; /* mac station address part 1 reg */ 59 u32 macstnaddr1; /* mac station address part 1 reg */
@@ -111,7 +111,7 @@ typedef struct ucc_geth {
111 u32 scar; /* Statistics carry register */ 111 u32 scar; /* Statistics carry register */
112 u32 scam; /* Statistics caryy mask register */ 112 u32 scam; /* Statistics caryy mask register */
113 u8 res5[0x200 - 0x1c4]; 113 u8 res5[0x200 - 0x1c4];
114} __attribute__ ((packed)) ucc_geth_t; 114} __attribute__ ((packed));
115 115
116/* UCC GETH TEMODR Register */ 116/* UCC GETH TEMODR Register */
117#define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics 117#define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics
@@ -508,39 +508,39 @@ typedef struct ucc_geth {
508/* UCC GETH UDSR (Data Synchronization Register) */ 508/* UCC GETH UDSR (Data Synchronization Register) */
509#define UDSR_MAGIC 0x067E 509#define UDSR_MAGIC 0x067E
510 510
511typedef struct ucc_geth_thread_data_tx { 511struct ucc_geth_thread_data_tx {
512 u8 res0[104]; 512 u8 res0[104];
513} __attribute__ ((packed)) ucc_geth_thread_data_tx_t; 513} __attribute__ ((packed));
514 514
515typedef struct ucc_geth_thread_data_rx { 515struct ucc_geth_thread_data_rx {
516 u8 res0[40]; 516 u8 res0[40];
517} __attribute__ ((packed)) ucc_geth_thread_data_rx_t; 517} __attribute__ ((packed));
518 518
519/* Send Queue Queue-Descriptor */ 519/* Send Queue Queue-Descriptor */
520typedef struct ucc_geth_send_queue_qd { 520struct ucc_geth_send_queue_qd {
521 u32 bd_ring_base; /* pointer to BD ring base address */ 521 u32 bd_ring_base; /* pointer to BD ring base address */
522 u8 res0[0x8]; 522 u8 res0[0x8];
523 u32 last_bd_completed_address;/* initialize to last entry in BD ring */ 523 u32 last_bd_completed_address;/* initialize to last entry in BD ring */
524 u8 res1[0x30]; 524 u8 res1[0x30];
525} __attribute__ ((packed)) ucc_geth_send_queue_qd_t; 525} __attribute__ ((packed));
526 526
527typedef struct ucc_geth_send_queue_mem_region { 527struct ucc_geth_send_queue_mem_region {
528 ucc_geth_send_queue_qd_t sqqd[NUM_TX_QUEUES]; 528 struct ucc_geth_send_queue_qd sqqd[NUM_TX_QUEUES];
529} __attribute__ ((packed)) ucc_geth_send_queue_mem_region_t; 529} __attribute__ ((packed));
530 530
531typedef struct ucc_geth_thread_tx_pram { 531struct ucc_geth_thread_tx_pram {
532 u8 res0[64]; 532 u8 res0[64];
533} __attribute__ ((packed)) ucc_geth_thread_tx_pram_t; 533} __attribute__ ((packed));
534 534
535typedef struct ucc_geth_thread_rx_pram { 535struct ucc_geth_thread_rx_pram {
536 u8 res0[128]; 536 u8 res0[128];
537} __attribute__ ((packed)) ucc_geth_thread_rx_pram_t; 537} __attribute__ ((packed));
538 538
539#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING 64 539#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING 64
540#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8 64 540#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8 64
541#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16 96 541#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16 96
542 542
543typedef struct ucc_geth_scheduler { 543struct ucc_geth_scheduler {
544 u16 cpucount0; /* CPU packet counter */ 544 u16 cpucount0; /* CPU packet counter */
545 u16 cpucount1; /* CPU packet counter */ 545 u16 cpucount1; /* CPU packet counter */
546 u16 cecount0; /* QE packet counter */ 546 u16 cecount0; /* QE packet counter */
@@ -574,9 +574,9 @@ typedef struct ucc_geth_scheduler {
574 /**< weight factor for queues */ 574 /**< weight factor for queues */
575 u32 minw; /* temporary variable handled by QE */ 575 u32 minw; /* temporary variable handled by QE */
576 u8 res1[0x70 - 0x64]; 576 u8 res1[0x70 - 0x64];
577} __attribute__ ((packed)) ucc_geth_scheduler_t; 577} __attribute__ ((packed));
578 578
579typedef struct ucc_geth_tx_firmware_statistics_pram { 579struct ucc_geth_tx_firmware_statistics_pram {
580 u32 sicoltx; /* single collision */ 580 u32 sicoltx; /* single collision */
581 u32 mulcoltx; /* multiple collision */ 581 u32 mulcoltx; /* multiple collision */
582 u32 latecoltxfr; /* late collision */ 582 u32 latecoltxfr; /* late collision */
@@ -596,9 +596,9 @@ typedef struct ucc_geth_tx_firmware_statistics_pram {
596 and 1518 octets */ 596 and 1518 octets */
597 u32 txpktsjumbo; /* total packets (including bad) between 1024 597 u32 txpktsjumbo; /* total packets (including bad) between 1024
598 and MAXLength octets */ 598 and MAXLength octets */
599} __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_pram_t; 599} __attribute__ ((packed));
600 600
601typedef struct ucc_geth_rx_firmware_statistics_pram { 601struct ucc_geth_rx_firmware_statistics_pram {
602 u32 frrxfcser; /* frames with crc error */ 602 u32 frrxfcser; /* frames with crc error */
603 u32 fraligner; /* frames with alignment error */ 603 u32 fraligner; /* frames with alignment error */
604 u32 inrangelenrxer; /* in range length error */ 604 u32 inrangelenrxer; /* in range length error */
@@ -630,33 +630,33 @@ typedef struct ucc_geth_rx_firmware_statistics_pram {
630 replaced */ 630 replaced */
631 u32 insertvlan; /* total frames that had their VLAN tag 631 u32 insertvlan; /* total frames that had their VLAN tag
632 inserted */ 632 inserted */
633} __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_pram_t; 633} __attribute__ ((packed));
634 634
635typedef struct ucc_geth_rx_interrupt_coalescing_entry { 635struct ucc_geth_rx_interrupt_coalescing_entry {
636 u32 interruptcoalescingmaxvalue; /* interrupt coalescing max 636 u32 interruptcoalescingmaxvalue; /* interrupt coalescing max
637 value */ 637 value */
638 u32 interruptcoalescingcounter; /* interrupt coalescing counter, 638 u32 interruptcoalescingcounter; /* interrupt coalescing counter,
639 initialize to 639 initialize to
640 interruptcoalescingmaxvalue */ 640 interruptcoalescingmaxvalue */
641} __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_entry_t; 641} __attribute__ ((packed));
642 642
643typedef struct ucc_geth_rx_interrupt_coalescing_table { 643struct ucc_geth_rx_interrupt_coalescing_table {
644 ucc_geth_rx_interrupt_coalescing_entry_t coalescingentry[NUM_RX_QUEUES]; 644 struct ucc_geth_rx_interrupt_coalescing_entry coalescingentry[NUM_RX_QUEUES];
645 /**< interrupt coalescing entry */ 645 /**< interrupt coalescing entry */
646} __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_table_t; 646} __attribute__ ((packed));
647 647
648typedef struct ucc_geth_rx_prefetched_bds { 648struct ucc_geth_rx_prefetched_bds {
649 qe_bd_t bd[NUM_BDS_IN_PREFETCHED_BDS]; /* prefetched bd */ 649 struct qe_bd bd[NUM_BDS_IN_PREFETCHED_BDS]; /* prefetched bd */
650} __attribute__ ((packed)) ucc_geth_rx_prefetched_bds_t; 650} __attribute__ ((packed));
651 651
652typedef struct ucc_geth_rx_bd_queues_entry { 652struct ucc_geth_rx_bd_queues_entry {
653 u32 bdbaseptr; /* BD base pointer */ 653 u32 bdbaseptr; /* BD base pointer */
654 u32 bdptr; /* BD pointer */ 654 u32 bdptr; /* BD pointer */
655 u32 externalbdbaseptr; /* external BD base pointer */ 655 u32 externalbdbaseptr; /* external BD base pointer */
656 u32 externalbdptr; /* external BD pointer */ 656 u32 externalbdptr; /* external BD pointer */
657} __attribute__ ((packed)) ucc_geth_rx_bd_queues_entry_t; 657} __attribute__ ((packed));
658 658
659typedef struct ucc_geth_tx_global_pram { 659struct ucc_geth_tx_global_pram {
660 u16 temoder; 660 u16 temoder;
661 u8 res0[0x38 - 0x02]; 661 u8 res0[0x38 - 0x02];
662 u32 sqptr; /* a base pointer to send queue memory region */ 662 u32 sqptr; /* a base pointer to send queue memory region */
@@ -670,15 +670,15 @@ typedef struct ucc_geth_tx_global_pram {
670 u32 tqptr; /* a base pointer to the Tx Queues Memory 670 u32 tqptr; /* a base pointer to the Tx Queues Memory
671 Region */ 671 Region */
672 u8 res2[0x80 - 0x74]; 672 u8 res2[0x80 - 0x74];
673} __attribute__ ((packed)) ucc_geth_tx_global_pram_t; 673} __attribute__ ((packed));
674 674
675/* structure representing Extended Filtering Global Parameters in PRAM */ 675/* structure representing Extended Filtering Global Parameters in PRAM */
676typedef struct ucc_geth_exf_global_pram { 676struct ucc_geth_exf_global_pram {
677 u32 l2pcdptr; /* individual address filter, high */ 677 u32 l2pcdptr; /* individual address filter, high */
678 u8 res0[0x10 - 0x04]; 678 u8 res0[0x10 - 0x04];
679} __attribute__ ((packed)) ucc_geth_exf_global_pram_t; 679} __attribute__ ((packed));
680 680
681typedef struct ucc_geth_rx_global_pram { 681struct ucc_geth_rx_global_pram {
682 u32 remoder; /* ethernet mode reg. */ 682 u32 remoder; /* ethernet mode reg. */
683 u32 rqptr; /* base pointer to the Rx Queues Memory Region*/ 683 u32 rqptr; /* base pointer to the Rx Queues Memory Region*/
684 u32 res0[0x1]; 684 u32 res0[0x1];
@@ -710,12 +710,12 @@ typedef struct ucc_geth_rx_global_pram {
710 u32 exfGlobalParam; /* base address for extended filtering global 710 u32 exfGlobalParam; /* base address for extended filtering global
711 parameters */ 711 parameters */
712 u8 res6[0x100 - 0xC4]; /* Initialize to zero */ 712 u8 res6[0x100 - 0xC4]; /* Initialize to zero */
713} __attribute__ ((packed)) ucc_geth_rx_global_pram_t; 713} __attribute__ ((packed));
714 714
715#define GRACEFUL_STOP_ACKNOWLEDGE_RX 0x01 715#define GRACEFUL_STOP_ACKNOWLEDGE_RX 0x01
716 716
717/* structure representing InitEnet command */ 717/* structure representing InitEnet command */
718typedef struct ucc_geth_init_pram { 718struct ucc_geth_init_pram {
719 u8 resinit1; 719 u8 resinit1;
720 u8 resinit2; 720 u8 resinit2;
721 u8 resinit3; 721 u8 resinit3;
@@ -729,7 +729,7 @@ typedef struct ucc_geth_init_pram {
729 u32 txglobal; /* tx global */ 729 u32 txglobal; /* tx global */
730 u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX]; /* tx threads */ 730 u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX]; /* tx threads */
731 u8 res3[0x1]; 731 u8 res3[0x1];
732} __attribute__ ((packed)) ucc_geth_init_pram_t; 732} __attribute__ ((packed));
733 733
734#define ENET_INIT_PARAM_RGF_SHIFT (32 - 4) 734#define ENET_INIT_PARAM_RGF_SHIFT (32 - 4)
735#define ENET_INIT_PARAM_TGF_SHIFT (32 - 8) 735#define ENET_INIT_PARAM_TGF_SHIFT (32 - 8)
@@ -746,27 +746,27 @@ typedef struct ucc_geth_init_pram {
746#define ENET_INIT_PARAM_MAGIC_RES_INIT5 0x0400 746#define ENET_INIT_PARAM_MAGIC_RES_INIT5 0x0400
747 747
748/* structure representing 82xx Address Filtering Enet Address in PRAM */ 748/* structure representing 82xx Address Filtering Enet Address in PRAM */
749typedef struct ucc_geth_82xx_enet_address { 749struct ucc_geth_82xx_enet_address {
750 u8 res1[0x2]; 750 u8 res1[0x2];
751 u16 h; /* address (MSB) */ 751 u16 h; /* address (MSB) */
752 u16 m; /* address */ 752 u16 m; /* address */
753 u16 l; /* address (LSB) */ 753 u16 l; /* address (LSB) */
754} __attribute__ ((packed)) ucc_geth_82xx_enet_address_t; 754} __attribute__ ((packed));
755 755
756/* structure representing 82xx Address Filtering PRAM */ 756/* structure representing 82xx Address Filtering PRAM */
757typedef struct ucc_geth_82xx_address_filtering_pram { 757struct ucc_geth_82xx_address_filtering_pram {
758 u32 iaddr_h; /* individual address filter, high */ 758 u32 iaddr_h; /* individual address filter, high */
759 u32 iaddr_l; /* individual address filter, low */ 759 u32 iaddr_l; /* individual address filter, low */
760 u32 gaddr_h; /* group address filter, high */ 760 u32 gaddr_h; /* group address filter, high */
761 u32 gaddr_l; /* group address filter, low */ 761 u32 gaddr_l; /* group address filter, low */
762 ucc_geth_82xx_enet_address_t taddr; 762 struct ucc_geth_82xx_enet_address taddr;
763 ucc_geth_82xx_enet_address_t paddr[NUM_OF_PADDRS]; 763 struct ucc_geth_82xx_enet_address paddr[NUM_OF_PADDRS];
764 u8 res0[0x40 - 0x38]; 764 u8 res0[0x40 - 0x38];
765} __attribute__ ((packed)) ucc_geth_82xx_address_filtering_pram_t; 765} __attribute__ ((packed));
766 766
767/* GETH Tx firmware statistics structure, used when calling 767/* GETH Tx firmware statistics structure, used when calling
768 UCC_GETH_GetStatistics. */ 768 UCC_GETH_GetStatistics. */
769typedef struct ucc_geth_tx_firmware_statistics { 769struct ucc_geth_tx_firmware_statistics {
770 u32 sicoltx; /* single collision */ 770 u32 sicoltx; /* single collision */
771 u32 mulcoltx; /* multiple collision */ 771 u32 mulcoltx; /* multiple collision */
772 u32 latecoltxfr; /* late collision */ 772 u32 latecoltxfr; /* late collision */
@@ -786,11 +786,11 @@ typedef struct ucc_geth_tx_firmware_statistics {
786 and 1518 octets */ 786 and 1518 octets */
787 u32 txpktsjumbo; /* total packets (including bad) between 1024 787 u32 txpktsjumbo; /* total packets (including bad) between 1024
788 and MAXLength octets */ 788 and MAXLength octets */
789} __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_t; 789} __attribute__ ((packed));
790 790
791/* GETH Rx firmware statistics structure, used when calling 791/* GETH Rx firmware statistics structure, used when calling
792 UCC_GETH_GetStatistics. */ 792 UCC_GETH_GetStatistics. */
793typedef struct ucc_geth_rx_firmware_statistics { 793struct ucc_geth_rx_firmware_statistics {
794 u32 frrxfcser; /* frames with crc error */ 794 u32 frrxfcser; /* frames with crc error */
795 u32 fraligner; /* frames with alignment error */ 795 u32 fraligner; /* frames with alignment error */
796 u32 inrangelenrxer; /* in range length error */ 796 u32 inrangelenrxer; /* in range length error */
@@ -822,11 +822,11 @@ typedef struct ucc_geth_rx_firmware_statistics {
822 replaced */ 822 replaced */
823 u32 insertvlan; /* total frames that had their VLAN tag 823 u32 insertvlan; /* total frames that had their VLAN tag
824 inserted */ 824 inserted */
825} __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_t; 825} __attribute__ ((packed));
826 826
827/* GETH hardware statistics structure, used when calling 827/* GETH hardware statistics structure, used when calling
828 UCC_GETH_GetStatistics. */ 828 UCC_GETH_GetStatistics. */
829typedef struct ucc_geth_hardware_statistics { 829struct ucc_geth_hardware_statistics {
830 u32 tx64; /* Total number of frames (including bad 830 u32 tx64; /* Total number of frames (including bad
831 frames) transmitted that were exactly of the 831 frames) transmitted that were exactly of the
832 minimal length (64 for un tagged, 68 for 832 minimal length (64 for un tagged, 68 for
@@ -871,7 +871,7 @@ typedef struct ucc_geth_hardware_statistics {
871 u32 rbca; /* Total number of frames received succesfully 871 u32 rbca; /* Total number of frames received succesfully
872 that had destination address equal to the 872 that had destination address equal to the
873 broadcast address */ 873 broadcast address */
874} __attribute__ ((packed)) ucc_geth_hardware_statistics_t; 874} __attribute__ ((packed));
875 875
876/* UCC GETH Tx errors returned via TxConf callback */ 876/* UCC GETH Tx errors returned via TxConf callback */
877#define TX_ERRORS_DEF 0x0200 877#define TX_ERRORS_DEF 0x0200
@@ -1013,21 +1013,21 @@ typedef struct ucc_geth_hardware_statistics {
1013 (MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112) 1013 (MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112)
1014 1014
1015/* Ethernet speed */ 1015/* Ethernet speed */
1016typedef enum enet_speed { 1016enum enet_speed {
1017 ENET_SPEED_10BT, /* 10 Base T */ 1017 ENET_SPEED_10BT, /* 10 Base T */
1018 ENET_SPEED_100BT, /* 100 Base T */ 1018 ENET_SPEED_100BT, /* 100 Base T */
1019 ENET_SPEED_1000BT /* 1000 Base T */ 1019 ENET_SPEED_1000BT /* 1000 Base T */
1020} enet_speed_e; 1020};
1021 1021
1022/* Ethernet Address Type. */ 1022/* Ethernet Address Type. */
1023typedef enum enet_addr_type { 1023enum enet_addr_type {
1024 ENET_ADDR_TYPE_INDIVIDUAL, 1024 ENET_ADDR_TYPE_INDIVIDUAL,
1025 ENET_ADDR_TYPE_GROUP, 1025 ENET_ADDR_TYPE_GROUP,
1026 ENET_ADDR_TYPE_BROADCAST 1026 ENET_ADDR_TYPE_BROADCAST
1027} enet_addr_type_e; 1027};
1028 1028
1029/* TBI / MII Set Register */ 1029/* TBI / MII Set Register */
1030typedef enum enet_tbi_mii_reg { 1030enum enet_tbi_mii_reg {
1031 ENET_TBI_MII_CR = 0x00, /* Control (CR ) */ 1031 ENET_TBI_MII_CR = 0x00, /* Control (CR ) */
1032 ENET_TBI_MII_SR = 0x01, /* Status (SR ) */ 1032 ENET_TBI_MII_SR = 0x01, /* Status (SR ) */
1033 ENET_TBI_MII_ANA = 0x04, /* AN advertisement (ANA ) */ 1033 ENET_TBI_MII_ANA = 0x04, /* AN advertisement (ANA ) */
@@ -1040,10 +1040,10 @@ typedef enum enet_tbi_mii_reg {
1040 ENET_TBI_MII_EXST = 0x0F, /* Extended status (EXST ) */ 1040 ENET_TBI_MII_EXST = 0x0F, /* Extended status (EXST ) */
1041 ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics (JD ) */ 1041 ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics (JD ) */
1042 ENET_TBI_MII_TBICON = 0x11 /* TBI control (TBICON ) */ 1042 ENET_TBI_MII_TBICON = 0x11 /* TBI control (TBICON ) */
1043} enet_tbi_mii_reg_e; 1043};
1044 1044
1045/* UCC GETH 82xx Ethernet Address Recognition Location */ 1045/* UCC GETH 82xx Ethernet Address Recognition Location */
1046typedef enum ucc_geth_enet_address_recognition_location { 1046enum ucc_geth_enet_address_recognition_location {
1047 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station 1047 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station
1048 address */ 1048 address */
1049 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST, /* additional 1049 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST, /* additional
@@ -1065,10 +1065,10 @@ typedef enum ucc_geth_enet_address_recognition_location {
1065 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH, /* group hash */ 1065 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH, /* group hash */
1066 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual 1066 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual
1067 hash */ 1067 hash */
1068} ucc_geth_enet_address_recognition_location_e; 1068};
1069 1069
1070/* UCC GETH vlan operation tagged */ 1070/* UCC GETH vlan operation tagged */
1071typedef enum ucc_geth_vlan_operation_tagged { 1071enum ucc_geth_vlan_operation_tagged {
1072 UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0, /* Tagged - nop */ 1072 UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0, /* Tagged - nop */
1073 UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG 1073 UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG
1074 = 0x1, /* Tagged - replace vid portion of q tag */ 1074 = 0x1, /* Tagged - replace vid portion of q tag */
@@ -1076,18 +1076,18 @@ typedef enum ucc_geth_vlan_operation_tagged {
1076 = 0x2, /* Tagged - if vid0 replace vid with default value */ 1076 = 0x2, /* Tagged - if vid0 replace vid with default value */
1077 UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME 1077 UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME
1078 = 0x3 /* Tagged - extract q tag from frame */ 1078 = 0x3 /* Tagged - extract q tag from frame */
1079} ucc_geth_vlan_operation_tagged_e; 1079};
1080 1080
1081/* UCC GETH vlan operation non-tagged */ 1081/* UCC GETH vlan operation non-tagged */
1082typedef enum ucc_geth_vlan_operation_non_tagged { 1082enum ucc_geth_vlan_operation_non_tagged {
1083 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0, /* Non tagged - nop */ 1083 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0, /* Non tagged - nop */
1084 UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1 /* Non tagged - 1084 UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1 /* Non tagged -
1085 q tag insert 1085 q tag insert
1086 */ 1086 */
1087} ucc_geth_vlan_operation_non_tagged_e; 1087};
1088 1088
1089/* UCC GETH Rx Quality of Service Mode */ 1089/* UCC GETH Rx Quality of Service Mode */
1090typedef enum ucc_geth_qos_mode { 1090enum ucc_geth_qos_mode {
1091 UCC_GETH_QOS_MODE_DEFAULT = 0x0, /* default queue */ 1091 UCC_GETH_QOS_MODE_DEFAULT = 0x0, /* default queue */
1092 UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1, /* queue 1092 UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1, /* queue
1093 determined 1093 determined
@@ -1097,11 +1097,11 @@ typedef enum ucc_geth_qos_mode {
1097 determined 1097 determined
1098 by L3 1098 by L3
1099 criteria */ 1099 criteria */
1100} ucc_geth_qos_mode_e; 1100};
1101 1101
1102/* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together 1102/* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together
1103 for combined functionality */ 1103 for combined functionality */
1104typedef enum ucc_geth_statistics_gathering_mode { 1104enum ucc_geth_statistics_gathering_mode {
1105 UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000, /* No 1105 UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000, /* No
1106 statistics 1106 statistics
1107 gathering */ 1107 gathering */
@@ -1122,10 +1122,10 @@ typedef enum ucc_geth_statistics_gathering_mode {
1122 statistics 1122 statistics
1123 gathering 1123 gathering
1124 */ 1124 */
1125} ucc_geth_statistics_gathering_mode_e; 1125};
1126 1126
1127/* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */ 1127/* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */
1128typedef enum ucc_geth_maccfg2_pad_and_crc_mode { 1128enum ucc_geth_maccfg2_pad_and_crc_mode {
1129 UCC_GETH_PAD_AND_CRC_MODE_NONE 1129 UCC_GETH_PAD_AND_CRC_MODE_NONE
1130 = MACCFG2_PAD_AND_CRC_MODE_NONE, /* Neither Padding 1130 = MACCFG2_PAD_AND_CRC_MODE_NONE, /* Neither Padding
1131 short frames 1131 short frames
@@ -1135,61 +1135,59 @@ typedef enum ucc_geth_maccfg2_pad_and_crc_mode {
1135 CRC only */ 1135 CRC only */
1136 UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC = 1136 UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC =
1137 MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC 1137 MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC
1138} ucc_geth_maccfg2_pad_and_crc_mode_e; 1138};
1139 1139
1140/* UCC GETH upsmr Flow Control Mode */ 1140/* UCC GETH upsmr Flow Control Mode */
1141typedef enum ucc_geth_flow_control_mode { 1141enum ucc_geth_flow_control_mode {
1142 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000, /* No automatic 1142 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000, /* No automatic
1143 flow control 1143 flow control
1144 */ 1144 */
1145 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY 1145 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY
1146 = 0x00004000 /* Send pause frame when RxFIFO reaches its 1146 = 0x00004000 /* Send pause frame when RxFIFO reaches its
1147 emergency threshold */ 1147 emergency threshold */
1148} ucc_geth_flow_control_mode_e; 1148};
1149 1149
1150/* UCC GETH number of threads */ 1150/* UCC GETH number of threads */
1151typedef enum ucc_geth_num_of_threads { 1151enum ucc_geth_num_of_threads {
1152 UCC_GETH_NUM_OF_THREADS_1 = 0x1, /* 1 */ 1152 UCC_GETH_NUM_OF_THREADS_1 = 0x1, /* 1 */
1153 UCC_GETH_NUM_OF_THREADS_2 = 0x2, /* 2 */ 1153 UCC_GETH_NUM_OF_THREADS_2 = 0x2, /* 2 */
1154 UCC_GETH_NUM_OF_THREADS_4 = 0x0, /* 4 */ 1154 UCC_GETH_NUM_OF_THREADS_4 = 0x0, /* 4 */
1155 UCC_GETH_NUM_OF_THREADS_6 = 0x3, /* 6 */ 1155 UCC_GETH_NUM_OF_THREADS_6 = 0x3, /* 6 */
1156 UCC_GETH_NUM_OF_THREADS_8 = 0x4 /* 8 */ 1156 UCC_GETH_NUM_OF_THREADS_8 = 0x4 /* 8 */
1157} ucc_geth_num_of_threads_e; 1157};
1158 1158
1159/* UCC GETH number of station addresses */ 1159/* UCC GETH number of station addresses */
1160typedef enum ucc_geth_num_of_station_addresses { 1160enum ucc_geth_num_of_station_addresses {
1161 UCC_GETH_NUM_OF_STATION_ADDRESSES_1, /* 1 */ 1161 UCC_GETH_NUM_OF_STATION_ADDRESSES_1, /* 1 */
1162 UCC_GETH_NUM_OF_STATION_ADDRESSES_5 /* 5 */ 1162 UCC_GETH_NUM_OF_STATION_ADDRESSES_5 /* 5 */
1163} ucc_geth_num_of_station_addresses_e; 1163};
1164
1165typedef u8 enet_addr_t[ENET_NUM_OCTETS_PER_ADDRESS];
1166 1164
1167/* UCC GETH 82xx Ethernet Address Container */ 1165/* UCC GETH 82xx Ethernet Address Container */
1168typedef struct enet_addr_container { 1166struct enet_addr_container {
1169 enet_addr_t address; /* ethernet address */ 1167 u8 address[ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */
1170 ucc_geth_enet_address_recognition_location_e location; /* location in 1168 enum ucc_geth_enet_address_recognition_location location; /* location in
1171 82xx address 1169 82xx address
1172 recognition 1170 recognition
1173 hardware */ 1171 hardware */
1174 struct list_head node; 1172 struct list_head node;
1175} enet_addr_container_t; 1173};
1176 1174
1177#define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, enet_addr_container_t, node) 1175#define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, struct enet_addr_container, node)
1178 1176
1179/* UCC GETH Termination Action Descriptor (TAD) structure. */ 1177/* UCC GETH Termination Action Descriptor (TAD) structure. */
1180typedef struct ucc_geth_tad_params { 1178struct ucc_geth_tad_params {
1181 int rx_non_dynamic_extended_features_mode; 1179 int rx_non_dynamic_extended_features_mode;
1182 int reject_frame; 1180 int reject_frame;
1183 ucc_geth_vlan_operation_tagged_e vtag_op; 1181 enum ucc_geth_vlan_operation_tagged vtag_op;
1184 ucc_geth_vlan_operation_non_tagged_e vnontag_op; 1182 enum ucc_geth_vlan_operation_non_tagged vnontag_op;
1185 ucc_geth_qos_mode_e rqos; 1183 enum ucc_geth_qos_mode rqos;
1186 u8 vpri; 1184 u8 vpri;
1187 u16 vid; 1185 u16 vid;
1188} ucc_geth_tad_params_t; 1186};
1189 1187
1190/* GETH protocol initialization structure */ 1188/* GETH protocol initialization structure */
1191typedef struct ucc_geth_info { 1189struct ucc_geth_info {
1192 ucc_fast_info_t uf_info; 1190 struct ucc_fast_info uf_info;
1193 u8 numQueuesTx; 1191 u8 numQueuesTx;
1194 u8 numQueuesRx; 1192 u8 numQueuesRx;
1195 int ipCheckSumCheck; 1193 int ipCheckSumCheck;
@@ -1251,51 +1249,51 @@ typedef struct ucc_geth_info {
1251 u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX]; 1249 u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
1252 u16 bdRingLenTx[NUM_TX_QUEUES]; 1250 u16 bdRingLenTx[NUM_TX_QUEUES];
1253 u16 bdRingLenRx[NUM_RX_QUEUES]; 1251 u16 bdRingLenRx[NUM_RX_QUEUES];
1254 enet_interface_e enet_interface; 1252 enum enet_interface enet_interface;
1255 ucc_geth_num_of_station_addresses_e numStationAddresses; 1253 enum ucc_geth_num_of_station_addresses numStationAddresses;
1256 qe_fltr_largest_external_tbl_lookup_key_size_e 1254 enum qe_fltr_largest_external_tbl_lookup_key_size
1257 largestexternallookupkeysize; 1255 largestexternallookupkeysize;
1258 ucc_geth_statistics_gathering_mode_e statisticsMode; 1256 enum ucc_geth_statistics_gathering_mode statisticsMode;
1259 ucc_geth_vlan_operation_tagged_e vlanOperationTagged; 1257 enum ucc_geth_vlan_operation_tagged vlanOperationTagged;
1260 ucc_geth_vlan_operation_non_tagged_e vlanOperationNonTagged; 1258 enum ucc_geth_vlan_operation_non_tagged vlanOperationNonTagged;
1261 ucc_geth_qos_mode_e rxQoSMode; 1259 enum ucc_geth_qos_mode rxQoSMode;
1262 ucc_geth_flow_control_mode_e aufc; 1260 enum ucc_geth_flow_control_mode aufc;
1263 ucc_geth_maccfg2_pad_and_crc_mode_e padAndCrc; 1261 enum ucc_geth_maccfg2_pad_and_crc_mode padAndCrc;
1264 ucc_geth_num_of_threads_e numThreadsTx; 1262 enum ucc_geth_num_of_threads numThreadsTx;
1265 ucc_geth_num_of_threads_e numThreadsRx; 1263 enum ucc_geth_num_of_threads numThreadsRx;
1266 qe_risc_allocation_e riscTx; 1264 enum qe_risc_allocation riscTx;
1267 qe_risc_allocation_e riscRx; 1265 enum qe_risc_allocation riscRx;
1268} ucc_geth_info_t; 1266};
1269 1267
1270/* structure representing UCC GETH */ 1268/* structure representing UCC GETH */
1271typedef struct ucc_geth_private { 1269struct ucc_geth_private {
1272 ucc_geth_info_t *ug_info; 1270 struct ucc_geth_info *ug_info;
1273 ucc_fast_private_t *uccf; 1271 struct ucc_fast_private *uccf;
1274 struct net_device *dev; 1272 struct net_device *dev;
1275 struct net_device_stats stats; /* linux network statistics */ 1273 struct net_device_stats stats; /* linux network statistics */
1276 ucc_geth_t *ug_regs; 1274 struct ucc_geth *ug_regs;
1277 ucc_geth_init_pram_t *p_init_enet_param_shadow; 1275 struct ucc_geth_init_pram *p_init_enet_param_shadow;
1278 ucc_geth_exf_global_pram_t *p_exf_glbl_param; 1276 struct ucc_geth_exf_global_pram *p_exf_glbl_param;
1279 u32 exf_glbl_param_offset; 1277 u32 exf_glbl_param_offset;
1280 ucc_geth_rx_global_pram_t *p_rx_glbl_pram; 1278 struct ucc_geth_rx_global_pram *p_rx_glbl_pram;
1281 u32 rx_glbl_pram_offset; 1279 u32 rx_glbl_pram_offset;
1282 ucc_geth_tx_global_pram_t *p_tx_glbl_pram; 1280 struct ucc_geth_tx_global_pram *p_tx_glbl_pram;
1283 u32 tx_glbl_pram_offset; 1281 u32 tx_glbl_pram_offset;
1284 ucc_geth_send_queue_mem_region_t *p_send_q_mem_reg; 1282 struct ucc_geth_send_queue_mem_region *p_send_q_mem_reg;
1285 u32 send_q_mem_reg_offset; 1283 u32 send_q_mem_reg_offset;
1286 ucc_geth_thread_data_tx_t *p_thread_data_tx; 1284 struct ucc_geth_thread_data_tx *p_thread_data_tx;
1287 u32 thread_dat_tx_offset; 1285 u32 thread_dat_tx_offset;
1288 ucc_geth_thread_data_rx_t *p_thread_data_rx; 1286 struct ucc_geth_thread_data_rx *p_thread_data_rx;
1289 u32 thread_dat_rx_offset; 1287 u32 thread_dat_rx_offset;
1290 ucc_geth_scheduler_t *p_scheduler; 1288 struct ucc_geth_scheduler *p_scheduler;
1291 u32 scheduler_offset; 1289 u32 scheduler_offset;
1292 ucc_geth_tx_firmware_statistics_pram_t *p_tx_fw_statistics_pram; 1290 struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram;
1293 u32 tx_fw_statistics_pram_offset; 1291 u32 tx_fw_statistics_pram_offset;
1294 ucc_geth_rx_firmware_statistics_pram_t *p_rx_fw_statistics_pram; 1292 struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram;
1295 u32 rx_fw_statistics_pram_offset; 1293 u32 rx_fw_statistics_pram_offset;
1296 ucc_geth_rx_interrupt_coalescing_table_t *p_rx_irq_coalescing_tbl; 1294 struct ucc_geth_rx_interrupt_coalescing_table *p_rx_irq_coalescing_tbl;
1297 u32 rx_irq_coalescing_tbl_offset; 1295 u32 rx_irq_coalescing_tbl_offset;
1298 ucc_geth_rx_bd_queues_entry_t *p_rx_bd_qs_tbl; 1296 struct ucc_geth_rx_bd_queues_entry *p_rx_bd_qs_tbl;
1299 u32 rx_bd_qs_tbl_offset; 1297 u32 rx_bd_qs_tbl_offset;
1300 u8 *p_tx_bd_ring[NUM_TX_QUEUES]; 1298 u8 *p_tx_bd_ring[NUM_TX_QUEUES];
1301 u32 tx_bd_ring_offset[NUM_TX_QUEUES]; 1299 u32 tx_bd_ring_offset[NUM_TX_QUEUES];
@@ -1308,7 +1306,7 @@ typedef struct ucc_geth_private {
1308 u16 cpucount[NUM_TX_QUEUES]; 1306 u16 cpucount[NUM_TX_QUEUES];
1309 volatile u16 *p_cpucount[NUM_TX_QUEUES]; 1307 volatile u16 *p_cpucount[NUM_TX_QUEUES];
1310 int indAddrRegUsed[NUM_OF_PADDRS]; 1308 int indAddrRegUsed[NUM_OF_PADDRS];
1311 enet_addr_t paddr[NUM_OF_PADDRS]; 1309 u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */
1312 u8 numGroupAddrInHash; 1310 u8 numGroupAddrInHash;
1313 u8 numIndAddrInHash; 1311 u8 numIndAddrInHash;
1314 u8 numIndAddrInReg; 1312 u8 numIndAddrInReg;
@@ -1334,6 +1332,6 @@ typedef struct ucc_geth_private {
1334 int oldspeed; 1332 int oldspeed;
1335 int oldduplex; 1333 int oldduplex;
1336 int oldlink; 1334 int oldlink;
1337} ucc_geth_private_t; 1335};
1338 1336
1339#endif /* __UCC_GETH_H__ */ 1337#endif /* __UCC_GETH_H__ */
diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 67260eb3188a..5360ec05eaa3 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -42,7 +42,6 @@
42 42
43#include "ucc_geth.h" 43#include "ucc_geth.h"
44#include "ucc_geth_phy.h" 44#include "ucc_geth_phy.h"
45#include <platforms/83xx/mpc8360e_pb.h>
46 45
47#define ugphy_printk(level, format, arg...) \ 46#define ugphy_printk(level, format, arg...) \
48 printk(level format "\n", ## arg) 47 printk(level format "\n", ## arg)
@@ -72,16 +71,14 @@ static int genmii_read_status(struct ugeth_mii_info *mii_info);
72u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum); 71u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
73void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val); 72void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
74 73
75static u8 *bcsr_regs = NULL;
76
77/* Write value to the PHY for this device to the register at regnum, */ 74/* Write value to the PHY for this device to the register at regnum, */
78/* waiting until the write is done before it returns. All PHY */ 75/* waiting until the write is done before it returns. All PHY */
79/* configuration has to be done through the TSEC1 MIIM regs */ 76/* configuration has to be done through the TSEC1 MIIM regs */
80void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) 77void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value)
81{ 78{
82 ucc_geth_private_t *ugeth = netdev_priv(dev); 79 struct ucc_geth_private *ugeth = netdev_priv(dev);
83 ucc_mii_mng_t *mii_regs; 80 struct ucc_mii_mng *mii_regs;
84 enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; 81 enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum;
85 u32 tmp_reg; 82 u32 tmp_reg;
86 83
87 ugphy_vdbg("%s: IN", __FUNCTION__); 84 ugphy_vdbg("%s: IN", __FUNCTION__);
@@ -116,9 +113,9 @@ void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value)
116/* configuration has to be done through the TSEC1 MIIM regs */ 113/* configuration has to be done through the TSEC1 MIIM regs */
117int read_phy_reg(struct net_device *dev, int mii_id, int regnum) 114int read_phy_reg(struct net_device *dev, int mii_id, int regnum)
118{ 115{
119 ucc_geth_private_t *ugeth = netdev_priv(dev); 116 struct ucc_geth_private *ugeth = netdev_priv(dev);
120 ucc_mii_mng_t *mii_regs; 117 struct ucc_mii_mng *mii_regs;
121 enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; 118 enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum;
122 u32 tmp_reg; 119 u32 tmp_reg;
123 u16 value; 120 u16 value;
124 121
@@ -634,11 +631,6 @@ static void dm9161_close(struct ugeth_mii_info *mii_info)
634 631
635static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info) 632static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info)
636{ 633{
637/* FIXME: This lines are for BUG fixing in the mpc8325.
638Remove this from here when it's fixed */
639 if (bcsr_regs == NULL)
640 bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);
641 bcsr_regs[14] |= 0x40;
642 ugphy_vdbg("%s: IN", __FUNCTION__); 634 ugphy_vdbg("%s: IN", __FUNCTION__);
643 635
644 /* Clear the interrupts by reading the reg */ 636 /* Clear the interrupts by reading the reg */
@@ -650,12 +642,6 @@ Remove this from here when it's fixed */
650 642
651static int dm9161_config_intr(struct ugeth_mii_info *mii_info) 643static int dm9161_config_intr(struct ugeth_mii_info *mii_info)
652{ 644{
653/* FIXME: This lines are for BUG fixing in the mpc8325.
654Remove this from here when it's fixed */
655 if (bcsr_regs == NULL) {
656 bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);
657 bcsr_regs[14] &= ~0x40;
658 }
659 ugphy_vdbg("%s: IN", __FUNCTION__); 645 ugphy_vdbg("%s: IN", __FUNCTION__);
660 646
661 if (mii_info->interrupts == MII_INTERRUPT_ENABLED) 647 if (mii_info->interrupts == MII_INTERRUPT_ENABLED)
diff --git a/drivers/net/ucc_geth_phy.h b/drivers/net/ucc_geth_phy.h
index 2f98b8f1bb0a..f5740783670f 100644
--- a/drivers/net/ucc_geth_phy.h
+++ b/drivers/net/ucc_geth_phy.h
@@ -126,7 +126,7 @@ struct ugeth_mii_info {
126 /* And management functions */ 126 /* And management functions */
127 struct phy_info *phyinfo; 127 struct phy_info *phyinfo;
128 128
129 ucc_mii_mng_t *mii_regs; 129 struct ucc_mii_mng *mii_regs;
130 130
131 /* forced speed & duplex (no autoneg) 131 /* forced speed & duplex (no autoneg)
132 * partner speed & duplex & pause (autoneg) 132 * partner speed & duplex & pause (autoneg)
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 5823e3bca178..36d1c3ff7078 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -2867,7 +2867,6 @@ static int ch_config(pc300dev_t * d)
2867 uclong clktype = chan->conf.phys_settings.clock_type; 2867 uclong clktype = chan->conf.phys_settings.clock_type;
2868 ucshort encoding = chan->conf.proto_settings.encoding; 2868 ucshort encoding = chan->conf.proto_settings.encoding;
2869 ucshort parity = chan->conf.proto_settings.parity; 2869 ucshort parity = chan->conf.proto_settings.parity;
2870 int tmc, br;
2871 ucchar md0, md2; 2870 ucchar md0, md2;
2872 2871
2873 /* Reset the channel */ 2872 /* Reset the channel */
@@ -2940,8 +2939,12 @@ static int ch_config(pc300dev_t * d)
2940 case PC300_RSV: 2939 case PC300_RSV:
2941 case PC300_X21: 2940 case PC300_X21:
2942 if (clktype == CLOCK_INT || clktype == CLOCK_TXINT) { 2941 if (clktype == CLOCK_INT || clktype == CLOCK_TXINT) {
2942 int tmc, br;
2943
2943 /* Calculate the clkrate parameters */ 2944 /* Calculate the clkrate parameters */
2944 tmc = clock_rate_calc(clkrate, card->hw.clock, &br); 2945 tmc = clock_rate_calc(clkrate, card->hw.clock, &br);
2946 if (tmc < 0)
2947 return -EIO;
2945 cpc_writeb(scabase + M_REG(TMCT, ch), tmc); 2948 cpc_writeb(scabase + M_REG(TMCT, ch), tmc);
2946 cpc_writeb(scabase + M_REG(TXS, ch), 2949 cpc_writeb(scabase + M_REG(TXS, ch),
2947 (TXS_DTRXC | TXS_IBRG | br)); 2950 (TXS_DTRXC | TXS_IBRG | br));
@@ -3097,14 +3100,16 @@ static int cpc_attach(struct net_device *dev, unsigned short encoding,
3097 return 0; 3100 return 0;
3098} 3101}
3099 3102
3100static void cpc_opench(pc300dev_t * d) 3103static int cpc_opench(pc300dev_t * d)
3101{ 3104{
3102 pc300ch_t *chan = (pc300ch_t *) d->chan; 3105 pc300ch_t *chan = (pc300ch_t *) d->chan;
3103 pc300_t *card = (pc300_t *) chan->card; 3106 pc300_t *card = (pc300_t *) chan->card;
3104 int ch = chan->channel; 3107 int ch = chan->channel, rc;
3105 void __iomem *scabase = card->hw.scabase; 3108 void __iomem *scabase = card->hw.scabase;
3106 3109
3107 ch_config(d); 3110 rc = ch_config(d);
3111 if (rc)
3112 return rc;
3108 3113
3109 rx_config(d); 3114 rx_config(d);
3110 3115
@@ -3113,6 +3118,8 @@ static void cpc_opench(pc300dev_t * d)
3113 /* Assert RTS and DTR */ 3118 /* Assert RTS and DTR */
3114 cpc_writeb(scabase + M_REG(CTL, ch), 3119 cpc_writeb(scabase + M_REG(CTL, ch),
3115 cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR)); 3120 cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR));
3121
3122 return 0;
3116} 3123}
3117 3124
3118static void cpc_closech(pc300dev_t * d) 3125static void cpc_closech(pc300dev_t * d)
@@ -3168,9 +3175,16 @@ int cpc_open(struct net_device *dev)
3168 } 3175 }
3169 3176
3170 sprintf(ifr.ifr_name, "%s", dev->name); 3177 sprintf(ifr.ifr_name, "%s", dev->name);
3171 cpc_opench(d); 3178 result = cpc_opench(d);
3179 if (result)
3180 goto err_out;
3181
3172 netif_start_queue(dev); 3182 netif_start_queue(dev);
3173 return 0; 3183 return 0;
3184
3185err_out:
3186 hdlc_close(dev);
3187 return result;
3174} 3188}
3175 3189
3176static int cpc_close(struct net_device *dev) 3190static int cpc_close(struct net_device *dev)
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 51cb9f817c22..270a33cc08f6 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -29,10 +29,10 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/pci_hotplug.h>
32#include <acpi/acpi.h> 33#include <acpi/acpi.h>
33#include <acpi/acpi_bus.h> 34#include <acpi/acpi_bus.h>
34#include <acpi/actypes.h> 35#include <acpi/actypes.h>
35#include "pci_hotplug.h"
36 36
37#define MY_NAME "acpi_pcihp" 37#define MY_NAME "acpi_pcihp"
38 38
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index 7fff07e877c7..59c5b242d86d 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -38,7 +38,7 @@
38#include <linux/acpi.h> 38#include <linux/acpi.h>
39#include <linux/kobject.h> /* for KOBJ_NAME_LEN */ 39#include <linux/kobject.h> /* for KOBJ_NAME_LEN */
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include "pci_hotplug.h" 41#include <linux/pci_hotplug.h>
42 42
43#define dbg(format, arg...) \ 43#define dbg(format, arg...) \
44 do { \ 44 do { \
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index e2fef60c2d06..c57d9d5ce84e 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -37,10 +37,10 @@
37 37
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/pci_hotplug.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#include <linux/smp.h> 42#include <linux/smp.h>
42#include <linux/smp_lock.h> 43#include <linux/smp_lock.h>
43#include "pci_hotplug.h"
44#include "acpiphp.h" 44#include "acpiphp.h"
45 45
46#define MY_NAME "acpiphp" 46#define MY_NAME "acpiphp"
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 83e8e4412de5..c44311ac2fd3 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -45,11 +45,11 @@
45 45
46#include <linux/kernel.h> 46#include <linux/kernel.h>
47#include <linux/pci.h> 47#include <linux/pci.h>
48#include <linux/pci_hotplug.h>
48#include <linux/smp_lock.h> 49#include <linux/smp_lock.h>
49#include <linux/mutex.h> 50#include <linux/mutex.h>
50 51
51#include "../pci.h" 52#include "../pci.h"
52#include "pci_hotplug.h"
53#include "acpiphp.h" 53#include "acpiphp.h"
54 54
55static LIST_HEAD(bridge_list); 55static LIST_HEAD(bridge_list);
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index d0a07d9ab30c..bd40aee10e16 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -35,7 +35,6 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36 36
37#include "acpiphp.h" 37#include "acpiphp.h"
38#include "pci_hotplug.h"
39 38
40#define DRIVER_VERSION "1.0.1" 39#define DRIVER_VERSION "1.0.1"
41#define DRIVER_AUTHOR "Irene Zubarev <zubarev@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>" 40#define DRIVER_AUTHOR "Irene Zubarev <zubarev@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>"
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index d06ab4045134..684551559d44 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -29,12 +29,12 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/pci_hotplug.h>
32#include <linux/init.h> 33#include <linux/init.h>
33#include <linux/interrupt.h> 34#include <linux/interrupt.h>
34#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
35#include <asm/atomic.h> 36#include <asm/atomic.h>
36#include <linux/delay.h> 37#include <linux/delay.h>
37#include "pci_hotplug.h"
38#include "cpci_hotplug.h" 38#include "cpci_hotplug.h"
39 39
40#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>" 40#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 4afcaffd031c..7b1beaad2752 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -26,9 +26,9 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/pci_hotplug.h>
29#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
30#include "../pci.h" 31#include "../pci.h"
31#include "pci_hotplug.h"
32#include "cpci_hotplug.h" 32#include "cpci_hotplug.h"
33 33
34#define MY_NAME "cpci_hotplug" 34#define MY_NAME "cpci_hotplug"
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c
index e847f0d6c7fe..f3852a6b74ea 100644
--- a/drivers/pci/hotplug/cpcihp_generic.c
+++ b/drivers/pci/hotplug/cpcihp_generic.c
@@ -84,7 +84,7 @@ static int __init validate_parameters(void)
84 84
85 if(!bridge) { 85 if(!bridge) {
86 info("not configured, disabling."); 86 info("not configured, disabling.");
87 return 1; 87 return -EINVAL;
88 } 88 }
89 str = bridge; 89 str = bridge;
90 if(!*str) 90 if(!*str)
@@ -147,7 +147,7 @@ static int __init cpcihp_generic_init(void)
147 147
148 info(DRIVER_DESC " version: " DRIVER_VERSION); 148 info(DRIVER_DESC " version: " DRIVER_VERSION);
149 status = validate_parameters(); 149 status = validate_parameters();
150 if(status != 0) 150 if (status)
151 return status; 151 return status;
152 152
153 r = request_region(port, 1, "#ENUM hotswap signal register"); 153 r = request_region(port, 1, "#ENUM hotswap signal register");
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h
index ea040c32f47d..298ad7f3f4f4 100644
--- a/drivers/pci/hotplug/cpqphp.h
+++ b/drivers/pci/hotplug/cpqphp.h
@@ -28,7 +28,6 @@
28#ifndef _CPQPHP_H 28#ifndef _CPQPHP_H
29#define _CPQPHP_H 29#define _CPQPHP_H
30 30
31#include "pci_hotplug.h"
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
33#include <asm/io.h> /* for read? and write? functions */ 32#include <asm/io.h> /* for read? and write? functions */
34#include <linux/delay.h> /* for delays */ 33#include <linux/delay.h> /* for delays */
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 1fc259913b68..5617cfdadc5c 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -37,6 +37,7 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/pci_hotplug.h>
40#include <linux/init.h> 41#include <linux/init.h>
41#include <linux/interrupt.h> 42#include <linux/interrupt.h>
42 43
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 3ec2ad7db49a..79ff6b4de3a6 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -36,6 +36,7 @@
36#include <linux/wait.h> 36#include <linux/wait.h>
37#include <linux/smp_lock.h> 37#include <linux/smp_lock.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/pci_hotplug.h>
39#include "cpqphp.h" 40#include "cpqphp.h"
40 41
41static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, 42static u32 configure_new_device(struct controller* ctrl, struct pci_func *func,
diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c
index cf0878917537..298a6cfd8406 100644
--- a/drivers/pci/hotplug/cpqphp_nvram.c
+++ b/drivers/pci/hotplug/cpqphp_nvram.c
@@ -33,6 +33,7 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/workqueue.h> 34#include <linux/workqueue.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/pci_hotplug.h>
36#include <linux/init.h> 37#include <linux/init.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include "cpqphp.h" 39#include "cpqphp.h"
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
index 0d9688952f4a..fc7c74d72595 100644
--- a/drivers/pci/hotplug/cpqphp_pci.c
+++ b/drivers/pci/hotplug/cpqphp_pci.c
@@ -33,6 +33,7 @@
33#include <linux/workqueue.h> 33#include <linux/workqueue.h>
34#include <linux/proc_fs.h> 34#include <linux/proc_fs.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/pci_hotplug.h>
36#include "../pci.h" 37#include "../pci.h"
37#include "cpqphp.h" 38#include "cpqphp.h"
38#include "cpqphp_nvram.h" 39#include "cpqphp_nvram.h"
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c
index 5bab666cd67e..634f74d919d3 100644
--- a/drivers/pci/hotplug/cpqphp_sysfs.c
+++ b/drivers/pci/hotplug/cpqphp_sysfs.c
@@ -32,6 +32,7 @@
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/workqueue.h> 33#include <linux/workqueue.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/pci_hotplug.h>
35#include <linux/debugfs.h> 36#include <linux/debugfs.h>
36#include "cpqphp.h" 37#include "cpqphp.h"
37 38
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 05a4f0f90186..e27907c91d92 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -35,10 +35,10 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/pci_hotplug.h>
38#include <linux/init.h> 39#include <linux/init.h>
39#include <linux/string.h> 40#include <linux/string.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#include "pci_hotplug.h"
42#include "../pci.h" 42#include "../pci.h"
43 43
44#if !defined(MODULE) 44#if !defined(MODULE)
@@ -181,7 +181,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
181 181
182 if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) { 182 if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) {
183 temp->hdr_type = hdr_type & 0x7f; 183 temp->hdr_type = hdr_type & 0x7f;
184 if (!pci_find_slot(bus->number, temp->devfn)) { 184 if ((dev = pci_get_slot(bus, temp->devfn)) != NULL)
185 pci_dev_put(dev);
186 else {
185 dev = pci_scan_single_device(bus, temp->devfn); 187 dev = pci_scan_single_device(bus, temp->devfn);
186 if (dev) { 188 if (dev) {
187 dbg("New device on %s function %x:%x\n", 189 dbg("New device on %s function %x:%x\n",
@@ -205,7 +207,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
205 continue; 207 continue;
206 temp->hdr_type = hdr_type & 0x7f; 208 temp->hdr_type = hdr_type & 0x7f;
207 209
208 if (!pci_find_slot(bus->number, temp->devfn)) { 210 if ((dev = pci_get_slot(bus, temp->devfn)) != NULL)
211 pci_dev_put(dev);
212 else {
209 dev = pci_scan_single_device(bus, temp->devfn); 213 dev = pci_scan_single_device(bus, temp->devfn);
210 if (dev) { 214 if (dev) {
211 dbg("New device on %s function %x:%x\n", 215 dbg("New device on %s function %x:%x\n",
@@ -305,7 +309,7 @@ static int disable_slot(struct hotplug_slot *slot)
305 /* search for subfunctions and disable them first */ 309 /* search for subfunctions and disable them first */
306 if (!(dslot->dev->devfn & 7)) { 310 if (!(dslot->dev->devfn & 7)) {
307 for (func = 1; func < 8; func++) { 311 for (func = 1; func < 8; func++) {
308 dev = pci_find_slot(dslot->dev->bus->number, 312 dev = pci_get_slot(dslot->dev->bus,
309 dslot->dev->devfn + func); 313 dslot->dev->devfn + func);
310 if (dev) { 314 if (dev) {
311 hslot = get_slot_from_dev(dev); 315 hslot = get_slot_from_dev(dev);
@@ -315,6 +319,7 @@ static int disable_slot(struct hotplug_slot *slot)
315 err("Hotplug slot not found for subfunction of PCI device\n"); 319 err("Hotplug slot not found for subfunction of PCI device\n");
316 return -ENODEV; 320 return -ENODEV;
317 } 321 }
322 pci_dev_put(dev);
318 } else 323 } else
319 dbg("No device in slot found\n"); 324 dbg("No device in slot found\n");
320 } 325 }
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h
index dba6d8ca9bda..612d96301509 100644
--- a/drivers/pci/hotplug/ibmphp.h
+++ b/drivers/pci/hotplug/ibmphp.h
@@ -30,7 +30,7 @@
30 * 30 *
31 */ 31 */
32 32
33#include "pci_hotplug.h" 33#include <linux/pci_hotplug.h>
34 34
35extern int ibmphp_debug; 35extern int ibmphp_debug;
36 36
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index e2823ea9c4ed..f5d632e72323 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -21,9 +21,7 @@
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * 23 *
24 * Send feedback to <greg@kroah.com> 24 * Send feedback to <kristen.c.accardi@intel.com>
25 *
26 * Filesystem portion based on work done by Pat Mochel on ddfs/driverfs
27 * 25 *
28 */ 26 */
29 27
@@ -32,6 +30,8 @@
32#include <linux/kernel.h> 30#include <linux/kernel.h>
33#include <linux/types.h> 31#include <linux/types.h>
34#include <linux/list.h> 32#include <linux/list.h>
33#include <linux/kobject.h>
34#include <linux/sysfs.h>
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/smp_lock.h> 37#include <linux/smp_lock.h>
@@ -39,11 +39,8 @@
39#include <linux/mount.h> 39#include <linux/mount.h>
40#include <linux/namei.h> 40#include <linux/namei.h>
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/pci_hotplug.h>
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
43#include <linux/kobject.h>
44#include <linux/sysfs.h>
45#include "pci_hotplug.h"
46
47 44
48#define MY_NAME "pci_hotplug" 45#define MY_NAME "pci_hotplug"
49 46
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index eaea9d36a1bb..4fb12fcda563 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -31,11 +31,11 @@
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/pci_hotplug.h>
34#include <linux/delay.h> 35#include <linux/delay.h>
35#include <linux/sched.h> /* signal_pending() */ 36#include <linux/sched.h> /* signal_pending() */
36#include <linux/pcieport_if.h> 37#include <linux/pcieport_if.h>
37#include <linux/mutex.h> 38#include <linux/mutex.h>
38#include "pci_hotplug.h"
39 39
40#define MY_NAME "pciehp" 40#define MY_NAME "pciehp"
41 41
@@ -92,6 +92,7 @@ struct php_ctlr_state_s {
92struct controller { 92struct controller {
93 struct controller *next; 93 struct controller *next;
94 struct mutex crit_sect; /* critical section mutex */ 94 struct mutex crit_sect; /* critical section mutex */
95 struct mutex ctrl_lock; /* controller lock */
95 struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ 96 struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
96 int num_slots; /* Number of slots on ctlr */ 97 int num_slots; /* Number of slots on ctlr */
97 int slot_num_inc; /* 1 or -1 */ 98 int slot_num_inc; /* 1 or -1 */
@@ -166,10 +167,10 @@ struct controller {
166 * error Messages 167 * error Messages
167 */ 168 */
168#define msg_initialization_err "Initialization failure, error=%d\n" 169#define msg_initialization_err "Initialization failure, error=%d\n"
169#define msg_button_on "PCI slot #%d - powering on due to button press.\n" 170#define msg_button_on "PCI slot #%s - powering on due to button press.\n"
170#define msg_button_off "PCI slot #%d - powering off due to button press.\n" 171#define msg_button_off "PCI slot #%s - powering off due to button press.\n"
171#define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" 172#define msg_button_cancel "PCI slot #%s - action canceled due to button press.\n"
172#define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n" 173#define msg_button_ignore "PCI slot #%s - button press ignored. (action in progress...)\n"
173 174
174/* controller functions */ 175/* controller functions */
175extern int pciehp_event_start_thread (void); 176extern int pciehp_event_start_thread (void);
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index c67b7c3f1ddf..f93e81e2d2c7 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -448,7 +448,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
448 } 448 }
449 449
450 /* Wait for exclusive access to hardware */ 450 /* Wait for exclusive access to hardware */
451 mutex_lock(&ctrl->crit_sect); 451 mutex_lock(&ctrl->ctrl_lock);
452 452
453 t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ 453 t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */
454 454
@@ -456,7 +456,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
456 rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ 456 rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/
457 if (rc) { 457 if (rc) {
458 /* Done with exclusive hardware access */ 458 /* Done with exclusive hardware access */
459 mutex_unlock(&ctrl->crit_sect); 459 mutex_unlock(&ctrl->ctrl_lock);
460 goto err_out_free_ctrl_slot; 460 goto err_out_free_ctrl_slot;
461 } else 461 } else
462 /* Wait for the command to complete */ 462 /* Wait for the command to complete */
@@ -464,7 +464,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
464 } 464 }
465 465
466 /* Done with exclusive hardware access */ 466 /* Done with exclusive hardware access */
467 mutex_unlock(&ctrl->crit_sect); 467 mutex_unlock(&ctrl->ctrl_lock);
468 468
469 return 0; 469 return 0;
470 470
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 41290a106bd8..372c63e35aa9 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -43,6 +43,11 @@ static int event_finished;
43static unsigned long pushbutton_pending; /* = 0 */ 43static unsigned long pushbutton_pending; /* = 0 */
44static unsigned long surprise_rm_pending; /* = 0 */ 44static unsigned long surprise_rm_pending; /* = 0 */
45 45
46static inline char *slot_name(struct slot *p_slot)
47{
48 return p_slot->hotplug_slot->name;
49}
50
46u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) 51u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
47{ 52{
48 struct controller *ctrl = (struct controller *) inst_id; 53 struct controller *ctrl = (struct controller *) inst_id;
@@ -68,7 +73,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
68 /* 73 /*
69 * Button pressed - See if need to TAKE ACTION!!! 74 * Button pressed - See if need to TAKE ACTION!!!
70 */ 75 */
71 info("Button pressed on Slot(%d)\n", ctrl->first_slot + hp_slot); 76 info("Button pressed on Slot(%s)\n", slot_name(p_slot));
72 taskInfo->event_type = INT_BUTTON_PRESS; 77 taskInfo->event_type = INT_BUTTON_PRESS;
73 78
74 if ((p_slot->state == BLINKINGON_STATE) 79 if ((p_slot->state == BLINKINGON_STATE)
@@ -78,7 +83,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
78 * or hot-remove 83 * or hot-remove
79 */ 84 */
80 taskInfo->event_type = INT_BUTTON_CANCEL; 85 taskInfo->event_type = INT_BUTTON_CANCEL;
81 info("Button cancel on Slot(%d)\n", ctrl->first_slot + hp_slot); 86 info("Button cancel on Slot(%s)\n", slot_name(p_slot));
82 } else if ((p_slot->state == POWERON_STATE) 87 } else if ((p_slot->state == POWERON_STATE)
83 || (p_slot->state == POWEROFF_STATE)) { 88 || (p_slot->state == POWEROFF_STATE)) {
84 /* Ignore if the slot is on power-on or power-off state; this 89 /* Ignore if the slot is on power-on or power-off state; this
@@ -86,7 +91,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
86 * hot-remove is undergoing 91 * hot-remove is undergoing
87 */ 92 */
88 taskInfo->event_type = INT_BUTTON_IGNORE; 93 taskInfo->event_type = INT_BUTTON_IGNORE;
89 info("Button ignore on Slot(%d)\n", ctrl->first_slot + hp_slot); 94 info("Button ignore on Slot(%s)\n", slot_name(p_slot));
90 } 95 }
91 96
92 if (rc) 97 if (rc)
@@ -122,13 +127,13 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id)
122 /* 127 /*
123 * Switch opened 128 * Switch opened
124 */ 129 */
125 info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); 130 info("Latch open on Slot(%s)\n", slot_name(p_slot));
126 taskInfo->event_type = INT_SWITCH_OPEN; 131 taskInfo->event_type = INT_SWITCH_OPEN;
127 } else { 132 } else {
128 /* 133 /*
129 * Switch closed 134 * Switch closed
130 */ 135 */
131 info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); 136 info("Latch close on Slot(%s)\n", slot_name(p_slot));
132 taskInfo->event_type = INT_SWITCH_CLOSE; 137 taskInfo->event_type = INT_SWITCH_CLOSE;
133 } 138 }
134 139
@@ -166,13 +171,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id)
166 /* 171 /*
167 * Card Present 172 * Card Present
168 */ 173 */
169 info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot); 174 info("Card present on Slot(%s)\n", slot_name(p_slot));
170 taskInfo->event_type = INT_PRESENCE_ON; 175 taskInfo->event_type = INT_PRESENCE_ON;
171 } else { 176 } else {
172 /* 177 /*
173 * Not Present 178 * Not Present
174 */ 179 */
175 info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot); 180 info("Card not present on Slot(%s)\n", slot_name(p_slot));
176 taskInfo->event_type = INT_PRESENCE_OFF; 181 taskInfo->event_type = INT_PRESENCE_OFF;
177 } 182 }
178 183
@@ -206,13 +211,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
206 /* 211 /*
207 * power fault Cleared 212 * power fault Cleared
208 */ 213 */
209 info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); 214 info("Power fault cleared on Slot(%s)\n", slot_name(p_slot));
210 taskInfo->event_type = INT_POWER_FAULT_CLEAR; 215 taskInfo->event_type = INT_POWER_FAULT_CLEAR;
211 } else { 216 } else {
212 /* 217 /*
213 * power fault 218 * power fault
214 */ 219 */
215 info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); 220 info("Power fault on Slot(%s)\n", slot_name(p_slot));
216 taskInfo->event_type = INT_POWER_FAULT; 221 taskInfo->event_type = INT_POWER_FAULT;
217 info("power fault bit %x set\n", hp_slot); 222 info("power fault bit %x set\n", hp_slot);
218 } 223 }
@@ -229,13 +234,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
229static void set_slot_off(struct controller *ctrl, struct slot * pslot) 234static void set_slot_off(struct controller *ctrl, struct slot * pslot)
230{ 235{
231 /* Wait for exclusive access to hardware */ 236 /* Wait for exclusive access to hardware */
232 mutex_lock(&ctrl->crit_sect); 237 mutex_lock(&ctrl->ctrl_lock);
233 238
234 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 239 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/
235 if (POWER_CTRL(ctrl->ctrlcap)) { 240 if (POWER_CTRL(ctrl->ctrlcap)) {
236 if (pslot->hpc_ops->power_off_slot(pslot)) { 241 if (pslot->hpc_ops->power_off_slot(pslot)) {
237 err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); 242 err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__);
238 mutex_unlock(&ctrl->crit_sect); 243 mutex_unlock(&ctrl->ctrl_lock);
239 return; 244 return;
240 } 245 }
241 wait_for_ctrl_irq (ctrl); 246 wait_for_ctrl_irq (ctrl);
@@ -249,14 +254,14 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
249 if (ATTN_LED(ctrl->ctrlcap)) { 254 if (ATTN_LED(ctrl->ctrlcap)) {
250 if (pslot->hpc_ops->set_attention_status(pslot, 1)) { 255 if (pslot->hpc_ops->set_attention_status(pslot, 1)) {
251 err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); 256 err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__);
252 mutex_unlock(&ctrl->crit_sect); 257 mutex_unlock(&ctrl->ctrl_lock);
253 return; 258 return;
254 } 259 }
255 wait_for_ctrl_irq (ctrl); 260 wait_for_ctrl_irq (ctrl);
256 } 261 }
257 262
258 /* Done with exclusive hardware access */ 263 /* Done with exclusive hardware access */
259 mutex_unlock(&ctrl->crit_sect); 264 mutex_unlock(&ctrl->ctrl_lock);
260} 265}
261 266
262/** 267/**
@@ -279,13 +284,13 @@ static int board_added(struct slot *p_slot)
279 ctrl->slot_device_offset, hp_slot); 284 ctrl->slot_device_offset, hp_slot);
280 285
281 /* Wait for exclusive access to hardware */ 286 /* Wait for exclusive access to hardware */
282 mutex_lock(&ctrl->crit_sect); 287 mutex_lock(&ctrl->ctrl_lock);
283 288
284 if (POWER_CTRL(ctrl->ctrlcap)) { 289 if (POWER_CTRL(ctrl->ctrlcap)) {
285 /* Power on slot */ 290 /* Power on slot */
286 rc = p_slot->hpc_ops->power_on_slot(p_slot); 291 rc = p_slot->hpc_ops->power_on_slot(p_slot);
287 if (rc) { 292 if (rc) {
288 mutex_unlock(&ctrl->crit_sect); 293 mutex_unlock(&ctrl->ctrl_lock);
289 return -1; 294 return -1;
290 } 295 }
291 296
@@ -301,7 +306,7 @@ static int board_added(struct slot *p_slot)
301 } 306 }
302 307
303 /* Done with exclusive hardware access */ 308 /* Done with exclusive hardware access */
304 mutex_unlock(&ctrl->crit_sect); 309 mutex_unlock(&ctrl->ctrl_lock);
305 310
306 /* Wait for ~1 second */ 311 /* Wait for ~1 second */
307 wait_for_ctrl_irq (ctrl); 312 wait_for_ctrl_irq (ctrl);
@@ -335,7 +340,7 @@ static int board_added(struct slot *p_slot)
335 pci_fixup_device(pci_fixup_final, ctrl->pci_dev); 340 pci_fixup_device(pci_fixup_final, ctrl->pci_dev);
336 if (PWR_LED(ctrl->ctrlcap)) { 341 if (PWR_LED(ctrl->ctrlcap)) {
337 /* Wait for exclusive access to hardware */ 342 /* Wait for exclusive access to hardware */
338 mutex_lock(&ctrl->crit_sect); 343 mutex_lock(&ctrl->ctrl_lock);
339 344
340 p_slot->hpc_ops->green_led_on(p_slot); 345 p_slot->hpc_ops->green_led_on(p_slot);
341 346
@@ -343,7 +348,7 @@ static int board_added(struct slot *p_slot)
343 wait_for_ctrl_irq (ctrl); 348 wait_for_ctrl_irq (ctrl);
344 349
345 /* Done with exclusive hardware access */ 350 /* Done with exclusive hardware access */
346 mutex_unlock(&ctrl->crit_sect); 351 mutex_unlock(&ctrl->ctrl_lock);
347 } 352 }
348 return 0; 353 return 0;
349 354
@@ -375,14 +380,14 @@ static int remove_board(struct slot *p_slot)
375 dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); 380 dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);
376 381
377 /* Wait for exclusive access to hardware */ 382 /* Wait for exclusive access to hardware */
378 mutex_lock(&ctrl->crit_sect); 383 mutex_lock(&ctrl->ctrl_lock);
379 384
380 if (POWER_CTRL(ctrl->ctrlcap)) { 385 if (POWER_CTRL(ctrl->ctrlcap)) {
381 /* power off slot */ 386 /* power off slot */
382 rc = p_slot->hpc_ops->power_off_slot(p_slot); 387 rc = p_slot->hpc_ops->power_off_slot(p_slot);
383 if (rc) { 388 if (rc) {
384 err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); 389 err("%s: Issue of Slot Disable command failed\n", __FUNCTION__);
385 mutex_unlock(&ctrl->crit_sect); 390 mutex_unlock(&ctrl->ctrl_lock);
386 return rc; 391 return rc;
387 } 392 }
388 /* Wait for the command to complete */ 393 /* Wait for the command to complete */
@@ -398,7 +403,7 @@ static int remove_board(struct slot *p_slot)
398 } 403 }
399 404
400 /* Done with exclusive hardware access */ 405 /* Done with exclusive hardware access */
401 mutex_unlock(&ctrl->crit_sect); 406 mutex_unlock(&ctrl->ctrl_lock);
402 407
403 return 0; 408 return 0;
404} 409}
@@ -445,7 +450,7 @@ static void pciehp_pushbutton_thread(unsigned long slot)
445 450
446 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { 451 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) {
447 /* Wait for exclusive access to hardware */ 452 /* Wait for exclusive access to hardware */
448 mutex_lock(&p_slot->ctrl->crit_sect); 453 mutex_lock(&p_slot->ctrl->ctrl_lock);
449 454
450 p_slot->hpc_ops->green_led_off(p_slot); 455 p_slot->hpc_ops->green_led_off(p_slot);
451 456
@@ -453,7 +458,7 @@ static void pciehp_pushbutton_thread(unsigned long slot)
453 wait_for_ctrl_irq (p_slot->ctrl); 458 wait_for_ctrl_irq (p_slot->ctrl);
454 459
455 /* Done with exclusive hardware access */ 460 /* Done with exclusive hardware access */
456 mutex_unlock(&p_slot->ctrl->crit_sect); 461 mutex_unlock(&p_slot->ctrl->ctrl_lock);
457 } 462 }
458 p_slot->state = STATIC_STATE; 463 p_slot->state = STATIC_STATE;
459 } 464 }
@@ -495,7 +500,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot)
495 500
496 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { 501 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) {
497 /* Wait for exclusive access to hardware */ 502 /* Wait for exclusive access to hardware */
498 mutex_lock(&p_slot->ctrl->crit_sect); 503 mutex_lock(&p_slot->ctrl->ctrl_lock);
499 504
500 p_slot->hpc_ops->green_led_off(p_slot); 505 p_slot->hpc_ops->green_led_off(p_slot);
501 506
@@ -503,7 +508,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot)
503 wait_for_ctrl_irq (p_slot->ctrl); 508 wait_for_ctrl_irq (p_slot->ctrl);
504 509
505 /* Done with exclusive hardware access */ 510 /* Done with exclusive hardware access */
506 mutex_unlock(&p_slot->ctrl->crit_sect); 511 mutex_unlock(&p_slot->ctrl->ctrl_lock);
507 } 512 }
508 p_slot->state = STATIC_STATE; 513 p_slot->state = STATIC_STATE;
509 } 514 }
@@ -616,7 +621,7 @@ static void interrupt_event_handler(struct controller *ctrl)
616 switch (p_slot->state) { 621 switch (p_slot->state) {
617 case BLINKINGOFF_STATE: 622 case BLINKINGOFF_STATE:
618 /* Wait for exclusive access to hardware */ 623 /* Wait for exclusive access to hardware */
619 mutex_lock(&ctrl->crit_sect); 624 mutex_lock(&ctrl->ctrl_lock);
620 625
621 if (PWR_LED(ctrl->ctrlcap)) { 626 if (PWR_LED(ctrl->ctrlcap)) {
622 p_slot->hpc_ops->green_led_on(p_slot); 627 p_slot->hpc_ops->green_led_on(p_slot);
@@ -630,11 +635,11 @@ static void interrupt_event_handler(struct controller *ctrl)
630 wait_for_ctrl_irq (ctrl); 635 wait_for_ctrl_irq (ctrl);
631 } 636 }
632 /* Done with exclusive hardware access */ 637 /* Done with exclusive hardware access */
633 mutex_unlock(&ctrl->crit_sect); 638 mutex_unlock(&ctrl->ctrl_lock);
634 break; 639 break;
635 case BLINKINGON_STATE: 640 case BLINKINGON_STATE:
636 /* Wait for exclusive access to hardware */ 641 /* Wait for exclusive access to hardware */
637 mutex_lock(&ctrl->crit_sect); 642 mutex_lock(&ctrl->ctrl_lock);
638 643
639 if (PWR_LED(ctrl->ctrlcap)) { 644 if (PWR_LED(ctrl->ctrlcap)) {
640 p_slot->hpc_ops->green_led_off(p_slot); 645 p_slot->hpc_ops->green_led_off(p_slot);
@@ -647,14 +652,14 @@ static void interrupt_event_handler(struct controller *ctrl)
647 wait_for_ctrl_irq (ctrl); 652 wait_for_ctrl_irq (ctrl);
648 } 653 }
649 /* Done with exclusive hardware access */ 654 /* Done with exclusive hardware access */
650 mutex_unlock(&ctrl->crit_sect); 655 mutex_unlock(&ctrl->ctrl_lock);
651 656
652 break; 657 break;
653 default: 658 default:
654 warn("Not a valid state\n"); 659 warn("Not a valid state\n");
655 return; 660 return;
656 } 661 }
657 info(msg_button_cancel, p_slot->number); 662 info(msg_button_cancel, slot_name(p_slot));
658 p_slot->state = STATIC_STATE; 663 p_slot->state = STATIC_STATE;
659 } 664 }
660 /* ***********Button Pressed (No action on 1st press...) */ 665 /* ***********Button Pressed (No action on 1st press...) */
@@ -667,16 +672,16 @@ static void interrupt_event_handler(struct controller *ctrl)
667 /* slot is on */ 672 /* slot is on */
668 dbg("slot is on\n"); 673 dbg("slot is on\n");
669 p_slot->state = BLINKINGOFF_STATE; 674 p_slot->state = BLINKINGOFF_STATE;
670 info(msg_button_off, p_slot->number); 675 info(msg_button_off, slot_name(p_slot));
671 } else { 676 } else {
672 /* slot is off */ 677 /* slot is off */
673 dbg("slot is off\n"); 678 dbg("slot is off\n");
674 p_slot->state = BLINKINGON_STATE; 679 p_slot->state = BLINKINGON_STATE;
675 info(msg_button_on, p_slot->number); 680 info(msg_button_on, slot_name(p_slot));
676 } 681 }
677 682
678 /* Wait for exclusive access to hardware */ 683 /* Wait for exclusive access to hardware */
679 mutex_lock(&ctrl->crit_sect); 684 mutex_lock(&ctrl->ctrl_lock);
680 685
681 /* blink green LED and turn off amber */ 686 /* blink green LED and turn off amber */
682 if (PWR_LED(ctrl->ctrlcap)) { 687 if (PWR_LED(ctrl->ctrlcap)) {
@@ -693,7 +698,7 @@ static void interrupt_event_handler(struct controller *ctrl)
693 } 698 }
694 699
695 /* Done with exclusive hardware access */ 700 /* Done with exclusive hardware access */
696 mutex_unlock(&ctrl->crit_sect); 701 mutex_unlock(&ctrl->ctrl_lock);
697 702
698 init_timer(&p_slot->task_event); 703 init_timer(&p_slot->task_event);
699 p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ 704 p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */
@@ -708,7 +713,7 @@ static void interrupt_event_handler(struct controller *ctrl)
708 if (POWER_CTRL(ctrl->ctrlcap)) { 713 if (POWER_CTRL(ctrl->ctrlcap)) {
709 dbg("power fault\n"); 714 dbg("power fault\n");
710 /* Wait for exclusive access to hardware */ 715 /* Wait for exclusive access to hardware */
711 mutex_lock(&ctrl->crit_sect); 716 mutex_lock(&ctrl->ctrl_lock);
712 717
713 if (ATTN_LED(ctrl->ctrlcap)) { 718 if (ATTN_LED(ctrl->ctrlcap)) {
714 p_slot->hpc_ops->set_attention_status(p_slot, 1); 719 p_slot->hpc_ops->set_attention_status(p_slot, 1);
@@ -721,7 +726,7 @@ static void interrupt_event_handler(struct controller *ctrl)
721 } 726 }
722 727
723 /* Done with exclusive hardware access */ 728 /* Done with exclusive hardware access */
724 mutex_unlock(&ctrl->crit_sect); 729 mutex_unlock(&ctrl->ctrl_lock);
725 } 730 }
726 } 731 }
727 /***********SURPRISE REMOVAL********************/ 732 /***********SURPRISE REMOVAL********************/
@@ -760,14 +765,16 @@ int pciehp_enable_slot(struct slot *p_slot)
760 765
761 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 766 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
762 if (rc || !getstatus) { 767 if (rc || !getstatus) {
763 info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); 768 info("%s: no adapter on slot(%s)\n", __FUNCTION__,
769 slot_name(p_slot));
764 mutex_unlock(&p_slot->ctrl->crit_sect); 770 mutex_unlock(&p_slot->ctrl->crit_sect);
765 return -ENODEV; 771 return -ENODEV;
766 } 772 }
767 if (MRL_SENS(p_slot->ctrl->ctrlcap)) { 773 if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
768 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 774 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
769 if (rc || getstatus) { 775 if (rc || getstatus) {
770 info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); 776 info("%s: latch open on slot(%s)\n", __FUNCTION__,
777 slot_name(p_slot));
771 mutex_unlock(&p_slot->ctrl->crit_sect); 778 mutex_unlock(&p_slot->ctrl->crit_sect);
772 return -ENODEV; 779 return -ENODEV;
773 } 780 }
@@ -776,12 +783,12 @@ int pciehp_enable_slot(struct slot *p_slot)
776 if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { 783 if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
777 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 784 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
778 if (rc || getstatus) { 785 if (rc || getstatus) {
779 info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); 786 info("%s: already enabled on slot(%s)\n", __FUNCTION__,
787 slot_name(p_slot));
780 mutex_unlock(&p_slot->ctrl->crit_sect); 788 mutex_unlock(&p_slot->ctrl->crit_sect);
781 return -EINVAL; 789 return -EINVAL;
782 } 790 }
783 } 791 }
784 mutex_unlock(&p_slot->ctrl->crit_sect);
785 792
786 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 793 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
787 794
@@ -790,9 +797,9 @@ int pciehp_enable_slot(struct slot *p_slot)
790 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 797 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
791 } 798 }
792 799
793 if (p_slot) 800 update_slot_info(p_slot);
794 update_slot_info(p_slot);
795 801
802 mutex_unlock(&p_slot->ctrl->crit_sect);
796 return rc; 803 return rc;
797} 804}
798 805
@@ -811,7 +818,8 @@ int pciehp_disable_slot(struct slot *p_slot)
811 if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { 818 if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) {
812 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 819 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
813 if (ret || !getstatus) { 820 if (ret || !getstatus) {
814 info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); 821 info("%s: no adapter on slot(%s)\n", __FUNCTION__,
822 slot_name(p_slot));
815 mutex_unlock(&p_slot->ctrl->crit_sect); 823 mutex_unlock(&p_slot->ctrl->crit_sect);
816 return -ENODEV; 824 return -ENODEV;
817 } 825 }
@@ -820,7 +828,8 @@ int pciehp_disable_slot(struct slot *p_slot)
820 if (MRL_SENS(p_slot->ctrl->ctrlcap)) { 828 if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
821 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 829 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
822 if (ret || getstatus) { 830 if (ret || getstatus) {
823 info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); 831 info("%s: latch open on slot(%s)\n", __FUNCTION__,
832 slot_name(p_slot));
824 mutex_unlock(&p_slot->ctrl->crit_sect); 833 mutex_unlock(&p_slot->ctrl->crit_sect);
825 return -ENODEV; 834 return -ENODEV;
826 } 835 }
@@ -829,16 +838,17 @@ int pciehp_disable_slot(struct slot *p_slot)
829 if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { 838 if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
830 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 839 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
831 if (ret || !getstatus) { 840 if (ret || !getstatus) {
832 info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); 841 info("%s: already disabled slot(%s)\n", __FUNCTION__,
842 slot_name(p_slot));
833 mutex_unlock(&p_slot->ctrl->crit_sect); 843 mutex_unlock(&p_slot->ctrl->crit_sect);
834 return -EINVAL; 844 return -EINVAL;
835 } 845 }
836 } 846 }
837 847
838 mutex_unlock(&p_slot->ctrl->crit_sect);
839
840 ret = remove_board(p_slot); 848 ret = remove_board(p_slot);
841 update_slot_info(p_slot); 849 update_slot_info(p_slot);
850
851 mutex_unlock(&p_slot->ctrl->crit_sect);
842 return ret; 852 return ret;
843} 853}
844 854
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 703a64a39fe8..1c551c697c35 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1402,6 +1402,8 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1402 pdev->subsystem_vendor, pdev->subsystem_device); 1402 pdev->subsystem_vendor, pdev->subsystem_device);
1403 1403
1404 mutex_init(&ctrl->crit_sect); 1404 mutex_init(&ctrl->crit_sect);
1405 mutex_init(&ctrl->ctrl_lock);
1406
1405 /* setup wait queue */ 1407 /* setup wait queue */
1406 init_waitqueue_head(&ctrl->queue); 1408 init_waitqueue_head(&ctrl->queue);
1407 1409
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c
index 2b9e10e38613..50bcd3fe61da 100644
--- a/drivers/pci/hotplug/pcihp_skeleton.c
+++ b/drivers/pci/hotplug/pcihp_skeleton.c
@@ -33,8 +33,8 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/pci_hotplug.h>
36#include <linux/init.h> 37#include <linux/init.h>
37#include "pci_hotplug.h"
38 38
39#define SLOT_NAME_SIZE 10 39#define SLOT_NAME_SIZE 10
40struct slot { 40struct slot {
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c
index db69be85b458..6c5be3ff578c 100644
--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
+++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/kobject.h> 15#include <linux/kobject.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include "pci_hotplug.h" 17#include <linux/pci_hotplug.h>
18#include "rpadlpar.h" 18#include "rpadlpar.h"
19 19
20#define DLPAR_KOBJ_NAME "control" 20#define DLPAR_KOBJ_NAME "control"
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
index 310b6186c0e5..2e7accf0f734 100644
--- a/drivers/pci/hotplug/rpaphp.h
+++ b/drivers/pci/hotplug/rpaphp.h
@@ -28,7 +28,7 @@
28#define _PPC64PHP_H 28#define _PPC64PHP_H
29 29
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include "pci_hotplug.h" 31#include <linux/pci_hotplug.h>
32 32
33#define DR_INDICATOR 9002 33#define DR_INDICATOR 9002
34#define DR_ENTITY_SENSE 9003 34#define DR_ENTITY_SENSE 9003
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 7288a3eccfb3..141486df235b 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -26,6 +26,7 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/pci_hotplug.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/smp.h> 31#include <linux/smp.h>
31#include <linux/smp_lock.h> 32#include <linux/smp_lock.h>
@@ -36,7 +37,6 @@
36#include "../pci.h" /* for pci_add_new_bus */ 37#include "../pci.h" /* for pci_add_new_bus */
37 /* and pci_do_scan_bus */ 38 /* and pci_do_scan_bus */
38#include "rpaphp.h" 39#include "rpaphp.h"
39#include "pci_hotplug.h"
40 40
41int debug; 41int debug;
42static struct semaphore rpaphp_sem; 42static struct semaphore rpaphp_sem;
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index f31d83c2c633..b62ad31a9739 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/pci_hotplug.h>
16#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/mutex.h> 19#include <linux/mutex.h>
@@ -29,7 +30,6 @@
29#include <asm/sn/types.h> 30#include <asm/sn/types.h>
30 31
31#include "../pci.h" 32#include "../pci.h"
32#include "pci_hotplug.h"
33 33
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
35MODULE_AUTHOR("SGI (prarit@sgi.com, dickie@sgi.com, habeck@sgi.com)"); 35MODULE_AUTHOR("SGI (prarit@sgi.com, dickie@sgi.com, habeck@sgi.com)");
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index c7103ac5cd06..ea2087c34149 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -31,12 +31,11 @@
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/pci_hotplug.h>
34#include <linux/delay.h> 35#include <linux/delay.h>
35#include <linux/sched.h> /* signal_pending(), struct timer_list */ 36#include <linux/sched.h> /* signal_pending(), struct timer_list */
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37 38
38#include "pci_hotplug.h"
39
40#if !defined(MODULE) 39#if !defined(MODULE)
41 #define MY_NAME "shpchp" 40 #define MY_NAME "shpchp"
42#else 41#else
@@ -103,7 +102,6 @@ struct controller {
103 u32 cap_offset; 102 u32 cap_offset;
104 unsigned long mmio_base; 103 unsigned long mmio_base;
105 unsigned long mmio_size; 104 unsigned long mmio_size;
106 volatile int cmd_busy;
107}; 105};
108 106
109 107
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index 4d8aee119134..83a5226ba9ed 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -302,21 +302,51 @@ static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec)
302 add_timer(&php_ctlr->int_poll_timer); 302 add_timer(&php_ctlr->int_poll_timer);
303} 303}
304 304
305static inline int is_ctrl_busy(struct controller *ctrl)
306{
307 u16 cmd_status = shpc_readw(ctrl, CMD_STATUS);
308 return cmd_status & 0x1;
309}
310
311/*
312 * Returns 1 if SHPC finishes executing a command within 1 sec,
313 * otherwise returns 0.
314 */
315static inline int shpc_poll_ctrl_busy(struct controller *ctrl)
316{
317 int i;
318
319 if (!is_ctrl_busy(ctrl))
320 return 1;
321
322 /* Check every 0.1 sec for a total of 1 sec */
323 for (i = 0; i < 10; i++) {
324 msleep(100);
325 if (!is_ctrl_busy(ctrl))
326 return 1;
327 }
328
329 return 0;
330}
331
305static inline int shpc_wait_cmd(struct controller *ctrl) 332static inline int shpc_wait_cmd(struct controller *ctrl)
306{ 333{
307 int retval = 0; 334 int retval = 0;
308 unsigned int timeout_msec = shpchp_poll_mode ? 2000 : 1000; 335 unsigned long timeout = msecs_to_jiffies(1000);
309 unsigned long timeout = msecs_to_jiffies(timeout_msec); 336 int rc;
310 int rc = wait_event_interruptible_timeout(ctrl->queue, 337
311 !ctrl->cmd_busy, timeout); 338 if (shpchp_poll_mode)
312 if (!rc) { 339 rc = shpc_poll_ctrl_busy(ctrl);
340 else
341 rc = wait_event_interruptible_timeout(ctrl->queue,
342 !is_ctrl_busy(ctrl), timeout);
343 if (!rc && is_ctrl_busy(ctrl)) {
313 retval = -EIO; 344 retval = -EIO;
314 err("Command not completed in %d msec\n", timeout_msec); 345 err("Command not completed in 1000 msec\n");
315 } else if (rc < 0) { 346 } else if (rc < 0) {
316 retval = -EINTR; 347 retval = -EINTR;
317 info("Command was interrupted by a signal\n"); 348 info("Command was interrupted by a signal\n");
318 } 349 }
319 ctrl->cmd_busy = 0;
320 350
321 return retval; 351 return retval;
322} 352}
@@ -327,26 +357,15 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
327 u16 cmd_status; 357 u16 cmd_status;
328 int retval = 0; 358 int retval = 0;
329 u16 temp_word; 359 u16 temp_word;
330 int i;
331 360
332 DBG_ENTER_ROUTINE 361 DBG_ENTER_ROUTINE
333 362
334 mutex_lock(&slot->ctrl->cmd_lock); 363 mutex_lock(&slot->ctrl->cmd_lock);
335 364
336 for (i = 0; i < 10; i++) { 365 if (!shpc_poll_ctrl_busy(ctrl)) {
337 cmd_status = shpc_readw(ctrl, CMD_STATUS);
338
339 if (!(cmd_status & 0x1))
340 break;
341 /* Check every 0.1 sec for a total of 1 sec*/
342 msleep(100);
343 }
344
345 cmd_status = shpc_readw(ctrl, CMD_STATUS);
346
347 if (cmd_status & 0x1) {
348 /* After 1 sec and and the controller is still busy */ 366 /* After 1 sec and and the controller is still busy */
349 err("%s : Controller is still busy after 1 sec.\n", __FUNCTION__); 367 err("%s : Controller is still busy after 1 sec.\n",
368 __FUNCTION__);
350 retval = -EBUSY; 369 retval = -EBUSY;
351 goto out; 370 goto out;
352 } 371 }
@@ -358,7 +377,6 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
358 /* To make sure the Controller Busy bit is 0 before we send out the 377 /* To make sure the Controller Busy bit is 0 before we send out the
359 * command. 378 * command.
360 */ 379 */
361 slot->ctrl->cmd_busy = 1;
362 shpc_writew(ctrl, CMD, temp_word); 380 shpc_writew(ctrl, CMD, temp_word);
363 381
364 /* 382 /*
@@ -908,7 +926,6 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
908 serr_int &= ~SERR_INTR_RSVDZ_MASK; 926 serr_int &= ~SERR_INTR_RSVDZ_MASK;
909 shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); 927 shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int);
910 928
911 ctrl->cmd_busy = 0;
912 wake_up_interruptible(&ctrl->queue); 929 wake_up_interruptible(&ctrl->queue);
913 } 930 }
914 931
@@ -1101,7 +1118,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1101{ 1118{
1102 struct php_ctlr_state_s *php_ctlr, *p; 1119 struct php_ctlr_state_s *php_ctlr, *p;
1103 void *instance_id = ctrl; 1120 void *instance_id = ctrl;
1104 int rc, num_slots = 0; 1121 int rc = -1, num_slots = 0;
1105 u8 hp_slot; 1122 u8 hp_slot;
1106 u32 shpc_base_offset; 1123 u32 shpc_base_offset;
1107 u32 tempdword, slot_reg, slot_config; 1124 u32 tempdword, slot_reg, slot_config;
@@ -1167,11 +1184,15 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1167 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 1184 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor,
1168 pdev->subsystem_device); 1185 pdev->subsystem_device);
1169 1186
1170 if (pci_enable_device(pdev)) 1187 rc = pci_enable_device(pdev);
1188 if (rc) {
1189 err("%s: pci_enable_device failed\n", __FUNCTION__);
1171 goto abort_free_ctlr; 1190 goto abort_free_ctlr;
1191 }
1172 1192
1173 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { 1193 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) {
1174 err("%s: cannot reserve MMIO region\n", __FUNCTION__); 1194 err("%s: cannot reserve MMIO region\n", __FUNCTION__);
1195 rc = -1;
1175 goto abort_free_ctlr; 1196 goto abort_free_ctlr;
1176 } 1197 }
1177 1198
@@ -1180,6 +1201,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1180 err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, 1201 err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__,
1181 ctrl->mmio_size, ctrl->mmio_base); 1202 ctrl->mmio_size, ctrl->mmio_base);
1182 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 1203 release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
1204 rc = -1;
1183 goto abort_free_ctlr; 1205 goto abort_free_ctlr;
1184 } 1206 }
1185 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); 1207 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg);
@@ -1282,8 +1304,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1282 */ 1304 */
1283 if (atomic_add_return(1, &shpchp_num_controllers) == 1) { 1305 if (atomic_add_return(1, &shpchp_num_controllers) == 1) {
1284 shpchp_wq = create_singlethread_workqueue("shpchpd"); 1306 shpchp_wq = create_singlethread_workqueue("shpchpd");
1285 if (!shpchp_wq) 1307 if (!shpchp_wq) {
1286 return -ENOMEM; 1308 rc = -ENOMEM;
1309 goto abort_free_ctlr;
1310 }
1287 } 1311 }
1288 1312
1289 /* 1313 /*
@@ -1313,8 +1337,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1313 1337
1314 /* We end up here for the many possible ways to fail this API. */ 1338 /* We end up here for the many possible ways to fail this API. */
1315abort_free_ctlr: 1339abort_free_ctlr:
1340 if (php_ctlr->creg)
1341 iounmap(php_ctlr->creg);
1316 kfree(php_ctlr); 1342 kfree(php_ctlr);
1317abort: 1343abort:
1318 DBG_LEAVE_ROUTINE 1344 DBG_LEAVE_ROUTINE
1319 return -1; 1345 return rc;
1320} 1346}
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index f9fdc54473c4..9fc9a34ef24a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -627,22 +627,24 @@ static int msix_capability_init(struct pci_dev *dev,
627 * pci_msi_supported - check whether MSI may be enabled on device 627 * pci_msi_supported - check whether MSI may be enabled on device
628 * @dev: pointer to the pci_dev data structure of MSI device function 628 * @dev: pointer to the pci_dev data structure of MSI device function
629 * 629 *
630 * MSI must be globally enabled and supported by the device and its root 630 * Look at global flags, the device itself, and its parent busses
631 * bus. But, the root bus is not easy to find since some architectures 631 * to return 0 if MSI are supported for the device.
632 * have virtual busses on top of the PCI hierarchy (for instance the
633 * hypertransport bus), while the actual bus where MSI must be supported
634 * is below. So we test the MSI flag on all parent busses and assume
635 * that no quirk will ever set the NO_MSI flag on a non-root bus.
636 **/ 632 **/
637static 633static
638int pci_msi_supported(struct pci_dev * dev) 634int pci_msi_supported(struct pci_dev * dev)
639{ 635{
640 struct pci_bus *bus; 636 struct pci_bus *bus;
641 637
638 /* MSI must be globally enabled and supported by the device */
642 if (!pci_msi_enable || !dev || dev->no_msi) 639 if (!pci_msi_enable || !dev || dev->no_msi)
643 return -EINVAL; 640 return -EINVAL;
644 641
645 /* check MSI flags of all parent busses */ 642 /* Any bridge which does NOT route MSI transactions from it's
643 * secondary bus to it's primary bus must set NO_MSI flag on
644 * the secondary pci_bus.
645 * We expect only arch-specific PCI host bus controller driver
646 * or quirks for specific PCI bridges to be setting NO_MSI.
647 */
646 for (bus = dev->bus; bus; bus = bus->parent) 648 for (bus = dev->bus; bus; bus = bus->parent)
647 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) 649 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
648 return -EINVAL; 650 return -EINVAL;
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 67fcd176babd..3656e0349dd1 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -9,6 +9,8 @@
9#ifndef _PORTDRV_H_ 9#ifndef _PORTDRV_H_
10#define _PORTDRV_H_ 10#define _PORTDRV_H_
11 11
12#include <linux/compiler.h>
13
12#if !defined(PCI_CAP_ID_PME) 14#if !defined(PCI_CAP_ID_PME)
13#define PCI_CAP_ID_PME 1 15#define PCI_CAP_ID_PME 1
14#endif 16#endif
@@ -39,7 +41,7 @@ extern int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state);
39extern int pcie_port_device_resume(struct pci_dev *dev); 41extern int pcie_port_device_resume(struct pci_dev *dev);
40#endif 42#endif
41extern void pcie_port_device_remove(struct pci_dev *dev); 43extern void pcie_port_device_remove(struct pci_dev *dev);
42extern int pcie_port_bus_register(void); 44extern int __must_check pcie_port_bus_register(void);
43extern void pcie_port_bus_unregister(void); 45extern void pcie_port_bus_unregister(void);
44 46
45#endif /* _PORTDRV_H_ */ 47#endif /* _PORTDRV_H_ */
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index bd6615b4d40e..b20a9b81dae2 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -6,7 +6,6 @@
6 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) 6 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
7 */ 7 */
8 8
9#include <linux/compiler.h>
10#include <linux/module.h> 9#include <linux/module.h>
11#include <linux/pci.h> 10#include <linux/pci.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
@@ -401,7 +400,7 @@ void pcie_port_device_remove(struct pci_dev *dev)
401 pci_disable_msi(dev); 400 pci_disable_msi(dev);
402} 401}
403 402
404int __must_check pcie_port_bus_register(void) 403int pcie_port_bus_register(void)
405{ 404{
406 return bus_register(&pcie_port_bus_type); 405 return bus_register(&pcie_port_bus_type);
407} 406}
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 037690e08f5f..b4da7954611e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -37,7 +37,6 @@ static int pcie_portdrv_save_config(struct pci_dev *dev)
37 return pci_save_state(dev); 37 return pci_save_state(dev);
38} 38}
39 39
40#ifdef CONFIG_PM
41static int pcie_portdrv_restore_config(struct pci_dev *dev) 40static int pcie_portdrv_restore_config(struct pci_dev *dev)
42{ 41{
43 int retval; 42 int retval;
@@ -50,6 +49,7 @@ static int pcie_portdrv_restore_config(struct pci_dev *dev)
50 return 0; 49 return 0;
51} 50}
52 51
52#ifdef CONFIG_PM
53static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state) 53static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state)
54{ 54{
55 int ret = pcie_port_device_suspend(dev, state); 55 int ret = pcie_port_device_suspend(dev, state);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a3b0a5eb5054..e159d6604494 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1067,3 +1067,95 @@ EXPORT_SYMBOL(pci_scan_bridge);
1067EXPORT_SYMBOL(pci_scan_single_device); 1067EXPORT_SYMBOL(pci_scan_single_device);
1068EXPORT_SYMBOL_GPL(pci_scan_child_bus); 1068EXPORT_SYMBOL_GPL(pci_scan_child_bus);
1069#endif 1069#endif
1070
1071static int __init pci_sort_bf_cmp(const struct pci_dev *a, const struct pci_dev *b)
1072{
1073 if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1;
1074 else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1;
1075
1076 if (a->bus->number < b->bus->number) return -1;
1077 else if (a->bus->number > b->bus->number) return 1;
1078
1079 if (a->devfn < b->devfn) return -1;
1080 else if (a->devfn > b->devfn) return 1;
1081
1082 return 0;
1083}
1084
1085/*
1086 * Yes, this forcably breaks the klist abstraction temporarily. It
1087 * just wants to sort the klist, not change reference counts and
1088 * take/drop locks rapidly in the process. It does all this while
1089 * holding the lock for the list, so objects can't otherwise be
1090 * added/removed while we're swizzling.
1091 */
1092static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head *list)
1093{
1094 struct list_head *pos;
1095 struct klist_node *n;
1096 struct device *dev;
1097 struct pci_dev *b;
1098
1099 list_for_each(pos, list) {
1100 n = container_of(pos, struct klist_node, n_node);
1101 dev = container_of(n, struct device, knode_bus);
1102 b = to_pci_dev(dev);
1103 if (pci_sort_bf_cmp(a, b) <= 0) {
1104 list_move_tail(&a->dev.knode_bus.n_node, &b->dev.knode_bus.n_node);
1105 return;
1106 }
1107 }
1108 list_move_tail(&a->dev.knode_bus.n_node, list);
1109}
1110
1111static void __init pci_sort_breadthfirst_klist(void)
1112{
1113 LIST_HEAD(sorted_devices);
1114 struct list_head *pos, *tmp;
1115 struct klist_node *n;
1116 struct device *dev;
1117 struct pci_dev *pdev;
1118
1119 spin_lock(&pci_bus_type.klist_devices.k_lock);
1120 list_for_each_safe(pos, tmp, &pci_bus_type.klist_devices.k_list) {
1121 n = container_of(pos, struct klist_node, n_node);
1122 dev = container_of(n, struct device, knode_bus);
1123 pdev = to_pci_dev(dev);
1124 pci_insertion_sort_klist(pdev, &sorted_devices);
1125 }
1126 list_splice(&sorted_devices, &pci_bus_type.klist_devices.k_list);
1127 spin_unlock(&pci_bus_type.klist_devices.k_lock);
1128}
1129
1130static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list)
1131{
1132 struct pci_dev *b;
1133
1134 list_for_each_entry(b, list, global_list) {
1135 if (pci_sort_bf_cmp(a, b) <= 0) {
1136 list_move_tail(&a->global_list, &b->global_list);
1137 return;
1138 }
1139 }
1140 list_move_tail(&a->global_list, list);
1141}
1142
1143static void __init pci_sort_breadthfirst_devices(void)
1144{
1145 LIST_HEAD(sorted_devices);
1146 struct pci_dev *dev, *tmp;
1147
1148 down_write(&pci_bus_sem);
1149 list_for_each_entry_safe(dev, tmp, &pci_devices, global_list) {
1150 pci_insertion_sort_devices(dev, &sorted_devices);
1151 }
1152 list_splice(&sorted_devices, &pci_devices);
1153 up_write(&pci_bus_sem);
1154}
1155
1156void __init pci_sort_breadthfirst(void)
1157{
1158 pci_sort_breadthfirst_devices();
1159 pci_sort_breadthfirst_klist();
1160}
1161
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 23b599d6a9d5..e8a7f1b1b2bc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -453,6 +453,12 @@ static void __devinit quirk_ich6_lpc_acpi(struct pci_dev *dev)
453} 453}
454DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, quirk_ich6_lpc_acpi ); 454DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, quirk_ich6_lpc_acpi );
455DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, quirk_ich6_lpc_acpi ); 455DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, quirk_ich6_lpc_acpi );
456DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, quirk_ich6_lpc_acpi );
457DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, quirk_ich6_lpc_acpi );
458DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk_ich6_lpc_acpi );
459DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
460DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
461DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
456 462
457/* 463/*
458 * VIA ACPI: One IO region pointed to by longword at 464 * VIA ACPI: One IO region pointed to by longword at
@@ -648,11 +654,43 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi
648 * Some of the on-chip devices are actually '586 devices' so they are 654 * Some of the on-chip devices are actually '586 devices' so they are
649 * listed here. 655 * listed here.
650 */ 656 */
657
658static int via_irq_fixup_needed = -1;
659
660/*
661 * As some VIA hardware is available in PCI-card form, we need to restrict
662 * this quirk to VIA PCI hardware built onto VIA-based motherboards only.
663 * We try to locate a VIA southbridge before deciding whether the quirk
664 * should be applied.
665 */
666static const struct pci_device_id via_irq_fixup_tbl[] = {
667 {
668 .vendor = PCI_VENDOR_ID_VIA,
669 .device = PCI_ANY_ID,
670 .subvendor = PCI_ANY_ID,
671 .subdevice = PCI_ANY_ID,
672 .class = PCI_CLASS_BRIDGE_ISA << 8,
673 .class_mask = 0xffff00,
674 },
675 { 0, },
676};
677
651static void quirk_via_irq(struct pci_dev *dev) 678static void quirk_via_irq(struct pci_dev *dev)
652{ 679{
653 u8 irq, new_irq; 680 u8 irq, new_irq;
654 681
655 new_irq = dev->irq & 0xf; 682 if (via_irq_fixup_needed == -1)
683 via_irq_fixup_needed = pci_dev_present(via_irq_fixup_tbl);
684
685 if (!via_irq_fixup_needed)
686 return;
687
688 new_irq = dev->irq;
689
690 /* Don't quirk interrupts outside the legacy IRQ range */
691 if (!new_irq || new_irq > 15)
692 return;
693
656 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq); 694 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
657 if (new_irq != irq) { 695 if (new_irq != irq) {
658 printk(KERN_INFO "PCI: VIA IRQ fixup for %s, from %d to %d\n", 696 printk(KERN_INFO "PCI: VIA IRQ fixup for %s, from %d to %d\n",
@@ -661,14 +699,7 @@ static void quirk_via_irq(struct pci_dev *dev)
661 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); 699 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
662 } 700 }
663} 701}
664DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq); 702DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq);
665DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
666DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
667DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
668DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235_USB_2, quirk_via_irq);
669DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
670DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
671DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
672 703
673/* 704/*
674 * VIA VT82C598 has its device ID settable and many BIOSes 705 * VIA VT82C598 has its device ID settable and many BIOSes
@@ -1588,6 +1619,51 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1588} 1619}
1589DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); 1620DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
1590 1621
1622/*
1623 * Fixup to mark boot BIOS video selected by BIOS before it changes
1624 *
1625 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
1626 *
1627 * The standard boot ROM sequence for an x86 machine uses the BIOS
1628 * to select an initial video card for boot display. This boot video
1629 * card will have it's BIOS copied to C0000 in system RAM.
1630 * IORESOURCE_ROM_SHADOW is used to associate the boot video
1631 * card with this copy. On laptops this copy has to be used since
1632 * the main ROM may be compressed or combined with another image.
1633 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
1634 * is marked here since the boot video device will be the only enabled
1635 * video device at this point.
1636 */
1637
1638static void __devinit fixup_video(struct pci_dev *pdev)
1639{
1640 struct pci_dev *bridge;
1641 struct pci_bus *bus;
1642 u16 config;
1643
1644 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
1645 return;
1646
1647 /* Is VGA routed to us? */
1648 bus = pdev->bus;
1649 while (bus) {
1650 bridge = bus->self;
1651 if (bridge) {
1652 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
1653 &config);
1654 if (!(config & PCI_BRIDGE_CTL_VGA))
1655 return;
1656 }
1657 bus = bus->parent;
1658 }
1659 pci_read_config_word(pdev, PCI_COMMAND, &config);
1660 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
1661 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
1662 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
1663 }
1664}
1665DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_video);
1666
1591 1667
1592static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) 1668static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
1593{ 1669{
@@ -1764,7 +1840,7 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1764 /* check HT MSI cap on this chipset and the root one. 1840 /* check HT MSI cap on this chipset and the root one.
1765 * a single one having MSI is enough to be sure that MSI are supported. 1841 * a single one having MSI is enough to be sure that MSI are supported.
1766 */ 1842 */
1767 pdev = pci_find_slot(dev->bus->number, 0); 1843 pdev = pci_get_slot(dev->bus, 0);
1768 if (dev->subordinate && !msi_ht_cap_enabled(dev) 1844 if (dev->subordinate && !msi_ht_cap_enabled(dev)
1769 && !msi_ht_cap_enabled(pdev)) { 1845 && !msi_ht_cap_enabled(pdev)) {
1770 printk(KERN_WARNING "PCI: MSI quirk detected. " 1846 printk(KERN_WARNING "PCI: MSI quirk detected. "
@@ -1772,6 +1848,7 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1772 pci_name(dev)); 1848 pci_name(dev));
1773 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 1849 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
1774 } 1850 }
1851 pci_dev_put(pdev);
1775} 1852}
1776DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1853DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1777 quirk_nvidia_ck804_msi_ht_cap); 1854 quirk_nvidia_ck804_msi_ht_cap);
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index f5ee7ce16fa6..43e4a49f2cc4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -71,7 +71,10 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
71 void __iomem *image; 71 void __iomem *image;
72 int last_image; 72 int last_image;
73 73
74 /* IORESOURCE_ROM_SHADOW only set on x86 */ 74 /*
75 * IORESOURCE_ROM_SHADOW set if the VGA enable bit of the Bridge Control
76 * register is set for embedded VGA.
77 */
75 if (res->flags & IORESOURCE_ROM_SHADOW) { 78 if (res->flags & IORESOURCE_ROM_SHADOW) {
76 /* primary video rom always starts here */ 79 /* primary video rom always starts here */
77 start = (loff_t)0xC0000; 80 start = (loff_t)0xC0000;
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index d529462d1b53..2f13eba5d5ae 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -140,6 +140,31 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn)
140} 140}
141 141
142/** 142/**
143 * pci_get_bus_and_slot - locate PCI device from a given PCI slot
144 * @bus: number of PCI bus on which desired PCI device resides
145 * @devfn: encodes number of PCI slot in which the desired PCI
146 * device resides and the logical device number within that slot
147 * in case of multi-function devices.
148 *
149 * Given a PCI bus and slot/function number, the desired PCI device
150 * is located in system global list of PCI devices. If the device
151 * is found, a pointer to its data structure is returned. If no
152 * device is found, %NULL is returned. The returned device has its
153 * reference count bumped by one.
154 */
155
156struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
157{
158 struct pci_dev *dev = NULL;
159
160 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
161 if (dev->bus->number == bus && dev->devfn == devfn)
162 return dev;
163 }
164 return NULL;
165}
166
167/**
143 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id 168 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
144 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids 169 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
145 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids 170 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
@@ -274,6 +299,45 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
274 return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); 299 return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
275} 300}
276 301
302/**
303 * pci_get_device_reverse - begin or continue searching for a PCI device by vendor/device id
304 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
305 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
306 * @from: Previous PCI device found in search, or %NULL for new search.
307 *
308 * Iterates through the list of known PCI devices in the reverse order of
309 * pci_get_device.
310 * If a PCI device is found with a matching @vendor and @device, the reference
311 * count to the device is incremented and a pointer to its device structure
312 * is returned Otherwise, %NULL is returned. A new search is initiated by
313 * passing %NULL as the @from argument. Otherwise if @from is not %NULL,
314 * searches continue from next device on the global list. The reference
315 * count for @from is always decremented if it is not %NULL.
316 */
317struct pci_dev *
318pci_get_device_reverse(unsigned int vendor, unsigned int device, struct pci_dev *from)
319{
320 struct list_head *n;
321 struct pci_dev *dev;
322
323 WARN_ON(in_interrupt());
324 down_read(&pci_bus_sem);
325 n = from ? from->global_list.prev : pci_devices.prev;
326
327 while (n && (n != &pci_devices)) {
328 dev = pci_dev_g(n);
329 if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&
330 (device == PCI_ANY_ID || dev->device == device))
331 goto exit;
332 n = n->prev;
333 }
334 dev = NULL;
335exit:
336 dev = pci_dev_get(dev);
337 up_read(&pci_bus_sem);
338 pci_dev_put(from);
339 return dev;
340}
277 341
278/** 342/**
279 * pci_find_device_reverse - begin or continue searching for a PCI device by vendor/device id 343 * pci_find_device_reverse - begin or continue searching for a PCI device by vendor/device id
@@ -382,12 +446,16 @@ exit:
382} 446}
383EXPORT_SYMBOL(pci_dev_present); 447EXPORT_SYMBOL(pci_dev_present);
384 448
385EXPORT_SYMBOL(pci_find_bus);
386EXPORT_SYMBOL(pci_find_next_bus);
387EXPORT_SYMBOL(pci_find_device); 449EXPORT_SYMBOL(pci_find_device);
388EXPORT_SYMBOL(pci_find_device_reverse); 450EXPORT_SYMBOL(pci_find_device_reverse);
389EXPORT_SYMBOL(pci_find_slot); 451EXPORT_SYMBOL(pci_find_slot);
452/* For boot time work */
453EXPORT_SYMBOL(pci_find_bus);
454EXPORT_SYMBOL(pci_find_next_bus);
455/* For everyone */
390EXPORT_SYMBOL(pci_get_device); 456EXPORT_SYMBOL(pci_get_device);
457EXPORT_SYMBOL(pci_get_device_reverse);
391EXPORT_SYMBOL(pci_get_subsys); 458EXPORT_SYMBOL(pci_get_subsys);
392EXPORT_SYMBOL(pci_get_slot); 459EXPORT_SYMBOL(pci_get_slot);
460EXPORT_SYMBOL(pci_get_bus_and_slot);
393EXPORT_SYMBOL(pci_get_class); 461EXPORT_SYMBOL(pci_get_class);
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index dc79b0a0059f..379048fdf05d 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -776,21 +776,32 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
776 struct resource *p) 776 struct resource *p)
777{ 777{
778 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ 778 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
779 if (p->flags & IORESOURCE_DMA_COMPATIBLE) 779 switch (p->flags & IORESOURCE_DMA_SPEED_MASK) {
780 resource->data.dma.type = ACPI_COMPATIBILITY; 780 case IORESOURCE_DMA_TYPEA:
781 else if (p->flags & IORESOURCE_DMA_TYPEA) 781 resource->data.dma.type = ACPI_TYPE_A;
782 resource->data.dma.type = ACPI_TYPE_A; 782 break;
783 else if (p->flags & IORESOURCE_DMA_TYPEB) 783 case IORESOURCE_DMA_TYPEB:
784 resource->data.dma.type = ACPI_TYPE_B; 784 resource->data.dma.type = ACPI_TYPE_B;
785 else if (p->flags & IORESOURCE_DMA_TYPEF) 785 break;
786 resource->data.dma.type = ACPI_TYPE_F; 786 case IORESOURCE_DMA_TYPEF:
787 if (p->flags & IORESOURCE_DMA_8BIT) 787 resource->data.dma.type = ACPI_TYPE_F;
788 resource->data.dma.transfer = ACPI_TRANSFER_8; 788 break;
789 else if (p->flags & IORESOURCE_DMA_8AND16BIT) 789 default:
790 resource->data.dma.transfer = ACPI_TRANSFER_8_16; 790 resource->data.dma.type = ACPI_COMPATIBILITY;
791 else if (p->flags & IORESOURCE_DMA_16BIT) 791 }
792 resource->data.dma.transfer = ACPI_TRANSFER_16; 792
793 resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; 793 switch (p->flags & IORESOURCE_DMA_TYPE_MASK) {
794 case IORESOURCE_DMA_8BIT:
795 resource->data.dma.transfer = ACPI_TRANSFER_8;
796 break;
797 case IORESOURCE_DMA_8AND16BIT:
798 resource->data.dma.transfer = ACPI_TRANSFER_8_16;
799 break;
800 default:
801 resource->data.dma.transfer = ACPI_TRANSFER_16;
802 }
803
804 resource->data.dma.bus_master = !!(p->flags & IORESOURCE_DMA_MASTER);
794 resource->data.dma.channel_count = 1; 805 resource->data.dma.channel_count = 1;
795 resource->data.dma.channels[0] = p->start; 806 resource->data.dma.channels[0] = p->start;
796} 807}
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 0b20dfacbf59..d94170728075 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -136,7 +136,7 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt)
136 dt->tm_min = BCD2BIN(chip->buf[2]); 136 dt->tm_min = BCD2BIN(chip->buf[2]);
137 dt->tm_hour = BCD2BIN(chip->buf[3]); 137 dt->tm_hour = BCD2BIN(chip->buf[3]);
138 dt->tm_mday = BCD2BIN(chip->buf[4]); 138 dt->tm_mday = BCD2BIN(chip->buf[4]);
139 dt->tm_mon = BCD2BIN(chip->buf[5] - 1); 139 dt->tm_mon = BCD2BIN(chip->buf[5]) - 1;
140 dt->tm_wday = BCD2BIN(chip->buf[6]); 140 dt->tm_wday = BCD2BIN(chip->buf[6]);
141 dt->tm_year = BCD2BIN(chip->buf[7]); 141 dt->tm_year = BCD2BIN(chip->buf[7]);
142 142
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index 09b714f1cdc3..3b58d3d5d38a 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -195,9 +195,9 @@ static int rtc_probe(struct platform_device *pdev)
195 * are all disabled */ 195 * are all disabled */
196 v3020_set_reg(chip, V3020_STATUS_0, 0x0); 196 v3020_set_reg(chip, V3020_STATUS_0, 0x0);
197 197
198 dev_info(&pdev->dev, "Chip available at physical address 0x%p," 198 dev_info(&pdev->dev, "Chip available at physical address 0x%llx,"
199 "data connected to D%d\n", 199 "data connected to D%d\n",
200 (void*)pdev->resource[0].start, 200 (unsigned long long)pdev->resource[0].start,
201 chip->leftshift); 201 chip->leftshift);
202 202
203 platform_set_drvdata(pdev, chip); 203 platform_set_drvdata(pdev, chip);
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d0647d116eaa..79ffef6bfaf8 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -203,6 +203,7 @@ dasd_state_basic_to_known(struct dasd_device * device)
203 rc = dasd_flush_ccw_queue(device, 1); 203 rc = dasd_flush_ccw_queue(device, 1);
204 if (rc) 204 if (rc)
205 return rc; 205 return rc;
206 dasd_clear_timer(device);
206 207
207 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); 208 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device);
208 if (device->debug_area != NULL) { 209 if (device->debug_area != NULL) {
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c
index abd02ed501cb..b9b0fc3f812b 100644
--- a/drivers/s390/char/monwriter.c
+++ b/drivers/s390/char/monwriter.c
@@ -73,12 +73,15 @@ static inline struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv,
73 struct mon_buf *entry, *next; 73 struct mon_buf *entry, *next;
74 74
75 list_for_each_entry_safe(entry, next, &monpriv->list, list) 75 list_for_each_entry_safe(entry, next, &monpriv->list, list)
76 if (entry->hdr.applid == monhdr->applid && 76 if ((entry->hdr.mon_function == monhdr->mon_function ||
77 monhdr->mon_function == MONWRITE_STOP_INTERVAL) &&
78 entry->hdr.applid == monhdr->applid &&
77 entry->hdr.record_num == monhdr->record_num && 79 entry->hdr.record_num == monhdr->record_num &&
78 entry->hdr.version == monhdr->version && 80 entry->hdr.version == monhdr->version &&
79 entry->hdr.release == monhdr->release && 81 entry->hdr.release == monhdr->release &&
80 entry->hdr.mod_level == monhdr->mod_level) 82 entry->hdr.mod_level == monhdr->mod_level)
81 return entry; 83 return entry;
84
82 return NULL; 85 return NULL;
83} 86}
84 87
@@ -92,7 +95,9 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
92 monhdr->mon_function > MONWRITE_START_CONFIG || 95 monhdr->mon_function > MONWRITE_START_CONFIG ||
93 monhdr->hdrlen != sizeof(struct monwrite_hdr)) 96 monhdr->hdrlen != sizeof(struct monwrite_hdr))
94 return -EINVAL; 97 return -EINVAL;
95 monbuf = monwrite_find_hdr(monpriv, monhdr); 98 monbuf = NULL;
99 if (monhdr->mon_function != MONWRITE_GEN_EVENT)
100 monbuf = monwrite_find_hdr(monpriv, monhdr);
96 if (monbuf) { 101 if (monbuf) {
97 if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) { 102 if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) {
98 monhdr->datalen = monbuf->hdr.datalen; 103 monhdr->datalen = monbuf->hdr.datalen;
@@ -104,7 +109,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
104 kfree(monbuf); 109 kfree(monbuf);
105 monbuf = NULL; 110 monbuf = NULL;
106 } 111 }
107 } else { 112 } else if (monhdr->mon_function != MONWRITE_STOP_INTERVAL) {
108 if (mon_buf_count >= mon_max_bufs) 113 if (mon_buf_count >= mon_max_bufs)
109 return -ENOSPC; 114 return -ENOSPC;
110 monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL); 115 monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL);
@@ -118,7 +123,8 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
118 } 123 }
119 monbuf->hdr = *monhdr; 124 monbuf->hdr = *monhdr;
120 list_add_tail(&monbuf->list, &monpriv->list); 125 list_add_tail(&monbuf->list, &monpriv->list);
121 mon_buf_count++; 126 if (monhdr->mon_function != MONWRITE_GEN_EVENT)
127 mon_buf_count++;
122 } 128 }
123 monpriv->current_buf = monbuf; 129 monpriv->current_buf = monbuf;
124 return 0; 130 return 0;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index fcaf28d7b4eb..de3d0857db9f 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -578,9 +578,13 @@ ccw_device_verify_done(struct ccw_device *cdev, int err)
578 } 578 }
579 break; 579 break;
580 case -ETIME: 580 case -ETIME:
581 /* Reset oper notify indication after verify error. */
582 cdev->private->flags.donotify = 0;
581 ccw_device_done(cdev, DEV_STATE_BOXED); 583 ccw_device_done(cdev, DEV_STATE_BOXED);
582 break; 584 break;
583 default: 585 default:
586 /* Reset oper notify indication after verify error. */
587 cdev->private->flags.donotify = 0;
584 PREPARE_WORK(&cdev->private->kick_work, 588 PREPARE_WORK(&cdev->private->kick_work,
585 ccw_device_nopath_notify, cdev); 589 ccw_device_nopath_notify, cdev);
586 queue_work(ccw_device_notify_work, &cdev->private->kick_work); 590 queue_work(ccw_device_notify_work, &cdev->private->kick_work);
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 0648ce5bb684..476aa1da5cbc 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -3529,7 +3529,7 @@ do_QDIO(struct ccw_device *cdev,unsigned int callflags,
3529#ifdef CONFIG_QDIO_DEBUG 3529#ifdef CONFIG_QDIO_DEBUG
3530 char dbf_text[20]; 3530 char dbf_text[20];
3531 3531
3532 sprintf(dbf_text,"doQD%04x",cdev->private->sch_no); 3532 sprintf(dbf_text,"doQD%04x",cdev->private->schid.sch_no);
3533 QDIO_DBF_TEXT3(0,trace,dbf_text); 3533 QDIO_DBF_TEXT3(0,trace,dbf_text);
3534#endif /* CONFIG_QDIO_DEBUG */ 3534#endif /* CONFIG_QDIO_DEBUG */
3535 3535
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index 0d3660c28f7d..a54e4140683a 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -5,8 +5,8 @@
5 */ 5 */
6 6
7#include <linux/kthread.h> 7#include <linux/kthread.h>
8#include <linux/syscalls.h>
9#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/kmod.h>
10#include <asm/oplib.h> 10#include <asm/oplib.h>
11#include <asm/ebus.h> 11#include <asm/ebus.h>
12 12
@@ -195,7 +195,7 @@ static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp)
195 printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n"); 195 printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n");
196 196
197 shutting_down = 1; 197 shutting_down = 1;
198 if (kernel_execve("/sbin/shutdown", argv, envp) < 0) 198 if (call_usermodehelper("/sbin/shutdown", argv, envp, 0) < 0)
199 printk(KERN_CRIT "envctrl: shutdown execution failed\n"); 199 printk(KERN_CRIT "envctrl: shutdown execution failed\n");
200} 200}
201 201
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 6b6a855f3795..fff4660cdf96 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -25,7 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/miscdevice.h> 27#include <linux/miscdevice.h>
28#include <linux/syscalls.h> 28#include <linux/kmod.h>
29 29
30#include <asm/ebus.h> 30#include <asm/ebus.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
@@ -976,7 +976,7 @@ static void envctrl_do_shutdown(void)
976 976
977 inprog = 1; 977 inprog = 1;
978 printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n"); 978 printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n");
979 ret = kernel_execve("/sbin/shutdown", argv, envp); 979 ret = call_usermodehelper("/sbin/shutdown", argv, envp, 0);
980 if (ret < 0) { 980 if (ret < 0) {
981 printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); 981 printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n");
982 inprog = 0; /* unlikely to succeed, but we could try again */ 982 inprog = 0; /* unlikely to succeed, but we could try again */
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 7c59bba98798..cdd033724786 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3600,5 +3600,16 @@ static void __exit BusLogic_exit(void)
3600 3600
3601__setup("BusLogic=", BusLogic_Setup); 3601__setup("BusLogic=", BusLogic_Setup);
3602 3602
3603static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = {
3604 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
3605 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3606 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
3607 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3608 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
3609 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3610 { }
3611};
3612MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl);
3613
3603module_init(BusLogic_init); 3614module_init(BusLogic_init);
3604module_exit(BusLogic_exit); 3615module_exit(BusLogic_exit);
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 811d8840707e..2dbb66d2f0a7 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -203,7 +203,7 @@ static irqreturn_t do_eata_pio_int_handler(int irq, void *dev_id)
203 irqreturn_t ret; 203 irqreturn_t ret;
204 204
205 spin_lock_irqsave(dev->host_lock, flags); 205 spin_lock_irqsave(dev->host_lock, flags);
206 ret = eata_pio_int_handler(irq, dev_id, regs); 206 ret = eata_pio_int_handler(irq, dev_id);
207 spin_unlock_irqrestore(dev->host_lock, flags); 207 spin_unlock_irqrestore(dev->host_lock, flags);
208 return ret; 208 return ret;
209} 209}
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 72794a7b6dcc..65e6e7b7ba07 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1736,6 +1736,15 @@ struct scsi_host_template fdomain_driver_template = {
1736}; 1736};
1737 1737
1738#ifndef PCMCIA 1738#ifndef PCMCIA
1739
1740static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
1741 { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
1742 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
1743 { }
1744};
1745MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
1746
1739#define driver_template fdomain_driver_template 1747#define driver_template fdomain_driver_template
1740#include "scsi_module.c" 1748#include "scsi_module.c"
1749
1741#endif 1750#endif
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 911f2ff4a1f2..afed293dd7b9 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -142,8 +142,6 @@
142#define i91u_MAXQUEUE 2 142#define i91u_MAXQUEUE 2
143#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a" 143#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a"
144 144
145#define INI_VENDOR_ID 0x1101 /* Initio's PCI vendor ID */
146#define DMX_VENDOR_ID 0x134a /* Domex's PCI vendor ID */
147#define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */ 145#define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */
148#define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */ 146#define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */
149#define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */ 147#define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */
@@ -171,13 +169,16 @@ static int setup_debug = 0;
171 169
172static void i91uSCBPost(BYTE * pHcb, BYTE * pScb); 170static void i91uSCBPost(BYTE * pHcb, BYTE * pScb);
173 171
174static const PCI_ID i91u_pci_devices[] = { 172/* PCI Devices supported by this driver */
175 { INI_VENDOR_ID, I950_DEVICE_ID }, 173static struct pci_device_id i91u_pci_devices[] __devinitdata = {
176 { INI_VENDOR_ID, I940_DEVICE_ID }, 174 { PCI_VENDOR_ID_INIT, I950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
177 { INI_VENDOR_ID, I935_DEVICE_ID }, 175 { PCI_VENDOR_ID_INIT, I940_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
178 { INI_VENDOR_ID, I920_DEVICE_ID }, 176 { PCI_VENDOR_ID_INIT, I935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
179 { DMX_VENDOR_ID, I920_DEVICE_ID }, 177 { PCI_VENDOR_ID_INIT, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
178 { PCI_VENDOR_ID_DOMEX, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
179 { }
180}; 180};
181MODULE_DEVICE_TABLE(pci, i91u_pci_devices);
181 182
182#define DEBUG_INTERRUPT 0 183#define DEBUG_INTERRUPT 0
183#define DEBUG_QUEUE 0 184#define DEBUG_QUEUE 0
@@ -2771,7 +2772,7 @@ static int tul_NewReturnNumberOfAdapters(void)
2771 2772
2772 for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++) 2773 for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++)
2773 { 2774 {
2774 while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) { 2775 while ((pDev = pci_find_device(i91u_pci_devices[i].vendor, i91u_pci_devices[i].device, pDev)) != NULL) {
2775 if (pci_enable_device(pDev)) 2776 if (pci_enable_device(pDev))
2776 continue; 2777 continue;
2777 pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue); 2778 pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index c0edb662d863..7bac86dda88f 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -884,7 +884,7 @@ megaraid_init_mbox(adapter_t *adapter)
884 884
885 if (((magic64 == HBA_SIGNATURE_64_BIT) && 885 if (((magic64 == HBA_SIGNATURE_64_BIT) &&
886 ((adapter->pdev->subsystem_device != 886 ((adapter->pdev->subsystem_device !=
887 PCI_SUBSYS_ID_MEGARAID_SATA_150_6) || 887 PCI_SUBSYS_ID_MEGARAID_SATA_150_6) &&
888 (adapter->pdev->subsystem_device != 888 (adapter->pdev->subsystem_device !=
889 PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) || 889 PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) ||
890 (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC && 890 (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC &&
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index ed58bb489889..9b827ceec501 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -461,7 +461,7 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host)
461 461
462#define PTI_RESET_LIMIT 400 462#define PTI_RESET_LIMIT 400
463 463
464static int __init qlogicpti_load_firmware(struct qlogicpti *qpti) 464static int __devinit qlogicpti_load_firmware(struct qlogicpti *qpti)
465{ 465{
466 struct Scsi_Host *host = qpti->qhost; 466 struct Scsi_Host *host = qpti->qhost;
467 unsigned short csum = 0; 467 unsigned short csum = 0;
diff --git a/drivers/scsi/qlogicpti_asm.c b/drivers/scsi/qlogicpti_asm.c
index 1545b30681b4..19aa84f46018 100644
--- a/drivers/scsi/qlogicpti_asm.c
+++ b/drivers/scsi/qlogicpti_asm.c
@@ -1,5 +1,5 @@
1/* Version 1.31.00 ISP1000 Initiator RISC firmware */ 1/* Version 1.31.00 ISP1000 Initiator RISC firmware */
2unsigned short sbus_risc_code01[] __initdata = { 2unsigned short sbus_risc_code01[] __devinitdata = {
3 0x0078, 0x1030, 0x0000, 0x2419, 0x0000, 0x12ff, 0x2043, 0x4f50, 3 0x0078, 0x1030, 0x0000, 0x2419, 0x0000, 0x12ff, 0x2043, 0x4f50,
4 0x5952, 0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932, 4 0x5952, 0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932,
5 0x2c31, 0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749, 5 0x2c31, 0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749,
@@ -1157,4 +1157,4 @@ unsigned short sbus_risc_code01[] __initdata = {
1157 0x003c, 0x0040, 0x3415, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x007c, 1157 0x003c, 0x0040, 0x3415, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x007c,
1158 0x92a7 1158 0x92a7
1159}; 1159};
1160unsigned short sbus_risc_code_length01 = 0x2419; 1160unsigned short __devinitdata sbus_risc_code_length01 = 0x2419;
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b0d502622d94..0b71e7d18903 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -767,37 +767,37 @@ config SERIAL_CPM_SCC1
767 bool "Support for SCC1 serial port" 767 bool "Support for SCC1 serial port"
768 depends on SERIAL_CPM=y 768 depends on SERIAL_CPM=y
769 help 769 help
770 Select the is option to use SCC1 as a serial port 770 Select this option to use SCC1 as a serial port
771 771
772config SERIAL_CPM_SCC2 772config SERIAL_CPM_SCC2
773 bool "Support for SCC2 serial port" 773 bool "Support for SCC2 serial port"
774 depends on SERIAL_CPM=y 774 depends on SERIAL_CPM=y
775 help 775 help
776 Select the is option to use SCC2 as a serial port 776 Select this option to use SCC2 as a serial port
777 777
778config SERIAL_CPM_SCC3 778config SERIAL_CPM_SCC3
779 bool "Support for SCC3 serial port" 779 bool "Support for SCC3 serial port"
780 depends on SERIAL_CPM=y 780 depends on SERIAL_CPM=y
781 help 781 help
782 Select the is option to use SCC3 as a serial port 782 Select this option to use SCC3 as a serial port
783 783
784config SERIAL_CPM_SCC4 784config SERIAL_CPM_SCC4
785 bool "Support for SCC4 serial port" 785 bool "Support for SCC4 serial port"
786 depends on SERIAL_CPM=y 786 depends on SERIAL_CPM=y
787 help 787 help
788 Select the is option to use SCC4 as a serial port 788 Select this option to use SCC4 as a serial port
789 789
790config SERIAL_CPM_SMC1 790config SERIAL_CPM_SMC1
791 bool "Support for SMC1 serial port" 791 bool "Support for SMC1 serial port"
792 depends on SERIAL_CPM=y 792 depends on SERIAL_CPM=y
793 help 793 help
794 Select the is option to use SMC1 as a serial port 794 Select this option to use SMC1 as a serial port
795 795
796config SERIAL_CPM_SMC2 796config SERIAL_CPM_SMC2
797 bool "Support for SMC2 serial port" 797 bool "Support for SMC2 serial port"
798 depends on SERIAL_CPM=y 798 depends on SERIAL_CPM=y
799 help 799 help
800 Select the is option to use SMC2 as a serial port 800 Select this option to use SMC2 as a serial port
801 801
802config SERIAL_SGI_L1_CONSOLE 802config SERIAL_SGI_L1_CONSOLE
803 bool "SGI Altix L1 serial console support" 803 bool "SGI Altix L1 serial console support"
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 98ce88d80207..ff4fa25f9fd1 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -2935,7 +2935,7 @@ static void __devexit ioc4_serial_exit(void)
2935 uart_unregister_driver(&ioc4_uart_rs422); 2935 uart_unregister_driver(&ioc4_uart_rs422);
2936} 2936}
2937 2937
2938module_init(ioc4_serial_init); 2938late_initcall(ioc4_serial_init); /* Call only after tty init is done */
2939module_exit(ioc4_serial_exit); 2939module_exit(ioc4_serial_exit);
2940 2940
2941MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>"); 2941MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>");
diff --git a/drivers/sn/Kconfig b/drivers/sn/Kconfig
index a34731625877..c66ba9ad833d 100644
--- a/drivers/sn/Kconfig
+++ b/drivers/sn/Kconfig
@@ -5,19 +5,6 @@
5menu "SN Devices" 5menu "SN Devices"
6 depends on SGI_SN 6 depends on SGI_SN
7 7
8config SGI_IOC4
9 tristate "SGI IOC4 Base IO support"
10 depends on MMTIMER
11 default m
12 ---help---
13 This option enables basic support for the SGI IOC4-based Base IO
14 controller card. This option does not enable any specific
15 functions on such a card, but provides necessary infrastructure
16 for other drivers to utilize.
17
18 If you have an SGI Altix with an IOC4-based
19 I/O controller say Y. Otherwise say N.
20
21config SGI_IOC3 8config SGI_IOC3
22 tristate "SGI IOC3 Base IO support" 9 tristate "SGI IOC3 Base IO support"
23 default m 10 default m
diff --git a/drivers/sn/Makefile b/drivers/sn/Makefile
index 2cda011597c0..693db8bb8d9c 100644
--- a/drivers/sn/Makefile
+++ b/drivers/sn/Makefile
@@ -3,5 +3,4 @@
3# 3#
4# 4#
5 5
6obj-$(CONFIG_SGI_IOC4) += ioc4.o
7obj-$(CONFIG_SGI_IOC3) += ioc3.o 6obj-$(CONFIG_SGI_IOC3) += ioc3.o
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index f6b2948ab288..1b601b6cf2a2 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,6 +284,14 @@ static int samplerate = 100;
284 284
285module_param(ixjdebug, int, 0); 285module_param(ixjdebug, int, 0);
286 286
287static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
288 { PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
289 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
290 { }
291};
292
293MODULE_DEVICE_TABLE(pci, ixj_pci_tbl);
294
287/************************************************************************ 295/************************************************************************
288* 296*
289* ixjdebug meanings are now bit mapped instead of level based 297* ixjdebug meanings are now bit mapped instead of level based
@@ -7683,7 +7691,8 @@ static int __init ixj_probe_pci(int *cnt)
7683 IXJ *j = NULL; 7691 IXJ *j = NULL;
7684 7692
7685 for (i = 0; i < IXJMAX - *cnt; i++) { 7693 for (i = 0; i < IXJMAX - *cnt; i++) {
7686 pci = pci_find_device(0x15E2, 0x0500, pci); 7694 pci = pci_find_device(PCI_VENDOR_ID_QUICKNET,
7695 PCI_DEVICE_ID_QUICKNET_XJ, pci);
7687 if (!pci) 7696 if (!pci)
7688 break; 7697 break;
7689 7698
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 97d57cfc343b..825bf884537a 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_USB_KBTAB) += input/
33obj-$(CONFIG_USB_MOUSE) += input/ 33obj-$(CONFIG_USB_MOUSE) += input/
34obj-$(CONFIG_USB_MTOUCH) += input/ 34obj-$(CONFIG_USB_MTOUCH) += input/
35obj-$(CONFIG_USB_POWERMATE) += input/ 35obj-$(CONFIG_USB_POWERMATE) += input/
36obj-$(CONFIG_USB_TRANCEVIBRATOR)+= input/
37obj-$(CONFIG_USB_WACOM) += input/ 36obj-$(CONFIG_USB_WACOM) += input/
38obj-$(CONFIG_USB_XPAD) += input/ 37obj-$(CONFIG_USB_XPAD) += input/
39 38
@@ -66,6 +65,7 @@ obj-$(CONFIG_USB_PHIDGETSERVO) += misc/
66obj-$(CONFIG_USB_RIO500) += misc/ 65obj-$(CONFIG_USB_RIO500) += misc/
67obj-$(CONFIG_USB_SISUSBVGA) += misc/ 66obj-$(CONFIG_USB_SISUSBVGA) += misc/
68obj-$(CONFIG_USB_TEST) += misc/ 67obj-$(CONFIG_USB_TEST) += misc/
68obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/
69obj-$(CONFIG_USB_USS720) += misc/ 69obj-$(CONFIG_USB_USS720) += misc/
70 70
71obj-$(CONFIG_USB_ATM) += atm/ 71obj-$(CONFIG_USB_ATM) += atm/
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 3892a9e9aee3..e6565633ba0f 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -793,6 +793,9 @@ static const struct usb_device_id cxacru_usb_ids[] = {
793 { /* V = Conexant P = ADSL modem */ 793 { /* V = Conexant P = ADSL modem */
794 USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 794 USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00
795 }, 795 },
796 { /* V = Conexant P = ADSL modem (ZTE ZXDSL 852) */
797 USB_DEVICE(0x0572, 0xcb07), .driver_info = (unsigned long) &cxacru_cb00
798 },
796 { /* V = Olitec P = ADSL modem version 2 */ 799 { /* V = Olitec P = ADSL modem version 2 */
797 USB_DEVICE(0x08e3, 0x0100), .driver_info = (unsigned long) &cxacru_cafe 800 USB_DEVICE(0x08e3, 0x0100), .driver_info = (unsigned long) &cxacru_cafe
798 }, 801 },
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 7c7b507af29d..c870c804470f 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -55,7 +55,6 @@ static const char speedtch_driver_name[] = "speedtch";
55#define OFFSET_d 9 /* size 4 */ 55#define OFFSET_d 9 /* size 4 */
56#define OFFSET_e 13 /* size 1 */ 56#define OFFSET_e 13 /* size 1 */
57#define OFFSET_f 14 /* size 1 */ 57#define OFFSET_f 14 /* size 1 */
58#define TOTAL 15
59 58
60#define SIZE_7 1 59#define SIZE_7 1
61#define SIZE_b 8 60#define SIZE_b 8
@@ -79,6 +78,18 @@ static int dl_512_first = DEFAULT_DL_512_FIRST;
79static int enable_isoc = DEFAULT_ENABLE_ISOC; 78static int enable_isoc = DEFAULT_ENABLE_ISOC;
80static int sw_buffering = DEFAULT_SW_BUFFERING; 79static int sw_buffering = DEFAULT_SW_BUFFERING;
81 80
81#define DEFAULT_B_MAX_DSL 8128
82#define DEFAULT_MODEM_MODE 11
83#define MODEM_OPTION_LENGTH 16
84static const unsigned char DEFAULT_MODEM_OPTION[MODEM_OPTION_LENGTH] = {
85 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
86};
87
88static unsigned int BMaxDSL = DEFAULT_B_MAX_DSL;
89static unsigned char ModemMode = DEFAULT_MODEM_MODE;
90static unsigned char ModemOption[MODEM_OPTION_LENGTH];
91static int num_ModemOption;
92
82module_param(altsetting, uint, S_IRUGO | S_IWUSR); 93module_param(altsetting, uint, S_IRUGO | S_IWUSR);
83MODULE_PARM_DESC(altsetting, 94MODULE_PARM_DESC(altsetting,
84 "Alternative setting for data interface (bulk_default: " 95 "Alternative setting for data interface (bulk_default: "
@@ -100,6 +111,17 @@ MODULE_PARM_DESC(sw_buffering,
100 "Enable software buffering (default: " 111 "Enable software buffering (default: "
101 __MODULE_STRING(DEFAULT_SW_BUFFERING) ")"); 112 __MODULE_STRING(DEFAULT_SW_BUFFERING) ")");
102 113
114module_param(BMaxDSL, uint, S_IRUGO | S_IWUSR);
115MODULE_PARM_DESC(BMaxDSL,
116 "default: " __MODULE_STRING(DEFAULT_B_MAX_DSL));
117
118module_param(ModemMode, byte, S_IRUGO | S_IWUSR);
119MODULE_PARM_DESC(ModemMode,
120 "default: " __MODULE_STRING(DEFAULT_MODEM_MODE));
121
122module_param_array(ModemOption, byte, &num_ModemOption, S_IRUGO);
123MODULE_PARM_DESC(ModemOption, "default: 0x10,0x00,0x00,0x00,0x20");
124
103#define INTERFACE_DATA 1 125#define INTERFACE_DATA 1
104#define ENDPOINT_INT 0x81 126#define ENDPOINT_INT 0x81
105#define ENDPOINT_BULK_DATA 0x07 127#define ENDPOINT_BULK_DATA 0x07
@@ -108,10 +130,17 @@ MODULE_PARM_DESC(sw_buffering,
108 130
109#define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) ) 131#define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) )
110 132
133struct speedtch_params {
134 unsigned int altsetting;
135 unsigned int BMaxDSL;
136 unsigned char ModemMode;
137 unsigned char ModemOption[MODEM_OPTION_LENGTH];
138};
139
111struct speedtch_instance_data { 140struct speedtch_instance_data {
112 struct usbatm_data *usbatm; 141 struct usbatm_data *usbatm;
113 142
114 unsigned int altsetting; 143 struct speedtch_params params; /* set in probe, constant afterwards */
115 144
116 struct work_struct status_checker; 145 struct work_struct status_checker;
117 146
@@ -123,7 +152,7 @@ struct speedtch_instance_data {
123 struct urb *int_urb; 152 struct urb *int_urb;
124 unsigned char int_data[16]; 153 unsigned char int_data[16];
125 154
126 unsigned char scratch_buffer[TOTAL]; 155 unsigned char scratch_buffer[16];
127}; 156};
128 157
129/*************** 158/***************
@@ -186,6 +215,34 @@ static void speedtch_test_sequence(struct speedtch_instance_data *instance)
186 0x01, 0x40, 0x04, 0x00, buf, 3, CTRL_TIMEOUT); 215 0x01, 0x40, 0x04, 0x00, buf, 3, CTRL_TIMEOUT);
187 if (ret < 0) 216 if (ret < 0)
188 usb_warn(usbatm, "%s failed on URB150: %d\n", __func__, ret); 217 usb_warn(usbatm, "%s failed on URB150: %d\n", __func__, ret);
218
219 /* Extra initialisation in recent drivers - gives higher speeds */
220
221 /* URBext1 */
222 buf[0] = instance->params.ModemMode;
223 ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
224 0x01, 0x40, 0x11, 0x00, buf, 1, CTRL_TIMEOUT);
225 if (ret < 0)
226 usb_warn(usbatm, "%s failed on URBext1: %d\n", __func__, ret);
227
228 /* URBext2 */
229 /* This seems to be the one which actually triggers the higher sync
230 rate -- it does require the new firmware too, although it works OK
231 with older firmware */
232 ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
233 0x01, 0x40, 0x14, 0x00,
234 instance->params.ModemOption,
235 MODEM_OPTION_LENGTH, CTRL_TIMEOUT);
236 if (ret < 0)
237 usb_warn(usbatm, "%s failed on URBext2: %d\n", __func__, ret);
238
239 /* URBext3 */
240 buf[0] = instance->params.BMaxDSL & 0xff;
241 buf[1] = instance->params.BMaxDSL >> 8;
242 ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
243 0x01, 0x40, 0x12, 0x00, buf, 2, CTRL_TIMEOUT);
244 if (ret < 0)
245 usb_warn(usbatm, "%s failed on URBext3: %d\n", __func__, ret);
189} 246}
190 247
191static int speedtch_upload_firmware(struct speedtch_instance_data *instance, 248static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
@@ -285,8 +342,8 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
285 because we're in our own kernel thread anyway. */ 342 because we're in our own kernel thread anyway. */
286 msleep_interruptible(1000); 343 msleep_interruptible(1000);
287 344
288 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { 345 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting)) < 0) {
289 usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret); 346 usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->params.altsetting, ret);
290 goto out_free; 347 goto out_free;
291 } 348 }
292 349
@@ -372,7 +429,7 @@ static int speedtch_read_status(struct speedtch_instance_data *instance)
372 unsigned char *buf = instance->scratch_buffer; 429 unsigned char *buf = instance->scratch_buffer;
373 int ret; 430 int ret;
374 431
375 memset(buf, 0, TOTAL); 432 memset(buf, 0, 16);
376 433
377 ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), 434 ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
378 0x12, 0xc0, 0x07, 0x00, buf + OFFSET_7, SIZE_7, 435 0x12, 0xc0, 0x07, 0x00, buf + OFFSET_7, SIZE_7,
@@ -746,17 +803,21 @@ static int speedtch_bind(struct usbatm_data *usbatm,
746 803
747 instance->usbatm = usbatm; 804 instance->usbatm = usbatm;
748 805
749 /* altsetting and enable_isoc may change at any moment, so take a snapshot */ 806 /* module parameters may change at any moment, so take a snapshot */
750 instance->altsetting = altsetting; 807 instance->params.altsetting = altsetting;
808 instance->params.BMaxDSL = BMaxDSL;
809 instance->params.ModemMode = ModemMode;
810 memcpy(instance->params.ModemOption, DEFAULT_MODEM_OPTION, MODEM_OPTION_LENGTH);
811 memcpy(instance->params.ModemOption, ModemOption, num_ModemOption);
751 use_isoc = enable_isoc; 812 use_isoc = enable_isoc;
752 813
753 if (instance->altsetting) 814 if (instance->params.altsetting)
754 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { 815 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting)) < 0) {
755 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->altsetting, ret); 816 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->params.altsetting, ret);
756 instance->altsetting = 0; /* fall back to default */ 817 instance->params.altsetting = 0; /* fall back to default */
757 } 818 }
758 819
759 if (!instance->altsetting && use_isoc) 820 if (!instance->params.altsetting && use_isoc)
760 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) { 821 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) {
761 usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret); 822 usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret);
762 use_isoc = 0; /* fall back to bulk */ 823 use_isoc = 0; /* fall back to bulk */
@@ -783,14 +844,14 @@ static int speedtch_bind(struct usbatm_data *usbatm,
783 usb_info(usbatm, "isochronous transfer not supported - using bulk\n"); 844 usb_info(usbatm, "isochronous transfer not supported - using bulk\n");
784 } 845 }
785 846
786 if (!use_isoc && !instance->altsetting) 847 if (!use_isoc && !instance->params.altsetting)
787 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) { 848 if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) {
788 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret); 849 usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret);
789 goto fail_free; 850 goto fail_free;
790 } 851 }
791 852
792 if (!instance->altsetting) 853 if (!instance->params.altsetting)
793 instance->altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING; 854 instance->params.altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING;
794 855
795 usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); 856 usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0);
796 857
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index f5434b1cbb1e..f6b9f7e1f716 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -68,7 +68,7 @@
68 68
69#include "usbatm.h" 69#include "usbatm.h"
70 70
71#define EAGLEUSBVERSION "ueagle 1.3" 71#define EAGLEUSBVERSION "ueagle 1.4"
72 72
73 73
74/* 74/*
@@ -80,14 +80,14 @@
80 dev_dbg(&(usb_dev)->dev, \ 80 dev_dbg(&(usb_dev)->dev, \
81 "[ueagle-atm dbg] %s: " format, \ 81 "[ueagle-atm dbg] %s: " format, \
82 __FUNCTION__, ##args); \ 82 __FUNCTION__, ##args); \
83 } while (0) 83 } while (0)
84 84
85#define uea_vdbg(usb_dev, format, args...) \ 85#define uea_vdbg(usb_dev, format, args...) \
86 do { \ 86 do { \
87 if (debug >= 2) \ 87 if (debug >= 2) \
88 dev_dbg(&(usb_dev)->dev, \ 88 dev_dbg(&(usb_dev)->dev, \
89 "[ueagle-atm vdbg] " format, ##args); \ 89 "[ueagle-atm vdbg] " format, ##args); \
90 } while (0) 90 } while (0)
91 91
92#define uea_enters(usb_dev) \ 92#define uea_enters(usb_dev) \
93 uea_vdbg(usb_dev, "entering %s\n", __FUNCTION__) 93 uea_vdbg(usb_dev, "entering %s\n", __FUNCTION__)
@@ -218,8 +218,8 @@ enum {
218#define UEA_CHIP_VERSION(x) \ 218#define UEA_CHIP_VERSION(x) \
219 ((x)->driver_info & 0xf) 219 ((x)->driver_info & 0xf)
220 220
221#define IS_ISDN(sc) \ 221#define IS_ISDN(usb_dev) \
222 (le16_to_cpu(sc->usb_dev->descriptor.bcdDevice) & 0x80) 222 (le16_to_cpu((usb_dev)->descriptor.bcdDevice) & 0x80)
223 223
224#define INS_TO_USBDEV(ins) ins->usb_dev 224#define INS_TO_USBDEV(ins) ins->usb_dev
225 225
@@ -625,12 +625,12 @@ static int request_dsp(struct uea_softc *sc)
625 char *dsp_name; 625 char *dsp_name;
626 626
627 if (UEA_CHIP_VERSION(sc) == ADI930) { 627 if (UEA_CHIP_VERSION(sc) == ADI930) {
628 if (IS_ISDN(sc)) 628 if (IS_ISDN(sc->usb_dev))
629 dsp_name = FW_DIR "DSP9i.bin"; 629 dsp_name = FW_DIR "DSP9i.bin";
630 else 630 else
631 dsp_name = FW_DIR "DSP9p.bin"; 631 dsp_name = FW_DIR "DSP9p.bin";
632 } else { 632 } else {
633 if (IS_ISDN(sc)) 633 if (IS_ISDN(sc->usb_dev))
634 dsp_name = FW_DIR "DSPei.bin"; 634 dsp_name = FW_DIR "DSPei.bin";
635 else 635 else
636 dsp_name = FW_DIR "DSPep.bin"; 636 dsp_name = FW_DIR "DSPep.bin";
@@ -744,7 +744,7 @@ static inline void wake_up_cmv_ack(struct uea_softc *sc)
744 744
745static inline int wait_cmv_ack(struct uea_softc *sc) 745static inline int wait_cmv_ack(struct uea_softc *sc)
746{ 746{
747 int ret = wait_event_timeout(sc->cmv_ack_wait, 747 int ret = wait_event_interruptible_timeout(sc->cmv_ack_wait,
748 sc->cmv_ack, ACK_TIMEOUT); 748 sc->cmv_ack, ACK_TIMEOUT);
749 sc->cmv_ack = 0; 749 sc->cmv_ack = 0;
750 750
@@ -885,7 +885,8 @@ static int uea_stat(struct uea_softc *sc)
885 break; 885 break;
886 886
887 case 3: /* fail ... */ 887 case 3: /* fail ... */
888 uea_info(INS_TO_USBDEV(sc), "modem synchronization failed\n"); 888 uea_info(INS_TO_USBDEV(sc), "modem synchronization failed"
889 " (may be try other cmv/dsp)\n");
889 return -EAGAIN; 890 return -EAGAIN;
890 891
891 case 4 ... 6: /* test state */ 892 case 4 ... 6: /* test state */
@@ -913,12 +914,6 @@ static int uea_stat(struct uea_softc *sc)
913 release_firmware(sc->dsp_firm); 914 release_firmware(sc->dsp_firm);
914 sc->dsp_firm = NULL; 915 sc->dsp_firm = NULL;
915 } 916 }
916
917 ret = uea_read_cmv(sc, SA_INFO, 10, &sc->stats.phy.firmid);
918 if (ret < 0)
919 return ret;
920 uea_info(INS_TO_USBDEV(sc), "ATU-R firmware version : %x\n",
921 sc->stats.phy.firmid);
922 } 917 }
923 918
924 /* always update it as atm layer could not be init when we switch to 919 /* always update it as atm layer could not be init when we switch to
@@ -1033,9 +1028,9 @@ static int request_cmvs(struct uea_softc *sc,
1033 1028
1034 if (cmv_file[sc->modem_index] == NULL) { 1029 if (cmv_file[sc->modem_index] == NULL) {
1035 if (UEA_CHIP_VERSION(sc) == ADI930) 1030 if (UEA_CHIP_VERSION(sc) == ADI930)
1036 file = (IS_ISDN(sc)) ? "CMV9i.bin" : "CMV9p.bin"; 1031 file = (IS_ISDN(sc->usb_dev)) ? "CMV9i.bin" : "CMV9p.bin";
1037 else 1032 else
1038 file = (IS_ISDN(sc)) ? "CMVei.bin" : "CMVep.bin"; 1033 file = (IS_ISDN(sc->usb_dev)) ? "CMVei.bin" : "CMVep.bin";
1039 } else 1034 } else
1040 file = cmv_file[sc->modem_index]; 1035 file = cmv_file[sc->modem_index];
1041 1036
@@ -1131,6 +1126,13 @@ static int uea_start_reset(struct uea_softc *sc)
1131 if (ret < 0) 1126 if (ret < 0)
1132 return ret; 1127 return ret;
1133 1128
1129 /* Dump firmware version */
1130 ret = uea_read_cmv(sc, SA_INFO, 10, &sc->stats.phy.firmid);
1131 if (ret < 0)
1132 return ret;
1133 uea_info(INS_TO_USBDEV(sc), "ATU-R firmware version : %x\n",
1134 sc->stats.phy.firmid);
1135
1134 /* get options */ 1136 /* get options */
1135 ret = len = request_cmvs(sc, &cmvs, &cmvs_fw); 1137 ret = len = request_cmvs(sc, &cmvs, &cmvs_fw);
1136 if (ret < 0) 1138 if (ret < 0)
@@ -1147,6 +1149,8 @@ static int uea_start_reset(struct uea_softc *sc)
1147 /* Enter in R-ACT-REQ */ 1149 /* Enter in R-ACT-REQ */
1148 ret = uea_write_cmv(sc, SA_CNTL, 0, 2); 1150 ret = uea_write_cmv(sc, SA_CNTL, 0, 2);
1149 uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); 1151 uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n");
1152 uea_info(INS_TO_USBDEV(sc), "Modem started, "
1153 "waiting synchronization\n");
1150out: 1154out:
1151 release_firmware(cmvs_fw); 1155 release_firmware(cmvs_fw);
1152 sc->reset = 0; 1156 sc->reset = 0;
@@ -1172,7 +1176,10 @@ static int uea_kthread(void *data)
1172 if (!ret) 1176 if (!ret)
1173 ret = uea_stat(sc); 1177 ret = uea_stat(sc);
1174 if (ret != -EAGAIN) 1178 if (ret != -EAGAIN)
1175 msleep(1000); 1179 msleep_interruptible(1000);
1180 if (try_to_freeze())
1181 uea_err(INS_TO_USBDEV(sc), "suspend/resume not supported, "
1182 "please unplug/replug your modem\n");
1176 } 1183 }
1177 uea_leaves(INS_TO_USBDEV(sc)); 1184 uea_leaves(INS_TO_USBDEV(sc));
1178 return ret; 1185 return ret;
@@ -1566,6 +1573,7 @@ UEA_ATTR(uscorr, 0);
1566UEA_ATTR(dscorr, 0); 1573UEA_ATTR(dscorr, 0);
1567UEA_ATTR(usunc, 0); 1574UEA_ATTR(usunc, 0);
1568UEA_ATTR(dsunc, 0); 1575UEA_ATTR(dsunc, 0);
1576UEA_ATTR(firmid, 0);
1569 1577
1570/* Retrieve the device End System Identifier (MAC) */ 1578/* Retrieve the device End System Identifier (MAC) */
1571 1579
@@ -1597,7 +1605,7 @@ static int uea_heavy(struct usbatm_data *usbatm, struct usb_interface *intf)
1597{ 1605{
1598 struct uea_softc *sc = usbatm->driver_data; 1606 struct uea_softc *sc = usbatm->driver_data;
1599 1607
1600 wait_event(sc->sync_q, IS_OPERATIONAL(sc)); 1608 wait_event_interruptible(sc->sync_q, IS_OPERATIONAL(sc));
1601 1609
1602 return 0; 1610 return 0;
1603 1611
@@ -1639,16 +1647,13 @@ static struct attribute *attrs[] = {
1639 &dev_attr_stat_dscorr.attr, 1647 &dev_attr_stat_dscorr.attr,
1640 &dev_attr_stat_usunc.attr, 1648 &dev_attr_stat_usunc.attr,
1641 &dev_attr_stat_dsunc.attr, 1649 &dev_attr_stat_dsunc.attr,
1650 &dev_attr_stat_firmid.attr,
1651 NULL,
1642}; 1652};
1643static struct attribute_group attr_grp = { 1653static struct attribute_group attr_grp = {
1644 .attrs = attrs, 1654 .attrs = attrs,
1645}; 1655};
1646 1656
1647static int create_fs_entries(struct usb_interface *intf)
1648{
1649 return sysfs_create_group(&intf->dev.kobj, &attr_grp);
1650}
1651
1652static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, 1657static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1653 const struct usb_device_id *id) 1658 const struct usb_device_id *id)
1654{ 1659{
@@ -1708,31 +1713,25 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1708 } 1713 }
1709 } 1714 }
1710 1715
1716 ret = sysfs_create_group(&intf->dev.kobj, &attr_grp);
1717 if (ret < 0)
1718 goto error;
1719
1711 ret = uea_boot(sc); 1720 ret = uea_boot(sc);
1712 if (ret < 0) { 1721 if (ret < 0)
1713 kfree(sc); 1722 goto error;
1714 return ret;
1715 }
1716 1723
1717 ret = create_fs_entries(intf);
1718 if (ret) {
1719 uea_stop(sc);
1720 kfree(sc);
1721 return ret;
1722 }
1723 return 0; 1724 return 0;
1724} 1725error:
1725 1726 kfree(sc);
1726static void destroy_fs_entries(struct usb_interface *intf) 1727 return ret;
1727{
1728 sysfs_remove_group(&intf->dev.kobj, &attr_grp);
1729} 1728}
1730 1729
1731static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) 1730static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
1732{ 1731{
1733 struct uea_softc *sc = usbatm->driver_data; 1732 struct uea_softc *sc = usbatm->driver_data;
1734 1733
1735 destroy_fs_entries(intf); 1734 sysfs_remove_group(&intf->dev.kobj, &attr_grp);
1736 uea_stop(sc); 1735 uea_stop(sc);
1737 kfree(sc); 1736 kfree(sc);
1738} 1737}
@@ -1753,10 +1752,10 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
1753 struct usb_device *usb = interface_to_usbdev(intf); 1752 struct usb_device *usb = interface_to_usbdev(intf);
1754 1753
1755 uea_enters(usb); 1754 uea_enters(usb);
1756 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) : %s\n", 1755 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) : %s %s\n",
1757 le16_to_cpu(usb->descriptor.idVendor), 1756 le16_to_cpu(usb->descriptor.idVendor),
1758 le16_to_cpu(usb->descriptor.idProduct), 1757 le16_to_cpu(usb->descriptor.idProduct),
1759 chip_name[UEA_CHIP_VERSION(id)]); 1758 chip_name[UEA_CHIP_VERSION(id)], IS_ISDN(usb)?"isdn":"pots");
1760 1759
1761 usb_reset_device(usb); 1760 usb_reset_device(usb);
1762 1761
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 309073f6433a..ec63b0ee0743 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -1001,6 +1001,7 @@ static int usbatm_do_heavy_init(void *arg)
1001 1001
1002 daemonize(instance->driver->driver_name); 1002 daemonize(instance->driver->driver_name);
1003 allow_signal(SIGTERM); 1003 allow_signal(SIGTERM);
1004 instance->thread_pid = current->pid;
1004 1005
1005 complete(&instance->thread_started); 1006 complete(&instance->thread_started);
1006 1007
@@ -1025,10 +1026,6 @@ static int usbatm_heavy_init(struct usbatm_data *instance)
1025 return ret; 1026 return ret;
1026 } 1027 }
1027 1028
1028 mutex_lock(&instance->serialize);
1029 instance->thread_pid = ret;
1030 mutex_unlock(&instance->serialize);
1031
1032 wait_for_completion(&instance->thread_started); 1029 wait_for_completion(&instance->thread_started);
1033 1030
1034 return 0; 1031 return 0;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index ec4d1d756725..9a9012fd284b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -325,7 +325,7 @@ static void acm_rx_tasklet(unsigned long _acm)
325 struct acm_rb *buf; 325 struct acm_rb *buf;
326 struct tty_struct *tty = acm->tty; 326 struct tty_struct *tty = acm->tty;
327 struct acm_ru *rcv; 327 struct acm_ru *rcv;
328 //unsigned long flags; 328 unsigned long flags;
329 int i = 0; 329 int i = 0;
330 dbg("Entering acm_rx_tasklet"); 330 dbg("Entering acm_rx_tasklet");
331 331
@@ -333,15 +333,15 @@ static void acm_rx_tasklet(unsigned long _acm)
333 return; 333 return;
334 334
335next_buffer: 335next_buffer:
336 spin_lock(&acm->read_lock); 336 spin_lock_irqsave(&acm->read_lock, flags);
337 if (list_empty(&acm->filled_read_bufs)) { 337 if (list_empty(&acm->filled_read_bufs)) {
338 spin_unlock(&acm->read_lock); 338 spin_unlock_irqrestore(&acm->read_lock, flags);
339 goto urbs; 339 goto urbs;
340 } 340 }
341 buf = list_entry(acm->filled_read_bufs.next, 341 buf = list_entry(acm->filled_read_bufs.next,
342 struct acm_rb, list); 342 struct acm_rb, list);
343 list_del(&buf->list); 343 list_del(&buf->list);
344 spin_unlock(&acm->read_lock); 344 spin_unlock_irqrestore(&acm->read_lock, flags);
345 345
346 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); 346 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
347 347
@@ -356,29 +356,29 @@ next_buffer:
356 memmove(buf->base, buf->base + i, buf->size - i); 356 memmove(buf->base, buf->base + i, buf->size - i);
357 buf->size -= i; 357 buf->size -= i;
358 spin_unlock(&acm->throttle_lock); 358 spin_unlock(&acm->throttle_lock);
359 spin_lock(&acm->read_lock); 359 spin_lock_irqsave(&acm->read_lock, flags);
360 list_add(&buf->list, &acm->filled_read_bufs); 360 list_add(&buf->list, &acm->filled_read_bufs);
361 spin_unlock(&acm->read_lock); 361 spin_unlock_irqrestore(&acm->read_lock, flags);
362 return; 362 return;
363 } 363 }
364 spin_unlock(&acm->throttle_lock); 364 spin_unlock(&acm->throttle_lock);
365 365
366 spin_lock(&acm->read_lock); 366 spin_lock_irqsave(&acm->read_lock, flags);
367 list_add(&buf->list, &acm->spare_read_bufs); 367 list_add(&buf->list, &acm->spare_read_bufs);
368 spin_unlock(&acm->read_lock); 368 spin_unlock_irqrestore(&acm->read_lock, flags);
369 goto next_buffer; 369 goto next_buffer;
370 370
371urbs: 371urbs:
372 while (!list_empty(&acm->spare_read_bufs)) { 372 while (!list_empty(&acm->spare_read_bufs)) {
373 spin_lock(&acm->read_lock); 373 spin_lock_irqsave(&acm->read_lock, flags);
374 if (list_empty(&acm->spare_read_urbs)) { 374 if (list_empty(&acm->spare_read_urbs)) {
375 spin_unlock(&acm->read_lock); 375 spin_unlock_irqrestore(&acm->read_lock, flags);
376 return; 376 return;
377 } 377 }
378 rcv = list_entry(acm->spare_read_urbs.next, 378 rcv = list_entry(acm->spare_read_urbs.next,
379 struct acm_ru, list); 379 struct acm_ru, list);
380 list_del(&rcv->list); 380 list_del(&rcv->list);
381 spin_unlock(&acm->read_lock); 381 spin_unlock_irqrestore(&acm->read_lock, flags);
382 382
383 buf = list_entry(acm->spare_read_bufs.next, 383 buf = list_entry(acm->spare_read_bufs.next,
384 struct acm_rb, list); 384 struct acm_rb, list);
@@ -400,9 +400,9 @@ urbs:
400 free-urbs-pool and resubmited ASAP */ 400 free-urbs-pool and resubmited ASAP */
401 if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) { 401 if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) {
402 list_add(&buf->list, &acm->spare_read_bufs); 402 list_add(&buf->list, &acm->spare_read_bufs);
403 spin_lock(&acm->read_lock); 403 spin_lock_irqsave(&acm->read_lock, flags);
404 list_add(&rcv->list, &acm->spare_read_urbs); 404 list_add(&rcv->list, &acm->spare_read_urbs);
405 spin_unlock(&acm->read_lock); 405 spin_unlock_irqrestore(&acm->read_lock, flags);
406 return; 406 return;
407 } 407 }
408 } 408 }
@@ -1083,6 +1083,9 @@ static struct usb_device_id acm_ids[] = {
1083 { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */ 1083 { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */
1084 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1084 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1085 }, 1085 },
1086 { USB_DEVICE(0x079b, 0x000f), /* BT On-Air USB MODEM */
1087 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1088 },
1086 { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ 1089 { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */
1087 .driver_info = SINGLE_RX_URB, /* firmware bug */ 1090 .driver_info = SINGLE_RX_URB, /* firmware bug */
1088 }, 1091 },
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index a161d70e1e42..809d465eb257 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -154,6 +154,7 @@ struct usblp {
154 unsigned char used; /* True if open */ 154 unsigned char used; /* True if open */
155 unsigned char present; /* True if not disconnected */ 155 unsigned char present; /* True if not disconnected */
156 unsigned char bidir; /* interface is bidirectional */ 156 unsigned char bidir; /* interface is bidirectional */
157 unsigned char sleeping; /* interface is suspended */
157 unsigned char *device_id_string; /* IEEE 1284 DEVICE ID string (ptr) */ 158 unsigned char *device_id_string; /* IEEE 1284 DEVICE ID string (ptr) */
158 /* first 2 bytes are (big-endian) length */ 159 /* first 2 bytes are (big-endian) length */
159}; 160};
@@ -183,6 +184,7 @@ static void usblp_dump(struct usblp *usblp) {
183 dbg("quirks=%d", usblp->quirks); 184 dbg("quirks=%d", usblp->quirks);
184 dbg("used=%d", usblp->used); 185 dbg("used=%d", usblp->used);
185 dbg("bidir=%d", usblp->bidir); 186 dbg("bidir=%d", usblp->bidir);
187 dbg("sleeping=%d", usblp->sleeping);
186 dbg("device_id_string=\"%s\"", 188 dbg("device_id_string=\"%s\"",
187 usblp->device_id_string ? 189 usblp->device_id_string ?
188 usblp->device_id_string + 2 : 190 usblp->device_id_string + 2 :
@@ -338,6 +340,20 @@ static int usblp_check_status(struct usblp *usblp, int err)
338 return newerr; 340 return newerr;
339} 341}
340 342
343static int handle_bidir (struct usblp *usblp)
344{
345 if (usblp->bidir && usblp->used && !usblp->sleeping) {
346 usblp->readcount = 0;
347 usblp->readurb->dev = usblp->dev;
348 if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) {
349 usblp->used = 0;
350 return -EIO;
351 }
352 }
353
354 return 0;
355}
356
341/* 357/*
342 * File op functions. 358 * File op functions.
343 */ 359 */
@@ -390,14 +406,9 @@ static int usblp_open(struct inode *inode, struct file *file)
390 usblp->writeurb->status = 0; 406 usblp->writeurb->status = 0;
391 usblp->readurb->status = 0; 407 usblp->readurb->status = 0;
392 408
393 if (usblp->bidir) { 409 if (handle_bidir(usblp) < 0) {
394 usblp->readcount = 0; 410 file->private_data = NULL;
395 usblp->readurb->dev = usblp->dev; 411 retval = -EIO;
396 if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) {
397 retval = -EIO;
398 usblp->used = 0;
399 file->private_data = NULL;
400 }
401 } 412 }
402out: 413out:
403 mutex_unlock (&usblp_mutex); 414 mutex_unlock (&usblp_mutex);
@@ -460,6 +471,11 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
460 goto done; 471 goto done;
461 } 472 }
462 473
474 if (usblp->sleeping) {
475 retval = -ENODEV;
476 goto done;
477 }
478
463 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd), 479 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
464 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) ); 480 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) );
465 481
@@ -658,6 +674,11 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
658 return -ENODEV; 674 return -ENODEV;
659 } 675 }
660 676
677 if (usblp->sleeping) {
678 up (&usblp->sem);
679 return writecount ? writecount : -ENODEV;
680 }
681
661 if (usblp->writeurb->status != 0) { 682 if (usblp->writeurb->status != 0) {
662 if (usblp->quirks & USBLP_QUIRK_BIDIR) { 683 if (usblp->quirks & USBLP_QUIRK_BIDIR) {
663 if (!usblp->wcomplete) 684 if (!usblp->wcomplete)
@@ -749,6 +770,11 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count,
749 goto done; 770 goto done;
750 } 771 }
751 772
773 if (usblp->sleeping) {
774 count = -ENODEV;
775 goto done;
776 }
777
752 if (usblp->readurb->status) { 778 if (usblp->readurb->status) {
753 err("usblp%d: error %d reading from printer", 779 err("usblp%d: error %d reading from printer",
754 usblp->minor, usblp->readurb->status); 780 usblp->minor, usblp->readurb->status);
@@ -1167,6 +1193,41 @@ static void usblp_disconnect(struct usb_interface *intf)
1167 mutex_unlock (&usblp_mutex); 1193 mutex_unlock (&usblp_mutex);
1168} 1194}
1169 1195
1196static int usblp_suspend (struct usb_interface *intf, pm_message_t message)
1197{
1198 struct usblp *usblp = usb_get_intfdata (intf);
1199
1200 /* this races against normal access and open */
1201 mutex_lock (&usblp_mutex);
1202 down (&usblp->sem);
1203 /* we take no more IO */
1204 usblp->sleeping = 1;
1205 /* we wait for anything printing */
1206 wait_event (usblp->wait, usblp->wcomplete || !usblp->present);
1207 usblp_unlink_urbs(usblp);
1208 up (&usblp->sem);
1209 mutex_unlock (&usblp_mutex);
1210
1211 return 0;
1212}
1213
1214static int usblp_resume (struct usb_interface *intf)
1215{
1216 struct usblp *usblp = usb_get_intfdata (intf);
1217 int r;
1218
1219 mutex_lock (&usblp_mutex);
1220 down (&usblp->sem);
1221
1222 usblp->sleeping = 0;
1223 r = handle_bidir (usblp);
1224
1225 up (&usblp->sem);
1226 mutex_unlock (&usblp_mutex);
1227
1228 return r;
1229}
1230
1170static struct usb_device_id usblp_ids [] = { 1231static struct usb_device_id usblp_ids [] = {
1171 { USB_DEVICE_INFO(7, 1, 1) }, 1232 { USB_DEVICE_INFO(7, 1, 1) },
1172 { USB_DEVICE_INFO(7, 1, 2) }, 1233 { USB_DEVICE_INFO(7, 1, 2) },
@@ -1183,6 +1244,8 @@ static struct usb_driver usblp_driver = {
1183 .name = "usblp", 1244 .name = "usblp",
1184 .probe = usblp_probe, 1245 .probe = usblp_probe,
1185 .disconnect = usblp_disconnect, 1246 .disconnect = usblp_disconnect,
1247 .suspend = usblp_suspend,
1248 .resume = usblp_resume,
1186 .id_table = usblp_ids, 1249 .id_table = usblp_ids,
1187}; 1250};
1188 1251
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 724822cac2b1..fed92be63b5e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1588,15 +1588,18 @@ const struct file_operations usbfs_device_file_operations = {
1588 .release = usbdev_release, 1588 .release = usbdev_release,
1589}; 1589};
1590 1590
1591static void usbdev_add(struct usb_device *dev) 1591static int usbdev_add(struct usb_device *dev)
1592{ 1592{
1593 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1593 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
1594 1594
1595 dev->class_dev = class_device_create(usb_device_class, NULL, 1595 dev->class_dev = class_device_create(usb_device_class, NULL,
1596 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev, 1596 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
1597 "usbdev%d.%d", dev->bus->busnum, dev->devnum); 1597 "usbdev%d.%d", dev->bus->busnum, dev->devnum);
1598 if (IS_ERR(dev->class_dev))
1599 return PTR_ERR(dev->class_dev);
1598 1600
1599 dev->class_dev->class_data = dev; 1601 dev->class_dev->class_data = dev;
1602 return 0;
1600} 1603}
1601 1604
1602static void usbdev_remove(struct usb_device *dev) 1605static void usbdev_remove(struct usb_device *dev)
@@ -1609,7 +1612,8 @@ static int usbdev_notify(struct notifier_block *self, unsigned long action,
1609{ 1612{
1610 switch (action) { 1613 switch (action) {
1611 case USB_DEVICE_ADD: 1614 case USB_DEVICE_ADD:
1612 usbdev_add(dev); 1615 if (usbdev_add(dev))
1616 return NOTIFY_BAD;
1613 break; 1617 break;
1614 case USB_DEVICE_REMOVE: 1618 case USB_DEVICE_REMOVE:
1615 usbdev_remove(dev); 1619 usbdev_remove(dev);
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 3ebb90149e93..3b2d137912be 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -223,7 +223,7 @@ int usb_create_ep_files(struct device *parent,
223 ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL); 223 ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
224 if (!ep_dev) { 224 if (!ep_dev) {
225 retval = -ENOMEM; 225 retval = -ENOMEM;
226 goto exit; 226 goto error_alloc;
227 } 227 }
228 228
229 /* fun calculation to determine the minor of this endpoint */ 229 /* fun calculation to determine the minor of this endpoint */
@@ -241,33 +241,31 @@ int usb_create_ep_files(struct device *parent,
241 241
242 retval = device_register(&ep_dev->dev); 242 retval = device_register(&ep_dev->dev);
243 if (retval) 243 if (retval)
244 goto error; 244 goto error_register;
245 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); 245 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
246 if (retval) 246 if (retval)
247 goto error_group; 247 goto error_group;
248 248
249 endpoint->ep_dev = ep_dev;
250
251 /* create the symlink to the old-style "ep_XX" directory */ 249 /* create the symlink to the old-style "ep_XX" directory */
252 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); 250 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
253 retval = sysfs_create_link(&parent->kobj, 251 retval = sysfs_create_link(&parent->kobj, &ep_dev->dev.kobj, name);
254 &endpoint->ep_dev->dev.kobj, name);
255 if (retval) 252 if (retval)
256 goto error_link; 253 goto error_link;
257exit: 254 endpoint->ep_dev = ep_dev;
258 return retval; 255 return retval;
259 256
260error_link: 257error_link:
261 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); 258 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
262
263error_group: 259error_group:
264 device_unregister(&ep_dev->dev); 260 device_unregister(&ep_dev->dev);
265 endpoint->ep_dev = NULL;
266 destroy_endpoint_class(); 261 destroy_endpoint_class();
267 return retval; 262 return retval;
268error: 263
264error_register:
269 kfree(ep_dev); 265 kfree(ep_dev);
266error_alloc:
270 destroy_endpoint_class(); 267 destroy_endpoint_class();
268exit:
271 return retval; 269 return retval;
272} 270}
273 271
@@ -282,8 +280,6 @@ void usb_remove_ep_files(struct usb_host_endpoint *endpoint)
282 sysfs_remove_group(&endpoint->ep_dev->dev.kobj, &ep_dev_attr_grp); 280 sysfs_remove_group(&endpoint->ep_dev->dev.kobj, &ep_dev_attr_grp);
283 device_unregister(&endpoint->ep_dev->dev); 281 device_unregister(&endpoint->ep_dev->dev);
284 endpoint->ep_dev = NULL; 282 endpoint->ep_dev = NULL;
283 destroy_endpoint_class();
285 } 284 }
286 destroy_endpoint_class();
287} 285}
288
289
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index d954daa8e9e0..3acc896a5d4c 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1774,8 +1774,8 @@ static DEVICE_ATTR (queues, S_IRUGO, show_queues, NULL);
1774 1774
1775#else 1775#else
1776 1776
1777#define device_create_file(a,b) do {} while (0) 1777#define device_create_file(a,b) (0)
1778#define device_remove_file device_create_file 1778#define device_remove_file(a,b) do { } while (0)
1779 1779
1780#endif 1780#endif
1781 1781
@@ -2044,8 +2044,10 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2044 return retval; 2044 return retval;
2045 } 2045 }
2046 2046
2047 device_create_file (&dev->pdev->dev, &dev_attr_function); 2047 retval = device_create_file (&dev->pdev->dev, &dev_attr_function);
2048 device_create_file (&dev->pdev->dev, &dev_attr_queues); 2048 if (retval) goto err_unbind;
2049 retval = device_create_file (&dev->pdev->dev, &dev_attr_queues);
2050 if (retval) goto err_func;
2049 2051
2050 /* ... then enable host detection and ep0; and we're ready 2052 /* ... then enable host detection and ep0; and we're ready
2051 * for set_configuration as well as eventual disconnect. 2053 * for set_configuration as well as eventual disconnect.
@@ -2060,6 +2062,14 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2060 2062
2061 /* pci writes may still be posted */ 2063 /* pci writes may still be posted */
2062 return 0; 2064 return 0;
2065
2066err_func:
2067 device_remove_file (&dev->pdev->dev, &dev_attr_function);
2068err_unbind:
2069 driver->unbind (&dev->gadget);
2070 dev->gadget.dev.driver = NULL;
2071 dev->driver = NULL;
2072 return retval;
2063} 2073}
2064EXPORT_SYMBOL (usb_gadget_register_driver); 2074EXPORT_SYMBOL (usb_gadget_register_driver);
2065 2075
@@ -2974,8 +2984,10 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
2974 : "disabled"); 2984 : "disabled");
2975 the_controller = dev; 2985 the_controller = dev;
2976 2986
2977 device_register (&dev->gadget.dev); 2987 retval = device_register (&dev->gadget.dev);
2978 device_create_file (&pdev->dev, &dev_attr_registers); 2988 if (retval) goto done;
2989 retval = device_create_file (&pdev->dev, &dev_attr_registers);
2990 if (retval) goto done;
2979 2991
2980 return 0; 2992 return 0;
2981 2993
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index f42c00ef0bca..671c24bc6d75 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -43,11 +43,11 @@
43#include <linux/mm.h> 43#include <linux/mm.h>
44#include <linux/platform_device.h> 44#include <linux/platform_device.h>
45#include <linux/dma-mapping.h> 45#include <linux/dma-mapping.h>
46#include <linux/irq.h>
46 47
47#include <asm/byteorder.h> 48#include <asm/byteorder.h>
48#include <asm/dma.h> 49#include <asm/dma.h>
49#include <asm/io.h> 50#include <asm/io.h>
50#include <asm/irq.h>
51#include <asm/system.h> 51#include <asm/system.h>
52#include <asm/mach-types.h> 52#include <asm/mach-types.h>
53#include <asm/unaligned.h> 53#include <asm/unaligned.h>
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 23b95b2bfe15..34b7a31cd85b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -754,7 +754,9 @@ show_registers (struct class_device *class_dev, char *buf)
754 } 754 }
755 755
756 if (ehci->reclaim) { 756 if (ehci->reclaim) {
757 temp = scnprintf (next, size, "reclaim qh %p\n", ehci->reclaim); 757 temp = scnprintf (next, size, "reclaim qh %p%s\n",
758 ehci->reclaim,
759 ehci->reclaim_ready ? " ready" : "");
758 size -= temp; 760 size -= temp;
759 next += temp; 761 next += temp;
760 } 762 }
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index aac6ec5dd7cf..9030994aba98 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -111,7 +111,7 @@ static const char hcd_name [] = "ehci_hcd";
111#define EHCI_TUNE_MULT_TT 1 111#define EHCI_TUNE_MULT_TT 1
112#define EHCI_TUNE_FLS 2 /* (small) 256 frame schedule */ 112#define EHCI_TUNE_FLS 2 /* (small) 256 frame schedule */
113 113
114#define EHCI_IAA_MSECS 10 /* arbitrary */ 114#define EHCI_IAA_JIFFIES (HZ/100) /* arbitrary; ~10 msec */
115#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */ 115#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
116#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */ 116#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
117#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */ 117#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */
@@ -254,7 +254,6 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
254 254
255/*-------------------------------------------------------------------------*/ 255/*-------------------------------------------------------------------------*/
256 256
257static void end_unlink_async (struct ehci_hcd *ehci);
258static void ehci_work(struct ehci_hcd *ehci); 257static void ehci_work(struct ehci_hcd *ehci);
259 258
260#include "ehci-hub.c" 259#include "ehci-hub.c"
@@ -264,37 +263,25 @@ static void ehci_work(struct ehci_hcd *ehci);
264 263
265/*-------------------------------------------------------------------------*/ 264/*-------------------------------------------------------------------------*/
266 265
267static void ehci_iaa_watchdog (unsigned long param) 266static void ehci_watchdog (unsigned long param)
268{ 267{
269 struct ehci_hcd *ehci = (struct ehci_hcd *) param; 268 struct ehci_hcd *ehci = (struct ehci_hcd *) param;
270 unsigned long flags; 269 unsigned long flags;
271 u32 status;
272 270
273 spin_lock_irqsave (&ehci->lock, flags); 271 spin_lock_irqsave (&ehci->lock, flags);
274 WARN_ON(!ehci->reclaim);
275 272
276 /* lost IAA irqs wedge things badly; seen first with a vt8235 */ 273 /* lost IAA irqs wedge things badly; seen with a vt8235 */
277 if (ehci->reclaim) { 274 if (ehci->reclaim) {
278 status = readl (&ehci->regs->status); 275 u32 status = readl (&ehci->regs->status);
279 if (status & STS_IAA) { 276 if (status & STS_IAA) {
280 ehci_vdbg (ehci, "lost IAA\n"); 277 ehci_vdbg (ehci, "lost IAA\n");
281 COUNT (ehci->stats.lost_iaa); 278 COUNT (ehci->stats.lost_iaa);
282 writel (STS_IAA, &ehci->regs->status); 279 writel (STS_IAA, &ehci->regs->status);
283 end_unlink_async (ehci); 280 ehci->reclaim_ready = 1;
284 } 281 }
285 } 282 }
286 283
287 spin_unlock_irqrestore (&ehci->lock, flags); 284 /* stop async processing after it's idled a bit */
288}
289
290static void ehci_watchdog (unsigned long param)
291{
292 struct ehci_hcd *ehci = (struct ehci_hcd *) param;
293 unsigned long flags;
294
295 spin_lock_irqsave (&ehci->lock, flags);
296
297 /* stop async processing after it's idled a bit */
298 if (test_bit (TIMER_ASYNC_OFF, &ehci->actions)) 285 if (test_bit (TIMER_ASYNC_OFF, &ehci->actions))
299 start_unlink_async (ehci, ehci->async); 286 start_unlink_async (ehci, ehci->async);
300 287
@@ -345,6 +332,8 @@ static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
345static void ehci_work (struct ehci_hcd *ehci) 332static void ehci_work (struct ehci_hcd *ehci)
346{ 333{
347 timer_action_done (ehci, TIMER_IO_WATCHDOG); 334 timer_action_done (ehci, TIMER_IO_WATCHDOG);
335 if (ehci->reclaim_ready)
336 end_unlink_async (ehci);
348 337
349 /* another CPU may drop ehci->lock during a schedule scan while 338 /* another CPU may drop ehci->lock during a schedule scan while
350 * it reports urb completions. this flag guards against bogus 339 * it reports urb completions. this flag guards against bogus
@@ -379,7 +368,6 @@ static void ehci_stop (struct usb_hcd *hcd)
379 368
380 /* no more interrupts ... */ 369 /* no more interrupts ... */
381 del_timer_sync (&ehci->watchdog); 370 del_timer_sync (&ehci->watchdog);
382 del_timer_sync (&ehci->iaa_watchdog);
383 371
384 spin_lock_irq(&ehci->lock); 372 spin_lock_irq(&ehci->lock);
385 if (HC_IS_RUNNING (hcd->state)) 373 if (HC_IS_RUNNING (hcd->state))
@@ -426,10 +414,6 @@ static int ehci_init(struct usb_hcd *hcd)
426 ehci->watchdog.function = ehci_watchdog; 414 ehci->watchdog.function = ehci_watchdog;
427 ehci->watchdog.data = (unsigned long) ehci; 415 ehci->watchdog.data = (unsigned long) ehci;
428 416
429 init_timer(&ehci->iaa_watchdog);
430 ehci->iaa_watchdog.function = ehci_iaa_watchdog;
431 ehci->iaa_watchdog.data = (unsigned long) ehci;
432
433 /* 417 /*
434 * hw default: 1K periodic list heads, one per frame. 418 * hw default: 1K periodic list heads, one per frame.
435 * periodic_size can shrink by USBCMD update if hcc_params allows. 419 * periodic_size can shrink by USBCMD update if hcc_params allows.
@@ -446,6 +430,7 @@ static int ehci_init(struct usb_hcd *hcd)
446 ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); 430 ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params);
447 431
448 ehci->reclaim = NULL; 432 ehci->reclaim = NULL;
433 ehci->reclaim_ready = 0;
449 ehci->next_uframe = -1; 434 ehci->next_uframe = -1;
450 435
451 /* 436 /*
@@ -619,7 +604,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
619 /* complete the unlinking of some qh [4.15.2.3] */ 604 /* complete the unlinking of some qh [4.15.2.3] */
620 if (status & STS_IAA) { 605 if (status & STS_IAA) {
621 COUNT (ehci->stats.reclaim); 606 COUNT (ehci->stats.reclaim);
622 end_unlink_async (ehci); 607 ehci->reclaim_ready = 1;
623 bh = 1; 608 bh = 1;
624 } 609 }
625 610
@@ -723,14 +708,10 @@ static int ehci_urb_enqueue (
723 708
724static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) 709static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
725{ 710{
726 // BUG_ON(qh->qh_state != QH_STATE_LINKED); 711 /* if we need to use IAA and it's busy, defer */
727 712 if (qh->qh_state == QH_STATE_LINKED
728 /* failfast */ 713 && ehci->reclaim
729 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) 714 && HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) {
730 end_unlink_async (ehci);
731
732 /* defer till later if busy */
733 else if (ehci->reclaim) {
734 struct ehci_qh *last; 715 struct ehci_qh *last;
735 716
736 for (last = ehci->reclaim; 717 for (last = ehci->reclaim;
@@ -740,8 +721,12 @@ static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
740 qh->qh_state = QH_STATE_UNLINK_WAIT; 721 qh->qh_state = QH_STATE_UNLINK_WAIT;
741 last->reclaim = qh; 722 last->reclaim = qh;
742 723
743 /* start IAA cycle */ 724 /* bypass IAA if the hc can't care */
744 } else 725 } else if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state) && ehci->reclaim)
726 end_unlink_async (ehci);
727
728 /* something else might have unlinked the qh by now */
729 if (qh->qh_state == QH_STATE_LINKED)
745 start_unlink_async (ehci, qh); 730 start_unlink_async (ehci, qh);
746} 731}
747 732
@@ -763,19 +748,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
763 qh = (struct ehci_qh *) urb->hcpriv; 748 qh = (struct ehci_qh *) urb->hcpriv;
764 if (!qh) 749 if (!qh)
765 break; 750 break;
766 switch (qh->qh_state) { 751 unlink_async (ehci, qh);
767 case QH_STATE_LINKED:
768 case QH_STATE_COMPLETING:
769 unlink_async (ehci, qh);
770 break;
771 case QH_STATE_UNLINK:
772 case QH_STATE_UNLINK_WAIT:
773 /* already started */
774 break;
775 case QH_STATE_IDLE:
776 WARN_ON(1);
777 break;
778 }
779 break; 752 break;
780 753
781 case PIPE_INTERRUPT: 754 case PIPE_INTERRUPT:
@@ -867,7 +840,6 @@ rescan:
867 unlink_async (ehci, qh); 840 unlink_async (ehci, qh);
868 /* FALL THROUGH */ 841 /* FALL THROUGH */
869 case QH_STATE_UNLINK: /* wait for hw to finish? */ 842 case QH_STATE_UNLINK: /* wait for hw to finish? */
870 case QH_STATE_UNLINK_WAIT:
871idle_timeout: 843idle_timeout:
872 spin_unlock_irqrestore (&ehci->lock, flags); 844 spin_unlock_irqrestore (&ehci->lock, flags);
873 schedule_timeout_uninterruptible(1); 845 schedule_timeout_uninterruptible(1);
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 2012213c0a25..1b20722c102b 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -48,7 +48,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
48 } 48 }
49 ehci->command = readl (&ehci->regs->command); 49 ehci->command = readl (&ehci->regs->command);
50 if (ehci->reclaim) 50 if (ehci->reclaim)
51 end_unlink_async (ehci); 51 ehci->reclaim_ready = 1;
52 ehci_work(ehci); 52 ehci_work(ehci);
53 53
54 /* suspend any active/unsuspended ports, maybe allow wakeup */ 54 /* suspend any active/unsuspended ports, maybe allow wakeup */
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 35e3fab6fc4e..e51c1ed81ac4 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -303,7 +303,7 @@ restart:
303 /* emptying the schedule aborts any urbs */ 303 /* emptying the schedule aborts any urbs */
304 spin_lock_irq(&ehci->lock); 304 spin_lock_irq(&ehci->lock);
305 if (ehci->reclaim) 305 if (ehci->reclaim)
306 end_unlink_async (ehci); 306 ehci->reclaim_ready = 1;
307 ehci_work(ehci); 307 ehci_work(ehci);
308 spin_unlock_irq(&ehci->lock); 308 spin_unlock_irq(&ehci->lock);
309 309
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 46327272f614..62e46dc60e86 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -967,7 +967,7 @@ static void end_unlink_async (struct ehci_hcd *ehci)
967 struct ehci_qh *qh = ehci->reclaim; 967 struct ehci_qh *qh = ehci->reclaim;
968 struct ehci_qh *next; 968 struct ehci_qh *next;
969 969
970 iaa_watchdog_done (ehci); 970 timer_action_done (ehci, TIMER_IAA_WATCHDOG);
971 971
972 // qh->hw_next = cpu_to_le32 (qh->qh_dma); 972 // qh->hw_next = cpu_to_le32 (qh->qh_dma);
973 qh->qh_state = QH_STATE_IDLE; 973 qh->qh_state = QH_STATE_IDLE;
@@ -977,6 +977,7 @@ static void end_unlink_async (struct ehci_hcd *ehci)
977 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */ 977 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
978 next = qh->reclaim; 978 next = qh->reclaim;
979 ehci->reclaim = next; 979 ehci->reclaim = next;
980 ehci->reclaim_ready = 0;
980 qh->reclaim = NULL; 981 qh->reclaim = NULL;
981 982
982 qh_completions (ehci, qh); 983 qh_completions (ehci, qh);
@@ -1051,10 +1052,11 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
1051 return; 1052 return;
1052 } 1053 }
1053 1054
1055 ehci->reclaim_ready = 0;
1054 cmd |= CMD_IAAD; 1056 cmd |= CMD_IAAD;
1055 writel (cmd, &ehci->regs->command); 1057 writel (cmd, &ehci->regs->command);
1056 (void) readl (&ehci->regs->command); 1058 (void) readl (&ehci->regs->command);
1057 iaa_watchdog_start (ehci); 1059 timer_action (ehci, TIMER_IAA_WATCHDOG);
1058} 1060}
1059 1061
1060/*-------------------------------------------------------------------------*/ 1062/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 6aac39f50e07..bbc3082a73d7 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -58,6 +58,7 @@ struct ehci_hcd { /* one per controller */
58 /* async schedule support */ 58 /* async schedule support */
59 struct ehci_qh *async; 59 struct ehci_qh *async;
60 struct ehci_qh *reclaim; 60 struct ehci_qh *reclaim;
61 unsigned reclaim_ready : 1;
61 unsigned scanning : 1; 62 unsigned scanning : 1;
62 63
63 /* periodic schedule support */ 64 /* periodic schedule support */
@@ -80,7 +81,6 @@ struct ehci_hcd { /* one per controller */
80 struct dma_pool *itd_pool; /* itd per iso urb */ 81 struct dma_pool *itd_pool; /* itd per iso urb */
81 struct dma_pool *sitd_pool; /* sitd per split iso urb */ 82 struct dma_pool *sitd_pool; /* sitd per split iso urb */
82 83
83 struct timer_list iaa_watchdog;
84 struct timer_list watchdog; 84 struct timer_list watchdog;
85 unsigned long actions; 85 unsigned long actions;
86 unsigned stamp; 86 unsigned stamp;
@@ -114,21 +114,9 @@ static inline struct usb_hcd *ehci_to_hcd (struct ehci_hcd *ehci)
114} 114}
115 115
116 116
117static inline void
118iaa_watchdog_start (struct ehci_hcd *ehci)
119{
120 WARN_ON(timer_pending(&ehci->iaa_watchdog));
121 mod_timer (&ehci->iaa_watchdog,
122 jiffies + msecs_to_jiffies(EHCI_IAA_MSECS));
123}
124
125static inline void iaa_watchdog_done (struct ehci_hcd *ehci)
126{
127 del_timer (&ehci->iaa_watchdog);
128}
129
130enum ehci_timer_action { 117enum ehci_timer_action {
131 TIMER_IO_WATCHDOG, 118 TIMER_IO_WATCHDOG,
119 TIMER_IAA_WATCHDOG,
132 TIMER_ASYNC_SHRINK, 120 TIMER_ASYNC_SHRINK,
133 TIMER_ASYNC_OFF, 121 TIMER_ASYNC_OFF,
134}; 122};
@@ -146,6 +134,9 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
146 unsigned long t; 134 unsigned long t;
147 135
148 switch (action) { 136 switch (action) {
137 case TIMER_IAA_WATCHDOG:
138 t = EHCI_IAA_JIFFIES;
139 break;
149 case TIMER_IO_WATCHDOG: 140 case TIMER_IO_WATCHDOG:
150 t = EHCI_IO_JIFFIES; 141 t = EHCI_IO_JIFFIES;
151 break; 142 break;
@@ -162,7 +153,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
162 // async queue SHRINK often precedes IAA. while it's ready 153 // async queue SHRINK often precedes IAA. while it's ready
163 // to go OFF neither can matter, and afterwards the IO 154 // to go OFF neither can matter, and afterwards the IO
164 // watchdog stops unless there's still periodic traffic. 155 // watchdog stops unless there's still periodic traffic.
165 if (time_before_eq(t, ehci->watchdog.expires) 156 if (action != TIMER_IAA_WATCHDOG
157 && t > ehci->watchdog.expires
166 && timer_pending (&ehci->watchdog)) 158 && timer_pending (&ehci->watchdog))
167 return; 159 return;
168 mod_timer (&ehci->watchdog, t); 160 mod_timer (&ehci->watchdog, t);
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 82cb22f002e7..2dbb77414905 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -262,6 +262,7 @@ static const struct hc_driver ohci_pnx4008_hc_driver = {
262 */ 262 */
263 .start = ohci_pnx4008_start, 263 .start = ohci_pnx4008_start,
264 .stop = ohci_stop, 264 .stop = ohci_stop,
265 .shutdown = ohci_shutdown,
265 266
266 /* 267 /*
267 * managing i/o requests and associated device resources 268 * managing i/o requests and associated device resources
@@ -280,7 +281,11 @@ static const struct hc_driver ohci_pnx4008_hc_driver = {
280 */ 281 */
281 .hub_status_data = ohci_hub_status_data, 282 .hub_status_data = ohci_hub_status_data,
282 .hub_control = ohci_hub_control, 283 .hub_control = ohci_hub_control,
283 284 .hub_irq_enable = ohci_rhsc_enable,
285#ifdef CONFIG_PM
286 .bus_suspend = ohci_bus_suspend,
287 .bus_resume = ohci_bus_resume,
288#endif
284 .start_port_reset = ohci_start_port_reset, 289 .start_port_reset = ohci_start_port_reset,
285}; 290};
286 291
@@ -410,8 +415,6 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
410 goto out4; 415 goto out4;
411 } 416 }
412 417
413 hcd->self.hcpriv = (void *)hcd;
414
415 pnx4008_start_hc(); 418 pnx4008_start_hc();
416 platform_set_drvdata(pdev, hcd); 419 platform_set_drvdata(pdev, hcd);
417 ohci = hcd_to_ohci(hcd); 420 ohci = hcd_to_ohci(hcd);
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 45ee6920a850..226bf3de8edd 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -40,6 +40,7 @@
40#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
41#include <linux/usb.h> 41#include <linux/usb.h>
42#include <linux/bitops.h> 42#include <linux/bitops.h>
43#include <linux/dmi.h>
43 44
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
45#include <asm/io.h> 46#include <asm/io.h>
@@ -196,12 +197,42 @@ static int resume_detect_interrupts_are_broken(struct uhci_hcd *uhci)
196 return 0; 197 return 0;
197} 198}
198 199
200static int remote_wakeup_is_broken(struct uhci_hcd *uhci)
201{
202 static struct dmi_system_id broken_wakeup_table[] = {
203 {
204 .ident = "Asus A7V8X",
205 .matches = {
206 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK"),
207 DMI_MATCH(DMI_BOARD_NAME, "A7V8X"),
208 DMI_MATCH(DMI_BOARD_VERSION, "REV 1.xx"),
209 }
210 },
211 { }
212 };
213 int port;
214
215 /* One of Asus's motherboards has a bug which causes it to
216 * wake up immediately from suspend-to-RAM if any of the ports
217 * are connected. In such cases we will not set EGSM.
218 */
219 if (dmi_check_system(broken_wakeup_table)) {
220 for (port = 0; port < uhci->rh_numports; ++port) {
221 if (inw(uhci->io_addr + USBPORTSC1 + port * 2) &
222 USBPORTSC_CCS)
223 return 1;
224 }
225 }
226
227 return 0;
228}
229
199static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state) 230static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state)
200__releases(uhci->lock) 231__releases(uhci->lock)
201__acquires(uhci->lock) 232__acquires(uhci->lock)
202{ 233{
203 int auto_stop; 234 int auto_stop;
204 int int_enable; 235 int int_enable, egsm_enable;
205 236
206 auto_stop = (new_state == UHCI_RH_AUTO_STOPPED); 237 auto_stop = (new_state == UHCI_RH_AUTO_STOPPED);
207 dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, 238 dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev,
@@ -217,15 +248,18 @@ __acquires(uhci->lock)
217 } 248 }
218 249
219 /* Enable resume-detect interrupts if they work. 250 /* Enable resume-detect interrupts if they work.
220 * Then enter Global Suspend mode, still configured. 251 * Then enter Global Suspend mode if _it_ works, still configured.
221 */ 252 */
253 egsm_enable = USBCMD_EGSM;
222 uhci->working_RD = 1; 254 uhci->working_RD = 1;
223 int_enable = USBINTR_RESUME; 255 int_enable = USBINTR_RESUME;
224 if (resume_detect_interrupts_are_broken(uhci)) { 256 if (remote_wakeup_is_broken(uhci))
257 egsm_enable = 0;
258 if (resume_detect_interrupts_are_broken(uhci) || !egsm_enable)
225 uhci->working_RD = int_enable = 0; 259 uhci->working_RD = int_enable = 0;
226 } 260
227 outw(int_enable, uhci->io_addr + USBINTR); 261 outw(int_enable, uhci->io_addr + USBINTR);
228 outw(USBCMD_EGSM | USBCMD_CF, uhci->io_addr + USBCMD); 262 outw(egsm_enable | USBCMD_CF, uhci->io_addr + USBCMD);
229 mb(); 263 mb();
230 udelay(5); 264 udelay(5);
231 265
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
index 21cd22640080..20db36448ab3 100644
--- a/drivers/usb/input/Kconfig
+++ b/drivers/usb/input/Kconfig
@@ -348,13 +348,3 @@ config USB_APPLETOUCH
348 348
349 To compile this driver as a module, choose M here: the 349 To compile this driver as a module, choose M here: the
350 module will be called appletouch. 350 module will be called appletouch.
351
352config USB_TRANCEVIBRATOR
353 tristate "PlayStation 2 Trance Vibrator driver support"
354 depends on USB
355 help
356 Say Y here if you want to connect a PlayStation 2 Trance Vibrator
357 device to your computer's USB port.
358
359 To compile this driver as a module, choose M here: the
360 module will be called trancevibrator.
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
index 295f459d1079..d946d5213b30 100644
--- a/drivers/usb/input/Makefile
+++ b/drivers/usb/input/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Multipart objects. 5# Multipart objects.
6wacom-objs := wacom_sys.o wacom_wac.o 6wacom-objs := wacom_wac.o wacom_sys.o
7usbhid-objs := hid-core.o 7usbhid-objs := hid-core.o
8 8
9# Optional parts of multipart objects. 9# Optional parts of multipart objects.
@@ -48,7 +48,6 @@ obj-$(CONFIG_USB_ACECAD) += acecad.o
48obj-$(CONFIG_USB_YEALINK) += yealink.o 48obj-$(CONFIG_USB_YEALINK) += yealink.o
49obj-$(CONFIG_USB_XPAD) += xpad.o 49obj-$(CONFIG_USB_XPAD) += xpad.o
50obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o 50obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o
51obj-$(CONFIG_USB_TRANCEVIBRATOR) += trancevibrator.o
52 51
53ifeq ($(CONFIG_USB_DEBUG),y) 52ifeq ($(CONFIG_USB_DEBUG),y)
54EXTRA_CFLAGS += -DDEBUG 53EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index a6738a83ff5b..45f44fe33bfe 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -750,21 +750,31 @@ static __inline__ __u32 s32ton(__s32 value, unsigned n)
750} 750}
751 751
752/* 752/*
753 * Extract/implement a data field from/to a report. 753 * Extract/implement a data field from/to a little endian report (bit array).
754 */ 754 */
755 755
756static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) 756static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
757{ 757{
758 report += (offset >> 5) << 2; offset &= 31; 758 u32 x;
759 return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1ULL << n) - 1); 759
760 report += offset >> 3; /* adjust byte index */
761 offset &= 8 - 1;
762 x = get_unaligned((u32 *) report);
763 x = le32_to_cpu(x);
764 x = (x >> offset) & ((1 << n) - 1);
765 return x;
760} 766}
761 767
762static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 768static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value)
763{ 769{
764 report += (offset >> 5) << 2; offset &= 31; 770 u32 x;
765 put_unaligned((get_unaligned((__le64*)report) 771
766 & cpu_to_le64(~((((__u64) 1 << n) - 1) << offset))) 772 report += offset >> 3;
767 | cpu_to_le64((__u64)value << offset), (__le64*)report); 773 offset &= 8 - 1;
774 x = get_unaligned((u32 *)report);
775 x &= cpu_to_le32(~((((__u32) 1 << n) - 1) << offset));
776 x |= cpu_to_le32(value << offset);
777 put_unaligned(x,(u32 *)report);
768} 778}
769 779
770/* 780/*
@@ -1381,6 +1391,9 @@ void hid_close(struct hid_device *hid)
1381 1391
1382#define USB_VENDOR_ID_PANJIT 0x134c 1392#define USB_VENDOR_ID_PANJIT 0x134c
1383 1393
1394#define USB_VENDOR_ID_TURBOX 0x062a
1395#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
1396
1384/* 1397/*
1385 * Initialize all reports 1398 * Initialize all reports
1386 */ 1399 */
@@ -1768,6 +1781,8 @@ static const struct hid_blacklist {
1768 { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, 1781 { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE },
1769 { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, 1782 { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE },
1770 1783
1784 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
1785
1771 { 0, 0 } 1786 { 0, 0 }
1772}; 1787};
1773 1788
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c
index f26c1cd1129f..2902742895ad 100644
--- a/drivers/usb/input/usbtouchscreen.c
+++ b/drivers/usb/input/usbtouchscreen.c
@@ -256,10 +256,10 @@ static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *pr
256{ 256{
257 *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); 257 *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
258 *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); 258 *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
259 *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); 259 *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F);
260 *touch = ~pkt[7] & 0x20; 260 *touch = ~pkt[7] & 0x20;
261 261
262 return 1; 262 return *touch;
263} 263}
264#endif 264#endif
265 265
diff --git a/drivers/usb/input/wacom.h b/drivers/usb/input/wacom.h
index 7b3840e378a8..1cf08f02c50e 100644
--- a/drivers/usb/input/wacom.h
+++ b/drivers/usb/input/wacom.h
@@ -63,6 +63,7 @@
63 * v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c, 63 * v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c,
64 * - where wacom_sys.c deals with system specific code, 64 * - where wacom_sys.c deals with system specific code,
65 * - and wacom_wac.c deals with Wacom specific code 65 * - and wacom_wac.c deals with Wacom specific code
66 * - Support Intuos3 4x6
66 */ 67 */
67 68
68/* 69/*
@@ -118,6 +119,7 @@ extern void wacom_input_sync(void *wcombo);
118extern void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 119extern void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
119extern void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 120extern void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
120extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 121extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
122extern void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
121extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 123extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
122extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 124extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
123extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); 125extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
diff --git a/drivers/usb/input/wacom_sys.c b/drivers/usb/input/wacom_sys.c
index d233c37bd533..3498b893b53b 100644
--- a/drivers/usb/input/wacom_sys.c
+++ b/drivers/usb/input/wacom_sys.c
@@ -110,7 +110,7 @@ __u16 wacom_be16_to_cpu(unsigned char *data)
110__u16 wacom_le16_to_cpu(unsigned char *data) 110__u16 wacom_le16_to_cpu(unsigned char *data)
111{ 111{
112 __u16 value; 112 __u16 value;
113 value = be16_to_cpu(*(__be16 *) data); 113 value = le16_to_cpu(*(__le16 *) data);
114 return value; 114 return value;
115} 115}
116 116
@@ -143,7 +143,7 @@ void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
143 input_dev->evbit[0] |= BIT(EV_MSC); 143 input_dev->evbit[0] |= BIT(EV_MSC);
144 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 144 input_dev->mscbit[0] |= BIT(MSC_SERIAL);
145 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); 145 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
146 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); 146 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_4);
147} 147}
148 148
149void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 149void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
@@ -155,11 +155,16 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
155 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); 155 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
156} 156}
157 157
158void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 158void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
159{ 159{
160 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); 160 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
161 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); 161 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3);
162 input_set_abs_params(input_dev, ABS_RX, 0, 4097, 0, 0); 162 input_set_abs_params(input_dev, ABS_RX, 0, 4097, 0, 0);
163}
164
165void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
166{
167 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
163 input_set_abs_params(input_dev, ABS_RY, 0, 4097, 0, 0); 168 input_set_abs_params(input_dev, ABS_RY, 0, 4097, 0, 0);
164} 169}
165 170
@@ -218,8 +223,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
218 strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); 223 strlcat(wacom->phys, "/input0", sizeof(wacom->phys));
219 224
220 wacom_wac->features = get_wacom_feature(id); 225 wacom_wac->features = get_wacom_feature(id);
221 if (wacom_wac->features->pktlen > 10) 226 BUG_ON(wacom_wac->features->pktlen > 10);
222 BUG();
223 227
224 input_dev->name = wacom_wac->features->name; 228 input_dev->name = wacom_wac->features->name;
225 wacom->wacom_wac = wacom_wac; 229 wacom->wacom_wac = wacom_wac;
@@ -244,7 +248,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
244 usb_fill_int_urb(wacom->irq, dev, 248 usb_fill_int_urb(wacom->irq, dev,
245 usb_rcvintpipe(dev, endpoint->bEndpointAddress), 249 usb_rcvintpipe(dev, endpoint->bEndpointAddress),
246 wacom_wac->data, wacom_wac->features->pktlen, 250 wacom_wac->data, wacom_wac->features->pktlen,
247 wacom_wac->features->irq, wacom, endpoint->bInterval); 251 wacom_sys_irq, wacom, endpoint->bInterval);
248 wacom->irq->transfer_dma = wacom->data_dma; 252 wacom->irq->transfer_dma = wacom->data_dma;
249 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 253 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
250 254
@@ -278,8 +282,8 @@ static void wacom_disconnect(struct usb_interface *intf)
278 input_unregister_device(wacom->dev); 282 input_unregister_device(wacom->dev);
279 usb_free_urb(wacom->irq); 283 usb_free_urb(wacom->irq);
280 usb_buffer_free(interface_to_usbdev(intf), 10, wacom->wacom_wac->data, wacom->data_dma); 284 usb_buffer_free(interface_to_usbdev(intf), 10, wacom->wacom_wac->data, wacom->data_dma);
281 kfree(wacom);
282 kfree(wacom->wacom_wac); 285 kfree(wacom->wacom_wac);
286 kfree(wacom);
283 } 287 }
284} 288}
285 289
diff --git a/drivers/usb/input/wacom_wac.c b/drivers/usb/input/wacom_wac.c
index aa31d22d4f05..92726fe89379 100644
--- a/drivers/usb/input/wacom_wac.c
+++ b/drivers/usb/input/wacom_wac.c
@@ -191,9 +191,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
191 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); 191 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
192 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); 192 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
193 if (wacom->features->type == WACOM_G4) 193 if (wacom->features->type == WACOM_G4)
194 wacom_report_abs(wcombo, ABS_DISTANCE, data[6]); 194 wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
195 else 195 else
196 wacom_report_abs(wcombo, ABS_DISTANCE, data[7]); 196 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
197 break; 197 break;
198 } 198 }
199 } 199 }
@@ -303,8 +303,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
303 wacom->tool[idx] = BTN_TOOL_PEN; 303 wacom->tool[idx] = BTN_TOOL_PEN;
304 } 304 }
305 /* only large I3 support Lens Cursor */ 305 /* only large I3 support Lens Cursor */
306 if(!((wacom->tool[idx] == BTN_TOOL_LENS) && 306 if(!((wacom->tool[idx] == BTN_TOOL_LENS)
307 (wacom->features->type == INTUOS3))) { 307 && ((wacom->features->type == INTUOS3)
308 || (wacom->features->type == INTUOS3S)))) {
308 wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */ 309 wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */
309 wacom_report_key(wcombo, wacom->tool[idx], 1); 310 wacom_report_key(wcombo, wacom->tool[idx], 1);
310 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 311 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
@@ -315,10 +316,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
315 316
316 /* Exit report */ 317 /* Exit report */
317 if ((data[1] & 0xfe) == 0x80) { 318 if ((data[1] & 0xfe) == 0x80) {
318 wacom_report_key(wcombo, wacom->tool[idx], 0); 319 if(!((wacom->tool[idx] == BTN_TOOL_LENS)
319 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 320 && ((wacom->features->type == INTUOS3)
320 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 321 || (wacom->features->type == INTUOS3S)))) {
321 return 2; 322 wacom_report_key(wcombo, wacom->tool[idx], 0);
323 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
324 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
325 return 2;
326 }
322 } 327 }
323 return 0; 328 return 0;
324} 329}
@@ -382,7 +387,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
382 wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); 387 wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
383 wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); 388 wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
384 389
385 if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2]) 390 if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) |
391 data[2] | (data[3] & 0x1f) | data[4])
386 wacom_report_key(wcombo, wacom->tool[1], 1); 392 wacom_report_key(wcombo, wacom->tool[1], 1);
387 else 393 else
388 wacom_report_key(wcombo, wacom->tool[1], 0); 394 wacom_report_key(wcombo, wacom->tool[1], 0);
@@ -432,7 +438,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
432 ((t - 1) / 2) : -t / 2); 438 ((t - 1) / 2) : -t / 2);
433 } 439 }
434 440
435 } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3) { 441 } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) {
436 /* 4D mouse packet */ 442 /* 4D mouse packet */
437 wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); 443 wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01);
438 wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); 444 wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
@@ -452,12 +458,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
452 - ((data[8] & 0x02) >> 1)); 458 - ((data[8] & 0x02) >> 1));
453 459
454 /* I3 2D mouse side buttons */ 460 /* I3 2D mouse side buttons */
455 if (wacom->features->type == INTUOS3) { 461 if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) {
456 wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); 462 wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40);
457 wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); 463 wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20);
458 } 464 }
459 465
460 } else if (wacom->features->type < INTUOS3) { 466 } else if (wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L) {
461 /* Lens cursor packets */ 467 /* Lens cursor packets */
462 wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); 468 wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01);
463 wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); 469 wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
@@ -490,6 +496,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
490 return (wacom_ptu_irq(wacom_wac, wcombo)); 496 return (wacom_ptu_irq(wacom_wac, wcombo));
491 break; 497 break;
492 case INTUOS: 498 case INTUOS:
499 case INTUOS3S:
493 case INTUOS3: 500 case INTUOS3:
494 case INTUOS3L: 501 case INTUOS3L:
495 case CINTIQ: 502 case CINTIQ:
@@ -515,6 +522,8 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
515 case CINTIQ: 522 case CINTIQ:
516 input_dev_i3(input_dev, wacom_wac); 523 input_dev_i3(input_dev, wacom_wac);
517 /* fall through */ 524 /* fall through */
525 case INTUOS3S:
526 input_dev_i3s(input_dev, wacom_wac);
518 case INTUOS: 527 case INTUOS:
519 input_dev_i(input_dev, wacom_wac); 528 input_dev_i(input_dev, wacom_wac);
520 break; 529 break;
@@ -530,49 +539,50 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
530} 539}
531 540
532static struct wacom_features wacom_features[] = { 541static struct wacom_features wacom_features[] = {
533 { "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_sys_irq }, 542 { "Wacom Penpartner", 7, 5040, 3780, 255, 0, PENPARTNER },
534 { "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_sys_irq }, 543 { "Wacom Graphire", 8, 10206, 7422, 511, 63, GRAPHIRE },
535 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_sys_irq }, 544 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 63, GRAPHIRE },
536 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_sys_irq }, 545 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 63, GRAPHIRE },
537 { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_sys_irq }, 546 { "Wacom Graphire3", 8, 10208, 7424, 511, 63, GRAPHIRE },
538 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_sys_irq }, 547 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63, GRAPHIRE },
539 { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 32, WACOM_G4, wacom_sys_irq }, 548 { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63, WACOM_G4 },
540 { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 32, WACOM_G4, wacom_sys_irq }, 549 { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 },
541 { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_sys_irq }, 550 { "Wacom Volito", 8, 5104, 3712, 511, 0, GRAPHIRE },
542 { "Wacom PenStation2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_sys_irq }, 551 { "Wacom PenStation2", 8, 3250, 2320, 255, 0, GRAPHIRE },
543 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_sys_irq }, 552 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 0, GRAPHIRE },
544 { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 32, GRAPHIRE, wacom_sys_irq }, 553 { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 0, GRAPHIRE },
545 { "Wacom PenPartner2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_sys_irq }, 554 { "Wacom PenPartner2", 8, 3250, 2320, 255, 0, GRAPHIRE },
546 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_sys_irq}, 555 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 63, INTUOS },
547 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, 556 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 63, INTUOS },
548 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_sys_irq }, 557 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 63, INTUOS },
549 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_sys_irq }, 558 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 63, INTUOS },
550 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_sys_irq}, 559 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 63, INTUOS },
551 { "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_sys_irq }, 560 { "Wacom PL400", 8, 5408, 4056, 255, 0, PL },
552 { "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_sys_irq }, 561 { "Wacom PL500", 8, 6144, 4608, 255, 0, PL },
553 { "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_sys_irq }, 562 { "Wacom PL600", 8, 6126, 4604, 255, 0, PL },
554 { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_sys_irq }, 563 { "Wacom PL600SX", 8, 6260, 5016, 255, 0, PL },
555 { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_sys_irq }, 564 { "Wacom PL550", 8, 6144, 4608, 511, 0, PL },
556 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_sys_irq }, 565 { "Wacom PL800", 8, 7220, 5780, 511, 0, PL },
557 { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_sys_irq }, 566 { "Wacom PL700", 8, 6758, 5406, 511, 0, PL },
558 { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_sys_irq }, 567 { "Wacom PL510", 8, 6282, 4762, 511, 0, PL },
559 { "Wacom DTU710", 8, 34080, 27660, 511, 32, PL, wacom_sys_irq }, 568 { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL },
560 { "Wacom DTF521", 8, 6282, 4762, 511, 32, PL, wacom_sys_irq }, 569 { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL },
561 { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_sys_irq }, 570 { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL },
562 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PTU, wacom_sys_irq }, 571 { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU },
563 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_sys_irq }, 572 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 63, INTUOS },
564 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, 573 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS },
565 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_sys_irq }, 574 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 63, INTUOS },
566 { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_sys_irq }, 575 { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 63, INTUOS },
567 { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_sys_irq }, 576 { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 63, INTUOS },
568 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_sys_irq }, 577 { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S },
569 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_sys_irq }, 578 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 },
570 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_sys_irq }, 579 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 },
571 { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS3L, wacom_sys_irq }, 580 { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 63, INTUOS3L },
572 { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS3L, wacom_sys_irq }, 581 { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 63, INTUOS3L },
573 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_sys_irq }, 582 { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 },
574 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_sys_irq }, 583 { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 15, INTUOS3S },
575 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_sys_irq }, 584 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ },
585 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS },
576 { } 586 { }
577}; 587};
578 588
@@ -618,6 +628,7 @@ static struct usb_device_id wacom_ids[] = {
618 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, 628 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) },
619 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, 629 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) },
620 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, 630 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) },
631 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) },
621 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, 632 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
622 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, 633 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
623 { } 634 { }
diff --git a/drivers/usb/input/wacom_wac.h b/drivers/usb/input/wacom_wac.h
index ceae7bf59d9f..a1d9ce007970 100644
--- a/drivers/usb/input/wacom_wac.h
+++ b/drivers/usb/input/wacom_wac.h
@@ -20,6 +20,7 @@ enum {
20 PTU, 20 PTU,
21 PL, 21 PL,
22 INTUOS, 22 INTUOS,
23 INTUOS3S,
23 INTUOS3, 24 INTUOS3,
24 INTUOS3L, 25 INTUOS3L,
25 CINTIQ, 26 CINTIQ,
@@ -34,7 +35,6 @@ struct wacom_features {
34 int pressure_max; 35 int pressure_max;
35 int distance_max; 36 int distance_max;
36 int type; 37 int type;
37 usb_complete_t irq;
38}; 38};
39 39
40struct wacom_wac { 40struct wacom_wac {
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index cebb6c463bfb..6a12a943b938 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * X-Box gamepad - v0.0.5 2 * X-Box gamepad - v0.0.6
3 * 3 *
4 * Copyright (c) 2002 Marko Friedemann <mfr@bmx-chemnitz.de> 4 * Copyright (c) 2002 Marko Friedemann <mfr@bmx-chemnitz.de>
5 * 5 * 2005 Dominic Cerquetti <binary1230@yahoo.com>
6 * 2006 Adam Buchbinder <adam.buchbinder@gmail.com>
6 * 7 *
7 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 9 * modify it under the terms of the GNU General Public License as
@@ -30,9 +31,10 @@
30 * - Greg Kroah-Hartman - usb-skeleton driver 31 * - Greg Kroah-Hartman - usb-skeleton driver
31 * 32 *
32 * TODO: 33 * TODO:
33 * - fine tune axes 34 * - fine tune axes (especially trigger axes)
34 * - fix "analog" buttons (reported as digital now) 35 * - fix "analog" buttons (reported as digital now)
35 * - get rumble working 36 * - get rumble working
37 * - need USB IDs for other dance pads
36 * 38 *
37 * History: 39 * History:
38 * 40 *
@@ -57,25 +59,40 @@
57#include <linux/kernel.h> 59#include <linux/kernel.h>
58#include <linux/init.h> 60#include <linux/init.h>
59#include <linux/slab.h> 61#include <linux/slab.h>
62#include <linux/stat.h>
60#include <linux/module.h> 63#include <linux/module.h>
64#include <linux/moduleparam.h>
61#include <linux/smp_lock.h> 65#include <linux/smp_lock.h>
62#include <linux/usb/input.h> 66#include <linux/usb/input.h>
63 67
64#define DRIVER_VERSION "v0.0.5" 68#define DRIVER_VERSION "v0.0.6"
65#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" 69#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
66#define DRIVER_DESC "X-Box pad driver" 70#define DRIVER_DESC "X-Box pad driver"
67 71
68#define XPAD_PKT_LEN 32 72#define XPAD_PKT_LEN 32
69 73
74/* xbox d-pads should map to buttons, as is required for DDR pads
75 but we map them to axes when possible to simplify things */
76#define MAP_DPAD_TO_BUTTONS 0
77#define MAP_DPAD_TO_AXES 1
78#define MAP_DPAD_UNKNOWN -1
79
80static int dpad_to_buttons;
81module_param(dpad_to_buttons, bool, S_IRUGO);
82MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads");
83
70static const struct xpad_device { 84static const struct xpad_device {
71 u16 idVendor; 85 u16 idVendor;
72 u16 idProduct; 86 u16 idProduct;
73 char *name; 87 char *name;
88 u8 dpad_mapping;
74} xpad_device[] = { 89} xpad_device[] = {
75 { 0x045e, 0x0202, "Microsoft X-Box pad (US)" }, 90 { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES },
76 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)" }, 91 { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES },
77 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)" }, 92 { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES },
78 { 0x0000, 0x0000, "X-Box pad" } 93 { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES },
94 { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS },
95 { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN }
79}; 96};
80 97
81static const signed short xpad_btn[] = { 98static const signed short xpad_btn[] = {
@@ -84,11 +101,23 @@ static const signed short xpad_btn[] = {
84 -1 /* terminating entry */ 101 -1 /* terminating entry */
85}; 102};
86 103
104/* only used if MAP_DPAD_TO_BUTTONS */
105static const signed short xpad_btn_pad[] = {
106 BTN_LEFT, BTN_RIGHT, /* d-pad left, right */
107 BTN_0, BTN_1, /* d-pad up, down (XXX names??) */
108 -1 /* terminating entry */
109};
110
87static const signed short xpad_abs[] = { 111static const signed short xpad_abs[] = {
88 ABS_X, ABS_Y, /* left stick */ 112 ABS_X, ABS_Y, /* left stick */
89 ABS_RX, ABS_RY, /* right stick */ 113 ABS_RX, ABS_RY, /* right stick */
90 ABS_Z, ABS_RZ, /* triggers left/right */ 114 ABS_Z, ABS_RZ, /* triggers left/right */
91 ABS_HAT0X, ABS_HAT0Y, /* digital pad */ 115 -1 /* terminating entry */
116};
117
118/* only used if MAP_DPAD_TO_AXES */
119static const signed short xpad_abs_pad[] = {
120 ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */
92 -1 /* terminating entry */ 121 -1 /* terminating entry */
93}; 122};
94 123
@@ -100,14 +129,16 @@ static struct usb_device_id xpad_table [] = {
100MODULE_DEVICE_TABLE (usb, xpad_table); 129MODULE_DEVICE_TABLE (usb, xpad_table);
101 130
102struct usb_xpad { 131struct usb_xpad {
103 struct input_dev *dev; /* input device interface */ 132 struct input_dev *dev; /* input device interface */
104 struct usb_device *udev; /* usb device */ 133 struct usb_device *udev; /* usb device */
105 134
106 struct urb *irq_in; /* urb for interrupt in report */ 135 struct urb *irq_in; /* urb for interrupt in report */
107 unsigned char *idata; /* input data */ 136 unsigned char *idata; /* input data */
108 dma_addr_t idata_dma; 137 dma_addr_t idata_dma;
109 138
110 char phys[65]; /* physical device path */ 139 char phys[65]; /* physical device path */
140
141 int dpad_mapping; /* map d-pad to buttons or to axes */
111}; 142};
112 143
113/* 144/*
@@ -137,14 +168,21 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
137 input_report_abs(dev, ABS_RZ, data[11]); 168 input_report_abs(dev, ABS_RZ, data[11]);
138 169
139 /* digital pad */ 170 /* digital pad */
140 input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); 171 if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
141 input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); 172 input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04));
173 input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01));
174 } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ {
175 input_report_key(dev, BTN_LEFT, data[2] & 0x04);
176 input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
177 input_report_key(dev, BTN_0, data[2] & 0x01); // up
178 input_report_key(dev, BTN_1, data[2] & 0x02); // down
179 }
142 180
143 /* start/back buttons and stick press left/right */ 181 /* start/back buttons and stick press left/right */
144 input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); 182 input_report_key(dev, BTN_START, data[2] & 0x10);
145 input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); 183 input_report_key(dev, BTN_BACK, data[2] & 0x20);
146 input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); 184 input_report_key(dev, BTN_THUMBL, data[2] & 0x40);
147 input_report_key(dev, BTN_THUMBR, data[2] >> 7); 185 input_report_key(dev, BTN_THUMBR, data[2] & 0x80);
148 186
149 /* "analog" buttons A, B, X, Y */ 187 /* "analog" buttons A, B, X, Y */
150 input_report_key(dev, BTN_A, data[4]); 188 input_report_key(dev, BTN_A, data[4]);
@@ -206,6 +244,28 @@ static void xpad_close (struct input_dev *dev)
206 usb_kill_urb(xpad->irq_in); 244 usb_kill_urb(xpad->irq_in);
207} 245}
208 246
247static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
248{
249 set_bit(abs, input_dev->absbit);
250
251 switch (abs) {
252 case ABS_X:
253 case ABS_Y:
254 case ABS_RX:
255 case ABS_RY: /* the two sticks */
256 input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128);
257 break;
258 case ABS_Z:
259 case ABS_RZ: /* the triggers */
260 input_set_abs_params(input_dev, abs, 0, 255, 0, 0);
261 break;
262 case ABS_HAT0X:
263 case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */
264 input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
265 break;
266 }
267}
268
209static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) 269static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id)
210{ 270{
211 struct usb_device *udev = interface_to_usbdev (intf); 271 struct usb_device *udev = interface_to_usbdev (intf);
@@ -235,6 +295,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
235 goto fail2; 295 goto fail2;
236 296
237 xpad->udev = udev; 297 xpad->udev = udev;
298 xpad->dpad_mapping = xpad_device[i].dpad_mapping;
299 if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
300 xpad->dpad_mapping = dpad_to_buttons;
238 xpad->dev = input_dev; 301 xpad->dev = input_dev;
239 usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); 302 usb_make_path(udev, xpad->phys, sizeof(xpad->phys));
240 strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); 303 strlcat(xpad->phys, "/input0", sizeof(xpad->phys));
@@ -249,32 +312,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
249 312
250 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 313 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
251 314
315 /* set up buttons */
252 for (i = 0; xpad_btn[i] >= 0; i++) 316 for (i = 0; xpad_btn[i] >= 0; i++)
253 set_bit(xpad_btn[i], input_dev->keybit); 317 set_bit(xpad_btn[i], input_dev->keybit);
318 if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS)
319 for (i = 0; xpad_btn_pad[i] >= 0; i++)
320 set_bit(xpad_btn_pad[i], input_dev->keybit);
254 321
255 for (i = 0; xpad_abs[i] >= 0; i++) { 322 /* set up axes */
256 323 for (i = 0; xpad_abs[i] >= 0; i++)
257 signed short t = xpad_abs[i]; 324 xpad_set_up_abs(input_dev, xpad_abs[i]);
258 325 if (xpad->dpad_mapping == MAP_DPAD_TO_AXES)
259 set_bit(t, input_dev->absbit); 326 for (i = 0; xpad_abs_pad[i] >= 0; i++)
260 327 xpad_set_up_abs(input_dev, xpad_abs_pad[i]);
261 switch (t) {
262 case ABS_X:
263 case ABS_Y:
264 case ABS_RX:
265 case ABS_RY: /* the two sticks */
266 input_set_abs_params(input_dev, t, -32768, 32767, 16, 128);
267 break;
268 case ABS_Z:
269 case ABS_RZ: /* the triggers */
270 input_set_abs_params(input_dev, t, 0, 255, 0, 0);
271 break;
272 case ABS_HAT0X:
273 case ABS_HAT0Y: /* the d-pad */
274 input_set_abs_params(input_dev, t, -1, 1, 0, 0);
275 break;
276 }
277 }
278 328
279 ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; 329 ep_irq_in = &intf->cur_altsetting->endpoint[0].desc;
280 usb_fill_int_urb(xpad->irq_in, udev, 330 usb_fill_int_urb(xpad->irq_in, udev,
@@ -305,7 +355,8 @@ static void xpad_disconnect(struct usb_interface *intf)
305 usb_kill_urb(xpad->irq_in); 355 usb_kill_urb(xpad->irq_in);
306 input_unregister_device(xpad->dev); 356 input_unregister_device(xpad->dev);
307 usb_free_urb(xpad->irq_in); 357 usb_free_urb(xpad->irq_in);
308 usb_buffer_free(interface_to_usbdev(intf), XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); 358 usb_buffer_free(interface_to_usbdev(intf), XPAD_PKT_LEN,
359 xpad->idata, xpad->idata_dma);
309 kfree(xpad); 360 kfree(xpad);
310 } 361 }
311} 362}
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index c29658f69e2a..a74bf8617e7f 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -223,6 +223,16 @@ config USB_LD
223 To compile this driver as a module, choose M here: the 223 To compile this driver as a module, choose M here: the
224 module will be called ldusb. 224 module will be called ldusb.
225 225
226config USB_TRANCEVIBRATOR
227 tristate "PlayStation 2 Trance Vibrator driver support"
228 depends on USB
229 help
230 Say Y here if you want to connect a PlayStation 2 Trance Vibrator
231 device to your computer's USB port.
232
233 To compile this driver as a module, choose M here: the
234 module will be called trancevibrator.
235
226config USB_TEST 236config USB_TEST
227 tristate "USB testing driver (DEVELOPMENT)" 237 tristate "USB testing driver (DEVELOPMENT)"
228 depends on USB && USB_DEVICEFS && EXPERIMENTAL 238 depends on USB && USB_DEVICEFS && EXPERIMENTAL
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 2be70fa259bf..11dc59540cda 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_USB_PHIDGETMOTORCONTROL) += phidgetmotorcontrol.o
21obj-$(CONFIG_USB_PHIDGETSERVO) += phidgetservo.o 21obj-$(CONFIG_USB_PHIDGETSERVO) += phidgetservo.o
22obj-$(CONFIG_USB_RIO500) += rio500.o 22obj-$(CONFIG_USB_RIO500) += rio500.o
23obj-$(CONFIG_USB_TEST) += usbtest.o 23obj-$(CONFIG_USB_TEST) += usbtest.o
24obj-$(CONFIG_USB_TRANCEVIBRATOR) += trancevibrator.o
24obj-$(CONFIG_USB_USS720) += uss720.o 25obj-$(CONFIG_USB_USS720) += uss720.o
25 26
26obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ 27obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index aecd633fe9f6..af2934e016a7 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -370,7 +370,8 @@ static int adu_release(struct inode *inode, struct file *file)
370 retval = adu_release_internal(dev); 370 retval = adu_release_internal(dev);
371 371
372exit: 372exit:
373 up(&dev->sem); 373 if (dev)
374 up(&dev->sem);
374 dbg(2," %s : leave, return value %d", __FUNCTION__, retval); 375 dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
375 return retval; 376 return retval;
376} 377}
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 0eb26a26115b..9b591b8b9369 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -513,8 +513,6 @@ static void ftdi_elan_respond_work(void *data)
513 ftdi->disconnected += 1; 513 ftdi->disconnected += 1;
514 } else if (retval == -ENODEV) { 514 } else if (retval == -ENODEV) {
515 ftdi->disconnected += 1; 515 ftdi->disconnected += 1;
516 } else if (retval == -ENODEV) {
517 ftdi->disconnected += 1;
518 } else if (retval == -EILSEQ) { 516 } else if (retval == -EILSEQ) {
519 ftdi->disconnected += 1; 517 ftdi->disconnected += 1;
520 } else { 518 } else {
@@ -1186,11 +1184,8 @@ static ssize_t ftdi_elan_write(struct file *file,
1186 int retval = 0; 1184 int retval = 0;
1187 struct urb *urb; 1185 struct urb *urb;
1188 char *buf; 1186 char *buf;
1189 char data[30 *3 + 4]; 1187 struct usb_ftdi *ftdi = file->private_data;
1190 char *d = data; 1188
1191 const char __user *s = user_buffer;
1192 int m = (sizeof(data) - 1) / 3;
1193 struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data;
1194 if (ftdi->disconnected > 0) { 1189 if (ftdi->disconnected > 0) {
1195 return -ENODEV; 1190 return -ENODEV;
1196 } 1191 }
@@ -1220,27 +1215,18 @@ static ssize_t ftdi_elan_write(struct file *file,
1220 if (retval) { 1215 if (retval) {
1221 dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" 1216 dev_err(&ftdi->udev->dev, "failed submitting write urb, error %"
1222 "d\n", retval); 1217 "d\n", retval);
1223 goto error_4; 1218 goto error_3;
1224 } 1219 }
1225 usb_free_urb(urb); 1220 usb_free_urb(urb);
1226 exit:; 1221
1227 if (count > m) { 1222exit:
1228 int I = m - 1;
1229 while (I-- > 0) {
1230 d += sprintf(d, " %02X", 0x000000FF & *s++);
1231 }
1232 d += sprintf(d, " ..");
1233 } else {
1234 int I = count;
1235 while (I-- > 0) {
1236 d += sprintf(d, " %02X", 0x000000FF & *s++);
1237 }
1238 }
1239 return count; 1223 return count;
1240 error_4: error_3:usb_buffer_free(ftdi->udev, count, buf, 1224error_3:
1241 urb->transfer_dma); 1225 usb_buffer_free(ftdi->udev, count, buf, urb->transfer_dma);
1242 error_2:usb_free_urb(urb); 1226error_2:
1243 error_1:return retval; 1227 usb_free_urb(urb);
1228error_1:
1229 return retval;
1244} 1230}
1245 1231
1246static struct file_operations ftdi_elan_fops = { 1232static struct file_operations ftdi_elan_fops = {
diff --git a/drivers/usb/input/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index 33cd91d11eca..33cd91d11eca 100644
--- a/drivers/usb/input/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 054059632a21..454a186b64ad 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -207,6 +207,14 @@ config USB_NET_PLUSB
207 Choose this option if you're using a host-to-host cable 207 Choose this option if you're using a host-to-host cable
208 with one of these chips. 208 with one of these chips.
209 209
210config USB_NET_MCS7830
211 tristate "MosChip MCS7830 based Ethernet adapters"
212 depends on USB_USBNET
213 help
214 Choose this option if you're using a 10/100 Ethernet USB2
215 adapter based on the MosChip 7830 controller. This includes
216 adapters marketed under the DeLOCK brand.
217
210config USB_NET_RNDIS_HOST 218config USB_NET_RNDIS_HOST
211 tristate "Host for RNDIS devices (EXPERIMENTAL)" 219 tristate "Host for RNDIS devices (EXPERIMENTAL)"
212 depends on USB_USBNET && EXPERIMENTAL 220 depends on USB_USBNET && EXPERIMENTAL
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
index 160f19dbdf12..7b51964de171 100644
--- a/drivers/usb/net/Makefile
+++ b/drivers/usb/net/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
14obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o 14obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
15obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o 15obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
16obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o 16obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
17obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
17obj-$(CONFIG_USB_USBNET) += usbnet.o 18obj-$(CONFIG_USB_USBNET) += usbnet.o
18 19
19ifeq ($(CONFIG_USB_DEBUG),y) 20ifeq ($(CONFIG_USB_DEBUG),y)
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index c73dd224aa76..881841e600de 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -569,10 +569,12 @@ static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
569 struct usbnet *dev = netdev_priv(netdev); 569 struct usbnet *dev = netdev_priv(netdev);
570 u16 res; 570 u16 res;
571 571
572 mutex_lock(&dev->phy_mutex);
572 asix_set_sw_mii(dev); 573 asix_set_sw_mii(dev);
573 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, 574 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
574 (__u16)loc, 2, (u16 *)&res); 575 (__u16)loc, 2, (u16 *)&res);
575 asix_set_hw_mii(dev); 576 asix_set_hw_mii(dev);
577 mutex_unlock(&dev->phy_mutex);
576 578
577 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff)); 579 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff));
578 580
@@ -586,10 +588,12 @@ asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
586 u16 res = cpu_to_le16(val); 588 u16 res = cpu_to_le16(val);
587 589
588 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); 590 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val);
591 mutex_lock(&dev->phy_mutex);
589 asix_set_sw_mii(dev); 592 asix_set_sw_mii(dev);
590 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, 593 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
591 (__u16)loc, 2, (u16 *)&res); 594 (__u16)loc, 2, (u16 *)&res);
592 asix_set_hw_mii(dev); 595 asix_set_hw_mii(dev);
596 mutex_unlock(&dev->phy_mutex);
593} 597}
594 598
595/* Get the PHY Identifier from the PHYSID1 & PHYSID2 MII registers */ 599/* Get the PHY Identifier from the PHYSID1 & PHYSID2 MII registers */
@@ -700,32 +704,6 @@ static void asix_get_drvinfo (struct net_device *net,
700 info->eedump_len = data->eeprom_len; 704 info->eedump_len = data->eeprom_len;
701} 705}
702 706
703static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
704{
705 struct usbnet *dev = netdev_priv(net);
706
707 return mii_ethtool_gset(&dev->mii,cmd);
708}
709
710static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
711{
712 struct usbnet *dev = netdev_priv(net);
713 int res = mii_ethtool_sset(&dev->mii,cmd);
714
715 /* link speed/duplex might have changed */
716 if (dev->driver_info->link_reset)
717 dev->driver_info->link_reset(dev);
718
719 return res;
720}
721
722static int asix_nway_reset(struct net_device *net)
723{
724 struct usbnet *dev = netdev_priv(net);
725
726 return mii_nway_restart(&dev->mii);
727}
728
729static u32 asix_get_link(struct net_device *net) 707static u32 asix_get_link(struct net_device *net)
730{ 708{
731 struct usbnet *dev = netdev_priv(net); 709 struct usbnet *dev = netdev_priv(net);
@@ -746,15 +724,15 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
746static struct ethtool_ops ax88172_ethtool_ops = { 724static struct ethtool_ops ax88172_ethtool_ops = {
747 .get_drvinfo = asix_get_drvinfo, 725 .get_drvinfo = asix_get_drvinfo,
748 .get_link = asix_get_link, 726 .get_link = asix_get_link,
749 .nway_reset = asix_nway_reset,
750 .get_msglevel = usbnet_get_msglevel, 727 .get_msglevel = usbnet_get_msglevel,
751 .set_msglevel = usbnet_set_msglevel, 728 .set_msglevel = usbnet_set_msglevel,
752 .get_wol = asix_get_wol, 729 .get_wol = asix_get_wol,
753 .set_wol = asix_set_wol, 730 .set_wol = asix_set_wol,
754 .get_eeprom_len = asix_get_eeprom_len, 731 .get_eeprom_len = asix_get_eeprom_len,
755 .get_eeprom = asix_get_eeprom, 732 .get_eeprom = asix_get_eeprom,
756 .get_settings = asix_get_settings, 733 .get_settings = usbnet_get_settings,
757 .set_settings = asix_set_settings, 734 .set_settings = usbnet_set_settings,
735 .nway_reset = usbnet_nway_reset,
758}; 736};
759 737
760static void ax88172_set_multicast(struct net_device *net) 738static void ax88172_set_multicast(struct net_device *net)
@@ -885,15 +863,15 @@ out1:
885static struct ethtool_ops ax88772_ethtool_ops = { 863static struct ethtool_ops ax88772_ethtool_ops = {
886 .get_drvinfo = asix_get_drvinfo, 864 .get_drvinfo = asix_get_drvinfo,
887 .get_link = asix_get_link, 865 .get_link = asix_get_link,
888 .nway_reset = asix_nway_reset,
889 .get_msglevel = usbnet_get_msglevel, 866 .get_msglevel = usbnet_get_msglevel,
890 .set_msglevel = usbnet_set_msglevel, 867 .set_msglevel = usbnet_set_msglevel,
891 .get_wol = asix_get_wol, 868 .get_wol = asix_get_wol,
892 .set_wol = asix_set_wol, 869 .set_wol = asix_set_wol,
893 .get_eeprom_len = asix_get_eeprom_len, 870 .get_eeprom_len = asix_get_eeprom_len,
894 .get_eeprom = asix_get_eeprom, 871 .get_eeprom = asix_get_eeprom,
895 .get_settings = asix_get_settings, 872 .get_settings = usbnet_get_settings,
896 .set_settings = asix_set_settings, 873 .set_settings = usbnet_set_settings,
874 .nway_reset = usbnet_nway_reset,
897}; 875};
898 876
899static int ax88772_link_reset(struct usbnet *dev) 877static int ax88772_link_reset(struct usbnet *dev)
@@ -1046,15 +1024,15 @@ out1:
1046static struct ethtool_ops ax88178_ethtool_ops = { 1024static struct ethtool_ops ax88178_ethtool_ops = {
1047 .get_drvinfo = asix_get_drvinfo, 1025 .get_drvinfo = asix_get_drvinfo,
1048 .get_link = asix_get_link, 1026 .get_link = asix_get_link,
1049 .nway_reset = asix_nway_reset,
1050 .get_msglevel = usbnet_get_msglevel, 1027 .get_msglevel = usbnet_get_msglevel,
1051 .set_msglevel = usbnet_set_msglevel, 1028 .set_msglevel = usbnet_set_msglevel,
1052 .get_wol = asix_get_wol, 1029 .get_wol = asix_get_wol,
1053 .set_wol = asix_set_wol, 1030 .set_wol = asix_set_wol,
1054 .get_eeprom_len = asix_get_eeprom_len, 1031 .get_eeprom_len = asix_get_eeprom_len,
1055 .get_eeprom = asix_get_eeprom, 1032 .get_eeprom = asix_get_eeprom,
1056 .get_settings = asix_get_settings, 1033 .get_settings = usbnet_get_settings,
1057 .set_settings = asix_set_settings, 1034 .set_settings = usbnet_set_settings,
1035 .nway_reset = usbnet_nway_reset,
1058}; 1036};
1059 1037
1060static int marvell_phy_init(struct usbnet *dev) 1038static int marvell_phy_init(struct usbnet *dev)
diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c
index 82ce0358d9a3..f6971b88349d 100644
--- a/drivers/usb/net/cdc_ether.c
+++ b/drivers/usb/net/cdc_ether.c
@@ -498,7 +498,7 @@ static struct usb_driver cdc_driver = {
498 498
499static int __init cdc_init(void) 499static int __init cdc_init(void)
500{ 500{
501 BUG_ON((sizeof(((struct usbnet *)0)->data) 501 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
502 < sizeof(struct cdc_state))); 502 < sizeof(struct cdc_state)));
503 503
504 return usb_register(&cdc_driver); 504 return usb_register(&cdc_driver);
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
index 957d4ad316f9..7c906a43e497 100644
--- a/drivers/usb/net/kaweth.c
+++ b/drivers/usb/net/kaweth.c
@@ -65,16 +65,6 @@
65 65
66#undef DEBUG 66#undef DEBUG
67 67
68#ifdef DEBUG
69#define kaweth_dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format "\n" ,##arg)
70#else
71#define kaweth_dbg(format, arg...) do {} while (0)
72#endif
73#define kaweth_err(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" ,##arg)
74#define kaweth_info(format, arg...) printk(KERN_INFO __FILE__ ": " format "\n" , ##arg)
75#define kaweth_warn(format, arg...) printk(KERN_WARNING __FILE__ ": " format "\n" , ##arg)
76
77
78#include "kawethfw.h" 68#include "kawethfw.h"
79 69
80#define KAWETH_MTU 1514 70#define KAWETH_MTU 1514
@@ -86,6 +76,9 @@
86 76
87#define KAWETH_STATUS_BROKEN 0x0000001 77#define KAWETH_STATUS_BROKEN 0x0000001
88#define KAWETH_STATUS_CLOSING 0x0000002 78#define KAWETH_STATUS_CLOSING 0x0000002
79#define KAWETH_STATUS_SUSPENDING 0x0000004
80
81#define KAWETH_STATUS_BLOCKED (KAWETH_STATUS_CLOSING | KAWETH_STATUS_SUSPENDING)
89 82
90#define KAWETH_PACKET_FILTER_PROMISCUOUS 0x01 83#define KAWETH_PACKET_FILTER_PROMISCUOUS 0x01
91#define KAWETH_PACKET_FILTER_ALL_MULTICAST 0x02 84#define KAWETH_PACKET_FILTER_ALL_MULTICAST 0x02
@@ -112,6 +105,8 @@
112#define STATE_MASK 0x40 105#define STATE_MASK 0x40
113#define STATE_SHIFT 5 106#define STATE_SHIFT 5
114 107
108#define IS_BLOCKED(s) (s & KAWETH_STATUS_BLOCKED)
109
115 110
116MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>"); 111MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>");
117MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver"); 112MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver");
@@ -128,6 +123,8 @@ static int kaweth_internal_control_msg(struct usb_device *usb_dev,
128 unsigned int pipe, 123 unsigned int pipe,
129 struct usb_ctrlrequest *cmd, void *data, 124 struct usb_ctrlrequest *cmd, void *data,
130 int len, int timeout); 125 int len, int timeout);
126static int kaweth_suspend(struct usb_interface *intf, pm_message_t message);
127static int kaweth_resume(struct usb_interface *intf);
131 128
132/**************************************************************** 129/****************************************************************
133 * usb_device_id 130 * usb_device_id
@@ -179,6 +176,8 @@ static struct usb_driver kaweth_driver = {
179 .name = driver_name, 176 .name = driver_name,
180 .probe = kaweth_probe, 177 .probe = kaweth_probe,
181 .disconnect = kaweth_disconnect, 178 .disconnect = kaweth_disconnect,
179 .suspend = kaweth_suspend,
180 .resume = kaweth_resume,
182 .id_table = usb_klsi_table, 181 .id_table = usb_klsi_table,
183}; 182};
184 183
@@ -222,6 +221,7 @@ struct kaweth_device
222 int suspend_lowmem_rx; 221 int suspend_lowmem_rx;
223 int suspend_lowmem_ctrl; 222 int suspend_lowmem_ctrl;
224 int linkstate; 223 int linkstate;
224 int opened;
225 struct work_struct lowmem_work; 225 struct work_struct lowmem_work;
226 226
227 struct usb_device *dev; 227 struct usb_device *dev;
@@ -265,17 +265,17 @@ static int kaweth_control(struct kaweth_device *kaweth,
265{ 265{
266 struct usb_ctrlrequest *dr; 266 struct usb_ctrlrequest *dr;
267 267
268 kaweth_dbg("kaweth_control()"); 268 dbg("kaweth_control()");
269 269
270 if(in_interrupt()) { 270 if(in_interrupt()) {
271 kaweth_dbg("in_interrupt()"); 271 dbg("in_interrupt()");
272 return -EBUSY; 272 return -EBUSY;
273 } 273 }
274 274
275 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); 275 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
276 276
277 if (!dr) { 277 if (!dr) {
278 kaweth_dbg("kmalloc() failed"); 278 dbg("kmalloc() failed");
279 return -ENOMEM; 279 return -ENOMEM;
280 } 280 }
281 281
@@ -300,7 +300,7 @@ static int kaweth_read_configuration(struct kaweth_device *kaweth)
300{ 300{
301 int retval; 301 int retval;
302 302
303 kaweth_dbg("Reading kaweth configuration"); 303 dbg("Reading kaweth configuration");
304 304
305 retval = kaweth_control(kaweth, 305 retval = kaweth_control(kaweth,
306 usb_rcvctrlpipe(kaweth->dev, 0), 306 usb_rcvctrlpipe(kaweth->dev, 0),
@@ -322,7 +322,7 @@ static int kaweth_set_urb_size(struct kaweth_device *kaweth, __u16 urb_size)
322{ 322{
323 int retval; 323 int retval;
324 324
325 kaweth_dbg("Setting URB size to %d", (unsigned)urb_size); 325 dbg("Setting URB size to %d", (unsigned)urb_size);
326 326
327 retval = kaweth_control(kaweth, 327 retval = kaweth_control(kaweth,
328 usb_sndctrlpipe(kaweth->dev, 0), 328 usb_sndctrlpipe(kaweth->dev, 0),
@@ -344,7 +344,7 @@ static int kaweth_set_sofs_wait(struct kaweth_device *kaweth, __u16 sofs_wait)
344{ 344{
345 int retval; 345 int retval;
346 346
347 kaweth_dbg("Set SOFS wait to %d", (unsigned)sofs_wait); 347 dbg("Set SOFS wait to %d", (unsigned)sofs_wait);
348 348
349 retval = kaweth_control(kaweth, 349 retval = kaweth_control(kaweth,
350 usb_sndctrlpipe(kaweth->dev, 0), 350 usb_sndctrlpipe(kaweth->dev, 0),
@@ -367,7 +367,7 @@ static int kaweth_set_receive_filter(struct kaweth_device *kaweth,
367{ 367{
368 int retval; 368 int retval;
369 369
370 kaweth_dbg("Set receive filter to %d", (unsigned)receive_filter); 370 dbg("Set receive filter to %d", (unsigned)receive_filter);
371 371
372 retval = kaweth_control(kaweth, 372 retval = kaweth_control(kaweth,
373 usb_sndctrlpipe(kaweth->dev, 0), 373 usb_sndctrlpipe(kaweth->dev, 0),
@@ -392,7 +392,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
392 __u8 type) 392 __u8 type)
393{ 393{
394 if(data_len > KAWETH_FIRMWARE_BUF_SIZE) { 394 if(data_len > KAWETH_FIRMWARE_BUF_SIZE) {
395 kaweth_err("Firmware too big: %d", data_len); 395 err("Firmware too big: %d", data_len);
396 return -ENOSPC; 396 return -ENOSPC;
397 } 397 }
398 398
@@ -403,13 +403,13 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
403 kaweth->firmware_buf[4] = type; 403 kaweth->firmware_buf[4] = type;
404 kaweth->firmware_buf[5] = interrupt; 404 kaweth->firmware_buf[5] = interrupt;
405 405
406 kaweth_dbg("High: %i, Low:%i", kaweth->firmware_buf[3], 406 dbg("High: %i, Low:%i", kaweth->firmware_buf[3],
407 kaweth->firmware_buf[2]); 407 kaweth->firmware_buf[2]);
408 408
409 kaweth_dbg("Downloading firmware at %p to kaweth device at %p", 409 dbg("Downloading firmware at %p to kaweth device at %p",
410 data, 410 data,
411 kaweth); 411 kaweth);
412 kaweth_dbg("Firmware length: %d", data_len); 412 dbg("Firmware length: %d", data_len);
413 413
414 return kaweth_control(kaweth, 414 return kaweth_control(kaweth,
415 usb_sndctrlpipe(kaweth->dev, 0), 415 usb_sndctrlpipe(kaweth->dev, 0),
@@ -437,7 +437,7 @@ static int kaweth_trigger_firmware(struct kaweth_device *kaweth,
437 kaweth->firmware_buf[6] = 0x00; 437 kaweth->firmware_buf[6] = 0x00;
438 kaweth->firmware_buf[7] = 0x00; 438 kaweth->firmware_buf[7] = 0x00;
439 439
440 kaweth_dbg("Triggering firmware"); 440 dbg("Triggering firmware");
441 441
442 return kaweth_control(kaweth, 442 return kaweth_control(kaweth,
443 usb_sndctrlpipe(kaweth->dev, 0), 443 usb_sndctrlpipe(kaweth->dev, 0),
@@ -457,7 +457,7 @@ static int kaweth_reset(struct kaweth_device *kaweth)
457{ 457{
458 int result; 458 int result;
459 459
460 kaweth_dbg("kaweth_reset(%p)", kaweth); 460 dbg("kaweth_reset(%p)", kaweth);
461 result = kaweth_control(kaweth, 461 result = kaweth_control(kaweth,
462 usb_sndctrlpipe(kaweth->dev, 0), 462 usb_sndctrlpipe(kaweth->dev, 0),
463 USB_REQ_SET_CONFIGURATION, 463 USB_REQ_SET_CONFIGURATION,
@@ -470,7 +470,7 @@ static int kaweth_reset(struct kaweth_device *kaweth)
470 470
471 mdelay(10); 471 mdelay(10);
472 472
473 kaweth_dbg("kaweth_reset() returns %d.",result); 473 dbg("kaweth_reset() returns %d.",result);
474 474
475 return result; 475 return result;
476} 476}
@@ -534,7 +534,7 @@ static void kaweth_resubmit_tl(void *d)
534{ 534{
535 struct kaweth_device *kaweth = (struct kaweth_device *)d; 535 struct kaweth_device *kaweth = (struct kaweth_device *)d;
536 536
537 if (kaweth->status | KAWETH_STATUS_CLOSING) 537 if (IS_BLOCKED(kaweth->status))
538 return; 538 return;
539 539
540 if (kaweth->suspend_lowmem_rx) 540 if (kaweth->suspend_lowmem_rx)
@@ -568,7 +568,7 @@ static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
568 kaweth->suspend_lowmem_rx = 1; 568 kaweth->suspend_lowmem_rx = 1;
569 schedule_delayed_work(&kaweth->lowmem_work, HZ/4); 569 schedule_delayed_work(&kaweth->lowmem_work, HZ/4);
570 } 570 }
571 kaweth_err("resubmitting rx_urb %d failed", result); 571 err("resubmitting rx_urb %d failed", result);
572 } else { 572 } else {
573 kaweth->suspend_lowmem_rx = 0; 573 kaweth->suspend_lowmem_rx = 0;
574 } 574 }
@@ -601,11 +601,15 @@ static void kaweth_usb_receive(struct urb *urb)
601 return; 601 return;
602 } 602 }
603 603
604 if (kaweth->status & KAWETH_STATUS_CLOSING) 604 spin_lock(&kaweth->device_lock);
605 if (IS_BLOCKED(kaweth->status)) {
606 spin_unlock(&kaweth->device_lock);
605 return; 607 return;
608 }
609 spin_unlock(&kaweth->device_lock);
606 610
607 if(urb->status && urb->status != -EREMOTEIO && count != 1) { 611 if(urb->status && urb->status != -EREMOTEIO && count != 1) {
608 kaweth_err("%s RX status: %d count: %d packet_len: %d", 612 err("%s RX status: %d count: %d packet_len: %d",
609 net->name, 613 net->name,
610 urb->status, 614 urb->status,
611 count, 615 count,
@@ -616,9 +620,9 @@ static void kaweth_usb_receive(struct urb *urb)
616 620
617 if(kaweth->net && (count > 2)) { 621 if(kaweth->net && (count > 2)) {
618 if(pkt_len > (count - 2)) { 622 if(pkt_len > (count - 2)) {
619 kaweth_err("Packet length too long for USB frame (pkt_len: %x, count: %x)",pkt_len, count); 623 err("Packet length too long for USB frame (pkt_len: %x, count: %x)",pkt_len, count);
620 kaweth_err("Packet len & 2047: %x", pkt_len & 2047); 624 err("Packet len & 2047: %x", pkt_len & 2047);
621 kaweth_err("Count 2: %x", count2); 625 err("Count 2: %x", count2);
622 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC); 626 kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC);
623 return; 627 return;
624 } 628 }
@@ -655,7 +659,7 @@ static int kaweth_open(struct net_device *net)
655 struct kaweth_device *kaweth = netdev_priv(net); 659 struct kaweth_device *kaweth = netdev_priv(net);
656 int res; 660 int res;
657 661
658 kaweth_dbg("Opening network device."); 662 dbg("Opening network device.");
659 663
660 res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL); 664 res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL);
661 if (res) 665 if (res)
@@ -678,6 +682,7 @@ static int kaweth_open(struct net_device *net)
678 usb_kill_urb(kaweth->rx_urb); 682 usb_kill_urb(kaweth->rx_urb);
679 return -EIO; 683 return -EIO;
680 } 684 }
685 kaweth->opened = 1;
681 686
682 netif_start_queue(net); 687 netif_start_queue(net);
683 688
@@ -688,14 +693,8 @@ static int kaweth_open(struct net_device *net)
688/**************************************************************** 693/****************************************************************
689 * kaweth_close 694 * kaweth_close
690 ****************************************************************/ 695 ****************************************************************/
691static int kaweth_close(struct net_device *net) 696static void kaweth_kill_urbs(struct kaweth_device *kaweth)
692{ 697{
693 struct kaweth_device *kaweth = netdev_priv(net);
694
695 netif_stop_queue(net);
696
697 kaweth->status |= KAWETH_STATUS_CLOSING;
698
699 usb_kill_urb(kaweth->irq_urb); 698 usb_kill_urb(kaweth->irq_urb);
700 usb_kill_urb(kaweth->rx_urb); 699 usb_kill_urb(kaweth->rx_urb);
701 usb_kill_urb(kaweth->tx_urb); 700 usb_kill_urb(kaweth->tx_urb);
@@ -706,6 +705,21 @@ static int kaweth_close(struct net_device *net)
706 we hit them again */ 705 we hit them again */
707 usb_kill_urb(kaweth->irq_urb); 706 usb_kill_urb(kaweth->irq_urb);
708 usb_kill_urb(kaweth->rx_urb); 707 usb_kill_urb(kaweth->rx_urb);
708}
709
710/****************************************************************
711 * kaweth_close
712 ****************************************************************/
713static int kaweth_close(struct net_device *net)
714{
715 struct kaweth_device *kaweth = netdev_priv(net);
716
717 netif_stop_queue(net);
718 kaweth->opened = 0;
719
720 kaweth->status |= KAWETH_STATUS_CLOSING;
721
722 kaweth_kill_urbs(kaweth);
709 723
710 kaweth->status &= ~KAWETH_STATUS_CLOSING; 724 kaweth->status &= ~KAWETH_STATUS_CLOSING;
711 725
@@ -732,7 +746,7 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
732 746
733 if (unlikely(urb->status != 0)) 747 if (unlikely(urb->status != 0))
734 if (urb->status != -ENOENT) 748 if (urb->status != -ENOENT)
735 kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status); 749 dbg("%s: TX status %d.", kaweth->net->name, urb->status);
736 750
737 netif_wake_queue(kaweth->net); 751 netif_wake_queue(kaweth->net);
738 dev_kfree_skb_irq(skb); 752 dev_kfree_skb_irq(skb);
@@ -752,6 +766,9 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
752 766
753 kaweth_async_set_rx_mode(kaweth); 767 kaweth_async_set_rx_mode(kaweth);
754 netif_stop_queue(net); 768 netif_stop_queue(net);
769 if (IS_BLOCKED(kaweth->status)) {
770 goto skip;
771 }
755 772
756 /* We now decide whether we can put our special header into the sk_buff */ 773 /* We now decide whether we can put our special header into the sk_buff */
757 if (skb_cloned(skb) || skb_headroom(skb) < 2) { 774 if (skb_cloned(skb) || skb_headroom(skb) < 2) {
@@ -783,7 +800,8 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
783 800
784 if((res = usb_submit_urb(kaweth->tx_urb, GFP_ATOMIC))) 801 if((res = usb_submit_urb(kaweth->tx_urb, GFP_ATOMIC)))
785 { 802 {
786 kaweth_warn("kaweth failed tx_urb %d", res); 803 warn("kaweth failed tx_urb %d", res);
804skip:
787 kaweth->stats.tx_errors++; 805 kaweth->stats.tx_errors++;
788 806
789 netif_start_queue(net); 807 netif_start_queue(net);
@@ -812,7 +830,7 @@ static void kaweth_set_rx_mode(struct net_device *net)
812 KAWETH_PACKET_FILTER_BROADCAST | 830 KAWETH_PACKET_FILTER_BROADCAST |
813 KAWETH_PACKET_FILTER_MULTICAST; 831 KAWETH_PACKET_FILTER_MULTICAST;
814 832
815 kaweth_dbg("Setting Rx mode to %d", packet_filter_bitmap); 833 dbg("Setting Rx mode to %d", packet_filter_bitmap);
816 834
817 netif_stop_queue(net); 835 netif_stop_queue(net);
818 836
@@ -850,10 +868,10 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
850 KAWETH_CONTROL_TIMEOUT); 868 KAWETH_CONTROL_TIMEOUT);
851 869
852 if(result < 0) { 870 if(result < 0) {
853 kaweth_err("Failed to set Rx mode: %d", result); 871 err("Failed to set Rx mode: %d", result);
854 } 872 }
855 else { 873 else {
856 kaweth_dbg("Set Rx mode to %d", packet_filter_bitmap); 874 dbg("Set Rx mode to %d", packet_filter_bitmap);
857 } 875 }
858 } 876 }
859} 877}
@@ -874,7 +892,7 @@ static void kaweth_tx_timeout(struct net_device *net)
874{ 892{
875 struct kaweth_device *kaweth = netdev_priv(net); 893 struct kaweth_device *kaweth = netdev_priv(net);
876 894
877 kaweth_warn("%s: Tx timed out. Resetting.", net->name); 895 warn("%s: Tx timed out. Resetting.", net->name);
878 kaweth->stats.tx_errors++; 896 kaweth->stats.tx_errors++;
879 net->trans_start = jiffies; 897 net->trans_start = jiffies;
880 898
@@ -882,6 +900,42 @@ static void kaweth_tx_timeout(struct net_device *net)
882} 900}
883 901
884/**************************************************************** 902/****************************************************************
903 * kaweth_suspend
904 ****************************************************************/
905static int kaweth_suspend(struct usb_interface *intf, pm_message_t message)
906{
907 struct kaweth_device *kaweth = usb_get_intfdata(intf);
908 unsigned long flags;
909
910 spin_lock_irqsave(&kaweth->device_lock, flags);
911 kaweth->status |= KAWETH_STATUS_SUSPENDING;
912 spin_unlock_irqrestore(&kaweth->device_lock, flags);
913
914 kaweth_kill_urbs(kaweth);
915 return 0;
916}
917
918/****************************************************************
919 * kaweth_resume
920 ****************************************************************/
921static int kaweth_resume(struct usb_interface *intf)
922{
923 struct kaweth_device *kaweth = usb_get_intfdata(intf);
924 unsigned long flags;
925
926 spin_lock_irqsave(&kaweth->device_lock, flags);
927 kaweth->status &= ~KAWETH_STATUS_SUSPENDING;
928 spin_unlock_irqrestore(&kaweth->device_lock, flags);
929
930 if (!kaweth->opened)
931 return 0;
932 kaweth_resubmit_rx_urb(kaweth, GFP_NOIO);
933 kaweth_resubmit_int_urb(kaweth, GFP_NOIO);
934
935 return 0;
936}
937
938/****************************************************************
885 * kaweth_probe 939 * kaweth_probe
886 ****************************************************************/ 940 ****************************************************************/
887static int kaweth_probe( 941static int kaweth_probe(
@@ -895,15 +949,15 @@ static int kaweth_probe(
895 const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 949 const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
896 int result = 0; 950 int result = 0;
897 951
898 kaweth_dbg("Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x", 952 dbg("Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x",
899 dev->devnum, 953 dev->devnum,
900 le16_to_cpu(dev->descriptor.idVendor), 954 le16_to_cpu(dev->descriptor.idVendor),
901 le16_to_cpu(dev->descriptor.idProduct), 955 le16_to_cpu(dev->descriptor.idProduct),
902 le16_to_cpu(dev->descriptor.bcdDevice)); 956 le16_to_cpu(dev->descriptor.bcdDevice));
903 957
904 kaweth_dbg("Device at %p", dev); 958 dbg("Device at %p", dev);
905 959
906 kaweth_dbg("Descriptor length: %x type: %x", 960 dbg("Descriptor length: %x type: %x",
907 (int)dev->descriptor.bLength, 961 (int)dev->descriptor.bLength,
908 (int)dev->descriptor.bDescriptorType); 962 (int)dev->descriptor.bDescriptorType);
909 963
@@ -918,7 +972,7 @@ static int kaweth_probe(
918 spin_lock_init(&kaweth->device_lock); 972 spin_lock_init(&kaweth->device_lock);
919 init_waitqueue_head(&kaweth->term_wait); 973 init_waitqueue_head(&kaweth->term_wait);
920 974
921 kaweth_dbg("Resetting."); 975 dbg("Resetting.");
922 976
923 kaweth_reset(kaweth); 977 kaweth_reset(kaweth);
924 978
@@ -928,17 +982,17 @@ static int kaweth_probe(
928 */ 982 */
929 983
930 if (le16_to_cpu(dev->descriptor.bcdDevice) >> 8) { 984 if (le16_to_cpu(dev->descriptor.bcdDevice) >> 8) {
931 kaweth_info("Firmware present in device."); 985 info("Firmware present in device.");
932 } else { 986 } else {
933 /* Download the firmware */ 987 /* Download the firmware */
934 kaweth_info("Downloading firmware..."); 988 info("Downloading firmware...");
935 kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL); 989 kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
936 if ((result = kaweth_download_firmware(kaweth, 990 if ((result = kaweth_download_firmware(kaweth,
937 kaweth_new_code, 991 kaweth_new_code,
938 len_kaweth_new_code, 992 len_kaweth_new_code,
939 100, 993 100,
940 2)) < 0) { 994 2)) < 0) {
941 kaweth_err("Error downloading firmware (%d)", result); 995 err("Error downloading firmware (%d)", result);
942 goto err_fw; 996 goto err_fw;
943 } 997 }
944 998
@@ -947,7 +1001,7 @@ static int kaweth_probe(
947 len_kaweth_new_code_fix, 1001 len_kaweth_new_code_fix,
948 100, 1002 100,
949 3)) < 0) { 1003 3)) < 0) {
950 kaweth_err("Error downloading firmware fix (%d)", result); 1004 err("Error downloading firmware fix (%d)", result);
951 goto err_fw; 1005 goto err_fw;
952 } 1006 }
953 1007
@@ -956,7 +1010,7 @@ static int kaweth_probe(
956 len_kaweth_trigger_code, 1010 len_kaweth_trigger_code,
957 126, 1011 126,
958 2)) < 0) { 1012 2)) < 0) {
959 kaweth_err("Error downloading trigger code (%d)", result); 1013 err("Error downloading trigger code (%d)", result);
960 goto err_fw; 1014 goto err_fw;
961 1015
962 } 1016 }
@@ -966,18 +1020,18 @@ static int kaweth_probe(
966 len_kaweth_trigger_code_fix, 1020 len_kaweth_trigger_code_fix,
967 126, 1021 126,
968 3)) < 0) { 1022 3)) < 0) {
969 kaweth_err("Error downloading trigger code fix (%d)", result); 1023 err("Error downloading trigger code fix (%d)", result);
970 goto err_fw; 1024 goto err_fw;
971 } 1025 }
972 1026
973 1027
974 if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) { 1028 if ((result = kaweth_trigger_firmware(kaweth, 126)) < 0) {
975 kaweth_err("Error triggering firmware (%d)", result); 1029 err("Error triggering firmware (%d)", result);
976 goto err_fw; 1030 goto err_fw;
977 } 1031 }
978 1032
979 /* Device will now disappear for a moment... */ 1033 /* Device will now disappear for a moment... */
980 kaweth_info("Firmware loaded. I'll be back..."); 1034 info("Firmware loaded. I'll be back...");
981err_fw: 1035err_fw:
982 free_page((unsigned long)kaweth->firmware_buf); 1036 free_page((unsigned long)kaweth->firmware_buf);
983 free_netdev(netdev); 1037 free_netdev(netdev);
@@ -987,14 +1041,14 @@ err_fw:
987 result = kaweth_read_configuration(kaweth); 1041 result = kaweth_read_configuration(kaweth);
988 1042
989 if(result < 0) { 1043 if(result < 0) {
990 kaweth_err("Error reading configuration (%d), no net device created", result); 1044 err("Error reading configuration (%d), no net device created", result);
991 goto err_free_netdev; 1045 goto err_free_netdev;
992 } 1046 }
993 1047
994 kaweth_info("Statistics collection: %x", kaweth->configuration.statistics_mask); 1048 info("Statistics collection: %x", kaweth->configuration.statistics_mask);
995 kaweth_info("Multicast filter limit: %x", kaweth->configuration.max_multicast_filters & ((1 << 15) - 1)); 1049 info("Multicast filter limit: %x", kaweth->configuration.max_multicast_filters & ((1 << 15) - 1));
996 kaweth_info("MTU: %d", le16_to_cpu(kaweth->configuration.segment_size)); 1050 info("MTU: %d", le16_to_cpu(kaweth->configuration.segment_size));
997 kaweth_info("Read MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", 1051 info("Read MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
998 (int)kaweth->configuration.hw_addr[0], 1052 (int)kaweth->configuration.hw_addr[0],
999 (int)kaweth->configuration.hw_addr[1], 1053 (int)kaweth->configuration.hw_addr[1],
1000 (int)kaweth->configuration.hw_addr[2], 1054 (int)kaweth->configuration.hw_addr[2],
@@ -1005,17 +1059,17 @@ err_fw:
1005 if(!memcmp(&kaweth->configuration.hw_addr, 1059 if(!memcmp(&kaweth->configuration.hw_addr,
1006 &bcast_addr, 1060 &bcast_addr,
1007 sizeof(bcast_addr))) { 1061 sizeof(bcast_addr))) {
1008 kaweth_err("Firmware not functioning properly, no net device created"); 1062 err("Firmware not functioning properly, no net device created");
1009 goto err_free_netdev; 1063 goto err_free_netdev;
1010 } 1064 }
1011 1065
1012 if(kaweth_set_urb_size(kaweth, KAWETH_BUF_SIZE) < 0) { 1066 if(kaweth_set_urb_size(kaweth, KAWETH_BUF_SIZE) < 0) {
1013 kaweth_dbg("Error setting URB size"); 1067 dbg("Error setting URB size");
1014 goto err_free_netdev; 1068 goto err_free_netdev;
1015 } 1069 }
1016 1070
1017 if(kaweth_set_sofs_wait(kaweth, KAWETH_SOFS_TO_WAIT) < 0) { 1071 if(kaweth_set_sofs_wait(kaweth, KAWETH_SOFS_TO_WAIT) < 0) {
1018 kaweth_err("Error setting SOFS wait"); 1072 err("Error setting SOFS wait");
1019 goto err_free_netdev; 1073 goto err_free_netdev;
1020 } 1074 }
1021 1075
@@ -1025,11 +1079,11 @@ err_fw:
1025 KAWETH_PACKET_FILTER_MULTICAST); 1079 KAWETH_PACKET_FILTER_MULTICAST);
1026 1080
1027 if(result < 0) { 1081 if(result < 0) {
1028 kaweth_err("Error setting receive filter"); 1082 err("Error setting receive filter");
1029 goto err_free_netdev; 1083 goto err_free_netdev;
1030 } 1084 }
1031 1085
1032 kaweth_dbg("Initializing net device."); 1086 dbg("Initializing net device.");
1033 1087
1034 kaweth->tx_urb = usb_alloc_urb(0, GFP_KERNEL); 1088 kaweth->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
1035 if (!kaweth->tx_urb) 1089 if (!kaweth->tx_urb)
@@ -1086,13 +1140,13 @@ err_fw:
1086 1140
1087 SET_NETDEV_DEV(netdev, &intf->dev); 1141 SET_NETDEV_DEV(netdev, &intf->dev);
1088 if (register_netdev(netdev) != 0) { 1142 if (register_netdev(netdev) != 0) {
1089 kaweth_err("Error registering netdev."); 1143 err("Error registering netdev.");
1090 goto err_intfdata; 1144 goto err_intfdata;
1091 } 1145 }
1092 1146
1093 kaweth_info("kaweth interface created at %s", kaweth->net->name); 1147 info("kaweth interface created at %s", kaweth->net->name);
1094 1148
1095 kaweth_dbg("Kaweth probe returning."); 1149 dbg("Kaweth probe returning.");
1096 1150
1097 return 0; 1151 return 0;
1098 1152
@@ -1121,16 +1175,16 @@ static void kaweth_disconnect(struct usb_interface *intf)
1121 struct kaweth_device *kaweth = usb_get_intfdata(intf); 1175 struct kaweth_device *kaweth = usb_get_intfdata(intf);
1122 struct net_device *netdev; 1176 struct net_device *netdev;
1123 1177
1124 kaweth_info("Unregistering"); 1178 info("Unregistering");
1125 1179
1126 usb_set_intfdata(intf, NULL); 1180 usb_set_intfdata(intf, NULL);
1127 if (!kaweth) { 1181 if (!kaweth) {
1128 kaweth_warn("unregistering non-existant device"); 1182 warn("unregistering non-existant device");
1129 return; 1183 return;
1130 } 1184 }
1131 netdev = kaweth->net; 1185 netdev = kaweth->net;
1132 1186
1133 kaweth_dbg("Unregistering net device"); 1187 dbg("Unregistering net device");
1134 unregister_netdev(netdev); 1188 unregister_netdev(netdev);
1135 1189
1136 usb_free_urb(kaweth->rx_urb); 1190 usb_free_urb(kaweth->rx_urb);
@@ -1185,7 +1239,7 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
1185 1239
1186 if (!wait_event_timeout(awd.wqh, awd.done, timeout)) { 1240 if (!wait_event_timeout(awd.wqh, awd.done, timeout)) {
1187 // timeout 1241 // timeout
1188 kaweth_warn("usb_control/bulk_msg: timeout"); 1242 warn("usb_control/bulk_msg: timeout");
1189 usb_kill_urb(urb); // remove urb safely 1243 usb_kill_urb(urb); // remove urb safely
1190 status = -ETIMEDOUT; 1244 status = -ETIMEDOUT;
1191 } 1245 }
@@ -1234,7 +1288,7 @@ static int kaweth_internal_control_msg(struct usb_device *usb_dev,
1234 ****************************************************************/ 1288 ****************************************************************/
1235static int __init kaweth_init(void) 1289static int __init kaweth_init(void)
1236{ 1290{
1237 kaweth_dbg("Driver loading"); 1291 dbg("Driver loading");
1238 return usb_register(&kaweth_driver); 1292 return usb_register(&kaweth_driver);
1239} 1293}
1240 1294
diff --git a/drivers/usb/net/mcs7830.c b/drivers/usb/net/mcs7830.c
new file mode 100644
index 000000000000..6240b978fe3d
--- /dev/null
+++ b/drivers/usb/net/mcs7830.c
@@ -0,0 +1,534 @@
1/*
2 * MosChips MCS7830 based USB 2.0 Ethernet Devices
3 *
4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver
5 *
6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>
7 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
8 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
9 * Copyright (c) 2002-2003 TiVo Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/crc32.h>
27#include <linux/etherdevice.h>
28#include <linux/ethtool.h>
29#include <linux/init.h>
30#include <linux/mii.h>
31#include <linux/module.h>
32#include <linux/netdevice.h>
33#include <linux/usb.h>
34
35#include "usbnet.h"
36
37/* requests */
38#define MCS7830_RD_BMREQ (USB_DIR_IN | USB_TYPE_VENDOR | \
39 USB_RECIP_DEVICE)
40#define MCS7830_WR_BMREQ (USB_DIR_OUT | USB_TYPE_VENDOR | \
41 USB_RECIP_DEVICE)
42#define MCS7830_RD_BREQ 0x0E
43#define MCS7830_WR_BREQ 0x0D
44
45#define MCS7830_CTRL_TIMEOUT 1000
46#define MCS7830_MAX_MCAST 64
47
48#define MCS7830_VENDOR_ID 0x9710
49#define MCS7830_PRODUCT_ID 0x7830
50
51#define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \
52 ADVERTISE_100HALF | ADVERTISE_10FULL | \
53 ADVERTISE_10HALF | ADVERTISE_CSMA)
54
55/* HIF_REG_XX coressponding index value */
56enum {
57 HIF_REG_MULTICAST_HASH = 0x00,
58 HIF_REG_PACKET_GAP1 = 0x08,
59 HIF_REG_PACKET_GAP2 = 0x09,
60 HIF_REG_PHY_DATA = 0x0a,
61 HIF_REG_PHY_CMD1 = 0x0c,
62 HIF_REG_PHY_CMD1_READ = 0x40,
63 HIF_REG_PHY_CMD1_WRITE = 0x20,
64 HIF_REG_PHY_CMD1_PHYADDR = 0x01,
65 HIF_REG_PHY_CMD2 = 0x0d,
66 HIF_REG_PHY_CMD2_PEND_FLAG_BIT = 0x80,
67 HIF_REG_PHY_CMD2_READY_FLAG_BIT = 0x40,
68 HIF_REG_CONFIG = 0x0e,
69 HIF_REG_CONFIG_CFG = 0x80,
70 HIF_REG_CONFIG_SPEED100 = 0x40,
71 HIF_REG_CONFIG_FULLDUPLEX_ENABLE = 0x20,
72 HIF_REG_CONFIG_RXENABLE = 0x10,
73 HIF_REG_CONFIG_TXENABLE = 0x08,
74 HIF_REG_CONFIG_SLEEPMODE = 0x04,
75 HIF_REG_CONFIG_ALLMULTICAST = 0x02,
76 HIF_REG_CONFIG_PROMISCIOUS = 0x01,
77 HIF_REG_ETHERNET_ADDR = 0x0f,
78 HIF_REG_22 = 0x15,
79 HIF_REG_PAUSE_THRESHOLD = 0x16,
80 HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0,
81};
82
83struct mcs7830_data {
84 u8 multi_filter[8];
85 u8 config;
86};
87
88static const char driver_name[] = "MOSCHIP usb-ethernet driver";
89
90static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
91{
92 struct usb_device *xdev = dev->udev;
93 int ret;
94
95 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ,
96 MCS7830_RD_BMREQ, 0x0000, index, data,
97 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT));
98 return ret;
99}
100
101static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data)
102{
103 struct usb_device *xdev = dev->udev;
104 int ret;
105
106 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ,
107 MCS7830_WR_BMREQ, 0x0000, index, data,
108 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT));
109 return ret;
110}
111
112static void mcs7830_async_cmd_callback(struct urb *urb)
113{
114 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
115
116 if (urb->status < 0)
117 printk(KERN_DEBUG "mcs7830_async_cmd_callback() failed with %d",
118 urb->status);
119
120 kfree(req);
121 usb_free_urb(urb);
122}
123
124static void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void *data)
125{
126 struct usb_ctrlrequest *req;
127 int ret;
128 struct urb *urb;
129
130 urb = usb_alloc_urb(0, GFP_ATOMIC);
131 if (!urb) {
132 dev_dbg(&dev->udev->dev, "Error allocating URB "
133 "in write_cmd_async!");
134 return;
135 }
136
137 req = kmalloc(sizeof *req, GFP_ATOMIC);
138 if (!req) {
139 dev_err(&dev->udev->dev, "Failed to allocate memory for "
140 "control request");
141 goto out;
142 }
143 req->bRequestType = MCS7830_WR_BMREQ;
144 req->bRequest = MCS7830_WR_BREQ;
145 req->wValue = 0;
146 req->wIndex = cpu_to_le16(index);
147 req->wLength = cpu_to_le16(size);
148
149 usb_fill_control_urb(urb, dev->udev,
150 usb_sndctrlpipe(dev->udev, 0),
151 (void *)req, data, size,
152 mcs7830_async_cmd_callback, req);
153
154 ret = usb_submit_urb(urb, GFP_ATOMIC);
155 if (ret < 0) {
156 dev_err(&dev->udev->dev, "Error submitting the control "
157 "message: ret=%d", ret);
158 goto out;
159 }
160 return;
161out:
162 kfree(req);
163 usb_free_urb(urb);
164}
165
166static int mcs7830_get_address(struct usbnet *dev)
167{
168 int ret;
169 ret = mcs7830_get_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN,
170 dev->net->dev_addr);
171 if (ret < 0)
172 return ret;
173 return 0;
174}
175
176static int mcs7830_read_phy(struct usbnet *dev, u8 index)
177{
178 int ret;
179 int i;
180 __le16 val;
181
182 u8 cmd[2] = {
183 HIF_REG_PHY_CMD1_READ | HIF_REG_PHY_CMD1_PHYADDR,
184 HIF_REG_PHY_CMD2_PEND_FLAG_BIT | index,
185 };
186
187 mutex_lock(&dev->phy_mutex);
188 /* write the MII command */
189 ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
190 if (ret < 0)
191 goto out;
192
193 /* wait for the data to become valid, should be within < 1ms */
194 for (i = 0; i < 10; i++) {
195 ret = mcs7830_get_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
196 if ((ret < 0) || (cmd[1] & HIF_REG_PHY_CMD2_READY_FLAG_BIT))
197 break;
198 ret = -EIO;
199 msleep(1);
200 }
201 if (ret < 0)
202 goto out;
203
204 /* read actual register contents */
205 ret = mcs7830_get_reg(dev, HIF_REG_PHY_DATA, 2, &val);
206 if (ret < 0)
207 goto out;
208 ret = le16_to_cpu(val);
209 dev_dbg(&dev->udev->dev, "read PHY reg %02x: %04x (%d tries)\n",
210 index, val, i);
211out:
212 mutex_unlock(&dev->phy_mutex);
213 return ret;
214}
215
216static int mcs7830_write_phy(struct usbnet *dev, u8 index, u16 val)
217{
218 int ret;
219 int i;
220 __le16 le_val;
221
222 u8 cmd[2] = {
223 HIF_REG_PHY_CMD1_WRITE | HIF_REG_PHY_CMD1_PHYADDR,
224 HIF_REG_PHY_CMD2_PEND_FLAG_BIT | (index & 0x1F),
225 };
226
227 mutex_lock(&dev->phy_mutex);
228
229 /* write the new register contents */
230 le_val = cpu_to_le16(val);
231 ret = mcs7830_set_reg(dev, HIF_REG_PHY_DATA, 2, &le_val);
232 if (ret < 0)
233 goto out;
234
235 /* write the MII command */
236 ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
237 if (ret < 0)
238 goto out;
239
240 /* wait for the command to be accepted by the PHY */
241 for (i = 0; i < 10; i++) {
242 ret = mcs7830_get_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
243 if ((ret < 0) || (cmd[1] & HIF_REG_PHY_CMD2_READY_FLAG_BIT))
244 break;
245 ret = -EIO;
246 msleep(1);
247 }
248 if (ret < 0)
249 goto out;
250
251 ret = 0;
252 dev_dbg(&dev->udev->dev, "write PHY reg %02x: %04x (%d tries)\n",
253 index, val, i);
254out:
255 mutex_unlock(&dev->phy_mutex);
256 return ret;
257}
258
259/*
260 * This algorithm comes from the original mcs7830 version 1.4 driver,
261 * not sure if it is needed.
262 */
263static int mcs7830_set_autoneg(struct usbnet *dev, int ptrUserPhyMode)
264{
265 int ret;
266 /* Enable all media types */
267 ret = mcs7830_write_phy(dev, MII_ADVERTISE, MCS7830_MII_ADVERTISE);
268
269 /* First reset BMCR */
270 if (!ret)
271 ret = mcs7830_write_phy(dev, MII_BMCR, 0x0000);
272 /* Enable Auto Neg */
273 if (!ret)
274 ret = mcs7830_write_phy(dev, MII_BMCR, BMCR_ANENABLE);
275 /* Restart Auto Neg (Keep the Enable Auto Neg Bit Set) */
276 if (!ret)
277 ret = mcs7830_write_phy(dev, MII_BMCR,
278 BMCR_ANENABLE | BMCR_ANRESTART );
279 return ret < 0 ? : 0;
280}
281
282
283/*
284 * if we can read register 22, the chip revision is C or higher
285 */
286static int mcs7830_get_rev(struct usbnet *dev)
287{
288 u8 dummy[2];
289 int ret;
290 ret = mcs7830_get_reg(dev, HIF_REG_22, 2, dummy);
291 if (ret > 0)
292 return 2; /* Rev C or later */
293 return 1; /* earlier revision */
294}
295
296/*
297 * On rev. C we need to set the pause threshold
298 */
299static void mcs7830_rev_C_fixup(struct usbnet *dev)
300{
301 u8 pause_threshold = HIF_REG_PAUSE_THRESHOLD_DEFAULT;
302 int retry;
303
304 for (retry = 0; retry < 2; retry++) {
305 if (mcs7830_get_rev(dev) == 2) {
306 dev_info(&dev->udev->dev, "applying rev.C fixup\n");
307 mcs7830_set_reg(dev, HIF_REG_PAUSE_THRESHOLD,
308 1, &pause_threshold);
309 }
310 msleep(1);
311 }
312}
313
314static int mcs7830_init_dev(struct usbnet *dev)
315{
316 int ret;
317 int retry;
318
319 /* Read MAC address from EEPROM */
320 ret = -EINVAL;
321 for (retry = 0; retry < 5 && ret; retry++)
322 ret = mcs7830_get_address(dev);
323 if (ret) {
324 dev_warn(&dev->udev->dev, "Cannot read MAC address\n");
325 goto out;
326 }
327
328 /* Set up PHY */
329 ret = mcs7830_set_autoneg(dev, 0);
330 if (ret) {
331 dev_info(&dev->udev->dev, "Cannot set autoneg\n");
332 goto out;
333 }
334
335 mcs7830_rev_C_fixup(dev);
336 ret = 0;
337out:
338 return ret;
339}
340
341static int mcs7830_mdio_read(struct net_device *netdev, int phy_id,
342 int location)
343{
344 struct usbnet *dev = netdev->priv;
345 return mcs7830_read_phy(dev, location);
346}
347
348static void mcs7830_mdio_write(struct net_device *netdev, int phy_id,
349 int location, int val)
350{
351 struct usbnet *dev = netdev->priv;
352 mcs7830_write_phy(dev, location, val);
353}
354
355static int mcs7830_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
356{
357 struct usbnet *dev = netdev_priv(net);
358 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
359}
360
361/* credits go to asix_set_multicast */
362static void mcs7830_set_multicast(struct net_device *net)
363{
364 struct usbnet *dev = netdev_priv(net);
365 struct mcs7830_data *data = (struct mcs7830_data *)&dev->data;
366
367 data->config = HIF_REG_CONFIG_TXENABLE;
368
369 /* this should not be needed, but it doesn't work otherwise */
370 data->config |= HIF_REG_CONFIG_ALLMULTICAST;
371
372 if (net->flags & IFF_PROMISC) {
373 data->config |= HIF_REG_CONFIG_PROMISCIOUS;
374 } else if (net->flags & IFF_ALLMULTI
375 || net->mc_count > MCS7830_MAX_MCAST) {
376 data->config |= HIF_REG_CONFIG_ALLMULTICAST;
377 } else if (net->mc_count == 0) {
378 /* just broadcast and directed */
379 } else {
380 /* We use the 20 byte dev->data
381 * for our 8 byte filter buffer
382 * to avoid allocating memory that
383 * is tricky to free later */
384 struct dev_mc_list *mc_list = net->mc_list;
385 u32 crc_bits;
386 int i;
387
388 memset(data->multi_filter, 0, sizeof data->multi_filter);
389
390 /* Build the multicast hash filter. */
391 for (i = 0; i < net->mc_count; i++) {
392 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
393 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7);
394 mc_list = mc_list->next;
395 }
396
397 mcs7830_set_reg_async(dev, HIF_REG_MULTICAST_HASH,
398 sizeof data->multi_filter,
399 data->multi_filter);
400 }
401
402 mcs7830_set_reg_async(dev, HIF_REG_CONFIG, 1, &data->config);
403}
404
405static int mcs7830_get_regs_len(struct net_device *net)
406{
407 struct usbnet *dev = netdev_priv(net);
408
409 switch (mcs7830_get_rev(dev)) {
410 case 1:
411 return 21;
412 case 2:
413 return 32;
414 }
415 return 0;
416}
417
418static void mcs7830_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *drvinfo)
419{
420 usbnet_get_drvinfo(net, drvinfo);
421 drvinfo->regdump_len = mcs7830_get_regs_len(net);
422}
423
424static void mcs7830_get_regs(struct net_device *net, struct ethtool_regs *regs, void *data)
425{
426 struct usbnet *dev = netdev_priv(net);
427
428 regs->version = mcs7830_get_rev(dev);
429 mcs7830_get_reg(dev, 0, regs->len, data);
430}
431
432static struct ethtool_ops mcs7830_ethtool_ops = {
433 .get_drvinfo = mcs7830_get_drvinfo,
434 .get_regs_len = mcs7830_get_regs_len,
435 .get_regs = mcs7830_get_regs,
436
437 /* common usbnet calls */
438 .get_link = usbnet_get_link,
439 .get_msglevel = usbnet_get_msglevel,
440 .set_msglevel = usbnet_set_msglevel,
441 .get_settings = usbnet_get_settings,
442 .set_settings = usbnet_set_settings,
443 .nway_reset = usbnet_nway_reset,
444};
445
446static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
447{
448 struct net_device *net = dev->net;
449 int ret;
450
451 ret = mcs7830_init_dev(dev);
452 if (ret)
453 goto out;
454
455 net->do_ioctl = mcs7830_ioctl;
456 net->ethtool_ops = &mcs7830_ethtool_ops;
457 net->set_multicast_list = mcs7830_set_multicast;
458 mcs7830_set_multicast(net);
459
460 /* reserve space for the status byte on rx */
461 dev->rx_urb_size = ETH_FRAME_LEN + 1;
462
463 dev->mii.mdio_read = mcs7830_mdio_read;
464 dev->mii.mdio_write = mcs7830_mdio_write;
465 dev->mii.dev = net;
466 dev->mii.phy_id_mask = 0x3f;
467 dev->mii.reg_num_mask = 0x1f;
468 dev->mii.phy_id = *((u8 *) net->dev_addr + 1);
469
470 ret = usbnet_get_endpoints(dev, udev);
471out:
472 return ret;
473}
474
475/* The chip always appends a status bytes that we need to strip */
476static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
477{
478 u8 status;
479
480 if (skb->len == 0) {
481 dev_err(&dev->udev->dev, "unexpected empty rx frame\n");
482 return 0;
483 }
484
485 skb_trim(skb, skb->len - 1);
486 status = skb->data[skb->len];
487
488 if (status != 0x20)
489 dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status);
490
491 return skb->len > 0;
492}
493
494static const struct driver_info moschip_info = {
495 .description = "MOSCHIP 7830 usb-NET adapter",
496 .bind = mcs7830_bind,
497 .rx_fixup = mcs7830_rx_fixup,
498 .flags = FLAG_ETHER,
499 .in = 1,
500 .out = 2,
501};
502
503static const struct usb_device_id products[] = {
504 {
505 USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID),
506 .driver_info = (unsigned long) &moschip_info,
507 },
508 {},
509};
510MODULE_DEVICE_TABLE(usb, products);
511
512static struct usb_driver mcs7830_driver = {
513 .name = driver_name,
514 .id_table = products,
515 .probe = usbnet_probe,
516 .disconnect = usbnet_disconnect,
517 .suspend = usbnet_suspend,
518 .resume = usbnet_resume,
519};
520
521static int __init mcs7830_init(void)
522{
523 return usb_register(&mcs7830_driver);
524}
525module_init(mcs7830_init);
526
527static void __exit mcs7830_exit(void)
528{
529 usb_deregister(&mcs7830_driver);
530}
531module_exit(mcs7830_exit);
532
533MODULE_DESCRIPTION("USB to network adapter MCS7830)");
534MODULE_LICENSE("GPL");
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 24bd3486ee63..cf3d20eb781c 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -669,6 +669,37 @@ done:
669 * they'll probably want to use this base set. 669 * they'll probably want to use this base set.
670 */ 670 */
671 671
672int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
673{
674 struct usbnet *dev = netdev_priv(net);
675
676 if (!dev->mii.mdio_read)
677 return -EOPNOTSUPP;
678
679 return mii_ethtool_gset(&dev->mii, cmd);
680}
681EXPORT_SYMBOL_GPL(usbnet_get_settings);
682
683int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd)
684{
685 struct usbnet *dev = netdev_priv(net);
686 int retval;
687
688 if (!dev->mii.mdio_write)
689 return -EOPNOTSUPP;
690
691 retval = mii_ethtool_sset(&dev->mii, cmd);
692
693 /* link speed/duplex might have changed */
694 if (dev->driver_info->link_reset)
695 dev->driver_info->link_reset(dev);
696
697 return retval;
698
699}
700EXPORT_SYMBOL_GPL(usbnet_set_settings);
701
702
672void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) 703void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
673{ 704{
674 struct usbnet *dev = netdev_priv(net); 705 struct usbnet *dev = netdev_priv(net);
@@ -682,7 +713,7 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
682} 713}
683EXPORT_SYMBOL_GPL(usbnet_get_drvinfo); 714EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
684 715
685static u32 usbnet_get_link (struct net_device *net) 716u32 usbnet_get_link (struct net_device *net)
686{ 717{
687 struct usbnet *dev = netdev_priv(net); 718 struct usbnet *dev = netdev_priv(net);
688 719
@@ -690,9 +721,14 @@ static u32 usbnet_get_link (struct net_device *net)
690 if (dev->driver_info->check_connect) 721 if (dev->driver_info->check_connect)
691 return dev->driver_info->check_connect (dev) == 0; 722 return dev->driver_info->check_connect (dev) == 0;
692 723
724 /* if the device has mii operations, use those */
725 if (dev->mii.mdio_read)
726 return mii_link_ok(&dev->mii);
727
693 /* Otherwise, say we're up (to avoid breaking scripts) */ 728 /* Otherwise, say we're up (to avoid breaking scripts) */
694 return 1; 729 return 1;
695} 730}
731EXPORT_SYMBOL_GPL(usbnet_get_link);
696 732
697u32 usbnet_get_msglevel (struct net_device *net) 733u32 usbnet_get_msglevel (struct net_device *net)
698{ 734{
@@ -710,10 +746,24 @@ void usbnet_set_msglevel (struct net_device *net, u32 level)
710} 746}
711EXPORT_SYMBOL_GPL(usbnet_set_msglevel); 747EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
712 748
749int usbnet_nway_reset(struct net_device *net)
750{
751 struct usbnet *dev = netdev_priv(net);
752
753 if (!dev->mii.mdio_write)
754 return -EOPNOTSUPP;
755
756 return mii_nway_restart(&dev->mii);
757}
758EXPORT_SYMBOL_GPL(usbnet_nway_reset);
759
713/* drivers may override default ethtool_ops in their bind() routine */ 760/* drivers may override default ethtool_ops in their bind() routine */
714static struct ethtool_ops usbnet_ethtool_ops = { 761static struct ethtool_ops usbnet_ethtool_ops = {
762 .get_settings = usbnet_get_settings,
763 .set_settings = usbnet_set_settings,
715 .get_drvinfo = usbnet_get_drvinfo, 764 .get_drvinfo = usbnet_get_drvinfo,
716 .get_link = usbnet_get_link, 765 .get_link = usbnet_get_link,
766 .nway_reset = usbnet_nway_reset,
717 .get_msglevel = usbnet_get_msglevel, 767 .get_msglevel = usbnet_get_msglevel,
718 .set_msglevel = usbnet_set_msglevel, 768 .set_msglevel = usbnet_set_msglevel,
719}; 769};
@@ -1094,6 +1144,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1094 dev->delay.function = usbnet_bh; 1144 dev->delay.function = usbnet_bh;
1095 dev->delay.data = (unsigned long) dev; 1145 dev->delay.data = (unsigned long) dev;
1096 init_timer (&dev->delay); 1146 init_timer (&dev->delay);
1147 mutex_init (&dev->phy_mutex);
1097 1148
1098 SET_MODULE_OWNER (net); 1149 SET_MODULE_OWNER (net);
1099 dev->net = net; 1150 dev->net = net;
@@ -1225,7 +1276,7 @@ EXPORT_SYMBOL_GPL(usbnet_resume);
1225static int __init usbnet_init(void) 1276static int __init usbnet_init(void)
1226{ 1277{
1227 /* compiler should optimize this out */ 1278 /* compiler should optimize this out */
1228 BUG_ON (sizeof (((struct sk_buff *)0)->cb) 1279 BUILD_BUG_ON (sizeof (((struct sk_buff *)0)->cb)
1229 < sizeof (struct skb_data)); 1280 < sizeof (struct skb_data));
1230 1281
1231 random_ether_addr(node_id); 1282 random_ether_addr(node_id);
diff --git a/drivers/usb/net/usbnet.h b/drivers/usb/net/usbnet.h
index c0746f0454af..07c70abbe0ec 100644
--- a/drivers/usb/net/usbnet.h
+++ b/drivers/usb/net/usbnet.h
@@ -30,6 +30,7 @@ struct usbnet {
30 struct usb_device *udev; 30 struct usb_device *udev;
31 struct driver_info *driver_info; 31 struct driver_info *driver_info;
32 wait_queue_head_t *wait; 32 wait_queue_head_t *wait;
33 struct mutex phy_mutex;
33 34
34 /* i/o info: pipes etc */ 35 /* i/o info: pipes etc */
35 unsigned in, out; 36 unsigned in, out;
@@ -168,9 +169,13 @@ extern void usbnet_defer_kevent (struct usbnet *, int);
168extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 169extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
169extern void usbnet_unlink_rx_urbs(struct usbnet *); 170extern void usbnet_unlink_rx_urbs(struct usbnet *);
170 171
172extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
173extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
174extern u32 usbnet_get_link (struct net_device *net);
171extern u32 usbnet_get_msglevel (struct net_device *); 175extern u32 usbnet_get_msglevel (struct net_device *);
172extern void usbnet_set_msglevel (struct net_device *, u32); 176extern void usbnet_set_msglevel (struct net_device *, u32);
173extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); 177extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
178extern int usbnet_nway_reset(struct net_device *net);
174 179
175/* messaging support includes the interface name, so it must not be 180/* messaging support includes the interface name, so it must not be
176 * used before it has one ... notably, in minidriver bind() calls. 181 * used before it has one ... notably, in minidriver bind() calls.
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 5076b9d97057..9a6ec1b5e3d5 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -422,6 +422,16 @@ config USB_SERIAL_MCT_U232
422 To compile this driver as a module, choose M here: the 422 To compile this driver as a module, choose M here: the
423 module will be called mct_u232. 423 module will be called mct_u232.
424 424
425config USB_SERIAL_MOS7720
426 tristate "USB Moschip 7720 Single Port Serial Driver"
427 depends on USB_SERIAL
428 ---help---
429 Say Y here if you want to use a USB Serial single port adapter from
430 Moschip Semiconductor Tech.
431
432 To compile this driver as a module, choose M here: the
433 module will be called mos7720.
434
425config USB_SERIAL_MOS7840 435config USB_SERIAL_MOS7840
426 tristate "USB Moschip 7840/7820 USB Serial Driver" 436 tristate "USB Moschip 7840/7820 USB Serial Driver"
427 depends on USB_SERIAL 437 depends on USB_SERIAL
@@ -527,8 +537,7 @@ config USB_SERIAL_OPTION
527 The USB bus on these cards is not accessible externally. 537 The USB bus on these cards is not accessible externally.
528 538
529 Supported devices include (some of?) those made by: 539 Supported devices include (some of?) those made by:
530 Option, Huawei, Audiovox, Sierra Wireless, Novatel Wireless, or 540 Option, Huawei, Audiovox, Novatel Wireless, or Anydata.
531 Anydata.
532 541
533 To compile this driver as a module, choose M here: the 542 To compile this driver as a module, choose M here: the
534 module will be called option. 543 module will be called option.
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 8dce83340e31..a5047dc599bb 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o
34obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o 34obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o
35obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o 35obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o
36obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o 36obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o
37obj-$(CONFIG_USB_SERIAL_MOS7720) += mos7720.o
37obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o 38obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o
38obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o 39obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o
39obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o 40obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 2c19f19b255c..7f5d546da39a 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,12 +18,8 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x0f3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */
22 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
23 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
24 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */
25 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
26 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ 21 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
22 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
27 { }, 23 { },
28}; 24};
29MODULE_DEVICE_TABLE(usb, id_table); 25MODULE_DEVICE_TABLE(usb, id_table);
@@ -133,6 +129,7 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
133 } 129 }
134 urb = usb_alloc_urb(0, GFP_KERNEL); 130 urb = usb_alloc_urb(0, GFP_KERNEL);
135 if (!urb) { 131 if (!urb) {
132 kfree(buffer);
136 dev_err(&port->dev, "%s - no more urbs?\n", 133 dev_err(&port->dev, "%s - no more urbs?\n",
137 __FUNCTION__); 134 __FUNCTION__);
138 result = -ENOMEM; 135 result = -ENOMEM;
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 486c7411b9a7..bbf6532c26e5 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -65,6 +65,7 @@ static struct usb_device_id id_table [] = {
65 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 65 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
66 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 66 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
67 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 67 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
68 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
68 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 69 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
69 { } /* Terminating Entry */ 70 { } /* Terminating Entry */
70}; 71};
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index d3dc1a15ec6c..bd76b4c11fcc 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1,16 +1,16 @@
1/* 1/*
2 * USB FTDI SIO driver 2 * USB FTDI SIO driver
3 * 3 *
4 * Copyright (C) 1999 - 2001 4 * Copyright (C) 1999 - 2001
5 * Greg Kroah-Hartman (greg@kroah.com) 5 * Greg Kroah-Hartman (greg@kroah.com)
6 * Bill Ryder (bryder@sgi.com) 6 * Bill Ryder (bryder@sgi.com)
7 * Copyright (C) 2002 7 * Copyright (C) 2002
8 * Kuba Ober (kuba@mareimbrium.org) 8 * Kuba Ober (kuba@mareimbrium.org)
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
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 13 * (at your option) any later version.
14 * 14 *
15 * See Documentation/usb/usb-serial.txt for more information on using this driver 15 * See Documentation/usb/usb-serial.txt for more information on using this driver
16 * 16 *
@@ -32,7 +32,7 @@
32 * Changed full name of USB-UIRT device to avoid "/" character. 32 * Changed full name of USB-UIRT device to avoid "/" character.
33 * Added FTDI's alternate PID (0x6006) for FT232/245 devices. 33 * Added FTDI's alternate PID (0x6006) for FT232/245 devices.
34 * Added PID for "ELV USB Module UO100" from Stefan Frings. 34 * Added PID for "ELV USB Module UO100" from Stefan Frings.
35 * 35 *
36 * (21/Oct/2003) Ian Abbott 36 * (21/Oct/2003) Ian Abbott
37 * Renamed some VID/PID macros for Matrix Orbital and Perle Systems 37 * Renamed some VID/PID macros for Matrix Orbital and Perle Systems
38 * devices. Removed Matrix Orbital and Perle Systems devices from the 38 * devices. Removed Matrix Orbital and Perle Systems devices from the
@@ -69,7 +69,7 @@
69 * does not incure any measurable overhead. This also relies on the fact 69 * does not incure any measurable overhead. This also relies on the fact
70 * that we have proper reference counting logic for urbs. I nicked this 70 * that we have proper reference counting logic for urbs. I nicked this
71 * from Greg KH's Visor driver. 71 * from Greg KH's Visor driver.
72 * 72 *
73 * (23/Jun/2003) Ian Abbott 73 * (23/Jun/2003) Ian Abbott
74 * Reduced flip buffer pushes and corrected a data length test in 74 * Reduced flip buffer pushes and corrected a data length test in
75 * ftdi_read_bulk_callback. 75 * ftdi_read_bulk_callback.
@@ -77,7 +77,7 @@
77 * 77 *
78 * (21/Jun/2003) Erik Nygren 78 * (21/Jun/2003) Erik Nygren
79 * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip. 79 * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip.
80 * See <http://www.home-electro.com/tira1.htm>. Only operates properly 80 * See <http://www.home-electro.com/tira1.htm>. Only operates properly
81 * at 100000 and RTS-CTS, so set custom divisor mode on startup. 81 * at 100000 and RTS-CTS, so set custom divisor mode on startup.
82 * Also force the Tira-1 and USB-UIRT to only use their custom baud rates. 82 * Also force the Tira-1 and USB-UIRT to only use their custom baud rates.
83 * 83 *
@@ -137,17 +137,17 @@
137 * (17/Feb/2003) Bill Ryder 137 * (17/Feb/2003) Bill Ryder
138 * Added write urb buffer pool on a per device basis 138 * Added write urb buffer pool on a per device basis
139 * Added more checking for open file on callbacks (fixed OOPS) 139 * Added more checking for open file on callbacks (fixed OOPS)
140 * Added CrystalFontz 632 and 634 PIDs 140 * Added CrystalFontz 632 and 634 PIDs
141 * (thanx to CrystalFontz for the sample devices - they flushed out 141 * (thanx to CrystalFontz for the sample devices - they flushed out
142 * some driver bugs) 142 * some driver bugs)
143 * Minor debugging message changes 143 * Minor debugging message changes
144 * Added throttle, unthrottle and chars_in_buffer functions 144 * Added throttle, unthrottle and chars_in_buffer functions
145 * Fixed FTDI_SIO (the original device) bug 145 * Fixed FTDI_SIO (the original device) bug
146 * Fixed some shutdown handling 146 * Fixed some shutdown handling
147 * 147 *
148 * 148 *
149 * 149 *
150 * 150 *
151 * (07/Jun/2002) Kuba Ober 151 * (07/Jun/2002) Kuba Ober
152 * Changed FTDI_SIO_BASE_BAUD_TO_DIVISOR macro into ftdi_baud_to_divisor 152 * Changed FTDI_SIO_BASE_BAUD_TO_DIVISOR macro into ftdi_baud_to_divisor
153 * function. It was getting too complex. 153 * function. It was getting too complex.
@@ -158,7 +158,7 @@
158 * 158 *
159 * (25/Jul/2002) Bill Ryder inserted Dmitri's TIOCMIWAIT patch 159 * (25/Jul/2002) Bill Ryder inserted Dmitri's TIOCMIWAIT patch
160 * Not tested by me but it doesn't break anything I use. 160 * Not tested by me but it doesn't break anything I use.
161 * 161 *
162 * (04/Jan/2002) Kuba Ober 162 * (04/Jan/2002) Kuba Ober
163 * Implemented 38400 baudrate kludge, where it can be substituted with other 163 * Implemented 38400 baudrate kludge, where it can be substituted with other
164 * values. That's the only way to set custom baudrates. 164 * values. That's the only way to set custom baudrates.
@@ -179,7 +179,7 @@
179 * (the previous version caused panics) 179 * (the previous version caused panics)
180 * Removed port iteration code since the device only has one I/O port and it 180 * Removed port iteration code since the device only has one I/O port and it
181 * was wrong anyway. 181 * was wrong anyway.
182 * 182 *
183 * (31/May/2001) gkh 183 * (31/May/2001) gkh
184 * Switched from using spinlock to a semaphore, which fixes lots of problems. 184 * Switched from using spinlock to a semaphore, which fixes lots of problems.
185 * 185 *
@@ -188,16 +188,16 @@
188 * Cleaned up comments for 8U232 188 * Cleaned up comments for 8U232
189 * Added parity, framing and overrun error handling 189 * Added parity, framing and overrun error handling
190 * Added receive break handling. 190 * Added receive break handling.
191 * 191 *
192 * (04/08/2001) gb 192 * (04/08/2001) gb
193 * Identify version on module load. 193 * Identify version on module load.
194 * 194 *
195 * (18/March/2001) Bill Ryder 195 * (18/March/2001) Bill Ryder
196 * (Not released) 196 * (Not released)
197 * Added send break handling. (requires kernel patch too) 197 * Added send break handling. (requires kernel patch too)
198 * Fixed 8U232AM hardware RTS/CTS etc status reporting. 198 * Fixed 8U232AM hardware RTS/CTS etc status reporting.
199 * Added flipbuf fix copied from generic device 199 * Added flipbuf fix copied from generic device
200 * 200 *
201 * (12/3/2000) Bill Ryder 201 * (12/3/2000) Bill Ryder
202 * Added support for 8U232AM device. 202 * Added support for 8U232AM device.
203 * Moved PID and VIDs into header file only. 203 * Moved PID and VIDs into header file only.
@@ -211,14 +211,14 @@
211 * Cleaned up comments. Removed multiple PID/VID definitions. 211 * Cleaned up comments. Removed multiple PID/VID definitions.
212 * Factorised cts/dtr code 212 * Factorised cts/dtr code
213 * Made use of __FUNCTION__ in dbg's 213 * Made use of __FUNCTION__ in dbg's
214 * 214 *
215 * (11/01/2000) Adam J. Richter 215 * (11/01/2000) Adam J. Richter
216 * usb_device_id table support 216 * usb_device_id table support
217 * 217 *
218 * (10/05/2000) gkh 218 * (10/05/2000) gkh
219 * Fixed bug with urb->dev not being set properly, now that the usb 219 * Fixed bug with urb->dev not being set properly, now that the usb
220 * core needs it. 220 * core needs it.
221 * 221 *
222 * (09/11/2000) gkh 222 * (09/11/2000) gkh
223 * Removed DEBUG #ifdefs with call to usb_serial_debug_data 223 * Removed DEBUG #ifdefs with call to usb_serial_debug_data
224 * 224 *
@@ -226,11 +226,11 @@
226 * Added module_init and module_exit functions to handle the fact that this 226 * Added module_init and module_exit functions to handle the fact that this
227 * driver is a loadable module now. 227 * driver is a loadable module now.
228 * 228 *
229 * (04/04/2000) Bill Ryder 229 * (04/04/2000) Bill Ryder
230 * Fixed bugs in TCGET/TCSET ioctls (by removing them - they are 230 * Fixed bugs in TCGET/TCSET ioctls (by removing them - they are
231 * handled elsewhere in the tty io driver chain). 231 * handled elsewhere in the tty io driver chain).
232 * 232 *
233 * (03/30/2000) Bill Ryder 233 * (03/30/2000) Bill Ryder
234 * Implemented lots of ioctls 234 * Implemented lots of ioctls
235 * Fixed a race condition in write 235 * Fixed a race condition in write
236 * Changed some dbg's to errs 236 * Changed some dbg's to errs
@@ -444,13 +444,13 @@ static struct usb_device_id id_table_combined [] = {
444 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, */ 444 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, */
445 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, */ 445 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, */
446 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, */ 446 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, */
447 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 447 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
448 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 448 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
449 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, 449 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
450 { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, 450 { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) },
451 { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, 451 { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) },
452 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, 452 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) },
453 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, 453 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) },
454 { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, 454 { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) },
455 { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, 455 { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) },
456 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, 456 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) },
@@ -522,7 +522,7 @@ static struct usb_driver ftdi_driver = {
522 .probe = usb_serial_probe, 522 .probe = usb_serial_probe,
523 .disconnect = usb_serial_disconnect, 523 .disconnect = usb_serial_disconnect,
524 .id_table = id_table_combined, 524 .id_table = id_table_combined,
525 .no_dynamic_id = 1, 525 .no_dynamic_id = 1,
526}; 526};
527 527
528static const char *ftdi_chip_name[] = { 528static const char *ftdi_chip_name[] = {
@@ -548,13 +548,13 @@ struct ftdi_private {
548 int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */ 548 int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */
549 __u16 last_set_data_urb_value ; 549 __u16 last_set_data_urb_value ;
550 /* the last data state set - needed for doing a break */ 550 /* the last data state set - needed for doing a break */
551 int write_offset; /* This is the offset in the usb data block to write the serial data - 551 int write_offset; /* This is the offset in the usb data block to write the serial data -
552 * it is different between devices 552 * it is different between devices
553 */ 553 */
554 int flags; /* some ASYNC_xxxx flags are supported */ 554 int flags; /* some ASYNC_xxxx flags are supported */
555 unsigned long last_dtr_rts; /* saved modem control outputs */ 555 unsigned long last_dtr_rts; /* saved modem control outputs */
556 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 556 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
557 char prev_status, diff_status; /* Used for TIOCMIWAIT */ 557 char prev_status, diff_status; /* Used for TIOCMIWAIT */
558 __u8 rx_flags; /* receive state flags (throttling) */ 558 __u8 rx_flags; /* receive state flags (throttling) */
559 spinlock_t rx_lock; /* spinlock for receive state */ 559 spinlock_t rx_lock; /* spinlock for receive state */
560 struct work_struct rx_work; 560 struct work_struct rx_work;
@@ -721,7 +721,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned
721 urb_value |= FTDI_SIO_SET_RTS_HIGH; 721 urb_value |= FTDI_SIO_SET_RTS_HIGH;
722 rv = usb_control_msg(port->serial->dev, 722 rv = usb_control_msg(port->serial->dev,
723 usb_sndctrlpipe(port->serial->dev, 0), 723 usb_sndctrlpipe(port->serial->dev, 0),
724 FTDI_SIO_SET_MODEM_CTRL_REQUEST, 724 FTDI_SIO_SET_MODEM_CTRL_REQUEST,
725 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, 725 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
726 urb_value, priv->interface, 726 urb_value, priv->interface,
727 buf, 0, WDR_TIMEOUT); 727 buf, 0, WDR_TIMEOUT);
@@ -768,7 +768,7 @@ static int change_speed(struct usb_serial_port *port)
768 if (priv->interface) { /* FT2232C */ 768 if (priv->interface) { /* FT2232C */
769 urb_index = (__u16)((urb_index << 8) | priv->interface); 769 urb_index = (__u16)((urb_index << 8) | priv->interface);
770 } 770 }
771 771
772 rv = usb_control_msg(port->serial->dev, 772 rv = usb_control_msg(port->serial->dev,
773 usb_sndctrlpipe(port->serial->dev, 0), 773 usb_sndctrlpipe(port->serial->dev, 0),
774 FTDI_SIO_SET_BAUDRATE_REQUEST, 774 FTDI_SIO_SET_BAUDRATE_REQUEST,
@@ -827,7 +827,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
827 827
828 /* 3. Convert baudrate to device-specific divisor */ 828 /* 3. Convert baudrate to device-specific divisor */
829 829
830 if (!baud) baud = 9600; 830 if (!baud) baud = 9600;
831 switch(priv->chip_type) { 831 switch(priv->chip_type) {
832 case SIO: /* SIO chip */ 832 case SIO: /* SIO chip */
833 switch(baud) { 833 switch(baud) {
@@ -843,7 +843,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
843 case 115200: div_value = ftdi_sio_b115200; break; 843 case 115200: div_value = ftdi_sio_b115200; break;
844 } /* baud */ 844 } /* baud */
845 if (div_value == 0) { 845 if (div_value == 0) {
846 dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); 846 dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud);
847 div_value = ftdi_sio_b9600; 847 div_value = ftdi_sio_b9600;
848 div_okay = 0; 848 div_okay = 0;
849 } 849 }
@@ -925,7 +925,7 @@ static int set_serial_info(struct usb_serial_port * port, struct serial_struct _
925 /* Make the changes - these are privileged changes! */ 925 /* Make the changes - these are privileged changes! */
926 926
927 priv->flags = ((priv->flags & ~ASYNC_FLAGS) | 927 priv->flags = ((priv->flags & ~ASYNC_FLAGS) |
928 (new_serial.flags & ASYNC_FLAGS)); 928 (new_serial.flags & ASYNC_FLAGS));
929 priv->custom_divisor = new_serial.custom_divisor; 929 priv->custom_divisor = new_serial.custom_divisor;
930 930
931 port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 931 port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
@@ -950,7 +950,7 @@ check_and_exit:
950 (old_priv.custom_divisor != priv->custom_divisor))) { 950 (old_priv.custom_divisor != priv->custom_divisor))) {
951 change_speed(port); 951 change_speed(port);
952 } 952 }
953 953
954 return (0); 954 return (0);
955 955
956} /* set_serial_info */ 956} /* set_serial_info */
@@ -1022,18 +1022,18 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a
1022 struct usb_device *udev; 1022 struct usb_device *udev;
1023 unsigned short latency = 0; 1023 unsigned short latency = 0;
1024 int rv = 0; 1024 int rv = 0;
1025 1025
1026 udev = to_usb_device(dev); 1026 udev = to_usb_device(dev);
1027 1027
1028 dbg("%s",__FUNCTION__); 1028 dbg("%s",__FUNCTION__);
1029 1029
1030 rv = usb_control_msg(udev, 1030 rv = usb_control_msg(udev,
1031 usb_rcvctrlpipe(udev, 0), 1031 usb_rcvctrlpipe(udev, 0),
1032 FTDI_SIO_GET_LATENCY_TIMER_REQUEST, 1032 FTDI_SIO_GET_LATENCY_TIMER_REQUEST,
1033 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 1033 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
1034 0, priv->interface, 1034 0, priv->interface,
1035 (char*) &latency, 1, WDR_TIMEOUT); 1035 (char*) &latency, 1, WDR_TIMEOUT);
1036 1036
1037 if (rv < 0) { 1037 if (rv < 0) {
1038 dev_err(dev, "Unable to read latency timer: %i", rv); 1038 dev_err(dev, "Unable to read latency timer: %i", rv);
1039 return -EIO; 1039 return -EIO;
@@ -1051,23 +1051,23 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute *
1051 char buf[1]; 1051 char buf[1];
1052 int v = simple_strtoul(valbuf, NULL, 10); 1052 int v = simple_strtoul(valbuf, NULL, 10);
1053 int rv = 0; 1053 int rv = 0;
1054 1054
1055 udev = to_usb_device(dev); 1055 udev = to_usb_device(dev);
1056 1056
1057 dbg("%s: setting latency timer = %i", __FUNCTION__, v); 1057 dbg("%s: setting latency timer = %i", __FUNCTION__, v);
1058 1058
1059 rv = usb_control_msg(udev, 1059 rv = usb_control_msg(udev,
1060 usb_sndctrlpipe(udev, 0), 1060 usb_sndctrlpipe(udev, 0),
1061 FTDI_SIO_SET_LATENCY_TIMER_REQUEST, 1061 FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
1062 FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, 1062 FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
1063 v, priv->interface, 1063 v, priv->interface,
1064 buf, 0, WDR_TIMEOUT); 1064 buf, 0, WDR_TIMEOUT);
1065 1065
1066 if (rv < 0) { 1066 if (rv < 0) {
1067 dev_err(dev, "Unable to write latency timer: %i", rv); 1067 dev_err(dev, "Unable to write latency timer: %i", rv);
1068 return -EIO; 1068 return -EIO;
1069 } 1069 }
1070 1070
1071 return count; 1071 return count;
1072} 1072}
1073 1073
@@ -1082,23 +1082,23 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
1082 char buf[1]; 1082 char buf[1];
1083 int v = simple_strtoul(valbuf, NULL, 10); 1083 int v = simple_strtoul(valbuf, NULL, 10);
1084 int rv = 0; 1084 int rv = 0;
1085 1085
1086 udev = to_usb_device(dev); 1086 udev = to_usb_device(dev);
1087 1087
1088 dbg("%s: setting event char = %i", __FUNCTION__, v); 1088 dbg("%s: setting event char = %i", __FUNCTION__, v);
1089 1089
1090 rv = usb_control_msg(udev, 1090 rv = usb_control_msg(udev,
1091 usb_sndctrlpipe(udev, 0), 1091 usb_sndctrlpipe(udev, 0),
1092 FTDI_SIO_SET_EVENT_CHAR_REQUEST, 1092 FTDI_SIO_SET_EVENT_CHAR_REQUEST,
1093 FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE, 1093 FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE,
1094 v, priv->interface, 1094 v, priv->interface,
1095 buf, 0, WDR_TIMEOUT); 1095 buf, 0, WDR_TIMEOUT);
1096 1096
1097 if (rv < 0) { 1097 if (rv < 0) {
1098 dbg("Unable to write event character: %i", rv); 1098 dbg("Unable to write event character: %i", rv);
1099 return -EIO; 1099 return -EIO;
1100 } 1100 }
1101 1101
1102 return count; 1102 return count;
1103} 1103}
1104 1104
@@ -1135,11 +1135,11 @@ static void remove_sysfs_attrs(struct usb_serial *serial)
1135 struct ftdi_private *priv; 1135 struct ftdi_private *priv;
1136 struct usb_device *udev; 1136 struct usb_device *udev;
1137 1137
1138 dbg("%s",__FUNCTION__); 1138 dbg("%s",__FUNCTION__);
1139 1139
1140 priv = usb_get_serial_port_data(serial->port[0]); 1140 priv = usb_get_serial_port_data(serial->port[0]);
1141 udev = serial->dev; 1141 udev = serial->dev;
1142 1142
1143 /* XXX see create_sysfs_attrs */ 1143 /* XXX see create_sysfs_attrs */
1144 if (priv->chip_type != SIO) { 1144 if (priv->chip_type != SIO) {
1145 device_remove_file(&udev->dev, &dev_attr_event_char); 1145 device_remove_file(&udev->dev, &dev_attr_event_char);
@@ -1147,7 +1147,7 @@ static void remove_sysfs_attrs(struct usb_serial *serial)
1147 device_remove_file(&udev->dev, &dev_attr_latency_timer); 1147 device_remove_file(&udev->dev, &dev_attr_latency_timer);
1148 } 1148 }
1149 } 1149 }
1150 1150
1151} 1151}
1152 1152
1153/* 1153/*
@@ -1258,7 +1258,7 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
1258} /* ftdi_HE_TIRA1_setup */ 1258} /* ftdi_HE_TIRA1_setup */
1259 1259
1260 1260
1261/* ftdi_shutdown is called from usbserial:usb_serial_disconnect 1261/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
1262 * it is called when the usb device is disconnected 1262 * it is called when the usb device is disconnected
1263 * 1263 *
1264 * usbserial:usb_serial_disconnect 1264 * usbserial:usb_serial_disconnect
@@ -1269,16 +1269,16 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
1269 1269
1270static void ftdi_shutdown (struct usb_serial *serial) 1270static void ftdi_shutdown (struct usb_serial *serial)
1271{ /* ftdi_shutdown */ 1271{ /* ftdi_shutdown */
1272 1272
1273 struct usb_serial_port *port = serial->port[0]; 1273 struct usb_serial_port *port = serial->port[0];
1274 struct ftdi_private *priv = usb_get_serial_port_data(port); 1274 struct ftdi_private *priv = usb_get_serial_port_data(port);
1275 1275
1276 dbg("%s", __FUNCTION__); 1276 dbg("%s", __FUNCTION__);
1277 1277
1278 remove_sysfs_attrs(serial); 1278 remove_sysfs_attrs(serial);
1279 1279
1280 /* all open ports are closed at this point 1280 /* all open ports are closed at this point
1281 * (by usbserial.c:__serial_close, which calls ftdi_close) 1281 * (by usbserial.c:__serial_close, which calls ftdi_close)
1282 */ 1282 */
1283 1283
1284 if (priv) { 1284 if (priv) {
@@ -1293,7 +1293,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1293 struct usb_device *dev = port->serial->dev; 1293 struct usb_device *dev = port->serial->dev;
1294 struct ftdi_private *priv = usb_get_serial_port_data(port); 1294 struct ftdi_private *priv = usb_get_serial_port_data(port);
1295 unsigned long flags; 1295 unsigned long flags;
1296 1296
1297 int result = 0; 1297 int result = 0;
1298 char buf[1]; /* Needed for the usb_control_msg I think */ 1298 char buf[1]; /* Needed for the usb_control_msg I think */
1299 1299
@@ -1312,8 +1312,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1312 /* No error checking for this (will get errors later anyway) */ 1312 /* No error checking for this (will get errors later anyway) */
1313 /* See ftdi_sio.h for description of what is reset */ 1313 /* See ftdi_sio.h for description of what is reset */
1314 usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1314 usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1315 FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 1315 FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE,
1316 FTDI_SIO_RESET_SIO, 1316 FTDI_SIO_RESET_SIO,
1317 priv->interface, buf, 0, WDR_TIMEOUT); 1317 priv->interface, buf, 0, WDR_TIMEOUT);
1318 1318
1319 /* Termios defaults are set by usb_serial_init. We don't change 1319 /* Termios defaults are set by usb_serial_init. We don't change
@@ -1350,12 +1350,12 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1350 1350
1351 1351
1352 1352
1353/* 1353/*
1354 * usbserial:__serial_close only calls ftdi_close if the point is open 1354 * usbserial:__serial_close only calls ftdi_close if the point is open
1355 * 1355 *
1356 * This only gets called when it is the last close 1356 * This only gets called when it is the last close
1357 * 1357 *
1358 * 1358 *
1359 */ 1359 */
1360 1360
1361static void ftdi_close (struct usb_serial_port *port, struct file *filp) 1361static void ftdi_close (struct usb_serial_port *port, struct file *filp)
@@ -1368,14 +1368,14 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp)
1368 1368
1369 if (c_cflag & HUPCL){ 1369 if (c_cflag & HUPCL){
1370 /* Disable flow control */ 1370 /* Disable flow control */
1371 if (usb_control_msg(port->serial->dev, 1371 if (usb_control_msg(port->serial->dev,
1372 usb_sndctrlpipe(port->serial->dev, 0), 1372 usb_sndctrlpipe(port->serial->dev, 0),
1373 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 1373 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
1374 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 1374 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
1375 0, priv->interface, buf, 0, 1375 0, priv->interface, buf, 0,
1376 WDR_TIMEOUT) < 0) { 1376 WDR_TIMEOUT) < 0) {
1377 err("error from flowcontrol urb"); 1377 err("error from flowcontrol urb");
1378 } 1378 }
1379 1379
1380 /* drop RTS and DTR */ 1380 /* drop RTS and DTR */
1381 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1381 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
@@ -1384,14 +1384,14 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp)
1384 /* cancel any scheduled reading */ 1384 /* cancel any scheduled reading */
1385 cancel_delayed_work(&priv->rx_work); 1385 cancel_delayed_work(&priv->rx_work);
1386 flush_scheduled_work(); 1386 flush_scheduled_work();
1387 1387
1388 /* shutdown our bulk read */ 1388 /* shutdown our bulk read */
1389 if (port->read_urb) 1389 if (port->read_urb)
1390 usb_kill_urb(port->read_urb); 1390 usb_kill_urb(port->read_urb);
1391} /* ftdi_close */ 1391} /* ftdi_close */
1392 1392
1393 1393
1394 1394
1395/* The SIO requires the first byte to have: 1395/* The SIO requires the first byte to have:
1396 * B0 1 1396 * B0 1
1397 * B1 0 1397 * B1 0
@@ -1423,7 +1423,7 @@ static int ftdi_write (struct usb_serial_port *port,
1423 return 0; 1423 return 0;
1424 } 1424 }
1425 spin_unlock_irqrestore(&priv->tx_lock, flags); 1425 spin_unlock_irqrestore(&priv->tx_lock, flags);
1426 1426
1427 data_offset = priv->write_offset; 1427 data_offset = priv->write_offset;
1428 dbg("data_offset set to %d",data_offset); 1428 dbg("data_offset set to %d",data_offset);
1429 1429
@@ -1462,7 +1462,7 @@ static int ftdi_write (struct usb_serial_port *port,
1462 user_pktsz = todo; 1462 user_pktsz = todo;
1463 } 1463 }
1464 /* Write the control byte at the front of the packet*/ 1464 /* Write the control byte at the front of the packet*/
1465 *first_byte = 1 | ((user_pktsz) << 2); 1465 *first_byte = 1 | ((user_pktsz) << 2);
1466 /* Copy data for packet */ 1466 /* Copy data for packet */
1467 memcpy (first_byte + data_offset, 1467 memcpy (first_byte + data_offset,
1468 current_position, user_pktsz); 1468 current_position, user_pktsz);
@@ -1479,7 +1479,7 @@ static int ftdi_write (struct usb_serial_port *port,
1479 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer); 1479 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer);
1480 1480
1481 /* fill the buffer and send it */ 1481 /* fill the buffer and send it */
1482 usb_fill_bulk_urb(urb, port->serial->dev, 1482 usb_fill_bulk_urb(urb, port->serial->dev,
1483 usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), 1483 usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress),
1484 buffer, transfer_size, 1484 buffer, transfer_size,
1485 ftdi_write_bulk_callback, port); 1485 ftdi_write_bulk_callback, port);
@@ -1520,7 +1520,7 @@ static void ftdi_write_bulk_callback (struct urb *urb)
1520 kfree (urb->transfer_buffer); 1520 kfree (urb->transfer_buffer);
1521 1521
1522 dbg("%s - port %d", __FUNCTION__, port->number); 1522 dbg("%s - port %d", __FUNCTION__, port->number);
1523 1523
1524 if (urb->status) { 1524 if (urb->status) {
1525 dbg("nonzero write bulk status received: %d", urb->status); 1525 dbg("nonzero write bulk status received: %d", urb->status);
1526 return; 1526 return;
@@ -1651,7 +1651,7 @@ static void ftdi_process_read (void *param)
1651 struct tty_struct *tty; 1651 struct tty_struct *tty;
1652 struct ftdi_private *priv; 1652 struct ftdi_private *priv;
1653 char error_flag; 1653 char error_flag;
1654 unsigned char *data; 1654 unsigned char *data;
1655 1655
1656 int i; 1656 int i;
1657 int result; 1657 int result;
@@ -1759,7 +1759,7 @@ static void ftdi_process_read (void *param)
1759 } 1759 }
1760 if (length > 0) { 1760 if (length > 0) {
1761 for (i = 2; i < length+2; i++) { 1761 for (i = 2; i < length+2; i++) {
1762 /* Note that the error flag is duplicated for 1762 /* Note that the error flag is duplicated for
1763 every character received since we don't know 1763 every character received since we don't know
1764 which character it applied to */ 1764 which character it applied to */
1765 tty_insert_flip_char(tty, data[packet_offset+i], error_flag); 1765 tty_insert_flip_char(tty, data[packet_offset+i], error_flag);
@@ -1773,7 +1773,7 @@ static void ftdi_process_read (void *param)
1773 This doesn't work well since the application receives a never 1773 This doesn't work well since the application receives a never
1774 ending stream of bad data - even though new data hasn't been sent. 1774 ending stream of bad data - even though new data hasn't been sent.
1775 Therefore I (bill) have taken this out. 1775 Therefore I (bill) have taken this out.
1776 However - this might make sense for framing errors and so on 1776 However - this might make sense for framing errors and so on
1777 so I am leaving the code in for now. 1777 so I am leaving the code in for now.
1778 */ 1778 */
1779 else { 1779 else {
@@ -1827,7 +1827,7 @@ static void ftdi_process_read (void *param)
1827 /* if the port is closed stop trying to read */ 1827 /* if the port is closed stop trying to read */
1828 if (port->open_count > 0){ 1828 if (port->open_count > 0){
1829 /* Continue trying to always read */ 1829 /* Continue trying to always read */
1830 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 1830 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
1831 usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), 1831 usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
1832 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, 1832 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
1833 ftdi_read_bulk_callback, port); 1833 ftdi_read_bulk_callback, port);
@@ -1844,9 +1844,9 @@ static void ftdi_process_read (void *param)
1844static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) 1844static void ftdi_break_ctl( struct usb_serial_port *port, int break_state )
1845{ 1845{
1846 struct ftdi_private *priv = usb_get_serial_port_data(port); 1846 struct ftdi_private *priv = usb_get_serial_port_data(port);
1847 __u16 urb_value = 0; 1847 __u16 urb_value = 0;
1848 char buf[1]; 1848 char buf[1];
1849 1849
1850 /* break_state = -1 to turn on break, and 0 to turn off break */ 1850 /* break_state = -1 to turn on break, and 0 to turn off break */
1851 /* see drivers/char/tty_io.c to see it used */ 1851 /* see drivers/char/tty_io.c to see it used */
1852 /* last_set_data_urb_value NEVER has the break bit set in it */ 1852 /* last_set_data_urb_value NEVER has the break bit set in it */
@@ -1854,20 +1854,20 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state )
1854 if (break_state) { 1854 if (break_state) {
1855 urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; 1855 urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK;
1856 } else { 1856 } else {
1857 urb_value = priv->last_set_data_urb_value; 1857 urb_value = priv->last_set_data_urb_value;
1858 } 1858 }
1859 1859
1860 1860
1861 if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), 1861 if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0),
1862 FTDI_SIO_SET_DATA_REQUEST, 1862 FTDI_SIO_SET_DATA_REQUEST,
1863 FTDI_SIO_SET_DATA_REQUEST_TYPE, 1863 FTDI_SIO_SET_DATA_REQUEST_TYPE,
1864 urb_value , priv->interface, 1864 urb_value , priv->interface,
1865 buf, 0, WDR_TIMEOUT) < 0) { 1865 buf, 0, WDR_TIMEOUT) < 0) {
1866 err("%s FAILED to enable/disable break state (state was %d)", __FUNCTION__,break_state); 1866 err("%s FAILED to enable/disable break state (state was %d)", __FUNCTION__,break_state);
1867 } 1867 }
1868 1868
1869 dbg("%s break state is %d - urb is %d", __FUNCTION__,break_state, urb_value); 1869 dbg("%s break state is %d - urb is %d", __FUNCTION__,break_state, urb_value);
1870 1870
1871} 1871}
1872 1872
1873 1873
@@ -1883,12 +1883,12 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1883 struct ftdi_private *priv = usb_get_serial_port_data(port); 1883 struct ftdi_private *priv = usb_get_serial_port_data(port);
1884 __u16 urb_value; /* will hold the new flags */ 1884 __u16 urb_value; /* will hold the new flags */
1885 char buf[1]; /* Perhaps I should dynamically alloc this? */ 1885 char buf[1]; /* Perhaps I should dynamically alloc this? */
1886 1886
1887 // Added for xon/xoff support 1887 // Added for xon/xoff support
1888 unsigned int iflag = port->tty->termios->c_iflag; 1888 unsigned int iflag = port->tty->termios->c_iflag;
1889 unsigned char vstop; 1889 unsigned char vstop;
1890 unsigned char vstart; 1890 unsigned char vstart;
1891 1891
1892 dbg("%s", __FUNCTION__); 1892 dbg("%s", __FUNCTION__);
1893 1893
1894 /* Force baud rate if this device requires it, unless it is set to B0. */ 1894 /* Force baud rate if this device requires it, unless it is set to B0. */
@@ -1906,20 +1906,20 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1906 1906
1907 cflag = port->tty->termios->c_cflag; 1907 cflag = port->tty->termios->c_cflag;
1908 1908
1909 /* FIXME -For this cut I don't care if the line is really changing or 1909 /* FIXME -For this cut I don't care if the line is really changing or
1910 not - so just do the change regardless - should be able to 1910 not - so just do the change regardless - should be able to
1911 compare old_termios and tty->termios */ 1911 compare old_termios and tty->termios */
1912 /* NOTE These routines can get interrupted by 1912 /* NOTE These routines can get interrupted by
1913 ftdi_sio_read_bulk_callback - need to examine what this 1913 ftdi_sio_read_bulk_callback - need to examine what this
1914 means - don't see any problems yet */ 1914 means - don't see any problems yet */
1915 1915
1916 /* Set number of data bits, parity, stop bits */ 1916 /* Set number of data bits, parity, stop bits */
1917 1917
1918 urb_value = 0; 1918 urb_value = 0;
1919 urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : 1919 urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :
1920 FTDI_SIO_SET_DATA_STOP_BITS_1); 1920 FTDI_SIO_SET_DATA_STOP_BITS_1);
1921 urb_value |= (cflag & PARENB ? 1921 urb_value |= (cflag & PARENB ?
1922 (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD : 1922 (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD :
1923 FTDI_SIO_SET_DATA_PARITY_EVEN) : 1923 FTDI_SIO_SET_DATA_PARITY_EVEN) :
1924 FTDI_SIO_SET_DATA_PARITY_NONE); 1924 FTDI_SIO_SET_DATA_PARITY_NONE);
1925 if (cflag & CSIZE) { 1925 if (cflag & CSIZE) {
@@ -1936,25 +1936,25 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1936 /* This is needed by the break command since it uses the same command - but is 1936 /* This is needed by the break command since it uses the same command - but is
1937 * or'ed with this value */ 1937 * or'ed with this value */
1938 priv->last_set_data_urb_value = urb_value; 1938 priv->last_set_data_urb_value = urb_value;
1939 1939
1940 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1940 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1941 FTDI_SIO_SET_DATA_REQUEST, 1941 FTDI_SIO_SET_DATA_REQUEST,
1942 FTDI_SIO_SET_DATA_REQUEST_TYPE, 1942 FTDI_SIO_SET_DATA_REQUEST_TYPE,
1943 urb_value , priv->interface, 1943 urb_value , priv->interface,
1944 buf, 0, WDR_SHORT_TIMEOUT) < 0) { 1944 buf, 0, WDR_SHORT_TIMEOUT) < 0) {
1945 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); 1945 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__);
1946 } 1946 }
1947 1947
1948 /* Now do the baudrate */ 1948 /* Now do the baudrate */
1949 if ((cflag & CBAUD) == B0 ) { 1949 if ((cflag & CBAUD) == B0 ) {
1950 /* Disable flow control */ 1950 /* Disable flow control */
1951 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1951 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1952 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 1952 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
1953 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 1953 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
1954 0, priv->interface, 1954 0, priv->interface,
1955 buf, 0, WDR_TIMEOUT) < 0) { 1955 buf, 0, WDR_TIMEOUT) < 0) {
1956 err("%s error from disable flowcontrol urb", __FUNCTION__); 1956 err("%s error from disable flowcontrol urb", __FUNCTION__);
1957 } 1957 }
1958 /* Drop RTS and DTR */ 1958 /* Drop RTS and DTR */
1959 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1959 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1960 } else { 1960 } else {
@@ -1972,16 +1972,16 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1972 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ 1972 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
1973 if (cflag & CRTSCTS) { 1973 if (cflag & CRTSCTS) {
1974 dbg("%s Setting to CRTSCTS flow control", __FUNCTION__); 1974 dbg("%s Setting to CRTSCTS flow control", __FUNCTION__);
1975 if (usb_control_msg(dev, 1975 if (usb_control_msg(dev,
1976 usb_sndctrlpipe(dev, 0), 1976 usb_sndctrlpipe(dev, 0),
1977 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 1977 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
1978 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 1978 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
1979 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), 1979 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
1980 buf, 0, WDR_TIMEOUT) < 0) { 1980 buf, 0, WDR_TIMEOUT) < 0) {
1981 err("urb failed to set to rts/cts flow control"); 1981 err("urb failed to set to rts/cts flow control");
1982 } 1982 }
1983 1983
1984 } else { 1984 } else {
1985 /* 1985 /*
1986 * Xon/Xoff code 1986 * Xon/Xoff code
1987 * 1987 *
@@ -2011,16 +2011,16 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
2011 /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */ 2011 /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */
2012 /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */ 2012 /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */
2013 dbg("%s Turning off hardware flow control", __FUNCTION__); 2013 dbg("%s Turning off hardware flow control", __FUNCTION__);
2014 if (usb_control_msg(dev, 2014 if (usb_control_msg(dev,
2015 usb_sndctrlpipe(dev, 0), 2015 usb_sndctrlpipe(dev, 0),
2016 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 2016 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
2017 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2017 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2018 0, priv->interface, 2018 0, priv->interface,
2019 buf, 0, WDR_TIMEOUT) < 0) { 2019 buf, 0, WDR_TIMEOUT) < 0) {
2020 err("urb failed to clear flow control"); 2020 err("urb failed to clear flow control");
2021 } 2021 }
2022 } 2022 }
2023 2023
2024 } 2024 }
2025 return; 2025 return;
2026} /* ftdi_termios */ 2026} /* ftdi_termios */
@@ -2036,11 +2036,11 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
2036 switch (priv->chip_type) { 2036 switch (priv->chip_type) {
2037 case SIO: 2037 case SIO:
2038 /* Request the status from the device */ 2038 /* Request the status from the device */
2039 if ((ret = usb_control_msg(port->serial->dev, 2039 if ((ret = usb_control_msg(port->serial->dev,
2040 usb_rcvctrlpipe(port->serial->dev, 0), 2040 usb_rcvctrlpipe(port->serial->dev, 0),
2041 FTDI_SIO_GET_MODEM_STATUS_REQUEST, 2041 FTDI_SIO_GET_MODEM_STATUS_REQUEST,
2042 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2042 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
2043 0, 0, 2043 0, 0,
2044 buf, 1, WDR_TIMEOUT)) < 0 ) { 2044 buf, 1, WDR_TIMEOUT)) < 0 ) {
2045 err("%s Could not get modem status of device - err: %d", __FUNCTION__, 2045 err("%s Could not get modem status of device - err: %d", __FUNCTION__,
2046 ret); 2046 ret);
@@ -2052,11 +2052,11 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
2052 case FT2232C: 2052 case FT2232C:
2053 /* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same 2053 /* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same
2054 format as the data returned from the in point */ 2054 format as the data returned from the in point */
2055 if ((ret = usb_control_msg(port->serial->dev, 2055 if ((ret = usb_control_msg(port->serial->dev,
2056 usb_rcvctrlpipe(port->serial->dev, 0), 2056 usb_rcvctrlpipe(port->serial->dev, 0),
2057 FTDI_SIO_GET_MODEM_STATUS_REQUEST, 2057 FTDI_SIO_GET_MODEM_STATUS_REQUEST,
2058 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2058 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
2059 0, priv->interface, 2059 0, priv->interface,
2060 buf, 2, WDR_TIMEOUT)) < 0 ) { 2060 buf, 2, WDR_TIMEOUT)) < 0 ) {
2061 err("%s Could not get modem status of device - err: %d", __FUNCTION__, 2061 err("%s Could not get modem status of device - err: %d", __FUNCTION__,
2062 ret); 2062 ret);
@@ -2067,12 +2067,12 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
2067 return -EFAULT; 2067 return -EFAULT;
2068 break; 2068 break;
2069 } 2069 }
2070 2070
2071 return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | 2071 return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |
2072 (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) | 2072 (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) |
2073 (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) | 2073 (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) |
2074 (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) | 2074 (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) |
2075 priv->last_dtr_rts; 2075 priv->last_dtr_rts;
2076} 2076}
2077 2077
2078static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) 2078static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear)
@@ -2138,11 +2138,11 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne
2138 break; 2138 break;
2139 default: 2139 default:
2140 break; 2140 break;
2141 2141
2142 } 2142 }
2143 2143
2144 2144
2145 /* This is not necessarily an error - turns out the higher layers will do 2145 /* This is not necessarily an error - turns out the higher layers will do
2146 * some ioctls itself (see comment above) 2146 * some ioctls itself (see comment above)
2147 */ 2147 */
2148 dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd); 2148 dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd);
@@ -2199,7 +2199,7 @@ static int __init ftdi_init (void)
2199 if (retval) 2199 if (retval)
2200 goto failed_sio_register; 2200 goto failed_sio_register;
2201 retval = usb_register(&ftdi_driver); 2201 retval = usb_register(&ftdi_driver);
2202 if (retval) 2202 if (retval)
2203 goto failed_usb_register; 2203 goto failed_usb_register;
2204 2204
2205 info(DRIVER_VERSION ":" DRIVER_DESC); 2205 info(DRIVER_VERSION ":" DRIVER_DESC);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
new file mode 100644
index 000000000000..82cd15b894b0
--- /dev/null
+++ b/drivers/usb/serial/mos7720.c
@@ -0,0 +1,1683 @@
1/*
2 * mos7720.c
3 * Controls the Moschip 7720 usb to dual port serial convertor
4 *
5 * Copyright 2006 Moschip Semiconductor Tech. Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, version 2 of the License.
10 *
11 * Developed by:
12 * VijayaKumar.G.N. <vijaykumar@aspirecom.net>
13 * AjayKumar <ajay@aspirecom.net>
14 * Gurudeva.N. <gurudev@aspirecom.net>
15 *
16 * Cleaned up from the original by:
17 * Greg Kroah-Hartman <gregkh@suse.de>
18 *
19 * Originally based on drivers/usb/serial/io_edgeport.c which is:
20 * Copyright (C) 2000 Inside Out Networks, All rights reserved.
21 * Copyright (C) 2001-2002 Greg Kroah-Hartman <greg@kroah.com>
22 */
23#include <linux/kernel.h>
24#include <linux/errno.h>
25#include <linux/init.h>
26#include <linux/slab.h>
27#include <linux/tty.h>
28#include <linux/tty_driver.h>
29#include <linux/tty_flip.h>
30#include <linux/module.h>
31#include <linux/spinlock.h>
32#include <linux/serial.h>
33#include <linux/serial_reg.h>
34#include <linux/usb.h>
35#include <linux/usb/serial.h>
36#include <asm/uaccess.h>
37
38
39/*
40 * Version Information
41 */
42#define DRIVER_VERSION "1.0.0.4F"
43#define DRIVER_AUTHOR "Aspire Communications pvt Ltd."
44#define DRIVER_DESC "Moschip USB Serial Driver"
45
46/* default urb timeout */
47#define MOS_WDR_TIMEOUT (HZ * 5)
48
49#define MOS_PORT1 0x0200
50#define MOS_PORT2 0x0300
51#define MOS_VENREG 0x0000
52#define MOS_MAX_PORT 0x02
53#define MOS_WRITE 0x0E
54#define MOS_READ 0x0D
55
56/* Interrupt Rotinue Defines */
57#define SERIAL_IIR_RLS 0x06
58#define SERIAL_IIR_RDA 0x04
59#define SERIAL_IIR_CTI 0x0c
60#define SERIAL_IIR_THR 0x02
61#define SERIAL_IIR_MS 0x00
62
63#define NUM_URBS 16 /* URB Count */
64#define URB_TRANSFER_BUFFER_SIZE 32 /* URB Size */
65
66/* This structure holds all of the local port information */
67struct moschip_port
68{
69 __u8 shadowLCR; /* last LCR value received */
70 __u8 shadowMCR; /* last MCR value received */
71 __u8 shadowMSR; /* last MSR value received */
72 char open;
73 struct async_icount icount;
74 struct usb_serial_port *port; /* loop back to the owner */
75 struct urb *write_urb_pool[NUM_URBS];
76};
77
78/* This structure holds all of the individual serial device information */
79struct moschip_serial
80{
81 int interrupt_started;
82};
83
84static int debug;
85
86#define USB_VENDOR_ID_MOSCHIP 0x9710
87#define MOSCHIP_DEVICE_ID_7720 0x7720
88#define MOSCHIP_DEVICE_ID_7715 0x7715
89
90static struct usb_device_id moschip_port_id_table [] = {
91 { USB_DEVICE(USB_VENDOR_ID_MOSCHIP,MOSCHIP_DEVICE_ID_7720) },
92 { } /* terminating entry */
93};
94MODULE_DEVICE_TABLE(usb, moschip_port_id_table);
95
96
97/*
98 * mos7720_interrupt_callback
99 * this is the callback function for when we have received data on the
100 * interrupt endpoint.
101 */
102static void mos7720_interrupt_callback(struct urb *urb)
103{
104 int result;
105 int length;
106 __u32 *data;
107 unsigned int status;
108 __u8 sp1;
109 __u8 sp2;
110 __u8 st;
111
112 dbg("%s"," : Entering\n");
113
114 if (!urb) {
115 dbg("%s","Invalid Pointer !!!!:\n");
116 return;
117 }
118
119 switch (urb->status) {
120 case 0:
121 /* success */
122 break;
123 case -ECONNRESET:
124 case -ENOENT:
125 case -ESHUTDOWN:
126 /* this urb is terminated, clean up */
127 dbg("%s - urb shutting down with status: %d", __FUNCTION__,
128 urb->status);
129 return;
130 default:
131 dbg("%s - nonzero urb status received: %d", __FUNCTION__,
132 urb->status);
133 goto exit;
134 }
135
136 length = urb->actual_length;
137 data = urb->transfer_buffer;
138
139 /* Moschip get 4 bytes
140 * Byte 1 IIR Port 1 (port.number is 0)
141 * Byte 2 IIR Port 2 (port.number is 1)
142 * Byte 3 --------------
143 * Byte 4 FIFO status for both */
144 if (length && length > 4) {
145 dbg("Wrong data !!!");
146 return;
147 }
148
149 status = *data;
150
151 sp1 = (status & 0xff000000)>>24;
152 sp2 = (status & 0x00ff0000)>>16;
153 st = status & 0x000000ff;
154
155 if ((sp1 & 0x01) || (sp2 & 0x01)) {
156 /* No Interrupt Pending in both the ports */
157 dbg("No Interrupt !!!");
158 } else {
159 switch (sp1 & 0x0f) {
160 case SERIAL_IIR_RLS:
161 dbg("Serial Port 1: Receiver status error or address "
162 "bit detected in 9-bit mode\n");
163 break;
164 case SERIAL_IIR_CTI:
165 dbg("Serial Port 1: Receiver time out");
166 break;
167 case SERIAL_IIR_MS:
168 dbg("Serial Port 1: Modem status change");
169 break;
170 }
171
172 switch (sp2 & 0x0f) {
173 case SERIAL_IIR_RLS:
174 dbg("Serial Port 2: Receiver status error or address "
175 "bit detected in 9-bit mode");
176 break;
177 case SERIAL_IIR_CTI:
178 dbg("Serial Port 2: Receiver time out");
179 break;
180 case SERIAL_IIR_MS:
181 dbg("Serial Port 2: Modem status change");
182 break;
183 }
184 }
185
186exit:
187 result = usb_submit_urb(urb, GFP_ATOMIC);
188 if (result)
189 dev_err(&urb->dev->dev,
190 "%s - Error %d submitting control urb\n",
191 __FUNCTION__, result);
192 return;
193}
194
195/*
196 * mos7720_bulk_in_callback
197 * this is the callback function for when we have received data on the
198 * bulk in endpoint.
199 */
200static void mos7720_bulk_in_callback(struct urb *urb)
201{
202 int status;
203 unsigned char *data ;
204 struct usb_serial_port *port;
205 struct moschip_port *mos7720_port;
206 struct tty_struct *tty;
207
208 if (urb->status) {
209 dbg("nonzero read bulk status received: %d",urb->status);
210 return;
211 }
212
213 mos7720_port = urb->context;
214 if (!mos7720_port) {
215 dbg("%s","NULL mos7720_port pointer \n");
216 return ;
217 }
218
219 port = mos7720_port->port;
220
221 dbg("Entering...%s", __FUNCTION__);
222
223 data = urb->transfer_buffer;
224
225 tty = port->tty;
226 if (tty && urb->actual_length) {
227 tty_buffer_request_room(tty, urb->actual_length);
228 tty_insert_flip_string(tty, data, urb->actual_length);
229 tty_flip_buffer_push(tty);
230 }
231
232 if (!port->read_urb) {
233 dbg("URB KILLED !!!");
234 return;
235 }
236
237 if (port->read_urb->status != -EINPROGRESS) {
238 port->read_urb->dev = port->serial->dev;
239
240 status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
241 if (status)
242 dbg("usb_submit_urb(read bulk) failed, status = %d",
243 status);
244 }
245}
246
247/*
248 * mos7720_bulk_out_data_callback
249 * this is the callback function for when we have finished sending serial
250 * data on the bulk out endpoint.
251 */
252static void mos7720_bulk_out_data_callback(struct urb *urb)
253{
254 struct moschip_port *mos7720_port;
255 struct tty_struct *tty;
256
257 if (urb->status) {
258 dbg("nonzero write bulk status received:%d", urb->status);
259 return;
260 }
261
262 mos7720_port = urb->context;
263 if (!mos7720_port) {
264 dbg("NULL mos7720_port pointer");
265 return ;
266 }
267
268 dbg("Entering .........");
269
270 tty = mos7720_port->port->tty;
271
272 if (tty && mos7720_port->open) {
273 /* let the tty driver wakeup if it has a special *
274 * write_wakeup function */
275 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
276 tty->ldisc.write_wakeup)
277 (tty->ldisc.write_wakeup)(tty);
278
279 /* tell the tty driver that something has changed */
280 wake_up_interruptible(&tty->write_wait);
281 }
282
283 /* schedule_work(&mos7720_port->port->work); */
284}
285
286/*
287 * send_mos_cmd
288 * this function will be used for sending command to device
289 */
290static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value,
291 __u16 index, void *data)
292{
293 int status;
294 unsigned int pipe;
295 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
296 __u8 requesttype;
297 __u16 size = 0x0000;
298
299 if (value < MOS_MAX_PORT) {
300 if (product == MOSCHIP_DEVICE_ID_7715) {
301 value = value*0x100+0x100;
302 } else {
303 value = value*0x100+0x200;
304 }
305 } else {
306 value = 0x0000;
307 if ((product == MOSCHIP_DEVICE_ID_7715) &&
308 (index != 0x08)) {
309 dbg("serial->product== MOSCHIP_DEVICE_ID_7715");
310 //index = 0x01 ;
311 }
312 }
313
314 if (request == MOS_WRITE) {
315 request = (__u8)MOS_WRITE;
316 requesttype = (__u8)0x40;
317 value = value + (__u16)*((unsigned char *)data);
318 data = NULL;
319 pipe = usb_sndctrlpipe(serial->dev, 0);
320 } else {
321 request = (__u8)MOS_READ;
322 requesttype = (__u8)0xC0;
323 size = 0x01;
324 pipe = usb_rcvctrlpipe(serial->dev,0);
325 }
326
327 status = usb_control_msg(serial->dev, pipe, request, requesttype,
328 value, index, data, size, MOS_WDR_TIMEOUT);
329
330 if (status < 0)
331 dbg("Command Write failed Value %x index %x\n",value,index);
332
333 return status;
334}
335
336static int mos7720_open(struct usb_serial_port *port, struct file * filp)
337{
338 struct usb_serial *serial;
339 struct usb_serial_port *port0;
340 struct urb *urb;
341 struct moschip_serial *mos7720_serial;
342 struct moschip_port *mos7720_port;
343 int response;
344 int port_number;
345 char data;
346 int j;
347
348 serial = port->serial;
349
350 mos7720_port = usb_get_serial_port_data(port);
351 if (mos7720_port == NULL)
352 return -ENODEV;
353
354 port0 = serial->port[0];
355
356 mos7720_serial = usb_get_serial_data(serial);
357
358 if (mos7720_serial == NULL || port0 == NULL)
359 return -ENODEV;
360
361 usb_clear_halt(serial->dev, port->write_urb->pipe);
362 usb_clear_halt(serial->dev, port->read_urb->pipe);
363
364 /* Initialising the write urb pool */
365 for (j = 0; j < NUM_URBS; ++j) {
366 urb = usb_alloc_urb(0,SLAB_ATOMIC);
367 mos7720_port->write_urb_pool[j] = urb;
368
369 if (urb == NULL) {
370 err("No more urbs???");
371 continue;
372 }
373
374 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
375 GFP_KERNEL);
376 if (!urb->transfer_buffer) {
377 err("%s-out of memory for urb buffers.", __FUNCTION__);
378 continue;
379 }
380 }
381
382 /* Initialize MCS7720 -- Write Init values to corresponding Registers
383 *
384 * Register Index
385 * 1 : IER
386 * 2 : FCR
387 * 3 : LCR
388 * 4 : MCR
389 *
390 * 0x08 : SP1/2 Control Reg
391 */
392 port_number = port->number - port->serial->minor;
393 send_mos_cmd(port->serial, MOS_READ, port_number, UART_LSR, &data);
394 dbg("SS::%p LSR:%x\n",mos7720_port, data);
395
396 dbg("Check:Sending Command ..........");
397
398 data = 0x02;
399 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x01, &data);
400 data = 0x02;
401 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x02, &data);
402
403 data = 0x00;
404 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
405 data = 0x00;
406 send_mos_cmd(serial, MOS_WRITE, port_number, 0x02, &data);
407
408 data = 0xCF;
409 send_mos_cmd(serial, MOS_WRITE, port_number, 0x02, &data);
410 data = 0x03;
411 mos7720_port->shadowLCR = data;
412 send_mos_cmd(serial, MOS_WRITE, port_number, 0x03, &data);
413 data = 0x0b;
414 mos7720_port->shadowMCR = data;
415 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
416 data = 0x0b;
417 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
418
419 data = 0x00;
420 send_mos_cmd(serial, MOS_READ, MOS_MAX_PORT, 0x08, &data);
421 data = 0x00;
422 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x08, &data);
423
424/* data = 0x00;
425 send_mos_cmd(serial, MOS_READ, MOS_MAX_PORT, port_number + 1, &data);
426 data = 0x03;
427 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, port_number + 1, &data);
428 data = 0x00;
429 send_mos_cmd(port->serial, MOS_WRITE, MOS_MAX_PORT, port_number + 1, &data);
430*/
431 data = 0x00;
432 send_mos_cmd(serial, MOS_READ, MOS_MAX_PORT, 0x08, &data);
433
434 data = data | (port->number - port->serial->minor + 1);
435 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x08, &data);
436
437 data = 0x83;
438 mos7720_port->shadowLCR = data;
439 send_mos_cmd(serial, MOS_WRITE, port_number, 0x03, &data);
440 data = 0x0c;
441 send_mos_cmd(serial, MOS_WRITE, port_number, 0x00, &data);
442 data = 0x00;
443 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
444 data = 0x03;
445 mos7720_port->shadowLCR = data;
446 send_mos_cmd(serial, MOS_WRITE, port_number, 0x03, &data);
447 data = 0x0c;
448 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
449 data = 0x0c;
450 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
451
452//Matrix
453
454 /* force low_latency on so that our tty_push actually forces *
455 * the data through,otherwise it is scheduled, and with *
456 * high data rates (like with OHCI) data can get lost. */
457
458 if (port->tty)
459 port->tty->low_latency = 1;
460
461 /* see if we've set up our endpoint info yet *
462 * (can't set it up in mos7720_startup as the *
463 * structures were not set up at that time.) */
464 if (!mos7720_serial->interrupt_started) {
465 dbg("Interrupt buffer NULL !!!");
466
467 /* not set up yet, so do it now */
468 mos7720_serial->interrupt_started = 1;
469
470 dbg("To Submit URB !!!");
471
472 /* set up our interrupt urb */
473 usb_fill_int_urb(port0->interrupt_in_urb, serial->dev,
474 usb_rcvintpipe(serial->dev,
475 port->interrupt_in_endpointAddress),
476 port0->interrupt_in_buffer,
477 port0->interrupt_in_urb->transfer_buffer_length,
478 mos7720_interrupt_callback, mos7720_port,
479 port0->interrupt_in_urb->interval);
480
481 /* start interrupt read for this mos7720 this interrupt *
482 * will continue as long as the mos7720 is connected */
483 dbg("Submit URB over !!!");
484 response = usb_submit_urb(port0->interrupt_in_urb, GFP_KERNEL);
485 if (response)
486 dev_err(&port->dev,
487 "%s - Error %d submitting control urb",
488 __FUNCTION__, response);
489 }
490
491 /* set up our bulk in urb */
492 usb_fill_bulk_urb(port->read_urb, serial->dev,
493 usb_rcvbulkpipe(serial->dev,
494 port->bulk_in_endpointAddress),
495 port->bulk_in_buffer,
496 port->read_urb->transfer_buffer_length,
497 mos7720_bulk_in_callback, mos7720_port);
498 response = usb_submit_urb(port->read_urb, GFP_KERNEL);
499 if (response)
500 dev_err(&port->dev,
501 "%s - Error %d submitting read urb", __FUNCTION__, response);
502
503 /* initialize our icount structure */
504 memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount));
505
506 /* initialize our port settings */
507 mos7720_port->shadowMCR = UART_MCR_OUT2; /* Must set to enable ints! */
508
509 /* send a open port command */
510 mos7720_port->open = 1;
511
512 return 0;
513}
514
515/*
516 * mos7720_chars_in_buffer
517 * this function is called by the tty driver when it wants to know how many
518 * bytes of data we currently have outstanding in the port (data that has
519 * been written, but hasn't made it out the port yet)
520 * If successful, we return the number of bytes left to be written in the
521 * system,
522 * Otherwise we return a negative error number.
523 */
524static int mos7720_chars_in_buffer(struct usb_serial_port *port)
525{
526 int i;
527 int chars = 0;
528 struct moschip_port *mos7720_port;
529
530 dbg("%s:entering ...........", __FUNCTION__);
531
532 mos7720_port = usb_get_serial_port_data(port);
533 if (mos7720_port == NULL) {
534 dbg("%s:leaving ...........", __FUNCTION__);
535 return -ENODEV;
536 }
537
538 for (i = 0; i < NUM_URBS; ++i) {
539 if (mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
540 chars += URB_TRANSFER_BUFFER_SIZE;
541 }
542 dbg("%s - returns %d", __FUNCTION__, chars);
543 return chars;
544}
545
546static void mos7720_close(struct usb_serial_port *port, struct file *filp)
547{
548 struct usb_serial *serial;
549 struct moschip_port *mos7720_port;
550 char data;
551 int j;
552
553 dbg("mos7720_close:entering...");
554
555 serial = port->serial;
556
557 mos7720_port = usb_get_serial_port_data(port);
558 if (mos7720_port == NULL)
559 return;
560
561 for (j = 0; j < NUM_URBS; ++j)
562 usb_kill_urb(mos7720_port->write_urb_pool[j]);
563
564 /* Freeing Write URBs */
565 for (j = 0; j < NUM_URBS; ++j) {
566 if (mos7720_port->write_urb_pool[j]) {
567 kfree(mos7720_port->write_urb_pool[j]->transfer_buffer);
568 usb_free_urb(mos7720_port->write_urb_pool[j]);
569 }
570 }
571
572 /* While closing port, shutdown all bulk read, write *
573 * and interrupt read if they exists */
574 if (serial->dev) {
575 dbg("Shutdown bulk write");
576 usb_kill_urb(port->write_urb);
577 dbg("Shutdown bulk read");
578 usb_kill_urb(port->read_urb);
579 }
580
581 data = 0x00;
582 send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
583 0x04, &data);
584
585 data = 0x00;
586 send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
587 0x01, &data);
588
589 mos7720_port->open = 0;
590
591 dbg("Leaving %s", __FUNCTION__);
592}
593
594static void mos7720_break(struct usb_serial_port *port, int break_state)
595{
596 unsigned char data;
597 struct usb_serial *serial;
598 struct moschip_port *mos7720_port;
599
600 dbg("Entering %s", __FUNCTION__);
601
602 serial = port->serial;
603
604 mos7720_port = usb_get_serial_port_data(port);
605 if (mos7720_port == NULL)
606 return;
607
608 if (break_state == -1)
609 data = mos7720_port->shadowLCR | UART_LCR_SBC;
610 else
611 data = mos7720_port->shadowLCR & ~UART_LCR_SBC;
612
613 mos7720_port->shadowLCR = data;
614 send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
615 0x03, &data);
616
617 return;
618}
619
620/*
621 * mos7720_write_room
622 * this function is called by the tty driver when it wants to know how many
623 * bytes of data we can accept for a specific port.
624 * If successful, we return the amount of room that we have for this port
625 * Otherwise we return a negative error number.
626 */
627static int mos7720_write_room(struct usb_serial_port *port)
628{
629 struct moschip_port *mos7720_port;
630 int room = 0;
631 int i;
632
633 dbg("%s:entering ...........", __FUNCTION__);
634
635 mos7720_port = usb_get_serial_port_data(port);
636 if (mos7720_port == NULL) {
637 dbg("%s:leaving ...........", __FUNCTION__);
638 return -ENODEV;
639 }
640
641 for (i = 0; i < NUM_URBS; ++i) {
642 if (mos7720_port->write_urb_pool[i]->status != -EINPROGRESS)
643 room += URB_TRANSFER_BUFFER_SIZE;
644 }
645
646 dbg("%s - returns %d", __FUNCTION__, room);
647 return room;
648}
649
650static int mos7720_write(struct usb_serial_port *port,
651 const unsigned char *data, int count)
652{
653 int status;
654 int i;
655 int bytes_sent = 0;
656 int transfer_size;
657
658 struct moschip_port *mos7720_port;
659 struct usb_serial *serial;
660 struct urb *urb;
661 const unsigned char *current_position = data;
662
663 dbg("%s:entering ...........", __FUNCTION__);
664
665 serial = port->serial;
666
667 mos7720_port = usb_get_serial_port_data(port);
668 if (mos7720_port == NULL) {
669 dbg("mos7720_port is NULL");
670 return -ENODEV;
671 }
672
673 /* try to find a free urb in the list */
674 urb = NULL;
675
676 for (i = 0; i < NUM_URBS; ++i) {
677 if (mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) {
678 urb = mos7720_port->write_urb_pool[i];
679 dbg("URB:%d",i);
680 break;
681 }
682 }
683
684 if (urb == NULL) {
685 dbg("%s - no more free urbs", __FUNCTION__);
686 goto exit;
687 }
688
689 if (urb->transfer_buffer == NULL) {
690 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
691 GFP_KERNEL);
692 if (urb->transfer_buffer == NULL) {
693 err("%s no more kernel memory...", __FUNCTION__);
694 goto exit;
695 }
696 }
697 transfer_size = min (count, URB_TRANSFER_BUFFER_SIZE);
698
699 memcpy(urb->transfer_buffer, current_position, transfer_size);
700 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size,
701 urb->transfer_buffer);
702
703 /* fill urb with data and submit */
704 usb_fill_bulk_urb(urb, serial->dev,
705 usb_sndbulkpipe(serial->dev,
706 port->bulk_out_endpointAddress),
707 urb->transfer_buffer, transfer_size,
708 mos7720_bulk_out_data_callback, mos7720_port);
709
710 /* send it down the pipe */
711 status = usb_submit_urb(urb,GFP_ATOMIC);
712 if (status) {
713 err("%s - usb_submit_urb(write bulk) failed with status = %d",
714 __FUNCTION__, status);
715 bytes_sent = status;
716 goto exit;
717 }
718 bytes_sent = transfer_size;
719
720exit:
721 return bytes_sent;
722}
723
724static void mos7720_throttle(struct usb_serial_port *port)
725{
726 struct moschip_port *mos7720_port;
727 struct tty_struct *tty;
728 int status;
729
730 dbg("%s- port %d\n", __FUNCTION__, port->number);
731
732 mos7720_port = usb_get_serial_port_data(port);
733
734 if (mos7720_port == NULL)
735 return;
736
737 if (!mos7720_port->open) {
738 dbg("port not opened");
739 return;
740 }
741
742 dbg("%s: Entering ..........", __FUNCTION__);
743
744 tty = port->tty;
745 if (!tty) {
746 dbg("%s - no tty available", __FUNCTION__);
747 return;
748 }
749
750 /* if we are implementing XON/XOFF, send the stop character */
751 if (I_IXOFF(tty)) {
752 unsigned char stop_char = STOP_CHAR(tty);
753 status = mos7720_write(port, &stop_char, 1);
754 if (status <= 0)
755 return;
756 }
757
758 /* if we are implementing RTS/CTS, toggle that line */
759 if (tty->termios->c_cflag & CRTSCTS) {
760 mos7720_port->shadowMCR &= ~UART_MCR_RTS;
761 status = send_mos_cmd(port->serial, MOS_WRITE,
762 port->number - port->serial->minor,
763 UART_MCR, &mos7720_port->shadowMCR);
764 if (status != 0)
765 return;
766 }
767}
768
769static void mos7720_unthrottle(struct usb_serial_port *port)
770{
771 struct tty_struct *tty;
772 int status;
773 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
774
775 if (mos7720_port == NULL)
776 return;
777
778 if (!mos7720_port->open) {
779 dbg("%s - port not opened", __FUNCTION__);
780 return;
781 }
782
783 dbg("%s: Entering ..........", __FUNCTION__);
784
785 tty = port->tty;
786 if (!tty) {
787 dbg("%s - no tty available", __FUNCTION__);
788 return;
789 }
790
791 /* if we are implementing XON/XOFF, send the start character */
792 if (I_IXOFF(tty)) {
793 unsigned char start_char = START_CHAR(tty);
794 status = mos7720_write(port, &start_char, 1);
795 if (status <= 0)
796 return;
797 }
798
799 /* if we are implementing RTS/CTS, toggle that line */
800 if (tty->termios->c_cflag & CRTSCTS) {
801 mos7720_port->shadowMCR |= UART_MCR_RTS;
802 status = send_mos_cmd(port->serial, MOS_WRITE,
803 port->number - port->serial->minor,
804 UART_MCR, &mos7720_port->shadowMCR);
805 if (status != 0)
806 return;
807 }
808}
809
810static int set_higher_rates(struct moschip_port *mos7720_port,
811 unsigned int baud)
812{
813 unsigned char data;
814 struct usb_serial_port *port;
815 struct usb_serial *serial;
816 int port_number;
817
818 if (mos7720_port == NULL)
819 return -EINVAL;
820
821 port = mos7720_port->port;
822 serial = port->serial;
823
824 /***********************************************
825 * Init Sequence for higher rates
826 ***********************************************/
827 dbg("Sending Setting Commands ..........");
828 port_number = port->number - port->serial->minor;
829
830 data = 0x000;
831 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
832 data = 0x000;
833 send_mos_cmd(serial, MOS_WRITE, port_number, 0x02, &data);
834 data = 0x0CF;
835 send_mos_cmd(serial, MOS_WRITE, port->number, 0x02, &data);
836 data = 0x00b;
837 mos7720_port->shadowMCR = data;
838 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
839 data = 0x00b;
840 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
841
842 data = 0x000;
843 send_mos_cmd(serial, MOS_READ, MOS_MAX_PORT, 0x08, &data);
844 data = 0x000;
845 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x08, &data);
846
847
848 /***********************************************
849 * Set for higher rates *
850 ***********************************************/
851
852 data = baud * 0x10;
853 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, port_number + 1,&data);
854
855 data = 0x003;
856 send_mos_cmd(serial, MOS_READ, MOS_MAX_PORT, 0x08, &data);
857 data = 0x003;
858 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT, 0x08, &data);
859
860 data = 0x02b;
861 mos7720_port->shadowMCR = data;
862 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
863 data = 0x02b;
864 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
865
866 /***********************************************
867 * Set DLL/DLM
868 ***********************************************/
869
870 data = mos7720_port->shadowLCR | UART_LCR_DLAB;
871 mos7720_port->shadowLCR = data;
872 send_mos_cmd(serial, MOS_WRITE, port_number, 0x03, &data);
873
874 data = 0x001; /* DLL */
875 send_mos_cmd(serial, MOS_WRITE, port_number, 0x00, &data);
876 data = 0x000; /* DLM */
877 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
878
879 data = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
880 mos7720_port->shadowLCR = data;
881 send_mos_cmd(serial, MOS_WRITE, port_number, 0x03, &data);
882
883 return 0;
884}
885
886/* baud rate information */
887struct divisor_table_entry
888{
889 __u32 baudrate;
890 __u16 divisor;
891};
892
893/* Define table of divisors for moschip 7720 hardware *
894 * These assume a 3.6864MHz crystal, the standard /16, and *
895 * MCR.7 = 0. */
896static struct divisor_table_entry divisor_table[] = {
897 { 50, 2304},
898 { 110, 1047}, /* 2094.545455 => 230450 => .0217 % over */
899 { 134, 857}, /* 1713.011152 => 230398.5 => .00065% under */
900 { 150, 768},
901 { 300, 384},
902 { 600, 192},
903 { 1200, 96},
904 { 1800, 64},
905 { 2400, 48},
906 { 4800, 24},
907 { 7200, 16},
908 { 9600, 12},
909 { 19200, 6},
910 { 38400, 3},
911 { 57600, 2},
912 { 115200, 1},
913};
914
915/*****************************************************************************
916 * calc_baud_rate_divisor
917 * this function calculates the proper baud rate divisor for the specified
918 * baud rate.
919 *****************************************************************************/
920static int calc_baud_rate_divisor(int baudrate, int *divisor)
921{
922 int i;
923 __u16 custom;
924 __u16 round1;
925 __u16 round;
926
927
928 dbg("%s - %d", __FUNCTION__, baudrate);
929
930 for (i = 0; i < ARRAY_SIZE(divisor_table); i++) {
931 if (divisor_table[i].baudrate == baudrate) {
932 *divisor = divisor_table[i].divisor;
933 return 0;
934 }
935 }
936
937 /* After trying for all the standard baud rates *
938 * Try calculating the divisor for this baud rate */
939 if (baudrate > 75 && baudrate < 230400) {
940 /* get the divisor */
941 custom = (__u16)(230400L / baudrate);
942
943 /* Check for round off */
944 round1 = (__u16)(2304000L / baudrate);
945 round = (__u16)(round1 - (custom * 10));
946 if (round > 4)
947 custom++;
948 *divisor = custom;
949
950 dbg("Baud %d = %d",baudrate, custom);
951 return 0;
952 }
953
954 dbg("Baud calculation Failed...");
955 return -EINVAL;
956}
957
958/*
959 * send_cmd_write_baud_rate
960 * this function sends the proper command to change the baud rate of the
961 * specified port.
962 */
963static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
964 int baudrate)
965{
966 struct usb_serial_port *port;
967 struct usb_serial *serial;
968 int divisor;
969 int status;
970 unsigned char data;
971 unsigned char number;
972
973 if (mos7720_port == NULL)
974 return -1;
975
976 port = mos7720_port->port;
977 serial = port->serial;
978
979 dbg("%s: Entering ..........", __FUNCTION__);
980
981 number = port->number - port->serial->minor;
982 dbg("%s - port = %d, baud = %d", __FUNCTION__, port->number, baudrate);
983
984 /* Calculate the Divisor */
985 status = calc_baud_rate_divisor(baudrate, &divisor);
986 if (status) {
987 err("%s - bad baud rate", __FUNCTION__);
988 return status;
989 }
990
991 /* Enable access to divisor latch */
992 data = mos7720_port->shadowLCR | UART_LCR_DLAB;
993 mos7720_port->shadowLCR = data;
994 send_mos_cmd(serial, MOS_WRITE, number, UART_LCR, &data);
995
996 /* Write the divisor */
997 data = ((unsigned char)(divisor & 0xff));
998 send_mos_cmd(serial, MOS_WRITE, number, 0x00, &data);
999
1000 data = ((unsigned char)((divisor & 0xff00) >> 8));
1001 send_mos_cmd(serial, MOS_WRITE, number, 0x01, &data);
1002
1003 /* Disable access to divisor latch */
1004 data = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
1005 mos7720_port->shadowLCR = data;
1006 send_mos_cmd(serial, MOS_WRITE, number, 0x03, &data);
1007
1008 return status;
1009}
1010
1011/*
1012 * change_port_settings
1013 * This routine is called to set the UART on the device to match
1014 * the specified new settings.
1015 */
1016static void change_port_settings(struct moschip_port *mos7720_port,
1017 struct termios *old_termios)
1018{
1019 struct usb_serial_port *port;
1020 struct usb_serial *serial;
1021 struct tty_struct *tty;
1022 int baud;
1023 unsigned cflag;
1024 unsigned iflag;
1025 __u8 mask = 0xff;
1026 __u8 lData;
1027 __u8 lParity;
1028 __u8 lStop;
1029 int status;
1030 int port_number;
1031 char data;
1032
1033 if (mos7720_port == NULL)
1034 return ;
1035
1036 port = mos7720_port->port;
1037 serial = port->serial;
1038 port_number = port->number - port->serial->minor;
1039
1040 dbg("%s - port %d", __FUNCTION__, port->number);
1041
1042 if (!mos7720_port->open) {
1043 dbg("%s - port not opened", __FUNCTION__);
1044 return;
1045 }
1046
1047 tty = mos7720_port->port->tty;
1048
1049 if ((!tty) || (!tty->termios)) {
1050 dbg("%s - no tty structures", __FUNCTION__);
1051 return;
1052 }
1053
1054 dbg("%s: Entering ..........", __FUNCTION__);
1055
1056 lData = UART_LCR_WLEN8;
1057 lStop = 0x00; /* 1 stop bit */
1058 lParity = 0x00; /* No parity */
1059
1060 cflag = tty->termios->c_cflag;
1061 iflag = tty->termios->c_iflag;
1062
1063 /* Change the number of bits */
1064 switch (cflag & CSIZE) {
1065 case CS5:
1066 lData = UART_LCR_WLEN5;
1067 mask = 0x1f;
1068 break;
1069
1070 case CS6:
1071 lData = UART_LCR_WLEN6;
1072 mask = 0x3f;
1073 break;
1074
1075 case CS7:
1076 lData = UART_LCR_WLEN7;
1077 mask = 0x7f;
1078 break;
1079 default:
1080 case CS8:
1081 lData = UART_LCR_WLEN8;
1082 break;
1083 }
1084
1085 /* Change the Parity bit */
1086 if (cflag & PARENB) {
1087 if (cflag & PARODD) {
1088 lParity = UART_LCR_PARITY;
1089 dbg("%s - parity = odd", __FUNCTION__);
1090 } else {
1091 lParity = (UART_LCR_EPAR | UART_LCR_PARITY);
1092 dbg("%s - parity = even", __FUNCTION__);
1093 }
1094
1095 } else {
1096 dbg("%s - parity = none", __FUNCTION__);
1097 }
1098
1099 if (cflag & CMSPAR)
1100 lParity = lParity | 0x20;
1101
1102 /* Change the Stop bit */
1103 if (cflag & CSTOPB) {
1104 lStop = UART_LCR_STOP;
1105 dbg("%s - stop bits = 2", __FUNCTION__);
1106 } else {
1107 lStop = 0x00;
1108 dbg("%s - stop bits = 1", __FUNCTION__);
1109 }
1110
1111#define LCR_BITS_MASK 0x03 /* Mask for bits/char field */
1112#define LCR_STOP_MASK 0x04 /* Mask for stop bits field */
1113#define LCR_PAR_MASK 0x38 /* Mask for parity field */
1114
1115 /* Update the LCR with the correct value */
1116 mos7720_port->shadowLCR &= ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK);
1117 mos7720_port->shadowLCR |= (lData | lParity | lStop);
1118
1119
1120 /* Disable Interrupts */
1121 data = 0x00;
1122 send_mos_cmd(serial,MOS_WRITE,port->number - port->serial->minor, UART_IER, &data);
1123
1124 data = 0x00;
1125 send_mos_cmd(serial, MOS_WRITE, port_number, UART_FCR, &data);
1126
1127 data = 0xcf;
1128 send_mos_cmd(serial, MOS_WRITE, port_number, UART_FCR, &data);
1129
1130 /* Send the updated LCR value to the mos7720 */
1131 data = mos7720_port->shadowLCR;
1132 send_mos_cmd(serial, MOS_WRITE, port_number, UART_LCR, &data);
1133
1134 data = 0x00b;
1135 mos7720_port->shadowMCR = data;
1136 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
1137 data = 0x00b;
1138 send_mos_cmd(serial, MOS_WRITE, port_number, 0x04, &data);
1139
1140 /* set up the MCR register and send it to the mos7720 */
1141 mos7720_port->shadowMCR = UART_MCR_OUT2;
1142 if (cflag & CBAUD)
1143 mos7720_port->shadowMCR |= (UART_MCR_DTR | UART_MCR_RTS);
1144
1145 if (cflag & CRTSCTS) {
1146 mos7720_port->shadowMCR |= (UART_MCR_XONANY);
1147
1148 /* To set hardware flow control to the specified *
1149 * serial port, in SP1/2_CONTROL_REG */
1150 if (port->number) {
1151 data = 0x001;
1152 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT,
1153 0x08, &data);
1154 } else {
1155 data = 0x002;
1156 send_mos_cmd(serial, MOS_WRITE, MOS_MAX_PORT,
1157 0x08, &data);
1158 }
1159 } else {
1160 mos7720_port->shadowMCR &= ~(UART_MCR_XONANY);
1161 }
1162
1163 data = mos7720_port->shadowMCR;
1164 send_mos_cmd(serial, MOS_WRITE, port_number, UART_MCR, &data);
1165
1166 /* Determine divisor based on baud rate */
1167 baud = tty_get_baud_rate(tty);
1168 if (!baud) {
1169 /* pick a default, any default... */
1170 dbg("Picked default baud...");
1171 baud = 9600;
1172 }
1173
1174 if (baud >= 230400) {
1175 set_higher_rates(mos7720_port, baud);
1176 /* Enable Interrupts */
1177 data = 0x0c;
1178 send_mos_cmd(serial, MOS_WRITE, port_number, UART_IER, &data);
1179 return;
1180 }
1181
1182 dbg("%s - baud rate = %d", __FUNCTION__, baud);
1183 status = send_cmd_write_baud_rate(mos7720_port, baud);
1184
1185 /* Enable Interrupts */
1186 data = 0x0c;
1187 send_mos_cmd(serial, MOS_WRITE, port_number, UART_IER, &data);
1188
1189 if (port->read_urb->status != -EINPROGRESS) {
1190 port->read_urb->dev = serial->dev;
1191
1192 status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1193 if (status)
1194 dbg("usb_submit_urb(read bulk) failed, status = %d",
1195 status);
1196 }
1197 return;
1198}
1199
1200/*
1201 * mos7720_set_termios
1202 * this function is called by the tty driver when it wants to change the
1203 * termios structure.
1204 */
1205static void mos7720_set_termios(struct usb_serial_port *port,
1206 struct termios *old_termios)
1207{
1208 int status;
1209 unsigned int cflag;
1210 struct usb_serial *serial;
1211 struct moschip_port *mos7720_port;
1212 struct tty_struct *tty;
1213
1214 serial = port->serial;
1215
1216 mos7720_port = usb_get_serial_port_data(port);
1217
1218 if (mos7720_port == NULL)
1219 return;
1220
1221 tty = port->tty;
1222
1223 if (!port->tty || !port->tty->termios) {
1224 dbg("%s - no tty or termios", __FUNCTION__);
1225 return;
1226 }
1227
1228 if (!mos7720_port->open) {
1229 dbg("%s - port not opened", __FUNCTION__);
1230 return;
1231 }
1232
1233 dbg("%s\n","setting termios - ASPIRE");
1234
1235 cflag = tty->termios->c_cflag;
1236
1237 if (!cflag) {
1238 printk("%s %s\n",__FUNCTION__,"cflag is NULL");
1239 return;
1240 }
1241
1242 /* check that they really want us to change something */
1243 if (old_termios) {
1244 if ((cflag == old_termios->c_cflag) &&
1245 (RELEVANT_IFLAG(tty->termios->c_iflag) ==
1246 RELEVANT_IFLAG(old_termios->c_iflag))) {
1247 dbg("Nothing to change");
1248 return;
1249 }
1250 }
1251
1252 dbg("%s - clfag %08x iflag %08x", __FUNCTION__,
1253 tty->termios->c_cflag,
1254 RELEVANT_IFLAG(tty->termios->c_iflag));
1255
1256 if (old_termios)
1257 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
1258 old_termios->c_cflag,
1259 RELEVANT_IFLAG(old_termios->c_iflag));
1260
1261 dbg("%s - port %d", __FUNCTION__, port->number);
1262
1263 /* change the port settings to the new ones specified */
1264 change_port_settings(mos7720_port, old_termios);
1265
1266 if(!port->read_urb) {
1267 dbg("%s","URB KILLED !!!!!\n");
1268 return;
1269 }
1270
1271 if(port->read_urb->status != -EINPROGRESS) {
1272 port->read_urb->dev = serial->dev;
1273 status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1274 if (status)
1275 dbg("usb_submit_urb(read bulk) failed, status = %d",
1276 status);
1277 }
1278 return;
1279}
1280
1281/*
1282 * get_lsr_info - get line status register info
1283 *
1284 * Purpose: Let user call ioctl() to get info when the UART physically
1285 * is emptied. On bus types like RS485, the transmitter must
1286 * release the bus after transmitting. This must be done when
1287 * the transmit shift register is empty, not be done when the
1288 * transmit holding register is empty. This functionality
1289 * allows an RS485 driver to be written in user space.
1290 */
1291static int get_lsr_info(struct moschip_port *mos7720_port,
1292 unsigned int __user *value)
1293{
1294 int count;
1295 unsigned int result = 0;
1296
1297 count = mos7720_chars_in_buffer(mos7720_port->port);
1298 if (count == 0) {
1299 dbg("%s -- Empty", __FUNCTION__);
1300 result = TIOCSER_TEMT;
1301 }
1302
1303 if (copy_to_user(value, &result, sizeof(int)))
1304 return -EFAULT;
1305 return 0;
1306}
1307
1308/*
1309 * get_number_bytes_avail - get number of bytes available
1310 *
1311 * Purpose: Let user call ioctl to get the count of number of bytes available.
1312 */
1313static int get_number_bytes_avail(struct moschip_port *mos7720_port,
1314 unsigned int __user *value)
1315{
1316 unsigned int result = 0;
1317 struct tty_struct *tty = mos7720_port->port->tty;
1318
1319 if (!tty)
1320 return -ENOIOCTLCMD;
1321
1322 result = tty->read_cnt;
1323
1324 dbg("%s(%d) = %d", __FUNCTION__, mos7720_port->port->number, result);
1325 if (copy_to_user(value, &result, sizeof(int)))
1326 return -EFAULT;
1327
1328 return -ENOIOCTLCMD;
1329}
1330
1331static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1332 unsigned int __user *value)
1333{
1334 unsigned int mcr ;
1335 unsigned int arg;
1336 unsigned char data;
1337
1338 struct usb_serial_port *port;
1339
1340 if (mos7720_port == NULL)
1341 return -1;
1342
1343 port = (struct usb_serial_port*)mos7720_port->port;
1344 mcr = mos7720_port->shadowMCR;
1345
1346 if (copy_from_user(&arg, value, sizeof(int)))
1347 return -EFAULT;
1348
1349 switch (cmd) {
1350 case TIOCMBIS:
1351 if (arg & TIOCM_RTS)
1352 mcr |= UART_MCR_RTS;
1353 if (arg & TIOCM_DTR)
1354 mcr |= UART_MCR_RTS;
1355 if (arg & TIOCM_LOOP)
1356 mcr |= UART_MCR_LOOP;
1357 break;
1358
1359 case TIOCMBIC:
1360 if (arg & TIOCM_RTS)
1361 mcr &= ~UART_MCR_RTS;
1362 if (arg & TIOCM_DTR)
1363 mcr &= ~UART_MCR_RTS;
1364 if (arg & TIOCM_LOOP)
1365 mcr &= ~UART_MCR_LOOP;
1366 break;
1367
1368 case TIOCMSET:
1369 /* turn off the RTS and DTR and LOOPBACK
1370 * and then only turn on what was asked to */
1371 mcr &= ~(UART_MCR_RTS | UART_MCR_DTR | UART_MCR_LOOP);
1372 mcr |= ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0);
1373 mcr |= ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0);
1374 mcr |= ((arg & TIOCM_LOOP) ? UART_MCR_LOOP : 0);
1375 break;
1376 }
1377
1378 mos7720_port->shadowMCR = mcr;
1379
1380 data = mos7720_port->shadowMCR;
1381 send_mos_cmd(port->serial, MOS_WRITE,
1382 port->number - port->serial->minor, UART_MCR, &data);
1383
1384 return 0;
1385}
1386
1387static int get_modem_info(struct moschip_port *mos7720_port,
1388 unsigned int __user *value)
1389{
1390 unsigned int result = 0;
1391 unsigned int msr = mos7720_port->shadowMSR;
1392 unsigned int mcr = mos7720_port->shadowMCR;
1393
1394 result = ((mcr & UART_MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */
1395 | ((mcr & UART_MCR_RTS) ? TIOCM_RTS: 0) /* 0x004 */
1396 | ((msr & UART_MSR_CTS) ? TIOCM_CTS: 0) /* 0x020 */
1397 | ((msr & UART_MSR_DCD) ? TIOCM_CAR: 0) /* 0x040 */
1398 | ((msr & UART_MSR_RI) ? TIOCM_RI: 0) /* 0x080 */
1399 | ((msr & UART_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */
1400
1401
1402 dbg("%s -- %x", __FUNCTION__, result);
1403
1404 if (copy_to_user(value, &result, sizeof(int)))
1405 return -EFAULT;
1406 return 0;
1407}
1408
1409static int get_serial_info(struct moschip_port *mos7720_port,
1410 struct serial_struct __user *retinfo)
1411{
1412 struct serial_struct tmp;
1413
1414 if (!retinfo)
1415 return -EFAULT;
1416
1417 memset(&tmp, 0, sizeof(tmp));
1418
1419 tmp.type = PORT_16550A;
1420 tmp.line = mos7720_port->port->serial->minor;
1421 tmp.port = mos7720_port->port->number;
1422 tmp.irq = 0;
1423 tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
1424 tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
1425 tmp.baud_base = 9600;
1426 tmp.close_delay = 5*HZ;
1427 tmp.closing_wait = 30*HZ;
1428
1429 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
1430 return -EFAULT;
1431 return 0;
1432}
1433
1434static int mos7720_ioctl(struct usb_serial_port *port, struct file *file,
1435 unsigned int cmd, unsigned long arg)
1436{
1437 struct moschip_port *mos7720_port;
1438 struct async_icount cnow;
1439 struct async_icount cprev;
1440 struct serial_icounter_struct icount;
1441
1442 mos7720_port = usb_get_serial_port_data(port);
1443 if (mos7720_port == NULL)
1444 return -ENODEV;
1445
1446 dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd);
1447
1448 switch (cmd) {
1449 case TIOCINQ:
1450 /* return number of bytes available */
1451 dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number);
1452 return get_number_bytes_avail(mos7720_port,
1453 (unsigned int __user *)arg);
1454 break;
1455
1456 case TIOCSERGETLSR:
1457 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number);
1458 return get_lsr_info(mos7720_port, (unsigned int __user *)arg);
1459 return 0;
1460
1461 case TIOCMBIS:
1462 case TIOCMBIC:
1463 case TIOCMSET:
1464 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__,
1465 port->number);
1466 return set_modem_info(mos7720_port, cmd,
1467 (unsigned int __user *)arg);
1468
1469 case TIOCMGET:
1470 dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
1471 return get_modem_info(mos7720_port,
1472 (unsigned int __user *)arg);
1473
1474 case TIOCGSERIAL:
1475 dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number);
1476 return get_serial_info(mos7720_port,
1477 (struct serial_struct __user *)arg);
1478
1479 case TIOCSSERIAL:
1480 dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number);
1481 break;
1482
1483 case TIOCMIWAIT:
1484 dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number);
1485 cprev = mos7720_port->icount;
1486 while (1) {
1487 if (signal_pending(current))
1488 return -ERESTARTSYS;
1489 cnow = mos7720_port->icount;
1490 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
1491 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
1492 return -EIO; /* no change => error */
1493 if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1494 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1495 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1496 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) {
1497 return 0;
1498 }
1499 cprev = cnow;
1500 }
1501 /* NOTREACHED */
1502 break;
1503
1504 case TIOCGICOUNT:
1505 cnow = mos7720_port->icount;
1506 icount.cts = cnow.cts;
1507 icount.dsr = cnow.dsr;
1508 icount.rng = cnow.rng;
1509 icount.dcd = cnow.dcd;
1510 icount.rx = cnow.rx;
1511 icount.tx = cnow.tx;
1512 icount.frame = cnow.frame;
1513 icount.overrun = cnow.overrun;
1514 icount.parity = cnow.parity;
1515 icount.brk = cnow.brk;
1516 icount.buf_overrun = cnow.buf_overrun;
1517
1518 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__,
1519 port->number, icount.rx, icount.tx );
1520 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
1521 return -EFAULT;
1522 return 0;
1523 }
1524
1525 return -ENOIOCTLCMD;
1526}
1527
1528static int mos7720_startup(struct usb_serial *serial)
1529{
1530 struct moschip_serial *mos7720_serial;
1531 struct moschip_port *mos7720_port;
1532 struct usb_device *dev;
1533 int i;
1534 char data;
1535
1536 dbg("%s: Entering ..........", __FUNCTION__);
1537
1538 if (!serial) {
1539 dbg("Invalid Handler");
1540 return -ENODEV;
1541 }
1542
1543 dev = serial->dev;
1544
1545 /* create our private serial structure */
1546 mos7720_serial = kzalloc(sizeof(struct moschip_serial), GFP_KERNEL);
1547 if (mos7720_serial == NULL) {
1548 err("%s - Out of memory", __FUNCTION__);
1549 return -ENOMEM;
1550 }
1551
1552 usb_set_serial_data(serial, mos7720_serial);
1553
1554 /* we set up the pointers to the endpoints in the mos7720_open *
1555 * function, as the structures aren't created yet. */
1556
1557 /* set up port private structures */
1558 for (i = 0; i < serial->num_ports; ++i) {
1559 mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
1560 if (mos7720_port == NULL) {
1561 err("%s - Out of memory", __FUNCTION__);
1562 usb_set_serial_data(serial, NULL);
1563 kfree(mos7720_serial);
1564 return -ENOMEM;
1565 }
1566
1567 /* Initialize all port interrupt end point to port 0 int
1568 * endpoint. Our device has only one interrupt endpoint
1569 * comman to all ports */
1570 serial->port[i]->interrupt_in_endpointAddress = serial->port[0]->interrupt_in_endpointAddress;
1571
1572 mos7720_port->port = serial->port[i];
1573 usb_set_serial_port_data(serial->port[i], mos7720_port);
1574
1575 dbg("port number is %d", serial->port[i]->number);
1576 dbg("serial number is %d", serial->minor);
1577 }
1578
1579
1580 /* setting configuration feature to one */
1581 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1582 (__u8)0x03, 0x00,0x01,0x00, NULL, 0x00, 5*HZ);
1583
1584 send_mos_cmd(serial,MOS_READ,0x00, UART_LSR, &data); // LSR For Port 1
1585 dbg("LSR:%x",data);
1586
1587 send_mos_cmd(serial,MOS_READ,0x01, UART_LSR, &data); // LSR For Port 2
1588 dbg("LSR:%x",data);
1589
1590 return 0;
1591}
1592
1593static void mos7720_shutdown(struct usb_serial *serial)
1594{
1595 int i;
1596
1597 /* free private structure allocated for serial port */
1598 for (i=0; i < serial->num_ports; ++i) {
1599 kfree(usb_get_serial_port_data(serial->port[i]));
1600 usb_set_serial_port_data(serial->port[i], NULL);
1601 }
1602
1603 /* free private structure allocated for serial device */
1604 kfree(usb_get_serial_data(serial));
1605 usb_set_serial_data(serial, NULL);
1606}
1607
1608static struct usb_serial_driver moschip7720_2port_driver = {
1609 .driver = {
1610 .owner = THIS_MODULE,
1611 .name = "moschip7720",
1612 },
1613 .description = "Moschip 2 port adapter",
1614 .id_table = moschip_port_id_table,
1615 .num_interrupt_in = 1,
1616 .num_bulk_in = 2,
1617 .num_bulk_out = 2,
1618 .num_ports = 2,
1619 .open = mos7720_open,
1620 .close = mos7720_close,
1621 .throttle = mos7720_throttle,
1622 .unthrottle = mos7720_unthrottle,
1623 .attach = mos7720_startup,
1624 .shutdown = mos7720_shutdown,
1625 .ioctl = mos7720_ioctl,
1626 .set_termios = mos7720_set_termios,
1627 .write = mos7720_write,
1628 .write_room = mos7720_write_room,
1629 .chars_in_buffer = mos7720_chars_in_buffer,
1630 .break_ctl = mos7720_break,
1631 .read_bulk_callback = mos7720_bulk_in_callback,
1632};
1633
1634static struct usb_driver usb_driver = {
1635 .name = "moschip7720",
1636 .probe = usb_serial_probe,
1637 .disconnect = usb_serial_disconnect,
1638 .id_table = moschip_port_id_table,
1639};
1640
1641static int __init moschip7720_init(void)
1642{
1643 int retval;
1644
1645 dbg("%s: Entering ..........", __FUNCTION__);
1646
1647 /* Register with the usb serial */
1648 retval = usb_serial_register(&moschip7720_2port_driver);
1649 if (retval)
1650 goto failed_port_device_register;
1651
1652 info(DRIVER_DESC " " DRIVER_VERSION);
1653
1654 /* Register with the usb */
1655 retval = usb_register(&usb_driver);
1656 if (retval)
1657 goto failed_usb_register;
1658
1659 return 0;
1660
1661failed_usb_register:
1662 usb_serial_deregister(&moschip7720_2port_driver);
1663
1664failed_port_device_register:
1665 return retval;
1666}
1667
1668static void __exit moschip7720_exit(void)
1669{
1670 usb_deregister(&usb_driver);
1671 usb_serial_deregister(&moschip7720_2port_driver);
1672}
1673
1674module_init(moschip7720_init);
1675module_exit(moschip7720_exit);
1676
1677/* Module information */
1678MODULE_AUTHOR( DRIVER_AUTHOR );
1679MODULE_DESCRIPTION( DRIVER_DESC );
1680MODULE_LICENSE("GPL");
1681
1682module_param(debug, bool, S_IRUGO | S_IWUSR);
1683MODULE_PARM_DESC(debug, "Debug enabled or not");
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 021be39fe16e..5b71962d0351 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2413,11 +2413,12 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2413 } 2413 }
2414 2414
2415 mos7840_port = mos7840_get_port_private(port); 2415 mos7840_port = mos7840_get_port_private(port);
2416 tty = mos7840_port->port->tty;
2417 2416
2418 if (mos7840_port == NULL) 2417 if (mos7840_port == NULL)
2419 return -1; 2418 return -1;
2420 2419
2420 tty = mos7840_port->port->tty;
2421
2421 dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); 2422 dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd);
2422 2423
2423 switch (cmd) { 2424 switch (cmd) {
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d29638daa987..ea16572d19f8 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -1,21 +1,35 @@
1/* 1/*
2 * Sierra Wireless CDMA Wireless Serial USB driver 2 USB Driver for Sierra Wireless
3 * 3
4 * Current Copy modified by: Kevin Lloyd <linux@sierrawireless.com> 4 Copyright (C) 2006 Kevin Lloyd <linux@sierrawireless.com>
5 * Original Copyright (C) 2005-2006 Greg Kroah-Hartman <gregkh@suse.de> 5
6 * 6 IMPORTANT DISCLAIMER: This driver is not commercially supported by
7 * This program is free software; you can redistribute it and/or 7 Sierra Wireless. Use at your own risk.
8 * modify it under the terms of the GNU General Public License version 8
9 * 2 as published by the Free Software Foundation. 9 This driver is free software; you can redistribute it and/or modify
10 */ 10 it under the terms of Version 2 of the GNU General Public License as
11 published by the Free Software Foundation.
12
13 Portions based on the option driver by Matthias Urlichs <smurf@smurf.noris.de>
14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
15
16 History:
17*/
18
19#define DRIVER_VERSION "v.1.0.5"
20#define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>"
21#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
11 22
12#include <linux/kernel.h> 23#include <linux/kernel.h>
13#include <linux/init.h> 24#include <linux/jiffies.h>
25#include <linux/errno.h>
14#include <linux/tty.h> 26#include <linux/tty.h>
27#include <linux/tty_flip.h>
15#include <linux/module.h> 28#include <linux/module.h>
16#include <linux/usb.h> 29#include <linux/usb.h>
17#include <linux/usb/serial.h> 30#include <linux/usb/serial.h>
18 31
32
19static struct usb_device_id id_table [] = { 33static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ 34 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
21 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 35 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
@@ -23,53 +37,674 @@ static struct usb_device_id id_table [] = {
23 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 37 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
24 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 38 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
25 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 39 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
40 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 for Europe */
26 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */ 41 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
27 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 42 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
28 /* Following devices are supported in the airprime.c driver */ 43
29 /* { USB_DEVICE(0x1199, 0x0112) }, */ /* Sierra Wireless AirCard 580 */ 44 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
30 /* { USB_DEVICE(0x0F3D, 0x0112) }, */ /* AirPrime/Sierra PC 5220 */ 45 { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra PC 5220 */
31 { } 46 { }
32}; 47};
33MODULE_DEVICE_TABLE(usb, id_table); 48MODULE_DEVICE_TABLE(usb, id_table);
34 49
50static struct usb_device_id id_table_1port [] = {
51 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
52 { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra PC 5220 */
53 { }
54};
55
56static struct usb_device_id id_table_3port [] = {
57 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
58 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
59 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
60 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
61 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
62 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
63 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
64 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
65 { }
66};
67
35static struct usb_driver sierra_driver = { 68static struct usb_driver sierra_driver = {
36 .name = "sierra_wireless", 69 .name = "sierra",
37 .probe = usb_serial_probe, 70 .probe = usb_serial_probe,
38 .disconnect = usb_serial_disconnect, 71 .disconnect = usb_serial_disconnect,
39 .id_table = id_table, 72 .id_table = id_table,
73 .no_dynamic_id = 1,
74};
75
76
77static int debug;
78
79/* per port private data */
80#define N_IN_URB 4
81#define N_OUT_URB 1
82#define IN_BUFLEN 4096
83#define OUT_BUFLEN 128
84
85struct sierra_port_private {
86 /* Input endpoints and buffer for this port */
87 struct urb *in_urbs[N_IN_URB];
88 char in_buffer[N_IN_URB][IN_BUFLEN];
89 /* Output endpoints and buffer for this port */
90 struct urb *out_urbs[N_OUT_URB];
91 char out_buffer[N_OUT_URB][OUT_BUFLEN];
92
93 /* Settings for the port */
94 int rts_state; /* Handshaking pins (outputs) */
95 int dtr_state;
96 int cts_state; /* Handshaking pins (inputs) */
97 int dsr_state;
98 int dcd_state;
99 int ri_state;
100
101 unsigned long tx_start_time[N_OUT_URB];
102};
103
104static int sierra_send_setup(struct usb_serial_port *port)
105{
106 struct usb_serial *serial = port->serial;
107 struct sierra_port_private *portdata;
108
109 dbg("%s", __FUNCTION__);
110
111 portdata = usb_get_serial_port_data(port);
112
113 if (port->tty) {
114 int val = 0;
115 if (portdata->dtr_state)
116 val |= 0x01;
117 if (portdata->rts_state)
118 val |= 0x02;
119
120 return usb_control_msg(serial->dev,
121 usb_rcvctrlpipe(serial->dev, 0),
122 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
123 }
124
125 return 0;
126}
127
128static void sierra_rx_throttle(struct usb_serial_port *port)
129{
130 dbg("%s", __FUNCTION__);
131}
132
133static void sierra_rx_unthrottle(struct usb_serial_port *port)
134{
135 dbg("%s", __FUNCTION__);
136}
137
138static void sierra_break_ctl(struct usb_serial_port *port, int break_state)
139{
140 /* Unfortunately, I don't know how to send a break */
141 dbg("%s", __FUNCTION__);
142}
143
144static void sierra_set_termios(struct usb_serial_port *port,
145 struct termios *old_termios)
146{
147 dbg("%s", __FUNCTION__);
148
149 sierra_send_setup(port);
150}
151
152static int sierra_tiocmget(struct usb_serial_port *port, struct file *file)
153{
154 unsigned int value;
155 struct sierra_port_private *portdata;
156
157 portdata = usb_get_serial_port_data(port);
158
159 value = ((portdata->rts_state) ? TIOCM_RTS : 0) |
160 ((portdata->dtr_state) ? TIOCM_DTR : 0) |
161 ((portdata->cts_state) ? TIOCM_CTS : 0) |
162 ((portdata->dsr_state) ? TIOCM_DSR : 0) |
163 ((portdata->dcd_state) ? TIOCM_CAR : 0) |
164 ((portdata->ri_state) ? TIOCM_RNG : 0);
165
166 return value;
167}
168
169static int sierra_tiocmset(struct usb_serial_port *port, struct file *file,
170 unsigned int set, unsigned int clear)
171{
172 struct sierra_port_private *portdata;
173
174 portdata = usb_get_serial_port_data(port);
175
176 if (set & TIOCM_RTS)
177 portdata->rts_state = 1;
178 if (set & TIOCM_DTR)
179 portdata->dtr_state = 1;
180
181 if (clear & TIOCM_RTS)
182 portdata->rts_state = 0;
183 if (clear & TIOCM_DTR)
184 portdata->dtr_state = 0;
185 return sierra_send_setup(port);
186}
187
188static int sierra_ioctl(struct usb_serial_port *port, struct file *file,
189 unsigned int cmd, unsigned long arg)
190{
191 return -ENOIOCTLCMD;
192}
193
194/* Write */
195static int sierra_write(struct usb_serial_port *port,
196 const unsigned char *buf, int count)
197{
198 struct sierra_port_private *portdata;
199 int i;
200 int left, todo;
201 struct urb *this_urb = NULL; /* spurious */
202 int err;
203
204 portdata = usb_get_serial_port_data(port);
205
206 dbg("%s: write (%d chars)", __FUNCTION__, count);
207
208 i = 0;
209 left = count;
210 for (i=0; left > 0 && i < N_OUT_URB; i++) {
211 todo = left;
212 if (todo > OUT_BUFLEN)
213 todo = OUT_BUFLEN;
214
215 this_urb = portdata->out_urbs[i];
216 if (this_urb->status == -EINPROGRESS) {
217 if (time_before(jiffies,
218 portdata->tx_start_time[i] + 10 * HZ))
219 continue;
220 usb_unlink_urb(this_urb);
221 continue;
222 }
223 if (this_urb->status != 0)
224 dbg("usb_write %p failed (err=%d)",
225 this_urb, this_urb->status);
226
227 dbg("%s: endpoint %d buf %d", __FUNCTION__,
228 usb_pipeendpoint(this_urb->pipe), i);
229
230 /* send the data */
231 memcpy (this_urb->transfer_buffer, buf, todo);
232 this_urb->transfer_buffer_length = todo;
233
234 this_urb->dev = port->serial->dev;
235 err = usb_submit_urb(this_urb, GFP_ATOMIC);
236 if (err) {
237 dbg("usb_submit_urb %p (write bulk) failed "
238 "(%d, has %d)", this_urb,
239 err, this_urb->status);
240 continue;
241 }
242 portdata->tx_start_time[i] = jiffies;
243 buf += todo;
244 left -= todo;
245 }
246
247 count -= left;
248 dbg("%s: wrote (did %d)", __FUNCTION__, count);
249 return count;
250}
251
252static void sierra_indat_callback(struct urb *urb)
253{
254 int err;
255 int endpoint;
256 struct usb_serial_port *port;
257 struct tty_struct *tty;
258 unsigned char *data = urb->transfer_buffer;
259
260 dbg("%s: %p", __FUNCTION__, urb);
261
262 endpoint = usb_pipeendpoint(urb->pipe);
263 port = (struct usb_serial_port *) urb->context;
264
265 if (urb->status) {
266 dbg("%s: nonzero status: %d on endpoint %02x.",
267 __FUNCTION__, urb->status, endpoint);
268 } else {
269 tty = port->tty;
270 if (urb->actual_length) {
271 tty_buffer_request_room(tty, urb->actual_length);
272 tty_insert_flip_string(tty, data, urb->actual_length);
273 tty_flip_buffer_push(tty);
274 } else {
275 dbg("%s: empty read urb received", __FUNCTION__);
276 }
277
278 /* Resubmit urb so we continue receiving */
279 if (port->open_count && urb->status != -ESHUTDOWN) {
280 err = usb_submit_urb(urb, GFP_ATOMIC);
281 if (err)
282 printk(KERN_ERR "%s: resubmit read urb failed. "
283 "(%d)", __FUNCTION__, err);
284 }
285 }
286 return;
287}
288
289static void sierra_outdat_callback(struct urb *urb)
290{
291 struct usb_serial_port *port;
292
293 dbg("%s", __FUNCTION__);
294
295 port = (struct usb_serial_port *) urb->context;
296
297 usb_serial_port_softint(port);
298}
299
300static void sierra_instat_callback(struct urb *urb)
301{
302 int err;
303 struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
304 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
305 struct usb_serial *serial = port->serial;
306
307 dbg("%s", __FUNCTION__);
308 dbg("%s: urb %p port %p has data %p", __FUNCTION__,urb,port,portdata);
309
310 if (urb->status == 0) {
311 struct usb_ctrlrequest *req_pkt =
312 (struct usb_ctrlrequest *)urb->transfer_buffer;
313
314 if (!req_pkt) {
315 dbg("%s: NULL req_pkt\n", __FUNCTION__);
316 return;
317 }
318 if ((req_pkt->bRequestType == 0xA1) &&
319 (req_pkt->bRequest == 0x20)) {
320 int old_dcd_state;
321 unsigned char signals = *((unsigned char *)
322 urb->transfer_buffer +
323 sizeof(struct usb_ctrlrequest));
324
325 dbg("%s: signal x%x", __FUNCTION__, signals);
326
327 old_dcd_state = portdata->dcd_state;
328 portdata->cts_state = 1;
329 portdata->dcd_state = ((signals & 0x01) ? 1 : 0);
330 portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
331 portdata->ri_state = ((signals & 0x08) ? 1 : 0);
332
333 if (port->tty && !C_CLOCAL(port->tty) &&
334 old_dcd_state && !portdata->dcd_state)
335 tty_hangup(port->tty);
336 } else {
337 dbg("%s: type %x req %x", __FUNCTION__,
338 req_pkt->bRequestType,req_pkt->bRequest);
339 }
340 } else
341 dbg("%s: error %d", __FUNCTION__, urb->status);
342
343 /* Resubmit urb so we continue receiving IRQ data */
344 if (urb->status != -ESHUTDOWN) {
345 urb->dev = serial->dev;
346 err = usb_submit_urb(urb, GFP_ATOMIC);
347 if (err)
348 dbg("%s: resubmit intr urb failed. (%d)",
349 __FUNCTION__, err);
350 }
351}
352
353static int sierra_write_room(struct usb_serial_port *port)
354{
355 struct sierra_port_private *portdata;
356 int i;
357 int data_len = 0;
358 struct urb *this_urb;
359
360 portdata = usb_get_serial_port_data(port);
361
362 for (i=0; i < N_OUT_URB; i++) {
363 this_urb = portdata->out_urbs[i];
364 if (this_urb && this_urb->status != -EINPROGRESS)
365 data_len += OUT_BUFLEN;
366 }
367
368 dbg("%s: %d", __FUNCTION__, data_len);
369 return data_len;
370}
371
372static int sierra_chars_in_buffer(struct usb_serial_port *port)
373{
374 struct sierra_port_private *portdata;
375 int i;
376 int data_len = 0;
377 struct urb *this_urb;
378
379 portdata = usb_get_serial_port_data(port);
380
381 for (i=0; i < N_OUT_URB; i++) {
382 this_urb = portdata->out_urbs[i];
383 if (this_urb && this_urb->status == -EINPROGRESS)
384 data_len += this_urb->transfer_buffer_length;
385 }
386 dbg("%s: %d", __FUNCTION__, data_len);
387 return data_len;
388}
389
390static int sierra_open(struct usb_serial_port *port, struct file *filp)
391{
392 struct sierra_port_private *portdata;
393 struct usb_serial *serial = port->serial;
394 int i, err;
395 struct urb *urb;
396
397 portdata = usb_get_serial_port_data(port);
398
399 dbg("%s", __FUNCTION__);
400
401 /* Set some sane defaults */
402 portdata->rts_state = 1;
403 portdata->dtr_state = 1;
404
405 /* Reset low level data toggle and start reading from endpoints */
406 for (i = 0; i < N_IN_URB; i++) {
407 urb = portdata->in_urbs[i];
408 if (! urb)
409 continue;
410 if (urb->dev != serial->dev) {
411 dbg("%s: dev %p != %p", __FUNCTION__,
412 urb->dev, serial->dev);
413 continue;
414 }
415
416 /*
417 * make sure endpoint data toggle is synchronized with the
418 * device
419 */
420 usb_clear_halt(urb->dev, urb->pipe);
421
422 err = usb_submit_urb(urb, GFP_KERNEL);
423 if (err) {
424 dbg("%s: submit urb %d failed (%d) %d",
425 __FUNCTION__, i, err,
426 urb->transfer_buffer_length);
427 }
428 }
429
430 /* Reset low level data toggle on out endpoints */
431 for (i = 0; i < N_OUT_URB; i++) {
432 urb = portdata->out_urbs[i];
433 if (! urb)
434 continue;
435 urb->dev = serial->dev;
436 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
437 usb_pipeout(urb->pipe), 0); */
438 }
439
440 port->tty->low_latency = 1;
441
442 sierra_send_setup(port);
443
444 return (0);
445}
446
447static inline void stop_urb(struct urb *urb)
448{
449 if (urb && urb->status == -EINPROGRESS)
450 usb_kill_urb(urb);
451}
452
453static void sierra_close(struct usb_serial_port *port, struct file *filp)
454{
455 int i;
456 struct usb_serial *serial = port->serial;
457 struct sierra_port_private *portdata;
458
459 dbg("%s", __FUNCTION__);
460 portdata = usb_get_serial_port_data(port);
461
462 portdata->rts_state = 0;
463 portdata->dtr_state = 0;
464
465 if (serial->dev) {
466 sierra_send_setup(port);
467
468 /* Stop reading/writing urbs */
469 for (i = 0; i < N_IN_URB; i++)
470 stop_urb(portdata->in_urbs[i]);
471 for (i = 0; i < N_OUT_URB; i++)
472 stop_urb(portdata->out_urbs[i]);
473 }
474 port->tty = NULL;
475}
476
477/* Helper functions used by sierra_setup_urbs */
478static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
479 int dir, void *ctx, char *buf, int len,
480 usb_complete_t callback)
481{
482 struct urb *urb;
483
484 if (endpoint == -1)
485 return NULL; /* endpoint not needed */
486
487 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
488 if (urb == NULL) {
489 dbg("%s: alloc for endpoint %d failed.", __FUNCTION__, endpoint);
490 return NULL;
491 }
492
493 /* Fill URB using supplied data. */
494 usb_fill_bulk_urb(urb, serial->dev,
495 usb_sndbulkpipe(serial->dev, endpoint) | dir,
496 buf, len, callback, ctx);
497
498 return urb;
499}
500
501/* Setup urbs */
502static void sierra_setup_urbs(struct usb_serial *serial)
503{
504 int i,j;
505 struct usb_serial_port *port;
506 struct sierra_port_private *portdata;
507
508 dbg("%s", __FUNCTION__);
509
510 for (i = 0; i < serial->num_ports; i++) {
511 port = serial->port[i];
512 portdata = usb_get_serial_port_data(port);
513
514 /* Do indat endpoints first */
515 for (j = 0; j < N_IN_URB; ++j) {
516 portdata->in_urbs[j] = sierra_setup_urb (serial,
517 port->bulk_in_endpointAddress, USB_DIR_IN, port,
518 portdata->in_buffer[j], IN_BUFLEN, sierra_indat_callback);
519 }
520
521 /* outdat endpoints */
522 for (j = 0; j < N_OUT_URB; ++j) {
523 portdata->out_urbs[j] = sierra_setup_urb (serial,
524 port->bulk_out_endpointAddress, USB_DIR_OUT, port,
525 portdata->out_buffer[j], OUT_BUFLEN, sierra_outdat_callback);
526 }
527 }
528}
529
530static int sierra_startup(struct usb_serial *serial)
531{
532 int i, err;
533 struct usb_serial_port *port;
534 struct sierra_port_private *portdata;
535
536 dbg("%s", __FUNCTION__);
537
538 /* Now setup per port private data */
539 for (i = 0; i < serial->num_ports; i++) {
540 port = serial->port[i];
541 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
542 if (!portdata) {
543 dbg("%s: kmalloc for sierra_port_private (%d) failed!.",
544 __FUNCTION__, i);
545 return (1);
546 }
547
548 usb_set_serial_port_data(port, portdata);
549
550 if (! port->interrupt_in_urb)
551 continue;
552 err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
553 if (err)
554 dbg("%s: submit irq_in urb failed %d",
555 __FUNCTION__, err);
556 }
557
558 sierra_setup_urbs(serial);
559
560 return (0);
561}
562
563static void sierra_shutdown(struct usb_serial *serial)
564{
565 int i, j;
566 struct usb_serial_port *port;
567 struct sierra_port_private *portdata;
568
569 dbg("%s", __FUNCTION__);
570
571 /* Stop reading/writing urbs */
572 for (i = 0; i < serial->num_ports; ++i) {
573 port = serial->port[i];
574 portdata = usb_get_serial_port_data(port);
575 for (j = 0; j < N_IN_URB; j++)
576 stop_urb(portdata->in_urbs[j]);
577 for (j = 0; j < N_OUT_URB; j++)
578 stop_urb(portdata->out_urbs[j]);
579 }
580
581 /* Now free them */
582 for (i = 0; i < serial->num_ports; ++i) {
583 port = serial->port[i];
584 portdata = usb_get_serial_port_data(port);
585
586 for (j = 0; j < N_IN_URB; j++) {
587 if (portdata->in_urbs[j]) {
588 usb_free_urb(portdata->in_urbs[j]);
589 portdata->in_urbs[j] = NULL;
590 }
591 }
592 for (j = 0; j < N_OUT_URB; j++) {
593 if (portdata->out_urbs[j]) {
594 usb_free_urb(portdata->out_urbs[j]);
595 portdata->out_urbs[j] = NULL;
596 }
597 }
598 }
599
600 /* Now free per port private data */
601 for (i = 0; i < serial->num_ports; i++) {
602 port = serial->port[i];
603 kfree(usb_get_serial_port_data(port));
604 }
605}
606
607static struct usb_serial_driver sierra_1port_device = {
608 .driver = {
609 .owner = THIS_MODULE,
610 .name = "sierra1",
611 },
612 .description = "Sierra USB modem (1 port)",
613 .id_table = id_table_1port,
614 .num_interrupt_in = NUM_DONT_CARE,
615 .num_bulk_in = 1,
616 .num_bulk_out = 1,
617 .num_ports = 1,
618 .open = sierra_open,
619 .close = sierra_close,
620 .write = sierra_write,
621 .write_room = sierra_write_room,
622 .chars_in_buffer = sierra_chars_in_buffer,
623 .throttle = sierra_rx_throttle,
624 .unthrottle = sierra_rx_unthrottle,
625 .ioctl = sierra_ioctl,
626 .set_termios = sierra_set_termios,
627 .break_ctl = sierra_break_ctl,
628 .tiocmget = sierra_tiocmget,
629 .tiocmset = sierra_tiocmset,
630 .attach = sierra_startup,
631 .shutdown = sierra_shutdown,
632 .read_int_callback = sierra_instat_callback,
40}; 633};
41 634
42static struct usb_serial_driver sierra_device = { 635static struct usb_serial_driver sierra_3port_device = {
43 .driver = { 636 .driver = {
44 .owner = THIS_MODULE, 637 .owner = THIS_MODULE,
45 .name = "Sierra_Wireless", 638 .name = "sierra3",
46 }, 639 },
47 .id_table = id_table, 640 .description = "Sierra USB modem (3 port)",
48 .num_interrupt_in = NUM_DONT_CARE, 641 .id_table = id_table_3port,
49 .num_bulk_in = NUM_DONT_CARE, 642 .num_interrupt_in = NUM_DONT_CARE,
50 .num_bulk_out = NUM_DONT_CARE, 643 .num_bulk_in = 3,
51 .num_ports = 3, 644 .num_bulk_out = 3,
645 .num_ports = 3,
646 .open = sierra_open,
647 .close = sierra_close,
648 .write = sierra_write,
649 .write_room = sierra_write_room,
650 .chars_in_buffer = sierra_chars_in_buffer,
651 .throttle = sierra_rx_throttle,
652 .unthrottle = sierra_rx_unthrottle,
653 .ioctl = sierra_ioctl,
654 .set_termios = sierra_set_termios,
655 .break_ctl = sierra_break_ctl,
656 .tiocmget = sierra_tiocmget,
657 .tiocmset = sierra_tiocmset,
658 .attach = sierra_startup,
659 .shutdown = sierra_shutdown,
660 .read_int_callback = sierra_instat_callback,
52}; 661};
53 662
663/* Functions used by new usb-serial code. */
54static int __init sierra_init(void) 664static int __init sierra_init(void)
55{ 665{
56 int retval; 666 int retval;
57 667 retval = usb_serial_register(&sierra_1port_device);
58 retval = usb_serial_register(&sierra_device); 668 if (retval)
669 goto failed_1port_device_register;
670 retval = usb_serial_register(&sierra_3port_device);
59 if (retval) 671 if (retval)
60 return retval; 672 goto failed_3port_device_register;
673
674
61 retval = usb_register(&sierra_driver); 675 retval = usb_register(&sierra_driver);
62 if (retval) 676 if (retval)
63 usb_serial_deregister(&sierra_device); 677 goto failed_driver_register;
678
679 info(DRIVER_DESC ": " DRIVER_VERSION);
680
681 return 0;
682
683failed_driver_register:
684 usb_serial_deregister(&sierra_3port_device);
685failed_3port_device_register:
686 usb_serial_deregister(&sierra_1port_device);
687failed_1port_device_register:
64 return retval; 688 return retval;
65} 689}
66 690
67static void __exit sierra_exit(void) 691static void __exit sierra_exit(void)
68{ 692{
69 usb_deregister(&sierra_driver); 693 usb_deregister (&sierra_driver);
70 usb_serial_deregister(&sierra_device); 694 usb_serial_deregister(&sierra_1port_device);
695 usb_serial_deregister(&sierra_3port_device);
71} 696}
72 697
73module_init(sierra_init); 698module_init(sierra_init);
74module_exit(sierra_exit); 699module_exit(sierra_exit);
700
701MODULE_AUTHOR(DRIVER_AUTHOR);
702MODULE_DESCRIPTION(DRIVER_DESC);
703MODULE_VERSION(DRIVER_VERSION);
75MODULE_LICENSE("GPL"); 704MODULE_LICENSE("GPL");
705
706#ifdef CONFIG_USB_DEBUG
707module_param(debug, bool, S_IRUGO | S_IWUSR);
708MODULE_PARM_DESC(debug, "Debug messages");
709#endif
710
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index c9a8d50106d1..37ed8e0f2dc8 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -55,7 +55,8 @@ UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
55 US_SC_DEVICE, US_PR_DEVICE, NULL, 55 US_SC_DEVICE, US_PR_DEVICE, NULL,
56 US_FL_IGNORE_RESIDUE), 56 US_FL_IGNORE_RESIDUE),
57 57
58UNUSUAL_DEV( 0x03ee, 0x6901, 0x0000, 0x0100, 58/* modified by Tobias Lorenz <tobias.lorenz@gmx.net> */
59UNUSUAL_DEV( 0x03ee, 0x6901, 0x0000, 0x0200,
59 "Mitsumi", 60 "Mitsumi",
60 "USB FDD", 61 "USB FDD",
61 US_SC_DEVICE, US_PR_DEVICE, NULL, 62 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -182,6 +183,20 @@ UNUSUAL_DEV( 0x0421, 0x044e, 0x0100, 0x0100,
182 US_SC_DEVICE, US_PR_DEVICE, NULL, 183 US_SC_DEVICE, US_PR_DEVICE, NULL,
183 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), 184 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
184 185
186/* Reported by Bardur Arantsson <bardur@scientician.net> */
187UNUSUAL_DEV( 0x0421, 0x047c, 0x0370, 0x0370,
188 "Nokia",
189 "6131",
190 US_SC_DEVICE, US_PR_DEVICE, NULL,
191 US_FL_MAX_SECTORS_64 ),
192
193/* Reported by Alex Corcoles <alex@corcoles.net> */
194UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
195 "Nokia",
196 "6234",
197 US_SC_DEVICE, US_PR_DEVICE, NULL,
198 US_FL_MAX_SECTORS_64 ),
199
185/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 200/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
186UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 201UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
187 "SMSC", 202 "SMSC",
@@ -1291,6 +1306,13 @@ UNUSUAL_DEV( 0x0fce, 0xe030, 0x0000, 0x0000,
1291 US_SC_DEVICE, US_PR_DEVICE, NULL, 1306 US_SC_DEVICE, US_PR_DEVICE, NULL,
1292 US_FL_FIX_CAPACITY ), 1307 US_FL_FIX_CAPACITY ),
1293 1308
1309/* Reported by Jan Mate <mate@fiit.stuba.sk> */
1310UNUSUAL_DEV( 0x0fce, 0xe030, 0x0000, 0x0000,
1311 "Sony Ericsson",
1312 "P990i",
1313 US_SC_DEVICE, US_PR_DEVICE, NULL,
1314 US_FL_FIX_CAPACITY ),
1315
1294/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> 1316/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
1295 * Tested on hardware version 1.10. 1317 * Tested on hardware version 1.10.
1296 * Entry is needed only for the initializer function override. 1318 * Entry is needed only for the initializer function override.
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c
index 8cc6c0e2d27a..04c6d928189b 100644
--- a/drivers/video/controlfb.c
+++ b/drivers/video/controlfb.c
@@ -415,13 +415,15 @@ static int __init init_control(struct fb_info_control *p)
415 full = p->total_vram == 0x400000; 415 full = p->total_vram == 0x400000;
416 416
417 /* Try to pick a video mode out of NVRAM if we have one. */ 417 /* Try to pick a video mode out of NVRAM if we have one. */
418#ifdef CONFIG_NVRAM
418 if (default_cmode == CMODE_NVRAM){ 419 if (default_cmode == CMODE_NVRAM){
419 cmode = nvram_read_byte(NV_CMODE); 420 cmode = nvram_read_byte(NV_CMODE);
420 if(cmode < CMODE_8 || cmode > CMODE_32) 421 if(cmode < CMODE_8 || cmode > CMODE_32)
421 cmode = CMODE_8; 422 cmode = CMODE_8;
422 } else 423 } else
424#endif
423 cmode=default_cmode; 425 cmode=default_cmode;
424 426#ifdef CONFIG_NVRAM
425 if (default_vmode == VMODE_NVRAM) { 427 if (default_vmode == VMODE_NVRAM) {
426 vmode = nvram_read_byte(NV_VMODE); 428 vmode = nvram_read_byte(NV_VMODE);
427 if (vmode < 1 || vmode > VMODE_MAX || 429 if (vmode < 1 || vmode > VMODE_MAX ||
@@ -432,7 +434,9 @@ static int __init init_control(struct fb_info_control *p)
432 if (control_mac_modes[vmode - 1].m[full] < cmode) 434 if (control_mac_modes[vmode - 1].m[full] < cmode)
433 vmode = VMODE_640_480_60; 435 vmode = VMODE_640_480_60;
434 } 436 }
435 } else { 437 } else
438#endif
439 {
436 vmode=default_vmode; 440 vmode=default_vmode;
437 if (control_mac_modes[vmode - 1].m[full] < cmode) { 441 if (control_mac_modes[vmode - 1].m[full] < cmode) {
438 if (cmode > CMODE_8) 442 if (cmode > CMODE_8)
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c
index 67f384f86758..e6df492c22a5 100644
--- a/drivers/video/igafb.c
+++ b/drivers/video/igafb.c
@@ -573,3 +573,10 @@ int __init igafb_setup(char *options)
573 573
574module_init(igafb_init); 574module_init(igafb_init);
575MODULE_LICENSE("GPL"); 575MODULE_LICENSE("GPL");
576static struct pci_device_id igafb_pci_tbl[] __devinitdata = {
577 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
578 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
579 { }
580};
581
582MODULE_DEVICE_TABLE(pci, igafb_pci_tbl);
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 983be3ec2345..fdb33cd21a27 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -339,11 +339,12 @@ static int __devinit platinum_init_fb(struct fb_info *info)
339 339
340 sense = read_platinum_sense(pinfo); 340 sense = read_platinum_sense(pinfo);
341 printk(KERN_INFO "platinumfb: Monitor sense value = 0x%x, ", sense); 341 printk(KERN_INFO "platinumfb: Monitor sense value = 0x%x, ", sense);
342
343 if (default_vmode == VMODE_NVRAM) { 342 if (default_vmode == VMODE_NVRAM) {
343#ifdef CONFIG_NVRAM
344 default_vmode = nvram_read_byte(NV_VMODE); 344 default_vmode = nvram_read_byte(NV_VMODE);
345 if (default_vmode <= 0 || default_vmode > VMODE_MAX || 345 if (default_vmode <= 0 || default_vmode > VMODE_MAX ||
346 !platinum_reg_init[default_vmode-1]) 346 !platinum_reg_init[default_vmode-1])
347#endif
347 default_vmode = VMODE_CHOOSE; 348 default_vmode = VMODE_CHOOSE;
348 } 349 }
349 if (default_vmode == VMODE_CHOOSE) { 350 if (default_vmode == VMODE_CHOOSE) {
@@ -351,8 +352,10 @@ static int __devinit platinum_init_fb(struct fb_info *info)
351 } 352 }
352 if (default_vmode <= 0 || default_vmode > VMODE_MAX) 353 if (default_vmode <= 0 || default_vmode > VMODE_MAX)
353 default_vmode = VMODE_640_480_60; 354 default_vmode = VMODE_640_480_60;
355#ifdef CONFIG_NVRAM
354 if (default_cmode == CMODE_NVRAM) 356 if (default_cmode == CMODE_NVRAM)
355 default_cmode = nvram_read_byte(NV_CMODE); 357 default_cmode = nvram_read_byte(NV_CMODE);
358#endif
356 if (default_cmode < CMODE_8 || default_cmode > CMODE_32) 359 if (default_cmode < CMODE_8 || default_cmode > CMODE_32)
357 default_cmode = CMODE_8; 360 default_cmode = CMODE_8;
358 /* 361 /*
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c
index 47f27924a7d7..06fc19a61192 100644
--- a/drivers/video/valkyriefb.c
+++ b/drivers/video/valkyriefb.c
@@ -284,7 +284,7 @@ static void __init valkyrie_choose_mode(struct fb_info_valkyrie *p)
284 printk(KERN_INFO "Monitor sense value = 0x%x\n", p->sense); 284 printk(KERN_INFO "Monitor sense value = 0x%x\n", p->sense);
285 285
286 /* Try to pick a video mode out of NVRAM if we have one. */ 286 /* Try to pick a video mode out of NVRAM if we have one. */
287#ifndef CONFIG_MAC 287#if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
288 if (default_vmode == VMODE_NVRAM) { 288 if (default_vmode == VMODE_NVRAM) {
289 default_vmode = nvram_read_byte(NV_VMODE); 289 default_vmode = nvram_read_byte(NV_VMODE);
290 if (default_vmode <= 0 290 if (default_vmode <= 0
@@ -297,7 +297,7 @@ static void __init valkyrie_choose_mode(struct fb_info_valkyrie *p)
297 default_vmode = mac_map_monitor_sense(p->sense); 297 default_vmode = mac_map_monitor_sense(p->sense);
298 if (!valkyrie_reg_init[default_vmode - 1]) 298 if (!valkyrie_reg_init[default_vmode - 1])
299 default_vmode = VMODE_640_480_67; 299 default_vmode = VMODE_640_480_67;
300#ifndef CONFIG_MAC 300#if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
301 if (default_cmode == CMODE_NVRAM) 301 if (default_cmode == CMODE_NVRAM)
302 default_cmode = nvram_read_byte(NV_CMODE); 302 default_cmode = nvram_read_byte(NV_CMODE);
303#endif 303#endif
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 27c9d05d03ef..c287a9ae4fdd 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -2,7 +2,6 @@ menu "Dallas's 1-wire bus"
2 2
3config W1 3config W1
4 tristate "Dallas's 1-wire support" 4 tristate "Dallas's 1-wire support"
5 depends on CONNECTOR
6 ---help--- 5 ---help---
7 Dallas' 1-wire bus is useful to connect slow 1-pin devices 6 Dallas' 1-wire bus is useful to connect slow 1-pin devices
8 such as iButtons and thermal sensors. 7 such as iButtons and thermal sensors.
diff --git a/fs/Kconfig b/fs/Kconfig
index 6a3df055280a..fee318e6f4bb 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -634,6 +634,10 @@ config FUSE_FS
634 If you want to develop a userspace FS, or if you want to use 634 If you want to develop a userspace FS, or if you want to use
635 a filesystem based on FUSE, answer Y or M. 635 a filesystem based on FUSE, answer Y or M.
636 636
637config GENERIC_ACL
638 bool
639 select FS_POSIX_ACL
640
637if BLOCK 641if BLOCK
638menu "CD-ROM/DVD Filesystems" 642menu "CD-ROM/DVD Filesystems"
639 643
@@ -2080,10 +2084,6 @@ config 9P_FS
2080 2084
2081 If unsure, say N. 2085 If unsure, say N.
2082 2086
2083config GENERIC_ACL
2084 bool
2085 select FS_POSIX_ACL
2086
2087endmenu 2087endmenu
2088 2088
2089if BLOCK 2089if BLOCK
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index c7700d9b3f96..906ba5ce2261 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -149,6 +149,7 @@ extern const struct file_operations autofs_root_operations;
149/* Initializing function */ 149/* Initializing function */
150 150
151int autofs_fill_super(struct super_block *, void *, int); 151int autofs_fill_super(struct super_block *, void *, int);
152void autofs_kill_sb(struct super_block *sb);
152 153
153/* Queue management functions */ 154/* Queue management functions */
154 155
diff --git a/fs/autofs/dirhash.c b/fs/autofs/dirhash.c
index 3fded389d06b..bf8c8af98004 100644
--- a/fs/autofs/dirhash.c
+++ b/fs/autofs/dirhash.c
@@ -246,5 +246,4 @@ void autofs_hash_nuke(struct autofs_sb_info *sbi)
246 kfree(ent); 246 kfree(ent);
247 } 247 }
248 } 248 }
249 shrink_dcache_sb(sbi->sb);
250} 249}
diff --git a/fs/autofs/init.c b/fs/autofs/init.c
index aca123752406..cea5219b4f37 100644
--- a/fs/autofs/init.c
+++ b/fs/autofs/init.c
@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs_type = {
24 .owner = THIS_MODULE, 24 .owner = THIS_MODULE,
25 .name = "autofs", 25 .name = "autofs",
26 .get_sb = autofs_get_sb, 26 .get_sb = autofs_get_sb,
27 .kill_sb = kill_anon_super, 27 .kill_sb = autofs_kill_sb,
28}; 28};
29 29
30static int __init init_autofs_fs(void) 30static int __init init_autofs_fs(void)
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 2c9759baad61..54c518c89e4c 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -20,7 +20,7 @@
20#include "autofs_i.h" 20#include "autofs_i.h"
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23static void autofs_put_super(struct super_block *sb) 23void autofs_kill_sb(struct super_block *sb)
24{ 24{
25 struct autofs_sb_info *sbi = autofs_sbi(sb); 25 struct autofs_sb_info *sbi = autofs_sbi(sb);
26 unsigned int n; 26 unsigned int n;
@@ -37,13 +37,13 @@ static void autofs_put_super(struct super_block *sb)
37 kfree(sb->s_fs_info); 37 kfree(sb->s_fs_info);
38 38
39 DPRINTK(("autofs: shutting down\n")); 39 DPRINTK(("autofs: shutting down\n"));
40 kill_anon_super(sb);
40} 41}
41 42
42static void autofs_read_inode(struct inode *inode); 43static void autofs_read_inode(struct inode *inode);
43 44
44static struct super_operations autofs_sops = { 45static struct super_operations autofs_sops = {
45 .read_inode = autofs_read_inode, 46 .read_inode = autofs_read_inode,
46 .put_super = autofs_put_super,
47 .statfs = simple_statfs, 47 .statfs = simple_statfs,
48}; 48};
49 49
diff --git a/fs/buffer.c b/fs/buffer.c
index f65ef8821c73..35527dca1dbc 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -452,6 +452,7 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
452 bdevname(bh->b_bdev, b)); 452 bdevname(bh->b_bdev, b));
453 } 453 }
454 set_bit(AS_EIO, &page->mapping->flags); 454 set_bit(AS_EIO, &page->mapping->flags);
455 set_buffer_write_io_error(bh);
455 clear_buffer_uptodate(bh); 456 clear_buffer_uptodate(bh);
456 SetPageError(page); 457 SetPageError(page);
457 } 458 }
@@ -571,6 +572,10 @@ EXPORT_SYMBOL(mark_buffer_async_write);
571static inline void __remove_assoc_queue(struct buffer_head *bh) 572static inline void __remove_assoc_queue(struct buffer_head *bh)
572{ 573{
573 list_del_init(&bh->b_assoc_buffers); 574 list_del_init(&bh->b_assoc_buffers);
575 WARN_ON(!bh->b_assoc_map);
576 if (buffer_write_io_error(bh))
577 set_bit(AS_EIO, &bh->b_assoc_map->flags);
578 bh->b_assoc_map = NULL;
574} 579}
575 580
576int inode_has_buffers(struct inode *inode) 581int inode_has_buffers(struct inode *inode)
@@ -669,6 +674,7 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
669 spin_lock(&buffer_mapping->private_lock); 674 spin_lock(&buffer_mapping->private_lock);
670 list_move_tail(&bh->b_assoc_buffers, 675 list_move_tail(&bh->b_assoc_buffers,
671 &mapping->private_list); 676 &mapping->private_list);
677 bh->b_assoc_map = mapping;
672 spin_unlock(&buffer_mapping->private_lock); 678 spin_unlock(&buffer_mapping->private_lock);
673 } 679 }
674} 680}
@@ -765,7 +771,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
765 spin_lock(lock); 771 spin_lock(lock);
766 while (!list_empty(list)) { 772 while (!list_empty(list)) {
767 bh = BH_ENTRY(list->next); 773 bh = BH_ENTRY(list->next);
768 list_del_init(&bh->b_assoc_buffers); 774 __remove_assoc_queue(bh);
769 if (buffer_dirty(bh) || buffer_locked(bh)) { 775 if (buffer_dirty(bh) || buffer_locked(bh)) {
770 list_add(&bh->b_assoc_buffers, &tmp); 776 list_add(&bh->b_assoc_buffers, &tmp);
771 if (buffer_dirty(bh)) { 777 if (buffer_dirty(bh)) {
@@ -786,7 +792,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
786 792
787 while (!list_empty(&tmp)) { 793 while (!list_empty(&tmp)) {
788 bh = BH_ENTRY(tmp.prev); 794 bh = BH_ENTRY(tmp.prev);
789 __remove_assoc_queue(bh); 795 list_del_init(&bh->b_assoc_buffers);
790 get_bh(bh); 796 get_bh(bh);
791 spin_unlock(lock); 797 spin_unlock(lock);
792 wait_on_buffer(bh); 798 wait_on_buffer(bh);
@@ -1167,6 +1173,7 @@ void __bforget(struct buffer_head *bh)
1167 1173
1168 spin_lock(&buffer_mapping->private_lock); 1174 spin_lock(&buffer_mapping->private_lock);
1169 list_del_init(&bh->b_assoc_buffers); 1175 list_del_init(&bh->b_assoc_buffers);
1176 bh->b_assoc_map = NULL;
1170 spin_unlock(&buffer_mapping->private_lock); 1177 spin_unlock(&buffer_mapping->private_lock);
1171 } 1178 }
1172 __brelse(bh); 1179 __brelse(bh);
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index e6d5754a715e..cf33fac68c84 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -275,13 +275,14 @@ static int check_perm(struct inode * inode, struct file * file)
275 * it in file->private_data for easy access. 275 * it in file->private_data for easy access.
276 */ 276 */
277 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL); 277 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
278 if (buffer) { 278 if (!buffer) {
279 init_MUTEX(&buffer->sem);
280 buffer->needs_read_fill = 1;
281 buffer->ops = ops;
282 file->private_data = buffer;
283 } else
284 error = -ENOMEM; 279 error = -ENOMEM;
280 goto Enomem;
281 }
282 init_MUTEX(&buffer->sem);
283 buffer->needs_read_fill = 1;
284 buffer->ops = ops;
285 file->private_data = buffer;
285 goto Done; 286 goto Done;
286 287
287 Einval: 288 Einval:
@@ -289,6 +290,7 @@ static int check_perm(struct inode * inode, struct file * file)
289 goto Done; 290 goto Done;
290 Eaccess: 291 Eaccess:
291 error = -EACCES; 292 error = -EACCES;
293 Enomem:
292 module_put(attr->ca_owner); 294 module_put(attr->ca_owner);
293 Done: 295 Done:
294 if (error && item) 296 if (error && item)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 867f93d0417e..6da6b14d5a61 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -519,6 +519,7 @@ static int receive_from_sock(void)
519 msg.msg_flags = 0; 519 msg.msg_flags = 0;
520 msg.msg_control = incmsg; 520 msg.msg_control = incmsg;
521 msg.msg_controllen = sizeof(incmsg); 521 msg.msg_controllen = sizeof(incmsg);
522 msg.msg_iovlen = 1;
522 523
523 /* I don't see why this circular buffer stuff is necessary for SCTP 524 /* I don't see why this circular buffer stuff is necessary for SCTP
524 * which is a packet-based protocol, but the whole thing breaks under 525 * which is a packet-based protocol, but the whole thing breaks under
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 7a11b8ae6644..5938a232d11b 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -104,10 +104,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
104 inode->i_op = &ecryptfs_dir_iops; 104 inode->i_op = &ecryptfs_dir_iops;
105 if (S_ISDIR(lower_inode->i_mode)) 105 if (S_ISDIR(lower_inode->i_mode))
106 inode->i_fop = &ecryptfs_dir_fops; 106 inode->i_fop = &ecryptfs_dir_fops;
107 /* TODO: Is there a better way to identify if the inode is 107 if (special_file(lower_inode->i_mode))
108 * special? */
109 if (S_ISBLK(lower_inode->i_mode) || S_ISCHR(lower_inode->i_mode) ||
110 S_ISFIFO(lower_inode->i_mode) || S_ISSOCK(lower_inode->i_mode))
111 init_special_inode(inode, lower_inode->i_mode, 108 init_special_inode(inode, lower_inode->i_mode,
112 lower_inode->i_rdev); 109 lower_inode->i_rdev);
113 dentry->d_op = &ecryptfs_dops; 110 dentry->d_op = &ecryptfs_dops;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index f4b8f8b3fbdd..8337451e7897 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -13,6 +13,7 @@
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/writeback.h> 15#include <linux/writeback.h>
16#include <linux/backing-dev.h>
16#include <linux/blkdev.h> 17#include <linux/blkdev.h>
17 18
18int fat_generic_ioctl(struct inode *inode, struct file *filp, 19int fat_generic_ioctl(struct inode *inode, struct file *filp,
@@ -118,7 +119,7 @@ static int fat_file_release(struct inode *inode, struct file *filp)
118 if ((filp->f_mode & FMODE_WRITE) && 119 if ((filp->f_mode & FMODE_WRITE) &&
119 MSDOS_SB(inode->i_sb)->options.flush) { 120 MSDOS_SB(inode->i_sb)->options.flush) {
120 fat_flush_inodes(inode->i_sb, inode, NULL); 121 fat_flush_inodes(inode->i_sb, inode, NULL);
121 blk_congestion_wait(WRITE, HZ/10); 122 congestion_wait(WRITE, HZ/10);
122 } 123 }
123 return 0; 124 return 0;
124} 125}
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 8605155db171..cfc8f81e60d0 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -138,6 +138,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
138 struct fuse_entry_out outarg; 138 struct fuse_entry_out outarg;
139 struct fuse_conn *fc; 139 struct fuse_conn *fc;
140 struct fuse_req *req; 140 struct fuse_req *req;
141 struct dentry *parent;
141 142
142 /* Doesn't hurt to "reset" the validity timeout */ 143 /* Doesn't hurt to "reset" the validity timeout */
143 fuse_invalidate_entry_cache(entry); 144 fuse_invalidate_entry_cache(entry);
@@ -151,8 +152,10 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
151 if (IS_ERR(req)) 152 if (IS_ERR(req))
152 return 0; 153 return 0;
153 154
154 fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg); 155 parent = dget_parent(entry);
156 fuse_lookup_init(req, parent->d_inode, entry, &outarg);
155 request_send(fc, req); 157 request_send(fc, req);
158 dput(parent);
156 err = req->out.h.error; 159 err = req->out.h.error;
157 /* Zero nodeid is same as -ENOENT */ 160 /* Zero nodeid is same as -ENOENT */
158 if (!err && !outarg.nodeid) 161 if (!err && !outarg.nodeid)
@@ -163,7 +166,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
163 fuse_send_forget(fc, req, outarg.nodeid, 1); 166 fuse_send_forget(fc, req, outarg.nodeid, 1);
164 return 0; 167 return 0;
165 } 168 }
169 spin_lock(&fc->lock);
166 fi->nlookup ++; 170 fi->nlookup ++;
171 spin_unlock(&fc->lock);
167 } 172 }
168 fuse_put_request(fc, req); 173 fuse_put_request(fc, req);
169 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) 174 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
@@ -175,22 +180,6 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
175 return 1; 180 return 1;
176} 181}
177 182
178/*
179 * Check if there's already a hashed alias of this directory inode.
180 * If yes, then lookup and mkdir must not create a new alias.
181 */
182static int dir_alias(struct inode *inode)
183{
184 if (S_ISDIR(inode->i_mode)) {
185 struct dentry *alias = d_find_alias(inode);
186 if (alias) {
187 dput(alias);
188 return 1;
189 }
190 }
191 return 0;
192}
193
194static int invalid_nodeid(u64 nodeid) 183static int invalid_nodeid(u64 nodeid)
195{ 184{
196 return !nodeid || nodeid == FUSE_ROOT_ID; 185 return !nodeid || nodeid == FUSE_ROOT_ID;
@@ -206,6 +195,24 @@ static int valid_mode(int m)
206 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m); 195 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
207} 196}
208 197
198/*
199 * Add a directory inode to a dentry, ensuring that no other dentry
200 * refers to this inode. Called with fc->inst_mutex.
201 */
202static int fuse_d_add_directory(struct dentry *entry, struct inode *inode)
203{
204 struct dentry *alias = d_find_alias(inode);
205 if (alias) {
206 /* This tries to shrink the subtree below alias */
207 fuse_invalidate_entry(alias);
208 dput(alias);
209 if (!list_empty(&inode->i_dentry))
210 return -EBUSY;
211 }
212 d_add(entry, inode);
213 return 0;
214}
215
209static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, 216static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
210 struct nameidata *nd) 217 struct nameidata *nd)
211{ 218{
@@ -241,11 +248,17 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
241 if (err && err != -ENOENT) 248 if (err && err != -ENOENT)
242 return ERR_PTR(err); 249 return ERR_PTR(err);
243 250
244 if (inode && dir_alias(inode)) { 251 if (inode && S_ISDIR(inode->i_mode)) {
245 iput(inode); 252 mutex_lock(&fc->inst_mutex);
246 return ERR_PTR(-EIO); 253 err = fuse_d_add_directory(entry, inode);
247 } 254 mutex_unlock(&fc->inst_mutex);
248 d_add(entry, inode); 255 if (err) {
256 iput(inode);
257 return ERR_PTR(err);
258 }
259 } else
260 d_add(entry, inode);
261
249 entry->d_op = &fuse_dentry_operations; 262 entry->d_op = &fuse_dentry_operations;
250 if (!err) 263 if (!err)
251 fuse_change_timeout(entry, &outarg); 264 fuse_change_timeout(entry, &outarg);
@@ -401,12 +414,22 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
401 } 414 }
402 fuse_put_request(fc, req); 415 fuse_put_request(fc, req);
403 416
404 if (dir_alias(inode)) { 417 if (S_ISDIR(inode->i_mode)) {
405 iput(inode); 418 struct dentry *alias;
406 return -EIO; 419 mutex_lock(&fc->inst_mutex);
407 } 420 alias = d_find_alias(inode);
421 if (alias) {
422 /* New directory must have moved since mkdir */
423 mutex_unlock(&fc->inst_mutex);
424 dput(alias);
425 iput(inode);
426 return -EBUSY;
427 }
428 d_instantiate(entry, inode);
429 mutex_unlock(&fc->inst_mutex);
430 } else
431 d_instantiate(entry, inode);
408 432
409 d_instantiate(entry, inode);
410 fuse_change_timeout(entry, &outarg); 433 fuse_change_timeout(entry, &outarg);
411 fuse_invalidate_attr(dir); 434 fuse_invalidate_attr(dir);
412 return 0; 435 return 0;
@@ -935,14 +958,30 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
935 } 958 }
936} 959}
937 960
961static void fuse_vmtruncate(struct inode *inode, loff_t offset)
962{
963 struct fuse_conn *fc = get_fuse_conn(inode);
964 int need_trunc;
965
966 spin_lock(&fc->lock);
967 need_trunc = inode->i_size > offset;
968 i_size_write(inode, offset);
969 spin_unlock(&fc->lock);
970
971 if (need_trunc) {
972 struct address_space *mapping = inode->i_mapping;
973 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
974 truncate_inode_pages(mapping, offset);
975 }
976}
977
938/* 978/*
939 * Set attributes, and at the same time refresh them. 979 * Set attributes, and at the same time refresh them.
940 * 980 *
941 * Truncation is slightly complicated, because the 'truncate' request 981 * Truncation is slightly complicated, because the 'truncate' request
942 * may fail, in which case we don't want to touch the mapping. 982 * may fail, in which case we don't want to touch the mapping.
943 * vmtruncate() doesn't allow for this case. So do the rlimit 983 * vmtruncate() doesn't allow for this case, so do the rlimit checking
944 * checking by hand and call vmtruncate() only after the file has 984 * and the actual truncation by hand.
945 * actually been truncated.
946 */ 985 */
947static int fuse_setattr(struct dentry *entry, struct iattr *attr) 986static int fuse_setattr(struct dentry *entry, struct iattr *attr)
948{ 987{
@@ -993,12 +1032,8 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
993 make_bad_inode(inode); 1032 make_bad_inode(inode);
994 err = -EIO; 1033 err = -EIO;
995 } else { 1034 } else {
996 if (is_truncate) { 1035 if (is_truncate)
997 loff_t origsize = i_size_read(inode); 1036 fuse_vmtruncate(inode, outarg.attr.size);
998 i_size_write(inode, outarg.attr.size);
999 if (origsize > outarg.attr.size)
1000 vmtruncate(inode, outarg.attr.size);
1001 }
1002 fuse_change_attributes(inode, &outarg.attr); 1037 fuse_change_attributes(inode, &outarg.attr);
1003 fi->i_time = time_to_jiffies(outarg.attr_valid, 1038 fi->i_time = time_to_jiffies(outarg.attr_valid,
1004 outarg.attr_valid_nsec); 1039 outarg.attr_valid_nsec);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 183626868eea..2bb5ace3882d 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -481,8 +481,10 @@ static int fuse_commit_write(struct file *file, struct page *page,
481 err = -EIO; 481 err = -EIO;
482 if (!err) { 482 if (!err) {
483 pos += count; 483 pos += count;
484 if (pos > i_size_read(inode)) 484 spin_lock(&fc->lock);
485 if (pos > inode->i_size)
485 i_size_write(inode, pos); 486 i_size_write(inode, pos);
487 spin_unlock(&fc->lock);
486 488
487 if (offset == 0 && to == PAGE_CACHE_SIZE) { 489 if (offset == 0 && to == PAGE_CACHE_SIZE) {
488 clear_page_dirty(page); 490 clear_page_dirty(page);
@@ -586,8 +588,12 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
586 } 588 }
587 fuse_put_request(fc, req); 589 fuse_put_request(fc, req);
588 if (res > 0) { 590 if (res > 0) {
589 if (write && pos > i_size_read(inode)) 591 if (write) {
590 i_size_write(inode, pos); 592 spin_lock(&fc->lock);
593 if (pos > inode->i_size)
594 i_size_write(inode, pos);
595 spin_unlock(&fc->lock);
596 }
591 *ppos = pos; 597 *ppos = pos;
592 } 598 }
593 fuse_invalidate_attr(inode); 599 fuse_invalidate_attr(inode);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 69c7750d55b8..91edb8932d90 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -239,6 +239,9 @@ struct fuse_conn {
239 /** Lock protecting accessess to members of this structure */ 239 /** Lock protecting accessess to members of this structure */
240 spinlock_t lock; 240 spinlock_t lock;
241 241
242 /** Mutex protecting against directory alias creation */
243 struct mutex inst_mutex;
244
242 /** Refcount */ 245 /** Refcount */
243 atomic_t count; 246 atomic_t count;
244 247
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 7d0a9aee01f2..fc4203570370 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -109,6 +109,7 @@ static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
109 109
110void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) 110void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
111{ 111{
112 struct fuse_conn *fc = get_fuse_conn(inode);
112 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size) 113 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
113 invalidate_inode_pages(inode->i_mapping); 114 invalidate_inode_pages(inode->i_mapping);
114 115
@@ -117,7 +118,9 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
117 inode->i_nlink = attr->nlink; 118 inode->i_nlink = attr->nlink;
118 inode->i_uid = attr->uid; 119 inode->i_uid = attr->uid;
119 inode->i_gid = attr->gid; 120 inode->i_gid = attr->gid;
121 spin_lock(&fc->lock);
120 i_size_write(inode, attr->size); 122 i_size_write(inode, attr->size);
123 spin_unlock(&fc->lock);
121 inode->i_blocks = attr->blocks; 124 inode->i_blocks = attr->blocks;
122 inode->i_atime.tv_sec = attr->atime; 125 inode->i_atime.tv_sec = attr->atime;
123 inode->i_atime.tv_nsec = attr->atimensec; 126 inode->i_atime.tv_nsec = attr->atimensec;
@@ -130,7 +133,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
130static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) 133static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
131{ 134{
132 inode->i_mode = attr->mode & S_IFMT; 135 inode->i_mode = attr->mode & S_IFMT;
133 i_size_write(inode, attr->size); 136 inode->i_size = attr->size;
134 if (S_ISREG(inode->i_mode)) { 137 if (S_ISREG(inode->i_mode)) {
135 fuse_init_common(inode); 138 fuse_init_common(inode);
136 fuse_init_file_inode(inode); 139 fuse_init_file_inode(inode);
@@ -169,7 +172,6 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
169 struct inode *inode; 172 struct inode *inode;
170 struct fuse_inode *fi; 173 struct fuse_inode *fi;
171 struct fuse_conn *fc = get_fuse_conn_super(sb); 174 struct fuse_conn *fc = get_fuse_conn_super(sb);
172 int retried = 0;
173 175
174 retry: 176 retry:
175 inode = iget5_locked(sb, nodeid, fuse_inode_eq, fuse_inode_set, &nodeid); 177 inode = iget5_locked(sb, nodeid, fuse_inode_eq, fuse_inode_set, &nodeid);
@@ -183,16 +185,16 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
183 fuse_init_inode(inode, attr); 185 fuse_init_inode(inode, attr);
184 unlock_new_inode(inode); 186 unlock_new_inode(inode);
185 } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { 187 } else if ((inode->i_mode ^ attr->mode) & S_IFMT) {
186 BUG_ON(retried);
187 /* Inode has changed type, any I/O on the old should fail */ 188 /* Inode has changed type, any I/O on the old should fail */
188 make_bad_inode(inode); 189 make_bad_inode(inode);
189 iput(inode); 190 iput(inode);
190 retried = 1;
191 goto retry; 191 goto retry;
192 } 192 }
193 193
194 fi = get_fuse_inode(inode); 194 fi = get_fuse_inode(inode);
195 spin_lock(&fc->lock);
195 fi->nlookup ++; 196 fi->nlookup ++;
197 spin_unlock(&fc->lock);
196 fuse_change_attributes(inode, attr); 198 fuse_change_attributes(inode, attr);
197 return inode; 199 return inode;
198} 200}
@@ -377,6 +379,7 @@ static struct fuse_conn *new_conn(void)
377 fc = kzalloc(sizeof(*fc), GFP_KERNEL); 379 fc = kzalloc(sizeof(*fc), GFP_KERNEL);
378 if (fc) { 380 if (fc) {
379 spin_lock_init(&fc->lock); 381 spin_lock_init(&fc->lock);
382 mutex_init(&fc->inst_mutex);
380 atomic_set(&fc->count, 1); 383 atomic_set(&fc->count, 1);
381 init_waitqueue_head(&fc->waitq); 384 init_waitqueue_head(&fc->waitq);
382 init_waitqueue_head(&fc->blocked_waitq); 385 init_waitqueue_head(&fc->blocked_waitq);
@@ -396,8 +399,10 @@ static struct fuse_conn *new_conn(void)
396 399
397void fuse_conn_put(struct fuse_conn *fc) 400void fuse_conn_put(struct fuse_conn *fc)
398{ 401{
399 if (atomic_dec_and_test(&fc->count)) 402 if (atomic_dec_and_test(&fc->count)) {
403 mutex_destroy(&fc->inst_mutex);
400 kfree(fc); 404 kfree(fc);
405 }
401} 406}
402 407
403struct fuse_conn *fuse_conn_get(struct fuse_conn *fc) 408struct fuse_conn *fuse_conn_get(struct fuse_conn *fc)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index cc57f2ecd219..06e9a8cb45e9 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -434,8 +434,7 @@ static int lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
434 */ 434 */
435 435
436static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create, 436static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create,
437 struct buffer_head *bh_map, struct metapath *mp, 437 struct buffer_head *bh_map, struct metapath *mp)
438 unsigned int maxlen)
439{ 438{
440 struct gfs2_inode *ip = GFS2_I(inode); 439 struct gfs2_inode *ip = GFS2_I(inode);
441 struct gfs2_sbd *sdp = GFS2_SB(inode); 440 struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -448,6 +447,7 @@ static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create,
448 int new = 0; 447 int new = 0;
449 u64 dblock = 0; 448 u64 dblock = 0;
450 int boundary; 449 int boundary;
450 unsigned int maxlen = bh_map->b_size >> inode->i_blkbits;
451 451
452 BUG_ON(maxlen == 0); 452 BUG_ON(maxlen == 0);
453 453
@@ -541,13 +541,13 @@ static inline void bmap_unlock(struct inode *inode, int create)
541} 541}
542 542
543int gfs2_block_map(struct inode *inode, u64 lblock, int create, 543int gfs2_block_map(struct inode *inode, u64 lblock, int create,
544 struct buffer_head *bh, unsigned int maxlen) 544 struct buffer_head *bh)
545{ 545{
546 struct metapath mp; 546 struct metapath mp;
547 int ret; 547 int ret;
548 548
549 bmap_lock(inode, create); 549 bmap_lock(inode, create);
550 ret = gfs2_block_pointers(inode, lblock, create, bh, &mp, maxlen); 550 ret = gfs2_block_pointers(inode, lblock, create, bh, &mp);
551 bmap_unlock(inode, create); 551 bmap_unlock(inode, create);
552 return ret; 552 return ret;
553} 553}
@@ -555,7 +555,7 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
555int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen) 555int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen)
556{ 556{
557 struct metapath mp; 557 struct metapath mp;
558 struct buffer_head bh = { .b_state = 0, .b_blocknr = 0, .b_size = 0 }; 558 struct buffer_head bh = { .b_state = 0, .b_blocknr = 0 };
559 int ret; 559 int ret;
560 int create = *new; 560 int create = *new;
561 561
@@ -563,8 +563,9 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
563 BUG_ON(!dblock); 563 BUG_ON(!dblock);
564 BUG_ON(!new); 564 BUG_ON(!new);
565 565
566 bh.b_size = 1 << (inode->i_blkbits + 5);
566 bmap_lock(inode, create); 567 bmap_lock(inode, create);
567 ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp, 32); 568 ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp);
568 bmap_unlock(inode, create); 569 bmap_unlock(inode, create);
569 *extlen = bh.b_size >> inode->i_blkbits; 570 *extlen = bh.b_size >> inode->i_blkbits;
570 *dblock = bh.b_blocknr; 571 *dblock = bh.b_blocknr;
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h
index 0fd379b4cd9e..ac2fd04370dc 100644
--- a/fs/gfs2/bmap.h
+++ b/fs/gfs2/bmap.h
@@ -15,7 +15,7 @@ struct gfs2_inode;
15struct page; 15struct page;
16 16
17int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); 17int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
18int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh, unsigned int maxlen); 18int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh);
19int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); 19int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen);
20 20
21int gfs2_truncatei(struct gfs2_inode *ip, u64 size); 21int gfs2_truncatei(struct gfs2_inode *ip, u64 size);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 459498cac93b..e24af28b1a12 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -184,7 +184,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
184 while (copied < size) { 184 while (copied < size) {
185 unsigned int amount; 185 unsigned int amount;
186 struct buffer_head *bh; 186 struct buffer_head *bh;
187 int new; 187 int new = 0;
188 188
189 amount = size - copied; 189 amount = size - copied;
190 if (amount > sdp->sd_sb.sb_bsize - o) 190 if (amount > sdp->sd_sb.sb_bsize - o)
@@ -212,8 +212,6 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
212 gfs2_trans_add_bh(ip->i_gl, bh, 1); 212 gfs2_trans_add_bh(ip->i_gl, bh, 1);
213 memcpy(bh->b_data + o, buf, amount); 213 memcpy(bh->b_data + o, buf, amount);
214 brelse(bh); 214 brelse(bh);
215 if (error)
216 goto fail;
217 215
218 buf += amount; 216 buf += amount;
219 copied += amount; 217 copied += amount;
@@ -317,8 +315,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
317 if (!ra) 315 if (!ra)
318 extlen = 1; 316 extlen = 1;
319 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); 317 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
320 } 318 } else {
321 if (!bh) {
322 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh); 319 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh);
323 if (error) 320 if (error)
324 goto fail; 321 goto fail;
@@ -332,7 +329,6 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
332 extlen--; 329 extlen--;
333 memcpy(buf, bh->b_data + o, amount); 330 memcpy(buf, bh->b_data + o, amount);
334 brelse(bh); 331 brelse(bh);
335 bh = NULL;
336 buf += amount; 332 buf += amount;
337 copied += amount; 333 copied += amount;
338 lblock++; 334 lblock++;
@@ -815,7 +811,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
815 leaf = (struct gfs2_leaf *)bh->b_data; 811 leaf = (struct gfs2_leaf *)bh->b_data;
816 leaf->lf_depth = cpu_to_be16(depth); 812 leaf->lf_depth = cpu_to_be16(depth);
817 leaf->lf_entries = 0; 813 leaf->lf_entries = 0;
818 leaf->lf_dirent_format = cpu_to_be16(GFS2_FORMAT_DE); 814 leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
819 leaf->lf_next = 0; 815 leaf->lf_next = 0;
820 memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved)); 816 memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved));
821 dent = (struct gfs2_dirent *)(leaf+1); 817 dent = (struct gfs2_dirent *)(leaf+1);
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 72eec6542d6a..0cace3da9dbb 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -312,10 +312,12 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
312 312
313static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) 313static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
314{ 314{
315 struct inode *inode = sdp->sd_jdesc->jd_inode;
315 int error; 316 int error;
316 struct buffer_head bh_map; 317 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
317 318
318 error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, 0, &bh_map, 1); 319 bh_map.b_size = 1 << inode->i_blkbits;
320 error = gfs2_block_map(inode, lbn, 0, &bh_map);
319 if (error || !bh_map.b_blocknr) 321 if (error || !bh_map.b_blocknr)
320 printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn); 322 printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn);
321 gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr); 323 gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index e0599fed99ce..8d5963c7e123 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -65,7 +65,7 @@ static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
65int gfs2_get_block(struct inode *inode, sector_t lblock, 65int gfs2_get_block(struct inode *inode, sector_t lblock,
66 struct buffer_head *bh_result, int create) 66 struct buffer_head *bh_result, int create)
67{ 67{
68 return gfs2_block_map(inode, lblock, create, bh_result, 32); 68 return gfs2_block_map(inode, lblock, create, bh_result);
69} 69}
70 70
71/** 71/**
@@ -83,7 +83,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
83{ 83{
84 int error; 84 int error;
85 85
86 error = gfs2_block_map(inode, lblock, 0, bh_result, 1); 86 error = gfs2_block_map(inode, lblock, 0, bh_result);
87 if (error) 87 if (error)
88 return error; 88 return error;
89 if (bh_result->b_blocknr == 0) 89 if (bh_result->b_blocknr == 0)
@@ -94,7 +94,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
94static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, 94static int gfs2_get_block_direct(struct inode *inode, sector_t lblock,
95 struct buffer_head *bh_result, int create) 95 struct buffer_head *bh_result, int create)
96{ 96{
97 return gfs2_block_map(inode, lblock, 0, bh_result, 32); 97 return gfs2_block_map(inode, lblock, 0, bh_result);
98} 98}
99 99
100/** 100/**
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 178b33911843..882873a6bd69 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -794,8 +794,8 @@ static int fill_super_meta(struct super_block *sb, struct super_block *new,
794 fs_err(sdp, "can't get root dentry\n"); 794 fs_err(sdp, "can't get root dentry\n");
795 error = -ENOMEM; 795 error = -ENOMEM;
796 iput(inode); 796 iput(inode);
797 } 797 } else
798 new->s_root->d_op = &gfs2_dops; 798 new->s_root->d_op = &gfs2_dops;
799 799
800 return error; 800 return error;
801} 801}
@@ -854,7 +854,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
854 int error = 0; 854 int error = 0;
855 struct super_block *sb = NULL, *new; 855 struct super_block *sb = NULL, *new;
856 struct gfs2_sbd *sdp; 856 struct gfs2_sbd *sdp;
857 char *gfs2mnt = NULL;
858 857
859 sb = get_gfs2_sb(dev_name); 858 sb = get_gfs2_sb(dev_name);
860 if (!sb) { 859 if (!sb) {
@@ -892,8 +891,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
892 atomic_inc(&sdp->sd_gfs2mnt->mnt_count); 891 atomic_inc(&sdp->sd_gfs2mnt->mnt_count);
893 return simple_set_mnt(mnt, new); 892 return simple_set_mnt(mnt, new);
894error: 893error:
895 if (gfs2mnt)
896 kfree(gfs2mnt);
897 return error; 894 return error;
898} 895}
899 896
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index c69b94a55588..a3deae7416c9 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -251,7 +251,7 @@ static int bh_get(struct gfs2_quota_data *qd)
251 unsigned int block, offset; 251 unsigned int block, offset;
252 struct buffer_head *bh; 252 struct buffer_head *bh;
253 int error; 253 int error;
254 struct buffer_head bh_map; 254 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
255 255
256 mutex_lock(&sdp->sd_quota_mutex); 256 mutex_lock(&sdp->sd_quota_mutex);
257 257
@@ -263,7 +263,8 @@ static int bh_get(struct gfs2_quota_data *qd)
263 block = qd->qd_slot / sdp->sd_qc_per_block; 263 block = qd->qd_slot / sdp->sd_qc_per_block;
264 offset = qd->qd_slot % sdp->sd_qc_per_block;; 264 offset = qd->qd_slot % sdp->sd_qc_per_block;;
265 265
266 error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map, 1); 266 bh_map.b_size = 1 << ip->i_inode.i_blkbits;
267 error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map);
267 if (error) 268 if (error)
268 goto fail; 269 goto fail;
269 error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); 270 error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh);
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 0a8a4b87dcc6..62cd223819b7 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -372,11 +372,12 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
372 u32 hash; 372 u32 hash;
373 struct buffer_head *bh; 373 struct buffer_head *bh;
374 int error; 374 int error;
375 struct buffer_head bh_map; 375 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
376 376
377 lblock = head->lh_blkno; 377 lblock = head->lh_blkno;
378 gfs2_replay_incr_blk(sdp, &lblock); 378 gfs2_replay_incr_blk(sdp, &lblock);
379 error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map, 1); 379 bh_map.b_size = 1 << ip->i_inode.i_blkbits;
380 error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map);
380 if (error) 381 if (error)
381 return error; 382 return error;
382 if (!bh_map.b_blocknr) { 383 if (!bh_map.b_blocknr) {
diff --git a/fs/inode.c b/fs/inode.c
index d9a21d122926..26cdb115ce67 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1306,6 +1306,42 @@ void wake_up_inode(struct inode *inode)
1306 wake_up_bit(&inode->i_state, __I_LOCK); 1306 wake_up_bit(&inode->i_state, __I_LOCK);
1307} 1307}
1308 1308
1309/*
1310 * We rarely want to lock two inodes that do not have a parent/child
1311 * relationship (such as directory, child inode) simultaneously. The
1312 * vast majority of file systems should be able to get along fine
1313 * without this. Do not use these functions except as a last resort.
1314 */
1315void inode_double_lock(struct inode *inode1, struct inode *inode2)
1316{
1317 if (inode1 == NULL || inode2 == NULL || inode1 == inode2) {
1318 if (inode1)
1319 mutex_lock(&inode1->i_mutex);
1320 else if (inode2)
1321 mutex_lock(&inode2->i_mutex);
1322 return;
1323 }
1324
1325 if (inode1 < inode2) {
1326 mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT);
1327 mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD);
1328 } else {
1329 mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT);
1330 mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD);
1331 }
1332}
1333EXPORT_SYMBOL(inode_double_lock);
1334
1335void inode_double_unlock(struct inode *inode1, struct inode *inode2)
1336{
1337 if (inode1)
1338 mutex_unlock(&inode1->i_mutex);
1339
1340 if (inode2 && inode2 != inode1)
1341 mutex_unlock(&inode2->i_mutex);
1342}
1343EXPORT_SYMBOL(inode_double_unlock);
1344
1309static __initdata unsigned long ihash_entries; 1345static __initdata unsigned long ihash_entries;
1310static int __init set_ihash_entries(char *str) 1346static int __init set_ihash_entries(char *str)
1311{ 1347{
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index e1b3c8af4d17..d5c63047a8b3 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -1314,13 +1314,14 @@ int journal_stop(handle_t *handle)
1314 int old_handle_count, err; 1314 int old_handle_count, err;
1315 pid_t pid; 1315 pid_t pid;
1316 1316
1317 J_ASSERT(transaction->t_updates > 0);
1318 J_ASSERT(journal_current_handle() == handle); 1317 J_ASSERT(journal_current_handle() == handle);
1319 1318
1320 if (is_handle_aborted(handle)) 1319 if (is_handle_aborted(handle))
1321 err = -EIO; 1320 err = -EIO;
1322 else 1321 else {
1322 J_ASSERT(transaction->t_updates > 0);
1323 err = 0; 1323 err = 0;
1324 }
1324 1325
1325 if (--handle->h_ref > 0) { 1326 if (--handle->h_ref > 0) {
1326 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, 1327 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 10db92ced014..c60f378b0f76 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -725,6 +725,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
725 __FUNCTION__); 725 __FUNCTION__);
726 kfree(journal); 726 kfree(journal);
727 journal = NULL; 727 journal = NULL;
728 goto out;
728 } 729 }
729 journal->j_dev = bdev; 730 journal->j_dev = bdev;
730 journal->j_fs_dev = fs_dev; 731 journal->j_fs_dev = fs_dev;
@@ -735,7 +736,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
735 J_ASSERT(bh != NULL); 736 J_ASSERT(bh != NULL);
736 journal->j_sb_buffer = bh; 737 journal->j_sb_buffer = bh;
737 journal->j_superblock = (journal_superblock_t *)bh->b_data; 738 journal->j_superblock = (journal_superblock_t *)bh->b_data;
738 739out:
739 return journal; 740 return journal;
740} 741}
741 742
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 149957bef907..b6cf2be845a1 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1314,13 +1314,14 @@ int jbd2_journal_stop(handle_t *handle)
1314 int old_handle_count, err; 1314 int old_handle_count, err;
1315 pid_t pid; 1315 pid_t pid;
1316 1316
1317 J_ASSERT(transaction->t_updates > 0);
1318 J_ASSERT(journal_current_handle() == handle); 1317 J_ASSERT(journal_current_handle() == handle);
1319 1318
1320 if (is_handle_aborted(handle)) 1319 if (is_handle_aborted(handle))
1321 err = -EIO; 1320 err = -EIO;
1322 else 1321 else {
1322 J_ASSERT(transaction->t_updates > 0);
1323 err = 0; 1323 err = 0;
1324 }
1324 1325
1325 if (--handle->h_ref > 0) { 1326 if (--handle->h_ref > 0) {
1326 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, 1327 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index e8c7765419e8..b85a0ad2cfb6 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -100,12 +100,12 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
100/* 100/*
101 * The server lockd has called us back to tell us the lock was granted 101 * The server lockd has called us back to tell us the lock was granted
102 */ 102 */
103u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock) 103__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock)
104{ 104{
105 const struct file_lock *fl = &lock->fl; 105 const struct file_lock *fl = &lock->fl;
106 const struct nfs_fh *fh = &lock->fh; 106 const struct nfs_fh *fh = &lock->fh;
107 struct nlm_wait *block; 107 struct nlm_wait *block;
108 u32 res = nlm_lck_denied; 108 __be32 res = nlm_lck_denied;
109 109
110 /* 110 /*
111 * Look up blocked request based on arguments. 111 * Look up blocked request based on arguments.
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index e0179f8c327f..eb243edf8932 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -148,8 +148,8 @@ nsm_create(void)
148 * XDR functions for NSM. 148 * XDR functions for NSM.
149 */ 149 */
150 150
151static u32 * 151static __be32 *
152xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 152xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
153{ 153{
154 char buffer[20], *name; 154 char buffer[20], *name;
155 155
@@ -176,7 +176,7 @@ xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
176} 176}
177 177
178static int 178static int
179xdr_encode_mon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 179xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
180{ 180{
181 p = xdr_encode_common(rqstp, p, argp); 181 p = xdr_encode_common(rqstp, p, argp);
182 if (IS_ERR(p)) 182 if (IS_ERR(p))
@@ -192,7 +192,7 @@ xdr_encode_mon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
192} 192}
193 193
194static int 194static int
195xdr_encode_unmon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 195xdr_encode_unmon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
196{ 196{
197 p = xdr_encode_common(rqstp, p, argp); 197 p = xdr_encode_common(rqstp, p, argp);
198 if (IS_ERR(p)) 198 if (IS_ERR(p))
@@ -202,7 +202,7 @@ xdr_encode_unmon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
202} 202}
203 203
204static int 204static int
205xdr_decode_stat_res(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) 205xdr_decode_stat_res(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
206{ 206{
207 resp->status = ntohl(*p++); 207 resp->status = ntohl(*p++);
208 resp->state = ntohl(*p++); 208 resp->state = ntohl(*p++);
@@ -212,7 +212,7 @@ xdr_decode_stat_res(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp)
212} 212}
213 213
214static int 214static int
215xdr_decode_stat(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) 215xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
216{ 216{
217 resp->state = ntohl(*p++); 217 resp->state = ntohl(*p++);
218 return 0; 218 return 0;
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index fa370f6eb07b..0ce5c81ff507 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -24,14 +24,14 @@
24/* 24/*
25 * Obtain client and file from arguments 25 * Obtain client and file from arguments
26 */ 26 */
27static u32 27static __be32
28nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, 28nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
29 struct nlm_host **hostp, struct nlm_file **filp) 29 struct nlm_host **hostp, struct nlm_file **filp)
30{ 30{
31 struct nlm_host *host = NULL; 31 struct nlm_host *host = NULL;
32 struct nlm_file *file = NULL; 32 struct nlm_file *file = NULL;
33 struct nlm_lock *lock = &argp->lock; 33 struct nlm_lock *lock = &argp->lock;
34 u32 error = 0; 34 __be32 error = 0;
35 35
36 /* nfsd callbacks must have been installed for this procedure */ 36 /* nfsd callbacks must have been installed for this procedure */
37 if (!nlmsvc_ops) 37 if (!nlmsvc_ops)
@@ -68,7 +68,7 @@ no_locks:
68/* 68/*
69 * NULL: Test for presence of service 69 * NULL: Test for presence of service
70 */ 70 */
71static int 71static __be32
72nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 72nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
73{ 73{
74 dprintk("lockd: NULL called\n"); 74 dprintk("lockd: NULL called\n");
@@ -78,7 +78,7 @@ nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
78/* 78/*
79 * TEST: Check for conflicting lock 79 * TEST: Check for conflicting lock
80 */ 80 */
81static int 81static __be32
82nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 82nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
83 struct nlm_res *resp) 83 struct nlm_res *resp)
84{ 84{
@@ -96,7 +96,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
96 96
97 /* Obtain client and file */ 97 /* Obtain client and file */
98 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 98 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
99 return rpc_success; 99 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
100 100
101 /* Now check for conflicting locks */ 101 /* Now check for conflicting locks */
102 resp->status = nlmsvc_testlock(file, &argp->lock, &resp->lock); 102 resp->status = nlmsvc_testlock(file, &argp->lock, &resp->lock);
@@ -107,7 +107,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
107 return rpc_success; 107 return rpc_success;
108} 108}
109 109
110static int 110static __be32
111nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 111nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
112 struct nlm_res *resp) 112 struct nlm_res *resp)
113{ 113{
@@ -126,7 +126,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
126 126
127 /* Obtain client and file */ 127 /* Obtain client and file */
128 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 128 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
129 return rpc_success; 129 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
130 130
131#if 0 131#if 0
132 /* If supplied state doesn't match current state, we assume it's 132 /* If supplied state doesn't match current state, we assume it's
@@ -150,7 +150,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
150 return rpc_success; 150 return rpc_success;
151} 151}
152 152
153static int 153static __be32
154nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 154nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
155 struct nlm_res *resp) 155 struct nlm_res *resp)
156{ 156{
@@ -169,7 +169,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
169 169
170 /* Obtain client and file */ 170 /* Obtain client and file */
171 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 171 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
172 return rpc_success; 172 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
173 173
174 /* Try to cancel request. */ 174 /* Try to cancel request. */
175 resp->status = nlmsvc_cancel_blocked(file, &argp->lock); 175 resp->status = nlmsvc_cancel_blocked(file, &argp->lock);
@@ -183,7 +183,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
183/* 183/*
184 * UNLOCK: release a lock 184 * UNLOCK: release a lock
185 */ 185 */
186static int 186static __be32
187nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 187nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
188 struct nlm_res *resp) 188 struct nlm_res *resp)
189{ 189{
@@ -202,7 +202,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
202 202
203 /* Obtain client and file */ 203 /* Obtain client and file */
204 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 204 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
205 return rpc_success; 205 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
206 206
207 /* Now try to remove the lock */ 207 /* Now try to remove the lock */
208 resp->status = nlmsvc_unlock(file, &argp->lock); 208 resp->status = nlmsvc_unlock(file, &argp->lock);
@@ -217,7 +217,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
217 * GRANTED: A server calls us to tell that a process' lock request 217 * GRANTED: A server calls us to tell that a process' lock request
218 * was granted 218 * was granted
219 */ 219 */
220static int 220static __be32
221nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 221nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
222 struct nlm_res *resp) 222 struct nlm_res *resp)
223{ 223{
@@ -253,12 +253,12 @@ static const struct rpc_call_ops nlm4svc_callback_ops = {
253 * because we send the callback before the reply proper. I hope this 253 * because we send the callback before the reply proper. I hope this
254 * doesn't break any clients. 254 * doesn't break any clients.
255 */ 255 */
256static int nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 256static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp,
257 int (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 257 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *))
258{ 258{
259 struct nlm_host *host; 259 struct nlm_host *host;
260 struct nlm_rqst *call; 260 struct nlm_rqst *call;
261 int stat; 261 __be32 stat;
262 262
263 host = nlmsvc_lookup_host(rqstp, 263 host = nlmsvc_lookup_host(rqstp,
264 argp->lock.caller, 264 argp->lock.caller,
@@ -282,35 +282,35 @@ static int nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *a
282 return rpc_success; 282 return rpc_success;
283} 283}
284 284
285static int nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 285static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
286 void *resp) 286 void *resp)
287{ 287{
288 dprintk("lockd: TEST_MSG called\n"); 288 dprintk("lockd: TEST_MSG called\n");
289 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test); 289 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test);
290} 290}
291 291
292static int nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 292static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
293 void *resp) 293 void *resp)
294{ 294{
295 dprintk("lockd: LOCK_MSG called\n"); 295 dprintk("lockd: LOCK_MSG called\n");
296 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock); 296 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock);
297} 297}
298 298
299static int nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 299static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
300 void *resp) 300 void *resp)
301{ 301{
302 dprintk("lockd: CANCEL_MSG called\n"); 302 dprintk("lockd: CANCEL_MSG called\n");
303 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel); 303 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel);
304} 304}
305 305
306static int nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 306static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
307 void *resp) 307 void *resp)
308{ 308{
309 dprintk("lockd: UNLOCK_MSG called\n"); 309 dprintk("lockd: UNLOCK_MSG called\n");
310 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock); 310 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock);
311} 311}
312 312
313static int nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 313static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
314 void *resp) 314 void *resp)
315{ 315{
316 dprintk("lockd: GRANTED_MSG called\n"); 316 dprintk("lockd: GRANTED_MSG called\n");
@@ -320,7 +320,7 @@ static int nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *arg
320/* 320/*
321 * SHARE: create a DOS share or alter existing share. 321 * SHARE: create a DOS share or alter existing share.
322 */ 322 */
323static int 323static __be32
324nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 324nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
325 struct nlm_res *resp) 325 struct nlm_res *resp)
326{ 326{
@@ -339,7 +339,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
339 339
340 /* Obtain client and file */ 340 /* Obtain client and file */
341 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 341 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
342 return rpc_success; 342 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
343 343
344 /* Now try to create the share */ 344 /* Now try to create the share */
345 resp->status = nlmsvc_share_file(host, file, argp); 345 resp->status = nlmsvc_share_file(host, file, argp);
@@ -353,7 +353,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
353/* 353/*
354 * UNSHARE: Release a DOS share. 354 * UNSHARE: Release a DOS share.
355 */ 355 */
356static int 356static __be32
357nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 357nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
358 struct nlm_res *resp) 358 struct nlm_res *resp)
359{ 359{
@@ -372,7 +372,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
372 372
373 /* Obtain client and file */ 373 /* Obtain client and file */
374 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 374 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
375 return rpc_success; 375 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
376 376
377 /* Now try to lock the file */ 377 /* Now try to lock the file */
378 resp->status = nlmsvc_unshare_file(host, file, argp); 378 resp->status = nlmsvc_unshare_file(host, file, argp);
@@ -386,7 +386,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
386/* 386/*
387 * NM_LOCK: Create an unmonitored lock 387 * NM_LOCK: Create an unmonitored lock
388 */ 388 */
389static int 389static __be32
390nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 390nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
391 struct nlm_res *resp) 391 struct nlm_res *resp)
392{ 392{
@@ -399,7 +399,7 @@ nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
399/* 399/*
400 * FREE_ALL: Release all locks and shares held by client 400 * FREE_ALL: Release all locks and shares held by client
401 */ 401 */
402static int 402static __be32
403nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 403nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
404 void *resp) 404 void *resp)
405{ 405{
@@ -417,7 +417,7 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
417/* 417/*
418 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 418 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
419 */ 419 */
420static int 420static __be32
421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
422 void *resp) 422 void *resp)
423{ 423{
@@ -446,7 +446,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
446/* 446/*
447 * client sent a GRANTED_RES, let's remove the associated block 447 * client sent a GRANTED_RES, let's remove the associated block
448 */ 448 */
449static int 449static __be32
450nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 450nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
451 void *resp) 451 void *resp)
452{ 452{
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 814c6064c9e0..7e219b938552 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -334,13 +334,13 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
334 * Attempt to establish a lock, and if it can't be granted, block it 334 * Attempt to establish a lock, and if it can't be granted, block it
335 * if required. 335 * if required.
336 */ 336 */
337u32 337__be32
338nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, 338nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
339 struct nlm_lock *lock, int wait, struct nlm_cookie *cookie) 339 struct nlm_lock *lock, int wait, struct nlm_cookie *cookie)
340{ 340{
341 struct nlm_block *block, *newblock = NULL; 341 struct nlm_block *block, *newblock = NULL;
342 int error; 342 int error;
343 u32 ret; 343 __be32 ret;
344 344
345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", 345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
346 file->f_file->f_dentry->d_inode->i_sb->s_id, 346 file->f_file->f_dentry->d_inode->i_sb->s_id,
@@ -415,7 +415,7 @@ out:
415/* 415/*
416 * Test for presence of a conflicting lock. 416 * Test for presence of a conflicting lock.
417 */ 417 */
418u32 418__be32
419nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock, 419nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
420 struct nlm_lock *conflock) 420 struct nlm_lock *conflock)
421{ 421{
@@ -448,7 +448,7 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
448 * afterwards. In this case the block will still be there, and hence 448 * afterwards. In this case the block will still be there, and hence
449 * must be removed. 449 * must be removed.
450 */ 450 */
451u32 451__be32
452nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock) 452nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
453{ 453{
454 int error; 454 int error;
@@ -476,7 +476,7 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
476 * be in progress. 476 * be in progress.
477 * The calling procedure must check whether the file can be closed. 477 * The calling procedure must check whether the file can be closed.
478 */ 478 */
479u32 479__be32
480nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) 480nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
481{ 481{
482 struct nlm_block *block; 482 struct nlm_block *block;
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 75b2c81bcb93..32e99a6e8dca 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -22,8 +22,8 @@
22#define NLMDBG_FACILITY NLMDBG_CLIENT 22#define NLMDBG_FACILITY NLMDBG_CLIENT
23 23
24#ifdef CONFIG_LOCKD_V4 24#ifdef CONFIG_LOCKD_V4
25static u32 25static __be32
26cast_to_nlm(u32 status, u32 vers) 26cast_to_nlm(__be32 status, u32 vers)
27{ 27{
28 /* Note: status is assumed to be in network byte order !!! */ 28 /* Note: status is assumed to be in network byte order !!! */
29 if (vers != 4){ 29 if (vers != 4){
@@ -52,14 +52,14 @@ cast_to_nlm(u32 status, u32 vers)
52/* 52/*
53 * Obtain client and file from arguments 53 * Obtain client and file from arguments
54 */ 54 */
55static u32 55static __be32
56nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, 56nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
57 struct nlm_host **hostp, struct nlm_file **filp) 57 struct nlm_host **hostp, struct nlm_file **filp)
58{ 58{
59 struct nlm_host *host = NULL; 59 struct nlm_host *host = NULL;
60 struct nlm_file *file = NULL; 60 struct nlm_file *file = NULL;
61 struct nlm_lock *lock = &argp->lock; 61 struct nlm_lock *lock = &argp->lock;
62 u32 error; 62 __be32 error = 0;
63 63
64 /* nfsd callbacks must have been installed for this procedure */ 64 /* nfsd callbacks must have been installed for this procedure */
65 if (!nlmsvc_ops) 65 if (!nlmsvc_ops)
@@ -88,13 +88,15 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
88no_locks: 88no_locks:
89 if (host) 89 if (host)
90 nlm_release_host(host); 90 nlm_release_host(host);
91 if (error)
92 return error;
91 return nlm_lck_denied_nolocks; 93 return nlm_lck_denied_nolocks;
92} 94}
93 95
94/* 96/*
95 * NULL: Test for presence of service 97 * NULL: Test for presence of service
96 */ 98 */
97static int 99static __be32
98nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 100nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
99{ 101{
100 dprintk("lockd: NULL called\n"); 102 dprintk("lockd: NULL called\n");
@@ -104,7 +106,7 @@ nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
104/* 106/*
105 * TEST: Check for conflicting lock 107 * TEST: Check for conflicting lock
106 */ 108 */
107static int 109static __be32
108nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 110nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
109 struct nlm_res *resp) 111 struct nlm_res *resp)
110{ 112{
@@ -122,7 +124,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
122 124
123 /* Obtain client and file */ 125 /* Obtain client and file */
124 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 126 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
125 return rpc_success; 127 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
126 128
127 /* Now check for conflicting locks */ 129 /* Now check for conflicting locks */
128 resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock)); 130 resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock));
@@ -134,7 +136,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
134 return rpc_success; 136 return rpc_success;
135} 137}
136 138
137static int 139static __be32
138nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 140nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
139 struct nlm_res *resp) 141 struct nlm_res *resp)
140{ 142{
@@ -153,7 +155,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
153 155
154 /* Obtain client and file */ 156 /* Obtain client and file */
155 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 157 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
156 return rpc_success; 158 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
157 159
158#if 0 160#if 0
159 /* If supplied state doesn't match current state, we assume it's 161 /* If supplied state doesn't match current state, we assume it's
@@ -177,7 +179,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
177 return rpc_success; 179 return rpc_success;
178} 180}
179 181
180static int 182static __be32
181nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 183nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
182 struct nlm_res *resp) 184 struct nlm_res *resp)
183{ 185{
@@ -196,7 +198,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
196 198
197 /* Obtain client and file */ 199 /* Obtain client and file */
198 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 200 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
199 return rpc_success; 201 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
200 202
201 /* Try to cancel request. */ 203 /* Try to cancel request. */
202 resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock)); 204 resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock));
@@ -210,7 +212,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
210/* 212/*
211 * UNLOCK: release a lock 213 * UNLOCK: release a lock
212 */ 214 */
213static int 215static __be32
214nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 216nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
215 struct nlm_res *resp) 217 struct nlm_res *resp)
216{ 218{
@@ -229,7 +231,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
229 231
230 /* Obtain client and file */ 232 /* Obtain client and file */
231 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 233 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
232 return rpc_success; 234 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
233 235
234 /* Now try to remove the lock */ 236 /* Now try to remove the lock */
235 resp->status = cast_status(nlmsvc_unlock(file, &argp->lock)); 237 resp->status = cast_status(nlmsvc_unlock(file, &argp->lock));
@@ -244,7 +246,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
244 * GRANTED: A server calls us to tell that a process' lock request 246 * GRANTED: A server calls us to tell that a process' lock request
245 * was granted 247 * was granted
246 */ 248 */
247static int 249static __be32
248nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 250nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
249 struct nlm_res *resp) 251 struct nlm_res *resp)
250{ 252{
@@ -280,12 +282,12 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
280 * because we send the callback before the reply proper. I hope this 282 * because we send the callback before the reply proper. I hope this
281 * doesn't break any clients. 283 * doesn't break any clients.
282 */ 284 */
283static int nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 285static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp,
284 int (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 286 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *))
285{ 287{
286 struct nlm_host *host; 288 struct nlm_host *host;
287 struct nlm_rqst *call; 289 struct nlm_rqst *call;
288 int stat; 290 __be32 stat;
289 291
290 host = nlmsvc_lookup_host(rqstp, 292 host = nlmsvc_lookup_host(rqstp,
291 argp->lock.caller, 293 argp->lock.caller,
@@ -309,28 +311,28 @@ static int nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *ar
309 return rpc_success; 311 return rpc_success;
310} 312}
311 313
312static int nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 314static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
313 void *resp) 315 void *resp)
314{ 316{
315 dprintk("lockd: TEST_MSG called\n"); 317 dprintk("lockd: TEST_MSG called\n");
316 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test); 318 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test);
317} 319}
318 320
319static int nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 321static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
320 void *resp) 322 void *resp)
321{ 323{
322 dprintk("lockd: LOCK_MSG called\n"); 324 dprintk("lockd: LOCK_MSG called\n");
323 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock); 325 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock);
324} 326}
325 327
326static int nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 328static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
327 void *resp) 329 void *resp)
328{ 330{
329 dprintk("lockd: CANCEL_MSG called\n"); 331 dprintk("lockd: CANCEL_MSG called\n");
330 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel); 332 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel);
331} 333}
332 334
333static int 335static __be32
334nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 336nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
335 void *resp) 337 void *resp)
336{ 338{
@@ -338,7 +340,7 @@ nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
338 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock); 340 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock);
339} 341}
340 342
341static int 343static __be32
342nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 344nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
343 void *resp) 345 void *resp)
344{ 346{
@@ -349,7 +351,7 @@ nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
349/* 351/*
350 * SHARE: create a DOS share or alter existing share. 352 * SHARE: create a DOS share or alter existing share.
351 */ 353 */
352static int 354static __be32
353nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 355nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
354 struct nlm_res *resp) 356 struct nlm_res *resp)
355{ 357{
@@ -368,7 +370,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
368 370
369 /* Obtain client and file */ 371 /* Obtain client and file */
370 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 372 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
371 return rpc_success; 373 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
372 374
373 /* Now try to create the share */ 375 /* Now try to create the share */
374 resp->status = cast_status(nlmsvc_share_file(host, file, argp)); 376 resp->status = cast_status(nlmsvc_share_file(host, file, argp));
@@ -382,7 +384,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
382/* 384/*
383 * UNSHARE: Release a DOS share. 385 * UNSHARE: Release a DOS share.
384 */ 386 */
385static int 387static __be32
386nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 388nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
387 struct nlm_res *resp) 389 struct nlm_res *resp)
388{ 390{
@@ -401,7 +403,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
401 403
402 /* Obtain client and file */ 404 /* Obtain client and file */
403 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 405 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
404 return rpc_success; 406 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
405 407
406 /* Now try to unshare the file */ 408 /* Now try to unshare the file */
407 resp->status = cast_status(nlmsvc_unshare_file(host, file, argp)); 409 resp->status = cast_status(nlmsvc_unshare_file(host, file, argp));
@@ -415,7 +417,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
415/* 417/*
416 * NM_LOCK: Create an unmonitored lock 418 * NM_LOCK: Create an unmonitored lock
417 */ 419 */
418static int 420static __be32
419nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 421nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
420 struct nlm_res *resp) 422 struct nlm_res *resp)
421{ 423{
@@ -428,7 +430,7 @@ nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
428/* 430/*
429 * FREE_ALL: Release all locks and shares held by client 431 * FREE_ALL: Release all locks and shares held by client
430 */ 432 */
431static int 433static __be32
432nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 434nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
433 void *resp) 435 void *resp)
434{ 436{
@@ -446,7 +448,7 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
446/* 448/*
447 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 449 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
448 */ 450 */
449static int 451static __be32
450nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
451 void *resp) 453 void *resp)
452{ 454{
@@ -475,7 +477,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
475/* 477/*
476 * client sent a GRANTED_RES, let's remove the associated block 478 * client sent a GRANTED_RES, let's remove the associated block
477 */ 479 */
478static int 480static __be32
479nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 481nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
480 void *resp) 482 void *resp)
481{ 483{
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c
index b9926ce8782e..6220dc2a3f2c 100644
--- a/fs/lockd/svcshare.c
+++ b/fs/lockd/svcshare.c
@@ -23,7 +23,7 @@ nlm_cmp_owner(struct nlm_share *share, struct xdr_netobj *oh)
23 && !memcmp(share->s_owner.data, oh->data, oh->len); 23 && !memcmp(share->s_owner.data, oh->data, oh->len);
24} 24}
25 25
26u32 26__be32
27nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file, 27nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file,
28 struct nlm_args *argp) 28 struct nlm_args *argp)
29{ 29{
@@ -64,7 +64,7 @@ update:
64/* 64/*
65 * Delete a share. 65 * Delete a share.
66 */ 66 */
67u32 67__be32
68nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file, 68nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file,
69 struct nlm_args *argp) 69 struct nlm_args *argp)
70{ 70{
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 514f5f20701e..e83024e16042 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -78,14 +78,14 @@ static inline unsigned int file_hash(struct nfs_fh *f)
78 * This is not quite right, but for now, we assume the client performs 78 * This is not quite right, but for now, we assume the client performs
79 * the proper R/W checking. 79 * the proper R/W checking.
80 */ 80 */
81u32 81__be32
82nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, 82nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
83 struct nfs_fh *f) 83 struct nfs_fh *f)
84{ 84{
85 struct hlist_node *pos; 85 struct hlist_node *pos;
86 struct nlm_file *file; 86 struct nlm_file *file;
87 unsigned int hash; 87 unsigned int hash;
88 u32 nfserr; 88 __be32 nfserr;
89 89
90 nlm_debug_print_fh("nlm_file_lookup", f); 90 nlm_debug_print_fh("nlm_file_lookup", f);
91 91
@@ -135,12 +135,6 @@ out_unlock:
135 135
136out_free: 136out_free:
137 kfree(file); 137 kfree(file);
138#ifdef CONFIG_LOCKD_V4
139 if (nfserr == 1)
140 nfserr = nlm4_stale_fh;
141 else
142#endif
143 nfserr = nlm_lck_denied;
144 goto out_unlock; 138 goto out_unlock;
145} 139}
146 140
@@ -324,7 +318,16 @@ nlmsvc_same_host(struct nlm_host *host, struct nlm_host *other)
324static int 318static int
325nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy) 319nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy)
326{ 320{
327 return host->h_server; 321 if (host->h_server) {
322 /* we are destroying locks even though the client
323 * hasn't asked us too, so don't unmonitor the
324 * client
325 */
326 if (host->h_nsmhandle)
327 host->h_nsmhandle->sm_sticky = 1;
328 return 1;
329 } else
330 return 0;
328} 331}
329 332
330/* 333/*
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 61c46facf257..b7c949256e5a 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -43,7 +43,7 @@ loff_t_to_s32(loff_t offset)
43/* 43/*
44 * XDR functions for basic NLM types 44 * XDR functions for basic NLM types
45 */ 45 */
46static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) 46static __be32 *nlm_decode_cookie(__be32 *p, struct nlm_cookie *c)
47{ 47{
48 unsigned int len; 48 unsigned int len;
49 49
@@ -69,8 +69,8 @@ static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c)
69 return p; 69 return p;
70} 70}
71 71
72static inline u32 * 72static inline __be32 *
73nlm_encode_cookie(u32 *p, struct nlm_cookie *c) 73nlm_encode_cookie(__be32 *p, struct nlm_cookie *c)
74{ 74{
75 *p++ = htonl(c->len); 75 *p++ = htonl(c->len);
76 memcpy(p, c->data, c->len); 76 memcpy(p, c->data, c->len);
@@ -78,8 +78,8 @@ nlm_encode_cookie(u32 *p, struct nlm_cookie *c)
78 return p; 78 return p;
79} 79}
80 80
81static u32 * 81static __be32 *
82nlm_decode_fh(u32 *p, struct nfs_fh *f) 82nlm_decode_fh(__be32 *p, struct nfs_fh *f)
83{ 83{
84 unsigned int len; 84 unsigned int len;
85 85
@@ -95,8 +95,8 @@ nlm_decode_fh(u32 *p, struct nfs_fh *f)
95 return p + XDR_QUADLEN(NFS2_FHSIZE); 95 return p + XDR_QUADLEN(NFS2_FHSIZE);
96} 96}
97 97
98static inline u32 * 98static inline __be32 *
99nlm_encode_fh(u32 *p, struct nfs_fh *f) 99nlm_encode_fh(__be32 *p, struct nfs_fh *f)
100{ 100{
101 *p++ = htonl(NFS2_FHSIZE); 101 *p++ = htonl(NFS2_FHSIZE);
102 memcpy(p, f->data, NFS2_FHSIZE); 102 memcpy(p, f->data, NFS2_FHSIZE);
@@ -106,20 +106,20 @@ nlm_encode_fh(u32 *p, struct nfs_fh *f)
106/* 106/*
107 * Encode and decode owner handle 107 * Encode and decode owner handle
108 */ 108 */
109static inline u32 * 109static inline __be32 *
110nlm_decode_oh(u32 *p, struct xdr_netobj *oh) 110nlm_decode_oh(__be32 *p, struct xdr_netobj *oh)
111{ 111{
112 return xdr_decode_netobj(p, oh); 112 return xdr_decode_netobj(p, oh);
113} 113}
114 114
115static inline u32 * 115static inline __be32 *
116nlm_encode_oh(u32 *p, struct xdr_netobj *oh) 116nlm_encode_oh(__be32 *p, struct xdr_netobj *oh)
117{ 117{
118 return xdr_encode_netobj(p, oh); 118 return xdr_encode_netobj(p, oh);
119} 119}
120 120
121static u32 * 121static __be32 *
122nlm_decode_lock(u32 *p, struct nlm_lock *lock) 122nlm_decode_lock(__be32 *p, struct nlm_lock *lock)
123{ 123{
124 struct file_lock *fl = &lock->fl; 124 struct file_lock *fl = &lock->fl;
125 s32 start, len, end; 125 s32 start, len, end;
@@ -153,8 +153,8 @@ nlm_decode_lock(u32 *p, struct nlm_lock *lock)
153/* 153/*
154 * Encode a lock as part of an NLM call 154 * Encode a lock as part of an NLM call
155 */ 155 */
156static u32 * 156static __be32 *
157nlm_encode_lock(u32 *p, struct nlm_lock *lock) 157nlm_encode_lock(__be32 *p, struct nlm_lock *lock)
158{ 158{
159 struct file_lock *fl = &lock->fl; 159 struct file_lock *fl = &lock->fl;
160 __s32 start, len; 160 __s32 start, len;
@@ -184,8 +184,8 @@ nlm_encode_lock(u32 *p, struct nlm_lock *lock)
184/* 184/*
185 * Encode result of a TEST/TEST_MSG call 185 * Encode result of a TEST/TEST_MSG call
186 */ 186 */
187static u32 * 187static __be32 *
188nlm_encode_testres(u32 *p, struct nlm_res *resp) 188nlm_encode_testres(__be32 *p, struct nlm_res *resp)
189{ 189{
190 s32 start, len; 190 s32 start, len;
191 191
@@ -221,7 +221,7 @@ nlm_encode_testres(u32 *p, struct nlm_res *resp)
221 * First, the server side XDR functions 221 * First, the server side XDR functions
222 */ 222 */
223int 223int
224nlmsvc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 224nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
225{ 225{
226 u32 exclusive; 226 u32 exclusive;
227 227
@@ -238,7 +238,7 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
238} 238}
239 239
240int 240int
241nlmsvc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 241nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
242{ 242{
243 if (!(p = nlm_encode_testres(p, resp))) 243 if (!(p = nlm_encode_testres(p, resp)))
244 return 0; 244 return 0;
@@ -246,7 +246,7 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
246} 246}
247 247
248int 248int
249nlmsvc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 249nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
250{ 250{
251 u32 exclusive; 251 u32 exclusive;
252 252
@@ -266,7 +266,7 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
266} 266}
267 267
268int 268int
269nlmsvc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 269nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
270{ 270{
271 u32 exclusive; 271 u32 exclusive;
272 272
@@ -282,7 +282,7 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
282} 282}
283 283
284int 284int
285nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 285nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
286{ 286{
287 if (!(p = nlm_decode_cookie(p, &argp->cookie)) 287 if (!(p = nlm_decode_cookie(p, &argp->cookie))
288 || !(p = nlm_decode_lock(p, &argp->lock))) 288 || !(p = nlm_decode_lock(p, &argp->lock)))
@@ -292,7 +292,7 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
292} 292}
293 293
294int 294int
295nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 295nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
296{ 296{
297 struct nlm_lock *lock = &argp->lock; 297 struct nlm_lock *lock = &argp->lock;
298 298
@@ -313,7 +313,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
313} 313}
314 314
315int 315int
316nlmsvc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 316nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
317{ 317{
318 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 318 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
319 return 0; 319 return 0;
@@ -323,7 +323,7 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
323} 323}
324 324
325int 325int
326nlmsvc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 326nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
327{ 327{
328 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 328 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
329 return 0; 329 return 0;
@@ -332,7 +332,7 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
332} 332}
333 333
334int 334int
335nlmsvc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp) 335nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
336{ 336{
337 struct nlm_lock *lock = &argp->lock; 337 struct nlm_lock *lock = &argp->lock;
338 338
@@ -344,7 +344,7 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
344} 344}
345 345
346int 346int
347nlmsvc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp) 347nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
348{ 348{
349 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 349 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
350 return 0; 350 return 0;
@@ -357,7 +357,7 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
357} 357}
358 358
359int 359int
360nlmsvc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 360nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
361{ 361{
362 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 362 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
363 return 0; 363 return 0;
@@ -366,13 +366,13 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
366} 366}
367 367
368int 368int
369nlmsvc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 369nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
370{ 370{
371 return xdr_argsize_check(rqstp, p); 371 return xdr_argsize_check(rqstp, p);
372} 372}
373 373
374int 374int
375nlmsvc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 375nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
376{ 376{
377 return xdr_ressize_check(rqstp, p); 377 return xdr_ressize_check(rqstp, p);
378} 378}
@@ -389,7 +389,7 @@ nlmclt_decode_void(struct rpc_rqst *req, u32 *p, void *ptr)
389#endif 389#endif
390 390
391static int 391static int
392nlmclt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 392nlmclt_encode_testargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
393{ 393{
394 struct nlm_lock *lock = &argp->lock; 394 struct nlm_lock *lock = &argp->lock;
395 395
@@ -403,7 +403,7 @@ nlmclt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
403} 403}
404 404
405static int 405static int
406nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 406nlmclt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
407{ 407{
408 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 408 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
409 return -EIO; 409 return -EIO;
@@ -438,7 +438,7 @@ nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
438 438
439 439
440static int 440static int
441nlmclt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 441nlmclt_encode_lockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
442{ 442{
443 struct nlm_lock *lock = &argp->lock; 443 struct nlm_lock *lock = &argp->lock;
444 444
@@ -455,7 +455,7 @@ nlmclt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
455} 455}
456 456
457static int 457static int
458nlmclt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 458nlmclt_encode_cancargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
459{ 459{
460 struct nlm_lock *lock = &argp->lock; 460 struct nlm_lock *lock = &argp->lock;
461 461
@@ -470,7 +470,7 @@ nlmclt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
470} 470}
471 471
472static int 472static int
473nlmclt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 473nlmclt_encode_unlockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
474{ 474{
475 struct nlm_lock *lock = &argp->lock; 475 struct nlm_lock *lock = &argp->lock;
476 476
@@ -483,7 +483,7 @@ nlmclt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
483} 483}
484 484
485static int 485static int
486nlmclt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 486nlmclt_encode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
487{ 487{
488 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 488 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
489 return -EIO; 489 return -EIO;
@@ -493,7 +493,7 @@ nlmclt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
493} 493}
494 494
495static int 495static int
496nlmclt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 496nlmclt_encode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
497{ 497{
498 if (!(p = nlm_encode_testres(p, resp))) 498 if (!(p = nlm_encode_testres(p, resp)))
499 return -EIO; 499 return -EIO;
@@ -502,7 +502,7 @@ nlmclt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
502} 502}
503 503
504static int 504static int
505nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 505nlmclt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
506{ 506{
507 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 507 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
508 return -EIO; 508 return -EIO;
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 36eb175ec335..f4c0b2b9f75a 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -44,8 +44,8 @@ loff_t_to_s64(loff_t offset)
44/* 44/*
45 * XDR functions for basic NLM types 45 * XDR functions for basic NLM types
46 */ 46 */
47static u32 * 47static __be32 *
48nlm4_decode_cookie(u32 *p, struct nlm_cookie *c) 48nlm4_decode_cookie(__be32 *p, struct nlm_cookie *c)
49{ 49{
50 unsigned int len; 50 unsigned int len;
51 51
@@ -71,8 +71,8 @@ nlm4_decode_cookie(u32 *p, struct nlm_cookie *c)
71 return p; 71 return p;
72} 72}
73 73
74static u32 * 74static __be32 *
75nlm4_encode_cookie(u32 *p, struct nlm_cookie *c) 75nlm4_encode_cookie(__be32 *p, struct nlm_cookie *c)
76{ 76{
77 *p++ = htonl(c->len); 77 *p++ = htonl(c->len);
78 memcpy(p, c->data, c->len); 78 memcpy(p, c->data, c->len);
@@ -80,8 +80,8 @@ nlm4_encode_cookie(u32 *p, struct nlm_cookie *c)
80 return p; 80 return p;
81} 81}
82 82
83static u32 * 83static __be32 *
84nlm4_decode_fh(u32 *p, struct nfs_fh *f) 84nlm4_decode_fh(__be32 *p, struct nfs_fh *f)
85{ 85{
86 memset(f->data, 0, sizeof(f->data)); 86 memset(f->data, 0, sizeof(f->data));
87 f->size = ntohl(*p++); 87 f->size = ntohl(*p++);
@@ -95,8 +95,8 @@ nlm4_decode_fh(u32 *p, struct nfs_fh *f)
95 return p + XDR_QUADLEN(f->size); 95 return p + XDR_QUADLEN(f->size);
96} 96}
97 97
98static u32 * 98static __be32 *
99nlm4_encode_fh(u32 *p, struct nfs_fh *f) 99nlm4_encode_fh(__be32 *p, struct nfs_fh *f)
100{ 100{
101 *p++ = htonl(f->size); 101 *p++ = htonl(f->size);
102 if (f->size) p[XDR_QUADLEN(f->size)-1] = 0; /* don't leak anything */ 102 if (f->size) p[XDR_QUADLEN(f->size)-1] = 0; /* don't leak anything */
@@ -107,20 +107,20 @@ nlm4_encode_fh(u32 *p, struct nfs_fh *f)
107/* 107/*
108 * Encode and decode owner handle 108 * Encode and decode owner handle
109 */ 109 */
110static u32 * 110static __be32 *
111nlm4_decode_oh(u32 *p, struct xdr_netobj *oh) 111nlm4_decode_oh(__be32 *p, struct xdr_netobj *oh)
112{ 112{
113 return xdr_decode_netobj(p, oh); 113 return xdr_decode_netobj(p, oh);
114} 114}
115 115
116static u32 * 116static __be32 *
117nlm4_encode_oh(u32 *p, struct xdr_netobj *oh) 117nlm4_encode_oh(__be32 *p, struct xdr_netobj *oh)
118{ 118{
119 return xdr_encode_netobj(p, oh); 119 return xdr_encode_netobj(p, oh);
120} 120}
121 121
122static u32 * 122static __be32 *
123nlm4_decode_lock(u32 *p, struct nlm_lock *lock) 123nlm4_decode_lock(__be32 *p, struct nlm_lock *lock)
124{ 124{
125 struct file_lock *fl = &lock->fl; 125 struct file_lock *fl = &lock->fl;
126 __s64 len, start, end; 126 __s64 len, start, end;
@@ -153,8 +153,8 @@ nlm4_decode_lock(u32 *p, struct nlm_lock *lock)
153/* 153/*
154 * Encode a lock as part of an NLM call 154 * Encode a lock as part of an NLM call
155 */ 155 */
156static u32 * 156static __be32 *
157nlm4_encode_lock(u32 *p, struct nlm_lock *lock) 157nlm4_encode_lock(__be32 *p, struct nlm_lock *lock)
158{ 158{
159 struct file_lock *fl = &lock->fl; 159 struct file_lock *fl = &lock->fl;
160 __s64 start, len; 160 __s64 start, len;
@@ -185,8 +185,8 @@ nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
185/* 185/*
186 * Encode result of a TEST/TEST_MSG call 186 * Encode result of a TEST/TEST_MSG call
187 */ 187 */
188static u32 * 188static __be32 *
189nlm4_encode_testres(u32 *p, struct nlm_res *resp) 189nlm4_encode_testres(__be32 *p, struct nlm_res *resp)
190{ 190{
191 s64 start, len; 191 s64 start, len;
192 192
@@ -227,7 +227,7 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
227 * First, the server side XDR functions 227 * First, the server side XDR functions
228 */ 228 */
229int 229int
230nlm4svc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 230nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
231{ 231{
232 u32 exclusive; 232 u32 exclusive;
233 233
@@ -244,7 +244,7 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
244} 244}
245 245
246int 246int
247nlm4svc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 247nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
248{ 248{
249 if (!(p = nlm4_encode_testres(p, resp))) 249 if (!(p = nlm4_encode_testres(p, resp)))
250 return 0; 250 return 0;
@@ -252,7 +252,7 @@ nlm4svc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
252} 252}
253 253
254int 254int
255nlm4svc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 255nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
256{ 256{
257 u32 exclusive; 257 u32 exclusive;
258 258
@@ -272,7 +272,7 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
272} 272}
273 273
274int 274int
275nlm4svc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 275nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
276{ 276{
277 u32 exclusive; 277 u32 exclusive;
278 278
@@ -288,7 +288,7 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
288} 288}
289 289
290int 290int
291nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 291nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
292{ 292{
293 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 293 if (!(p = nlm4_decode_cookie(p, &argp->cookie))
294 || !(p = nlm4_decode_lock(p, &argp->lock))) 294 || !(p = nlm4_decode_lock(p, &argp->lock)))
@@ -298,7 +298,7 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
298} 298}
299 299
300int 300int
301nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 301nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
302{ 302{
303 struct nlm_lock *lock = &argp->lock; 303 struct nlm_lock *lock = &argp->lock;
304 304
@@ -319,7 +319,7 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
319} 319}
320 320
321int 321int
322nlm4svc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 322nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
323{ 323{
324 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 324 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
325 return 0; 325 return 0;
@@ -329,7 +329,7 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
329} 329}
330 330
331int 331int
332nlm4svc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 332nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
333{ 333{
334 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 334 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
335 return 0; 335 return 0;
@@ -338,7 +338,7 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
338} 338}
339 339
340int 340int
341nlm4svc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp) 341nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
342{ 342{
343 struct nlm_lock *lock = &argp->lock; 343 struct nlm_lock *lock = &argp->lock;
344 344
@@ -350,7 +350,7 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
350} 350}
351 351
352int 352int
353nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp) 353nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
354{ 354{
355 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 355 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
356 return 0; 356 return 0;
@@ -363,7 +363,7 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
363} 363}
364 364
365int 365int
366nlm4svc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 366nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
367{ 367{
368 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 368 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
369 return 0; 369 return 0;
@@ -372,13 +372,13 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
372} 372}
373 373
374int 374int
375nlm4svc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 375nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
376{ 376{
377 return xdr_argsize_check(rqstp, p); 377 return xdr_argsize_check(rqstp, p);
378} 378}
379 379
380int 380int
381nlm4svc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 381nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
382{ 382{
383 return xdr_ressize_check(rqstp, p); 383 return xdr_ressize_check(rqstp, p);
384} 384}
@@ -388,14 +388,14 @@ nlm4svc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy)
388 */ 388 */
389#ifdef NLMCLNT_SUPPORT_SHARES 389#ifdef NLMCLNT_SUPPORT_SHARES
390static int 390static int
391nlm4clt_decode_void(struct rpc_rqst *req, u32 *p, void *ptr) 391nlm4clt_decode_void(struct rpc_rqst *req, __be32 *p, void *ptr)
392{ 392{
393 return 0; 393 return 0;
394} 394}
395#endif 395#endif
396 396
397static int 397static int
398nlm4clt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 398nlm4clt_encode_testargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
399{ 399{
400 struct nlm_lock *lock = &argp->lock; 400 struct nlm_lock *lock = &argp->lock;
401 401
@@ -409,7 +409,7 @@ nlm4clt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
409} 409}
410 410
411static int 411static int
412nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 412nlm4clt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
413{ 413{
414 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 414 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
415 return -EIO; 415 return -EIO;
@@ -444,7 +444,7 @@ nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
444 444
445 445
446static int 446static int
447nlm4clt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 447nlm4clt_encode_lockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
448{ 448{
449 struct nlm_lock *lock = &argp->lock; 449 struct nlm_lock *lock = &argp->lock;
450 450
@@ -461,7 +461,7 @@ nlm4clt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
461} 461}
462 462
463static int 463static int
464nlm4clt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 464nlm4clt_encode_cancargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
465{ 465{
466 struct nlm_lock *lock = &argp->lock; 466 struct nlm_lock *lock = &argp->lock;
467 467
@@ -476,7 +476,7 @@ nlm4clt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
476} 476}
477 477
478static int 478static int
479nlm4clt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 479nlm4clt_encode_unlockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
480{ 480{
481 struct nlm_lock *lock = &argp->lock; 481 struct nlm_lock *lock = &argp->lock;
482 482
@@ -489,7 +489,7 @@ nlm4clt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
489} 489}
490 490
491static int 491static int
492nlm4clt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 492nlm4clt_encode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
493{ 493{
494 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 494 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
495 return -EIO; 495 return -EIO;
@@ -499,7 +499,7 @@ nlm4clt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
499} 499}
500 500
501static int 501static int
502nlm4clt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 502nlm4clt_encode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
503{ 503{
504 if (!(p = nlm4_encode_testres(p, resp))) 504 if (!(p = nlm4_encode_testres(p, resp)))
505 return -EIO; 505 return -EIO;
@@ -508,7 +508,7 @@ nlm4clt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
508} 508}
509 509
510static int 510static int
511nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 511nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
512{ 512{
513 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 513 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
514 return -EIO; 514 return -EIO;
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index 5676163d26e8..db3d7919c601 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -31,10 +31,10 @@ struct cb_compound_hdr_arg {
31}; 31};
32 32
33struct cb_compound_hdr_res { 33struct cb_compound_hdr_res {
34 uint32_t *status; 34 __be32 *status;
35 int taglen; 35 int taglen;
36 const char *tag; 36 const char *tag;
37 uint32_t *nops; 37 __be32 *nops;
38}; 38};
39 39
40struct cb_getattrargs { 40struct cb_getattrargs {
@@ -44,7 +44,7 @@ struct cb_getattrargs {
44}; 44};
45 45
46struct cb_getattrres { 46struct cb_getattrres {
47 uint32_t status; 47 __be32 status;
48 uint32_t bitmap[2]; 48 uint32_t bitmap[2];
49 uint64_t size; 49 uint64_t size;
50 uint64_t change_attr; 50 uint64_t change_attr;
@@ -59,8 +59,8 @@ struct cb_recallargs {
59 uint32_t truncate; 59 uint32_t truncate;
60}; 60};
61 61
62extern unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res); 62extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
63extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy); 63extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
64 64
65#ifdef CONFIG_NFS_V4 65#ifdef CONFIG_NFS_V4
66extern int nfs_callback_up(void); 66extern int nfs_callback_up(void);
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 97cf8f71451f..72e55d83756d 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -14,7 +14,7 @@
14 14
15#define NFSDBG_FACILITY NFSDBG_CALLBACK 15#define NFSDBG_FACILITY NFSDBG_CALLBACK
16 16
17unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) 17__be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res)
18{ 18{
19 struct nfs_client *clp; 19 struct nfs_client *clp;
20 struct nfs_delegation *delegation; 20 struct nfs_delegation *delegation;
@@ -55,11 +55,11 @@ out:
55 return res->status; 55 return res->status;
56} 56}
57 57
58unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy) 58__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
59{ 59{
60 struct nfs_client *clp; 60 struct nfs_client *clp;
61 struct inode *inode; 61 struct inode *inode;
62 unsigned res; 62 __be32 res;
63 63
64 res = htonl(NFS4ERR_BADHANDLE); 64 res = htonl(NFS4ERR_BADHANDLE);
65 clp = nfs_find_client(args->addr, 4); 65 clp = nfs_find_client(args->addr, 4);
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 29f932192054..f8ea1f51f590 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -22,9 +22,9 @@
22 22
23#define NFSDBG_FACILITY NFSDBG_CALLBACK 23#define NFSDBG_FACILITY NFSDBG_CALLBACK
24 24
25typedef unsigned (*callback_process_op_t)(void *, void *); 25typedef __be32 (*callback_process_op_t)(void *, void *);
26typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); 26typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
27typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); 27typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
28 28
29 29
30struct callback_op { 30struct callback_op {
@@ -36,24 +36,24 @@ struct callback_op {
36 36
37static struct callback_op callback_ops[]; 37static struct callback_op callback_ops[];
38 38
39static int nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) 39static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp)
40{ 40{
41 return htonl(NFS4_OK); 41 return htonl(NFS4_OK);
42} 42}
43 43
44static int nfs4_decode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) 44static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
45{ 45{
46 return xdr_argsize_check(rqstp, p); 46 return xdr_argsize_check(rqstp, p);
47} 47}
48 48
49static int nfs4_encode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) 49static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
50{ 50{
51 return xdr_ressize_check(rqstp, p); 51 return xdr_ressize_check(rqstp, p);
52} 52}
53 53
54static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) 54static __be32 *read_buf(struct xdr_stream *xdr, int nbytes)
55{ 55{
56 uint32_t *p; 56 __be32 *p;
57 57
58 p = xdr_inline_decode(xdr, nbytes); 58 p = xdr_inline_decode(xdr, nbytes);
59 if (unlikely(p == NULL)) 59 if (unlikely(p == NULL))
@@ -61,9 +61,9 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes)
61 return p; 61 return p;
62} 62}
63 63
64static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) 64static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str)
65{ 65{
66 uint32_t *p; 66 __be32 *p;
67 67
68 p = read_buf(xdr, 4); 68 p = read_buf(xdr, 4);
69 if (unlikely(p == NULL)) 69 if (unlikely(p == NULL))
@@ -81,9 +81,9 @@ static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const c
81 return 0; 81 return 0;
82} 82}
83 83
84static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) 84static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
85{ 85{
86 uint32_t *p; 86 __be32 *p;
87 87
88 p = read_buf(xdr, 4); 88 p = read_buf(xdr, 4);
89 if (unlikely(p == NULL)) 89 if (unlikely(p == NULL))
@@ -99,9 +99,9 @@ static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
99 return 0; 99 return 0;
100} 100}
101 101
102static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 102static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
103{ 103{
104 uint32_t *p; 104 __be32 *p;
105 unsigned int attrlen; 105 unsigned int attrlen;
106 106
107 p = read_buf(xdr, 4); 107 p = read_buf(xdr, 4);
@@ -118,9 +118,9 @@ static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
118 return 0; 118 return 0;
119} 119}
120 120
121static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) 121static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
122{ 122{
123 uint32_t *p; 123 __be32 *p;
124 124
125 p = read_buf(xdr, 16); 125 p = read_buf(xdr, 16);
126 if (unlikely(p == NULL)) 126 if (unlikely(p == NULL))
@@ -129,11 +129,11 @@ static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
129 return 0; 129 return 0;
130} 130}
131 131
132static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) 132static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
133{ 133{
134 uint32_t *p; 134 __be32 *p;
135 unsigned int minor_version; 135 unsigned int minor_version;
136 unsigned status; 136 __be32 status;
137 137
138 status = decode_string(xdr, &hdr->taglen, &hdr->tag); 138 status = decode_string(xdr, &hdr->taglen, &hdr->tag);
139 if (unlikely(status != 0)) 139 if (unlikely(status != 0))
@@ -159,9 +159,9 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou
159 return 0; 159 return 0;
160} 160}
161 161
162static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) 162static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
163{ 163{
164 uint32_t *p; 164 __be32 *p;
165 p = read_buf(xdr, 4); 165 p = read_buf(xdr, 4);
166 if (unlikely(p == NULL)) 166 if (unlikely(p == NULL))
167 return htonl(NFS4ERR_RESOURCE); 167 return htonl(NFS4ERR_RESOURCE);
@@ -169,9 +169,9 @@ static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
169 return 0; 169 return 0;
170} 170}
171 171
172static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) 172static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args)
173{ 173{
174 unsigned status; 174 __be32 status;
175 175
176 status = decode_fh(xdr, &args->fh); 176 status = decode_fh(xdr, &args->fh);
177 if (unlikely(status != 0)) 177 if (unlikely(status != 0))
@@ -183,10 +183,10 @@ out:
183 return status; 183 return status;
184} 184}
185 185
186static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) 186static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
187{ 187{
188 uint32_t *p; 188 __be32 *p;
189 unsigned status; 189 __be32 status;
190 190
191 args->addr = &rqstp->rq_addr; 191 args->addr = &rqstp->rq_addr;
192 status = decode_stateid(xdr, &args->stateid); 192 status = decode_stateid(xdr, &args->stateid);
@@ -204,9 +204,9 @@ out:
204 return status; 204 return status;
205} 205}
206 206
207static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) 207static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
208{ 208{
209 uint32_t *p; 209 __be32 *p;
210 210
211 p = xdr_reserve_space(xdr, 4 + len); 211 p = xdr_reserve_space(xdr, 4 + len);
212 if (unlikely(p == NULL)) 212 if (unlikely(p == NULL))
@@ -217,10 +217,10 @@ static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const ch
217 217
218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) 218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) 219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
220static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep) 220static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, __be32 **savep)
221{ 221{
222 uint32_t bm[2]; 222 __be32 bm[2];
223 uint32_t *p; 223 __be32 *p;
224 224
225 bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); 225 bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0);
226 bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); 226 bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1);
@@ -247,9 +247,9 @@ static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitma
247 return 0; 247 return 0;
248} 248}
249 249
250static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) 250static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
251{ 251{
252 uint32_t *p; 252 __be32 *p;
253 253
254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) 254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE))
255 return 0; 255 return 0;
@@ -260,9 +260,9 @@ static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitma
260 return 0; 260 return 0;
261} 261}
262 262
263static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) 263static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
264{ 264{
265 uint32_t *p; 265 __be32 *p;
266 266
267 if (!(bitmap[0] & FATTR4_WORD0_SIZE)) 267 if (!(bitmap[0] & FATTR4_WORD0_SIZE))
268 return 0; 268 return 0;
@@ -273,9 +273,9 @@ static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap,
273 return 0; 273 return 0;
274} 274}
275 275
276static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) 276static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *time)
277{ 277{
278 uint32_t *p; 278 __be32 *p;
279 279
280 p = xdr_reserve_space(xdr, 12); 280 p = xdr_reserve_space(xdr, 12);
281 if (unlikely(p == 0)) 281 if (unlikely(p == 0))
@@ -285,23 +285,23 @@ static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *
285 return 0; 285 return 0;
286} 286}
287 287
288static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 288static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
289{ 289{
290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) 290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA))
291 return 0; 291 return 0;
292 return encode_attr_time(xdr,time); 292 return encode_attr_time(xdr,time);
293} 293}
294 294
295static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 295static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
296{ 296{
297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) 297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY))
298 return 0; 298 return 0;
299 return encode_attr_time(xdr,time); 299 return encode_attr_time(xdr,time);
300} 300}
301 301
302static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) 302static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
303{ 303{
304 unsigned status; 304 __be32 status;
305 305
306 hdr->status = xdr_reserve_space(xdr, 4); 306 hdr->status = xdr_reserve_space(xdr, 4);
307 if (unlikely(hdr->status == NULL)) 307 if (unlikely(hdr->status == NULL))
@@ -315,9 +315,9 @@ static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compou
315 return 0; 315 return 0;
316} 316}
317 317
318static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) 318static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
319{ 319{
320 uint32_t *p; 320 __be32 *p;
321 321
322 p = xdr_reserve_space(xdr, 8); 322 p = xdr_reserve_space(xdr, 8);
323 if (unlikely(p == NULL)) 323 if (unlikely(p == NULL))
@@ -327,10 +327,10 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
327 return 0; 327 return 0;
328} 328}
329 329
330static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) 330static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
331{ 331{
332 uint32_t *savep = NULL; 332 __be32 *savep = NULL;
333 unsigned status = res->status; 333 __be32 status = res->status;
334 334
335 if (unlikely(status != 0)) 335 if (unlikely(status != 0))
336 goto out; 336 goto out;
@@ -353,15 +353,15 @@ out:
353 return status; 353 return status;
354} 354}
355 355
356static unsigned process_op(struct svc_rqst *rqstp, 356static __be32 process_op(struct svc_rqst *rqstp,
357 struct xdr_stream *xdr_in, void *argp, 357 struct xdr_stream *xdr_in, void *argp,
358 struct xdr_stream *xdr_out, void *resp) 358 struct xdr_stream *xdr_out, void *resp)
359{ 359{
360 struct callback_op *op = &callback_ops[0]; 360 struct callback_op *op = &callback_ops[0];
361 unsigned int op_nr = OP_CB_ILLEGAL; 361 unsigned int op_nr = OP_CB_ILLEGAL;
362 unsigned int status = 0; 362 __be32 status = 0;
363 long maxlen; 363 long maxlen;
364 unsigned res; 364 __be32 res;
365 365
366 dprintk("%s: start\n", __FUNCTION__); 366 dprintk("%s: start\n", __FUNCTION__);
367 status = decode_op_hdr(xdr_in, &op_nr); 367 status = decode_op_hdr(xdr_in, &op_nr);
@@ -399,20 +399,20 @@ static unsigned process_op(struct svc_rqst *rqstp,
399/* 399/*
400 * Decode, process and encode a COMPOUND 400 * Decode, process and encode a COMPOUND
401 */ 401 */
402static int nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp)
403{ 403{
404 struct cb_compound_hdr_arg hdr_arg; 404 struct cb_compound_hdr_arg hdr_arg;
405 struct cb_compound_hdr_res hdr_res; 405 struct cb_compound_hdr_res hdr_res;
406 struct xdr_stream xdr_in, xdr_out; 406 struct xdr_stream xdr_in, xdr_out;
407 uint32_t *p; 407 __be32 *p;
408 unsigned int status; 408 __be32 status;
409 unsigned int nops = 1; 409 unsigned int nops = 1;
410 410
411 dprintk("%s: start\n", __FUNCTION__); 411 dprintk("%s: start\n", __FUNCTION__);
412 412
413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); 413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base);
414 414
415 p = (uint32_t*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); 415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len);
416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p); 416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p);
417 417
418 decode_compound_hdr_arg(&xdr_in, &hdr_arg); 418 decode_compound_hdr_arg(&xdr_in, &hdr_arg);
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 34c3996bd0f5..5fea638743e4 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -232,11 +232,15 @@ void nfs_put_client(struct nfs_client *clp)
232 * Find a client by address 232 * Find a client by address
233 * - caller must hold nfs_client_lock 233 * - caller must hold nfs_client_lock
234 */ 234 */
235static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion) 235static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion, int match_port)
236{ 236{
237 struct nfs_client *clp; 237 struct nfs_client *clp;
238 238
239 list_for_each_entry(clp, &nfs_client_list, cl_share_link) { 239 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
240 /* Don't match clients that failed to initialise properly */
241 if (clp->cl_cons_state < 0)
242 continue;
243
240 /* Different NFS versions cannot share the same nfs_client */ 244 /* Different NFS versions cannot share the same nfs_client */
241 if (clp->cl_nfsversion != nfsversion) 245 if (clp->cl_nfsversion != nfsversion)
242 continue; 246 continue;
@@ -245,7 +249,7 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int
245 sizeof(clp->cl_addr.sin_addr)) != 0) 249 sizeof(clp->cl_addr.sin_addr)) != 0)
246 continue; 250 continue;
247 251
248 if (clp->cl_addr.sin_port == addr->sin_port) 252 if (!match_port || clp->cl_addr.sin_port == addr->sin_port)
249 goto found; 253 goto found;
250 } 254 }
251 255
@@ -265,11 +269,12 @@ struct nfs_client *nfs_find_client(const struct sockaddr_in *addr, int nfsversio
265 struct nfs_client *clp; 269 struct nfs_client *clp;
266 270
267 spin_lock(&nfs_client_lock); 271 spin_lock(&nfs_client_lock);
268 clp = __nfs_find_client(addr, nfsversion); 272 clp = __nfs_find_client(addr, nfsversion, 0);
269 spin_unlock(&nfs_client_lock); 273 spin_unlock(&nfs_client_lock);
270 274 if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) {
271 BUG_ON(clp && clp->cl_cons_state == 0); 275 nfs_put_client(clp);
272 276 clp = NULL;
277 }
273 return clp; 278 return clp;
274} 279}
275 280
@@ -292,7 +297,7 @@ static struct nfs_client *nfs_get_client(const char *hostname,
292 do { 297 do {
293 spin_lock(&nfs_client_lock); 298 spin_lock(&nfs_client_lock);
294 299
295 clp = __nfs_find_client(addr, nfsversion); 300 clp = __nfs_find_client(addr, nfsversion, 1);
296 if (clp) 301 if (clp)
297 goto found_client; 302 goto found_client;
298 if (new) 303 if (new)
@@ -849,6 +854,7 @@ error:
849 */ 854 */
850static int nfs4_init_client(struct nfs_client *clp, 855static int nfs4_init_client(struct nfs_client *clp,
851 int proto, int timeo, int retrans, 856 int proto, int timeo, int retrans,
857 const char *ip_addr,
852 rpc_authflavor_t authflavour) 858 rpc_authflavor_t authflavour)
853{ 859{
854 int error; 860 int error;
@@ -865,6 +871,7 @@ static int nfs4_init_client(struct nfs_client *clp,
865 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour); 871 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour);
866 if (error < 0) 872 if (error < 0)
867 goto error; 873 goto error;
874 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
868 875
869 error = nfs_idmap_new(clp); 876 error = nfs_idmap_new(clp);
870 if (error < 0) { 877 if (error < 0) {
@@ -888,6 +895,7 @@ error:
888 */ 895 */
889static int nfs4_set_client(struct nfs_server *server, 896static int nfs4_set_client(struct nfs_server *server,
890 const char *hostname, const struct sockaddr_in *addr, 897 const char *hostname, const struct sockaddr_in *addr,
898 const char *ip_addr,
891 rpc_authflavor_t authflavour, 899 rpc_authflavor_t authflavour,
892 int proto, int timeo, int retrans) 900 int proto, int timeo, int retrans)
893{ 901{
@@ -902,7 +910,7 @@ static int nfs4_set_client(struct nfs_server *server,
902 error = PTR_ERR(clp); 910 error = PTR_ERR(clp);
903 goto error; 911 goto error;
904 } 912 }
905 error = nfs4_init_client(clp, proto, timeo, retrans, authflavour); 913 error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour);
906 if (error < 0) 914 if (error < 0)
907 goto error_put; 915 goto error_put;
908 916
@@ -971,7 +979,7 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data,
971 return ERR_PTR(-ENOMEM); 979 return ERR_PTR(-ENOMEM);
972 980
973 /* Get a client record */ 981 /* Get a client record */
974 error = nfs4_set_client(server, hostname, addr, authflavour, 982 error = nfs4_set_client(server, hostname, addr, ip_addr, authflavour,
975 data->proto, data->timeo, data->retrans); 983 data->proto, data->timeo, data->retrans);
976 if (error < 0) 984 if (error < 0)
977 goto error; 985 goto error;
@@ -1041,6 +1049,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1041 /* Get a client representation. 1049 /* Get a client representation.
1042 * Note: NFSv4 always uses TCP, */ 1050 * Note: NFSv4 always uses TCP, */
1043 error = nfs4_set_client(server, data->hostname, data->addr, 1051 error = nfs4_set_client(server, data->hostname, data->addr,
1052 parent_client->cl_ipaddr,
1044 data->authflavor, 1053 data->authflavor,
1045 parent_server->client->cl_xprt->prot, 1054 parent_server->client->cl_xprt->prot,
1046 parent_client->retrans_timeo, 1055 parent_client->retrans_timeo,
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 481f8892a919..4133ef5264e5 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -142,12 +142,12 @@ nfs_opendir(struct inode *inode, struct file *filp)
142 return res; 142 return res;
143} 143}
144 144
145typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int); 145typedef __be32 * (*decode_dirent_t)(__be32 *, struct nfs_entry *, int);
146typedef struct { 146typedef struct {
147 struct file *file; 147 struct file *file;
148 struct page *page; 148 struct page *page;
149 unsigned long page_index; 149 unsigned long page_index;
150 u32 *ptr; 150 __be32 *ptr;
151 u64 *dir_cookie; 151 u64 *dir_cookie;
152 loff_t current_index; 152 loff_t current_index;
153 struct nfs_entry *entry; 153 struct nfs_entry *entry;
@@ -203,8 +203,10 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
203 * Note: assumes we have exclusive access to this mapping either 203 * Note: assumes we have exclusive access to this mapping either
204 * through inode->i_mutex or some other mechanism. 204 * through inode->i_mutex or some other mechanism.
205 */ 205 */
206 if (page->index == 0) 206 if (page->index == 0 && invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1) < 0) {
207 invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1); 207 /* Should never happen */
208 nfs_zap_mapping(inode, inode->i_mapping);
209 }
208 unlock_page(page); 210 unlock_page(page);
209 return 0; 211 return 0;
210 error: 212 error:
@@ -218,7 +220,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
218static inline 220static inline
219int dir_decode(nfs_readdir_descriptor_t *desc) 221int dir_decode(nfs_readdir_descriptor_t *desc)
220{ 222{
221 u32 *p = desc->ptr; 223 __be32 *p = desc->ptr;
222 p = desc->decode(p, desc->entry, desc->plus); 224 p = desc->decode(p, desc->entry, desc->plus);
223 if (IS_ERR(p)) 225 if (IS_ERR(p))
224 return PTR_ERR(p); 226 return PTR_ERR(p);
@@ -1517,8 +1519,8 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
1517 pagevec_init(&lru_pvec, 0); 1519 pagevec_init(&lru_pvec, 0);
1518 if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0, 1520 if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0,
1519 GFP_KERNEL)) { 1521 GFP_KERNEL)) {
1520 if (!pagevec_add(&lru_pvec, page)) 1522 pagevec_add(&lru_pvec, page);
1521 __pagevec_lru_add(&lru_pvec); 1523 pagevec_lru_add(&lru_pvec);
1522 SetPageUptodate(page); 1524 SetPageUptodate(page);
1523 unlock_page(page); 1525 unlock_page(page);
1524 } else 1526 } else
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 9f7f8b9ea1e2..bdfabf854a51 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -497,6 +497,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
497 if (dreq->commit_data != NULL) 497 if (dreq->commit_data != NULL)
498 nfs_commit_free(dreq->commit_data); 498 nfs_commit_free(dreq->commit_data);
499 nfs_direct_free_writedata(dreq); 499 nfs_direct_free_writedata(dreq);
500 nfs_zap_mapping(inode, inode->i_mapping);
500 nfs_direct_complete(dreq); 501 nfs_direct_complete(dreq);
501 } 502 }
502} 503}
@@ -517,6 +518,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
517{ 518{
518 nfs_end_data_update(inode); 519 nfs_end_data_update(inode);
519 nfs_direct_free_writedata(dreq); 520 nfs_direct_free_writedata(dreq);
521 nfs_zap_mapping(inode, inode->i_mapping);
520 nfs_direct_complete(dreq); 522 nfs_direct_complete(dreq);
521} 523}
522#endif 524#endif
@@ -532,10 +534,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
532 534
533 spin_lock(&dreq->lock); 535 spin_lock(&dreq->lock);
534 536
535 if (likely(status >= 0)) 537 if (unlikely(status < 0)) {
536 dreq->count += data->res.count; 538 dreq->error = status;
537 else 539 goto out_unlock;
538 dreq->error = task->tk_status; 540 }
541
542 dreq->count += data->res.count;
539 543
540 if (data->res.verf->committed != NFS_FILE_SYNC) { 544 if (data->res.verf->committed != NFS_FILE_SYNC) {
541 switch (dreq->flags) { 545 switch (dreq->flags) {
@@ -550,7 +554,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
550 } 554 }
551 } 555 }
552 } 556 }
553 557out_unlock:
554 spin_unlock(&dreq->lock); 558 spin_unlock(&dreq->lock);
555} 559}
556 560
@@ -828,17 +832,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
828 832
829 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); 833 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos);
830 834
831 /*
832 * XXX: nfs_end_data_update() already ensures this file's
833 * cached data is subsequently invalidated. Do we really
834 * need to call invalidate_inode_pages2() again here?
835 *
836 * For aio writes, this invalidation will almost certainly
837 * occur before the writes complete. Kind of racey.
838 */
839 if (mapping->nrpages)
840 invalidate_inode_pages2(mapping);
841
842 if (retval > 0) 835 if (retval > 0)
843 iocb->ki_pos = pos + retval; 836 iocb->ki_pos = pos + retval;
844 837
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index bc9376ca86cd..08cc4c5919ab 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -131,6 +131,15 @@ void nfs_zap_caches(struct inode *inode)
131 spin_unlock(&inode->i_lock); 131 spin_unlock(&inode->i_lock);
132} 132}
133 133
134void nfs_zap_mapping(struct inode *inode, struct address_space *mapping)
135{
136 if (mapping->nrpages != 0) {
137 spin_lock(&inode->i_lock);
138 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
139 spin_unlock(&inode->i_lock);
140 }
141}
142
134static void nfs_zap_acl_cache(struct inode *inode) 143static void nfs_zap_acl_cache(struct inode *inode)
135{ 144{
136 void (*clear_acl_cache)(struct inode *); 145 void (*clear_acl_cache)(struct inode *);
@@ -574,7 +583,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
574 583
575 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); 584 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE);
576 lock_kernel(); 585 lock_kernel();
577 if (!inode || is_bad_inode(inode)) 586 if (is_bad_inode(inode))
578 goto out_nowait; 587 goto out_nowait;
579 if (NFS_STALE(inode)) 588 if (NFS_STALE(inode))
580 goto out_nowait; 589 goto out_nowait;
@@ -671,13 +680,20 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
671 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) 680 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
672 || nfs_attribute_timeout(inode)) 681 || nfs_attribute_timeout(inode))
673 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); 682 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
683 if (ret < 0)
684 goto out;
674 685
675 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { 686 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) {
676 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); 687 if (mapping->nrpages != 0) {
677 if (S_ISREG(inode->i_mode)) 688 if (S_ISREG(inode->i_mode)) {
678 nfs_sync_mapping(mapping); 689 ret = nfs_sync_mapping(mapping);
679 invalidate_inode_pages2(mapping); 690 if (ret < 0)
680 691 goto out;
692 }
693 ret = invalidate_inode_pages2(mapping);
694 if (ret < 0)
695 goto out;
696 }
681 spin_lock(&inode->i_lock); 697 spin_lock(&inode->i_lock);
682 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; 698 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
683 if (S_ISDIR(inode->i_mode)) { 699 if (S_ISDIR(inode->i_mode)) {
@@ -687,10 +703,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
687 } 703 }
688 spin_unlock(&inode->i_lock); 704 spin_unlock(&inode->i_lock);
689 705
706 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
690 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", 707 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
691 inode->i_sb->s_id, 708 inode->i_sb->s_id,
692 (long long)NFS_FILEID(inode)); 709 (long long)NFS_FILEID(inode));
693 } 710 }
711out:
694 return ret; 712 return ret;
695} 713}
696 714
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index bea0b016bd70..d205466233f6 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -93,15 +93,15 @@ extern void nfs_destroy_directcache(void);
93/* nfs2xdr.c */ 93/* nfs2xdr.c */
94extern int nfs_stat_to_errno(int); 94extern int nfs_stat_to_errno(int);
95extern struct rpc_procinfo nfs_procedures[]; 95extern struct rpc_procinfo nfs_procedures[];
96extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); 96extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int);
97 97
98/* nfs3xdr.c */ 98/* nfs3xdr.c */
99extern struct rpc_procinfo nfs3_procedures[]; 99extern struct rpc_procinfo nfs3_procedures[];
100extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); 100extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int);
101 101
102/* nfs4xdr.c */ 102/* nfs4xdr.c */
103#ifdef CONFIG_NFS_V4 103#ifdef CONFIG_NFS_V4
104extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); 104extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
105#endif 105#endif
106 106
107/* nfs4proc.c */ 107/* nfs4proc.c */
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index d507b021207f..f75fe72b4160 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -95,7 +95,7 @@ mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version,
95 * XDR encode/decode functions for MOUNT 95 * XDR encode/decode functions for MOUNT
96 */ 96 */
97static int 97static int
98xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path) 98xdr_encode_dirpath(struct rpc_rqst *req, __be32 *p, const char *path)
99{ 99{
100 p = xdr_encode_string(p, path); 100 p = xdr_encode_string(p, path);
101 101
@@ -104,7 +104,7 @@ xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path)
104} 104}
105 105
106static int 106static int
107xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) 107xdr_decode_fhstatus(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res)
108{ 108{
109 struct nfs_fh *fh = res->fh; 109 struct nfs_fh *fh = res->fh;
110 110
@@ -116,7 +116,7 @@ xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res)
116} 116}
117 117
118static int 118static int
119xdr_decode_fhstatus3(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) 119xdr_decode_fhstatus3(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res)
120{ 120{
121 struct nfs_fh *fh = res->fh; 121 struct nfs_fh *fh = res->fh;
122 122
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index b49501fc0a79..3be4e72a0227 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -66,15 +66,15 @@
66/* 66/*
67 * Common NFS XDR functions as inlines 67 * Common NFS XDR functions as inlines
68 */ 68 */
69static inline u32 * 69static inline __be32 *
70xdr_encode_fhandle(u32 *p, struct nfs_fh *fhandle) 70xdr_encode_fhandle(__be32 *p, struct nfs_fh *fhandle)
71{ 71{
72 memcpy(p, fhandle->data, NFS2_FHSIZE); 72 memcpy(p, fhandle->data, NFS2_FHSIZE);
73 return p + XDR_QUADLEN(NFS2_FHSIZE); 73 return p + XDR_QUADLEN(NFS2_FHSIZE);
74} 74}
75 75
76static inline u32 * 76static inline __be32 *
77xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) 77xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle)
78{ 78{
79 /* NFSv2 handles have a fixed length */ 79 /* NFSv2 handles have a fixed length */
80 fhandle->size = NFS2_FHSIZE; 80 fhandle->size = NFS2_FHSIZE;
@@ -82,8 +82,8 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle)
82 return p + XDR_QUADLEN(NFS2_FHSIZE); 82 return p + XDR_QUADLEN(NFS2_FHSIZE);
83} 83}
84 84
85static inline u32* 85static inline __be32*
86xdr_encode_time(u32 *p, struct timespec *timep) 86xdr_encode_time(__be32 *p, struct timespec *timep)
87{ 87{
88 *p++ = htonl(timep->tv_sec); 88 *p++ = htonl(timep->tv_sec);
89 /* Convert nanoseconds into microseconds */ 89 /* Convert nanoseconds into microseconds */
@@ -91,8 +91,8 @@ xdr_encode_time(u32 *p, struct timespec *timep)
91 return p; 91 return p;
92} 92}
93 93
94static inline u32* 94static inline __be32*
95xdr_encode_current_server_time(u32 *p, struct timespec *timep) 95xdr_encode_current_server_time(__be32 *p, struct timespec *timep)
96{ 96{
97 /* 97 /*
98 * Passing the invalid value useconds=1000000 is a 98 * Passing the invalid value useconds=1000000 is a
@@ -108,8 +108,8 @@ xdr_encode_current_server_time(u32 *p, struct timespec *timep)
108 return p; 108 return p;
109} 109}
110 110
111static inline u32* 111static inline __be32*
112xdr_decode_time(u32 *p, struct timespec *timep) 112xdr_decode_time(__be32 *p, struct timespec *timep)
113{ 113{
114 timep->tv_sec = ntohl(*p++); 114 timep->tv_sec = ntohl(*p++);
115 /* Convert microseconds into nanoseconds */ 115 /* Convert microseconds into nanoseconds */
@@ -117,8 +117,8 @@ xdr_decode_time(u32 *p, struct timespec *timep)
117 return p; 117 return p;
118} 118}
119 119
120static u32 * 120static __be32 *
121xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) 121xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
122{ 122{
123 u32 rdev; 123 u32 rdev;
124 fattr->type = (enum nfs_ftype) ntohl(*p++); 124 fattr->type = (enum nfs_ftype) ntohl(*p++);
@@ -146,10 +146,10 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
146 return p; 146 return p;
147} 147}
148 148
149static inline u32 * 149static inline __be32 *
150xdr_encode_sattr(u32 *p, struct iattr *attr) 150xdr_encode_sattr(__be32 *p, struct iattr *attr)
151{ 151{
152 const u32 not_set = __constant_htonl(0xFFFFFFFF); 152 const __be32 not_set = __constant_htonl(0xFFFFFFFF);
153 153
154 *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; 154 *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set;
155 *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; 155 *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set;
@@ -184,7 +184,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
184 * GETATTR, READLINK, STATFS 184 * GETATTR, READLINK, STATFS
185 */ 185 */
186static int 186static int
187nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) 187nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
188{ 188{
189 p = xdr_encode_fhandle(p, fh); 189 p = xdr_encode_fhandle(p, fh);
190 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); 190 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -195,7 +195,7 @@ nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh)
195 * Encode SETATTR arguments 195 * Encode SETATTR arguments
196 */ 196 */
197static int 197static int
198nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) 198nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args)
199{ 199{
200 p = xdr_encode_fhandle(p, args->fh); 200 p = xdr_encode_fhandle(p, args->fh);
201 p = xdr_encode_sattr(p, args->sattr); 201 p = xdr_encode_sattr(p, args->sattr);
@@ -208,7 +208,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args)
208 * LOOKUP, REMOVE, RMDIR 208 * LOOKUP, REMOVE, RMDIR
209 */ 209 */
210static int 210static int
211nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) 211nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
212{ 212{
213 p = xdr_encode_fhandle(p, args->fh); 213 p = xdr_encode_fhandle(p, args->fh);
214 p = xdr_encode_array(p, args->name, args->len); 214 p = xdr_encode_array(p, args->name, args->len);
@@ -222,7 +222,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args)
222 * exactly to the page we want to fetch. 222 * exactly to the page we want to fetch.
223 */ 223 */
224static int 224static int
225nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) 225nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
226{ 226{
227 struct rpc_auth *auth = req->rq_task->tk_auth; 227 struct rpc_auth *auth = req->rq_task->tk_auth;
228 unsigned int replen; 228 unsigned int replen;
@@ -246,7 +246,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
246 * Decode READ reply 246 * Decode READ reply
247 */ 247 */
248static int 248static int
249nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) 249nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
250{ 250{
251 struct kvec *iov = req->rq_rcv_buf.head; 251 struct kvec *iov = req->rq_rcv_buf.head;
252 int status, count, recvd, hdrlen; 252 int status, count, recvd, hdrlen;
@@ -286,7 +286,7 @@ nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
286 * Write arguments. Splice the buffer to be written into the iovec. 286 * Write arguments. Splice the buffer to be written into the iovec.
287 */ 287 */
288static int 288static int
289nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 289nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
290{ 290{
291 struct xdr_buf *sndbuf = &req->rq_snd_buf; 291 struct xdr_buf *sndbuf = &req->rq_snd_buf;
292 u32 offset = (u32)args->offset; 292 u32 offset = (u32)args->offset;
@@ -309,7 +309,7 @@ nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
309 * CREATE, MKDIR 309 * CREATE, MKDIR
310 */ 310 */
311static int 311static int
312nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) 312nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args)
313{ 313{
314 p = xdr_encode_fhandle(p, args->fh); 314 p = xdr_encode_fhandle(p, args->fh);
315 p = xdr_encode_array(p, args->name, args->len); 315 p = xdr_encode_array(p, args->name, args->len);
@@ -322,7 +322,7 @@ nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args)
322 * Encode RENAME arguments 322 * Encode RENAME arguments
323 */ 323 */
324static int 324static int
325nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) 325nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args)
326{ 326{
327 p = xdr_encode_fhandle(p, args->fromfh); 327 p = xdr_encode_fhandle(p, args->fromfh);
328 p = xdr_encode_array(p, args->fromname, args->fromlen); 328 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -336,7 +336,7 @@ nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args)
336 * Encode LINK arguments 336 * Encode LINK arguments
337 */ 337 */
338static int 338static int
339nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) 339nfs_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs_linkargs *args)
340{ 340{
341 p = xdr_encode_fhandle(p, args->fromfh); 341 p = xdr_encode_fhandle(p, args->fromfh);
342 p = xdr_encode_fhandle(p, args->tofh); 342 p = xdr_encode_fhandle(p, args->tofh);
@@ -349,7 +349,7 @@ nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args)
349 * Encode SYMLINK arguments 349 * Encode SYMLINK arguments
350 */ 350 */
351static int 351static int
352nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) 352nfs_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_symlinkargs *args)
353{ 353{
354 struct xdr_buf *sndbuf = &req->rq_snd_buf; 354 struct xdr_buf *sndbuf = &req->rq_snd_buf;
355 size_t pad; 355 size_t pad;
@@ -378,7 +378,7 @@ nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args)
378 * Encode arguments to readdir call 378 * Encode arguments to readdir call
379 */ 379 */
380static int 380static int
381nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) 381nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args)
382{ 382{
383 struct rpc_task *task = req->rq_task; 383 struct rpc_task *task = req->rq_task;
384 struct rpc_auth *auth = task->tk_auth; 384 struct rpc_auth *auth = task->tk_auth;
@@ -404,7 +404,7 @@ nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args)
404 * from nfs_readdir for each entry. 404 * from nfs_readdir for each entry.
405 */ 405 */
406static int 406static int
407nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) 407nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy)
408{ 408{
409 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 409 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
410 struct kvec *iov = rcvbuf->head; 410 struct kvec *iov = rcvbuf->head;
@@ -412,7 +412,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy)
412 int hdrlen, recvd; 412 int hdrlen, recvd;
413 int status, nr; 413 int status, nr;
414 unsigned int len, pglen; 414 unsigned int len, pglen;
415 u32 *end, *entry, *kaddr; 415 __be32 *end, *entry, *kaddr;
416 416
417 if ((status = ntohl(*p++))) 417 if ((status = ntohl(*p++)))
418 return -nfs_stat_to_errno(status); 418 return -nfs_stat_to_errno(status);
@@ -432,8 +432,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy)
432 if (pglen > recvd) 432 if (pglen > recvd)
433 pglen = recvd; 433 pglen = recvd;
434 page = rcvbuf->pages; 434 page = rcvbuf->pages;
435 kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); 435 kaddr = p = kmap_atomic(*page, KM_USER0);
436 end = (u32 *)((char *)p + pglen); 436 end = (__be32 *)((char *)p + pglen);
437 entry = p; 437 entry = p;
438 for (nr = 0; *p++; nr++) { 438 for (nr = 0; *p++; nr++) {
439 if (p + 2 > end) 439 if (p + 2 > end)
@@ -468,8 +468,8 @@ err_unmap:
468 goto out; 468 goto out;
469} 469}
470 470
471u32 * 471__be32 *
472nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) 472nfs_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
473{ 473{
474 if (!*p++) { 474 if (!*p++) {
475 if (!*p) 475 if (!*p)
@@ -496,7 +496,7 @@ nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
496 * Decode simple status reply 496 * Decode simple status reply
497 */ 497 */
498static int 498static int
499nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) 499nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy)
500{ 500{
501 int status; 501 int status;
502 502
@@ -510,7 +510,7 @@ nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy)
510 * GETATTR, SETATTR, WRITE 510 * GETATTR, SETATTR, WRITE
511 */ 511 */
512static int 512static int
513nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 513nfs_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
514{ 514{
515 int status; 515 int status;
516 516
@@ -525,7 +525,7 @@ nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
525 * LOOKUP, CREATE, MKDIR 525 * LOOKUP, CREATE, MKDIR
526 */ 526 */
527static int 527static int
528nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) 528nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res)
529{ 529{
530 int status; 530 int status;
531 531
@@ -540,7 +540,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res)
540 * Encode READLINK args 540 * Encode READLINK args
541 */ 541 */
542static int 542static int
543nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args) 543nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args)
544{ 544{
545 struct rpc_auth *auth = req->rq_task->tk_auth; 545 struct rpc_auth *auth = req->rq_task->tk_auth;
546 unsigned int replen; 546 unsigned int replen;
@@ -558,7 +558,7 @@ nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args
558 * Decode READLINK reply 558 * Decode READLINK reply
559 */ 559 */
560static int 560static int
561nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) 561nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy)
562{ 562{
563 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 563 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
564 struct kvec *iov = rcvbuf->head; 564 struct kvec *iov = rcvbuf->head;
@@ -601,7 +601,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy)
601 * Decode WRITE reply 601 * Decode WRITE reply
602 */ 602 */
603static int 603static int
604nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 604nfs_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
605{ 605{
606 res->verf->committed = NFS_FILE_SYNC; 606 res->verf->committed = NFS_FILE_SYNC;
607 return nfs_xdr_attrstat(req, p, res->fattr); 607 return nfs_xdr_attrstat(req, p, res->fattr);
@@ -611,7 +611,7 @@ nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
611 * Decode STATFS reply 611 * Decode STATFS reply
612 */ 612 */
613static int 613static int
614nfs_xdr_statfsres(struct rpc_rqst *req, u32 *p, struct nfs2_fsstat *res) 614nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res)
615{ 615{
616 int status; 616 int status;
617 617
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 3b234d4601e7..e5f128ffc32d 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -668,7 +668,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
668{ 668{
669 struct inode *dir = dentry->d_inode; 669 struct inode *dir = dentry->d_inode;
670 struct nfs_fattr dir_attr; 670 struct nfs_fattr dir_attr;
671 u32 *verf = NFS_COOKIEVERF(dir); 671 __be32 *verf = NFS_COOKIEVERF(dir);
672 struct nfs3_readdirargs arg = { 672 struct nfs3_readdirargs arg = {
673 .fh = NFS_FH(dir), 673 .fh = NFS_FH(dir),
674 .cookie = cookie, 674 .cookie = cookie,
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 16556fa4effb..0ace092d126f 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -105,14 +105,14 @@ static struct {
105/* 105/*
106 * Common NFS XDR functions as inlines 106 * Common NFS XDR functions as inlines
107 */ 107 */
108static inline u32 * 108static inline __be32 *
109xdr_encode_fhandle(u32 *p, struct nfs_fh *fh) 109xdr_encode_fhandle(__be32 *p, struct nfs_fh *fh)
110{ 110{
111 return xdr_encode_array(p, fh->data, fh->size); 111 return xdr_encode_array(p, fh->data, fh->size);
112} 112}
113 113
114static inline u32 * 114static inline __be32 *
115xdr_decode_fhandle(u32 *p, struct nfs_fh *fh) 115xdr_decode_fhandle(__be32 *p, struct nfs_fh *fh)
116{ 116{
117 if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) { 117 if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) {
118 memcpy(fh->data, p, fh->size); 118 memcpy(fh->data, p, fh->size);
@@ -124,24 +124,24 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fh)
124/* 124/*
125 * Encode/decode time. 125 * Encode/decode time.
126 */ 126 */
127static inline u32 * 127static inline __be32 *
128xdr_encode_time3(u32 *p, struct timespec *timep) 128xdr_encode_time3(__be32 *p, struct timespec *timep)
129{ 129{
130 *p++ = htonl(timep->tv_sec); 130 *p++ = htonl(timep->tv_sec);
131 *p++ = htonl(timep->tv_nsec); 131 *p++ = htonl(timep->tv_nsec);
132 return p; 132 return p;
133} 133}
134 134
135static inline u32 * 135static inline __be32 *
136xdr_decode_time3(u32 *p, struct timespec *timep) 136xdr_decode_time3(__be32 *p, struct timespec *timep)
137{ 137{
138 timep->tv_sec = ntohl(*p++); 138 timep->tv_sec = ntohl(*p++);
139 timep->tv_nsec = ntohl(*p++); 139 timep->tv_nsec = ntohl(*p++);
140 return p; 140 return p;
141} 141}
142 142
143static u32 * 143static __be32 *
144xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) 144xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
145{ 145{
146 unsigned int type, major, minor; 146 unsigned int type, major, minor;
147 int fmode; 147 int fmode;
@@ -177,8 +177,8 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
177 return p; 177 return p;
178} 178}
179 179
180static inline u32 * 180static inline __be32 *
181xdr_encode_sattr(u32 *p, struct iattr *attr) 181xdr_encode_sattr(__be32 *p, struct iattr *attr)
182{ 182{
183 if (attr->ia_valid & ATTR_MODE) { 183 if (attr->ia_valid & ATTR_MODE) {
184 *p++ = xdr_one; 184 *p++ = xdr_one;
@@ -223,8 +223,8 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
223 return p; 223 return p;
224} 224}
225 225
226static inline u32 * 226static inline __be32 *
227xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr) 227xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr)
228{ 228{
229 p = xdr_decode_hyper(p, &fattr->pre_size); 229 p = xdr_decode_hyper(p, &fattr->pre_size);
230 p = xdr_decode_time3(p, &fattr->pre_mtime); 230 p = xdr_decode_time3(p, &fattr->pre_mtime);
@@ -233,16 +233,16 @@ xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr)
233 return p; 233 return p;
234} 234}
235 235
236static inline u32 * 236static inline __be32 *
237xdr_decode_post_op_attr(u32 *p, struct nfs_fattr *fattr) 237xdr_decode_post_op_attr(__be32 *p, struct nfs_fattr *fattr)
238{ 238{
239 if (*p++) 239 if (*p++)
240 p = xdr_decode_fattr(p, fattr); 240 p = xdr_decode_fattr(p, fattr);
241 return p; 241 return p;
242} 242}
243 243
244static inline u32 * 244static inline __be32 *
245xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr) 245xdr_decode_pre_op_attr(__be32 *p, struct nfs_fattr *fattr)
246{ 246{
247 if (*p++) 247 if (*p++)
248 return xdr_decode_wcc_attr(p, fattr); 248 return xdr_decode_wcc_attr(p, fattr);
@@ -250,8 +250,8 @@ xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr)
250} 250}
251 251
252 252
253static inline u32 * 253static inline __be32 *
254xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr) 254xdr_decode_wcc_data(__be32 *p, struct nfs_fattr *fattr)
255{ 255{
256 p = xdr_decode_pre_op_attr(p, fattr); 256 p = xdr_decode_pre_op_attr(p, fattr);
257 return xdr_decode_post_op_attr(p, fattr); 257 return xdr_decode_post_op_attr(p, fattr);
@@ -265,7 +265,7 @@ xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr)
265 * Encode file handle argument 265 * Encode file handle argument
266 */ 266 */
267static int 267static int
268nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) 268nfs3_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
269{ 269{
270 p = xdr_encode_fhandle(p, fh); 270 p = xdr_encode_fhandle(p, fh);
271 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); 271 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -276,7 +276,7 @@ nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh)
276 * Encode SETATTR arguments 276 * Encode SETATTR arguments
277 */ 277 */
278static int 278static int
279nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args) 279nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
280{ 280{
281 p = xdr_encode_fhandle(p, args->fh); 281 p = xdr_encode_fhandle(p, args->fh);
282 p = xdr_encode_sattr(p, args->sattr); 282 p = xdr_encode_sattr(p, args->sattr);
@@ -291,7 +291,7 @@ nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args)
291 * Encode directory ops argument 291 * Encode directory ops argument
292 */ 292 */
293static int 293static int
294nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args) 294nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args)
295{ 295{
296 p = xdr_encode_fhandle(p, args->fh); 296 p = xdr_encode_fhandle(p, args->fh);
297 p = xdr_encode_array(p, args->name, args->len); 297 p = xdr_encode_array(p, args->name, args->len);
@@ -303,7 +303,7 @@ nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args)
303 * Encode access() argument 303 * Encode access() argument
304 */ 304 */
305static int 305static int
306nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args) 306nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *args)
307{ 307{
308 p = xdr_encode_fhandle(p, args->fh); 308 p = xdr_encode_fhandle(p, args->fh);
309 *p++ = htonl(args->access); 309 *p++ = htonl(args->access);
@@ -317,7 +317,7 @@ nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args)
317 * exactly to the page we want to fetch. 317 * exactly to the page we want to fetch.
318 */ 318 */
319static int 319static int
320nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) 320nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
321{ 321{
322 struct rpc_auth *auth = req->rq_task->tk_auth; 322 struct rpc_auth *auth = req->rq_task->tk_auth;
323 unsigned int replen; 323 unsigned int replen;
@@ -339,7 +339,7 @@ nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
339 * Write arguments. Splice the buffer to be written into the iovec. 339 * Write arguments. Splice the buffer to be written into the iovec.
340 */ 340 */
341static int 341static int
342nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 342nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
343{ 343{
344 struct xdr_buf *sndbuf = &req->rq_snd_buf; 344 struct xdr_buf *sndbuf = &req->rq_snd_buf;
345 u32 count = args->count; 345 u32 count = args->count;
@@ -360,7 +360,7 @@ nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
360 * Encode CREATE arguments 360 * Encode CREATE arguments
361 */ 361 */
362static int 362static int
363nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args) 363nfs3_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs3_createargs *args)
364{ 364{
365 p = xdr_encode_fhandle(p, args->fh); 365 p = xdr_encode_fhandle(p, args->fh);
366 p = xdr_encode_array(p, args->name, args->len); 366 p = xdr_encode_array(p, args->name, args->len);
@@ -380,7 +380,7 @@ nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args)
380 * Encode MKDIR arguments 380 * Encode MKDIR arguments
381 */ 381 */
382static int 382static int
383nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args) 383nfs3_xdr_mkdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mkdirargs *args)
384{ 384{
385 p = xdr_encode_fhandle(p, args->fh); 385 p = xdr_encode_fhandle(p, args->fh);
386 p = xdr_encode_array(p, args->name, args->len); 386 p = xdr_encode_array(p, args->name, args->len);
@@ -393,7 +393,7 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args)
393 * Encode SYMLINK arguments 393 * Encode SYMLINK arguments
394 */ 394 */
395static int 395static int
396nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args) 396nfs3_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_symlinkargs *args)
397{ 397{
398 p = xdr_encode_fhandle(p, args->fromfh); 398 p = xdr_encode_fhandle(p, args->fromfh);
399 p = xdr_encode_array(p, args->fromname, args->fromlen); 399 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -410,7 +410,7 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args
410 * Encode MKNOD arguments 410 * Encode MKNOD arguments
411 */ 411 */
412static int 412static int
413nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args) 413nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args)
414{ 414{
415 p = xdr_encode_fhandle(p, args->fh); 415 p = xdr_encode_fhandle(p, args->fh);
416 p = xdr_encode_array(p, args->name, args->len); 416 p = xdr_encode_array(p, args->name, args->len);
@@ -429,7 +429,7 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args)
429 * Encode RENAME arguments 429 * Encode RENAME arguments
430 */ 430 */
431static int 431static int
432nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args) 432nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs3_renameargs *args)
433{ 433{
434 p = xdr_encode_fhandle(p, args->fromfh); 434 p = xdr_encode_fhandle(p, args->fromfh);
435 p = xdr_encode_array(p, args->fromname, args->fromlen); 435 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -443,7 +443,7 @@ nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args)
443 * Encode LINK arguments 443 * Encode LINK arguments
444 */ 444 */
445static int 445static int
446nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args) 446nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args)
447{ 447{
448 p = xdr_encode_fhandle(p, args->fromfh); 448 p = xdr_encode_fhandle(p, args->fromfh);
449 p = xdr_encode_fhandle(p, args->tofh); 449 p = xdr_encode_fhandle(p, args->tofh);
@@ -456,7 +456,7 @@ nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args)
456 * Encode arguments to readdir call 456 * Encode arguments to readdir call
457 */ 457 */
458static int 458static int
459nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args) 459nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args)
460{ 460{
461 struct rpc_auth *auth = req->rq_task->tk_auth; 461 struct rpc_auth *auth = req->rq_task->tk_auth;
462 unsigned int replen; 462 unsigned int replen;
@@ -485,7 +485,7 @@ nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args
485 * We just check for syntactical correctness. 485 * We just check for syntactical correctness.
486 */ 486 */
487static int 487static int
488nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res) 488nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res)
489{ 489{
490 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 490 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
491 struct kvec *iov = rcvbuf->head; 491 struct kvec *iov = rcvbuf->head;
@@ -493,7 +493,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
493 int hdrlen, recvd; 493 int hdrlen, recvd;
494 int status, nr; 494 int status, nr;
495 unsigned int len, pglen; 495 unsigned int len, pglen;
496 u32 *entry, *end, *kaddr; 496 __be32 *entry, *end, *kaddr;
497 497
498 status = ntohl(*p++); 498 status = ntohl(*p++);
499 /* Decode post_op_attrs */ 499 /* Decode post_op_attrs */
@@ -523,8 +523,8 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
523 if (pglen > recvd) 523 if (pglen > recvd)
524 pglen = recvd; 524 pglen = recvd;
525 page = rcvbuf->pages; 525 page = rcvbuf->pages;
526 kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); 526 kaddr = p = kmap_atomic(*page, KM_USER0);
527 end = (u32 *)((char *)p + pglen); 527 end = (__be32 *)((char *)p + pglen);
528 entry = p; 528 entry = p;
529 for (nr = 0; *p++; nr++) { 529 for (nr = 0; *p++; nr++) {
530 if (p + 3 > end) 530 if (p + 3 > end)
@@ -583,8 +583,8 @@ err_unmap:
583 goto out; 583 goto out;
584} 584}
585 585
586u32 * 586__be32 *
587nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) 587nfs3_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
588{ 588{
589 struct nfs_entry old = *entry; 589 struct nfs_entry old = *entry;
590 590
@@ -626,7 +626,7 @@ nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
626 * Encode COMMIT arguments 626 * Encode COMMIT arguments
627 */ 627 */
628static int 628static int
629nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 629nfs3_xdr_commitargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
630{ 630{
631 p = xdr_encode_fhandle(p, args->fh); 631 p = xdr_encode_fhandle(p, args->fh);
632 p = xdr_encode_hyper(p, args->offset); 632 p = xdr_encode_hyper(p, args->offset);
@@ -640,7 +640,7 @@ nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
640 * Encode GETACL arguments 640 * Encode GETACL arguments
641 */ 641 */
642static int 642static int
643nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p, 643nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p,
644 struct nfs3_getaclargs *args) 644 struct nfs3_getaclargs *args)
645{ 645{
646 struct rpc_auth *auth = req->rq_task->tk_auth; 646 struct rpc_auth *auth = req->rq_task->tk_auth;
@@ -664,7 +664,7 @@ nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p,
664 * Encode SETACL arguments 664 * Encode SETACL arguments
665 */ 665 */
666static int 666static int
667nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p, 667nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
668 struct nfs3_setaclargs *args) 668 struct nfs3_setaclargs *args)
669{ 669{
670 struct xdr_buf *buf = &req->rq_snd_buf; 670 struct xdr_buf *buf = &req->rq_snd_buf;
@@ -711,7 +711,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p,
711 * Decode attrstat reply. 711 * Decode attrstat reply.
712 */ 712 */
713static int 713static int
714nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 714nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
715{ 715{
716 int status; 716 int status;
717 717
@@ -726,7 +726,7 @@ nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
726 * SATTR, REMOVE, RMDIR 726 * SATTR, REMOVE, RMDIR
727 */ 727 */
728static int 728static int
729nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 729nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
730{ 730{
731 int status; 731 int status;
732 732
@@ -740,7 +740,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
740 * Decode LOOKUP reply 740 * Decode LOOKUP reply
741 */ 741 */
742static int 742static int
743nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) 743nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
744{ 744{
745 int status; 745 int status;
746 746
@@ -759,7 +759,7 @@ nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
759 * Decode ACCESS reply 759 * Decode ACCESS reply
760 */ 760 */
761static int 761static int
762nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res) 762nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
763{ 763{
764 int status = ntohl(*p++); 764 int status = ntohl(*p++);
765 765
@@ -771,7 +771,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res)
771} 771}
772 772
773static int 773static int
774nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *args) 774nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args)
775{ 775{
776 struct rpc_auth *auth = req->rq_task->tk_auth; 776 struct rpc_auth *auth = req->rq_task->tk_auth;
777 unsigned int replen; 777 unsigned int replen;
@@ -789,7 +789,7 @@ nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *ar
789 * Decode READLINK reply 789 * Decode READLINK reply
790 */ 790 */
791static int 791static int
792nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 792nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
793{ 793{
794 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 794 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
795 struct kvec *iov = rcvbuf->head; 795 struct kvec *iov = rcvbuf->head;
@@ -837,7 +837,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
837 * Decode READ reply 837 * Decode READ reply
838 */ 838 */
839static int 839static int
840nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) 840nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
841{ 841{
842 struct kvec *iov = req->rq_rcv_buf.head; 842 struct kvec *iov = req->rq_rcv_buf.head;
843 int status, count, ocount, recvd, hdrlen; 843 int status, count, ocount, recvd, hdrlen;
@@ -888,7 +888,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
888 * Decode WRITE response 888 * Decode WRITE response
889 */ 889 */
890static int 890static int
891nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 891nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
892{ 892{
893 int status; 893 int status;
894 894
@@ -910,7 +910,7 @@ nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
910 * Decode a CREATE response 910 * Decode a CREATE response
911 */ 911 */
912static int 912static int
913nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) 913nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
914{ 914{
915 int status; 915 int status;
916 916
@@ -937,7 +937,7 @@ nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
937 * Decode RENAME reply 937 * Decode RENAME reply
938 */ 938 */
939static int 939static int
940nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res) 940nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res)
941{ 941{
942 int status; 942 int status;
943 943
@@ -952,7 +952,7 @@ nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res)
952 * Decode LINK reply 952 * Decode LINK reply
953 */ 953 */
954static int 954static int
955nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res) 955nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
956{ 956{
957 int status; 957 int status;
958 958
@@ -967,7 +967,7 @@ nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res)
967 * Decode FSSTAT reply 967 * Decode FSSTAT reply
968 */ 968 */
969static int 969static int
970nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res) 970nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
971{ 971{
972 int status; 972 int status;
973 973
@@ -992,7 +992,7 @@ nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res)
992 * Decode FSINFO reply 992 * Decode FSINFO reply
993 */ 993 */
994static int 994static int
995nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res) 995nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
996{ 996{
997 int status; 997 int status;
998 998
@@ -1020,7 +1020,7 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res)
1020 * Decode PATHCONF reply 1020 * Decode PATHCONF reply
1021 */ 1021 */
1022static int 1022static int
1023nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res) 1023nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
1024{ 1024{
1025 int status; 1025 int status;
1026 1026
@@ -1040,7 +1040,7 @@ nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res)
1040 * Decode COMMIT reply 1040 * Decode COMMIT reply
1041 */ 1041 */
1042static int 1042static int
1043nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 1043nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
1044{ 1044{
1045 int status; 1045 int status;
1046 1046
@@ -1059,7 +1059,7 @@ nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
1059 * Decode GETACL reply 1059 * Decode GETACL reply
1060 */ 1060 */
1061static int 1061static int
1062nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p, 1062nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
1063 struct nfs3_getaclres *res) 1063 struct nfs3_getaclres *res)
1064{ 1064{
1065 struct xdr_buf *buf = &req->rq_rcv_buf; 1065 struct xdr_buf *buf = &req->rq_rcv_buf;
@@ -1091,7 +1091,7 @@ nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p,
1091 * Decode setacl reply. 1091 * Decode setacl reply.
1092 */ 1092 */
1093static int 1093static int
1094nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 1094nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
1095{ 1095{
1096 int status = ntohl(*p++); 1096 int status = ntohl(*p++);
1097 1097
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 61095fe4b5ca..6f346677332d 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -212,7 +212,7 @@ extern void nfs_free_seqid(struct nfs_seqid *seqid);
212extern const nfs4_stateid zero_stateid; 212extern const nfs4_stateid zero_stateid;
213 213
214/* nfs4xdr.c */ 214/* nfs4xdr.c */
215extern uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus); 215extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
216extern struct rpc_procinfo nfs4_procedures[]; 216extern struct rpc_procinfo nfs4_procedures[];
217 217
218struct nfs4_mount_data; 218struct nfs4_mount_data;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 47c7e6e3910d..8118036cc449 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -138,10 +138,10 @@ const u32 nfs4_fs_locations_bitmap[2] = {
138 | FATTR4_WORD1_MOUNTED_ON_FILEID 138 | FATTR4_WORD1_MOUNTED_ON_FILEID
139}; 139};
140 140
141static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, 141static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry,
142 struct nfs4_readdir_arg *readdir) 142 struct nfs4_readdir_arg *readdir)
143{ 143{
144 u32 *start, *p; 144 __be32 *start, *p;
145 145
146 BUG_ON(readdir->count < 80); 146 BUG_ON(readdir->count < 80);
147 if (cookie > 2) { 147 if (cookie > 2) {
@@ -162,7 +162,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry,
162 * when talking to the server, we always send cookie 0 162 * when talking to the server, we always send cookie 0
163 * instead of 1 or 2. 163 * instead of 1 or 2.
164 */ 164 */
165 start = p = (u32 *)kmap_atomic(*readdir->pages, KM_USER0); 165 start = p = kmap_atomic(*readdir->pages, KM_USER0);
166 166
167 if (cookie == 0) { 167 if (cookie == 0) {
168 *p++ = xdr_one; /* next */ 168 *p++ = xdr_one; /* next */
@@ -1314,11 +1314,9 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
1314 case -EROFS: 1314 case -EROFS:
1315 lookup_instantiate_filp(nd, (struct dentry *)state, NULL); 1315 lookup_instantiate_filp(nd, (struct dentry *)state, NULL);
1316 return 1; 1316 return 1;
1317 case -ENOENT: 1317 default:
1318 if (dentry->d_inode == NULL) 1318 goto out_drop;
1319 return 1;
1320 } 1319 }
1321 goto out_drop;
1322 } 1320 }
1323 if (state->inode == dentry->d_inode) { 1321 if (state->inode == dentry->d_inode) {
1324 nfs4_intent_set_file(nd, dentry, state); 1322 nfs4_intent_set_file(nd, dentry, state);
@@ -2917,11 +2915,11 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, unsigned short po
2917 .rpc_resp = clp, 2915 .rpc_resp = clp,
2918 .rpc_cred = cred, 2916 .rpc_cred = cred,
2919 }; 2917 };
2920 u32 *p; 2918 __be32 *p;
2921 int loop = 0; 2919 int loop = 0;
2922 int status; 2920 int status;
2923 2921
2924 p = (u32*)sc_verifier.data; 2922 p = (__be32*)sc_verifier.data;
2925 *p++ = htonl((u32)clp->cl_boot_time.tv_sec); 2923 *p++ = htonl((u32)clp->cl_boot_time.tv_sec);
2926 *p = htonl((u32)clp->cl_boot_time.tv_nsec); 2924 *p = htonl((u32)clp->cl_boot_time.tv_nsec);
2927 2925
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 3dd413f52da1..0cf3fa312a33 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -471,7 +471,7 @@ struct compound_hdr {
471 471
472static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) 472static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
473{ 473{
474 uint32_t *p; 474 __be32 *p;
475 475
476 p = xdr_reserve_space(xdr, 4 + len); 476 p = xdr_reserve_space(xdr, 4 + len);
477 BUG_ON(p == NULL); 477 BUG_ON(p == NULL);
@@ -480,7 +480,7 @@ static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *
480 480
481static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) 481static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
482{ 482{
483 uint32_t *p; 483 __be32 *p;
484 484
485 dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); 485 dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag);
486 BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); 486 BUG_ON(hdr->taglen > NFS4_MAXTAGLEN);
@@ -494,7 +494,7 @@ static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
494 494
495static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) 495static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf)
496{ 496{
497 uint32_t *p; 497 __be32 *p;
498 498
499 p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE); 499 p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE);
500 BUG_ON(p == NULL); 500 BUG_ON(p == NULL);
@@ -507,8 +507,8 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
507 char owner_group[IDMAP_NAMESZ]; 507 char owner_group[IDMAP_NAMESZ];
508 int owner_namelen = 0; 508 int owner_namelen = 0;
509 int owner_grouplen = 0; 509 int owner_grouplen = 0;
510 uint32_t *p; 510 __be32 *p;
511 uint32_t *q; 511 __be32 *q;
512 int len; 512 int len;
513 uint32_t bmval0 = 0; 513 uint32_t bmval0 = 0;
514 uint32_t bmval1 = 0; 514 uint32_t bmval1 = 0;
@@ -630,7 +630,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
630 630
631static int encode_access(struct xdr_stream *xdr, u32 access) 631static int encode_access(struct xdr_stream *xdr, u32 access)
632{ 632{
633 uint32_t *p; 633 __be32 *p;
634 634
635 RESERVE_SPACE(8); 635 RESERVE_SPACE(8);
636 WRITE32(OP_ACCESS); 636 WRITE32(OP_ACCESS);
@@ -641,7 +641,7 @@ static int encode_access(struct xdr_stream *xdr, u32 access)
641 641
642static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) 642static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
643{ 643{
644 uint32_t *p; 644 __be32 *p;
645 645
646 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 646 RESERVE_SPACE(8+sizeof(arg->stateid->data));
647 WRITE32(OP_CLOSE); 647 WRITE32(OP_CLOSE);
@@ -653,7 +653,7 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
653 653
654static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) 654static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args)
655{ 655{
656 uint32_t *p; 656 __be32 *p;
657 657
658 RESERVE_SPACE(16); 658 RESERVE_SPACE(16);
659 WRITE32(OP_COMMIT); 659 WRITE32(OP_COMMIT);
@@ -665,7 +665,7 @@ static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *arg
665 665
666static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) 666static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create)
667{ 667{
668 uint32_t *p; 668 __be32 *p;
669 669
670 RESERVE_SPACE(8); 670 RESERVE_SPACE(8);
671 WRITE32(OP_CREATE); 671 WRITE32(OP_CREATE);
@@ -697,7 +697,7 @@ static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *c
697 697
698static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) 698static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap)
699{ 699{
700 uint32_t *p; 700 __be32 *p;
701 701
702 RESERVE_SPACE(12); 702 RESERVE_SPACE(12);
703 WRITE32(OP_GETATTR); 703 WRITE32(OP_GETATTR);
@@ -708,7 +708,7 @@ static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap)
708 708
709static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) 709static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1)
710{ 710{
711 uint32_t *p; 711 __be32 *p;
712 712
713 RESERVE_SPACE(16); 713 RESERVE_SPACE(16);
714 WRITE32(OP_GETATTR); 714 WRITE32(OP_GETATTR);
@@ -740,7 +740,7 @@ static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask)
740 740
741static int encode_getfh(struct xdr_stream *xdr) 741static int encode_getfh(struct xdr_stream *xdr)
742{ 742{
743 uint32_t *p; 743 __be32 *p;
744 744
745 RESERVE_SPACE(4); 745 RESERVE_SPACE(4);
746 WRITE32(OP_GETFH); 746 WRITE32(OP_GETFH);
@@ -750,7 +750,7 @@ static int encode_getfh(struct xdr_stream *xdr)
750 750
751static int encode_link(struct xdr_stream *xdr, const struct qstr *name) 751static int encode_link(struct xdr_stream *xdr, const struct qstr *name)
752{ 752{
753 uint32_t *p; 753 __be32 *p;
754 754
755 RESERVE_SPACE(8 + name->len); 755 RESERVE_SPACE(8 + name->len);
756 WRITE32(OP_LINK); 756 WRITE32(OP_LINK);
@@ -780,7 +780,7 @@ static inline uint64_t nfs4_lock_length(struct file_lock *fl)
780 */ 780 */
781static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) 781static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args)
782{ 782{
783 uint32_t *p; 783 __be32 *p;
784 784
785 RESERVE_SPACE(32); 785 RESERVE_SPACE(32);
786 WRITE32(OP_LOCK); 786 WRITE32(OP_LOCK);
@@ -809,7 +809,7 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args)
809 809
810static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args) 810static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args)
811{ 811{
812 uint32_t *p; 812 __be32 *p;
813 813
814 RESERVE_SPACE(40); 814 RESERVE_SPACE(40);
815 WRITE32(OP_LOCKT); 815 WRITE32(OP_LOCKT);
@@ -825,7 +825,7 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg
825 825
826static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args) 826static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args)
827{ 827{
828 uint32_t *p; 828 __be32 *p;
829 829
830 RESERVE_SPACE(44); 830 RESERVE_SPACE(44);
831 WRITE32(OP_LOCKU); 831 WRITE32(OP_LOCKU);
@@ -841,7 +841,7 @@ static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *arg
841static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) 841static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name)
842{ 842{
843 int len = name->len; 843 int len = name->len;
844 uint32_t *p; 844 __be32 *p;
845 845
846 RESERVE_SPACE(8 + len); 846 RESERVE_SPACE(8 + len);
847 WRITE32(OP_LOOKUP); 847 WRITE32(OP_LOOKUP);
@@ -853,7 +853,7 @@ static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name)
853 853
854static void encode_share_access(struct xdr_stream *xdr, int open_flags) 854static void encode_share_access(struct xdr_stream *xdr, int open_flags)
855{ 855{
856 uint32_t *p; 856 __be32 *p;
857 857
858 RESERVE_SPACE(8); 858 RESERVE_SPACE(8);
859 switch (open_flags & (FMODE_READ|FMODE_WRITE)) { 859 switch (open_flags & (FMODE_READ|FMODE_WRITE)) {
@@ -874,7 +874,7 @@ static void encode_share_access(struct xdr_stream *xdr, int open_flags)
874 874
875static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) 875static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg)
876{ 876{
877 uint32_t *p; 877 __be32 *p;
878 /* 878 /*
879 * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4, 879 * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4,
880 * owner 4 = 32 880 * owner 4 = 32
@@ -891,7 +891,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
891 891
892static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) 892static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
893{ 893{
894 uint32_t *p; 894 __be32 *p;
895 895
896 RESERVE_SPACE(4); 896 RESERVE_SPACE(4);
897 switch(arg->open_flags & O_EXCL) { 897 switch(arg->open_flags & O_EXCL) {
@@ -907,7 +907,7 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
907 907
908static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg) 908static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg)
909{ 909{
910 uint32_t *p; 910 __be32 *p;
911 911
912 RESERVE_SPACE(4); 912 RESERVE_SPACE(4);
913 switch (arg->open_flags & O_CREAT) { 913 switch (arg->open_flags & O_CREAT) {
@@ -923,7 +923,7 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a
923 923
924static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type) 924static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type)
925{ 925{
926 uint32_t *p; 926 __be32 *p;
927 927
928 RESERVE_SPACE(4); 928 RESERVE_SPACE(4);
929 switch (delegation_type) { 929 switch (delegation_type) {
@@ -943,7 +943,7 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation
943 943
944static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name) 944static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name)
945{ 945{
946 uint32_t *p; 946 __be32 *p;
947 947
948 RESERVE_SPACE(4); 948 RESERVE_SPACE(4);
949 WRITE32(NFS4_OPEN_CLAIM_NULL); 949 WRITE32(NFS4_OPEN_CLAIM_NULL);
@@ -952,7 +952,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *
952 952
953static inline void encode_claim_previous(struct xdr_stream *xdr, int type) 953static inline void encode_claim_previous(struct xdr_stream *xdr, int type)
954{ 954{
955 uint32_t *p; 955 __be32 *p;
956 956
957 RESERVE_SPACE(4); 957 RESERVE_SPACE(4);
958 WRITE32(NFS4_OPEN_CLAIM_PREVIOUS); 958 WRITE32(NFS4_OPEN_CLAIM_PREVIOUS);
@@ -961,7 +961,7 @@ static inline void encode_claim_previous(struct xdr_stream *xdr, int type)
961 961
962static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid) 962static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid)
963{ 963{
964 uint32_t *p; 964 __be32 *p;
965 965
966 RESERVE_SPACE(4+sizeof(stateid->data)); 966 RESERVE_SPACE(4+sizeof(stateid->data));
967 WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); 967 WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR);
@@ -991,7 +991,7 @@ static int encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg)
991 991
992static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg) 992static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg)
993{ 993{
994 uint32_t *p; 994 __be32 *p;
995 995
996 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 996 RESERVE_SPACE(8+sizeof(arg->stateid->data));
997 WRITE32(OP_OPEN_CONFIRM); 997 WRITE32(OP_OPEN_CONFIRM);
@@ -1003,7 +1003,7 @@ static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_con
1003 1003
1004static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg) 1004static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
1005{ 1005{
1006 uint32_t *p; 1006 __be32 *p;
1007 1007
1008 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 1008 RESERVE_SPACE(8+sizeof(arg->stateid->data));
1009 WRITE32(OP_OPEN_DOWNGRADE); 1009 WRITE32(OP_OPEN_DOWNGRADE);
@@ -1017,7 +1017,7 @@ static int
1017encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) 1017encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh)
1018{ 1018{
1019 int len = fh->size; 1019 int len = fh->size;
1020 uint32_t *p; 1020 __be32 *p;
1021 1021
1022 RESERVE_SPACE(8 + len); 1022 RESERVE_SPACE(8 + len);
1023 WRITE32(OP_PUTFH); 1023 WRITE32(OP_PUTFH);
@@ -1029,7 +1029,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh)
1029 1029
1030static int encode_putrootfh(struct xdr_stream *xdr) 1030static int encode_putrootfh(struct xdr_stream *xdr)
1031{ 1031{
1032 uint32_t *p; 1032 __be32 *p;
1033 1033
1034 RESERVE_SPACE(4); 1034 RESERVE_SPACE(4);
1035 WRITE32(OP_PUTROOTFH); 1035 WRITE32(OP_PUTROOTFH);
@@ -1040,7 +1040,7 @@ static int encode_putrootfh(struct xdr_stream *xdr)
1040static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) 1040static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx)
1041{ 1041{
1042 nfs4_stateid stateid; 1042 nfs4_stateid stateid;
1043 uint32_t *p; 1043 __be32 *p;
1044 1044
1045 RESERVE_SPACE(16); 1045 RESERVE_SPACE(16);
1046 if (ctx->state != NULL) { 1046 if (ctx->state != NULL) {
@@ -1052,7 +1052,7 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context
1052 1052
1053static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) 1053static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
1054{ 1054{
1055 uint32_t *p; 1055 __be32 *p;
1056 1056
1057 RESERVE_SPACE(4); 1057 RESERVE_SPACE(4);
1058 WRITE32(OP_READ); 1058 WRITE32(OP_READ);
@@ -1074,7 +1074,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1074 FATTR4_WORD1_MOUNTED_ON_FILEID, 1074 FATTR4_WORD1_MOUNTED_ON_FILEID,
1075 }; 1075 };
1076 int replen; 1076 int replen;
1077 uint32_t *p; 1077 __be32 *p;
1078 1078
1079 RESERVE_SPACE(32+sizeof(nfs4_verifier)); 1079 RESERVE_SPACE(32+sizeof(nfs4_verifier));
1080 WRITE32(OP_READDIR); 1080 WRITE32(OP_READDIR);
@@ -1116,7 +1116,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
1116{ 1116{
1117 struct rpc_auth *auth = req->rq_task->tk_auth; 1117 struct rpc_auth *auth = req->rq_task->tk_auth;
1118 unsigned int replen; 1118 unsigned int replen;
1119 uint32_t *p; 1119 __be32 *p;
1120 1120
1121 RESERVE_SPACE(4); 1121 RESERVE_SPACE(4);
1122 WRITE32(OP_READLINK); 1122 WRITE32(OP_READLINK);
@@ -1134,7 +1134,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
1134 1134
1135static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) 1135static int encode_remove(struct xdr_stream *xdr, const struct qstr *name)
1136{ 1136{
1137 uint32_t *p; 1137 __be32 *p;
1138 1138
1139 RESERVE_SPACE(8 + name->len); 1139 RESERVE_SPACE(8 + name->len);
1140 WRITE32(OP_REMOVE); 1140 WRITE32(OP_REMOVE);
@@ -1146,7 +1146,7 @@ static int encode_remove(struct xdr_stream *xdr, const struct qstr *name)
1146 1146
1147static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname) 1147static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname)
1148{ 1148{
1149 uint32_t *p; 1149 __be32 *p;
1150 1150
1151 RESERVE_SPACE(8 + oldname->len); 1151 RESERVE_SPACE(8 + oldname->len);
1152 WRITE32(OP_RENAME); 1152 WRITE32(OP_RENAME);
@@ -1162,7 +1162,7 @@ static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, con
1162 1162
1163static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid) 1163static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid)
1164{ 1164{
1165 uint32_t *p; 1165 __be32 *p;
1166 1166
1167 RESERVE_SPACE(12); 1167 RESERVE_SPACE(12);
1168 WRITE32(OP_RENEW); 1168 WRITE32(OP_RENEW);
@@ -1174,7 +1174,7 @@ static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_
1174static int 1174static int
1175encode_restorefh(struct xdr_stream *xdr) 1175encode_restorefh(struct xdr_stream *xdr)
1176{ 1176{
1177 uint32_t *p; 1177 __be32 *p;
1178 1178
1179 RESERVE_SPACE(4); 1179 RESERVE_SPACE(4);
1180 WRITE32(OP_RESTOREFH); 1180 WRITE32(OP_RESTOREFH);
@@ -1185,7 +1185,7 @@ encode_restorefh(struct xdr_stream *xdr)
1185static int 1185static int
1186encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) 1186encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg)
1187{ 1187{
1188 uint32_t *p; 1188 __be32 *p;
1189 1189
1190 RESERVE_SPACE(4+sizeof(zero_stateid.data)); 1190 RESERVE_SPACE(4+sizeof(zero_stateid.data));
1191 WRITE32(OP_SETATTR); 1191 WRITE32(OP_SETATTR);
@@ -1204,7 +1204,7 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg)
1204static int 1204static int
1205encode_savefh(struct xdr_stream *xdr) 1205encode_savefh(struct xdr_stream *xdr)
1206{ 1206{
1207 uint32_t *p; 1207 __be32 *p;
1208 1208
1209 RESERVE_SPACE(4); 1209 RESERVE_SPACE(4);
1210 WRITE32(OP_SAVEFH); 1210 WRITE32(OP_SAVEFH);
@@ -1215,7 +1215,7 @@ encode_savefh(struct xdr_stream *xdr)
1215static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server) 1215static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server)
1216{ 1216{
1217 int status; 1217 int status;
1218 uint32_t *p; 1218 __be32 *p;
1219 1219
1220 RESERVE_SPACE(4+sizeof(arg->stateid.data)); 1220 RESERVE_SPACE(4+sizeof(arg->stateid.data));
1221 WRITE32(OP_SETATTR); 1221 WRITE32(OP_SETATTR);
@@ -1229,7 +1229,7 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *
1229 1229
1230static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) 1230static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid)
1231{ 1231{
1232 uint32_t *p; 1232 __be32 *p;
1233 1233
1234 RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data)); 1234 RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data));
1235 WRITE32(OP_SETCLIENTID); 1235 WRITE32(OP_SETCLIENTID);
@@ -1248,7 +1248,7 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien
1248 1248
1249static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) 1249static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state)
1250{ 1250{
1251 uint32_t *p; 1251 __be32 *p;
1252 1252
1253 RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data)); 1253 RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data));
1254 WRITE32(OP_SETCLIENTID_CONFIRM); 1254 WRITE32(OP_SETCLIENTID_CONFIRM);
@@ -1260,7 +1260,7 @@ static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_c
1260 1260
1261static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) 1261static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args)
1262{ 1262{
1263 uint32_t *p; 1263 __be32 *p;
1264 1264
1265 RESERVE_SPACE(4); 1265 RESERVE_SPACE(4);
1266 WRITE32(OP_WRITE); 1266 WRITE32(OP_WRITE);
@@ -1279,7 +1279,7 @@ static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args
1279 1279
1280static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid) 1280static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid)
1281{ 1281{
1282 uint32_t *p; 1282 __be32 *p;
1283 1283
1284 RESERVE_SPACE(20); 1284 RESERVE_SPACE(20);
1285 1285
@@ -1295,7 +1295,7 @@ static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *statei
1295/* 1295/*
1296 * Encode an ACCESS request 1296 * Encode an ACCESS request
1297 */ 1297 */
1298static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct nfs4_accessargs *args) 1298static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs4_accessargs *args)
1299{ 1299{
1300 struct xdr_stream xdr; 1300 struct xdr_stream xdr;
1301 struct compound_hdr hdr = { 1301 struct compound_hdr hdr = {
@@ -1313,7 +1313,7 @@ static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct n
1313/* 1313/*
1314 * Encode LOOKUP request 1314 * Encode LOOKUP request
1315 */ 1315 */
1316static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_arg *args) 1316static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_arg *args)
1317{ 1317{
1318 struct xdr_stream xdr; 1318 struct xdr_stream xdr;
1319 struct compound_hdr hdr = { 1319 struct compound_hdr hdr = {
@@ -1337,7 +1337,7 @@ out:
1337/* 1337/*
1338 * Encode LOOKUP_ROOT request 1338 * Encode LOOKUP_ROOT request
1339 */ 1339 */
1340static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_root_arg *args) 1340static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_root_arg *args)
1341{ 1341{
1342 struct xdr_stream xdr; 1342 struct xdr_stream xdr;
1343 struct compound_hdr hdr = { 1343 struct compound_hdr hdr = {
@@ -1358,7 +1358,7 @@ out:
1358/* 1358/*
1359 * Encode REMOVE request 1359 * Encode REMOVE request
1360 */ 1360 */
1361static int nfs4_xdr_enc_remove(struct rpc_rqst *req, uint32_t *p, const struct nfs4_remove_arg *args) 1361static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs4_remove_arg *args)
1362{ 1362{
1363 struct xdr_stream xdr; 1363 struct xdr_stream xdr;
1364 struct compound_hdr hdr = { 1364 struct compound_hdr hdr = {
@@ -1380,7 +1380,7 @@ out:
1380/* 1380/*
1381 * Encode RENAME request 1381 * Encode RENAME request
1382 */ 1382 */
1383static int nfs4_xdr_enc_rename(struct rpc_rqst *req, uint32_t *p, const struct nfs4_rename_arg *args) 1383static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs4_rename_arg *args)
1384{ 1384{
1385 struct xdr_stream xdr; 1385 struct xdr_stream xdr;
1386 struct compound_hdr hdr = { 1386 struct compound_hdr hdr = {
@@ -1410,7 +1410,7 @@ out:
1410/* 1410/*
1411 * Encode LINK request 1411 * Encode LINK request
1412 */ 1412 */
1413static int nfs4_xdr_enc_link(struct rpc_rqst *req, uint32_t *p, const struct nfs4_link_arg *args) 1413static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_link_arg *args)
1414{ 1414{
1415 struct xdr_stream xdr; 1415 struct xdr_stream xdr;
1416 struct compound_hdr hdr = { 1416 struct compound_hdr hdr = {
@@ -1440,7 +1440,7 @@ out:
1440/* 1440/*
1441 * Encode CREATE request 1441 * Encode CREATE request
1442 */ 1442 */
1443static int nfs4_xdr_enc_create(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) 1443static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args)
1444{ 1444{
1445 struct xdr_stream xdr; 1445 struct xdr_stream xdr;
1446 struct compound_hdr hdr = { 1446 struct compound_hdr hdr = {
@@ -1470,7 +1470,7 @@ out:
1470/* 1470/*
1471 * Encode SYMLINK request 1471 * Encode SYMLINK request
1472 */ 1472 */
1473static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) 1473static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args)
1474{ 1474{
1475 return nfs4_xdr_enc_create(req, p, args); 1475 return nfs4_xdr_enc_create(req, p, args);
1476} 1476}
@@ -1478,7 +1478,7 @@ static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct
1478/* 1478/*
1479 * Encode GETATTR request 1479 * Encode GETATTR request
1480 */ 1480 */
1481static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct nfs4_getattr_arg *args) 1481static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nfs4_getattr_arg *args)
1482{ 1482{
1483 struct xdr_stream xdr; 1483 struct xdr_stream xdr;
1484 struct compound_hdr hdr = { 1484 struct compound_hdr hdr = {
@@ -1496,7 +1496,7 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct
1496/* 1496/*
1497 * Encode a CLOSE request 1497 * Encode a CLOSE request
1498 */ 1498 */
1499static int nfs4_xdr_enc_close(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) 1499static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args)
1500{ 1500{
1501 struct xdr_stream xdr; 1501 struct xdr_stream xdr;
1502 struct compound_hdr hdr = { 1502 struct compound_hdr hdr = {
@@ -1520,7 +1520,7 @@ out:
1520/* 1520/*
1521 * Encode an OPEN request 1521 * Encode an OPEN request
1522 */ 1522 */
1523static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) 1523static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args)
1524{ 1524{
1525 struct xdr_stream xdr; 1525 struct xdr_stream xdr;
1526 struct compound_hdr hdr = { 1526 struct compound_hdr hdr = {
@@ -1556,7 +1556,7 @@ out:
1556/* 1556/*
1557 * Encode an OPEN_CONFIRM request 1557 * Encode an OPEN_CONFIRM request
1558 */ 1558 */
1559static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_open_confirmargs *args) 1559static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_open_confirmargs *args)
1560{ 1560{
1561 struct xdr_stream xdr; 1561 struct xdr_stream xdr;
1562 struct compound_hdr hdr = { 1562 struct compound_hdr hdr = {
@@ -1577,7 +1577,7 @@ out:
1577/* 1577/*
1578 * Encode an OPEN request with no attributes. 1578 * Encode an OPEN request with no attributes.
1579 */ 1579 */
1580static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) 1580static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args)
1581{ 1581{
1582 struct xdr_stream xdr; 1582 struct xdr_stream xdr;
1583 struct compound_hdr hdr = { 1583 struct compound_hdr hdr = {
@@ -1601,7 +1601,7 @@ out:
1601/* 1601/*
1602 * Encode an OPEN_DOWNGRADE request 1602 * Encode an OPEN_DOWNGRADE request
1603 */ 1603 */
1604static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) 1604static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args)
1605{ 1605{
1606 struct xdr_stream xdr; 1606 struct xdr_stream xdr;
1607 struct compound_hdr hdr = { 1607 struct compound_hdr hdr = {
@@ -1625,7 +1625,7 @@ out:
1625/* 1625/*
1626 * Encode a LOCK request 1626 * Encode a LOCK request
1627 */ 1627 */
1628static int nfs4_xdr_enc_lock(struct rpc_rqst *req, uint32_t *p, struct nfs_lock_args *args) 1628static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_args *args)
1629{ 1629{
1630 struct xdr_stream xdr; 1630 struct xdr_stream xdr;
1631 struct compound_hdr hdr = { 1631 struct compound_hdr hdr = {
@@ -1646,7 +1646,7 @@ out:
1646/* 1646/*
1647 * Encode a LOCKT request 1647 * Encode a LOCKT request
1648 */ 1648 */
1649static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, uint32_t *p, struct nfs_lockt_args *args) 1649static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_args *args)
1650{ 1650{
1651 struct xdr_stream xdr; 1651 struct xdr_stream xdr;
1652 struct compound_hdr hdr = { 1652 struct compound_hdr hdr = {
@@ -1667,7 +1667,7 @@ out:
1667/* 1667/*
1668 * Encode a LOCKU request 1668 * Encode a LOCKU request
1669 */ 1669 */
1670static int nfs4_xdr_enc_locku(struct rpc_rqst *req, uint32_t *p, struct nfs_locku_args *args) 1670static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_args *args)
1671{ 1671{
1672 struct xdr_stream xdr; 1672 struct xdr_stream xdr;
1673 struct compound_hdr hdr = { 1673 struct compound_hdr hdr = {
@@ -1688,7 +1688,7 @@ out:
1688/* 1688/*
1689 * Encode a READLINK request 1689 * Encode a READLINK request
1690 */ 1690 */
1691static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readlink *args) 1691static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_readlink *args)
1692{ 1692{
1693 struct xdr_stream xdr; 1693 struct xdr_stream xdr;
1694 struct compound_hdr hdr = { 1694 struct compound_hdr hdr = {
@@ -1709,7 +1709,7 @@ out:
1709/* 1709/*
1710 * Encode a READDIR request 1710 * Encode a READDIR request
1711 */ 1711 */
1712static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readdir_arg *args) 1712static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nfs4_readdir_arg *args)
1713{ 1713{
1714 struct xdr_stream xdr; 1714 struct xdr_stream xdr;
1715 struct compound_hdr hdr = { 1715 struct compound_hdr hdr = {
@@ -1730,7 +1730,7 @@ out:
1730/* 1730/*
1731 * Encode a READ request 1731 * Encode a READ request
1732 */ 1732 */
1733static int nfs4_xdr_enc_read(struct rpc_rqst *req, uint32_t *p, struct nfs_readargs *args) 1733static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
1734{ 1734{
1735 struct rpc_auth *auth = req->rq_task->tk_auth; 1735 struct rpc_auth *auth = req->rq_task->tk_auth;
1736 struct xdr_stream xdr; 1736 struct xdr_stream xdr;
@@ -1762,7 +1762,7 @@ out:
1762/* 1762/*
1763 * Encode an SETATTR request 1763 * Encode an SETATTR request
1764 */ 1764 */
1765static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, uint32_t *p, struct nfs_setattrargs *args) 1765static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args)
1766 1766
1767{ 1767{
1768 struct xdr_stream xdr; 1768 struct xdr_stream xdr;
@@ -1788,7 +1788,7 @@ out:
1788 * Encode a GETACL request 1788 * Encode a GETACL request
1789 */ 1789 */
1790static int 1790static int
1791nfs4_xdr_enc_getacl(struct rpc_rqst *req, uint32_t *p, 1791nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
1792 struct nfs_getaclargs *args) 1792 struct nfs_getaclargs *args)
1793{ 1793{
1794 struct xdr_stream xdr; 1794 struct xdr_stream xdr;
@@ -1815,7 +1815,7 @@ out:
1815/* 1815/*
1816 * Encode a WRITE request 1816 * Encode a WRITE request
1817 */ 1817 */
1818static int nfs4_xdr_enc_write(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) 1818static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
1819{ 1819{
1820 struct xdr_stream xdr; 1820 struct xdr_stream xdr;
1821 struct compound_hdr hdr = { 1821 struct compound_hdr hdr = {
@@ -1839,7 +1839,7 @@ out:
1839/* 1839/*
1840 * a COMMIT request 1840 * a COMMIT request
1841 */ 1841 */
1842static int nfs4_xdr_enc_commit(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) 1842static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
1843{ 1843{
1844 struct xdr_stream xdr; 1844 struct xdr_stream xdr;
1845 struct compound_hdr hdr = { 1845 struct compound_hdr hdr = {
@@ -1863,7 +1863,7 @@ out:
1863/* 1863/*
1864 * FSINFO request 1864 * FSINFO request
1865 */ 1865 */
1866static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fsinfo_arg *args) 1866static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args)
1867{ 1867{
1868 struct xdr_stream xdr; 1868 struct xdr_stream xdr;
1869 struct compound_hdr hdr = { 1869 struct compound_hdr hdr = {
@@ -1882,7 +1882,7 @@ static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs
1882/* 1882/*
1883 * a PATHCONF request 1883 * a PATHCONF request
1884 */ 1884 */
1885static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct nfs4_pathconf_arg *args) 1885static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct nfs4_pathconf_arg *args)
1886{ 1886{
1887 struct xdr_stream xdr; 1887 struct xdr_stream xdr;
1888 struct compound_hdr hdr = { 1888 struct compound_hdr hdr = {
@@ -1902,7 +1902,7 @@ static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct
1902/* 1902/*
1903 * a STATFS request 1903 * a STATFS request
1904 */ 1904 */
1905static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct nfs4_statfs_arg *args) 1905static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs4_statfs_arg *args)
1906{ 1906{
1907 struct xdr_stream xdr; 1907 struct xdr_stream xdr;
1908 struct compound_hdr hdr = { 1908 struct compound_hdr hdr = {
@@ -1923,7 +1923,7 @@ static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct n
1923/* 1923/*
1924 * GETATTR_BITMAP request 1924 * GETATTR_BITMAP request
1925 */ 1925 */
1926static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const struct nfs_fh *fhandle) 1926static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p, const struct nfs_fh *fhandle)
1927{ 1927{
1928 struct xdr_stream xdr; 1928 struct xdr_stream xdr;
1929 struct compound_hdr hdr = { 1929 struct compound_hdr hdr = {
@@ -1945,7 +1945,7 @@ static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const str
1945/* 1945/*
1946 * a RENEW request 1946 * a RENEW request
1947 */ 1947 */
1948static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) 1948static int nfs4_xdr_enc_renew(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp)
1949{ 1949{
1950 struct xdr_stream xdr; 1950 struct xdr_stream xdr;
1951 struct compound_hdr hdr = { 1951 struct compound_hdr hdr = {
@@ -1960,7 +1960,7 @@ static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_clie
1960/* 1960/*
1961 * a SETCLIENTID request 1961 * a SETCLIENTID request
1962 */ 1962 */
1963static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nfs4_setclientid *sc) 1963static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid *sc)
1964{ 1964{
1965 struct xdr_stream xdr; 1965 struct xdr_stream xdr;
1966 struct compound_hdr hdr = { 1966 struct compound_hdr hdr = {
@@ -1975,7 +1975,7 @@ static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nf
1975/* 1975/*
1976 * a SETCLIENTID_CONFIRM request 1976 * a SETCLIENTID_CONFIRM request
1977 */ 1977 */
1978static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) 1978static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp)
1979{ 1979{
1980 struct xdr_stream xdr; 1980 struct xdr_stream xdr;
1981 struct compound_hdr hdr = { 1981 struct compound_hdr hdr = {
@@ -1997,7 +1997,7 @@ static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s
1997/* 1997/*
1998 * DELEGRETURN request 1998 * DELEGRETURN request
1999 */ 1999 */
2000static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, uint32_t *p, const struct nfs4_delegreturnargs *args) 2000static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struct nfs4_delegreturnargs *args)
2001{ 2001{
2002 struct xdr_stream xdr; 2002 struct xdr_stream xdr;
2003 struct compound_hdr hdr = { 2003 struct compound_hdr hdr = {
@@ -2021,7 +2021,7 @@ out:
2021/* 2021/*
2022 * Encode FS_LOCATIONS request 2022 * Encode FS_LOCATIONS request
2023 */ 2023 */
2024static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations_arg *args) 2024static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations_arg *args)
2025{ 2025{
2026 struct xdr_stream xdr; 2026 struct xdr_stream xdr;
2027 struct compound_hdr hdr = { 2027 struct compound_hdr hdr = {
@@ -2086,7 +2086,7 @@ out:
2086 2086
2087static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string) 2087static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string)
2088{ 2088{
2089 uint32_t *p; 2089 __be32 *p;
2090 2090
2091 READ_BUF(4); 2091 READ_BUF(4);
2092 READ32(*len); 2092 READ32(*len);
@@ -2097,7 +2097,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char
2097 2097
2098static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) 2098static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
2099{ 2099{
2100 uint32_t *p; 2100 __be32 *p;
2101 2101
2102 READ_BUF(8); 2102 READ_BUF(8);
2103 READ32(hdr->status); 2103 READ32(hdr->status);
@@ -2112,7 +2112,7 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
2112 2112
2113static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) 2113static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2114{ 2114{
2115 uint32_t *p; 2115 __be32 *p;
2116 uint32_t opnum; 2116 uint32_t opnum;
2117 int32_t nfserr; 2117 int32_t nfserr;
2118 2118
@@ -2134,7 +2134,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2134/* Dummy routine */ 2134/* Dummy routine */
2135static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp) 2135static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp)
2136{ 2136{
2137 uint32_t *p; 2137 __be32 *p;
2138 unsigned int strlen; 2138 unsigned int strlen;
2139 char *str; 2139 char *str;
2140 2140
@@ -2144,7 +2144,8 @@ static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp)
2144 2144
2145static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 2145static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
2146{ 2146{
2147 uint32_t bmlen, *p; 2147 uint32_t bmlen;
2148 __be32 *p;
2148 2149
2149 READ_BUF(4); 2150 READ_BUF(4);
2150 READ32(bmlen); 2151 READ32(bmlen);
@@ -2159,9 +2160,9 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
2159 return 0; 2160 return 0;
2160} 2161}
2161 2162
2162static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, uint32_t **savep) 2163static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, __be32 **savep)
2163{ 2164{
2164 uint32_t *p; 2165 __be32 *p;
2165 2166
2166 READ_BUF(4); 2167 READ_BUF(4);
2167 READ32(*attrlen); 2168 READ32(*attrlen);
@@ -2182,7 +2183,7 @@ static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint3
2182 2183
2183static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) 2184static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type)
2184{ 2185{
2185 uint32_t *p; 2186 __be32 *p;
2186 2187
2187 *type = 0; 2188 *type = 0;
2188 if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) 2189 if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U)))
@@ -2202,7 +2203,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2202 2203
2203static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) 2204static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change)
2204{ 2205{
2205 uint32_t *p; 2206 __be32 *p;
2206 2207
2207 *change = 0; 2208 *change = 0;
2208 if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) 2209 if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U)))
@@ -2219,7 +2220,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2219 2220
2220static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) 2221static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size)
2221{ 2222{
2222 uint32_t *p; 2223 __be32 *p;
2223 2224
2224 *size = 0; 2225 *size = 0;
2225 if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) 2226 if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U)))
@@ -2235,7 +2236,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *
2235 2236
2236static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2237static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2237{ 2238{
2238 uint32_t *p; 2239 __be32 *p;
2239 2240
2240 *res = 0; 2241 *res = 0;
2241 if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) 2242 if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U)))
@@ -2251,7 +2252,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
2251 2252
2252static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2253static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2253{ 2254{
2254 uint32_t *p; 2255 __be32 *p;
2255 2256
2256 *res = 0; 2257 *res = 0;
2257 if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U))) 2258 if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U)))
@@ -2267,7 +2268,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
2267 2268
2268static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) 2269static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid)
2269{ 2270{
2270 uint32_t *p; 2271 __be32 *p;
2271 2272
2272 fsid->major = 0; 2273 fsid->major = 0;
2273 fsid->minor = 0; 2274 fsid->minor = 0;
@@ -2287,7 +2288,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
2287 2288
2288static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2289static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2289{ 2290{
2290 uint32_t *p; 2291 __be32 *p;
2291 2292
2292 *res = 60; 2293 *res = 60;
2293 if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) 2294 if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U)))
@@ -2303,7 +2304,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
2303 2304
2304static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2305static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2305{ 2306{
2306 uint32_t *p; 2307 __be32 *p;
2307 2308
2308 *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL; 2309 *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL;
2309 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U))) 2310 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U)))
@@ -2319,7 +2320,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
2319 2320
2320static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 2321static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
2321{ 2322{
2322 uint32_t *p; 2323 __be32 *p;
2323 2324
2324 *fileid = 0; 2325 *fileid = 0;
2325 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) 2326 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U)))
@@ -2335,7 +2336,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2335 2336
2336static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 2337static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
2337{ 2338{
2338 uint32_t *p; 2339 __be32 *p;
2339 2340
2340 *fileid = 0; 2341 *fileid = 0;
2341 if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) 2342 if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U)))
@@ -2351,7 +2352,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma
2351 2352
2352static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2353static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2353{ 2354{
2354 uint32_t *p; 2355 __be32 *p;
2355 int status = 0; 2356 int status = 0;
2356 2357
2357 *res = 0; 2358 *res = 0;
@@ -2368,7 +2369,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2368 2369
2369static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2370static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2370{ 2371{
2371 uint32_t *p; 2372 __be32 *p;
2372 int status = 0; 2373 int status = 0;
2373 2374
2374 *res = 0; 2375 *res = 0;
@@ -2385,7 +2386,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2385 2386
2386static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2387static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2387{ 2388{
2388 uint32_t *p; 2389 __be32 *p;
2389 int status = 0; 2390 int status = 0;
2390 2391
2391 *res = 0; 2392 *res = 0;
@@ -2403,7 +2404,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2403static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) 2404static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2404{ 2405{
2405 int n; 2406 int n;
2406 uint32_t *p; 2407 __be32 *p;
2407 int status = 0; 2408 int status = 0;
2408 2409
2409 READ_BUF(4); 2410 READ_BUF(4);
@@ -2448,7 +2449,7 @@ out_eio:
2448static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) 2449static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res)
2449{ 2450{
2450 int n; 2451 int n;
2451 uint32_t *p; 2452 __be32 *p;
2452 int status = -EIO; 2453 int status = -EIO;
2453 2454
2454 if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) 2455 if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U)))
@@ -2512,7 +2513,7 @@ out_eio:
2512 2513
2513static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2514static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2514{ 2515{
2515 uint32_t *p; 2516 __be32 *p;
2516 int status = 0; 2517 int status = 0;
2517 2518
2518 *res = 0; 2519 *res = 0;
@@ -2529,7 +2530,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin
2529 2530
2530static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) 2531static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink)
2531{ 2532{
2532 uint32_t *p; 2533 __be32 *p;
2533 int status = 0; 2534 int status = 0;
2534 2535
2535 *maxlink = 1; 2536 *maxlink = 1;
@@ -2546,7 +2547,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2546 2547
2547static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) 2548static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname)
2548{ 2549{
2549 uint32_t *p; 2550 __be32 *p;
2550 int status = 0; 2551 int status = 0;
2551 2552
2552 *maxname = 1024; 2553 *maxname = 1024;
@@ -2563,7 +2564,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2563 2564
2564static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2565static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2565{ 2566{
2566 uint32_t *p; 2567 __be32 *p;
2567 int status = 0; 2568 int status = 0;
2568 2569
2569 *res = 1024; 2570 *res = 1024;
@@ -2584,7 +2585,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2584 2585
2585static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2586static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2586{ 2587{
2587 uint32_t *p; 2588 __be32 *p;
2588 int status = 0; 2589 int status = 0;
2589 2590
2590 *res = 1024; 2591 *res = 1024;
@@ -2605,7 +2606,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
2605 2606
2606static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode) 2607static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode)
2607{ 2608{
2608 uint32_t *p; 2609 __be32 *p;
2609 2610
2610 *mode = 0; 2611 *mode = 0;
2611 if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) 2612 if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U)))
@@ -2622,7 +2623,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2622 2623
2623static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) 2624static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink)
2624{ 2625{
2625 uint32_t *p; 2626 __be32 *p;
2626 2627
2627 *nlink = 1; 2628 *nlink = 1;
2628 if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) 2629 if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U)))
@@ -2638,7 +2639,8 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
2638 2639
2639static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid) 2640static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid)
2640{ 2641{
2641 uint32_t len, *p; 2642 uint32_t len;
2643 __be32 *p;
2642 2644
2643 *uid = -2; 2645 *uid = -2;
2644 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) 2646 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U)))
@@ -2662,7 +2664,8 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2662 2664
2663static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid) 2665static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid)
2664{ 2666{
2665 uint32_t len, *p; 2667 uint32_t len;
2668 __be32 *p;
2666 2669
2667 *gid = -2; 2670 *gid = -2;
2668 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) 2671 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U)))
@@ -2686,7 +2689,8 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2686 2689
2687static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) 2690static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev)
2688{ 2691{
2689 uint32_t major = 0, minor = 0, *p; 2692 uint32_t major = 0, minor = 0;
2693 __be32 *p;
2690 2694
2691 *rdev = MKDEV(0,0); 2695 *rdev = MKDEV(0,0);
2692 if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) 2696 if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U)))
@@ -2708,7 +2712,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
2708 2712
2709static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2713static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2710{ 2714{
2711 uint32_t *p; 2715 __be32 *p;
2712 int status = 0; 2716 int status = 0;
2713 2717
2714 *res = 0; 2718 *res = 0;
@@ -2725,7 +2729,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2725 2729
2726static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2730static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2727{ 2731{
2728 uint32_t *p; 2732 __be32 *p;
2729 int status = 0; 2733 int status = 0;
2730 2734
2731 *res = 0; 2735 *res = 0;
@@ -2742,7 +2746,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2742 2746
2743static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2747static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2744{ 2748{
2745 uint32_t *p; 2749 __be32 *p;
2746 int status = 0; 2750 int status = 0;
2747 2751
2748 *res = 0; 2752 *res = 0;
@@ -2759,7 +2763,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2759 2763
2760static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) 2764static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used)
2761{ 2765{
2762 uint32_t *p; 2766 __be32 *p;
2763 2767
2764 *used = 0; 2768 *used = 0;
2765 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) 2769 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U)))
@@ -2776,7 +2780,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
2776 2780
2777static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) 2781static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)
2778{ 2782{
2779 uint32_t *p; 2783 __be32 *p;
2780 uint64_t sec; 2784 uint64_t sec;
2781 uint32_t nsec; 2785 uint32_t nsec;
2782 2786
@@ -2836,7 +2840,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str
2836 return status; 2840 return status;
2837} 2841}
2838 2842
2839static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t attrlen) 2843static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrlen)
2840{ 2844{
2841 unsigned int attrwords = XDR_QUADLEN(attrlen); 2845 unsigned int attrwords = XDR_QUADLEN(attrlen);
2842 unsigned int nwords = xdr->p - savep; 2846 unsigned int nwords = xdr->p - savep;
@@ -2854,7 +2858,7 @@ static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t att
2854 2858
2855static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 2859static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2856{ 2860{
2857 uint32_t *p; 2861 __be32 *p;
2858 2862
2859 READ_BUF(20); 2863 READ_BUF(20);
2860 READ32(cinfo->atomic); 2864 READ32(cinfo->atomic);
@@ -2865,7 +2869,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c
2865 2869
2866static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) 2870static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
2867{ 2871{
2868 uint32_t *p; 2872 __be32 *p;
2869 uint32_t supp, acc; 2873 uint32_t supp, acc;
2870 int status; 2874 int status;
2871 2875
@@ -2882,7 +2886,7 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
2882 2886
2883static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) 2887static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
2884{ 2888{
2885 uint32_t *p; 2889 __be32 *p;
2886 int status; 2890 int status;
2887 2891
2888 status = decode_op_hdr(xdr, OP_CLOSE); 2892 status = decode_op_hdr(xdr, OP_CLOSE);
@@ -2895,7 +2899,7 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
2895 2899
2896static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) 2900static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
2897{ 2901{
2898 uint32_t *p; 2902 __be32 *p;
2899 int status; 2903 int status;
2900 2904
2901 status = decode_op_hdr(xdr, OP_COMMIT); 2905 status = decode_op_hdr(xdr, OP_COMMIT);
@@ -2908,7 +2912,7 @@ static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
2908 2912
2909static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 2913static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2910{ 2914{
2911 uint32_t *p; 2915 __be32 *p;
2912 uint32_t bmlen; 2916 uint32_t bmlen;
2913 int status; 2917 int status;
2914 2918
@@ -2925,7 +2929,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2925 2929
2926static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) 2930static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res)
2927{ 2931{
2928 uint32_t *savep; 2932 __be32 *savep;
2929 uint32_t attrlen, 2933 uint32_t attrlen,
2930 bitmap[2] = {0}; 2934 bitmap[2] = {0};
2931 int status; 2935 int status;
@@ -2952,7 +2956,7 @@ xdr_error:
2952 2956
2953static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) 2957static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat)
2954{ 2958{
2955 uint32_t *savep; 2959 __be32 *savep;
2956 uint32_t attrlen, 2960 uint32_t attrlen,
2957 bitmap[2] = {0}; 2961 bitmap[2] = {0};
2958 int status; 2962 int status;
@@ -2985,7 +2989,7 @@ xdr_error:
2985 2989
2986static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) 2990static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf)
2987{ 2991{
2988 uint32_t *savep; 2992 __be32 *savep;
2989 uint32_t attrlen, 2993 uint32_t attrlen,
2990 bitmap[2] = {0}; 2994 bitmap[2] = {0};
2991 int status; 2995 int status;
@@ -3010,7 +3014,7 @@ xdr_error:
3010 3014
3011static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server) 3015static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server)
3012{ 3016{
3013 uint32_t *savep; 3017 __be32 *savep;
3014 uint32_t attrlen, 3018 uint32_t attrlen,
3015 bitmap[2] = {0}, 3019 bitmap[2] = {0},
3016 type; 3020 type;
@@ -3079,7 +3083,7 @@ xdr_error:
3079 3083
3080static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) 3084static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
3081{ 3085{
3082 uint32_t *savep; 3086 __be32 *savep;
3083 uint32_t attrlen, bitmap[2]; 3087 uint32_t attrlen, bitmap[2];
3084 int status; 3088 int status;
3085 3089
@@ -3111,7 +3115,7 @@ xdr_error:
3111 3115
3112static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) 3116static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
3113{ 3117{
3114 uint32_t *p; 3118 __be32 *p;
3115 uint32_t len; 3119 uint32_t len;
3116 int status; 3120 int status;
3117 3121
@@ -3147,7 +3151,7 @@ static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
3147static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) 3151static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3148{ 3152{
3149 uint64_t offset, length, clientid; 3153 uint64_t offset, length, clientid;
3150 uint32_t *p; 3154 __be32 *p;
3151 uint32_t namelen, type; 3155 uint32_t namelen, type;
3152 3156
3153 READ_BUF(32); 3157 READ_BUF(32);
@@ -3172,7 +3176,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3172 3176
3173static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) 3177static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res)
3174{ 3178{
3175 uint32_t *p; 3179 __be32 *p;
3176 int status; 3180 int status;
3177 3181
3178 status = decode_op_hdr(xdr, OP_LOCK); 3182 status = decode_op_hdr(xdr, OP_LOCK);
@@ -3195,7 +3199,7 @@ static int decode_lockt(struct xdr_stream *xdr, struct nfs_lockt_res *res)
3195 3199
3196static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) 3200static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res)
3197{ 3201{
3198 uint32_t *p; 3202 __be32 *p;
3199 int status; 3203 int status;
3200 3204
3201 status = decode_op_hdr(xdr, OP_LOCKU); 3205 status = decode_op_hdr(xdr, OP_LOCKU);
@@ -3214,7 +3218,7 @@ static int decode_lookup(struct xdr_stream *xdr)
3214/* This is too sick! */ 3218/* This is too sick! */
3215static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) 3219static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
3216{ 3220{
3217 uint32_t *p; 3221 __be32 *p;
3218 uint32_t limit_type, nblocks, blocksize; 3222 uint32_t limit_type, nblocks, blocksize;
3219 3223
3220 READ_BUF(12); 3224 READ_BUF(12);
@@ -3233,7 +3237,7 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
3233 3237
3234static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) 3238static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
3235{ 3239{
3236 uint32_t *p; 3240 __be32 *p;
3237 uint32_t delegation_type; 3241 uint32_t delegation_type;
3238 3242
3239 READ_BUF(4); 3243 READ_BUF(4);
@@ -3259,7 +3263,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
3259 3263
3260static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) 3264static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
3261{ 3265{
3262 uint32_t *p; 3266 __be32 *p;
3263 uint32_t bmlen; 3267 uint32_t bmlen;
3264 int status; 3268 int status;
3265 3269
@@ -3287,7 +3291,7 @@ xdr_error:
3287 3291
3288static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) 3292static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res)
3289{ 3293{
3290 uint32_t *p; 3294 __be32 *p;
3291 int status; 3295 int status;
3292 3296
3293 status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); 3297 status = decode_op_hdr(xdr, OP_OPEN_CONFIRM);
@@ -3300,7 +3304,7 @@ static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmre
3300 3304
3301static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) 3305static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res)
3302{ 3306{
3303 uint32_t *p; 3307 __be32 *p;
3304 int status; 3308 int status;
3305 3309
3306 status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); 3310 status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE);
@@ -3324,7 +3328,7 @@ static int decode_putrootfh(struct xdr_stream *xdr)
3324static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res) 3328static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res)
3325{ 3329{
3326 struct kvec *iov = req->rq_rcv_buf.head; 3330 struct kvec *iov = req->rq_rcv_buf.head;
3327 uint32_t *p; 3331 __be32 *p;
3328 uint32_t count, eof, recvd, hdrlen; 3332 uint32_t count, eof, recvd, hdrlen;
3329 int status; 3333 int status;
3330 3334
@@ -3354,7 +3358,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3354 struct page *page = *rcvbuf->pages; 3358 struct page *page = *rcvbuf->pages;
3355 struct kvec *iov = rcvbuf->head; 3359 struct kvec *iov = rcvbuf->head;
3356 unsigned int nr, pglen = rcvbuf->page_len; 3360 unsigned int nr, pglen = rcvbuf->page_len;
3357 uint32_t *end, *entry, *p, *kaddr; 3361 __be32 *end, *entry, *p, *kaddr;
3358 uint32_t len, attrlen, xlen; 3362 uint32_t len, attrlen, xlen;
3359 int hdrlen, recvd, status; 3363 int hdrlen, recvd, status;
3360 3364
@@ -3376,7 +3380,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3376 xdr_read_pages(xdr, pglen); 3380 xdr_read_pages(xdr, pglen);
3377 3381
3378 BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE); 3382 BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE);
3379 kaddr = p = (uint32_t *) kmap_atomic(page, KM_USER0); 3383 kaddr = p = kmap_atomic(page, KM_USER0);
3380 end = p + ((pglen + readdir->pgbase) >> 2); 3384 end = p + ((pglen + readdir->pgbase) >> 2);
3381 entry = p; 3385 entry = p;
3382 for (nr = 0; *p++; nr++) { 3386 for (nr = 0; *p++; nr++) {
@@ -3428,7 +3432,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
3428 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 3432 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
3429 struct kvec *iov = rcvbuf->head; 3433 struct kvec *iov = rcvbuf->head;
3430 int hdrlen, len, recvd; 3434 int hdrlen, len, recvd;
3431 uint32_t *p; 3435 __be32 *p;
3432 char *kaddr; 3436 char *kaddr;
3433 int status; 3437 int status;
3434 3438
@@ -3505,7 +3509,7 @@ decode_restorefh(struct xdr_stream *xdr)
3505static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, 3509static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
3506 size_t *acl_len) 3510 size_t *acl_len)
3507{ 3511{
3508 uint32_t *savep; 3512 __be32 *savep;
3509 uint32_t attrlen, 3513 uint32_t attrlen,
3510 bitmap[2] = {0}; 3514 bitmap[2] = {0};
3511 struct kvec *iov = req->rq_rcv_buf.head; 3515 struct kvec *iov = req->rq_rcv_buf.head;
@@ -3551,7 +3555,7 @@ decode_savefh(struct xdr_stream *xdr)
3551 3555
3552static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) 3556static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res)
3553{ 3557{
3554 uint32_t *p; 3558 __be32 *p;
3555 uint32_t bmlen; 3559 uint32_t bmlen;
3556 int status; 3560 int status;
3557 3561
@@ -3567,7 +3571,7 @@ static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res)
3567 3571
3568static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) 3572static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
3569{ 3573{
3570 uint32_t *p; 3574 __be32 *p;
3571 uint32_t opnum; 3575 uint32_t opnum;
3572 int32_t nfserr; 3576 int32_t nfserr;
3573 3577
@@ -3610,7 +3614,7 @@ static int decode_setclientid_confirm(struct xdr_stream *xdr)
3610 3614
3611static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) 3615static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res)
3612{ 3616{
3613 uint32_t *p; 3617 __be32 *p;
3614 int status; 3618 int status;
3615 3619
3616 status = decode_op_hdr(xdr, OP_WRITE); 3620 status = decode_op_hdr(xdr, OP_WRITE);
@@ -3632,7 +3636,7 @@ static int decode_delegreturn(struct xdr_stream *xdr)
3632/* 3636/*
3633 * Decode OPEN_DOWNGRADE response 3637 * Decode OPEN_DOWNGRADE response
3634 */ 3638 */
3635static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) 3639static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res)
3636{ 3640{
3637 struct xdr_stream xdr; 3641 struct xdr_stream xdr;
3638 struct compound_hdr hdr; 3642 struct compound_hdr hdr;
@@ -3660,7 +3664,7 @@ out:
3660/* 3664/*
3661 * Decode ACCESS response 3665 * Decode ACCESS response
3662 */ 3666 */
3663static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_accessres *res) 3667static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res)
3664{ 3668{
3665 struct xdr_stream xdr; 3669 struct xdr_stream xdr;
3666 struct compound_hdr hdr; 3670 struct compound_hdr hdr;
@@ -3678,7 +3682,7 @@ out:
3678/* 3682/*
3679 * Decode LOOKUP response 3683 * Decode LOOKUP response
3680 */ 3684 */
3681static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) 3685static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res)
3682{ 3686{
3683 struct xdr_stream xdr; 3687 struct xdr_stream xdr;
3684 struct compound_hdr hdr; 3688 struct compound_hdr hdr;
@@ -3701,7 +3705,7 @@ out:
3701/* 3705/*
3702 * Decode LOOKUP_ROOT response 3706 * Decode LOOKUP_ROOT response
3703 */ 3707 */
3704static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) 3708static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res)
3705{ 3709{
3706 struct xdr_stream xdr; 3710 struct xdr_stream xdr;
3707 struct compound_hdr hdr; 3711 struct compound_hdr hdr;
@@ -3721,7 +3725,7 @@ out:
3721/* 3725/*
3722 * Decode REMOVE response 3726 * Decode REMOVE response
3723 */ 3727 */
3724static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_remove_res *res) 3728static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_remove_res *res)
3725{ 3729{
3726 struct xdr_stream xdr; 3730 struct xdr_stream xdr;
3727 struct compound_hdr hdr; 3731 struct compound_hdr hdr;
@@ -3742,7 +3746,7 @@ out:
3742/* 3746/*
3743 * Decode RENAME response 3747 * Decode RENAME response
3744 */ 3748 */
3745static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_rename_res *res) 3749static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_rename_res *res)
3746{ 3750{
3747 struct xdr_stream xdr; 3751 struct xdr_stream xdr;
3748 struct compound_hdr hdr; 3752 struct compound_hdr hdr;
@@ -3772,7 +3776,7 @@ out:
3772/* 3776/*
3773 * Decode LINK response 3777 * Decode LINK response
3774 */ 3778 */
3775static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_link_res *res) 3779static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link_res *res)
3776{ 3780{
3777 struct xdr_stream xdr; 3781 struct xdr_stream xdr;
3778 struct compound_hdr hdr; 3782 struct compound_hdr hdr;
@@ -3805,7 +3809,7 @@ out:
3805/* 3809/*
3806 * Decode CREATE response 3810 * Decode CREATE response
3807 */ 3811 */
3808static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) 3812static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res)
3809{ 3813{
3810 struct xdr_stream xdr; 3814 struct xdr_stream xdr;
3811 struct compound_hdr hdr; 3815 struct compound_hdr hdr;
@@ -3834,7 +3838,7 @@ out:
3834/* 3838/*
3835 * Decode SYMLINK response 3839 * Decode SYMLINK response
3836 */ 3840 */
3837static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) 3841static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res)
3838{ 3842{
3839 return nfs4_xdr_dec_create(rqstp, p, res); 3843 return nfs4_xdr_dec_create(rqstp, p, res);
3840} 3844}
@@ -3842,7 +3846,7 @@ static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4
3842/* 3846/*
3843 * Decode GETATTR response 3847 * Decode GETATTR response
3844 */ 3848 */
3845static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_getattr_res *res) 3849static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_getattr_res *res)
3846{ 3850{
3847 struct xdr_stream xdr; 3851 struct xdr_stream xdr;
3848 struct compound_hdr hdr; 3852 struct compound_hdr hdr;
@@ -3865,7 +3869,7 @@ out:
3865 * Encode an SETACL request 3869 * Encode an SETACL request
3866 */ 3870 */
3867static int 3871static int
3868nfs4_xdr_enc_setacl(struct rpc_rqst *req, uint32_t *p, struct nfs_setaclargs *args) 3872nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args)
3869{ 3873{
3870 struct xdr_stream xdr; 3874 struct xdr_stream xdr;
3871 struct compound_hdr hdr = { 3875 struct compound_hdr hdr = {
@@ -3886,7 +3890,7 @@ out:
3886 * Decode SETACL response 3890 * Decode SETACL response
3887 */ 3891 */
3888static int 3892static int
3889nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, uint32_t *p, void *res) 3893nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, __be32 *p, void *res)
3890{ 3894{
3891 struct xdr_stream xdr; 3895 struct xdr_stream xdr;
3892 struct compound_hdr hdr; 3896 struct compound_hdr hdr;
@@ -3908,7 +3912,7 @@ out:
3908 * Decode GETACL response 3912 * Decode GETACL response
3909 */ 3913 */
3910static int 3914static int
3911nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, uint32_t *p, size_t *acl_len) 3915nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, size_t *acl_len)
3912{ 3916{
3913 struct xdr_stream xdr; 3917 struct xdr_stream xdr;
3914 struct compound_hdr hdr; 3918 struct compound_hdr hdr;
@@ -3930,7 +3934,7 @@ out:
3930/* 3934/*
3931 * Decode CLOSE response 3935 * Decode CLOSE response
3932 */ 3936 */
3933static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) 3937static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res)
3934{ 3938{
3935 struct xdr_stream xdr; 3939 struct xdr_stream xdr;
3936 struct compound_hdr hdr; 3940 struct compound_hdr hdr;
@@ -3960,7 +3964,7 @@ out:
3960/* 3964/*
3961 * Decode OPEN response 3965 * Decode OPEN response
3962 */ 3966 */
3963static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) 3967static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res)
3964{ 3968{
3965 struct xdr_stream xdr; 3969 struct xdr_stream xdr;
3966 struct compound_hdr hdr; 3970 struct compound_hdr hdr;
@@ -3994,7 +3998,7 @@ out:
3994/* 3998/*
3995 * Decode OPEN_CONFIRM response 3999 * Decode OPEN_CONFIRM response
3996 */ 4000 */
3997static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_open_confirmres *res) 4001static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res)
3998{ 4002{
3999 struct xdr_stream xdr; 4003 struct xdr_stream xdr;
4000 struct compound_hdr hdr; 4004 struct compound_hdr hdr;
@@ -4015,7 +4019,7 @@ out:
4015/* 4019/*
4016 * Decode OPEN response 4020 * Decode OPEN response
4017 */ 4021 */
4018static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) 4022static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res)
4019{ 4023{
4020 struct xdr_stream xdr; 4024 struct xdr_stream xdr;
4021 struct compound_hdr hdr; 4025 struct compound_hdr hdr;
@@ -4039,7 +4043,7 @@ out:
4039/* 4043/*
4040 * Decode SETATTR response 4044 * Decode SETATTR response
4041 */ 4045 */
4042static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_setattrres *res) 4046static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res)
4043{ 4047{
4044 struct xdr_stream xdr; 4048 struct xdr_stream xdr;
4045 struct compound_hdr hdr; 4049 struct compound_hdr hdr;
@@ -4065,7 +4069,7 @@ out:
4065/* 4069/*
4066 * Decode LOCK response 4070 * Decode LOCK response
4067 */ 4071 */
4068static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lock_res *res) 4072static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lock_res *res)
4069{ 4073{
4070 struct xdr_stream xdr; 4074 struct xdr_stream xdr;
4071 struct compound_hdr hdr; 4075 struct compound_hdr hdr;
@@ -4086,7 +4090,7 @@ out:
4086/* 4090/*
4087 * Decode LOCKT response 4091 * Decode LOCKT response
4088 */ 4092 */
4089static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lockt_res *res) 4093static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lockt_res *res)
4090{ 4094{
4091 struct xdr_stream xdr; 4095 struct xdr_stream xdr;
4092 struct compound_hdr hdr; 4096 struct compound_hdr hdr;
@@ -4107,7 +4111,7 @@ out:
4107/* 4111/*
4108 * Decode LOCKU response 4112 * Decode LOCKU response
4109 */ 4113 */
4110static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_locku_res *res) 4114static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, __be32 *p, struct nfs_locku_res *res)
4111{ 4115{
4112 struct xdr_stream xdr; 4116 struct xdr_stream xdr;
4113 struct compound_hdr hdr; 4117 struct compound_hdr hdr;
@@ -4128,7 +4132,7 @@ out:
4128/* 4132/*
4129 * Decode READLINK response 4133 * Decode READLINK response
4130 */ 4134 */
4131static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, uint32_t *p, void *res) 4135static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, __be32 *p, void *res)
4132{ 4136{
4133 struct xdr_stream xdr; 4137 struct xdr_stream xdr;
4134 struct compound_hdr hdr; 4138 struct compound_hdr hdr;
@@ -4149,7 +4153,7 @@ out:
4149/* 4153/*
4150 * Decode READDIR response 4154 * Decode READDIR response
4151 */ 4155 */
4152static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_readdir_res *res) 4156static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_readdir_res *res)
4153{ 4157{
4154 struct xdr_stream xdr; 4158 struct xdr_stream xdr;
4155 struct compound_hdr hdr; 4159 struct compound_hdr hdr;
@@ -4170,7 +4174,7 @@ out:
4170/* 4174/*
4171 * Decode Read response 4175 * Decode Read response
4172 */ 4176 */
4173static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_readres *res) 4177static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, __be32 *p, struct nfs_readres *res)
4174{ 4178{
4175 struct xdr_stream xdr; 4179 struct xdr_stream xdr;
4176 struct compound_hdr hdr; 4180 struct compound_hdr hdr;
@@ -4193,7 +4197,7 @@ out:
4193/* 4197/*
4194 * Decode WRITE response 4198 * Decode WRITE response
4195 */ 4199 */
4196static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) 4200static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res)
4197{ 4201{
4198 struct xdr_stream xdr; 4202 struct xdr_stream xdr;
4199 struct compound_hdr hdr; 4203 struct compound_hdr hdr;
@@ -4219,7 +4223,7 @@ out:
4219/* 4223/*
4220 * Decode COMMIT response 4224 * Decode COMMIT response
4221 */ 4225 */
4222static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) 4226static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res)
4223{ 4227{
4224 struct xdr_stream xdr; 4228 struct xdr_stream xdr;
4225 struct compound_hdr hdr; 4229 struct compound_hdr hdr;
@@ -4243,7 +4247,7 @@ out:
4243/* 4247/*
4244 * FSINFO request 4248 * FSINFO request
4245 */ 4249 */
4246static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) 4250static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo)
4247{ 4251{
4248 struct xdr_stream xdr; 4252 struct xdr_stream xdr;
4249 struct compound_hdr hdr; 4253 struct compound_hdr hdr;
@@ -4263,7 +4267,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsi
4263/* 4267/*
4264 * PATHCONF request 4268 * PATHCONF request
4265 */ 4269 */
4266static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_pathconf *pathconf) 4270static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *pathconf)
4267{ 4271{
4268 struct xdr_stream xdr; 4272 struct xdr_stream xdr;
4269 struct compound_hdr hdr; 4273 struct compound_hdr hdr;
@@ -4281,7 +4285,7 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_p
4281/* 4285/*
4282 * STATFS request 4286 * STATFS request
4283 */ 4287 */
4284static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fsstat *fsstat) 4288static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *fsstat)
4285{ 4289{
4286 struct xdr_stream xdr; 4290 struct xdr_stream xdr;
4287 struct compound_hdr hdr; 4291 struct compound_hdr hdr;
@@ -4299,7 +4303,7 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fss
4299/* 4303/*
4300 * GETATTR_BITMAP request 4304 * GETATTR_BITMAP request
4301 */ 4305 */
4302static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, uint32_t *p, struct nfs4_server_caps_res *res) 4306static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res)
4303{ 4307{
4304 struct xdr_stream xdr; 4308 struct xdr_stream xdr;
4305 struct compound_hdr hdr; 4309 struct compound_hdr hdr;
@@ -4318,7 +4322,7 @@ out:
4318/* 4322/*
4319 * Decode RENEW response 4323 * Decode RENEW response
4320 */ 4324 */
4321static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) 4325static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy)
4322{ 4326{
4323 struct xdr_stream xdr; 4327 struct xdr_stream xdr;
4324 struct compound_hdr hdr; 4328 struct compound_hdr hdr;
@@ -4334,7 +4338,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy)
4334/* 4338/*
4335 * a SETCLIENTID request 4339 * a SETCLIENTID request
4336 */ 4340 */
4337static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p, 4341static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
4338 struct nfs_client *clp) 4342 struct nfs_client *clp)
4339{ 4343{
4340 struct xdr_stream xdr; 4344 struct xdr_stream xdr;
@@ -4353,7 +4357,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p,
4353/* 4357/*
4354 * a SETCLIENTID_CONFIRM request 4358 * a SETCLIENTID_CONFIRM request
4355 */ 4359 */
4356static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) 4360static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo)
4357{ 4361{
4358 struct xdr_stream xdr; 4362 struct xdr_stream xdr;
4359 struct compound_hdr hdr; 4363 struct compound_hdr hdr;
@@ -4375,7 +4379,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s
4375/* 4379/*
4376 * DELEGRETURN request 4380 * DELEGRETURN request
4377 */ 4381 */
4378static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_delegreturnres *res) 4382static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res)
4379{ 4383{
4380 struct xdr_stream xdr; 4384 struct xdr_stream xdr;
4381 struct compound_hdr hdr; 4385 struct compound_hdr hdr;
@@ -4397,7 +4401,7 @@ out:
4397/* 4401/*
4398 * FS_LOCATIONS request 4402 * FS_LOCATIONS request
4399 */ 4403 */
4400static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations *res) 4404static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations *res)
4401{ 4405{
4402 struct xdr_stream xdr; 4406 struct xdr_stream xdr;
4403 struct compound_hdr hdr; 4407 struct compound_hdr hdr;
@@ -4417,7 +4421,7 @@ out:
4417 return status; 4421 return status;
4418} 4422}
4419 4423
4420uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus) 4424__be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
4421{ 4425{
4422 uint32_t bitmap[2] = {0}; 4426 uint32_t bitmap[2] = {0};
4423 uint32_t len; 4427 uint32_t len;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 28659a919d6e..28108c82b887 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -834,7 +834,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
834 } 834 }
835 /* RFC3530: The default port for NFS is 2049 */ 835 /* RFC3530: The default port for NFS is 2049 */
836 if (addr.sin_port == 0) 836 if (addr.sin_port == 0)
837 addr.sin_port = NFS_PORT; 837 addr.sin_port = htons(NFS_PORT);
838 838
839 /* Grab the authentication type */ 839 /* Grab the authentication type */
840 authflavour = RPC_AUTH_UNIX; 840 authflavour = RPC_AUTH_UNIX;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f6675d2c386c..883dd4a1c157 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -57,6 +57,8 @@
57#include <linux/nfs_fs.h> 57#include <linux/nfs_fs.h>
58#include <linux/nfs_mount.h> 58#include <linux/nfs_mount.h>
59#include <linux/nfs_page.h> 59#include <linux/nfs_page.h>
60#include <linux/backing-dev.h>
61
60#include <asm/uaccess.h> 62#include <asm/uaccess.h>
61#include <linux/smp_lock.h> 63#include <linux/smp_lock.h>
62 64
@@ -395,7 +397,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
395out: 397out:
396 clear_bit(BDI_write_congested, &bdi->state); 398 clear_bit(BDI_write_congested, &bdi->state);
397 wake_up_all(&nfs_write_congestion); 399 wake_up_all(&nfs_write_congestion);
398 writeback_congestion_end(); 400 congestion_end(WRITE);
399 return err; 401 return err;
400} 402}
401 403
@@ -588,10 +590,10 @@ static void nfs_cancel_commit_list(struct list_head *head)
588 590
589 while(!list_empty(head)) { 591 while(!list_empty(head)) {
590 req = nfs_list_entry(head->next); 592 req = nfs_list_entry(head->next);
593 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
591 nfs_list_remove_request(req); 594 nfs_list_remove_request(req);
592 nfs_inode_remove_request(req); 595 nfs_inode_remove_request(req);
593 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 596 nfs_unlock_request(req);
594 nfs_clear_page_writeback(req);
595 } 597 }
596} 598}
597 599
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c
index 0c2be8c0307d..c11f5375d7c1 100644
--- a/fs/nfs_common/nfsacl.c
+++ b/fs/nfs_common/nfsacl.c
@@ -46,7 +46,7 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem)
46{ 46{
47 struct nfsacl_encode_desc *nfsacl_desc = 47 struct nfsacl_encode_desc *nfsacl_desc =
48 (struct nfsacl_encode_desc *) desc; 48 (struct nfsacl_encode_desc *) desc;
49 u32 *p = (u32 *) elem; 49 __be32 *p = elem;
50 50
51 struct posix_acl_entry *entry = 51 struct posix_acl_entry *entry =
52 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++]; 52 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++];
@@ -127,7 +127,7 @@ xdr_nfsace_decode(struct xdr_array2_desc *desc, void *elem)
127{ 127{
128 struct nfsacl_decode_desc *nfsacl_desc = 128 struct nfsacl_decode_desc *nfsacl_desc =
129 (struct nfsacl_decode_desc *) desc; 129 (struct nfsacl_decode_desc *) desc;
130 u32 *p = (u32 *) elem; 130 __be32 *p = elem;
131 struct posix_acl_entry *entry; 131 struct posix_acl_entry *entry;
132 132
133 if (!nfsacl_desc->acl) { 133 if (!nfsacl_desc->acl) {
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index e13fa23bd108..f37df46d2eaa 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1148,12 +1148,12 @@ exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
1148 * for a given NFSv4 client. The root is defined to be the 1148 * for a given NFSv4 client. The root is defined to be the
1149 * export point with fsid==0 1149 * export point with fsid==0
1150 */ 1150 */
1151int 1151__be32
1152exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, 1152exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
1153 struct cache_req *creq) 1153 struct cache_req *creq)
1154{ 1154{
1155 struct svc_export *exp; 1155 struct svc_export *exp;
1156 int rv; 1156 __be32 rv;
1157 u32 fsidv[2]; 1157 u32 fsidv[2];
1158 1158
1159 mk_fsid_v1(fsidv, 0); 1159 mk_fsid_v1(fsidv, 0);
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 7b889ff15ae6..11fdaf7721b4 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -25,7 +25,7 @@
25static u32 25static u32
26nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) 26nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
27{ 27{
28 u32 nfserr; 28 __be32 nfserr;
29 struct svc_fh fh; 29 struct svc_fh fh;
30 30
31 /* must initialize before using! but maxsize doesn't matter */ 31 /* must initialize before using! but maxsize doesn't matter */
@@ -39,18 +39,20 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
39 fh_put(&fh); 39 fh_put(&fh);
40 rqstp->rq_client = NULL; 40 rqstp->rq_client = NULL;
41 exp_readunlock(); 41 exp_readunlock();
42 /* nlm and nfsd don't share error codes. 42 /* We return nlm error codes as nlm doesn't know
43 * we invent: 0 = no error 43 * about nfsd, but nfsd does know about nlm..
44 * 1 = stale file handle
45 * 2 = other error
46 */ 44 */
47 switch (nfserr) { 45 switch (nfserr) {
48 case nfs_ok: 46 case nfs_ok:
49 return 0; 47 return 0;
48 case nfserr_dropit:
49 return nlm_drop_reply;
50#ifdef CONFIG_LOCKD_V4
50 case nfserr_stale: 51 case nfserr_stale:
51 return 1; 52 return nlm4_stale_fh;
53#endif
52 default: 54 default:
53 return 2; 55 return nlm_lck_denied;
54 } 56 }
55} 57}
56 58
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index 9187755661df..e3eca0816986 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -21,7 +21,7 @@
21/* 21/*
22 * NULL call. 22 * NULL call.
23 */ 23 */
24static int 24static __be32
25nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 25nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
26{ 26{
27 return nfs_ok; 27 return nfs_ok;
@@ -30,12 +30,12 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
30/* 30/*
31 * Get the Access and/or Default ACL of a file. 31 * Get the Access and/or Default ACL of a file.
32 */ 32 */
33static int nfsacld_proc_getacl(struct svc_rqst * rqstp, 33static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
34 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 34 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
35{ 35{
36 svc_fh *fh; 36 svc_fh *fh;
37 struct posix_acl *acl; 37 struct posix_acl *acl;
38 int nfserr = 0; 38 __be32 nfserr = 0;
39 39
40 dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); 40 dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
41 41
@@ -97,12 +97,12 @@ fail:
97/* 97/*
98 * Set the Access and/or Default ACL of a file. 98 * Set the Access and/or Default ACL of a file.
99 */ 99 */
100static int nfsacld_proc_setacl(struct svc_rqst * rqstp, 100static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
101 struct nfsd3_setaclargs *argp, 101 struct nfsd3_setaclargs *argp,
102 struct nfsd_attrstat *resp) 102 struct nfsd_attrstat *resp)
103{ 103{
104 svc_fh *fh; 104 svc_fh *fh;
105 int nfserr = 0; 105 __be32 nfserr = 0;
106 106
107 dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); 107 dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
108 108
@@ -128,7 +128,7 @@ static int nfsacld_proc_setacl(struct svc_rqst * rqstp,
128/* 128/*
129 * Check file attributes 129 * Check file attributes
130 */ 130 */
131static int nfsacld_proc_getattr(struct svc_rqst * rqstp, 131static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
132 struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) 132 struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
133{ 133{
134 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 134 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
@@ -140,10 +140,10 @@ static int nfsacld_proc_getattr(struct svc_rqst * rqstp,
140/* 140/*
141 * Check file access 141 * Check file access
142 */ 142 */
143static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 143static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
144 struct nfsd3_accessres *resp) 144 struct nfsd3_accessres *resp)
145{ 145{
146 int nfserr; 146 __be32 nfserr;
147 147
148 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", 148 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n",
149 SVCFH_fmt(&argp->fh), 149 SVCFH_fmt(&argp->fh),
@@ -158,7 +158,7 @@ static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *
158/* 158/*
159 * XDR decode functions 159 * XDR decode functions
160 */ 160 */
161static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, 161static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
162 struct nfsd3_getaclargs *argp) 162 struct nfsd3_getaclargs *argp)
163{ 163{
164 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 164 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -169,7 +169,7 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p,
169} 169}
170 170
171 171
172static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, 172static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
173 struct nfsd3_setaclargs *argp) 173 struct nfsd3_setaclargs *argp)
174{ 174{
175 struct kvec *head = rqstp->rq_arg.head; 175 struct kvec *head = rqstp->rq_arg.head;
@@ -194,7 +194,7 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p,
194 return (n > 0); 194 return (n > 0);
195} 195}
196 196
197static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p, 197static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
198 struct nfsd_fhandle *argp) 198 struct nfsd_fhandle *argp)
199{ 199{
200 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 200 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -202,7 +202,7 @@ static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p,
202 return xdr_argsize_check(rqstp, p); 202 return xdr_argsize_check(rqstp, p);
203} 203}
204 204
205static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, 205static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
206 struct nfsd3_accessargs *argp) 206 struct nfsd3_accessargs *argp)
207{ 207{
208 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 208 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -217,7 +217,7 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p,
217 */ 217 */
218 218
219/* GETACL */ 219/* GETACL */
220static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, 220static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
221 struct nfsd3_getaclres *resp) 221 struct nfsd3_getaclres *resp)
222{ 222{
223 struct dentry *dentry = resp->fh.fh_dentry; 223 struct dentry *dentry = resp->fh.fh_dentry;
@@ -259,7 +259,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p,
259 return 1; 259 return 1;
260} 260}
261 261
262static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p, 262static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p,
263 struct nfsd_attrstat *resp) 263 struct nfsd_attrstat *resp)
264{ 264{
265 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); 265 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
@@ -267,7 +267,7 @@ static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p,
267} 267}
268 268
269/* ACCESS */ 269/* ACCESS */
270static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p, 270static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
271 struct nfsd3_accessres *resp) 271 struct nfsd3_accessres *resp)
272{ 272{
273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); 273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
@@ -278,7 +278,7 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p,
278/* 278/*
279 * XDR release functions 279 * XDR release functions
280 */ 280 */
281static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p, 281static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
282 struct nfsd3_getaclres *resp) 282 struct nfsd3_getaclres *resp)
283{ 283{
284 fh_put(&resp->fh); 284 fh_put(&resp->fh);
@@ -287,7 +287,7 @@ static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p,
287 return 1; 287 return 1;
288} 288}
289 289
290static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 290static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
291 struct nfsd_fhandle *resp) 291 struct nfsd_fhandle *resp)
292{ 292{
293 fh_put(&resp->fh); 293 fh_put(&resp->fh);
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index d4bdc00c1169..fcad2895ddb0 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -19,7 +19,7 @@
19/* 19/*
20 * NULL call. 20 * NULL call.
21 */ 21 */
22static int 22static __be32
23nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 23nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
24{ 24{
25 return nfs_ok; 25 return nfs_ok;
@@ -28,12 +28,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
28/* 28/*
29 * Get the Access and/or Default ACL of a file. 29 * Get the Access and/or Default ACL of a file.
30 */ 30 */
31static int nfsd3_proc_getacl(struct svc_rqst * rqstp, 31static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
32 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 32 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
33{ 33{
34 svc_fh *fh; 34 svc_fh *fh;
35 struct posix_acl *acl; 35 struct posix_acl *acl;
36 int nfserr = 0; 36 __be32 nfserr = 0;
37 37
38 fh = fh_copy(&resp->fh, &argp->fh); 38 fh = fh_copy(&resp->fh, &argp->fh);
39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) 39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
@@ -93,12 +93,12 @@ fail:
93/* 93/*
94 * Set the Access and/or Default ACL of a file. 94 * Set the Access and/or Default ACL of a file.
95 */ 95 */
96static int nfsd3_proc_setacl(struct svc_rqst * rqstp, 96static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp,
97 struct nfsd3_setaclargs *argp, 97 struct nfsd3_setaclargs *argp,
98 struct nfsd3_attrstat *resp) 98 struct nfsd3_attrstat *resp)
99{ 99{
100 svc_fh *fh; 100 svc_fh *fh;
101 int nfserr = 0; 101 __be32 nfserr = 0;
102 102
103 fh = fh_copy(&resp->fh, &argp->fh); 103 fh = fh_copy(&resp->fh, &argp->fh);
104 nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); 104 nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
@@ -122,7 +122,7 @@ static int nfsd3_proc_setacl(struct svc_rqst * rqstp,
122/* 122/*
123 * XDR decode functions 123 * XDR decode functions
124 */ 124 */
125static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, 125static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
126 struct nfsd3_getaclargs *args) 126 struct nfsd3_getaclargs *args)
127{ 127{
128 if (!(p = nfs3svc_decode_fh(p, &args->fh))) 128 if (!(p = nfs3svc_decode_fh(p, &args->fh)))
@@ -133,7 +133,7 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p,
133} 133}
134 134
135 135
136static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, 136static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
137 struct nfsd3_setaclargs *args) 137 struct nfsd3_setaclargs *args)
138{ 138{
139 struct kvec *head = rqstp->rq_arg.head; 139 struct kvec *head = rqstp->rq_arg.head;
@@ -163,7 +163,7 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p,
163 */ 163 */
164 164
165/* GETACL */ 165/* GETACL */
166static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, 166static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
167 struct nfsd3_getaclres *resp) 167 struct nfsd3_getaclres *resp)
168{ 168{
169 struct dentry *dentry = resp->fh.fh_dentry; 169 struct dentry *dentry = resp->fh.fh_dentry;
@@ -208,7 +208,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p,
208} 208}
209 209
210/* SETACL */ 210/* SETACL */
211static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p, 211static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p,
212 struct nfsd3_attrstat *resp) 212 struct nfsd3_attrstat *resp)
213{ 213{
214 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 214 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
@@ -219,7 +219,7 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p,
219/* 219/*
220 * XDR release functions 220 * XDR release functions
221 */ 221 */
222static int nfs3svc_release_getacl(struct svc_rqst *rqstp, u32 *p, 222static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
223 struct nfsd3_getaclres *resp) 223 struct nfsd3_getaclres *resp)
224{ 224{
225 fh_put(&resp->fh); 225 fh_put(&resp->fh);
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index a5ebc7dbb384..64db601c2bd2 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -43,7 +43,7 @@ static int nfs3_ftypes[] = {
43/* 43/*
44 * NULL call. 44 * NULL call.
45 */ 45 */
46static int 46static __be32
47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
48{ 48{
49 return nfs_ok; 49 return nfs_ok;
@@ -52,11 +52,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
52/* 52/*
53 * Get a file's attributes 53 * Get a file's attributes
54 */ 54 */
55static int 55static __be32
56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
57 struct nfsd3_attrstat *resp) 57 struct nfsd3_attrstat *resp)
58{ 58{
59 int err, nfserr; 59 int err;
60 __be32 nfserr;
60 61
61 dprintk("nfsd: GETATTR(3) %s\n", 62 dprintk("nfsd: GETATTR(3) %s\n",
62 SVCFH_fmt(&argp->fh)); 63 SVCFH_fmt(&argp->fh));
@@ -76,11 +77,11 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
76/* 77/*
77 * Set a file's attributes 78 * Set a file's attributes
78 */ 79 */
79static int 80static __be32
80nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp, 81nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
81 struct nfsd3_attrstat *resp) 82 struct nfsd3_attrstat *resp)
82{ 83{
83 int nfserr; 84 __be32 nfserr;
84 85
85 dprintk("nfsd: SETATTR(3) %s\n", 86 dprintk("nfsd: SETATTR(3) %s\n",
86 SVCFH_fmt(&argp->fh)); 87 SVCFH_fmt(&argp->fh));
@@ -94,11 +95,11 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
94/* 95/*
95 * Look up a path name component 96 * Look up a path name component
96 */ 97 */
97static int 98static __be32
98nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 99nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
99 struct nfsd3_diropres *resp) 100 struct nfsd3_diropres *resp)
100{ 101{
101 int nfserr; 102 __be32 nfserr;
102 103
103 dprintk("nfsd: LOOKUP(3) %s %.*s\n", 104 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
104 SVCFH_fmt(&argp->fh), 105 SVCFH_fmt(&argp->fh),
@@ -118,11 +119,11 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
118/* 119/*
119 * Check file access 120 * Check file access
120 */ 121 */
121static int 122static __be32
122nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 123nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
123 struct nfsd3_accessres *resp) 124 struct nfsd3_accessres *resp)
124{ 125{
125 int nfserr; 126 __be32 nfserr;
126 127
127 dprintk("nfsd: ACCESS(3) %s 0x%x\n", 128 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
128 SVCFH_fmt(&argp->fh), 129 SVCFH_fmt(&argp->fh),
@@ -137,11 +138,11 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
137/* 138/*
138 * Read a symlink. 139 * Read a symlink.
139 */ 140 */
140static int 141static __be32
141nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp, 142nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
142 struct nfsd3_readlinkres *resp) 143 struct nfsd3_readlinkres *resp)
143{ 144{
144 int nfserr; 145 __be32 nfserr;
145 146
146 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); 147 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
147 148
@@ -155,11 +156,11 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
155/* 156/*
156 * Read a portion of a file. 157 * Read a portion of a file.
157 */ 158 */
158static int 159static __be32
159nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, 160nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
160 struct nfsd3_readres *resp) 161 struct nfsd3_readres *resp)
161{ 162{
162 int nfserr; 163 __be32 nfserr;
163 u32 max_blocksize = svc_max_payload(rqstp); 164 u32 max_blocksize = svc_max_payload(rqstp);
164 165
165 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n", 166 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n",
@@ -195,11 +196,11 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
195/* 196/*
196 * Write data to a file 197 * Write data to a file
197 */ 198 */
198static int 199static __be32
199nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, 200nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
200 struct nfsd3_writeres *resp) 201 struct nfsd3_writeres *resp)
201{ 202{
202 int nfserr; 203 __be32 nfserr;
203 204
204 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n", 205 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n",
205 SVCFH_fmt(&argp->fh), 206 SVCFH_fmt(&argp->fh),
@@ -223,13 +224,13 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
223 * At least in theory; we'll see how it fares in practice when the 224 * At least in theory; we'll see how it fares in practice when the
224 * first reports about SunOS compatibility problems start to pour in... 225 * first reports about SunOS compatibility problems start to pour in...
225 */ 226 */
226static int 227static __be32
227nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 228nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
228 struct nfsd3_diropres *resp) 229 struct nfsd3_diropres *resp)
229{ 230{
230 svc_fh *dirfhp, *newfhp = NULL; 231 svc_fh *dirfhp, *newfhp = NULL;
231 struct iattr *attr; 232 struct iattr *attr;
232 u32 nfserr; 233 __be32 nfserr;
233 234
234 dprintk("nfsd: CREATE(3) %s %.*s\n", 235 dprintk("nfsd: CREATE(3) %s %.*s\n",
235 SVCFH_fmt(&argp->fh), 236 SVCFH_fmt(&argp->fh),
@@ -265,11 +266,11 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
265/* 266/*
266 * Make directory. This operation is not idempotent. 267 * Make directory. This operation is not idempotent.
267 */ 268 */
268static int 269static __be32
269nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 270nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
270 struct nfsd3_diropres *resp) 271 struct nfsd3_diropres *resp)
271{ 272{
272 int nfserr; 273 __be32 nfserr;
273 274
274 dprintk("nfsd: MKDIR(3) %s %.*s\n", 275 dprintk("nfsd: MKDIR(3) %s %.*s\n",
275 SVCFH_fmt(&argp->fh), 276 SVCFH_fmt(&argp->fh),
@@ -285,11 +286,11 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
285 RETURN_STATUS(nfserr); 286 RETURN_STATUS(nfserr);
286} 287}
287 288
288static int 289static __be32
289nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, 290nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
290 struct nfsd3_diropres *resp) 291 struct nfsd3_diropres *resp)
291{ 292{
292 int nfserr; 293 __be32 nfserr;
293 294
294 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", 295 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
295 SVCFH_fmt(&argp->ffh), 296 SVCFH_fmt(&argp->ffh),
@@ -307,11 +308,12 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
307/* 308/*
308 * Make socket/fifo/device. 309 * Make socket/fifo/device.
309 */ 310 */
310static int 311static __be32
311nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, 312nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
312 struct nfsd3_diropres *resp) 313 struct nfsd3_diropres *resp)
313{ 314{
314 int nfserr, type; 315 __be32 nfserr;
316 int type;
315 dev_t rdev = 0; 317 dev_t rdev = 0;
316 318
317 dprintk("nfsd: MKNOD(3) %s %.*s\n", 319 dprintk("nfsd: MKNOD(3) %s %.*s\n",
@@ -343,11 +345,11 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
343/* 345/*
344 * Remove file/fifo/socket etc. 346 * Remove file/fifo/socket etc.
345 */ 347 */
346static int 348static __be32
347nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 349nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
348 struct nfsd3_attrstat *resp) 350 struct nfsd3_attrstat *resp)
349{ 351{
350 int nfserr; 352 __be32 nfserr;
351 353
352 dprintk("nfsd: REMOVE(3) %s %.*s\n", 354 dprintk("nfsd: REMOVE(3) %s %.*s\n",
353 SVCFH_fmt(&argp->fh), 355 SVCFH_fmt(&argp->fh),
@@ -363,11 +365,11 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
363/* 365/*
364 * Remove a directory 366 * Remove a directory
365 */ 367 */
366static int 368static __be32
367nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 369nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
368 struct nfsd3_attrstat *resp) 370 struct nfsd3_attrstat *resp)
369{ 371{
370 int nfserr; 372 __be32 nfserr;
371 373
372 dprintk("nfsd: RMDIR(3) %s %.*s\n", 374 dprintk("nfsd: RMDIR(3) %s %.*s\n",
373 SVCFH_fmt(&argp->fh), 375 SVCFH_fmt(&argp->fh),
@@ -379,11 +381,11 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
379 RETURN_STATUS(nfserr); 381 RETURN_STATUS(nfserr);
380} 382}
381 383
382static int 384static __be32
383nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, 385nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
384 struct nfsd3_renameres *resp) 386 struct nfsd3_renameres *resp)
385{ 387{
386 int nfserr; 388 __be32 nfserr;
387 389
388 dprintk("nfsd: RENAME(3) %s %.*s ->\n", 390 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
389 SVCFH_fmt(&argp->ffh), 391 SVCFH_fmt(&argp->ffh),
@@ -401,11 +403,11 @@ nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
401 RETURN_STATUS(nfserr); 403 RETURN_STATUS(nfserr);
402} 404}
403 405
404static int 406static __be32
405nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, 407nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
406 struct nfsd3_linkres *resp) 408 struct nfsd3_linkres *resp)
407{ 409{
408 int nfserr; 410 __be32 nfserr;
409 411
410 dprintk("nfsd: LINK(3) %s ->\n", 412 dprintk("nfsd: LINK(3) %s ->\n",
411 SVCFH_fmt(&argp->ffh)); 413 SVCFH_fmt(&argp->ffh));
@@ -424,11 +426,12 @@ nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
424/* 426/*
425 * Read a portion of a directory. 427 * Read a portion of a directory.
426 */ 428 */
427static int 429static __be32
428nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 430nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
429 struct nfsd3_readdirres *resp) 431 struct nfsd3_readdirres *resp)
430{ 432{
431 int nfserr, count; 433 __be32 nfserr;
434 int count;
432 435
433 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", 436 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
434 SVCFH_fmt(&argp->fh), 437 SVCFH_fmt(&argp->fh),
@@ -459,11 +462,12 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
459 * Read a portion of a directory, including file handles and attrs. 462 * Read a portion of a directory, including file handles and attrs.
460 * For now, we choose to ignore the dircount parameter. 463 * For now, we choose to ignore the dircount parameter.
461 */ 464 */
462static int 465static __be32
463nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 466nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
464 struct nfsd3_readdirres *resp) 467 struct nfsd3_readdirres *resp)
465{ 468{
466 int nfserr, count = 0; 469 __be32 nfserr;
470 int count = 0;
467 loff_t offset; 471 loff_t offset;
468 int i; 472 int i;
469 caddr_t page_addr = NULL; 473 caddr_t page_addr = NULL;
@@ -517,11 +521,11 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
517/* 521/*
518 * Get file system stats 522 * Get file system stats
519 */ 523 */
520static int 524static __be32
521nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 525nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
522 struct nfsd3_fsstatres *resp) 526 struct nfsd3_fsstatres *resp)
523{ 527{
524 int nfserr; 528 __be32 nfserr;
525 529
526 dprintk("nfsd: FSSTAT(3) %s\n", 530 dprintk("nfsd: FSSTAT(3) %s\n",
527 SVCFH_fmt(&argp->fh)); 531 SVCFH_fmt(&argp->fh));
@@ -534,11 +538,11 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
534/* 538/*
535 * Get file system info 539 * Get file system info
536 */ 540 */
537static int 541static __be32
538nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 542nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
539 struct nfsd3_fsinfores *resp) 543 struct nfsd3_fsinfores *resp)
540{ 544{
541 int nfserr; 545 __be32 nfserr;
542 u32 max_blocksize = svc_max_payload(rqstp); 546 u32 max_blocksize = svc_max_payload(rqstp);
543 547
544 dprintk("nfsd: FSINFO(3) %s\n", 548 dprintk("nfsd: FSINFO(3) %s\n",
@@ -576,11 +580,11 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
576/* 580/*
577 * Get pathconf info for the specified file 581 * Get pathconf info for the specified file
578 */ 582 */
579static int 583static __be32
580nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 584nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
581 struct nfsd3_pathconfres *resp) 585 struct nfsd3_pathconfres *resp)
582{ 586{
583 int nfserr; 587 __be32 nfserr;
584 588
585 dprintk("nfsd: PATHCONF(3) %s\n", 589 dprintk("nfsd: PATHCONF(3) %s\n",
586 SVCFH_fmt(&argp->fh)); 590 SVCFH_fmt(&argp->fh));
@@ -619,11 +623,11 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
619/* 623/*
620 * Commit a file (range) to stable storage. 624 * Commit a file (range) to stable storage.
621 */ 625 */
622static int 626static __be32
623nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, 627nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
624 struct nfsd3_commitres *resp) 628 struct nfsd3_commitres *resp)
625{ 629{
626 int nfserr; 630 __be32 nfserr;
627 631
628 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", 632 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
629 SVCFH_fmt(&argp->fh), 633 SVCFH_fmt(&argp->fh),
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 247d518248bf..b4baca3053c3 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -42,23 +42,23 @@ static u32 nfs3_ftypes[] = {
42/* 42/*
43 * XDR functions for basic NFS types 43 * XDR functions for basic NFS types
44 */ 44 */
45static inline u32 * 45static inline __be32 *
46encode_time3(u32 *p, struct timespec *time) 46encode_time3(__be32 *p, struct timespec *time)
47{ 47{
48 *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); 48 *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec);
49 return p; 49 return p;
50} 50}
51 51
52static inline u32 * 52static inline __be32 *
53decode_time3(u32 *p, struct timespec *time) 53decode_time3(__be32 *p, struct timespec *time)
54{ 54{
55 time->tv_sec = ntohl(*p++); 55 time->tv_sec = ntohl(*p++);
56 time->tv_nsec = ntohl(*p++); 56 time->tv_nsec = ntohl(*p++);
57 return p; 57 return p;
58} 58}
59 59
60static inline u32 * 60static inline __be32 *
61decode_fh(u32 *p, struct svc_fh *fhp) 61decode_fh(__be32 *p, struct svc_fh *fhp)
62{ 62{
63 unsigned int size; 63 unsigned int size;
64 fh_init(fhp, NFS3_FHSIZE); 64 fh_init(fhp, NFS3_FHSIZE);
@@ -72,13 +72,13 @@ decode_fh(u32 *p, struct svc_fh *fhp)
72} 72}
73 73
74/* Helper function for NFSv3 ACL code */ 74/* Helper function for NFSv3 ACL code */
75u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp) 75__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp)
76{ 76{
77 return decode_fh(p, fhp); 77 return decode_fh(p, fhp);
78} 78}
79 79
80static inline u32 * 80static inline __be32 *
81encode_fh(u32 *p, struct svc_fh *fhp) 81encode_fh(__be32 *p, struct svc_fh *fhp)
82{ 82{
83 unsigned int size = fhp->fh_handle.fh_size; 83 unsigned int size = fhp->fh_handle.fh_size;
84 *p++ = htonl(size); 84 *p++ = htonl(size);
@@ -91,8 +91,8 @@ encode_fh(u32 *p, struct svc_fh *fhp)
91 * Decode a file name and make sure that the path contains 91 * Decode a file name and make sure that the path contains
92 * no slashes or null bytes. 92 * no slashes or null bytes.
93 */ 93 */
94static inline u32 * 94static inline __be32 *
95decode_filename(u32 *p, char **namp, int *lenp) 95decode_filename(__be32 *p, char **namp, int *lenp)
96{ 96{
97 char *name; 97 char *name;
98 int i; 98 int i;
@@ -107,8 +107,8 @@ decode_filename(u32 *p, char **namp, int *lenp)
107 return p; 107 return p;
108} 108}
109 109
110static inline u32 * 110static inline __be32 *
111decode_sattr3(u32 *p, struct iattr *iap) 111decode_sattr3(__be32 *p, struct iattr *iap)
112{ 112{
113 u32 tmp; 113 u32 tmp;
114 114
@@ -153,8 +153,8 @@ decode_sattr3(u32 *p, struct iattr *iap)
153 return p; 153 return p;
154} 154}
155 155
156static inline u32 * 156static inline __be32 *
157encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, 157encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
158 struct kstat *stat) 158 struct kstat *stat)
159{ 159{
160 struct dentry *dentry = fhp->fh_dentry; 160 struct dentry *dentry = fhp->fh_dentry;
@@ -186,8 +186,8 @@ encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp,
186 return p; 186 return p;
187} 187}
188 188
189static inline u32 * 189static inline __be32 *
190encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 190encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
191{ 191{
192 struct inode *inode = fhp->fh_dentry->d_inode; 192 struct inode *inode = fhp->fh_dentry->d_inode;
193 193
@@ -224,8 +224,8 @@ encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
224 * The inode may be NULL if the call failed because of a stale file 224 * The inode may be NULL if the call failed because of a stale file
225 * handle. In this case, no attributes are returned. 225 * handle. In this case, no attributes are returned.
226 */ 226 */
227static u32 * 227static __be32 *
228encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 228encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
229{ 229{
230 struct dentry *dentry = fhp->fh_dentry; 230 struct dentry *dentry = fhp->fh_dentry;
231 if (dentry && dentry->d_inode != NULL) { 231 if (dentry && dentry->d_inode != NULL) {
@@ -243,8 +243,8 @@ encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
243} 243}
244 244
245/* Helper for NFSv3 ACLs */ 245/* Helper for NFSv3 ACLs */
246u32 * 246__be32 *
247nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 247nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
248{ 248{
249 return encode_post_op_attr(rqstp, p, fhp); 249 return encode_post_op_attr(rqstp, p, fhp);
250} 250}
@@ -252,8 +252,8 @@ nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
252/* 252/*
253 * Enocde weak cache consistency data 253 * Enocde weak cache consistency data
254 */ 254 */
255static u32 * 255static __be32 *
256encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 256encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
257{ 257{
258 struct dentry *dentry = fhp->fh_dentry; 258 struct dentry *dentry = fhp->fh_dentry;
259 259
@@ -278,7 +278,7 @@ encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
278 * XDR decode functions 278 * XDR decode functions
279 */ 279 */
280int 280int
281nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) 281nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
282{ 282{
283 if (!(p = decode_fh(p, &args->fh))) 283 if (!(p = decode_fh(p, &args->fh)))
284 return 0; 284 return 0;
@@ -286,7 +286,7 @@ nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args
286} 286}
287 287
288int 288int
289nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, 289nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
290 struct nfsd3_sattrargs *args) 290 struct nfsd3_sattrargs *args)
291{ 291{
292 if (!(p = decode_fh(p, &args->fh)) 292 if (!(p = decode_fh(p, &args->fh))
@@ -303,7 +303,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p,
303} 303}
304 304
305int 305int
306nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, 306nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
307 struct nfsd3_diropargs *args) 307 struct nfsd3_diropargs *args)
308{ 308{
309 if (!(p = decode_fh(p, &args->fh)) 309 if (!(p = decode_fh(p, &args->fh))
@@ -314,7 +314,7 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p,
314} 314}
315 315
316int 316int
317nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, 317nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
318 struct nfsd3_accessargs *args) 318 struct nfsd3_accessargs *args)
319{ 319{
320 if (!(p = decode_fh(p, &args->fh))) 320 if (!(p = decode_fh(p, &args->fh)))
@@ -325,7 +325,7 @@ nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p,
325} 325}
326 326
327int 327int
328nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, 328nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
329 struct nfsd3_readargs *args) 329 struct nfsd3_readargs *args)
330{ 330{
331 unsigned int len; 331 unsigned int len;
@@ -355,7 +355,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
355} 355}
356 356
357int 357int
358nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, 358nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
359 struct nfsd3_writeargs *args) 359 struct nfsd3_writeargs *args)
360{ 360{
361 unsigned int len, v, hdr; 361 unsigned int len, v, hdr;
@@ -393,7 +393,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
393} 393}
394 394
395int 395int
396nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, 396nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
397 struct nfsd3_createargs *args) 397 struct nfsd3_createargs *args)
398{ 398{
399 if (!(p = decode_fh(p, &args->fh)) 399 if (!(p = decode_fh(p, &args->fh))
@@ -417,7 +417,7 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p,
417 return xdr_argsize_check(rqstp, p); 417 return xdr_argsize_check(rqstp, p);
418} 418}
419int 419int
420nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, 420nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p,
421 struct nfsd3_createargs *args) 421 struct nfsd3_createargs *args)
422{ 422{
423 if (!(p = decode_fh(p, &args->fh)) 423 if (!(p = decode_fh(p, &args->fh))
@@ -429,7 +429,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p,
429} 429}
430 430
431int 431int
432nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, 432nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
433 struct nfsd3_symlinkargs *args) 433 struct nfsd3_symlinkargs *args)
434{ 434{
435 unsigned int len; 435 unsigned int len;
@@ -481,7 +481,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
481} 481}
482 482
483int 483int
484nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, 484nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p,
485 struct nfsd3_mknodargs *args) 485 struct nfsd3_mknodargs *args)
486{ 486{
487 if (!(p = decode_fh(p, &args->fh)) 487 if (!(p = decode_fh(p, &args->fh))
@@ -505,7 +505,7 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p,
505} 505}
506 506
507int 507int
508nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, 508nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
509 struct nfsd3_renameargs *args) 509 struct nfsd3_renameargs *args)
510{ 510{
511 if (!(p = decode_fh(p, &args->ffh)) 511 if (!(p = decode_fh(p, &args->ffh))
@@ -518,7 +518,7 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p,
518} 518}
519 519
520int 520int
521nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, 521nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
522 struct nfsd3_readlinkargs *args) 522 struct nfsd3_readlinkargs *args)
523{ 523{
524 if (!(p = decode_fh(p, &args->fh))) 524 if (!(p = decode_fh(p, &args->fh)))
@@ -530,7 +530,7 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p,
530} 530}
531 531
532int 532int
533nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, 533nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
534 struct nfsd3_linkargs *args) 534 struct nfsd3_linkargs *args)
535{ 535{
536 if (!(p = decode_fh(p, &args->ffh)) 536 if (!(p = decode_fh(p, &args->ffh))
@@ -542,7 +542,7 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p,
542} 542}
543 543
544int 544int
545nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, 545nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
546 struct nfsd3_readdirargs *args) 546 struct nfsd3_readdirargs *args)
547{ 547{
548 if (!(p = decode_fh(p, &args->fh))) 548 if (!(p = decode_fh(p, &args->fh)))
@@ -562,7 +562,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
562} 562}
563 563
564int 564int
565nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, 565nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
566 struct nfsd3_readdirargs *args) 566 struct nfsd3_readdirargs *args)
567{ 567{
568 int len, pn; 568 int len, pn;
@@ -590,7 +590,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
590} 590}
591 591
592int 592int
593nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, 593nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p,
594 struct nfsd3_commitargs *args) 594 struct nfsd3_commitargs *args)
595{ 595{
596 if (!(p = decode_fh(p, &args->fh))) 596 if (!(p = decode_fh(p, &args->fh)))
@@ -609,14 +609,14 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p,
609 * will work properly. 609 * will work properly.
610 */ 610 */
611int 611int
612nfs3svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) 612nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
613{ 613{
614 return xdr_ressize_check(rqstp, p); 614 return xdr_ressize_check(rqstp, p);
615} 615}
616 616
617/* GETATTR */ 617/* GETATTR */
618int 618int
619nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, 619nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
620 struct nfsd3_attrstat *resp) 620 struct nfsd3_attrstat *resp)
621{ 621{
622 if (resp->status == 0) 622 if (resp->status == 0)
@@ -626,7 +626,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p,
626 626
627/* SETATTR, REMOVE, RMDIR */ 627/* SETATTR, REMOVE, RMDIR */
628int 628int
629nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, 629nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p,
630 struct nfsd3_attrstat *resp) 630 struct nfsd3_attrstat *resp)
631{ 631{
632 p = encode_wcc_data(rqstp, p, &resp->fh); 632 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -635,7 +635,7 @@ nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p,
635 635
636/* LOOKUP */ 636/* LOOKUP */
637int 637int
638nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, 638nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
639 struct nfsd3_diropres *resp) 639 struct nfsd3_diropres *resp)
640{ 640{
641 if (resp->status == 0) { 641 if (resp->status == 0) {
@@ -648,7 +648,7 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p,
648 648
649/* ACCESS */ 649/* ACCESS */
650int 650int
651nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, 651nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
652 struct nfsd3_accessres *resp) 652 struct nfsd3_accessres *resp)
653{ 653{
654 p = encode_post_op_attr(rqstp, p, &resp->fh); 654 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -659,7 +659,7 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p,
659 659
660/* READLINK */ 660/* READLINK */
661int 661int
662nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, 662nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
663 struct nfsd3_readlinkres *resp) 663 struct nfsd3_readlinkres *resp)
664{ 664{
665 p = encode_post_op_attr(rqstp, p, &resp->fh); 665 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -680,7 +680,7 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
680 680
681/* READ */ 681/* READ */
682int 682int
683nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, 683nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
684 struct nfsd3_readres *resp) 684 struct nfsd3_readres *resp)
685{ 685{
686 p = encode_post_op_attr(rqstp, p, &resp->fh); 686 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -704,7 +704,7 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p,
704 704
705/* WRITE */ 705/* WRITE */
706int 706int
707nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, 707nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p,
708 struct nfsd3_writeres *resp) 708 struct nfsd3_writeres *resp)
709{ 709{
710 p = encode_wcc_data(rqstp, p, &resp->fh); 710 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -719,7 +719,7 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p,
719 719
720/* CREATE, MKDIR, SYMLINK, MKNOD */ 720/* CREATE, MKDIR, SYMLINK, MKNOD */
721int 721int
722nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, 722nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p,
723 struct nfsd3_diropres *resp) 723 struct nfsd3_diropres *resp)
724{ 724{
725 if (resp->status == 0) { 725 if (resp->status == 0) {
@@ -733,7 +733,7 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p,
733 733
734/* RENAME */ 734/* RENAME */
735int 735int
736nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, 736nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p,
737 struct nfsd3_renameres *resp) 737 struct nfsd3_renameres *resp)
738{ 738{
739 p = encode_wcc_data(rqstp, p, &resp->ffh); 739 p = encode_wcc_data(rqstp, p, &resp->ffh);
@@ -743,7 +743,7 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p,
743 743
744/* LINK */ 744/* LINK */
745int 745int
746nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, 746nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p,
747 struct nfsd3_linkres *resp) 747 struct nfsd3_linkres *resp)
748{ 748{
749 p = encode_post_op_attr(rqstp, p, &resp->fh); 749 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -753,7 +753,7 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p,
753 753
754/* READDIR */ 754/* READDIR */
755int 755int
756nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, 756nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
757 struct nfsd3_readdirres *resp) 757 struct nfsd3_readdirres *resp)
758{ 758{
759 p = encode_post_op_attr(rqstp, p, &resp->fh); 759 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -776,8 +776,8 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
776 return xdr_ressize_check(rqstp, p); 776 return xdr_ressize_check(rqstp, p);
777} 777}
778 778
779static inline u32 * 779static inline __be32 *
780encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, 780encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
781 int namlen, ino_t ino) 781 int namlen, ino_t ino)
782{ 782{
783 *p++ = xdr_one; /* mark entry present */ 783 *p++ = xdr_one; /* mark entry present */
@@ -790,8 +790,8 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name,
790 return p; 790 return p;
791} 791}
792 792
793static inline u32 * 793static inline __be32 *
794encode_entryplus_baggage(struct nfsd3_readdirres *cd, u32 *p, 794encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p,
795 struct svc_fh *fhp) 795 struct svc_fh *fhp)
796{ 796{
797 p = encode_post_op_attr(cd->rqstp, p, fhp); 797 p = encode_post_op_attr(cd->rqstp, p, fhp);
@@ -853,7 +853,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
853{ 853{
854 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, 854 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
855 common); 855 common);
856 u32 *p = cd->buffer; 856 __be32 *p = cd->buffer;
857 caddr_t curr_page_addr = NULL; 857 caddr_t curr_page_addr = NULL;
858 int pn; /* current page number */ 858 int pn; /* current page number */
859 int slen; /* string (name) length */ 859 int slen; /* string (name) length */
@@ -919,7 +919,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
919 } else if (cd->rqstp->rq_respages[pn+1] != NULL) { 919 } else if (cd->rqstp->rq_respages[pn+1] != NULL) {
920 /* temporarily encode entry into next page, then move back to 920 /* temporarily encode entry into next page, then move back to
921 * current and next page in rq_respages[] */ 921 * current and next page in rq_respages[] */
922 u32 *p1, *tmp; 922 __be32 *p1, *tmp;
923 int len1, len2; 923 int len1, len2;
924 924
925 /* grab next page for temporary storage of entry */ 925 /* grab next page for temporary storage of entry */
@@ -1009,7 +1009,7 @@ nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name,
1009 1009
1010/* FSSTAT */ 1010/* FSSTAT */
1011int 1011int
1012nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, 1012nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p,
1013 struct nfsd3_fsstatres *resp) 1013 struct nfsd3_fsstatres *resp)
1014{ 1014{
1015 struct kstatfs *s = &resp->stats; 1015 struct kstatfs *s = &resp->stats;
@@ -1031,7 +1031,7 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p,
1031 1031
1032/* FSINFO */ 1032/* FSINFO */
1033int 1033int
1034nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, 1034nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p,
1035 struct nfsd3_fsinfores *resp) 1035 struct nfsd3_fsinfores *resp)
1036{ 1036{
1037 *p++ = xdr_zero; /* no post_op_attr */ 1037 *p++ = xdr_zero; /* no post_op_attr */
@@ -1055,7 +1055,7 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p,
1055 1055
1056/* PATHCONF */ 1056/* PATHCONF */
1057int 1057int
1058nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, 1058nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p,
1059 struct nfsd3_pathconfres *resp) 1059 struct nfsd3_pathconfres *resp)
1060{ 1060{
1061 *p++ = xdr_zero; /* no post_op_attr */ 1061 *p++ = xdr_zero; /* no post_op_attr */
@@ -1074,7 +1074,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p,
1074 1074
1075/* COMMIT */ 1075/* COMMIT */
1076int 1076int
1077nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, 1077nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p,
1078 struct nfsd3_commitres *resp) 1078 struct nfsd3_commitres *resp)
1079{ 1079{
1080 p = encode_wcc_data(rqstp, p, &resp->fh); 1080 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -1090,7 +1090,7 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p,
1090 * XDR release functions 1090 * XDR release functions
1091 */ 1091 */
1092int 1092int
1093nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 1093nfs3svc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
1094 struct nfsd3_attrstat *resp) 1094 struct nfsd3_attrstat *resp)
1095{ 1095{
1096 fh_put(&resp->fh); 1096 fh_put(&resp->fh);
@@ -1098,7 +1098,7 @@ nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p,
1098} 1098}
1099 1099
1100int 1100int
1101nfs3svc_release_fhandle2(struct svc_rqst *rqstp, u32 *p, 1101nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p,
1102 struct nfsd3_fhandle_pair *resp) 1102 struct nfsd3_fhandle_pair *resp)
1103{ 1103{
1104 fh_put(&resp->fh1); 1104 fh_put(&resp->fh1);
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index f6ca9fb3fc63..f57655a7a2b6 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -85,8 +85,8 @@ enum nfs_cb_opnum4 {
85/* 85/*
86* Generic encode routines from fs/nfs/nfs4xdr.c 86* Generic encode routines from fs/nfs/nfs4xdr.c
87*/ 87*/
88static inline u32 * 88static inline __be32 *
89xdr_writemem(u32 *p, const void *ptr, int nbytes) 89xdr_writemem(__be32 *p, const void *ptr, int nbytes)
90{ 90{
91 int tmp = XDR_QUADLEN(nbytes); 91 int tmp = XDR_QUADLEN(nbytes);
92 if (!tmp) 92 if (!tmp)
@@ -205,7 +205,7 @@ nfs_cb_stat_to_errno(int stat)
205static int 205static int
206encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) 206encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
207{ 207{
208 u32 * p; 208 __be32 * p;
209 209
210 RESERVE_SPACE(16); 210 RESERVE_SPACE(16);
211 WRITE32(0); /* tag length is always 0 */ 211 WRITE32(0); /* tag length is always 0 */
@@ -218,7 +218,7 @@ encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
218static int 218static int
219encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec) 219encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
220{ 220{
221 u32 *p; 221 __be32 *p;
222 int len = cb_rec->cbr_fhlen; 222 int len = cb_rec->cbr_fhlen;
223 223
224 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len); 224 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len);
@@ -231,7 +231,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
231} 231}
232 232
233static int 233static int
234nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p) 234nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
235{ 235{
236 struct xdr_stream xdrs, *xdr = &xdrs; 236 struct xdr_stream xdrs, *xdr = &xdrs;
237 237
@@ -241,7 +241,7 @@ nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p)
241} 241}
242 242
243static int 243static int
244nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args) 244nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, struct nfs4_cb_recall *args)
245{ 245{
246 struct xdr_stream xdr; 246 struct xdr_stream xdr;
247 struct nfs4_cb_compound_hdr hdr = { 247 struct nfs4_cb_compound_hdr hdr = {
@@ -257,7 +257,7 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args
257 257
258static int 258static int
259decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){ 259decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){
260 u32 *p; 260 __be32 *p;
261 261
262 READ_BUF(8); 262 READ_BUF(8);
263 READ32(hdr->status); 263 READ32(hdr->status);
@@ -272,7 +272,7 @@ decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
272static int 272static int
273decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) 273decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
274{ 274{
275 u32 *p; 275 __be32 *p;
276 u32 op; 276 u32 op;
277 int32_t nfserr; 277 int32_t nfserr;
278 278
@@ -291,13 +291,13 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
291} 291}
292 292
293static int 293static int
294nfs4_xdr_dec_cb_null(struct rpc_rqst *req, u32 *p) 294nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
295{ 295{
296 return 0; 296 return 0;
297} 297}
298 298
299static int 299static int
300nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p) 300nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p)
301{ 301{
302 struct xdr_stream xdr; 302 struct xdr_stream xdr;
303 struct nfs4_cb_compound_hdr hdr; 303 struct nfs4_cb_compound_hdr hdr;
@@ -421,7 +421,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
421 421
422 /* Create RPC client */ 422 /* Create RPC client */
423 cb->cb_client = rpc_create(&args); 423 cb->cb_client = rpc_create(&args);
424 if (!cb->cb_client) { 424 if (IS_ERR(cb->cb_client)) {
425 dprintk("NFSD: couldn't create callback client\n"); 425 dprintk("NFSD: couldn't create callback client\n");
426 goto out_err; 426 goto out_err;
427 } 427 }
@@ -448,10 +448,10 @@ nfsd4_probe_callback(struct nfs4_client *clp)
448out_rpciod: 448out_rpciod:
449 atomic_dec(&clp->cl_count); 449 atomic_dec(&clp->cl_count);
450 rpciod_down(); 450 rpciod_down();
451 cb->cb_client = NULL;
452out_clnt: 451out_clnt:
453 rpc_shutdown_client(cb->cb_client); 452 rpc_shutdown_client(cb->cb_client);
454out_err: 453out_err:
454 cb->cb_client = NULL;
455 dprintk("NFSD: warning: no callback path to client %.*s\n", 455 dprintk("NFSD: warning: no callback path to client %.*s\n",
456 (int)clp->cl_name.len, clp->cl_name.data); 456 (int)clp->cl_name.len, clp->cl_name.data);
457} 457}
@@ -461,7 +461,7 @@ nfs4_cb_null(struct rpc_task *task, void *dummy)
461{ 461{
462 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; 462 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;
463 struct nfs4_callback *cb = &clp->cl_callback; 463 struct nfs4_callback *cb = &clp->cl_callback;
464 u32 addr = htonl(cb->cb_addr); 464 __be32 addr = htonl(cb->cb_addr);
465 465
466 dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status); 466 dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status);
467 467
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 8333db12caca..0a7bbdc4a10a 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -67,32 +67,32 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
67 *dst = *src; 67 *dst = *src;
68} 68}
69 69
70static int 70static __be32
71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
72{ 72{
73 int accmode, status; 73 __be32 status;
74 74
75 if (open->op_truncate && 75 if (open->op_truncate &&
76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) 76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
77 return nfserr_inval; 77 return nfserr_inval;
78 78
79 accmode = MAY_NOP;
80 if (open->op_share_access & NFS4_SHARE_ACCESS_READ) 79 if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
81 accmode = MAY_READ; 80 accmode |= MAY_READ;
82 if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) 81 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
83 accmode |= (MAY_WRITE | MAY_TRUNC); 82 accmode |= (MAY_WRITE | MAY_TRUNC);
84 accmode |= MAY_OWNER_OVERRIDE; 83 if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
84 accmode |= MAY_WRITE;
85 85
86 status = fh_verify(rqstp, current_fh, S_IFREG, accmode); 86 status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
87 87
88 return status; 88 return status;
89} 89}
90 90
91static int 91static __be32
92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
93{ 93{
94 struct svc_fh resfh; 94 struct svc_fh resfh;
95 int status; 95 __be32 status;
96 96
97 fh_init(&resfh, NFS4_FHSIZE); 97 fh_init(&resfh, NFS4_FHSIZE);
98 open->op_truncate = 0; 98 open->op_truncate = 0;
@@ -124,17 +124,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
124 &resfh.fh_handle.fh_base, 124 &resfh.fh_handle.fh_base,
125 resfh.fh_handle.fh_size); 125 resfh.fh_handle.fh_size);
126 126
127 status = do_open_permission(rqstp, current_fh, open); 127 status = do_open_permission(rqstp, current_fh, open, MAY_NOP);
128 } 128 }
129 129
130 fh_put(&resfh); 130 fh_put(&resfh);
131 return status; 131 return status;
132} 132}
133 133
134static int 134static __be32
135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
136{ 136{
137 int status; 137 __be32 status;
138 138
139 /* Only reclaims from previously confirmed clients are valid */ 139 /* Only reclaims from previously confirmed clients are valid */
140 if ((status = nfs4_check_open_reclaim(&open->op_clientid))) 140 if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
@@ -155,16 +155,16 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
155 open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && 155 open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
156 (open->op_iattr.ia_size == 0); 156 (open->op_iattr.ia_size == 0);
157 157
158 status = do_open_permission(rqstp, current_fh, open); 158 status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE);
159 159
160 return status; 160 return status;
161} 161}
162 162
163 163
164static inline int 164static inline __be32
165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) 165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner)
166{ 166{
167 int status; 167 __be32 status;
168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", 168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
169 (int)open->op_fname.len, open->op_fname.data, 169 (int)open->op_fname.len, open->op_fname.data,
170 open->op_stateowner); 170 open->op_stateowner);
@@ -177,7 +177,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
177 177
178 /* check seqid for replay. set nfs4_owner */ 178 /* check seqid for replay. set nfs4_owner */
179 status = nfsd4_process_open1(open); 179 status = nfsd4_process_open1(open);
180 if (status == NFSERR_REPLAY_ME) { 180 if (status == nfserr_replay_me) {
181 struct nfs4_replay *rp = &open->op_stateowner->so_replay; 181 struct nfs4_replay *rp = &open->op_stateowner->so_replay;
182 fh_put(current_fh); 182 fh_put(current_fh);
183 current_fh->fh_handle.fh_size = rp->rp_openfh_len; 183 current_fh->fh_handle.fh_size = rp->rp_openfh_len;
@@ -188,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
188 dprintk("nfsd4_open: replay failed" 188 dprintk("nfsd4_open: replay failed"
189 " restoring previous filehandle\n"); 189 " restoring previous filehandle\n");
190 else 190 else
191 status = NFSERR_REPLAY_ME; 191 status = nfserr_replay_me;
192 } 192 }
193 if (status) 193 if (status)
194 goto out; 194 goto out;
@@ -261,7 +261,7 @@ out:
261/* 261/*
262 * filehandle-manipulating ops. 262 * filehandle-manipulating ops.
263 */ 263 */
264static inline int 264static inline __be32
265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) 265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
266{ 266{
267 if (!current_fh->fh_dentry) 267 if (!current_fh->fh_dentry)
@@ -271,7 +271,7 @@ nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
271 return nfs_ok; 271 return nfs_ok;
272} 272}
273 273
274static inline int 274static inline __be32
275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) 275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh)
276{ 276{
277 fh_put(current_fh); 277 fh_put(current_fh);
@@ -280,10 +280,10 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf
280 return fh_verify(rqstp, current_fh, 0, MAY_NOP); 280 return fh_verify(rqstp, current_fh, 0, MAY_NOP);
281} 281}
282 282
283static inline int 283static inline __be32
284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) 284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
285{ 285{
286 int status; 286 __be32 status;
287 287
288 fh_put(current_fh); 288 fh_put(current_fh);
289 status = exp_pseudoroot(rqstp->rq_client, current_fh, 289 status = exp_pseudoroot(rqstp->rq_client, current_fh,
@@ -291,7 +291,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
291 return status; 291 return status;
292} 292}
293 293
294static inline int 294static inline __be32
295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
296{ 296{
297 if (!save_fh->fh_dentry) 297 if (!save_fh->fh_dentry)
@@ -301,7 +301,7 @@ nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
301 return nfs_ok; 301 return nfs_ok;
302} 302}
303 303
304static inline int 304static inline __be32
305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
306{ 306{
307 if (!current_fh->fh_dentry) 307 if (!current_fh->fh_dentry)
@@ -314,7 +314,7 @@ nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
314/* 314/*
315 * misc nfsv4 ops 315 * misc nfsv4 ops
316 */ 316 */
317static inline int 317static inline __be32
318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) 318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access)
319{ 319{
320 if (access->ac_req_access & ~NFS3_ACCESS_FULL) 320 if (access->ac_req_access & ~NFS3_ACCESS_FULL)
@@ -324,10 +324,10 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); 324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported);
325} 325}
326 326
327static inline int 327static inline __be32
328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) 328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit)
329{ 329{
330 int status; 330 __be32 status;
331 331
332 u32 *p = (u32 *)commit->co_verf.data; 332 u32 *p = (u32 *)commit->co_verf.data;
333 *p++ = nfssvc_boot.tv_sec; 333 *p++ = nfssvc_boot.tv_sec;
@@ -339,11 +339,11 @@ nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_com
339 return status; 339 return status;
340} 340}
341 341
342static int 342static __be32
343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) 343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create)
344{ 344{
345 struct svc_fh resfh; 345 struct svc_fh resfh;
346 int status; 346 __be32 status;
347 dev_t rdev; 347 dev_t rdev;
348 348
349 fh_init(&resfh, NFS4_FHSIZE); 349 fh_init(&resfh, NFS4_FHSIZE);
@@ -423,10 +423,10 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre
423 return status; 423 return status;
424} 424}
425 425
426static inline int 426static inline __be32
427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) 427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr)
428{ 428{
429 int status; 429 __be32 status;
430 430
431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
432 if (status) 432 if (status)
@@ -442,11 +442,11 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ge
442 return nfs_ok; 442 return nfs_ok;
443} 443}
444 444
445static inline int 445static inline __be32
446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, 446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
447 struct svc_fh *save_fh, struct nfsd4_link *link) 447 struct svc_fh *save_fh, struct nfsd4_link *link)
448{ 448{
449 int status = nfserr_nofilehandle; 449 __be32 status = nfserr_nofilehandle;
450 450
451 if (!save_fh->fh_dentry) 451 if (!save_fh->fh_dentry)
452 return status; 452 return status;
@@ -456,11 +456,11 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
456 return status; 456 return status;
457} 457}
458 458
459static int 459static __be32
460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) 460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
461{ 461{
462 struct svc_fh tmp_fh; 462 struct svc_fh tmp_fh;
463 int ret; 463 __be32 ret;
464 464
465 fh_init(&tmp_fh, NFS4_FHSIZE); 465 fh_init(&tmp_fh, NFS4_FHSIZE);
466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, 466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh,
@@ -474,16 +474,16 @@ nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); 474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh);
475} 475}
476 476
477static inline int 477static inline __be32
478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) 478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup)
479{ 479{
480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); 480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh);
481} 481}
482 482
483static inline int 483static inline __be32
484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) 484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read)
485{ 485{
486 int status; 486 __be32 status;
487 487
488 /* no need to check permission - this will be done in nfsd_read() */ 488 /* no need to check permission - this will be done in nfsd_read() */
489 489
@@ -508,7 +508,7 @@ out:
508 return status; 508 return status;
509} 509}
510 510
511static inline int 511static inline __be32
512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) 512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir)
513{ 513{
514 u64 cookie = readdir->rd_cookie; 514 u64 cookie = readdir->rd_cookie;
@@ -531,7 +531,7 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_re
531 return nfs_ok; 531 return nfs_ok;
532} 532}
533 533
534static inline int 534static inline __be32
535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) 535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink)
536{ 536{
537 readlink->rl_rqstp = rqstp; 537 readlink->rl_rqstp = rqstp;
@@ -539,10 +539,10 @@ nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_r
539 return nfs_ok; 539 return nfs_ok;
540} 540}
541 541
542static inline int 542static inline __be32
543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) 543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove)
544{ 544{
545 int status; 545 __be32 status;
546 546
547 if (nfs4_in_grace()) 547 if (nfs4_in_grace())
548 return nfserr_grace; 548 return nfserr_grace;
@@ -556,11 +556,11 @@ nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_rem
556 return status; 556 return status;
557} 557}
558 558
559static inline int 559static inline __be32
560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, 560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
561 struct svc_fh *save_fh, struct nfsd4_rename *rename) 561 struct svc_fh *save_fh, struct nfsd4_rename *rename)
562{ 562{
563 int status = nfserr_nofilehandle; 563 __be32 status = nfserr_nofilehandle;
564 564
565 if (!save_fh->fh_dentry) 565 if (!save_fh->fh_dentry)
566 return status; 566 return status;
@@ -589,10 +589,10 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
589 return status; 589 return status;
590} 590}
591 591
592static inline int 592static inline __be32
593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) 593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr)
594{ 594{
595 int status = nfs_ok; 595 __be32 status = nfs_ok;
596 596
597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
598 nfs4_lock_state(); 598 nfs4_lock_state();
@@ -614,13 +614,13 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se
614 return status; 614 return status;
615} 615}
616 616
617static inline int 617static inline __be32
618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) 618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write)
619{ 619{
620 stateid_t *stateid = &write->wr_stateid; 620 stateid_t *stateid = &write->wr_stateid;
621 struct file *filp = NULL; 621 struct file *filp = NULL;
622 u32 *p; 622 u32 *p;
623 int status = nfs_ok; 623 __be32 status = nfs_ok;
624 624
625 /* no need to check permission - this will be done in nfsd_write() */ 625 /* no need to check permission - this will be done in nfsd_write() */
626 626
@@ -661,12 +661,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME 661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME
662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. 662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.
663 */ 663 */
664static int 664static __be32
665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) 665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify)
666{ 666{
667 u32 *buf, *p; 667 __be32 *buf, *p;
668 int count; 668 int count;
669 int status; 669 __be32 status;
670 670
671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
672 if (status) 672 if (status)
@@ -715,7 +715,7 @@ out_kfree:
715/* 715/*
716 * NULL call. 716 * NULL call.
717 */ 717 */
718static int 718static __be32
719nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 719nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
720{ 720{
721 return nfs_ok; 721 return nfs_ok;
@@ -731,7 +731,7 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
731/* 731/*
732 * COMPOUND call. 732 * COMPOUND call.
733 */ 733 */
734static int 734static __be32
735nfsd4_proc_compound(struct svc_rqst *rqstp, 735nfsd4_proc_compound(struct svc_rqst *rqstp,
736 struct nfsd4_compoundargs *args, 736 struct nfsd4_compoundargs *args,
737 struct nfsd4_compoundres *resp) 737 struct nfsd4_compoundres *resp)
@@ -741,7 +741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
741 struct svc_fh *save_fh = NULL; 741 struct svc_fh *save_fh = NULL;
742 struct nfs4_stateowner *replay_owner = NULL; 742 struct nfs4_stateowner *replay_owner = NULL;
743 int slack_space; /* in words, not bytes! */ 743 int slack_space; /* in words, not bytes! */
744 int status; 744 __be32 status;
745 745
746 status = nfserr_resource; 746 status = nfserr_resource;
747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); 747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL);
@@ -937,7 +937,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
937 } 937 }
938 938
939encode_op: 939encode_op:
940 if (op->status == NFSERR_REPLAY_ME) { 940 if (op->status == nfserr_replay_me) {
941 op->replay = &replay_owner->so_replay; 941 op->replay = &replay_owner->so_replay;
942 nfsd4_encode_replay(resp, op); 942 nfsd4_encode_replay(resp, op);
943 status = op->status = op->replay->rp_status; 943 status = op->status = op->replay->rp_status;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1cbd2e4ee122..e9d07704680e 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -83,13 +83,13 @@ md5_to_hex(char *out, char *md5)
83 *out = '\0'; 83 *out = '\0';
84} 84}
85 85
86int 86__be32
87nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) 87nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
88{ 88{
89 struct xdr_netobj cksum; 89 struct xdr_netobj cksum;
90 struct hash_desc desc; 90 struct hash_desc desc;
91 struct scatterlist sg[1]; 91 struct scatterlist sg[1];
92 int status = nfserr_resource; 92 __be32 status = nfserr_resource;
93 93
94 dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", 94 dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
95 clname->len, clname->data); 95 clname->len, clname->data);
@@ -193,7 +193,7 @@ nfsd4_build_dentrylist(void *arg, const char *name, int namlen,
193 struct dentry_list *child; 193 struct dentry_list *child;
194 194
195 if (name && isdotent(name, namlen)) 195 if (name && isdotent(name, namlen))
196 return nfs_ok; 196 return 0;
197 dentry = lookup_one_len(name, parent, namlen); 197 dentry = lookup_one_len(name, parent, namlen);
198 if (IS_ERR(dentry)) 198 if (IS_ERR(dentry))
199 return PTR_ERR(dentry); 199 return PTR_ERR(dentry);
@@ -333,14 +333,14 @@ purge_old(struct dentry *parent, struct dentry *child)
333 int status; 333 int status;
334 334
335 if (nfs4_has_reclaimed_state(child->d_name.name)) 335 if (nfs4_has_reclaimed_state(child->d_name.name))
336 return nfs_ok; 336 return 0;
337 337
338 status = nfsd4_clear_clid_dir(parent, child); 338 status = nfsd4_clear_clid_dir(parent, child);
339 if (status) 339 if (status)
340 printk("failed to remove client recovery directory %s\n", 340 printk("failed to remove client recovery directory %s\n",
341 child->d_name.name); 341 child->d_name.name);
342 /* Keep trying, success or failure: */ 342 /* Keep trying, success or failure: */
343 return nfs_ok; 343 return 0;
344} 344}
345 345
346void 346void
@@ -365,10 +365,10 @@ load_recdir(struct dentry *parent, struct dentry *child)
365 printk("nfsd4: illegal name %s in recovery directory\n", 365 printk("nfsd4: illegal name %s in recovery directory\n",
366 child->d_name.name); 366 child->d_name.name);
367 /* Keep trying; maybe the others are OK: */ 367 /* Keep trying; maybe the others are OK: */
368 return nfs_ok; 368 return 0;
369 } 369 }
370 nfs4_client_to_reclaim(child->d_name.name); 370 nfs4_client_to_reclaim(child->d_name.name);
371 return nfs_ok; 371 return 0;
372} 372}
373 373
374int 374int
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ebcf226a9e4a..293b6495829f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -710,10 +710,10 @@ out_err:
710 * as described above. 710 * as described above.
711 * 711 *
712 */ 712 */
713int 713__be32
714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) 714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
715{ 715{
716 u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 716 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
717 struct xdr_netobj clname = { 717 struct xdr_netobj clname = {
718 .len = setclid->se_namelen, 718 .len = setclid->se_namelen,
719 .data = setclid->se_name, 719 .data = setclid->se_name,
@@ -721,7 +721,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
721 nfs4_verifier clverifier = setclid->se_verf; 721 nfs4_verifier clverifier = setclid->se_verf;
722 unsigned int strhashval; 722 unsigned int strhashval;
723 struct nfs4_client *conf, *unconf, *new; 723 struct nfs4_client *conf, *unconf, *new;
724 int status; 724 __be32 status;
725 char dname[HEXDIR_LEN]; 725 char dname[HEXDIR_LEN];
726 726
727 if (!check_name(clname)) 727 if (!check_name(clname))
@@ -875,14 +875,14 @@ out:
875 * 875 *
876 * NOTE: callback information will be processed here in a future patch 876 * NOTE: callback information will be processed here in a future patch
877 */ 877 */
878int 878__be32
879nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) 879nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm)
880{ 880{
881 u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 881 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
882 struct nfs4_client *conf, *unconf; 882 struct nfs4_client *conf, *unconf;
883 nfs4_verifier confirm = setclientid_confirm->sc_confirm; 883 nfs4_verifier confirm = setclientid_confirm->sc_confirm;
884 clientid_t * clid = &setclientid_confirm->sc_clientid; 884 clientid_t * clid = &setclientid_confirm->sc_clientid;
885 int status; 885 __be32 status;
886 886
887 if (STALE_CLIENTID(clid)) 887 if (STALE_CLIENTID(clid))
888 return nfserr_stale_clientid; 888 return nfserr_stale_clientid;
@@ -1280,13 +1280,13 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) {
1280 * Called to check deny when READ with all zero stateid or 1280 * Called to check deny when READ with all zero stateid or
1281 * WRITE with all zero or all one stateid 1281 * WRITE with all zero or all one stateid
1282 */ 1282 */
1283static int 1283static __be32
1284nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) 1284nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
1285{ 1285{
1286 struct inode *ino = current_fh->fh_dentry->d_inode; 1286 struct inode *ino = current_fh->fh_dentry->d_inode;
1287 struct nfs4_file *fp; 1287 struct nfs4_file *fp;
1288 struct nfs4_stateid *stp; 1288 struct nfs4_stateid *stp;
1289 int ret; 1289 __be32 ret;
1290 1290
1291 dprintk("NFSD: nfs4_share_conflict\n"); 1291 dprintk("NFSD: nfs4_share_conflict\n");
1292 1292
@@ -1444,7 +1444,7 @@ static struct lock_manager_operations nfsd_lease_mng_ops = {
1444}; 1444};
1445 1445
1446 1446
1447int 1447__be32
1448nfsd4_process_open1(struct nfsd4_open *open) 1448nfsd4_process_open1(struct nfsd4_open *open)
1449{ 1449{
1450 clientid_t *clientid = &open->op_clientid; 1450 clientid_t *clientid = &open->op_clientid;
@@ -1477,7 +1477,7 @@ nfsd4_process_open1(struct nfsd4_open *open)
1477 } 1477 }
1478 if (open->op_seqid == sop->so_seqid - 1) { 1478 if (open->op_seqid == sop->so_seqid - 1) {
1479 if (sop->so_replay.rp_buflen) 1479 if (sop->so_replay.rp_buflen)
1480 return NFSERR_REPLAY_ME; 1480 return nfserr_replay_me;
1481 /* The original OPEN failed so spectacularly 1481 /* The original OPEN failed so spectacularly
1482 * that we don't even have replay data saved! 1482 * that we don't even have replay data saved!
1483 * Therefore, we have no choice but to continue 1483 * Therefore, we have no choice but to continue
@@ -1501,7 +1501,7 @@ renew:
1501 return nfs_ok; 1501 return nfs_ok;
1502} 1502}
1503 1503
1504static inline int 1504static inline __be32
1505nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) 1505nfs4_check_delegmode(struct nfs4_delegation *dp, int flags)
1506{ 1506{
1507 if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ)) 1507 if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ))
@@ -1522,12 +1522,12 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid)
1522 return NULL; 1522 return NULL;
1523} 1523}
1524 1524
1525static int 1525static __be32
1526nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, 1526nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
1527 struct nfs4_delegation **dp) 1527 struct nfs4_delegation **dp)
1528{ 1528{
1529 int flags; 1529 int flags;
1530 int status = nfserr_bad_stateid; 1530 __be32 status = nfserr_bad_stateid;
1531 1531
1532 *dp = find_delegation_file(fp, &open->op_delegate_stateid); 1532 *dp = find_delegation_file(fp, &open->op_delegate_stateid);
1533 if (*dp == NULL) 1533 if (*dp == NULL)
@@ -1546,11 +1546,11 @@ out:
1546 return nfs_ok; 1546 return nfs_ok;
1547} 1547}
1548 1548
1549static int 1549static __be32
1550nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) 1550nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp)
1551{ 1551{
1552 struct nfs4_stateid *local; 1552 struct nfs4_stateid *local;
1553 int status = nfserr_share_denied; 1553 __be32 status = nfserr_share_denied;
1554 struct nfs4_stateowner *sop = open->op_stateowner; 1554 struct nfs4_stateowner *sop = open->op_stateowner;
1555 1555
1556 list_for_each_entry(local, &fp->fi_stateids, st_perfile) { 1556 list_for_each_entry(local, &fp->fi_stateids, st_perfile) {
@@ -1575,7 +1575,7 @@ nfs4_alloc_stateid(void)
1575 return kmem_cache_alloc(stateid_slab, GFP_KERNEL); 1575 return kmem_cache_alloc(stateid_slab, GFP_KERNEL);
1576} 1576}
1577 1577
1578static int 1578static __be32
1579nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, 1579nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1580 struct nfs4_delegation *dp, 1580 struct nfs4_delegation *dp,
1581 struct svc_fh *cur_fh, int flags) 1581 struct svc_fh *cur_fh, int flags)
@@ -1590,7 +1590,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1590 get_file(dp->dl_vfs_file); 1590 get_file(dp->dl_vfs_file);
1591 stp->st_vfs_file = dp->dl_vfs_file; 1591 stp->st_vfs_file = dp->dl_vfs_file;
1592 } else { 1592 } else {
1593 int status; 1593 __be32 status;
1594 status = nfsd_open(rqstp, cur_fh, S_IFREG, flags, 1594 status = nfsd_open(rqstp, cur_fh, S_IFREG, flags,
1595 &stp->st_vfs_file); 1595 &stp->st_vfs_file);
1596 if (status) { 1596 if (status) {
@@ -1604,7 +1604,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1604 return 0; 1604 return 0;
1605} 1605}
1606 1606
1607static inline int 1607static inline __be32
1608nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, 1608nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
1609 struct nfsd4_open *open) 1609 struct nfsd4_open *open)
1610{ 1610{
@@ -1619,22 +1619,22 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
1619 return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); 1619 return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0);
1620} 1620}
1621 1621
1622static int 1622static __be32
1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) 1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open)
1624{ 1624{
1625 struct file *filp = stp->st_vfs_file; 1625 struct file *filp = stp->st_vfs_file;
1626 struct inode *inode = filp->f_dentry->d_inode; 1626 struct inode *inode = filp->f_dentry->d_inode;
1627 unsigned int share_access, new_writer; 1627 unsigned int share_access, new_writer;
1628 int status; 1628 __be32 status;
1629 1629
1630 set_access(&share_access, stp->st_access_bmap); 1630 set_access(&share_access, stp->st_access_bmap);
1631 new_writer = (~share_access) & open->op_share_access 1631 new_writer = (~share_access) & open->op_share_access
1632 & NFS4_SHARE_ACCESS_WRITE; 1632 & NFS4_SHARE_ACCESS_WRITE;
1633 1633
1634 if (new_writer) { 1634 if (new_writer) {
1635 status = get_write_access(inode); 1635 int err = get_write_access(inode);
1636 if (status) 1636 if (err)
1637 return nfserrno(status); 1637 return nfserrno(err);
1638 } 1638 }
1639 status = nfsd4_truncate(rqstp, cur_fh, open); 1639 status = nfsd4_truncate(rqstp, cur_fh, open);
1640 if (status) { 1640 if (status) {
@@ -1738,14 +1738,14 @@ out:
1738/* 1738/*
1739 * called with nfs4_lock_state() held. 1739 * called with nfs4_lock_state() held.
1740 */ 1740 */
1741int 1741__be32
1742nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 1742nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
1743{ 1743{
1744 struct nfs4_file *fp = NULL; 1744 struct nfs4_file *fp = NULL;
1745 struct inode *ino = current_fh->fh_dentry->d_inode; 1745 struct inode *ino = current_fh->fh_dentry->d_inode;
1746 struct nfs4_stateid *stp = NULL; 1746 struct nfs4_stateid *stp = NULL;
1747 struct nfs4_delegation *dp = NULL; 1747 struct nfs4_delegation *dp = NULL;
1748 int status; 1748 __be32 status;
1749 1749
1750 status = nfserr_inval; 1750 status = nfserr_inval;
1751 if (!access_valid(open->op_share_access) 1751 if (!access_valid(open->op_share_access)
@@ -1833,11 +1833,11 @@ static struct work_struct laundromat_work;
1833static void laundromat_main(void *); 1833static void laundromat_main(void *);
1834static DECLARE_WORK(laundromat_work, laundromat_main, NULL); 1834static DECLARE_WORK(laundromat_work, laundromat_main, NULL);
1835 1835
1836int 1836__be32
1837nfsd4_renew(clientid_t *clid) 1837nfsd4_renew(clientid_t *clid)
1838{ 1838{
1839 struct nfs4_client *clp; 1839 struct nfs4_client *clp;
1840 int status; 1840 __be32 status;
1841 1841
1842 nfs4_lock_state(); 1842 nfs4_lock_state();
1843 dprintk("process_renew(%08x/%08x): starting\n", 1843 dprintk("process_renew(%08x/%08x): starting\n",
@@ -1996,9 +1996,9 @@ access_permit_write(unsigned long access_bmap)
1996} 1996}
1997 1997
1998static 1998static
1999int nfs4_check_openmode(struct nfs4_stateid *stp, int flags) 1999__be32 nfs4_check_openmode(struct nfs4_stateid *stp, int flags)
2000{ 2000{
2001 int status = nfserr_openmode; 2001 __be32 status = nfserr_openmode;
2002 2002
2003 if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap))) 2003 if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap)))
2004 goto out; 2004 goto out;
@@ -2009,7 +2009,7 @@ out:
2009 return status; 2009 return status;
2010} 2010}
2011 2011
2012static inline int 2012static inline __be32
2013check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) 2013check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags)
2014{ 2014{
2015 /* Trying to call delegreturn with a special stateid? Yuch: */ 2015 /* Trying to call delegreturn with a special stateid? Yuch: */
@@ -2043,14 +2043,14 @@ io_during_grace_disallowed(struct inode *inode, int flags)
2043/* 2043/*
2044* Checks for stateid operations 2044* Checks for stateid operations
2045*/ 2045*/
2046int 2046__be32
2047nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp) 2047nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp)
2048{ 2048{
2049 struct nfs4_stateid *stp = NULL; 2049 struct nfs4_stateid *stp = NULL;
2050 struct nfs4_delegation *dp = NULL; 2050 struct nfs4_delegation *dp = NULL;
2051 stateid_t *stidp; 2051 stateid_t *stidp;
2052 struct inode *ino = current_fh->fh_dentry->d_inode; 2052 struct inode *ino = current_fh->fh_dentry->d_inode;
2053 int status; 2053 __be32 status;
2054 2054
2055 dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n", 2055 dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n",
2056 stateid->si_boot, stateid->si_stateownerid, 2056 stateid->si_boot, stateid->si_stateownerid,
@@ -2125,7 +2125,7 @@ setlkflg (int type)
2125/* 2125/*
2126 * Checks for sequence id mutating operations. 2126 * Checks for sequence id mutating operations.
2127 */ 2127 */
2128static int 2128static __be32
2129nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock) 2129nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock)
2130{ 2130{
2131 struct nfs4_stateid *stp; 2131 struct nfs4_stateid *stp;
@@ -2169,7 +2169,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2169 clientid_t *lockclid = &lock->v.new.clientid; 2169 clientid_t *lockclid = &lock->v.new.clientid;
2170 struct nfs4_client *clp = sop->so_client; 2170 struct nfs4_client *clp = sop->so_client;
2171 int lkflg = 0; 2171 int lkflg = 0;
2172 int status; 2172 __be32 status;
2173 2173
2174 lkflg = setlkflg(lock->lk_type); 2174 lkflg = setlkflg(lock->lk_type);
2175 2175
@@ -2233,7 +2233,7 @@ check_replay:
2233 if (seqid == sop->so_seqid - 1) { 2233 if (seqid == sop->so_seqid - 1) {
2234 dprintk("NFSD: preprocess_seqid_op: retransmission?\n"); 2234 dprintk("NFSD: preprocess_seqid_op: retransmission?\n");
2235 /* indicate replay to calling function */ 2235 /* indicate replay to calling function */
2236 return NFSERR_REPLAY_ME; 2236 return nfserr_replay_me;
2237 } 2237 }
2238 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", 2238 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n",
2239 sop->so_seqid, seqid); 2239 sop->so_seqid, seqid);
@@ -2241,10 +2241,10 @@ check_replay:
2241 return nfserr_bad_seqid; 2241 return nfserr_bad_seqid;
2242} 2242}
2243 2243
2244int 2244__be32
2245nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner) 2245nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner)
2246{ 2246{
2247 int status; 2247 __be32 status;
2248 struct nfs4_stateowner *sop; 2248 struct nfs4_stateowner *sop;
2249 struct nfs4_stateid *stp; 2249 struct nfs4_stateid *stp;
2250 2250
@@ -2310,10 +2310,10 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap)
2310 } 2310 }
2311} 2311}
2312 2312
2313int 2313__be32
2314nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner) 2314nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner)
2315{ 2315{
2316 int status; 2316 __be32 status;
2317 struct nfs4_stateid *stp; 2317 struct nfs4_stateid *stp;
2318 unsigned int share_access; 2318 unsigned int share_access;
2319 2319
@@ -2365,10 +2365,10 @@ out:
2365/* 2365/*
2366 * nfs4_unlock_state() called after encode 2366 * nfs4_unlock_state() called after encode
2367 */ 2367 */
2368int 2368__be32
2369nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) 2369nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner)
2370{ 2370{
2371 int status; 2371 __be32 status;
2372 struct nfs4_stateid *stp; 2372 struct nfs4_stateid *stp;
2373 2373
2374 dprintk("NFSD: nfsd4_close on file %.*s\n", 2374 dprintk("NFSD: nfsd4_close on file %.*s\n",
@@ -2404,10 +2404,10 @@ out:
2404 return status; 2404 return status;
2405} 2405}
2406 2406
2407int 2407__be32
2408nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr) 2408nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr)
2409{ 2409{
2410 int status; 2410 __be32 status;
2411 2411
2412 if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) 2412 if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0)))
2413 goto out; 2413 goto out;
@@ -2635,7 +2635,7 @@ check_lock_length(u64 offset, u64 length)
2635/* 2635/*
2636 * LOCK operation 2636 * LOCK operation
2637 */ 2637 */
2638int 2638__be32
2639nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) 2639nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner)
2640{ 2640{
2641 struct nfs4_stateowner *open_sop = NULL; 2641 struct nfs4_stateowner *open_sop = NULL;
@@ -2644,8 +2644,9 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2644 struct file *filp; 2644 struct file *filp;
2645 struct file_lock file_lock; 2645 struct file_lock file_lock;
2646 struct file_lock conflock; 2646 struct file_lock conflock;
2647 int status = 0; 2647 __be32 status = 0;
2648 unsigned int strhashval; 2648 unsigned int strhashval;
2649 int err;
2649 2650
2650 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", 2651 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
2651 (long long) lock->lk_offset, 2652 (long long) lock->lk_offset,
@@ -2758,13 +2759,14 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2758 * locks_copy_lock: */ 2759 * locks_copy_lock: */
2759 conflock.fl_ops = NULL; 2760 conflock.fl_ops = NULL;
2760 conflock.fl_lmops = NULL; 2761 conflock.fl_lmops = NULL;
2761 status = posix_lock_file_conf(filp, &file_lock, &conflock); 2762 err = posix_lock_file_conf(filp, &file_lock, &conflock);
2762 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status); 2763 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status);
2763 switch (-status) { 2764 switch (-err) {
2764 case 0: /* success! */ 2765 case 0: /* success! */
2765 update_stateid(&lock_stp->st_stateid); 2766 update_stateid(&lock_stp->st_stateid);
2766 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid, 2767 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid,
2767 sizeof(stateid_t)); 2768 sizeof(stateid_t));
2769 status = 0;
2768 break; 2770 break;
2769 case (EAGAIN): /* conflock holds conflicting lock */ 2771 case (EAGAIN): /* conflock holds conflicting lock */
2770 status = nfserr_denied; 2772 status = nfserr_denied;
@@ -2775,7 +2777,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2775 status = nfserr_deadlock; 2777 status = nfserr_deadlock;
2776 break; 2778 break;
2777 default: 2779 default:
2778 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",status); 2780 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err);
2779 status = nfserr_resource; 2781 status = nfserr_resource;
2780 break; 2782 break;
2781 } 2783 }
@@ -2793,14 +2795,14 @@ out:
2793/* 2795/*
2794 * LOCKT operation 2796 * LOCKT operation
2795 */ 2797 */
2796int 2798__be32
2797nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt) 2799nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt)
2798{ 2800{
2799 struct inode *inode; 2801 struct inode *inode;
2800 struct file file; 2802 struct file file;
2801 struct file_lock file_lock; 2803 struct file_lock file_lock;
2802 struct file_lock conflock; 2804 struct file_lock conflock;
2803 int status; 2805 __be32 status;
2804 2806
2805 if (nfs4_in_grace()) 2807 if (nfs4_in_grace())
2806 return nfserr_grace; 2808 return nfserr_grace;
@@ -2873,13 +2875,14 @@ out:
2873 return status; 2875 return status;
2874} 2876}
2875 2877
2876int 2878__be32
2877nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) 2879nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner)
2878{ 2880{
2879 struct nfs4_stateid *stp; 2881 struct nfs4_stateid *stp;
2880 struct file *filp = NULL; 2882 struct file *filp = NULL;
2881 struct file_lock file_lock; 2883 struct file_lock file_lock;
2882 int status; 2884 __be32 status;
2885 int err;
2883 2886
2884 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", 2887 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n",
2885 (long long) locku->lu_offset, 2888 (long long) locku->lu_offset,
@@ -2917,8 +2920,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2917 /* 2920 /*
2918 * Try to unlock the file in the VFS. 2921 * Try to unlock the file in the VFS.
2919 */ 2922 */
2920 status = posix_lock_file(filp, &file_lock); 2923 err = posix_lock_file(filp, &file_lock);
2921 if (status) { 2924 if (err) {
2922 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); 2925 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n");
2923 goto out_nfserr; 2926 goto out_nfserr;
2924 } 2927 }
@@ -2937,7 +2940,7 @@ out:
2937 return status; 2940 return status;
2938 2941
2939out_nfserr: 2942out_nfserr:
2940 status = nfserrno(status); 2943 status = nfserrno(err);
2941 goto out; 2944 goto out;
2942} 2945}
2943 2946
@@ -2965,7 +2968,7 @@ out:
2965 return status; 2968 return status;
2966} 2969}
2967 2970
2968int 2971__be32
2969nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner) 2972nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner)
2970{ 2973{
2971 clientid_t *clid = &rlockowner->rl_clientid; 2974 clientid_t *clid = &rlockowner->rl_clientid;
@@ -2974,7 +2977,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *
2974 struct xdr_netobj *owner = &rlockowner->rl_owner; 2977 struct xdr_netobj *owner = &rlockowner->rl_owner;
2975 struct list_head matches; 2978 struct list_head matches;
2976 int i; 2979 int i;
2977 int status; 2980 __be32 status;
2978 2981
2979 dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", 2982 dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
2980 clid->cl_boot, clid->cl_id); 2983 clid->cl_boot, clid->cl_id);
@@ -3111,7 +3114,7 @@ nfs4_find_reclaim_client(clientid_t *clid)
3111/* 3114/*
3112* Called from OPEN. Look for clientid in reclaim list. 3115* Called from OPEN. Look for clientid in reclaim list.
3113*/ 3116*/
3114int 3117__be32
3115nfs4_check_open_reclaim(clientid_t *clid) 3118nfs4_check_open_reclaim(clientid_t *clid)
3116{ 3119{
3117 return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; 3120 return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 41fc241b729a..f3f239db04bb 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -68,8 +68,8 @@
68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL 68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL
69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL 69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL
70 70
71static int 71static __be32
72check_filename(char *str, int len, int err) 72check_filename(char *str, int len, __be32 err)
73{ 73{
74 int i; 74 int i;
75 75
@@ -94,8 +94,8 @@ check_filename(char *str, int len, int err)
94 * consistent with the style used in NFSv2/v3... 94 * consistent with the style used in NFSv2/v3...
95 */ 95 */
96#define DECODE_HEAD \ 96#define DECODE_HEAD \
97 u32 *p; \ 97 __be32 *p; \
98 int status 98 __be32 status
99#define DECODE_TAIL \ 99#define DECODE_TAIL \
100 status = 0; \ 100 status = 0; \
101out: \ 101out: \
@@ -144,13 +144,13 @@ xdr_error: \
144 } \ 144 } \
145} while (0) 145} while (0)
146 146
147static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) 147static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
148{ 148{
149 /* We want more bytes than seem to be available. 149 /* We want more bytes than seem to be available.
150 * Maybe we need a new page, maybe we have just run out 150 * Maybe we need a new page, maybe we have just run out
151 */ 151 */
152 int avail = (char*)argp->end - (char*)argp->p; 152 int avail = (char*)argp->end - (char*)argp->p;
153 u32 *p; 153 __be32 *p;
154 if (avail + argp->pagelen < nbytes) 154 if (avail + argp->pagelen < nbytes)
155 return NULL; 155 return NULL;
156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ 156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */
@@ -197,7 +197,7 @@ defer_free(struct nfsd4_compoundargs *argp,
197 return 0; 197 return 0;
198} 198}
199 199
200static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) 200static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes)
201{ 201{
202 void *new = NULL; 202 void *new = NULL;
203 if (p == argp->tmp) { 203 if (p == argp->tmp) {
@@ -217,7 +217,7 @@ static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes)
217} 217}
218 218
219 219
220static int 220static __be32
221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) 221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
222{ 222{
223 u32 bmlen; 223 u32 bmlen;
@@ -240,13 +240,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
240 DECODE_TAIL; 240 DECODE_TAIL;
241} 241}
242 242
243static int 243static __be32
244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, 244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr,
245 struct nfs4_acl **acl) 245 struct nfs4_acl **acl)
246{ 246{
247 int expected_len, len = 0; 247 int expected_len, len = 0;
248 u32 dummy32; 248 u32 dummy32;
249 char *buf; 249 char *buf;
250 int host_err;
250 251
251 DECODE_HEAD; 252 DECODE_HEAD;
252 iattr->ia_valid = 0; 253 iattr->ia_valid = 0;
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
280 281
281 *acl = nfs4_acl_new(); 282 *acl = nfs4_acl_new();
282 if (*acl == NULL) { 283 if (*acl == NULL) {
283 status = -ENOMEM; 284 host_err = -ENOMEM;
284 goto out_nfserr; 285 goto out_nfserr;
285 } 286 }
286 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); 287 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl);
@@ -295,20 +296,20 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
295 len += XDR_QUADLEN(dummy32) << 2; 296 len += XDR_QUADLEN(dummy32) << 2;
296 READMEM(buf, dummy32); 297 READMEM(buf, dummy32);
297 ace.whotype = nfs4_acl_get_whotype(buf, dummy32); 298 ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
298 status = 0; 299 host_err = 0;
299 if (ace.whotype != NFS4_ACL_WHO_NAMED) 300 if (ace.whotype != NFS4_ACL_WHO_NAMED)
300 ace.who = 0; 301 ace.who = 0;
301 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) 302 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
302 status = nfsd_map_name_to_gid(argp->rqstp, 303 host_err = nfsd_map_name_to_gid(argp->rqstp,
303 buf, dummy32, &ace.who); 304 buf, dummy32, &ace.who);
304 else 305 else
305 status = nfsd_map_name_to_uid(argp->rqstp, 306 host_err = nfsd_map_name_to_uid(argp->rqstp,
306 buf, dummy32, &ace.who); 307 buf, dummy32, &ace.who);
307 if (status) 308 if (host_err)
308 goto out_nfserr; 309 goto out_nfserr;
309 status = nfs4_acl_add_ace(*acl, ace.type, ace.flag, 310 host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
310 ace.access_mask, ace.whotype, ace.who); 311 ace.access_mask, ace.whotype, ace.who);
311 if (status) 312 if (host_err)
312 goto out_nfserr; 313 goto out_nfserr;
313 } 314 }
314 } else 315 } else
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
327 READ_BUF(dummy32); 328 READ_BUF(dummy32);
328 len += (XDR_QUADLEN(dummy32) << 2); 329 len += (XDR_QUADLEN(dummy32) << 2);
329 READMEM(buf, dummy32); 330 READMEM(buf, dummy32);
330 if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) 331 if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
331 goto out_nfserr; 332 goto out_nfserr;
332 iattr->ia_valid |= ATTR_UID; 333 iattr->ia_valid |= ATTR_UID;
333 } 334 }
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
338 READ_BUF(dummy32); 339 READ_BUF(dummy32);
339 len += (XDR_QUADLEN(dummy32) << 2); 340 len += (XDR_QUADLEN(dummy32) << 2);
340 READMEM(buf, dummy32); 341 READMEM(buf, dummy32);
341 if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) 342 if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
342 goto out_nfserr; 343 goto out_nfserr;
343 iattr->ia_valid |= ATTR_GID; 344 iattr->ia_valid |= ATTR_GID;
344 } 345 }
@@ -414,11 +415,11 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
414 DECODE_TAIL; 415 DECODE_TAIL;
415 416
416out_nfserr: 417out_nfserr:
417 status = nfserrno(status); 418 status = nfserrno(host_err);
418 goto out; 419 goto out;
419} 420}
420 421
421static int 422static __be32
422nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) 423nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access)
423{ 424{
424 DECODE_HEAD; 425 DECODE_HEAD;
@@ -429,7 +430,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access
429 DECODE_TAIL; 430 DECODE_TAIL;
430} 431}
431 432
432static int 433static __be32
433nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) 434nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
434{ 435{
435 DECODE_HEAD; 436 DECODE_HEAD;
@@ -444,7 +445,7 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
444} 445}
445 446
446 447
447static int 448static __be32
448nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) 449nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
449{ 450{
450 DECODE_HEAD; 451 DECODE_HEAD;
@@ -456,7 +457,7 @@ nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit
456 DECODE_TAIL; 457 DECODE_TAIL;
457} 458}
458 459
459static int 460static __be32
460nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) 461nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create)
461{ 462{
462 DECODE_HEAD; 463 DECODE_HEAD;
@@ -496,7 +497,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
496 DECODE_TAIL; 497 DECODE_TAIL;
497} 498}
498 499
499static inline int 500static inline __be32
500nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) 501nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
501{ 502{
502 DECODE_HEAD; 503 DECODE_HEAD;
@@ -508,13 +509,13 @@ nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegretu
508 DECODE_TAIL; 509 DECODE_TAIL;
509} 510}
510 511
511static inline int 512static inline __be32
512nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr) 513nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
513{ 514{
514 return nfsd4_decode_bitmap(argp, getattr->ga_bmval); 515 return nfsd4_decode_bitmap(argp, getattr->ga_bmval);
515} 516}
516 517
517static int 518static __be32
518nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) 519nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
519{ 520{
520 DECODE_HEAD; 521 DECODE_HEAD;
@@ -529,7 +530,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
529 DECODE_TAIL; 530 DECODE_TAIL;
530} 531}
531 532
532static int 533static __be32
533nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) 534nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
534{ 535{
535 DECODE_HEAD; 536 DECODE_HEAD;
@@ -568,7 +569,7 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
568 DECODE_TAIL; 569 DECODE_TAIL;
569} 570}
570 571
571static int 572static __be32
572nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) 573nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
573{ 574{
574 DECODE_HEAD; 575 DECODE_HEAD;
@@ -587,7 +588,7 @@ nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
587 DECODE_TAIL; 588 DECODE_TAIL;
588} 589}
589 590
590static int 591static __be32
591nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) 592nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
592{ 593{
593 DECODE_HEAD; 594 DECODE_HEAD;
@@ -606,7 +607,7 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
606 DECODE_TAIL; 607 DECODE_TAIL;
607} 608}
608 609
609static int 610static __be32
610nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup) 611nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup)
611{ 612{
612 DECODE_HEAD; 613 DECODE_HEAD;
@@ -621,7 +622,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup
621 DECODE_TAIL; 622 DECODE_TAIL;
622} 623}
623 624
624static int 625static __be32
625nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) 626nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
626{ 627{
627 DECODE_HEAD; 628 DECODE_HEAD;
@@ -699,7 +700,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
699 DECODE_TAIL; 700 DECODE_TAIL;
700} 701}
701 702
702static int 703static __be32
703nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf) 704nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf)
704{ 705{
705 DECODE_HEAD; 706 DECODE_HEAD;
@@ -713,7 +714,7 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
713 DECODE_TAIL; 714 DECODE_TAIL;
714} 715}
715 716
716static int 717static __be32
717nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down) 718nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down)
718{ 719{
719 DECODE_HEAD; 720 DECODE_HEAD;
@@ -729,7 +730,7 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
729 DECODE_TAIL; 730 DECODE_TAIL;
730} 731}
731 732
732static int 733static __be32
733nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) 734nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
734{ 735{
735 DECODE_HEAD; 736 DECODE_HEAD;
@@ -744,7 +745,7 @@ nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
744 DECODE_TAIL; 745 DECODE_TAIL;
745} 746}
746 747
747static int 748static __be32
748nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) 749nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
749{ 750{
750 DECODE_HEAD; 751 DECODE_HEAD;
@@ -758,7 +759,7 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
758 DECODE_TAIL; 759 DECODE_TAIL;
759} 760}
760 761
761static int 762static __be32
762nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir) 763nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir)
763{ 764{
764 DECODE_HEAD; 765 DECODE_HEAD;
@@ -774,7 +775,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
774 DECODE_TAIL; 775 DECODE_TAIL;
775} 776}
776 777
777static int 778static __be32
778nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) 779nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
779{ 780{
780 DECODE_HEAD; 781 DECODE_HEAD;
@@ -789,7 +790,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove
789 DECODE_TAIL; 790 DECODE_TAIL;
790} 791}
791 792
792static int 793static __be32
793nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename) 794nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename)
794{ 795{
795 DECODE_HEAD; 796 DECODE_HEAD;
@@ -809,7 +810,7 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
809 DECODE_TAIL; 810 DECODE_TAIL;
810} 811}
811 812
812static int 813static __be32
813nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) 814nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
814{ 815{
815 DECODE_HEAD; 816 DECODE_HEAD;
@@ -820,7 +821,7 @@ nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
820 DECODE_TAIL; 821 DECODE_TAIL;
821} 822}
822 823
823static int 824static __be32
824nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) 825nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
825{ 826{
826 DECODE_HEAD; 827 DECODE_HEAD;
@@ -834,7 +835,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta
834 DECODE_TAIL; 835 DECODE_TAIL;
835} 836}
836 837
837static int 838static __be32
838nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid) 839nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid)
839{ 840{
840 DECODE_HEAD; 841 DECODE_HEAD;
@@ -859,7 +860,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
859 DECODE_TAIL; 860 DECODE_TAIL;
860} 861}
861 862
862static int 863static __be32
863nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c) 864nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c)
864{ 865{
865 DECODE_HEAD; 866 DECODE_HEAD;
@@ -872,7 +873,7 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s
872} 873}
873 874
874/* Also used for NVERIFY */ 875/* Also used for NVERIFY */
875static int 876static __be32
876nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) 877nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
877{ 878{
878#if 0 879#if 0
@@ -908,7 +909,7 @@ nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify
908 DECODE_TAIL; 909 DECODE_TAIL;
909} 910}
910 911
911static int 912static __be32
912nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) 913nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
913{ 914{
914 int avail; 915 int avail;
@@ -951,15 +952,15 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
951 argp->pagelen -= len; 952 argp->pagelen -= len;
952 } 953 }
953 } 954 }
954 argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); 955 argp->end = (__be32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len);
955 argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); 956 argp->p = (__be32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2));
956 argp->rqstp->rq_vec[v].iov_len = len; 957 argp->rqstp->rq_vec[v].iov_len = len;
957 write->wr_vlen = v+1; 958 write->wr_vlen = v+1;
958 959
959 DECODE_TAIL; 960 DECODE_TAIL;
960} 961}
961 962
962static int 963static __be32
963nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner) 964nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
964{ 965{
965 DECODE_HEAD; 966 DECODE_HEAD;
@@ -973,7 +974,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
973 DECODE_TAIL; 974 DECODE_TAIL;
974} 975}
975 976
976static int 977static __be32
977nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 978nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
978{ 979{
979 DECODE_HEAD; 980 DECODE_HEAD;
@@ -1179,7 +1180,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1179 * task to translate them into Linux-specific versions which are more 1180 * task to translate them into Linux-specific versions which are more
1180 * consistent with the style used in NFSv2/v3... 1181 * consistent with the style used in NFSv2/v3...
1181 */ 1182 */
1182#define ENCODE_HEAD u32 *p 1183#define ENCODE_HEAD __be32 *p
1183 1184
1184#define WRITE32(n) *p++ = htonl(n) 1185#define WRITE32(n) *p++ = htonl(n)
1185#define WRITE64(n) do { \ 1186#define WRITE64(n) do { \
@@ -1209,8 +1210,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1209 * Header routine to setup seqid operation replay cache 1210 * Header routine to setup seqid operation replay cache
1210 */ 1211 */
1211#define ENCODE_SEQID_OP_HEAD \ 1212#define ENCODE_SEQID_OP_HEAD \
1212 u32 *p; \ 1213 __be32 *p; \
1213 u32 *save; \ 1214 __be32 *save; \
1214 \ 1215 \
1215 save = resp->p; 1216 save = resp->p;
1216 1217
@@ -1234,11 +1235,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1234/* Encode as an array of strings the string given with components 1235/* Encode as an array of strings the string given with components
1235 * seperated @sep. 1236 * seperated @sep.
1236 */ 1237 */
1237static int nfsd4_encode_components(char sep, char *components, 1238static __be32 nfsd4_encode_components(char sep, char *components,
1238 u32 **pp, int *buflen) 1239 __be32 **pp, int *buflen)
1239{ 1240{
1240 u32 *p = *pp; 1241 __be32 *p = *pp;
1241 u32 *countp = p; 1242 __be32 *countp = p;
1242 int strlen, count=0; 1243 int strlen, count=0;
1243 char *str, *end; 1244 char *str, *end;
1244 1245
@@ -1271,11 +1272,11 @@ static int nfsd4_encode_components(char sep, char *components,
1271/* 1272/*
1272 * encode a location element of a fs_locations structure 1273 * encode a location element of a fs_locations structure
1273 */ 1274 */
1274static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, 1275static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1275 u32 **pp, int *buflen) 1276 __be32 **pp, int *buflen)
1276{ 1277{
1277 int status; 1278 __be32 status;
1278 u32 *p = *pp; 1279 __be32 *p = *pp;
1279 1280
1280 status = nfsd4_encode_components(':', location->hosts, &p, buflen); 1281 status = nfsd4_encode_components(':', location->hosts, &p, buflen);
1281 if (status) 1282 if (status)
@@ -1292,16 +1293,15 @@ static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1292 * Returned string is safe to use as long as the caller holds a reference 1293 * Returned string is safe to use as long as the caller holds a reference
1293 * to @exp. 1294 * to @exp.
1294 */ 1295 */
1295static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) 1296static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat)
1296{ 1297{
1297 struct svc_fh tmp_fh; 1298 struct svc_fh tmp_fh;
1298 char *path, *rootpath; 1299 char *path, *rootpath;
1299 int stat;
1300 1300
1301 fh_init(&tmp_fh, NFS4_FHSIZE); 1301 fh_init(&tmp_fh, NFS4_FHSIZE);
1302 stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle); 1302 *stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle);
1303 if (stat) 1303 if (*stat)
1304 return ERR_PTR(stat); 1304 return NULL;
1305 rootpath = tmp_fh.fh_export->ex_path; 1305 rootpath = tmp_fh.fh_export->ex_path;
1306 1306
1307 path = exp->ex_path; 1307 path = exp->ex_path;
@@ -1309,7 +1309,8 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1309 if (strncmp(path, rootpath, strlen(rootpath))) { 1309 if (strncmp(path, rootpath, strlen(rootpath))) {
1310 printk("nfsd: fs_locations failed;" 1310 printk("nfsd: fs_locations failed;"
1311 "%s is not contained in %s\n", path, rootpath); 1311 "%s is not contained in %s\n", path, rootpath);
1312 return ERR_PTR(-EOPNOTSUPP); 1312 *stat = nfserr_notsupp;
1313 return NULL;
1313 } 1314 }
1314 1315
1315 return path + strlen(rootpath); 1316 return path + strlen(rootpath);
@@ -1318,17 +1319,18 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1318/* 1319/*
1319 * encode a fs_locations structure 1320 * encode a fs_locations structure
1320 */ 1321 */
1321static int nfsd4_encode_fs_locations(struct svc_rqst *rqstp, 1322static __be32 nfsd4_encode_fs_locations(struct svc_rqst *rqstp,
1322 struct svc_export *exp, 1323 struct svc_export *exp,
1323 u32 **pp, int *buflen) 1324 __be32 **pp, int *buflen)
1324{ 1325{
1325 int status, i; 1326 __be32 status;
1326 u32 *p = *pp; 1327 int i;
1328 __be32 *p = *pp;
1327 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; 1329 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs;
1328 char *root = nfsd4_path(rqstp, exp); 1330 char *root = nfsd4_path(rqstp, exp, &status);
1329 1331
1330 if (IS_ERR(root)) 1332 if (status)
1331 return PTR_ERR(root); 1333 return status;
1332 status = nfsd4_encode_components('/', root, &p, buflen); 1334 status = nfsd4_encode_components('/', root, &p, buflen);
1333 if (status) 1335 if (status)
1334 return status; 1336 return status;
@@ -1352,9 +1354,9 @@ static u32 nfs4_ftypes[16] = {
1352 NF4SOCK, NF4BAD, NF4LNK, NF4BAD, 1354 NF4SOCK, NF4BAD, NF4LNK, NF4BAD,
1353}; 1355};
1354 1356
1355static int 1357static __be32
1356nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1358nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1357 u32 **p, int *buflen) 1359 __be32 **p, int *buflen)
1358{ 1360{
1359 int status; 1361 int status;
1360 1362
@@ -1374,21 +1376,21 @@ nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1374 return 0; 1376 return 0;
1375} 1377}
1376 1378
1377static inline int 1379static inline __be32
1378nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) 1380nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, __be32 **p, int *buflen)
1379{ 1381{
1380 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); 1382 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen);
1381} 1383}
1382 1384
1383static inline int 1385static inline __be32
1384nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) 1386nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, __be32 **p, int *buflen)
1385{ 1387{
1386 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); 1388 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen);
1387} 1389}
1388 1390
1389static inline int 1391static inline __be32
1390nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1392nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1391 u32 **p, int *buflen) 1393 __be32 **p, int *buflen)
1392{ 1394{
1393 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); 1395 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen);
1394} 1396}
@@ -1397,7 +1399,7 @@ nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1397 FATTR4_WORD0_RDATTR_ERROR) 1399 FATTR4_WORD0_RDATTR_ERROR)
1398#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID 1400#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
1399 1401
1400static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) 1402static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1401{ 1403{
1402 /* As per referral draft: */ 1404 /* As per referral draft: */
1403 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || 1405 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||
@@ -1420,9 +1422,9 @@ static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1420 * @countp is the buffer size in _words_; upon successful return this becomes 1422 * @countp is the buffer size in _words_; upon successful return this becomes
1421 * replaced with the number of words written. 1423 * replaced with the number of words written.
1422 */ 1424 */
1423int 1425__be32
1424nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 1426nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1425 struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval, 1427 struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval,
1426 struct svc_rqst *rqstp) 1428 struct svc_rqst *rqstp)
1427{ 1429{
1428 u32 bmval0 = bmval[0]; 1430 u32 bmval0 = bmval[0];
@@ -1431,12 +1433,13 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1431 struct svc_fh tempfh; 1433 struct svc_fh tempfh;
1432 struct kstatfs statfs; 1434 struct kstatfs statfs;
1433 int buflen = *countp << 2; 1435 int buflen = *countp << 2;
1434 u32 *attrlenp; 1436 __be32 *attrlenp;
1435 u32 dummy; 1437 u32 dummy;
1436 u64 dummy64; 1438 u64 dummy64;
1437 u32 rdattr_err = 0; 1439 u32 rdattr_err = 0;
1438 u32 *p = buffer; 1440 __be32 *p = buffer;
1439 int status; 1441 __be32 status;
1442 int err;
1440 int aclsupport = 0; 1443 int aclsupport = 0;
1441 struct nfs4_acl *acl = NULL; 1444 struct nfs4_acl *acl = NULL;
1442 1445
@@ -1450,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1450 goto out; 1453 goto out;
1451 } 1454 }
1452 1455
1453 status = vfs_getattr(exp->ex_mnt, dentry, &stat); 1456 err = vfs_getattr(exp->ex_mnt, dentry, &stat);
1454 if (status) 1457 if (err)
1455 goto out_nfserr; 1458 goto out_nfserr;
1456 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || 1459 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
1457 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | 1460 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1458 FATTR4_WORD1_SPACE_TOTAL))) { 1461 FATTR4_WORD1_SPACE_TOTAL))) {
1459 status = vfs_statfs(dentry, &statfs); 1462 err = vfs_statfs(dentry, &statfs);
1460 if (status) 1463 if (err)
1461 goto out_nfserr; 1464 goto out_nfserr;
1462 } 1465 }
1463 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { 1466 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
@@ -1469,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1469 } 1472 }
1470 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT 1473 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
1471 | FATTR4_WORD0_SUPPORTED_ATTRS)) { 1474 | FATTR4_WORD0_SUPPORTED_ATTRS)) {
1472 status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); 1475 err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
1473 aclsupport = (status == 0); 1476 aclsupport = (err == 0);
1474 if (bmval0 & FATTR4_WORD0_ACL) { 1477 if (bmval0 & FATTR4_WORD0_ACL) {
1475 if (status == -EOPNOTSUPP) 1478 if (err == -EOPNOTSUPP)
1476 bmval0 &= ~FATTR4_WORD0_ACL; 1479 bmval0 &= ~FATTR4_WORD0_ACL;
1477 else if (status == -EINVAL) { 1480 else if (err == -EINVAL) {
1478 status = nfserr_attrnotsupp; 1481 status = nfserr_attrnotsupp;
1479 goto out; 1482 goto out;
1480 } else if (status != 0) 1483 } else if (err != 0)
1481 goto out_nfserr; 1484 goto out_nfserr;
1482 } 1485 }
1483 } 1486 }
@@ -1817,7 +1820,7 @@ out:
1817 fh_put(&tempfh); 1820 fh_put(&tempfh);
1818 return status; 1821 return status;
1819out_nfserr: 1822out_nfserr:
1820 status = nfserrno(status); 1823 status = nfserrno(err);
1821 goto out; 1824 goto out;
1822out_resource: 1825out_resource:
1823 *countp = 0; 1826 *countp = 0;
@@ -1828,13 +1831,13 @@ out_serverfault:
1828 goto out; 1831 goto out;
1829} 1832}
1830 1833
1831static int 1834static __be32
1832nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, 1835nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
1833 const char *name, int namlen, u32 *p, int *buflen) 1836 const char *name, int namlen, __be32 *p, int *buflen)
1834{ 1837{
1835 struct svc_export *exp = cd->rd_fhp->fh_export; 1838 struct svc_export *exp = cd->rd_fhp->fh_export;
1836 struct dentry *dentry; 1839 struct dentry *dentry;
1837 int nfserr; 1840 __be32 nfserr;
1838 1841
1839 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); 1842 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
1840 if (IS_ERR(dentry)) 1843 if (IS_ERR(dentry))
@@ -1863,10 +1866,10 @@ out_put:
1863 return nfserr; 1866 return nfserr;
1864} 1867}
1865 1868
1866static u32 * 1869static __be32 *
1867nfsd4_encode_rdattr_error(u32 *p, int buflen, int nfserr) 1870nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
1868{ 1871{
1869 u32 *attrlenp; 1872 __be32 *attrlenp;
1870 1873
1871 if (buflen < 6) 1874 if (buflen < 6)
1872 return NULL; 1875 return NULL;
@@ -1886,8 +1889,8 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
1886{ 1889{
1887 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); 1890 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
1888 int buflen; 1891 int buflen;
1889 u32 *p = cd->buffer; 1892 __be32 *p = cd->buffer;
1890 int nfserr = nfserr_toosmall; 1893 __be32 nfserr = nfserr_toosmall;
1891 1894
1892 /* In nfsv4, "." and ".." never make it onto the wire.. */ 1895 /* In nfsv4, "." and ".." never make it onto the wire.. */
1893 if (name && isdotent(name, namlen)) { 1896 if (name && isdotent(name, namlen)) {
@@ -1943,7 +1946,7 @@ fail:
1943} 1946}
1944 1947
1945static void 1948static void
1946nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_access *access) 1949nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
1947{ 1950{
1948 ENCODE_HEAD; 1951 ENCODE_HEAD;
1949 1952
@@ -1956,7 +1959,7 @@ nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_acc
1956} 1959}
1957 1960
1958static void 1961static void
1959nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_close *close) 1962nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_close *close)
1960{ 1963{
1961 ENCODE_SEQID_OP_HEAD; 1964 ENCODE_SEQID_OP_HEAD;
1962 1965
@@ -1971,7 +1974,7 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos
1971 1974
1972 1975
1973static void 1976static void
1974nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_commit *commit) 1977nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
1975{ 1978{
1976 ENCODE_HEAD; 1979 ENCODE_HEAD;
1977 1980
@@ -1983,7 +1986,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com
1983} 1986}
1984 1987
1985static void 1988static void
1986nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_create *create) 1989nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create)
1987{ 1990{
1988 ENCODE_HEAD; 1991 ENCODE_HEAD;
1989 1992
@@ -1997,8 +2000,8 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_cre
1997 } 2000 }
1998} 2001}
1999 2002
2000static int 2003static __be32
2001nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_getattr *getattr) 2004nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_getattr *getattr)
2002{ 2005{
2003 struct svc_fh *fhp = getattr->ga_fhp; 2006 struct svc_fh *fhp = getattr->ga_fhp;
2004 int buflen; 2007 int buflen;
@@ -2016,7 +2019,7 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ge
2016} 2019}
2017 2020
2018static void 2021static void
2019nfsd4_encode_getfh(struct nfsd4_compoundres *resp, int nfserr, struct svc_fh *fhp) 2022nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh *fhp)
2020{ 2023{
2021 unsigned int len; 2024 unsigned int len;
2022 ENCODE_HEAD; 2025 ENCODE_HEAD;
@@ -2056,7 +2059,7 @@ nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denie
2056} 2059}
2057 2060
2058static void 2061static void
2059nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock *lock) 2062nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lock *lock)
2060{ 2063{
2061 ENCODE_SEQID_OP_HEAD; 2064 ENCODE_SEQID_OP_HEAD;
2062 2065
@@ -2072,14 +2075,14 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2072} 2075}
2073 2076
2074static void 2077static void
2075nfsd4_encode_lockt(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lockt *lockt) 2078nfsd4_encode_lockt(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lockt *lockt)
2076{ 2079{
2077 if (nfserr == nfserr_denied) 2080 if (nfserr == nfserr_denied)
2078 nfsd4_encode_lock_denied(resp, &lockt->lt_denied); 2081 nfsd4_encode_lock_denied(resp, &lockt->lt_denied);
2079} 2082}
2080 2083
2081static void 2084static void
2082nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_locku *locku) 2085nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_locku *locku)
2083{ 2086{
2084 ENCODE_SEQID_OP_HEAD; 2087 ENCODE_SEQID_OP_HEAD;
2085 2088
@@ -2095,7 +2098,7 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2095 2098
2096 2099
2097static void 2100static void
2098nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link) 2101nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link)
2099{ 2102{
2100 ENCODE_HEAD; 2103 ENCODE_HEAD;
2101 2104
@@ -2108,7 +2111,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link
2108 2111
2109 2112
2110static void 2113static void
2111nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open *open) 2114nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
2112{ 2115{
2113 ENCODE_SEQID_OP_HEAD; 2116 ENCODE_SEQID_OP_HEAD;
2114 2117
@@ -2173,7 +2176,7 @@ out:
2173} 2176}
2174 2177
2175static void 2178static void
2176nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_confirm *oc) 2179nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc)
2177{ 2180{
2178 ENCODE_SEQID_OP_HEAD; 2181 ENCODE_SEQID_OP_HEAD;
2179 2182
@@ -2188,7 +2191,7 @@ nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfs
2188} 2191}
2189 2192
2190static void 2193static void
2191nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_downgrade *od) 2194nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
2192{ 2195{
2193 ENCODE_SEQID_OP_HEAD; 2196 ENCODE_SEQID_OP_HEAD;
2194 2197
@@ -2202,8 +2205,8 @@ nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct n
2202 ENCODE_SEQID_OP_TAIL(od->od_stateowner); 2205 ENCODE_SEQID_OP_TAIL(od->od_stateowner);
2203} 2206}
2204 2207
2205static int 2208static __be32
2206nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, 2209nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2207 struct nfsd4_read *read) 2210 struct nfsd4_read *read)
2208{ 2211{
2209 u32 eof; 2212 u32 eof;
@@ -2267,8 +2270,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr,
2267 return 0; 2270 return 0;
2268} 2271}
2269 2272
2270static int 2273static __be32
2271nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readlink *readlink) 2274nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readlink *readlink)
2272{ 2275{
2273 int maxcount; 2276 int maxcount;
2274 char *page; 2277 char *page;
@@ -2315,12 +2318,12 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2315 return 0; 2318 return 0;
2316} 2319}
2317 2320
2318static int 2321static __be32
2319nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readdir *readdir) 2322nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readdir *readdir)
2320{ 2323{
2321 int maxcount; 2324 int maxcount;
2322 loff_t offset; 2325 loff_t offset;
2323 u32 *page, *savep, *tailbase; 2326 __be32 *page, *savep, *tailbase;
2324 ENCODE_HEAD; 2327 ENCODE_HEAD;
2325 2328
2326 if (nfserr) 2329 if (nfserr)
@@ -2395,7 +2398,7 @@ err_no_verf:
2395} 2398}
2396 2399
2397static void 2400static void
2398nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_remove *remove) 2401nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove)
2399{ 2402{
2400 ENCODE_HEAD; 2403 ENCODE_HEAD;
2401 2404
@@ -2407,7 +2410,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rem
2407} 2410}
2408 2411
2409static void 2412static void
2410nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rename *rename) 2413nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename)
2411{ 2414{
2412 ENCODE_HEAD; 2415 ENCODE_HEAD;
2413 2416
@@ -2424,7 +2427,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ren
2424 * regardless of the error status. 2427 * regardless of the error status.
2425 */ 2428 */
2426static void 2429static void
2427nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setattr *setattr) 2430nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr)
2428{ 2431{
2429 ENCODE_HEAD; 2432 ENCODE_HEAD;
2430 2433
@@ -2443,7 +2446,7 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_se
2443} 2446}
2444 2447
2445static void 2448static void
2446nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setclientid *scd) 2449nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd)
2447{ 2450{
2448 ENCODE_HEAD; 2451 ENCODE_HEAD;
2449 2452
@@ -2462,7 +2465,7 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd
2462} 2465}
2463 2466
2464static void 2467static void
2465nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_write *write) 2468nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write)
2466{ 2469{
2467 ENCODE_HEAD; 2470 ENCODE_HEAD;
2468 2471
@@ -2478,7 +2481,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
2478void 2481void
2479nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) 2482nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2480{ 2483{
2481 u32 *statp; 2484 __be32 *statp;
2482 ENCODE_HEAD; 2485 ENCODE_HEAD;
2483 2486
2484 RESERVE_SPACE(8); 2487 RESERVE_SPACE(8);
@@ -2616,7 +2619,7 @@ nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2616 */ 2619 */
2617 2620
2618int 2621int
2619nfs4svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) 2622nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
2620{ 2623{
2621 return xdr_ressize_check(rqstp, p); 2624 return xdr_ressize_check(rqstp, p);
2622} 2625}
@@ -2638,9 +2641,9 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
2638} 2641}
2639 2642
2640int 2643int
2641nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundargs *args) 2644nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args)
2642{ 2645{
2643 int status; 2646 __be32 status;
2644 2647
2645 args->p = p; 2648 args->p = p;
2646 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len; 2649 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len;
@@ -2659,7 +2662,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoun
2659} 2662}
2660 2663
2661int 2664int
2662nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundres *resp) 2665nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp)
2663{ 2666{
2664 /* 2667 /*
2665 * All that remains is to write the tag and operation count... 2668 * All that remains is to write the tag and operation count...
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index fdf7cf3dfadc..6100bbe27432 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -29,7 +29,7 @@
29 */ 29 */
30#define CACHESIZE 1024 30#define CACHESIZE 1024
31#define HASHSIZE 64 31#define HASHSIZE 64
32#define REQHASH(xid) ((((xid) >> 24) ^ (xid)) & (HASHSIZE-1)) 32#define REQHASH(xid) (((((__force __u32)xid) >> 24) ^ ((__force __u32)xid)) & (HASHSIZE-1))
33 33
34static struct hlist_head * hash_list; 34static struct hlist_head * hash_list;
35static struct list_head lru_head; 35static struct list_head lru_head;
@@ -127,8 +127,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type)
127 struct hlist_node *hn; 127 struct hlist_node *hn;
128 struct hlist_head *rh; 128 struct hlist_head *rh;
129 struct svc_cacherep *rp; 129 struct svc_cacherep *rp;
130 u32 xid = rqstp->rq_xid, 130 __be32 xid = rqstp->rq_xid;
131 proto = rqstp->rq_prot, 131 u32 proto = rqstp->rq_prot,
132 vers = rqstp->rq_vers, 132 vers = rqstp->rq_vers,
133 proc = rqstp->rq_proc; 133 proc = rqstp->rq_proc;
134 unsigned long age; 134 unsigned long age;
@@ -258,7 +258,7 @@ found_entry:
258 * In this case, nfsd_cache_update is called with statp == NULL. 258 * In this case, nfsd_cache_update is called with statp == NULL.
259 */ 259 */
260void 260void
261nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, u32 *statp) 261nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp)
262{ 262{
263 struct svc_cacherep *rp; 263 struct svc_cacherep *rp;
264 struct kvec *resv = &rqstp->rq_res.head[0], *cachv; 264 struct kvec *resv = &rqstp->rq_res.head[0], *cachv;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 501d83884530..727ab3bd450d 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -76,7 +76,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
76 * comment in the NFSv3 spec says this is incorrect (implementation notes for 76 * comment in the NFSv3 spec says this is incorrect (implementation notes for
77 * the write call). 77 * the write call).
78 */ 78 */
79static inline int 79static inline __be32
80nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) 80nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
81{ 81{
82 /* Type can be negative when creating hardlinks - not to a dir */ 82 /* Type can be negative when creating hardlinks - not to a dir */
@@ -110,13 +110,13 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
110 * This is only called at the start of an nfsproc call, so fhp points to 110 * This is only called at the start of an nfsproc call, so fhp points to
111 * a svc_fh which is all 0 except for the over-the-wire file handle. 111 * a svc_fh which is all 0 except for the over-the-wire file handle.
112 */ 112 */
113u32 113__be32
114fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) 114fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
115{ 115{
116 struct knfsd_fh *fh = &fhp->fh_handle; 116 struct knfsd_fh *fh = &fhp->fh_handle;
117 struct svc_export *exp = NULL; 117 struct svc_export *exp = NULL;
118 struct dentry *dentry; 118 struct dentry *dentry;
119 u32 error = 0; 119 __be32 error = 0;
120 120
121 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); 121 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp));
122 122
@@ -315,7 +315,7 @@ static inline void _fh_update_old(struct dentry *dentry,
315 fh->ofh_dirino = 0; 315 fh->ofh_dirino = 0;
316} 316}
317 317
318int 318__be32
319fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) 319fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh)
320{ 320{
321 /* ref_fh is a reference file handle. 321 /* ref_fh is a reference file handle.
@@ -451,7 +451,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
451 * Update file handle information after changing a dentry. 451 * Update file handle information after changing a dentry.
452 * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create 452 * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create
453 */ 453 */
454int 454__be32
455fh_update(struct svc_fh *fhp) 455fh_update(struct svc_fh *fhp)
456{ 456{
457 struct dentry *dentry; 457 struct dentry *dentry;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 9ee1dab5d44a..ec983b777680 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -30,22 +30,22 @@ typedef struct svc_buf svc_buf;
30#define NFSDDBG_FACILITY NFSDDBG_PROC 30#define NFSDDBG_FACILITY NFSDDBG_PROC
31 31
32 32
33static int 33static __be32
34nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 34nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
35{ 35{
36 return nfs_ok; 36 return nfs_ok;
37} 37}
38 38
39static int 39static __be32
40nfsd_return_attrs(int err, struct nfsd_attrstat *resp) 40nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
41{ 41{
42 if (err) return err; 42 if (err) return err;
43 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 43 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
44 resp->fh.fh_dentry, 44 resp->fh.fh_dentry,
45 &resp->stat)); 45 &resp->stat));
46} 46}
47static int 47static __be32
48nfsd_return_dirop(int err, struct nfsd_diropres *resp) 48nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
49{ 49{
50 if (err) return err; 50 if (err) return err;
51 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 51 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
@@ -56,11 +56,11 @@ nfsd_return_dirop(int err, struct nfsd_diropres *resp)
56 * Get a file's attributes 56 * Get a file's attributes
57 * N.B. After this call resp->fh needs an fh_put 57 * N.B. After this call resp->fh needs an fh_put
58 */ 58 */
59static int 59static __be32
60nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 60nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
61 struct nfsd_attrstat *resp) 61 struct nfsd_attrstat *resp)
62{ 62{
63 int nfserr; 63 __be32 nfserr;
64 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 64 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
65 65
66 fh_copy(&resp->fh, &argp->fh); 66 fh_copy(&resp->fh, &argp->fh);
@@ -72,11 +72,11 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
72 * Set a file's attributes 72 * Set a file's attributes
73 * N.B. After this call resp->fh needs an fh_put 73 * N.B. After this call resp->fh needs an fh_put
74 */ 74 */
75static int 75static __be32
76nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, 76nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
77 struct nfsd_attrstat *resp) 77 struct nfsd_attrstat *resp)
78{ 78{
79 int nfserr; 79 __be32 nfserr;
80 dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", 80 dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n",
81 SVCFH_fmt(&argp->fh), 81 SVCFH_fmt(&argp->fh),
82 argp->attrs.ia_valid, (long) argp->attrs.ia_size); 82 argp->attrs.ia_valid, (long) argp->attrs.ia_size);
@@ -92,11 +92,11 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
92 * doesn't exist yet. 92 * doesn't exist yet.
93 * N.B. After this call resp->fh needs an fh_put 93 * N.B. After this call resp->fh needs an fh_put
94 */ 94 */
95static int 95static __be32
96nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 96nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
97 struct nfsd_diropres *resp) 97 struct nfsd_diropres *resp)
98{ 98{
99 int nfserr; 99 __be32 nfserr;
100 100
101 dprintk("nfsd: LOOKUP %s %.*s\n", 101 dprintk("nfsd: LOOKUP %s %.*s\n",
102 SVCFH_fmt(&argp->fh), argp->len, argp->name); 102 SVCFH_fmt(&argp->fh), argp->len, argp->name);
@@ -112,11 +112,11 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
112/* 112/*
113 * Read a symlink. 113 * Read a symlink.
114 */ 114 */
115static int 115static __be32
116nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, 116nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
117 struct nfsd_readlinkres *resp) 117 struct nfsd_readlinkres *resp)
118{ 118{
119 int nfserr; 119 __be32 nfserr;
120 120
121 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); 121 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh));
122 122
@@ -132,11 +132,11 @@ nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
132 * Read a portion of a file. 132 * Read a portion of a file.
133 * N.B. After this call resp->fh needs an fh_put 133 * N.B. After this call resp->fh needs an fh_put
134 */ 134 */
135static int 135static __be32
136nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, 136nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
137 struct nfsd_readres *resp) 137 struct nfsd_readres *resp)
138{ 138{
139 int nfserr; 139 __be32 nfserr;
140 140
141 dprintk("nfsd: READ %s %d bytes at %d\n", 141 dprintk("nfsd: READ %s %d bytes at %d\n",
142 SVCFH_fmt(&argp->fh), 142 SVCFH_fmt(&argp->fh),
@@ -172,11 +172,11 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
172 * Write data to a file 172 * Write data to a file
173 * N.B. After this call resp->fh needs an fh_put 173 * N.B. After this call resp->fh needs an fh_put
174 */ 174 */
175static int 175static __be32
176nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, 176nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
177 struct nfsd_attrstat *resp) 177 struct nfsd_attrstat *resp)
178{ 178{
179 int nfserr; 179 __be32 nfserr;
180 int stable = 1; 180 int stable = 1;
181 181
182 dprintk("nfsd: WRITE %s %d bytes at %d\n", 182 dprintk("nfsd: WRITE %s %d bytes at %d\n",
@@ -197,7 +197,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
197 * and the actual create() call in compliance with VFS protocols. 197 * and the actual create() call in compliance with VFS protocols.
198 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put 198 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put
199 */ 199 */
200static int 200static __be32
201nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 201nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
202 struct nfsd_diropres *resp) 202 struct nfsd_diropres *resp)
203{ 203{
@@ -206,7 +206,8 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
206 struct iattr *attr = &argp->attrs; 206 struct iattr *attr = &argp->attrs;
207 struct inode *inode; 207 struct inode *inode;
208 struct dentry *dchild; 208 struct dentry *dchild;
209 int nfserr, type, mode; 209 int type, mode;
210 __be32 nfserr;
210 dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); 211 dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size);
211 212
212 dprintk("nfsd: CREATE %s %.*s\n", 213 dprintk("nfsd: CREATE %s %.*s\n",
@@ -348,11 +349,11 @@ done:
348 return nfsd_return_dirop(nfserr, resp); 349 return nfsd_return_dirop(nfserr, resp);
349} 350}
350 351
351static int 352static __be32
352nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 353nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
353 void *resp) 354 void *resp)
354{ 355{
355 int nfserr; 356 __be32 nfserr;
356 357
357 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), 358 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh),
358 argp->len, argp->name); 359 argp->len, argp->name);
@@ -363,11 +364,11 @@ nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
363 return nfserr; 364 return nfserr;
364} 365}
365 366
366static int 367static __be32
367nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, 368nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
368 void *resp) 369 void *resp)
369{ 370{
370 int nfserr; 371 __be32 nfserr;
371 372
372 dprintk("nfsd: RENAME %s %.*s -> \n", 373 dprintk("nfsd: RENAME %s %.*s -> \n",
373 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); 374 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname);
@@ -381,11 +382,11 @@ nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
381 return nfserr; 382 return nfserr;
382} 383}
383 384
384static int 385static __be32
385nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, 386nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
386 void *resp) 387 void *resp)
387{ 388{
388 int nfserr; 389 __be32 nfserr;
389 390
390 dprintk("nfsd: LINK %s ->\n", 391 dprintk("nfsd: LINK %s ->\n",
391 SVCFH_fmt(&argp->ffh)); 392 SVCFH_fmt(&argp->ffh));
@@ -401,12 +402,12 @@ nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
401 return nfserr; 402 return nfserr;
402} 403}
403 404
404static int 405static __be32
405nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, 406nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
406 void *resp) 407 void *resp)
407{ 408{
408 struct svc_fh newfh; 409 struct svc_fh newfh;
409 int nfserr; 410 __be32 nfserr;
410 411
411 dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", 412 dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n",
412 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, 413 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname,
@@ -430,11 +431,11 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
430 * Make directory. This operation is not idempotent. 431 * Make directory. This operation is not idempotent.
431 * N.B. After this call resp->fh needs an fh_put 432 * N.B. After this call resp->fh needs an fh_put
432 */ 433 */
433static int 434static __be32
434nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 435nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
435 struct nfsd_diropres *resp) 436 struct nfsd_diropres *resp)
436{ 437{
437 int nfserr; 438 __be32 nfserr;
438 439
439 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 440 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
440 441
@@ -454,11 +455,11 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
454/* 455/*
455 * Remove a directory 456 * Remove a directory
456 */ 457 */
457static int 458static __be32
458nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 459nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
459 void *resp) 460 void *resp)
460{ 461{
461 int nfserr; 462 __be32 nfserr;
462 463
463 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 464 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
464 465
@@ -470,11 +471,12 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
470/* 471/*
471 * Read a portion of a directory. 472 * Read a portion of a directory.
472 */ 473 */
473static int 474static __be32
474nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, 475nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
475 struct nfsd_readdirres *resp) 476 struct nfsd_readdirres *resp)
476{ 477{
477 int nfserr, count; 478 int count;
479 __be32 nfserr;
478 loff_t offset; 480 loff_t offset;
479 481
480 dprintk("nfsd: READDIR %s %d bytes at %d\n", 482 dprintk("nfsd: READDIR %s %d bytes at %d\n",
@@ -509,11 +511,11 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
509/* 511/*
510 * Get file system info 512 * Get file system info
511 */ 513 */
512static int 514static __be32
513nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 515nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
514 struct nfsd_statfsres *resp) 516 struct nfsd_statfsres *resp)
515{ 517{
516 int nfserr; 518 __be32 nfserr;
517 519
518 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); 520 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
519 521
@@ -579,11 +581,11 @@ struct svc_version nfsd_version2 = {
579/* 581/*
580 * Map errnos to NFS errnos. 582 * Map errnos to NFS errnos.
581 */ 583 */
582int 584__be32
583nfserrno (int errno) 585nfserrno (int errno)
584{ 586{
585 static struct { 587 static struct {
586 int nfserr; 588 __be32 nfserr;
587 int syserr; 589 int syserr;
588 } nfs_errtbl[] = { 590 } nfs_errtbl[] = {
589 { nfs_ok, 0 }, 591 { nfs_ok, 0 },
@@ -615,11 +617,10 @@ nfserrno (int errno)
615 { nfserr_badname, -ESRCH }, 617 { nfserr_badname, -ESRCH },
616 { nfserr_io, -ETXTBSY }, 618 { nfserr_io, -ETXTBSY },
617 { nfserr_notsupp, -EOPNOTSUPP }, 619 { nfserr_notsupp, -EOPNOTSUPP },
618 { -1, -EIO }
619 }; 620 };
620 int i; 621 int i;
621 622
622 for (i = 0; nfs_errtbl[i].nfserr != -1; i++) { 623 for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
623 if (nfs_errtbl[i].syserr == errno) 624 if (nfs_errtbl[i].syserr == errno)
624 return nfs_errtbl[i].nfserr; 625 return nfs_errtbl[i].nfserr;
625 } 626 }
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 013b38996e64..0aaccb03bf76 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -491,12 +491,12 @@ out:
491} 491}
492 492
493int 493int
494nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp) 494nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
495{ 495{
496 struct svc_procedure *proc; 496 struct svc_procedure *proc;
497 kxdrproc_t xdr; 497 kxdrproc_t xdr;
498 u32 nfserr; 498 __be32 nfserr;
499 u32 *nfserrp; 499 __be32 *nfserrp;
500 500
501 dprintk("nfsd_dispatch: vers %d proc %d\n", 501 dprintk("nfsd_dispatch: vers %d proc %d\n",
502 rqstp->rq_vers, rqstp->rq_proc); 502 rqstp->rq_vers, rqstp->rq_proc);
@@ -515,7 +515,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
515 515
516 /* Decode arguments */ 516 /* Decode arguments */
517 xdr = proc->pc_decode; 517 xdr = proc->pc_decode;
518 if (xdr && !xdr(rqstp, (u32*)rqstp->rq_arg.head[0].iov_base, 518 if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base,
519 rqstp->rq_argp)) { 519 rqstp->rq_argp)) {
520 dprintk("nfsd: failed to decode arguments!\n"); 520 dprintk("nfsd: failed to decode arguments!\n");
521 nfsd_cache_update(rqstp, RC_NOCACHE, NULL); 521 nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
@@ -528,7 +528,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
528 */ 528 */
529 nfserrp = rqstp->rq_res.head[0].iov_base 529 nfserrp = rqstp->rq_res.head[0].iov_base
530 + rqstp->rq_res.head[0].iov_len; 530 + rqstp->rq_res.head[0].iov_len;
531 rqstp->rq_res.head[0].iov_len += sizeof(u32); 531 rqstp->rq_res.head[0].iov_len += sizeof(__be32);
532 532
533 /* Now call the procedure handler, and encode NFS status. */ 533 /* Now call the procedure handler, and encode NFS status. */
534 nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 534 nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 1135c0d14557..56ebb1443e0e 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -37,8 +37,8 @@ static u32 nfs_ftypes[] = {
37/* 37/*
38 * XDR functions for basic NFS types 38 * XDR functions for basic NFS types
39 */ 39 */
40static u32 * 40static __be32 *
41decode_fh(u32 *p, struct svc_fh *fhp) 41decode_fh(__be32 *p, struct svc_fh *fhp)
42{ 42{
43 fh_init(fhp, NFS_FHSIZE); 43 fh_init(fhp, NFS_FHSIZE);
44 memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE); 44 memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE);
@@ -50,13 +50,13 @@ decode_fh(u32 *p, struct svc_fh *fhp)
50} 50}
51 51
52/* Helper function for NFSv2 ACL code */ 52/* Helper function for NFSv2 ACL code */
53u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp) 53__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp)
54{ 54{
55 return decode_fh(p, fhp); 55 return decode_fh(p, fhp);
56} 56}
57 57
58static inline u32 * 58static inline __be32 *
59encode_fh(u32 *p, struct svc_fh *fhp) 59encode_fh(__be32 *p, struct svc_fh *fhp)
60{ 60{
61 memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE); 61 memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE);
62 return p + (NFS_FHSIZE>> 2); 62 return p + (NFS_FHSIZE>> 2);
@@ -66,8 +66,8 @@ encode_fh(u32 *p, struct svc_fh *fhp)
66 * Decode a file name and make sure that the path contains 66 * Decode a file name and make sure that the path contains
67 * no slashes or null bytes. 67 * no slashes or null bytes.
68 */ 68 */
69static inline u32 * 69static inline __be32 *
70decode_filename(u32 *p, char **namp, int *lenp) 70decode_filename(__be32 *p, char **namp, int *lenp)
71{ 71{
72 char *name; 72 char *name;
73 int i; 73 int i;
@@ -82,8 +82,8 @@ decode_filename(u32 *p, char **namp, int *lenp)
82 return p; 82 return p;
83} 83}
84 84
85static inline u32 * 85static inline __be32 *
86decode_pathname(u32 *p, char **namp, int *lenp) 86decode_pathname(__be32 *p, char **namp, int *lenp)
87{ 87{
88 char *name; 88 char *name;
89 int i; 89 int i;
@@ -98,8 +98,8 @@ decode_pathname(u32 *p, char **namp, int *lenp)
98 return p; 98 return p;
99} 99}
100 100
101static inline u32 * 101static inline __be32 *
102decode_sattr(u32 *p, struct iattr *iap) 102decode_sattr(__be32 *p, struct iattr *iap)
103{ 103{
104 u32 tmp, tmp1; 104 u32 tmp, tmp1;
105 105
@@ -151,8 +151,8 @@ decode_sattr(u32 *p, struct iattr *iap)
151 return p; 151 return p;
152} 152}
153 153
154static u32 * 154static __be32 *
155encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, 155encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
156 struct kstat *stat) 156 struct kstat *stat)
157{ 157{
158 struct dentry *dentry = fhp->fh_dentry; 158 struct dentry *dentry = fhp->fh_dentry;
@@ -195,7 +195,7 @@ encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp,
195} 195}
196 196
197/* Helper function for NFSv2 ACL code */ 197/* Helper function for NFSv2 ACL code */
198u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 198__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
199{ 199{
200 struct kstat stat; 200 struct kstat stat;
201 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); 201 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat);
@@ -206,13 +206,13 @@ u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
206 * XDR decode functions 206 * XDR decode functions
207 */ 207 */
208int 208int
209nfssvc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 209nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
210{ 210{
211 return xdr_argsize_check(rqstp, p); 211 return xdr_argsize_check(rqstp, p);
212} 212}
213 213
214int 214int
215nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) 215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
216{ 216{
217 if (!(p = decode_fh(p, &args->fh))) 217 if (!(p = decode_fh(p, &args->fh)))
218 return 0; 218 return 0;
@@ -220,7 +220,7 @@ nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args)
220} 220}
221 221
222int 222int
223nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, 223nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
224 struct nfsd_sattrargs *args) 224 struct nfsd_sattrargs *args)
225{ 225{
226 if (!(p = decode_fh(p, &args->fh)) 226 if (!(p = decode_fh(p, &args->fh))
@@ -231,7 +231,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p,
231} 231}
232 232
233int 233int
234nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, 234nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
235 struct nfsd_diropargs *args) 235 struct nfsd_diropargs *args)
236{ 236{
237 if (!(p = decode_fh(p, &args->fh)) 237 if (!(p = decode_fh(p, &args->fh))
@@ -242,7 +242,7 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p,
242} 242}
243 243
244int 244int
245nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, 245nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
246 struct nfsd_readargs *args) 246 struct nfsd_readargs *args)
247{ 247{
248 unsigned int len; 248 unsigned int len;
@@ -273,7 +273,7 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
273} 273}
274 274
275int 275int
276nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, 276nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
277 struct nfsd_writeargs *args) 277 struct nfsd_writeargs *args)
278{ 278{
279 unsigned int len; 279 unsigned int len;
@@ -303,7 +303,7 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
303} 303}
304 304
305int 305int
306nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p, 306nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
307 struct nfsd_createargs *args) 307 struct nfsd_createargs *args)
308{ 308{
309 if (!(p = decode_fh(p, &args->fh)) 309 if (!(p = decode_fh(p, &args->fh))
@@ -315,7 +315,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p,
315} 315}
316 316
317int 317int
318nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, 318nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
319 struct nfsd_renameargs *args) 319 struct nfsd_renameargs *args)
320{ 320{
321 if (!(p = decode_fh(p, &args->ffh)) 321 if (!(p = decode_fh(p, &args->ffh))
@@ -328,7 +328,7 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p,
328} 328}
329 329
330int 330int
331nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinkargs *args) 331nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args)
332{ 332{
333 if (!(p = decode_fh(p, &args->fh))) 333 if (!(p = decode_fh(p, &args->fh)))
334 return 0; 334 return 0;
@@ -338,7 +338,7 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinka
338} 338}
339 339
340int 340int
341nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, 341nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
342 struct nfsd_linkargs *args) 342 struct nfsd_linkargs *args)
343{ 343{
344 if (!(p = decode_fh(p, &args->ffh)) 344 if (!(p = decode_fh(p, &args->ffh))
@@ -350,7 +350,7 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p,
350} 350}
351 351
352int 352int
353nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, 353nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
354 struct nfsd_symlinkargs *args) 354 struct nfsd_symlinkargs *args)
355{ 355{
356 if (!(p = decode_fh(p, &args->ffh)) 356 if (!(p = decode_fh(p, &args->ffh))
@@ -363,7 +363,7 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
363} 363}
364 364
365int 365int
366nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, 366nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
367 struct nfsd_readdirargs *args) 367 struct nfsd_readdirargs *args)
368{ 368{
369 if (!(p = decode_fh(p, &args->fh))) 369 if (!(p = decode_fh(p, &args->fh)))
@@ -382,13 +382,13 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
382 * XDR encode functions 382 * XDR encode functions
383 */ 383 */
384int 384int
385nfssvc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 385nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
386{ 386{
387 return xdr_ressize_check(rqstp, p); 387 return xdr_ressize_check(rqstp, p);
388} 388}
389 389
390int 390int
391nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, 391nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
392 struct nfsd_attrstat *resp) 392 struct nfsd_attrstat *resp)
393{ 393{
394 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 394 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
@@ -396,7 +396,7 @@ nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p,
396} 396}
397 397
398int 398int
399nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p, 399nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
400 struct nfsd_diropres *resp) 400 struct nfsd_diropres *resp)
401{ 401{
402 p = encode_fh(p, &resp->fh); 402 p = encode_fh(p, &resp->fh);
@@ -405,7 +405,7 @@ nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p,
405} 405}
406 406
407int 407int
408nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, 408nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
409 struct nfsd_readlinkres *resp) 409 struct nfsd_readlinkres *resp)
410{ 410{
411 *p++ = htonl(resp->len); 411 *p++ = htonl(resp->len);
@@ -421,7 +421,7 @@ nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
421} 421}
422 422
423int 423int
424nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p, 424nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
425 struct nfsd_readres *resp) 425 struct nfsd_readres *resp)
426{ 426{
427 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 427 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
@@ -440,7 +440,7 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p,
440} 440}
441 441
442int 442int
443nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, 443nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
444 struct nfsd_readdirres *resp) 444 struct nfsd_readdirres *resp)
445{ 445{
446 xdr_ressize_check(rqstp, p); 446 xdr_ressize_check(rqstp, p);
@@ -453,7 +453,7 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
453} 453}
454 454
455int 455int
456nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, 456nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
457 struct nfsd_statfsres *resp) 457 struct nfsd_statfsres *resp)
458{ 458{
459 struct kstatfs *stat = &resp->stats; 459 struct kstatfs *stat = &resp->stats;
@@ -471,7 +471,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
471 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 471 int namlen, loff_t offset, ino_t ino, unsigned int d_type)
472{ 472{
473 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); 473 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
474 u32 *p = cd->buffer; 474 __be32 *p = cd->buffer;
475 int buflen, slen; 475 int buflen, slen;
476 476
477 /* 477 /*
@@ -497,7 +497,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
497 *p++ = htonl((u32) ino); /* file id */ 497 *p++ = htonl((u32) ino); /* file id */
498 p = xdr_encode_array(p, name, namlen);/* name length & name */ 498 p = xdr_encode_array(p, name, namlen);/* name length & name */
499 cd->offset = p; /* remember pointer */ 499 cd->offset = p; /* remember pointer */
500 *p++ = ~(u32) 0; /* offset of next entry */ 500 *p++ = htonl(~0U); /* offset of next entry */
501 501
502 cd->buflen = buflen; 502 cd->buflen = buflen;
503 cd->buffer = p; 503 cd->buffer = p;
@@ -509,7 +509,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
509 * XDR release functions 509 * XDR release functions
510 */ 510 */
511int 511int
512nfssvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 512nfssvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
513 struct nfsd_fhandle *resp) 513 struct nfsd_fhandle *resp)
514{ 514{
515 fh_put(&resp->fh); 515 fh_put(&resp->fh);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1141bd29e4e3..f21e917bb8ed 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -110,7 +110,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
110 struct dentry *dentry = *dpp; 110 struct dentry *dentry = *dpp;
111 struct vfsmount *mnt = mntget(exp->ex_mnt); 111 struct vfsmount *mnt = mntget(exp->ex_mnt);
112 struct dentry *mounts = dget(dentry); 112 struct dentry *mounts = dget(dentry);
113 int err = nfs_ok; 113 int err = 0;
114 114
115 while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)); 115 while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts));
116 116
@@ -148,14 +148,15 @@ out:
148 * clients and is explicitly disallowed for NFSv3 148 * clients and is explicitly disallowed for NFSv3
149 * NeilBrown <neilb@cse.unsw.edu.au> 149 * NeilBrown <neilb@cse.unsw.edu.au>
150 */ 150 */
151int 151__be32
152nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, 152nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
153 int len, struct svc_fh *resfh) 153 int len, struct svc_fh *resfh)
154{ 154{
155 struct svc_export *exp; 155 struct svc_export *exp;
156 struct dentry *dparent; 156 struct dentry *dparent;
157 struct dentry *dentry; 157 struct dentry *dentry;
158 int err; 158 __be32 err;
159 int host_err;
159 160
160 dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); 161 dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
161 162
@@ -193,7 +194,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
193 exp2 = exp_parent(exp->ex_client, mnt, dentry, 194 exp2 = exp_parent(exp->ex_client, mnt, dentry,
194 &rqstp->rq_chandle); 195 &rqstp->rq_chandle);
195 if (IS_ERR(exp2)) { 196 if (IS_ERR(exp2)) {
196 err = PTR_ERR(exp2); 197 host_err = PTR_ERR(exp2);
197 dput(dentry); 198 dput(dentry);
198 mntput(mnt); 199 mntput(mnt);
199 goto out_nfserr; 200 goto out_nfserr;
@@ -210,14 +211,14 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
210 } else { 211 } else {
211 fh_lock(fhp); 212 fh_lock(fhp);
212 dentry = lookup_one_len(name, dparent, len); 213 dentry = lookup_one_len(name, dparent, len);
213 err = PTR_ERR(dentry); 214 host_err = PTR_ERR(dentry);
214 if (IS_ERR(dentry)) 215 if (IS_ERR(dentry))
215 goto out_nfserr; 216 goto out_nfserr;
216 /* 217 /*
217 * check if we have crossed a mount point ... 218 * check if we have crossed a mount point ...
218 */ 219 */
219 if (d_mountpoint(dentry)) { 220 if (d_mountpoint(dentry)) {
220 if ((err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { 221 if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) {
221 dput(dentry); 222 dput(dentry);
222 goto out_nfserr; 223 goto out_nfserr;
223 } 224 }
@@ -236,7 +237,7 @@ out:
236 return err; 237 return err;
237 238
238out_nfserr: 239out_nfserr:
239 err = nfserrno(err); 240 err = nfserrno(host_err);
240 goto out; 241 goto out;
241} 242}
242 243
@@ -244,7 +245,7 @@ out_nfserr:
244 * Set various file attributes. 245 * Set various file attributes.
245 * N.B. After this call fhp needs an fh_put 246 * N.B. After this call fhp needs an fh_put
246 */ 247 */
247int 248__be32
248nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, 249nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
249 int check_guard, time_t guardtime) 250 int check_guard, time_t guardtime)
250{ 251{
@@ -253,7 +254,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
253 int accmode = MAY_SATTR; 254 int accmode = MAY_SATTR;
254 int ftype = 0; 255 int ftype = 0;
255 int imode; 256 int imode;
256 int err; 257 __be32 err;
258 int host_err;
257 int size_change = 0; 259 int size_change = 0;
258 260
259 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) 261 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
@@ -319,19 +321,19 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
319 * If we are changing the size of the file, then 321 * If we are changing the size of the file, then
320 * we need to break all leases. 322 * we need to break all leases.
321 */ 323 */
322 err = break_lease(inode, FMODE_WRITE | O_NONBLOCK); 324 host_err = break_lease(inode, FMODE_WRITE | O_NONBLOCK);
323 if (err == -EWOULDBLOCK) 325 if (host_err == -EWOULDBLOCK)
324 err = -ETIMEDOUT; 326 host_err = -ETIMEDOUT;
325 if (err) /* ENOMEM or EWOULDBLOCK */ 327 if (host_err) /* ENOMEM or EWOULDBLOCK */
326 goto out_nfserr; 328 goto out_nfserr;
327 329
328 err = get_write_access(inode); 330 host_err = get_write_access(inode);
329 if (err) 331 if (host_err)
330 goto out_nfserr; 332 goto out_nfserr;
331 333
332 size_change = 1; 334 size_change = 1;
333 err = locks_verify_truncate(inode, NULL, iap->ia_size); 335 host_err = locks_verify_truncate(inode, NULL, iap->ia_size);
334 if (err) { 336 if (host_err) {
335 put_write_access(inode); 337 put_write_access(inode);
336 goto out_nfserr; 338 goto out_nfserr;
337 } 339 }
@@ -357,8 +359,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
357 err = nfserr_notsync; 359 err = nfserr_notsync;
358 if (!check_guard || guardtime == inode->i_ctime.tv_sec) { 360 if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
359 fh_lock(fhp); 361 fh_lock(fhp);
360 err = notify_change(dentry, iap); 362 host_err = notify_change(dentry, iap);
361 err = nfserrno(err); 363 err = nfserrno(host_err);
362 fh_unlock(fhp); 364 fh_unlock(fhp);
363 } 365 }
364 if (size_change) 366 if (size_change)
@@ -370,7 +372,7 @@ out:
370 return err; 372 return err;
371 373
372out_nfserr: 374out_nfserr:
373 err = nfserrno(err); 375 err = nfserrno(host_err);
374 goto out; 376 goto out;
375} 377}
376 378
@@ -420,11 +422,12 @@ out:
420 return error; 422 return error;
421} 423}
422 424
423int 425__be32
424nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, 426nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
425 struct nfs4_acl *acl) 427 struct nfs4_acl *acl)
426{ 428{
427 int error; 429 __be32 error;
430 int host_error;
428 struct dentry *dentry; 431 struct dentry *dentry;
429 struct inode *inode; 432 struct inode *inode;
430 struct posix_acl *pacl = NULL, *dpacl = NULL; 433 struct posix_acl *pacl = NULL, *dpacl = NULL;
@@ -440,20 +443,20 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
440 if (S_ISDIR(inode->i_mode)) 443 if (S_ISDIR(inode->i_mode))
441 flags = NFS4_ACL_DIR; 444 flags = NFS4_ACL_DIR;
442 445
443 error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags); 446 host_error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags);
444 if (error == -EINVAL) { 447 if (host_error == -EINVAL) {
445 error = nfserr_attrnotsupp; 448 error = nfserr_attrnotsupp;
446 goto out; 449 goto out;
447 } else if (error < 0) 450 } else if (host_error < 0)
448 goto out_nfserr; 451 goto out_nfserr;
449 452
450 error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); 453 host_error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
451 if (error < 0) 454 if (host_error < 0)
452 goto out_nfserr; 455 goto out_nfserr;
453 456
454 if (S_ISDIR(inode->i_mode)) { 457 if (S_ISDIR(inode->i_mode)) {
455 error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); 458 host_error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
456 if (error < 0) 459 if (host_error < 0)
457 goto out_nfserr; 460 goto out_nfserr;
458 } 461 }
459 462
@@ -464,7 +467,7 @@ out:
464 posix_acl_release(dpacl); 467 posix_acl_release(dpacl);
465 return (error); 468 return (error);
466out_nfserr: 469out_nfserr:
467 error = nfserrno(error); 470 error = nfserrno(host_error);
468 goto out; 471 goto out;
469} 472}
470 473
@@ -571,14 +574,14 @@ static struct accessmap nfs3_anyaccess[] = {
571 { 0, 0 } 574 { 0, 0 }
572}; 575};
573 576
574int 577__be32
575nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported) 578nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported)
576{ 579{
577 struct accessmap *map; 580 struct accessmap *map;
578 struct svc_export *export; 581 struct svc_export *export;
579 struct dentry *dentry; 582 struct dentry *dentry;
580 u32 query, result = 0, sresult = 0; 583 u32 query, result = 0, sresult = 0;
581 unsigned int error; 584 __be32 error;
582 585
583 error = fh_verify(rqstp, fhp, 0, MAY_NOP); 586 error = fh_verify(rqstp, fhp, 0, MAY_NOP);
584 if (error) 587 if (error)
@@ -598,7 +601,7 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
598 query = *access; 601 query = *access;
599 for (; map->access; map++) { 602 for (; map->access; map++) {
600 if (map->access & query) { 603 if (map->access & query) {
601 unsigned int err2; 604 __be32 err2;
602 605
603 sresult |= map->access; 606 sresult |= map->access;
604 607
@@ -637,13 +640,15 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
637 * The access argument indicates the type of open (read/write/lock) 640 * The access argument indicates the type of open (read/write/lock)
638 * N.B. After this call fhp needs an fh_put 641 * N.B. After this call fhp needs an fh_put
639 */ 642 */
640int 643__be32
641nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, 644nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
642 int access, struct file **filp) 645 int access, struct file **filp)
643{ 646{
644 struct dentry *dentry; 647 struct dentry *dentry;
645 struct inode *inode; 648 struct inode *inode;
646 int flags = O_RDONLY|O_LARGEFILE, err; 649 int flags = O_RDONLY|O_LARGEFILE;
650 __be32 err;
651 int host_err;
647 652
648 /* 653 /*
649 * If we get here, then the client has already done an "open", 654 * If we get here, then the client has already done an "open",
@@ -673,10 +678,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
673 * Check to see if there are any leases on this file. 678 * Check to see if there are any leases on this file.
674 * This may block while leases are broken. 679 * This may block while leases are broken.
675 */ 680 */
676 err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0)); 681 host_err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0));
677 if (err == -EWOULDBLOCK) 682 if (host_err == -EWOULDBLOCK)
678 err = -ETIMEDOUT; 683 host_err = -ETIMEDOUT;
679 if (err) /* NOMEM or WOULDBLOCK */ 684 if (host_err) /* NOMEM or WOULDBLOCK */
680 goto out_nfserr; 685 goto out_nfserr;
681 686
682 if (access & MAY_WRITE) { 687 if (access & MAY_WRITE) {
@@ -689,10 +694,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
689 } 694 }
690 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); 695 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags);
691 if (IS_ERR(*filp)) 696 if (IS_ERR(*filp))
692 err = PTR_ERR(*filp); 697 host_err = PTR_ERR(*filp);
693out_nfserr: 698out_nfserr:
694 if (err) 699 err = nfserrno(host_err);
695 err = nfserrno(err);
696out: 700out:
697 return err; 701 return err;
698} 702}
@@ -830,14 +834,15 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
830 return size; 834 return size;
831} 835}
832 836
833static int 837static __be32
834nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 838nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
835 loff_t offset, struct kvec *vec, int vlen, unsigned long *count) 839 loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
836{ 840{
837 struct inode *inode; 841 struct inode *inode;
838 struct raparms *ra; 842 struct raparms *ra;
839 mm_segment_t oldfs; 843 mm_segment_t oldfs;
840 int err; 844 __be32 err;
845 int host_err;
841 846
842 err = nfserr_perm; 847 err = nfserr_perm;
843 inode = file->f_dentry->d_inode; 848 inode = file->f_dentry->d_inode;
@@ -855,12 +860,12 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
855 860
856 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { 861 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) {
857 rqstp->rq_resused = 1; 862 rqstp->rq_resused = 1;
858 err = file->f_op->sendfile(file, &offset, *count, 863 host_err = file->f_op->sendfile(file, &offset, *count,
859 nfsd_read_actor, rqstp); 864 nfsd_read_actor, rqstp);
860 } else { 865 } else {
861 oldfs = get_fs(); 866 oldfs = get_fs();
862 set_fs(KERNEL_DS); 867 set_fs(KERNEL_DS);
863 err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset); 868 host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset);
864 set_fs(oldfs); 869 set_fs(oldfs);
865 } 870 }
866 871
@@ -874,13 +879,13 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
874 spin_unlock(&rab->pb_lock); 879 spin_unlock(&rab->pb_lock);
875 } 880 }
876 881
877 if (err >= 0) { 882 if (host_err >= 0) {
878 nfsdstats.io_read += err; 883 nfsdstats.io_read += host_err;
879 *count = err; 884 *count = host_err;
880 err = 0; 885 err = 0;
881 fsnotify_access(file->f_dentry); 886 fsnotify_access(file->f_dentry);
882 } else 887 } else
883 err = nfserrno(err); 888 err = nfserrno(host_err);
884out: 889out:
885 return err; 890 return err;
886} 891}
@@ -895,7 +900,7 @@ static void kill_suid(struct dentry *dentry)
895 mutex_unlock(&dentry->d_inode->i_mutex); 900 mutex_unlock(&dentry->d_inode->i_mutex);
896} 901}
897 902
898static int 903static __be32
899nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 904nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
900 loff_t offset, struct kvec *vec, int vlen, 905 loff_t offset, struct kvec *vec, int vlen,
901 unsigned long cnt, int *stablep) 906 unsigned long cnt, int *stablep)
@@ -904,7 +909,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
904 struct dentry *dentry; 909 struct dentry *dentry;
905 struct inode *inode; 910 struct inode *inode;
906 mm_segment_t oldfs; 911 mm_segment_t oldfs;
907 int err = 0; 912 __be32 err = 0;
913 int host_err;
908 int stable = *stablep; 914 int stable = *stablep;
909 915
910#ifdef MSNFS 916#ifdef MSNFS
@@ -940,18 +946,18 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
940 946
941 /* Write the data. */ 947 /* Write the data. */
942 oldfs = get_fs(); set_fs(KERNEL_DS); 948 oldfs = get_fs(); set_fs(KERNEL_DS);
943 err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); 949 host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
944 set_fs(oldfs); 950 set_fs(oldfs);
945 if (err >= 0) { 951 if (host_err >= 0) {
946 nfsdstats.io_write += cnt; 952 nfsdstats.io_write += cnt;
947 fsnotify_modify(file->f_dentry); 953 fsnotify_modify(file->f_dentry);
948 } 954 }
949 955
950 /* clear setuid/setgid flag after write */ 956 /* clear setuid/setgid flag after write */
951 if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) 957 if (host_err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID)))
952 kill_suid(dentry); 958 kill_suid(dentry);
953 959
954 if (err >= 0 && stable) { 960 if (host_err >= 0 && stable) {
955 static ino_t last_ino; 961 static ino_t last_ino;
956 static dev_t last_dev; 962 static dev_t last_dev;
957 963
@@ -977,7 +983,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
977 983
978 if (inode->i_state & I_DIRTY) { 984 if (inode->i_state & I_DIRTY) {
979 dprintk("nfsd: write sync %d\n", current->pid); 985 dprintk("nfsd: write sync %d\n", current->pid);
980 err=nfsd_sync(file); 986 host_err=nfsd_sync(file);
981 } 987 }
982#if 0 988#if 0
983 wake_up(&inode->i_wait); 989 wake_up(&inode->i_wait);
@@ -987,11 +993,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
987 last_dev = inode->i_sb->s_dev; 993 last_dev = inode->i_sb->s_dev;
988 } 994 }
989 995
990 dprintk("nfsd: write complete err=%d\n", err); 996 dprintk("nfsd: write complete host_err=%d\n", host_err);
991 if (err >= 0) 997 if (host_err >= 0)
992 err = 0; 998 err = 0;
993 else 999 else
994 err = nfserrno(err); 1000 err = nfserrno(host_err);
995out: 1001out:
996 return err; 1002 return err;
997} 1003}
@@ -1001,12 +1007,12 @@ out:
1001 * on entry. On return, *count contains the number of bytes actually read. 1007 * on entry. On return, *count contains the number of bytes actually read.
1002 * N.B. After this call fhp needs an fh_put 1008 * N.B. After this call fhp needs an fh_put
1003 */ 1009 */
1004int 1010__be32
1005nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 1011nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1006 loff_t offset, struct kvec *vec, int vlen, 1012 loff_t offset, struct kvec *vec, int vlen,
1007 unsigned long *count) 1013 unsigned long *count)
1008{ 1014{
1009 int err; 1015 __be32 err;
1010 1016
1011 if (file) { 1017 if (file) {
1012 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, 1018 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry,
@@ -1030,12 +1036,12 @@ out:
1030 * The stable flag requests synchronous writes. 1036 * The stable flag requests synchronous writes.
1031 * N.B. After this call fhp needs an fh_put 1037 * N.B. After this call fhp needs an fh_put
1032 */ 1038 */
1033int 1039__be32
1034nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 1040nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1035 loff_t offset, struct kvec *vec, int vlen, unsigned long cnt, 1041 loff_t offset, struct kvec *vec, int vlen, unsigned long cnt,
1036 int *stablep) 1042 int *stablep)
1037{ 1043{
1038 int err = 0; 1044 __be32 err = 0;
1039 1045
1040 if (file) { 1046 if (file) {
1041 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, 1047 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry,
@@ -1067,12 +1073,12 @@ out:
1067 * Unfortunately we cannot lock the file to make sure we return full WCC 1073 * Unfortunately we cannot lock the file to make sure we return full WCC
1068 * data to the client, as locking happens lower down in the filesystem. 1074 * data to the client, as locking happens lower down in the filesystem.
1069 */ 1075 */
1070int 1076__be32
1071nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, 1077nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
1072 loff_t offset, unsigned long count) 1078 loff_t offset, unsigned long count)
1073{ 1079{
1074 struct file *file; 1080 struct file *file;
1075 int err; 1081 __be32 err;
1076 1082
1077 if ((u64)count > ~(u64)offset) 1083 if ((u64)count > ~(u64)offset)
1078 return nfserr_inval; 1084 return nfserr_inval;
@@ -1100,14 +1106,15 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
1100 * 1106 *
1101 * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp 1107 * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp
1102 */ 1108 */
1103int 1109__be32
1104nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, 1110nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1105 char *fname, int flen, struct iattr *iap, 1111 char *fname, int flen, struct iattr *iap,
1106 int type, dev_t rdev, struct svc_fh *resfhp) 1112 int type, dev_t rdev, struct svc_fh *resfhp)
1107{ 1113{
1108 struct dentry *dentry, *dchild = NULL; 1114 struct dentry *dentry, *dchild = NULL;
1109 struct inode *dirp; 1115 struct inode *dirp;
1110 int err; 1116 __be32 err;
1117 int host_err;
1111 1118
1112 err = nfserr_perm; 1119 err = nfserr_perm;
1113 if (!flen) 1120 if (!flen)
@@ -1134,7 +1141,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1134 /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ 1141 /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
1135 fh_lock_nested(fhp, I_MUTEX_PARENT); 1142 fh_lock_nested(fhp, I_MUTEX_PARENT);
1136 dchild = lookup_one_len(fname, dentry, flen); 1143 dchild = lookup_one_len(fname, dentry, flen);
1137 err = PTR_ERR(dchild); 1144 host_err = PTR_ERR(dchild);
1138 if (IS_ERR(dchild)) 1145 if (IS_ERR(dchild))
1139 goto out_nfserr; 1146 goto out_nfserr;
1140 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); 1147 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
@@ -1173,22 +1180,22 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1173 err = nfserr_perm; 1180 err = nfserr_perm;
1174 switch (type) { 1181 switch (type) {
1175 case S_IFREG: 1182 case S_IFREG:
1176 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 1183 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
1177 break; 1184 break;
1178 case S_IFDIR: 1185 case S_IFDIR:
1179 err = vfs_mkdir(dirp, dchild, iap->ia_mode); 1186 host_err = vfs_mkdir(dirp, dchild, iap->ia_mode);
1180 break; 1187 break;
1181 case S_IFCHR: 1188 case S_IFCHR:
1182 case S_IFBLK: 1189 case S_IFBLK:
1183 case S_IFIFO: 1190 case S_IFIFO:
1184 case S_IFSOCK: 1191 case S_IFSOCK:
1185 err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); 1192 host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
1186 break; 1193 break;
1187 default: 1194 default:
1188 printk("nfsd: bad file type %o in nfsd_create\n", type); 1195 printk("nfsd: bad file type %o in nfsd_create\n", type);
1189 err = -EINVAL; 1196 host_err = -EINVAL;
1190 } 1197 }
1191 if (err < 0) 1198 if (host_err < 0)
1192 goto out_nfserr; 1199 goto out_nfserr;
1193 1200
1194 if (EX_ISSYNC(fhp->fh_export)) { 1201 if (EX_ISSYNC(fhp->fh_export)) {
@@ -1203,7 +1210,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1203 * directories via NFS. 1210 * directories via NFS.
1204 */ 1211 */
1205 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) { 1212 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
1206 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1213 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1207 if (err2) 1214 if (err2)
1208 err = err2; 1215 err = err2;
1209 } 1216 }
@@ -1218,7 +1225,7 @@ out:
1218 return err; 1225 return err;
1219 1226
1220out_nfserr: 1227out_nfserr:
1221 err = nfserrno(err); 1228 err = nfserrno(host_err);
1222 goto out; 1229 goto out;
1223} 1230}
1224 1231
@@ -1226,7 +1233,7 @@ out_nfserr:
1226/* 1233/*
1227 * NFSv3 version of nfsd_create 1234 * NFSv3 version of nfsd_create
1228 */ 1235 */
1229int 1236__be32
1230nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, 1237nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1231 char *fname, int flen, struct iattr *iap, 1238 char *fname, int flen, struct iattr *iap,
1232 struct svc_fh *resfhp, int createmode, u32 *verifier, 1239 struct svc_fh *resfhp, int createmode, u32 *verifier,
@@ -1234,7 +1241,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1234{ 1241{
1235 struct dentry *dentry, *dchild = NULL; 1242 struct dentry *dentry, *dchild = NULL;
1236 struct inode *dirp; 1243 struct inode *dirp;
1237 int err; 1244 __be32 err;
1245 int host_err;
1238 __u32 v_mtime=0, v_atime=0; 1246 __u32 v_mtime=0, v_atime=0;
1239 int v_mode=0; 1247 int v_mode=0;
1240 1248
@@ -1264,7 +1272,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1264 * Compose the response file handle. 1272 * Compose the response file handle.
1265 */ 1273 */
1266 dchild = lookup_one_len(fname, dentry, flen); 1274 dchild = lookup_one_len(fname, dentry, flen);
1267 err = PTR_ERR(dchild); 1275 host_err = PTR_ERR(dchild);
1268 if (IS_ERR(dchild)) 1276 if (IS_ERR(dchild))
1269 goto out_nfserr; 1277 goto out_nfserr;
1270 1278
@@ -1320,8 +1328,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1320 goto out; 1328 goto out;
1321 } 1329 }
1322 1330
1323 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 1331 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
1324 if (err < 0) 1332 if (host_err < 0)
1325 goto out_nfserr; 1333 goto out_nfserr;
1326 1334
1327 if (EX_ISSYNC(fhp->fh_export)) { 1335 if (EX_ISSYNC(fhp->fh_export)) {
@@ -1350,7 +1358,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1350 */ 1358 */
1351 set_attr: 1359 set_attr:
1352 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { 1360 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
1353 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1361 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1354 if (err2) 1362 if (err2)
1355 err = err2; 1363 err = err2;
1356 } 1364 }
@@ -1368,7 +1376,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1368 return err; 1376 return err;
1369 1377
1370 out_nfserr: 1378 out_nfserr:
1371 err = nfserrno(err); 1379 err = nfserrno(host_err);
1372 goto out; 1380 goto out;
1373} 1381}
1374#endif /* CONFIG_NFSD_V3 */ 1382#endif /* CONFIG_NFSD_V3 */
@@ -1378,13 +1386,14 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1378 * fits into the buffer. On return, it contains the true length. 1386 * fits into the buffer. On return, it contains the true length.
1379 * N.B. After this call fhp needs an fh_put 1387 * N.B. After this call fhp needs an fh_put
1380 */ 1388 */
1381int 1389__be32
1382nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) 1390nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1383{ 1391{
1384 struct dentry *dentry; 1392 struct dentry *dentry;
1385 struct inode *inode; 1393 struct inode *inode;
1386 mm_segment_t oldfs; 1394 mm_segment_t oldfs;
1387 int err; 1395 __be32 err;
1396 int host_err;
1388 1397
1389 err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP); 1398 err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP);
1390 if (err) 1399 if (err)
@@ -1403,18 +1412,18 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1403 */ 1412 */
1404 1413
1405 oldfs = get_fs(); set_fs(KERNEL_DS); 1414 oldfs = get_fs(); set_fs(KERNEL_DS);
1406 err = inode->i_op->readlink(dentry, buf, *lenp); 1415 host_err = inode->i_op->readlink(dentry, buf, *lenp);
1407 set_fs(oldfs); 1416 set_fs(oldfs);
1408 1417
1409 if (err < 0) 1418 if (host_err < 0)
1410 goto out_nfserr; 1419 goto out_nfserr;
1411 *lenp = err; 1420 *lenp = host_err;
1412 err = 0; 1421 err = 0;
1413out: 1422out:
1414 return err; 1423 return err;
1415 1424
1416out_nfserr: 1425out_nfserr:
1417 err = nfserrno(err); 1426 err = nfserrno(host_err);
1418 goto out; 1427 goto out;
1419} 1428}
1420 1429
@@ -1422,7 +1431,7 @@ out_nfserr:
1422 * Create a symlink and look up its inode 1431 * Create a symlink and look up its inode
1423 * N.B. After this call _both_ fhp and resfhp need an fh_put 1432 * N.B. After this call _both_ fhp and resfhp need an fh_put
1424 */ 1433 */
1425int 1434__be32
1426nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, 1435nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1427 char *fname, int flen, 1436 char *fname, int flen,
1428 char *path, int plen, 1437 char *path, int plen,
@@ -1430,7 +1439,8 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1430 struct iattr *iap) 1439 struct iattr *iap)
1431{ 1440{
1432 struct dentry *dentry, *dnew; 1441 struct dentry *dentry, *dnew;
1433 int err, cerr; 1442 __be32 err, cerr;
1443 int host_err;
1434 umode_t mode; 1444 umode_t mode;
1435 1445
1436 err = nfserr_noent; 1446 err = nfserr_noent;
@@ -1446,7 +1456,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1446 fh_lock(fhp); 1456 fh_lock(fhp);
1447 dentry = fhp->fh_dentry; 1457 dentry = fhp->fh_dentry;
1448 dnew = lookup_one_len(fname, dentry, flen); 1458 dnew = lookup_one_len(fname, dentry, flen);
1449 err = PTR_ERR(dnew); 1459 host_err = PTR_ERR(dnew);
1450 if (IS_ERR(dnew)) 1460 if (IS_ERR(dnew))
1451 goto out_nfserr; 1461 goto out_nfserr;
1452 1462
@@ -1458,21 +1468,21 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1458 if (unlikely(path[plen] != 0)) { 1468 if (unlikely(path[plen] != 0)) {
1459 char *path_alloced = kmalloc(plen+1, GFP_KERNEL); 1469 char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
1460 if (path_alloced == NULL) 1470 if (path_alloced == NULL)
1461 err = -ENOMEM; 1471 host_err = -ENOMEM;
1462 else { 1472 else {
1463 strncpy(path_alloced, path, plen); 1473 strncpy(path_alloced, path, plen);
1464 path_alloced[plen] = 0; 1474 path_alloced[plen] = 0;
1465 err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); 1475 host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
1466 kfree(path_alloced); 1476 kfree(path_alloced);
1467 } 1477 }
1468 } else 1478 } else
1469 err = vfs_symlink(dentry->d_inode, dnew, path, mode); 1479 host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
1470 1480
1471 if (!err) 1481 if (!host_err) {
1472 if (EX_ISSYNC(fhp->fh_export)) 1482 if (EX_ISSYNC(fhp->fh_export))
1473 err = nfsd_sync_dir(dentry); 1483 host_err = nfsd_sync_dir(dentry);
1474 if (err) 1484 }
1475 err = nfserrno(err); 1485 err = nfserrno(host_err);
1476 fh_unlock(fhp); 1486 fh_unlock(fhp);
1477 1487
1478 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); 1488 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
@@ -1482,7 +1492,7 @@ out:
1482 return err; 1492 return err;
1483 1493
1484out_nfserr: 1494out_nfserr:
1485 err = nfserrno(err); 1495 err = nfserrno(host_err);
1486 goto out; 1496 goto out;
1487} 1497}
1488 1498
@@ -1490,13 +1500,14 @@ out_nfserr:
1490 * Create a hardlink 1500 * Create a hardlink
1491 * N.B. After this call _both_ ffhp and tfhp need an fh_put 1501 * N.B. After this call _both_ ffhp and tfhp need an fh_put
1492 */ 1502 */
1493int 1503__be32
1494nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, 1504nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1495 char *name, int len, struct svc_fh *tfhp) 1505 char *name, int len, struct svc_fh *tfhp)
1496{ 1506{
1497 struct dentry *ddir, *dnew, *dold; 1507 struct dentry *ddir, *dnew, *dold;
1498 struct inode *dirp, *dest; 1508 struct inode *dirp, *dest;
1499 int err; 1509 __be32 err;
1510 int host_err;
1500 1511
1501 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); 1512 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE);
1502 if (err) 1513 if (err)
@@ -1517,24 +1528,25 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1517 dirp = ddir->d_inode; 1528 dirp = ddir->d_inode;
1518 1529
1519 dnew = lookup_one_len(name, ddir, len); 1530 dnew = lookup_one_len(name, ddir, len);
1520 err = PTR_ERR(dnew); 1531 host_err = PTR_ERR(dnew);
1521 if (IS_ERR(dnew)) 1532 if (IS_ERR(dnew))
1522 goto out_nfserr; 1533 goto out_nfserr;
1523 1534
1524 dold = tfhp->fh_dentry; 1535 dold = tfhp->fh_dentry;
1525 dest = dold->d_inode; 1536 dest = dold->d_inode;
1526 1537
1527 err = vfs_link(dold, dirp, dnew); 1538 host_err = vfs_link(dold, dirp, dnew);
1528 if (!err) { 1539 if (!host_err) {
1529 if (EX_ISSYNC(ffhp->fh_export)) { 1540 if (EX_ISSYNC(ffhp->fh_export)) {
1530 err = nfserrno(nfsd_sync_dir(ddir)); 1541 err = nfserrno(nfsd_sync_dir(ddir));
1531 write_inode_now(dest, 1); 1542 write_inode_now(dest, 1);
1532 } 1543 }
1544 err = 0;
1533 } else { 1545 } else {
1534 if (err == -EXDEV && rqstp->rq_vers == 2) 1546 if (host_err == -EXDEV && rqstp->rq_vers == 2)
1535 err = nfserr_acces; 1547 err = nfserr_acces;
1536 else 1548 else
1537 err = nfserrno(err); 1549 err = nfserrno(host_err);
1538 } 1550 }
1539 1551
1540 dput(dnew); 1552 dput(dnew);
@@ -1544,7 +1556,7 @@ out:
1544 return err; 1556 return err;
1545 1557
1546out_nfserr: 1558out_nfserr:
1547 err = nfserrno(err); 1559 err = nfserrno(host_err);
1548 goto out_unlock; 1560 goto out_unlock;
1549} 1561}
1550 1562
@@ -1552,13 +1564,14 @@ out_nfserr:
1552 * Rename a file 1564 * Rename a file
1553 * N.B. After this call _both_ ffhp and tfhp need an fh_put 1565 * N.B. After this call _both_ ffhp and tfhp need an fh_put
1554 */ 1566 */
1555int 1567__be32
1556nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, 1568nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1557 struct svc_fh *tfhp, char *tname, int tlen) 1569 struct svc_fh *tfhp, char *tname, int tlen)
1558{ 1570{
1559 struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap; 1571 struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap;
1560 struct inode *fdir, *tdir; 1572 struct inode *fdir, *tdir;
1561 int err; 1573 __be32 err;
1574 int host_err;
1562 1575
1563 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE); 1576 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE);
1564 if (err) 1577 if (err)
@@ -1589,22 +1602,22 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1589 fill_pre_wcc(tfhp); 1602 fill_pre_wcc(tfhp);
1590 1603
1591 odentry = lookup_one_len(fname, fdentry, flen); 1604 odentry = lookup_one_len(fname, fdentry, flen);
1592 err = PTR_ERR(odentry); 1605 host_err = PTR_ERR(odentry);
1593 if (IS_ERR(odentry)) 1606 if (IS_ERR(odentry))
1594 goto out_nfserr; 1607 goto out_nfserr;
1595 1608
1596 err = -ENOENT; 1609 host_err = -ENOENT;
1597 if (!odentry->d_inode) 1610 if (!odentry->d_inode)
1598 goto out_dput_old; 1611 goto out_dput_old;
1599 err = -EINVAL; 1612 host_err = -EINVAL;
1600 if (odentry == trap) 1613 if (odentry == trap)
1601 goto out_dput_old; 1614 goto out_dput_old;
1602 1615
1603 ndentry = lookup_one_len(tname, tdentry, tlen); 1616 ndentry = lookup_one_len(tname, tdentry, tlen);
1604 err = PTR_ERR(ndentry); 1617 host_err = PTR_ERR(ndentry);
1605 if (IS_ERR(ndentry)) 1618 if (IS_ERR(ndentry))
1606 goto out_dput_old; 1619 goto out_dput_old;
1607 err = -ENOTEMPTY; 1620 host_err = -ENOTEMPTY;
1608 if (ndentry == trap) 1621 if (ndentry == trap)
1609 goto out_dput_new; 1622 goto out_dput_new;
1610 1623
@@ -1612,14 +1625,14 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1612 if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) && 1625 if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
1613 ((atomic_read(&odentry->d_count) > 1) 1626 ((atomic_read(&odentry->d_count) > 1)
1614 || (atomic_read(&ndentry->d_count) > 1))) { 1627 || (atomic_read(&ndentry->d_count) > 1))) {
1615 err = -EPERM; 1628 host_err = -EPERM;
1616 } else 1629 } else
1617#endif 1630#endif
1618 err = vfs_rename(fdir, odentry, tdir, ndentry); 1631 host_err = vfs_rename(fdir, odentry, tdir, ndentry);
1619 if (!err && EX_ISSYNC(tfhp->fh_export)) { 1632 if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
1620 err = nfsd_sync_dir(tdentry); 1633 host_err = nfsd_sync_dir(tdentry);
1621 if (!err) 1634 if (!host_err)
1622 err = nfsd_sync_dir(fdentry); 1635 host_err = nfsd_sync_dir(fdentry);
1623 } 1636 }
1624 1637
1625 out_dput_new: 1638 out_dput_new:
@@ -1627,8 +1640,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1627 out_dput_old: 1640 out_dput_old:
1628 dput(odentry); 1641 dput(odentry);
1629 out_nfserr: 1642 out_nfserr:
1630 if (err) 1643 err = nfserrno(host_err);
1631 err = nfserrno(err);
1632 1644
1633 /* we cannot reply on fh_unlock on the two filehandles, 1645 /* we cannot reply on fh_unlock on the two filehandles,
1634 * as that would do the wrong thing if the two directories 1646 * as that would do the wrong thing if the two directories
@@ -1647,13 +1659,14 @@ out:
1647 * Unlink a file or directory 1659 * Unlink a file or directory
1648 * N.B. After this call fhp needs an fh_put 1660 * N.B. After this call fhp needs an fh_put
1649 */ 1661 */
1650int 1662__be32
1651nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, 1663nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1652 char *fname, int flen) 1664 char *fname, int flen)
1653{ 1665{
1654 struct dentry *dentry, *rdentry; 1666 struct dentry *dentry, *rdentry;
1655 struct inode *dirp; 1667 struct inode *dirp;
1656 int err; 1668 __be32 err;
1669 int host_err;
1657 1670
1658 err = nfserr_acces; 1671 err = nfserr_acces;
1659 if (!flen || isdotent(fname, flen)) 1672 if (!flen || isdotent(fname, flen))
@@ -1667,7 +1680,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1667 dirp = dentry->d_inode; 1680 dirp = dentry->d_inode;
1668 1681
1669 rdentry = lookup_one_len(fname, dentry, flen); 1682 rdentry = lookup_one_len(fname, dentry, flen);
1670 err = PTR_ERR(rdentry); 1683 host_err = PTR_ERR(rdentry);
1671 if (IS_ERR(rdentry)) 1684 if (IS_ERR(rdentry))
1672 goto out_nfserr; 1685 goto out_nfserr;
1673 1686
@@ -1684,22 +1697,23 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1684#ifdef MSNFS 1697#ifdef MSNFS
1685 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 1698 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
1686 (atomic_read(&rdentry->d_count) > 1)) { 1699 (atomic_read(&rdentry->d_count) > 1)) {
1687 err = -EPERM; 1700 host_err = -EPERM;
1688 } else 1701 } else
1689#endif 1702#endif
1690 err = vfs_unlink(dirp, rdentry); 1703 host_err = vfs_unlink(dirp, rdentry);
1691 } else { /* It's RMDIR */ 1704 } else { /* It's RMDIR */
1692 err = vfs_rmdir(dirp, rdentry); 1705 host_err = vfs_rmdir(dirp, rdentry);
1693 } 1706 }
1694 1707
1695 dput(rdentry); 1708 dput(rdentry);
1696 1709
1697 if (err == 0 && 1710 if (host_err)
1698 EX_ISSYNC(fhp->fh_export)) 1711 goto out_nfserr;
1699 err = nfsd_sync_dir(dentry); 1712 if (EX_ISSYNC(fhp->fh_export))
1713 host_err = nfsd_sync_dir(dentry);
1700 1714
1701out_nfserr: 1715out_nfserr:
1702 err = nfserrno(err); 1716 err = nfserrno(host_err);
1703out: 1717out:
1704 return err; 1718 return err;
1705} 1719}
@@ -1708,11 +1722,12 @@ out:
1708 * Read entries from a directory. 1722 * Read entries from a directory.
1709 * The NFSv3/4 verifier we ignore for now. 1723 * The NFSv3/4 verifier we ignore for now.
1710 */ 1724 */
1711int 1725__be32
1712nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 1726nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1713 struct readdir_cd *cdp, encode_dent_fn func) 1727 struct readdir_cd *cdp, encode_dent_fn func)
1714{ 1728{
1715 int err; 1729 __be32 err;
1730 int host_err;
1716 struct file *file; 1731 struct file *file;
1717 loff_t offset = *offsetp; 1732 loff_t offset = *offsetp;
1718 1733
@@ -1734,10 +1749,10 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1734 1749
1735 do { 1750 do {
1736 cdp->err = nfserr_eof; /* will be cleared on successful read */ 1751 cdp->err = nfserr_eof; /* will be cleared on successful read */
1737 err = vfs_readdir(file, (filldir_t) func, cdp); 1752 host_err = vfs_readdir(file, (filldir_t) func, cdp);
1738 } while (err >=0 && cdp->err == nfs_ok); 1753 } while (host_err >=0 && cdp->err == nfs_ok);
1739 if (err) 1754 if (host_err)
1740 err = nfserrno(err); 1755 err = nfserrno(host_err);
1741 else 1756 else
1742 err = cdp->err; 1757 err = cdp->err;
1743 *offsetp = vfs_llseek(file, 0, 1); 1758 *offsetp = vfs_llseek(file, 0, 1);
@@ -1754,10 +1769,10 @@ out:
1754 * Get file system stats 1769 * Get file system stats
1755 * N.B. After this call fhp needs an fh_put 1770 * N.B. After this call fhp needs an fh_put
1756 */ 1771 */
1757int 1772__be32
1758nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) 1773nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
1759{ 1774{
1760 int err = fh_verify(rqstp, fhp, 0, MAY_NOP); 1775 __be32 err = fh_verify(rqstp, fhp, 0, MAY_NOP);
1761 if (!err && vfs_statfs(fhp->fh_dentry,stat)) 1776 if (!err && vfs_statfs(fhp->fh_dentry,stat))
1762 err = nfserr_io; 1777 err = nfserr_io;
1763 return err; 1778 return err;
@@ -1766,7 +1781,7 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
1766/* 1781/*
1767 * Check for a user's access permissions to this inode. 1782 * Check for a user's access permissions to this inode.
1768 */ 1783 */
1769int 1784__be32
1770nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc) 1785nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
1771{ 1786{
1772 struct inode *inode = dentry->d_inode; 1787 struct inode *inode = dentry->d_inode;
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index e1fceb8aa32d..d11753c50bc1 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tree_lookup(struct o2nm_cluster *cluster,
152 struct o2nm_node *node, *ret = NULL; 152 struct o2nm_node *node, *ret = NULL;
153 153
154 while (*p) { 154 while (*p) {
155 int cmp;
156
155 parent = *p; 157 parent = *p;
156 node = rb_entry(parent, struct o2nm_node, nd_ip_node); 158 node = rb_entry(parent, struct o2nm_node, nd_ip_node);
157 159
158 if (memcmp(&ip_needle, &node->nd_ipv4_address, 160 cmp = memcmp(&ip_needle, &node->nd_ipv4_address,
159 sizeof(ip_needle)) < 0) 161 sizeof(ip_needle));
162 if (cmp < 0)
160 p = &(*p)->rb_left; 163 p = &(*p)->rb_left;
161 else if (memcmp(&ip_needle, &node->nd_ipv4_address, 164 else if (cmp > 0)
162 sizeof(ip_needle)) > 0)
163 p = &(*p)->rb_right; 165 p = &(*p)->rb_right;
164 else { 166 else {
165 ret = node; 167 ret = node;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d9ba0a931a03..1be74c4e7814 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -30,6 +30,7 @@
30#include <linux/highmem.h> 30#include <linux/highmem.h>
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <linux/uio.h> 32#include <linux/uio.h>
33#include <linux/sched.h>
33 34
34#define MLOG_MASK_PREFIX ML_INODE 35#define MLOG_MASK_PREFIX ML_INODE
35#include <cluster/masklog.h> 36#include <cluster/masklog.h>
@@ -691,6 +692,12 @@ static int ocfs2_zero_extend(struct inode *inode,
691 } 692 }
692 693
693 start_off += sb->s_blocksize; 694 start_off += sb->s_blocksize;
695
696 /*
697 * Very large extends have the potential to lock up
698 * the cpu for extended periods of time.
699 */
700 cond_resched();
694 } 701 }
695 702
696out: 703out:
@@ -728,31 +735,36 @@ static int ocfs2_extend_file(struct inode *inode,
728 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) - 735 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) -
729 OCFS2_I(inode)->ip_clusters; 736 OCFS2_I(inode)->ip_clusters;
730 737
731 if (clusters_to_add) { 738 /*
732 /* 739 * protect the pages that ocfs2_zero_extend is going to be
733 * protect the pages that ocfs2_zero_extend is going to 740 * pulling into the page cache.. we do this before the
734 * be pulling into the page cache.. we do this before the 741 * metadata extend so that we don't get into the situation
735 * metadata extend so that we don't get into the situation 742 * where we've extended the metadata but can't get the data
736 * where we've extended the metadata but can't get the data 743 * lock to zero.
737 * lock to zero. 744 */
738 */ 745 ret = ocfs2_data_lock(inode, 1);
739 ret = ocfs2_data_lock(inode, 1); 746 if (ret < 0) {
740 if (ret < 0) { 747 mlog_errno(ret);
741 mlog_errno(ret); 748 goto out;
742 goto out; 749 }
743 }
744 750
751 if (clusters_to_add) {
745 ret = ocfs2_extend_allocation(inode, clusters_to_add); 752 ret = ocfs2_extend_allocation(inode, clusters_to_add);
746 if (ret < 0) { 753 if (ret < 0) {
747 mlog_errno(ret); 754 mlog_errno(ret);
748 goto out_unlock; 755 goto out_unlock;
749 } 756 }
757 }
750 758
751 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip); 759 /*
752 if (ret < 0) { 760 * Call this even if we don't add any clusters to the tree. We
753 mlog_errno(ret); 761 * still need to zero the area between the old i_size and the
754 goto out_unlock; 762 * new i_size.
755 } 763 */
764 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
765 if (ret < 0) {
766 mlog_errno(ret);
767 goto out_unlock;
756 } 768 }
757 769
758 if (!tail_to_skip) { 770 if (!tail_to_skip) {
@@ -764,8 +776,7 @@ static int ocfs2_extend_file(struct inode *inode,
764 } 776 }
765 777
766out_unlock: 778out_unlock:
767 if (clusters_to_add) /* this is the only case in which we lock */ 779 ocfs2_data_unlock(inode, 1);
768 ocfs2_data_unlock(inode, 1);
769 780
770out: 781out:
771 return ret; 782 return ret;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 259155f0eb2e..a57b751d4f40 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1085,14 +1085,6 @@ static int ocfs2_rename(struct inode *old_dir,
1085 BUG(); 1085 BUG();
1086 } 1086 }
1087 1087
1088 if (atomic_read(&old_dentry->d_count) > 2) {
1089 shrink_dcache_parent(old_dentry);
1090 if (atomic_read(&old_dentry->d_count) > 2) {
1091 status = -EBUSY;
1092 goto bail;
1093 }
1094 }
1095
1096 /* Assume a directory heirarchy thusly: 1088 /* Assume a directory heirarchy thusly:
1097 * a/b/c 1089 * a/b/c
1098 * a/d 1090 * a/d
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 51c6a748df49..6fb4b6150d77 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -376,18 +376,48 @@ static char *make_block_name(struct gendisk *disk)
376 return name; 376 return name;
377} 377}
378 378
379static void disk_sysfs_symlinks(struct gendisk *disk) 379static int disk_sysfs_symlinks(struct gendisk *disk)
380{ 380{
381 struct device *target = get_device(disk->driverfs_dev); 381 struct device *target = get_device(disk->driverfs_dev);
382 int err;
383 char *disk_name = NULL;
384
382 if (target) { 385 if (target) {
383 char *disk_name = make_block_name(disk); 386 disk_name = make_block_name(disk);
384 sysfs_create_link(&disk->kobj,&target->kobj,"device"); 387 if (!disk_name) {
385 if (disk_name) { 388 err = -ENOMEM;
386 sysfs_create_link(&target->kobj,&disk->kobj,disk_name); 389 goto err_out;
387 kfree(disk_name);
388 } 390 }
391
392 err = sysfs_create_link(&disk->kobj, &target->kobj, "device");
393 if (err)
394 goto err_out_disk_name;
395
396 err = sysfs_create_link(&target->kobj, &disk->kobj, disk_name);
397 if (err)
398 goto err_out_dev_link;
389 } 399 }
390 sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, "subsystem"); 400
401 err = sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj,
402 "subsystem");
403 if (err)
404 goto err_out_disk_name_lnk;
405
406 kfree(disk_name);
407
408 return 0;
409
410err_out_disk_name_lnk:
411 if (target) {
412 sysfs_remove_link(&target->kobj, disk_name);
413err_out_dev_link:
414 sysfs_remove_link(&disk->kobj, "device");
415err_out_disk_name:
416 kfree(disk_name);
417err_out:
418 put_device(target);
419 }
420 return err;
391} 421}
392 422
393/* Not exported, helper to add_disk(). */ 423/* Not exported, helper to add_disk(). */
@@ -406,7 +436,11 @@ void register_disk(struct gendisk *disk)
406 *s = '!'; 436 *s = '!';
407 if ((err = kobject_add(&disk->kobj))) 437 if ((err = kobject_add(&disk->kobj)))
408 return; 438 return;
409 disk_sysfs_symlinks(disk); 439 err = disk_sysfs_symlinks(disk);
440 if (err) {
441 kobject_del(&disk->kobj);
442 return;
443 }
410 disk_sysfs_add_subdirs(disk); 444 disk_sysfs_add_subdirs(disk);
411 445
412 /* No minors to use for partitions */ 446 /* No minors to use for partitions */
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 82da55b5cffe..8df27401d292 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -72,6 +72,7 @@
72#include <linux/audit.h> 72#include <linux/audit.h>
73#include <linux/poll.h> 73#include <linux/poll.h>
74#include <linux/nsproxy.h> 74#include <linux/nsproxy.h>
75#include <linux/oom.h>
75#include "internal.h" 76#include "internal.h"
76 77
77/* NOTE: 78/* NOTE:
@@ -86,7 +87,7 @@
86 87
87 88
88/* Worst case buffer size needed for holding an integer. */ 89/* Worst case buffer size needed for holding an integer. */
89#define PROC_NUMBUF 10 90#define PROC_NUMBUF 13
90 91
91struct pid_entry { 92struct pid_entry {
92 int len; 93 int len;
@@ -689,7 +690,8 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
689 if (copy_from_user(buffer, buf, count)) 690 if (copy_from_user(buffer, buf, count))
690 return -EFAULT; 691 return -EFAULT;
691 oom_adjust = simple_strtol(buffer, &end, 0); 692 oom_adjust = simple_strtol(buffer, &end, 0);
692 if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE) 693 if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
694 oom_adjust != OOM_DISABLE)
693 return -EINVAL; 695 return -EINVAL;
694 if (*end == '\n') 696 if (*end == '\n')
695 end++; 697 end++;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index ad8cbc49883a..85ce23268302 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -53,6 +53,7 @@
53#include <linux/workqueue.h> 53#include <linux/workqueue.h>
54#include <linux/writeback.h> 54#include <linux/writeback.h>
55#include <linux/blkdev.h> 55#include <linux/blkdev.h>
56#include <linux/backing-dev.h>
56 57
57/* gets a struct reiserfs_journal_list * from a list head */ 58/* gets a struct reiserfs_journal_list * from a list head */
58#define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ 59#define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
@@ -970,7 +971,7 @@ int reiserfs_async_progress_wait(struct super_block *s)
970 DEFINE_WAIT(wait); 971 DEFINE_WAIT(wait);
971 struct reiserfs_journal *j = SB_JOURNAL(s); 972 struct reiserfs_journal *j = SB_JOURNAL(s);
972 if (atomic_read(&j->j_async_throttle)) 973 if (atomic_read(&j->j_async_throttle))
973 blk_congestion_wait(WRITE, HZ / 10); 974 congestion_wait(WRITE, HZ / 10);
974 return 0; 975 return 0;
975} 976}
976 977
diff --git a/fs/splice.c b/fs/splice.c
index a567010b62ac..49fb9f129938 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -707,9 +707,9 @@ out_ret:
707 * key here is the 'actor' worker passed in that actually moves the data 707 * key here is the 'actor' worker passed in that actually moves the data
708 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above. 708 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.
709 */ 709 */
710ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, 710static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
711 loff_t *ppos, size_t len, unsigned int flags, 711 struct file *out, loff_t *ppos, size_t len,
712 splice_actor *actor) 712 unsigned int flags, splice_actor *actor)
713{ 713{
714 int ret, do_wakeup, err; 714 int ret, do_wakeup, err;
715 struct splice_desc sd; 715 struct splice_desc sd;
@@ -722,9 +722,6 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
722 sd.file = out; 722 sd.file = out;
723 sd.pos = *ppos; 723 sd.pos = *ppos;
724 724
725 if (pipe->inode)
726 mutex_lock(&pipe->inode->i_mutex);
727
728 for (;;) { 725 for (;;) {
729 if (pipe->nrbufs) { 726 if (pipe->nrbufs) {
730 struct pipe_buffer *buf = pipe->bufs + pipe->curbuf; 727 struct pipe_buffer *buf = pipe->bufs + pipe->curbuf;
@@ -797,9 +794,6 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
797 pipe_wait(pipe); 794 pipe_wait(pipe);
798 } 795 }
799 796
800 if (pipe->inode)
801 mutex_unlock(&pipe->inode->i_mutex);
802
803 if (do_wakeup) { 797 if (do_wakeup) {
804 smp_mb(); 798 smp_mb();
805 if (waitqueue_active(&pipe->wait)) 799 if (waitqueue_active(&pipe->wait))
@@ -810,6 +804,73 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
810 return ret; 804 return ret;
811} 805}
812 806
807ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
808 loff_t *ppos, size_t len, unsigned int flags,
809 splice_actor *actor)
810{
811 ssize_t ret;
812 struct inode *inode = out->f_mapping->host;
813
814 /*
815 * The actor worker might be calling ->prepare_write and
816 * ->commit_write. Most of the time, these expect i_mutex to
817 * be held. Since this may result in an ABBA deadlock with
818 * pipe->inode, we have to order lock acquiry here.
819 */
820 inode_double_lock(inode, pipe->inode);
821 ret = __splice_from_pipe(pipe, out, ppos, len, flags, actor);
822 inode_double_unlock(inode, pipe->inode);
823
824 return ret;
825}
826
827/**
828 * generic_file_splice_write_nolock - generic_file_splice_write without mutexes
829 * @pipe: pipe info
830 * @out: file to write to
831 * @len: number of bytes to splice
832 * @flags: splice modifier flags
833 *
834 * Will either move or copy pages (determined by @flags options) from
835 * the given pipe inode to the given file. The caller is responsible
836 * for acquiring i_mutex on both inodes.
837 *
838 */
839ssize_t
840generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
841 loff_t *ppos, size_t len, unsigned int flags)
842{
843 struct address_space *mapping = out->f_mapping;
844 struct inode *inode = mapping->host;
845 ssize_t ret;
846 int err;
847
848 err = remove_suid(out->f_dentry);
849 if (unlikely(err))
850 return err;
851
852 ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
853 if (ret > 0) {
854 *ppos += ret;
855
856 /*
857 * If file or inode is SYNC and we actually wrote some data,
858 * sync it.
859 */
860 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) {
861 err = generic_osync_inode(inode, mapping,
862 OSYNC_METADATA|OSYNC_DATA);
863
864 if (err)
865 ret = err;
866 }
867 }
868
869 return ret;
870}
871
872EXPORT_SYMBOL(generic_file_splice_write_nolock);
873
813/** 874/**
814 * generic_file_splice_write - splice data from a pipe to a file 875 * generic_file_splice_write - splice data from a pipe to a file
815 * @pipe: pipe info 876 * @pipe: pipe info
@@ -826,12 +887,21 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
826 loff_t *ppos, size_t len, unsigned int flags) 887 loff_t *ppos, size_t len, unsigned int flags)
827{ 888{
828 struct address_space *mapping = out->f_mapping; 889 struct address_space *mapping = out->f_mapping;
890 struct inode *inode = mapping->host;
829 ssize_t ret; 891 ssize_t ret;
892 int err;
893
894 err = should_remove_suid(out->f_dentry);
895 if (unlikely(err)) {
896 mutex_lock(&inode->i_mutex);
897 err = __remove_suid(out->f_dentry, err);
898 mutex_unlock(&inode->i_mutex);
899 if (err)
900 return err;
901 }
830 902
831 ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); 903 ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
832 if (ret > 0) { 904 if (ret > 0) {
833 struct inode *inode = mapping->host;
834
835 *ppos += ret; 905 *ppos += ret;
836 906
837 /* 907 /*
@@ -839,8 +909,6 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
839 * sync it. 909 * sync it.
840 */ 910 */
841 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { 911 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) {
842 int err;
843
844 mutex_lock(&inode->i_mutex); 912 mutex_lock(&inode->i_mutex);
845 err = generic_osync_inode(inode, mapping, 913 err = generic_osync_inode(inode, mapping,
846 OSYNC_METADATA|OSYNC_DATA); 914 OSYNC_METADATA|OSYNC_DATA);
@@ -1400,13 +1468,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
1400 * grabbing by inode address. Otherwise two different processes 1468 * grabbing by inode address. Otherwise two different processes
1401 * could deadlock (one doing tee from A -> B, the other from B -> A). 1469 * could deadlock (one doing tee from A -> B, the other from B -> A).
1402 */ 1470 */
1403 if (ipipe->inode < opipe->inode) { 1471 inode_double_lock(ipipe->inode, opipe->inode);
1404 mutex_lock_nested(&ipipe->inode->i_mutex, I_MUTEX_PARENT);
1405 mutex_lock_nested(&opipe->inode->i_mutex, I_MUTEX_CHILD);
1406 } else {
1407 mutex_lock_nested(&opipe->inode->i_mutex, I_MUTEX_PARENT);
1408 mutex_lock_nested(&ipipe->inode->i_mutex, I_MUTEX_CHILD);
1409 }
1410 1472
1411 do { 1473 do {
1412 if (!opipe->readers) { 1474 if (!opipe->readers) {
@@ -1450,8 +1512,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
1450 i++; 1512 i++;
1451 } while (len); 1513 } while (len);
1452 1514
1453 mutex_unlock(&ipipe->inode->i_mutex); 1515 inode_double_unlock(ipipe->inode, opipe->inode);
1454 mutex_unlock(&opipe->inode->i_mutex);
1455 1516
1456 /* 1517 /*
1457 * If we put data in the output pipe, wakeup any potential readers. 1518 * If we put data in the output pipe, wakeup any potential readers.
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 146f1dedec84..298303b5a716 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -483,17 +483,12 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
483 (victim->d_parent->d_inode == dir->d_inode)) { 483 (victim->d_parent->d_inode == dir->d_inode)) {
484 victim->d_inode->i_mtime = CURRENT_TIME; 484 victim->d_inode->i_mtime = CURRENT_TIME;
485 fsnotify_modify(victim); 485 fsnotify_modify(victim);
486
487 /**
488 * Drop reference from initial sysfs_get_dentry().
489 */
490 dput(victim);
491 res = 0; 486 res = 0;
492 } else 487 } else
493 d_drop(victim); 488 d_drop(victim);
494 489
495 /** 490 /**
496 * Drop the reference acquired from sysfs_get_dentry() above. 491 * Drop the reference acquired from lookup_one_len() above.
497 */ 492 */
498 dput(victim); 493 dput(victim);
499 } 494 }
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c
index d59737589815..004baf600611 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -21,6 +21,7 @@
21#include <linux/highmem.h> 21#include <linux/highmem.h>
22#include <linux/swap.h> 22#include <linux/swap.h>
23#include <linux/blkdev.h> 23#include <linux/blkdev.h>
24#include <linux/backing-dev.h>
24#include "time.h" 25#include "time.h"
25#include "kmem.h" 26#include "kmem.h"
26 27
@@ -53,7 +54,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
53 printk(KERN_ERR "XFS: possible memory allocation " 54 printk(KERN_ERR "XFS: possible memory allocation "
54 "deadlock in %s (mode:0x%x)\n", 55 "deadlock in %s (mode:0x%x)\n",
55 __FUNCTION__, lflags); 56 __FUNCTION__, lflags);
56 blk_congestion_wait(WRITE, HZ/50); 57 congestion_wait(WRITE, HZ/50);
57 } while (1); 58 } while (1);
58} 59}
59 60
@@ -131,7 +132,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
131 printk(KERN_ERR "XFS: possible memory allocation " 132 printk(KERN_ERR "XFS: possible memory allocation "
132 "deadlock in %s (mode:0x%x)\n", 133 "deadlock in %s (mode:0x%x)\n",
133 __FUNCTION__, lflags); 134 __FUNCTION__, lflags);
134 blk_congestion_wait(WRITE, HZ/50); 135 congestion_wait(WRITE, HZ/50);
135 } while (1); 136 } while (1);
136} 137}
137 138
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 9bbadafdcb00..db5f5a3608ca 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -30,6 +30,7 @@
30#include <linux/hash.h> 30#include <linux/hash.h>
31#include <linux/kthread.h> 31#include <linux/kthread.h>
32#include <linux/migrate.h> 32#include <linux/migrate.h>
33#include <linux/backing-dev.h>
33#include "xfs_linux.h" 34#include "xfs_linux.h"
34 35
35STATIC kmem_zone_t *xfs_buf_zone; 36STATIC kmem_zone_t *xfs_buf_zone;
@@ -395,7 +396,7 @@ _xfs_buf_lookup_pages(
395 396
396 XFS_STATS_INC(xb_page_retries); 397 XFS_STATS_INC(xb_page_retries);
397 xfsbufd_wakeup(0, gfp_mask); 398 xfsbufd_wakeup(0, gfp_mask);
398 blk_congestion_wait(WRITE, HZ/50); 399 congestion_wait(WRITE, HZ/50);
399 goto retry; 400 goto retry;
400 } 401 }
401 402
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index f5cc65dd7d0d..68731e0923a4 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1681,6 +1681,7 @@
1681#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */ 1681#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */
1682#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ 1682#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */
1683 1683
1684#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */
1684#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */ 1685#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */
1685#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */ 1686#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */
1686#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */ 1687#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */
diff --git a/include/asm-arm/arch-sa1100/jornada720.h b/include/asm-arm/arch-sa1100/jornada720.h
index 1b8e8a304800..3f37ca07806d 100644
--- a/include/asm-arm/arch-sa1100/jornada720.h
+++ b/include/asm-arm/arch-sa1100/jornada720.h
@@ -19,6 +19,20 @@
19#define GPIO_JORNADA720_KEYBOARD_IRQ IRQ_GPIO0 19#define GPIO_JORNADA720_KEYBOARD_IRQ IRQ_GPIO0
20#define GPIO_JORNADA720_MOUSE_IRQ IRQ_GPIO9 20#define GPIO_JORNADA720_MOUSE_IRQ IRQ_GPIO9
21 21
22/* MCU COMMANDS */
23#define MCU_GetBatteryData 0xc0
24#define MCU_GetScanKeyCode 0x90
25#define MCU_GetTouchSamples 0xa0
26#define MCU_GetContrast 0xD0
27#define MCU_SetContrast 0xD1
28#define MCU_GetBrightness 0xD2
29#define MCU_SetBrightness 0xD3
30#define MCU_ContrastOff 0xD8
31#define MCU_BrightnessOff 0xD9
32#define MCU_PWMOFF 0xDF
33#define MCU_TxDummy 0x11
34#define MCU_ErrorCode 0x00
35
22#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
23 37
24void jornada720_mcu_init(void); 38void jornada720_mcu_init(void);
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index e2247c22a638..0f390f41f816 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -82,11 +82,11 @@ extern struct page *kmap_atomic_to_page(void *ptr);
82 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \ 82 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
83 \ 83 \
84 if (type != __KM_CACHE) \ 84 if (type != __KM_CACHE) \
85 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr)); \ 85 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \
86 else \ 86 else \
87 asm volatile("movgs %0,iampr"#ampr"\n" \ 87 asm volatile("movgs %0,iampr"#ampr"\n" \
88 "movgs %0,dampr"#ampr"\n" \ 88 "movgs %0,dampr"#ampr"\n" \
89 :: "r"(dampr) \ 89 :: "r"(dampr) : "memory" \
90 ); \ 90 ); \
91 \ 91 \
92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \ 92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
@@ -104,7 +104,7 @@ extern struct page *kmap_atomic_to_page(void *ptr);
104 asm volatile("movgs %0,tplr \n" \ 104 asm volatile("movgs %0,tplr \n" \
105 "movgs %1,tppr \n" \ 105 "movgs %1,tppr \n" \
106 "tlbpr %0,gr0,#2,#1" \ 106 "tlbpr %0,gr0,#2,#1" \
107 : : "r"(damlr), "r"(dampr)); \ 107 : : "r"(damlr), "r"(dampr) : "memory"); \
108 \ 108 \
109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \ 109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \
110 \ 110 \
@@ -115,7 +115,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
115{ 115{
116 unsigned long paddr; 116 unsigned long paddr;
117 117
118 preempt_disable(); 118 inc_preempt_count();
119 paddr = page_to_phys(page); 119 paddr = page_to_phys(page);
120 120
121 switch (type) { 121 switch (type) {
@@ -138,16 +138,16 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
138 } 138 }
139} 139}
140 140
141#define __kunmap_atomic_primary(type, ampr) \ 141#define __kunmap_atomic_primary(type, ampr) \
142do { \ 142do { \
143 asm volatile("movgs gr0,dampr"#ampr"\n"); \ 143 asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \
144 if (type == __KM_CACHE) \ 144 if (type == __KM_CACHE) \
145 asm volatile("movgs gr0,iampr"#ampr"\n"); \ 145 asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \
146} while(0) 146} while(0)
147 147
148#define __kunmap_atomic_secondary(slot, vaddr) \ 148#define __kunmap_atomic_secondary(slot, vaddr) \
149do { \ 149do { \
150 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr)); \ 150 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \
151} while(0) 151} while(0)
152 152
153static inline void kunmap_atomic(void *kvaddr, enum km_type type) 153static inline void kunmap_atomic(void *kvaddr, enum km_type type)
@@ -170,7 +170,8 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
170 default: 170 default:
171 BUG(); 171 BUG();
172 } 172 }
173 preempt_enable(); 173 dec_preempt_count();
174 preempt_check_resched();
174} 175}
175 176
176#endif /* !__ASSEMBLY__ */ 177#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 1d9573cf4a0b..c92ae0f166ff 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -37,7 +37,10 @@
37#endif 37#endif
38 38
39#ifndef HAVE_ARCH_WARN_ON 39#ifndef HAVE_ARCH_WARN_ON
40#define WARN_ON(condition) unlikely((condition)) 40#define WARN_ON(condition) ({ \
41 typeof(condition) __ret_warn_on = (condition); \
42 unlikely(__ret_warn_on); \
43})
41#endif 44#endif
42#endif 45#endif
43 46
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 43bfff6c6b87..855c30af72a9 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -417,6 +417,8 @@ __writeq (unsigned long val, volatile void __iomem *addr)
417# define outl_p outl 417# define outl_p outl
418#endif 418#endif
419 419
420# ifdef __KERNEL__
421
420extern void __iomem * ioremap(unsigned long offset, unsigned long size); 422extern void __iomem * ioremap(unsigned long offset, unsigned long size);
421extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 423extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
422 424
@@ -430,8 +432,6 @@ iounmap (volatile void __iomem *addr)
430#define dmi_iounmap(x,l) iounmap(x) 432#define dmi_iounmap(x,l) iounmap(x)
431#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) 433#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
432 434
433# ifdef __KERNEL__
434
435/* 435/*
436 * String version of IO memory access ops: 436 * String version of IO memory access ops:
437 */ 437 */
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 2c8fd92d0ece..4283ddcc25fb 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -764,7 +764,7 @@ struct ia64_pal_retval {
764 * (generally 0) MUST be passed. Reserved parameters are not optional 764 * (generally 0) MUST be passed. Reserved parameters are not optional
765 * parameters. 765 * parameters.
766 */ 766 */
767extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64, u64); 767extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
768extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64); 768extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
769extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64); 769extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
770extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64); 770extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
@@ -774,14 +774,7 @@ extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
774#define PAL_CALL(iprv,a0,a1,a2,a3) do { \ 774#define PAL_CALL(iprv,a0,a1,a2,a3) do { \
775 struct ia64_fpreg fr[6]; \ 775 struct ia64_fpreg fr[6]; \
776 ia64_save_scratch_fpregs(fr); \ 776 ia64_save_scratch_fpregs(fr); \
777 iprv = ia64_pal_call_static(a0, a1, a2, a3, 0); \ 777 iprv = ia64_pal_call_static(a0, a1, a2, a3); \
778 ia64_load_scratch_fpregs(fr); \
779} while (0)
780
781#define PAL_CALL_IC_OFF(iprv,a0,a1,a2,a3) do { \
782 struct ia64_fpreg fr[6]; \
783 ia64_save_scratch_fpregs(fr); \
784 iprv = ia64_pal_call_static(a0, a1, a2, a3, 1); \
785 ia64_load_scratch_fpregs(fr); \ 778 ia64_load_scratch_fpregs(fr); \
786} while (0) 779} while (0)
787 780
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index c2d124badbe5..bc5f3c53155f 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -172,7 +172,7 @@ extern unsigned long isa_slot_offset;
172#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 172#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
173 173
174extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags); 174extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
175extern void __iounmap(volatile void __iomem *addr); 175extern void __iounmap(const volatile void __iomem *addr);
176 176
177static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size, 177static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
178 unsigned long flags) 178 unsigned long flags)
@@ -279,7 +279,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
279#define ioremap_uncached_accelerated(offset, size) \ 279#define ioremap_uncached_accelerated(offset, size) \
280 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED) 280 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)
281 281
282static inline void iounmap(volatile void __iomem *addr) 282static inline void iounmap(const volatile void __iomem *addr)
283{ 283{
284#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) 284#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
285 285
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 685c91467e63..30240a445dbb 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -331,16 +331,17 @@
331#define __NR_move_pages (__NR_Linux + 308) 331#define __NR_move_pages (__NR_Linux + 308)
332#define __NR_set_robust_list (__NR_Linux + 309) 332#define __NR_set_robust_list (__NR_Linux + 309)
333#define __NR_get_robust_list (__NR_Linux + 310) 333#define __NR_get_robust_list (__NR_Linux + 310)
334#define __NR_kexec_load (__NR_Linux + 311)
334 335
335/* 336/*
336 * Offset of the last Linux o32 flavoured syscall 337 * Offset of the last Linux o32 flavoured syscall
337 */ 338 */
338#define __NR_Linux_syscalls 310 339#define __NR_Linux_syscalls 311
339 340
340#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 341#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
341 342
342#define __NR_O32_Linux 4000 343#define __NR_O32_Linux 4000
343#define __NR_O32_Linux_syscalls 310 344#define __NR_O32_Linux_syscalls 311
344 345
345#if _MIPS_SIM == _MIPS_SIM_ABI64 346#if _MIPS_SIM == _MIPS_SIM_ABI64
346 347
@@ -618,16 +619,17 @@
618#define __NR_move_pages (__NR_Linux + 267) 619#define __NR_move_pages (__NR_Linux + 267)
619#define __NR_set_robust_list (__NR_Linux + 268) 620#define __NR_set_robust_list (__NR_Linux + 268)
620#define __NR_get_robust_list (__NR_Linux + 269) 621#define __NR_get_robust_list (__NR_Linux + 269)
622#define __NR_kexec_load (__NR_Linux + 270)
621 623
622/* 624/*
623 * Offset of the last Linux 64-bit flavoured syscall 625 * Offset of the last Linux 64-bit flavoured syscall
624 */ 626 */
625#define __NR_Linux_syscalls 269 627#define __NR_Linux_syscalls 270
626 628
627#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 629#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
628 630
629#define __NR_64_Linux 5000 631#define __NR_64_Linux 5000
630#define __NR_64_Linux_syscalls 269 632#define __NR_64_Linux_syscalls 270
631 633
632#if _MIPS_SIM == _MIPS_SIM_NABI32 634#if _MIPS_SIM == _MIPS_SIM_NABI32
633 635
@@ -909,16 +911,17 @@
909#define __NR_move_pages (__NR_Linux + 271) 911#define __NR_move_pages (__NR_Linux + 271)
910#define __NR_set_robust_list (__NR_Linux + 272) 912#define __NR_set_robust_list (__NR_Linux + 272)
911#define __NR_get_robust_list (__NR_Linux + 273) 913#define __NR_get_robust_list (__NR_Linux + 273)
914#define __NR_kexec_load (__NR_Linux + 274)
912 915
913/* 916/*
914 * Offset of the last N32 flavoured syscall 917 * Offset of the last N32 flavoured syscall
915 */ 918 */
916#define __NR_Linux_syscalls 273 919#define __NR_Linux_syscalls 274
917 920
918#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 921#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
919 922
920#define __NR_N32_Linux 6000 923#define __NR_N32_Linux 6000
921#define __NR_N32_Linux_syscalls 273 924#define __NR_N32_Linux_syscalls 274
922 925
923#ifdef __KERNEL__ 926#ifdef __KERNEL__
924 927
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index dd3eb3dc5886..88b492f6ea9c 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -75,7 +75,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
75 * Interrupt Control Unit 75 * Interrupt Control Unit
76 */ 76 */
77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); 77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *)); 78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int));
79 79
80#define PIUINT_COMMAND 0x0040 80#define PIUINT_COMMAND 0x0040
81#define PIUINT_DATA 0x0020 81#define PIUINT_DATA 0x0020
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 519f0a5ff181..36bb6dacf008 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -200,18 +200,45 @@ extern char empty_zero_page[PAGE_SIZE];
200 */ 200 */
201 201
202/* Hardware bits in the page table entry */ 202/* Hardware bits in the page table entry */
203#define _PAGE_RO 0x200 /* HW read-only */ 203#define _PAGE_RO 0x200 /* HW read-only bit */
204#define _PAGE_INVALID 0x400 /* HW invalid */ 204#define _PAGE_INVALID 0x400 /* HW invalid bit */
205#define _PAGE_SWT 0x001 /* SW pte type bit t */
206#define _PAGE_SWX 0x002 /* SW pte type bit x */
205 207
206/* Mask and six different types of pages. */ 208/* Six different types of pages. */
207#define _PAGE_TYPE_MASK 0x601
208#define _PAGE_TYPE_EMPTY 0x400 209#define _PAGE_TYPE_EMPTY 0x400
209#define _PAGE_TYPE_NONE 0x401 210#define _PAGE_TYPE_NONE 0x401
210#define _PAGE_TYPE_SWAP 0x600 211#define _PAGE_TYPE_SWAP 0x403
211#define _PAGE_TYPE_FILE 0x601 212#define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */
212#define _PAGE_TYPE_RO 0x200 213#define _PAGE_TYPE_RO 0x200
213#define _PAGE_TYPE_RW 0x000 214#define _PAGE_TYPE_RW 0x000
214 215
216/*
217 * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
218 * pte_none and pte_file to find out the pte type WITHOUT holding the page
219 * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to
220 * invalidate a given pte. ipte sets the hw invalid bit and clears all tlbs
221 * for the page. The page table entry is set to _PAGE_TYPE_EMPTY afterwards.
222 * This change is done while holding the lock, but the intermediate step
223 * of a previously valid pte with the hw invalid bit set can be observed by
224 * handle_pte_fault. That makes it necessary that all valid pte types with
225 * the hw invalid bit set must be distinguishable from the four pte types
226 * empty, none, swap and file.
227 *
228 * irxt ipte irxt
229 * _PAGE_TYPE_EMPTY 1000 -> 1000
230 * _PAGE_TYPE_NONE 1001 -> 1001
231 * _PAGE_TYPE_SWAP 1011 -> 1011
232 * _PAGE_TYPE_FILE 11?1 -> 11?1
233 * _PAGE_TYPE_RO 0100 -> 1100
234 * _PAGE_TYPE_RW 0000 -> 1000
235 *
236 * pte_none is true for bits combinations 1000, 1100
237 * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001
238 * pte_file is true for bits combinations 1101, 1111
239 * swap pte is 1011 and 0001, 0011, 0101, 0111, 1010 and 1110 are invalid.
240 */
241
215#ifndef __s390x__ 242#ifndef __s390x__
216 243
217/* Bits in the segment table entry */ 244/* Bits in the segment table entry */
@@ -365,18 +392,21 @@ static inline int pmd_bad(pmd_t pmd)
365 392
366static inline int pte_none(pte_t pte) 393static inline int pte_none(pte_t pte)
367{ 394{
368 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY; 395 return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT);
369} 396}
370 397
371static inline int pte_present(pte_t pte) 398static inline int pte_present(pte_t pte)
372{ 399{
373 return !(pte_val(pte) & _PAGE_INVALID) || 400 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT | _PAGE_SWX;
374 (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE; 401 return (pte_val(pte) & mask) == _PAGE_TYPE_NONE ||
402 (!(pte_val(pte) & _PAGE_INVALID) &&
403 !(pte_val(pte) & _PAGE_SWT));
375} 404}
376 405
377static inline int pte_file(pte_t pte) 406static inline int pte_file(pte_t pte)
378{ 407{
379 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE; 408 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT;
409 return (pte_val(pte) & mask) == _PAGE_TYPE_FILE;
380} 410}
381 411
382#define pte_same(a,b) (pte_val(a) == pte_val(b)) 412#define pte_same(a,b) (pte_val(a) == pte_val(b))
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index a19238cbcffa..71d3c21b84f0 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -249,8 +249,9 @@
249#define __NR_vmsplice 309 249#define __NR_vmsplice 309
250/* Number 310 is reserved for new sys_move_pages */ 250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311 251#define __NR_getcpu 311
252#define __NR_epoll_pwait 312
252 253
253#define NR_syscalls 312 254#define NR_syscalls 313
254 255
255/* 256/*
256 * There are some system calls that are not present on 64 bit, some 257 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index 83a3dd15a6ed..aaf6ef40ee2f 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -8,11 +8,6 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10 10
11#ifdef __KERNEL__
12#include <asm/mbus.h>
13#include <asm/uaccess.h>
14#endif
15
16/* 11/*
17 * Sparc section types 12 * Sparc section types
18 */ 13 */
@@ -77,6 +72,23 @@ typedef unsigned long elf_greg_t;
77#define ELF_NGREG 38 72#define ELF_NGREG 38
78typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 73typedef elf_greg_t elf_gregset_t[ELF_NGREG];
79 74
75typedef struct {
76 union {
77 unsigned long pr_regs[32];
78 double pr_dregs[16];
79 } pr_fr;
80 unsigned long __unused;
81 unsigned long pr_fsr;
82 unsigned char pr_qcnt;
83 unsigned char pr_q_entrysize;
84 unsigned char pr_en;
85 unsigned int pr_q[64];
86} elf_fpregset_t;
87
88#ifdef __KERNEL__
89#include <asm/mbus.h>
90#include <asm/uaccess.h>
91
80/* Format is: 92/* Format is:
81 * G0 --> G7 93 * G0 --> G7
82 * O0 --> O7 94 * O0 --> O7
@@ -99,20 +111,7 @@ do { unsigned long *dest = &(__elf_regs[0]); \
99 dest[34] = src->npc; \ 111 dest[34] = src->npc; \
100 dest[35] = src->y; \ 112 dest[35] = src->y; \
101 dest[36] = dest[37] = 0; /* XXX */ \ 113 dest[36] = dest[37] = 0; /* XXX */ \
102} while(0); /* Janitors: Don't touch this colon. */ 114} while(0); /* Janitors: Don't touch this semicolon. */
103
104typedef struct {
105 union {
106 unsigned long pr_regs[32];
107 double pr_dregs[16];
108 } pr_fr;
109 unsigned long __unused;
110 unsigned long pr_fsr;
111 unsigned char pr_qcnt;
112 unsigned char pr_q_entrysize;
113 unsigned char pr_en;
114 unsigned int pr_q[64];
115} elf_fpregset_t;
116 115
117#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ 116#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
118 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; }) 117 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
@@ -165,8 +164,8 @@ typedef struct {
165 164
166#define ELF_PLATFORM (NULL) 165#define ELF_PLATFORM (NULL)
167 166
168#ifdef __KERNEL__
169#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 167#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
170#endif 168
169#endif /* __KERNEL__ */
171 170
172#endif /* !(__ASMSPARC_ELF_H) */ 171#endif /* !(__ASMSPARC_ELF_H) */
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h
index 172cd6ffacc4..4269d8a37b4f 100644
--- a/include/asm-um/archparam-ppc.h
+++ b/include/asm-um/archparam-ppc.h
@@ -1,15 +1,6 @@
1#ifndef __UM_ARCHPARAM_PPC_H 1#ifndef __UM_ARCHPARAM_PPC_H
2#define __UM_ARCHPARAM_PPC_H 2#define __UM_ARCHPARAM_PPC_H
3 3
4/********* Bits for asm-um/hw_irq.h **********/
5
6struct hw_interrupt_type;
7
8/********* Bits for asm-um/hardirq.h **********/
9
10#define irq_enter(cpu, irq) hardirq_enter(cpu)
11#define irq_exit(cpu, irq) hardirq_exit(cpu)
12
13/********* Bits for asm-um/string.h **********/ 4/********* Bits for asm-um/string.h **********/
14 5
15#define __HAVE_ARCH_STRRCHR 6#define __HAVE_ARCH_STRRCHR
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5114ff18101d..a1155a2beb32 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -120,6 +120,7 @@ header-y += netrom.h
120header-y += nfs2.h 120header-y += nfs2.h
121header-y += nfs4_mount.h 121header-y += nfs4_mount.h
122header-y += nfs_mount.h 122header-y += nfs_mount.h
123header-y += oom.h
123header-y += param.h 124header-y += param.h
124header-y += pci_ids.h 125header-y += pci_ids.h
125header-y += pci_regs.h 126header-y += pci_regs.h
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index f7a1390d67f5..7011d6255593 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -10,6 +10,8 @@
10 10
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12 12
13struct page;
14
13/* 15/*
14 * Bits in backing_dev_info.state 16 * Bits in backing_dev_info.state
15 */ 17 */
@@ -88,6 +90,11 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
88 (1 << BDI_write_congested)); 90 (1 << BDI_write_congested));
89} 91}
90 92
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout);
96void congestion_end(int rw);
97
91#define bdi_cap_writeback_dirty(bdi) \ 98#define bdi_cap_writeback_dirty(bdi) \
92 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) 99 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
93 100
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d370d2cfe138..7bfcde2d5578 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -651,6 +651,26 @@ extern void blk_recount_segments(request_queue_t *, struct bio *);
651extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 651extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
652extern int sg_scsi_ioctl(struct file *, struct request_queue *, 652extern int sg_scsi_ioctl(struct file *, struct request_queue *,
653 struct gendisk *, struct scsi_ioctl_command __user *); 653 struct gendisk *, struct scsi_ioctl_command __user *);
654
655/*
656 * A queue has just exitted congestion. Note this in the global counter of
657 * congested queues, and wake up anyone who was waiting for requests to be
658 * put back.
659 */
660static inline void blk_clear_queue_congested(request_queue_t *q, int rw)
661{
662 clear_bdi_congested(&q->backing_dev_info, rw);
663}
664
665/*
666 * A queue has just entered congestion. Flag that in the queue's VM-visible
667 * state flags and increment the global gounter of congested queues.
668 */
669static inline void blk_set_queue_congested(request_queue_t *q, int rw)
670{
671 set_bdi_congested(&q->backing_dev_info, rw);
672}
673
654extern void blk_start_queue(request_queue_t *q); 674extern void blk_start_queue(request_queue_t *q);
655extern void blk_stop_queue(request_queue_t *q); 675extern void blk_stop_queue(request_queue_t *q);
656extern void blk_sync_queue(struct request_queue *q); 676extern void blk_sync_queue(struct request_queue *q);
@@ -765,10 +785,8 @@ extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
765extern void blk_queue_free_tags(request_queue_t *); 785extern void blk_queue_free_tags(request_queue_t *);
766extern int blk_queue_resize_tags(request_queue_t *, int); 786extern int blk_queue_resize_tags(request_queue_t *, int);
767extern void blk_queue_invalidate_tags(request_queue_t *); 787extern void blk_queue_invalidate_tags(request_queue_t *);
768extern long blk_congestion_wait(int rw, long timeout);
769extern struct blk_queue_tag *blk_init_tags(int); 788extern struct blk_queue_tag *blk_init_tags(int);
770extern void blk_free_tags(struct blk_queue_tag *); 789extern void blk_free_tags(struct blk_queue_tag *);
771extern void blk_congestion_end(int rw);
772 790
773static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, 791static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
774 int tag) 792 int tag)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 131ffd37e716..5d9fb0e94156 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -69,6 +69,8 @@ struct buffer_head {
69 bh_end_io_t *b_end_io; /* I/O completion */ 69 bh_end_io_t *b_end_io; /* I/O completion */
70 void *b_private; /* reserved for b_end_io */ 70 void *b_private; /* reserved for b_end_io */
71 struct list_head b_assoc_buffers; /* associated with another mapping */ 71 struct list_head b_assoc_buffers; /* associated with another mapping */
72 struct address_space *b_assoc_map; /* mapping this buffer is
73 associated with */
72 atomic_t b_count; /* users using this buffer_head */ 74 atomic_t b_count; /* users using this buffer_head */
73}; 75};
74 76
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed467c3..2fe6e3f900ba 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -623,6 +623,9 @@ enum inode_i_mutex_lock_class
623 I_MUTEX_QUOTA 623 I_MUTEX_QUOTA
624}; 624};
625 625
626extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
627extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
628
626/* 629/*
627 * NOTE: in a 32bit arch with a preemptable kernel and 630 * NOTE: in a 32bit arch with a preemptable kernel and
628 * an UP compile the i_size_read/write must be atomic 631 * an UP compile the i_size_read/write must be atomic
@@ -656,7 +659,11 @@ static inline loff_t i_size_read(struct inode *inode)
656#endif 659#endif
657} 660}
658 661
659 662/*
663 * NOTE: unlike i_size_read(), i_size_write() does need locking around it
664 * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
665 * can be lost, resulting in subsequent i_size_read() calls spinning forever.
666 */
660static inline void i_size_write(struct inode *inode, loff_t i_size) 667static inline void i_size_write(struct inode *inode, loff_t i_size)
661{ 668{
662#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 669#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
@@ -1705,6 +1712,8 @@ extern void __iget(struct inode * inode);
1705extern void clear_inode(struct inode *); 1712extern void clear_inode(struct inode *);
1706extern void destroy_inode(struct inode *); 1713extern void destroy_inode(struct inode *);
1707extern struct inode *new_inode(struct super_block *); 1714extern struct inode *new_inode(struct super_block *);
1715extern int __remove_suid(struct dentry *, int);
1716extern int should_remove_suid(struct dentry *);
1708extern int remove_suid(struct dentry *); 1717extern int remove_suid(struct dentry *);
1709extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1718extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1710 1719
@@ -1751,6 +1760,8 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
1751 struct pipe_inode_info *, size_t, unsigned int); 1760 struct pipe_inode_info *, size_t, unsigned int);
1752extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 1761extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
1753 struct file *, loff_t *, size_t, unsigned int); 1762 struct file *, loff_t *, size_t, unsigned int);
1763extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
1764 struct file *, loff_t *, size_t, unsigned int);
1754extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 1765extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
1755 struct file *out, loff_t *, size_t len, unsigned int flags); 1766 struct file *out, loff_t *, size_t len, unsigned int flags);
1756extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 1767extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c64f3cc7e870..52fc4052a0ae 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -141,6 +141,7 @@ struct irq_chip {
141 * @pending_mask: pending rebalanced interrupts 141 * @pending_mask: pending rebalanced interrupts
142 * @dir: /proc/irq/ procfs entry 142 * @dir: /proc/irq/ procfs entry
143 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP 143 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
144 * @name: flow handler name for /proc/interrupts output
144 * 145 *
145 * Pad this out to 32 bytes for cache and indexing reasons. 146 * Pad this out to 32 bytes for cache and indexing reasons.
146 */ 147 */
@@ -165,8 +166,9 @@ struct irq_desc {
165 cpumask_t pending_mask; 166 cpumask_t pending_mask;
166#endif 167#endif
167#ifdef CONFIG_PROC_FS 168#ifdef CONFIG_PROC_FS
168 struct proc_dir_entry *dir; 169 struct proc_dir_entry *dir;
169#endif 170#endif
171 const char *name;
170} ____cacheline_aligned; 172} ____cacheline_aligned;
171 173
172extern struct irq_desc irq_desc[NR_IRQS]; 174extern struct irq_desc irq_desc[NR_IRQS];
@@ -272,12 +274,6 @@ extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
272extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); 274extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc);
273 275
274/* 276/*
275 * Get a descriptive string for the highlevel handler, for
276 * /proc/interrupts output:
277 */
278extern const char *handle_irq_name(irq_flow_handler_t handle);
279
280/*
281 * Monolithic do_IRQ implementation. 277 * Monolithic do_IRQ implementation.
282 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) 278 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
283 */ 279 */
@@ -329,7 +325,12 @@ extern void
329set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, 325set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
330 irq_flow_handler_t handle); 326 irq_flow_handler_t handle);
331extern void 327extern void
332__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained); 328set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
329 irq_flow_handler_t handle, const char *name);
330
331extern void
332__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
333 const char *name);
333 334
334/* 335/*
335 * Set a highlevel flow handler for a given IRQ: 336 * Set a highlevel flow handler for a given IRQ:
@@ -337,7 +338,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained);
337static inline void 338static inline void
338set_irq_handler(unsigned int irq, irq_flow_handler_t handle) 339set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
339{ 340{
340 __set_irq_handler(irq, handle, 0); 341 __set_irq_handler(irq, handle, 0, NULL);
341} 342}
342 343
343/* 344/*
@@ -349,7 +350,7 @@ static inline void
349set_irq_chained_handler(unsigned int irq, 350set_irq_chained_handler(unsigned int irq,
350 irq_flow_handler_t handle) 351 irq_flow_handler_t handle)
351{ 352{
352 __set_irq_handler(irq, handle, 1); 353 __set_irq_handler(irq, handle, 1, NULL);
353} 354}
354 355
355/* Handle dynamic irq creation and destruction */ 356/* Handle dynamic irq creation and destruction */
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 81e3a185f951..aa50d89eacd7 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -10,6 +10,11 @@
10#define LINUX_LOCKD_BIND_H 10#define LINUX_LOCKD_BIND_H
11 11
12#include <linux/lockd/nlm.h> 12#include <linux/lockd/nlm.h>
13/* need xdr-encoded error codes too, so... */
14#include <linux/lockd/xdr.h>
15#ifdef CONFIG_LOCKD_V4
16#include <linux/lockd/xdr4.h>
17#endif
13 18
14/* Dummy declarations */ 19/* Dummy declarations */
15struct svc_rqst; 20struct svc_rqst;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 2909619c0295..862d9730a60d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -154,7 +154,7 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
155void nlmclnt_finish_block(struct nlm_wait *block); 155void nlmclnt_finish_block(struct nlm_wait *block);
156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
157u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 157__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
158void nlmclnt_recovery(struct nlm_host *); 158void nlmclnt_recovery(struct nlm_host *);
159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
160void nlmclnt_next_cookie(struct nlm_cookie *); 160void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -184,12 +184,12 @@ typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref)
184/* 184/*
185 * Server-side lock handling 185 * Server-side lock handling
186 */ 186 */
187u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 187__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
188 struct nlm_lock *, int, struct nlm_cookie *); 188 struct nlm_lock *, int, struct nlm_cookie *);
189u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 189__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
190u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, 190__be32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
191 struct nlm_lock *); 191 struct nlm_lock *);
192u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 192__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
193unsigned long nlmsvc_retry_blocked(void); 193unsigned long nlmsvc_retry_blocked(void);
194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
195 nlm_host_match_fn_t match); 195 nlm_host_match_fn_t match);
@@ -198,7 +198,7 @@ void nlmsvc_grant_reply(struct nlm_cookie *, u32);
198/* 198/*
199 * File handling for the server personality 199 * File handling for the server personality
200 */ 200 */
201u32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, 201__be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
202 struct nfs_fh *); 202 struct nfs_fh *);
203void nlm_release_file(struct nlm_file *); 203void nlm_release_file(struct nlm_file *);
204void nlmsvc_mark_resources(void); 204void nlmsvc_mark_resources(void);
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index cd7816e74c05..630c5bf69b07 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -21,9 +21,9 @@ struct nlm_share {
21 u32 s_mode; /* deny mode */ 21 u32 s_mode; /* deny mode */
22}; 22};
23 23
24u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *, 24__be32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26__be32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *,
29 nlm_host_match_fn_t); 29 nlm_host_match_fn_t);
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index bb0a0f1caa91..29e7d9fc9dad 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,8 @@
13#include <linux/nfs.h> 13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h> 14#include <linux/sunrpc/xdr.h>
15 15
16struct svc_rqst;
17
16#define NLM_MAXCOOKIELEN 32 18#define NLM_MAXCOOKIELEN 32
17#define NLM_MAXSTRLEN 1024 19#define NLM_MAXSTRLEN 1024
18 20
@@ -22,6 +24,8 @@
22#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) 24#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
23#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) 25#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
24 26
27#define nlm_drop_reply __constant_htonl(30000)
28
25/* Lock info passed via NLM */ 29/* Lock info passed via NLM */
26struct nlm_lock { 30struct nlm_lock {
27 char * caller; 31 char * caller;
@@ -86,19 +90,19 @@ struct nlm_reboot {
86 */ 90 */
87#define NLMSVC_XDRSIZE sizeof(struct nlm_args) 91#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
88 92
89int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 93int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
90int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 94int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
91int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 95int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
92int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 96int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
93int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 97int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
94int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 98int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
95int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 99int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
96int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *); 100int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
97int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *); 101int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
98int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 102int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
99int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 103int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
100int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 104int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
101int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 105int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
102/* 106/*
103int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
104int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 3cc1ae25009b..dd12b4c9e613 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -23,19 +23,19 @@
23 23
24 24
25 25
26int nlm4svc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 26int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
27int nlm4svc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 27int nlm4svc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
28int nlm4svc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 28int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
29int nlm4svc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 29int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
30int nlm4svc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 30int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
31int nlm4svc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 31int nlm4svc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
32int nlm4svc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 32int nlm4svc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
33int nlm4svc_encode_void(struct svc_rqst *, u32 *, void *); 33int nlm4svc_encode_void(struct svc_rqst *, __be32 *, void *);
34int nlm4svc_decode_void(struct svc_rqst *, u32 *, void *); 34int nlm4svc_decode_void(struct svc_rqst *, __be32 *, void *);
35int nlm4svc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 35int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
36int nlm4svc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 36int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
37int nlm4svc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 37int nlm4svc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
38int nlm4svc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 38int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
39/* 39/*
40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 1314ca0f29be..819f08f1310d 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -202,7 +202,7 @@ extern int lockdep_internal(void);
202 */ 202 */
203 203
204extern void lockdep_init_map(struct lockdep_map *lock, const char *name, 204extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
205 struct lock_class_key *key); 205 struct lock_class_key *key, int subclass);
206 206
207/* 207/*
208 * Reinitialize a lock key - for cases where there is special locking or 208 * Reinitialize a lock key - for cases where there is special locking or
@@ -211,9 +211,14 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
211 * or they are too narrow (they suffer from a false class-split): 211 * or they are too narrow (they suffer from a false class-split):
212 */ 212 */
213#define lockdep_set_class(lock, key) \ 213#define lockdep_set_class(lock, key) \
214 lockdep_init_map(&(lock)->dep_map, #key, key) 214 lockdep_init_map(&(lock)->dep_map, #key, key, 0)
215#define lockdep_set_class_and_name(lock, key, name) \ 215#define lockdep_set_class_and_name(lock, key, name) \
216 lockdep_init_map(&(lock)->dep_map, name, key) 216 lockdep_init_map(&(lock)->dep_map, name, key, 0)
217#define lockdep_set_class_and_subclass(lock, key, sub) \
218 lockdep_init_map(&(lock)->dep_map, #key, key, sub)
219#define lockdep_set_subclass(lock, sub) \
220 lockdep_init_map(&(lock)->dep_map, #lock, \
221 (lock)->dep_map.key, sub)
217 222
218/* 223/*
219 * Acquire a lock. 224 * Acquire a lock.
@@ -257,10 +262,14 @@ static inline int lockdep_internal(void)
257# define lock_release(l, n, i) do { } while (0) 262# define lock_release(l, n, i) do { } while (0)
258# define lockdep_init() do { } while (0) 263# define lockdep_init() do { } while (0)
259# define lockdep_info() do { } while (0) 264# define lockdep_info() do { } while (0)
260# define lockdep_init_map(lock, name, key) do { (void)(key); } while (0) 265# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0)
261# define lockdep_set_class(lock, key) do { (void)(key); } while (0) 266# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
262# define lockdep_set_class_and_name(lock, key, name) \ 267# define lockdep_set_class_and_name(lock, key, name) \
263 do { (void)(key); } while (0) 268 do { (void)(key); } while (0)
269#define lockdep_set_class_and_subclass(lock, key, sub) \
270 do { (void)(key); } while (0)
271#define lockdep_set_subclass(lock, sub) do { } while (0)
272
264# define INIT_LOCKDEP 273# define INIT_LOCKDEP
265# define lockdep_reset() do { debug_locks = 1; } while (0) 274# define lockdep_reset() do { debug_locks = 1; } while (0)
266# define lockdep_free_key_range(start, size) do { } while (0) 275# define lockdep_free_key_range(start, size) do { } while (0)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5a6068ff5556..d538de901965 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1115,9 +1115,6 @@ int in_gate_area_no_task(unsigned long addr);
1115#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1115#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1116#endif /* __HAVE_ARCH_GATE_AREA */ 1116#endif /* __HAVE_ARCH_GATE_AREA */
1117 1117
1118/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
1119#define OOM_DISABLE -17
1120
1121int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1118int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1122 void __user *, size_t *, loff_t *); 1119 void __user *, size_t *, loff_t *);
1123unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1120unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
diff --git a/include/linux/net.h b/include/linux/net.h
index c257f716e00f..15c733b816f0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,6 +19,7 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/random.h>
22#include <asm/socket.h> 23#include <asm/socket.h>
23 24
24struct poll_table_struct; 25struct poll_table_struct;
@@ -193,9 +194,9 @@ extern int sock_map_fd(struct socket *sock);
193extern struct socket *sockfd_lookup(int fd, int *err); 194extern struct socket *sockfd_lookup(int fd, int *err);
194#define sockfd_put(sock) fput(sock->file) 195#define sockfd_put(sock) fput(sock->file)
195extern int net_ratelimit(void); 196extern int net_ratelimit(void);
196extern unsigned long net_random(void); 197
197extern void net_srandom(unsigned long); 198#define net_random() random32()
198extern void net_random_init(void); 199#define net_srandom(seed) srandom32(seed)
199 200
200extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
201 struct kvec *vec, size_t num, size_t len); 202 struct kvec *vec, size_t num, size_t len);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 76ff54846ada..45228c1a1195 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -157,7 +157,7 @@ struct nfs_inode {
157 * This is the cookie verifier used for NFSv3 readdir 157 * This is the cookie verifier used for NFSv3 readdir
158 * operations 158 * operations
159 */ 159 */
160 __u32 cookieverf[2]; 160 __be32 cookieverf[2];
161 161
162 /* 162 /*
163 * This is the list of dirty unwritten pages. 163 * This is the list of dirty unwritten pages.
@@ -290,6 +290,7 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
290 * linux/fs/nfs/inode.c 290 * linux/fs/nfs/inode.c
291 */ 291 */
292extern int nfs_sync_mapping(struct address_space *mapping); 292extern int nfs_sync_mapping(struct address_space *mapping);
293extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
293extern void nfs_zap_caches(struct inode *); 294extern void nfs_zap_caches(struct inode *);
294extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 295extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
295 struct nfs_fattr *); 296 struct nfs_fattr *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index dc5397d9d23c..768c1ad5ff6f 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -266,7 +266,7 @@ struct nfs_writeargs {
266 266
267struct nfs_writeverf { 267struct nfs_writeverf {
268 enum nfs3_stable_how committed; 268 enum nfs3_stable_how committed;
269 __u32 verifier[2]; 269 __be32 verifier[2];
270}; 270};
271 271
272struct nfs_writeres { 272struct nfs_writeres {
@@ -420,7 +420,7 @@ struct nfs3_createargs {
420 unsigned int len; 420 unsigned int len;
421 struct iattr * sattr; 421 struct iattr * sattr;
422 enum nfs3_createmode createmode; 422 enum nfs3_createmode createmode;
423 __u32 verifier[2]; 423 __be32 verifier[2];
424}; 424};
425 425
426struct nfs3_mkdirargs { 426struct nfs3_mkdirargs {
@@ -467,7 +467,7 @@ struct nfs3_linkargs {
467struct nfs3_readdirargs { 467struct nfs3_readdirargs {
468 struct nfs_fh * fh; 468 struct nfs_fh * fh;
469 __u64 cookie; 469 __u64 cookie;
470 __u32 verf[2]; 470 __be32 verf[2];
471 int plus; 471 int plus;
472 unsigned int count; 472 unsigned int count;
473 struct page ** pages; 473 struct page ** pages;
@@ -503,7 +503,7 @@ struct nfs3_linkres {
503 503
504struct nfs3_readdirres { 504struct nfs3_readdirres {
505 struct nfs_fattr * dir_attr; 505 struct nfs_fattr * dir_attr;
506 __u32 * verf; 506 __be32 * verf;
507 int plus; 507 int plus;
508}; 508};
509 509
@@ -811,7 +811,7 @@ struct nfs_rpc_ops {
811 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 811 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
812 struct nfs_pathconf *); 812 struct nfs_pathconf *);
813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
814 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 814 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
815 void (*read_setup) (struct nfs_read_data *); 815 void (*read_setup) (struct nfs_read_data *);
816 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 816 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
817 void (*write_setup) (struct nfs_write_data *, int how); 817 void (*write_setup) (struct nfs_write_data *, int how);
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index c3a3557c2a5b..007480cd6a60 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -26,14 +26,14 @@ struct svc_cacherep {
26 c_type, /* status, buffer */ 26 c_type, /* status, buffer */
27 c_secure : 1; /* req came from port < 1024 */ 27 c_secure : 1; /* req came from port < 1024 */
28 struct sockaddr_in c_addr; 28 struct sockaddr_in c_addr;
29 u32 c_xid; 29 __be32 c_xid;
30 u32 c_prot; 30 u32 c_prot;
31 u32 c_proc; 31 u32 c_proc;
32 u32 c_vers; 32 u32 c_vers;
33 unsigned long c_timestamp; 33 unsigned long c_timestamp;
34 union { 34 union {
35 struct kvec u_vec; 35 struct kvec u_vec;
36 u32 u_status; 36 __be32 u_status;
37 } c_u; 37 } c_u;
38}; 38};
39 39
@@ -75,7 +75,7 @@ enum {
75void nfsd_cache_init(void); 75void nfsd_cache_init(void);
76void nfsd_cache_shutdown(void); 76void nfsd_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, u32 *); 78void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 79
80#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
81#endif /* NFSCACHE_H */ 81#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 6e78ea969f49..045e38cdbe64 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -117,8 +117,8 @@ struct svc_export * exp_parent(struct auth_domain *clp,
117 struct cache_req *reqp); 117 struct cache_req *reqp);
118int exp_rootfh(struct auth_domain *, 118int exp_rootfh(struct auth_domain *,
119 char *path, struct knfsd_fh *, int maxsize); 119 char *path, struct knfsd_fh *, int maxsize);
120int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 120__be32 exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
121int nfserrno(int errno); 121__be32 nfserrno(int errno);
122 122
123extern struct cache_detail svc_export_cache; 123extern struct cache_detail svc_export_cache;
124 124
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index d0d4aae7085f..eb231143d579 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -50,7 +50,7 @@
50 * Callback function for readdir 50 * Callback function for readdir
51 */ 51 */
52struct readdir_cd { 52struct readdir_cd {
53 int err; /* 0, nfserr, or nfserr_eof */ 53 __be32 err; /* 0, nfserr, or nfserr_eof */
54}; 54};
55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, 55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
56 int, loff_t, ino_t, unsigned int); 56 int, loff_t, ino_t, unsigned int);
@@ -64,7 +64,7 @@ extern struct svc_serv *nfsd_serv;
64 * Function prototypes. 64 * Function prototypes.
65 */ 65 */
66int nfsd_svc(unsigned short port, int nrservs); 66int nfsd_svc(unsigned short port, int nrservs);
67int nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp); 67int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
68 68
69/* nfsd/vfs.c */ 69/* nfsd/vfs.c */
70int fh_lock_parent(struct svc_fh *, struct dentry *); 70int fh_lock_parent(struct svc_fh *, struct dentry *);
@@ -72,57 +72,57 @@ int nfsd_racache_init(int);
72void nfsd_racache_shutdown(void); 72void nfsd_racache_shutdown(void);
73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, 73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
74 struct svc_export **expp); 74 struct svc_export **expp);
75int nfsd_lookup(struct svc_rqst *, struct svc_fh *, 75__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
76 const char *, int, struct svc_fh *); 76 const char *, int, struct svc_fh *);
77int nfsd_setattr(struct svc_rqst *, struct svc_fh *, 77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t); 78 struct iattr *, int, time_t);
79#ifdef CONFIG_NFSD_V4 79#ifdef CONFIG_NFSD_V4
80int nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, 80__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
81 struct nfs4_acl *); 81 struct nfs4_acl *);
82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); 82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
83#endif /* CONFIG_NFSD_V4 */ 83#endif /* CONFIG_NFSD_V4 */
84int nfsd_create(struct svc_rqst *, struct svc_fh *, 84__be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
85 char *name, int len, struct iattr *attrs, 85 char *name, int len, struct iattr *attrs,
86 int type, dev_t rdev, struct svc_fh *res); 86 int type, dev_t rdev, struct svc_fh *res);
87#ifdef CONFIG_NFSD_V3 87#ifdef CONFIG_NFSD_V3
88int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); 88__be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, 89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs, 90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode, 91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp); 92 u32 *verifier, int *truncp);
93int nfsd_commit(struct svc_rqst *, struct svc_fh *, 93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long); 94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */ 95#endif /* CONFIG_NFSD_V3 */
96int nfsd_open(struct svc_rqst *, struct svc_fh *, int, 96__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int,
97 int, struct file **); 97 int, struct file **);
98void nfsd_close(struct file *); 98void nfsd_close(struct file *);
99int nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 99__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
100 loff_t, struct kvec *, int, unsigned long *); 100 loff_t, struct kvec *, int, unsigned long *);
101int nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 101__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
102 loff_t, struct kvec *,int, unsigned long, int *); 102 loff_t, struct kvec *,int, unsigned long, int *);
103int nfsd_readlink(struct svc_rqst *, struct svc_fh *, 103__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
104 char *, int *); 104 char *, int *);
105int nfsd_symlink(struct svc_rqst *, struct svc_fh *, 105__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
106 char *name, int len, char *path, int plen, 106 char *name, int len, char *path, int plen,
107 struct svc_fh *res, struct iattr *); 107 struct svc_fh *res, struct iattr *);
108int nfsd_link(struct svc_rqst *, struct svc_fh *, 108__be32 nfsd_link(struct svc_rqst *, struct svc_fh *,
109 char *, int, struct svc_fh *); 109 char *, int, struct svc_fh *);
110int nfsd_rename(struct svc_rqst *, 110__be32 nfsd_rename(struct svc_rqst *,
111 struct svc_fh *, char *, int, 111 struct svc_fh *, char *, int,
112 struct svc_fh *, char *, int); 112 struct svc_fh *, char *, int);
113int nfsd_remove(struct svc_rqst *, 113__be32 nfsd_remove(struct svc_rqst *,
114 struct svc_fh *, char *, int); 114 struct svc_fh *, char *, int);
115int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, 115__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
116 char *name, int len); 116 char *name, int len);
117int nfsd_truncate(struct svc_rqst *, struct svc_fh *, 117int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
118 unsigned long size); 118 unsigned long size);
119int nfsd_readdir(struct svc_rqst *, struct svc_fh *, 119__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
120 loff_t *, struct readdir_cd *, encode_dent_fn); 120 loff_t *, struct readdir_cd *, encode_dent_fn);
121int nfsd_statfs(struct svc_rqst *, struct svc_fh *, 121__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
122 struct kstatfs *); 122 struct kstatfs *);
123 123
124int nfsd_notify_change(struct inode *, struct iattr *); 124int nfsd_notify_change(struct inode *, struct iattr *);
125int nfsd_permission(struct svc_export *, struct dentry *, int); 125__be32 nfsd_permission(struct svc_export *, struct dentry *, int);
126int nfsd_sync_dir(struct dentry *dp); 126int nfsd_sync_dir(struct dentry *dp);
127 127
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -238,6 +238,7 @@ void nfsd_lockd_shutdown(void);
238#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 238#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
240#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 240#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
241#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME)
241 242
242/* error codes for internal use */ 243/* error codes for internal use */
243/* if a request fails due to kmalloc failure, it gets dropped. 244/* if a request fails due to kmalloc failure, it gets dropped.
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 069257ea99a0..f3b51d62ec7d 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -157,7 +157,7 @@ typedef struct svc_fh {
157 __u64 fh_post_size; /* i_size */ 157 __u64 fh_post_size; /* i_size */
158 unsigned long fh_post_blocks; /* i_blocks */ 158 unsigned long fh_post_blocks; /* i_blocks */
159 unsigned long fh_post_blksize;/* i_blksize */ 159 unsigned long fh_post_blksize;/* i_blksize */
160 __u32 fh_post_rdev[2];/* i_rdev */ 160 __be32 fh_post_rdev[2];/* i_rdev */
161 struct timespec fh_post_atime; /* i_atime */ 161 struct timespec fh_post_atime; /* i_atime */
162 struct timespec fh_post_mtime; /* i_mtime */ 162 struct timespec fh_post_mtime; /* i_mtime */
163 struct timespec fh_post_ctime; /* i_ctime */ 163 struct timespec fh_post_ctime; /* i_ctime */
@@ -209,9 +209,9 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
209/* 209/*
210 * Function prototypes 210 * Function prototypes
211 */ 211 */
212u32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); 212__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
213int fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 213__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
214int fh_update(struct svc_fh *); 214__be32 fh_update(struct svc_fh *);
215void fh_put(struct svc_fh *); 215void fh_put(struct svc_fh *);
216 216
217static __inline__ struct svc_fh * 217static __inline__ struct svc_fh *
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 8bf23cf8b603..c3673f487e84 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -125,7 +125,7 @@ struct nfs4_client {
125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
126 nfs4_verifier cl_verifier; /* generated by client */ 126 nfs4_verifier cl_verifier; /* generated by client */
127 time_t cl_time; /* time of last lease renewal */ 127 time_t cl_time; /* time of last lease renewal */
128 u32 cl_addr; /* client ipaddress */ 128 __be32 cl_addr; /* client ipaddress */
129 struct svc_cred cl_cred; /* setclientid principal */ 129 struct svc_cred cl_cred; /* setclientid principal */
130 clientid_t cl_clientid; /* generated by server */ 130 clientid_t cl_clientid; /* generated by server */
131 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
@@ -164,7 +164,7 @@ update_stateid(stateid_t *stateid)
164 * is cached. 164 * is cached.
165 */ 165 */
166struct nfs4_replay { 166struct nfs4_replay {
167 u32 rp_status; 167 __be32 rp_status;
168 unsigned int rp_buflen; 168 unsigned int rp_buflen;
169 char *rp_buf; 169 char *rp_buf;
170 unsigned intrp_allocated; 170 unsigned intrp_allocated;
@@ -273,19 +273,19 @@ struct nfs4_stateid {
273 ((err) != nfserr_stale_stateid) && \ 273 ((err) != nfserr_stale_stateid) && \
274 ((err) != nfserr_bad_stateid)) 274 ((err) != nfserr_bad_stateid))
275 275
276extern int nfsd4_renew(clientid_t *clid); 276extern __be32 nfsd4_renew(clientid_t *clid);
277extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 277extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
278 stateid_t *stateid, int flags, struct file **filp); 278 stateid_t *stateid, int flags, struct file **filp);
279extern void nfs4_lock_state(void); 279extern void nfs4_lock_state(void);
280extern void nfs4_unlock_state(void); 280extern void nfs4_unlock_state(void);
281extern int nfs4_in_grace(void); 281extern int nfs4_in_grace(void);
282extern int nfs4_check_open_reclaim(clientid_t *clid); 282extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
283extern void put_nfs4_client(struct nfs4_client *clp); 283extern void put_nfs4_client(struct nfs4_client *clp);
284extern void nfs4_free_stateowner(struct kref *kref); 284extern void nfs4_free_stateowner(struct kref *kref);
285extern void nfsd4_probe_callback(struct nfs4_client *clp); 285extern void nfsd4_probe_callback(struct nfs4_client *clp);
286extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 286extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
287extern void nfs4_put_delegation(struct nfs4_delegation *dp); 287extern void nfs4_put_delegation(struct nfs4_delegation *dp);
288extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); 288extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
289extern void nfsd4_init_recdir(char *recdir_name); 289extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void); 290extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void); 291extern void nfsd4_shutdown_recdir(void);
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 0e53de87d886..877192d3ae79 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -81,7 +81,7 @@ struct nfsd_readdirargs {
81 struct svc_fh fh; 81 struct svc_fh fh;
82 __u32 cookie; 82 __u32 cookie;
83 __u32 count; 83 __u32 count;
84 u32 * buffer; 84 __be32 * buffer;
85}; 85};
86 86
87struct nfsd_attrstat { 87struct nfsd_attrstat {
@@ -108,9 +108,9 @@ struct nfsd_readdirres {
108 int count; 108 int count;
109 109
110 struct readdir_cd common; 110 struct readdir_cd common;
111 u32 * buffer; 111 __be32 * buffer;
112 int buflen; 112 int buflen;
113 u32 * offset; 113 __be32 * offset;
114}; 114};
115 115
116struct nfsd_statfsres { 116struct nfsd_statfsres {
@@ -135,43 +135,43 @@ union nfsd_xdrstore {
135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) 135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
136 136
137 137
138int nfssvc_decode_void(struct svc_rqst *, u32 *, void *); 138int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
139int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 139int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
140int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *, 140int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
141 struct nfsd_sattrargs *); 141 struct nfsd_sattrargs *);
142int nfssvc_decode_diropargs(struct svc_rqst *, u32 *, 142int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
143 struct nfsd_diropargs *); 143 struct nfsd_diropargs *);
144int nfssvc_decode_readargs(struct svc_rqst *, u32 *, 144int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
145 struct nfsd_readargs *); 145 struct nfsd_readargs *);
146int nfssvc_decode_writeargs(struct svc_rqst *, u32 *, 146int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
147 struct nfsd_writeargs *); 147 struct nfsd_writeargs *);
148int nfssvc_decode_createargs(struct svc_rqst *, u32 *, 148int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
149 struct nfsd_createargs *); 149 struct nfsd_createargs *);
150int nfssvc_decode_renameargs(struct svc_rqst *, u32 *, 150int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
151 struct nfsd_renameargs *); 151 struct nfsd_renameargs *);
152int nfssvc_decode_readlinkargs(struct svc_rqst *, u32 *, 152int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
153 struct nfsd_readlinkargs *); 153 struct nfsd_readlinkargs *);
154int nfssvc_decode_linkargs(struct svc_rqst *, u32 *, 154int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
155 struct nfsd_linkargs *); 155 struct nfsd_linkargs *);
156int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *, 156int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
157 struct nfsd_symlinkargs *); 157 struct nfsd_symlinkargs *);
158int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *, 158int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
159 struct nfsd_readdirargs *); 159 struct nfsd_readdirargs *);
160int nfssvc_encode_void(struct svc_rqst *, u32 *, void *); 160int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
161int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *); 161int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
162int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *); 162int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
163int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *); 163int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
164int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *); 164int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
165int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *); 165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
166int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); 166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
167 167
168int nfssvc_encode_entry(struct readdir_cd *, const char *name, 168int nfssvc_encode_entry(struct readdir_cd *, const char *name,
169 int namlen, loff_t offset, ino_t ino, unsigned int); 169 int namlen, loff_t offset, ino_t ino, unsigned int);
170 170
171int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
172 172
173/* Helper functions for NFSv2 ACL code */ 173/* Helper functions for NFSv2 ACL code */
174u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp); 174__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
175u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp); 175__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
176 176
177#endif /* LINUX_NFSD_H */ 177#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 474d882dc2f3..79963867b0d7 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -51,7 +51,7 @@ struct nfsd3_createargs {
51 int len; 51 int len;
52 int createmode; 52 int createmode;
53 struct iattr attrs; 53 struct iattr attrs;
54 __u32 * verf; 54 __be32 * verf;
55}; 55};
56 56
57struct nfsd3_mknodargs { 57struct nfsd3_mknodargs {
@@ -98,8 +98,8 @@ struct nfsd3_readdirargs {
98 __u64 cookie; 98 __u64 cookie;
99 __u32 dircount; 99 __u32 dircount;
100 __u32 count; 100 __u32 count;
101 __u32 * verf; 101 __be32 * verf;
102 u32 * buffer; 102 __be32 * buffer;
103}; 103};
104 104
105struct nfsd3_commitargs { 105struct nfsd3_commitargs {
@@ -122,79 +122,79 @@ struct nfsd3_setaclargs {
122}; 122};
123 123
124struct nfsd3_attrstat { 124struct nfsd3_attrstat {
125 __u32 status; 125 __be32 status;
126 struct svc_fh fh; 126 struct svc_fh fh;
127 struct kstat stat; 127 struct kstat stat;
128}; 128};
129 129
130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
131struct nfsd3_diropres { 131struct nfsd3_diropres {
132 __u32 status; 132 __be32 status;
133 struct svc_fh dirfh; 133 struct svc_fh dirfh;
134 struct svc_fh fh; 134 struct svc_fh fh;
135}; 135};
136 136
137struct nfsd3_accessres { 137struct nfsd3_accessres {
138 __u32 status; 138 __be32 status;
139 struct svc_fh fh; 139 struct svc_fh fh;
140 __u32 access; 140 __u32 access;
141}; 141};
142 142
143struct nfsd3_readlinkres { 143struct nfsd3_readlinkres {
144 __u32 status; 144 __be32 status;
145 struct svc_fh fh; 145 struct svc_fh fh;
146 __u32 len; 146 __u32 len;
147}; 147};
148 148
149struct nfsd3_readres { 149struct nfsd3_readres {
150 __u32 status; 150 __be32 status;
151 struct svc_fh fh; 151 struct svc_fh fh;
152 unsigned long count; 152 unsigned long count;
153 int eof; 153 int eof;
154}; 154};
155 155
156struct nfsd3_writeres { 156struct nfsd3_writeres {
157 __u32 status; 157 __be32 status;
158 struct svc_fh fh; 158 struct svc_fh fh;
159 unsigned long count; 159 unsigned long count;
160 int committed; 160 int committed;
161}; 161};
162 162
163struct nfsd3_renameres { 163struct nfsd3_renameres {
164 __u32 status; 164 __be32 status;
165 struct svc_fh ffh; 165 struct svc_fh ffh;
166 struct svc_fh tfh; 166 struct svc_fh tfh;
167}; 167};
168 168
169struct nfsd3_linkres { 169struct nfsd3_linkres {
170 __u32 status; 170 __be32 status;
171 struct svc_fh tfh; 171 struct svc_fh tfh;
172 struct svc_fh fh; 172 struct svc_fh fh;
173}; 173};
174 174
175struct nfsd3_readdirres { 175struct nfsd3_readdirres {
176 __u32 status; 176 __be32 status;
177 struct svc_fh fh; 177 struct svc_fh fh;
178 int count; 178 int count;
179 __u32 verf[2]; 179 __be32 verf[2];
180 180
181 struct readdir_cd common; 181 struct readdir_cd common;
182 u32 * buffer; 182 __be32 * buffer;
183 int buflen; 183 int buflen;
184 u32 * offset; 184 __be32 * offset;
185 u32 * offset1; 185 __be32 * offset1;
186 struct svc_rqst * rqstp; 186 struct svc_rqst * rqstp;
187 187
188}; 188};
189 189
190struct nfsd3_fsstatres { 190struct nfsd3_fsstatres {
191 __u32 status; 191 __be32 status;
192 struct kstatfs stats; 192 struct kstatfs stats;
193 __u32 invarsec; 193 __u32 invarsec;
194}; 194};
195 195
196struct nfsd3_fsinfores { 196struct nfsd3_fsinfores {
197 __u32 status; 197 __be32 status;
198 __u32 f_rtmax; 198 __u32 f_rtmax;
199 __u32 f_rtpref; 199 __u32 f_rtpref;
200 __u32 f_rtmult; 200 __u32 f_rtmult;
@@ -207,7 +207,7 @@ struct nfsd3_fsinfores {
207}; 207};
208 208
209struct nfsd3_pathconfres { 209struct nfsd3_pathconfres {
210 __u32 status; 210 __be32 status;
211 __u32 p_link_max; 211 __u32 p_link_max;
212 __u32 p_name_max; 212 __u32 p_name_max;
213 __u32 p_no_trunc; 213 __u32 p_no_trunc;
@@ -217,12 +217,12 @@ struct nfsd3_pathconfres {
217}; 217};
218 218
219struct nfsd3_commitres { 219struct nfsd3_commitres {
220 __u32 status; 220 __be32 status;
221 struct svc_fh fh; 221 struct svc_fh fh;
222}; 222};
223 223
224struct nfsd3_getaclres { 224struct nfsd3_getaclres {
225 __u32 status; 225 __be32 status;
226 struct svc_fh fh; 226 struct svc_fh fh;
227 int mask; 227 int mask;
228 struct posix_acl *acl_access; 228 struct posix_acl *acl_access;
@@ -266,70 +266,70 @@ union nfsd3_xdrstore {
266 266
267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
268 268
269int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 269int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
270int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *, 270int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
271 struct nfsd3_sattrargs *); 271 struct nfsd3_sattrargs *);
272int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *, 272int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
273 struct nfsd3_diropargs *); 273 struct nfsd3_diropargs *);
274int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *, 274int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
275 struct nfsd3_accessargs *); 275 struct nfsd3_accessargs *);
276int nfs3svc_decode_readargs(struct svc_rqst *, u32 *, 276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
277 struct nfsd3_readargs *); 277 struct nfsd3_readargs *);
278int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *, 278int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
279 struct nfsd3_writeargs *); 279 struct nfsd3_writeargs *);
280int nfs3svc_decode_createargs(struct svc_rqst *, u32 *, 280int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
281 struct nfsd3_createargs *); 281 struct nfsd3_createargs *);
282int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *, 282int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
283 struct nfsd3_createargs *); 283 struct nfsd3_createargs *);
284int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *, 284int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
285 struct nfsd3_mknodargs *); 285 struct nfsd3_mknodargs *);
286int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *, 286int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
287 struct nfsd3_renameargs *); 287 struct nfsd3_renameargs *);
288int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *, 288int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
289 struct nfsd3_readlinkargs *); 289 struct nfsd3_readlinkargs *);
290int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *, 290int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
291 struct nfsd3_linkargs *); 291 struct nfsd3_linkargs *);
292int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *, 292int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
293 struct nfsd3_symlinkargs *); 293 struct nfsd3_symlinkargs *);
294int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *, 294int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
295 struct nfsd3_readdirargs *); 295 struct nfsd3_readdirargs *);
296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *, 296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
297 struct nfsd3_readdirargs *); 297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *, 298int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
299 struct nfsd3_commitargs *); 299 struct nfsd3_commitargs *);
300int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *); 300int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
301int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *, 301int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
302 struct nfsd3_attrstat *); 302 struct nfsd3_attrstat *);
303int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *, 303int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
304 struct nfsd3_attrstat *); 304 struct nfsd3_attrstat *);
305int nfs3svc_encode_diropres(struct svc_rqst *, u32 *, 305int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
306 struct nfsd3_diropres *); 306 struct nfsd3_diropres *);
307int nfs3svc_encode_accessres(struct svc_rqst *, u32 *, 307int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
308 struct nfsd3_accessres *); 308 struct nfsd3_accessres *);
309int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, 309int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
310 struct nfsd3_readlinkres *); 310 struct nfsd3_readlinkres *);
311int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); 311int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
312int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *); 312int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
313int nfs3svc_encode_createres(struct svc_rqst *, u32 *, 313int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
314 struct nfsd3_diropres *); 314 struct nfsd3_diropres *);
315int nfs3svc_encode_renameres(struct svc_rqst *, u32 *, 315int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
316 struct nfsd3_renameres *); 316 struct nfsd3_renameres *);
317int nfs3svc_encode_linkres(struct svc_rqst *, u32 *, 317int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
318 struct nfsd3_linkres *); 318 struct nfsd3_linkres *);
319int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, 319int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
320 struct nfsd3_readdirres *); 320 struct nfsd3_readdirres *);
321int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *, 321int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
322 struct nfsd3_fsstatres *); 322 struct nfsd3_fsstatres *);
323int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *, 323int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
324 struct nfsd3_fsinfores *); 324 struct nfsd3_fsinfores *);
325int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *, 325int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
326 struct nfsd3_pathconfres *); 326 struct nfsd3_pathconfres *);
327int nfs3svc_encode_commitres(struct svc_rqst *, u32 *, 327int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
328 struct nfsd3_commitres *); 328 struct nfsd3_commitres *);
329 329
330int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, 330int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *); 331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, 332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *); 333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(struct readdir_cd *, const char *name, 334int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
335 int namlen, loff_t offset, ino_t ino, 335 int namlen, loff_t offset, ino_t ino,
@@ -338,9 +338,9 @@ int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
338 int namlen, loff_t offset, ino_t ino, 338 int namlen, loff_t offset, ino_t ino,
339 unsigned int); 339 unsigned int);
340/* Helper functions for NFSv3 ACL code */ 340/* Helper functions for NFSv3 ACL code */
341u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, 341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342 struct svc_fh *fhp); 342 struct svc_fh *fhp);
343u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); 343__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
344 344
345 345
346#endif /* _LINUX_NFSD_XDR3_H */ 346#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 66e642762a07..45ca01b5f844 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -258,9 +258,9 @@ struct nfsd4_readdir {
258 struct svc_fh * rd_fhp; /* response */ 258 struct svc_fh * rd_fhp; /* response */
259 259
260 struct readdir_cd common; 260 struct readdir_cd common;
261 u32 * buffer; 261 __be32 * buffer;
262 int buflen; 262 int buflen;
263 u32 * offset; 263 __be32 * offset;
264}; 264};
265 265
266struct nfsd4_release_lockowner { 266struct nfsd4_release_lockowner {
@@ -334,7 +334,7 @@ struct nfsd4_write {
334 334
335struct nfsd4_op { 335struct nfsd4_op {
336 int opnum; 336 int opnum;
337 int status; 337 __be32 status;
338 union { 338 union {
339 struct nfsd4_access access; 339 struct nfsd4_access access;
340 struct nfsd4_close close; 340 struct nfsd4_close close;
@@ -371,12 +371,12 @@ struct nfsd4_op {
371 371
372struct nfsd4_compoundargs { 372struct nfsd4_compoundargs {
373 /* scratch variables for XDR decode */ 373 /* scratch variables for XDR decode */
374 u32 * p; 374 __be32 * p;
375 u32 * end; 375 __be32 * end;
376 struct page ** pagelist; 376 struct page ** pagelist;
377 int pagelen; 377 int pagelen;
378 u32 tmp[8]; 378 __be32 tmp[8];
379 u32 * tmpp; 379 __be32 * tmpp;
380 struct tmpbuf { 380 struct tmpbuf {
381 struct tmpbuf *next; 381 struct tmpbuf *next;
382 void (*release)(const void *); 382 void (*release)(const void *);
@@ -395,15 +395,15 @@ struct nfsd4_compoundargs {
395 395
396struct nfsd4_compoundres { 396struct nfsd4_compoundres {
397 /* scratch variables for XDR encode */ 397 /* scratch variables for XDR encode */
398 u32 * p; 398 __be32 * p;
399 u32 * end; 399 __be32 * end;
400 struct xdr_buf * xbuf; 400 struct xdr_buf * xbuf;
401 struct svc_rqst * rqstp; 401 struct svc_rqst * rqstp;
402 402
403 u32 taglen; 403 u32 taglen;
404 char * tag; 404 char * tag;
405 u32 opcnt; 405 u32 opcnt;
406 u32 * tagp; /* where to encode tag and opcount */ 406 __be32 * tagp; /* where to encode tag and opcount */
407}; 407};
408 408
409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
@@ -419,45 +419,45 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec; 419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
420} 420}
421 421
422int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *); 422int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
423int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *, 423int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
424 struct nfsd4_compoundargs *); 424 struct nfsd4_compoundargs *);
425int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *, 425int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
426 struct nfsd4_compoundres *); 426 struct nfsd4_compoundres *);
427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); 428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
429int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 429__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
430 struct dentry *dentry, u32 *buffer, int *countp, 430 struct dentry *dentry, __be32 *buffer, int *countp,
431 u32 *bmval, struct svc_rqst *); 431 u32 *bmval, struct svc_rqst *);
432extern int nfsd4_setclientid(struct svc_rqst *rqstp, 432extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
433 struct nfsd4_setclientid *setclid); 433 struct nfsd4_setclientid *setclid);
434extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 434extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
435 struct nfsd4_setclientid_confirm *setclientid_confirm); 435 struct nfsd4_setclientid_confirm *setclientid_confirm);
436extern int nfsd4_process_open1(struct nfsd4_open *open); 436extern __be32 nfsd4_process_open1(struct nfsd4_open *open);
437extern int nfsd4_process_open2(struct svc_rqst *rqstp, 437extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
438 struct svc_fh *current_fh, struct nfsd4_open *open); 438 struct svc_fh *current_fh, struct nfsd4_open *open);
439extern int nfsd4_open_confirm(struct svc_rqst *rqstp, 439extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, 440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc,
441 struct nfs4_stateowner **); 441 struct nfs4_stateowner **);
442extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, 442extern __be32 nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
443 struct nfsd4_close *close, 443 struct nfsd4_close *close,
444 struct nfs4_stateowner **replay_owner); 444 struct nfs4_stateowner **replay_owner);
445extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, 445extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, 446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od,
447 struct nfs4_stateowner **replay_owner); 447 struct nfs4_stateowner **replay_owner);
448extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, 448extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
449 struct nfsd4_lock *lock, 449 struct nfsd4_lock *lock,
450 struct nfs4_stateowner **replay_owner); 450 struct nfs4_stateowner **replay_owner);
451extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 451extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
452 struct nfsd4_lockt *lockt); 452 struct nfsd4_lockt *lockt);
453extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, 453extern __be32 nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
454 struct nfsd4_locku *locku, 454 struct nfsd4_locku *locku,
455 struct nfs4_stateowner **replay_owner); 455 struct nfs4_stateowner **replay_owner);
456extern int 456extern __be32
457nfsd4_release_lockowner(struct svc_rqst *rqstp, 457nfsd4_release_lockowner(struct svc_rqst *rqstp,
458 struct nfsd4_release_lockowner *rlockowner); 458 struct nfsd4_release_lockowner *rlockowner);
459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *); 459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
460extern int nfsd4_delegreturn(struct svc_rqst *rqstp, 460extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr); 461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
462#endif 462#endif
463 463
diff --git a/include/linux/oom.h b/include/linux/oom.h
new file mode 100644
index 000000000000..ad76463629a0
--- /dev/null
+++ b/include/linux/oom.h
@@ -0,0 +1,10 @@
1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H
3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
5#define OOM_DISABLE (-17)
6/* inclusive */
7#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15
9
10#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5c604f5fad67..4689e2a699c0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -443,6 +443,7 @@ extern void pci_remove_bus(struct pci_bus *b);
443extern void pci_remove_bus_device(struct pci_dev *dev); 443extern void pci_remove_bus_device(struct pci_dev *dev);
444extern void pci_stop_bus_device(struct pci_dev *dev); 444extern void pci_stop_bus_device(struct pci_dev *dev);
445void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
446extern void pci_sort_breadthfirst(void);
446 447
447/* Generic PCI functions exported to card drivers */ 448/* Generic PCI functions exported to card drivers */
448 449
@@ -452,13 +453,14 @@ struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
452int pci_find_capability (struct pci_dev *dev, int cap); 453int pci_find_capability (struct pci_dev *dev, int cap);
453int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 454int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
454int pci_find_ext_capability (struct pci_dev *dev, int cap); 455int pci_find_ext_capability (struct pci_dev *dev, int cap);
455struct pci_bus * pci_find_next_bus(const struct pci_bus *from); 456struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
456 457
457struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from); 458struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
458struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 459struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device,
459 unsigned int ss_vendor, unsigned int ss_device, 460 unsigned int ss_vendor, unsigned int ss_device,
460 struct pci_dev *from); 461 struct pci_dev *from);
461struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); 462struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn);
463struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn);
462struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); 464struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from);
463int pci_dev_present(const struct pci_device_id *ids); 465int pci_dev_present(const struct pci_device_id *ids);
464 466
diff --git a/drivers/pci/hotplug/pci_hotplug.h b/include/linux/pci_hotplug.h
index 772523dc3860..a675a05c4091 100644
--- a/drivers/pci/hotplug/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -22,7 +22,7 @@
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * 24 *
25 * Send feedback to <greg@kroah.com> 25 * Send feedback to <kristen.c.accardi@intel.com>
26 * 26 *
27 */ 27 */
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f069df245469..f3a168f3c9df 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2351,3 +2351,5 @@
2351#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 2351#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2352#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 2352#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2353 2353
2354#define PCI_VENDOR_ID_QUICKNET 0x15E2
2355#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 80d780e5a8f5..bf4cf2080e5c 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_PERSONALITY_H 1#ifndef _LINUX_PERSONALITY_H
2#define _LINUX_PERSONALITY_H 2#define _LINUX_PERSONALITY_H
3 3
4#ifdef __KERNEL__
5
4/* 6/*
5 * Handling of different ABIs (personalities). 7 * Handling of different ABIs (personalities).
6 */ 8 */
@@ -12,6 +14,8 @@ extern int register_exec_domain(struct exec_domain *);
12extern int unregister_exec_domain(struct exec_domain *); 14extern int unregister_exec_domain(struct exec_domain *);
13extern int __set_personality(unsigned long); 15extern int __set_personality(unsigned long);
14 16
17#endif /* __KERNEL__ */
18
15/* 19/*
16 * Flags for bug emulation. 20 * Flags for bug emulation.
17 * 21 *
@@ -71,6 +75,7 @@ enum {
71 PER_MASK = 0x00ff, 75 PER_MASK = 0x00ff,
72}; 76};
73 77
78#ifdef __KERNEL__
74 79
75/* 80/*
76 * Description of an execution domain. 81 * Description of an execution domain.
@@ -111,4 +116,6 @@ struct exec_domain {
111#define set_personality(pers) \ 116#define set_personality(pers) \
112 ((current->personality == pers) ? 0 : __set_personality(pers)) 117 ((current->personality == pers) ? 0 : __set_personality(pers))
113 118
119#endif /* __KERNEL__ */
120
114#endif /* _LINUX_PERSONALITY_H */ 121#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/random.h b/include/linux/random.h
index 5d6456bcdeba..0248b30e306d 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -69,6 +69,9 @@ extern struct file_operations random_fops, urandom_fops;
69unsigned int get_random_int(void); 69unsigned int get_random_int(void);
70unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 70unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
71 71
72u32 random32(void);
73void srandom32(u32 seed);
74
72#endif /* __KERNEL___ */ 75#endif /* __KERNEL___ */
73 76
74#endif /* _LINUX_RANDOM_H */ 77#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 3a697cc6ecae..b99c5ca9708d 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -41,6 +41,7 @@ struct serio {
41 void (*stop)(struct serio *); 41 void (*stop)(struct serio *);
42 42
43 struct serio *parent, *child; 43 struct serio *parent, *child;
44 unsigned int depth; /* level of nesting in serio hierarchy */
44 45
45 struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */ 46 struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */
46 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 1e65f2dd80e5..606cb2165232 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -56,7 +56,9 @@ enum rpc_accept_stat {
56 RPC_PROG_MISMATCH = 2, 56 RPC_PROG_MISMATCH = 2,
57 RPC_PROC_UNAVAIL = 3, 57 RPC_PROC_UNAVAIL = 3,
58 RPC_GARBAGE_ARGS = 4, 58 RPC_GARBAGE_ARGS = 4,
59 RPC_SYSTEM_ERR = 5 59 RPC_SYSTEM_ERR = 5,
60 /* internal use only */
61 RPC_DROP_REPLY = 60000,
60}; 62};
61 63
62enum rpc_reject_stat { 64enum rpc_reject_stat {
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 9c9a8ad92477..965d6c20086e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -335,7 +335,7 @@ struct svc_version {
335/* 335/*
336 * RPC procedure info 336 * RPC procedure info
337 */ 337 */
338typedef int (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp); 338typedef __be32 (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
339struct svc_procedure { 339struct svc_procedure {
340 svc_procfunc pc_func; /* process the request */ 340 svc_procfunc pc_func; /* process the request */
341 kxdrproc_t pc_decode; /* XDR decode args */ 341 kxdrproc_t pc_decode; /* XDR decode args */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 953723b09bc6..ac69e5511606 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -74,6 +74,7 @@ struct xdr_buf {
74#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) 74#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL)
75#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) 75#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS)
76#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) 76#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR)
77#define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY)
77 78
78#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) 79#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK)
79#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) 80#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e058a2d1c6d..2d36f6db3706 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -342,6 +342,8 @@ struct tcp_sock {
342 342
343 unsigned long last_synq_overflow; 343 unsigned long last_synq_overflow;
344 344
345 __u32 tso_deferred;
346
345/* Receiver side RTT estimation */ 347/* Receiver side RTT estimation */
346 struct { 348 struct {
347 __u32 rtt; 349 __u32 rtt;
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 243a15f54002..bea469455a0c 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -129,6 +129,7 @@ static inline unsigned int tipc_node(__u32 addr)
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
132#if 0 133#if 0
133/* The following filter options are not currently implemented */ 134/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ 135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a341c8032866..fc35e6bdfb93 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -85,7 +85,6 @@ int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(void);
88void writeback_congestion_end(void);
89 88
90/* These are exported to sysctl. */ 89/* These are exported to sysctl. */
91extern int dirty_background_ratio; 90extern int dirty_background_ratio;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index df22efcfcc0b..c0fc39620f36 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -153,6 +153,7 @@ struct hci_conn {
153 __u8 mode; 153 __u8 mode;
154 __u8 type; 154 __u8 type;
155 __u8 out; 155 __u8 out;
156 __u8 attempt;
156 __u8 dev_class[3]; 157 __u8 dev_class[3];
157 __u8 features[8]; 158 __u8 features[8];
158 __u16 interval; 159 __u16 interval;
@@ -289,6 +290,22 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
289 return NULL; 290 return NULL;
290} 291}
291 292
293static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
294 __u8 type, __u16 state)
295{
296 struct hci_conn_hash *h = &hdev->conn_hash;
297 struct list_head *p;
298 struct hci_conn *c;
299
300 list_for_each(p, &h->list) {
301 c = list_entry(p, struct hci_conn, list);
302 if (c->type == type && c->state == state)
303 return c;
304 }
305 return NULL;
306}
307
308void hci_acl_connect(struct hci_conn *conn);
292void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 309void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
293void hci_add_sco(struct hci_conn *conn, __u16 handle); 310void hci_add_sco(struct hci_conn *conn, __u16 handle);
294 311
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 925573fd2aed..aa10a8178e70 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -17,14 +17,15 @@
17 17
18struct inet_peer 18struct inet_peer
19{ 19{
20 /* group together avl_left,avl_right,v4daddr to speedup lookups */
20 struct inet_peer *avl_left, *avl_right; 21 struct inet_peer *avl_left, *avl_right;
21 struct inet_peer *unused_next, **unused_prevp;
22 unsigned long dtime; /* the time of last use of not
23 * referenced entries */
24 atomic_t refcnt;
25 __be32 v4daddr; /* peer's address */ 22 __be32 v4daddr; /* peer's address */
26 __u16 avl_height; 23 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 24 __u16 ip_id_count; /* IP ID for the next packet */
25 struct inet_peer *unused_next, **unused_prevp;
26 __u32 dtime; /* the time of last use of not
27 * referenced entries */
28 atomic_t refcnt;
28 atomic_t rid; /* Frag reception counter */ 29 atomic_t rid; /* Frag reception counter */
29 __u32 tcp_ts; 30 __u32 tcp_ts;
30 unsigned long tcp_ts_stamp; 31 unsigned long tcp_ts_stamp;
@@ -35,21 +36,8 @@ void inet_initpeers(void) __init;
35/* can be called with or without local BH being disabled */ 36/* can be called with or without local BH being disabled */
36struct inet_peer *inet_getpeer(__be32 daddr, int create); 37struct inet_peer *inet_getpeer(__be32 daddr, int create);
37 38
38extern spinlock_t inet_peer_unused_lock;
39extern struct inet_peer **inet_peer_unused_tailp;
40/* can be called from BH context or outside */ 39/* can be called from BH context or outside */
41static inline void inet_putpeer(struct inet_peer *p) 40extern void inet_putpeer(struct inet_peer *p);
42{
43 spin_lock_bh(&inet_peer_unused_lock);
44 if (atomic_dec_and_test(&p->refcnt)) {
45 p->unused_prevp = inet_peer_unused_tailp;
46 p->unused_next = NULL;
47 *inet_peer_unused_tailp = p;
48 inet_peer_unused_tailp = &p->unused_next;
49 p->dtime = jiffies;
50 }
51 spin_unlock_bh(&inet_peer_unused_lock);
52}
53 41
54extern spinlock_t inet_peer_idlock; 42extern spinlock_t inet_peer_idlock;
55/* can be called with or without local BH being disabled */ 43/* can be called with or without local BH being disabled */
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 6ca6b71dfe0f..c14b70ed4c57 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -36,13 +36,6 @@ struct route_info {
36#define RT6_LOOKUP_F_REACHABLE 0x2 36#define RT6_LOOKUP_F_REACHABLE 0x2
37#define RT6_LOOKUP_F_HAS_SADDR 0x4 37#define RT6_LOOKUP_F_HAS_SADDR 0x4
38 38
39struct pol_chain {
40 int type;
41 int priority;
42 struct fib6_node *rules;
43 struct pol_chain *next;
44};
45
46extern struct rt6_info ip6_null_entry; 39extern struct rt6_info ip6_null_entry;
47 40
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 41#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 82229146bac7..949b932d2f08 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -21,17 +21,14 @@
21#include <net/fib_rules.h> 21#include <net/fib_rules.h>
22 22
23struct fib_config { 23struct fib_config {
24 u8 fc_family;
25 u8 fc_dst_len; 24 u8 fc_dst_len;
26 u8 fc_src_len;
27 u8 fc_tos; 25 u8 fc_tos;
28 u8 fc_protocol; 26 u8 fc_protocol;
29 u8 fc_scope; 27 u8 fc_scope;
30 u8 fc_type; 28 u8 fc_type;
31 /* 1 byte unused */ 29 /* 3 bytes unused */
32 u32 fc_table; 30 u32 fc_table;
33 __be32 fc_dst; 31 __be32 fc_dst;
34 __be32 fc_src;
35 __be32 fc_gw; 32 __be32 fc_gw;
36 int fc_oif; 33 int fc_oif;
37 u32 fc_flags; 34 u32 fc_flags;
diff --git a/init/Kconfig b/init/Kconfig
index 10382931eead..c8b2624af176 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1,5 +1,6 @@
1config DEFCONFIG_LIST 1config DEFCONFIG_LIST
2 string 2 string
3 depends on !UML
3 option defconfig_list 4 option defconfig_list
4 default "/lib/modules/$UNAME_RELEASE/.config" 5 default "/lib/modules/$UNAME_RELEASE/.config"
5 default "/etc/kernel-config" 6 default "/etc/kernel-config"
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 32c96628463e..27dd3ee47099 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -19,7 +19,7 @@
19static DEFINE_MUTEX(cpu_add_remove_lock); 19static DEFINE_MUTEX(cpu_add_remove_lock);
20static DEFINE_MUTEX(cpu_bitmask_lock); 20static DEFINE_MUTEX(cpu_bitmask_lock);
21 21
22static __cpuinitdata BLOCKING_NOTIFIER_HEAD(cpu_chain); 22static __cpuinitdata RAW_NOTIFIER_HEAD(cpu_chain);
23 23
24/* If set, cpu_up and cpu_down will return -EBUSY and do nothing. 24/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.
25 * Should always be manipulated under cpu_add_remove_lock 25 * Should always be manipulated under cpu_add_remove_lock
@@ -68,7 +68,11 @@ EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
68/* Need to know about CPUs going up/down? */ 68/* Need to know about CPUs going up/down? */
69int __cpuinit register_cpu_notifier(struct notifier_block *nb) 69int __cpuinit register_cpu_notifier(struct notifier_block *nb)
70{ 70{
71 return blocking_notifier_chain_register(&cpu_chain, nb); 71 int ret;
72 mutex_lock(&cpu_add_remove_lock);
73 ret = raw_notifier_chain_register(&cpu_chain, nb);
74 mutex_unlock(&cpu_add_remove_lock);
75 return ret;
72} 76}
73 77
74#ifdef CONFIG_HOTPLUG_CPU 78#ifdef CONFIG_HOTPLUG_CPU
@@ -77,7 +81,9 @@ EXPORT_SYMBOL(register_cpu_notifier);
77 81
78void unregister_cpu_notifier(struct notifier_block *nb) 82void unregister_cpu_notifier(struct notifier_block *nb)
79{ 83{
80 blocking_notifier_chain_unregister(&cpu_chain, nb); 84 mutex_lock(&cpu_add_remove_lock);
85 raw_notifier_chain_unregister(&cpu_chain, nb);
86 mutex_unlock(&cpu_add_remove_lock);
81} 87}
82EXPORT_SYMBOL(unregister_cpu_notifier); 88EXPORT_SYMBOL(unregister_cpu_notifier);
83 89
@@ -126,7 +132,7 @@ static int _cpu_down(unsigned int cpu)
126 if (!cpu_online(cpu)) 132 if (!cpu_online(cpu))
127 return -EINVAL; 133 return -EINVAL;
128 134
129 err = blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, 135 err = raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
130 (void *)(long)cpu); 136 (void *)(long)cpu);
131 if (err == NOTIFY_BAD) { 137 if (err == NOTIFY_BAD) {
132 printk("%s: attempt to take down CPU %u failed\n", 138 printk("%s: attempt to take down CPU %u failed\n",
@@ -146,7 +152,7 @@ static int _cpu_down(unsigned int cpu)
146 152
147 if (IS_ERR(p)) { 153 if (IS_ERR(p)) {
148 /* CPU didn't die: tell everyone. Can't complain. */ 154 /* CPU didn't die: tell everyone. Can't complain. */
149 if (blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, 155 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
150 (void *)(long)cpu) == NOTIFY_BAD) 156 (void *)(long)cpu) == NOTIFY_BAD)
151 BUG(); 157 BUG();
152 158
@@ -169,7 +175,7 @@ static int _cpu_down(unsigned int cpu)
169 put_cpu(); 175 put_cpu();
170 176
171 /* CPU is completely dead: tell everyone. Too late to complain. */ 177 /* CPU is completely dead: tell everyone. Too late to complain. */
172 if (blocking_notifier_call_chain(&cpu_chain, CPU_DEAD, 178 if (raw_notifier_call_chain(&cpu_chain, CPU_DEAD,
173 (void *)(long)cpu) == NOTIFY_BAD) 179 (void *)(long)cpu) == NOTIFY_BAD)
174 BUG(); 180 BUG();
175 181
@@ -206,7 +212,7 @@ static int __devinit _cpu_up(unsigned int cpu)
206 if (cpu_online(cpu) || !cpu_present(cpu)) 212 if (cpu_online(cpu) || !cpu_present(cpu))
207 return -EINVAL; 213 return -EINVAL;
208 214
209 ret = blocking_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); 215 ret = raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
210 if (ret == NOTIFY_BAD) { 216 if (ret == NOTIFY_BAD) {
211 printk("%s: attempt to bring up CPU %u failed\n", 217 printk("%s: attempt to bring up CPU %u failed\n",
212 __FUNCTION__, cpu); 218 __FUNCTION__, cpu);
@@ -223,11 +229,11 @@ static int __devinit _cpu_up(unsigned int cpu)
223 BUG_ON(!cpu_online(cpu)); 229 BUG_ON(!cpu_online(cpu));
224 230
225 /* Now call notifier in preparation. */ 231 /* Now call notifier in preparation. */
226 blocking_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu); 232 raw_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
227 233
228out_notify: 234out_notify:
229 if (ret != 0) 235 if (ret != 0)
230 blocking_notifier_call_chain(&cpu_chain, 236 raw_notifier_call_chain(&cpu_chain,
231 CPU_UP_CANCELED, hcpu); 237 CPU_UP_CANCELED, hcpu);
232 238
233 return ret; 239 return ret;
diff --git a/kernel/fork.c b/kernel/fork.c
index 7dc6140baac6..29ebb30850ed 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -984,6 +984,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
984 if (!p) 984 if (!p)
985 goto fork_out; 985 goto fork_out;
986 986
987 rt_mutex_init_task(p);
988
987#ifdef CONFIG_TRACE_IRQFLAGS 989#ifdef CONFIG_TRACE_IRQFLAGS
988 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled); 990 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
989 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); 991 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
@@ -1088,8 +1090,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1088 p->lockdep_recursion = 0; 1090 p->lockdep_recursion = 0;
1089#endif 1091#endif
1090 1092
1091 rt_mutex_init_task(p);
1092
1093#ifdef CONFIG_DEBUG_MUTEXES 1093#ifdef CONFIG_DEBUG_MUTEXES
1094 p->blocked_on = NULL; /* not blocked yet */ 1094 p->blocked_on = NULL; /* not blocked yet */
1095#endif 1095#endif
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 11c99697acfe..2d0dc3efe813 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -499,7 +499,8 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
499#endif /* CONFIG_SMP */ 499#endif /* CONFIG_SMP */
500 500
501void 501void
502__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained) 502__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
503 const char *name)
503{ 504{
504 struct irq_desc *desc; 505 struct irq_desc *desc;
505 unsigned long flags; 506 unsigned long flags;
@@ -540,6 +541,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained)
540 desc->depth = 1; 541 desc->depth = 1;
541 } 542 }
542 desc->handle_irq = handle; 543 desc->handle_irq = handle;
544 desc->name = name;
543 545
544 if (handle != handle_bad_irq && is_chained) { 546 if (handle != handle_bad_irq && is_chained) {
545 desc->status &= ~IRQ_DISABLED; 547 desc->status &= ~IRQ_DISABLED;
@@ -555,30 +557,13 @@ set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
555 irq_flow_handler_t handle) 557 irq_flow_handler_t handle)
556{ 558{
557 set_irq_chip(irq, chip); 559 set_irq_chip(irq, chip);
558 __set_irq_handler(irq, handle, 0); 560 __set_irq_handler(irq, handle, 0, NULL);
559} 561}
560 562
561/* 563void
562 * Get a descriptive string for the highlevel handler, for 564set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
563 * /proc/interrupts output: 565 irq_flow_handler_t handle, const char *name)
564 */
565const char *
566handle_irq_name(irq_flow_handler_t handle)
567{ 566{
568 if (handle == handle_level_irq) 567 set_irq_chip(irq, chip);
569 return "level "; 568 __set_irq_handler(irq, handle, 0, name);
570 if (handle == handle_fasteoi_irq)
571 return "fasteoi";
572 if (handle == handle_edge_irq)
573 return "edge ";
574 if (handle == handle_simple_irq)
575 return "simple ";
576#ifdef CONFIG_SMP
577 if (handle == handle_percpu_irq)
578 return "percpu ";
579#endif
580 if (handle == handle_bad_irq)
581 return "bad ";
582
583 return NULL;
584} 569}
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 805a322a5655..b739be2a6dc9 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -575,6 +575,8 @@ static noinline int print_circular_bug_tail(void)
575 return 0; 575 return 0;
576} 576}
577 577
578#define RECURSION_LIMIT 40
579
578static int noinline print_infinite_recursion_bug(void) 580static int noinline print_infinite_recursion_bug(void)
579{ 581{
580 __raw_spin_unlock(&hash_lock); 582 __raw_spin_unlock(&hash_lock);
@@ -595,7 +597,7 @@ check_noncircular(struct lock_class *source, unsigned int depth)
595 debug_atomic_inc(&nr_cyclic_check_recursions); 597 debug_atomic_inc(&nr_cyclic_check_recursions);
596 if (depth > max_recursion_depth) 598 if (depth > max_recursion_depth)
597 max_recursion_depth = depth; 599 max_recursion_depth = depth;
598 if (depth >= 20) 600 if (depth >= RECURSION_LIMIT)
599 return print_infinite_recursion_bug(); 601 return print_infinite_recursion_bug();
600 /* 602 /*
601 * Check this lock's dependency list: 603 * Check this lock's dependency list:
@@ -645,7 +647,7 @@ find_usage_forwards(struct lock_class *source, unsigned int depth)
645 647
646 if (depth > max_recursion_depth) 648 if (depth > max_recursion_depth)
647 max_recursion_depth = depth; 649 max_recursion_depth = depth;
648 if (depth >= 20) 650 if (depth >= RECURSION_LIMIT)
649 return print_infinite_recursion_bug(); 651 return print_infinite_recursion_bug();
650 652
651 debug_atomic_inc(&nr_find_usage_forwards_checks); 653 debug_atomic_inc(&nr_find_usage_forwards_checks);
@@ -684,7 +686,7 @@ find_usage_backwards(struct lock_class *source, unsigned int depth)
684 686
685 if (depth > max_recursion_depth) 687 if (depth > max_recursion_depth)
686 max_recursion_depth = depth; 688 max_recursion_depth = depth;
687 if (depth >= 20) 689 if (depth >= RECURSION_LIMIT)
688 return print_infinite_recursion_bug(); 690 return print_infinite_recursion_bug();
689 691
690 debug_atomic_inc(&nr_find_usage_backwards_checks); 692 debug_atomic_inc(&nr_find_usage_backwards_checks);
@@ -1174,7 +1176,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
1174 * itself, so actual lookup of the hash should be once per lock object. 1176 * itself, so actual lookup of the hash should be once per lock object.
1175 */ 1177 */
1176static inline struct lock_class * 1178static inline struct lock_class *
1177register_lock_class(struct lockdep_map *lock, unsigned int subclass) 1179register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
1178{ 1180{
1179 struct lockdep_subclass_key *key; 1181 struct lockdep_subclass_key *key;
1180 struct list_head *hash_head; 1182 struct list_head *hash_head;
@@ -1246,7 +1248,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass)
1246out_unlock_set: 1248out_unlock_set:
1247 __raw_spin_unlock(&hash_lock); 1249 __raw_spin_unlock(&hash_lock);
1248 1250
1249 if (!subclass) 1251 if (!subclass || force)
1250 lock->class_cache = class; 1252 lock->class_cache = class;
1251 1253
1252 DEBUG_LOCKS_WARN_ON(class->subclass != subclass); 1254 DEBUG_LOCKS_WARN_ON(class->subclass != subclass);
@@ -1934,7 +1936,7 @@ void trace_softirqs_off(unsigned long ip)
1934 * Initialize a lock instance's lock-class mapping info: 1936 * Initialize a lock instance's lock-class mapping info:
1935 */ 1937 */
1936void lockdep_init_map(struct lockdep_map *lock, const char *name, 1938void lockdep_init_map(struct lockdep_map *lock, const char *name,
1937 struct lock_class_key *key) 1939 struct lock_class_key *key, int subclass)
1938{ 1940{
1939 if (unlikely(!debug_locks)) 1941 if (unlikely(!debug_locks))
1940 return; 1942 return;
@@ -1954,6 +1956,8 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name,
1954 lock->name = name; 1956 lock->name = name;
1955 lock->key = key; 1957 lock->key = key;
1956 lock->class_cache = NULL; 1958 lock->class_cache = NULL;
1959 if (subclass)
1960 register_lock_class(lock, subclass, 1);
1957} 1961}
1958 1962
1959EXPORT_SYMBOL_GPL(lockdep_init_map); 1963EXPORT_SYMBOL_GPL(lockdep_init_map);
@@ -1992,7 +1996,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
1992 * Not cached yet or subclass? 1996 * Not cached yet or subclass?
1993 */ 1997 */
1994 if (unlikely(!class)) { 1998 if (unlikely(!class)) {
1995 class = register_lock_class(lock, subclass); 1999 class = register_lock_class(lock, subclass, 0);
1996 if (!class) 2000 if (!class)
1997 return 0; 2001 return 0;
1998 } 2002 }
diff --git a/kernel/mutex-debug.c b/kernel/mutex-debug.c
index e3203c654dda..18651641a7b5 100644
--- a/kernel/mutex-debug.c
+++ b/kernel/mutex-debug.c
@@ -91,7 +91,7 @@ void debug_mutex_init(struct mutex *lock, const char *name,
91 * Make sure we are not reinitializing a held lock: 91 * Make sure we are not reinitializing a held lock:
92 */ 92 */
93 debug_check_no_locks_freed((void *)lock, sizeof(*lock)); 93 debug_check_no_locks_freed((void *)lock, sizeof(*lock));
94 lockdep_init_map(&lock->dep_map, name, key); 94 lockdep_init_map(&lock->dep_map, name, key, 0);
95#endif 95#endif
96 lock->owner = NULL; 96 lock->owner = NULL;
97 lock->magic = lock; 97 lock->magic = lock;
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 6ebdb82a0ce4..674aceb7335a 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -44,11 +44,9 @@ static inline struct nsproxy *clone_namespaces(struct nsproxy *orig)
44{ 44{
45 struct nsproxy *ns; 45 struct nsproxy *ns;
46 46
47 ns = kmalloc(sizeof(struct nsproxy), GFP_KERNEL); 47 ns = kmemdup(orig, sizeof(struct nsproxy), GFP_KERNEL);
48 if (ns) { 48 if (ns)
49 memcpy(ns, orig, sizeof(struct nsproxy));
50 atomic_set(&ns->count, 1); 49 atomic_set(&ns->count, 1);
51 }
52 return ns; 50 return ns;
53} 51}
54 52
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 479b16b44f79..7c3e1e6dfb5b 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -88,6 +88,19 @@ static inline union cpu_time_count cpu_time_sub(const clockid_t which_clock,
88} 88}
89 89
90/* 90/*
91 * Divide and limit the result to res >= 1
92 *
93 * This is necessary to prevent signal delivery starvation, when the result of
94 * the division would be rounded down to 0.
95 */
96static inline cputime_t cputime_div_non_zero(cputime_t time, unsigned long div)
97{
98 cputime_t res = cputime_div(time, div);
99
100 return max_t(cputime_t, res, 1);
101}
102
103/*
91 * Update expiry time from increment, and increase overrun count, 104 * Update expiry time from increment, and increase overrun count,
92 * given the current clock sample. 105 * given the current clock sample.
93 */ 106 */
@@ -483,8 +496,8 @@ static void process_timer_rebalance(struct task_struct *p,
483 BUG(); 496 BUG();
484 break; 497 break;
485 case CPUCLOCK_PROF: 498 case CPUCLOCK_PROF:
486 left = cputime_div(cputime_sub(expires.cpu, val.cpu), 499 left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),
487 nthreads); 500 nthreads);
488 do { 501 do {
489 if (likely(!(t->flags & PF_EXITING))) { 502 if (likely(!(t->flags & PF_EXITING))) {
490 ticks = cputime_add(prof_ticks(t), left); 503 ticks = cputime_add(prof_ticks(t), left);
@@ -498,8 +511,8 @@ static void process_timer_rebalance(struct task_struct *p,
498 } while (t != p); 511 } while (t != p);
499 break; 512 break;
500 case CPUCLOCK_VIRT: 513 case CPUCLOCK_VIRT:
501 left = cputime_div(cputime_sub(expires.cpu, val.cpu), 514 left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),
502 nthreads); 515 nthreads);
503 do { 516 do {
504 if (likely(!(t->flags & PF_EXITING))) { 517 if (likely(!(t->flags & PF_EXITING))) {
505 ticks = cputime_add(virt_ticks(t), left); 518 ticks = cputime_add(virt_ticks(t), left);
@@ -515,6 +528,7 @@ static void process_timer_rebalance(struct task_struct *p,
515 case CPUCLOCK_SCHED: 528 case CPUCLOCK_SCHED:
516 nsleft = expires.sched - val.sched; 529 nsleft = expires.sched - val.sched;
517 do_div(nsleft, nthreads); 530 do_div(nsleft, nthreads);
531 nsleft = max_t(unsigned long long, nsleft, 1);
518 do { 532 do {
519 if (likely(!(t->flags & PF_EXITING))) { 533 if (likely(!(t->flags & PF_EXITING))) {
520 ns = t->sched_time + nsleft; 534 ns = t->sched_time + nsleft;
@@ -1159,12 +1173,13 @@ static void check_process_timers(struct task_struct *tsk,
1159 1173
1160 prof_left = cputime_sub(prof_expires, utime); 1174 prof_left = cputime_sub(prof_expires, utime);
1161 prof_left = cputime_sub(prof_left, stime); 1175 prof_left = cputime_sub(prof_left, stime);
1162 prof_left = cputime_div(prof_left, nthreads); 1176 prof_left = cputime_div_non_zero(prof_left, nthreads);
1163 virt_left = cputime_sub(virt_expires, utime); 1177 virt_left = cputime_sub(virt_expires, utime);
1164 virt_left = cputime_div(virt_left, nthreads); 1178 virt_left = cputime_div_non_zero(virt_left, nthreads);
1165 if (sched_expires) { 1179 if (sched_expires) {
1166 sched_left = sched_expires - sched_time; 1180 sched_left = sched_expires - sched_time;
1167 do_div(sched_left, nthreads); 1181 do_div(sched_left, nthreads);
1182 sched_left = max_t(unsigned long long, sched_left, 1);
1168 } else { 1183 } else {
1169 sched_left = 0; 1184 sched_left = 0;
1170 } 1185 }
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 9b2ee5344dee..1a3b0dd2c3fc 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -425,7 +425,8 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
425 bio_set_pages_dirty(bio); 425 bio_set_pages_dirty(bio);
426 bio_put(bio); 426 bio_put(bio);
427 } else { 427 } else {
428 get_page(page); 428 if (rw == READ)
429 get_page(page); /* These pages are freed later */
429 bio->bi_private = *bio_chain; 430 bio->bi_private = *bio_chain;
430 *bio_chain = bio; 431 *bio_chain = bio;
431 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 432 submit_bio(rw | (1 << BIO_RW_SYNC), bio);
diff --git a/kernel/sched.c b/kernel/sched.c
index 094b5687eef6..3399701c680e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -160,15 +160,6 @@
160#define TASK_PREEMPTS_CURR(p, rq) \ 160#define TASK_PREEMPTS_CURR(p, rq) \
161 ((p)->prio < (rq)->curr->prio) 161 ((p)->prio < (rq)->curr->prio)
162 162
163/*
164 * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
165 * to time slice values: [800ms ... 100ms ... 5ms]
166 *
167 * The higher a thread's priority, the bigger timeslices
168 * it gets during one round of execution. But even the lowest
169 * priority thread gets MIN_TIMESLICE worth of execution time.
170 */
171
172#define SCALE_PRIO(x, prio) \ 163#define SCALE_PRIO(x, prio) \
173 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_TIMESLICE) 164 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_TIMESLICE)
174 165
@@ -180,6 +171,15 @@ static unsigned int static_prio_timeslice(int static_prio)
180 return SCALE_PRIO(DEF_TIMESLICE, static_prio); 171 return SCALE_PRIO(DEF_TIMESLICE, static_prio);
181} 172}
182 173
174/*
175 * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
176 * to time slice values: [800ms ... 100ms ... 5ms]
177 *
178 * The higher a thread's priority, the bigger timeslices
179 * it gets during one round of execution. But even the lowest
180 * priority thread gets MIN_TIMESLICE worth of execution time.
181 */
182
183static inline unsigned int task_timeslice(struct task_struct *p) 183static inline unsigned int task_timeslice(struct task_struct *p)
184{ 184{
185 return static_prio_timeslice(p->static_prio); 185 return static_prio_timeslice(p->static_prio);
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 7a3b2e75f040..0e53314b14de 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -49,6 +49,7 @@ cond_syscall(compat_sys_get_robust_list);
49cond_syscall(sys_epoll_create); 49cond_syscall(sys_epoll_create);
50cond_syscall(sys_epoll_ctl); 50cond_syscall(sys_epoll_ctl);
51cond_syscall(sys_epoll_wait); 51cond_syscall(sys_epoll_wait);
52cond_syscall(sys_epoll_pwait);
52cond_syscall(sys_semget); 53cond_syscall(sys_semget);
53cond_syscall(sys_semop); 54cond_syscall(sys_semop);
54cond_syscall(sys_semtimedop); 55cond_syscall(sys_semtimedop);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8020fb273c4f..8bff2c18fb5a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -136,8 +136,10 @@ static int parse_table(int __user *, int, void __user *, size_t __user *,
136static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, 136static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 137 void __user *buffer, size_t *lenp, loff_t *ppos);
138 138
139#ifdef CONFIG_PROC_SYSCTL
139static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 140static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
140 void __user *buffer, size_t *lenp, loff_t *ppos); 141 void __user *buffer, size_t *lenp, loff_t *ppos);
142#endif
141 143
142static ctl_table root_table[]; 144static ctl_table root_table[];
143static struct ctl_table_header root_table_header = 145static struct ctl_table_header root_table_header =
@@ -542,6 +544,7 @@ static ctl_table kern_table[] = {
542 .proc_handler = &proc_dointvec, 544 .proc_handler = &proc_dointvec,
543 }, 545 },
544#endif 546#endif
547#ifdef CONFIG_PROC_SYSCTL
545 { 548 {
546 .ctl_name = KERN_CADPID, 549 .ctl_name = KERN_CADPID,
547 .procname = "cad_pid", 550 .procname = "cad_pid",
@@ -550,6 +553,7 @@ static ctl_table kern_table[] = {
550 .mode = 0600, 553 .mode = 0600,
551 .proc_handler = &proc_do_cad_pid, 554 .proc_handler = &proc_do_cad_pid,
552 }, 555 },
556#endif
553 { 557 {
554 .ctl_name = KERN_MAX_THREADS, 558 .ctl_name = KERN_MAX_THREADS,
555 .procname = "threads-max", 559 .procname = "threads-max",
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 126bb30c4afe..a99b2a6e6a07 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -57,7 +57,7 @@ static cycle_t jiffies_read(void)
57 57
58struct clocksource clocksource_jiffies = { 58struct clocksource clocksource_jiffies = {
59 .name = "jiffies", 59 .name = "jiffies",
60 .rating = 0, /* lowest rating*/ 60 .rating = 1, /* lowest valid rating*/
61 .read = jiffies_read, 61 .read = jiffies_read,
62 .mask = 0xffffffff, /*32bits*/ 62 .mask = 0xffffffff, /*32bits*/
63 .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */ 63 .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
diff --git a/lib/Makefile b/lib/Makefile
index 59070dbfbeb4..cf98fabaa549 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,14 +5,14 @@
5lib-y := ctype.o string.o vsprintf.o cmdline.o \ 5lib-y := ctype.o string.o vsprintf.o cmdline.o \
6 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ 6 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
8 sha1.o irq_regs.o carta_random32.o 8 sha1.o irq_regs.o
9 9
10lib-$(CONFIG_MMU) += ioremap.o 10lib-$(CONFIG_MMU) += ioremap.o
11lib-$(CONFIG_SMP) += cpumask.o 11lib-$(CONFIG_SMP) += cpumask.o
12 12
13lib-y += kobject.o kref.o kobject_uevent.o klist.o 13lib-y += kobject.o kref.o kobject_uevent.o klist.o
14 14
15obj-y += sort.o parser.o halfmd4.o iomap_copy.o debug_locks.o 15obj-y += sort.o parser.o halfmd4.o iomap_copy.o debug_locks.o random32.o
16 16
17ifeq ($(CONFIG_DEBUG_KOBJECT),y) 17ifeq ($(CONFIG_DEBUG_KOBJECT),y)
18CFLAGS_kobject.o += -DDEBUG 18CFLAGS_kobject.o += -DDEBUG
diff --git a/lib/carta_random32.c b/lib/carta_random32.c
deleted file mode 100644
index ca82df70eee4..000000000000
--- a/lib/carta_random32.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
3 * Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 * 02111-1307 USA
18 */
19#include <linux/types.h>
20#include <linux/module.h>
21
22/*
23 * Fast, simple, yet decent quality random number generator based on
24 * a paper by David G. Carta ("Two Fast Implementations of the
25 * `Minimal Standard' Random Number Generator," Communications of the
26 * ACM, January, 1990).
27 */
28u64 carta_random32 (u64 seed)
29{
30# define A 16807
31# define M ((u32) 1 << 31)
32 u64 s, prod = A * seed, p, q;
33
34 p = (prod >> 31) & (M - 1);
35 q = (prod >> 0) & (M - 1);
36 s = p + q;
37 if (s >= M)
38 s -= M - 1;
39 return s;
40}
41EXPORT_SYMBOL_GPL(carta_random32);
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 7a2a73f88d59..3a67dc5ada7d 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -43,19 +43,3 @@ int __any_online_cpu(const cpumask_t *mask)
43 return cpu; 43 return cpu;
44} 44}
45EXPORT_SYMBOL(__any_online_cpu); 45EXPORT_SYMBOL(__any_online_cpu);
46
47#if MAX_NUMNODES > 1
48/*
49 * Find the highest possible node id.
50 */
51int highest_possible_node_id(void)
52{
53 unsigned int node;
54 unsigned int highest = 0;
55
56 for_each_node_mask(node, node_possible_map)
57 highest = node;
58 return highest;
59}
60EXPORT_SYMBOL(highest_possible_node_id);
61#endif
diff --git a/lib/kobject.c b/lib/kobject.c
index 1699eb9161f3..7dd5c0e9d996 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -119,6 +119,7 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
119 119
120 return path; 120 return path;
121} 121}
122EXPORT_SYMBOL_GPL(kobject_get_path);
122 123
123/** 124/**
124 * kobject_init - initialize object. 125 * kobject_init - initialize object.
diff --git a/lib/random32.c b/lib/random32.c
new file mode 100644
index 000000000000..4a15ce51cea7
--- /dev/null
+++ b/lib/random32.c
@@ -0,0 +1,142 @@
1/*
2 This is a maximally equidistributed combined Tausworthe generator
3 based on code from GNU Scientific Library 1.5 (30 Jun 2004)
4
5 x_n = (s1_n ^ s2_n ^ s3_n)
6
7 s1_{n+1} = (((s1_n & 4294967294) <<12) ^ (((s1_n <<13) ^ s1_n) >>19))
8 s2_{n+1} = (((s2_n & 4294967288) << 4) ^ (((s2_n << 2) ^ s2_n) >>25))
9 s3_{n+1} = (((s3_n & 4294967280) <<17) ^ (((s3_n << 3) ^ s3_n) >>11))
10
11 The period of this generator is about 2^88.
12
13 From: P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe
14 Generators", Mathematics of Computation, 65, 213 (1996), 203--213.
15
16 This is available on the net from L'Ecuyer's home page,
17
18 http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps
19 ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/tausme.ps
20
21 There is an erratum in the paper "Tables of Maximally
22 Equidistributed Combined LFSR Generators", Mathematics of
23 Computation, 68, 225 (1999), 261--269:
24 http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps
25
26 ... the k_j most significant bits of z_j must be non-
27 zero, for each j. (Note: this restriction also applies to the
28 computer code given in [4], but was mistakenly not mentioned in
29 that paper.)
30
31 This affects the seeding procedure by imposing the requirement
32 s1 > 1, s2 > 7, s3 > 15.
33
34*/
35
36#include <linux/types.h>
37#include <linux/percpu.h>
38#include <linux/module.h>
39#include <linux/random.h>
40
41struct rnd_state {
42 u32 s1, s2, s3;
43};
44
45static DEFINE_PER_CPU(struct rnd_state, net_rand_state);
46
47static u32 __random32(struct rnd_state *state)
48{
49#define TAUSWORTHE(s,a,b,c,d) ((s&c)<<d) ^ (((s <<a) ^ s)>>b)
50
51 state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12);
52 state->s2 = TAUSWORTHE(state->s2, 2, 25, 4294967288UL, 4);
53 state->s3 = TAUSWORTHE(state->s3, 3, 11, 4294967280UL, 17);
54
55 return (state->s1 ^ state->s2 ^ state->s3);
56}
57
58static void __set_random32(struct rnd_state *state, unsigned long s)
59{
60 if (s == 0)
61 s = 1; /* default seed is 1 */
62
63#define LCG(n) (69069 * n)
64 state->s1 = LCG(s);
65 state->s2 = LCG(state->s1);
66 state->s3 = LCG(state->s2);
67
68 /* "warm it up" */
69 __random32(state);
70 __random32(state);
71 __random32(state);
72 __random32(state);
73 __random32(state);
74 __random32(state);
75}
76
77/**
78 * random32 - pseudo random number generator
79 *
80 * A 32 bit pseudo-random number is generated using a fast
81 * algorithm suitable for simulation. This algorithm is NOT
82 * considered safe for cryptographic use.
83 */
84u32 random32(void)
85{
86 unsigned long r;
87 struct rnd_state *state = &get_cpu_var(net_rand_state);
88 r = __random32(state);
89 put_cpu_var(state);
90 return r;
91}
92EXPORT_SYMBOL(random32);
93
94/**
95 * srandom32 - add entropy to pseudo random number generator
96 * @seed: seed value
97 *
98 * Add some additional seeding to the random32() pool.
99 * Note: this pool is per cpu so it only affects current CPU.
100 */
101void srandom32(u32 entropy)
102{
103 struct rnd_state *state = &get_cpu_var(net_rand_state);
104 __set_random32(state, state->s1 ^ entropy);
105 put_cpu_var(state);
106}
107EXPORT_SYMBOL(srandom32);
108
109/*
110 * Generate some initially weak seeding values to allow
111 * to start the random32() engine.
112 */
113static int __init random32_init(void)
114{
115 int i;
116
117 for_each_possible_cpu(i) {
118 struct rnd_state *state = &per_cpu(net_rand_state,i);
119 __set_random32(state, i + jiffies);
120 }
121 return 0;
122}
123core_initcall(random32_init);
124
125/*
126 * Generate better values after random number generator
127 * is fully initalized.
128 */
129static int __init random32_reseed(void)
130{
131 int i;
132 unsigned long seed;
133
134 for_each_possible_cpu(i) {
135 struct rnd_state *state = &per_cpu(net_rand_state,i);
136
137 get_random_bytes(&seed, sizeof(seed));
138 __set_random32(state, seed);
139 }
140 return 0;
141}
142late_initcall(random32_reseed);
diff --git a/lib/rwsem-spinlock.c b/lib/rwsem-spinlock.c
index db4fed74b940..c4cfd6c0342f 100644
--- a/lib/rwsem-spinlock.c
+++ b/lib/rwsem-spinlock.c
@@ -28,7 +28,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name,
28 * Make sure we are not reinitializing a held semaphore: 28 * Make sure we are not reinitializing a held semaphore:
29 */ 29 */
30 debug_check_no_locks_freed((void *)sem, sizeof(*sem)); 30 debug_check_no_locks_freed((void *)sem, sizeof(*sem));
31 lockdep_init_map(&sem->dep_map, name, key); 31 lockdep_init_map(&sem->dep_map, name, key, 0);
32#endif 32#endif
33 sem->activity = 0; 33 sem->activity = 0;
34 spin_lock_init(&sem->wait_lock); 34 spin_lock_init(&sem->wait_lock);
diff --git a/lib/rwsem.c b/lib/rwsem.c
index 901d0e7da892..cdb4e3d05607 100644
--- a/lib/rwsem.c
+++ b/lib/rwsem.c
@@ -19,7 +19,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name,
19 * Make sure we are not reinitializing a held semaphore: 19 * Make sure we are not reinitializing a held semaphore:
20 */ 20 */
21 debug_check_no_locks_freed((void *)sem, sizeof(*sem)); 21 debug_check_no_locks_freed((void *)sem, sizeof(*sem));
22 lockdep_init_map(&sem->dep_map, name, key); 22 lockdep_init_map(&sem->dep_map, name, key, 0);
23#endif 23#endif
24 sem->count = RWSEM_UNLOCKED_VALUE; 24 sem->count = RWSEM_UNLOCKED_VALUE;
25 spin_lock_init(&sem->wait_lock); 25 spin_lock_init(&sem->wait_lock);
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index dafaf1de2491..b6c4f898197c 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -20,7 +20,7 @@ void __spin_lock_init(spinlock_t *lock, const char *name,
20 * Make sure we are not reinitializing a held lock: 20 * Make sure we are not reinitializing a held lock:
21 */ 21 */
22 debug_check_no_locks_freed((void *)lock, sizeof(*lock)); 22 debug_check_no_locks_freed((void *)lock, sizeof(*lock));
23 lockdep_init_map(&lock->dep_map, name, key); 23 lockdep_init_map(&lock->dep_map, name, key, 0);
24#endif 24#endif
25 lock->raw_lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; 25 lock->raw_lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
26 lock->magic = SPINLOCK_MAGIC; 26 lock->magic = SPINLOCK_MAGIC;
@@ -38,7 +38,7 @@ void __rwlock_init(rwlock_t *lock, const char *name,
38 * Make sure we are not reinitializing a held lock: 38 * Make sure we are not reinitializing a held lock:
39 */ 39 */
40 debug_check_no_locks_freed((void *)lock, sizeof(*lock)); 40 debug_check_no_locks_freed((void *)lock, sizeof(*lock));
41 lockdep_init_map(&lock->dep_map, name, key); 41 lockdep_init_map(&lock->dep_map, name, key, 0);
42#endif 42#endif
43 lock->raw_lock = (raw_rwlock_t) __RAW_RW_LOCK_UNLOCKED; 43 lock->raw_lock = (raw_rwlock_t) __RAW_RW_LOCK_UNLOCKED;
44 lock->magic = RWLOCK_MAGIC; 44 lock->magic = RWLOCK_MAGIC;
diff --git a/mm/Makefile b/mm/Makefile
index 12b3a4eee88d..f3c077eb0b8e 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -10,7 +10,8 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ 10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
11 page_alloc.o page-writeback.o pdflush.o \ 11 page_alloc.o page-writeback.o pdflush.o \
12 readahead.o swap.o truncate.o vmscan.o \ 12 readahead.o swap.o truncate.o vmscan.o \
13 prio_tree.o util.o mmzone.o vmstat.o $(mmu-y) 13 prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
14 $(mmu-y)
14 15
15ifeq ($(CONFIG_MMU)$(CONFIG_BLOCK),yy) 16ifeq ($(CONFIG_MMU)$(CONFIG_BLOCK),yy)
16obj-y += bounce.o 17obj-y += bounce.o
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
new file mode 100644
index 000000000000..f50a2811f9dc
--- /dev/null
+++ b/mm/backing-dev.c
@@ -0,0 +1,69 @@
1
2#include <linux/wait.h>
3#include <linux/backing-dev.h>
4#include <linux/fs.h>
5#include <linux/sched.h>
6#include <linux/module.h>
7
8static wait_queue_head_t congestion_wqh[2] = {
9 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
10 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
11 };
12
13
14void clear_bdi_congested(struct backing_dev_info *bdi, int rw)
15{
16 enum bdi_state bit;
17 wait_queue_head_t *wqh = &congestion_wqh[rw];
18
19 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
20 clear_bit(bit, &bdi->state);
21 smp_mb__after_clear_bit();
22 if (waitqueue_active(wqh))
23 wake_up(wqh);
24}
25EXPORT_SYMBOL(clear_bdi_congested);
26
27void set_bdi_congested(struct backing_dev_info *bdi, int rw)
28{
29 enum bdi_state bit;
30
31 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
32 set_bit(bit, &bdi->state);
33}
34EXPORT_SYMBOL(set_bdi_congested);
35
36/**
37 * congestion_wait - wait for a backing_dev to become uncongested
38 * @rw: READ or WRITE
39 * @timeout: timeout in jiffies
40 *
41 * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit
42 * write congestion. If no backing_devs are congested then just wait for the
43 * next write to be completed.
44 */
45long congestion_wait(int rw, long timeout)
46{
47 long ret;
48 DEFINE_WAIT(wait);
49 wait_queue_head_t *wqh = &congestion_wqh[rw];
50
51 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
52 ret = io_schedule_timeout(timeout);
53 finish_wait(wqh, &wait);
54 return ret;
55}
56EXPORT_SYMBOL(congestion_wait);
57
58/**
59 * congestion_end - wake up sleepers on a congested backing_dev_info
60 * @rw: READ or WRITE
61 */
62void congestion_end(int rw)
63{
64 wait_queue_head_t *wqh = &congestion_wqh[rw];
65
66 if (waitqueue_active(wqh))
67 wake_up(wqh);
68}
69EXPORT_SYMBOL(congestion_end);
diff --git a/mm/filemap.c b/mm/filemap.c
index 3464b681f844..cb26e33fd0ff 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -75,8 +75,8 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
75 * ->mmap_sem 75 * ->mmap_sem
76 * ->lock_page (access_process_vm) 76 * ->lock_page (access_process_vm)
77 * 77 *
78 * ->mmap_sem 78 * ->i_mutex (generic_file_buffered_write)
79 * ->i_mutex (msync) 79 * ->mmap_sem (fault_in_pages_readable->do_page_fault)
80 * 80 *
81 * ->i_mutex 81 * ->i_mutex
82 * ->i_alloc_sem (various) 82 * ->i_alloc_sem (various)
@@ -1884,11 +1884,10 @@ repeat:
1884 * if suid or (sgid and xgrp) 1884 * if suid or (sgid and xgrp)
1885 * remove privs 1885 * remove privs
1886 */ 1886 */
1887int remove_suid(struct dentry *dentry) 1887int should_remove_suid(struct dentry *dentry)
1888{ 1888{
1889 mode_t mode = dentry->d_inode->i_mode; 1889 mode_t mode = dentry->d_inode->i_mode;
1890 int kill = 0; 1890 int kill = 0;
1891 int result = 0;
1892 1891
1893 /* suid always must be killed */ 1892 /* suid always must be killed */
1894 if (unlikely(mode & S_ISUID)) 1893 if (unlikely(mode & S_ISUID))
@@ -1901,13 +1900,28 @@ int remove_suid(struct dentry *dentry)
1901 if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 1900 if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
1902 kill |= ATTR_KILL_SGID; 1901 kill |= ATTR_KILL_SGID;
1903 1902
1904 if (unlikely(kill && !capable(CAP_FSETID))) { 1903 if (unlikely(kill && !capable(CAP_FSETID)))
1905 struct iattr newattrs; 1904 return kill;
1906 1905
1907 newattrs.ia_valid = ATTR_FORCE | kill; 1906 return 0;
1908 result = notify_change(dentry, &newattrs); 1907}
1909 } 1908
1910 return result; 1909int __remove_suid(struct dentry *dentry, int kill)
1910{
1911 struct iattr newattrs;
1912
1913 newattrs.ia_valid = ATTR_FORCE | kill;
1914 return notify_change(dentry, &newattrs);
1915}
1916
1917int remove_suid(struct dentry *dentry)
1918{
1919 int kill = should_remove_suid(dentry);
1920
1921 if (unlikely(kill))
1922 return __remove_suid(dentry, kill);
1923
1924 return 0;
1911} 1925}
1912EXPORT_SYMBOL(remove_suid); 1926EXPORT_SYMBOL(remove_suid);
1913 1927
@@ -2222,7 +2236,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2222 unsigned long nr_segs, loff_t *ppos) 2236 unsigned long nr_segs, loff_t *ppos)
2223{ 2237{
2224 struct file *file = iocb->ki_filp; 2238 struct file *file = iocb->ki_filp;
2225 const struct address_space * mapping = file->f_mapping; 2239 struct address_space * mapping = file->f_mapping;
2226 size_t ocount; /* original count */ 2240 size_t ocount; /* original count */
2227 size_t count; /* after file limit checks */ 2241 size_t count; /* after file limit checks */
2228 struct inode *inode = mapping->host; 2242 struct inode *inode = mapping->host;
@@ -2275,8 +2289,11 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2275 2289
2276 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ 2290 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
2277 if (unlikely(file->f_flags & O_DIRECT)) { 2291 if (unlikely(file->f_flags & O_DIRECT)) {
2278 written = generic_file_direct_write(iocb, iov, 2292 loff_t endbyte;
2279 &nr_segs, pos, ppos, count, ocount); 2293 ssize_t written_buffered;
2294
2295 written = generic_file_direct_write(iocb, iov, &nr_segs, pos,
2296 ppos, count, ocount);
2280 if (written < 0 || written == count) 2297 if (written < 0 || written == count)
2281 goto out; 2298 goto out;
2282 /* 2299 /*
@@ -2285,10 +2302,46 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2285 */ 2302 */
2286 pos += written; 2303 pos += written;
2287 count -= written; 2304 count -= written;
2288 } 2305 written_buffered = generic_file_buffered_write(iocb, iov,
2306 nr_segs, pos, ppos, count,
2307 written);
2308 /*
2309 * If generic_file_buffered_write() retuned a synchronous error
2310 * then we want to return the number of bytes which were
2311 * direct-written, or the error code if that was zero. Note
2312 * that this differs from normal direct-io semantics, which
2313 * will return -EFOO even if some bytes were written.
2314 */
2315 if (written_buffered < 0) {
2316 err = written_buffered;
2317 goto out;
2318 }
2289 2319
2290 written = generic_file_buffered_write(iocb, iov, nr_segs, 2320 /*
2291 pos, ppos, count, written); 2321 * We need to ensure that the page cache pages are written to
2322 * disk and invalidated to preserve the expected O_DIRECT
2323 * semantics.
2324 */
2325 endbyte = pos + written_buffered - written - 1;
2326 err = do_sync_file_range(file, pos, endbyte,
2327 SYNC_FILE_RANGE_WAIT_BEFORE|
2328 SYNC_FILE_RANGE_WRITE|
2329 SYNC_FILE_RANGE_WAIT_AFTER);
2330 if (err == 0) {
2331 written = written_buffered;
2332 invalidate_mapping_pages(mapping,
2333 pos >> PAGE_CACHE_SHIFT,
2334 endbyte >> PAGE_CACHE_SHIFT);
2335 } else {
2336 /*
2337 * We don't know how much we wrote, so just return
2338 * the number of bytes which were direct-written
2339 */
2340 }
2341 } else {
2342 written = generic_file_buffered_write(iocb, iov, nr_segs,
2343 pos, ppos, count, written);
2344 }
2292out: 2345out:
2293 current->backing_dev_info = NULL; 2346 current->backing_dev_info = NULL;
2294 return written ? written : err; 2347 return written ? written : err;
diff --git a/mm/memory.c b/mm/memory.c
index b5a4aadd961a..156861fcac43 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1452,6 +1452,7 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo
1452 if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) 1452 if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE))
1453 memset(kaddr, 0, PAGE_SIZE); 1453 memset(kaddr, 0, PAGE_SIZE);
1454 kunmap_atomic(kaddr, KM_USER0); 1454 kunmap_atomic(kaddr, KM_USER0);
1455 flush_dcache_page(dst);
1455 return; 1456 return;
1456 1457
1457 } 1458 }
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 20f41b082e16..2e3ce3a928b9 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -15,6 +15,7 @@
15 * kernel subsystems and hints as to where to find out what things do. 15 * kernel subsystems and hints as to where to find out what things do.
16 */ 16 */
17 17
18#include <linux/oom.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/swap.h> 21#include <linux/swap.h>
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index a0f339057449..8d9b19f239c3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -222,7 +222,7 @@ static void balance_dirty_pages(struct address_space *mapping)
222 if (pages_written >= write_chunk) 222 if (pages_written >= write_chunk)
223 break; /* We've done our duty */ 223 break; /* We've done our duty */
224 } 224 }
225 blk_congestion_wait(WRITE, HZ/10); 225 congestion_wait(WRITE, HZ/10);
226 } 226 }
227 227
228 if (nr_reclaimable + global_page_state(NR_WRITEBACK) 228 if (nr_reclaimable + global_page_state(NR_WRITEBACK)
@@ -314,7 +314,7 @@ void throttle_vm_writeout(void)
314 if (global_page_state(NR_UNSTABLE_NFS) + 314 if (global_page_state(NR_UNSTABLE_NFS) +
315 global_page_state(NR_WRITEBACK) <= dirty_thresh) 315 global_page_state(NR_WRITEBACK) <= dirty_thresh)
316 break; 316 break;
317 blk_congestion_wait(WRITE, HZ/10); 317 congestion_wait(WRITE, HZ/10);
318 } 318 }
319} 319}
320 320
@@ -351,7 +351,7 @@ static void background_writeout(unsigned long _min_pages)
351 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; 351 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
352 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 352 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
353 /* Wrote less than expected */ 353 /* Wrote less than expected */
354 blk_congestion_wait(WRITE, HZ/10); 354 congestion_wait(WRITE, HZ/10);
355 if (!wbc.encountered_congestion) 355 if (!wbc.encountered_congestion)
356 break; 356 break;
357 } 357 }
@@ -422,7 +422,7 @@ static void wb_kupdate(unsigned long arg)
422 writeback_inodes(&wbc); 422 writeback_inodes(&wbc);
423 if (wbc.nr_to_write > 0) { 423 if (wbc.nr_to_write > 0) {
424 if (wbc.encountered_congestion) 424 if (wbc.encountered_congestion)
425 blk_congestion_wait(WRITE, HZ/10); 425 congestion_wait(WRITE, HZ/10);
426 else 426 else
427 break; /* All the old data is written */ 427 break; /* All the old data is written */
428 } 428 }
@@ -956,15 +956,6 @@ int test_set_page_writeback(struct page *page)
956EXPORT_SYMBOL(test_set_page_writeback); 956EXPORT_SYMBOL(test_set_page_writeback);
957 957
958/* 958/*
959 * Wakes up tasks that are being throttled due to writeback congestion
960 */
961void writeback_congestion_end(void)
962{
963 blk_congestion_end(WRITE);
964}
965EXPORT_SYMBOL(writeback_congestion_end);
966
967/*
968 * Return true if any of the pages in the mapping are marged with the 959 * Return true if any of the pages in the mapping are marged with the
969 * passed tag. 960 * passed tag.
970 */ 961 */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 40db96a655d0..ebd425c2e2a7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -39,6 +39,7 @@
39#include <linux/stop_machine.h> 39#include <linux/stop_machine.h>
40#include <linux/sort.h> 40#include <linux/sort.h>
41#include <linux/pfn.h> 41#include <linux/pfn.h>
42#include <linux/backing-dev.h>
42 43
43#include <asm/tlbflush.h> 44#include <asm/tlbflush.h>
44#include <asm/div64.h> 45#include <asm/div64.h>
@@ -1050,7 +1051,7 @@ nofail_alloc:
1050 if (page) 1051 if (page)
1051 goto got_pg; 1052 goto got_pg;
1052 if (gfp_mask & __GFP_NOFAIL) { 1053 if (gfp_mask & __GFP_NOFAIL) {
1053 blk_congestion_wait(WRITE, HZ/50); 1054 congestion_wait(WRITE, HZ/50);
1054 goto nofail_alloc; 1055 goto nofail_alloc;
1055 } 1056 }
1056 } 1057 }
@@ -1113,7 +1114,7 @@ rebalance:
1113 do_retry = 1; 1114 do_retry = 1;
1114 } 1115 }
1115 if (do_retry) { 1116 if (do_retry) {
1116 blk_congestion_wait(WRITE, HZ/50); 1117 congestion_wait(WRITE, HZ/50);
1117 goto rebalance; 1118 goto rebalance;
1118 } 1119 }
1119 1120
@@ -3119,3 +3120,19 @@ unsigned long page_to_pfn(struct page *page)
3119EXPORT_SYMBOL(pfn_to_page); 3120EXPORT_SYMBOL(pfn_to_page);
3120EXPORT_SYMBOL(page_to_pfn); 3121EXPORT_SYMBOL(page_to_pfn);
3121#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ 3122#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
3123
3124#if MAX_NUMNODES > 1
3125/*
3126 * Find the highest possible node id.
3127 */
3128int highest_possible_node_id(void)
3129{
3130 unsigned int node;
3131 unsigned int highest = 0;
3132
3133 for_each_node_mask(node, node_possible_map)
3134 highest = node;
3135 return highest;
3136}
3137EXPORT_SYMBOL(highest_possible_node_id);
3138#endif
diff --git a/mm/rmap.c b/mm/rmap.c
index a9136d8b7577..d8a842a586db 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -21,27 +21,21 @@
21 * Lock ordering in mm: 21 * Lock ordering in mm:
22 * 22 *
23 * inode->i_mutex (while writing or truncating, not reading or faulting) 23 * inode->i_mutex (while writing or truncating, not reading or faulting)
24 * inode->i_alloc_sem 24 * inode->i_alloc_sem (vmtruncate_range)
25 * 25 * mm->mmap_sem
26 * When a page fault occurs in writing from user to file, down_read 26 * page->flags PG_locked (lock_page)
27 * of mmap_sem nests within i_mutex; in sys_msync, i_mutex nests within 27 * mapping->i_mmap_lock
28 * down_read of mmap_sem; i_mutex and down_write of mmap_sem are never 28 * anon_vma->lock
29 * taken together; in truncation, i_mutex is taken outermost. 29 * mm->page_table_lock or pte_lock
30 * 30 * zone->lru_lock (in mark_page_accessed, isolate_lru_page)
31 * mm->mmap_sem 31 * swap_lock (in swap_duplicate, swap_info_get)
32 * page->flags PG_locked (lock_page) 32 * mmlist_lock (in mmput, drain_mmlist and others)
33 * mapping->i_mmap_lock 33 * mapping->private_lock (in __set_page_dirty_buffers)
34 * anon_vma->lock 34 * inode_lock (in set_page_dirty's __mark_inode_dirty)
35 * mm->page_table_lock or pte_lock 35 * sb_lock (within inode_lock in fs/fs-writeback.c)
36 * zone->lru_lock (in mark_page_accessed, isolate_lru_page) 36 * mapping->tree_lock (widely used, in set_page_dirty,
37 * swap_lock (in swap_duplicate, swap_info_get) 37 * in arch-dependent flush_dcache_mmap_lock,
38 * mmlist_lock (in mmput, drain_mmlist and others) 38 * within inode_lock in __sync_single_inode)
39 * mapping->private_lock (in __set_page_dirty_buffers)
40 * inode_lock (in set_page_dirty's __mark_inode_dirty)
41 * sb_lock (within inode_lock in fs/fs-writeback.c)
42 * mapping->tree_lock (widely used, in set_page_dirty,
43 * in arch-dependent flush_dcache_mmap_lock,
44 * within inode_lock in __sync_single_inode)
45 */ 39 */
46 40
47#include <linux/mm.h> 41#include <linux/mm.h>
diff --git a/mm/shmem.c b/mm/shmem.c
index bb8ca7ef7094..4959535fc14c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -48,6 +48,7 @@
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/migrate.h> 49#include <linux/migrate.h>
50#include <linux/highmem.h> 50#include <linux/highmem.h>
51#include <linux/backing-dev.h>
51 52
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/div64.h> 54#include <asm/div64.h>
@@ -1131,7 +1132,7 @@ repeat:
1131 page_cache_release(swappage); 1132 page_cache_release(swappage);
1132 if (error == -ENOMEM) { 1133 if (error == -ENOMEM) {
1133 /* let kswapd refresh zone for GFP_ATOMICs */ 1134 /* let kswapd refresh zone for GFP_ATOMICs */
1134 blk_congestion_wait(WRITE, HZ/50); 1135 congestion_wait(WRITE, HZ/50);
1135 } 1136 }
1136 goto repeat; 1137 goto repeat;
1137 } 1138 }
@@ -1362,6 +1363,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1362 inode->i_mapping->a_ops = &shmem_aops; 1363 inode->i_mapping->a_ops = &shmem_aops;
1363 inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; 1364 inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
1364 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1365 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1366 inode->i_generation = get_seconds();
1365 info = SHMEM_I(inode); 1367 info = SHMEM_I(inode);
1366 memset(info, 0, (char *)inode - (char *)info); 1368 memset(info, 0, (char *)inode - (char *)info);
1367 spin_lock_init(&info->lock); 1369 spin_lock_init(&info->lock);
@@ -1956,6 +1958,85 @@ static struct xattr_handler *shmem_xattr_handlers[] = {
1956}; 1958};
1957#endif 1959#endif
1958 1960
1961static struct dentry *shmem_get_parent(struct dentry *child)
1962{
1963 return ERR_PTR(-ESTALE);
1964}
1965
1966static int shmem_match(struct inode *ino, void *vfh)
1967{
1968 __u32 *fh = vfh;
1969 __u64 inum = fh[2];
1970 inum = (inum << 32) | fh[1];
1971 return ino->i_ino == inum && fh[0] == ino->i_generation;
1972}
1973
1974static struct dentry *shmem_get_dentry(struct super_block *sb, void *vfh)
1975{
1976 struct dentry *de = NULL;
1977 struct inode *inode;
1978 __u32 *fh = vfh;
1979 __u64 inum = fh[2];
1980 inum = (inum << 32) | fh[1];
1981
1982 inode = ilookup5(sb, (unsigned long)(inum+fh[0]), shmem_match, vfh);
1983 if (inode) {
1984 de = d_find_alias(inode);
1985 iput(inode);
1986 }
1987
1988 return de? de: ERR_PTR(-ESTALE);
1989}
1990
1991static struct dentry *shmem_decode_fh(struct super_block *sb, __u32 *fh,
1992 int len, int type,
1993 int (*acceptable)(void *context, struct dentry *de),
1994 void *context)
1995{
1996 if (len < 3)
1997 return ERR_PTR(-ESTALE);
1998
1999 return sb->s_export_op->find_exported_dentry(sb, fh, NULL, acceptable,
2000 context);
2001}
2002
2003static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
2004 int connectable)
2005{
2006 struct inode *inode = dentry->d_inode;
2007
2008 if (*len < 3)
2009 return 255;
2010
2011 if (hlist_unhashed(&inode->i_hash)) {
2012 /* Unfortunately insert_inode_hash is not idempotent,
2013 * so as we hash inodes here rather than at creation
2014 * time, we need a lock to ensure we only try
2015 * to do it once
2016 */
2017 static DEFINE_SPINLOCK(lock);
2018 spin_lock(&lock);
2019 if (hlist_unhashed(&inode->i_hash))
2020 __insert_inode_hash(inode,
2021 inode->i_ino + inode->i_generation);
2022 spin_unlock(&lock);
2023 }
2024
2025 fh[0] = inode->i_generation;
2026 fh[1] = inode->i_ino;
2027 fh[2] = ((__u64)inode->i_ino) >> 32;
2028
2029 *len = 3;
2030 return 1;
2031}
2032
2033static struct export_operations shmem_export_ops = {
2034 .get_parent = shmem_get_parent,
2035 .get_dentry = shmem_get_dentry,
2036 .encode_fh = shmem_encode_fh,
2037 .decode_fh = shmem_decode_fh,
2038};
2039
1959static int shmem_parse_options(char *options, int *mode, uid_t *uid, 2040static int shmem_parse_options(char *options, int *mode, uid_t *uid,
1960 gid_t *gid, unsigned long *blocks, unsigned long *inodes, 2041 gid_t *gid, unsigned long *blocks, unsigned long *inodes,
1961 int *policy, nodemask_t *policy_nodes) 2042 int *policy, nodemask_t *policy_nodes)
@@ -2128,6 +2209,7 @@ static int shmem_fill_super(struct super_block *sb,
2128 &inodes, &policy, &policy_nodes)) 2209 &inodes, &policy, &policy_nodes))
2129 return -EINVAL; 2210 return -EINVAL;
2130 } 2211 }
2212 sb->s_export_op = &shmem_export_ops;
2131#else 2213#else
2132 sb->s_flags |= MS_NOUSER; 2214 sb->s_flags |= MS_NOUSER;
2133#endif 2215#endif
diff --git a/mm/truncate.c b/mm/truncate.c
index 11ca480701dd..e07b1e682c38 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -96,7 +96,6 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
96 return 0; 96 return 0;
97 97
98 ret = remove_mapping(mapping, page); 98 ret = remove_mapping(mapping, page);
99 ClearPageUptodate(page);
100 99
101 return ret; 100 return ret;
102} 101}
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 750ab6ed13fc..1133dd3aafcf 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -428,8 +428,11 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
428 if (array_size > PAGE_SIZE) { 428 if (array_size > PAGE_SIZE) {
429 pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node); 429 pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node);
430 area->flags |= VM_VPAGES; 430 area->flags |= VM_VPAGES;
431 } else 431 } else {
432 pages = kmalloc_node(array_size, (gfp_mask & ~__GFP_HIGHMEM), node); 432 pages = kmalloc_node(array_size,
433 (gfp_mask & ~(__GFP_HIGHMEM | __GFP_ZERO)),
434 node);
435 }
433 area->pages = pages; 436 area->pages = pages;
434 if (!area->pages) { 437 if (!area->pages) {
435 remove_vm_area(area->addr); 438 remove_vm_area(area->addr);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index eca70310adb2..f05527bf792b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -378,6 +378,12 @@ static pageout_t pageout(struct page *page, struct address_space *mapping)
378 return PAGE_CLEAN; 378 return PAGE_CLEAN;
379} 379}
380 380
381/*
382 * Attempt to detach a locked page from its ->mapping. If it is dirty or if
383 * someone else has a ref on the page, abort and return 0. If it was
384 * successfully detached, return 1. Assumes the caller has a single ref on
385 * this page.
386 */
381int remove_mapping(struct address_space *mapping, struct page *page) 387int remove_mapping(struct address_space *mapping, struct page *page)
382{ 388{
383 BUG_ON(!PageLocked(page)); 389 BUG_ON(!PageLocked(page));
@@ -1053,7 +1059,7 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1053 1059
1054 /* Take a nap, wait for some writeback to complete */ 1060 /* Take a nap, wait for some writeback to complete */
1055 if (sc.nr_scanned && priority < DEF_PRIORITY - 2) 1061 if (sc.nr_scanned && priority < DEF_PRIORITY - 2)
1056 blk_congestion_wait(WRITE, HZ/10); 1062 congestion_wait(WRITE, HZ/10);
1057 } 1063 }
1058 /* top priority shrink_caches still had more to do? don't OOM, then */ 1064 /* top priority shrink_caches still had more to do? don't OOM, then */
1059 if (!sc.all_unreclaimable) 1065 if (!sc.all_unreclaimable)
@@ -1208,7 +1214,7 @@ scan:
1208 * another pass across the zones. 1214 * another pass across the zones.
1209 */ 1215 */
1210 if (total_scanned && priority < DEF_PRIORITY - 2) 1216 if (total_scanned && priority < DEF_PRIORITY - 2)
1211 blk_congestion_wait(WRITE, HZ/10); 1217 congestion_wait(WRITE, HZ/10);
1212 1218
1213 /* 1219 /*
1214 * We do this so kswapd doesn't build up large priorities for 1220 * We do this so kswapd doesn't build up large priorities for
@@ -1452,7 +1458,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
1452 goto out; 1458 goto out;
1453 1459
1454 if (sc.nr_scanned && prio < DEF_PRIORITY - 2) 1460 if (sc.nr_scanned && prio < DEF_PRIORITY - 2)
1455 blk_congestion_wait(WRITE, HZ / 10); 1461 congestion_wait(WRITE, HZ / 10);
1456 } 1462 }
1457 1463
1458 lru_pages = 0; 1464 lru_pages = 0;
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 305a099b7477..67df99e2e5c8 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -48,41 +48,56 @@
48#define BT_DBG(D...) 48#define BT_DBG(D...)
49#endif 49#endif
50 50
51#define VERSION "2.10" 51#define VERSION "2.11"
52 52
53/* Bluetooth sockets */ 53/* Bluetooth sockets */
54#define BT_MAX_PROTO 8 54#define BT_MAX_PROTO 8
55static struct net_proto_family *bt_proto[BT_MAX_PROTO]; 55static struct net_proto_family *bt_proto[BT_MAX_PROTO];
56static DEFINE_RWLOCK(bt_proto_lock);
56 57
57int bt_sock_register(int proto, struct net_proto_family *ops) 58int bt_sock_register(int proto, struct net_proto_family *ops)
58{ 59{
60 int err = 0;
61
59 if (proto < 0 || proto >= BT_MAX_PROTO) 62 if (proto < 0 || proto >= BT_MAX_PROTO)
60 return -EINVAL; 63 return -EINVAL;
61 64
65 write_lock(&bt_proto_lock);
66
62 if (bt_proto[proto]) 67 if (bt_proto[proto])
63 return -EEXIST; 68 err = -EEXIST;
69 else
70 bt_proto[proto] = ops;
64 71
65 bt_proto[proto] = ops; 72 write_unlock(&bt_proto_lock);
66 return 0; 73
74 return err;
67} 75}
68EXPORT_SYMBOL(bt_sock_register); 76EXPORT_SYMBOL(bt_sock_register);
69 77
70int bt_sock_unregister(int proto) 78int bt_sock_unregister(int proto)
71{ 79{
80 int err = 0;
81
72 if (proto < 0 || proto >= BT_MAX_PROTO) 82 if (proto < 0 || proto >= BT_MAX_PROTO)
73 return -EINVAL; 83 return -EINVAL;
74 84
85 write_lock(&bt_proto_lock);
86
75 if (!bt_proto[proto]) 87 if (!bt_proto[proto])
76 return -ENOENT; 88 err = -ENOENT;
89 else
90 bt_proto[proto] = NULL;
77 91
78 bt_proto[proto] = NULL; 92 write_unlock(&bt_proto_lock);
79 return 0; 93
94 return err;
80} 95}
81EXPORT_SYMBOL(bt_sock_unregister); 96EXPORT_SYMBOL(bt_sock_unregister);
82 97
83static int bt_sock_create(struct socket *sock, int proto) 98static int bt_sock_create(struct socket *sock, int proto)
84{ 99{
85 int err = 0; 100 int err;
86 101
87 if (proto < 0 || proto >= BT_MAX_PROTO) 102 if (proto < 0 || proto >= BT_MAX_PROTO)
88 return -EINVAL; 103 return -EINVAL;
@@ -92,11 +107,18 @@ static int bt_sock_create(struct socket *sock, int proto)
92 request_module("bt-proto-%d", proto); 107 request_module("bt-proto-%d", proto);
93 } 108 }
94#endif 109#endif
110
95 err = -EPROTONOSUPPORT; 111 err = -EPROTONOSUPPORT;
112
113 read_lock(&bt_proto_lock);
114
96 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { 115 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
97 err = bt_proto[proto]->create(sock, proto); 116 err = bt_proto[proto]->create(sock, proto);
98 module_put(bt_proto[proto]->owner); 117 module_put(bt_proto[proto]->owner);
99 } 118 }
119
120 read_unlock(&bt_proto_lock);
121
100 return err; 122 return err;
101} 123}
102 124
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 2312d050eeed..4d3424c2421c 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -528,12 +528,10 @@ static struct device *bnep_get_device(struct bnep_session *session)
528 return NULL; 528 return NULL;
529 529
530 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); 530 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
531 if (!conn)
532 return NULL;
533 531
534 hci_dev_put(hdev); 532 hci_dev_put(hdev);
535 533
536 return &conn->dev; 534 return conn ? &conn->dev : NULL;
537} 535}
538 536
539int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) 537int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 28c55835422a..5563db1bf526 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -43,6 +43,7 @@
43#include <linux/ioctl.h> 43#include <linux/ioctl.h>
44#include <linux/file.h> 44#include <linux/file.h>
45#include <linux/init.h> 45#include <linux/init.h>
46#include <linux/compat.h>
46#include <net/sock.h> 47#include <net/sock.h>
47 48
48#include <asm/system.h> 49#include <asm/system.h>
@@ -146,24 +147,56 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
146 return 0; 147 return 0;
147} 148}
148 149
150#ifdef CONFIG_COMPAT
151static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
152{
153 if (cmd == BNEPGETCONNLIST) {
154 struct bnep_connlist_req cl;
155 uint32_t uci;
156 int err;
157
158 if (get_user(cl.cnum, (uint32_t __user *) arg) ||
159 get_user(uci, (u32 __user *) (arg + 4)))
160 return -EFAULT;
161
162 cl.ci = compat_ptr(uci);
163
164 if (cl.cnum <= 0)
165 return -EINVAL;
166
167 err = bnep_get_connlist(&cl);
168
169 if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
170 err = -EFAULT;
171
172 return err;
173 }
174
175 return bnep_sock_ioctl(sock, cmd, arg);
176}
177#endif
178
149static const struct proto_ops bnep_sock_ops = { 179static const struct proto_ops bnep_sock_ops = {
150 .family = PF_BLUETOOTH, 180 .family = PF_BLUETOOTH,
151 .owner = THIS_MODULE, 181 .owner = THIS_MODULE,
152 .release = bnep_sock_release, 182 .release = bnep_sock_release,
153 .ioctl = bnep_sock_ioctl, 183 .ioctl = bnep_sock_ioctl,
154 .bind = sock_no_bind, 184#ifdef CONFIG_COMPAT
155 .getname = sock_no_getname, 185 .compat_ioctl = bnep_sock_compat_ioctl,
156 .sendmsg = sock_no_sendmsg, 186#endif
157 .recvmsg = sock_no_recvmsg, 187 .bind = sock_no_bind,
158 .poll = sock_no_poll, 188 .getname = sock_no_getname,
159 .listen = sock_no_listen, 189 .sendmsg = sock_no_sendmsg,
160 .shutdown = sock_no_shutdown, 190 .recvmsg = sock_no_recvmsg,
161 .setsockopt = sock_no_setsockopt, 191 .poll = sock_no_poll,
162 .getsockopt = sock_no_getsockopt, 192 .listen = sock_no_listen,
163 .connect = sock_no_connect, 193 .shutdown = sock_no_shutdown,
164 .socketpair = sock_no_socketpair, 194 .setsockopt = sock_no_setsockopt,
165 .accept = sock_no_accept, 195 .getsockopt = sock_no_getsockopt,
166 .mmap = sock_no_mmap 196 .connect = sock_no_connect,
197 .socketpair = sock_no_socketpair,
198 .accept = sock_no_accept,
199 .mmap = sock_no_mmap
167}; 200};
168 201
169static struct proto bnep_proto = { 202static struct proto bnep_proto = {
@@ -181,7 +214,7 @@ static int bnep_sock_create(struct socket *sock, int protocol)
181 if (sock->type != SOCK_RAW) 214 if (sock->type != SOCK_RAW)
182 return -ESOCKTNOSUPPORT; 215 return -ESOCKTNOSUPPORT;
183 216
184 sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &bnep_proto, 1); 217 sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1);
185 if (!sk) 218 if (!sk)
186 return -ENOMEM; 219 return -ENOMEM;
187 220
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 10ad7fd91d83..53295d33dc5c 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -34,6 +34,7 @@
34#include <linux/socket.h> 34#include <linux/socket.h>
35#include <linux/ioctl.h> 35#include <linux/ioctl.h>
36#include <linux/file.h> 36#include <linux/file.h>
37#include <linux/compat.h>
37#include <net/sock.h> 38#include <net/sock.h>
38 39
39#include <linux/isdn/capilli.h> 40#include <linux/isdn/capilli.h>
@@ -137,11 +138,43 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
137 return -EINVAL; 138 return -EINVAL;
138} 139}
139 140
141#ifdef CONFIG_COMPAT
142static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
143{
144 if (cmd == CMTPGETCONNLIST) {
145 struct cmtp_connlist_req cl;
146 uint32_t uci;
147 int err;
148
149 if (get_user(cl.cnum, (uint32_t __user *) arg) ||
150 get_user(uci, (u32 __user *) (arg + 4)))
151 return -EFAULT;
152
153 cl.ci = compat_ptr(uci);
154
155 if (cl.cnum <= 0)
156 return -EINVAL;
157
158 err = cmtp_get_connlist(&cl);
159
160 if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
161 err = -EFAULT;
162
163 return err;
164 }
165
166 return cmtp_sock_ioctl(sock, cmd, arg);
167}
168#endif
169
140static const struct proto_ops cmtp_sock_ops = { 170static const struct proto_ops cmtp_sock_ops = {
141 .family = PF_BLUETOOTH, 171 .family = PF_BLUETOOTH,
142 .owner = THIS_MODULE, 172 .owner = THIS_MODULE,
143 .release = cmtp_sock_release, 173 .release = cmtp_sock_release,
144 .ioctl = cmtp_sock_ioctl, 174 .ioctl = cmtp_sock_ioctl,
175#ifdef CONFIG_COMPAT
176 .compat_ioctl = cmtp_sock_compat_ioctl,
177#endif
145 .bind = sock_no_bind, 178 .bind = sock_no_bind,
146 .getname = sock_no_getname, 179 .getname = sock_no_getname,
147 .sendmsg = sock_no_sendmsg, 180 .sendmsg = sock_no_sendmsg,
@@ -172,7 +205,7 @@ static int cmtp_sock_create(struct socket *sock, int protocol)
172 if (sock->type != SOCK_RAW) 205 if (sock->type != SOCK_RAW)
173 return -ESOCKTNOSUPPORT; 206 return -ESOCKTNOSUPPORT;
174 207
175 sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &cmtp_proto, 1); 208 sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1);
176 if (!sk) 209 if (!sk)
177 return -ENOMEM; 210 return -ENOMEM;
178 211
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 90e3a285a17e..6cd5711fa28a 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -51,7 +51,7 @@
51#define BT_DBG(D...) 51#define BT_DBG(D...)
52#endif 52#endif
53 53
54static void hci_acl_connect(struct hci_conn *conn) 54void hci_acl_connect(struct hci_conn *conn)
55{ 55{
56 struct hci_dev *hdev = conn->hdev; 56 struct hci_dev *hdev = conn->hdev;
57 struct inquiry_entry *ie; 57 struct inquiry_entry *ie;
@@ -63,6 +63,8 @@ static void hci_acl_connect(struct hci_conn *conn)
63 conn->out = 1; 63 conn->out = 1;
64 conn->link_mode = HCI_LM_MASTER; 64 conn->link_mode = HCI_LM_MASTER;
65 65
66 conn->attempt++;
67
66 memset(&cp, 0, sizeof(cp)); 68 memset(&cp, 0, sizeof(cp));
67 bacpy(&cp.bdaddr, &conn->dst); 69 bacpy(&cp.bdaddr, &conn->dst);
68 cp.pscan_rep_mode = 0x02; 70 cp.pscan_rep_mode = 0x02;
@@ -80,7 +82,7 @@ static void hci_acl_connect(struct hci_conn *conn)
80 cp.role_switch = 0x01; 82 cp.role_switch = 0x01;
81 else 83 else
82 cp.role_switch = 0x00; 84 cp.role_switch = 0x00;
83 85
84 hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp); 86 hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp);
85} 87}
86 88
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index d43d0c890975..65f094845719 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -414,9 +414,12 @@ static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
414 414
415 if (status) { 415 if (status) {
416 if (conn && conn->state == BT_CONNECT) { 416 if (conn && conn->state == BT_CONNECT) {
417 conn->state = BT_CLOSED; 417 if (status != 0x0c || conn->attempt > 2) {
418 hci_proto_connect_cfm(conn, status); 418 conn->state = BT_CLOSED;
419 hci_conn_del(conn); 419 hci_proto_connect_cfm(conn, status);
420 hci_conn_del(conn);
421 } else
422 conn->state = BT_CONNECT2;
420 } 423 }
421 } else { 424 } else {
422 if (!conn) { 425 if (!conn) {
@@ -728,7 +731,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
728static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 731static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
729{ 732{
730 struct hci_ev_conn_complete *ev = (struct hci_ev_conn_complete *) skb->data; 733 struct hci_ev_conn_complete *ev = (struct hci_ev_conn_complete *) skb->data;
731 struct hci_conn *conn; 734 struct hci_conn *conn, *pend;
732 735
733 BT_DBG("%s", hdev->name); 736 BT_DBG("%s", hdev->name);
734 737
@@ -801,6 +804,10 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
801 if (ev->status) 804 if (ev->status)
802 hci_conn_del(conn); 805 hci_conn_del(conn);
803 806
807 pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2);
808 if (pend)
809 hci_acl_connect(pend);
810
804 hci_dev_unlock(hdev); 811 hci_dev_unlock(hdev);
805} 812}
806 813
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 1a35d343e08a..f26a9eb49945 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -618,7 +618,7 @@ static int hci_sock_create(struct socket *sock, int protocol)
618 618
619 sock->ops = &hci_sock_ops; 619 sock->ops = &hci_sock_ops;
620 620
621 sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &hci_sk_proto, 1); 621 sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1);
622 if (!sk) 622 if (!sk)
623 return -ENOMEM; 623 return -ENOMEM;
624 624
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 989b22d9042e..954eb74eb370 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -242,10 +242,14 @@ static void add_conn(void *data)
242 struct hci_conn *conn = data; 242 struct hci_conn *conn = data;
243 int i; 243 int i;
244 244
245 device_register(&conn->dev); 245 if (device_register(&conn->dev) < 0) {
246 BT_ERR("Failed to register connection device");
247 return;
248 }
246 249
247 for (i = 0; conn_attrs[i]; i++) 250 for (i = 0; conn_attrs[i]; i++)
248 device_create_file(&conn->dev, conn_attrs[i]); 251 if (device_create_file(&conn->dev, conn_attrs[i]) < 0)
252 BT_ERR("Failed to create connection attribute");
249} 253}
250 254
251void hci_conn_add_sysfs(struct hci_conn *conn) 255void hci_conn_add_sysfs(struct hci_conn *conn)
@@ -295,11 +299,7 @@ int hci_register_sysfs(struct hci_dev *hdev)
295 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); 299 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
296 300
297 dev->class = bt_class; 301 dev->class = bt_class;
298 302 dev->parent = hdev->parent;
299 if (hdev->parent)
300 dev->parent = hdev->parent;
301 else
302 dev->parent = &bt_platform->dev;
303 303
304 strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); 304 strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
305 305
@@ -312,7 +312,8 @@ int hci_register_sysfs(struct hci_dev *hdev)
312 return err; 312 return err;
313 313
314 for (i = 0; bt_attrs[i]; i++) 314 for (i = 0; bt_attrs[i]; i++)
315 device_create_file(dev, bt_attrs[i]); 315 if (device_create_file(dev, bt_attrs[i]) < 0)
316 BT_ERR("Failed to create device attribute");
316 317
317 return 0; 318 return 0;
318} 319}
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 03b5dadb4951..66782010f82c 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -507,14 +507,12 @@ static int hidp_session(void *arg)
507 507
508 hidp_del_timer(session); 508 hidp_del_timer(session);
509 509
510 if (intr_sk->sk_state != BT_CONNECTED) 510 fput(session->intr_sock->file);
511 wait_event_timeout(*(ctrl_sk->sk_sleep), (ctrl_sk->sk_state == BT_CLOSED), HZ);
512
513 fput(session->ctrl_sock->file);
514 511
515 wait_event_timeout(*(intr_sk->sk_sleep), (intr_sk->sk_state == BT_CLOSED), HZ); 512 wait_event_timeout(*(ctrl_sk->sk_sleep),
513 (ctrl_sk->sk_state == BT_CLOSED), msecs_to_jiffies(500));
516 514
517 fput(session->intr_sock->file); 515 fput(session->ctrl_sock->file);
518 516
519 __hidp_unlink_session(session); 517 __hidp_unlink_session(session);
520 518
@@ -541,12 +539,10 @@ static struct device *hidp_get_device(struct hidp_session *session)
541 return NULL; 539 return NULL;
542 540
543 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); 541 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
544 if (!conn)
545 return NULL;
546 542
547 hci_dev_put(hdev); 543 hci_dev_put(hdev);
548 544
549 return &conn->dev; 545 return conn ? &conn->dev : NULL;
550} 546}
551 547
552static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) 548static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 099646e4e2ef..407fba43c1b9 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -35,6 +35,7 @@
35#include <linux/ioctl.h> 35#include <linux/ioctl.h>
36#include <linux/file.h> 36#include <linux/file.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/compat.h>
38#include <net/sock.h> 39#include <net/sock.h>
39 40
40#include "hidp.h" 41#include "hidp.h"
@@ -143,11 +144,88 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
143 return -EINVAL; 144 return -EINVAL;
144} 145}
145 146
147#ifdef CONFIG_COMPAT
148struct compat_hidp_connadd_req {
149 int ctrl_sock; // Connected control socket
150 int intr_sock; // Connteted interrupt socket
151 __u16 parser;
152 __u16 rd_size;
153 compat_uptr_t rd_data;
154 __u8 country;
155 __u8 subclass;
156 __u16 vendor;
157 __u16 product;
158 __u16 version;
159 __u32 flags;
160 __u32 idle_to;
161 char name[128];
162};
163
164static int hidp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
165{
166 if (cmd == HIDPGETCONNLIST) {
167 struct hidp_connlist_req cl;
168 uint32_t uci;
169 int err;
170
171 if (get_user(cl.cnum, (uint32_t __user *) arg) ||
172 get_user(uci, (u32 __user *) (arg + 4)))
173 return -EFAULT;
174
175 cl.ci = compat_ptr(uci);
176
177 if (cl.cnum <= 0)
178 return -EINVAL;
179
180 err = hidp_get_connlist(&cl);
181
182 if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
183 err = -EFAULT;
184
185 return err;
186 } else if (cmd == HIDPCONNADD) {
187 struct compat_hidp_connadd_req ca;
188 struct hidp_connadd_req __user *uca;
189
190 uca = compat_alloc_user_space(sizeof(*uca));
191
192 if (copy_from_user(&ca, (void *) arg, sizeof(ca)))
193 return -EFAULT;
194
195 if (put_user(ca.ctrl_sock, &uca->ctrl_sock) ||
196 put_user(ca.intr_sock, &uca->intr_sock) ||
197 put_user(ca.parser, &uca->parser) ||
198 put_user(ca.rd_size, &uca->parser) ||
199 put_user(compat_ptr(ca.rd_data), &uca->rd_data) ||
200 put_user(ca.country, &uca->country) ||
201 put_user(ca.subclass, &uca->subclass) ||
202 put_user(ca.vendor, &uca->vendor) ||
203 put_user(ca.product, &uca->product) ||
204 put_user(ca.version, &uca->version) ||
205 put_user(ca.flags, &uca->flags) ||
206 put_user(ca.idle_to, &uca->idle_to) ||
207 copy_to_user(&uca->name[0], &ca.name[0], 128))
208 return -EFAULT;
209
210 arg = (unsigned long) uca;
211
212 /* Fall through. We don't actually write back any _changes_
213 to the structure anyway, so there's no need to copy back
214 into the original compat version */
215 }
216
217 return hidp_sock_ioctl(sock, cmd, arg);
218}
219#endif
220
146static const struct proto_ops hidp_sock_ops = { 221static const struct proto_ops hidp_sock_ops = {
147 .family = PF_BLUETOOTH, 222 .family = PF_BLUETOOTH,
148 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
149 .release = hidp_sock_release, 224 .release = hidp_sock_release,
150 .ioctl = hidp_sock_ioctl, 225 .ioctl = hidp_sock_ioctl,
226#ifdef CONFIG_COMPAT
227 .compat_ioctl = hidp_sock_compat_ioctl,
228#endif
151 .bind = sock_no_bind, 229 .bind = sock_no_bind,
152 .getname = sock_no_getname, 230 .getname = sock_no_getname,
153 .sendmsg = sock_no_sendmsg, 231 .sendmsg = sock_no_sendmsg,
@@ -178,7 +256,7 @@ static int hidp_sock_create(struct socket *sock, int protocol)
178 if (sock->type != SOCK_RAW) 256 if (sock->type != SOCK_RAW)
179 return -ESOCKTNOSUPPORT; 257 return -ESOCKTNOSUPPORT;
180 258
181 sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &hidp_proto, 1); 259 sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1);
182 if (!sk) 260 if (!sk)
183 return -ENOMEM; 261 return -ENOMEM;
184 262
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index d56f60b392ac..2b3dcb8f90fa 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -559,7 +559,7 @@ static int l2cap_sock_create(struct socket *sock, int protocol)
559 559
560 sock->ops = &l2cap_sock_ops; 560 sock->ops = &l2cap_sock_ops;
561 561
562 sk = l2cap_sock_alloc(sock, protocol, GFP_KERNEL); 562 sk = l2cap_sock_alloc(sock, protocol, GFP_ATOMIC);
563 if (!sk) 563 if (!sk)
564 return -ENOMEM; 564 return -ENOMEM;
565 565
@@ -2216,7 +2216,8 @@ static int __init l2cap_init(void)
2216 goto error; 2216 goto error;
2217 } 2217 }
2218 2218
2219 class_create_file(bt_class, &class_attr_l2cap); 2219 if (class_create_file(bt_class, &class_attr_l2cap) < 0)
2220 BT_ERR("Failed to create L2CAP info file");
2220 2221
2221 BT_INFO("L2CAP ver %s", VERSION); 2222 BT_INFO("L2CAP ver %s", VERSION);
2222 BT_INFO("L2CAP socket layer initialized"); 2223 BT_INFO("L2CAP socket layer initialized");
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 468df3b953f6..ddc4e9d5963e 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2058,7 +2058,8 @@ static int __init rfcomm_init(void)
2058 2058
2059 kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); 2059 kernel_thread(rfcomm_run, NULL, CLONE_KERNEL);
2060 2060
2061 class_create_file(bt_class, &class_attr_rfcomm_dlc); 2061 if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0)
2062 BT_ERR("Failed to create RFCOMM info file");
2062 2063
2063 rfcomm_init_sockets(); 2064 rfcomm_init_sockets();
2064 2065
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 220fee04e7f2..544d65b7baa7 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -336,7 +336,8 @@ static int rfcomm_sock_create(struct socket *sock, int protocol)
336 336
337 sock->ops = &rfcomm_sock_ops; 337 sock->ops = &rfcomm_sock_ops;
338 338
339 if (!(sk = rfcomm_sock_alloc(sock, protocol, GFP_KERNEL))) 339 sk = rfcomm_sock_alloc(sock, protocol, GFP_ATOMIC);
340 if (!sk)
340 return -ENOMEM; 341 return -ENOMEM;
341 342
342 rfcomm_sock_init(sk, NULL); 343 rfcomm_sock_init(sk, NULL);
@@ -944,7 +945,8 @@ int __init rfcomm_init_sockets(void)
944 if (err < 0) 945 if (err < 0)
945 goto error; 946 goto error;
946 947
947 class_create_file(bt_class, &class_attr_rfcomm); 948 if (class_create_file(bt_class, &class_attr_rfcomm) < 0)
949 BT_ERR("Failed to create RFCOMM info file");
948 950
949 BT_INFO("RFCOMM socket layer initialized"); 951 BT_INFO("RFCOMM socket layer initialized");
950 952
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 1958ad1b8541..b8e3a5f1c8a8 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -172,12 +172,10 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
172 return NULL; 172 return NULL;
173 173
174 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); 174 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst);
175 if (!conn)
176 return NULL;
177 175
178 hci_dev_put(hdev); 176 hci_dev_put(hdev);
179 177
180 return &conn->dev; 178 return conn ? &conn->dev : NULL;
181} 179}
182 180
183static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) 181static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
@@ -767,6 +765,9 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct termios *old)
767 765
768 BT_DBG("tty %p termios %p", tty, old); 766 BT_DBG("tty %p termios %p", tty, old);
769 767
768 if (!dev)
769 return;
770
770 /* Handle turning off CRTSCTS */ 771 /* Handle turning off CRTSCTS */
771 if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) 772 if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS))
772 BT_DBG("Turning off CRTSCTS unsupported"); 773 BT_DBG("Turning off CRTSCTS unsupported");
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 7714a2ec3854..5d13d4f31753 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -452,7 +452,8 @@ static int sco_sock_create(struct socket *sock, int protocol)
452 452
453 sock->ops = &sco_sock_ops; 453 sock->ops = &sco_sock_ops;
454 454
455 if (!(sk = sco_sock_alloc(sock, protocol, GFP_KERNEL))) 455 sk = sco_sock_alloc(sock, protocol, GFP_ATOMIC);
456 if (!sk)
456 return -ENOMEM; 457 return -ENOMEM;
457 458
458 sco_sock_init(sk, NULL); 459 sco_sock_init(sk, NULL);
@@ -967,7 +968,8 @@ static int __init sco_init(void)
967 goto error; 968 goto error;
968 } 969 }
969 970
970 class_create_file(bt_class, &class_attr_sco); 971 if (class_create_file(bt_class, &class_attr_sco) < 0)
972 BT_ERR("Failed to create SCO info file");
971 973
972 BT_INFO("SCO (Voice Link) ver %s", VERSION); 974 BT_INFO("SCO (Voice Link) ver %s", VERSION);
973 BT_INFO("SCO socket layer initialized"); 975 BT_INFO("SCO socket layer initialized");
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 3a73b8c94271..d9f04864d15d 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -128,7 +128,10 @@ void br_fdb_cleanup(unsigned long _data)
128 mod_timer(&br->gc_timer, jiffies + HZ/10); 128 mod_timer(&br->gc_timer, jiffies + HZ/10);
129} 129}
130 130
131void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p) 131
132void br_fdb_delete_by_port(struct net_bridge *br,
133 const struct net_bridge_port *p,
134 int do_all)
132{ 135{
133 int i; 136 int i;
134 137
@@ -142,6 +145,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
142 if (f->dst != p) 145 if (f->dst != p)
143 continue; 146 continue;
144 147
148 if (f->is_static && !do_all)
149 continue;
145 /* 150 /*
146 * if multiple ports all have the same device address 151 * if multiple ports all have the same device address
147 * then when one port is deleted, assign 152 * then when one port is deleted, assign
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index b1211d5342f6..f753c40c11d2 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -163,7 +163,7 @@ static void del_nbp(struct net_bridge_port *p)
163 br_stp_disable_port(p); 163 br_stp_disable_port(p);
164 spin_unlock_bh(&br->lock); 164 spin_unlock_bh(&br->lock);
165 165
166 br_fdb_delete_by_port(br, p); 166 br_fdb_delete_by_port(br, p, 1);
167 167
168 list_del_rcu(&p->list); 168 list_del_rcu(&p->list);
169 169
@@ -448,7 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
448 448
449 return 0; 449 return 0;
450err2: 450err2:
451 br_fdb_delete_by_port(br, p); 451 br_fdb_delete_by_port(br, p, 1);
452err1: 452err1:
453 kobject_del(&p->kobj); 453 kobject_del(&p->kobj);
454err0: 454err0:
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index c491fb2f280e..74258d86f256 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -143,7 +143,7 @@ extern void br_fdb_changeaddr(struct net_bridge_port *p,
143 const unsigned char *newaddr); 143 const unsigned char *newaddr);
144extern void br_fdb_cleanup(unsigned long arg); 144extern void br_fdb_cleanup(unsigned long arg);
145extern void br_fdb_delete_by_port(struct net_bridge *br, 145extern void br_fdb_delete_by_port(struct net_bridge *br,
146 struct net_bridge_port *p); 146 const struct net_bridge_port *p, int do_all);
147extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, 147extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
148 const unsigned char *addr); 148 const unsigned char *addr);
149extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, 149extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 14cd025079af..d294224592db 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -113,6 +113,8 @@ void br_stp_disable_port(struct net_bridge_port *p)
113 del_timer(&p->forward_delay_timer); 113 del_timer(&p->forward_delay_timer);
114 del_timer(&p->hold_timer); 114 del_timer(&p->hold_timer);
115 115
116 br_fdb_delete_by_port(br, p, 0);
117
116 br_configuration_update(br); 118 br_configuration_update(br);
117 119
118 br_port_state_selection(br); 120 br_port_state_selection(br);
diff --git a/net/core/dev.c b/net/core/dev.c
index 4d891beab138..81c426adcd1e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3502,8 +3502,6 @@ static int __init net_dev_init(void)
3502 3502
3503 BUG_ON(!dev_boot_phase); 3503 BUG_ON(!dev_boot_phase);
3504 3504
3505 net_random_init();
3506
3507 if (dev_proc_init()) 3505 if (dev_proc_init())
3508 goto out; 3506 goto out;
3509 3507
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index ead5920c26d6..9308af060b44 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -335,13 +335,13 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
335 memcpy(skb->data, msg, len); 335 memcpy(skb->data, msg, len);
336 skb->len += len; 336 skb->len += len;
337 337
338 udph = (struct udphdr *) skb_push(skb, sizeof(*udph)); 338 skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph));
339 udph->source = htons(np->local_port); 339 udph->source = htons(np->local_port);
340 udph->dest = htons(np->remote_port); 340 udph->dest = htons(np->remote_port);
341 udph->len = htons(udp_len); 341 udph->len = htons(udp_len);
342 udph->check = 0; 342 udph->check = 0;
343 343
344 iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); 344 skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
345 345
346 /* iph->version = 4; iph->ihl = 5; */ 346 /* iph->version = 4; iph->ihl = 5; */
347 put_unaligned(0x45, (unsigned char *)iph); 347 put_unaligned(0x45, (unsigned char *)iph);
@@ -357,8 +357,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
357 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); 357 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
358 358
359 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); 359 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
360 360 skb->mac.raw = skb->data;
361 eth->h_proto = htons(ETH_P_IP); 361 skb->protocol = eth->h_proto = htons(ETH_P_IP);
362 memcpy(eth->h_source, np->local_mac, 6); 362 memcpy(eth->h_source, np->local_mac, 6);
363 memcpy(eth->h_dest, np->remote_mac, 6); 363 memcpy(eth->h_dest, np->remote_mac, 6);
364 364
diff --git a/net/core/sock.c b/net/core/sock.c
index b77e155cbe6c..d472db4776c3 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -823,7 +823,7 @@ static void inline sock_lock_init(struct sock *sk)
823 af_family_slock_key_strings[sk->sk_family]); 823 af_family_slock_key_strings[sk->sk_family]);
824 lockdep_init_map(&sk->sk_lock.dep_map, 824 lockdep_init_map(&sk->sk_lock.dep_map,
825 af_family_key_strings[sk->sk_family], 825 af_family_key_strings[sk->sk_family],
826 af_family_keys + sk->sk_family); 826 af_family_keys + sk->sk_family, 0);
827} 827}
828 828
829/** 829/**
diff --git a/net/core/utils.c b/net/core/utils.c
index 94c5d761c830..d93fe64f6693 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -30,119 +30,6 @@
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33/*
34 This is a maximally equidistributed combined Tausworthe generator
35 based on code from GNU Scientific Library 1.5 (30 Jun 2004)
36
37 x_n = (s1_n ^ s2_n ^ s3_n)
38
39 s1_{n+1} = (((s1_n & 4294967294) <<12) ^ (((s1_n <<13) ^ s1_n) >>19))
40 s2_{n+1} = (((s2_n & 4294967288) << 4) ^ (((s2_n << 2) ^ s2_n) >>25))
41 s3_{n+1} = (((s3_n & 4294967280) <<17) ^ (((s3_n << 3) ^ s3_n) >>11))
42
43 The period of this generator is about 2^88.
44
45 From: P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe
46 Generators", Mathematics of Computation, 65, 213 (1996), 203--213.
47
48 This is available on the net from L'Ecuyer's home page,
49
50 http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps
51 ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/tausme.ps
52
53 There is an erratum in the paper "Tables of Maximally
54 Equidistributed Combined LFSR Generators", Mathematics of
55 Computation, 68, 225 (1999), 261--269:
56 http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps
57
58 ... the k_j most significant bits of z_j must be non-
59 zero, for each j. (Note: this restriction also applies to the
60 computer code given in [4], but was mistakenly not mentioned in
61 that paper.)
62
63 This affects the seeding procedure by imposing the requirement
64 s1 > 1, s2 > 7, s3 > 15.
65
66*/
67struct nrnd_state {
68 u32 s1, s2, s3;
69};
70
71static DEFINE_PER_CPU(struct nrnd_state, net_rand_state);
72
73static u32 __net_random(struct nrnd_state *state)
74{
75#define TAUSWORTHE(s,a,b,c,d) ((s&c)<<d) ^ (((s <<a) ^ s)>>b)
76
77 state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12);
78 state->s2 = TAUSWORTHE(state->s2, 2, 25, 4294967288UL, 4);
79 state->s3 = TAUSWORTHE(state->s3, 3, 11, 4294967280UL, 17);
80
81 return (state->s1 ^ state->s2 ^ state->s3);
82}
83
84static void __net_srandom(struct nrnd_state *state, unsigned long s)
85{
86 if (s == 0)
87 s = 1; /* default seed is 1 */
88
89#define LCG(n) (69069 * n)
90 state->s1 = LCG(s);
91 state->s2 = LCG(state->s1);
92 state->s3 = LCG(state->s2);
93
94 /* "warm it up" */
95 __net_random(state);
96 __net_random(state);
97 __net_random(state);
98 __net_random(state);
99 __net_random(state);
100 __net_random(state);
101}
102
103
104unsigned long net_random(void)
105{
106 unsigned long r;
107 struct nrnd_state *state = &get_cpu_var(net_rand_state);
108 r = __net_random(state);
109 put_cpu_var(state);
110 return r;
111}
112
113
114void net_srandom(unsigned long entropy)
115{
116 struct nrnd_state *state = &get_cpu_var(net_rand_state);
117 __net_srandom(state, state->s1^entropy);
118 put_cpu_var(state);
119}
120
121void __init net_random_init(void)
122{
123 int i;
124
125 for_each_possible_cpu(i) {
126 struct nrnd_state *state = &per_cpu(net_rand_state,i);
127 __net_srandom(state, i+jiffies);
128 }
129}
130
131static int net_random_reseed(void)
132{
133 int i;
134 unsigned long seed;
135
136 for_each_possible_cpu(i) {
137 struct nrnd_state *state = &per_cpu(net_rand_state,i);
138
139 get_random_bytes(&seed, sizeof(seed));
140 __net_srandom(state, seed);
141 }
142 return 0;
143}
144late_initcall(net_random_reseed);
145
146int net_msg_cost = 5*HZ; 33int net_msg_cost = 5*HZ;
147int net_msg_burst = 10; 34int net_msg_burst = 10;
148 35
@@ -153,10 +40,7 @@ int net_ratelimit(void)
153{ 40{
154 return __printk_ratelimit(net_msg_cost, net_msg_burst); 41 return __printk_ratelimit(net_msg_cost, net_msg_burst);
155} 42}
156
157EXPORT_SYMBOL(net_random);
158EXPORT_SYMBOL(net_ratelimit); 43EXPORT_SYMBOL(net_ratelimit);
159EXPORT_SYMBOL(net_srandom);
160 44
161/* 45/*
162 * Convert an ASCII string to binary IP. 46 * Convert an ASCII string to binary IP.
diff --git a/net/core/wireless.c b/net/core/wireless.c
index ffff0da46c6e..cb1b8728d7ee 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -748,11 +748,39 @@ static int ioctl_standard_call(struct net_device * dev,
748 int extra_size; 748 int extra_size;
749 int user_length = 0; 749 int user_length = 0;
750 int err; 750 int err;
751 int essid_compat = 0;
751 752
752 /* Calculate space needed by arguments. Always allocate 753 /* Calculate space needed by arguments. Always allocate
753 * for max space. Easier, and won't last long... */ 754 * for max space. Easier, and won't last long... */
754 extra_size = descr->max_tokens * descr->token_size; 755 extra_size = descr->max_tokens * descr->token_size;
755 756
757 /* Check need for ESSID compatibility for WE < 21 */
758 switch (cmd) {
759 case SIOCSIWESSID:
760 case SIOCGIWESSID:
761 case SIOCSIWNICKN:
762 case SIOCGIWNICKN:
763 if (iwr->u.data.length == descr->max_tokens + 1)
764 essid_compat = 1;
765 else if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
766 char essid[IW_ESSID_MAX_SIZE + 1];
767
768 err = copy_from_user(essid, iwr->u.data.pointer,
769 iwr->u.data.length *
770 descr->token_size);
771 if (err)
772 return -EFAULT;
773
774 if (essid[iwr->u.data.length - 1] == '\0')
775 essid_compat = 1;
776 }
777 break;
778 default:
779 break;
780 }
781
782 iwr->u.data.length -= essid_compat;
783
756 /* Check what user space is giving us */ 784 /* Check what user space is giving us */
757 if(IW_IS_SET(cmd)) { 785 if(IW_IS_SET(cmd)) {
758 /* Check NULL pointer */ 786 /* Check NULL pointer */
@@ -795,7 +823,8 @@ static int ioctl_standard_call(struct net_device * dev,
795#endif /* WE_IOCTL_DEBUG */ 823#endif /* WE_IOCTL_DEBUG */
796 824
797 /* Create the kernel buffer */ 825 /* Create the kernel buffer */
798 extra = kmalloc(extra_size, GFP_KERNEL); 826 /* kzalloc ensures NULL-termination for essid_compat */
827 extra = kzalloc(extra_size, GFP_KERNEL);
799 if (extra == NULL) { 828 if (extra == NULL) {
800 return -ENOMEM; 829 return -ENOMEM;
801 } 830 }
@@ -819,6 +848,8 @@ static int ioctl_standard_call(struct net_device * dev,
819 /* Call the handler */ 848 /* Call the handler */
820 ret = handler(dev, &info, &(iwr->u), extra); 849 ret = handler(dev, &info, &(iwr->u), extra);
821 850
851 iwr->u.data.length += essid_compat;
852
822 /* If we have something to return to the user */ 853 /* If we have something to return to the user */
823 if (!ret && IW_IS_GET(cmd)) { 854 if (!ret && IW_IS_GET(cmd)) {
824 /* Check if there is enough buffer up there */ 855 /* Check if there is enough buffer up there */
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index a2a43d8d93fe..23489f7232d2 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -269,7 +269,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
269{ 269{
270 return ((fl1->nl_u.dn_u.daddr ^ fl2->nl_u.dn_u.daddr) | 270 return ((fl1->nl_u.dn_u.daddr ^ fl2->nl_u.dn_u.daddr) |
271 (fl1->nl_u.dn_u.saddr ^ fl2->nl_u.dn_u.saddr) | 271 (fl1->nl_u.dn_u.saddr ^ fl2->nl_u.dn_u.saddr) |
272#ifdef CONFIG_IP_ROUTE_FWMARK 272#ifdef CONFIG_DECNET_ROUTE_FWMARK
273 (fl1->nl_u.dn_u.fwmark ^ fl2->nl_u.dn_u.fwmark) | 273 (fl1->nl_u.dn_u.fwmark ^ fl2->nl_u.dn_u.fwmark) |
274#endif 274#endif
275 (fl1->nl_u.dn_u.scope ^ fl2->nl_u.dn_u.scope) | 275 (fl1->nl_u.dn_u.scope ^ fl2->nl_u.dn_u.scope) |
@@ -1275,7 +1275,6 @@ static int dn_route_input_slow(struct sk_buff *skb)
1275 goto e_inval; 1275 goto e_inval;
1276 1276
1277 res.type = RTN_LOCAL; 1277 res.type = RTN_LOCAL;
1278 flags |= RTCF_DIRECTSRC;
1279 } else { 1278 } else {
1280 __le16 src_map = fl.fld_src; 1279 __le16 src_map = fl.fld_src;
1281 free_res = 1; 1280 free_res = 1;
@@ -1346,7 +1345,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1346 goto make_route; 1345 goto make_route;
1347 1346
1348 /* Packet was intra-ethernet, so we know its on-link */ 1347 /* Packet was intra-ethernet, so we know its on-link */
1349 if (cb->rt_flags | DN_RT_F_IE) { 1348 if (cb->rt_flags & DN_RT_F_IE) {
1350 gateway = cb->src; 1349 gateway = cb->src;
1351 flags |= RTCF_DIRECTSRC; 1350 flags |= RTCF_DIRECTSRC;
1352 goto make_route; 1351 goto make_route;
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index bde8ccaa1531..e2077a3aa8c0 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -773,13 +773,15 @@ static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def,
773{ 773{
774 int cat = -1; 774 int cat = -1;
775 u32 bitmap_len_bits = bitmap_len * 8; 775 u32 bitmap_len_bits = bitmap_len * 8;
776 u32 cipso_cat_size = doi_def->map.std->cat.cipso_size; 776 u32 cipso_cat_size;
777 u32 *cipso_array = doi_def->map.std->cat.cipso; 777 u32 *cipso_array;
778 778
779 switch (doi_def->type) { 779 switch (doi_def->type) {
780 case CIPSO_V4_MAP_PASS: 780 case CIPSO_V4_MAP_PASS:
781 return 0; 781 return 0;
782 case CIPSO_V4_MAP_STD: 782 case CIPSO_V4_MAP_STD:
783 cipso_cat_size = doi_def->map.std->cat.cipso_size;
784 cipso_array = doi_def->map.std->cat.cipso;
783 for (;;) { 785 for (;;) {
784 cat = cipso_v4_bitmap_walk(bitmap, 786 cat = cipso_v4_bitmap_walk(bitmap,
785 bitmap_len_bits, 787 bitmap_len_bits,
@@ -825,19 +827,21 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def,
825 u32 net_spot_max = 0; 827 u32 net_spot_max = 0;
826 u32 host_clen_bits = host_cat_len * 8; 828 u32 host_clen_bits = host_cat_len * 8;
827 u32 net_clen_bits = net_cat_len * 8; 829 u32 net_clen_bits = net_cat_len * 8;
828 u32 host_cat_size = doi_def->map.std->cat.local_size; 830 u32 host_cat_size;
829 u32 *host_cat_array = doi_def->map.std->cat.local; 831 u32 *host_cat_array;
830 832
831 switch (doi_def->type) { 833 switch (doi_def->type) {
832 case CIPSO_V4_MAP_PASS: 834 case CIPSO_V4_MAP_PASS:
833 net_spot_max = host_cat_len - 1; 835 net_spot_max = host_cat_len;
834 while (net_spot_max > 0 && host_cat[net_spot_max] == 0) 836 while (net_spot_max > 0 && host_cat[net_spot_max - 1] == 0)
835 net_spot_max--; 837 net_spot_max--;
836 if (net_spot_max > net_cat_len) 838 if (net_spot_max > net_cat_len)
837 return -EINVAL; 839 return -EINVAL;
838 memcpy(net_cat, host_cat, net_spot_max); 840 memcpy(net_cat, host_cat, net_spot_max);
839 return net_spot_max; 841 return net_spot_max;
840 case CIPSO_V4_MAP_STD: 842 case CIPSO_V4_MAP_STD:
843 host_cat_size = doi_def->map.std->cat.local_size;
844 host_cat_array = doi_def->map.std->cat.local;
841 for (;;) { 845 for (;;) {
842 host_spot = cipso_v4_bitmap_walk(host_cat, 846 host_spot = cipso_v4_bitmap_walk(host_cat,
843 host_clen_bits, 847 host_clen_bits,
@@ -893,8 +897,8 @@ static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def,
893 int net_spot = -1; 897 int net_spot = -1;
894 u32 net_clen_bits = net_cat_len * 8; 898 u32 net_clen_bits = net_cat_len * 8;
895 u32 host_clen_bits = host_cat_len * 8; 899 u32 host_clen_bits = host_cat_len * 8;
896 u32 net_cat_size = doi_def->map.std->cat.cipso_size; 900 u32 net_cat_size;
897 u32 *net_cat_array = doi_def->map.std->cat.cipso; 901 u32 *net_cat_array;
898 902
899 switch (doi_def->type) { 903 switch (doi_def->type) {
900 case CIPSO_V4_MAP_PASS: 904 case CIPSO_V4_MAP_PASS:
@@ -903,6 +907,8 @@ static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def,
903 memcpy(host_cat, net_cat, net_cat_len); 907 memcpy(host_cat, net_cat, net_cat_len);
904 return net_cat_len; 908 return net_cat_len;
905 case CIPSO_V4_MAP_STD: 909 case CIPSO_V4_MAP_STD:
910 net_cat_size = doi_def->map.std->cat.cipso_size;
911 net_cat_array = doi_def->map.std->cat.cipso;
906 for (;;) { 912 for (;;) {
907 net_spot = cipso_v4_bitmap_walk(net_cat, 913 net_spot = cipso_v4_bitmap_walk(net_cat,
908 net_clen_bits, 914 net_clen_bits,
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 9c399a70dd5d..af0190d8b6c0 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -482,9 +482,7 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
482 memset(cfg, 0, sizeof(*cfg)); 482 memset(cfg, 0, sizeof(*cfg));
483 483
484 rtm = nlmsg_data(nlh); 484 rtm = nlmsg_data(nlh);
485 cfg->fc_family = rtm->rtm_family;
486 cfg->fc_dst_len = rtm->rtm_dst_len; 485 cfg->fc_dst_len = rtm->rtm_dst_len;
487 cfg->fc_src_len = rtm->rtm_src_len;
488 cfg->fc_tos = rtm->rtm_tos; 486 cfg->fc_tos = rtm->rtm_tos;
489 cfg->fc_table = rtm->rtm_table; 487 cfg->fc_table = rtm->rtm_table;
490 cfg->fc_protocol = rtm->rtm_protocol; 488 cfg->fc_protocol = rtm->rtm_protocol;
@@ -501,9 +499,6 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
501 case RTA_DST: 499 case RTA_DST:
502 cfg->fc_dst = nla_get_be32(attr); 500 cfg->fc_dst = nla_get_be32(attr);
503 break; 501 break;
504 case RTA_SRC:
505 cfg->fc_src = nla_get_be32(attr);
506 break;
507 case RTA_OIF: 502 case RTA_OIF:
508 cfg->fc_oif = nla_get_u32(attr); 503 cfg->fc_oif = nla_get_u32(attr);
509 break; 504 break;
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 2b1a54b59c48..f072f3875af8 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -94,10 +94,8 @@ int inet_peer_minttl = 120 * HZ; /* TTL under high load: 120 sec */
94int inet_peer_maxttl = 10 * 60 * HZ; /* usual time to live: 10 min */ 94int inet_peer_maxttl = 10 * 60 * HZ; /* usual time to live: 10 min */
95 95
96static struct inet_peer *inet_peer_unused_head; 96static struct inet_peer *inet_peer_unused_head;
97/* Exported for inet_putpeer inline function. */ 97static struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head;
98struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head; 98static DEFINE_SPINLOCK(inet_peer_unused_lock);
99DEFINE_SPINLOCK(inet_peer_unused_lock);
100#define PEER_MAX_CLEANUP_WORK 30
101 99
102static void peer_check_expire(unsigned long dummy); 100static void peer_check_expire(unsigned long dummy);
103static DEFINE_TIMER(peer_periodic_timer, peer_check_expire, 0, 0); 101static DEFINE_TIMER(peer_periodic_timer, peer_check_expire, 0, 0);
@@ -340,7 +338,8 @@ static int cleanup_once(unsigned long ttl)
340 spin_lock_bh(&inet_peer_unused_lock); 338 spin_lock_bh(&inet_peer_unused_lock);
341 p = inet_peer_unused_head; 339 p = inet_peer_unused_head;
342 if (p != NULL) { 340 if (p != NULL) {
343 if (time_after(p->dtime + ttl, jiffies)) { 341 __u32 delta = (__u32)jiffies - p->dtime;
342 if (delta < ttl) {
344 /* Do not prune fresh entries. */ 343 /* Do not prune fresh entries. */
345 spin_unlock_bh(&inet_peer_unused_lock); 344 spin_unlock_bh(&inet_peer_unused_lock);
346 return -1; 345 return -1;
@@ -432,7 +431,7 @@ out_free:
432/* Called with local BH disabled. */ 431/* Called with local BH disabled. */
433static void peer_check_expire(unsigned long dummy) 432static void peer_check_expire(unsigned long dummy)
434{ 433{
435 int i; 434 unsigned long now = jiffies;
436 int ttl; 435 int ttl;
437 436
438 if (peer_total >= inet_peer_threshold) 437 if (peer_total >= inet_peer_threshold)
@@ -441,7 +440,10 @@ static void peer_check_expire(unsigned long dummy)
441 ttl = inet_peer_maxttl 440 ttl = inet_peer_maxttl
442 - (inet_peer_maxttl - inet_peer_minttl) / HZ * 441 - (inet_peer_maxttl - inet_peer_minttl) / HZ *
443 peer_total / inet_peer_threshold * HZ; 442 peer_total / inet_peer_threshold * HZ;
444 for (i = 0; i < PEER_MAX_CLEANUP_WORK && !cleanup_once(ttl); i++); 443 while (!cleanup_once(ttl)) {
444 if (jiffies != now)
445 break;
446 }
445 447
446 /* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime 448 /* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime
447 * interval depending on the total number of entries (more entries, 449 * interval depending on the total number of entries (more entries,
@@ -455,3 +457,16 @@ static void peer_check_expire(unsigned long dummy)
455 peer_total / inet_peer_threshold * HZ; 457 peer_total / inet_peer_threshold * HZ;
456 add_timer(&peer_periodic_timer); 458 add_timer(&peer_periodic_timer);
457} 459}
460
461void inet_putpeer(struct inet_peer *p)
462{
463 spin_lock_bh(&inet_peer_unused_lock);
464 if (atomic_dec_and_test(&p->refcnt)) {
465 p->unused_prevp = inet_peer_unused_tailp;
466 p->unused_next = NULL;
467 *inet_peer_unused_tailp = p;
468 inet_peer_unused_tailp = &p->unused_next;
469 p->dtime = (__u32)jiffies;
470 }
471 spin_unlock_bh(&inet_peer_unused_lock);
472}
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 17e1a687ab45..0849f1cced13 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1196,6 +1196,8 @@ err1:
1196static void __exit arp_tables_fini(void) 1196static void __exit arp_tables_fini(void)
1197{ 1197{
1198 nf_unregister_sockopt(&arpt_sockopts); 1198 nf_unregister_sockopt(&arpt_sockopts);
1199 xt_unregister_target(&arpt_error_target);
1200 xt_unregister_target(&arpt_standard_target);
1199 xt_proto_fini(NF_ARP); 1201 xt_proto_fini(NF_ARP);
1200} 1202}
1201 1203
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index 53b6dffea6c2..262d0d44ec1b 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -44,13 +44,6 @@ MODULE_LICENSE("GPL");
44 44
45static char __initdata version[] = "0.90"; 45static char __initdata version[] = "0.90";
46 46
47#if 0
48#define DEBUGP printk
49#else
50#define DEBUGP(format, args...)
51#endif
52
53
54static inline int 47static inline int
55ctnetlink_dump_tuples_proto(struct sk_buff *skb, 48ctnetlink_dump_tuples_proto(struct sk_buff *skb,
56 const struct ip_conntrack_tuple *tuple, 49 const struct ip_conntrack_tuple *tuple,
@@ -398,7 +391,6 @@ nfattr_failure:
398 391
399static int ctnetlink_done(struct netlink_callback *cb) 392static int ctnetlink_done(struct netlink_callback *cb)
400{ 393{
401 DEBUGP("entered %s\n", __FUNCTION__);
402 if (cb->args[1]) 394 if (cb->args[1])
403 ip_conntrack_put((struct ip_conntrack *)cb->args[1]); 395 ip_conntrack_put((struct ip_conntrack *)cb->args[1]);
404 return 0; 396 return 0;
@@ -411,9 +403,6 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
411 struct ip_conntrack_tuple_hash *h; 403 struct ip_conntrack_tuple_hash *h;
412 struct list_head *i; 404 struct list_head *i;
413 405
414 DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__,
415 cb->args[0], *id);
416
417 read_lock_bh(&ip_conntrack_lock); 406 read_lock_bh(&ip_conntrack_lock);
418 last = (struct ip_conntrack *)cb->args[1]; 407 last = (struct ip_conntrack *)cb->args[1];
419 for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) { 408 for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) {
@@ -452,7 +441,6 @@ out:
452 if (last) 441 if (last)
453 ip_conntrack_put(last); 442 ip_conntrack_put(last);
454 443
455 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
456 return skb->len; 444 return skb->len;
457} 445}
458 446
@@ -466,8 +454,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
466{ 454{
467 struct nfattr *tb[CTA_IP_MAX]; 455 struct nfattr *tb[CTA_IP_MAX];
468 456
469 DEBUGP("entered %s\n", __FUNCTION__);
470
471 nfattr_parse_nested(tb, CTA_IP_MAX, attr); 457 nfattr_parse_nested(tb, CTA_IP_MAX, attr);
472 458
473 if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip)) 459 if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
@@ -481,8 +467,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
481 return -EINVAL; 467 return -EINVAL;
482 tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]); 468 tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
483 469
484 DEBUGP("leaving\n");
485
486 return 0; 470 return 0;
487} 471}
488 472
@@ -503,8 +487,6 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
503 struct ip_conntrack_protocol *proto; 487 struct ip_conntrack_protocol *proto;
504 int ret = 0; 488 int ret = 0;
505 489
506 DEBUGP("entered %s\n", __FUNCTION__);
507
508 nfattr_parse_nested(tb, CTA_PROTO_MAX, attr); 490 nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
509 491
510 if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto)) 492 if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
@@ -531,8 +513,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,
531 struct nfattr *tb[CTA_TUPLE_MAX]; 513 struct nfattr *tb[CTA_TUPLE_MAX];
532 int err; 514 int err;
533 515
534 DEBUGP("entered %s\n", __FUNCTION__);
535
536 memset(tuple, 0, sizeof(*tuple)); 516 memset(tuple, 0, sizeof(*tuple));
537 517
538 nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]); 518 nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
@@ -557,10 +537,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,
557 else 537 else
558 tuple->dst.dir = IP_CT_DIR_ORIGINAL; 538 tuple->dst.dir = IP_CT_DIR_ORIGINAL;
559 539
560 DUMP_TUPLE(tuple);
561
562 DEBUGP("leaving\n");
563
564 return 0; 540 return 0;
565} 541}
566 542
@@ -577,8 +553,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
577 struct nfattr *tb[CTA_PROTONAT_MAX]; 553 struct nfattr *tb[CTA_PROTONAT_MAX];
578 struct ip_nat_protocol *npt; 554 struct ip_nat_protocol *npt;
579 555
580 DEBUGP("entered %s\n", __FUNCTION__);
581
582 nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr); 556 nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
583 557
584 if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat)) 558 if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
@@ -597,7 +571,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
597 571
598 ip_nat_proto_put(npt); 572 ip_nat_proto_put(npt);
599 573
600 DEBUGP("leaving\n");
601 return 0; 574 return 0;
602} 575}
603 576
@@ -613,8 +586,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
613 struct nfattr *tb[CTA_NAT_MAX]; 586 struct nfattr *tb[CTA_NAT_MAX];
614 int err; 587 int err;
615 588
616 DEBUGP("entered %s\n", __FUNCTION__);
617
618 memset(range, 0, sizeof(*range)); 589 memset(range, 0, sizeof(*range));
619 590
620 nfattr_parse_nested(tb, CTA_NAT_MAX, nat); 591 nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
@@ -640,7 +611,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
640 if (err < 0) 611 if (err < 0)
641 return err; 612 return err;
642 613
643 DEBUGP("leaving\n");
644 return 0; 614 return 0;
645} 615}
646#endif 616#endif
@@ -650,8 +620,6 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
650{ 620{
651 struct nfattr *tb[CTA_HELP_MAX]; 621 struct nfattr *tb[CTA_HELP_MAX];
652 622
653 DEBUGP("entered %s\n", __FUNCTION__);
654
655 nfattr_parse_nested(tb, CTA_HELP_MAX, attr); 623 nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
656 624
657 if (!tb[CTA_HELP_NAME-1]) 625 if (!tb[CTA_HELP_NAME-1])
@@ -679,8 +647,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
679 struct ip_conntrack *ct; 647 struct ip_conntrack *ct;
680 int err = 0; 648 int err = 0;
681 649
682 DEBUGP("entered %s\n", __FUNCTION__);
683
684 if (nfattr_bad_size(cda, CTA_MAX, cta_min)) 650 if (nfattr_bad_size(cda, CTA_MAX, cta_min))
685 return -EINVAL; 651 return -EINVAL;
686 652
@@ -698,10 +664,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
698 return err; 664 return err;
699 665
700 h = ip_conntrack_find_get(&tuple, NULL); 666 h = ip_conntrack_find_get(&tuple, NULL);
701 if (!h) { 667 if (!h)
702 DEBUGP("tuple not found in conntrack hash\n");
703 return -ENOENT; 668 return -ENOENT;
704 }
705 669
706 ct = tuplehash_to_ctrack(h); 670 ct = tuplehash_to_ctrack(h);
707 671
@@ -716,7 +680,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
716 ct->timeout.function((unsigned long)ct); 680 ct->timeout.function((unsigned long)ct);
717 681
718 ip_conntrack_put(ct); 682 ip_conntrack_put(ct);
719 DEBUGP("leaving\n");
720 683
721 return 0; 684 return 0;
722} 685}
@@ -731,8 +694,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
731 struct sk_buff *skb2 = NULL; 694 struct sk_buff *skb2 = NULL;
732 int err = 0; 695 int err = 0;
733 696
734 DEBUGP("entered %s\n", __FUNCTION__);
735
736 if (nlh->nlmsg_flags & NLM_F_DUMP) { 697 if (nlh->nlmsg_flags & NLM_F_DUMP) {
737 struct nfgenmsg *msg = NLMSG_DATA(nlh); 698 struct nfgenmsg *msg = NLMSG_DATA(nlh);
738 u32 rlen; 699 u32 rlen;
@@ -770,11 +731,9 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
770 return err; 731 return err;
771 732
772 h = ip_conntrack_find_get(&tuple, NULL); 733 h = ip_conntrack_find_get(&tuple, NULL);
773 if (!h) { 734 if (!h)
774 DEBUGP("tuple not found in conntrack hash");
775 return -ENOENT; 735 return -ENOENT;
776 } 736
777 DEBUGP("tuple found\n");
778 ct = tuplehash_to_ctrack(h); 737 ct = tuplehash_to_ctrack(h);
779 738
780 err = -ENOMEM; 739 err = -ENOMEM;
@@ -795,7 +754,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
795 if (err < 0) 754 if (err < 0)
796 goto out; 755 goto out;
797 756
798 DEBUGP("leaving\n");
799 return 0; 757 return 0;
800 758
801free: 759free:
@@ -866,8 +824,6 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[])
866 char *helpname; 824 char *helpname;
867 int err; 825 int err;
868 826
869 DEBUGP("entered %s\n", __FUNCTION__);
870
871 /* don't change helper of sibling connections */ 827 /* don't change helper of sibling connections */
872 if (ct->master) 828 if (ct->master)
873 return -EINVAL; 829 return -EINVAL;
@@ -938,8 +894,6 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
938{ 894{
939 int err; 895 int err;
940 896
941 DEBUGP("entered %s\n", __FUNCTION__);
942
943 if (cda[CTA_HELP-1]) { 897 if (cda[CTA_HELP-1]) {
944 err = ctnetlink_change_helper(ct, cda); 898 err = ctnetlink_change_helper(ct, cda);
945 if (err < 0) 899 if (err < 0)
@@ -969,7 +923,6 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
969 ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1])); 923 ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
970#endif 924#endif
971 925
972 DEBUGP("all done\n");
973 return 0; 926 return 0;
974} 927}
975 928
@@ -981,8 +934,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
981 struct ip_conntrack *ct; 934 struct ip_conntrack *ct;
982 int err = -EINVAL; 935 int err = -EINVAL;
983 936
984 DEBUGP("entered %s\n", __FUNCTION__);
985
986 ct = ip_conntrack_alloc(otuple, rtuple); 937 ct = ip_conntrack_alloc(otuple, rtuple);
987 if (ct == NULL || IS_ERR(ct)) 938 if (ct == NULL || IS_ERR(ct))
988 return -ENOMEM; 939 return -ENOMEM;
@@ -1017,7 +968,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
1017 if (ct->helper) 968 if (ct->helper)
1018 ip_conntrack_helper_put(ct->helper); 969 ip_conntrack_helper_put(ct->helper);
1019 970
1020 DEBUGP("conntrack with id %u inserted\n", ct->id);
1021 return 0; 971 return 0;
1022 972
1023err: 973err:
@@ -1033,8 +983,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1033 struct ip_conntrack_tuple_hash *h = NULL; 983 struct ip_conntrack_tuple_hash *h = NULL;
1034 int err = 0; 984 int err = 0;
1035 985
1036 DEBUGP("entered %s\n", __FUNCTION__);
1037
1038 if (nfattr_bad_size(cda, CTA_MAX, cta_min)) 986 if (nfattr_bad_size(cda, CTA_MAX, cta_min))
1039 return -EINVAL; 987 return -EINVAL;
1040 988
@@ -1058,7 +1006,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1058 1006
1059 if (h == NULL) { 1007 if (h == NULL) {
1060 write_unlock_bh(&ip_conntrack_lock); 1008 write_unlock_bh(&ip_conntrack_lock);
1061 DEBUGP("no such conntrack, create new\n");
1062 err = -ENOENT; 1009 err = -ENOENT;
1063 if (nlh->nlmsg_flags & NLM_F_CREATE) 1010 if (nlh->nlmsg_flags & NLM_F_CREATE)
1064 err = ctnetlink_create_conntrack(cda, &otuple, &rtuple); 1011 err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
@@ -1074,7 +1021,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1074 1021
1075 /* We manipulate the conntrack inside the global conntrack table lock, 1022 /* We manipulate the conntrack inside the global conntrack table lock,
1076 * so there's no need to increase the refcount */ 1023 * so there's no need to increase the refcount */
1077 DEBUGP("conntrack found\n");
1078 err = -EEXIST; 1024 err = -EEXIST;
1079 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) 1025 if (!(nlh->nlmsg_flags & NLM_F_EXCL))
1080 err = ctnetlink_change_conntrack(tuplehash_to_ctrack(h), cda); 1026 err = ctnetlink_change_conntrack(tuplehash_to_ctrack(h), cda);
@@ -1249,8 +1195,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
1249 struct list_head *i; 1195 struct list_head *i;
1250 u_int32_t *id = (u_int32_t *) &cb->args[0]; 1196 u_int32_t *id = (u_int32_t *) &cb->args[0];
1251 1197
1252 DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id);
1253
1254 read_lock_bh(&ip_conntrack_lock); 1198 read_lock_bh(&ip_conntrack_lock);
1255 list_for_each_prev(i, &ip_conntrack_expect_list) { 1199 list_for_each_prev(i, &ip_conntrack_expect_list) {
1256 exp = (struct ip_conntrack_expect *) i; 1200 exp = (struct ip_conntrack_expect *) i;
@@ -1266,8 +1210,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
1266out: 1210out:
1267 read_unlock_bh(&ip_conntrack_lock); 1211 read_unlock_bh(&ip_conntrack_lock);
1268 1212
1269 DEBUGP("leaving, last id=%llu\n", *id);
1270
1271 return skb->len; 1213 return skb->len;
1272} 1214}
1273 1215
@@ -1285,8 +1227,6 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1285 struct sk_buff *skb2; 1227 struct sk_buff *skb2;
1286 int err = 0; 1228 int err = 0;
1287 1229
1288 DEBUGP("entered %s\n", __FUNCTION__);
1289
1290 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) 1230 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
1291 return -EINVAL; 1231 return -EINVAL;
1292 1232
@@ -1437,8 +1377,6 @@ ctnetlink_create_expect(struct nfattr *cda[])
1437 struct ip_conntrack *ct; 1377 struct ip_conntrack *ct;
1438 int err = 0; 1378 int err = 0;
1439 1379
1440 DEBUGP("entered %s\n", __FUNCTION__);
1441
1442 /* caller guarantees that those three CTA_EXPECT_* exist */ 1380 /* caller guarantees that those three CTA_EXPECT_* exist */
1443 err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE); 1381 err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE);
1444 if (err < 0) 1382 if (err < 0)
@@ -1490,8 +1428,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1490 struct ip_conntrack_expect *exp; 1428 struct ip_conntrack_expect *exp;
1491 int err = 0; 1429 int err = 0;
1492 1430
1493 DEBUGP("entered %s\n", __FUNCTION__);
1494
1495 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) 1431 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
1496 return -EINVAL; 1432 return -EINVAL;
1497 1433
@@ -1520,8 +1456,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1520 err = ctnetlink_change_expect(exp, cda); 1456 err = ctnetlink_change_expect(exp, cda);
1521 write_unlock_bh(&ip_conntrack_lock); 1457 write_unlock_bh(&ip_conntrack_lock);
1522 1458
1523 DEBUGP("leaving\n");
1524
1525 return err; 1459 return err;
1526} 1460}
1527 1461
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 78a44b01c035..4b90927619b8 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1932,6 +1932,9 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1932{ 1932{
1933 int ret; 1933 int ret;
1934 1934
1935 if (!capable(CAP_NET_ADMIN))
1936 return -EPERM;
1937
1935 switch (cmd) { 1938 switch (cmd) {
1936 case IPT_SO_GET_INFO: 1939 case IPT_SO_GET_INFO:
1937 ret = get_info(user, len, 1); 1940 ret = get_info(user, len, 1);
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c
index 12a818a2462f..1aa4517fbcdb 100644
--- a/net/ipv4/netfilter/ipt_ECN.c
+++ b/net/ipv4/netfilter/ipt_ECN.c
@@ -28,7 +28,7 @@ static inline int
28set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) 28set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
29{ 29{
30 struct iphdr *iph = (*pskb)->nh.iph; 30 struct iphdr *iph = (*pskb)->nh.iph;
31 __be16 oldtos; 31 u_int16_t oldtos;
32 32
33 if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { 33 if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
34 if (!skb_make_writable(pskb, sizeof(struct iphdr))) 34 if (!skb_make_writable(pskb, sizeof(struct iphdr)))
@@ -37,8 +37,8 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
37 oldtos = iph->tos; 37 oldtos = iph->tos;
38 iph->tos &= ~IPT_ECN_IP_MASK; 38 iph->tos &= ~IPT_ECN_IP_MASK;
39 iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); 39 iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK);
40 iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, 40 iph->check = nf_csum_update(htons(oldtos) ^ htons(0xFFFF),
41 iph->check); 41 htons(iph->tos), iph->check);
42 } 42 }
43 return 1; 43 return 1;
44} 44}
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
index 6b8b14ccc3d3..83b80b3a5d2f 100644
--- a/net/ipv4/netfilter/ipt_TOS.c
+++ b/net/ipv4/netfilter/ipt_TOS.c
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb,
30{ 30{
31 const struct ipt_tos_target_info *tosinfo = targinfo; 31 const struct ipt_tos_target_info *tosinfo = targinfo;
32 struct iphdr *iph = (*pskb)->nh.iph; 32 struct iphdr *iph = (*pskb)->nh.iph;
33 __be16 oldtos; 33 u_int16_t oldtos;
34 34
35 if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { 35 if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
36 if (!skb_make_writable(pskb, sizeof(struct iphdr))) 36 if (!skb_make_writable(pskb, sizeof(struct iphdr)))
@@ -38,8 +38,8 @@ target(struct sk_buff **pskb,
38 iph = (*pskb)->nh.iph; 38 iph = (*pskb)->nh.iph;
39 oldtos = iph->tos; 39 oldtos = iph->tos;
40 iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; 40 iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
41 iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, 41 iph->check = nf_csum_update(htons(oldtos) ^ htons(0xFFFF),
42 iph->check); 42 htons(iph->tos), iph->check);
43 } 43 }
44 return IPT_CONTINUE; 44 return IPT_CONTINUE;
45} 45}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6bbd98575172..22ef8bd26620 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -373,7 +373,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
373 seq = ntohl(th->seq); 373 seq = ntohl(th->seq);
374 if (sk->sk_state != TCP_LISTEN && 374 if (sk->sk_state != TCP_LISTEN &&
375 !between(seq, tp->snd_una, tp->snd_nxt)) { 375 !between(seq, tp->snd_una, tp->snd_nxt)) {
376 NET_INC_STATS(LINUX_MIB_OUTOFWINDOWICMPS); 376 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
377 goto out; 377 goto out;
378 } 378 }
379 379
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f22536e32cb1..ca406157724c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1096,10 +1096,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1096 u32 send_win, cong_win, limit, in_flight; 1096 u32 send_win, cong_win, limit, in_flight;
1097 1097
1098 if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) 1098 if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)
1099 return 0; 1099 goto send_now;
1100 1100
1101 if (icsk->icsk_ca_state != TCP_CA_Open) 1101 if (icsk->icsk_ca_state != TCP_CA_Open)
1102 return 0; 1102 goto send_now;
1103
1104 /* Defer for less than two clock ticks. */
1105 if (!tp->tso_deferred && ((jiffies<<1)>>1) - (tp->tso_deferred>>1) > 1)
1106 goto send_now;
1103 1107
1104 in_flight = tcp_packets_in_flight(tp); 1108 in_flight = tcp_packets_in_flight(tp);
1105 1109
@@ -1115,7 +1119,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1115 1119
1116 /* If a full-sized TSO skb can be sent, do it. */ 1120 /* If a full-sized TSO skb can be sent, do it. */
1117 if (limit >= 65536) 1121 if (limit >= 65536)
1118 return 0; 1122 goto send_now;
1119 1123
1120 if (sysctl_tcp_tso_win_divisor) { 1124 if (sysctl_tcp_tso_win_divisor) {
1121 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); 1125 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);
@@ -1125,7 +1129,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1125 */ 1129 */
1126 chunk /= sysctl_tcp_tso_win_divisor; 1130 chunk /= sysctl_tcp_tso_win_divisor;
1127 if (limit >= chunk) 1131 if (limit >= chunk)
1128 return 0; 1132 goto send_now;
1129 } else { 1133 } else {
1130 /* Different approach, try not to defer past a single 1134 /* Different approach, try not to defer past a single
1131 * ACK. Receiver should ACK every other full sized 1135 * ACK. Receiver should ACK every other full sized
@@ -1133,11 +1137,17 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1133 * then send now. 1137 * then send now.
1134 */ 1138 */
1135 if (limit > tcp_max_burst(tp) * tp->mss_cache) 1139 if (limit > tcp_max_burst(tp) * tp->mss_cache)
1136 return 0; 1140 goto send_now;
1137 } 1141 }
1138 1142
1139 /* Ok, it looks like it is advisable to defer. */ 1143 /* Ok, it looks like it is advisable to defer. */
1144 tp->tso_deferred = 1 | (jiffies<<1);
1145
1140 return 1; 1146 return 1;
1147
1148send_now:
1149 tp->tso_deferred = 0;
1150 return 0;
1141} 1151}
1142 1152
1143/* Create a new MTU probe if we are ready. 1153/* Create a new MTU probe if we are ready.
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index ef5eaad44851..6e48f52e197c 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -175,9 +175,16 @@ config IPV6_TUNNEL
175 175
176 If unsure, say N. 176 If unsure, say N.
177 177
178config IPV6_MULTIPLE_TABLES
179 bool "IPv6: Multiple Routing Tables"
180 depends on IPV6 && EXPERIMENTAL
181 select FIB_RULES
182 ---help---
183 Support multiple routing tables.
184
178config IPV6_SUBTREES 185config IPV6_SUBTREES
179 bool "IPv6: source address based routing" 186 bool "IPv6: source address based routing"
180 depends on IPV6 && EXPERIMENTAL 187 depends on IPV6_MULTIPLE_TABLES
181 ---help--- 188 ---help---
182 Enable routing by source address or prefix. 189 Enable routing by source address or prefix.
183 190
@@ -189,13 +196,6 @@ config IPV6_SUBTREES
189 196
190 If unsure, say N. 197 If unsure, say N.
191 198
192config IPV6_MULTIPLE_TABLES
193 bool "IPv6: Multiple Routing Tables"
194 depends on IPV6 && EXPERIMENTAL
195 select FIB_RULES
196 ---help---
197 Support multiple routing tables.
198
199config IPV6_ROUTE_FWMARK 199config IPV6_ROUTE_FWMARK
200 bool "IPv6: use netfilter MARK value as routing key" 200 bool "IPv6: use netfilter MARK value as routing key"
201 depends on IPV6_MULTIPLE_TABLES && NETFILTER 201 depends on IPV6_MULTIPLE_TABLES && NETFILTER
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index d8c1057e8b00..1896ecb52899 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -117,12 +117,15 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
117{ 117{
118 struct fib6_rule *r = (struct fib6_rule *) rule; 118 struct fib6_rule *r = (struct fib6_rule *) rule;
119 119
120 if (!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) 120 if (r->dst.plen &&
121 !ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
121 return 0; 122 return 0;
122 123
123 if ((flags & RT6_LOOKUP_F_HAS_SADDR) && 124 if (r->src.plen) {
124 !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen)) 125 if (!(flags & RT6_LOOKUP_F_HAS_SADDR) ||
125 return 0; 126 !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen))
127 return 0;
128 }
126 129
127 if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) 130 if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff))
128 return 0; 131 return 0;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 0304b5fe8d6a..41a8a5f06602 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -967,8 +967,6 @@ static void ndisc_recv_na(struct sk_buff *skb)
967 ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && 967 ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp &&
968 pneigh_lookup(&nd_tbl, &msg->target, dev, 0)) { 968 pneigh_lookup(&nd_tbl, &msg->target, dev, 0)) {
969 /* XXX: idev->cnf.prixy_ndp */ 969 /* XXX: idev->cnf.prixy_ndp */
970 WARN_ON(skb->dst != NULL &&
971 ((struct rt6_info *)skb->dst)->rt6i_idev);
972 goto out; 970 goto out;
973 } 971 }
974 972
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d6b4b4f48d18..c953466b7afd 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -141,6 +141,10 @@ struct rt6_info ip6_null_entry = {
141 141
142#ifdef CONFIG_IPV6_MULTIPLE_TABLES 142#ifdef CONFIG_IPV6_MULTIPLE_TABLES
143 143
144static int ip6_pkt_prohibit(struct sk_buff *skb);
145static int ip6_pkt_prohibit_out(struct sk_buff *skb);
146static int ip6_pkt_blk_hole(struct sk_buff *skb);
147
144struct rt6_info ip6_prohibit_entry = { 148struct rt6_info ip6_prohibit_entry = {
145 .u = { 149 .u = {
146 .dst = { 150 .dst = {
@@ -150,8 +154,8 @@ struct rt6_info ip6_prohibit_entry = {
150 .obsolete = -1, 154 .obsolete = -1,
151 .error = -EACCES, 155 .error = -EACCES,
152 .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, 156 .metrics = { [RTAX_HOPLIMIT - 1] = 255, },
153 .input = ip6_pkt_discard, 157 .input = ip6_pkt_prohibit,
154 .output = ip6_pkt_discard_out, 158 .output = ip6_pkt_prohibit_out,
155 .ops = &ip6_dst_ops, 159 .ops = &ip6_dst_ops,
156 .path = (struct dst_entry*)&ip6_prohibit_entry, 160 .path = (struct dst_entry*)&ip6_prohibit_entry,
157 } 161 }
@@ -170,8 +174,8 @@ struct rt6_info ip6_blk_hole_entry = {
170 .obsolete = -1, 174 .obsolete = -1,
171 .error = -EINVAL, 175 .error = -EINVAL,
172 .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, 176 .metrics = { [RTAX_HOPLIMIT - 1] = 255, },
173 .input = ip6_pkt_discard, 177 .input = ip6_pkt_blk_hole,
174 .output = ip6_pkt_discard_out, 178 .output = ip6_pkt_blk_hole,
175 .ops = &ip6_dst_ops, 179 .ops = &ip6_dst_ops,
176 .path = (struct dst_entry*)&ip6_blk_hole_entry, 180 .path = (struct dst_entry*)&ip6_blk_hole_entry,
177 } 181 }
@@ -484,7 +488,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
484do { \ 488do { \
485 if (rt == &ip6_null_entry) { \ 489 if (rt == &ip6_null_entry) { \
486 struct fib6_node *pn; \ 490 struct fib6_node *pn; \
487 while (fn) { \ 491 while (1) { \
488 if (fn->fn_flags & RTN_TL_ROOT) \ 492 if (fn->fn_flags & RTN_TL_ROOT) \
489 goto out; \ 493 goto out; \
490 pn = fn->parent; \ 494 pn = fn->parent; \
@@ -529,13 +533,17 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
529 .nl_u = { 533 .nl_u = {
530 .ip6_u = { 534 .ip6_u = {
531 .daddr = *daddr, 535 .daddr = *daddr,
532 /* TODO: saddr */
533 }, 536 },
534 }, 537 },
535 }; 538 };
536 struct dst_entry *dst; 539 struct dst_entry *dst;
537 int flags = strict ? RT6_LOOKUP_F_IFACE : 0; 540 int flags = strict ? RT6_LOOKUP_F_IFACE : 0;
538 541
542 if (saddr) {
543 memcpy(&fl.fl6_src, saddr, sizeof(*saddr));
544 flags |= RT6_LOOKUP_F_HAS_SADDR;
545 }
546
539 dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup); 547 dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup);
540 if (dst->error == 0) 548 if (dst->error == 0)
541 return (struct rt6_info *) dst; 549 return (struct rt6_info *) dst;
@@ -614,8 +622,6 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *d
614 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr); 622 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr);
615 rt->rt6i_dst.plen = 128; 623 rt->rt6i_dst.plen = 128;
616 rt->rt6i_flags |= RTF_CACHE; 624 rt->rt6i_flags |= RTF_CACHE;
617 if (rt->rt6i_flags & RTF_REJECT)
618 rt->u.dst.error = ort->u.dst.error;
619 rt->u.dst.flags |= DST_HOST; 625 rt->u.dst.flags |= DST_HOST;
620 rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop); 626 rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop);
621 } 627 }
@@ -697,6 +703,7 @@ out2:
697void ip6_route_input(struct sk_buff *skb) 703void ip6_route_input(struct sk_buff *skb)
698{ 704{
699 struct ipv6hdr *iph = skb->nh.ipv6h; 705 struct ipv6hdr *iph = skb->nh.ipv6h;
706 int flags = RT6_LOOKUP_F_HAS_SADDR;
700 struct flowi fl = { 707 struct flowi fl = {
701 .iif = skb->dev->ifindex, 708 .iif = skb->dev->ifindex,
702 .nl_u = { 709 .nl_u = {
@@ -711,7 +718,9 @@ void ip6_route_input(struct sk_buff *skb)
711 }, 718 },
712 .proto = iph->nexthdr, 719 .proto = iph->nexthdr,
713 }; 720 };
714 int flags = rt6_need_strict(&iph->daddr) ? RT6_LOOKUP_F_IFACE : 0; 721
722 if (rt6_need_strict(&iph->daddr))
723 flags |= RT6_LOOKUP_F_IFACE;
715 724
716 skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input); 725 skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input);
717} 726}
@@ -794,6 +803,9 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
794 if (rt6_need_strict(&fl->fl6_dst)) 803 if (rt6_need_strict(&fl->fl6_dst))
795 flags |= RT6_LOOKUP_F_IFACE; 804 flags |= RT6_LOOKUP_F_IFACE;
796 805
806 if (!ipv6_addr_any(&fl->fl6_src))
807 flags |= RT6_LOOKUP_F_HAS_SADDR;
808
797 return fib6_rule_lookup(fl, flags, ip6_pol_route_output); 809 return fib6_rule_lookup(fl, flags, ip6_pol_route_output);
798} 810}
799 811
@@ -1345,6 +1357,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1345 struct in6_addr *gateway, 1357 struct in6_addr *gateway,
1346 struct net_device *dev) 1358 struct net_device *dev)
1347{ 1359{
1360 int flags = RT6_LOOKUP_F_HAS_SADDR;
1348 struct ip6rd_flowi rdfl = { 1361 struct ip6rd_flowi rdfl = {
1349 .fl = { 1362 .fl = {
1350 .oif = dev->ifindex, 1363 .oif = dev->ifindex,
@@ -1357,7 +1370,9 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1357 }, 1370 },
1358 .gateway = *gateway, 1371 .gateway = *gateway,
1359 }; 1372 };
1360 int flags = rt6_need_strict(dest) ? RT6_LOOKUP_F_IFACE : 0; 1373
1374 if (rt6_need_strict(dest))
1375 flags |= RT6_LOOKUP_F_IFACE;
1361 1376
1362 return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect); 1377 return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect);
1363} 1378}
@@ -1527,6 +1542,7 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
1527 rt->u.dst.output = ort->u.dst.output; 1542 rt->u.dst.output = ort->u.dst.output;
1528 1543
1529 memcpy(rt->u.dst.metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32)); 1544 memcpy(rt->u.dst.metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32));
1545 rt->u.dst.error = ort->u.dst.error;
1530 rt->u.dst.dev = ort->u.dst.dev; 1546 rt->u.dst.dev = ort->u.dst.dev;
1531 if (rt->u.dst.dev) 1547 if (rt->u.dst.dev)
1532 dev_hold(rt->u.dst.dev); 1548 dev_hold(rt->u.dst.dev);
@@ -1730,24 +1746,50 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1730 * Drop the packet on the floor 1746 * Drop the packet on the floor
1731 */ 1747 */
1732 1748
1733static int ip6_pkt_discard(struct sk_buff *skb) 1749static inline int ip6_pkt_drop(struct sk_buff *skb, int code)
1734{ 1750{
1735 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1751 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
1736 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) 1752 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED)
1737 IP6_INC_STATS(IPSTATS_MIB_INADDRERRORS); 1753 IP6_INC_STATS(IPSTATS_MIB_INADDRERRORS);
1738 1754
1739 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES); 1755 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
1740 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); 1756 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
1741 kfree_skb(skb); 1757 kfree_skb(skb);
1742 return 0; 1758 return 0;
1743} 1759}
1744 1760
1761static int ip6_pkt_discard(struct sk_buff *skb)
1762{
1763 return ip6_pkt_drop(skb, ICMPV6_NOROUTE);
1764}
1765
1745static int ip6_pkt_discard_out(struct sk_buff *skb) 1766static int ip6_pkt_discard_out(struct sk_buff *skb)
1746{ 1767{
1747 skb->dev = skb->dst->dev; 1768 skb->dev = skb->dst->dev;
1748 return ip6_pkt_discard(skb); 1769 return ip6_pkt_discard(skb);
1749} 1770}
1750 1771
1772#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1773
1774static int ip6_pkt_prohibit(struct sk_buff *skb)
1775{
1776 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED);
1777}
1778
1779static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1780{
1781 skb->dev = skb->dst->dev;
1782 return ip6_pkt_prohibit(skb);
1783}
1784
1785static int ip6_pkt_blk_hole(struct sk_buff *skb)
1786{
1787 kfree_skb(skb);
1788 return 0;
1789}
1790
1791#endif
1792
1751/* 1793/*
1752 * Allocate a dst for local (unicast / anycast) address. 1794 * Allocate a dst for local (unicast / anycast) address.
1753 */ 1795 */
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index dc5765b62b87..b481a4d780c2 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -853,3 +853,4 @@ int __init sit_init(void)
853 853
854module_init(sit_init); 854module_init(sit_init);
855module_exit(sit_cleanup); 855module_exit(sit_cleanup);
856MODULE_LICENSE("GPL");
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 73cee2ec07e8..d400f8fae129 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -25,12 +25,14 @@
25static struct dst_ops xfrm6_dst_ops; 25static struct dst_ops xfrm6_dst_ops;
26static struct xfrm_policy_afinfo xfrm6_policy_afinfo; 26static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
27 27
28static int xfrm6_dst_lookup(struct xfrm_dst **dst, struct flowi *fl) 28static int xfrm6_dst_lookup(struct xfrm_dst **xdst, struct flowi *fl)
29{ 29{
30 int err = 0; 30 struct dst_entry *dst = ip6_route_output(NULL, fl);
31 *dst = (struct xfrm_dst*)ip6_route_output(NULL, fl); 31 int err = dst->error;
32 if (!*dst) 32 if (!err)
33 err = -ENETUNREACH; 33 *xdst = (struct xfrm_dst *) dst;
34 else
35 dst_release(dst);
34 return err; 36 return err;
35} 37}
36 38
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index ce94732b8e23..f619c6527266 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -209,7 +209,9 @@ config NETFILTER_XT_TARGET_SECMARK
209 209
210config NETFILTER_XT_TARGET_CONNSECMARK 210config NETFILTER_XT_TARGET_CONNSECMARK
211 tristate '"CONNSECMARK" target support' 211 tristate '"CONNSECMARK" target support'
212 depends on NETFILTER_XTABLES && (NF_CONNTRACK_SECMARK || IP_NF_CONNTRACK_SECMARK) 212 depends on NETFILTER_XTABLES && \
213 ((NF_CONNTRACK && NF_CONNTRACK_SECMARK) || \
214 (IP_NF_CONNTRACK && IP_NF_CONNTRACK_SECMARK))
213 help 215 help
214 The CONNSECMARK target copies security markings from packets 216 The CONNSECMARK target copies security markings from packets
215 to connections, and restores security markings from connections 217 to connections, and restores security markings from connections
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 1721f7c78c77..bd0156a28ecd 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -47,13 +47,6 @@ MODULE_LICENSE("GPL");
47 47
48static char __initdata version[] = "0.93"; 48static char __initdata version[] = "0.93";
49 49
50#if 0
51#define DEBUGP printk
52#else
53#define DEBUGP(format, args...)
54#endif
55
56
57static inline int 50static inline int
58ctnetlink_dump_tuples_proto(struct sk_buff *skb, 51ctnetlink_dump_tuples_proto(struct sk_buff *skb,
59 const struct nf_conntrack_tuple *tuple, 52 const struct nf_conntrack_tuple *tuple,
@@ -410,7 +403,6 @@ static int ctnetlink_done(struct netlink_callback *cb)
410{ 403{
411 if (cb->args[1]) 404 if (cb->args[1])
412 nf_ct_put((struct nf_conn *)cb->args[1]); 405 nf_ct_put((struct nf_conn *)cb->args[1]);
413 DEBUGP("entered %s\n", __FUNCTION__);
414 return 0; 406 return 0;
415} 407}
416 408
@@ -425,9 +417,6 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
425 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); 417 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
426 u_int8_t l3proto = nfmsg->nfgen_family; 418 u_int8_t l3proto = nfmsg->nfgen_family;
427 419
428 DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__,
429 cb->args[0], *id);
430
431 read_lock_bh(&nf_conntrack_lock); 420 read_lock_bh(&nf_conntrack_lock);
432 last = (struct nf_conn *)cb->args[1]; 421 last = (struct nf_conn *)cb->args[1];
433 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { 422 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
@@ -471,7 +460,6 @@ out:
471 if (last) 460 if (last)
472 nf_ct_put(last); 461 nf_ct_put(last);
473 462
474 DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
475 return skb->len; 463 return skb->len;
476} 464}
477 465
@@ -482,8 +470,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple)
482 struct nf_conntrack_l3proto *l3proto; 470 struct nf_conntrack_l3proto *l3proto;
483 int ret = 0; 471 int ret = 0;
484 472
485 DEBUGP("entered %s\n", __FUNCTION__);
486
487 nfattr_parse_nested(tb, CTA_IP_MAX, attr); 473 nfattr_parse_nested(tb, CTA_IP_MAX, attr);
488 474
489 l3proto = nf_ct_l3proto_find_get(tuple->src.l3num); 475 l3proto = nf_ct_l3proto_find_get(tuple->src.l3num);
@@ -493,8 +479,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple)
493 479
494 nf_ct_l3proto_put(l3proto); 480 nf_ct_l3proto_put(l3proto);
495 481
496 DEBUGP("leaving\n");
497
498 return ret; 482 return ret;
499} 483}
500 484
@@ -510,8 +494,6 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
510 struct nf_conntrack_protocol *proto; 494 struct nf_conntrack_protocol *proto;
511 int ret = 0; 495 int ret = 0;
512 496
513 DEBUGP("entered %s\n", __FUNCTION__);
514
515 nfattr_parse_nested(tb, CTA_PROTO_MAX, attr); 497 nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
516 498
517 if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto)) 499 if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
@@ -538,8 +520,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple,
538 struct nfattr *tb[CTA_TUPLE_MAX]; 520 struct nfattr *tb[CTA_TUPLE_MAX];
539 int err; 521 int err;
540 522
541 DEBUGP("entered %s\n", __FUNCTION__);
542
543 memset(tuple, 0, sizeof(*tuple)); 523 memset(tuple, 0, sizeof(*tuple));
544 524
545 nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]); 525 nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
@@ -566,10 +546,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple,
566 else 546 else
567 tuple->dst.dir = IP_CT_DIR_ORIGINAL; 547 tuple->dst.dir = IP_CT_DIR_ORIGINAL;
568 548
569 NF_CT_DUMP_TUPLE(tuple);
570
571 DEBUGP("leaving\n");
572
573 return 0; 549 return 0;
574} 550}
575 551
@@ -586,8 +562,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
586 struct nfattr *tb[CTA_PROTONAT_MAX]; 562 struct nfattr *tb[CTA_PROTONAT_MAX];
587 struct ip_nat_protocol *npt; 563 struct ip_nat_protocol *npt;
588 564
589 DEBUGP("entered %s\n", __FUNCTION__);
590
591 nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr); 565 nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
592 566
593 if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat)) 567 if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
@@ -606,7 +580,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
606 580
607 ip_nat_proto_put(npt); 581 ip_nat_proto_put(npt);
608 582
609 DEBUGP("leaving\n");
610 return 0; 583 return 0;
611} 584}
612 585
@@ -622,8 +595,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
622 struct nfattr *tb[CTA_NAT_MAX]; 595 struct nfattr *tb[CTA_NAT_MAX];
623 int err; 596 int err;
624 597
625 DEBUGP("entered %s\n", __FUNCTION__);
626
627 memset(range, 0, sizeof(*range)); 598 memset(range, 0, sizeof(*range));
628 599
629 nfattr_parse_nested(tb, CTA_NAT_MAX, nat); 600 nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
@@ -649,7 +620,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
649 if (err < 0) 620 if (err < 0)
650 return err; 621 return err;
651 622
652 DEBUGP("leaving\n");
653 return 0; 623 return 0;
654} 624}
655#endif 625#endif
@@ -659,8 +629,6 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
659{ 629{
660 struct nfattr *tb[CTA_HELP_MAX]; 630 struct nfattr *tb[CTA_HELP_MAX];
661 631
662 DEBUGP("entered %s\n", __FUNCTION__);
663
664 nfattr_parse_nested(tb, CTA_HELP_MAX, attr); 632 nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
665 633
666 if (!tb[CTA_HELP_NAME-1]) 634 if (!tb[CTA_HELP_NAME-1])
@@ -690,8 +658,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
690 u_int8_t u3 = nfmsg->nfgen_family; 658 u_int8_t u3 = nfmsg->nfgen_family;
691 int err = 0; 659 int err = 0;
692 660
693 DEBUGP("entered %s\n", __FUNCTION__);
694
695 if (nfattr_bad_size(cda, CTA_MAX, cta_min)) 661 if (nfattr_bad_size(cda, CTA_MAX, cta_min))
696 return -EINVAL; 662 return -EINVAL;
697 663
@@ -709,10 +675,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
709 return err; 675 return err;
710 676
711 h = nf_conntrack_find_get(&tuple, NULL); 677 h = nf_conntrack_find_get(&tuple, NULL);
712 if (!h) { 678 if (!h)
713 DEBUGP("tuple not found in conntrack hash\n");
714 return -ENOENT; 679 return -ENOENT;
715 }
716 680
717 ct = nf_ct_tuplehash_to_ctrack(h); 681 ct = nf_ct_tuplehash_to_ctrack(h);
718 682
@@ -727,7 +691,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
727 ct->timeout.function((unsigned long)ct); 691 ct->timeout.function((unsigned long)ct);
728 692
729 nf_ct_put(ct); 693 nf_ct_put(ct);
730 DEBUGP("leaving\n");
731 694
732 return 0; 695 return 0;
733} 696}
@@ -744,8 +707,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
744 u_int8_t u3 = nfmsg->nfgen_family; 707 u_int8_t u3 = nfmsg->nfgen_family;
745 int err = 0; 708 int err = 0;
746 709
747 DEBUGP("entered %s\n", __FUNCTION__);
748
749 if (nlh->nlmsg_flags & NLM_F_DUMP) { 710 if (nlh->nlmsg_flags & NLM_F_DUMP) {
750 u32 rlen; 711 u32 rlen;
751 712
@@ -779,11 +740,9 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
779 return err; 740 return err;
780 741
781 h = nf_conntrack_find_get(&tuple, NULL); 742 h = nf_conntrack_find_get(&tuple, NULL);
782 if (!h) { 743 if (!h)
783 DEBUGP("tuple not found in conntrack hash");
784 return -ENOENT; 744 return -ENOENT;
785 } 745
786 DEBUGP("tuple found\n");
787 ct = nf_ct_tuplehash_to_ctrack(h); 746 ct = nf_ct_tuplehash_to_ctrack(h);
788 747
789 err = -ENOMEM; 748 err = -ENOMEM;
@@ -804,7 +763,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
804 if (err < 0) 763 if (err < 0)
805 goto out; 764 goto out;
806 765
807 DEBUGP("leaving\n");
808 return 0; 766 return 0;
809 767
810free: 768free:
@@ -876,8 +834,6 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
876 char *helpname; 834 char *helpname;
877 int err; 835 int err;
878 836
879 DEBUGP("entered %s\n", __FUNCTION__);
880
881 if (!help) { 837 if (!help) {
882 /* FIXME: we need to reallocate and rehash */ 838 /* FIXME: we need to reallocate and rehash */
883 return -EBUSY; 839 return -EBUSY;
@@ -954,8 +910,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[])
954{ 910{
955 int err; 911 int err;
956 912
957 DEBUGP("entered %s\n", __FUNCTION__);
958
959 if (cda[CTA_HELP-1]) { 913 if (cda[CTA_HELP-1]) {
960 err = ctnetlink_change_helper(ct, cda); 914 err = ctnetlink_change_helper(ct, cda);
961 if (err < 0) 915 if (err < 0)
@@ -985,7 +939,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[])
985 ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); 939 ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
986#endif 940#endif
987 941
988 DEBUGP("all done\n");
989 return 0; 942 return 0;
990} 943}
991 944
@@ -997,8 +950,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
997 struct nf_conn *ct; 950 struct nf_conn *ct;
998 int err = -EINVAL; 951 int err = -EINVAL;
999 952
1000 DEBUGP("entered %s\n", __FUNCTION__);
1001
1002 ct = nf_conntrack_alloc(otuple, rtuple); 953 ct = nf_conntrack_alloc(otuple, rtuple);
1003 if (ct == NULL || IS_ERR(ct)) 954 if (ct == NULL || IS_ERR(ct))
1004 return -ENOMEM; 955 return -ENOMEM;
@@ -1028,7 +979,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
1028 add_timer(&ct->timeout); 979 add_timer(&ct->timeout);
1029 nf_conntrack_hash_insert(ct); 980 nf_conntrack_hash_insert(ct);
1030 981
1031 DEBUGP("conntrack with id %u inserted\n", ct->id);
1032 return 0; 982 return 0;
1033 983
1034err: 984err:
@@ -1046,8 +996,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1046 u_int8_t u3 = nfmsg->nfgen_family; 996 u_int8_t u3 = nfmsg->nfgen_family;
1047 int err = 0; 997 int err = 0;
1048 998
1049 DEBUGP("entered %s\n", __FUNCTION__);
1050
1051 if (nfattr_bad_size(cda, CTA_MAX, cta_min)) 999 if (nfattr_bad_size(cda, CTA_MAX, cta_min))
1052 return -EINVAL; 1000 return -EINVAL;
1053 1001
@@ -1071,7 +1019,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1071 1019
1072 if (h == NULL) { 1020 if (h == NULL) {
1073 write_unlock_bh(&nf_conntrack_lock); 1021 write_unlock_bh(&nf_conntrack_lock);
1074 DEBUGP("no such conntrack, create new\n");
1075 err = -ENOENT; 1022 err = -ENOENT;
1076 if (nlh->nlmsg_flags & NLM_F_CREATE) 1023 if (nlh->nlmsg_flags & NLM_F_CREATE)
1077 err = ctnetlink_create_conntrack(cda, &otuple, &rtuple); 1024 err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
@@ -1087,7 +1034,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1087 1034
1088 /* We manipulate the conntrack inside the global conntrack table lock, 1035 /* We manipulate the conntrack inside the global conntrack table lock,
1089 * so there's no need to increase the refcount */ 1036 * so there's no need to increase the refcount */
1090 DEBUGP("conntrack found\n");
1091 err = -EEXIST; 1037 err = -EEXIST;
1092 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) 1038 if (!(nlh->nlmsg_flags & NLM_F_EXCL))
1093 err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda); 1039 err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda);
@@ -1268,8 +1214,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
1268 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); 1214 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
1269 u_int8_t l3proto = nfmsg->nfgen_family; 1215 u_int8_t l3proto = nfmsg->nfgen_family;
1270 1216
1271 DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id);
1272
1273 read_lock_bh(&nf_conntrack_lock); 1217 read_lock_bh(&nf_conntrack_lock);
1274 list_for_each_prev(i, &nf_conntrack_expect_list) { 1218 list_for_each_prev(i, &nf_conntrack_expect_list) {
1275 exp = (struct nf_conntrack_expect *) i; 1219 exp = (struct nf_conntrack_expect *) i;
@@ -1287,8 +1231,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
1287out: 1231out:
1288 read_unlock_bh(&nf_conntrack_lock); 1232 read_unlock_bh(&nf_conntrack_lock);
1289 1233
1290 DEBUGP("leaving, last id=%llu\n", *id);
1291
1292 return skb->len; 1234 return skb->len;
1293} 1235}
1294 1236
@@ -1308,8 +1250,6 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1308 u_int8_t u3 = nfmsg->nfgen_family; 1250 u_int8_t u3 = nfmsg->nfgen_family;
1309 int err = 0; 1251 int err = 0;
1310 1252
1311 DEBUGP("entered %s\n", __FUNCTION__);
1312
1313 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) 1253 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
1314 return -EINVAL; 1254 return -EINVAL;
1315 1255
@@ -1460,8 +1400,6 @@ ctnetlink_create_expect(struct nfattr *cda[], u_int8_t u3)
1460 struct nf_conn_help *help; 1400 struct nf_conn_help *help;
1461 int err = 0; 1401 int err = 0;
1462 1402
1463 DEBUGP("entered %s\n", __FUNCTION__);
1464
1465 /* caller guarantees that those three CTA_EXPECT_* exist */ 1403 /* caller guarantees that those three CTA_EXPECT_* exist */
1466 err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE, u3); 1404 err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE, u3);
1467 if (err < 0) 1405 if (err < 0)
@@ -1516,8 +1454,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1516 u_int8_t u3 = nfmsg->nfgen_family; 1454 u_int8_t u3 = nfmsg->nfgen_family;
1517 int err = 0; 1455 int err = 0;
1518 1456
1519 DEBUGP("entered %s\n", __FUNCTION__);
1520
1521 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) 1457 if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
1522 return -EINVAL; 1458 return -EINVAL;
1523 1459
@@ -1546,8 +1482,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1546 err = ctnetlink_change_expect(exp, cda); 1482 err = ctnetlink_change_expect(exp, cda);
1547 write_unlock_bh(&nf_conntrack_lock); 1483 write_unlock_bh(&nf_conntrack_lock);
1548 1484
1549 DEBUGP("leaving\n");
1550
1551 return err; 1485 return err;
1552} 1486}
1553 1487
diff --git a/net/netfilter/xt_NFQUEUE.c b/net/netfilter/xt_NFQUEUE.c
index db9b896e57c8..39e117502bd7 100644
--- a/net/netfilter/xt_NFQUEUE.c
+++ b/net/netfilter/xt_NFQUEUE.c
@@ -68,7 +68,7 @@ static int __init xt_nfqueue_init(void)
68 68
69static void __exit xt_nfqueue_fini(void) 69static void __exit xt_nfqueue_fini(void)
70{ 70{
71 xt_register_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target)); 71 xt_unregister_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target));
72} 72}
73 73
74module_init(xt_nfqueue_init); 74module_init(xt_nfqueue_init);
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
index 92a5726ef237..a8f03057dbde 100644
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -147,7 +147,7 @@ static int __init xt_connmark_init(void)
147 147
148static void __exit xt_connmark_fini(void) 148static void __exit xt_connmark_fini(void)
149{ 149{
150 xt_register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match)); 150 xt_unregister_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match));
151} 151}
152 152
153module_init(xt_connmark_init); 153module_init(xt_connmark_init);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 249e5033c1a8..78071c6e6cf1 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -215,17 +215,17 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
215 } 215 }
216 216
217 dst = ip6_route_output(NULL, &fl); 217 dst = ip6_route_output(NULL, &fl);
218 if (dst) { 218 if (!dst->error) {
219 struct rt6_info *rt; 219 struct rt6_info *rt;
220 rt = (struct rt6_info *)dst; 220 rt = (struct rt6_info *)dst;
221 SCTP_DEBUG_PRINTK( 221 SCTP_DEBUG_PRINTK(
222 "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n", 222 "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n",
223 NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr)); 223 NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
224 } else { 224 return dst;
225 SCTP_DEBUG_PRINTK("NO ROUTE\n");
226 } 225 }
227 226 SCTP_DEBUG_PRINTK("NO ROUTE\n");
228 return dst; 227 dst_release(dst);
228 return NULL;
229} 229}
230 230
231/* Returns the number of consecutive initial bits that match in the 2 ipv6 231/* Returns the number of consecutive initial bits that match in the 2 ipv6
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9deec4391187..9f34dec6ff8e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -821,7 +821,7 @@ out:
821 * addrs is a pointer to an array of one or more socket addresses. Each 821 * addrs is a pointer to an array of one or more socket addresses. Each
822 * address is contained in its appropriate structure (i.e. struct 822 * address is contained in its appropriate structure (i.e. struct
823 * sockaddr_in or struct sockaddr_in6) the family of the address type 823 * sockaddr_in or struct sockaddr_in6) the family of the address type
824 * must be used to distengish the address length (note that this 824 * must be used to distinguish the address length (note that this
825 * representation is termed a "packed array" of addresses). The caller 825 * representation is termed a "packed array" of addresses). The caller
826 * specifies the number of addresses in the array with addrcnt. 826 * specifies the number of addresses in the array with addrcnt.
827 * 827 *
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
index 919d5ba7ca0a..e52afab413de 100644
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -101,11 +101,13 @@ void rpc_getport(struct rpc_task *task)
101 /* Autobind on cloned rpc clients is discouraged */ 101 /* Autobind on cloned rpc clients is discouraged */
102 BUG_ON(clnt->cl_parent != clnt); 102 BUG_ON(clnt->cl_parent != clnt);
103 103
104 if (xprt_test_and_set_binding(xprt)) { 104 /* Put self on queue before sending rpcbind request, in case
105 task->tk_status = -EACCES; /* tell caller to check again */ 105 * pmap_getport_done completes before we return from rpc_run_task */
106 rpc_sleep_on(&xprt->binding, task, NULL, NULL); 106 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
107 return; 107
108 } 108 status = -EACCES; /* tell caller to check again */
109 if (xprt_test_and_set_binding(xprt))
110 goto bailout_nofree;
109 111
110 /* Someone else may have bound if we slept */ 112 /* Someone else may have bound if we slept */
111 status = 0; 113 status = 0;
@@ -134,8 +136,6 @@ void rpc_getport(struct rpc_task *task)
134 goto bailout; 136 goto bailout;
135 rpc_release_task(child); 137 rpc_release_task(child);
136 138
137 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
138
139 task->tk_xprt->stat.bind_count++; 139 task->tk_xprt->stat.bind_count++;
140 return; 140 return;
141 141
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 2807fa0eab40..eb44ec929ca1 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -828,6 +828,11 @@ svc_process(struct svc_rqst *rqstp)
828 *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 828 *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
829 829
830 /* Encode reply */ 830 /* Encode reply */
831 if (*statp == rpc_drop_reply) {
832 if (procp->pc_release)
833 procp->pc_release(rqstp, NULL, rqstp->rq_resp);
834 goto dropit;
835 }
831 if (*statp == rpc_success && (xdr = procp->pc_encode) 836 if (*statp == rpc_success && (xdr = procp->pc_encode)
832 && !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { 837 && !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
833 dprintk("svc: failed to encode reply\n"); 838 dprintk("svc: failed to encode reply\n");
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 61e307cca13d..96521f16342b 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -973,7 +973,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
973 return 0; 973 return 0;
974 } 974 }
975 975
976 if (test_bit(SK_CONN, &svsk->sk_flags)) { 976 if (svsk->sk_sk->sk_state == TCP_LISTEN) {
977 svc_tcp_accept(svsk); 977 svc_tcp_accept(svsk);
978 svc_sock_received(svsk); 978 svc_sock_received(svsk);
979 return 0; 979 return 0;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 28100e019225..757fc91ef25d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1366,7 +1366,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1366 if (xprt->slot == NULL) 1366 if (xprt->slot == NULL)
1367 return -ENOMEM; 1367 return -ENOMEM;
1368 1368
1369 if (ntohs(addr->sin_port != 0)) 1369 if (ntohs(addr->sin_port) != 0)
1370 xprt_set_bound(xprt); 1370 xprt_set_bound(xprt);
1371 xprt->port = xs_get_random_port(); 1371 xprt->port = xs_get_random_port();
1372 1372
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 75a5968c2139..39744a33bd36 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -2,7 +2,7 @@
2 * net/tipc/bearer.c: TIPC bearer code 2 * net/tipc/bearer.c: TIPC bearer code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -191,14 +191,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
191 if ((i < media_count) && (m_ptr->addr2str != NULL)) { 191 if ((i < media_count) && (m_ptr->addr2str != NULL)) {
192 char addr_str[MAX_ADDR_STR]; 192 char addr_str[MAX_ADDR_STR];
193 193
194 tipc_printf(pb, "%s(%s) ", m_ptr->name, 194 tipc_printf(pb, "%s(%s)", m_ptr->name,
195 m_ptr->addr2str(a, addr_str, sizeof(addr_str))); 195 m_ptr->addr2str(a, addr_str, sizeof(addr_str)));
196 } else { 196 } else {
197 unchar *addr = (unchar *)&a->dev_addr; 197 unchar *addr = (unchar *)&a->dev_addr;
198 198
199 tipc_printf(pb, "UNKNOWN(%u):", media_type); 199 tipc_printf(pb, "UNKNOWN(%u)", media_type);
200 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) { 200 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) {
201 tipc_printf(pb, "%02x ", addr[i]); 201 tipc_printf(pb, "-%02x", addr[i]);
202 } 202 }
203 } 203 }
204} 204}
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 285e1bc2d880..ed1351ed05e1 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -2,7 +2,7 @@
2 * net/tipc/config.c: TIPC configuration management code 2 * net/tipc/config.c: TIPC configuration management code
3 * 3 *
4 * Copyright (c) 2002-2006, Ericsson AB 4 * Copyright (c) 2002-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -613,7 +613,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
613 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); 613 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id);
614 break; 614 break;
615 default: 615 default:
616 rep_tlv_buf = NULL; 616 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
617 " (unknown command)");
617 break; 618 break;
618 } 619 }
619 620
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 0539a8362858..6f5b7ee31180 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -57,7 +57,7 @@ void tipc_socket_stop(void);
57int tipc_netlink_start(void); 57int tipc_netlink_start(void);
58void tipc_netlink_stop(void); 58void tipc_netlink_stop(void);
59 59
60#define TIPC_MOD_VER "1.6.1" 60#define TIPC_MOD_VER "1.6.2"
61 61
62#ifndef CONFIG_TIPC_ZONES 62#ifndef CONFIG_TIPC_ZONES
63#define CONFIG_TIPC_ZONES 3 63#define CONFIG_TIPC_ZONES 3
@@ -90,7 +90,7 @@ int tipc_random;
90atomic_t tipc_user_count = ATOMIC_INIT(0); 90atomic_t tipc_user_count = ATOMIC_INIT(0);
91 91
92const char tipc_alphabet[] = 92const char tipc_alphabet[] =
93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; 93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
94 94
95/* configurable TIPC parameters */ 95/* configurable TIPC parameters */
96 96
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 762aac2572be..4638947c2326 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -65,7 +65,7 @@
65#define assert(i) BUG_ON(!(i)) 65#define assert(i) BUG_ON(!(i))
66 66
67struct tipc_msg; 67struct tipc_msg;
68extern struct print_buf *TIPC_CONS, *TIPC_LOG; 68extern struct print_buf *TIPC_NULL, *TIPC_CONS, *TIPC_LOG;
69extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *); 69extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *);
70void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); 70void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
71void tipc_printf(struct print_buf *, const char *fmt, ...); 71void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -83,9 +83,9 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
83#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg) 83#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg)
84#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) 84#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
85 85
86#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) 86#define dbg(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
87#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0) 87#define msg_dbg(msg, txt) do {if (DBG_OUTPUT != TIPC_NULL) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
88#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) 88#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
89 89
90 90
91/* 91/*
@@ -94,11 +94,11 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
94 * here, or on a per .c file basis, by redefining these symbols. The following 94 * here, or on a per .c file basis, by redefining these symbols. The following
95 * print buffer options are available: 95 * print buffer options are available:
96 * 96 *
97 * NULL : Output to null print buffer (i.e. print nowhere) 97 * TIPC_NULL : null buffer (i.e. print nowhere)
98 * TIPC_CONS : Output to system console 98 * TIPC_CONS : system console
99 * TIPC_LOG : Output to TIPC log buffer 99 * TIPC_LOG : TIPC log buffer
100 * &buf : Output to user-defined buffer (struct print_buf *) 100 * &buf : user-defined buffer (struct print_buf *)
101 * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) ) 101 * TIPC_TEE(&buf_a,&buf_b) : list of buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG))
102 */ 102 */
103 103
104#ifndef TIPC_OUTPUT 104#ifndef TIPC_OUTPUT
@@ -106,7 +106,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
106#endif 106#endif
107 107
108#ifndef DBG_OUTPUT 108#ifndef DBG_OUTPUT
109#define DBG_OUTPUT NULL 109#define DBG_OUTPUT TIPC_NULL
110#endif 110#endif
111 111
112#else 112#else
@@ -136,7 +136,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
136#define TIPC_OUTPUT TIPC_CONS 136#define TIPC_OUTPUT TIPC_CONS
137 137
138#undef DBG_OUTPUT 138#undef DBG_OUTPUT
139#define DBG_OUTPUT NULL 139#define DBG_OUTPUT TIPC_NULL
140 140
141#endif 141#endif
142 142
@@ -275,11 +275,15 @@ static inline void k_term_timer(struct timer_list *timer)
275/* 275/*
276 * TIPC message buffer code 276 * TIPC message buffer code
277 * 277 *
278 * TIPC message buffer headroom leaves room for 14 byte Ethernet header, 278 * TIPC message buffer headroom reserves space for a link-level header
279 * (in case the message is sent off-node),
279 * while ensuring TIPC header is word aligned for quicker access 280 * while ensuring TIPC header is word aligned for quicker access
281 *
282 * The largest header currently supported is 18 bytes, which is used when
283 * the standard 14 byte Ethernet header has 4 added bytes for VLAN info
280 */ 284 */
281 285
282#define BUF_HEADROOM 16u 286#define BUF_HEADROOM 20u
283 287
284struct tipc_skb_cb { 288struct tipc_skb_cb {
285 void *handle; 289 void *handle;
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 55130655e1ed..d8af4c28695d 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * net/tipc/dbg.c: TIPC print buffer routines for debuggign 2 * net/tipc/dbg.c: TIPC print buffer routines for debugging
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -38,11 +38,12 @@
38#include "config.h" 38#include "config.h"
39#include "dbg.h" 39#include "dbg.h"
40 40
41#define MAX_STRING 512 41static char print_string[TIPC_PB_MAX_STR];
42
43static char print_string[MAX_STRING];
44static DEFINE_SPINLOCK(print_lock); 42static DEFINE_SPINLOCK(print_lock);
45 43
44static struct print_buf null_buf = { NULL, 0, NULL, NULL };
45struct print_buf *TIPC_NULL = &null_buf;
46
46static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; 47static struct print_buf cons_buf = { NULL, 0, NULL, NULL };
47struct print_buf *TIPC_CONS = &cons_buf; 48struct print_buf *TIPC_CONS = &cons_buf;
48 49
@@ -62,68 +63,83 @@ struct print_buf *TIPC_LOG = &log_buf;
62/* 63/*
63 * Locking policy when using print buffers. 64 * Locking policy when using print buffers.
64 * 65 *
65 * 1) Routines of the form printbuf_XXX() rely on the caller to prevent 66 * The following routines use 'print_lock' for protection:
66 * simultaneous use of the print buffer(s) being manipulated. 67 * 1) tipc_printf() - to protect its print buffer(s) and 'print_string'
67 * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of 68 * 2) TIPC_TEE() - to protect its print buffer(s)
68 * 'print_string' and to protect its print buffer(s). 69 * 3) tipc_dump() - to protect its print buffer(s) and 'print_string'
69 * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s). 70 * 4) tipc_log_XXX() - to protect TIPC_LOG
70 * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG. 71 *
72 * All routines of the form tipc_printbuf_XXX() rely on the caller to prevent
73 * simultaneous use of the print buffer(s) being manipulated.
71 */ 74 */
72 75
73/** 76/**
74 * tipc_printbuf_init - initialize print buffer to empty 77 * tipc_printbuf_init - initialize print buffer to empty
78 * @pb: pointer to print buffer structure
79 * @raw: pointer to character array used by print buffer
80 * @size: size of character array
81 *
82 * Makes the print buffer a null device that discards anything written to it
83 * if the character array is too small (or absent).
75 */ 84 */
76 85
77void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz) 86void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
78{ 87{
79 if (!pb || !raw || (sz < (MAX_STRING + 1))) 88 pb->buf = raw;
80 return; 89 pb->crs = raw;
81 90 pb->size = size;
82 pb->crs = pb->buf = raw;
83 pb->size = sz;
84 pb->next = NULL; 91 pb->next = NULL;
85 pb->buf[0] = 0; 92
86 pb->buf[sz-1] = ~0; 93 if (size < TIPC_PB_MIN_SIZE) {
94 pb->buf = NULL;
95 } else if (raw) {
96 pb->buf[0] = 0;
97 pb->buf[size-1] = ~0;
98 }
87} 99}
88 100
89/** 101/**
90 * tipc_printbuf_reset - reinitialize print buffer to empty state 102 * tipc_printbuf_reset - reinitialize print buffer to empty state
103 * @pb: pointer to print buffer structure
91 */ 104 */
92 105
93void tipc_printbuf_reset(struct print_buf *pb) 106void tipc_printbuf_reset(struct print_buf *pb)
94{ 107{
95 if (pb && pb->buf) 108 tipc_printbuf_init(pb, pb->buf, pb->size);
96 tipc_printbuf_init(pb, pb->buf, pb->size);
97} 109}
98 110
99/** 111/**
100 * tipc_printbuf_empty - test if print buffer is in empty state 112 * tipc_printbuf_empty - test if print buffer is in empty state
113 * @pb: pointer to print buffer structure
114 *
115 * Returns non-zero if print buffer is empty.
101 */ 116 */
102 117
103int tipc_printbuf_empty(struct print_buf *pb) 118int tipc_printbuf_empty(struct print_buf *pb)
104{ 119{
105 return (!pb || !pb->buf || (pb->crs == pb->buf)); 120 return (!pb->buf || (pb->crs == pb->buf));
106} 121}
107 122
108/** 123/**
109 * tipc_printbuf_validate - check for print buffer overflow 124 * tipc_printbuf_validate - check for print buffer overflow
125 * @pb: pointer to print buffer structure
110 * 126 *
111 * Verifies that a print buffer has captured all data written to it. 127 * Verifies that a print buffer has captured all data written to it.
112 * If data has been lost, linearize buffer and prepend an error message 128 * If data has been lost, linearize buffer and prepend an error message
113 * 129 *
114 * Returns length of print buffer data string (including trailing NULL) 130 * Returns length of print buffer data string (including trailing NUL)
115 */ 131 */
116 132
117int tipc_printbuf_validate(struct print_buf *pb) 133int tipc_printbuf_validate(struct print_buf *pb)
118{ 134{
119 char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; 135 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
120 char *cp_buf; 136 char *cp_buf;
121 struct print_buf cb; 137 struct print_buf cb;
122 138
123 if (!pb || !pb->buf) 139 if (!pb->buf)
124 return 0; 140 return 0;
125 141
126 if (pb->buf[pb->size - 1] == '\0') { 142 if (pb->buf[pb->size - 1] == 0) {
127 cp_buf = kmalloc(pb->size, GFP_ATOMIC); 143 cp_buf = kmalloc(pb->size, GFP_ATOMIC);
128 if (cp_buf != NULL){ 144 if (cp_buf != NULL){
129 tipc_printbuf_init(&cb, cp_buf, pb->size); 145 tipc_printbuf_init(&cb, cp_buf, pb->size);
@@ -141,6 +157,8 @@ int tipc_printbuf_validate(struct print_buf *pb)
141 157
142/** 158/**
143 * tipc_printbuf_move - move print buffer contents to another print buffer 159 * tipc_printbuf_move - move print buffer contents to another print buffer
160 * @pb_to: pointer to destination print buffer structure
161 * @pb_from: pointer to source print buffer structure
144 * 162 *
145 * Current contents of destination print buffer (if any) are discarded. 163 * Current contents of destination print buffer (if any) are discarded.
146 * Source print buffer becomes empty if a successful move occurs. 164 * Source print buffer becomes empty if a successful move occurs.
@@ -152,21 +170,22 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
152 170
153 /* Handle the cases where contents can't be moved */ 171 /* Handle the cases where contents can't be moved */
154 172
155 if (!pb_to || !pb_to->buf) 173 if (!pb_to->buf)
156 return; 174 return;
157 175
158 if (!pb_from || !pb_from->buf) { 176 if (!pb_from->buf) {
159 tipc_printbuf_reset(pb_to); 177 tipc_printbuf_reset(pb_to);
160 return; 178 return;
161 } 179 }
162 180
163 if (pb_to->size < pb_from->size) { 181 if (pb_to->size < pb_from->size) {
164 tipc_printbuf_reset(pb_to); 182 tipc_printbuf_reset(pb_to);
165 tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); 183 tipc_printf(pb_to, "*** PRINT BUFFER MOVE ERROR ***");
166 return; 184 return;
167 } 185 }
168 186
169 /* Copy data from char after cursor to end (if used) */ 187 /* Copy data from char after cursor to end (if used) */
188
170 len = pb_from->buf + pb_from->size - pb_from->crs - 2; 189 len = pb_from->buf + pb_from->size - pb_from->crs - 2;
171 if ((pb_from->buf[pb_from->size-1] == 0) && (len > 0)) { 190 if ((pb_from->buf[pb_from->size-1] == 0) && (len > 0)) {
172 strcpy(pb_to->buf, pb_from->crs + 1); 191 strcpy(pb_to->buf, pb_from->crs + 1);
@@ -175,6 +194,7 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
175 pb_to->crs = pb_to->buf; 194 pb_to->crs = pb_to->buf;
176 195
177 /* Copy data from start to cursor (always) */ 196 /* Copy data from start to cursor (always) */
197
178 len = pb_from->crs - pb_from->buf; 198 len = pb_from->crs - pb_from->buf;
179 strcpy(pb_to->crs, pb_from->buf); 199 strcpy(pb_to->crs, pb_from->buf);
180 pb_to->crs += len; 200 pb_to->crs += len;
@@ -184,6 +204,8 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
184 204
185/** 205/**
186 * tipc_printf - append formatted output to print buffer chain 206 * tipc_printf - append formatted output to print buffer chain
207 * @pb: pointer to chain of print buffers (may be NULL)
208 * @fmt: formatted info to be printed
187 */ 209 */
188 210
189void tipc_printf(struct print_buf *pb, const char *fmt, ...) 211void tipc_printf(struct print_buf *pb, const char *fmt, ...)
@@ -195,8 +217,8 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
195 217
196 spin_lock_bh(&print_lock); 218 spin_lock_bh(&print_lock);
197 FORMAT(print_string, chars_to_add, fmt); 219 FORMAT(print_string, chars_to_add, fmt);
198 if (chars_to_add >= MAX_STRING) 220 if (chars_to_add >= TIPC_PB_MAX_STR)
199 strcpy(print_string, "*** STRING TOO LONG ***"); 221 strcpy(print_string, "*** PRINT BUFFER STRING TOO LONG ***");
200 222
201 while (pb) { 223 while (pb) {
202 if (pb == TIPC_CONS) 224 if (pb == TIPC_CONS)
@@ -206,6 +228,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
206 if (chars_to_add <= chars_left) { 228 if (chars_to_add <= chars_left) {
207 strcpy(pb->crs, print_string); 229 strcpy(pb->crs, print_string);
208 pb->crs += chars_to_add; 230 pb->crs += chars_to_add;
231 } else if (chars_to_add >= (pb->size - 1)) {
232 strcpy(pb->buf, print_string + chars_to_add + 1
233 - pb->size);
234 pb->crs = pb->buf + pb->size - 1;
209 } else { 235 } else {
210 strcpy(pb->buf, print_string + chars_left); 236 strcpy(pb->buf, print_string + chars_left);
211 save_char = print_string[chars_left]; 237 save_char = print_string[chars_left];
@@ -224,6 +250,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
224 250
225/** 251/**
226 * TIPC_TEE - perform next output operation on both print buffers 252 * TIPC_TEE - perform next output operation on both print buffers
253 * @b0: pointer to chain of print buffers (may be NULL)
254 * @b1: pointer to print buffer to add to chain
255 *
256 * Returns pointer to print buffer chain.
227 */ 257 */
228 258
229struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1) 259struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
@@ -232,8 +262,6 @@ struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
232 262
233 if (!b0 || (b0 == b1)) 263 if (!b0 || (b0 == b1))
234 return b1; 264 return b1;
235 if (!b1)
236 return b0;
237 265
238 spin_lock_bh(&print_lock); 266 spin_lock_bh(&print_lock);
239 while (pb->next) { 267 while (pb->next) {
@@ -256,7 +284,7 @@ static void print_to_console(char *crs, int len)
256 int rest = len; 284 int rest = len;
257 285
258 while (rest > 0) { 286 while (rest > 0) {
259 int sz = rest < MAX_STRING ? rest : MAX_STRING; 287 int sz = rest < TIPC_PB_MAX_STR ? rest : TIPC_PB_MAX_STR;
260 char c = crs[sz]; 288 char c = crs[sz];
261 289
262 crs[sz] = 0; 290 crs[sz] = 0;
@@ -275,36 +303,48 @@ static void printbuf_dump(struct print_buf *pb)
275{ 303{
276 int len; 304 int len;
277 305
306 if (!pb->buf) {
307 printk("*** PRINT BUFFER NOT ALLOCATED ***");
308 return;
309 }
310
278 /* Dump print buffer from char after cursor to end (if used) */ 311 /* Dump print buffer from char after cursor to end (if used) */
312
279 len = pb->buf + pb->size - pb->crs - 2; 313 len = pb->buf + pb->size - pb->crs - 2;
280 if ((pb->buf[pb->size - 1] == 0) && (len > 0)) 314 if ((pb->buf[pb->size - 1] == 0) && (len > 0))
281 print_to_console(pb->crs + 1, len); 315 print_to_console(pb->crs + 1, len);
282 316
283 /* Dump print buffer from start to cursor (always) */ 317 /* Dump print buffer from start to cursor (always) */
318
284 len = pb->crs - pb->buf; 319 len = pb->crs - pb->buf;
285 print_to_console(pb->buf, len); 320 print_to_console(pb->buf, len);
286} 321}
287 322
288/** 323/**
289 * tipc_dump - dump non-console print buffer(s) to console 324 * tipc_dump - dump non-console print buffer(s) to console
325 * @pb: pointer to chain of print buffers
290 */ 326 */
291 327
292void tipc_dump(struct print_buf *pb, const char *fmt, ...) 328void tipc_dump(struct print_buf *pb, const char *fmt, ...)
293{ 329{
330 struct print_buf *pb_next;
294 int len; 331 int len;
295 332
296 spin_lock_bh(&print_lock); 333 spin_lock_bh(&print_lock);
297 FORMAT(TIPC_CONS->buf, len, fmt); 334 FORMAT(print_string, len, fmt);
298 printk(TIPC_CONS->buf); 335 printk(print_string);
299 336
300 for (; pb; pb = pb->next) { 337 for (; pb; pb = pb->next) {
301 if (pb == TIPC_CONS) 338 if (pb != TIPC_CONS) {
302 continue; 339 printk("\n---- Start of %s log dump ----\n\n",
303 printk("\n---- Start of dump,%s log ----\n\n", 340 (pb == TIPC_LOG) ? "global" : "local");
304 (pb == TIPC_LOG) ? "global" : "local"); 341 printbuf_dump(pb);
305 printbuf_dump(pb); 342 tipc_printbuf_reset(pb);
306 tipc_printbuf_reset(pb); 343 printk("\n---- End of dump ----\n");
307 printk("\n-------- End of dump --------\n"); 344 }
345 pb_next = pb->next;
346 pb->next = NULL;
347 pb = pb_next;
308 } 348 }
309 spin_unlock_bh(&print_lock); 349 spin_unlock_bh(&print_lock);
310} 350}
@@ -324,7 +364,8 @@ void tipc_log_stop(void)
324} 364}
325 365
326/** 366/**
327 * tipc_log_reinit - set TIPC log print buffer to specified size 367 * tipc_log_reinit - (re)initialize TIPC log print buffer
368 * @log_size: print buffer size to use
328 */ 369 */
329 370
330void tipc_log_reinit(int log_size) 371void tipc_log_reinit(int log_size)
@@ -332,10 +373,11 @@ void tipc_log_reinit(int log_size)
332 tipc_log_stop(); 373 tipc_log_stop();
333 374
334 if (log_size) { 375 if (log_size) {
335 if (log_size <= MAX_STRING) 376 if (log_size < TIPC_PB_MIN_SIZE)
336 log_size = MAX_STRING + 1; 377 log_size = TIPC_PB_MIN_SIZE;
337 spin_lock_bh(&print_lock); 378 spin_lock_bh(&print_lock);
338 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size); 379 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC),
380 log_size);
339 spin_unlock_bh(&print_lock); 381 spin_unlock_bh(&print_lock);
340 } 382 }
341} 383}
diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h
index 227f050d2a52..467c0bc78a79 100644
--- a/net/tipc/dbg.h
+++ b/net/tipc/dbg.h
@@ -2,7 +2,7 @@
2 * net/tipc/dbg.h: Include file for TIPC print buffer routines 2 * net/tipc/dbg.h: Include file for TIPC print buffer routines
3 * 3 *
4 * Copyright (c) 1997-2006, Ericsson AB 4 * Copyright (c) 1997-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,14 @@
37#ifndef _TIPC_DBG_H 37#ifndef _TIPC_DBG_H
38#define _TIPC_DBG_H 38#define _TIPC_DBG_H
39 39
40/**
41 * struct print_buf - TIPC print buffer structure
42 * @buf: pointer to character array containing print buffer contents
43 * @size: size of character array
44 * @crs: pointer to first unused space in character array (i.e. final NUL)
45 * @next: used to link print buffers when printing to more than one at a time
46 */
47
40struct print_buf { 48struct print_buf {
41 char *buf; 49 char *buf;
42 u32 size; 50 u32 size;
@@ -44,7 +52,10 @@ struct print_buf {
44 struct print_buf *next; 52 struct print_buf *next;
45}; 53};
46 54
47void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz); 55#define TIPC_PB_MIN_SIZE 64 /* minimum size for a print buffer's array */
56#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
57
58void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
48void tipc_printbuf_reset(struct print_buf *pb); 59void tipc_printbuf_reset(struct print_buf *pb);
49int tipc_printbuf_empty(struct print_buf *pb); 60int tipc_printbuf_empty(struct print_buf *pb);
50int tipc_printbuf_validate(struct print_buf *pb); 61int tipc_printbuf_validate(struct print_buf *pb);
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index ee94de92ae99..3b0cd12f37da 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -132,6 +132,28 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
132} 132}
133 133
134/** 134/**
135 * disc_dupl_alert - issue node address duplication alert
136 * @b_ptr: pointer to bearer detecting duplication
137 * @node_addr: duplicated node address
138 * @media_addr: media address advertised by duplicated node
139 */
140
141static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr,
142 struct tipc_media_addr *media_addr)
143{
144 char node_addr_str[16];
145 char media_addr_str[64];
146 struct print_buf pb;
147
148 addr_string_fill(node_addr_str, node_addr);
149 tipc_printbuf_init(&pb, media_addr_str, sizeof(media_addr_str));
150 tipc_media_addr_printf(&pb, media_addr);
151 tipc_printbuf_validate(&pb);
152 warn("Duplicate %s using %s seen on <%s>\n",
153 node_addr_str, media_addr_str, b_ptr->publ.name);
154}
155
156/**
135 * tipc_disc_recv_msg - handle incoming link setup message (request or response) 157 * tipc_disc_recv_msg - handle incoming link setup message (request or response)
136 * @buf: buffer containing message 158 * @buf: buffer containing message
137 */ 159 */
@@ -157,8 +179,11 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
157 return; 179 return;
158 if (!tipc_addr_node_valid(orig)) 180 if (!tipc_addr_node_valid(orig))
159 return; 181 return;
160 if (orig == tipc_own_addr) 182 if (orig == tipc_own_addr) {
183 if (memcmp(&media_addr, &b_ptr->publ.addr, sizeof(media_addr)))
184 disc_dupl_alert(b_ptr, tipc_own_addr, &media_addr);
161 return; 185 return;
186 }
162 if (!in_scope(dest, tipc_own_addr)) 187 if (!in_scope(dest, tipc_own_addr))
163 return; 188 return;
164 if (is_slave(tipc_own_addr) && is_slave(orig)) 189 if (is_slave(tipc_own_addr) && is_slave(orig))
@@ -170,7 +195,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
170 struct sk_buff *rbuf; 195 struct sk_buff *rbuf;
171 struct tipc_media_addr *addr; 196 struct tipc_media_addr *addr;
172 struct node *n_ptr = tipc_node_find(orig); 197 struct node *n_ptr = tipc_node_find(orig);
173 int link_up; 198 int link_fully_up;
199
174 dbg(" in own cluster\n"); 200 dbg(" in own cluster\n");
175 if (n_ptr == NULL) { 201 if (n_ptr == NULL) {
176 n_ptr = tipc_node_create(orig); 202 n_ptr = tipc_node_create(orig);
@@ -190,14 +216,19 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
190 } 216 }
191 addr = &link->media_addr; 217 addr = &link->media_addr;
192 if (memcmp(addr, &media_addr, sizeof(*addr))) { 218 if (memcmp(addr, &media_addr, sizeof(*addr))) {
219 if (tipc_link_is_up(link) || (!link->started)) {
220 disc_dupl_alert(b_ptr, orig, &media_addr);
221 spin_unlock_bh(&n_ptr->lock);
222 return;
223 }
193 warn("Resetting link <%s>, peer interface address changed\n", 224 warn("Resetting link <%s>, peer interface address changed\n",
194 link->name); 225 link->name);
195 memcpy(addr, &media_addr, sizeof(*addr)); 226 memcpy(addr, &media_addr, sizeof(*addr));
196 tipc_link_reset(link); 227 tipc_link_reset(link);
197 } 228 }
198 link_up = tipc_link_is_up(link); 229 link_fully_up = (link->state == WORKING_WORKING);
199 spin_unlock_bh(&n_ptr->lock); 230 spin_unlock_bh(&n_ptr->lock);
200 if ((type == DSC_RESP_MSG) || link_up) 231 if ((type == DSC_RESP_MSG) || link_fully_up)
201 return; 232 return;
202 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); 233 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
203 if (rbuf != NULL) { 234 if (rbuf != NULL) {
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 53bc8cb5adbc..1bb983c8130b 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -132,7 +132,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
132 * allow the output from multiple links to be intermixed. For this reason 132 * allow the output from multiple links to be intermixed. For this reason
133 * routines of the form "dbg_link_XXX()" have been created that will capture 133 * routines of the form "dbg_link_XXX()" have been created that will capture
134 * debug info into a link's personal print buffer, which can then be dumped 134 * debug info into a link's personal print buffer, which can then be dumped
135 * into the TIPC system log (LOG) upon request. 135 * into the TIPC system log (TIPC_LOG) upon request.
136 * 136 *
137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size 137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size
138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, 138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0,
@@ -141,7 +141,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
141 * when there is only a single link in the system being debugged. 141 * when there is only a single link in the system being debugged.
142 * 142 *
143 * Notes: 143 * Notes:
144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least 1000 (bytes) 144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE
145 * - "l_ptr" must be valid when using dbg_link_XXX() macros 145 * - "l_ptr" must be valid when using dbg_link_XXX() macros
146 */ 146 */
147 147
@@ -159,13 +159,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
159 159
160static void dbg_print_link(struct link *l_ptr, const char *str) 160static void dbg_print_link(struct link *l_ptr, const char *str)
161{ 161{
162 if (DBG_OUTPUT) 162 if (DBG_OUTPUT != TIPC_NULL)
163 link_print(l_ptr, DBG_OUTPUT, str); 163 link_print(l_ptr, DBG_OUTPUT, str);
164} 164}
165 165
166static void dbg_print_buf_chain(struct sk_buff *root_buf) 166static void dbg_print_buf_chain(struct sk_buff *root_buf)
167{ 167{
168 if (DBG_OUTPUT) { 168 if (DBG_OUTPUT != TIPC_NULL) {
169 struct sk_buff *buf = root_buf; 169 struct sk_buff *buf = root_buf;
170 170
171 while (buf) { 171 while (buf) {
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index f0b063bcc2a9..03bd659c43ca 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -122,7 +122,7 @@ void tipc_named_publish(struct publication *publ)
122 struct sk_buff *buf; 122 struct sk_buff *buf;
123 struct distr_item *item; 123 struct distr_item *item;
124 124
125 list_add(&publ->local_list, &publ_root); 125 list_add_tail(&publ->local_list, &publ_root);
126 publ_cnt++; 126 publ_cnt++;
127 127
128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); 128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index fc6d09630ccd..886bda5e88db 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -648,7 +648,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
649 " (network address)"); 649 " (network address)");
650 650
651 if (!tipc_nodes) 651 if (tipc_mode != TIPC_NET_MODE)
652 return tipc_cfg_reply_none(); 652 return tipc_cfg_reply_none();
653 653
654 /* Get space for all unicast links + multicast link */ 654 /* Get space for all unicast links + multicast link */
diff --git a/net/tipc/port.c b/net/tipc/port.c
index b9c8c6b9e94f..c1a1a76759b5 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -505,8 +505,13 @@ static void port_timeout(unsigned long ref)
505 struct port *p_ptr = tipc_port_lock(ref); 505 struct port *p_ptr = tipc_port_lock(ref);
506 struct sk_buff *buf = NULL; 506 struct sk_buff *buf = NULL;
507 507
508 if (!p_ptr || !p_ptr->publ.connected) 508 if (!p_ptr)
509 return;
510
511 if (!p_ptr->publ.connected) {
512 tipc_port_unlock(p_ptr);
509 return; 513 return;
514 }
510 515
511 /* Last probe answered ? */ 516 /* Last probe answered ? */
512 if (p_ptr->probing_state == PROBING) { 517 if (p_ptr->probing_state == PROBING) {
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index acfb852e7c98..2a6a5a6b4c12 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2,7 +2,7 @@
2 * net/tipc/socket.c: TIPC socket API 2 * net/tipc/socket.c: TIPC socket API
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -629,6 +629,9 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
629 return -ENOTCONN; 629 return -ENOTCONN;
630 } 630 }
631 631
632 if (unlikely(m->msg_name))
633 return -EISCONN;
634
632 /* 635 /*
633 * Send each iovec entry using one or more messages 636 * Send each iovec entry using one or more messages
634 * 637 *
@@ -641,6 +644,8 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
641 curr_iovlen = m->msg_iovlen; 644 curr_iovlen = m->msg_iovlen;
642 my_msg.msg_iov = &my_iov; 645 my_msg.msg_iov = &my_iov;
643 my_msg.msg_iovlen = 1; 646 my_msg.msg_iovlen = 1;
647 my_msg.msg_flags = m->msg_flags;
648 my_msg.msg_name = NULL;
644 bytes_sent = 0; 649 bytes_sent = 0;
645 650
646 while (curr_iovlen--) { 651 while (curr_iovlen--) {
@@ -1203,7 +1208,8 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1203 atomic_inc(&tipc_queue_size); 1208 atomic_inc(&tipc_queue_size);
1204 skb_queue_tail(&sock->sk->sk_receive_queue, buf); 1209 skb_queue_tail(&sock->sk->sk_receive_queue, buf);
1205 1210
1206 wake_up_interruptible(sock->sk->sk_sleep); 1211 if (waitqueue_active(sock->sk->sk_sleep))
1212 wake_up_interruptible(sock->sk->sk_sleep);
1207 return TIPC_OK; 1213 return TIPC_OK;
1208} 1214}
1209 1215
@@ -1218,7 +1224,8 @@ static void wakeupdispatch(struct tipc_port *tport)
1218{ 1224{
1219 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle; 1225 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle;
1220 1226
1221 wake_up_interruptible(tsock->sk.sk_sleep); 1227 if (waitqueue_active(tsock->sk.sk_sleep))
1228 wake_up_interruptible(tsock->sk.sk_sleep);
1222} 1229}
1223 1230
1224/** 1231/**
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index c51600ba5f4a..7a918f12a5df 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -155,7 +155,7 @@ void tipc_subscr_report_overlap(struct subscription *sub,
155 sub->seq.upper, found_lower, found_upper); 155 sub->seq.upper, found_lower, found_upper);
156 if (!tipc_subscr_overlap(sub, found_lower, found_upper)) 156 if (!tipc_subscr_overlap(sub, found_lower, found_upper))
157 return; 157 return;
158 if (!must && (sub->filter != TIPC_SUB_PORTS)) 158 if (!must && !(sub->filter & TIPC_SUB_PORTS))
159 return; 159 return;
160 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); 160 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node);
161} 161}
@@ -176,6 +176,13 @@ static void subscr_timeout(struct subscription *sub)
176 if (subscriber == NULL) 176 if (subscriber == NULL)
177 return; 177 return;
178 178
179 /* Validate timeout (in case subscription is being cancelled) */
180
181 if (sub->timeout == TIPC_WAIT_FOREVER) {
182 tipc_ref_unlock(subscriber_ref);
183 return;
184 }
185
179 /* Unlink subscription from name table */ 186 /* Unlink subscription from name table */
180 187
181 tipc_nametbl_unsubscribe(sub); 188 tipc_nametbl_unsubscribe(sub);
@@ -199,6 +206,20 @@ static void subscr_timeout(struct subscription *sub)
199} 206}
200 207
201/** 208/**
209 * subscr_del - delete a subscription within a subscription list
210 *
211 * Called with subscriber locked.
212 */
213
214static void subscr_del(struct subscription *sub)
215{
216 tipc_nametbl_unsubscribe(sub);
217 list_del(&sub->subscription_list);
218 kfree(sub);
219 atomic_dec(&topsrv.subscription_count);
220}
221
222/**
202 * subscr_terminate - terminate communication with a subscriber 223 * subscr_terminate - terminate communication with a subscriber
203 * 224 *
204 * Called with subscriber locked. Routine must temporarily release this lock 225 * Called with subscriber locked. Routine must temporarily release this lock
@@ -227,12 +248,9 @@ static void subscr_terminate(struct subscriber *subscriber)
227 k_cancel_timer(&sub->timer); 248 k_cancel_timer(&sub->timer);
228 k_term_timer(&sub->timer); 249 k_term_timer(&sub->timer);
229 } 250 }
230 tipc_nametbl_unsubscribe(sub); 251 dbg("Term: Removing sub %u,%u,%u from subscriber %x list\n",
231 list_del(&sub->subscription_list);
232 dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n",
233 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); 252 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
234 kfree(sub); 253 subscr_del(sub);
235 atomic_dec(&topsrv.subscription_count);
236 } 254 }
237 255
238 /* Sever connection to subscriber */ 256 /* Sever connection to subscriber */
@@ -253,6 +271,49 @@ static void subscr_terminate(struct subscriber *subscriber)
253} 271}
254 272
255/** 273/**
274 * subscr_cancel - handle subscription cancellation request
275 *
276 * Called with subscriber locked. Routine must temporarily release this lock
277 * to enable the subscription timeout routine to finish without deadlocking;
278 * the lock is then reclaimed to allow caller to release it upon return.
279 *
280 * Note that fields of 's' use subscriber's endianness!
281 */
282
283static void subscr_cancel(struct tipc_subscr *s,
284 struct subscriber *subscriber)
285{
286 struct subscription *sub;
287 struct subscription *sub_temp;
288 int found = 0;
289
290 /* Find first matching subscription, exit if not found */
291
292 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
293 subscription_list) {
294 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
295 found = 1;
296 break;
297 }
298 }
299 if (!found)
300 return;
301
302 /* Cancel subscription timer (if used), then delete subscription */
303
304 if (sub->timeout != TIPC_WAIT_FOREVER) {
305 sub->timeout = TIPC_WAIT_FOREVER;
306 spin_unlock_bh(subscriber->lock);
307 k_cancel_timer(&sub->timer);
308 k_term_timer(&sub->timer);
309 spin_lock_bh(subscriber->lock);
310 }
311 dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n",
312 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
313 subscr_del(sub);
314}
315
316/**
256 * subscr_subscribe - create subscription for subscriber 317 * subscr_subscribe - create subscription for subscriber
257 * 318 *
258 * Called with subscriber locked 319 * Called with subscriber locked
@@ -263,6 +324,21 @@ static void subscr_subscribe(struct tipc_subscr *s,
263{ 324{
264 struct subscription *sub; 325 struct subscription *sub;
265 326
327 /* Determine/update subscriber's endianness */
328
329 if (s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE))
330 subscriber->swap = 0;
331 else
332 subscriber->swap = 1;
333
334 /* Detect & process a subscription cancellation request */
335
336 if (s->filter & htohl(TIPC_SUB_CANCEL, subscriber->swap)) {
337 s->filter &= ~htohl(TIPC_SUB_CANCEL, subscriber->swap);
338 subscr_cancel(s, subscriber);
339 return;
340 }
341
266 /* Refuse subscription if global limit exceeded */ 342 /* Refuse subscription if global limit exceeded */
267 343
268 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { 344 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
@@ -281,13 +357,6 @@ static void subscr_subscribe(struct tipc_subscr *s,
281 return; 357 return;
282 } 358 }
283 359
284 /* Determine/update subscriber's endianness */
285
286 if ((s->filter == TIPC_SUB_PORTS) || (s->filter == TIPC_SUB_SERVICE))
287 subscriber->swap = 0;
288 else
289 subscriber->swap = 1;
290
291 /* Initialize subscription object */ 360 /* Initialize subscription object */
292 361
293 memset(sub, 0, sizeof(*sub)); 362 memset(sub, 0, sizeof(*sub));
@@ -296,8 +365,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
296 sub->seq.upper = htohl(s->seq.upper, subscriber->swap); 365 sub->seq.upper = htohl(s->seq.upper, subscriber->swap);
297 sub->timeout = htohl(s->timeout, subscriber->swap); 366 sub->timeout = htohl(s->timeout, subscriber->swap);
298 sub->filter = htohl(s->filter, subscriber->swap); 367 sub->filter = htohl(s->filter, subscriber->swap);
299 if ((((sub->filter != TIPC_SUB_PORTS) 368 if ((!(sub->filter & TIPC_SUB_PORTS)
300 && (sub->filter != TIPC_SUB_SERVICE))) 369 == !(sub->filter & TIPC_SUB_SERVICE))
301 || (sub->seq.lower > sub->seq.upper)) { 370 || (sub->seq.lower > sub->seq.upper)) {
302 warn("Subscription rejected, illegal request\n"); 371 warn("Subscription rejected, illegal request\n");
303 kfree(sub); 372 kfree(sub);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 39b8bf3a9ded..84bbf8474f3e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -614,6 +614,14 @@ out:
614 return x; 614 return x;
615} 615}
616 616
617static void xfrm_hash_grow_check(int have_hash_collision)
618{
619 if (have_hash_collision &&
620 (xfrm_state_hmask + 1) < xfrm_state_hashmax &&
621 xfrm_state_num > xfrm_state_hmask)
622 schedule_work(&xfrm_hash_work);
623}
624
617static void __xfrm_state_insert(struct xfrm_state *x) 625static void __xfrm_state_insert(struct xfrm_state *x)
618{ 626{
619 unsigned int h; 627 unsigned int h;
@@ -642,10 +650,7 @@ static void __xfrm_state_insert(struct xfrm_state *x)
642 650
643 xfrm_state_num++; 651 xfrm_state_num++;
644 652
645 if (x->bydst.next != NULL && 653 xfrm_hash_grow_check(x->bydst.next != NULL);
646 (xfrm_state_hmask + 1) < xfrm_state_hashmax &&
647 xfrm_state_num > xfrm_state_hmask)
648 schedule_work(&xfrm_hash_work);
649} 654}
650 655
651/* xfrm_state_lock is held */ 656/* xfrm_state_lock is held */
@@ -753,6 +758,10 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
753 h = xfrm_src_hash(daddr, saddr, family); 758 h = xfrm_src_hash(daddr, saddr, family);
754 hlist_add_head(&x->bysrc, xfrm_state_bysrc+h); 759 hlist_add_head(&x->bysrc, xfrm_state_bysrc+h);
755 wake_up(&km_waitq); 760 wake_up(&km_waitq);
761
762 xfrm_state_num++;
763
764 xfrm_hash_grow_check(x->bydst.next != NULL);
756 } 765 }
757 766
758 return x; 767 return x;
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 6a026f69b563..4241e0dfeeaf 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -168,7 +168,7 @@ $(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES)
168 $(call cmd,gen) 168 $(call cmd,gen)
169 169
170else 170else
171$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) 171$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
172 $(call cmd,o_hdr_install) 172 $(call cmd,o_hdr_install)
173 173
174$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) 174$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 6c5469b1473b..65e0a79c36cf 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -44,7 +44,7 @@ include scripts/Kbuild.include
44include scripts/Makefile.lib 44include scripts/Makefile.lib
45 45
46kernelsymfile := $(objtree)/Module.symvers 46kernelsymfile := $(objtree)/Module.symvers
47modulesymfile := $(KBUILD_EXTMOD)/Module.symvers 47modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers
48 48
49# Step 1), find all modules listed in $(MODVERDIR)/ 49# Step 1), find all modules listed in $(MODVERDIR)/
50__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 50__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
index cfed1d30fa6a..d539346ab3a2 100644
--- a/security/selinux/ss/ebitmap.c
+++ b/security/selinux/ss/ebitmap.c
@@ -93,11 +93,15 @@ int ebitmap_export(const struct ebitmap *src,
93 size_t bitmap_byte; 93 size_t bitmap_byte;
94 unsigned char bitmask; 94 unsigned char bitmask;
95 95
96 if (src->highbit == 0) {
97 *dst = NULL;
98 *dst_len = 0;
99 return 0;
100 }
101
96 bitmap_len = src->highbit / 8; 102 bitmap_len = src->highbit / 8;
97 if (src->highbit % 7) 103 if (src->highbit % 7)
98 bitmap_len += 1; 104 bitmap_len += 1;
99 if (bitmap_len == 0)
100 return -EINVAL;
101 105
102 bitmap = kzalloc((bitmap_len & ~(sizeof(MAPTYPE) - 1)) + 106 bitmap = kzalloc((bitmap_len & ~(sizeof(MAPTYPE) - 1)) +
103 sizeof(MAPTYPE), 107 sizeof(MAPTYPE),
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index c713af23250a..2cca8e251624 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -640,8 +640,13 @@ int mls_export_cat(const struct context *context,
640{ 640{
641 int rc = -EPERM; 641 int rc = -EPERM;
642 642
643 if (!selinux_mls_enabled) 643 if (!selinux_mls_enabled) {
644 *low = NULL;
645 *low_len = 0;
646 *high = NULL;
647 *high_len = 0;
644 return 0; 648 return 0;
649 }
645 650
646 if (low != NULL) { 651 if (low != NULL) {
647 rc = ebitmap_export(&context->range.level[0].cat, 652 rc = ebitmap_export(&context->range.level[0].cat,
@@ -661,10 +666,16 @@ int mls_export_cat(const struct context *context,
661 return 0; 666 return 0;
662 667
663export_cat_failure: 668export_cat_failure:
664 if (low != NULL) 669 if (low != NULL) {
665 kfree(*low); 670 kfree(*low);
666 if (high != NULL) 671 *low = NULL;
672 *low_len = 0;
673 }
674 if (high != NULL) {
667 kfree(*high); 675 kfree(*high);
676 *high = NULL;
677 *high_len = 0;
678 }
668 return rc; 679 return rc;
669} 680}
670 681
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 18274b005090..b1f6fb36c699 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2399,31 +2399,33 @@ static int selinux_netlbl_socket_setsid(struct socket *sock, u32 sid)
2399 if (!ss_initialized) 2399 if (!ss_initialized)
2400 return 0; 2400 return 0;
2401 2401
2402 netlbl_secattr_init(&secattr);
2403
2402 POLICY_RDLOCK; 2404 POLICY_RDLOCK;
2403 2405
2404 ctx = sidtab_search(&sidtab, sid); 2406 ctx = sidtab_search(&sidtab, sid);
2405 if (ctx == NULL) 2407 if (ctx == NULL)
2406 goto netlbl_socket_setsid_return; 2408 goto netlbl_socket_setsid_return;
2407 2409
2408 netlbl_secattr_init(&secattr);
2409 secattr.domain = kstrdup(policydb.p_type_val_to_name[ctx->type - 1], 2410 secattr.domain = kstrdup(policydb.p_type_val_to_name[ctx->type - 1],
2410 GFP_ATOMIC); 2411 GFP_ATOMIC);
2411 mls_export_lvl(ctx, &secattr.mls_lvl, NULL); 2412 mls_export_lvl(ctx, &secattr.mls_lvl, NULL);
2412 secattr.mls_lvl_vld = 1; 2413 secattr.mls_lvl_vld = 1;
2413 mls_export_cat(ctx, 2414 rc = mls_export_cat(ctx,
2414 &secattr.mls_cat, 2415 &secattr.mls_cat,
2415 &secattr.mls_cat_len, 2416 &secattr.mls_cat_len,
2416 NULL, 2417 NULL,
2417 NULL); 2418 NULL);
2419 if (rc != 0)
2420 goto netlbl_socket_setsid_return;
2418 2421
2419 rc = netlbl_socket_setattr(sock, &secattr); 2422 rc = netlbl_socket_setattr(sock, &secattr);
2420 if (rc == 0) 2423 if (rc == 0)
2421 sksec->nlbl_state = NLBL_LABELED; 2424 sksec->nlbl_state = NLBL_LABELED;
2422 2425
2423 netlbl_secattr_destroy(&secattr);
2424
2425netlbl_socket_setsid_return: 2426netlbl_socket_setsid_return:
2426 POLICY_RDUNLOCK; 2427 POLICY_RDUNLOCK;
2428 netlbl_secattr_destroy(&secattr);
2427 return rc; 2429 return rc;
2428} 2430}
2429 2431