aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-26 01:45:37 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-08-26 01:45:37 -0400
commit94d4ac2f4a58c6e37876827c6688c61cef21290c (patch)
tree732f4e4794f3c116041242f69754637f75c0dd57
parented21763e7b0b3fb50e4efd9d4bc17ef5b035d304 (diff)
parent08970fc4e0385790a7b093adfaa4165a189f9eb0 (diff)
Merge branch 'x86/urgent' into x86/cleanups
-rw-r--r--Documentation/filesystems/ext4.txt6
-rw-r--r--Documentation/ja_JP/HOWTO67
-rw-r--r--Documentation/ja_JP/SubmitChecklist111
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/rfkill.txt5
-rw-r--r--Documentation/scsi/ChangeLog.megaraid_sas23
-rw-r--r--MAINTAINERS87
-rw-r--r--Makefile2
-rw-r--r--arch/arm/mach-integrator/impd1.c2
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c4
-rw-r--r--arch/arm/mach-pxa/clock.c25
-rw-r--r--arch/arm/mach-pxa/clock.h5
-rw-r--r--arch/arm/mach-pxa/eseries.c170
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c10
-rw-r--r--arch/arm/mach-pxa/pxa300.c2
-rw-r--r--arch/arm/plat-omap/clock.c1
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c2
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c1
-rw-r--r--arch/powerpc/kernel/crash_dump.c31
-rw-r--r--arch/powerpc/kernel/ibmebus.c12
-rw-r--r--arch/powerpc/kernel/vio.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c15
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c11
-rw-r--r--arch/powerpc/sysdev/bestcomm/gen_bd.c1
-rw-r--r--arch/s390/defconfig54
-rw-r--r--arch/s390/include/asm/bitops.h6
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/smp.c2
-rw-r--r--arch/sh/boards/board-ap325rxa.c4
-rw-r--r--arch/sh/boards/mach-migor/setup.c8
-rw-r--r--arch/sh/boards/mach-sh7763rdp/setup.c84
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c10
-rw-r--r--arch/sh/configs/sh7763rdp_defconfig113
-rw-r--r--arch/sh/include/asm/flat.h7
-rw-r--r--arch/sh/include/asm/migor.h3
-rw-r--r--arch/sh/include/asm/sh_mobile_lcdc.h6
-rw-r--r--arch/sh/include/cpu-sh3/cpu/cacheflush.h10
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c4
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c4
-rw-r--r--arch/sh/mm/Kconfig2
-rw-r--r--arch/sh/mm/consistent.c27
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c109
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h3
-rw-r--r--arch/x86/kernel/cpuid.c15
-rw-r--r--arch/x86/kernel/msr.c38
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/lib/msr-on-cpu.c22
-rw-r--r--arch/x86/mach-rdc321x/platform.c1
-rw-r--r--arch/x86/pci/irq.c2
-rw-r--r--arch/x86/pci/legacy.c2
-rw-r--r--arch/x86/pci/mmconfig-shared.c65
-rw-r--r--block/genhd.c36
-rw-r--r--crypto/authenc.c10
-rw-r--r--drivers/ata/ahci.c8
-rw-r--r--drivers/ata/ata_piix.c8
-rw-r--r--drivers/ata/libata-core.c60
-rw-r--r--drivers/ata/libata-eh.c30
-rw-r--r--drivers/ata/pata_acpi.c2
-rw-r--r--drivers/ata/pata_atiixp.c2
-rw-r--r--drivers/ata/pata_cs5530.c6
-rw-r--r--drivers/ata/pata_it821x.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_sc1200.c6
-rw-r--r--drivers/ata/pata_via.c59
-rw-r--r--drivers/ata/sata_mv.c37
-rw-r--r--drivers/atm/adummy.c1
-rw-r--r--drivers/base/class.c11
-rw-r--r--drivers/base/core.c31
-rw-r--r--drivers/base/driver.c3
-rw-r--r--drivers/base/power/main.c19
-rw-r--r--drivers/base/power/power.h9
-rw-r--r--drivers/block/brd.c2
-rw-r--r--drivers/block/nbd.c10
-rw-r--r--drivers/bluetooth/Kconfig10
-rw-r--r--drivers/bluetooth/bt3c_cs.c2
-rw-r--r--drivers/bluetooth/btusb.c282
-rw-r--r--drivers/bluetooth/hci_ldisc.c2
-rw-r--r--drivers/bluetooth/hci_usb.c2
-rw-r--r--drivers/bluetooth/hci_vhci.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c8
-rw-r--r--drivers/char/random.c1
-rw-r--r--drivers/char/xilinx_hwicap/buffer_icap.h1
-rw-r--r--drivers/char/xilinx_hwicap/fifo_icap.h1
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.h1
-rw-r--r--drivers/edac/edac_core.h1
-rw-r--r--drivers/firewire/Kconfig4
-rw-r--r--drivers/i2c/busses/i2c-at91.c1
-rw-r--r--drivers/ieee1394/nodemgr.c63
-rw-r--r--drivers/ieee1394/nodemgr.h2
-rw-r--r--drivers/ieee1394/sbp2.c25
-rw-r--r--drivers/infiniband/hw/ehca/ehca_tools.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba7220.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c8
-rw-r--r--drivers/infiniband/hw/nes/nes.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c19
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c10
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c1
-rw-r--r--drivers/input/evdev.c4
-rw-r--r--drivers/input/keyboard/bf54x-keys.c1
-rw-r--r--drivers/input/keyboard/gpio_keys.c1
-rw-r--r--drivers/input/misc/cobalt_btns.c3
-rw-r--r--drivers/input/mouse/gpio_mouse.c1
-rw-r--r--drivers/input/tablet/gtco.c1
-rw-r--r--drivers/input/touchscreen/mainstone-wm97xx.c1
-rw-r--r--drivers/input/touchscreen/migor_ts.c11
-rw-r--r--drivers/input/touchscreen/wm9705.c1
-rw-r--r--drivers/input/touchscreen/wm9712.c1
-rw-r--r--drivers/input/touchscreen/wm9713.c1
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c1
-rw-r--r--drivers/mfd/asic3.c1
-rw-r--r--drivers/misc/acer-wmi.c5
-rw-r--r--drivers/misc/eeepc-laptop.c2
-rw-r--r--drivers/misc/eeprom_93cx6.c1
-rw-r--r--drivers/mtd/maps/amd76xrom.c1
-rw-r--r--drivers/mtd/maps/ck804xrom.c1
-rw-r--r--drivers/mtd/maps/esb2rom.c1
-rw-r--r--drivers/mtd/nand/au1550nd.c1
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/acenic.c1
-rw-r--r--drivers/net/arm/ixp4xx_eth.c6
-rw-r--r--drivers/net/atl1e/atl1e_ethtool.c2
-rw-r--r--drivers/net/au1000_eth.c2
-rw-r--r--drivers/net/ax88796.c4
-rw-r--r--drivers/net/bnx2.c47
-rw-r--r--drivers/net/bnx2x_link.c1
-rw-r--r--drivers/net/bnx2x_main.c1
-rw-r--r--drivers/net/cpmac.c1
-rw-r--r--drivers/net/e1000e/defines.h2
-rw-r--r--drivers/net/e1000e/e1000.h1
-rw-r--r--drivers/net/e1000e/ethtool.c2
-rw-r--r--drivers/net/e1000e/netdev.c185
-rw-r--r--drivers/net/e1000e/param.c25
-rw-r--r--drivers/net/gianfar.c6
-rw-r--r--drivers/net/gianfar_sysfs.c1
-rw-r--r--drivers/net/ipg.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h1
-rw-r--r--drivers/net/loopback.c67
-rw-r--r--drivers/net/myri10ge/myri10ge.c7
-rw-r--r--drivers/net/ne.c4
-rw-r--r--drivers/net/netxen/netxen_nic.h8
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c1
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h2
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c59
-rw-r--r--drivers/net/netxen/netxen_nic_init.c28
-rw-r--r--drivers/net/netxen/netxen_nic_main.c210
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h2
-rw-r--r--drivers/net/ppp_mppe.c1
-rw-r--r--drivers/net/pppol2tp.c1
-rw-r--r--drivers/net/r6040.c1
-rw-r--r--drivers/net/sh_eth.c1
-rw-r--r--drivers/net/sky2.c8
-rw-r--r--drivers/net/tehuti.h1
-rw-r--r--drivers/net/tg3.c101
-rw-r--r--drivers/net/tg3.h6
-rw-r--r--drivers/net/tlan.c8
-rw-r--r--drivers/net/tokenring/lanstreamer.c1
-rw-r--r--drivers/net/tokenring/lanstreamer.h2
-rw-r--r--drivers/net/tun.c105
-rw-r--r--drivers/net/typhoon.c1
-rw-r--r--drivers/net/usb/Kconfig21
-rw-r--r--drivers/net/usb/hso.c53
-rw-r--r--drivers/net/wireless/ath5k/base.c9
-rw-r--r--drivers/net/wireless/ath9k/hw.c6
-rw-r--r--drivers/net/wireless/b43/main.c3
-rw-r--r--drivers/net/wireless/b43legacy/main.c1
-rw-r--r--drivers/net/wireless/ipw2100.c1
-rw-r--r--drivers/net/wireless/ipw2200.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c7
-rw-r--r--drivers/net/wireless/p54/p54common.c51
-rw-r--r--drivers/net/wireless/p54/p54common.h18
-rw-r--r--drivers/net/wireless/p54/p54usb.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c1
-rw-r--r--drivers/net/wireless/rtl8187_dev.c1
-rw-r--r--drivers/of/device.c10
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c38
-rw-r--r--drivers/pci/pcie/aer/aerdrv_acpi.c7
-rw-r--r--drivers/pci/probe.c3
-rw-r--r--drivers/pci/setup-bus.c35
-rw-r--r--drivers/rtc/Kconfig2
-rw-r--r--drivers/rtc/rtc-bfin.c60
-rw-r--r--drivers/rtc/rtc-dev.c5
-rw-r--r--drivers/rtc/rtc-ds1374.c10
-rw-r--r--drivers/rtc/rtc-max6902.c2
-rw-r--r--drivers/rtc/rtc-r9701.c1
-rw-r--r--drivers/s390/block/dasd.c5
-rw-r--r--drivers/s390/block/dasd_eckd.h2
-rw-r--r--drivers/s390/block/dasd_eer.c3
-rw-r--r--drivers/s390/block/dcssblk.c4
-rw-r--r--drivers/s390/char/tape_char.c2
-rw-r--r--drivers/s390/char/tape_std.c2
-rw-r--r--drivers/s390/cio/ccwgroup.c20
-rw-r--r--drivers/s390/cio/css.c1
-rw-r--r--drivers/s390/cio/device.c40
-rw-r--r--drivers/s390/cio/device.h2
-rw-r--r--drivers/s390/cio/device_fsm.c31
-rw-r--r--drivers/s390/cio/qdio_debug.h6
-rw-r--r--drivers/s390/cio/qdio_main.c74
-rw-r--r--drivers/s390/cio/qdio_setup.c6
-rw-r--r--drivers/s390/cio/qdio_thinint.c6
-rw-r--r--drivers/s390/net/ctcm_mpc.c1
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c3
-rw-r--r--drivers/scsi/dpt/dpti_i2o.h1
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c37
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h4
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/ips.c1
-rw-r--r--drivers/scsi/ips.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c119
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h10
-rw-r--r--drivers/scsi/nsp32.c1
-rw-r--r--drivers/scsi/nsp32.h1
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c11
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c14
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c18
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/ssb/main.c8
-rw-r--r--drivers/uio/Kconfig13
-rw-r--r--drivers/uio/Makefile1
-rw-r--r--drivers/uio/uio_pdrv.c4
-rw-r--r--drivers/uio/uio_pdrv_genirq.c188
-rw-r--r--drivers/usb/atm/ueagle-atm.c1
-rw-r--r--drivers/usb/class/cdc-acm.c5
-rw-r--r--drivers/usb/core/driver.c96
-rw-r--r--drivers/usb/core/hcd.c9
-rw-r--r--drivers/usb/core/hcd.h4
-rw-r--r--drivers/usb/core/hub.c9
-rw-r--r--drivers/usb/core/urb.c9
-rw-r--r--drivers/usb/core/usb.c73
-rw-r--r--drivers/usb/core/usb.h3
-rw-r--r--drivers/usb/gadget/amd5536udc.c1
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c1
-rw-r--r--drivers/usb/host/isp1760-hcd.c2
-rw-r--r--drivers/usb/host/ohci-at91.c1
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c1
-rw-r--r--drivers/usb/host/ohci-hub.c53
-rw-r--r--drivers/usb/host/ohci-lh7a404.c1
-rw-r--r--drivers/usb/host/ohci-omap.c1
-rw-r--r--drivers/usb/host/ohci-pci.c1
-rw-r--r--drivers/usb/host/ohci-pnx4008.c1
-rw-r--r--drivers/usb/host/ohci-pnx8550.c1
-rw-r--r--drivers/usb/host/ohci-ppc-of.c1
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ohci-ps3.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c1
-rw-r--r--drivers/usb/host/ohci-s3c2410.c1
-rw-r--r--drivers/usb/host/ohci-sa1111.c1
-rw-r--r--drivers/usb/host/ohci-sh.c1
-rw-r--r--drivers/usb/host/ohci-sm501.c1
-rw-r--r--drivers/usb/host/ohci-ssb.c1
-rw-r--r--drivers/usb/host/u132-hcd.c11
-rw-r--r--drivers/usb/misc/iowarrior.c1
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c1
-rw-r--r--drivers/usb/musb/Kconfig13
-rw-r--r--drivers/usb/musb/Makefile21
-rw-r--r--drivers/usb/musb/musb_core.c38
-rw-r--r--drivers/usb/musb/musb_core.h19
-rw-r--r--drivers/usb/musb/musb_debug.h4
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c2
-rw-r--r--drivers/usb/musb/musb_procfs.c830
-rw-r--r--drivers/usb/serial/garmin_gps.c2
-rw-r--r--drivers/usb/serial/option.c2
-rw-r--r--drivers/video/arkfb.c1
-rw-r--r--drivers/video/bf54x-lq043fb.c15
-rw-r--r--drivers/video/fb_defio.c19
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/pm2fb.c1
-rw-r--r--drivers/video/s3fb.c1
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c2
-rw-r--r--drivers/video/vermilion/vermilion.h1
-rw-r--r--drivers/video/vt8623fb.c1
-rw-r--r--drivers/video/xilinxfb.c1
-rw-r--r--fs/binfmt_flat.c4
-rw-r--r--fs/binfmt_misc.c4
-rw-r--r--fs/cramfs/inode.c84
-rw-r--r--fs/ext4/balloc.c3
-rw-r--r--fs/ext4/dir.c20
-rw-r--r--fs/ext4/ext4.h4
-rw-r--r--fs/ext4/ext4_extents.h4
-rw-r--r--fs/ext4/ext4_jbd2.h8
-rw-r--r--fs/ext4/extents.c113
-rw-r--r--fs/ext4/ialloc.c2
-rw-r--r--fs/ext4/inode.c478
-rw-r--r--fs/ext4/mballoc.c53
-rw-r--r--fs/ext4/migrate.c3
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/ext4/super.c1
-rw-r--r--fs/fat/inode.c10
-rw-r--r--fs/ioprio.c8
-rw-r--r--fs/jffs2/jffs2_fs_i.h1
-rw-r--r--fs/proc/nommu.c4
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--fs/xfs/xfs_dmapi.h1
-rw-r--r--include/asm-cris/Kbuild1
-rw-r--r--include/asm-frv/io.h2
-rw-r--r--include/asm-mn10300/io.h2
-rw-r--r--include/asm-x86/cpufeature.h2
-rw-r--r--include/asm-x86/msr.h27
-rw-r--r--include/asm-x86/xen/hypervisor.h1
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/exportfs.h21
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/fs_uart_pd.h1
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/libata.h24
-rw-r--r--include/linux/pci-acpi.h11
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pid.h9
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/usb.h3
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/ip6_route.h1
-rw-r--r--include/net/mac80211.h11
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/net/sch_generic.h7
-rw-r--r--include/scsi/scsi_device.h3
-rw-r--r--kernel/nsproxy.c1
-rw-r--r--kernel/power/swap.c1
-rw-r--r--kernel/rcupdate.c1
-rw-r--r--kernel/sched_features.h2
-rw-r--r--kernel/signal.c5
-rw-r--r--kernel/smp.c10
-rw-r--r--kernel/sys.c8
-rw-r--r--kernel/time/tick-sched.c6
-rw-r--r--kernel/user_namespace.c1
-rw-r--r--kernel/utsname.c1
-rw-r--r--kernel/utsname_sysctl.c1
-rw-r--r--lib/kobject.c3
-rw-r--r--mm/bootmem.c35
-rw-r--r--mm/filemap_xip.c65
-rw-r--r--mm/mm_init.c2
-rw-r--r--mm/rmap.c39
-rw-r--r--mm/swap_state.c2
-rw-r--r--net/bluetooth/af_bluetooth.c2
-rw-r--r--net/bluetooth/bnep/core.c2
-rw-r--r--net/bluetooth/hci_sysfs.c376
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/bridge/br_device.c15
-rw-r--r--net/core/datagram.c87
-rw-r--r--net/core/dev.c49
-rw-r--r--net/core/gen_estimator.c9
-rw-r--r--net/core/skbuff.c12
-rw-r--r--net/dccp/input.c12
-rw-r--r--net/ipv4/icmp.c22
-rw-r--r--net/ipv4/netfilter/ipt_addrtype.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_common.c8
-rw-r--r--net/ipv4/route.c76
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/fib6_rules.c3
-rw-r--r--net/ipv6/icmp.c23
-rw-r--r--net/ipv6/ip6_fib.c1
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c4
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/route.c12
-rw-r--r--net/ipv6/xfrm6_policy.c4
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c36
-rw-r--r--net/rfkill/rfkill.c14
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sched/sch_api.c95
-rw-r--r--net/sched/sch_cbq.c6
-rw-r--r--net/sched/sch_generic.c67
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_prio.c4
-rw-r--r--net/sched/sch_tbf.c11
-rw-r--r--net/sctp/endpointola.c4
-rw-r--r--net/sctp/ipv6.c3
-rw-r--r--net/sctp/socket.c85
-rw-r--r--scripts/mod/file2alias.c16
-rw-r--r--sound/mips/au1x00.c1
-rw-r--r--sound/pci/hda/hda_intel.c9
-rw-r--r--sound/pci/hda/patch_realtek.c6
-rw-r--r--sound/soc/at91/eti_b1_wm8731.c1
-rw-r--r--sound/soc/codecs/wm8753.c1
-rw-r--r--sound/soc/codecs/wm9712.c1
406 files changed, 4395 insertions, 3155 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 80e193d82e2e..0d5394920a31 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -26,6 +26,12 @@ Mailing list: linux-ext4@vger.kernel.org
26 26
27 git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git 27 git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
28 28
29 - Note that it is highly important to install the mke2fs.conf file
30 that comes with the e2fsprogs 1.41.x sources in /etc/mke2fs.conf. If
31 you have edited the /etc/mke2fs.conf file installed on your system,
32 you will need to merge your changes with the version from e2fsprogs
33 1.41.x.
34
29 - Create a new filesystem using the ext4dev filesystem type: 35 - Create a new filesystem using the ext4dev filesystem type:
30 36
31 # mke2fs -t ext4dev /dev/hda1 37 # mke2fs -t ext4dev /dev/hda1
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
index 488c77fa3aae..0775cf4798b2 100644
--- a/Documentation/ja_JP/HOWTO
+++ b/Documentation/ja_JP/HOWTO
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates for this file, please try 11fork. So if you have any comments or updates for this file, please try
12to update the original English file first. 12to update the original English file first.
13 13
14Last Updated: 2007/11/16 14Last Updated: 2008/08/21
15================================== 15==================================
16ã“ã‚Œã¯ã€ 16ã“ã‚Œã¯ã€
17linux-2.6.24/Documentation/HOWTO 17linux-2.6.27/Documentation/HOWTO
18ã®å’Œè¨³ã§ã™ã€‚ 18ã®å’Œè¨³ã§ã™ã€‚
19 19
20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
21翻訳日: 2007/11/10 21翻訳日: 2008/8/5
22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> 23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com>
24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -287,13 +287,15 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚
287 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–° 287 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–°
288 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ 288 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚
289 289
290 - 以下㮠URL ã§å„ -rc リリースã«å­˜åœ¨ã™ã‚‹æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œã®ãƒªã‚¹ãƒˆ
291 ãŒè¿½è·¡ã•ã‚Œã¾ã™-
292 http://kernelnewbies.org/known_regressions
293
294 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ 290 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾
295 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ 291 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚
296 292
293 - å„リリースã§ã®æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œ(regression: ã“ã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸­ã§æ–°è¦
294 ã«ä½œã‚Šè¾¼ã¾ã‚ŒãŸå•é¡Œã‚’指ã™) ã¯ãã®éƒ½åº¦ Linux-kernel メーリングリスト
295 ã«æŠ•ç¨¿ã•ã‚Œã¾ã™ã€‚ゴールã¨ã—ã¦ã¯ã€ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨å®£è¨€
296 ã™ã‚‹å‰ã«ã“ã®ãƒªã‚¹ãƒˆã®é•·ã•ã‚’ゼロã«æ¸›ã‚‰ã™ã“ã¨ã§ã™ãŒã€ç¾å®Ÿã«ã¯ã€æ•°å€‹ã®
297 後戻りå•é¡ŒãŒãƒªãƒªãƒ¼ã‚¹æ™‚ã«ãŸã³ãŸã³æ®‹ã£ã¦ã—ã¾ã„ã¾ã™ã€‚
298
297Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ 299Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„
298ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™- 300ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™-
299 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾ 301 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾
@@ -303,18 +305,20 @@ Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã
3032.6.x.y -stable カーãƒãƒ«ãƒ„リー 3052.6.x.y -stable カーãƒãƒ«ãƒ„リー
304--------------------------- 306---------------------------
305 307
306ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«4ã¤ç›®ã®æ•°å­—ãŒã¤ã„ãŸã‚«ãƒ¼ãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ã“れ㫠308ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ4ã¤ã®æ•°å­—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚
307ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ã™ã‚‹æ¯” 309ã“ã‚Œã«ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾
308較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚ 310ã™ã‚‹æ¯”較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚
309 311
310ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠312ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ãã€
311最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ 313最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚
312 314
313ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x 315ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x ãŒ
314ãŒæœ€æ–°ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ 316最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚
315 317
3162.6.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€ã  3182.6.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€å¿…
317ã„ãŸã„隔週ã§ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¦ã„ã¾ã™ã€‚ 319è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—è¿«ã£
320ãŸå•é¡ŒãŒãªã‘ã‚Œã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚ã‚Šã¾ã™ã€‚セキュリティ関連ã®å•é¡Œ
321ã®å ´åˆã¯ã“ã‚Œã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•ã‚Œã¾ã™ã€‚
318 322
319カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ 323カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ
320イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª 324イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª
@@ -341,7 +345,9 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
341メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚ 345メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚
342 346
343メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ 347メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ
344ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¾ã™ã€‚ 348ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¦ã„ã¾ã™ã€‚マージウィン
349ドウãŒé–‹ãå‰ã« -mm ツリーã«ç¾ã‚Œãªã‹ã£ãŸãƒ‘ッãƒã¯ãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã«ãƒžãƒ¼ã‚¸ã•
350れるã“ã¨ã¯å›°é›£ã«ãªã‚Šã¾ã™ã€‚
345 351
346ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚ 352ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚
347ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸­ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚ 353ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸­ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚
@@ -395,13 +401,15 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
395 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> 401 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
396 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git 402 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
397 403
398 - SCSI, James Bottomley <James.Bottomley@SteelEye.com> 404 - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com>
399 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git 405 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
400 406
407 - x86, Ingo Molnar <mingo@elte.hu>
408 git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
409
401 quilt ツリー- 410 quilt ツリー-
402 - USB, PCI ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de> 411 - USB, ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de>
403 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 412 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
404 - x86-64 㨠i386 ã®ä»²é–“ Andi Kleen <ak@suse.de>
405 413
406 ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ 414 ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ
407 イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚ 415 イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚
@@ -412,13 +420,32 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
412bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ 420bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹
413場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ 421場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚
414ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- 422ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„-
415 http://test.kernel.org/bugzilla/faq.html 423 http://bugzilla.kernel.org/page.cgi?id=faq.html
416
417メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ 424メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ
418ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å• 425ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å•
419é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ 426é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³
420ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ 427ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚
421 428
429ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç†
430-------------------
431
432ã‚ãªãŸã®ãƒãƒƒã‚­ãƒ³ã‚°ã®ã‚¹ã‚­ãƒ«ã‚’訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼
433トã—ãŸãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ãŒã‚ã‚Šã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹
434ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•é¡Œã‚’修正ã™ã‚‹ã“ã¨ã‚’
435å­¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚­ãƒ«ã‚‚強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å­˜åœ¨ã«æ°—ãŒã¤ã
436ã¾ã™ã€‚ãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸­ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善
437ã®é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ­£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好ã¾
438ãªã„ã‹ã‚‰ã§ã™ã€‚
439
440ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•ã‚ŒãŸãƒã‚°ã®ãŸã‚ã«ä»•äº‹ã‚’ã™ã‚‹ãŸã‚ã«ã¯ã€
441http://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã«
442ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚ã‚Œã°ã€bugme-new メーリングリスト(æ–°ã—
443ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹) ã¾ãŸã¯ bugme-janitor メーリン
444グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹)を購読ã§ãã¾ã™ã€‚
445
446 http://lists.linux-foundation.org/mailman/listinfo/bugme-new
447 http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
448
422メーリングリスト 449メーリングリスト
423------------- 450-------------
424 451
diff --git a/Documentation/ja_JP/SubmitChecklist b/Documentation/ja_JP/SubmitChecklist
new file mode 100644
index 000000000000..6c42e071d723
--- /dev/null
+++ b/Documentation/ja_JP/SubmitChecklist
@@ -0,0 +1,111 @@
1NOTE:
2This is a version of Documentation/SubmitChecklist into Japanese.
3This document is maintained by Takenori Nagano <t-nagano@ah.jp.nec.com>
4and the JF Project team <http://www.linux.or.jp/JF/>.
5If you find any difference between this document and the original file
6or a problem with the translation,
7please contact the maintainer of this file or JF project.
8
9Please also note that the purpose of this file is to be easier to read
10for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates of this file, please try
12to update the original English file first.
13
14Last Updated: 2008/07/14
15==================================
16ã“ã‚Œã¯ã€
17linux-2.6.26/Documentation/SubmitChecklist ã®å’Œè¨³ã§ã™ã€‚
18
19翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
20翻訳日: 2008/07/14
21翻訳者: Takenori Nagano <t-nagano at ah dot jp dot nec dot com>
22校正者: Masanori Kobayashi ã•ã‚“ <zap03216 at nifty dot ne dot jp>
23==================================
24
25
26Linux カーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿è€…å‘ã‘ãƒã‚§ãƒƒã‚¯ãƒªã‚¹ãƒˆ
27~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28
29本書ã§ã¯ã€ãƒ‘ッãƒã‚’より素早ãå–り込んã§ã‚‚らã„ãŸã„開発者ãŒå®Ÿè·µã™ã¹ã基本的ãªäº‹æŸ„
30ã‚’ã„ãã¤ã‹ç´¹ä»‹ã—ã¾ã™ã€‚ã“ã“ã«ã‚ã‚‹å…¨ã¦ã®äº‹æŸ„ã¯ã€Documentation/SubmittingPatches
31ãªã©ã®Linuxカーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿ã«éš›ã—ã¦ã®å¿ƒå¾—を補足ã™ã‚‹ã‚‚ã®ã§ã™ã€‚
32
33 1: 妥当ãªCONFIGオプションや変更ã•ã‚ŒãŸCONFIGオプションã€ã¤ã¾ã‚Š =y, =m, =n
34 å…¨ã¦ã§æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。ãã®éš›ã€gccåŠã³ãƒªãƒ³ã‚«ãŒ
35 warningã‚„errorを出ã—ã¦ã„ãªã„ã“ã¨ã‚‚確èªã—ã¦ãã ã•ã„。
36
37 2: allnoconfig, allmodconfig オプションを用ã„ã¦æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’
38 確èªã—ã¦ãã ã•ã„。
39
40 3: 手許ã®ã‚¯ãƒ­ã‚¹ã‚³ãƒ³ãƒ‘イルツールやOSDLã®PLMã®ã‚ˆã†ãªã‚‚ã®ã‚’用ã„ã¦ã€è¤‡æ•°ã®
41 アーキテクãƒãƒ£ã«ãŠã„ã¦ã‚‚æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
42
43 4: 64bité•·ã®'unsigned long'を使用ã—ã¦ã„ã‚‹ppc64ã¯ã€ã‚¯ãƒ­ã‚¹ã‚³ãƒ³ãƒ‘イルã§ã®
44 ãƒã‚§ãƒƒã‚¯ã«é©å½“ãªã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ã™ã€‚
45
46 5: カーãƒãƒ«ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã«æº–æ‹ ã—ã¦ã„ã‚‹ã‹ã©ã†ã‹ç¢ºèªã—ã¦ãã ã•ã„(!)
47
48 6: CONFIGオプションã®è¿½åŠ ãƒ»å¤‰æ›´ã‚’ã—ãŸå ´åˆã«ã¯ã€CONFIGメニューãŒå£Šã‚Œã¦ã„ãªã„
49 ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
50
51 7: æ–°ã—ãKconfigã®ã‚ªãƒ—ションを追加ã™ã‚‹éš›ã«ã¯ã€å¿…ãšãã®helpも記述ã—ã¦ãã ã•ã„。
52
53 8: é©åˆ‡ãªKconfigã®ä¾å­˜é–¢ä¿‚を考ãˆãªãŒã‚‰æ…Žé‡ã«ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„。
54 ãŸã ã—ã€ã“ã®ä½œæ¥­ã¯ãƒžã‚·ãƒ³ã‚’使ã£ãŸãƒ†ã‚¹ãƒˆã§ãã¡ã‚“ã¨è¡Œã†ã®ãŒã¨ã¦ã‚‚困難ã§ã™ã€‚
55 ã†ã¾ãã‚„ã‚‹ã«ã¯ã€è‡ªåˆ†ã®é ­ã§è€ƒãˆã‚‹ã“ã¨ã§ã™ã€‚
56
57 9: sparseを利用ã—ã¦ã¡ã‚ƒã‚“ã¨ã—ãŸã‚³ãƒ¼ãƒ‰ãƒã‚§ãƒƒã‚¯ã‚’ã—ã¦ãã ã•ã„。
58
5910: 'make checkstack' 㨠'make namespacecheck' を利用ã—ã€å•é¡ŒãŒç™ºè¦‹ã•ã‚ŒãŸã‚‰
60 修正ã—ã¦ãã ã•ã„。'make checkstack' ã¯æ˜Žç¤ºçš„ã«å•é¡Œã‚’示ã—ã¾ã›ã‚“ãŒã€ã©ã‚Œã‹
61 1ã¤ã®é–¢æ•°ãŒ512ãƒã‚¤ãƒˆã‚ˆã‚Šå¤§ãã„スタックを使ã£ã¦ã„ã‚Œã°ã€ä¿®æ­£ã™ã¹ã候補ã¨
62 ãªã‚Šã¾ã™ã€‚
63
6411: グローãƒãƒ«ãªkernel API を説明ã™ã‚‹ kernel-doc をソースã®ä¸­ã«å«ã‚ã¦ãã ã•ã„。
65 ( staticãªé–¢æ•°ã«ãŠã„ã¦ã¯å¿…é ˆã§ã¯ã‚ã‚Šã¾ã›ã‚“ãŒã€å«ã‚ã¦ã‚‚らã£ã¦ã‚‚çµæ§‹ã§ã™ )
66 ãã—ã¦ã€'make htmldocs' ã‚‚ã—ã㯠'make mandocs' を利用ã—ã¦è¿½è¨˜ã—ãŸ
67 ドキュメントã®ãƒã‚§ãƒƒã‚¯ã‚’è¡Œã„ã€å•é¡ŒãŒè¦‹ã¤ã‹ã£ãŸå ´åˆã«ã¯ä¿®æ­£ã‚’è¡Œã£ã¦ãã ã•ã„。
68
6912: CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB,
70 CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_SPINLOCK,
71 CONFIG_DEBUG_SPINLOCK_SLEEP ã“れら全ã¦ã‚’åŒæ™‚ã«æœ‰åŠ¹ã«ã—ã¦å‹•ä½œç¢ºèªã‚’
72 è¡Œã£ã¦ãã ã•ã„。
73
7413: CONFIG_SMP, CONFIG_PREEMPT を有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§
75 ビルドã—ãŸä¸Šã€å‹•ä½œç¢ºèªã‚’è¡Œã£ã¦ãã ã•ã„。
76
7714: ã‚‚ã—パッãƒãŒãƒ‡ã‚£ã‚¹ã‚¯ã®I/O性能ãªã©ã«å½±éŸ¿ã‚’与ãˆã‚‹ã‚ˆã†ã§ã‚ã‚Œã°ã€
78 'CONFIG_LBD'オプションを有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§
79 テストを実施ã—ã¦ã¿ã¦ãã ã•ã„。
80
8115: lockdepã®æ©Ÿèƒ½ã‚’å…¨ã¦æœ‰åŠ¹ã«ã—ãŸä¸Šã§ã€å…¨ã¦ã®ã‚³ãƒ¼ãƒ‰ãƒ‘スを評価ã—ã¦ãã ã•ã„。
82
8316: /proc ã«æ–°ã—ã„エントリを追加ã—ãŸå ´åˆã«ã¯ã€Documentation/ é…下ã«
84 å¿…ãšãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’追加ã—ã¦ãã ã•ã„。
85
8617: æ–°ã—ã„ブートパラメータを追加ã—ãŸå ´åˆã«ã¯ã€
87 å¿…ãšDocumentation/kernel-parameters.txt ã«èª¬æ˜Žã‚’追加ã—ã¦ãã ã•ã„。
88
8918: æ–°ã—ãmoduleã«ãƒ‘ラメータを追加ã—ãŸå ´åˆã«ã¯ã€MODULE_PARM_DESC()ã‚’
90 利用ã—ã¦å¿…ãšãã®èª¬æ˜Žã‚’記述ã—ã¦ãã ã•ã„。
91
9219: æ–°ã—ã„userspaceインタフェースを作æˆã—ãŸå ´åˆã«ã¯ã€Documentation/ABI/ ã«
93 Documentation/ABI/README ã‚’å‚考ã«ã—ã¦å¿…ãšãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’追加ã—ã¦ãã ã•ã„。
94
9520: 'make headers_check'を実行ã—ã¦å…¨ãå•é¡ŒãŒãªã„ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
96
9721: å°‘ãªãã¨ã‚‚slabアロケーションã¨pageアロケーションã«å¤±æ•—ã—ãŸå ´åˆã®
98 挙動ã«ã¤ã„ã¦ã€fault-injectionを利用ã—ã¦ç¢ºèªã—ã¦ãã ã•ã„。
99 Documentation/fault-injection/ ã‚’å‚ç…§ã—ã¦ãã ã•ã„。
100
101 追加ã—ãŸã‚³ãƒ¼ãƒ‰ãŒã‹ãªã‚Šã®é‡ã§ã‚ã£ãŸãªã‚‰ã°ã€ã‚µãƒ–システム特有ã®
102 fault-injectionを追加ã—ãŸã»ã†ãŒè‰¯ã„ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。
103
10422: æ–°ãŸã«è¿½åŠ ã—ãŸã‚³ãƒ¼ãƒ‰ã¯ã€`gcc -W'ã§ã‚³ãƒ³ãƒ‘イルã—ã¦ãã ã•ã„。
105 ã“ã®ã‚ªãƒ—ションã¯å¤§é‡ã®ä¸è¦ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’出力ã—ã¾ã™ãŒã€
106 "warning: comparison between signed and unsigned" ã®ã‚ˆã†ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯ã€
107 ãƒã‚°ã‚’見ã¤ã‘ã‚‹ã®ã«å½¹ã«ç«‹ã¡ã¾ã™ã€‚
108
10923: 投稿ã—ãŸãƒ‘ッãƒãŒ -mm パッãƒã‚»ãƒƒãƒˆã«ãƒžãƒ¼ã‚¸ã•ã‚ŒãŸå¾Œã€å…¨ã¦ã®æ—¢å­˜ã®ãƒ‘ッãƒã‚„
110 VM, VFS ãŠã‚ˆã³ãã®ä»–ã®ã‚µãƒ–システムã«é–¢ã™ã‚‹æ§˜ã€…ãªå¤‰æ›´ã¨ã€ç¾æ™‚点ã§ã‚‚共存
111 ã§ãã‚‹ã“ã¨ã‚’確èªã™ã‚‹ãƒ†ã‚¹ãƒˆã‚’è¡Œã£ã¦ãã ã•ã„。
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e7bea3e85304..1150444a21ab 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -365,6 +365,8 @@ and is between 256 and 4096 characters. It is defined in the file
365 no delay (0). 365 no delay (0).
366 Format: integer 366 Format: integer
367 367
368 bootmem_debug [KNL] Enable bootmem allocator debug messages.
369
368 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) 370 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards)
369 bttv.radio= Most important insmod options are available as 371 bttv.radio= Most important insmod options are available as
370 kernel args too. 372 kernel args too.
@@ -1072,6 +1074,9 @@ and is between 256 and 4096 characters. It is defined in the file
1072 1074
1073 * [no]ncq: Turn on or off NCQ. 1075 * [no]ncq: Turn on or off NCQ.
1074 1076
1077 * nohrst, nosrst, norst: suppress hard, soft
1078 and both resets.
1079
1075 If there are multiple matching configurations changing 1080 If there are multiple matching configurations changing
1076 the same attribute, the last one is used. 1081 the same attribute, the last one is used.
1077 1082
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
index 28b6ec87c642..6fcb3060dec5 100644
--- a/Documentation/rfkill.txt
+++ b/Documentation/rfkill.txt
@@ -363,6 +363,11 @@ This rule exists because users of the rfkill subsystem expect to get (and set,
363when possible) the overall transmitter rfkill state, not of a particular rfkill 363when possible) the overall transmitter rfkill state, not of a particular rfkill
364line. 364line.
365 365
3665. During suspend, the rfkill class will attempt to soft-block the radio
367through a call to rfkill->toggle_radio, and will try to restore its previous
368state during resume. After a rfkill class is suspended, it will *not* call
369rfkill->toggle_radio until it is resumed.
370
366Example of a WLAN wireless driver connected to the rfkill subsystem: 371Example of a WLAN wireless driver connected to the rfkill subsystem:
367-------------------------------------------------------------------- 372--------------------------------------------------------------------
368 373
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas
index 716fcc1cafb5..c851ef497795 100644
--- a/Documentation/scsi/ChangeLog.megaraid_sas
+++ b/Documentation/scsi/ChangeLog.megaraid_sas
@@ -1,3 +1,26 @@
1
21 Release Date : Thur.July. 24 11:41:51 PST 2008 -
3 (emaild-id:megaraidlinux@lsi.com)
4 Sumant Patro
5 Bo Yang
6
72 Current Version : 00.00.04.01
83 Older Version : 00.00.03.22
9
101. Add the new controller (0078, 0079) support to the driver
11 Those controllers are LSI's next generatation(gen2) SAS controllers.
12
131 Release Date : Mon.June. 23 10:12:45 PST 2008 -
14 (emaild-id:megaraidlinux@lsi.com)
15 Sumant Patro
16 Bo Yang
17
182 Current Version : 00.00.03.22
193 Older Version : 00.00.03.20
20
211. Add shutdown DCMD cmd to the shutdown routine to make FW shutdown proper.
222. Unexpected interrupt occurs in HWR Linux driver, add the dumy readl pci flush will fix this issue.
23
11 Release Date : Mon. March 10 11:02:31 PDT 2008 - 241 Release Date : Mon. March 10 11:02:31 PDT 2008 -
2 (emaild-id:megaraidlinux@lsi.com) 25 (emaild-id:megaraidlinux@lsi.com)
3 Sumant Patro 26 Sumant Patro
diff --git a/MAINTAINERS b/MAINTAINERS
index 663485b004fb..28c69aaefcd9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -942,94 +942,19 @@ M: joern@lazybastard.org
942L: linux-mtd@lists.infradead.org 942L: linux-mtd@lists.infradead.org
943S: Maintained 943S: Maintained
944 944
945BLUETOOTH SUBSYSTEM 945BLUETOOTH DRIVERS
946P: Marcel Holtmann 946P: Marcel Holtmann
947M: marcel@holtmann.org 947M: marcel@holtmann.org
948P: Maxim Krasnyansky
949M: maxk@qualcomm.com
950L: linux-bluetooth@vger.kernel.org 948L: linux-bluetooth@vger.kernel.org
951W: http://bluez.sf.net 949W: http://www.bluez.org/
952W: http://www.bluez.org
953W: http://www.holtmann.org/linux/bluetooth/
954T: git kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git
955S: Maintained
956
957BLUETOOTH RFCOMM LAYER
958P: Marcel Holtmann
959M: marcel@holtmann.org
960P: Maxim Krasnyansky
961M: maxk@qualcomm.com
962S: Maintained
963
964BLUETOOTH BNEP LAYER
965P: Marcel Holtmann
966M: marcel@holtmann.org
967P: Maxim Krasnyansky
968M: maxk@qualcomm.com
969S: Maintained
970
971BLUETOOTH CMTP LAYER
972P: Marcel Holtmann
973M: marcel@holtmann.org
974S: Maintained 950S: Maintained
975 951
976BLUETOOTH HIDP LAYER 952BLUETOOTH SUBSYSTEM
977P: Marcel Holtmann
978M: marcel@holtmann.org
979S: Maintained
980
981BLUETOOTH HCI UART DRIVER
982P: Marcel Holtmann
983M: marcel@holtmann.org
984P: Maxim Krasnyansky
985M: maxk@qualcomm.com
986S: Maintained
987
988BLUETOOTH HCI USB DRIVER
989P: Marcel Holtmann
990M: marcel@holtmann.org
991P: Maxim Krasnyansky
992M: maxk@qualcomm.com
993S: Maintained
994
995BLUETOOTH HCI BCM203X DRIVER
996P: Marcel Holtmann
997M: marcel@holtmann.org
998S: Maintained
999
1000BLUETOOTH HCI BPA10X DRIVER
1001P: Marcel Holtmann
1002M: marcel@holtmann.org
1003S: Maintained
1004
1005BLUETOOTH HCI BFUSB DRIVER
1006P: Marcel Holtmann
1007M: marcel@holtmann.org
1008S: Maintained
1009
1010BLUETOOTH HCI DTL1 DRIVER
1011P: Marcel Holtmann
1012M: marcel@holtmann.org
1013S: Maintained
1014
1015BLUETOOTH HCI BLUECARD DRIVER
1016P: Marcel Holtmann
1017M: marcel@holtmann.org
1018S: Maintained
1019
1020BLUETOOTH HCI BT3C DRIVER
1021P: Marcel Holtmann
1022M: marcel@holtmann.org
1023S: Maintained
1024
1025BLUETOOTH HCI BTUART DRIVER
1026P: Marcel Holtmann 953P: Marcel Holtmann
1027M: marcel@holtmann.org 954M: marcel@holtmann.org
1028S: Maintained 955L: linux-bluetooth@vger.kernel.org
1029 956W: http://www.bluez.org/
1030BLUETOOTH HCI VHCI DRIVER 957T: git kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git
1031P: Maxim Krasnyansky
1032M: maxk@qualcomm.com
1033S: Maintained 958S: Maintained
1034 959
1035BONDING DRIVER 960BONDING DRIVER
diff --git a/Makefile b/Makefile
index 53bf6ec1af9d..2e15e0b4483d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 27 3SUBLEVEL = 27
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0a7b3267c8d8..3c8383dbe9e6 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -405,7 +405,7 @@ static int impd1_probe(struct lm_device *dev)
405 405
406 ret = amba_device_register(d, &dev->resource); 406 ret = amba_device_register(d, &dev->resource);
407 if (ret) { 407 if (ret) {
408 dev_err(&d->dev, "unable to register device: %d\n"); 408 dev_err(&d->dev, "unable to register device: %d\n", ret);
409 kfree(d); 409 kfree(d);
410 } 410 }
411 } 411 }
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 0db3a909ae61..501dfdcc39fe 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -64,7 +64,7 @@ static struct platform_device fsg_i2c_gpio = {
64 64
65static struct i2c_board_info __initdata fsg_i2c_board_info [] = { 65static struct i2c_board_info __initdata fsg_i2c_board_info [] = {
66 { 66 {
67 I2C_BOARD_INFO("rtc-isl1208", 0x6f), 67 I2C_BOARD_INFO("isl1208", 0x6f),
68 }, 68 },
69}; 69};
70 70
@@ -179,7 +179,6 @@ static void __init fsg_init(void)
179{ 179{
180 DECLARE_MAC_BUF(mac_buf); 180 DECLARE_MAC_BUF(mac_buf);
181 uint8_t __iomem *f; 181 uint8_t __iomem *f;
182 int i;
183 182
184 ixp4xx_sys_init(); 183 ixp4xx_sys_init();
185 184
@@ -228,6 +227,7 @@ static void __init fsg_init(void)
228 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000); 227 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000);
229 if (f) { 228 if (f) {
230#ifdef __ARMEB__ 229#ifdef __ARMEB__
230 int i;
231 for (i = 0; i < 6; i++) { 231 for (i = 0; i < 6; i++) {
232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i); 232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i);
233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i); 233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i);
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index c01eea88f787..ca8e20538157 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -125,3 +125,28 @@ void clks_register(struct clk *clks, size_t num)
125 list_add(&clks[i].node, &clocks); 125 list_add(&clks[i].node, &clocks);
126 mutex_unlock(&clocks_mutex); 126 mutex_unlock(&clocks_mutex);
127} 127}
128
129int clk_add_alias(char *alias, struct device *alias_dev, char *id,
130 struct device *dev)
131{
132 struct clk *r = clk_lookup(dev, id);
133 struct clk *new;
134
135 if (!r)
136 return -ENODEV;
137
138 new = kzalloc(sizeof(struct clk), GFP_KERNEL);
139
140 if (!new)
141 return -ENOMEM;
142
143 new->name = alias;
144 new->dev = alias_dev;
145 new->other = r;
146
147 mutex_lock(&clocks_mutex);
148 list_add(&new->node, &clocks);
149 mutex_unlock(&clocks_mutex);
150
151 return 0;
152}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 1ec8f9178aaf..73be795fe3bf 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -1,3 +1,5 @@
1#include <linux/list.h>
2
1struct clk; 3struct clk;
2 4
3struct clkops { 5struct clkops {
@@ -86,3 +88,6 @@ extern void clk_pxa3xx_cken_disable(struct clk *);
86#endif 88#endif
87 89
88void clks_register(struct clk *clks, size_t num); 90void clks_register(struct clk *clks, size_t num);
91int clk_add_alias(char *alias, struct device *alias_dev, char *id,
92 struct device *dev);
93
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 03942450885b..001a252bd514 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -10,18 +10,78 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/kernel.h>
13#include <linux/init.h> 14#include <linux/init.h>
14 15
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <mach/hardware.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19 19
20#include <mach/mfp-pxa25x.h>
21#include <mach/hardware.h>
22
20#include "generic.h" 23#include "generic.h"
21 24
25static unsigned long e740_pin_config[] __initdata = {
26 /* Chip selects */
27 GPIO15_nCS_1, /* CS1 - Flash */
28 GPIO79_nCS_3, /* CS3 - IMAGEON */
29 GPIO80_nCS_4, /* CS4 - TMIO */
30
31 /* Clocks */
32 GPIO12_32KHz,
33
34 /* BTUART */
35 GPIO42_BTUART_RXD,
36 GPIO43_BTUART_TXD,
37 GPIO44_BTUART_CTS,
38 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */
39
40 /* PC Card */
41 GPIO8_GPIO, /* CD0 */
42 GPIO44_GPIO, /* CD1 */
43 GPIO11_GPIO, /* IRQ0 */
44 GPIO6_GPIO, /* IRQ1 */
45 GPIO27_GPIO, /* RST0 */
46 GPIO24_GPIO, /* RST1 */
47 GPIO20_GPIO, /* PWR0 */
48 GPIO23_GPIO, /* PWR1 */
49 GPIO48_nPOE,
50 GPIO49_nPWE,
51 GPIO50_nPIOR,
52 GPIO51_nPIOW,
53 GPIO52_nPCE_1,
54 GPIO53_nPCE_2,
55 GPIO54_nPSKTSEL,
56 GPIO55_nPREG,
57 GPIO56_nPWAIT,
58 GPIO57_nIOIS16,
59
60 /* wakeup */
61 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
62};
63
64static unsigned long e400_pin_config[] __initdata = {
65 /* Chip selects */
66 GPIO15_nCS_1, /* CS1 - Flash */
67 GPIO80_nCS_4, /* CS4 - TMIO */
68
69 /* Clocks */
70 GPIO12_32KHz,
71
72 /* BTUART */
73 GPIO42_BTUART_RXD,
74 GPIO43_BTUART_TXD,
75 GPIO44_BTUART_CTS,
76 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */
77
78 /* wakeup */
79 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
80};
81
22/* Only e800 has 128MB RAM */ 82/* Only e800 has 128MB RAM */
23static void __init eseries_fixup(struct machine_desc *desc, 83static void __init eseries_fixup(struct machine_desc *desc,
24 struct tag *tags, char **cmdline, struct meminfo *mi) 84 struct tag *tags, char **cmdline, struct meminfo *mi)
25{ 85{
26 mi->nr_banks=1; 86 mi->nr_banks=1;
27 mi->bank[0].start = 0xa0000000; 87 mi->bank[0].start = 0xa0000000;
@@ -32,83 +92,95 @@ static void __init eseries_fixup(struct machine_desc *desc,
32 mi->bank[0].size = (64*1024*1024); 92 mi->bank[0].size = (64*1024*1024);
33} 93}
34 94
95static void __init e740_init(void)
96{
97 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
98}
99
100static void __init e400_init(void)
101{
102 pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
103}
104
35/* e-series machine definitions */ 105/* e-series machine definitions */
36 106
37#ifdef CONFIG_MACH_E330 107#ifdef CONFIG_MACH_E330
38MACHINE_START(E330, "Toshiba e330") 108MACHINE_START(E330, "Toshiba e330")
39 /* Maintainer: Ian Molton (spyro@f2s.com) */ 109 /* Maintainer: Ian Molton (spyro@f2s.com) */
40 .phys_io = 0x40000000, 110 .phys_io = 0x40000000,
41 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 111 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
42 .boot_params = 0xa0000100, 112 .boot_params = 0xa0000100,
43 .map_io = pxa_map_io, 113 .map_io = pxa_map_io,
44 .init_irq = pxa25x_init_irq, 114 .init_irq = pxa25x_init_irq,
45 .fixup = eseries_fixup, 115 .fixup = eseries_fixup,
46 .timer = &pxa_timer, 116 .timer = &pxa_timer,
47MACHINE_END 117MACHINE_END
48#endif 118#endif
49 119
50#ifdef CONFIG_MACH_E350 120#ifdef CONFIG_MACH_E350
51MACHINE_START(E350, "Toshiba e350") 121MACHINE_START(E350, "Toshiba e350")
52 /* Maintainer: Ian Molton (spyro@f2s.com) */ 122 /* Maintainer: Ian Molton (spyro@f2s.com) */
53 .phys_io = 0x40000000, 123 .phys_io = 0x40000000,
54 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 124 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
55 .boot_params = 0xa0000100, 125 .boot_params = 0xa0000100,
56 .map_io = pxa_map_io, 126 .map_io = pxa_map_io,
57 .init_irq = pxa25x_init_irq, 127 .init_irq = pxa25x_init_irq,
58 .fixup = eseries_fixup, 128 .fixup = eseries_fixup,
59 .timer = &pxa_timer, 129 .timer = &pxa_timer,
60MACHINE_END 130MACHINE_END
61#endif 131#endif
62 132
63#ifdef CONFIG_MACH_E740 133#ifdef CONFIG_MACH_E740
64MACHINE_START(E740, "Toshiba e740") 134MACHINE_START(E740, "Toshiba e740")
65 /* Maintainer: Ian Molton (spyro@f2s.com) */ 135 /* Maintainer: Ian Molton (spyro@f2s.com) */
66 .phys_io = 0x40000000, 136 .phys_io = 0x40000000,
67 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 137 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
68 .boot_params = 0xa0000100, 138 .boot_params = 0xa0000100,
69 .map_io = pxa_map_io, 139 .map_io = pxa_map_io,
70 .init_irq = pxa25x_init_irq, 140 .init_irq = pxa25x_init_irq,
71 .fixup = eseries_fixup, 141 .fixup = eseries_fixup,
72 .timer = &pxa_timer, 142 .init_machine = e740_init,
143 .timer = &pxa_timer,
73MACHINE_END 144MACHINE_END
74#endif 145#endif
75 146
76#ifdef CONFIG_MACH_E750 147#ifdef CONFIG_MACH_E750
77MACHINE_START(E750, "Toshiba e750") 148MACHINE_START(E750, "Toshiba e750")
78 /* Maintainer: Ian Molton (spyro@f2s.com) */ 149 /* Maintainer: Ian Molton (spyro@f2s.com) */
79 .phys_io = 0x40000000, 150 .phys_io = 0x40000000,
80 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 151 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
81 .boot_params = 0xa0000100, 152 .boot_params = 0xa0000100,
82 .map_io = pxa_map_io, 153 .map_io = pxa_map_io,
83 .init_irq = pxa25x_init_irq, 154 .init_irq = pxa25x_init_irq,
84 .fixup = eseries_fixup, 155 .fixup = eseries_fixup,
85 .timer = &pxa_timer, 156 .timer = &pxa_timer,
86MACHINE_END 157MACHINE_END
87#endif 158#endif
88 159
89#ifdef CONFIG_MACH_E400 160#ifdef CONFIG_MACH_E400
90MACHINE_START(E400, "Toshiba e400") 161MACHINE_START(E400, "Toshiba e400")
91 /* Maintainer: Ian Molton (spyro@f2s.com) */ 162 /* Maintainer: Ian Molton (spyro@f2s.com) */
92 .phys_io = 0x40000000, 163 .phys_io = 0x40000000,
93 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 164 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
94 .boot_params = 0xa0000100, 165 .boot_params = 0xa0000100,
95 .map_io = pxa_map_io, 166 .map_io = pxa_map_io,
96 .init_irq = pxa25x_init_irq, 167 .init_irq = pxa25x_init_irq,
97 .fixup = eseries_fixup, 168 .fixup = eseries_fixup,
98 .timer = &pxa_timer, 169 .init_machine = e400_init,
170 .timer = &pxa_timer,
99MACHINE_END 171MACHINE_END
100#endif 172#endif
101 173
102#ifdef CONFIG_MACH_E800 174#ifdef CONFIG_MACH_E800
103MACHINE_START(E800, "Toshiba e800") 175MACHINE_START(E800, "Toshiba e800")
104 /* Maintainer: Ian Molton (spyro@f2s.com) */ 176 /* Maintainer: Ian Molton (spyro@f2s.com) */
105 .phys_io = 0x40000000, 177 .phys_io = 0x40000000,
106 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 178 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
107 .boot_params = 0xa0000100, 179 .boot_params = 0xa0000100,
108 .map_io = pxa_map_io, 180 .map_io = pxa_map_io,
109 .init_irq = pxa25x_init_irq, 181 .init_irq = pxa25x_init_irq,
110 .fixup = eseries_fixup, 182 .fixup = eseries_fixup,
111 .timer = &pxa_timer, 183 .timer = &pxa_timer,
112MACHINE_END 184MACHINE_END
113#endif 185#endif
114 186
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 32772bc6925c..108b5db9b2af 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -183,6 +183,7 @@
183 defined(CONFIG_MACH_TOSA) || \ 183 defined(CONFIG_MACH_TOSA) || \
184 defined(CONFIG_MACH_MAINSTONE) || \ 184 defined(CONFIG_MACH_MAINSTONE) || \
185 defined(CONFIG_MACH_PCM027) || \ 185 defined(CONFIG_MACH_PCM027) || \
186 defined(CONFIG_ARCH_PXA_ESERIES) || \
186 defined(CONFIG_MACH_MAGICIAN) 187 defined(CONFIG_MACH_MAGICIAN)
187#define NR_IRQS (IRQ_BOARD_END) 188#define NR_IRQS (IRQ_BOARD_END)
188#elif defined(CONFIG_MACH_ZYLONITE) 189#elif defined(CONFIG_MACH_ZYLONITE)
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index bb9e09208b9f..4ffdff2d9ff1 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -52,6 +52,7 @@
52#include <mach/mmc.h> 52#include <mach/mmc.h>
53 53
54#include "generic.h" 54#include "generic.h"
55#include "clock.h"
55#include "devices.h" 56#include "devices.h"
56 57
57static unsigned long lubbock_pin_config[] __initdata = { 58static unsigned long lubbock_pin_config[] __initdata = {
@@ -485,6 +486,7 @@ static void __init lubbock_init(void)
485 486
486 pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config)); 487 pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
487 488
489 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
488 pxa_set_udc_info(&udc_info); 490 pxa_set_udc_info(&udc_info);
489 set_pxa_fb_info(&sharp_lm8v31); 491 set_pxa_fb_info(&sharp_lm8v31);
490 pxa_set_mci_info(&lubbock_mci_platform_data); 492 pxa_set_mci_info(&lubbock_mci_platform_data);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9e5d8a8c6424..305452b56e91 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -166,8 +166,7 @@ static struct clk pxa25x_hwuart_clk =
166; 166;
167 167
168/* 168/*
169 * PXA 2xx clock declarations. Order is important (see aliases below) 169 * PXA 2xx clock declarations.
170 * Please be careful not to disrupt the ordering.
171 */ 170 */
172static struct clk pxa25x_clks[] = { 171static struct clk pxa25x_clks[] = {
173 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 172 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
@@ -194,11 +193,6 @@ static struct clk pxa25x_clks[] = {
194 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 193 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
195}; 194};
196 195
197static struct clk pxa2xx_clk_aliases[] = {
198 INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
199 INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
200};
201
202#ifdef CONFIG_PM 196#ifdef CONFIG_PM
203 197
204#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 198#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
@@ -375,8 +369,6 @@ static int __init pxa25x_init(void)
375 if (cpu_is_pxa255()) 369 if (cpu_is_pxa255())
376 ret = platform_device_register(&pxa_device_hwuart); 370 ret = platform_device_register(&pxa_device_hwuart);
377 371
378 clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
379
380 return ret; 372 return ret;
381} 373}
382 374
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 494fc1f032db..9adc7fc4618a 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -90,7 +90,9 @@ static struct clk common_clks[] = {
90}; 90};
91 91
92static struct clk pxa310_clks[] = { 92static struct clk pxa310_clks[] = {
93#ifdef CONFIG_CPU_PXA310
93 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev), 94 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
95#endif
94}; 96};
95 97
96static int __init pxa300_init(void) 98static int __init pxa300_init(void)
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 23a070599993..197974defbe4 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -10,7 +10,6 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#include <linux/version.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/module.h> 15#include <linux/module.h>
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index 2de9d5849ef0..111caa1a2efb 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -19,8 +19,6 @@
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/system.h> 20#include <asm/system.h>
21 21
22#include <linux/version.h>
23
24#include <hwregs/reg_map.h> 22#include <hwregs/reg_map.h>
25#include <hwregs/reg_rdwr.h> 23#include <hwregs/reg_rdwr.h>
26#include <hwregs/timer_defs.h> 24#include <hwregs/timer_defs.h>
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 8b054e7a8ae8..aa07d0cd1905 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -17,7 +17,6 @@ static const char serial_revdate[] = "2007-11-06";
17#define SUPPORT_SYSRQ 17#define SUPPORT_SYSRQ
18#endif 18#endif
19 19
20#include <linux/version.h>
21#include <linux/module.h> 20#include <linux/module.h>
22#include <linux/serial.h> 21#include <linux/serial.h>
23#include <linux/circ_buf.h> 22#include <linux/circ_buf.h>
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index e0debcca0bfa..a323c9b32ee1 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -86,6 +86,19 @@ static int __init parse_savemaxmem(char *p)
86} 86}
87__setup("savemaxmem=", parse_savemaxmem); 87__setup("savemaxmem=", parse_savemaxmem);
88 88
89
90static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
91 unsigned long offset, int userbuf)
92{
93 if (userbuf) {
94 if (copy_to_user((char __user *)buf, (vaddr + offset), csize))
95 return -EFAULT;
96 } else
97 memcpy(buf, (vaddr + offset), csize);
98
99 return csize;
100}
101
89/** 102/**
90 * copy_oldmem_page - copy one page from "oldmem" 103 * copy_oldmem_page - copy one page from "oldmem"
91 * @pfn: page frame number to be copied 104 * @pfn: page frame number to be copied
@@ -107,16 +120,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
107 if (!csize) 120 if (!csize)
108 return 0; 121 return 0;
109 122
110 vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0); 123 csize = min(csize, PAGE_SIZE);
111 124
112 if (userbuf) { 125 if (pfn < max_pfn) {
113 if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) { 126 vaddr = __va(pfn << PAGE_SHIFT);
114 iounmap(vaddr); 127 csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
115 return -EFAULT; 128 } else {
116 } 129 vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
117 } else 130 csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
118 memcpy(buf, (vaddr + offset), csize); 131 iounmap(vaddr);
132 }
119 133
120 iounmap(vaddr);
121 return csize; 134 return csize;
122} 135}
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 9d42eb57aea3..a06362223f8d 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -233,17 +233,6 @@ void ibmebus_free_irq(u32 ist, void *dev_id)
233} 233}
234EXPORT_SYMBOL(ibmebus_free_irq); 234EXPORT_SYMBOL(ibmebus_free_irq);
235 235
236static ssize_t name_show(struct device *dev,
237 struct device_attribute *attr, char *buf)
238{
239 return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
240}
241
242static struct device_attribute ibmebus_dev_attrs[] = {
243 __ATTR_RO(name),
244 __ATTR_NULL
245};
246
247static char *ibmebus_chomp(const char *in, size_t count) 236static char *ibmebus_chomp(const char *in, size_t count)
248{ 237{
249 char *out = kmalloc(count + 1, GFP_KERNEL); 238 char *out = kmalloc(count + 1, GFP_KERNEL);
@@ -327,7 +316,6 @@ static struct bus_attribute ibmebus_bus_attrs[] = {
327 316
328struct bus_type ibmebus_bus_type = { 317struct bus_type ibmebus_bus_type = {
329 .uevent = of_device_uevent, 318 .uevent = of_device_uevent,
330 .dev_attrs = ibmebus_dev_attrs,
331 .bus_attrs = ibmebus_bus_attrs 319 .bus_attrs = ibmebus_bus_attrs
332}; 320};
333EXPORT_SYMBOL(ibmebus_bus_type); 321EXPORT_SYMBOL(ibmebus_bus_type);
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 22a3c33fd751..2750fbab1975 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1113,7 +1113,7 @@ static int vio_bus_probe(struct device *dev)
1113 return error; 1113 return error;
1114 } 1114 }
1115 error = viodrv->probe(viodev, id); 1115 error = viodrv->probe(viodev, id);
1116 if (error) 1116 if (error && firmware_has_feature(FW_FEATURE_CMO))
1117 vio_cmo_bus_remove(viodev); 1117 vio_cmo_bus_remove(viodev);
1118 } 1118 }
1119 1119
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index f7edba6cb795..c9bb7cfd3dca 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -206,11 +206,6 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
206 (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); 206 (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
207 if (runcntl == 0) 207 if (runcntl == 0)
208 runcntl = SPU_RUNCNTL_RUNNABLE; 208 runcntl = SPU_RUNCNTL_RUNNABLE;
209 }
210
211 if (ctx->flags & SPU_CREATE_NOSCHED) {
212 spuctx_switch_state(ctx, SPU_UTIL_USER);
213 ctx->ops->runcntl_write(ctx, runcntl);
214 } else { 209 } else {
215 unsigned long privcntl; 210 unsigned long privcntl;
216 211
@@ -219,9 +214,15 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
219 else 214 else
220 privcntl = SPU_PRIVCNTL_MODE_NORMAL; 215 privcntl = SPU_PRIVCNTL_MODE_NORMAL;
221 216
222 ctx->ops->npc_write(ctx, *npc);
223 ctx->ops->privcntl_write(ctx, privcntl); 217 ctx->ops->privcntl_write(ctx, privcntl);
224 ctx->ops->runcntl_write(ctx, runcntl); 218 ctx->ops->npc_write(ctx, *npc);
219 }
220
221 ctx->ops->runcntl_write(ctx, runcntl);
222
223 if (ctx->flags & SPU_CREATE_NOSCHED) {
224 spuctx_switch_state(ctx, SPU_UTIL_USER);
225 } else {
225 226
226 if (ctx->state == SPU_STATE_SAVED) { 227 if (ctx->state == SPU_STATE_SAVED) {
227 ret = spu_activate(ctx, 0); 228 ret = spu_activate(ctx, 0);
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2deeeba7eccf..1c1b627ee843 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -641,8 +641,10 @@ static struct spu *find_victim(struct spu_context *ctx)
641 641
642 if (tmp && tmp->prio > ctx->prio && 642 if (tmp && tmp->prio > ctx->prio &&
643 !(tmp->flags & SPU_CREATE_NOSCHED) && 643 !(tmp->flags & SPU_CREATE_NOSCHED) &&
644 (!victim || tmp->prio > victim->prio)) 644 (!victim || tmp->prio > victim->prio)) {
645 victim = spu->ctx; 645 victim = spu->ctx;
646 get_spu_context(victim);
647 }
646 } 648 }
647 mutex_unlock(&cbe_spu_info[node].list_mutex); 649 mutex_unlock(&cbe_spu_info[node].list_mutex);
648 650
@@ -658,6 +660,7 @@ static struct spu *find_victim(struct spu_context *ctx)
658 * look at another context or give up after X retries. 660 * look at another context or give up after X retries.
659 */ 661 */
660 if (!mutex_trylock(&victim->state_mutex)) { 662 if (!mutex_trylock(&victim->state_mutex)) {
663 put_spu_context(victim);
661 victim = NULL; 664 victim = NULL;
662 goto restart; 665 goto restart;
663 } 666 }
@@ -670,6 +673,7 @@ static struct spu *find_victim(struct spu_context *ctx)
670 * restart the search. 673 * restart the search.
671 */ 674 */
672 mutex_unlock(&victim->state_mutex); 675 mutex_unlock(&victim->state_mutex);
676 put_spu_context(victim);
673 victim = NULL; 677 victim = NULL;
674 goto restart; 678 goto restart;
675 } 679 }
@@ -687,6 +691,7 @@ static struct spu *find_victim(struct spu_context *ctx)
687 spu_add_to_rq(victim); 691 spu_add_to_rq(victim);
688 692
689 mutex_unlock(&victim->state_mutex); 693 mutex_unlock(&victim->state_mutex);
694 put_spu_context(victim);
690 695
691 return spu; 696 return spu;
692 } 697 }
@@ -985,9 +990,11 @@ static int spusched_thread(void *unused)
985 struct spu_context *ctx = spu->ctx; 990 struct spu_context *ctx = spu->ctx;
986 991
987 if (ctx) { 992 if (ctx) {
993 get_spu_context(ctx);
988 mutex_unlock(mtx); 994 mutex_unlock(mtx);
989 spusched_tick(ctx); 995 spusched_tick(ctx);
990 mutex_lock(mtx); 996 mutex_lock(mtx);
997 put_spu_context(ctx);
991 } 998 }
992 } 999 }
993 mutex_unlock(mtx); 1000 mutex_unlock(mtx);
@@ -1030,7 +1037,7 @@ void spuctx_switch_state(struct spu_context *ctx,
1030 node = spu->node; 1037 node = spu->node;
1031 if (old_state == SPU_UTIL_USER) 1038 if (old_state == SPU_UTIL_USER)
1032 atomic_dec(&cbe_spu_info[node].busy_spus); 1039 atomic_dec(&cbe_spu_info[node].busy_spus);
1033 if (new_state == SPU_UTIL_USER); 1040 if (new_state == SPU_UTIL_USER)
1034 atomic_inc(&cbe_spu_info[node].busy_spus); 1041 atomic_inc(&cbe_spu_info[node].busy_spus);
1035 } 1042 }
1036} 1043}
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.c b/arch/powerpc/sysdev/bestcomm/gen_bd.c
index a3a134c35b0a..e0a53e3147b2 100644
--- a/arch/powerpc/sysdev/bestcomm/gen_bd.c
+++ b/arch/powerpc/sysdev/bestcomm/gen_bd.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/version.h>
15#include <linux/module.h> 14#include <linux/module.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/string.h> 16#include <linux/string.h>
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index c5cdb975d590..9b0bc2c9fba0 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.26-rc4 3# Linux kernel version: 2.6.27-rc4
4# Fri May 30 09:49:33 2008 4# Thu Aug 21 19:43:29 2008
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -68,7 +68,6 @@ CONFIG_INITRAMFS_SOURCE=""
68CONFIG_SYSCTL=y 68CONFIG_SYSCTL=y
69# CONFIG_EMBEDDED is not set 69# CONFIG_EMBEDDED is not set
70CONFIG_SYSCTL_SYSCALL=y 70CONFIG_SYSCTL_SYSCALL=y
71CONFIG_SYSCTL_SYSCALL_CHECK=y
72CONFIG_KALLSYMS=y 71CONFIG_KALLSYMS=y
73# CONFIG_KALLSYMS_ALL is not set 72# CONFIG_KALLSYMS_ALL is not set
74# CONFIG_KALLSYMS_EXTRA_PASS is not set 73# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -93,11 +92,17 @@ CONFIG_SLAB=y
93# CONFIG_MARKERS is not set 92# CONFIG_MARKERS is not set
94CONFIG_HAVE_OPROFILE=y 93CONFIG_HAVE_OPROFILE=y
95CONFIG_KPROBES=y 94CONFIG_KPROBES=y
95# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
96CONFIG_KRETPROBES=y 96CONFIG_KRETPROBES=y
97# CONFIG_HAVE_IOREMAP_PROT is not set
97CONFIG_HAVE_KPROBES=y 98CONFIG_HAVE_KPROBES=y
98CONFIG_HAVE_KRETPROBES=y 99CONFIG_HAVE_KRETPROBES=y
100# CONFIG_HAVE_ARCH_TRACEHOOK is not set
99# CONFIG_HAVE_DMA_ATTRS is not set 101# CONFIG_HAVE_DMA_ATTRS is not set
102# CONFIG_USE_GENERIC_SMP_HELPERS is not set
103# CONFIG_HAVE_CLK is not set
100CONFIG_PROC_PAGE_MONITOR=y 104CONFIG_PROC_PAGE_MONITOR=y
105# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
101CONFIG_SLABINFO=y 106CONFIG_SLABINFO=y
102CONFIG_RT_MUTEXES=y 107CONFIG_RT_MUTEXES=y
103# CONFIG_TINY_SHMEM is not set 108# CONFIG_TINY_SHMEM is not set
@@ -113,6 +118,7 @@ CONFIG_STOP_MACHINE=y
113CONFIG_BLOCK=y 118CONFIG_BLOCK=y
114# CONFIG_BLK_DEV_IO_TRACE is not set 119# CONFIG_BLK_DEV_IO_TRACE is not set
115CONFIG_BLK_DEV_BSG=y 120CONFIG_BLK_DEV_BSG=y
121# CONFIG_BLK_DEV_INTEGRITY is not set
116CONFIG_BLOCK_COMPAT=y 122CONFIG_BLOCK_COMPAT=y
117 123
118# 124#
@@ -175,6 +181,8 @@ CONFIG_PREEMPT=y
175CONFIG_ARCH_SPARSEMEM_ENABLE=y 181CONFIG_ARCH_SPARSEMEM_ENABLE=y
176CONFIG_ARCH_SPARSEMEM_DEFAULT=y 182CONFIG_ARCH_SPARSEMEM_DEFAULT=y
177CONFIG_ARCH_SELECT_MEMORY_MODEL=y 183CONFIG_ARCH_SELECT_MEMORY_MODEL=y
184CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
185CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
178CONFIG_SELECT_MEMORY_MODEL=y 186CONFIG_SELECT_MEMORY_MODEL=y
179# CONFIG_FLATMEM_MANUAL is not set 187# CONFIG_FLATMEM_MANUAL is not set
180# CONFIG_DISCONTIGMEM_MANUAL is not set 188# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -185,8 +193,12 @@ CONFIG_HAVE_MEMORY_PRESENT=y
185CONFIG_SPARSEMEM_EXTREME=y 193CONFIG_SPARSEMEM_EXTREME=y
186CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 194CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
187CONFIG_SPARSEMEM_VMEMMAP=y 195CONFIG_SPARSEMEM_VMEMMAP=y
196CONFIG_MEMORY_HOTPLUG=y
197CONFIG_MEMORY_HOTPLUG_SPARSE=y
198CONFIG_MEMORY_HOTREMOVE=y
188CONFIG_PAGEFLAGS_EXTENDED=y 199CONFIG_PAGEFLAGS_EXTENDED=y
189CONFIG_SPLIT_PTLOCK_CPUS=4 200CONFIG_SPLIT_PTLOCK_CPUS=4
201CONFIG_MIGRATION=y
190CONFIG_RESOURCES_64BIT=y 202CONFIG_RESOURCES_64BIT=y
191CONFIG_ZONE_DMA_FLAG=1 203CONFIG_ZONE_DMA_FLAG=1
192CONFIG_BOUNCE=y 204CONFIG_BOUNCE=y
@@ -198,6 +210,7 @@ CONFIG_VIRT_TO_BUS=y
198CONFIG_MACHCHK_WARNING=y 210CONFIG_MACHCHK_WARNING=y
199CONFIG_QDIO=y 211CONFIG_QDIO=y
200# CONFIG_QDIO_DEBUG is not set 212# CONFIG_QDIO_DEBUG is not set
213CONFIG_CHSC_SCH=m
201 214
202# 215#
203# Misc 216# Misc
@@ -206,6 +219,7 @@ CONFIG_IPL=y
206# CONFIG_IPL_TAPE is not set 219# CONFIG_IPL_TAPE is not set
207CONFIG_IPL_VM=y 220CONFIG_IPL_VM=y
208CONFIG_BINFMT_ELF=y 221CONFIG_BINFMT_ELF=y
222CONFIG_COMPAT_BINFMT_ELF=y
209CONFIG_BINFMT_MISC=m 223CONFIG_BINFMT_MISC=m
210CONFIG_FORCE_MAX_ZONEORDER=9 224CONFIG_FORCE_MAX_ZONEORDER=9
211# CONFIG_PROCESS_DEBUG is not set 225# CONFIG_PROCESS_DEBUG is not set
@@ -226,10 +240,6 @@ CONFIG_S390_HYPFS_FS=y
226CONFIG_KEXEC=y 240CONFIG_KEXEC=y
227# CONFIG_ZFCPDUMP is not set 241# CONFIG_ZFCPDUMP is not set
228CONFIG_S390_GUEST=y 242CONFIG_S390_GUEST=y
229
230#
231# Networking
232#
233CONFIG_NET=y 243CONFIG_NET=y
234 244
235# 245#
@@ -364,7 +374,6 @@ CONFIG_NET_SCH_CBQ=m
364# CONFIG_NET_SCH_HTB is not set 374# CONFIG_NET_SCH_HTB is not set
365# CONFIG_NET_SCH_HFSC is not set 375# CONFIG_NET_SCH_HFSC is not set
366CONFIG_NET_SCH_PRIO=m 376CONFIG_NET_SCH_PRIO=m
367CONFIG_NET_SCH_RR=m
368CONFIG_NET_SCH_RED=m 377CONFIG_NET_SCH_RED=m
369CONFIG_NET_SCH_SFQ=m 378CONFIG_NET_SCH_SFQ=m
370CONFIG_NET_SCH_TEQL=m 379CONFIG_NET_SCH_TEQL=m
@@ -430,7 +439,9 @@ CONFIG_CCW=y
430CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 439CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
431CONFIG_STANDALONE=y 440CONFIG_STANDALONE=y
432CONFIG_PREVENT_FIRMWARE_BUILD=y 441CONFIG_PREVENT_FIRMWARE_BUILD=y
433# CONFIG_FW_LOADER is not set 442CONFIG_FW_LOADER=y
443# CONFIG_FIRMWARE_IN_KERNEL is not set
444CONFIG_EXTRA_FIRMWARE=""
434# CONFIG_DEBUG_DRIVER is not set 445# CONFIG_DEBUG_DRIVER is not set
435# CONFIG_DEBUG_DEVRES is not set 446# CONFIG_DEBUG_DEVRES is not set
436CONFIG_SYS_HYPERVISOR=y 447CONFIG_SYS_HYPERVISOR=y
@@ -507,6 +518,11 @@ CONFIG_SCSI_LOWLEVEL=y
507# CONFIG_ISCSI_TCP is not set 518# CONFIG_ISCSI_TCP is not set
508# CONFIG_SCSI_DEBUG is not set 519# CONFIG_SCSI_DEBUG is not set
509CONFIG_ZFCP=y 520CONFIG_ZFCP=y
521CONFIG_SCSI_DH=m
522CONFIG_SCSI_DH_RDAC=m
523CONFIG_SCSI_DH_HP_SW=m
524CONFIG_SCSI_DH_EMC=m
525CONFIG_SCSI_DH_ALUA=m
510CONFIG_MD=y 526CONFIG_MD=y
511CONFIG_BLK_DEV_MD=y 527CONFIG_BLK_DEV_MD=y
512CONFIG_MD_LINEAR=m 528CONFIG_MD_LINEAR=m
@@ -522,14 +538,10 @@ CONFIG_DM_CRYPT=y
522CONFIG_DM_SNAPSHOT=y 538CONFIG_DM_SNAPSHOT=y
523CONFIG_DM_MIRROR=y 539CONFIG_DM_MIRROR=y
524CONFIG_DM_ZERO=y 540CONFIG_DM_ZERO=y
525CONFIG_DM_MULTIPATH=y 541CONFIG_DM_MULTIPATH=m
526# CONFIG_DM_MULTIPATH_EMC is not set
527# CONFIG_DM_MULTIPATH_RDAC is not set
528# CONFIG_DM_MULTIPATH_HP is not set
529# CONFIG_DM_DELAY is not set 542# CONFIG_DM_DELAY is not set
530# CONFIG_DM_UEVENT is not set 543# CONFIG_DM_UEVENT is not set
531CONFIG_NETDEVICES=y 544CONFIG_NETDEVICES=y
532# CONFIG_NETDEVICES_MULTIQUEUE is not set
533# CONFIG_IFB is not set 545# CONFIG_IFB is not set
534CONFIG_DUMMY=m 546CONFIG_DUMMY=m
535CONFIG_BONDING=m 547CONFIG_BONDING=m
@@ -544,7 +556,6 @@ CONFIG_NET_ETHERNET=y
544# CONFIG_IBM_NEW_EMAC_TAH is not set 556# CONFIG_IBM_NEW_EMAC_TAH is not set
545# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 557# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
546CONFIG_NETDEV_1000=y 558CONFIG_NETDEV_1000=y
547# CONFIG_E1000E_ENABLED is not set
548CONFIG_NETDEV_10000=y 559CONFIG_NETDEV_10000=y
549# CONFIG_TR is not set 560# CONFIG_TR is not set
550# CONFIG_WAN is not set 561# CONFIG_WAN is not set
@@ -576,7 +587,10 @@ CONFIG_DEVKMEM=y
576CONFIG_UNIX98_PTYS=y 587CONFIG_UNIX98_PTYS=y
577CONFIG_LEGACY_PTYS=y 588CONFIG_LEGACY_PTYS=y
578CONFIG_LEGACY_PTY_COUNT=256 589CONFIG_LEGACY_PTY_COUNT=256
590CONFIG_HVC_DRIVER=y
591CONFIG_VIRTIO_CONSOLE=y
579CONFIG_HW_RANDOM=m 592CONFIG_HW_RANDOM=m
593CONFIG_HW_RANDOM_VIRTIO=m
580# CONFIG_R3964 is not set 594# CONFIG_R3964 is not set
581CONFIG_RAW_DRIVER=m 595CONFIG_RAW_DRIVER=m
582CONFIG_MAX_RAW_DEVS=256 596CONFIG_MAX_RAW_DEVS=256
@@ -616,6 +630,7 @@ CONFIG_MONWRITER=m
616CONFIG_S390_VMUR=m 630CONFIG_S390_VMUR=m
617# CONFIG_POWER_SUPPLY is not set 631# CONFIG_POWER_SUPPLY is not set
618# CONFIG_THERMAL is not set 632# CONFIG_THERMAL is not set
633# CONFIG_THERMAL_HWMON is not set
619# CONFIG_WATCHDOG is not set 634# CONFIG_WATCHDOG is not set
620 635
621# 636#
@@ -693,6 +708,7 @@ CONFIG_CONFIGFS_FS=m
693# CONFIG_CRAMFS is not set 708# CONFIG_CRAMFS is not set
694# CONFIG_VXFS_FS is not set 709# CONFIG_VXFS_FS is not set
695# CONFIG_MINIX_FS is not set 710# CONFIG_MINIX_FS is not set
711# CONFIG_OMFS_FS is not set
696# CONFIG_HPFS_FS is not set 712# CONFIG_HPFS_FS is not set
697# CONFIG_QNX4FS_FS is not set 713# CONFIG_QNX4FS_FS is not set
698# CONFIG_ROMFS_FS is not set 714# CONFIG_ROMFS_FS is not set
@@ -712,7 +728,6 @@ CONFIG_LOCKD_V4=y
712CONFIG_EXPORTFS=y 728CONFIG_EXPORTFS=y
713CONFIG_NFS_COMMON=y 729CONFIG_NFS_COMMON=y
714CONFIG_SUNRPC=y 730CONFIG_SUNRPC=y
715# CONFIG_SUNRPC_BIND34 is not set
716# CONFIG_RPCSEC_GSS_KRB5 is not set 731# CONFIG_RPCSEC_GSS_KRB5 is not set
717# CONFIG_RPCSEC_GSS_SPKM3 is not set 732# CONFIG_RPCSEC_GSS_SPKM3 is not set
718# CONFIG_SMB_FS is not set 733# CONFIG_SMB_FS is not set
@@ -780,6 +795,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
780# CONFIG_DEBUG_INFO is not set 795# CONFIG_DEBUG_INFO is not set
781# CONFIG_DEBUG_VM is not set 796# CONFIG_DEBUG_VM is not set
782# CONFIG_DEBUG_WRITECOUNT is not set 797# CONFIG_DEBUG_WRITECOUNT is not set
798CONFIG_DEBUG_MEMORY_INIT=y
783# CONFIG_DEBUG_LIST is not set 799# CONFIG_DEBUG_LIST is not set
784# CONFIG_DEBUG_SG is not set 800# CONFIG_DEBUG_SG is not set
785# CONFIG_FRAME_POINTER is not set 801# CONFIG_FRAME_POINTER is not set
@@ -789,6 +805,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
789# CONFIG_LKDTM is not set 805# CONFIG_LKDTM is not set
790# CONFIG_FAULT_INJECTION is not set 806# CONFIG_FAULT_INJECTION is not set
791# CONFIG_LATENCYTOP is not set 807# CONFIG_LATENCYTOP is not set
808CONFIG_SYSCTL_SYSCALL_CHECK=y
792CONFIG_SAMPLES=y 809CONFIG_SAMPLES=y
793# CONFIG_SAMPLE_KOBJECT is not set 810# CONFIG_SAMPLE_KOBJECT is not set
794# CONFIG_SAMPLE_KPROBES is not set 811# CONFIG_SAMPLE_KPROBES is not set
@@ -847,6 +864,10 @@ CONFIG_CRYPTO_HMAC=m
847# CONFIG_CRYPTO_MD4 is not set 864# CONFIG_CRYPTO_MD4 is not set
848CONFIG_CRYPTO_MD5=m 865CONFIG_CRYPTO_MD5=m
849# CONFIG_CRYPTO_MICHAEL_MIC is not set 866# CONFIG_CRYPTO_MICHAEL_MIC is not set
867CONFIG_CRYPTO_RMD128=m
868CONFIG_CRYPTO_RMD160=m
869CONFIG_CRYPTO_RMD256=m
870CONFIG_CRYPTO_RMD320=m
850CONFIG_CRYPTO_SHA1=m 871CONFIG_CRYPTO_SHA1=m
851# CONFIG_CRYPTO_SHA256 is not set 872# CONFIG_CRYPTO_SHA256 is not set
852# CONFIG_CRYPTO_SHA512 is not set 873# CONFIG_CRYPTO_SHA512 is not set
@@ -895,6 +916,7 @@ CONFIG_BITREVERSE=m
895# CONFIG_GENERIC_FIND_NEXT_BIT is not set 916# CONFIG_GENERIC_FIND_NEXT_BIT is not set
896# CONFIG_CRC_CCITT is not set 917# CONFIG_CRC_CCITT is not set
897# CONFIG_CRC16 is not set 918# CONFIG_CRC16 is not set
919CONFIG_CRC_T10DIF=y
898# CONFIG_CRC_ITU_T is not set 920# CONFIG_CRC_ITU_T is not set
899CONFIG_CRC32=m 921CONFIG_CRC32=m
900CONFIG_CRC7=m 922CONFIG_CRC7=m
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index b4eb24ab5af9..8e9243ae0c19 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -709,7 +709,7 @@ static inline int find_next_zero_bit (const unsigned long * addr,
709 * __ffz_word returns __BITOPS_WORDSIZE 709 * __ffz_word returns __BITOPS_WORDSIZE
710 * if no zero bit is present in the word. 710 * if no zero bit is present in the word.
711 */ 711 */
712 set = __ffz_word(0, *p >> bit) + bit; 712 set = __ffz_word(bit, *p >> bit);
713 if (set >= size) 713 if (set >= size)
714 return size + offset; 714 return size + offset;
715 if (set < __BITOPS_WORDSIZE) 715 if (set < __BITOPS_WORDSIZE)
@@ -824,7 +824,7 @@ static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
824 * s390 version of ffz returns __BITOPS_WORDSIZE 824 * s390 version of ffz returns __BITOPS_WORDSIZE
825 * if no zero bit is present in the word. 825 * if no zero bit is present in the word.
826 */ 826 */
827 set = ffz(__load_ulong_le(p, 0) >> bit) + bit; 827 set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit);
828 if (set >= size) 828 if (set >= size)
829 return size + offset; 829 return size + offset;
830 if (set < __BITOPS_WORDSIZE) 830 if (set < __BITOPS_WORDSIZE)
@@ -865,7 +865,7 @@ static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
865 * s390 version of ffz returns __BITOPS_WORDSIZE 865 * s390 version of ffz returns __BITOPS_WORDSIZE
866 * if no zero bit is present in the word. 866 * if no zero bit is present in the word.
867 */ 867 */
868 set = ffs(__load_ulong_le(p, 0) >> bit) + bit; 868 set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit));
869 if (set >= size) 869 if (set >= size)
870 return size + offset; 870 return size + offset;
871 if (set < __BITOPS_WORDSIZE) 871 if (set < __BITOPS_WORDSIZE)
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 9839767d0842..3e2c05cb6a87 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -75,7 +75,9 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
75 return sf->gprs[8]; 75 return sf->gprs[8];
76} 76}
77 77
78DEFINE_PER_CPU(struct s390_idle_data, s390_idle); 78DEFINE_PER_CPU(struct s390_idle_data, s390_idle) = {
79 .lock = __SPIN_LOCK_UNLOCKED(s390_idle.lock)
80};
79 81
80static int s390_idle_enter(void) 82static int s390_idle_enter(void)
81{ 83{
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b795b3e24afd..00b9b4dec5eb 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -610,7 +610,6 @@ static void __init smp_create_idle(unsigned int cpu)
610 if (IS_ERR(p)) 610 if (IS_ERR(p))
611 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p)); 611 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
612 current_set[cpu] = p; 612 current_set[cpu] = p;
613 spin_lock_init(&(&per_cpu(s390_idle, cpu))->lock);
614} 613}
615 614
616static int __cpuinit smp_alloc_lowcore(int cpu) 615static int __cpuinit smp_alloc_lowcore(int cpu)
@@ -845,7 +844,6 @@ void __init smp_prepare_boot_cpu(void)
845 current_set[0] = current; 844 current_set[0] = current;
846 smp_cpu_state[0] = CPU_STATE_CONFIGURED; 845 smp_cpu_state[0] = CPU_STATE_CONFIGURED;
847 smp_cpu_polarization[0] = POLARIZATION_UNKNWN; 846 smp_cpu_polarization[0] = POLARIZATION_UNKNWN;
848 spin_lock_init(&(&__get_cpu_var(s390_idle))->lock);
849} 847}
850 848
851void __init smp_cpus_done(unsigned int max_cpus) 849void __init smp_cpus_done(unsigned int max_cpus)
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 025d4fe55a58..fd1612590bf4 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -140,6 +140,10 @@ static struct sh_mobile_lcdc_info lcdc_info = {
140 .vsync_len = 1, 140 .vsync_len = 1,
141 .sync = 0, /* hsync and vsync are active low */ 141 .sync = 0, /* hsync and vsync are active low */
142 }, 142 },
143 .lcd_size_cfg = { /* 7.0 inch */
144 .width = 152,
145 .height = 91,
146 },
143 .board_cfg = { 147 .board_cfg = {
144 .display_on = ap320_wvga_power_on, 148 .display_on = ap320_wvga_power_on,
145 }, 149 },
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index e499ee384d58..714dce91cc9b 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -224,6 +224,10 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
224 .vsync_len = 2, 224 .vsync_len = 2,
225 .sync = 0, 225 .sync = 0,
226 }, 226 },
227 .lcd_size_cfg = { /* 7.0 inch */
228 .width = 152,
229 .height = 91,
230 },
227 } 231 }
228#endif 232#endif
229#ifdef CONFIG_SH_MIGOR_QVGA 233#ifdef CONFIG_SH_MIGOR_QVGA
@@ -245,6 +249,10 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
245 .vsync_len = 2, 249 .vsync_len = 2,
246 .sync = FB_SYNC_HOR_HIGH_ACT, 250 .sync = FB_SYNC_HOR_HIGH_ACT,
247 }, 251 },
252 .lcd_size_cfg = { /* 2.4 inch */
253 .width = 49,
254 .height = 37,
255 },
248 .board_cfg = { 256 .board_cfg = {
249 .setup_sys = migor_lcd_qvga_setup, 257 .setup_sys = migor_lcd_qvga_setup,
250 }, 258 },
diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
index 925f16af7121..23850da05e3c 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -15,8 +15,11 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <asm/io.h> 18#include <linux/fb.h>
19#include <linux/io.h>
19#include <asm/sh7763rdp.h> 20#include <asm/sh7763rdp.h>
21#include <asm/sh_eth.h>
22#include <asm/sh7760fb.h>
20 23
21/* NOR Flash */ 24/* NOR Flash */
22static struct mtd_partition sh7763rdp_nor_flash_partitions[] = { 25static struct mtd_partition sh7763rdp_nor_flash_partitions[] = {
@@ -60,8 +63,85 @@ static struct platform_device sh7763rdp_nor_flash_device = {
60 }, 63 },
61}; 64};
62 65
66/* SH-Ether */
67static struct resource sh_eth_resources[] = {
68 {
69 .start = 0xFEE00800, /* use eth1 */
70 .end = 0xFEE00F7C - 1,
71 .flags = IORESOURCE_MEM,
72 }, {
73 .start = 58, /* irq number */
74 .end = 58,
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct sh_eth_plat_data sh7763_eth_pdata = {
80 .phy = 1,
81 .edmac_endian = EDMAC_LITTLE_ENDIAN,
82};
83
84static struct platform_device sh7763rdp_eth_device = {
85 .name = "sh-eth",
86 .resource = sh_eth_resources,
87 .num_resources = ARRAY_SIZE(sh_eth_resources),
88 .dev = {
89 .platform_data = &sh7763_eth_pdata,
90 },
91};
92
93/* SH7763 LCDC */
94static struct resource sh7763rdp_fb_resources[] = {
95 {
96 .start = 0xFFE80000,
97 .end = 0xFFE80442 - 1,
98 .flags = IORESOURCE_MEM,
99 },
100};
101
102static struct fb_videomode sh7763fb_videomode = {
103 .refresh = 60,
104 .name = "VGA Monitor",
105 .xres = 640,
106 .yres = 480,
107 .pixclock = 10000,
108 .left_margin = 80,
109 .right_margin = 24,
110 .upper_margin = 30,
111 .lower_margin = 1,
112 .hsync_len = 96,
113 .vsync_len = 1,
114 .sync = 0,
115 .vmode = FB_VMODE_NONINTERLACED,
116 .flag = FBINFO_FLAG_DEFAULT,
117};
118
119static struct sh7760fb_platdata sh7763fb_def_pdata = {
120 .def_mode = &sh7763fb_videomode,
121 .ldmtr = (LDMTR_TFT_COLOR_16|LDMTR_MCNT),
122 .lddfr = LDDFR_16BPP_RGB565,
123 .ldpmmr = 0x0000,
124 .ldpspr = 0xFFFF,
125 .ldaclnr = 0x0001,
126 .ldickr = 0x1102,
127 .rotate = 0,
128 .novsync = 0,
129 .blank = NULL,
130};
131
132static struct platform_device sh7763rdp_fb_device = {
133 .name = "sh7760-lcdc",
134 .resource = sh7763rdp_fb_resources,
135 .num_resources = ARRAY_SIZE(sh7763rdp_fb_resources),
136 .dev = {
137 .platform_data = &sh7763fb_def_pdata,
138 },
139};
140
63static struct platform_device *sh7763rdp_devices[] __initdata = { 141static struct platform_device *sh7763rdp_devices[] __initdata = {
64 &sh7763rdp_nor_flash_device, 142 &sh7763rdp_nor_flash_device,
143 &sh7763rdp_eth_device,
144 &sh7763rdp_fb_device,
65}; 145};
66 146
67static int __init sh7763rdp_devices_setup(void) 147static int __init sh7763rdp_devices_setup(void)
@@ -69,7 +149,7 @@ static int __init sh7763rdp_devices_setup(void)
69 return platform_add_devices(sh7763rdp_devices, 149 return platform_add_devices(sh7763rdp_devices,
70 ARRAY_SIZE(sh7763rdp_devices)); 150 ARRAY_SIZE(sh7763rdp_devices));
71} 151}
72__initcall(sh7763rdp_devices_setup); 152device_initcall(sh7763rdp_devices_setup);
73 153
74static void __init sh7763rdp_setup(char **cmdline_p) 154static void __init sh7763rdp_setup(char **cmdline_p)
75{ 155{
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index abc5b6d418fe..a70d23b21788 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Renesas SH-X3 Prototype Board Support. 4 * Renesas SH-X3 Prototype Board Support.
5 * 5 *
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 - 2008 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -13,6 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/smc91x.h>
16#include <asm/ilsel.h> 17#include <asm/ilsel.h>
17 18
18static struct resource heartbeat_resources[] = { 19static struct resource heartbeat_resources[] = {
@@ -30,6 +31,10 @@ static struct platform_device heartbeat_device = {
30 .resource = heartbeat_resources, 31 .resource = heartbeat_resources,
31}; 32};
32 33
34static struct smc91x_platdata smc91x_info = {
35 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
36};
37
33static struct resource smc91x_resources[] = { 38static struct resource smc91x_resources[] = {
34 [0] = { 39 [0] = {
35 .start = 0x18000300, 40 .start = 0x18000300,
@@ -47,6 +52,9 @@ static struct platform_device smc91x_device = {
47 .id = -1, 52 .id = -1,
48 .resource = smc91x_resources, 53 .resource = smc91x_resources,
49 .num_resources = ARRAY_SIZE(smc91x_resources), 54 .num_resources = ARRAY_SIZE(smc91x_resources),
55 .dev = {
56 .platform_data = &smc91x_info,
57 },
50}; 58};
51 59
52static struct resource r8a66597_usb_host_resources[] = { 60static struct resource r8a66597_usb_host_resources[] = {
diff --git a/arch/sh/configs/sh7763rdp_defconfig b/arch/sh/configs/sh7763rdp_defconfig
index 83f3fe5db3e5..baf830c4a7e4 100644
--- a/arch/sh/configs/sh7763rdp_defconfig
+++ b/arch/sh/configs/sh7763rdp_defconfig
@@ -1,15 +1,17 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc2
4# Fri Jun 6 12:20:17 2008 4# Fri Aug 8 13:44:20 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
13CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y 16CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_TIME=y 17CONFIG_GENERIC_TIME=y
@@ -19,7 +21,6 @@ CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 25
25# 26#
@@ -83,10 +84,16 @@ CONFIG_PROFILING=y
83# CONFIG_MARKERS is not set 84# CONFIG_MARKERS is not set
84CONFIG_OPROFILE=y 85CONFIG_OPROFILE=y
85CONFIG_HAVE_OPROFILE=y 86CONFIG_HAVE_OPROFILE=y
87# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
88# CONFIG_HAVE_IOREMAP_PROT is not set
86# CONFIG_HAVE_KPROBES is not set 89# CONFIG_HAVE_KPROBES is not set
87# CONFIG_HAVE_KRETPROBES is not set 90# CONFIG_HAVE_KRETPROBES is not set
91# CONFIG_HAVE_ARCH_TRACEHOOK is not set
88# CONFIG_HAVE_DMA_ATTRS is not set 92# CONFIG_HAVE_DMA_ATTRS is not set
93# CONFIG_USE_GENERIC_SMP_HELPERS is not set
94CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y 95CONFIG_PROC_PAGE_MONITOR=y
96CONFIG_HAVE_GENERIC_DMA_COHERENT=y
90CONFIG_SLABINFO=y 97CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y 98CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set 99# CONFIG_TINY_SHMEM is not set
@@ -96,12 +103,13 @@ CONFIG_MODULES=y
96# CONFIG_MODULE_UNLOAD is not set 103# CONFIG_MODULE_UNLOAD is not set
97# CONFIG_MODVERSIONS is not set 104# CONFIG_MODVERSIONS is not set
98# CONFIG_MODULE_SRCVERSION_ALL is not set 105# CONFIG_MODULE_SRCVERSION_ALL is not set
99# CONFIG_KMOD is not set 106CONFIG_KMOD=y
100CONFIG_BLOCK=y 107CONFIG_BLOCK=y
101# CONFIG_LBD is not set 108# CONFIG_LBD is not set
102# CONFIG_BLK_DEV_IO_TRACE is not set 109# CONFIG_BLK_DEV_IO_TRACE is not set
103# CONFIG_LSF is not set 110# CONFIG_LSF is not set
104# CONFIG_BLK_DEV_BSG is not set 111# CONFIG_BLK_DEV_BSG is not set
112# CONFIG_BLK_DEV_INTEGRITY is not set
105 113
106# 114#
107# IO Schedulers 115# IO Schedulers
@@ -177,6 +185,7 @@ CONFIG_PAGE_SIZE_4KB=y
177# CONFIG_PAGE_SIZE_8KB is not set 185# CONFIG_PAGE_SIZE_8KB is not set
178# CONFIG_PAGE_SIZE_16KB is not set 186# CONFIG_PAGE_SIZE_16KB is not set
179# CONFIG_PAGE_SIZE_64KB is not set 187# CONFIG_PAGE_SIZE_64KB is not set
188CONFIG_ENTRY_OFFSET=0x00001000
180CONFIG_SELECT_MEMORY_MODEL=y 189CONFIG_SELECT_MEMORY_MODEL=y
181# CONFIG_FLATMEM_MANUAL is not set 190# CONFIG_FLATMEM_MANUAL is not set
182# CONFIG_DISCONTIGMEM_MANUAL is not set 191# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -258,6 +267,7 @@ CONFIG_HZ=250
258# CONFIG_SCHED_HRTICK is not set 267# CONFIG_SCHED_HRTICK is not set
259# CONFIG_KEXEC is not set 268# CONFIG_KEXEC is not set
260# CONFIG_CRASH_DUMP is not set 269# CONFIG_CRASH_DUMP is not set
270CONFIG_SECCOMP=y
261CONFIG_PREEMPT_NONE=y 271CONFIG_PREEMPT_NONE=y
262# CONFIG_PREEMPT_VOLUNTARY is not set 272# CONFIG_PREEMPT_VOLUNTARY is not set
263# CONFIG_PREEMPT is not set 273# CONFIG_PREEMPT is not set
@@ -282,10 +292,6 @@ CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/sda1 rootdelay=10"
282# 292#
283CONFIG_BINFMT_ELF=y 293CONFIG_BINFMT_ELF=y
284# CONFIG_BINFMT_MISC is not set 294# CONFIG_BINFMT_MISC is not set
285
286#
287# Networking
288#
289CONFIG_NET=y 295CONFIG_NET=y
290 296
291# 297#
@@ -361,6 +367,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
361# 367#
362# CONFIG_CFG80211 is not set 368# CONFIG_CFG80211 is not set
363CONFIG_WIRELESS_EXT=y 369CONFIG_WIRELESS_EXT=y
370CONFIG_WIRELESS_EXT_SYSFS=y
364# CONFIG_MAC80211 is not set 371# CONFIG_MAC80211 is not set
365# CONFIG_IEEE80211 is not set 372# CONFIG_IEEE80211 is not set
366# CONFIG_RFKILL is not set 373# CONFIG_RFKILL is not set
@@ -377,6 +384,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
377CONFIG_STANDALONE=y 384CONFIG_STANDALONE=y
378CONFIG_PREVENT_FIRMWARE_BUILD=y 385CONFIG_PREVENT_FIRMWARE_BUILD=y
379CONFIG_FW_LOADER=y 386CONFIG_FW_LOADER=y
387CONFIG_FIRMWARE_IN_KERNEL=y
388CONFIG_EXTRA_FIRMWARE=""
380# CONFIG_SYS_HYPERVISOR is not set 389# CONFIG_SYS_HYPERVISOR is not set
381# CONFIG_CONNECTOR is not set 390# CONFIG_CONNECTOR is not set
382CONFIG_MTD=y 391CONFIG_MTD=y
@@ -471,6 +480,7 @@ CONFIG_BLK_DEV=y
471# CONFIG_BLK_DEV_RAM is not set 480# CONFIG_BLK_DEV_RAM is not set
472# CONFIG_CDROM_PKTCDVD is not set 481# CONFIG_CDROM_PKTCDVD is not set
473# CONFIG_ATA_OVER_ETH is not set 482# CONFIG_ATA_OVER_ETH is not set
483# CONFIG_BLK_DEV_HD is not set
474# CONFIG_MISC_DEVICES is not set 484# CONFIG_MISC_DEVICES is not set
475CONFIG_HAVE_IDE=y 485CONFIG_HAVE_IDE=y
476# CONFIG_IDE is not set 486# CONFIG_IDE is not set
@@ -515,10 +525,10 @@ CONFIG_SCSI_WAIT_SCAN=m
515CONFIG_SCSI_LOWLEVEL=y 525CONFIG_SCSI_LOWLEVEL=y
516# CONFIG_ISCSI_TCP is not set 526# CONFIG_ISCSI_TCP is not set
517# CONFIG_SCSI_DEBUG is not set 527# CONFIG_SCSI_DEBUG is not set
528# CONFIG_SCSI_DH is not set
518# CONFIG_ATA is not set 529# CONFIG_ATA is not set
519# CONFIG_MD is not set 530# CONFIG_MD is not set
520CONFIG_NETDEVICES=y 531CONFIG_NETDEVICES=y
521# CONFIG_NETDEVICES_MULTIQUEUE is not set
522# CONFIG_DUMMY is not set 532# CONFIG_DUMMY is not set
523# CONFIG_BONDING is not set 533# CONFIG_BONDING is not set
524# CONFIG_MACVLAN is not set 534# CONFIG_MACVLAN is not set
@@ -546,7 +556,9 @@ CONFIG_NET_ETHERNET=y
546CONFIG_MII=y 556CONFIG_MII=y
547# CONFIG_AX88796 is not set 557# CONFIG_AX88796 is not set
548# CONFIG_STNIC is not set 558# CONFIG_STNIC is not set
559CONFIG_SH_ETH=y
549# CONFIG_SMC91X is not set 560# CONFIG_SMC91X is not set
561# CONFIG_SMC911X is not set
550# CONFIG_IBM_NEW_EMAC_ZMII is not set 562# CONFIG_IBM_NEW_EMAC_ZMII is not set
551# CONFIG_IBM_NEW_EMAC_RGMII is not set 563# CONFIG_IBM_NEW_EMAC_RGMII is not set
552# CONFIG_IBM_NEW_EMAC_TAH is not set 564# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -613,7 +625,11 @@ CONFIG_INPUT=y
613# 625#
614# Character devices 626# Character devices
615# 627#
616# CONFIG_VT is not set 628CONFIG_VT=y
629CONFIG_CONSOLE_TRANSLATIONS=y
630CONFIG_VT_CONSOLE=y
631CONFIG_HW_CONSOLE=y
632# CONFIG_VT_HW_CONSOLE_BINDING is not set
617CONFIG_DEVKMEM=y 633CONFIG_DEVKMEM=y
618# CONFIG_SERIAL_NONSTANDARD is not set 634# CONFIG_SERIAL_NONSTANDARD is not set
619 635
@@ -644,6 +660,7 @@ CONFIG_HW_RANDOM=y
644# CONFIG_POWER_SUPPLY is not set 660# CONFIG_POWER_SUPPLY is not set
645# CONFIG_HWMON is not set 661# CONFIG_HWMON is not set
646# CONFIG_THERMAL is not set 662# CONFIG_THERMAL is not set
663# CONFIG_THERMAL_HWMON is not set
647# CONFIG_WATCHDOG is not set 664# CONFIG_WATCHDOG is not set
648 665
649# 666#
@@ -655,6 +672,7 @@ CONFIG_SSB_POSSIBLE=y
655# 672#
656# Multifunction device drivers 673# Multifunction device drivers
657# 674#
675# CONFIG_MFD_CORE is not set
658# CONFIG_MFD_SM501 is not set 676# CONFIG_MFD_SM501 is not set
659# CONFIG_HTC_PASIC3 is not set 677# CONFIG_HTC_PASIC3 is not set
660 678
@@ -679,7 +697,34 @@ CONFIG_SSB_POSSIBLE=y
679# 697#
680# CONFIG_VGASTATE is not set 698# CONFIG_VGASTATE is not set
681# CONFIG_VIDEO_OUTPUT_CONTROL is not set 699# CONFIG_VIDEO_OUTPUT_CONTROL is not set
682# CONFIG_FB is not set 700CONFIG_FB=y
701# CONFIG_FIRMWARE_EDID is not set
702# CONFIG_FB_DDC is not set
703CONFIG_FB_CFB_FILLRECT=y
704CONFIG_FB_CFB_COPYAREA=y
705CONFIG_FB_CFB_IMAGEBLIT=y
706# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
707# CONFIG_FB_SYS_FILLRECT is not set
708# CONFIG_FB_SYS_COPYAREA is not set
709# CONFIG_FB_SYS_IMAGEBLIT is not set
710CONFIG_FB_FOREIGN_ENDIAN=y
711CONFIG_FB_BOTH_ENDIAN=y
712# CONFIG_FB_BIG_ENDIAN is not set
713# CONFIG_FB_LITTLE_ENDIAN is not set
714# CONFIG_FB_SYS_FOPS is not set
715# CONFIG_FB_SVGALIB is not set
716# CONFIG_FB_MACMODES is not set
717# CONFIG_FB_BACKLIGHT is not set
718# CONFIG_FB_MODE_HELPERS is not set
719# CONFIG_FB_TILEBLITTING is not set
720
721#
722# Frame buffer hardware drivers
723#
724# CONFIG_FB_S1D13XXX is not set
725# CONFIG_FB_SH_MOBILE_LCDC is not set
726CONFIG_FB_SH7760=y
727# CONFIG_FB_VIRTUAL is not set
683# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 728# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
684 729
685# 730#
@@ -688,8 +733,22 @@ CONFIG_SSB_POSSIBLE=y
688# CONFIG_DISPLAY_SUPPORT is not set 733# CONFIG_DISPLAY_SUPPORT is not set
689 734
690# 735#
691# Sound 736# Console display driver support
692# 737#
738CONFIG_DUMMY_CONSOLE=y
739CONFIG_FRAMEBUFFER_CONSOLE=y
740# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
741# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
742# CONFIG_FONTS is not set
743CONFIG_FONT_8x8=y
744CONFIG_FONT_8x16=y
745CONFIG_LOGO=y
746CONFIG_LOGO_LINUX_MONO=y
747CONFIG_LOGO_LINUX_VGA16=y
748CONFIG_LOGO_LINUX_CLUT224=y
749CONFIG_LOGO_SUPERH_MONO=y
750CONFIG_LOGO_SUPERH_VGA16=y
751CONFIG_LOGO_SUPERH_CLUT224=y
693# CONFIG_SOUND is not set 752# CONFIG_SOUND is not set
694# CONFIG_HID_SUPPORT is not set 753# CONFIG_HID_SUPPORT is not set
695CONFIG_USB_SUPPORT=y 754CONFIG_USB_SUPPORT=y
@@ -788,11 +847,27 @@ CONFIG_USB_MON=y
788# CONFIG_USB_IOWARRIOR is not set 847# CONFIG_USB_IOWARRIOR is not set
789# CONFIG_USB_ISIGHTFW is not set 848# CONFIG_USB_ISIGHTFW is not set
790# CONFIG_USB_GADGET is not set 849# CONFIG_USB_GADGET is not set
791# CONFIG_MMC is not set 850CONFIG_MMC=y
851# CONFIG_MMC_DEBUG is not set
852# CONFIG_MMC_UNSAFE_RESUME is not set
853
854#
855# MMC/SD Card Drivers
856#
857CONFIG_MMC_BLOCK=y
858CONFIG_MMC_BLOCK_BOUNCE=y
859# CONFIG_SDIO_UART is not set
860# CONFIG_MMC_TEST is not set
861
862#
863# MMC/SD Host Controller Drivers
864#
865# CONFIG_MMC_SDHCI is not set
792# CONFIG_MEMSTICK is not set 866# CONFIG_MEMSTICK is not set
793# CONFIG_NEW_LEDS is not set 867# CONFIG_NEW_LEDS is not set
794# CONFIG_ACCESSIBILITY is not set 868# CONFIG_ACCESSIBILITY is not set
795# CONFIG_RTC_CLASS is not set 869# CONFIG_RTC_CLASS is not set
870# CONFIG_DMADEVICES is not set
796# CONFIG_UIO is not set 871# CONFIG_UIO is not set
797 872
798# 873#
@@ -865,6 +940,7 @@ CONFIG_TMPFS_POSIX_ACL=y
865# CONFIG_CRAMFS is not set 940# CONFIG_CRAMFS is not set
866# CONFIG_VXFS_FS is not set 941# CONFIG_VXFS_FS is not set
867# CONFIG_MINIX_FS is not set 942# CONFIG_MINIX_FS is not set
943# CONFIG_OMFS_FS is not set
868# CONFIG_HPFS_FS is not set 944# CONFIG_HPFS_FS is not set
869# CONFIG_QNX4FS_FS is not set 945# CONFIG_QNX4FS_FS is not set
870# CONFIG_ROMFS_FS is not set 946# CONFIG_ROMFS_FS is not set
@@ -874,12 +950,11 @@ CONFIG_NETWORK_FILESYSTEMS=y
874CONFIG_NFS_FS=y 950CONFIG_NFS_FS=y
875# CONFIG_NFS_V3 is not set 951# CONFIG_NFS_V3 is not set
876# CONFIG_NFS_V4 is not set 952# CONFIG_NFS_V4 is not set
877# CONFIG_NFSD is not set
878CONFIG_ROOT_NFS=y 953CONFIG_ROOT_NFS=y
954# CONFIG_NFSD is not set
879CONFIG_LOCKD=y 955CONFIG_LOCKD=y
880CONFIG_NFS_COMMON=y 956CONFIG_NFS_COMMON=y
881CONFIG_SUNRPC=y 957CONFIG_SUNRPC=y
882# CONFIG_SUNRPC_BIND34 is not set
883# CONFIG_RPCSEC_GSS_KRB5 is not set 958# CONFIG_RPCSEC_GSS_KRB5 is not set
884# CONFIG_RPCSEC_GSS_SPKM3 is not set 959# CONFIG_RPCSEC_GSS_SPKM3 is not set
885# CONFIG_SMB_FS is not set 960# CONFIG_SMB_FS is not set
@@ -949,6 +1024,7 @@ CONFIG_FRAME_WARN=1024
949# CONFIG_HEADERS_CHECK is not set 1024# CONFIG_HEADERS_CHECK is not set
950# CONFIG_DEBUG_KERNEL is not set 1025# CONFIG_DEBUG_KERNEL is not set
951# CONFIG_DEBUG_BUGVERBOSE is not set 1026# CONFIG_DEBUG_BUGVERBOSE is not set
1027# CONFIG_DEBUG_MEMORY_INIT is not set
952# CONFIG_SAMPLES is not set 1028# CONFIG_SAMPLES is not set
953# CONFIG_SH_STANDARD_BIOS is not set 1029# CONFIG_SH_STANDARD_BIOS is not set
954# CONFIG_EARLY_SCIF_CONSOLE is not set 1030# CONFIG_EARLY_SCIF_CONSOLE is not set
@@ -1003,6 +1079,10 @@ CONFIG_CRYPTO=y
1003# CONFIG_CRYPTO_MD4 is not set 1079# CONFIG_CRYPTO_MD4 is not set
1004# CONFIG_CRYPTO_MD5 is not set 1080# CONFIG_CRYPTO_MD5 is not set
1005# CONFIG_CRYPTO_MICHAEL_MIC is not set 1081# CONFIG_CRYPTO_MICHAEL_MIC is not set
1082# CONFIG_CRYPTO_RMD128 is not set
1083# CONFIG_CRYPTO_RMD160 is not set
1084# CONFIG_CRYPTO_RMD256 is not set
1085# CONFIG_CRYPTO_RMD320 is not set
1006# CONFIG_CRYPTO_SHA1 is not set 1086# CONFIG_CRYPTO_SHA1 is not set
1007# CONFIG_CRYPTO_SHA256 is not set 1087# CONFIG_CRYPTO_SHA256 is not set
1008# CONFIG_CRYPTO_SHA512 is not set 1088# CONFIG_CRYPTO_SHA512 is not set
@@ -1042,6 +1122,7 @@ CONFIG_BITREVERSE=y
1042# CONFIG_GENERIC_FIND_FIRST_BIT is not set 1122# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1043# CONFIG_CRC_CCITT is not set 1123# CONFIG_CRC_CCITT is not set
1044# CONFIG_CRC16 is not set 1124# CONFIG_CRC16 is not set
1125CONFIG_CRC_T10DIF=y
1045# CONFIG_CRC_ITU_T is not set 1126# CONFIG_CRC_ITU_T is not set
1046CONFIG_CRC32=y 1127CONFIG_CRC32=y
1047# CONFIG_CRC7 is not set 1128# CONFIG_CRC7 is not set
diff --git a/arch/sh/include/asm/flat.h b/arch/sh/include/asm/flat.h
index 0cc800299e06..d3b2b4f109e3 100644
--- a/arch/sh/include/asm/flat.h
+++ b/arch/sh/include/asm/flat.h
@@ -21,4 +21,11 @@
21#define flat_get_relocate_addr(rel) (rel) 21#define flat_get_relocate_addr(rel) (rel)
22#define flat_set_persistent(relval, p) ({ (void)p; 0; }) 22#define flat_set_persistent(relval, p) ({ (void)p; 0; })
23 23
24#define FLAT_PLAT_INIT(_r) \
25 do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
26 _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
27 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
28 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
29 _r->sr = SR_FD; } while (0)
30
24#endif /* __ASM_SH_FLAT_H */ 31#endif /* __ASM_SH_FLAT_H */
diff --git a/arch/sh/include/asm/migor.h b/arch/sh/include/asm/migor.h
index 10016e0f4a4e..c12b632c540b 100644
--- a/arch/sh/include/asm/migor.h
+++ b/arch/sh/include/asm/migor.h
@@ -42,9 +42,6 @@
42 42
43#define PORT_MSELCRB 0xa4050182 43#define PORT_MSELCRB 0xa4050182
44 44
45#define MSTPCR1 0xa4150034
46#define MSTPCR2 0xa4150038
47
48#define PORT_PSELA 0xa405014e 45#define PORT_PSELA 0xa405014e
49#define PORT_PSELB 0xa4050150 46#define PORT_PSELB 0xa4050150
50#define PORT_PSELC 0xa4050152 47#define PORT_PSELC 0xa4050152
diff --git a/arch/sh/include/asm/sh_mobile_lcdc.h b/arch/sh/include/asm/sh_mobile_lcdc.h
index 27677727df4d..130102f663f5 100644
--- a/arch/sh/include/asm/sh_mobile_lcdc.h
+++ b/arch/sh/include/asm/sh_mobile_lcdc.h
@@ -47,12 +47,18 @@ struct sh_mobile_lcdc_board_cfg {
47 void (*display_off)(void *board_data); 47 void (*display_off)(void *board_data);
48}; 48};
49 49
50struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
51 unsigned long width;
52 unsigned long height;
53};
54
50struct sh_mobile_lcdc_chan_cfg { 55struct sh_mobile_lcdc_chan_cfg {
51 int chan; 56 int chan;
52 int bpp; 57 int bpp;
53 int interface_type; /* selects RGBn or SYSn I/F, see above */ 58 int interface_type; /* selects RGBn or SYSn I/F, see above */
54 int clock_divider; 59 int clock_divider;
55 struct fb_videomode lcd_cfg; 60 struct fb_videomode lcd_cfg;
61 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
56 struct sh_mobile_lcdc_board_cfg board_cfg; 62 struct sh_mobile_lcdc_board_cfg board_cfg;
57 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 63 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
58}; 64};
diff --git a/arch/sh/include/cpu-sh3/cpu/cacheflush.h b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
index abc909880807..1ac27aae6700 100644
--- a/arch/sh/include/cpu-sh3/cpu/cacheflush.h
+++ b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
@@ -29,6 +29,16 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned l
29void flush_dcache_page(struct page *pg); 29void flush_dcache_page(struct page *pg);
30void flush_icache_range(unsigned long start, unsigned long end); 30void flush_icache_range(unsigned long start, unsigned long end);
31void flush_icache_page(struct vm_area_struct *vma, struct page *page); 31void flush_icache_page(struct vm_area_struct *vma, struct page *page);
32
33#define flush_dcache_mmap_lock(mapping) do { } while (0)
34#define flush_dcache_mmap_unlock(mapping) do { } while (0)
35
36/* SH3 has unified cache so no special action needed here */
37#define flush_cache_sigtramp(vaddr) do { } while (0)
38#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
39
40#define p3_cache_init() do { } while (0)
41
32#else 42#else
33#include <cpu-common/cpu/cacheflush.h> 43#include <cpu-common/cpu/cacheflush.h>
34#endif 44#endif
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index cd6baffdc896..a7412cede534 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -45,7 +45,7 @@ static struct platform_device vpu_device = {
45}; 45};
46 46
47static struct uio_info veu0_platform_data = { 47static struct uio_info veu0_platform_data = {
48 .name = "VEU", 48 .name = "VEU2H",
49 .version = "0", 49 .version = "0",
50 .irq = 54, 50 .irq = 54,
51}; 51};
@@ -73,7 +73,7 @@ static struct platform_device veu0_device = {
73}; 73};
74 74
75static struct uio_info veu1_platform_data = { 75static struct uio_info veu1_platform_data = {
76 .name = "VEU", 76 .name = "VEU2H",
77 .version = "0", 77 .version = "0",
78 .irq = 27, 78 .irq = 27,
79}; 79};
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index 8f916536719c..6e1b1c271658 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -107,10 +107,12 @@ DECLARE_EXPORT(__movmemSI12_i4);
107 * GCC >= 4.2 emits these for division, as do GCC 4.1.x versions of the ST 107 * GCC >= 4.2 emits these for division, as do GCC 4.1.x versions of the ST
108 * compiler which include backported patches. 108 * compiler which include backported patches.
109 */ 109 */
110DECLARE_EXPORT(__sdivsi3_i4i);
111DECLARE_EXPORT(__udiv_qrnnd_16); 110DECLARE_EXPORT(__udiv_qrnnd_16);
111#if !defined(CONFIG_CPU_SH2)
112DECLARE_EXPORT(__sdivsi3_i4i);
112DECLARE_EXPORT(__udivsi3_i4i); 113DECLARE_EXPORT(__udivsi3_i4i);
113#endif 114#endif
115#endif
114#else /* GCC 3.x */ 116#else /* GCC 3.x */
115DECLARE_EXPORT(__movstr_i4_even); 117DECLARE_EXPORT(__movstr_i4_even);
116DECLARE_EXPORT(__movstr_i4_odd); 118DECLARE_EXPORT(__movstr_i4_odd);
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 9c131cac91a4..8a03926ea84f 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -181,10 +181,12 @@ config ENTRY_OFFSET
181choice 181choice
182 prompt "HugeTLB page size" 182 prompt "HugeTLB page size"
183 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU 183 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU
184 default HUGETLB_PAGE_SIZE_1MB if PAGE_SIZE_64KB
184 default HUGETLB_PAGE_SIZE_64K 185 default HUGETLB_PAGE_SIZE_64K
185 186
186config HUGETLB_PAGE_SIZE_64K 187config HUGETLB_PAGE_SIZE_64K
187 bool "64kB" 188 bool "64kB"
189 depends on !PAGE_SIZE_64KB
188 190
189config HUGETLB_PAGE_SIZE_256K 191config HUGETLB_PAGE_SIZE_256K
190 bool "256kB" 192 bool "256kB"
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index b2ce014401b5..895bb3f335c7 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -95,6 +95,29 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
95} 95}
96EXPORT_SYMBOL(dma_cache_sync); 96EXPORT_SYMBOL(dma_cache_sync);
97 97
98static int __init memchunk_setup(char *str)
99{
100 return 1; /* accept anything that begins with "memchunk." */
101}
102__setup("memchunk.", memchunk_setup);
103
104static void memchunk_cmdline_override(char *name, unsigned long *sizep)
105{
106 char *p = boot_command_line;
107 int k = strlen(name);
108
109 while ((p = strstr(p, "memchunk."))) {
110 p += 9; /* strlen("memchunk.") */
111 if (!strncmp(name, p, k) && p[k] == '=') {
112 p += k + 1;
113 *sizep = memparse(p, NULL);
114 pr_info("%s: forcing memory chunk size to 0x%08lx\n",
115 name, *sizep);
116 break;
117 }
118 }
119}
120
98int platform_resource_setup_memory(struct platform_device *pdev, 121int platform_resource_setup_memory(struct platform_device *pdev,
99 char *name, unsigned long memsize) 122 char *name, unsigned long memsize)
100{ 123{
@@ -109,6 +132,10 @@ int platform_resource_setup_memory(struct platform_device *pdev,
109 return -EINVAL; 132 return -EINVAL;
110 } 133 }
111 134
135 memchunk_cmdline_override(name, &memsize);
136 if (!memsize)
137 return 0;
138
112 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL); 139 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL);
113 if (!buf) { 140 if (!buf) {
114 pr_warning("%s: unable to allocate memory\n", name); 141 pr_warning("%s: unable to allocate memory\n", name);
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 4e7271999a74..84bb395038d8 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -737,63 +737,44 @@ static int find_psb_table(struct powernow_k8_data *data)
737#ifdef CONFIG_X86_POWERNOW_K8_ACPI 737#ifdef CONFIG_X86_POWERNOW_K8_ACPI
738static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) 738static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index)
739{ 739{
740 if (!data->acpi_data->state_count || (cpu_family == CPU_HW_PSTATE)) 740 if (!data->acpi_data.state_count || (cpu_family == CPU_HW_PSTATE))
741 return; 741 return;
742 742
743 data->irt = (data->acpi_data->states[index].control >> IRT_SHIFT) & IRT_MASK; 743 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK;
744 data->rvo = (data->acpi_data->states[index].control >> RVO_SHIFT) & RVO_MASK; 744 data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK;
745 data->exttype = (data->acpi_data->states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK; 745 data->exttype = (data->acpi_data.states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK;
746 data->plllock = (data->acpi_data->states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; 746 data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK;
747 data->vidmvs = 1 << ((data->acpi_data->states[index].control >> MVS_SHIFT) & MVS_MASK); 747 data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK);
748 data->vstable = (data->acpi_data->states[index].control >> VST_SHIFT) & VST_MASK; 748 data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK;
749}
750
751
752static struct acpi_processor_performance *acpi_perf_data;
753static int preregister_valid;
754
755static int powernow_k8_cpu_preinit_acpi(void)
756{
757 acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
758 if (!acpi_perf_data)
759 return -ENODEV;
760
761 if (acpi_processor_preregister_performance(acpi_perf_data))
762 return -ENODEV;
763 else
764 preregister_valid = 1;
765 return 0;
766} 749}
767 750
768static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) 751static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
769{ 752{
770 struct cpufreq_frequency_table *powernow_table; 753 struct cpufreq_frequency_table *powernow_table;
771 int ret_val; 754 int ret_val;
772 int cpu = 0;
773 755
774 data->acpi_data = percpu_ptr(acpi_perf_data, cpu); 756 if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) {
775 if (acpi_processor_register_performance(data->acpi_data, data->cpu)) {
776 dprintk("register performance failed: bad ACPI data\n"); 757 dprintk("register performance failed: bad ACPI data\n");
777 return -EIO; 758 return -EIO;
778 } 759 }
779 760
780 /* verify the data contained in the ACPI structures */ 761 /* verify the data contained in the ACPI structures */
781 if (data->acpi_data->state_count <= 1) { 762 if (data->acpi_data.state_count <= 1) {
782 dprintk("No ACPI P-States\n"); 763 dprintk("No ACPI P-States\n");
783 goto err_out; 764 goto err_out;
784 } 765 }
785 766
786 if ((data->acpi_data->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || 767 if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) ||
787 (data->acpi_data->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { 768 (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) {
788 dprintk("Invalid control/status registers (%x - %x)\n", 769 dprintk("Invalid control/status registers (%x - %x)\n",
789 data->acpi_data->control_register.space_id, 770 data->acpi_data.control_register.space_id,
790 data->acpi_data->status_register.space_id); 771 data->acpi_data.status_register.space_id);
791 goto err_out; 772 goto err_out;
792 } 773 }
793 774
794 /* fill in data->powernow_table */ 775 /* fill in data->powernow_table */
795 powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table) 776 powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table)
796 * (data->acpi_data->state_count + 1)), GFP_KERNEL); 777 * (data->acpi_data.state_count + 1)), GFP_KERNEL);
797 if (!powernow_table) { 778 if (!powernow_table) {
798 dprintk("powernow_table memory alloc failure\n"); 779 dprintk("powernow_table memory alloc failure\n");
799 goto err_out; 780 goto err_out;
@@ -806,12 +787,12 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
806 if (ret_val) 787 if (ret_val)
807 goto err_out_mem; 788 goto err_out_mem;
808 789
809 powernow_table[data->acpi_data->state_count].frequency = CPUFREQ_TABLE_END; 790 powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END;
810 powernow_table[data->acpi_data->state_count].index = 0; 791 powernow_table[data->acpi_data.state_count].index = 0;
811 data->powernow_table = powernow_table; 792 data->powernow_table = powernow_table;
812 793
813 /* fill in data */ 794 /* fill in data */
814 data->numps = data->acpi_data->state_count; 795 data->numps = data->acpi_data.state_count;
815 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu) 796 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
816 print_basics(data); 797 print_basics(data);
817 powernow_k8_acpi_pst_values(data, 0); 798 powernow_k8_acpi_pst_values(data, 0);
@@ -819,31 +800,16 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
819 /* notify BIOS that we exist */ 800 /* notify BIOS that we exist */
820 acpi_processor_notify_smm(THIS_MODULE); 801 acpi_processor_notify_smm(THIS_MODULE);
821 802
822 /* determine affinity, from ACPI if available */
823 if (preregister_valid) {
824 if ((data->acpi_data->shared_type == CPUFREQ_SHARED_TYPE_ALL) ||
825 (data->acpi_data->shared_type == CPUFREQ_SHARED_TYPE_ANY))
826 data->starting_core_affinity = data->acpi_data->shared_cpu_map;
827 else
828 data->starting_core_affinity = cpumask_of_cpu(data->cpu);
829 } else {
830 /* best guess from family if not */
831 if (cpu_family == CPU_HW_PSTATE)
832 data->starting_core_affinity = cpumask_of_cpu(data->cpu);
833 else
834 data->starting_core_affinity = per_cpu(cpu_core_map, data->cpu);
835 }
836
837 return 0; 803 return 0;
838 804
839err_out_mem: 805err_out_mem:
840 kfree(powernow_table); 806 kfree(powernow_table);
841 807
842err_out: 808err_out:
843 acpi_processor_unregister_performance(data->acpi_data, data->cpu); 809 acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
844 810
845 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */ 811 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
846 data->acpi_data->state_count = 0; 812 data->acpi_data.state_count = 0;
847 813
848 return -ENODEV; 814 return -ENODEV;
849} 815}
@@ -855,10 +821,10 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
855 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo); 821 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo);
856 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT; 822 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
857 823
858 for (i = 0; i < data->acpi_data->state_count; i++) { 824 for (i = 0; i < data->acpi_data.state_count; i++) {
859 u32 index; 825 u32 index;
860 826
861 index = data->acpi_data->states[i].control & HW_PSTATE_MASK; 827 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
862 if (index > data->max_hw_pstate) { 828 if (index > data->max_hw_pstate) {
863 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); 829 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
864 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); 830 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
@@ -874,7 +840,7 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
874 840
875 powernow_table[i].index = index; 841 powernow_table[i].index = index;
876 842
877 powernow_table[i].frequency = data->acpi_data->states[i].core_frequency * 1000; 843 powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000;
878 } 844 }
879 return 0; 845 return 0;
880} 846}
@@ -883,16 +849,16 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpuf
883{ 849{
884 int i; 850 int i;
885 int cntlofreq = 0; 851 int cntlofreq = 0;
886 for (i = 0; i < data->acpi_data->state_count; i++) { 852 for (i = 0; i < data->acpi_data.state_count; i++) {
887 u32 fid; 853 u32 fid;
888 u32 vid; 854 u32 vid;
889 855
890 if (data->exttype) { 856 if (data->exttype) {
891 fid = data->acpi_data->states[i].status & EXT_FID_MASK; 857 fid = data->acpi_data.states[i].status & EXT_FID_MASK;
892 vid = (data->acpi_data->states[i].status >> VID_SHIFT) & EXT_VID_MASK; 858 vid = (data->acpi_data.states[i].status >> VID_SHIFT) & EXT_VID_MASK;
893 } else { 859 } else {
894 fid = data->acpi_data->states[i].control & FID_MASK; 860 fid = data->acpi_data.states[i].control & FID_MASK;
895 vid = (data->acpi_data->states[i].control >> VID_SHIFT) & VID_MASK; 861 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK;
896 } 862 }
897 863
898 dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid); 864 dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
@@ -933,10 +899,10 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpuf
933 cntlofreq = i; 899 cntlofreq = i;
934 } 900 }
935 901
936 if (powernow_table[i].frequency != (data->acpi_data->states[i].core_frequency * 1000)) { 902 if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
937 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n", 903 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
938 powernow_table[i].frequency, 904 powernow_table[i].frequency,
939 (unsigned int) (data->acpi_data->states[i].core_frequency * 1000)); 905 (unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
940 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; 906 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
941 continue; 907 continue;
942 } 908 }
@@ -946,12 +912,11 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpuf
946 912
947static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) 913static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
948{ 914{
949 if (data->acpi_data->state_count) 915 if (data->acpi_data.state_count)
950 acpi_processor_unregister_performance(data->acpi_data, data->cpu); 916 acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
951} 917}
952 918
953#else 919#else
954static int powernow_k8_cpu_preinit_acpi(void) { return -ENODEV; }
955static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) { return -ENODEV; } 920static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) { return -ENODEV; }
956static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) { return; } 921static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) { return; }
957static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) { return; } 922static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) { return; }
@@ -1136,7 +1101,7 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
1136static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) 1101static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1137{ 1102{
1138 struct powernow_k8_data *data; 1103 struct powernow_k8_data *data;
1139 cpumask_t oldmask = CPU_MASK_ALL; 1104 cpumask_t oldmask;
1140 int rc; 1105 int rc;
1141 1106
1142 if (!cpu_online(pol->cpu)) 1107 if (!cpu_online(pol->cpu))
@@ -1209,7 +1174,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1209 /* run on any CPU again */ 1174 /* run on any CPU again */
1210 set_cpus_allowed_ptr(current, &oldmask); 1175 set_cpus_allowed_ptr(current, &oldmask);
1211 1176
1212 pol->cpus = data->starting_core_affinity; 1177 if (cpu_family == CPU_HW_PSTATE)
1178 pol->cpus = cpumask_of_cpu(pol->cpu);
1179 else
1180 pol->cpus = per_cpu(cpu_core_map, pol->cpu);
1213 data->available_cores = &(pol->cpus); 1181 data->available_cores = &(pol->cpus);
1214 1182
1215 /* Take a crude guess here. 1183 /* Take a crude guess here.
@@ -1332,7 +1300,6 @@ static int __cpuinit powernowk8_init(void)
1332 } 1300 }
1333 1301
1334 if (supported_cpus == num_online_cpus()) { 1302 if (supported_cpus == num_online_cpus()) {
1335 powernow_k8_cpu_preinit_acpi();
1336 printk(KERN_INFO PFX "Found %d %s " 1303 printk(KERN_INFO PFX "Found %d %s "
1337 "processors (%d cpu cores) (" VERSION ")\n", 1304 "processors (%d cpu cores) (" VERSION ")\n",
1338 num_online_nodes(), 1305 num_online_nodes(),
@@ -1349,10 +1316,6 @@ static void __exit powernowk8_exit(void)
1349 dprintk("exit\n"); 1316 dprintk("exit\n");
1350 1317
1351 cpufreq_unregister_driver(&cpufreq_amd64_driver); 1318 cpufreq_unregister_driver(&cpufreq_amd64_driver);
1352
1353#ifdef CONFIG_X86_POWERNOW_K8_ACPI
1354 free_percpu(acpi_perf_data);
1355#endif
1356} 1319}
1357 1320
1358MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>"); 1321MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>");
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index a62612cd4be8..ab48cfed4d96 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -33,13 +33,12 @@ struct powernow_k8_data {
33#ifdef CONFIG_X86_POWERNOW_K8_ACPI 33#ifdef CONFIG_X86_POWERNOW_K8_ACPI
34 /* the acpi table needs to be kept. it's only available if ACPI was 34 /* the acpi table needs to be kept. it's only available if ACPI was
35 * used to determine valid frequency/vid/fid states */ 35 * used to determine valid frequency/vid/fid states */
36 struct acpi_processor_performance *acpi_data; 36 struct acpi_processor_performance acpi_data;
37#endif 37#endif
38 /* we need to keep track of associated cores, but let cpufreq 38 /* we need to keep track of associated cores, but let cpufreq
39 * handle hotplug events - so just point at cpufreq pol->cpus 39 * handle hotplug events - so just point at cpufreq pol->cpus
40 * structure */ 40 * structure */
41 cpumask_t *available_cores; 41 cpumask_t *available_cores;
42 cpumask_t starting_core_affinity;
43}; 42};
44 43
45 44
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 3fa4e926b510..6a44d6465991 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -88,6 +88,8 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
88 struct cpuid_regs cmd; 88 struct cpuid_regs cmd;
89 int cpu = iminor(file->f_path.dentry->d_inode); 89 int cpu = iminor(file->f_path.dentry->d_inode);
90 u64 pos = *ppos; 90 u64 pos = *ppos;
91 ssize_t bytes = 0;
92 int err = 0;
91 93
92 if (count % 16) 94 if (count % 16)
93 return -EINVAL; /* Invalid chunk size */ 95 return -EINVAL; /* Invalid chunk size */
@@ -95,14 +97,19 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
95 for (; count; count -= 16) { 97 for (; count; count -= 16) {
96 cmd.eax = pos; 98 cmd.eax = pos;
97 cmd.ecx = pos >> 32; 99 cmd.ecx = pos >> 32;
98 smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); 100 err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1);
99 if (copy_to_user(tmp, &cmd, 16)) 101 if (err)
100 return -EFAULT; 102 break;
103 if (copy_to_user(tmp, &cmd, 16)) {
104 err = -EFAULT;
105 break;
106 }
101 tmp += 16; 107 tmp += 16;
108 bytes += 16;
102 *ppos = ++pos; 109 *ppos = ++pos;
103 } 110 }
104 111
105 return tmp - buf; 112 return bytes ? bytes : err;
106} 113}
107 114
108static int cpuid_open(struct inode *inode, struct file *file) 115static int cpuid_open(struct inode *inode, struct file *file)
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index e43938086885..2e2af5d18191 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -72,21 +72,28 @@ static ssize_t msr_read(struct file *file, char __user *buf,
72 u32 data[2]; 72 u32 data[2];
73 u32 reg = *ppos; 73 u32 reg = *ppos;
74 int cpu = iminor(file->f_path.dentry->d_inode); 74 int cpu = iminor(file->f_path.dentry->d_inode);
75 int err; 75 int err = 0;
76 ssize_t bytes = 0;
76 77
77 if (count % 8) 78 if (count % 8)
78 return -EINVAL; /* Invalid chunk size */ 79 return -EINVAL; /* Invalid chunk size */
79 80
80 for (; count; count -= 8) { 81 for (; count; count -= 8) {
81 err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); 82 err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]);
82 if (err) 83 if (err) {
83 return -EIO; 84 if (err == -EFAULT) /* Fix idiotic error code */
84 if (copy_to_user(tmp, &data, 8)) 85 err = -EIO;
85 return -EFAULT; 86 break;
87 }
88 if (copy_to_user(tmp, &data, 8)) {
89 err = -EFAULT;
90 break;
91 }
86 tmp += 2; 92 tmp += 2;
93 bytes += 8;
87 } 94 }
88 95
89 return ((char __user *)tmp) - buf; 96 return bytes ? bytes : err;
90} 97}
91 98
92static ssize_t msr_write(struct file *file, const char __user *buf, 99static ssize_t msr_write(struct file *file, const char __user *buf,
@@ -96,21 +103,28 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
96 u32 data[2]; 103 u32 data[2];
97 u32 reg = *ppos; 104 u32 reg = *ppos;
98 int cpu = iminor(file->f_path.dentry->d_inode); 105 int cpu = iminor(file->f_path.dentry->d_inode);
99 int err; 106 int err = 0;
107 ssize_t bytes = 0;
100 108
101 if (count % 8) 109 if (count % 8)
102 return -EINVAL; /* Invalid chunk size */ 110 return -EINVAL; /* Invalid chunk size */
103 111
104 for (; count; count -= 8) { 112 for (; count; count -= 8) {
105 if (copy_from_user(&data, tmp, 8)) 113 if (copy_from_user(&data, tmp, 8)) {
106 return -EFAULT; 114 err = -EFAULT;
115 break;
116 }
107 err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); 117 err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]);
108 if (err) 118 if (err) {
109 return -EIO; 119 if (err == -EFAULT) /* Fix idiotic error code */
120 err = -EIO;
121 break;
122 }
110 tmp += 2; 123 tmp += 2;
124 bytes += 8;
111 } 125 }
112 126
113 return ((char __user *)tmp) - buf; 127 return bytes ? bytes : err;
114} 128}
115 129
116static int msr_open(struct inode *inode, struct file *file) 130static int msr_open(struct inode *inode, struct file *file)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9bed5cae4bdc..8e786b0d665a 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -314,7 +314,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
314 mark_tsc_unstable("cpufreq changes"); 314 mark_tsc_unstable("cpufreq changes");
315 } 315 }
316 316
317 set_cyc2ns_scale(tsc_khz_ref, freq->cpu); 317 set_cyc2ns_scale(tsc_khz, freq->cpu);
318 318
319 return 0; 319 return 0;
320} 320}
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr-on-cpu.c
index d5a2b39f882b..01b868ba82f8 100644
--- a/arch/x86/lib/msr-on-cpu.c
+++ b/arch/x86/lib/msr-on-cpu.c
@@ -30,10 +30,11 @@ static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe)
30 30
31 rv.msr_no = msr_no; 31 rv.msr_no = msr_no;
32 if (safe) { 32 if (safe) {
33 smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); 33 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
34 err = rv.err; 34 &rv, 1);
35 err = err ? err : rv.err;
35 } else { 36 } else {
36 smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); 37 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
37 } 38 }
38 *l = rv.l; 39 *l = rv.l;
39 *h = rv.h; 40 *h = rv.h;
@@ -64,23 +65,24 @@ static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe)
64 rv.l = l; 65 rv.l = l;
65 rv.h = h; 66 rv.h = h;
66 if (safe) { 67 if (safe) {
67 smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); 68 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
68 err = rv.err; 69 &rv, 1);
70 err = err ? err : rv.err;
69 } else { 71 } else {
70 smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); 72 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
71 } 73 }
72 74
73 return err; 75 return err;
74} 76}
75 77
76void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) 78int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
77{ 79{
78 _wrmsr_on_cpu(cpu, msr_no, l, h, 0); 80 return _wrmsr_on_cpu(cpu, msr_no, l, h, 0);
79} 81}
80 82
81void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) 83int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
82{ 84{
83 _rdmsr_on_cpu(cpu, msr_no, l, h, 0); 85 return _rdmsr_on_cpu(cpu, msr_no, l, h, 0);
84} 86}
85 87
86/* These "safe" variants are slower and should be used when the target MSR 88/* These "safe" variants are slower and should be used when the target MSR
diff --git a/arch/x86/mach-rdc321x/platform.c b/arch/x86/mach-rdc321x/platform.c
index a037041817c7..4f4e50c3ad3b 100644
--- a/arch/x86/mach-rdc321x/platform.c
+++ b/arch/x86/mach-rdc321x/platform.c
@@ -25,7 +25,6 @@
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/version.h>
29#include <linux/leds.h> 28#include <linux/leds.h>
30 29
31#include <asm/gpio.h> 30#include <asm/gpio.h>
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index d781cc4f725a..006599db0dc7 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -590,6 +590,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
590 case PCI_DEVICE_ID_INTEL_ICH10_1: 590 case PCI_DEVICE_ID_INTEL_ICH10_1:
591 case PCI_DEVICE_ID_INTEL_ICH10_2: 591 case PCI_DEVICE_ID_INTEL_ICH10_2:
592 case PCI_DEVICE_ID_INTEL_ICH10_3: 592 case PCI_DEVICE_ID_INTEL_ICH10_3:
593 case PCI_DEVICE_ID_INTEL_PCH_0:
594 case PCI_DEVICE_ID_INTEL_PCH_1:
593 r->name = "PIIX/ICH"; 595 r->name = "PIIX/ICH";
594 r->get = pirq_piix_get; 596 r->get = pirq_piix_get;
595 r->set = pirq_piix_set; 597 r->set = pirq_piix_set;
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index ec9ce35e44d6..b722dd481b39 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -14,7 +14,7 @@ static void __devinit pcibios_fixup_peer_bridges(void)
14 int n, devfn; 14 int n, devfn;
15 long node; 15 long node;
16 16
17 if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff) 17 if (pcibios_last_bus <= 0 || pcibios_last_bus > 0xff)
18 return; 18 return;
19 DBG("PCI: Peer bridge fixup\n"); 19 DBG("PCI: Peer bridge fixup\n");
20 20
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 2bd5c53f6386..d9635764ce3d 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -293,7 +293,7 @@ static acpi_status __init find_mboard_resource(acpi_handle handle, u32 lvl,
293 return AE_OK; 293 return AE_OK;
294} 294}
295 295
296static int __init is_acpi_reserved(unsigned long start, unsigned long end) 296static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used)
297{ 297{
298 struct resource mcfg_res; 298 struct resource mcfg_res;
299 299
@@ -310,6 +310,41 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end)
310 return mcfg_res.flags; 310 return mcfg_res.flags;
311} 311}
312 312
313typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type);
314
315static int __init is_mmconf_reserved(check_reserved_t is_reserved,
316 u64 addr, u64 size, int i,
317 typeof(pci_mmcfg_config[0]) *cfg, int with_e820)
318{
319 u64 old_size = size;
320 int valid = 0;
321
322 while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) {
323 size >>= 1;
324 if (size < (16UL<<20))
325 break;
326 }
327
328 if (size >= (16UL<<20) || size == old_size) {
329 printk(KERN_NOTICE
330 "PCI: MCFG area at %Lx reserved in %s\n",
331 addr, with_e820?"E820":"ACPI motherboard resources");
332 valid = 1;
333
334 if (old_size != size) {
335 /* update end_bus_number */
336 cfg->end_bus_number = cfg->start_bus_number + ((size>>20) - 1);
337 printk(KERN_NOTICE "PCI: updated MCFG configuration %d: base %lx "
338 "segment %hu buses %u - %u\n",
339 i, (unsigned long)cfg->address, cfg->pci_segment,
340 (unsigned int)cfg->start_bus_number,
341 (unsigned int)cfg->end_bus_number);
342 }
343 }
344
345 return valid;
346}
347
313static void __init pci_mmcfg_reject_broken(int early) 348static void __init pci_mmcfg_reject_broken(int early)
314{ 349{
315 typeof(pci_mmcfg_config[0]) *cfg; 350 typeof(pci_mmcfg_config[0]) *cfg;
@@ -324,21 +359,22 @@ static void __init pci_mmcfg_reject_broken(int early)
324 359
325 for (i = 0; i < pci_mmcfg_config_num; i++) { 360 for (i = 0; i < pci_mmcfg_config_num; i++) {
326 int valid = 0; 361 int valid = 0;
327 u32 size = (cfg->end_bus_number + 1) << 20; 362 u64 addr, size;
363
328 cfg = &pci_mmcfg_config[i]; 364 cfg = &pci_mmcfg_config[i];
365 addr = cfg->start_bus_number;
366 addr <<= 20;
367 addr += cfg->address;
368 size = cfg->end_bus_number + 1 - cfg->start_bus_number;
369 size <<= 20;
329 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " 370 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx "
330 "segment %hu buses %u - %u\n", 371 "segment %hu buses %u - %u\n",
331 i, (unsigned long)cfg->address, cfg->pci_segment, 372 i, (unsigned long)cfg->address, cfg->pci_segment,
332 (unsigned int)cfg->start_bus_number, 373 (unsigned int)cfg->start_bus_number,
333 (unsigned int)cfg->end_bus_number); 374 (unsigned int)cfg->end_bus_number);
334 375
335 if (!early && 376 if (!early)
336 is_acpi_reserved(cfg->address, cfg->address + size - 1)) { 377 valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0);
337 printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved "
338 "in ACPI motherboard resources\n",
339 cfg->address);
340 valid = 1;
341 }
342 378
343 if (valid) 379 if (valid)
344 continue; 380 continue;
@@ -347,16 +383,11 @@ static void __init pci_mmcfg_reject_broken(int early)
347 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" 383 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
348 " reserved in ACPI motherboard resources\n", 384 " reserved in ACPI motherboard resources\n",
349 cfg->address); 385 cfg->address);
386
350 /* Don't try to do this check unless configuration 387 /* Don't try to do this check unless configuration
351 type 1 is available. how about type 2 ?*/ 388 type 1 is available. how about type 2 ?*/
352 if (raw_pci_ops && e820_all_mapped(cfg->address, 389 if (raw_pci_ops)
353 cfg->address + size - 1, 390 valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1);
354 E820_RESERVED)) {
355 printk(KERN_NOTICE
356 "PCI: MCFG area at %Lx reserved in E820\n",
357 cfg->address);
358 valid = 1;
359 }
360 391
361 if (!valid) 392 if (!valid)
362 goto reject; 393 goto reject;
diff --git a/block/genhd.c b/block/genhd.c
index c13cc77291af..656c2c7abf99 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -293,27 +293,30 @@ void __init printk_all_partitions(void)
293/* iterator */ 293/* iterator */
294static int find_start(struct device *dev, void *data) 294static int find_start(struct device *dev, void *data)
295{ 295{
296 loff_t k = *(loff_t *)data; 296 loff_t *k = data;
297 297
298 if (dev->type != &disk_type) 298 if (dev->type != &disk_type)
299 return 0; 299 return 0;
300 if (!k--) 300 if (!*k)
301 return 1; 301 return 1;
302 (*k)--;
302 return 0; 303 return 0;
303} 304}
304 305
305static void *part_start(struct seq_file *part, loff_t *pos) 306static void *part_start(struct seq_file *part, loff_t *pos)
306{ 307{
307 struct device *dev; 308 struct device *dev;
308 loff_t n = *pos; 309 loff_t k = *pos;
309 310
310 if (!n) 311 if (!k)
311 seq_puts(part, "major minor #blocks name\n\n"); 312 seq_puts(part, "major minor #blocks name\n\n");
312 313
313 mutex_lock(&block_class_lock); 314 mutex_lock(&block_class_lock);
314 dev = class_find_device(&block_class, NULL, (void *)pos, find_start); 315 dev = class_find_device(&block_class, NULL, &k, find_start);
315 if (dev) 316 if (dev) {
317 put_device(dev);
316 return dev_to_disk(dev); 318 return dev_to_disk(dev);
319 }
317 return NULL; 320 return NULL;
318} 321}
319 322
@@ -330,8 +333,10 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
330 struct device *dev; 333 struct device *dev;
331 ++*pos; 334 ++*pos;
332 dev = class_find_device(&block_class, &gp->dev, NULL, find_next); 335 dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
333 if (dev) 336 if (dev) {
337 put_device(dev);
334 return dev_to_disk(dev); 338 return dev_to_disk(dev);
339 }
335 return NULL; 340 return NULL;
336} 341}
337 342
@@ -568,11 +573,14 @@ static struct device_type disk_type = {
568static void *diskstats_start(struct seq_file *part, loff_t *pos) 573static void *diskstats_start(struct seq_file *part, loff_t *pos)
569{ 574{
570 struct device *dev; 575 struct device *dev;
576 loff_t k = *pos;
571 577
572 mutex_lock(&block_class_lock); 578 mutex_lock(&block_class_lock);
573 dev = class_find_device(&block_class, NULL, (void *)pos, find_start); 579 dev = class_find_device(&block_class, NULL, &k, find_start);
574 if (dev) 580 if (dev) {
581 put_device(dev);
575 return dev_to_disk(dev); 582 return dev_to_disk(dev);
583 }
576 return NULL; 584 return NULL;
577} 585}
578 586
@@ -583,8 +591,10 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)
583 591
584 ++*pos; 592 ++*pos;
585 dev = class_find_device(&block_class, &gp->dev, NULL, find_next); 593 dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
586 if (dev) 594 if (dev) {
595 put_device(dev);
587 return dev_to_disk(dev); 596 return dev_to_disk(dev);
597 }
588 return NULL; 598 return NULL;
589} 599}
590 600
@@ -712,10 +722,12 @@ dev_t blk_lookup_devt(const char *name, int part)
712 mutex_lock(&block_class_lock); 722 mutex_lock(&block_class_lock);
713 find.name = name; 723 find.name = name;
714 find.part = part; 724 find.part = part;
715 dev = class_find_device(&block_class, NULL, (void *)&find, match_id); 725 dev = class_find_device(&block_class, NULL, &find, match_id);
716 if (dev) 726 if (dev) {
727 put_device(dev);
717 devt = MKDEV(MAJOR(dev->devt), 728 devt = MKDEV(MAJOR(dev->devt),
718 MINOR(dev->devt) + part); 729 MINOR(dev->devt) + part);
730 }
719 mutex_unlock(&block_class_lock); 731 mutex_unlock(&block_class_lock);
720 732
721 return devt; 733 return devt;
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 4b226768752a..fd9f06c63d76 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -174,8 +174,9 @@ static int crypto_authenc_genicv(struct aead_request *req, u8 *iv,
174static void crypto_authenc_encrypt_done(struct crypto_async_request *req, 174static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
175 int err) 175 int err)
176{ 176{
177 struct aead_request *areq = req->data;
178
177 if (!err) { 179 if (!err) {
178 struct aead_request *areq = req->data;
179 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); 180 struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
180 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); 181 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
181 struct ablkcipher_request *abreq = aead_request_ctx(areq); 182 struct ablkcipher_request *abreq = aead_request_ctx(areq);
@@ -185,7 +186,7 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
185 err = crypto_authenc_genicv(areq, iv, 0); 186 err = crypto_authenc_genicv(areq, iv, 0);
186 } 187 }
187 188
188 aead_request_complete(req->data, err); 189 aead_request_complete(areq, err);
189} 190}
190 191
191static int crypto_authenc_encrypt(struct aead_request *req) 192static int crypto_authenc_encrypt(struct aead_request *req)
@@ -216,14 +217,15 @@ static int crypto_authenc_encrypt(struct aead_request *req)
216static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, 217static void crypto_authenc_givencrypt_done(struct crypto_async_request *req,
217 int err) 218 int err)
218{ 219{
220 struct aead_request *areq = req->data;
221
219 if (!err) { 222 if (!err) {
220 struct aead_request *areq = req->data;
221 struct skcipher_givcrypt_request *greq = aead_request_ctx(areq); 223 struct skcipher_givcrypt_request *greq = aead_request_ctx(areq);
222 224
223 err = crypto_authenc_genicv(areq, greq->giv, 0); 225 err = crypto_authenc_genicv(areq, greq->giv, 0);
224 } 226 }
225 227
226 aead_request_complete(req->data, err); 228 aead_request_complete(areq, err);
227} 229}
228 230
229static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req) 231static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ef3e5522e1a4..c729e6988bbb 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -486,6 +486,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ 486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */
487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ 487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */
488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ 488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */
489 { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
490 { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
489 491
490 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 492 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
491 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 493 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -575,9 +577,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
575 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ 577 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */
576 578
577 /* SiS */ 579 /* SiS */
578 { PCI_VDEVICE(SI, 0x1184), board_ahci_nopmp }, /* SiS 966 */ 580 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
579 { PCI_VDEVICE(SI, 0x1185), board_ahci_nopmp }, /* SiS 968 */ 581 { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 968 */
580 { PCI_VDEVICE(SI, 0x0186), board_ahci_nopmp }, /* SiS 968 */ 582 { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */
581 583
582 /* Marvell */ 584 /* Marvell */
583 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ 585 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index c294121fd69e..b1d08a8f5003 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -275,6 +275,14 @@ static const struct pci_device_id piix_pci_tbl[] = {
275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
276 /* SATA Controller IDE (ICH10) */ 276 /* SATA Controller IDE (ICH10) */
277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
278 /* SATA Controller IDE (PCH) */
279 { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
280 /* SATA Controller IDE (PCH) */
281 { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
282 /* SATA Controller IDE (PCH) */
283 { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
284 /* SATA Controller IDE (PCH) */
285 { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
278 286
279 { } /* terminate list */ 287 { } /* terminate list */
280}; 288};
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5ba96c5052c8..79e3a8e7a84a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -104,6 +104,7 @@ struct ata_force_param {
104 unsigned long xfer_mask; 104 unsigned long xfer_mask;
105 unsigned int horkage_on; 105 unsigned int horkage_on;
106 unsigned int horkage_off; 106 unsigned int horkage_off;
107 unsigned int lflags;
107}; 108};
108 109
109struct ata_force_ent { 110struct ata_force_ent {
@@ -196,22 +197,23 @@ void ata_force_cbl(struct ata_port *ap)
196} 197}
197 198
198/** 199/**
199 * ata_force_spd_limit - force SATA spd limit according to libata.force 200 * ata_force_link_limits - force link limits according to libata.force
200 * @link: ATA link of interest 201 * @link: ATA link of interest
201 * 202 *
202 * Force SATA spd limit according to libata.force and whine about 203 * Force link flags and SATA spd limit according to libata.force
203 * it. When only the port part is specified (e.g. 1:), the limit 204 * and whine about it. When only the port part is specified
204 * applies to all links connected to both the host link and all 205 * (e.g. 1:), the limit applies to all links connected to both
205 * fan-out ports connected via PMP. If the device part is 206 * the host link and all fan-out ports connected via PMP. If the
206 * specified as 0 (e.g. 1.00:), it specifies the first fan-out 207 * device part is specified as 0 (e.g. 1.00:), it specifies the
207 * link not the host link. Device number 15 always points to the 208 * first fan-out link not the host link. Device number 15 always
208 * host link whether PMP is attached or not. 209 * points to the host link whether PMP is attached or not.
209 * 210 *
210 * LOCKING: 211 * LOCKING:
211 * EH context. 212 * EH context.
212 */ 213 */
213static void ata_force_spd_limit(struct ata_link *link) 214static void ata_force_link_limits(struct ata_link *link)
214{ 215{
216 bool did_spd = false;
215 int linkno, i; 217 int linkno, i;
216 218
217 if (ata_is_host_link(link)) 219 if (ata_is_host_link(link))
@@ -228,13 +230,22 @@ static void ata_force_spd_limit(struct ata_link *link)
228 if (fe->device != -1 && fe->device != linkno) 230 if (fe->device != -1 && fe->device != linkno)
229 continue; 231 continue;
230 232
231 if (!fe->param.spd_limit) 233 /* only honor the first spd limit */
232 continue; 234 if (!did_spd && fe->param.spd_limit) {
235 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1;
236 ata_link_printk(link, KERN_NOTICE,
237 "FORCE: PHY spd limit set to %s\n",
238 fe->param.name);
239 did_spd = true;
240 }
233 241
234 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; 242 /* let lflags stack */
235 ata_link_printk(link, KERN_NOTICE, 243 if (fe->param.lflags) {
236 "FORCE: PHY spd limit set to %s\n", fe->param.name); 244 link->flags |= fe->param.lflags;
237 return; 245 ata_link_printk(link, KERN_NOTICE,
246 "FORCE: link flag 0x%x forced -> 0x%x\n",
247 fe->param.lflags, link->flags);
248 }
238 } 249 }
239} 250}
240 251
@@ -3277,7 +3288,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3277 dev->dma_mode = ata_xfer_mask2mode(dma_mask); 3288 dev->dma_mode = ata_xfer_mask2mode(dma_mask);
3278 3289
3279 found = 1; 3290 found = 1;
3280 if (dev->dma_mode != 0xff) 3291 if (ata_dma_enabled(dev))
3281 used_dma = 1; 3292 used_dma = 1;
3282 } 3293 }
3283 if (!found) 3294 if (!found)
@@ -3302,7 +3313,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3302 3313
3303 /* step 3: set host DMA timings */ 3314 /* step 3: set host DMA timings */
3304 ata_link_for_each_dev(dev, link) { 3315 ata_link_for_each_dev(dev, link) {
3305 if (!ata_dev_enabled(dev) || dev->dma_mode == 0xff) 3316 if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev))
3306 continue; 3317 continue;
3307 3318
3308 dev->xfer_mode = dev->dma_mode; 3319 dev->xfer_mode = dev->dma_mode;
@@ -5188,19 +5199,18 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
5188 */ 5199 */
5189int sata_link_init_spd(struct ata_link *link) 5200int sata_link_init_spd(struct ata_link *link)
5190{ 5201{
5191 u32 scontrol;
5192 u8 spd; 5202 u8 spd;
5193 int rc; 5203 int rc;
5194 5204
5195 rc = sata_scr_read(link, SCR_CONTROL, &scontrol); 5205 rc = sata_scr_read(link, SCR_CONTROL, &link->saved_scontrol);
5196 if (rc) 5206 if (rc)
5197 return rc; 5207 return rc;
5198 5208
5199 spd = (scontrol >> 4) & 0xf; 5209 spd = (link->saved_scontrol >> 4) & 0xf;
5200 if (spd) 5210 if (spd)
5201 link->hw_sata_spd_limit &= (1 << spd) - 1; 5211 link->hw_sata_spd_limit &= (1 << spd) - 1;
5202 5212
5203 ata_force_spd_limit(link); 5213 ata_force_link_limits(link);
5204 5214
5205 link->sata_spd_limit = link->hw_sata_spd_limit; 5215 link->sata_spd_limit = link->hw_sata_spd_limit;
5206 5216
@@ -5783,9 +5793,10 @@ static void ata_port_detach(struct ata_port *ap)
5783 ata_port_wait_eh(ap); 5793 ata_port_wait_eh(ap);
5784 5794
5785 /* EH is now guaranteed to see UNLOADING - EH context belongs 5795 /* EH is now guaranteed to see UNLOADING - EH context belongs
5786 * to us. Disable all existing devices. 5796 * to us. Restore SControl and disable all existing devices.
5787 */ 5797 */
5788 ata_port_for_each_link(link, ap) { 5798 __ata_port_for_each_link(link, ap) {
5799 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol);
5789 ata_link_for_each_dev(dev, link) 5800 ata_link_for_each_dev(dev, link)
5790 ata_dev_disable(dev); 5801 ata_dev_disable(dev);
5791 } 5802 }
@@ -5991,6 +6002,9 @@ static int __init ata_parse_force_one(char **cur,
5991 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6002 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
5992 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6003 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
5993 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, 6004 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) },
6005 { "nohrst", .lflags = ATA_LFLAG_NO_HRST },
6006 { "nosrst", .lflags = ATA_LFLAG_NO_SRST },
6007 { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST },
5994 }; 6008 };
5995 char *start = *cur, *p = *cur; 6009 char *start = *cur, *p = *cur;
5996 char *id, *val, *endp; 6010 char *id, *val, *endp;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 58bdc538d229..c1db2f234d2e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2040,7 +2040,7 @@ static void ata_eh_link_report(struct ata_link *link)
2040 } 2040 }
2041 2041
2042 if (ehc->i.serror) 2042 if (ehc->i.serror)
2043 ata_port_printk(ap, KERN_ERR, 2043 ata_link_printk(link, KERN_ERR,
2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", 2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n",
2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", 2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "",
2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", 2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "",
@@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
2171} 2171}
2172 2172
2173static int ata_eh_followup_srst_needed(struct ata_link *link, 2173static int ata_eh_followup_srst_needed(struct ata_link *link,
2174 int rc, int classify, 2174 int rc, const unsigned int *classes)
2175 const unsigned int *classes)
2176{ 2175{
2177 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) 2176 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link))
2178 return 0; 2177 return 0;
2179 if (rc == -EAGAIN) { 2178 if (rc == -EAGAIN)
2180 if (classify) 2179 return 1;
2181 return 1;
2182 rc = 0;
2183 }
2184 if (rc != 0)
2185 return 0;
2186 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) 2180 if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
2187 return 1; 2181 return 1;
2188 return 0; 2182 return 0;
@@ -2210,6 +2204,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
2210 */ 2204 */
2211 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) 2205 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX)
2212 max_tries++; 2206 max_tries++;
2207 if (link->flags & ATA_LFLAG_NO_HRST)
2208 hardreset = NULL;
2209 if (link->flags & ATA_LFLAG_NO_SRST)
2210 softreset = NULL;
2213 2211
2214 now = jiffies; 2212 now = jiffies;
2215 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); 2213 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN);
@@ -2247,10 +2245,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
2247 ehc->i.action &= ~ATA_EH_RESET; 2245 ehc->i.action &= ~ATA_EH_RESET;
2248 if (hardreset) { 2246 if (hardreset) {
2249 reset = hardreset; 2247 reset = hardreset;
2250 ehc->i.action = ATA_EH_HARDRESET; 2248 ehc->i.action |= ATA_EH_HARDRESET;
2251 } else if (softreset) { 2249 } else if (softreset) {
2252 reset = softreset; 2250 reset = softreset;
2253 ehc->i.action = ATA_EH_SOFTRESET; 2251 ehc->i.action |= ATA_EH_SOFTRESET;
2254 } 2252 }
2255 2253
2256 if (prereset) { 2254 if (prereset) {
@@ -2305,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2305 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2303 ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
2306 2304
2307 rc = ata_do_reset(link, reset, classes, deadline); 2305 rc = ata_do_reset(link, reset, classes, deadline);
2306 if (rc && rc != -EAGAIN)
2307 goto fail;
2308 2308
2309 if (reset == hardreset && 2309 if (reset == hardreset &&
2310 ata_eh_followup_srst_needed(link, rc, classify, classes)) { 2310 ata_eh_followup_srst_needed(link, rc, classes)) {
2311 /* okay, let's do follow-up softreset */ 2311 /* okay, let's do follow-up softreset */
2312 reset = softreset; 2312 reset = softreset;
2313 2313
@@ -2322,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify,
2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
2323 rc = ata_do_reset(link, reset, classes, deadline); 2323 rc = ata_do_reset(link, reset, classes, deadline);
2324 } 2324 }
2325
2326 /* -EAGAIN can happen if we skipped followup SRST */
2327 if (rc && rc != -EAGAIN)
2328 goto fail;
2329 } else { 2325 } else {
2330 if (verbose) 2326 if (verbose)
2331 ata_link_printk(link, KERN_INFO, "no reset method " 2327 ata_link_printk(link, KERN_INFO, "no reset method "
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index fbe605711554..eb919c16a03e 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -181,7 +181,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)
181 181
182 if (adev != acpi->last) { 182 if (adev != acpi->last) {
183 pacpi_set_piomode(ap, adev); 183 pacpi_set_piomode(ap, adev);
184 if (adev->dma_mode) 184 if (ata_dma_enabled(adev))
185 pacpi_set_dmamode(ap, adev); 185 pacpi_set_dmamode(ap, adev);
186 acpi->last = adev; 186 acpi->last = adev;
187 } 187 }
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index d7de7baf58a8..e8a0d99d7356 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -183,7 +183,7 @@ static void atiixp_bmdma_start(struct ata_queued_cmd *qc)
183 u16 tmp16; 183 u16 tmp16;
184 184
185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); 185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16);
186 if (adev->dma_mode >= XFER_UDMA_0) 186 if (ata_using_udma(adev))
187 tmp16 |= (1 << dn); 187 tmp16 |= (1 << dn);
188 else 188 else
189 tmp16 &= ~(1 << dn); 189 tmp16 &= ~(1 << dn);
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 744beebaaf49..0c4b271a9d5a 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -149,10 +149,10 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc)
149 struct ata_device *prev = ap->private_data; 149 struct ata_device *prev = ap->private_data;
150 150
151 /* See if the DMA settings could be wrong */ 151 /* See if the DMA settings could be wrong */
152 if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 152 if (ata_dma_enabled(adev) && adev != prev && prev != NULL) {
153 /* Maybe, but do the channels match MWDMA/UDMA ? */ 153 /* Maybe, but do the channels match MWDMA/UDMA ? */
154 if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 154 if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
155 (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 155 (ata_using_udma(prev) && !ata_using_udma(adev)))
156 /* Switch the mode bits */ 156 /* Switch the mode bits */
157 cs5530_set_dmamode(ap, adev); 157 cs5530_set_dmamode(ap, adev);
158 } 158 }
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 27843c70eb9d..0221c9a46769 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -606,7 +606,7 @@ static void it821x_display_disk(int n, u8 *buf)
606{ 606{
607 unsigned char id[41]; 607 unsigned char id[41];
608 int mode = 0; 608 int mode = 0;
609 char *mtype; 609 char *mtype = "";
610 char mbuf[8]; 610 char mbuf[8];
611 char *cbl = "(40 wire cable)"; 611 char *cbl = "(40 wire cable)";
612 612
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index e678af383d13..df64f2443001 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -198,7 +198,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc)
198 198
199 if (adev != ap->private_data) { 199 if (adev != ap->private_data) {
200 oldpiix_set_piomode(ap, adev); 200 oldpiix_set_piomode(ap, adev);
201 if (adev->dma_mode) 201 if (ata_dma_enabled(adev))
202 oldpiix_set_dmamode(ap, adev); 202 oldpiix_set_dmamode(ap, adev);
203 } 203 }
204 return ata_sff_qc_issue(qc); 204 return ata_sff_qc_issue(qc);
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index cbab397e3db7..0278fd2b8fb1 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -167,10 +167,10 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc)
167 struct ata_device *prev = ap->private_data; 167 struct ata_device *prev = ap->private_data;
168 168
169 /* See if the DMA settings could be wrong */ 169 /* See if the DMA settings could be wrong */
170 if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 170 if (ata_dma_enabled(adev) && adev != prev && prev != NULL) {
171 /* Maybe, but do the channels match MWDMA/UDMA ? */ 171 /* Maybe, but do the channels match MWDMA/UDMA ? */
172 if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 172 if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
173 (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 173 (ata_using_udma(prev) && !ata_using_udma(adev)))
174 /* Switch the mode bits */ 174 /* Switch the mode bits */
175 sc1200_set_dmamode(ap, adev); 175 sc1200_set_dmamode(ap, adev);
176 } 176 }
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 57d951b11f2d..8fdb2ce73210 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -324,62 +324,26 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev)
324} 324}
325 325
326/** 326/**
327 * via_ata_sff_tf_load - send taskfile registers to host controller 327 * via_tf_load - send taskfile registers to host controller
328 * @ap: Port to which output is sent 328 * @ap: Port to which output is sent
329 * @tf: ATA taskfile register set 329 * @tf: ATA taskfile register set
330 * 330 *
331 * Outputs ATA taskfile to standard ATA host controller. 331 * Outputs ATA taskfile to standard ATA host controller.
332 * 332 *
333 * Note: This is to fix the internal bug of via chipsets, which 333 * Note: This is to fix the internal bug of via chipsets, which
334 * will reset the device register after changing the IEN bit on 334 * will reset the device register after changing the IEN bit on
335 * ctl register 335 * ctl register
336 */ 336 */
337static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 337static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
338{ 338{
339 struct ata_ioports *ioaddr = &ap->ioaddr; 339 struct ata_taskfile tmp_tf;
340 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
341
342 if (tf->ctl != ap->last_ctl) {
343 iowrite8(tf->ctl, ioaddr->ctl_addr);
344 iowrite8(tf->device, ioaddr->device_addr);
345 ap->last_ctl = tf->ctl;
346 ata_wait_idle(ap);
347 }
348
349 if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
350 iowrite8(tf->hob_feature, ioaddr->feature_addr);
351 iowrite8(tf->hob_nsect, ioaddr->nsect_addr);
352 iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
353 iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
354 iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
355 VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
356 tf->hob_feature,
357 tf->hob_nsect,
358 tf->hob_lbal,
359 tf->hob_lbam,
360 tf->hob_lbah);
361 }
362 340
363 if (is_addr) { 341 if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) {
364 iowrite8(tf->feature, ioaddr->feature_addr); 342 tmp_tf = *tf;
365 iowrite8(tf->nsect, ioaddr->nsect_addr); 343 tmp_tf.flags |= ATA_TFLAG_DEVICE;
366 iowrite8(tf->lbal, ioaddr->lbal_addr); 344 tf = &tmp_tf;
367 iowrite8(tf->lbam, ioaddr->lbam_addr);
368 iowrite8(tf->lbah, ioaddr->lbah_addr);
369 VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
370 tf->feature,
371 tf->nsect,
372 tf->lbal,
373 tf->lbam,
374 tf->lbah);
375 } 345 }
376 346 ata_sff_tf_load(ap, tf);
377 if (tf->flags & ATA_TFLAG_DEVICE) {
378 iowrite8(tf->device, ioaddr->device_addr);
379 VPRINTK("device 0x%X\n", tf->device);
380 }
381
382 ata_wait_idle(ap);
383} 347}
384 348
385static struct scsi_host_template via_sht = { 349static struct scsi_host_template via_sht = {
@@ -392,13 +356,12 @@ static struct ata_port_operations via_port_ops = {
392 .set_piomode = via_set_piomode, 356 .set_piomode = via_set_piomode,
393 .set_dmamode = via_set_dmamode, 357 .set_dmamode = via_set_dmamode,
394 .prereset = via_pre_reset, 358 .prereset = via_pre_reset,
395 .sff_tf_load = via_ata_tf_load, 359 .sff_tf_load = via_tf_load,
396}; 360};
397 361
398static struct ata_port_operations via_port_ops_noirq = { 362static struct ata_port_operations via_port_ops_noirq = {
399 .inherits = &via_port_ops, 363 .inherits = &via_port_ops,
400 .sff_data_xfer = ata_sff_data_xfer_noirq, 364 .sff_data_xfer = ata_sff_data_xfer_noirq,
401 .sff_tf_load = via_ata_tf_load,
402}; 365};
403 366
404/** 367/**
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index ad169ffbc4cb..13c1d2af18ac 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1134,30 +1134,16 @@ static int mv_qc_defer(struct ata_queued_cmd *qc)
1134 if (ap->nr_active_links == 0) 1134 if (ap->nr_active_links == 0)
1135 return 0; 1135 return 0;
1136 1136
1137 if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { 1137 /*
1138 /* 1138 * The port is operating in host queuing mode (EDMA) with NCQ
1139 * The port is operating in host queuing mode (EDMA). 1139 * enabled, allow multiple NCQ commands. EDMA also allows
1140 * It can accomodate a new qc if the qc protocol 1140 * queueing multiple DMA commands but libata core currently
1141 * is compatible with the current host queue mode. 1141 * doesn't allow it.
1142 */ 1142 */
1143 if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { 1143 if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) &&
1144 /* 1144 (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol))
1145 * The host queue (EDMA) is in NCQ mode. 1145 return 0;
1146 * If the new qc is also an NCQ command, 1146
1147 * then allow the new qc.
1148 */
1149 if (qc->tf.protocol == ATA_PROT_NCQ)
1150 return 0;
1151 } else {
1152 /*
1153 * The host queue (EDMA) is in non-NCQ, DMA mode.
1154 * If the new qc is also a non-NCQ, DMA command,
1155 * then allow the new qc.
1156 */
1157 if (qc->tf.protocol == ATA_PROT_DMA)
1158 return 0;
1159 }
1160 }
1161 return ATA_DEFER_PORT; 1147 return ATA_DEFER_PORT;
1162} 1148}
1163 1149
@@ -3036,7 +3022,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3036 break; 3022 break;
3037 case chip_soc: 3023 case chip_soc:
3038 hpriv->ops = &mv_soc_ops; 3024 hpriv->ops = &mv_soc_ops;
3039 hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; 3025 hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE |
3026 MV_HP_ERRATA_60X1C0;
3040 break; 3027 break;
3041 3028
3042 default: 3029 default:
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 2ebd07f2ef81..5effec6f5458 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -3,7 +3,6 @@
3 */ 3 */
4 4
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/version.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/skbuff.h> 7#include <linux/skbuff.h>
9#include <linux/errno.h> 8#include <linux/errno.h>
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 5667c2f02c51..cc5e28c8885c 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -295,6 +295,12 @@ int class_for_each_device(struct class *class, struct device *start,
295 295
296 if (!class) 296 if (!class)
297 return -EINVAL; 297 return -EINVAL;
298 if (!class->p) {
299 WARN(1, "%s called for class '%s' before it was initialized",
300 __func__, class->name);
301 return -EINVAL;
302 }
303
298 mutex_lock(&class->p->class_mutex); 304 mutex_lock(&class->p->class_mutex);
299 list_for_each_entry(dev, &class->p->class_devices, node) { 305 list_for_each_entry(dev, &class->p->class_devices, node) {
300 if (start) { 306 if (start) {
@@ -344,6 +350,11 @@ struct device *class_find_device(struct class *class, struct device *start,
344 350
345 if (!class) 351 if (!class)
346 return NULL; 352 return NULL;
353 if (!class->p) {
354 WARN(1, "%s called for class '%s' before it was initialized",
355 __func__, class->name);
356 return NULL;
357 }
347 358
348 mutex_lock(&class->p->class_mutex); 359 mutex_lock(&class->p->class_mutex);
349 list_for_each_entry(dev, &class->p->class_devices, node) { 360 list_for_each_entry(dev, &class->p->class_devices, node) {
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 068aa1c9538c..d021c98605b3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -53,7 +53,7 @@ static inline int device_is_not_partition(struct device *dev)
53 * it is attached to. If it is not attached to a bus either, an empty 53 * it is attached to. If it is not attached to a bus either, an empty
54 * string will be returned. 54 * string will be returned.
55 */ 55 */
56const char *dev_driver_string(struct device *dev) 56const char *dev_driver_string(const struct device *dev)
57{ 57{
58 return dev->driver ? dev->driver->name : 58 return dev->driver ? dev->driver->name :
59 (dev->bus ? dev->bus->name : 59 (dev->bus ? dev->bus->name :
@@ -541,6 +541,7 @@ void device_initialize(struct device *dev)
541 spin_lock_init(&dev->devres_lock); 541 spin_lock_init(&dev->devres_lock);
542 INIT_LIST_HEAD(&dev->devres_head); 542 INIT_LIST_HEAD(&dev->devres_head);
543 device_init_wakeup(dev, 0); 543 device_init_wakeup(dev, 0);
544 device_pm_init(dev);
544 set_dev_node(dev, -1); 545 set_dev_node(dev, -1);
545} 546}
546 547
@@ -843,13 +844,19 @@ int device_add(struct device *dev)
843{ 844{
844 struct device *parent = NULL; 845 struct device *parent = NULL;
845 struct class_interface *class_intf; 846 struct class_interface *class_intf;
846 int error; 847 int error = -EINVAL;
847 848
848 dev = get_device(dev); 849 dev = get_device(dev);
849 if (!dev || !strlen(dev->bus_id)) { 850 if (!dev)
850 error = -EINVAL; 851 goto done;
851 goto Done; 852
852 } 853 /* Temporarily support init_name if it is set.
854 * It will override bus_id for now */
855 if (dev->init_name)
856 dev_set_name(dev, "%s", dev->init_name);
857
858 if (!strlen(dev->bus_id))
859 goto done;
853 860
854 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 861 pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
855 862
@@ -897,9 +904,10 @@ int device_add(struct device *dev)
897 error = bus_add_device(dev); 904 error = bus_add_device(dev);
898 if (error) 905 if (error)
899 goto BusError; 906 goto BusError;
900 error = device_pm_add(dev); 907 error = dpm_sysfs_add(dev);
901 if (error) 908 if (error)
902 goto PMError; 909 goto DPMError;
910 device_pm_add(dev);
903 kobject_uevent(&dev->kobj, KOBJ_ADD); 911 kobject_uevent(&dev->kobj, KOBJ_ADD);
904 bus_attach_device(dev); 912 bus_attach_device(dev);
905 if (parent) 913 if (parent)
@@ -917,10 +925,10 @@ int device_add(struct device *dev)
917 class_intf->add_dev(dev, class_intf); 925 class_intf->add_dev(dev, class_intf);
918 mutex_unlock(&dev->class->p->class_mutex); 926 mutex_unlock(&dev->class->p->class_mutex);
919 } 927 }
920 Done: 928done:
921 put_device(dev); 929 put_device(dev);
922 return error; 930 return error;
923 PMError: 931 DPMError:
924 bus_remove_device(dev); 932 bus_remove_device(dev);
925 BusError: 933 BusError:
926 if (dev->bus) 934 if (dev->bus)
@@ -944,7 +952,7 @@ int device_add(struct device *dev)
944 cleanup_device_parent(dev); 952 cleanup_device_parent(dev);
945 if (parent) 953 if (parent)
946 put_device(parent); 954 put_device(parent);
947 goto Done; 955 goto done;
948} 956}
949 957
950/** 958/**
@@ -1007,6 +1015,7 @@ void device_del(struct device *dev)
1007 struct class_interface *class_intf; 1015 struct class_interface *class_intf;
1008 1016
1009 device_pm_remove(dev); 1017 device_pm_remove(dev);
1018 dpm_sysfs_remove(dev);
1010 if (parent) 1019 if (parent)
1011 klist_del(&dev->knode_parent); 1020 klist_del(&dev->knode_parent);
1012 if (MAJOR(dev->devt)) { 1021 if (MAJOR(dev->devt)) {
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 2ef5acf4368b..1e2bda780e48 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -16,9 +16,6 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include "base.h" 17#include "base.h"
18 18
19#define to_dev(node) container_of(node, struct device, driver_list)
20
21
22static struct device *next_device(struct klist_iter *i) 19static struct device *next_device(struct klist_iter *i)
23{ 20{
24 struct klist_node *n = klist_next(i); 21 struct klist_node *n = klist_next(i);
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 3250c5257b74..273a944d4040 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -67,20 +67,16 @@ void device_pm_unlock(void)
67 * device_pm_add - add a device to the list of active devices 67 * device_pm_add - add a device to the list of active devices
68 * @dev: Device to be added to the list 68 * @dev: Device to be added to the list
69 */ 69 */
70int device_pm_add(struct device *dev) 70void device_pm_add(struct device *dev)
71{ 71{
72 int error;
73
74 pr_debug("PM: Adding info for %s:%s\n", 72 pr_debug("PM: Adding info for %s:%s\n",
75 dev->bus ? dev->bus->name : "No Bus", 73 dev->bus ? dev->bus->name : "No Bus",
76 kobject_name(&dev->kobj)); 74 kobject_name(&dev->kobj));
77 mutex_lock(&dpm_list_mtx); 75 mutex_lock(&dpm_list_mtx);
78 if (dev->parent) { 76 if (dev->parent) {
79 if (dev->parent->power.status >= DPM_SUSPENDING) { 77 if (dev->parent->power.status >= DPM_SUSPENDING)
80 dev_warn(dev, "parent %s is sleeping, will not add\n", 78 dev_warn(dev, "parent %s should not be sleeping\n",
81 dev->parent->bus_id); 79 dev->parent->bus_id);
82 WARN_ON(true);
83 }
84 } else if (transition_started) { 80 } else if (transition_started) {
85 /* 81 /*
86 * We refuse to register parentless devices while a PM 82 * We refuse to register parentless devices while a PM
@@ -89,13 +85,9 @@ int device_pm_add(struct device *dev)
89 */ 85 */
90 WARN_ON(true); 86 WARN_ON(true);
91 } 87 }
92 error = dpm_sysfs_add(dev); 88
93 if (!error) { 89 list_add_tail(&dev->power.entry, &dpm_list);
94 dev->power.status = DPM_ON;
95 list_add_tail(&dev->power.entry, &dpm_list);
96 }
97 mutex_unlock(&dpm_list_mtx); 90 mutex_unlock(&dpm_list_mtx);
98 return error;
99} 91}
100 92
101/** 93/**
@@ -110,7 +102,6 @@ void device_pm_remove(struct device *dev)
110 dev->bus ? dev->bus->name : "No Bus", 102 dev->bus ? dev->bus->name : "No Bus",
111 kobject_name(&dev->kobj)); 103 kobject_name(&dev->kobj));
112 mutex_lock(&dpm_list_mtx); 104 mutex_lock(&dpm_list_mtx);
113 dpm_sysfs_remove(dev);
114 list_del_init(&dev->power.entry); 105 list_del_init(&dev->power.entry);
115 mutex_unlock(&dpm_list_mtx); 106 mutex_unlock(&dpm_list_mtx);
116} 107}
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index a3252c0e2887..41f51fae042f 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -1,3 +1,8 @@
1static inline void device_pm_init(struct device *dev)
2{
3 dev->power.status = DPM_ON;
4}
5
1#ifdef CONFIG_PM_SLEEP 6#ifdef CONFIG_PM_SLEEP
2 7
3/* 8/*
@@ -11,12 +16,12 @@ static inline struct device *to_device(struct list_head *entry)
11 return container_of(entry, struct device, power.entry); 16 return container_of(entry, struct device, power.entry);
12} 17}
13 18
14extern int device_pm_add(struct device *); 19extern void device_pm_add(struct device *);
15extern void device_pm_remove(struct device *); 20extern void device_pm_remove(struct device *);
16 21
17#else /* CONFIG_PM_SLEEP */ 22#else /* CONFIG_PM_SLEEP */
18 23
19static inline int device_pm_add(struct device *dev) { return 0; } 24static inline void device_pm_add(struct device *dev) {}
20static inline void device_pm_remove(struct device *dev) {} 25static inline void device_pm_remove(struct device *dev) {}
21 26
22#endif 27#endif
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 24b97b0bef99..d070d492e385 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -571,8 +571,8 @@ out_free:
571 list_del(&brd->brd_list); 571 list_del(&brd->brd_list);
572 brd_free(brd); 572 brd_free(brd);
573 } 573 }
574 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
574 575
575 unregister_blkdev(RAMDISK_MAJOR, "brd");
576 return -ENOMEM; 576 return -ENOMEM;
577} 577}
578 578
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ad98dda6037d..1778e4a2c672 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -707,15 +707,15 @@ static int __init nbd_init(void)
707 707
708 BUILD_BUG_ON(sizeof(struct nbd_request) != 28); 708 BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
709 709
710 nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
711 if (!nbd_dev)
712 return -ENOMEM;
713
714 if (max_part < 0) { 710 if (max_part < 0) {
715 printk(KERN_CRIT "nbd: max_part must be >= 0\n"); 711 printk(KERN_CRIT "nbd: max_part must be >= 0\n");
716 return -EINVAL; 712 return -EINVAL;
717 } 713 }
718 714
715 nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
716 if (!nbd_dev)
717 return -ENOMEM;
718
719 part_shift = 0; 719 part_shift = 0;
720 if (max_part > 0) 720 if (max_part > 0)
721 part_shift = fls(max_part); 721 part_shift = fls(max_part);
@@ -779,6 +779,7 @@ out:
779 blk_cleanup_queue(nbd_dev[i].disk->queue); 779 blk_cleanup_queue(nbd_dev[i].disk->queue);
780 put_disk(nbd_dev[i].disk); 780 put_disk(nbd_dev[i].disk);
781 } 781 }
782 kfree(nbd_dev);
782 return err; 783 return err;
783} 784}
784 785
@@ -795,6 +796,7 @@ static void __exit nbd_cleanup(void)
795 } 796 }
796 } 797 }
797 unregister_blkdev(NBD_MAJOR, "nbd"); 798 unregister_blkdev(NBD_MAJOR, "nbd");
799 kfree(nbd_dev);
798 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); 800 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR);
799} 801}
800 802
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index a235ca787465..7cb4029a5375 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -3,8 +3,8 @@ menu "Bluetooth device drivers"
3 depends on BT 3 depends on BT
4 4
5config BT_HCIUSB 5config BT_HCIUSB
6 tristate "HCI USB driver" 6 tristate "HCI USB driver (old version)"
7 depends on USB 7 depends on USB && BT_HCIBTUSB=n
8 help 8 help
9 Bluetooth HCI USB driver. 9 Bluetooth HCI USB driver.
10 This driver is required if you want to use Bluetooth devices with 10 This driver is required if you want to use Bluetooth devices with
@@ -23,15 +23,13 @@ config BT_HCIUSB_SCO
23 Say Y here to compile support for SCO over HCI USB. 23 Say Y here to compile support for SCO over HCI USB.
24 24
25config BT_HCIBTUSB 25config BT_HCIBTUSB
26 tristate "HCI USB driver (alternate version)" 26 tristate "HCI USB driver"
27 depends on USB && EXPERIMENTAL && BT_HCIUSB=n 27 depends on USB
28 help 28 help
29 Bluetooth HCI USB driver. 29 Bluetooth HCI USB driver.
30 This driver is required if you want to use Bluetooth devices with 30 This driver is required if you want to use Bluetooth devices with
31 USB interface. 31 USB interface.
32 32
33 This driver is still experimental and has no SCO support.
34
35 Say Y here to compile support for Bluetooth USB devices into the 33 Say Y here to compile support for Bluetooth USB devices into the
36 kernel or say M to compile it as module (btusb). 34 kernel or say M to compile it as module (btusb).
37 35
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 593b7c595038..27058477cc8b 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -60,7 +60,7 @@
60/* ======================== Module parameters ======================== */ 60/* ======================== Module parameters ======================== */
61 61
62 62
63MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>, Jose Orlando Pereira <jop@di.uminho.pt>"); 63MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
64MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card"); 64MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card");
65MODULE_LICENSE("GPL"); 65MODULE_LICENSE("GPL");
66MODULE_FIRMWARE("BT3CPCC.bin"); 66MODULE_FIRMWARE("BT3CPCC.bin");
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 95ae9ba5661e..6a010681ecf3 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Generic Bluetooth USB driver 3 * Generic Bluetooth USB driver
4 * 4 *
5 * Copyright (C) 2005-2007 Marcel Holtmann <marcel@holtmann.org> 5 * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org>
6 * 6 *
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,7 @@
41#define BT_DBG(D...) 41#define BT_DBG(D...)
42#endif 42#endif
43 43
44#define VERSION "0.2" 44#define VERSION "0.3"
45 45
46static int ignore_dga; 46static int ignore_dga;
47static int ignore_csr; 47static int ignore_csr;
@@ -160,12 +160,16 @@ static struct usb_device_id blacklist_table[] = {
160 { } /* Terminating entry */ 160 { } /* Terminating entry */
161}; 161};
162 162
163#define BTUSB_MAX_ISOC_FRAMES 10
164
163#define BTUSB_INTR_RUNNING 0 165#define BTUSB_INTR_RUNNING 0
164#define BTUSB_BULK_RUNNING 1 166#define BTUSB_BULK_RUNNING 1
167#define BTUSB_ISOC_RUNNING 2
165 168
166struct btusb_data { 169struct btusb_data {
167 struct hci_dev *hdev; 170 struct hci_dev *hdev;
168 struct usb_device *udev; 171 struct usb_device *udev;
172 struct usb_interface *isoc;
169 173
170 spinlock_t lock; 174 spinlock_t lock;
171 175
@@ -176,10 +180,15 @@ struct btusb_data {
176 struct usb_anchor tx_anchor; 180 struct usb_anchor tx_anchor;
177 struct usb_anchor intr_anchor; 181 struct usb_anchor intr_anchor;
178 struct usb_anchor bulk_anchor; 182 struct usb_anchor bulk_anchor;
183 struct usb_anchor isoc_anchor;
179 184
180 struct usb_endpoint_descriptor *intr_ep; 185 struct usb_endpoint_descriptor *intr_ep;
181 struct usb_endpoint_descriptor *bulk_tx_ep; 186 struct usb_endpoint_descriptor *bulk_tx_ep;
182 struct usb_endpoint_descriptor *bulk_rx_ep; 187 struct usb_endpoint_descriptor *bulk_rx_ep;
188 struct usb_endpoint_descriptor *isoc_tx_ep;
189 struct usb_endpoint_descriptor *isoc_rx_ep;
190
191 int isoc_altsetting;
183}; 192};
184 193
185static void btusb_intr_complete(struct urb *urb) 194static void btusb_intr_complete(struct urb *urb)
@@ -195,6 +204,8 @@ static void btusb_intr_complete(struct urb *urb)
195 return; 204 return;
196 205
197 if (urb->status == 0) { 206 if (urb->status == 0) {
207 hdev->stat.byte_rx += urb->actual_length;
208
198 if (hci_recv_fragment(hdev, HCI_EVENT_PKT, 209 if (hci_recv_fragment(hdev, HCI_EVENT_PKT,
199 urb->transfer_buffer, 210 urb->transfer_buffer,
200 urb->actual_length) < 0) { 211 urb->actual_length) < 0) {
@@ -216,7 +227,7 @@ static void btusb_intr_complete(struct urb *urb)
216 } 227 }
217} 228}
218 229
219static inline int btusb_submit_intr_urb(struct hci_dev *hdev) 230static int btusb_submit_intr_urb(struct hci_dev *hdev)
220{ 231{
221 struct btusb_data *data = hdev->driver_data; 232 struct btusb_data *data = hdev->driver_data;
222 struct urb *urb; 233 struct urb *urb;
@@ -226,6 +237,9 @@ static inline int btusb_submit_intr_urb(struct hci_dev *hdev)
226 237
227 BT_DBG("%s", hdev->name); 238 BT_DBG("%s", hdev->name);
228 239
240 if (!data->intr_ep)
241 return -ENODEV;
242
229 urb = usb_alloc_urb(0, GFP_ATOMIC); 243 urb = usb_alloc_urb(0, GFP_ATOMIC);
230 if (!urb) 244 if (!urb)
231 return -ENOMEM; 245 return -ENOMEM;
@@ -274,6 +288,8 @@ static void btusb_bulk_complete(struct urb *urb)
274 return; 288 return;
275 289
276 if (urb->status == 0) { 290 if (urb->status == 0) {
291 hdev->stat.byte_rx += urb->actual_length;
292
277 if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT, 293 if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT,
278 urb->transfer_buffer, 294 urb->transfer_buffer,
279 urb->actual_length) < 0) { 295 urb->actual_length) < 0) {
@@ -295,7 +311,7 @@ static void btusb_bulk_complete(struct urb *urb)
295 } 311 }
296} 312}
297 313
298static inline int btusb_submit_bulk_urb(struct hci_dev *hdev) 314static int btusb_submit_bulk_urb(struct hci_dev *hdev)
299{ 315{
300 struct btusb_data *data = hdev->driver_data; 316 struct btusb_data *data = hdev->driver_data;
301 struct urb *urb; 317 struct urb *urb;
@@ -305,6 +321,9 @@ static inline int btusb_submit_bulk_urb(struct hci_dev *hdev)
305 321
306 BT_DBG("%s", hdev->name); 322 BT_DBG("%s", hdev->name);
307 323
324 if (!data->bulk_rx_ep)
325 return -ENODEV;
326
308 urb = usb_alloc_urb(0, GFP_KERNEL); 327 urb = usb_alloc_urb(0, GFP_KERNEL);
309 if (!urb) 328 if (!urb)
310 return -ENOMEM; 329 return -ENOMEM;
@@ -339,6 +358,127 @@ static inline int btusb_submit_bulk_urb(struct hci_dev *hdev)
339 return err; 358 return err;
340} 359}
341 360
361static void btusb_isoc_complete(struct urb *urb)
362{
363 struct hci_dev *hdev = urb->context;
364 struct btusb_data *data = hdev->driver_data;
365 int i, err;
366
367 BT_DBG("%s urb %p status %d count %d", hdev->name,
368 urb, urb->status, urb->actual_length);
369
370 if (!test_bit(HCI_RUNNING, &hdev->flags))
371 return;
372
373 if (urb->status == 0) {
374 for (i = 0; i < urb->number_of_packets; i++) {
375 unsigned int offset = urb->iso_frame_desc[i].offset;
376 unsigned int length = urb->iso_frame_desc[i].actual_length;
377
378 if (urb->iso_frame_desc[i].status)
379 continue;
380
381 hdev->stat.byte_rx += length;
382
383 if (hci_recv_fragment(hdev, HCI_SCODATA_PKT,
384 urb->transfer_buffer + offset,
385 length) < 0) {
386 BT_ERR("%s corrupted SCO packet", hdev->name);
387 hdev->stat.err_rx++;
388 }
389 }
390 }
391
392 if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
393 return;
394
395 usb_anchor_urb(urb, &data->isoc_anchor);
396
397 err = usb_submit_urb(urb, GFP_ATOMIC);
398 if (err < 0) {
399 BT_ERR("%s urb %p failed to resubmit (%d)",
400 hdev->name, urb, -err);
401 usb_unanchor_urb(urb);
402 }
403}
404
405static void inline __fill_isoc_descriptor(struct urb *urb, int len, int mtu)
406{
407 int i, offset = 0;
408
409 BT_DBG("len %d mtu %d", len, mtu);
410
411 for (i = 0; i < BTUSB_MAX_ISOC_FRAMES && len >= mtu;
412 i++, offset += mtu, len -= mtu) {
413 urb->iso_frame_desc[i].offset = offset;
414 urb->iso_frame_desc[i].length = mtu;
415 }
416
417 if (len && i < BTUSB_MAX_ISOC_FRAMES) {
418 urb->iso_frame_desc[i].offset = offset;
419 urb->iso_frame_desc[i].length = len;
420 i++;
421 }
422
423 urb->number_of_packets = i;
424}
425
426static int btusb_submit_isoc_urb(struct hci_dev *hdev)
427{
428 struct btusb_data *data = hdev->driver_data;
429 struct urb *urb;
430 unsigned char *buf;
431 unsigned int pipe;
432 int err, size;
433
434 BT_DBG("%s", hdev->name);
435
436 if (!data->isoc_rx_ep)
437 return -ENODEV;
438
439 urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_KERNEL);
440 if (!urb)
441 return -ENOMEM;
442
443 size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) *
444 BTUSB_MAX_ISOC_FRAMES;
445
446 buf = kmalloc(size, GFP_KERNEL);
447 if (!buf) {
448 usb_free_urb(urb);
449 return -ENOMEM;
450 }
451
452 pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress);
453
454 urb->dev = data->udev;
455 urb->pipe = pipe;
456 urb->context = hdev;
457 urb->complete = btusb_isoc_complete;
458 urb->interval = data->isoc_rx_ep->bInterval;
459
460 urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP;
461 urb->transfer_buffer = buf;
462 urb->transfer_buffer_length = size;
463
464 __fill_isoc_descriptor(urb, size,
465 le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize));
466
467 usb_anchor_urb(urb, &data->isoc_anchor);
468
469 err = usb_submit_urb(urb, GFP_KERNEL);
470 if (err < 0) {
471 BT_ERR("%s urb %p submission failed (%d)",
472 hdev->name, urb, -err);
473 usb_unanchor_urb(urb);
474 kfree(buf);
475 }
476
477 usb_free_urb(urb);
478
479 return err;
480}
481
342static void btusb_tx_complete(struct urb *urb) 482static void btusb_tx_complete(struct urb *urb)
343{ 483{
344 struct sk_buff *skb = urb->context; 484 struct sk_buff *skb = urb->context;
@@ -392,6 +532,9 @@ static int btusb_close(struct hci_dev *hdev)
392 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 532 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
393 return 0; 533 return 0;
394 534
535 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
536 usb_kill_anchored_urbs(&data->intr_anchor);
537
395 clear_bit(BTUSB_BULK_RUNNING, &data->flags); 538 clear_bit(BTUSB_BULK_RUNNING, &data->flags);
396 usb_kill_anchored_urbs(&data->bulk_anchor); 539 usb_kill_anchored_urbs(&data->bulk_anchor);
397 540
@@ -453,6 +596,9 @@ static int btusb_send_frame(struct sk_buff *skb)
453 break; 596 break;
454 597
455 case HCI_ACLDATA_PKT: 598 case HCI_ACLDATA_PKT:
599 if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)
600 return -ENODEV;
601
456 urb = usb_alloc_urb(0, GFP_ATOMIC); 602 urb = usb_alloc_urb(0, GFP_ATOMIC);
457 if (!urb) 603 if (!urb)
458 return -ENOMEM; 604 return -ENOMEM;
@@ -467,9 +613,31 @@ static int btusb_send_frame(struct sk_buff *skb)
467 break; 613 break;
468 614
469 case HCI_SCODATA_PKT: 615 case HCI_SCODATA_PKT:
616 if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)
617 return -ENODEV;
618
619 urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
620 if (!urb)
621 return -ENOMEM;
622
623 pipe = usb_sndisocpipe(data->udev,
624 data->isoc_tx_ep->bEndpointAddress);
625
626 urb->dev = data->udev;
627 urb->pipe = pipe;
628 urb->context = skb;
629 urb->complete = btusb_tx_complete;
630 urb->interval = data->isoc_tx_ep->bInterval;
631
632 urb->transfer_flags = URB_ISO_ASAP;
633 urb->transfer_buffer = skb->data;
634 urb->transfer_buffer_length = skb->len;
635
636 __fill_isoc_descriptor(urb, skb->len,
637 le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));
638
470 hdev->stat.sco_tx++; 639 hdev->stat.sco_tx++;
471 kfree_skb(skb); 640 break;
472 return 0;
473 641
474 default: 642 default:
475 return -EILSEQ; 643 return -EILSEQ;
@@ -508,22 +676,86 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
508 schedule_work(&data->work); 676 schedule_work(&data->work);
509} 677}
510 678
679static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting)
680{
681 struct btusb_data *data = hdev->driver_data;
682 struct usb_interface *intf = data->isoc;
683 struct usb_endpoint_descriptor *ep_desc;
684 int i, err;
685
686 if (!data->isoc)
687 return -ENODEV;
688
689 err = usb_set_interface(data->udev, 1, altsetting);
690 if (err < 0) {
691 BT_ERR("%s setting interface failed (%d)", hdev->name, -err);
692 return err;
693 }
694
695 data->isoc_altsetting = altsetting;
696
697 data->isoc_tx_ep = NULL;
698 data->isoc_rx_ep = NULL;
699
700 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
701 ep_desc = &intf->cur_altsetting->endpoint[i].desc;
702
703 if (!data->isoc_tx_ep && usb_endpoint_is_isoc_out(ep_desc)) {
704 data->isoc_tx_ep = ep_desc;
705 continue;
706 }
707
708 if (!data->isoc_rx_ep && usb_endpoint_is_isoc_in(ep_desc)) {
709 data->isoc_rx_ep = ep_desc;
710 continue;
711 }
712 }
713
714 if (!data->isoc_tx_ep || !data->isoc_rx_ep) {
715 BT_ERR("%s invalid SCO descriptors", hdev->name);
716 return -ENODEV;
717 }
718
719 return 0;
720}
721
511static void btusb_work(struct work_struct *work) 722static void btusb_work(struct work_struct *work)
512{ 723{
513 struct btusb_data *data = container_of(work, struct btusb_data, work); 724 struct btusb_data *data = container_of(work, struct btusb_data, work);
514 struct hci_dev *hdev = data->hdev; 725 struct hci_dev *hdev = data->hdev;
515 726
516 if (hdev->conn_hash.acl_num == 0) { 727 if (hdev->conn_hash.acl_num > 0) {
728 if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) {
729 if (btusb_submit_bulk_urb(hdev) < 0)
730 clear_bit(BTUSB_BULK_RUNNING, &data->flags);
731 else
732 btusb_submit_bulk_urb(hdev);
733 }
734 } else {
517 clear_bit(BTUSB_BULK_RUNNING, &data->flags); 735 clear_bit(BTUSB_BULK_RUNNING, &data->flags);
518 usb_kill_anchored_urbs(&data->bulk_anchor); 736 usb_kill_anchored_urbs(&data->bulk_anchor);
519 return;
520 } 737 }
521 738
522 if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { 739 if (hdev->conn_hash.sco_num > 0) {
523 if (btusb_submit_bulk_urb(hdev) < 0) 740 if (data->isoc_altsetting != 2) {
524 clear_bit(BTUSB_BULK_RUNNING, &data->flags); 741 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
525 else 742 usb_kill_anchored_urbs(&data->isoc_anchor);
526 btusb_submit_bulk_urb(hdev); 743
744 if (__set_isoc_interface(hdev, 2) < 0)
745 return;
746 }
747
748 if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
749 if (btusb_submit_isoc_urb(hdev) < 0)
750 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
751 else
752 btusb_submit_isoc_urb(hdev);
753 }
754 } else {
755 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
756 usb_kill_anchored_urbs(&data->isoc_anchor);
757
758 __set_isoc_interface(hdev, 0);
527 } 759 }
528} 760}
529 761
@@ -597,6 +829,7 @@ static int btusb_probe(struct usb_interface *intf,
597 init_usb_anchor(&data->tx_anchor); 829 init_usb_anchor(&data->tx_anchor);
598 init_usb_anchor(&data->intr_anchor); 830 init_usb_anchor(&data->intr_anchor);
599 init_usb_anchor(&data->bulk_anchor); 831 init_usb_anchor(&data->bulk_anchor);
832 init_usb_anchor(&data->isoc_anchor);
600 833
601 hdev = hci_alloc_dev(); 834 hdev = hci_alloc_dev();
602 if (!hdev) { 835 if (!hdev) {
@@ -620,6 +853,9 @@ static int btusb_probe(struct usb_interface *intf,
620 853
621 hdev->owner = THIS_MODULE; 854 hdev->owner = THIS_MODULE;
622 855
856 /* interface numbers are hardcoded in the spec */
857 data->isoc = usb_ifnum_to_if(data->udev, 1);
858
623 if (reset || id->driver_info & BTUSB_RESET) 859 if (reset || id->driver_info & BTUSB_RESET)
624 set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); 860 set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks);
625 861
@@ -628,11 +864,16 @@ static int btusb_probe(struct usb_interface *intf,
628 set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks); 864 set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks);
629 } 865 }
630 866
867 if (id->driver_info & BTUSB_BROKEN_ISOC)
868 data->isoc = NULL;
869
631 if (id->driver_info & BTUSB_SNIFFER) { 870 if (id->driver_info & BTUSB_SNIFFER) {
632 struct usb_device *udev = interface_to_usbdev(intf); 871 struct usb_device *udev = data->udev;
633 872
634 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) 873 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997)
635 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); 874 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
875
876 data->isoc = NULL;
636 } 877 }
637 878
638 if (id->driver_info & BTUSB_BCM92035) { 879 if (id->driver_info & BTUSB_BCM92035) {
@@ -646,6 +887,16 @@ static int btusb_probe(struct usb_interface *intf,
646 } 887 }
647 } 888 }
648 889
890 if (data->isoc) {
891 err = usb_driver_claim_interface(&btusb_driver,
892 data->isoc, NULL);
893 if (err < 0) {
894 hci_free_dev(hdev);
895 kfree(data);
896 return err;
897 }
898 }
899
649 err = hci_register_dev(hdev); 900 err = hci_register_dev(hdev);
650 if (err < 0) { 901 if (err < 0) {
651 hci_free_dev(hdev); 902 hci_free_dev(hdev);
@@ -670,6 +921,9 @@ static void btusb_disconnect(struct usb_interface *intf)
670 921
671 hdev = data->hdev; 922 hdev = data->hdev;
672 923
924 if (data->isoc)
925 usb_driver_release_interface(&btusb_driver, data->isoc);
926
673 usb_set_intfdata(intf, NULL); 927 usb_set_intfdata(intf, NULL);
674 928
675 hci_unregister_dev(hdev); 929 hci_unregister_dev(hdev);
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 69df187d74ce..8dfcf77cb717 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -577,7 +577,7 @@ module_exit(hci_uart_exit);
577module_param(reset, bool, 0644); 577module_param(reset, bool, 0644);
578MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); 578MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
579 579
580MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 580MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
581MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); 581MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION);
582MODULE_VERSION(VERSION); 582MODULE_VERSION(VERSION);
583MODULE_LICENSE("GPL"); 583MODULE_LICENSE("GPL");
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index e397572bf574..3c453924f838 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -1130,7 +1130,7 @@ module_param(isoc, int, 0644);
1130MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support"); 1130MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support");
1131#endif 1131#endif
1132 1132
1133MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 1133MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
1134MODULE_DESCRIPTION("Bluetooth HCI USB driver ver " VERSION); 1134MODULE_DESCRIPTION("Bluetooth HCI USB driver ver " VERSION);
1135MODULE_VERSION(VERSION); 1135MODULE_VERSION(VERSION);
1136MODULE_LICENSE("GPL"); 1136MODULE_LICENSE("GPL");
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index d97700aa54a9..7320a71b6368 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -377,7 +377,7 @@ module_exit(vhci_exit);
377module_param(minor, int, 0444); 377module_param(minor, int, 0444);
378MODULE_PARM_DESC(minor, "Miscellaneous minor device number"); 378MODULE_PARM_DESC(minor, "Miscellaneous minor device number");
379 379
380MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 380MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
381MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION); 381MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
382MODULE_VERSION(VERSION); 382MODULE_VERSION(VERSION);
383MODULE_LICENSE("GPL"); 383MODULE_LICENSE("GPL");
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f52931e1c16e..8e8afb6141f9 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2695,15 +2695,13 @@ static __devinit void default_find_bmc(void)
2695 for (i = 0; ; i++) { 2695 for (i = 0; ; i++) {
2696 if (!ipmi_defaults[i].port) 2696 if (!ipmi_defaults[i].port)
2697 break; 2697 break;
2698
2699 info = kzalloc(sizeof(*info), GFP_KERNEL);
2700 if (!info)
2701 return;
2702
2703#ifdef CONFIG_PPC_MERGE 2698#ifdef CONFIG_PPC_MERGE
2704 if (check_legacy_ioport(ipmi_defaults[i].port)) 2699 if (check_legacy_ioport(ipmi_defaults[i].port))
2705 continue; 2700 continue;
2706#endif 2701#endif
2702 info = kzalloc(sizeof(*info), GFP_KERNEL);
2703 if (!info)
2704 return;
2707 2705
2708 info->addr_source = NULL; 2706 info->addr_source = NULL;
2709 2707
diff --git a/drivers/char/random.c b/drivers/char/random.c
index e0d0e371909c..1838aa3d24fe 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1571,6 +1571,7 @@ u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)
1571 1571
1572 return half_md4_transform(hash, keyptr->secret); 1572 return half_md4_transform(hash, keyptr->secret);
1573} 1573}
1574EXPORT_SYMBOL_GPL(secure_ipv4_port_ephemeral);
1574 1575
1575#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1576#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1576u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 1577u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h
index c5b1840906b2..8b0252bf06e2 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.h
+++ b/drivers/char/xilinx_hwicap/buffer_icap.h
@@ -38,7 +38,6 @@
38 38
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/cdev.h> 40#include <linux/cdev.h>
41#include <linux/version.h>
42#include <linux/platform_device.h> 41#include <linux/platform_device.h>
43 42
44#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h
index ffabd3ba2bd8..62bda453c90b 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.h
+++ b/drivers/char/xilinx_hwicap/fifo_icap.h
@@ -38,7 +38,6 @@
38 38
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/cdev.h> 40#include <linux/cdev.h>
41#include <linux/version.h>
42#include <linux/platform_device.h> 41#include <linux/platform_device.h>
43 42
44#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
index 1f9c8b082dbe..24d0d9b938fb 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
@@ -38,7 +38,6 @@
38 38
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/cdev.h> 40#include <linux/cdev.h>
41#include <linux/version.h>
42#include <linux/platform_device.h> 41#include <linux/platform_device.h>
43 42
44#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index b27b13c5eb5a..4b55ec607a88 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -34,7 +34,6 @@
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/sysdev.h> 35#include <linux/sysdev.h>
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37#include <linux/version.h>
38 37
39#define EDAC_MC_LABEL_LEN 31 38#define EDAC_MC_LABEL_LEN 31
40#define EDAC_DEVICE_NAME_LEN 31 39#define EDAC_DEVICE_NAME_LEN 31
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index fa6d6abefd4d..450902438208 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -12,8 +12,8 @@ config FIREWIRE
12 This is the "Juju" FireWire stack, a new alternative implementation 12 This is the "Juju" FireWire stack, a new alternative implementation
13 designed for robustness and simplicity. You can build either this 13 designed for robustness and simplicity. You can build either this
14 stack, or the old stack (the ieee1394 driver, ohci1394 etc.) or both. 14 stack, or the old stack (the ieee1394 driver, ohci1394 etc.) or both.
15 Please read http://wiki.linux1394.org/JujuMigration before you 15 Please read http://ieee1394.wiki.kernel.org/index.php/Juju_Migration
16 enable the new stack. 16 before you enable the new stack.
17 17
18 To compile this driver as a module, say M here: the module will be 18 To compile this driver as a module, say M here: the module will be
19 called firewire-core. 19 called firewire-core.
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index c1adcdbf7979..9efb02137254 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -14,7 +14,6 @@
14*/ 14*/
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/version.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/err.h> 18#include <linux/err.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 994a21e5a0aa..16240a789650 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -844,7 +844,7 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
844 ne->host = host; 844 ne->host = host;
845 ne->nodeid = nodeid; 845 ne->nodeid = nodeid;
846 ne->generation = generation; 846 ne->generation = generation;
847 ne->needs_probe = 1; 847 ne->needs_probe = true;
848 848
849 ne->guid = guid; 849 ne->guid = guid;
850 ne->guid_vendor_id = (guid >> 40) & 0xffffff; 850 ne->guid_vendor_id = (guid >> 40) & 0xffffff;
@@ -1144,7 +1144,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
1144 struct csr1212_keyval *kv, *vendor_name_kv = NULL; 1144 struct csr1212_keyval *kv, *vendor_name_kv = NULL;
1145 u8 last_key_id = 0; 1145 u8 last_key_id = 0;
1146 1146
1147 ne->needs_probe = 0; 1147 ne->needs_probe = false;
1148 1148
1149 csr1212_for_each_dir_entry(ne->csr, kv, ne->csr->root_kv, dentry) { 1149 csr1212_for_each_dir_entry(ne->csr, kv, ne->csr->root_kv, dentry) {
1150 switch (kv->key.id) { 1150 switch (kv->key.id) {
@@ -1295,7 +1295,7 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr,
1295 nodemgr_update_bus_options(ne); 1295 nodemgr_update_bus_options(ne);
1296 1296
1297 /* Mark the node as new, so it gets re-probed */ 1297 /* Mark the node as new, so it gets re-probed */
1298 ne->needs_probe = 1; 1298 ne->needs_probe = true;
1299 } else { 1299 } else {
1300 /* old cache is valid, so update its generation */ 1300 /* old cache is valid, so update its generation */
1301 struct nodemgr_csr_info *ci = ne->csr->private; 1301 struct nodemgr_csr_info *ci = ne->csr->private;
@@ -1566,57 +1566,60 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge
1566struct probe_param { 1566struct probe_param {
1567 struct host_info *hi; 1567 struct host_info *hi;
1568 int generation; 1568 int generation;
1569 bool probe_now;
1569}; 1570};
1570 1571
1571static int __nodemgr_node_probe(struct device *dev, void *data) 1572static int node_probe(struct device *dev, void *data)
1572{ 1573{
1573 struct probe_param *param = (struct probe_param *)data; 1574 struct probe_param *p = data;
1574 struct node_entry *ne; 1575 struct node_entry *ne;
1575 1576
1577 if (p->generation != get_hpsb_generation(p->hi->host))
1578 return -EAGAIN;
1579
1576 ne = container_of(dev, struct node_entry, node_dev); 1580 ne = container_of(dev, struct node_entry, node_dev);
1577 if (!ne->needs_probe) 1581 if (ne->needs_probe == p->probe_now)
1578 nodemgr_probe_ne(param->hi, ne, param->generation); 1582 nodemgr_probe_ne(p->hi, ne, p->generation);
1579 if (ne->needs_probe)
1580 nodemgr_probe_ne(param->hi, ne, param->generation);
1581 return 0; 1583 return 0;
1582} 1584}
1583 1585
1584static void nodemgr_node_probe(struct host_info *hi, int generation) 1586static void nodemgr_node_probe(struct host_info *hi, int generation)
1585{ 1587{
1586 struct hpsb_host *host = hi->host; 1588 struct probe_param p;
1587 struct probe_param param;
1588 1589
1589 param.hi = hi; 1590 p.hi = hi;
1590 param.generation = generation; 1591 p.generation = generation;
1591 /* Do some processing of the nodes we've probed. This pulls them 1592 /*
1593 * Do some processing of the nodes we've probed. This pulls them
1592 * into the sysfs layer if needed, and can result in processing of 1594 * into the sysfs layer if needed, and can result in processing of
1593 * unit-directories, or just updating the node and it's 1595 * unit-directories, or just updating the node and it's
1594 * unit-directories. 1596 * unit-directories.
1595 * 1597 *
1596 * Run updates before probes. Usually, updates are time-critical 1598 * Run updates before probes. Usually, updates are time-critical
1597 * while probes are time-consuming. (Well, those probes need some 1599 * while probes are time-consuming.
1598 * improvement...) */
1599
1600 class_for_each_device(&nodemgr_ne_class, NULL, &param,
1601 __nodemgr_node_probe);
1602
1603 /* If we had a bus reset while we were scanning the bus, it is
1604 * possible that we did not probe all nodes. In that case, we
1605 * skip the clean up for now, since we could remove nodes that
1606 * were still on the bus. Another bus scan is pending which will
1607 * do the clean up eventually.
1608 * 1600 *
1601 * Meanwhile, another bus reset may have happened. In this case we
1602 * skip everything here and let the next bus scan handle it.
1603 * Otherwise we may prematurely remove nodes which are still there.
1604 */
1605 p.probe_now = false;
1606 if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0)
1607 return;
1608
1609 p.probe_now = true;
1610 if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0)
1611 return;
1612 /*
1609 * Now let's tell the bus to rescan our devices. This may seem 1613 * Now let's tell the bus to rescan our devices. This may seem
1610 * like overhead, but the driver-model core will only scan a 1614 * like overhead, but the driver-model core will only scan a
1611 * device for a driver when either the device is added, or when a 1615 * device for a driver when either the device is added, or when a
1612 * new driver is added. A bus reset is a good reason to rescan 1616 * new driver is added. A bus reset is a good reason to rescan
1613 * devices that were there before. For example, an sbp2 device 1617 * devices that were there before. For example, an sbp2 device
1614 * may become available for login, if the host that held it was 1618 * may become available for login, if the host that held it was
1615 * just removed. */ 1619 * just removed.
1616 1620 */
1617 if (generation == get_hpsb_generation(host)) 1621 if (bus_rescan_devices(&ieee1394_bus_type) != 0)
1618 if (bus_rescan_devices(&ieee1394_bus_type)) 1622 HPSB_DEBUG("bus_rescan_devices had an error");
1619 HPSB_DEBUG("bus_rescan_devices had an error");
1620} 1623}
1621 1624
1622static int nodemgr_send_resume_packet(struct hpsb_host *host) 1625static int nodemgr_send_resume_packet(struct hpsb_host *host)
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
index 919e92e2a955..6eb26465a84c 100644
--- a/drivers/ieee1394/nodemgr.h
+++ b/drivers/ieee1394/nodemgr.h
@@ -97,7 +97,7 @@ struct node_entry {
97 struct hpsb_host *host; /* Host this node is attached to */ 97 struct hpsb_host *host; /* Host this node is attached to */
98 nodeid_t nodeid; /* NodeID */ 98 nodeid_t nodeid; /* NodeID */
99 struct bus_options busopt; /* Bus Options */ 99 struct bus_options busopt; /* Bus Options */
100 int needs_probe; 100 bool needs_probe;
101 unsigned int generation; /* Synced with hpsb generation */ 101 unsigned int generation; /* Synced with hpsb generation */
102 102
103 /* The following is read from the config rom */ 103 /* The following is read from the config rom */
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 9cbf3154d243..1d6ad3435537 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -731,15 +731,26 @@ static int sbp2_update(struct unit_directory *ud)
731{ 731{
732 struct sbp2_lu *lu = ud->device.driver_data; 732 struct sbp2_lu *lu = ud->device.driver_data;
733 733
734 if (sbp2_reconnect_device(lu)) { 734 if (sbp2_reconnect_device(lu) != 0) {
735 /* Reconnect has failed. Perhaps we didn't reconnect fast 735 /*
736 * enough. Try a regular login, but first log out just in 736 * Reconnect failed. If another bus reset happened,
737 * case of any weirdness. */ 737 * let nodemgr proceed and call sbp2_update again later
738 * (or sbp2_remove if this node went away).
739 */
740 if (!hpsb_node_entry_valid(lu->ne))
741 return 0;
742 /*
743 * Or the target rejected the reconnect because we weren't
744 * fast enough. Try a regular login, but first log out
745 * just in case of any weirdness.
746 */
738 sbp2_logout_device(lu); 747 sbp2_logout_device(lu);
739 748
740 if (sbp2_login_device(lu)) { 749 if (sbp2_login_device(lu) != 0) {
741 /* Login failed too, just fail, and the backend 750 if (!hpsb_node_entry_valid(lu->ne))
742 * will call our sbp2_remove for us */ 751 return 0;
752
753 /* Maybe another initiator won the login. */
743 SBP2_ERR("Failed to reconnect to sbp2 device!"); 754 SBP2_ERR("Failed to reconnect to sbp2 device!");
744 return -EBUSY; 755 return -EBUSY;
745 } 756 }
diff --git a/drivers/infiniband/hw/ehca/ehca_tools.h b/drivers/infiniband/hw/ehca/ehca_tools.h
index ec950bf8c479..21f7d06f14ad 100644
--- a/drivers/infiniband/hw/ehca/ehca_tools.h
+++ b/drivers/infiniband/hw/ehca/ehca_tools.h
@@ -54,7 +54,6 @@
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/moduleparam.h> 55#include <linux/moduleparam.h>
56#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
57#include <linux/version.h>
58#include <linux/notifier.h> 57#include <linux/notifier.h>
59#include <linux/cpu.h> 58#include <linux/cpu.h>
60#include <linux/device.h> 59#include <linux/device.h>
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 23faba9d21eb..8bb5170b4e41 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -31,7 +31,6 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/version.h>
35#include <linux/module.h> 34#include <linux/module.h>
36#include <linux/fs.h> 35#include <linux/fs.h>
37#include <linux/mount.h> 36#include <linux/mount.h>
diff --git a/drivers/infiniband/hw/ipath/ipath_iba7220.c b/drivers/infiniband/hw/ipath/ipath_iba7220.c
index d90f5e9a54fa..9839e20119bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba7220.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba7220.c
@@ -1720,7 +1720,7 @@ static void ipath_7220_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr,
1720 "not 2KB aligned!\n", pa); 1720 "not 2KB aligned!\n", pa);
1721 return; 1721 return;
1722 } 1722 }
1723 if (pa >= (1UL << IBA7220_TID_SZ_SHIFT)) { 1723 if (chippa >= (1UL << IBA7220_TID_SZ_SHIFT)) {
1724 ipath_dev_err(dd, 1724 ipath_dev_err(dd,
1725 "BUG: Physical page address 0x%lx " 1725 "BUG: Physical page address 0x%lx "
1726 "larger than supported\n", pa); 1726 "larger than supported\n", pa);
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 36aa242c487c..729446f56aab 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -267,6 +267,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
267 u16 lrh0; 267 u16 lrh0;
268 u16 lid; 268 u16 lid;
269 int ret = 0; 269 int ret = 0;
270 int next_cur;
270 271
271 spin_lock_irqsave(&qp->s_lock, flags); 272 spin_lock_irqsave(&qp->s_lock, flags);
272 273
@@ -290,8 +291,9 @@ int ipath_make_ud_req(struct ipath_qp *qp)
290 goto bail; 291 goto bail;
291 292
292 wqe = get_swqe_ptr(qp, qp->s_cur); 293 wqe = get_swqe_ptr(qp, qp->s_cur);
293 if (++qp->s_cur >= qp->s_size) 294 next_cur = qp->s_cur + 1;
294 qp->s_cur = 0; 295 if (next_cur >= qp->s_size)
296 next_cur = 0;
295 297
296 /* Construct the header. */ 298 /* Construct the header. */
297 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr; 299 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr;
@@ -315,6 +317,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
315 qp->s_flags |= IPATH_S_WAIT_DMA; 317 qp->s_flags |= IPATH_S_WAIT_DMA;
316 goto bail; 318 goto bail;
317 } 319 }
320 qp->s_cur = next_cur;
318 spin_unlock_irqrestore(&qp->s_lock, flags); 321 spin_unlock_irqrestore(&qp->s_lock, flags);
319 ipath_ud_loopback(qp, wqe); 322 ipath_ud_loopback(qp, wqe);
320 spin_lock_irqsave(&qp->s_lock, flags); 323 spin_lock_irqsave(&qp->s_lock, flags);
@@ -323,6 +326,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
323 } 326 }
324 } 327 }
325 328
329 qp->s_cur = next_cur;
326 extra_bytes = -wqe->length & 3; 330 extra_bytes = -wqe->length & 3;
327 nwords = (wqe->length + extra_bytes) >> 2; 331 nwords = (wqe->length + extra_bytes) >> 2;
328 332
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index 39bd897b40c6..8eb7ae96974d 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -43,7 +43,6 @@
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/workqueue.h> 44#include <linux/workqueue.h>
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/version.h>
47#include <asm/io.h> 46#include <asm/io.h>
48#include <linux/crc32c.h> 47#include <linux/crc32c.h>
49 48
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f51201b17bfd..7e9e218738fa 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -156,14 +156,8 @@ static int ipoib_stop(struct net_device *dev)
156 156
157 netif_stop_queue(dev); 157 netif_stop_queue(dev);
158 158
159 /* 159 ipoib_ib_dev_down(dev, 0);
160 * Now flush workqueue to make sure a scheduled task doesn't 160 ipoib_ib_dev_stop(dev, 0);
161 * bring our internal state back up.
162 */
163 flush_workqueue(ipoib_workqueue);
164
165 ipoib_ib_dev_down(dev, 1);
166 ipoib_ib_dev_stop(dev, 1);
167 161
168 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { 162 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
169 struct ipoib_dev_priv *cpriv; 163 struct ipoib_dev_priv *cpriv;
@@ -1314,7 +1308,7 @@ sysfs_failed:
1314 1308
1315register_failed: 1309register_failed:
1316 ib_unregister_event_handler(&priv->event_handler); 1310 ib_unregister_event_handler(&priv->event_handler);
1317 flush_scheduled_work(); 1311 flush_workqueue(ipoib_workqueue);
1318 1312
1319event_failed: 1313event_failed:
1320 ipoib_dev_cleanup(priv->dev); 1314 ipoib_dev_cleanup(priv->dev);
@@ -1373,7 +1367,12 @@ static void ipoib_remove_one(struct ib_device *device)
1373 1367
1374 list_for_each_entry_safe(priv, tmp, dev_list, list) { 1368 list_for_each_entry_safe(priv, tmp, dev_list, list) {
1375 ib_unregister_event_handler(&priv->event_handler); 1369 ib_unregister_event_handler(&priv->event_handler);
1376 flush_scheduled_work(); 1370
1371 rtnl_lock();
1372 dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
1373 rtnl_unlock();
1374
1375 flush_workqueue(ipoib_workqueue);
1377 1376
1378 unregister_netdev(priv->dev); 1377 unregister_netdev(priv->dev);
1379 ipoib_dev_cleanup(priv->dev); 1378 ipoib_dev_cleanup(priv->dev);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 8950e9546f4e..ac33c8f3ea85 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -392,8 +392,16 @@ static int ipoib_mcast_join_complete(int status,
392 &priv->mcast_task, 0); 392 &priv->mcast_task, 0);
393 mutex_unlock(&mcast_mutex); 393 mutex_unlock(&mcast_mutex);
394 394
395 if (mcast == priv->broadcast) 395 if (mcast == priv->broadcast) {
396 /*
397 * Take RTNL lock here to avoid racing with
398 * ipoib_stop() and turning the carrier back
399 * on while a device is being removed.
400 */
401 rtnl_lock();
396 netif_carrier_on(dev); 402 netif_carrier_on(dev);
403 rtnl_unlock();
404 }
397 405
398 return 0; 406 return 0;
399 } 407 }
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 63462ecca147..26ff6214a81f 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -33,7 +33,6 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/version.h>
37 36
38#include "iscsi_iser.h" 37#include "iscsi_iser.h"
39 38
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a92d81567559..3524bef62be6 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -677,8 +677,8 @@ static int handle_eviocgbit(struct input_dev *dev, unsigned int cmd, void __user
677 len = OLD_KEY_MAX; 677 len = OLD_KEY_MAX;
678 if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000)) 678 if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000))
679 printk(KERN_WARNING 679 printk(KERN_WARNING
680 "evdev.c(EVIOCGBIT): Suspicious buffer size %d, " 680 "evdev.c(EVIOCGBIT): Suspicious buffer size %u, "
681 "limiting output to %d bytes. See " 681 "limiting output to %zu bytes. See "
682 "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n", 682 "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
683 OLD_KEY_MAX, 683 OLD_KEY_MAX,
684 BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long)); 684 BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 54ed8e2e1c02..6f227d3dbda1 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -29,7 +29,6 @@
29 */ 29 */
30 30
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/version.h>
33 32
34#include <linux/init.h> 33#include <linux/init.h>
35#include <linux/fs.h> 34#include <linux/fs.h>
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 3f48279f2195..ec96b369dd7a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/version.h>
13 12
14#include <linux/init.h> 13#include <linux/init.h>
15#include <linux/fs.h> 14#include <linux/fs.h>
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c
index 6a1f48b76e32..2adf9cb265da 100644
--- a/drivers/input/misc/cobalt_btns.c
+++ b/drivers/input/misc/cobalt_btns.c
@@ -148,6 +148,9 @@ static int __devexit cobalt_buttons_remove(struct platform_device *pdev)
148 return 0; 148 return 0;
149} 149}
150 150
151MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");
152MODULE_DESCRIPTION("Cobalt button interface driver");
153MODULE_LICENSE("GPL");
151/* work with hotplug and coldplug */ 154/* work with hotplug and coldplug */
152MODULE_ALIAS("platform:Cobalt buttons"); 155MODULE_ALIAS("platform:Cobalt buttons");
153 156
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
index 339290184871..72cf5e33790e 100644
--- a/drivers/input/mouse/gpio_mouse.c
+++ b/drivers/input/mouse/gpio_mouse.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/version.h>
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/platform_device.h> 13#include <linux/platform_device.h>
15#include <linux/input-polldev.h> 14#include <linux/input-polldev.h>
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index b9b7a98bc5a5..7df0228e836e 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -64,7 +64,6 @@ Scott Hill shill@gtcocalcomp.com
64#include <asm/byteorder.h> 64#include <asm/byteorder.h>
65 65
66 66
67#include <linux/version.h>
68#include <linux/usb/input.h> 67#include <linux/usb/input.h>
69 68
70/* Version with a Major number of 2 is for kernel inclusion only. */ 69/* Version with a Major number of 2 is for kernel inclusion only. */
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
index 283f93a0cee2..37a555f37306 100644
--- a/drivers/input/touchscreen/mainstone-wm97xx.c
+++ b/drivers/input/touchscreen/mainstone-wm97xx.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/version.h>
29#include <linux/kernel.h> 28#include <linux/kernel.h>
30#include <linux/init.h> 29#include <linux/init.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c
index c1cd99d58981..504ca11749a1 100644
--- a/drivers/input/touchscreen/migor_ts.c
+++ b/drivers/input/touchscreen/migor_ts.c
@@ -173,7 +173,7 @@ static int migor_ts_probe(struct i2c_client *client,
173 input_set_abs_params(input, ABS_X, 95, 955, 0, 0); 173 input_set_abs_params(input, ABS_X, 95, 955, 0, 0);
174 input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); 174 input_set_abs_params(input, ABS_Y, 85, 935, 0, 0);
175 175
176 input->name = client->driver_name; 176 input->name = client->name;
177 input->id.bustype = BUS_I2C; 177 input->id.bustype = BUS_I2C;
178 input->dev.parent = &client->dev; 178 input->dev.parent = &client->dev;
179 179
@@ -192,7 +192,7 @@ static int migor_ts_probe(struct i2c_client *client,
192 goto err1; 192 goto err1;
193 193
194 error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, 194 error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW,
195 client->driver_name, priv); 195 client->name, priv);
196 if (error) { 196 if (error) {
197 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); 197 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
198 goto err2; 198 goto err2;
@@ -224,12 +224,19 @@ static int migor_ts_remove(struct i2c_client *client)
224 return 0; 224 return 0;
225} 225}
226 226
227static const struct i2c_device_id migor_ts_id[] = {
228 { "migor_ts", 0 },
229 { }
230};
231MODULE_DEVICE_TABLE(i2c, migor_ts);
232
227static struct i2c_driver migor_ts_driver = { 233static struct i2c_driver migor_ts_driver = {
228 .driver = { 234 .driver = {
229 .name = "migor_ts", 235 .name = "migor_ts",
230 }, 236 },
231 .probe = migor_ts_probe, 237 .probe = migor_ts_probe,
232 .remove = migor_ts_remove, 238 .remove = migor_ts_remove,
239 .id_table = migor_ts_id,
233}; 240};
234 241
235static int __init migor_ts_init(void) 242static int __init migor_ts_init(void)
diff --git a/drivers/input/touchscreen/wm9705.c b/drivers/input/touchscreen/wm9705.c
index 978e1a13ffc7..372efbc694ff 100644
--- a/drivers/input/touchscreen/wm9705.c
+++ b/drivers/input/touchscreen/wm9705.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
20#include <linux/version.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c
index 4c5d85a249ae..c8bb1e7335fc 100644
--- a/drivers/input/touchscreen/wm9712.c
+++ b/drivers/input/touchscreen/wm9712.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
20#include <linux/version.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c
index 838458792ea0..781ee83547e6 100644
--- a/drivers/input/touchscreen/wm9713.c
+++ b/drivers/input/touchscreen/wm9713.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
20#include <linux/version.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index cdc24ad314e0..d589ab0e3adc 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -37,7 +37,6 @@
37 37
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/moduleparam.h> 39#include <linux/moduleparam.h>
40#include <linux/version.h>
41#include <linux/kernel.h> 40#include <linux/kernel.h>
42#include <linux/init.h> 41#include <linux/init.h>
43#include <linux/delay.h> 42#include <linux/delay.h>
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index c6408a62d95e..bc2a807f210d 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/version.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/irq.h> 20#include <linux/irq.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
index b2d9878dc3f0..c6c77a505ec1 100644
--- a/drivers/misc/acer-wmi.c
+++ b/drivers/misc/acer-wmi.c
@@ -192,6 +192,9 @@ static struct quirk_entry *quirks;
192 192
193static void set_quirks(void) 193static void set_quirks(void)
194{ 194{
195 if (!interface)
196 return;
197
195 if (quirks->mailled) 198 if (quirks->mailled)
196 interface->capability |= ACER_CAP_MAILLED; 199 interface->capability |= ACER_CAP_MAILLED;
197 200
@@ -1237,6 +1240,8 @@ static int __init acer_wmi_init(void)
1237 return -ENODEV; 1240 return -ENODEV;
1238 } 1241 }
1239 1242
1243 set_quirks();
1244
1240 if (platform_driver_register(&acer_platform_driver)) { 1245 if (platform_driver_register(&acer_platform_driver)) {
1241 printk(ACER_ERR "Unable to register platform driver.\n"); 1246 printk(ACER_ERR "Unable to register platform driver.\n");
1242 goto error_platform_register; 1247 goto error_platform_register;
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 9e8d79e7e9f4..facdb9893c84 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -553,9 +553,9 @@ static void eeepc_hwmon_exit(void)
553 hwmon = eeepc_hwmon_device; 553 hwmon = eeepc_hwmon_device;
554 if (!hwmon) 554 if (!hwmon)
555 return ; 555 return ;
556 hwmon_device_unregister(hwmon);
557 sysfs_remove_group(&hwmon->kobj, 556 sysfs_remove_group(&hwmon->kobj,
558 &hwmon_attribute_group); 557 &hwmon_attribute_group);
558 hwmon_device_unregister(hwmon);
559 eeepc_hwmon_device = NULL; 559 eeepc_hwmon_device = NULL;
560} 560}
561 561
diff --git a/drivers/misc/eeprom_93cx6.c b/drivers/misc/eeprom_93cx6.c
index ea55654e5948..15b1780025c8 100644
--- a/drivers/misc/eeprom_93cx6.c
+++ b/drivers/misc/eeprom_93cx6.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/version.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/eeprom_93cx6.h> 30#include <linux/eeprom_93cx6.h>
32 31
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 948b86f35ef4..d1eec7d3243f 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -6,7 +6,6 @@
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/version.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/init.h> 10#include <linux/init.h>
12#include <asm/io.h> 11#include <asm/io.h>
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index effaf7cdefab..1a6feb4474de 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -9,7 +9,6 @@
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/version.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <asm/io.h> 14#include <asm/io.h>
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index aa64a4752781..bbbcdd4c8d13 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/version.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/init.h> 16#include <linux/init.h>
18#include <asm/io.h> 17#include <asm/io.h>
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 761946ea45b1..92c334ff4508 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -16,7 +16,6 @@
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
18#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
19#include <linux/version.h>
20#include <asm/io.h> 19#include <asm/io.h>
21 20
22#include <asm/mach-au1x00/au1xxx.h> 21#include <asm/mach-au1x00/au1xxx.h>
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 4b4cb2bf4f11..a5c141cecd4e 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1172,7 +1172,7 @@ config ETH16I
1172 1172
1173config NE2000 1173config NE2000
1174 tristate "NE2000/NE1000 support" 1174 tristate "NE2000/NE1000 support"
1175 depends on NET_ISA || (Q40 && m) || M32R || TOSHIBA_RBTX4927 || TOSHIBA_RBTX4938 1175 depends on NET_ISA || (Q40 && m) || M32R || MACH_TX49XX
1176 select CRC32 1176 select CRC32
1177 ---help--- 1177 ---help---
1178 If you have a network (Ethernet) card of this type, say Y and read 1178 If you have a network (Ethernet) card of this type, say Y and read
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index e4483de84e7f..66de80b64b92 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -52,7 +52,6 @@
52 52
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/moduleparam.h> 54#include <linux/moduleparam.h>
55#include <linux/version.h>
56#include <linux/types.h> 55#include <linux/types.h>
57#include <linux/errno.h> 56#include <linux/errno.h>
58#include <linux/ioport.h> 57#include <linux/ioport.h>
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 020771bfb603..e2d702b8b2e4 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -551,7 +551,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
551 if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) { 551 if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) {
552 phys = dma_map_single(&dev->dev, skb->data, 552 phys = dma_map_single(&dev->dev, skb->data,
553 RX_BUFF_SIZE, DMA_FROM_DEVICE); 553 RX_BUFF_SIZE, DMA_FROM_DEVICE);
554 if (dma_mapping_error(phys)) { 554 if (dma_mapping_error(&dev->dev, phys)) {
555 dev_kfree_skb(skb); 555 dev_kfree_skb(skb);
556 skb = NULL; 556 skb = NULL;
557 } 557 }
@@ -698,7 +698,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
698#endif 698#endif
699 699
700 phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); 700 phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE);
701 if (dma_mapping_error(phys)) { 701 if (dma_mapping_error(&dev->dev, phys)) {
702#ifdef __ARMEB__ 702#ifdef __ARMEB__
703 dev_kfree_skb(skb); 703 dev_kfree_skb(skb);
704#else 704#else
@@ -883,7 +883,7 @@ static int init_queues(struct port *port)
883 desc->buf_len = MAX_MRU; 883 desc->buf_len = MAX_MRU;
884 desc->data = dma_map_single(&port->netdev->dev, data, 884 desc->data = dma_map_single(&port->netdev->dev, data,
885 RX_BUFF_SIZE, DMA_FROM_DEVICE); 885 RX_BUFF_SIZE, DMA_FROM_DEVICE);
886 if (dma_mapping_error(desc->data)) { 886 if (dma_mapping_error(&port->netdev->dev, desc->data)) {
887 free_buffer(buff); 887 free_buffer(buff);
888 return -EIO; 888 return -EIO;
889 } 889 }
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c
index cdc3b85b10b9..619c6583e1aa 100644
--- a/drivers/net/atl1e/atl1e_ethtool.c
+++ b/drivers/net/atl1e/atl1e_ethtool.c
@@ -355,7 +355,7 @@ static int atl1e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
355 struct atl1e_adapter *adapter = netdev_priv(netdev); 355 struct atl1e_adapter *adapter = netdev_priv(netdev);
356 356
357 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE | 357 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
358 WAKE_MCAST | WAKE_BCAST | WAKE_MCAST)) 358 WAKE_UCAST | WAKE_MCAST | WAKE_BCAST))
359 return -EOPNOTSUPP; 359 return -EOPNOTSUPP;
360 /* these settings will always override what we currently have */ 360 /* these settings will always override what we currently have */
361 adapter->wol = 0; 361 adapter->wol = 0;
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index cb8be490e5ae..5ee1b0557a02 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -807,7 +807,7 @@ err_out:
807static int au1000_init(struct net_device *dev) 807static int au1000_init(struct net_device *dev)
808{ 808{
809 struct au1000_private *aup = (struct au1000_private *) dev->priv; 809 struct au1000_private *aup = (struct au1000_private *) dev->priv;
810 u32 flags; 810 unsigned long flags;
811 int i; 811 int i;
812 u32 control; 812 u32 control;
813 813
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 0b4adf4a0f7d..a886a4b9f7e5 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -554,7 +554,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
554 554
555 spin_lock_irqsave(&ax->mii_lock, flags); 555 spin_lock_irqsave(&ax->mii_lock, flags);
556 mii_ethtool_gset(&ax->mii, cmd); 556 mii_ethtool_gset(&ax->mii, cmd);
557 spin_lock_irqsave(&ax->mii_lock, flags); 557 spin_unlock_irqrestore(&ax->mii_lock, flags);
558 558
559 return 0; 559 return 0;
560} 560}
@@ -567,7 +567,7 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
567 567
568 spin_lock_irqsave(&ax->mii_lock, flags); 568 spin_lock_irqsave(&ax->mii_lock, flags);
569 rc = mii_ethtool_sset(&ax->mii, cmd); 569 rc = mii_ethtool_sset(&ax->mii, cmd);
570 spin_lock_irqsave(&ax->mii_lock, flags); 570 spin_unlock_irqrestore(&ax->mii_lock, flags);
571 571
572 return rc; 572 return rc;
573} 573}
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 5ebde67d4297..2486a656f12d 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -35,8 +35,8 @@
35#include <linux/time.h> 35#include <linux/time.h>
36#include <linux/ethtool.h> 36#include <linux/ethtool.h>
37#include <linux/mii.h> 37#include <linux/mii.h>
38#ifdef NETIF_F_HW_VLAN_TX
39#include <linux/if_vlan.h> 38#include <linux/if_vlan.h>
39#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
40#define BCM_VLAN 1 40#define BCM_VLAN 1
41#endif 41#endif
42#include <net/ip.h> 42#include <net/ip.h>
@@ -57,8 +57,8 @@
57 57
58#define DRV_MODULE_NAME "bnx2" 58#define DRV_MODULE_NAME "bnx2"
59#define PFX DRV_MODULE_NAME ": " 59#define PFX DRV_MODULE_NAME ": "
60#define DRV_MODULE_VERSION "1.7.9" 60#define DRV_MODULE_VERSION "1.8.0"
61#define DRV_MODULE_RELDATE "July 18, 2008" 61#define DRV_MODULE_RELDATE "Aug 14, 2008"
62 62
63#define RUN_AT(x) (jiffies + (x)) 63#define RUN_AT(x) (jiffies + (x))
64 64
@@ -2876,6 +2876,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
2876 struct sw_bd *rx_buf; 2876 struct sw_bd *rx_buf;
2877 struct sk_buff *skb; 2877 struct sk_buff *skb;
2878 dma_addr_t dma_addr; 2878 dma_addr_t dma_addr;
2879 u16 vtag = 0;
2880 int hw_vlan __maybe_unused = 0;
2879 2881
2880 sw_ring_cons = RX_RING_IDX(sw_cons); 2882 sw_ring_cons = RX_RING_IDX(sw_cons);
2881 sw_ring_prod = RX_RING_IDX(sw_prod); 2883 sw_ring_prod = RX_RING_IDX(sw_prod);
@@ -2919,7 +2921,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
2919 if (len <= bp->rx_copy_thresh) { 2921 if (len <= bp->rx_copy_thresh) {
2920 struct sk_buff *new_skb; 2922 struct sk_buff *new_skb;
2921 2923
2922 new_skb = netdev_alloc_skb(bp->dev, len + 2); 2924 new_skb = netdev_alloc_skb(bp->dev, len + 6);
2923 if (new_skb == NULL) { 2925 if (new_skb == NULL) {
2924 bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons, 2926 bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons,
2925 sw_ring_prod); 2927 sw_ring_prod);
@@ -2928,9 +2930,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
2928 2930
2929 /* aligned copy */ 2931 /* aligned copy */
2930 skb_copy_from_linear_data_offset(skb, 2932 skb_copy_from_linear_data_offset(skb,
2931 BNX2_RX_OFFSET - 2, 2933 BNX2_RX_OFFSET - 6,
2932 new_skb->data, len + 2); 2934 new_skb->data, len + 6);
2933 skb_reserve(new_skb, 2); 2935 skb_reserve(new_skb, 6);
2934 skb_put(new_skb, len); 2936 skb_put(new_skb, len);
2935 2937
2936 bnx2_reuse_rx_skb(bp, rxr, skb, 2938 bnx2_reuse_rx_skb(bp, rxr, skb,
@@ -2941,6 +2943,25 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
2941 dma_addr, (sw_ring_cons << 16) | sw_ring_prod))) 2943 dma_addr, (sw_ring_cons << 16) | sw_ring_prod)))
2942 goto next_rx; 2944 goto next_rx;
2943 2945
2946 if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) &&
2947 !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) {
2948 vtag = rx_hdr->l2_fhdr_vlan_tag;
2949#ifdef BCM_VLAN
2950 if (bp->vlgrp)
2951 hw_vlan = 1;
2952 else
2953#endif
2954 {
2955 struct vlan_ethhdr *ve = (struct vlan_ethhdr *)
2956 __skb_push(skb, 4);
2957
2958 memmove(ve, skb->data + 4, ETH_ALEN * 2);
2959 ve->h_vlan_proto = htons(ETH_P_8021Q);
2960 ve->h_vlan_TCI = htons(vtag);
2961 len += 4;
2962 }
2963 }
2964
2944 skb->protocol = eth_type_trans(skb, bp->dev); 2965 skb->protocol = eth_type_trans(skb, bp->dev);
2945 2966
2946 if ((len > (bp->dev->mtu + ETH_HLEN)) && 2967 if ((len > (bp->dev->mtu + ETH_HLEN)) &&
@@ -2962,10 +2983,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
2962 } 2983 }
2963 2984
2964#ifdef BCM_VLAN 2985#ifdef BCM_VLAN
2965 if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && bp->vlgrp) { 2986 if (hw_vlan)
2966 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 2987 vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag);
2967 rx_hdr->l2_fhdr_vlan_tag);
2968 }
2969 else 2988 else
2970#endif 2989#endif
2971 netif_receive_skb(skb); 2990 netif_receive_skb(skb);
@@ -3237,10 +3256,10 @@ bnx2_set_rx_mode(struct net_device *dev)
3237 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); 3256 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG);
3238 sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; 3257 sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN;
3239#ifdef BCM_VLAN 3258#ifdef BCM_VLAN
3240 if (!bp->vlgrp && !(bp->flags & BNX2_FLAG_ASF_ENABLE)) 3259 if (!bp->vlgrp && (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
3241 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; 3260 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG;
3242#else 3261#else
3243 if (!(bp->flags & BNX2_FLAG_ASF_ENABLE)) 3262 if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)
3244 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; 3263 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG;
3245#endif 3264#endif
3246 if (dev->flags & IFF_PROMISC) { 3265 if (dev->flags & IFF_PROMISC) {
@@ -5963,10 +5982,12 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
5963 vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; 5982 vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
5964 } 5983 }
5965 5984
5985#ifdef BCM_VLAN
5966 if (bp->vlgrp && vlan_tx_tag_present(skb)) { 5986 if (bp->vlgrp && vlan_tx_tag_present(skb)) {
5967 vlan_tag_flags |= 5987 vlan_tag_flags |=
5968 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); 5988 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
5969 } 5989 }
5990#endif
5970 if ((mss = skb_shinfo(skb)->gso_size)) { 5991 if ((mss = skb_shinfo(skb)->gso_size)) {
5971 u32 tcp_opt_len, ip_tcp_len; 5992 u32 tcp_opt_len, ip_tcp_len;
5972 struct iphdr *iph; 5993 struct iphdr *iph;
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index 8b92c6ad0759..4ce7fe9c5251 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -21,7 +21,6 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/ethtool.h> 22#include <linux/ethtool.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/version.h>
25 24
26#include "bnx2x_reg.h" 25#include "bnx2x_reg.h"
27#include "bnx2x_fw_defs.h" 26#include "bnx2x_fw_defs.h"
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 3e7dc171cdf1..971576b43687 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -44,7 +44,6 @@
44#include <net/ip.h> 44#include <net/ip.h>
45#include <net/tcp.h> 45#include <net/tcp.h>
46#include <net/checksum.h> 46#include <net/checksum.h>
47#include <linux/version.h>
48#include <net/ip6_checksum.h> 47#include <net/ip6_checksum.h>
49#include <linux/workqueue.h> 48#include <linux/workqueue.h>
50#include <linux/crc32.h> 49#include <linux/crc32.h>
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index a7800e559090..ec6b0af3d46b 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -26,7 +26,6 @@
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/version.h>
30 29
31#include <linux/netdevice.h> 30#include <linux/netdevice.h>
32#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index f823b8ba5785..14b0e6cd3b8d 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -389,7 +389,7 @@
389 389
390/* Interrupt Cause Set */ 390/* Interrupt Cause Set */
391#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ 391#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
392#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ 392#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
393#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ 393#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
394 394
395/* Transmit Descriptor Control */ 395/* Transmit Descriptor Control */
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index cf57050d99d8..ac4e506b4f88 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -326,6 +326,7 @@ struct e1000_info {
326#define FLAG_RX_CSUM_ENABLED (1 << 28) 326#define FLAG_RX_CSUM_ENABLED (1 << 28)
327#define FLAG_TSO_FORCE (1 << 29) 327#define FLAG_TSO_FORCE (1 << 29)
328#define FLAG_RX_RESTART_NOW (1 << 30) 328#define FLAG_RX_RESTART_NOW (1 << 30)
329#define FLAG_MSI_TEST_FAILED (1 << 31)
329 330
330#define E1000_RX_DESC_PS(R, i) \ 331#define E1000_RX_DESC_PS(R, i) \
331 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) 332 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index cf9679f2b7c4..e21c9e0f3738 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev)
177 u32 status; 177 u32 status;
178 178
179 status = er32(STATUS); 179 status = er32(STATUS);
180 return (status & E1000_STATUS_LU); 180 return (status & E1000_STATUS_LU) ? 1 : 0;
181} 181}
182 182
183static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) 183static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 05b0b2f9c54b..d266510c8a94 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -510,9 +510,12 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
510 netdev_alloc_skb(netdev, length + NET_IP_ALIGN); 510 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
511 if (new_skb) { 511 if (new_skb) {
512 skb_reserve(new_skb, NET_IP_ALIGN); 512 skb_reserve(new_skb, NET_IP_ALIGN);
513 memcpy(new_skb->data - NET_IP_ALIGN, 513 skb_copy_to_linear_data_offset(new_skb,
514 skb->data - NET_IP_ALIGN, 514 -NET_IP_ALIGN,
515 length + NET_IP_ALIGN); 515 (skb->data -
516 NET_IP_ALIGN),
517 (length +
518 NET_IP_ALIGN));
516 /* save the skb in buffer_info as good */ 519 /* save the skb in buffer_info as good */
517 buffer_info->skb = skb; 520 buffer_info->skb = skb;
518 skb = new_skb; 521 skb = new_skb;
@@ -1233,26 +1236,36 @@ static irqreturn_t e1000_intr(int irq, void *data)
1233 return IRQ_HANDLED; 1236 return IRQ_HANDLED;
1234} 1237}
1235 1238
1239/**
1240 * e1000_request_irq - initialize interrupts
1241 *
1242 * Attempts to configure interrupts using the best available
1243 * capabilities of the hardware and kernel.
1244 **/
1236static int e1000_request_irq(struct e1000_adapter *adapter) 1245static int e1000_request_irq(struct e1000_adapter *adapter)
1237{ 1246{
1238 struct net_device *netdev = adapter->netdev; 1247 struct net_device *netdev = adapter->netdev;
1239 irq_handler_t handler = e1000_intr;
1240 int irq_flags = IRQF_SHARED; 1248 int irq_flags = IRQF_SHARED;
1241 int err; 1249 int err;
1242 1250
1243 if (!pci_enable_msi(adapter->pdev)) { 1251 if (!(adapter->flags & FLAG_MSI_TEST_FAILED)) {
1244 adapter->flags |= FLAG_MSI_ENABLED; 1252 err = pci_enable_msi(adapter->pdev);
1245 handler = e1000_intr_msi; 1253 if (!err) {
1246 irq_flags = 0; 1254 adapter->flags |= FLAG_MSI_ENABLED;
1255 irq_flags = 0;
1256 }
1247 } 1257 }
1248 1258
1249 err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, 1259 err = request_irq(adapter->pdev->irq,
1250 netdev); 1260 ((adapter->flags & FLAG_MSI_ENABLED) ?
1261 &e1000_intr_msi : &e1000_intr),
1262 irq_flags, netdev->name, netdev);
1251 if (err) { 1263 if (err) {
1252 e_err("Unable to allocate %s interrupt (return: %d)\n", 1264 if (adapter->flags & FLAG_MSI_ENABLED) {
1253 adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", err);
1254 if (adapter->flags & FLAG_MSI_ENABLED)
1255 pci_disable_msi(adapter->pdev); 1265 pci_disable_msi(adapter->pdev);
1266 adapter->flags &= ~FLAG_MSI_ENABLED;
1267 }
1268 e_err("Unable to allocate interrupt, Error: %d\n", err);
1256 } 1269 }
1257 1270
1258 return err; 1271 return err;
@@ -2592,6 +2605,135 @@ err:
2592} 2605}
2593 2606
2594/** 2607/**
2608 * e1000_intr_msi_test - Interrupt Handler
2609 * @irq: interrupt number
2610 * @data: pointer to a network interface device structure
2611 **/
2612static irqreturn_t e1000_intr_msi_test(int irq, void *data)
2613{
2614 struct net_device *netdev = data;
2615 struct e1000_adapter *adapter = netdev_priv(netdev);
2616 struct e1000_hw *hw = &adapter->hw;
2617 u32 icr = er32(ICR);
2618
2619 e_dbg("%s: icr is %08X\n", netdev->name, icr);
2620 if (icr & E1000_ICR_RXSEQ) {
2621 adapter->flags &= ~FLAG_MSI_TEST_FAILED;
2622 wmb();
2623 }
2624
2625 return IRQ_HANDLED;
2626}
2627
2628/**
2629 * e1000_test_msi_interrupt - Returns 0 for successful test
2630 * @adapter: board private struct
2631 *
2632 * code flow taken from tg3.c
2633 **/
2634static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
2635{
2636 struct net_device *netdev = adapter->netdev;
2637 struct e1000_hw *hw = &adapter->hw;
2638 int err;
2639
2640 /* poll_enable hasn't been called yet, so don't need disable */
2641 /* clear any pending events */
2642 er32(ICR);
2643
2644 /* free the real vector and request a test handler */
2645 e1000_free_irq(adapter);
2646
2647 /* Assume that the test fails, if it succeeds then the test
2648 * MSI irq handler will unset this flag */
2649 adapter->flags |= FLAG_MSI_TEST_FAILED;
2650
2651 err = pci_enable_msi(adapter->pdev);
2652 if (err)
2653 goto msi_test_failed;
2654
2655 err = request_irq(adapter->pdev->irq, &e1000_intr_msi_test, 0,
2656 netdev->name, netdev);
2657 if (err) {
2658 pci_disable_msi(adapter->pdev);
2659 goto msi_test_failed;
2660 }
2661
2662 wmb();
2663
2664 e1000_irq_enable(adapter);
2665
2666 /* fire an unusual interrupt on the test handler */
2667 ew32(ICS, E1000_ICS_RXSEQ);
2668 e1e_flush();
2669 msleep(50);
2670
2671 e1000_irq_disable(adapter);
2672
2673 rmb();
2674
2675 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
2676 err = -EIO;
2677 e_info("MSI interrupt test failed!\n");
2678 }
2679
2680 free_irq(adapter->pdev->irq, netdev);
2681 pci_disable_msi(adapter->pdev);
2682
2683 if (err == -EIO)
2684 goto msi_test_failed;
2685
2686 /* okay so the test worked, restore settings */
2687 e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name);
2688msi_test_failed:
2689 /* restore the original vector, even if it failed */
2690 e1000_request_irq(adapter);
2691 return err;
2692}
2693
2694/**
2695 * e1000_test_msi - Returns 0 if MSI test succeeds or INTx mode is restored
2696 * @adapter: board private struct
2697 *
2698 * code flow taken from tg3.c, called with e1000 interrupts disabled.
2699 **/
2700static int e1000_test_msi(struct e1000_adapter *adapter)
2701{
2702 int err;
2703 u16 pci_cmd;
2704
2705 if (!(adapter->flags & FLAG_MSI_ENABLED))
2706 return 0;
2707
2708 /* disable SERR in case the MSI write causes a master abort */
2709 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
2710 pci_write_config_word(adapter->pdev, PCI_COMMAND,
2711 pci_cmd & ~PCI_COMMAND_SERR);
2712
2713 err = e1000_test_msi_interrupt(adapter);
2714
2715 /* restore previous setting of command word */
2716 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);
2717
2718 /* success ! */
2719 if (!err)
2720 return 0;
2721
2722 /* EIO means MSI test failed */
2723 if (err != -EIO)
2724 return err;
2725
2726 /* back to INTx mode */
2727 e_warn("MSI interrupt test failed, using legacy interrupt.\n");
2728
2729 e1000_free_irq(adapter);
2730
2731 err = e1000_request_irq(adapter);
2732
2733 return err;
2734}
2735
2736/**
2595 * e1000_open - Called when a network interface is made active 2737 * e1000_open - Called when a network interface is made active
2596 * @netdev: network interface device structure 2738 * @netdev: network interface device structure
2597 * 2739 *
@@ -2649,6 +2791,19 @@ static int e1000_open(struct net_device *netdev)
2649 if (err) 2791 if (err)
2650 goto err_req_irq; 2792 goto err_req_irq;
2651 2793
2794 /*
2795 * Work around PCIe errata with MSI interrupts causing some chipsets to
2796 * ignore e1000e MSI messages, which means we need to test our MSI
2797 * interrupt now
2798 */
2799 {
2800 err = e1000_test_msi(adapter);
2801 if (err) {
2802 e_err("Interrupt allocation failed\n");
2803 goto err_req_irq;
2804 }
2805 }
2806
2652 /* From here on the code is the same as e1000e_up() */ 2807 /* From here on the code is the same as e1000e_up() */
2653 clear_bit(__E1000_DOWN, &adapter->state); 2808 clear_bit(__E1000_DOWN, &adapter->state);
2654 2809
@@ -3055,7 +3210,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3055 case SPEED_10: 3210 case SPEED_10:
3056 txb2b = 0; 3211 txb2b = 0;
3057 netdev->tx_queue_len = 10; 3212 netdev->tx_queue_len = 10;
3058 adapter->tx_timeout_factor = 14; 3213 adapter->tx_timeout_factor = 16;
3059 break; 3214 break;
3060 case SPEED_100: 3215 case SPEED_100:
3061 txb2b = 0; 3216 txb2b = 0;
@@ -3721,7 +3876,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3721 struct e1000_adapter *adapter = netdev_priv(netdev); 3876 struct e1000_adapter *adapter = netdev_priv(netdev);
3722 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 3877 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
3723 3878
3724 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 3879 if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) ||
3725 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 3880 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
3726 e_err("Invalid MTU setting\n"); 3881 e_err("Invalid MTU setting\n");
3727 return -EINVAL; 3882 return -EINVAL;
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index 8effc3107f9a..ed912e023a72 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -324,14 +324,27 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
324 adapter->itr = 20000; 324 adapter->itr = 20000;
325 break; 325 break;
326 default: 326 default:
327 e1000_validate_option(&adapter->itr, &opt,
328 adapter);
329 /* 327 /*
330 * save the setting, because the dynamic bits 328 * Save the setting, because the dynamic bits
331 * change itr. clear the lower two bits 329 * change itr.
332 * because they are used as control
333 */ 330 */
334 adapter->itr_setting = adapter->itr & ~3; 331 if (e1000_validate_option(&adapter->itr, &opt,
332 adapter) &&
333 (adapter->itr == 3)) {
334 /*
335 * In case of invalid user value,
336 * default to conservative mode.
337 */
338 adapter->itr_setting = adapter->itr;
339 adapter->itr = 20000;
340 } else {
341 /*
342 * Clear the lower two bits because
343 * they are used as control.
344 */
345 adapter->itr_setting =
346 adapter->itr & ~3;
347 }
335 break; 348 break;
336 } 349 }
337 } else { 350 } else {
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index ca6cf6ecb37b..999d69168277 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -134,9 +134,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int l
134static void gfar_vlan_rx_register(struct net_device *netdev, 134static void gfar_vlan_rx_register(struct net_device *netdev,
135 struct vlan_group *grp); 135 struct vlan_group *grp);
136void gfar_halt(struct net_device *dev); 136void gfar_halt(struct net_device *dev);
137#ifdef CONFIG_PM
138static void gfar_halt_nodisable(struct net_device *dev); 137static void gfar_halt_nodisable(struct net_device *dev);
139#endif
140void gfar_start(struct net_device *dev); 138void gfar_start(struct net_device *dev);
141static void gfar_clear_exact_match(struct net_device *dev); 139static void gfar_clear_exact_match(struct net_device *dev);
142static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); 140static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr);
@@ -631,7 +629,6 @@ static void init_registers(struct net_device *dev)
631} 629}
632 630
633 631
634#ifdef CONFIG_PM
635/* Halt the receive and transmit queues */ 632/* Halt the receive and transmit queues */
636static void gfar_halt_nodisable(struct net_device *dev) 633static void gfar_halt_nodisable(struct net_device *dev)
637{ 634{
@@ -657,7 +654,6 @@ static void gfar_halt_nodisable(struct net_device *dev)
657 cpu_relax(); 654 cpu_relax();
658 } 655 }
659} 656}
660#endif
661 657
662/* Halt the receive and transmit queues */ 658/* Halt the receive and transmit queues */
663void gfar_halt(struct net_device *dev) 659void gfar_halt(struct net_device *dev)
@@ -666,6 +662,8 @@ void gfar_halt(struct net_device *dev)
666 struct gfar __iomem *regs = priv->regs; 662 struct gfar __iomem *regs = priv->regs;
667 u32 tempval; 663 u32 tempval;
668 664
665 gfar_halt_nodisable(dev);
666
669 /* Disable Rx and Tx */ 667 /* Disable Rx and Tx */
670 tempval = gfar_read(&regs->maccfg1); 668 tempval = gfar_read(&regs->maccfg1);
671 tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); 669 tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 5116f68e01b9..782c20170082 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -33,7 +33,6 @@
33 33
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/version.h>
37 36
38#include "gianfar.h" 37#include "gianfar.h"
39 38
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index e0e718ab4c2e..dd9318f19497 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -7,7 +7,6 @@
7#ifndef __LINUX_IPG_H 7#ifndef __LINUX_IPG_H
8#define __LINUX_IPG_H 8#define __LINUX_IPG_H
9 9
10#include <linux/version.h>
11#include <linux/module.h> 10#include <linux/module.h>
12 11
13#include <linux/kernel.h> 12#include <linux/kernel.h>
@@ -21,7 +20,6 @@
21#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/skbuff.h> 22#include <linux/skbuff.h>
24#include <linux/version.h>
25#include <asm/bitops.h> 23#include <asm/bitops.h>
26 24
27/* 25/*
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 2f38e847e2cd..f96358b641af 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -190,6 +190,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
190 case IXGBE_DEV_ID_82598AF_DUAL_PORT: 190 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
191 case IXGBE_DEV_ID_82598AF_SINGLE_PORT: 191 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
192 case IXGBE_DEV_ID_82598EB_CX4: 192 case IXGBE_DEV_ID_82598EB_CX4:
193 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
193 media_type = ixgbe_media_type_fiber; 194 media_type = ixgbe_media_type_fiber;
194 break; 195 break;
195 case IXGBE_DEV_ID_82598AT_DUAL_PORT: 196 case IXGBE_DEV_ID_82598AT_DUAL_PORT:
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index e5f3da8468cc..34bca16d48a6 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -48,7 +48,7 @@ char ixgbe_driver_name[] = "ixgbe";
48static const char ixgbe_driver_string[] = 48static const char ixgbe_driver_string[] =
49 "Intel(R) 10 Gigabit PCI Express Network Driver"; 49 "Intel(R) 10 Gigabit PCI Express Network Driver";
50 50
51#define DRV_VERSION "1.3.18-k2" 51#define DRV_VERSION "1.3.18-k4"
52const char ixgbe_driver_version[] = DRV_VERSION; 52const char ixgbe_driver_version[] = DRV_VERSION;
53static const char ixgbe_copyright[] = 53static const char ixgbe_copyright[] =
54 "Copyright (c) 1999-2007 Intel Corporation."; 54 "Copyright (c) 1999-2007 Intel Corporation.";
@@ -72,6 +72,8 @@ static struct pci_device_id ixgbe_pci_tbl[] = {
72 board_82598 }, 72 board_82598 },
73 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4), 73 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4),
74 board_82598 }, 74 board_82598 },
75 {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598_CX4_DUAL_PORT),
76 board_82598 },
75 77
76 /* required last entry */ 78 /* required last entry */
77 {0, } 79 {0, }
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 1ad7cb9c25a8..c0282a223df3 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -39,6 +39,7 @@
39#define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7 39#define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7
40#define IXGBE_DEV_ID_82598AT_DUAL_PORT 0x10C8 40#define IXGBE_DEV_ID_82598AT_DUAL_PORT 0x10C8
41#define IXGBE_DEV_ID_82598EB_CX4 0x10DD 41#define IXGBE_DEV_ID_82598EB_CX4 0x10DD
42#define IXGBE_DEV_ID_82598_CX4_DUAL_PORT 0x10EC
42 43
43/* General Registers */ 44/* General Registers */
44#define IXGBE_CTRL 0x00000 45#define IXGBE_CTRL 0x00000
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 49f6bc036a92..3b43bfd85a0f 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -64,68 +64,6 @@ struct pcpu_lstats {
64 unsigned long bytes; 64 unsigned long bytes;
65}; 65};
66 66
67/* KISS: just allocate small chunks and copy bits.
68 *
69 * So, in fact, this is documentation, explaining what we expect
70 * of largesending device modulo TCP checksum, which is ignored for loopback.
71 */
72
73#ifdef LOOPBACK_TSO
74static void emulate_large_send_offload(struct sk_buff *skb)
75{
76 struct iphdr *iph = ip_hdr(skb);
77 struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) +
78 (iph->ihl * 4));
79 unsigned int doffset = (iph->ihl + th->doff) * 4;
80 unsigned int mtu = skb_shinfo(skb)->gso_size + doffset;
81 unsigned int offset = 0;
82 u32 seq = ntohl(th->seq);
83 u16 id = ntohs(iph->id);
84
85 while (offset + doffset < skb->len) {
86 unsigned int frag_size = min(mtu, skb->len - offset) - doffset;
87 struct sk_buff *nskb = alloc_skb(mtu + 32, GFP_ATOMIC);
88
89 if (!nskb)
90 break;
91 skb_reserve(nskb, 32);
92 skb_set_mac_header(nskb, -ETH_HLEN);
93 skb_reset_network_header(nskb);
94 iph = ip_hdr(nskb);
95 skb_copy_to_linear_data(nskb, skb_network_header(skb),
96 doffset);
97 if (skb_copy_bits(skb,
98 doffset + offset,
99 nskb->data + doffset,
100 frag_size))
101 BUG();
102 skb_put(nskb, doffset + frag_size);
103 nskb->ip_summed = CHECKSUM_UNNECESSARY;
104 nskb->dev = skb->dev;
105 nskb->priority = skb->priority;
106 nskb->protocol = skb->protocol;
107 nskb->dst = dst_clone(skb->dst);
108 memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
109 nskb->pkt_type = skb->pkt_type;
110
111 th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4);
112 iph->tot_len = htons(frag_size + doffset);
113 iph->id = htons(id);
114 iph->check = 0;
115 iph->check = ip_fast_csum((unsigned char *) iph, iph->ihl);
116 th->seq = htonl(seq);
117 if (offset + doffset + frag_size < skb->len)
118 th->fin = th->psh = 0;
119 netif_rx(nskb);
120 offset += frag_size;
121 seq += frag_size;
122 id++;
123 }
124
125 dev_kfree_skb(skb);
126}
127#endif /* LOOPBACK_TSO */
128
129/* 67/*
130 * The higher levels take care of making this non-reentrant (it's 68 * The higher levels take care of making this non-reentrant (it's
131 * called with bh's disabled). 69 * called with bh's disabled).
@@ -137,9 +75,6 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
137 skb_orphan(skb); 75 skb_orphan(skb);
138 76
139 skb->protocol = eth_type_trans(skb,dev); 77 skb->protocol = eth_type_trans(skb,dev);
140#ifndef LOOPBACK_MUST_CHECKSUM
141 skb->ip_summed = CHECKSUM_UNNECESSARY;
142#endif
143 78
144#ifdef LOOPBACK_TSO 79#ifdef LOOPBACK_TSO
145 if (skb_is_gso(skb)) { 80 if (skb_is_gso(skb)) {
@@ -234,9 +169,7 @@ static void loopback_setup(struct net_device *dev)
234 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ 169 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
235 dev->flags = IFF_LOOPBACK; 170 dev->flags = IFF_LOOPBACK;
236 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST 171 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
237#ifdef LOOPBACK_TSO
238 | NETIF_F_TSO 172 | NETIF_F_TSO
239#endif
240 | NETIF_F_NO_CSUM 173 | NETIF_F_NO_CSUM
241 | NETIF_F_HIGHDMA 174 | NETIF_F_HIGHDMA
242 | NETIF_F_LLTX 175 | NETIF_F_LLTX
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index f1de38f8b742..54cd89cb0838 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -56,7 +56,6 @@
56#include <linux/ethtool.h> 56#include <linux/ethtool.h>
57#include <linux/firmware.h> 57#include <linux/firmware.h>
58#include <linux/delay.h> 58#include <linux/delay.h>
59#include <linux/version.h>
60#include <linux/timer.h> 59#include <linux/timer.h>
61#include <linux/vmalloc.h> 60#include <linux/vmalloc.h>
62#include <linux/crc32.h> 61#include <linux/crc32.h>
@@ -3548,7 +3547,11 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3548 3547
3549 /* try to load the slice aware rss firmware */ 3548 /* try to load the slice aware rss firmware */
3550 old_fw = mgp->fw_name; 3549 old_fw = mgp->fw_name;
3551 if (old_fw == myri10ge_fw_aligned) 3550 if (myri10ge_fw_name != NULL) {
3551 dev_info(&mgp->pdev->dev, "overriding rss firmware to %s\n",
3552 myri10ge_fw_name);
3553 mgp->fw_name = myri10ge_fw_name;
3554 } else if (old_fw == myri10ge_fw_aligned)
3552 mgp->fw_name = myri10ge_fw_rss_aligned; 3555 mgp->fw_name = myri10ge_fw_rss_aligned;
3553 else 3556 else
3554 mgp->fw_name = myri10ge_fw_rss_unaligned; 3557 mgp->fw_name = myri10ge_fw_rss_unaligned;
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 42443d697423..fa3ceca4e15c 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -118,7 +118,7 @@ bad_clone_list[] __initdata = {
118 {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ 118 {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */
119 {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ 119 {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */
120 {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ 120 {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
121#if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 121#ifdef CONFIG_MACH_TX49XX
122 {"RBHMA4X00-RTL8019", "RBHMA4X00/RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */ 122 {"RBHMA4X00-RTL8019", "RBHMA4X00/RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */
123#endif 123#endif
124 {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ 124 {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
@@ -142,7 +142,7 @@ bad_clone_list[] __initdata = {
142#if defined(CONFIG_PLAT_MAPPI) 142#if defined(CONFIG_PLAT_MAPPI)
143# define DCR_VAL 0x4b 143# define DCR_VAL 0x4b
144#elif defined(CONFIG_PLAT_OAKS32R) || \ 144#elif defined(CONFIG_PLAT_OAKS32R) || \
145 defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 145 defined(CONFIG_MACH_TX49XX)
146# define DCR_VAL 0x48 /* 8-bit mode */ 146# define DCR_VAL 0x48 /* 8-bit mode */
147#else 147#else
148# define DCR_VAL 0x49 148# define DCR_VAL 0x49
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 93a7b9b668d5..244ab49c4337 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -45,7 +45,6 @@
45#include <linux/in.h> 45#include <linux/in.h>
46#include <linux/tcp.h> 46#include <linux/tcp.h>
47#include <linux/skbuff.h> 47#include <linux/skbuff.h>
48#include <linux/version.h>
49 48
50#include <linux/ethtool.h> 49#include <linux/ethtool.h>
51#include <linux/mii.h> 50#include <linux/mii.h>
@@ -66,8 +65,8 @@
66 65
67#define _NETXEN_NIC_LINUX_MAJOR 4 66#define _NETXEN_NIC_LINUX_MAJOR 4
68#define _NETXEN_NIC_LINUX_MINOR 0 67#define _NETXEN_NIC_LINUX_MINOR 0
69#define _NETXEN_NIC_LINUX_SUBVERSION 0 68#define _NETXEN_NIC_LINUX_SUBVERSION 11
70#define NETXEN_NIC_LINUX_VERSIONID "4.0.0" 69#define NETXEN_NIC_LINUX_VERSIONID "4.0.11"
71 70
72#define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) 71#define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c))
73 72
@@ -1615,7 +1614,8 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter)
1615 1614
1616 1615
1617int netxen_is_flash_supported(struct netxen_adapter *adapter); 1616int netxen_is_flash_supported(struct netxen_adapter *adapter);
1618int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]); 1617int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
1618int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
1619extern void netxen_change_ringparam(struct netxen_adapter *adapter); 1619extern void netxen_change_ringparam(struct netxen_adapter *adapter);
1620extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, 1620extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
1621 int *valp); 1621 int *valp);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 4ad3e0844b99..b974ca0fc530 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -38,7 +38,6 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <linux/netdevice.h> 39#include <linux/netdevice.h>
40#include <linux/ethtool.h> 40#include <linux/ethtool.h>
41#include <linux/version.h>
42 41
43#include "netxen_nic.h" 42#include "netxen_nic.h"
44#include "netxen_nic_hw.h" 43#include "netxen_nic_hw.h"
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index e8e8d73f6ed7..e80f9e3e5973 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -32,8 +32,6 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/version.h>
36
37#include <linux/spinlock.h> 35#include <linux/spinlock.h>
38#include <asm/irq.h> 36#include <asm/irq.h>
39#include <linux/init.h> 37#include <linux/init.h>
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 9aa20f961618..84978f80f396 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -733,31 +733,56 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
733 return 0; 733 return 0;
734} 734}
735 735
736int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]) 736int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac)
737{ 737{
738 __le32 *pmac = (__le32 *) & mac[0]; 738 __le32 *pmac = (__le32 *) mac;
739 u32 offset;
739 740
740 if (netxen_get_flash_block(adapter, 741 offset = NETXEN_USER_START +
741 NETXEN_USER_START + 742 offsetof(struct netxen_new_user_info, mac_addr) +
742 offsetof(struct netxen_new_user_info, 743 adapter->portnum * sizeof(u64);
743 mac_addr), 744
744 FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { 745 if (netxen_get_flash_block(adapter, offset, sizeof(u64), pmac) == -1)
745 return -1; 746 return -1;
746 } 747
747 if (*mac == cpu_to_le64(~0ULL)) { 748 if (*mac == cpu_to_le64(~0ULL)) {
749
750 offset = NETXEN_USER_START_OLD +
751 offsetof(struct netxen_user_old_info, mac_addr) +
752 adapter->portnum * sizeof(u64);
753
748 if (netxen_get_flash_block(adapter, 754 if (netxen_get_flash_block(adapter,
749 NETXEN_USER_START_OLD + 755 offset, sizeof(u64), pmac) == -1)
750 offsetof(struct netxen_user_old_info,
751 mac_addr),
752 FLASH_NUM_PORTS * sizeof(u64),
753 pmac) == -1)
754 return -1; 756 return -1;
757
755 if (*mac == cpu_to_le64(~0ULL)) 758 if (*mac == cpu_to_le64(~0ULL))
756 return -1; 759 return -1;
757 } 760 }
758 return 0; 761 return 0;
759} 762}
760 763
764int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac)
765{
766 uint32_t crbaddr, mac_hi, mac_lo;
767 int pci_func = adapter->ahw.pci_func;
768
769 crbaddr = CRB_MAC_BLOCK_START +
770 (4 * ((pci_func/2) * 3)) + (4 * (pci_func & 1));
771
772 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4);
773 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4);
774
775 mac_hi = cpu_to_le32(mac_hi);
776 mac_lo = cpu_to_le32(mac_lo);
777
778 if (pci_func & 1)
779 *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16));
780 else
781 *mac = ((mac_lo) | ((u64)mac_hi << 32));
782
783 return 0;
784}
785
761#define CRB_WIN_LOCK_TIMEOUT 100000000 786#define CRB_WIN_LOCK_TIMEOUT 100000000
762 787
763static int crb_win_lock(struct netxen_adapter *adapter) 788static int crb_win_lock(struct netxen_adapter *adapter)
@@ -2183,10 +2208,10 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
2183 if (adapter->portnum == 0) { 2208 if (adapter->portnum == 0) {
2184 get_brd_name_by_type(board_info->board_type, brd_name); 2209 get_brd_name_by_type(board_info->board_type, brd_name);
2185 2210
2186 printk("NetXen %s Board S/N %s Chip id 0x%x\n", 2211 printk(KERN_INFO "NetXen %s Board S/N %s Chip rev 0x%x\n",
2187 brd_name, serial_num, board_info->chip_id); 2212 brd_name, serial_num, adapter->ahw.revision_id);
2188 printk("NetXen Firmware version %d.%d.%d\n", fw_major, 2213 printk(KERN_INFO "NetXen Firmware version %d.%d.%d\n",
2189 fw_minor, fw_build); 2214 fw_major, fw_minor, fw_build);
2190 } 2215 }
2191 2216
2192 if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < 2217 if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) <
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 519fc860e17e..5bba675d0504 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1079,10 +1079,12 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
1079 1079
1080void netxen_free_adapter_offload(struct netxen_adapter *adapter) 1080void netxen_free_adapter_offload(struct netxen_adapter *adapter)
1081{ 1081{
1082 int i; 1082 int i = 100;
1083
1084 if (!adapter->dummy_dma.addr)
1085 return;
1083 1086
1084 if (adapter->dummy_dma.addr) { 1087 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1085 i = 100;
1086 do { 1088 do {
1087 if (dma_watchdog_shutdown_request(adapter) == 1) 1089 if (dma_watchdog_shutdown_request(adapter) == 1)
1088 break; 1090 break;
@@ -1090,17 +1092,17 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter)
1090 if (dma_watchdog_shutdown_poll_result(adapter) == 1) 1092 if (dma_watchdog_shutdown_poll_result(adapter) == 1)
1091 break; 1093 break;
1092 } while (--i); 1094 } while (--i);
1095 }
1093 1096
1094 if (i) { 1097 if (i) {
1095 pci_free_consistent(adapter->pdev, 1098 pci_free_consistent(adapter->pdev,
1096 NETXEN_HOST_DUMMY_DMA_SIZE, 1099 NETXEN_HOST_DUMMY_DMA_SIZE,
1097 adapter->dummy_dma.addr, 1100 adapter->dummy_dma.addr,
1098 adapter->dummy_dma.phys_addr); 1101 adapter->dummy_dma.phys_addr);
1099 adapter->dummy_dma.addr = NULL; 1102 adapter->dummy_dma.addr = NULL;
1100 } else { 1103 } else {
1101 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 1104 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
1102 adapter->netdev->name); 1105 adapter->netdev->name);
1103 }
1104 } 1106 }
1105} 1107}
1106 1108
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 7615c715e66e..32bb47adbe39 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -149,76 +149,18 @@ static uint32_t msi_tgt_status[8] = {
149 149
150static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG; 150static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG;
151 151
152static void netxen_nic_disable_int(struct netxen_adapter *adapter) 152static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
153{ 153{
154 u32 mask = 0x7ff; 154 adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0);
155 int retries = 32;
156 int pci_fn = adapter->ahw.pci_func;
157
158 if (adapter->msi_mode != MSI_MODE_MULTIFUNC)
159 adapter->pci_write_normalize(adapter,
160 adapter->crb_intr_mask, 0);
161
162 if (adapter->intr_scheme != -1 &&
163 adapter->intr_scheme != INTR_SCHEME_PERPORT)
164 adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask);
165
166 if (!NETXEN_IS_MSI_FAMILY(adapter)) {
167 do {
168 adapter->pci_write_immediate(adapter,
169 adapter->legacy_intr.tgt_status_reg,
170 0xffffffff);
171 mask = adapter->pci_read_immediate(adapter,
172 ISR_INT_VECTOR);
173 if (!(mask & 0x80))
174 break;
175 udelay(10);
176 } while (--retries);
177
178 if (!retries) {
179 printk(KERN_NOTICE "%s: Failed to disable interrupt\n",
180 netxen_nic_driver_name);
181 }
182 } else {
183 if (adapter->msi_mode == MSI_MODE_MULTIFUNC) {
184 adapter->pci_write_immediate(adapter,
185 msi_tgt_status[pci_fn], 0xffffffff);
186 }
187 }
188} 155}
189 156
190static void netxen_nic_enable_int(struct netxen_adapter *adapter) 157static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
191{ 158{
192 u32 mask;
193
194 if (adapter->intr_scheme != -1 &&
195 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
196 switch (adapter->ahw.board_type) {
197 case NETXEN_NIC_GBE:
198 mask = 0x77b;
199 break;
200 case NETXEN_NIC_XGBE:
201 mask = 0x77f;
202 break;
203 default:
204 mask = 0x7ff;
205 break;
206 }
207
208 adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask);
209 }
210
211 adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1); 159 adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1);
212 160
213 if (!NETXEN_IS_MSI_FAMILY(adapter)) { 161 if (!NETXEN_IS_MSI_FAMILY(adapter))
214 mask = 0xbff; 162 adapter->pci_write_immediate(adapter,
215 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) 163 adapter->legacy_intr.tgt_mask_reg, 0xfbff);
216 adapter->pci_write_immediate(adapter,
217 adapter->legacy_intr.tgt_mask_reg, mask);
218 else
219 adapter->pci_write_normalize(adapter,
220 CRB_INT_VECTOR, 0);
221 }
222} 164}
223 165
224static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) 166static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id)
@@ -501,6 +443,44 @@ static void netxen_init_msix_entries(struct netxen_adapter *adapter)
501 adapter->msix_entries[i].entry = i; 443 adapter->msix_entries[i].entry = i;
502} 444}
503 445
446static int
447netxen_read_mac_addr(struct netxen_adapter *adapter)
448{
449 int i;
450 unsigned char *p;
451 __le64 mac_addr;
452 DECLARE_MAC_BUF(mac);
453 struct net_device *netdev = adapter->netdev;
454 struct pci_dev *pdev = adapter->pdev;
455
456 if (netxen_is_flash_supported(adapter) != 0)
457 return -EIO;
458
459 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
460 if (netxen_p3_get_mac_addr(adapter, &mac_addr) != 0)
461 return -EIO;
462 } else {
463 if (netxen_get_flash_mac_addr(adapter, &mac_addr) != 0)
464 return -EIO;
465 }
466
467 p = (unsigned char *)&mac_addr;
468 for (i = 0; i < 6; i++)
469 netdev->dev_addr[i] = *(p + 5 - i);
470
471 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
472
473 /* set station address */
474
475 if (!is_valid_ether_addr(netdev->perm_addr)) {
476 dev_warn(&pdev->dev, "Bad MAC address %s.\n",
477 print_mac(mac, netdev->dev_addr));
478 } else
479 adapter->macaddr_set(adapter, netdev->dev_addr);
480
481 return 0;
482}
483
504/* 484/*
505 * netxen_nic_probe() 485 * netxen_nic_probe()
506 * 486 *
@@ -529,10 +509,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
529 unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0; 509 unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0;
530 int i = 0, err; 510 int i = 0, err;
531 int first_driver, first_boot; 511 int first_driver, first_boot;
532 __le64 mac_addr[FLASH_NUM_PORTS + 1];
533 u32 val; 512 u32 val;
534 int pci_func_id = PCI_FUNC(pdev->devfn); 513 int pci_func_id = PCI_FUNC(pdev->devfn);
535 DECLARE_MAC_BUF(mac);
536 struct netxen_legacy_intr_set *legacy_intrp; 514 struct netxen_legacy_intr_set *legacy_intrp;
537 uint8_t revision_id; 515 uint8_t revision_id;
538 516
@@ -545,6 +523,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
545 return -ENODEV; 523 return -ENODEV;
546 } 524 }
547 525
526 if (pdev->revision >= NX_P3_A0 && pdev->revision < NX_P3_B1) {
527 printk(KERN_WARNING "NetXen chip revisions between 0x%x-0x%x"
528 "will not be enabled.\n",
529 NX_P3_A0, NX_P3_B1);
530 return -ENODEV;
531 }
532
548 if ((err = pci_enable_device(pdev))) 533 if ((err = pci_enable_device(pdev)))
549 return err; 534 return err;
550 535
@@ -898,34 +883,14 @@ request_msi:
898 goto err_out_disable_msi; 883 goto err_out_disable_msi;
899 884
900 init_timer(&adapter->watchdog_timer); 885 init_timer(&adapter->watchdog_timer);
901 adapter->ahw.linkup = 0;
902 adapter->watchdog_timer.function = &netxen_watchdog; 886 adapter->watchdog_timer.function = &netxen_watchdog;
903 adapter->watchdog_timer.data = (unsigned long)adapter; 887 adapter->watchdog_timer.data = (unsigned long)adapter;
904 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); 888 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task);
905 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); 889 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task);
906 890
907 if (netxen_is_flash_supported(adapter) == 0 && 891 err = netxen_read_mac_addr(adapter);
908 netxen_get_flash_mac_addr(adapter, mac_addr) == 0) { 892 if (err)
909 unsigned char *p; 893 dev_warn(&pdev->dev, "failed to read mac addr\n");
910
911 p = (unsigned char *)&mac_addr[adapter->portnum];
912 netdev->dev_addr[0] = *(p + 5);
913 netdev->dev_addr[1] = *(p + 4);
914 netdev->dev_addr[2] = *(p + 3);
915 netdev->dev_addr[3] = *(p + 2);
916 netdev->dev_addr[4] = *(p + 1);
917 netdev->dev_addr[5] = *(p + 0);
918
919 memcpy(netdev->perm_addr, netdev->dev_addr,
920 netdev->addr_len);
921 if (!is_valid_ether_addr(netdev->perm_addr)) {
922 printk(KERN_ERR "%s: Bad MAC address %s.\n",
923 netxen_nic_driver_name,
924 print_mac(mac, netdev->dev_addr));
925 } else {
926 adapter->macaddr_set(adapter, netdev->dev_addr);
927 }
928 }
929 894
930 netif_carrier_off(netdev); 895 netif_carrier_off(netdev);
931 netif_stop_queue(netdev); 896 netif_stop_queue(netdev);
@@ -1000,6 +965,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
1000 965
1001 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 966 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
1002 netxen_free_hw_resources(adapter); 967 netxen_free_hw_resources(adapter);
968 netxen_release_rx_buffers(adapter);
1003 netxen_free_sw_resources(adapter); 969 netxen_free_sw_resources(adapter);
1004 } 970 }
1005 971
@@ -1069,6 +1035,15 @@ static int netxen_nic_open(struct net_device *netdev)
1069 goto err_out_free_sw; 1035 goto err_out_free_sw;
1070 } 1036 }
1071 1037
1038 if ((adapter->msi_mode != MSI_MODE_MULTIFUNC) ||
1039 (adapter->intr_scheme != INTR_SCHEME_PERPORT)) {
1040 printk(KERN_ERR "%s: Firmware interrupt scheme is "
1041 "incompatible with driver\n",
1042 netdev->name);
1043 adapter->driver_mismatch = 1;
1044 goto err_out_free_hw;
1045 }
1046
1072 if (adapter->fw_major < 4) { 1047 if (adapter->fw_major < 4) {
1073 adapter->crb_addr_cmd_producer = 1048 adapter->crb_addr_cmd_producer =
1074 crb_cmd_producer[adapter->portnum]; 1049 crb_cmd_producer[adapter->portnum];
@@ -1094,7 +1069,7 @@ static int netxen_nic_open(struct net_device *netdev)
1094 flags, netdev->name, adapter); 1069 flags, netdev->name, adapter);
1095 if (err) { 1070 if (err) {
1096 printk(KERN_ERR "request_irq failed with: %d\n", err); 1071 printk(KERN_ERR "request_irq failed with: %d\n", err);
1097 goto err_out_free_hw; 1072 goto err_out_free_rxbuf;
1098 } 1073 }
1099 1074
1100 adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; 1075 adapter->is_up = NETXEN_ADAPTER_UP_MAGIC;
@@ -1116,6 +1091,7 @@ static int netxen_nic_open(struct net_device *netdev)
1116 if (adapter->set_mtu) 1091 if (adapter->set_mtu)
1117 adapter->set_mtu(adapter, netdev->mtu); 1092 adapter->set_mtu(adapter, netdev->mtu);
1118 1093
1094 adapter->ahw.linkup = 0;
1119 mod_timer(&adapter->watchdog_timer, jiffies); 1095 mod_timer(&adapter->watchdog_timer, jiffies);
1120 1096
1121 napi_enable(&adapter->napi); 1097 napi_enable(&adapter->napi);
@@ -1127,6 +1103,8 @@ static int netxen_nic_open(struct net_device *netdev)
1127 1103
1128err_out_free_irq: 1104err_out_free_irq:
1129 free_irq(adapter->irq, adapter); 1105 free_irq(adapter->irq, adapter);
1106err_out_free_rxbuf:
1107 netxen_release_rx_buffers(adapter);
1130err_out_free_hw: 1108err_out_free_hw:
1131 netxen_free_hw_resources(adapter); 1109 netxen_free_hw_resources(adapter);
1132err_out_free_sw: 1110err_out_free_sw:
@@ -1152,10 +1130,8 @@ static int netxen_nic_close(struct net_device *netdev)
1152 1130
1153 netxen_release_tx_buffers(adapter); 1131 netxen_release_tx_buffers(adapter);
1154 1132
1155 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 1133 FLUSH_SCHEDULED_WORK();
1156 FLUSH_SCHEDULED_WORK(); 1134 del_timer_sync(&adapter->watchdog_timer);
1157 del_timer_sync(&adapter->watchdog_timer);
1158 }
1159 1135
1160 return 0; 1136 return 0;
1161} 1137}
@@ -1458,7 +1434,8 @@ void netxen_watchdog_task(struct work_struct *work)
1458 1434
1459 netxen_nic_handle_phy_intr(adapter); 1435 netxen_nic_handle_phy_intr(adapter);
1460 1436
1461 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 1437 if (netif_running(adapter->netdev))
1438 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1462} 1439}
1463 1440
1464static void netxen_tx_timeout(struct net_device *netdev) 1441static void netxen_tx_timeout(struct net_device *netdev)
@@ -1518,18 +1495,9 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
1518 return stats; 1495 return stats;
1519} 1496}
1520 1497
1521static inline void
1522netxen_handle_int(struct netxen_adapter *adapter)
1523{
1524 netxen_nic_disable_int(adapter);
1525 napi_schedule(&adapter->napi);
1526}
1527
1528static irqreturn_t netxen_intr(int irq, void *data) 1498static irqreturn_t netxen_intr(int irq, void *data)
1529{ 1499{
1530 struct netxen_adapter *adapter = data; 1500 struct netxen_adapter *adapter = data;
1531 u32 our_int = 0;
1532
1533 u32 status = 0; 1501 u32 status = 0;
1534 1502
1535 status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); 1503 status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR);
@@ -1544,22 +1512,32 @@ static irqreturn_t netxen_intr(int irq, void *data)
1544 if (!ISR_LEGACY_INT_TRIGGERED(status)) 1512 if (!ISR_LEGACY_INT_TRIGGERED(status))
1545 return IRQ_NONE; 1513 return IRQ_NONE;
1546 1514
1547 } else if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 1515 } else {
1516 unsigned long our_int = 0;
1548 1517
1549 our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); 1518 our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR);
1519
1550 /* not our interrupt */ 1520 /* not our interrupt */
1551 if ((our_int & (0x80 << adapter->portnum)) == 0) 1521 if (!test_and_clear_bit((7 + adapter->portnum), &our_int))
1552 return IRQ_NONE; 1522 return IRQ_NONE;
1553 1523
1554 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { 1524 /* claim interrupt */
1555 /* claim interrupt */ 1525 adapter->pci_write_normalize(adapter,
1556 adapter->pci_write_normalize(adapter, 1526 CRB_INT_VECTOR, (our_int & 0xffffffff));
1557 CRB_INT_VECTOR,
1558 our_int & ~((u32)(0x80 << adapter->portnum)));
1559 }
1560 } 1527 }
1561 1528
1562 netxen_handle_int(adapter); 1529 /* clear interrupt */
1530 if (adapter->fw_major < 4)
1531 netxen_nic_disable_int(adapter);
1532
1533 adapter->pci_write_immediate(adapter,
1534 adapter->legacy_intr.tgt_status_reg,
1535 0xffffffff);
1536 /* read twice to ensure write is flushed */
1537 adapter->pci_read_immediate(adapter, ISR_INT_VECTOR);
1538 adapter->pci_read_immediate(adapter, ISR_INT_VECTOR);
1539
1540 napi_schedule(&adapter->napi);
1563 1541
1564 return IRQ_HANDLED; 1542 return IRQ_HANDLED;
1565} 1543}
@@ -1568,7 +1546,11 @@ static irqreturn_t netxen_msi_intr(int irq, void *data)
1568{ 1546{
1569 struct netxen_adapter *adapter = data; 1547 struct netxen_adapter *adapter = data;
1570 1548
1571 netxen_handle_int(adapter); 1549 /* clear interrupt */
1550 adapter->pci_write_immediate(adapter,
1551 msi_tgt_status[adapter->ahw.pci_func], 0xffffffff);
1552
1553 napi_schedule(&adapter->napi);
1572 return IRQ_HANDLED; 1554 return IRQ_HANDLED;
1573} 1555}
1574 1556
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index 83e5ee57bfef..b293adcc95ab 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -125,6 +125,8 @@
125#define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4) 125#define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4)
126#define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8) 126#define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8)
127 127
128#define CRB_MAC_BLOCK_START NETXEN_CAM_RAM(0x1c0)
129
128/* 130/*
129 * capabilities register, can be used to selectively enable/disable features 131 * capabilities register, can be used to selectively enable/disable features
130 * for backward compability 132 * for backward compability
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index b35d79449500..88f03c9e9403 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -46,7 +46,6 @@
46#include <linux/err.h> 46#include <linux/err.h>
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/version.h>
50#include <linux/init.h> 49#include <linux/init.h>
51#include <linux/types.h> 50#include <linux/types.h>
52#include <linux/slab.h> 51#include <linux/slab.h>
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index f9298827a76c..ff175e8f36b2 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -61,7 +61,6 @@
61 */ 61 */
62 62
63#include <linux/module.h> 63#include <linux/module.h>
64#include <linux/version.h>
65#include <linux/string.h> 64#include <linux/string.h>
66#include <linux/list.h> 65#include <linux/list.h>
67#include <asm/uaccess.h> 66#include <asm/uaccess.h>
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 6531ff565c54..5d86281d9363 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -24,7 +24,6 @@
24 24
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/version.h>
28#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
29#include <linux/string.h> 28#include <linux/string.h>
30#include <linux/timer.h> 29#include <linux/timer.h>
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 25e62cf58d3a..1c370e6aa641 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -20,7 +20,6 @@
20 * the file called "COPYING". 20 * the file called "COPYING".
21 */ 21 */
22 22
23#include <linux/version.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
26#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 7d29edcd40b4..e24b25ca1c69 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -24,7 +24,6 @@
24 24
25#include <linux/crc32.h> 25#include <linux/crc32.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/version.h>
28#include <linux/module.h> 27#include <linux/module.h>
29#include <linux/netdevice.h> 28#include <linux/netdevice.h>
30#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
@@ -666,11 +665,16 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
666 665
667 if (hw->chip_id != CHIP_ID_YUKON_EC) { 666 if (hw->chip_id != CHIP_ID_YUKON_EC) {
668 if (hw->chip_id == CHIP_ID_YUKON_EC_U) { 667 if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
669 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); 668 /* select page 2 to access MAC control register */
669 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 2);
670 670
671 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
671 /* enable Power Down */ 672 /* enable Power Down */
672 ctrl |= PHY_M_PC_POW_D_ENA; 673 ctrl |= PHY_M_PC_POW_D_ENA;
673 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); 674 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
675
676 /* set page register back to 0 */
677 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0);
674 } 678 }
675 679
676 /* set IEEE compatible Power Down Mode (dev. #4.99) */ 680 /* set IEEE compatible Power Down Mode (dev. #4.99) */
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index c66dfc9ec1ec..7db48f1cd949 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -27,7 +27,6 @@
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/if_vlan.h> 29#include <linux/if_vlan.h>
30#include <linux/version.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
32#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
33#include <asm/byteorder.h> 32#include <asm/byteorder.h>
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d2439b85a790..71d2c5cfdad9 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -66,8 +66,8 @@
66 66
67#define DRV_MODULE_NAME "tg3" 67#define DRV_MODULE_NAME "tg3"
68#define PFX DRV_MODULE_NAME ": " 68#define PFX DRV_MODULE_NAME ": "
69#define DRV_MODULE_VERSION "3.93" 69#define DRV_MODULE_VERSION "3.94"
70#define DRV_MODULE_RELDATE "May 22, 2008" 70#define DRV_MODULE_RELDATE "August 14, 2008"
71 71
72#define TG3_DEF_MAC_MODE 0 72#define TG3_DEF_MAC_MODE 0
73#define TG3_DEF_RX_MODE 0 73#define TG3_DEF_RX_MODE 0
@@ -536,6 +536,7 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
536 return 0; 536 return 0;
537 537
538 switch (locknum) { 538 switch (locknum) {
539 case TG3_APE_LOCK_GRC:
539 case TG3_APE_LOCK_MEM: 540 case TG3_APE_LOCK_MEM:
540 break; 541 break;
541 default: 542 default:
@@ -573,6 +574,7 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
573 return; 574 return;
574 575
575 switch (locknum) { 576 switch (locknum) {
577 case TG3_APE_LOCK_GRC:
576 case TG3_APE_LOCK_MEM: 578 case TG3_APE_LOCK_MEM:
577 break; 579 break;
578 default: 580 default:
@@ -1018,15 +1020,43 @@ static void tg3_mdio_fini(struct tg3 *tp)
1018} 1020}
1019 1021
1020/* tp->lock is held. */ 1022/* tp->lock is held. */
1023static inline void tg3_generate_fw_event(struct tg3 *tp)
1024{
1025 u32 val;
1026
1027 val = tr32(GRC_RX_CPU_EVENT);
1028 val |= GRC_RX_CPU_DRIVER_EVENT;
1029 tw32_f(GRC_RX_CPU_EVENT, val);
1030
1031 tp->last_event_jiffies = jiffies;
1032}
1033
1034#define TG3_FW_EVENT_TIMEOUT_USEC 2500
1035
1036/* tp->lock is held. */
1021static void tg3_wait_for_event_ack(struct tg3 *tp) 1037static void tg3_wait_for_event_ack(struct tg3 *tp)
1022{ 1038{
1023 int i; 1039 int i;
1040 unsigned int delay_cnt;
1041 long time_remain;
1042
1043 /* If enough time has passed, no wait is necessary. */
1044 time_remain = (long)(tp->last_event_jiffies + 1 +
1045 usecs_to_jiffies(TG3_FW_EVENT_TIMEOUT_USEC)) -
1046 (long)jiffies;
1047 if (time_remain < 0)
1048 return;
1024 1049
1025 /* Wait for up to 2.5 milliseconds */ 1050 /* Check if we can shorten the wait time. */
1026 for (i = 0; i < 250000; i++) { 1051 delay_cnt = jiffies_to_usecs(time_remain);
1052 if (delay_cnt > TG3_FW_EVENT_TIMEOUT_USEC)
1053 delay_cnt = TG3_FW_EVENT_TIMEOUT_USEC;
1054 delay_cnt = (delay_cnt >> 3) + 1;
1055
1056 for (i = 0; i < delay_cnt; i++) {
1027 if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT)) 1057 if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT))
1028 break; 1058 break;
1029 udelay(10); 1059 udelay(8);
1030 } 1060 }
1031} 1061}
1032 1062
@@ -1075,9 +1105,7 @@ static void tg3_ump_link_report(struct tg3 *tp)
1075 val = 0; 1105 val = 0;
1076 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val); 1106 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val);
1077 1107
1078 val = tr32(GRC_RX_CPU_EVENT); 1108 tg3_generate_fw_event(tp);
1079 val |= GRC_RX_CPU_DRIVER_EVENT;
1080 tw32_f(GRC_RX_CPU_EVENT, val);
1081} 1109}
1082 1110
1083static void tg3_link_report(struct tg3 *tp) 1111static void tg3_link_report(struct tg3 *tp)
@@ -2124,6 +2152,13 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2124 (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)) 2152 (tp->tg3_flags & TG3_FLAG_WOL_ENABLE))
2125 mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE; 2153 mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE;
2126 2154
2155 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
2156 mac_mode |= tp->mac_mode &
2157 (MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN);
2158 if (mac_mode & MAC_MODE_APE_TX_EN)
2159 mac_mode |= MAC_MODE_TDE_ENABLE;
2160 }
2161
2127 tw32_f(MAC_MODE, mac_mode); 2162 tw32_f(MAC_MODE, mac_mode);
2128 udelay(100); 2163 udelay(100);
2129 2164
@@ -5493,7 +5528,7 @@ static void tg3_ape_send_event(struct tg3 *tp, u32 event)
5493 return; 5528 return;
5494 5529
5495 apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS); 5530 apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS);
5496 if (apedata != APE_FW_STATUS_READY) 5531 if (!(apedata & APE_FW_STATUS_READY))
5497 return; 5532 return;
5498 5533
5499 /* Wait for up to 1 millisecond for APE to service previous event. */ 5534 /* Wait for up to 1 millisecond for APE to service previous event. */
@@ -5760,6 +5795,8 @@ static int tg3_chip_reset(struct tg3 *tp)
5760 5795
5761 tg3_mdio_stop(tp); 5796 tg3_mdio_stop(tp);
5762 5797
5798 tg3_ape_lock(tp, TG3_APE_LOCK_GRC);
5799
5763 /* No matching tg3_nvram_unlock() after this because 5800 /* No matching tg3_nvram_unlock() after this because
5764 * chip reset below will undo the nvram lock. 5801 * chip reset below will undo the nvram lock.
5765 */ 5802 */
@@ -5908,12 +5945,19 @@ static int tg3_chip_reset(struct tg3 *tp)
5908 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 5945 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
5909 tp->mac_mode = MAC_MODE_PORT_MODE_GMII; 5946 tp->mac_mode = MAC_MODE_PORT_MODE_GMII;
5910 tw32_f(MAC_MODE, tp->mac_mode); 5947 tw32_f(MAC_MODE, tp->mac_mode);
5948 } else if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
5949 tp->mac_mode &= (MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN);
5950 if (tp->mac_mode & MAC_MODE_APE_TX_EN)
5951 tp->mac_mode |= MAC_MODE_TDE_ENABLE;
5952 tw32_f(MAC_MODE, tp->mac_mode);
5911 } else 5953 } else
5912 tw32_f(MAC_MODE, 0); 5954 tw32_f(MAC_MODE, 0);
5913 udelay(40); 5955 udelay(40);
5914 5956
5915 tg3_mdio_start(tp); 5957 tg3_mdio_start(tp);
5916 5958
5959 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC);
5960
5917 err = tg3_poll_fw(tp); 5961 err = tg3_poll_fw(tp);
5918 if (err) 5962 if (err)
5919 return err; 5963 return err;
@@ -5935,6 +5979,7 @@ static int tg3_chip_reset(struct tg3 *tp)
5935 tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); 5979 tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg);
5936 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { 5980 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
5937 tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; 5981 tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
5982 tp->last_event_jiffies = jiffies;
5938 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 5983 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
5939 tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; 5984 tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE;
5940 } 5985 }
@@ -5948,15 +5993,12 @@ static void tg3_stop_fw(struct tg3 *tp)
5948{ 5993{
5949 if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && 5994 if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
5950 !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) { 5995 !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) {
5951 u32 val;
5952
5953 /* Wait for RX cpu to ACK the previous event. */ 5996 /* Wait for RX cpu to ACK the previous event. */
5954 tg3_wait_for_event_ack(tp); 5997 tg3_wait_for_event_ack(tp);
5955 5998
5956 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW); 5999 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW);
5957 val = tr32(GRC_RX_CPU_EVENT); 6000
5958 val |= GRC_RX_CPU_DRIVER_EVENT; 6001 tg3_generate_fw_event(tp);
5959 tw32(GRC_RX_CPU_EVENT, val);
5960 6002
5961 /* Wait for RX cpu to ACK this event. */ 6003 /* Wait for RX cpu to ACK this event. */
5962 tg3_wait_for_event_ack(tp); 6004 tg3_wait_for_event_ack(tp);
@@ -7406,7 +7448,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7406 udelay(10); 7448 udelay(10);
7407 } 7449 }
7408 7450
7409 tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | 7451 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)
7452 tp->mac_mode &= MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN;
7453 else
7454 tp->mac_mode = 0;
7455 tp->mac_mode |= MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE |
7410 MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; 7456 MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE;
7411 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && 7457 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) &&
7412 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 7458 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) &&
@@ -7840,9 +7886,8 @@ static void tg3_timer(unsigned long __opaque)
7840 * resets. 7886 * resets.
7841 */ 7887 */
7842 if (!--tp->asf_counter) { 7888 if (!--tp->asf_counter) {
7843 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { 7889 if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
7844 u32 val; 7890 !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) {
7845
7846 tg3_wait_for_event_ack(tp); 7891 tg3_wait_for_event_ack(tp);
7847 7892
7848 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, 7893 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX,
@@ -7850,9 +7895,8 @@ static void tg3_timer(unsigned long __opaque)
7850 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); 7895 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4);
7851 /* 5 seconds timeout */ 7896 /* 5 seconds timeout */
7852 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); 7897 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5);
7853 val = tr32(GRC_RX_CPU_EVENT); 7898
7854 val |= GRC_RX_CPU_DRIVER_EVENT; 7899 tg3_generate_fw_event(tp);
7855 tw32_f(GRC_RX_CPU_EVENT, val);
7856 } 7900 }
7857 tp->asf_counter = tp->asf_multiplier; 7901 tp->asf_counter = tp->asf_multiplier;
7858 } 7902 }
@@ -8422,6 +8466,11 @@ static inline unsigned long get_stat64(tg3_stat64_t *val)
8422 return ret; 8466 return ret;
8423} 8467}
8424 8468
8469static inline u64 get_estat64(tg3_stat64_t *val)
8470{
8471 return ((u64)val->high << 32) | ((u64)val->low);
8472}
8473
8425static unsigned long calc_crc_errors(struct tg3 *tp) 8474static unsigned long calc_crc_errors(struct tg3 *tp)
8426{ 8475{
8427 struct tg3_hw_stats *hw_stats = tp->hw_stats; 8476 struct tg3_hw_stats *hw_stats = tp->hw_stats;
@@ -8450,7 +8499,7 @@ static unsigned long calc_crc_errors(struct tg3 *tp)
8450 8499
8451#define ESTAT_ADD(member) \ 8500#define ESTAT_ADD(member) \
8452 estats->member = old_estats->member + \ 8501 estats->member = old_estats->member + \
8453 get_stat64(&hw_stats->member) 8502 get_estat64(&hw_stats->member)
8454 8503
8455static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) 8504static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
8456{ 8505{
@@ -12416,6 +12465,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12416 tp->misc_host_ctrl); 12465 tp->misc_host_ctrl);
12417 } 12466 }
12418 12467
12468 /* Preserve the APE MAC_MODE bits */
12469 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)
12470 tp->mac_mode = tr32(MAC_MODE) |
12471 MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN;
12472 else
12473 tp->mac_mode = TG3_DEF_MAC_MODE;
12474
12419 /* these are limited to 10/100 only */ 12475 /* these are limited to 10/100 only */
12420 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && 12476 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
12421 (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || 12477 (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) ||
@@ -13275,7 +13331,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13275 tp->pdev = pdev; 13331 tp->pdev = pdev;
13276 tp->dev = dev; 13332 tp->dev = dev;
13277 tp->pm_cap = pm_cap; 13333 tp->pm_cap = pm_cap;
13278 tp->mac_mode = TG3_DEF_MAC_MODE;
13279 tp->rx_mode = TG3_DEF_RX_MODE; 13334 tp->rx_mode = TG3_DEF_RX_MODE;
13280 tp->tx_mode = TG3_DEF_TX_MODE; 13335 tp->tx_mode = TG3_DEF_TX_MODE;
13281 13336
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index df07842172b7..f5b8cab8d4b5 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -325,6 +325,8 @@
325#define MAC_MODE_TDE_ENABLE 0x00200000 325#define MAC_MODE_TDE_ENABLE 0x00200000
326#define MAC_MODE_RDE_ENABLE 0x00400000 326#define MAC_MODE_RDE_ENABLE 0x00400000
327#define MAC_MODE_FHDE_ENABLE 0x00800000 327#define MAC_MODE_FHDE_ENABLE 0x00800000
328#define MAC_MODE_APE_RX_EN 0x08000000
329#define MAC_MODE_APE_TX_EN 0x10000000
328#define MAC_STATUS 0x00000404 330#define MAC_STATUS 0x00000404
329#define MAC_STATUS_PCS_SYNCED 0x00000001 331#define MAC_STATUS_PCS_SYNCED 0x00000001
330#define MAC_STATUS_SIGNAL_DET 0x00000002 332#define MAC_STATUS_SIGNAL_DET 0x00000002
@@ -1889,6 +1891,7 @@
1889#define APE_EVENT_STATUS_EVENT_PENDING 0x80000000 1891#define APE_EVENT_STATUS_EVENT_PENDING 0x80000000
1890 1892
1891/* APE convenience enumerations. */ 1893/* APE convenience enumerations. */
1894#define TG3_APE_LOCK_GRC 1
1892#define TG3_APE_LOCK_MEM 4 1895#define TG3_APE_LOCK_MEM 4
1893 1896
1894#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 1897#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10
@@ -2429,7 +2432,10 @@ struct tg3 {
2429 struct tg3_ethtool_stats estats; 2432 struct tg3_ethtool_stats estats;
2430 struct tg3_ethtool_stats estats_prev; 2433 struct tg3_ethtool_stats estats_prev;
2431 2434
2435 union {
2432 unsigned long phy_crc_errors; 2436 unsigned long phy_crc_errors;
2437 unsigned long last_event_jiffies;
2438 };
2433 2439
2434 u32 rx_offset; 2440 u32 rx_offset;
2435 u32 tg3_flags; 2441 u32 tg3_flags;
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 85246ed7cb9c..ec871f646766 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -360,8 +360,8 @@ TLan_GetSKB( const struct tlan_list_tag *tag)
360{ 360{
361 unsigned long addr; 361 unsigned long addr;
362 362
363 addr = tag->buffer[8].address; 363 addr = tag->buffer[9].address;
364 addr |= (tag->buffer[9].address << 16) << 16; 364 addr |= (tag->buffer[8].address << 16) << 16;
365 return (struct sk_buff *) addr; 365 return (struct sk_buff *) addr;
366} 366}
367 367
@@ -1984,7 +1984,6 @@ static void TLan_ResetLists( struct net_device *dev )
1984 TLanList *list; 1984 TLanList *list;
1985 dma_addr_t list_phys; 1985 dma_addr_t list_phys;
1986 struct sk_buff *skb; 1986 struct sk_buff *skb;
1987 void *t = NULL;
1988 1987
1989 priv->txHead = 0; 1988 priv->txHead = 0;
1990 priv->txTail = 0; 1989 priv->txTail = 0;
@@ -2022,7 +2021,8 @@ static void TLan_ResetLists( struct net_device *dev )
2022 } 2021 }
2023 2022
2024 skb_reserve( skb, NET_IP_ALIGN ); 2023 skb_reserve( skb, NET_IP_ALIGN );
2025 list->buffer[0].address = pci_map_single(priv->pciDev, t, 2024 list->buffer[0].address = pci_map_single(priv->pciDev,
2025 skb->data,
2026 TLAN_MAX_FRAME_SIZE, 2026 TLAN_MAX_FRAME_SIZE,
2027 PCI_DMA_FROMDEVICE); 2027 PCI_DMA_FROMDEVICE);
2028 TLan_StoreSKB(list, skb); 2028 TLan_StoreSKB(list, skb);
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd28097..59d1673f9387 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -119,7 +119,6 @@
119#include <linux/pci.h> 119#include <linux/pci.h>
120#include <linux/dma-mapping.h> 120#include <linux/dma-mapping.h>
121#include <linux/spinlock.h> 121#include <linux/spinlock.h>
122#include <linux/version.h>
123#include <linux/bitops.h> 122#include <linux/bitops.h>
124#include <linux/jiffies.h> 123#include <linux/jiffies.h>
125 124
diff --git a/drivers/net/tokenring/lanstreamer.h b/drivers/net/tokenring/lanstreamer.h
index e7bb3494afc7..13ccee6449c1 100644
--- a/drivers/net/tokenring/lanstreamer.h
+++ b/drivers/net/tokenring/lanstreamer.h
@@ -60,8 +60,6 @@
60 * 60 *
61 */ 61 */
62 62
63#include <linux/version.h>
64
65/* MAX_INTR - the maximum number of times we can loop 63/* MAX_INTR - the maximum number of times we can loop
66 * inside the interrupt function before returning 64 * inside the interrupt function before returning
67 * control to the OS (maximum value is 256) 65 * control to the OS (maximum value is 256)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e6bbc639c2d0..6daea0c91862 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -358,6 +358,66 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
358 return mask; 358 return mask;
359} 359}
360 360
361/* prepad is the amount to reserve at front. len is length after that.
362 * linear is a hint as to how much to copy (usually headers). */
363static struct sk_buff *tun_alloc_skb(size_t prepad, size_t len, size_t linear,
364 gfp_t gfp)
365{
366 struct sk_buff *skb;
367 unsigned int i;
368
369 skb = alloc_skb(prepad + len, gfp|__GFP_NOWARN);
370 if (skb) {
371 skb_reserve(skb, prepad);
372 skb_put(skb, len);
373 return skb;
374 }
375
376 /* Under a page? Don't bother with paged skb. */
377 if (prepad + len < PAGE_SIZE)
378 return NULL;
379
380 /* Start with a normal skb, and add pages. */
381 skb = alloc_skb(prepad + linear, gfp);
382 if (!skb)
383 return NULL;
384
385 skb_reserve(skb, prepad);
386 skb_put(skb, linear);
387
388 len -= linear;
389
390 for (i = 0; i < MAX_SKB_FRAGS; i++) {
391 skb_frag_t *f = &skb_shinfo(skb)->frags[i];
392
393 f->page = alloc_page(gfp|__GFP_ZERO);
394 if (!f->page)
395 break;
396
397 f->page_offset = 0;
398 f->size = PAGE_SIZE;
399
400 skb->data_len += PAGE_SIZE;
401 skb->len += PAGE_SIZE;
402 skb->truesize += PAGE_SIZE;
403 skb_shinfo(skb)->nr_frags++;
404
405 if (len < PAGE_SIZE) {
406 len = 0;
407 break;
408 }
409 len -= PAGE_SIZE;
410 }
411
412 /* Too large, or alloc fail? */
413 if (unlikely(len)) {
414 kfree_skb(skb);
415 skb = NULL;
416 }
417
418 return skb;
419}
420
361/* Get packet from user space buffer */ 421/* Get packet from user space buffer */
362static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count) 422static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count)
363{ 423{
@@ -391,14 +451,12 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
391 return -EINVAL; 451 return -EINVAL;
392 } 452 }
393 453
394 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { 454 if (!(skb = tun_alloc_skb(align, len, gso.hdr_len, GFP_KERNEL))) {
395 tun->dev->stats.rx_dropped++; 455 tun->dev->stats.rx_dropped++;
396 return -ENOMEM; 456 return -ENOMEM;
397 } 457 }
398 458
399 if (align) 459 if (skb_copy_datagram_from_iovec(skb, 0, iv, len)) {
400 skb_reserve(skb, align);
401 if (memcpy_fromiovec(skb_put(skb, len), iv, len)) {
402 tun->dev->stats.rx_dropped++; 460 tun->dev->stats.rx_dropped++;
403 kfree_skb(skb); 461 kfree_skb(skb);
404 return -EFAULT; 462 return -EFAULT;
@@ -748,6 +806,36 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
748 return err; 806 return err;
749} 807}
750 808
809static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr)
810{
811 struct tun_struct *tun = file->private_data;
812
813 if (!tun)
814 return -EBADFD;
815
816 DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name);
817
818 strcpy(ifr->ifr_name, tun->dev->name);
819
820 ifr->ifr_flags = 0;
821
822 if (ifr->ifr_flags & TUN_TUN_DEV)
823 ifr->ifr_flags |= IFF_TUN;
824 else
825 ifr->ifr_flags |= IFF_TAP;
826
827 if (tun->flags & TUN_NO_PI)
828 ifr->ifr_flags |= IFF_NO_PI;
829
830 if (tun->flags & TUN_ONE_QUEUE)
831 ifr->ifr_flags |= IFF_ONE_QUEUE;
832
833 if (tun->flags & TUN_VNET_HDR)
834 ifr->ifr_flags |= IFF_VNET_HDR;
835
836 return 0;
837}
838
751/* This is like a cut-down ethtool ops, except done via tun fd so no 839/* This is like a cut-down ethtool ops, except done via tun fd so no
752 * privs required. */ 840 * privs required. */
753static int set_offload(struct net_device *dev, unsigned long arg) 841static int set_offload(struct net_device *dev, unsigned long arg)
@@ -833,6 +921,15 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
833 DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); 921 DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd);
834 922
835 switch (cmd) { 923 switch (cmd) {
924 case TUNGETIFF:
925 ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr);
926 if (ret)
927 return ret;
928
929 if (copy_to_user(argp, &ifr, sizeof(ifr)))
930 return -EFAULT;
931 break;
932
836 case TUNSETNOCSUM: 933 case TUNSETNOCSUM:
837 /* Disable/Enable checksum */ 934 /* Disable/Enable checksum */
838 if (arg) 935 if (arg)
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 8549f1159a30..734ce0977f02 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -128,7 +128,6 @@ static const int multicast_filter_limit = 32;
128#include <asm/io.h> 128#include <asm/io.h>
129#include <asm/uaccess.h> 129#include <asm/uaccess.h>
130#include <linux/in6.h> 130#include <linux/in6.h>
131#include <linux/version.h>
132#include <linux/dma-mapping.h> 131#include <linux/dma-mapping.h>
133 132
134#include "typhoon.h" 133#include "typhoon.h"
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 68e198bd538b..0973b6e37024 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -154,17 +154,6 @@ config USB_NET_AX8817X
154 This driver creates an interface named "ethX", where X depends on 154 This driver creates an interface named "ethX", where X depends on
155 what other networking devices you have in use. 155 what other networking devices you have in use.
156 156
157config USB_HSO
158 tristate "Option USB High Speed Mobile Devices"
159 depends on USB && RFKILL
160 default n
161 help
162 Choose this option if you have an Option HSDPA/HSUPA card.
163 These cards support downlink speeds of 7.2Mbps or greater.
164
165 To compile this driver as a module, choose M here: the
166 module will be called hso.
167
168config USB_NET_CDCETHER 157config USB_NET_CDCETHER
169 tristate "CDC Ethernet support (smart devices such as cable modems)" 158 tristate "CDC Ethernet support (smart devices such as cable modems)"
170 depends on USB_USBNET 159 depends on USB_USBNET
@@ -337,5 +326,15 @@ config USB_NET_ZAURUS
337 really need this non-conformant variant of CDC Ethernet (or in 326 really need this non-conformant variant of CDC Ethernet (or in
338 some cases CDC MDLM) protocol, not "g_ether". 327 some cases CDC MDLM) protocol, not "g_ether".
339 328
329config USB_HSO
330 tristate "Option USB High Speed Mobile Devices"
331 depends on USB && RFKILL
332 default n
333 help
334 Choose this option if you have an Option HSDPA/HSUPA card.
335 These cards support downlink speeds of 7.2Mbps or greater.
336
337 To compile this driver as a module, choose M here: the
338 module will be called hso.
340 339
341endmenu 340endmenu
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 031d07b105af..1b7cac77159e 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -102,8 +102,12 @@
102 102
103#define MAX_RX_URBS 2 103#define MAX_RX_URBS 2
104 104
105#define get_serial_by_tty(x) \ 105static inline struct hso_serial *get_serial_by_tty(struct tty_struct *tty)
106 (x ? (struct hso_serial *)x->driver_data : NULL) 106{
107 if (tty)
108 return tty->driver_data;
109 return NULL;
110}
107 111
108/*****************************************************************************/ 112/*****************************************************************************/
109/* Debugging functions */ 113/* Debugging functions */
@@ -294,24 +298,25 @@ static int hso_get_activity(struct hso_device *hso_dev);
294 298
295/* #define DEBUG */ 299/* #define DEBUG */
296 300
297#define dev2net(x) (x->port_data.dev_net) 301static inline struct hso_net *dev2net(struct hso_device *hso_dev)
298#define dev2ser(x) (x->port_data.dev_serial) 302{
303 return hso_dev->port_data.dev_net;
304}
305
306static inline struct hso_serial *dev2ser(struct hso_device *hso_dev)
307{
308 return hso_dev->port_data.dev_serial;
309}
299 310
300/* Debugging functions */ 311/* Debugging functions */
301#ifdef DEBUG 312#ifdef DEBUG
302static void dbg_dump(int line_count, const char *func_name, unsigned char *buf, 313static void dbg_dump(int line_count, const char *func_name, unsigned char *buf,
303 unsigned int len) 314 unsigned int len)
304{ 315{
305 u8 i = 0; 316 static char name[255];
306 317
307 printk(KERN_DEBUG "[%d:%s]: len %d", line_count, func_name, len); 318 sprintf(name, "hso[%d:%s]", line_count, func_name);
308 319 print_hex_dump_bytes(name, DUMP_PREFIX_NONE, buf, len);
309 for (i = 0; i < len; i++) {
310 if (!(i % 16))
311 printk("\n 0x%03x: ", i);
312 printk("%02x ", (unsigned char)buf[i]);
313 }
314 printk("\n");
315} 320}
316 321
317#define DUMP(buf_, len_) \ 322#define DUMP(buf_, len_) \
@@ -528,13 +533,12 @@ static struct hso_serial *get_serial_by_shared_int_and_type(
528 533
529static struct hso_serial *get_serial_by_index(unsigned index) 534static struct hso_serial *get_serial_by_index(unsigned index)
530{ 535{
531 struct hso_serial *serial; 536 struct hso_serial *serial = NULL;
532 unsigned long flags; 537 unsigned long flags;
533 538
534 if (!serial_table[index])
535 return NULL;
536 spin_lock_irqsave(&serial_table_lock, flags); 539 spin_lock_irqsave(&serial_table_lock, flags);
537 serial = dev2ser(serial_table[index]); 540 if (serial_table[index])
541 serial = dev2ser(serial_table[index]);
538 spin_unlock_irqrestore(&serial_table_lock, flags); 542 spin_unlock_irqrestore(&serial_table_lock, flags);
539 543
540 return serial; 544 return serial;
@@ -561,6 +565,7 @@ static int get_free_serial_index(void)
561static void set_serial_by_index(unsigned index, struct hso_serial *serial) 565static void set_serial_by_index(unsigned index, struct hso_serial *serial)
562{ 566{
563 unsigned long flags; 567 unsigned long flags;
568
564 spin_lock_irqsave(&serial_table_lock, flags); 569 spin_lock_irqsave(&serial_table_lock, flags);
565 if (serial) 570 if (serial)
566 serial_table[index] = serial->parent; 571 serial_table[index] = serial->parent;
@@ -569,7 +574,7 @@ static void set_serial_by_index(unsigned index, struct hso_serial *serial)
569 spin_unlock_irqrestore(&serial_table_lock, flags); 574 spin_unlock_irqrestore(&serial_table_lock, flags);
570} 575}
571 576
572/* log a meaningfull explanation of an USB status */ 577/* log a meaningful explanation of an USB status */
573static void log_usb_status(int status, const char *function) 578static void log_usb_status(int status, const char *function)
574{ 579{
575 char *explanation; 580 char *explanation;
@@ -1103,8 +1108,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1103 /* reset the rts and dtr */ 1108 /* reset the rts and dtr */
1104 /* do the actual close */ 1109 /* do the actual close */
1105 serial->open_count--; 1110 serial->open_count--;
1111 kref_put(&serial->parent->ref, hso_serial_ref_free);
1106 if (serial->open_count <= 0) { 1112 if (serial->open_count <= 0) {
1107 kref_put(&serial->parent->ref, hso_serial_ref_free);
1108 serial->open_count = 0; 1113 serial->open_count = 0;
1109 if (serial->tty) { 1114 if (serial->tty) {
1110 serial->tty->driver_data = NULL; 1115 serial->tty->driver_data = NULL;
@@ -1467,7 +1472,8 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
1467 return; 1472 return;
1468 } 1473 }
1469 hso_put_activity(serial->parent); 1474 hso_put_activity(serial->parent);
1470 tty_wakeup(serial->tty); 1475 if (serial->tty)
1476 tty_wakeup(serial->tty);
1471 hso_kick_transmit(serial); 1477 hso_kick_transmit(serial);
1472 1478
1473 D1(" "); 1479 D1(" ");
@@ -1538,7 +1544,8 @@ static void ctrl_callback(struct urb *urb)
1538 clear_bit(HSO_SERIAL_FLAG_RX_SENT, &serial->flags); 1544 clear_bit(HSO_SERIAL_FLAG_RX_SENT, &serial->flags);
1539 } else { 1545 } else {
1540 hso_put_activity(serial->parent); 1546 hso_put_activity(serial->parent);
1541 tty_wakeup(serial->tty); 1547 if (serial->tty)
1548 tty_wakeup(serial->tty);
1542 /* response to a write command */ 1549 /* response to a write command */
1543 hso_kick_transmit(serial); 1550 hso_kick_transmit(serial);
1544 } 1551 }
@@ -2652,7 +2659,7 @@ static void hso_free_interface(struct usb_interface *interface)
2652 hso_stop_net_device(network_table[i]); 2659 hso_stop_net_device(network_table[i]);
2653 cancel_work_sync(&network_table[i]->async_put_intf); 2660 cancel_work_sync(&network_table[i]->async_put_intf);
2654 cancel_work_sync(&network_table[i]->async_get_intf); 2661 cancel_work_sync(&network_table[i]->async_get_intf);
2655 if(rfk) 2662 if (rfk)
2656 rfkill_unregister(rfk); 2663 rfkill_unregister(rfk);
2657 hso_free_net_device(network_table[i]); 2664 hso_free_net_device(network_table[i]);
2658 } 2665 }
@@ -2723,7 +2730,7 @@ static int hso_mux_submit_intr_urb(struct hso_shared_int *shared_int,
2723} 2730}
2724 2731
2725/* operations setup of the serial interface */ 2732/* operations setup of the serial interface */
2726static struct tty_operations hso_serial_ops = { 2733static const struct tty_operations hso_serial_ops = {
2727 .open = hso_serial_open, 2734 .open = hso_serial_open,
2728 .close = hso_serial_close, 2735 .close = hso_serial_close,
2729 .write = hso_serial_write, 2736 .write = hso_serial_write,
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 2028866f5995..b20a45aa8680 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -40,7 +40,6 @@
40 * 40 *
41 */ 41 */
42 42
43#include <linux/version.h>
44#include <linux/module.h> 43#include <linux/module.h>
45#include <linux/delay.h> 44#include <linux/delay.h>
46#include <linux/hardirq.h> 45#include <linux/hardirq.h>
@@ -587,7 +586,6 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
587 ath5k_stop_hw(sc); 586 ath5k_stop_hw(sc);
588 587
589 free_irq(pdev->irq, sc); 588 free_irq(pdev->irq, sc);
590 pci_disable_msi(pdev);
591 pci_save_state(pdev); 589 pci_save_state(pdev);
592 pci_disable_device(pdev); 590 pci_disable_device(pdev);
593 pci_set_power_state(pdev, PCI_D3hot); 591 pci_set_power_state(pdev, PCI_D3hot);
@@ -616,12 +614,10 @@ ath5k_pci_resume(struct pci_dev *pdev)
616 */ 614 */
617 pci_write_config_byte(pdev, 0x41, 0); 615 pci_write_config_byte(pdev, 0x41, 0);
618 616
619 pci_enable_msi(pdev);
620
621 err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc); 617 err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
622 if (err) { 618 if (err) {
623 ATH5K_ERR(sc, "request_irq failed\n"); 619 ATH5K_ERR(sc, "request_irq failed\n");
624 goto err_msi; 620 goto err_no_irq;
625 } 621 }
626 622
627 err = ath5k_init(sc); 623 err = ath5k_init(sc);
@@ -642,8 +638,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
642 return 0; 638 return 0;
643err_irq: 639err_irq:
644 free_irq(pdev->irq, sc); 640 free_irq(pdev->irq, sc);
645err_msi: 641err_no_irq:
646 pci_disable_msi(pdev);
647 pci_disable_device(pdev); 642 pci_disable_device(pdev);
648 return err; 643 return err;
649} 644}
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index bde162f128ab..a17eb130f574 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -5017,7 +5017,11 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah,
5017 5017
5018 for (i = 0; i < 123; i++) { 5018 for (i = 0; i < 123; i++) {
5019 if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { 5019 if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
5020 if ((abs(cur_vit_mask - bin)) < 75) 5020
5021 /* workaround for gcc bug #37014 */
5022 volatile int tmp = abs(cur_vit_mask - bin);
5023
5024 if (tmp < 75)
5021 mask_amt = 1; 5025 mask_amt = 1;
5022 else 5026 else
5023 mask_amt = 0; 5027 mask_amt = 0;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 3bf3a869361f..7205a936ec74 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -33,7 +33,6 @@
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/if_arp.h> 34#include <linux/if_arp.h>
35#include <linux/etherdevice.h> 35#include <linux/etherdevice.h>
36#include <linux/version.h>
37#include <linux/firmware.h> 36#include <linux/firmware.h>
38#include <linux/wireless.h> 37#include <linux/wireless.h>
39#include <linux/workqueue.h> 38#include <linux/workqueue.h>
@@ -4615,7 +4614,9 @@ static void b43_sprom_fixup(struct ssb_bus *bus)
4615 if (bus->bustype == SSB_BUSTYPE_PCI) { 4614 if (bus->bustype == SSB_BUSTYPE_PCI) {
4616 pdev = bus->host_pci; 4615 pdev = bus->host_pci;
4617 if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) || 4616 if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) ||
4617 IS_PDEV(pdev, BROADCOM, 0x4320, DELL, 0x0003) ||
4618 IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) || 4618 IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) ||
4619 IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0014) ||
4619 IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013)) 4620 IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013))
4620 bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST; 4621 bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST;
4621 } 4622 }
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 2541c81932f0..1cb77db5c292 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -34,7 +34,6 @@
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/if_arp.h> 35#include <linux/if_arp.h>
36#include <linux/etherdevice.h> 36#include <linux/etherdevice.h>
37#include <linux/version.h>
38#include <linux/firmware.h> 37#include <linux/firmware.h>
39#include <linux/wireless.h> 38#include <linux/wireless.h>
40#include <linux/workqueue.h> 39#include <linux/workqueue.h>
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index c6f886ec08a3..19a401c4a0dc 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -157,7 +157,6 @@ that only one external action is invoked at a time.
157#include <linux/stringify.h> 157#include <linux/stringify.h>
158#include <linux/tcp.h> 158#include <linux/tcp.h>
159#include <linux/types.h> 159#include <linux/types.h>
160#include <linux/version.h>
161#include <linux/time.h> 160#include <linux/time.h>
162#include <linux/firmware.h> 161#include <linux/firmware.h>
163#include <linux/acpi.h> 162#include <linux/acpi.h>
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 36e8d2f6e7b4..dcce3542d5a7 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -31,7 +31,6 @@
31******************************************************************************/ 31******************************************************************************/
32 32
33#include "ipw2200.h" 33#include "ipw2200.h"
34#include <linux/version.h>
35 34
36 35
37#ifndef KBUILD_EXTMOD 36#ifndef KBUILD_EXTMOD
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index d3336966b6b5..705c65bed9fd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -27,7 +27,6 @@
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/version.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/pci.h> 31#include <linux/pci.h>
33#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index b3931f6135a4..3f51f3635344 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/version.h>
30#include <linux/init.h> 29#include <linux/init.h>
31#include <linux/pci.h> 30#include <linux/pci.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 22bb26985c2e..e2581229d8b2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/version.h>
30#include <linux/init.h> 29#include <linux/init.h>
31#include <linux/pci.h> 30#include <linux/pci.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
@@ -967,7 +966,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
967 966
968 s = iwl4965_get_sub_band(priv, channel); 967 s = iwl4965_get_sub_band(priv, channel);
969 if (s >= EEPROM_TX_POWER_BANDS) { 968 if (s >= EEPROM_TX_POWER_BANDS) {
970 IWL_ERROR("Tx Power can not find channel %d ", channel); 969 IWL_ERROR("Tx Power can not find channel %d\n", channel);
971 return -1; 970 return -1;
972 } 971 }
973 972
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index f3d139b663e6..cbc01a00eaf4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/version.h>
29#include <linux/init.h> 28#include <linux/init.h>
30#include <linux/pci.h> 29#include <linux/pci.h>
31#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ed09e48b1b61..061ffba9c884 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/version.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/pci.h> 33#include <linux/pci.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 9bd61809129f..c72f72579bea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -28,7 +28,6 @@
28 28
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/version.h>
32#include <net/mac80211.h> 31#include <net/mac80211.h>
33 32
34struct iwl_priv; /* FIXME: remove */ 33struct iwl_priv; /* FIXME: remove */
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index bce53830b301..37155755efc5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -63,7 +63,6 @@
63 63
64#include <linux/kernel.h> 64#include <linux/kernel.h>
65#include <linux/module.h> 65#include <linux/module.h>
66#include <linux/version.h>
67#include <linux/init.h> 66#include <linux/init.h>
68 67
69#include <net/mac80211.h> 68#include <net/mac80211.h>
@@ -146,7 +145,7 @@ int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
146{ 145{
147 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 146 u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
148 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { 147 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
149 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); 148 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
150 return -ENOENT; 149 return -ENOENT;
151 } 150 }
152 return 0; 151 return 0;
@@ -227,7 +226,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
227 226
228 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); 227 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
229 if (ret < 0) { 228 if (ret < 0) {
230 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); 229 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
231 ret = -ENOENT; 230 ret = -ENOENT;
232 goto err; 231 goto err;
233 } 232 }
@@ -254,7 +253,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
254 } 253 }
255 254
256 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { 255 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) {
257 IWL_ERROR("Time out reading EEPROM[%d]", addr); 256 IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
258 ret = -ETIMEDOUT; 257 ret = -ETIMEDOUT;
259 goto done; 258 goto done;
260 } 259 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index 6512834bb916..2eb03eea1908 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -28,7 +28,6 @@
28 28
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/version.h>
32#include <net/mac80211.h> 31#include <net/mac80211.h>
33 32
34#include "iwl-dev.h" /* FIXME: remove */ 33#include "iwl-dev.h" /* FIXME: remove */
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index cb11c4a4d691..4eee1b163cd2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -27,7 +27,6 @@
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/version.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/pci.h> 31#include <linux/pci.h>
33#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 028e3053c0ca..a099c9e30e55 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/version.h>
33#include <linux/init.h> 32#include <linux/init.h>
34 33
35#include <net/mac80211.h> 34#include <net/mac80211.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
index e5e5846e9f25..5d642298f04c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
@@ -27,7 +27,6 @@
27 *****************************************************************************/ 27 *****************************************************************************/
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/version.h>
31#include <linux/init.h> 30#include <linux/init.h>
32 31
33#include <net/mac80211.h> 32#include <net/mac80211.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 60a6e0106036..6283a3a707f5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -207,7 +207,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
207 case WLAN_HT_CAP_MIMO_PS_DISABLED: 207 case WLAN_HT_CAP_MIMO_PS_DISABLED:
208 break; 208 break;
209 default: 209 default:
210 IWL_WARNING("Invalid MIMO PS mode %d", mimo_ps_mode); 210 IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode);
211 break; 211 break;
212 } 212 }
213 213
@@ -969,7 +969,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
969 return priv->hw_params.bcast_sta_id; 969 return priv->hw_params.bcast_sta_id;
970 970
971 default: 971 default:
972 IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); 972 IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
973 return priv->hw_params.bcast_sta_id; 973 return priv->hw_params.bcast_sta_id;
974 } 974 }
975} 975}
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 4108c7c8f00f..d82823b5c8ab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -493,7 +493,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv)
493 /* Alloc keep-warm buffer */ 493 /* Alloc keep-warm buffer */
494 ret = iwl_kw_alloc(priv); 494 ret = iwl_kw_alloc(priv);
495 if (ret) { 495 if (ret) {
496 IWL_ERROR("Keep Warm allocation failed"); 496 IWL_ERROR("Keep Warm allocation failed\n");
497 goto error_kw; 497 goto error_kw;
498 } 498 }
499 spin_lock_irqsave(&priv->lock, flags); 499 spin_lock_irqsave(&priv->lock, flags);
@@ -1463,7 +1463,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
1463 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 1463 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
1464 1464
1465 if (scd_flow >= priv->hw_params.max_txq_num) { 1465 if (scd_flow >= priv->hw_params.max_txq_num) {
1466 IWL_ERROR("BUG_ON scd_flow is bigger than number of queues"); 1466 IWL_ERROR("BUG_ON scd_flow is bigger than number of queues\n");
1467 return; 1467 return;
1468 } 1468 }
1469 1469
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 444847ab1b5a..b775d5bab668 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/version.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/pci.h> 33#include <linux/pci.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
@@ -1558,7 +1557,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1558 BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE); 1557 BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE);
1559 1558
1560 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { 1559 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
1561 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); 1560 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
1562 return -ENOENT; 1561 return -ENOENT;
1563 } 1562 }
1564 1563
@@ -1583,7 +1582,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1583 } 1582 }
1584 1583
1585 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { 1584 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) {
1586 IWL_ERROR("Time out reading EEPROM[%d]", addr); 1585 IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
1587 return -ETIMEDOUT; 1586 return -ETIMEDOUT;
1588 } 1587 }
1589 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); 1588 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
@@ -2507,7 +2506,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2507 return priv->hw_setting.bcast_sta_id; 2506 return priv->hw_setting.bcast_sta_id;
2508 2507
2509 default: 2508 default:
2510 IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); 2509 IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
2511 return priv->hw_setting.bcast_sta_id; 2510 return priv->hw_setting.bcast_sta_id;
2512 } 2511 }
2513} 2512}
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 83cd85e1f847..29be3dc8ee09 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -413,12 +413,12 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
413 last_addr = range->end_addr; 413 last_addr = range->end_addr;
414 __skb_unlink(entry, &priv->tx_queue); 414 __skb_unlink(entry, &priv->tx_queue);
415 memset(&info->status, 0, sizeof(info->status)); 415 memset(&info->status, 0, sizeof(info->status));
416 priv->tx_stats[skb_get_queue_mapping(skb)].len--;
417 entry_hdr = (struct p54_control_hdr *) entry->data; 416 entry_hdr = (struct p54_control_hdr *) entry->data;
418 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 417 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
419 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 418 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
420 pad = entry_data->align[0]; 419 pad = entry_data->align[0];
421 420
421 priv->tx_stats[entry_data->hw_queue - 4].len--;
422 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 422 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
423 if (!(payload->status & 0x01)) 423 if (!(payload->status & 0x01))
424 info->flags |= IEEE80211_TX_STAT_ACK; 424 info->flags |= IEEE80211_TX_STAT_ACK;
@@ -557,6 +557,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
557 struct p54_tx_control_allocdata *txhdr; 557 struct p54_tx_control_allocdata *txhdr;
558 size_t padding, len; 558 size_t padding, len;
559 u8 rate; 559 u8 rate;
560 u8 cts_rate = 0x20;
560 561
561 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)]; 562 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)];
562 if (unlikely(current_queue->len > current_queue->limit)) 563 if (unlikely(current_queue->len > current_queue->limit))
@@ -581,28 +582,28 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
581 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); 582 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1);
582 hdr->retry1 = hdr->retry2 = info->control.retry_limit; 583 hdr->retry1 = hdr->retry2 = info->control.retry_limit;
583 584
584 memset(txhdr->wep_key, 0x0, 16);
585 txhdr->padding = 0;
586 txhdr->padding2 = 0;
587
588 /* TODO: add support for alternate retry TX rates */ 585 /* TODO: add support for alternate retry TX rates */
589 rate = ieee80211_get_tx_rate(dev, info)->hw_value; 586 rate = ieee80211_get_tx_rate(dev, info)->hw_value;
590 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) 587 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) {
591 rate |= 0x10; 588 rate |= 0x10;
592 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 589 cts_rate |= 0x10;
590 }
591 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
593 rate |= 0x40; 592 rate |= 0x40;
594 else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 593 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
594 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
595 rate |= 0x20; 595 rate |= 0x20;
596 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
597 }
596 memset(txhdr->rateset, rate, 8); 598 memset(txhdr->rateset, rate, 8);
597 txhdr->wep_key_present = 0; 599 txhdr->key_type = 0;
598 txhdr->wep_key_len = 0; 600 txhdr->key_len = 0;
599 txhdr->frame_type = cpu_to_le32(skb_get_queue_mapping(skb) + 4); 601 txhdr->hw_queue = skb_get_queue_mapping(skb) + 4;
600 txhdr->magic4 = 0; 602 txhdr->tx_antenna = (info->antenna_sel_tx == 0) ?
601 txhdr->antenna = (info->antenna_sel_tx == 0) ?
602 2 : info->antenna_sel_tx - 1; 603 2 : info->antenna_sel_tx - 1;
603 txhdr->output_power = 0x7f; // HW Maximum 604 txhdr->output_power = 0x7f; // HW Maximum
604 txhdr->magic5 = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 605 txhdr->cts_rate = (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
605 0 : ((rate > 0x3) ? cpu_to_le32(0x33) : cpu_to_le32(0x23)); 606 0 : cts_rate;
606 if (padding) 607 if (padding)
607 txhdr->align[0] = padding; 608 txhdr->align[0] = padding;
608 609
@@ -836,10 +837,21 @@ static int p54_start(struct ieee80211_hw *dev)
836 struct p54_common *priv = dev->priv; 837 struct p54_common *priv = dev->priv;
837 int err; 838 int err;
838 839
840 if (!priv->cached_vdcf) {
841 priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf)+
842 priv->tx_hdr_len + sizeof(struct p54_control_hdr),
843 GFP_KERNEL);
844
845 if (!priv->cached_vdcf)
846 return -ENOMEM;
847 }
848
839 err = priv->open(dev); 849 err = priv->open(dev);
840 if (!err) 850 if (!err)
841 priv->mode = IEEE80211_IF_TYPE_MNTR; 851 priv->mode = IEEE80211_IF_TYPE_MNTR;
842 852
853 p54_init_vdcf(dev);
854
843 return err; 855 return err;
844} 856}
845 857
@@ -1019,15 +1031,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
1019 dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 + 1031 dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 +
1020 sizeof(struct p54_tx_control_allocdata); 1032 sizeof(struct p54_tx_control_allocdata);
1021 1033
1022 priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf) +
1023 priv->tx_hdr_len + sizeof(struct p54_control_hdr), GFP_KERNEL);
1024
1025 if (!priv->cached_vdcf) {
1026 ieee80211_free_hw(dev);
1027 return NULL;
1028 }
1029
1030 p54_init_vdcf(dev);
1031 mutex_init(&priv->conf_mutex); 1034 mutex_init(&priv->conf_mutex);
1032 1035
1033 return dev; 1036 return dev;
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index 2245fcce92dc..8db6c0e8e540 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -183,16 +183,16 @@ struct p54_frame_sent_hdr {
183 183
184struct p54_tx_control_allocdata { 184struct p54_tx_control_allocdata {
185 u8 rateset[8]; 185 u8 rateset[8];
186 u16 padding; 186 u8 unalloc0[2];
187 u8 wep_key_present; 187 u8 key_type;
188 u8 wep_key_len; 188 u8 key_len;
189 u8 wep_key[16]; 189 u8 key[16];
190 __le32 frame_type; 190 u8 hw_queue;
191 u32 padding2; 191 u8 unalloc1[9];
192 __le16 magic4; 192 u8 tx_antenna;
193 u8 antenna;
194 u8 output_power; 193 u8 output_power;
195 __le32 magic5; 194 u8 cts_rate;
195 u8 unalloc2[3];
196 u8 align[0]; 196 u8 align[0];
197} __attribute__ ((packed)); 197} __attribute__ ((packed));
198 198
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 815c095ef797..cbaca23a9453 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -109,7 +109,17 @@ static void p54u_rx_cb(struct urb *urb)
109 urb->context = skb; 109 urb->context = skb;
110 skb_queue_tail(&priv->rx_queue, skb); 110 skb_queue_tail(&priv->rx_queue, skb);
111 } else { 111 } else {
112 if (!priv->hw_type)
113 skb_push(skb, sizeof(struct net2280_tx_hdr));
114
115 skb_reset_tail_pointer(skb);
112 skb_trim(skb, 0); 116 skb_trim(skb, 0);
117 if (urb->transfer_buffer != skb_tail_pointer(skb)) {
118 /* this should not happen */
119 WARN_ON(1);
120 urb->transfer_buffer = skb_tail_pointer(skb);
121 }
122
113 skb_queue_tail(&priv->rx_queue, skb); 123 skb_queue_tail(&priv->rx_queue, skb);
114 } 124 }
115 125
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index a4a8c57004db..ff78e52ce43c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -173,10 +173,10 @@ struct rxdone_entry_desc {
173 * frame transmission failed due to excessive retries. 173 * frame transmission failed due to excessive retries.
174 */ 174 */
175enum txdone_entry_desc_flags { 175enum txdone_entry_desc_flags {
176 TXDONE_UNKNOWN = 1 << 0, 176 TXDONE_UNKNOWN,
177 TXDONE_SUCCESS = 1 << 1, 177 TXDONE_SUCCESS,
178 TXDONE_FAILURE = 1 << 2, 178 TXDONE_FAILURE,
179 TXDONE_EXCESSIVE_RETRY = 1 << 3, 179 TXDONE_EXCESSIVE_RETRY,
180}; 180};
181 181
182/** 182/**
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 8d76bb2e0312..2050227ea530 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -181,6 +181,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
181 * (Only indirectly by looking at the failed TX counters 181 * (Only indirectly by looking at the failed TX counters
182 * in the register). 182 * in the register).
183 */ 183 */
184 txdesc.flags = 0;
184 if (!urb->status) 185 if (!urb->status)
185 __set_bit(TXDONE_UNKNOWN, &txdesc.flags); 186 __set_bit(TXDONE_UNKNOWN, &txdesc.flags);
186 else 187 else
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 57376fb993ed..ca5deb6244e6 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -40,6 +40,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
40 /* Netgear */ 40 /* Netgear */
41 {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, 41 {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
42 {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, 42 {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
43 {USB_DEVICE(0x0846, 0x4260), .driver_info = DEVICE_RTL8187B},
43 /* HP */ 44 /* HP */
44 {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187}, 45 {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187},
45 /* Sitecom */ 46 /* Sitecom */
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 8a1d93a2bb81..51e5214071da 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -57,6 +57,15 @@ static ssize_t devspec_show(struct device *dev,
57 return sprintf(buf, "%s\n", ofdev->node->full_name); 57 return sprintf(buf, "%s\n", ofdev->node->full_name);
58} 58}
59 59
60static ssize_t name_show(struct device *dev,
61 struct device_attribute *attr, char *buf)
62{
63 struct of_device *ofdev;
64
65 ofdev = to_of_device(dev);
66 return sprintf(buf, "%s\n", ofdev->node->name);
67}
68
60static ssize_t modalias_show(struct device *dev, 69static ssize_t modalias_show(struct device *dev,
61 struct device_attribute *attr, char *buf) 70 struct device_attribute *attr, char *buf)
62{ 71{
@@ -71,6 +80,7 @@ static ssize_t modalias_show(struct device *dev,
71 80
72struct device_attribute of_platform_device_attrs[] = { 81struct device_attribute of_platform_device_attrs[] = {
73 __ATTR_RO(devspec), 82 __ATTR_RO(devspec),
83 __ATTR_RO(name),
74 __ATTR_RO(modalias), 84 __ATTR_RO(modalias),
75 __ATTR_NULL 85 __ATTR_NULL
76}; 86};
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 93e37f0666ab..e17ef54f0efc 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware);
382int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) 382int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
383{ 383{
384 acpi_status status; 384 acpi_status status;
385 acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); 385 acpi_handle chandle, handle;
386 struct pci_dev *pdev = dev; 386 struct pci_dev *pdev = dev;
387 struct pci_bus *parent; 387 struct pci_bus *parent;
388 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; 388 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -399,10 +399,25 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
399 * Per PCI firmware specification, we should run the ACPI _OSC 399 * Per PCI firmware specification, we should run the ACPI _OSC
400 * method to get control of hotplug hardware before using it. If 400 * method to get control of hotplug hardware before using it. If
401 * an _OSC is missing, we look for an OSHP to do the same thing. 401 * an _OSC is missing, we look for an OSHP to do the same thing.
402 * To handle different BIOS behavior, we look for _OSC and OSHP 402 * To handle different BIOS behavior, we look for _OSC on a root
403 * within the scope of the hotplug controller and its parents, 403 * bridge preferentially (according to PCI fw spec). Later for
404 * OSHP within the scope of the hotplug controller and its parents,
404 * upto the host bridge under which this controller exists. 405 * upto the host bridge under which this controller exists.
405 */ 406 */
407 handle = acpi_find_root_bridge_handle(pdev);
408 if (handle) {
409 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
410 dbg("Trying to get hotplug control for %s\n",
411 (char *)string.pointer);
412 status = pci_osc_control_set(handle, flags);
413 if (ACPI_SUCCESS(status))
414 goto got_one;
415 kfree(string.pointer);
416 string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL };
417 }
418
419 pdev = dev;
420 handle = DEVICE_ACPI_HANDLE(&dev->dev);
406 while (!handle) { 421 while (!handle) {
407 /* 422 /*
408 * This hotplug controller was not listed in the ACPI name 423 * This hotplug controller was not listed in the ACPI name
@@ -427,15 +442,9 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
427 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 442 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
428 dbg("Trying to get hotplug control for %s \n", 443 dbg("Trying to get hotplug control for %s \n",
429 (char *)string.pointer); 444 (char *)string.pointer);
430 status = pci_osc_control_set(handle, flags); 445 status = acpi_run_oshp(handle);
431 if (status == AE_NOT_FOUND) 446 if (ACPI_SUCCESS(status))
432 status = acpi_run_oshp(handle); 447 goto got_one;
433 if (ACPI_SUCCESS(status)) {
434 dbg("Gained control for hotplug HW for pci %s (%s)\n",
435 pci_name(dev), (char *)string.pointer);
436 kfree(string.pointer);
437 return 0;
438 }
439 if (acpi_root_bridge(handle)) 448 if (acpi_root_bridge(handle))
440 break; 449 break;
441 chandle = handle; 450 chandle = handle;
@@ -449,6 +458,11 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
449 458
450 kfree(string.pointer); 459 kfree(string.pointer);
451 return -ENODEV; 460 return -ENODEV;
461got_one:
462 dbg("Gained control for hotplug HW for pci %s (%s)\n", pci_name(dev),
463 (char *)string.pointer);
464 kfree(string.pointer);
465 return 0;
452} 466}
453EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); 467EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware);
454 468
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index 30f581b8791f..6dd7b13e9808 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -36,12 +36,7 @@ int aer_osc_setup(struct pcie_device *pciedev)
36 if (acpi_pci_disabled) 36 if (acpi_pci_disabled)
37 return -1; 37 return -1;
38 38
39 /* Find root host bridge */ 39 handle = acpi_find_root_bridge_handle(pdev);
40 while (pdev->bus->self)
41 pdev = pdev->bus->self;
42 handle = acpi_get_pci_rootbridge_handle(
43 pci_domain_nr(pdev->bus), pdev->bus->number);
44
45 if (handle) { 40 if (handle) {
46 pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); 41 pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
47 status = pci_osc_control_set(handle, 42 status = pci_osc_control_set(handle,
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a04498d390c8..cce2f4cb1fbf 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -383,6 +383,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
383 res->start = base; 383 res->start = base;
384 if (!res->end) 384 if (!res->end)
385 res->end = limit + 0xfff; 385 res->end = limit + 0xfff;
386 printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
386 } 387 }
387 388
388 res = child->resource[1]; 389 res = child->resource[1];
@@ -394,6 +395,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
394 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 395 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
395 res->start = base; 396 res->start = base;
396 res->end = limit + 0xfffff; 397 res->end = limit + 0xfffff;
398 printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
397 } 399 }
398 400
399 res = child->resource[2]; 401 res = child->resource[2];
@@ -429,6 +431,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
429 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; 431 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
430 res->start = base; 432 res->start = base;
431 res->end = limit + 0xfffff; 433 res->end = limit + 0xfffff;
434 printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
432 } 435 }
433} 436}
434 437
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 827c0a520e2b..82634a2f1b1d 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -530,6 +530,36 @@ void __ref pci_bus_assign_resources(struct pci_bus *bus)
530} 530}
531EXPORT_SYMBOL(pci_bus_assign_resources); 531EXPORT_SYMBOL(pci_bus_assign_resources);
532 532
533static void pci_bus_dump_res(struct pci_bus *bus)
534{
535 int i;
536
537 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
538 struct resource *res = bus->resource[i];
539 if (!res)
540 continue;
541
542 printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
543 }
544}
545
546static void pci_bus_dump_resources(struct pci_bus *bus)
547{
548 struct pci_bus *b;
549 struct pci_dev *dev;
550
551
552 pci_bus_dump_res(bus);
553
554 list_for_each_entry(dev, &bus->devices, bus_list) {
555 b = dev->subordinate;
556 if (!b)
557 continue;
558
559 pci_bus_dump_resources(b);
560 }
561}
562
533void __init 563void __init
534pci_assign_unassigned_resources(void) 564pci_assign_unassigned_resources(void)
535{ 565{
@@ -545,4 +575,9 @@ pci_assign_unassigned_resources(void)
545 pci_bus_assign_resources(bus); 575 pci_bus_assign_resources(bus);
546 pci_enable_bridges(bus); 576 pci_enable_bridges(bus);
547 } 577 }
578
579 /* dump the resource on buses */
580 list_for_each_entry(bus, &pci_root_buses, node) {
581 pci_bus_dump_resources(bus);
582 }
548} 583}
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 90ab73825401..9a9755c92fad 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR
561 561
562config RTC_DRV_BFIN 562config RTC_DRV_BFIN
563 tristate "Blackfin On-Chip RTC" 563 tristate "Blackfin On-Chip RTC"
564 depends on BLACKFIN 564 depends on BLACKFIN && !BF561
565 help 565 help
566 If you say yes here you will get support for the 566 If you say yes here you will get support for the
567 Blackfin On-Chip Real Time Clock. 567 Blackfin On-Chip Real Time Clock.
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index a1af4c27939b..34439ce3967e 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -218,26 +218,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
218 return IRQ_NONE; 218 return IRQ_NONE;
219} 219}
220 220
221static int bfin_rtc_open(struct device *dev)
222{
223 int ret;
224
225 dev_dbg_stamp(dev);
226
227 ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev);
228 if (!ret)
229 bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
230
231 return ret;
232}
233
234static void bfin_rtc_release(struct device *dev)
235{
236 dev_dbg_stamp(dev);
237 bfin_rtc_reset(dev, 0);
238 free_irq(IRQ_RTC, dev);
239}
240
241static void bfin_rtc_int_set(u16 rtc_int) 221static void bfin_rtc_int_set(u16 rtc_int)
242{ 222{
243 bfin_write_RTC_ISTAT(rtc_int); 223 bfin_write_RTC_ISTAT(rtc_int);
@@ -370,8 +350,6 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
370} 350}
371 351
372static struct rtc_class_ops bfin_rtc_ops = { 352static struct rtc_class_ops bfin_rtc_ops = {
373 .open = bfin_rtc_open,
374 .release = bfin_rtc_release,
375 .ioctl = bfin_rtc_ioctl, 353 .ioctl = bfin_rtc_ioctl,
376 .read_time = bfin_rtc_read_time, 354 .read_time = bfin_rtc_read_time,
377 .set_time = bfin_rtc_set_time, 355 .set_time = bfin_rtc_set_time,
@@ -383,29 +361,44 @@ static struct rtc_class_ops bfin_rtc_ops = {
383static int __devinit bfin_rtc_probe(struct platform_device *pdev) 361static int __devinit bfin_rtc_probe(struct platform_device *pdev)
384{ 362{
385 struct bfin_rtc *rtc; 363 struct bfin_rtc *rtc;
364 struct device *dev = &pdev->dev;
386 int ret = 0; 365 int ret = 0;
366 unsigned long timeout;
387 367
388 dev_dbg_stamp(&pdev->dev); 368 dev_dbg_stamp(dev);
389 369
370 /* Allocate memory for our RTC struct */
390 rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); 371 rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
391 if (unlikely(!rtc)) 372 if (unlikely(!rtc))
392 return -ENOMEM; 373 return -ENOMEM;
374 platform_set_drvdata(pdev, rtc);
375 device_init_wakeup(dev, 1);
393 376
394 rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE); 377 /* Grab the IRQ and init the hardware */
395 if (IS_ERR(rtc)) { 378 ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev);
396 ret = PTR_ERR(rtc->rtc_dev); 379 if (unlikely(ret))
397 goto err; 380 goto err;
398 } 381 /* sometimes the bootloader touched things, but the write complete was not
399 382 * enabled, so let's just do a quick timeout here since the IRQ will not fire ...
400 /* see comment at top of file about stopwatch/PIE */ 383 */
384 timeout = jiffies + HZ;
385 while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING)
386 if (time_after(jiffies, timeout))
387 break;
388 bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
401 bfin_write_RTC_SWCNT(0); 389 bfin_write_RTC_SWCNT(0);
402 390
403 platform_set_drvdata(pdev, rtc); 391 /* Register our RTC with the RTC framework */
404 392 rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE);
405 device_init_wakeup(&pdev->dev, 1); 393 if (unlikely(IS_ERR(rtc))) {
394 ret = PTR_ERR(rtc->rtc_dev);
395 goto err_irq;
396 }
406 397
407 return 0; 398 return 0;
408 399
400 err_irq:
401 free_irq(IRQ_RTC, dev);
409 err: 402 err:
410 kfree(rtc); 403 kfree(rtc);
411 return ret; 404 return ret;
@@ -414,7 +407,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
414static int __devexit bfin_rtc_remove(struct platform_device *pdev) 407static int __devexit bfin_rtc_remove(struct platform_device *pdev)
415{ 408{
416 struct bfin_rtc *rtc = platform_get_drvdata(pdev); 409 struct bfin_rtc *rtc = platform_get_drvdata(pdev);
410 struct device *dev = &pdev->dev;
417 411
412 bfin_rtc_reset(dev, 0);
413 free_irq(IRQ_RTC, dev);
418 rtc_device_unregister(rtc->rtc_dev); 414 rtc_device_unregister(rtc->rtc_dev);
419 platform_set_drvdata(pdev, NULL); 415 platform_set_drvdata(pdev, NULL);
420 kfree(rtc); 416 kfree(rtc);
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 35dcc06eb3e2..f118252f3a9f 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file,
403 403
404#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 404#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
405 case RTC_UIE_OFF: 405 case RTC_UIE_OFF:
406 mutex_unlock(&rtc->ops_lock);
406 clear_uie(rtc); 407 clear_uie(rtc);
407 break; 408 return 0;
408 409
409 case RTC_UIE_ON: 410 case RTC_UIE_ON:
411 mutex_unlock(&rtc->ops_lock);
410 err = set_uie(rtc); 412 err = set_uie(rtc);
413 return err;
411#endif 414#endif
412 default: 415 default:
413 err = -ENOTTY; 416 err = -ENOTTY;
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 640acd20fdde..a150418fba76 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
173 int cr, sr; 173 int cr, sr;
174 int ret = 0; 174 int ret = 0;
175 175
176 if (client->irq < 0) 176 if (client->irq <= 0)
177 return -EINVAL; 177 return -EINVAL;
178 178
179 mutex_lock(&ds1374->mutex); 179 mutex_lock(&ds1374->mutex);
@@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
212 int cr; 212 int cr;
213 int ret = 0; 213 int ret = 0;
214 214
215 if (client->irq < 0) 215 if (client->irq <= 0)
216 return -EINVAL; 216 return -EINVAL;
217 217
218 ret = ds1374_read_time(dev, &now); 218 ret = ds1374_read_time(dev, &now);
@@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client,
381 if (ret) 381 if (ret)
382 goto out_free; 382 goto out_free;
383 383
384 if (client->irq >= 0) { 384 if (client->irq > 0) {
385 ret = request_irq(client->irq, ds1374_irq, 0, 385 ret = request_irq(client->irq, ds1374_irq, 0,
386 "ds1374", client); 386 "ds1374", client);
387 if (ret) { 387 if (ret) {
@@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client,
401 return 0; 401 return 0;
402 402
403out_irq: 403out_irq:
404 if (client->irq >= 0) 404 if (client->irq > 0)
405 free_irq(client->irq, client); 405 free_irq(client->irq, client);
406 406
407out_free: 407out_free:
@@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client)
414{ 414{
415 struct ds1374 *ds1374 = i2c_get_clientdata(client); 415 struct ds1374 *ds1374 = i2c_get_clientdata(client);
416 416
417 if (client->irq >= 0) { 417 if (client->irq > 0) {
418 mutex_lock(&ds1374->mutex); 418 mutex_lock(&ds1374->mutex);
419 ds1374->exiting = 1; 419 ds1374->exiting = 1;
420 mutex_unlock(&ds1374->mutex); 420 mutex_unlock(&ds1374->mutex);
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 12f0310ae89c..78b2551fb19d 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -20,8 +20,6 @@
20 */ 20 */
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/version.h>
24
25#include <linux/kernel.h> 23#include <linux/kernel.h>
26#include <linux/platform_device.h> 24#include <linux/platform_device.h>
27#include <linux/init.h> 25#include <linux/init.h>
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index b35f9bfa2af4..395985b339c9 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/version.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/platform_device.h> 18#include <linux/platform_device.h>
20#include <linux/device.h> 19#include <linux/device.h>
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 1b6c52ef7339..acb78017e7d0 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2333,13 +2333,11 @@ int dasd_generic_notify(struct ccw_device *cdev, int event)
2333{ 2333{
2334 struct dasd_device *device; 2334 struct dasd_device *device;
2335 struct dasd_ccw_req *cqr; 2335 struct dasd_ccw_req *cqr;
2336 unsigned long flags;
2337 int ret; 2336 int ret;
2338 2337
2339 device = dasd_device_from_cdev(cdev); 2338 device = dasd_device_from_cdev_locked(cdev);
2340 if (IS_ERR(device)) 2339 if (IS_ERR(device))
2341 return 0; 2340 return 0;
2342 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
2343 ret = 0; 2341 ret = 0;
2344 switch (event) { 2342 switch (event) {
2345 case CIO_GONE: 2343 case CIO_GONE:
@@ -2369,7 +2367,6 @@ int dasd_generic_notify(struct ccw_device *cdev, int event)
2369 ret = 1; 2367 ret = 1;
2370 break; 2368 break;
2371 } 2369 }
2372 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
2373 dasd_put_device(device); 2370 dasd_put_device(device);
2374 return ret; 2371 return ret;
2375} 2372}
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h
index 4bf0aa5112c1..2476f87d21d0 100644
--- a/drivers/s390/block/dasd_eckd.h
+++ b/drivers/s390/block/dasd_eckd.h
@@ -308,7 +308,7 @@ struct dasd_psf_prssd_data {
308 unsigned char flags; 308 unsigned char flags;
309 unsigned char reserved[4]; 309 unsigned char reserved[4];
310 unsigned char suborder; 310 unsigned char suborder;
311 unsigned char varies[9]; 311 unsigned char varies[5];
312} __attribute__ ((packed)); 312} __attribute__ ((packed));
313 313
314/* 314/*
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index 29da4413ad43..bf512ac75b9e 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -16,6 +16,7 @@
16#include <linux/poll.h> 16#include <linux/poll.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/err.h>
19 20
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <asm/atomic.h> 22#include <asm/atomic.h>
@@ -457,7 +458,7 @@ int dasd_eer_enable(struct dasd_device *device)
457 458
458 cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, 459 cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */,
459 SNSS_DATA_SIZE, device); 460 SNSS_DATA_SIZE, device);
460 if (!cqr) 461 if (IS_ERR(cqr))
461 return -ENOMEM; 462 return -ENOMEM;
462 463
463 cqr->startdev = device; 464 cqr->startdev = device;
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 01fcdd91b846..db85f1fb131e 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -384,6 +384,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
384 * get minor, add to list 384 * get minor, add to list
385 */ 385 */
386 down_write(&dcssblk_devices_sem); 386 down_write(&dcssblk_devices_sem);
387 if (dcssblk_get_segment_by_name(local_buf)) {
388 rc = -EEXIST;
389 goto release_gd;
390 }
387 rc = dcssblk_assign_free_minor(dev_info); 391 rc = dcssblk_assign_free_minor(dev_info);
388 if (rc) { 392 if (rc) {
389 up_write(&dcssblk_devices_sem); 393 up_write(&dcssblk_devices_sem);
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
index 687720b552d1..be0ce2215c8d 100644
--- a/drivers/s390/char/tape_char.c
+++ b/drivers/s390/char/tape_char.c
@@ -109,7 +109,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size)
109 109
110 /* The current idal buffer is not correct. Allocate a new one. */ 110 /* The current idal buffer is not correct. Allocate a new one. */
111 new = idal_buffer_alloc(block_size, 0); 111 new = idal_buffer_alloc(block_size, 0);
112 if (new == NULL) 112 if (IS_ERR(new))
113 return -ENOMEM; 113 return -ENOMEM;
114 114
115 if (device->char_data.idal_buf != NULL) 115 if (device->char_data.idal_buf != NULL)
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 2a1af4e60be0..cc8fd781ee22 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -248,7 +248,7 @@ tape_std_mtsetblk(struct tape_device *device, int count)
248 248
249 /* Allocate a new idal buffer. */ 249 /* Allocate a new idal buffer. */
250 new = idal_buffer_alloc(count, 0); 250 new = idal_buffer_alloc(count, 0);
251 if (new == NULL) 251 if (IS_ERR(new))
252 return -ENOMEM; 252 return -ENOMEM;
253 if (device->char_data.idal_buf != NULL) 253 if (device->char_data.idal_buf != NULL)
254 idal_buffer_free(device->char_data.idal_buf); 254 idal_buffer_free(device->char_data.idal_buf);
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 26a930e832bd..e0ce65fca4e7 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -112,8 +112,10 @@ ccwgroup_release (struct device *dev)
112 gdev = to_ccwgroupdev(dev); 112 gdev = to_ccwgroupdev(dev);
113 113
114 for (i = 0; i < gdev->count; i++) { 114 for (i = 0; i < gdev->count; i++) {
115 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 115 if (gdev->cdev[i]) {
116 put_device(&gdev->cdev[i]->dev); 116 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
117 put_device(&gdev->cdev[i]->dev);
118 }
117 } 119 }
118 kfree(gdev); 120 kfree(gdev);
119} 121}
@@ -221,6 +223,13 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
221 atomic_set(&gdev->onoff, 0); 223 atomic_set(&gdev->onoff, 0);
222 mutex_init(&gdev->reg_mutex); 224 mutex_init(&gdev->reg_mutex);
223 mutex_lock(&gdev->reg_mutex); 225 mutex_lock(&gdev->reg_mutex);
226 gdev->creator_id = creator_id;
227 gdev->count = num_devices;
228 gdev->dev.bus = &ccwgroup_bus_type;
229 gdev->dev.parent = root;
230 gdev->dev.release = ccwgroup_release;
231 device_initialize(&gdev->dev);
232
224 curr_buf = buf; 233 curr_buf = buf;
225 for (i = 0; i < num_devices && curr_buf; i++) { 234 for (i = 0; i < num_devices && curr_buf; i++) {
226 rc = __get_next_bus_id(&curr_buf, tmp_bus_id); 235 rc = __get_next_bus_id(&curr_buf, tmp_bus_id);
@@ -258,16 +267,11 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
258 rc = -EINVAL; 267 rc = -EINVAL;
259 goto error; 268 goto error;
260 } 269 }
261 gdev->creator_id = creator_id;
262 gdev->count = num_devices;
263 gdev->dev.bus = &ccwgroup_bus_type;
264 gdev->dev.parent = root;
265 gdev->dev.release = ccwgroup_release;
266 270
267 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 271 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s",
268 gdev->cdev[0]->dev.bus_id); 272 gdev->cdev[0]->dev.bus_id);
269 273
270 rc = device_register(&gdev->dev); 274 rc = device_add(&gdev->dev);
271 if (rc) 275 if (rc)
272 goto error; 276 goto error;
273 get_device(&gdev->dev); 277 get_device(&gdev->dev);
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 46c021d880dc..51489eff6b0b 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -477,7 +477,6 @@ void css_schedule_eval_all(void)
477 477
478void css_wait_for_slow_path(void) 478void css_wait_for_slow_path(void)
479{ 479{
480 flush_workqueue(ccw_device_notify_work);
481 flush_workqueue(slow_path_wq); 480 flush_workqueue(slow_path_wq);
482} 481}
483 482
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index e818d0c54c09..28221030b886 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -150,7 +150,6 @@ static struct css_driver io_subchannel_driver = {
150}; 150};
151 151
152struct workqueue_struct *ccw_device_work; 152struct workqueue_struct *ccw_device_work;
153struct workqueue_struct *ccw_device_notify_work;
154wait_queue_head_t ccw_device_init_wq; 153wait_queue_head_t ccw_device_init_wq;
155atomic_t ccw_device_init_count; 154atomic_t ccw_device_init_count;
156 155
@@ -168,11 +167,6 @@ init_ccw_bus_type (void)
168 ccw_device_work = create_singlethread_workqueue("cio"); 167 ccw_device_work = create_singlethread_workqueue("cio");
169 if (!ccw_device_work) 168 if (!ccw_device_work)
170 return -ENOMEM; /* FIXME: better errno ? */ 169 return -ENOMEM; /* FIXME: better errno ? */
171 ccw_device_notify_work = create_singlethread_workqueue("cio_notify");
172 if (!ccw_device_notify_work) {
173 ret = -ENOMEM; /* FIXME: better errno ? */
174 goto out_err;
175 }
176 slow_path_wq = create_singlethread_workqueue("kslowcrw"); 170 slow_path_wq = create_singlethread_workqueue("kslowcrw");
177 if (!slow_path_wq) { 171 if (!slow_path_wq) {
178 ret = -ENOMEM; /* FIXME: better errno ? */ 172 ret = -ENOMEM; /* FIXME: better errno ? */
@@ -192,8 +186,6 @@ init_ccw_bus_type (void)
192out_err: 186out_err:
193 if (ccw_device_work) 187 if (ccw_device_work)
194 destroy_workqueue(ccw_device_work); 188 destroy_workqueue(ccw_device_work);
195 if (ccw_device_notify_work)
196 destroy_workqueue(ccw_device_notify_work);
197 if (slow_path_wq) 189 if (slow_path_wq)
198 destroy_workqueue(slow_path_wq); 190 destroy_workqueue(slow_path_wq);
199 return ret; 191 return ret;
@@ -204,7 +196,6 @@ cleanup_ccw_bus_type (void)
204{ 196{
205 css_driver_unregister(&io_subchannel_driver); 197 css_driver_unregister(&io_subchannel_driver);
206 bus_unregister(&ccw_bus_type); 198 bus_unregister(&ccw_bus_type);
207 destroy_workqueue(ccw_device_notify_work);
208 destroy_workqueue(ccw_device_work); 199 destroy_workqueue(ccw_device_work);
209} 200}
210 201
@@ -1496,11 +1487,22 @@ static void device_set_disconnected(struct ccw_device *cdev)
1496 ccw_device_schedule_recovery(); 1487 ccw_device_schedule_recovery();
1497} 1488}
1498 1489
1490void ccw_device_set_notoper(struct ccw_device *cdev)
1491{
1492 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1493
1494 CIO_TRACE_EVENT(2, "notoper");
1495 CIO_TRACE_EVENT(2, sch->dev.bus_id);
1496 ccw_device_set_timeout(cdev, 0);
1497 cio_disable_subchannel(sch);
1498 cdev->private->state = DEV_STATE_NOT_OPER;
1499}
1500
1499static int io_subchannel_sch_event(struct subchannel *sch, int slow) 1501static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1500{ 1502{
1501 int event, ret, disc; 1503 int event, ret, disc;
1502 unsigned long flags; 1504 unsigned long flags;
1503 enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE } action; 1505 enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE, DISC } action;
1504 struct ccw_device *cdev; 1506 struct ccw_device *cdev;
1505 1507
1506 spin_lock_irqsave(sch->lock, flags); 1508 spin_lock_irqsave(sch->lock, flags);
@@ -1535,16 +1537,11 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1535 } 1537 }
1536 /* fall through */ 1538 /* fall through */
1537 case CIO_GONE: 1539 case CIO_GONE:
1538 /* Prevent unwanted effects when opening lock. */
1539 cio_disable_subchannel(sch);
1540 device_set_disconnected(cdev);
1541 /* Ask driver what to do with device. */ 1540 /* Ask driver what to do with device. */
1542 action = UNREGISTER; 1541 if (io_subchannel_notify(sch, event))
1543 spin_unlock_irqrestore(sch->lock, flags); 1542 action = DISC;
1544 ret = io_subchannel_notify(sch, event); 1543 else
1545 spin_lock_irqsave(sch->lock, flags); 1544 action = UNREGISTER;
1546 if (ret)
1547 action = NONE;
1548 break; 1545 break;
1549 case CIO_REVALIDATE: 1546 case CIO_REVALIDATE:
1550 /* Device will be removed, so no notify necessary. */ 1547 /* Device will be removed, so no notify necessary. */
@@ -1565,6 +1562,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1565 switch (action) { 1562 switch (action) {
1566 case UNREGISTER: 1563 case UNREGISTER:
1567 case UNREGISTER_PROBE: 1564 case UNREGISTER_PROBE:
1565 ccw_device_set_notoper(cdev);
1568 /* Unregister device (will use subchannel lock). */ 1566 /* Unregister device (will use subchannel lock). */
1569 spin_unlock_irqrestore(sch->lock, flags); 1567 spin_unlock_irqrestore(sch->lock, flags);
1570 css_sch_device_unregister(sch); 1568 css_sch_device_unregister(sch);
@@ -1577,6 +1575,9 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1577 case REPROBE: 1575 case REPROBE:
1578 ccw_device_trigger_reprobe(cdev); 1576 ccw_device_trigger_reprobe(cdev);
1579 break; 1577 break;
1578 case DISC:
1579 device_set_disconnected(cdev);
1580 break;
1580 default: 1581 default:
1581 break; 1582 break;
1582 } 1583 }
@@ -1828,5 +1829,4 @@ EXPORT_SYMBOL(ccw_driver_unregister);
1828EXPORT_SYMBOL(get_ccwdev_by_busid); 1829EXPORT_SYMBOL(get_ccwdev_by_busid);
1829EXPORT_SYMBOL(ccw_bus_type); 1830EXPORT_SYMBOL(ccw_bus_type);
1830EXPORT_SYMBOL(ccw_device_work); 1831EXPORT_SYMBOL(ccw_device_work);
1831EXPORT_SYMBOL(ccw_device_notify_work);
1832EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); 1832EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id);
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index 9800a8335a3f..6f5c3f2b3587 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -72,7 +72,6 @@ dev_fsm_final_state(struct ccw_device *cdev)
72} 72}
73 73
74extern struct workqueue_struct *ccw_device_work; 74extern struct workqueue_struct *ccw_device_work;
75extern struct workqueue_struct *ccw_device_notify_work;
76extern wait_queue_head_t ccw_device_init_wq; 75extern wait_queue_head_t ccw_device_init_wq;
77extern atomic_t ccw_device_init_count; 76extern atomic_t ccw_device_init_count;
78 77
@@ -120,6 +119,7 @@ int ccw_device_stlck(struct ccw_device *);
120void ccw_device_trigger_reprobe(struct ccw_device *); 119void ccw_device_trigger_reprobe(struct ccw_device *);
121void ccw_device_kill_io(struct ccw_device *); 120void ccw_device_kill_io(struct ccw_device *);
122int ccw_device_notify(struct ccw_device *, int); 121int ccw_device_notify(struct ccw_device *, int);
122void ccw_device_set_notoper(struct ccw_device *cdev);
123 123
124/* qdio needs this. */ 124/* qdio needs this. */
125void ccw_device_set_timeout(struct ccw_device *, int); 125void ccw_device_set_timeout(struct ccw_device *, int);
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 8b5fe57fb2f3..550508df952b 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -337,26 +337,34 @@ int ccw_device_notify(struct ccw_device *cdev, int event)
337 return 0; 337 return 0;
338 if (!cdev->online) 338 if (!cdev->online)
339 return 0; 339 return 0;
340 CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n",
341 cdev->private->dev_id.ssid, cdev->private->dev_id.devno,
342 event);
340 return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0; 343 return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0;
341} 344}
342 345
343static void 346static void cmf_reenable_delayed(struct work_struct *work)
344ccw_device_oper_notify(struct work_struct *work)
345{ 347{
346 struct ccw_device_private *priv; 348 struct ccw_device_private *priv;
347 struct ccw_device *cdev; 349 struct ccw_device *cdev;
348 int ret;
349 350
350 priv = container_of(work, struct ccw_device_private, kick_work); 351 priv = container_of(work, struct ccw_device_private, kick_work);
351 cdev = priv->cdev; 352 cdev = priv->cdev;
352 ret = ccw_device_notify(cdev, CIO_OPER); 353 cmf_reenable(cdev);
353 if (ret) { 354}
355
356static void ccw_device_oper_notify(struct ccw_device *cdev)
357{
358 if (ccw_device_notify(cdev, CIO_OPER)) {
354 /* Reenable channel measurements, if needed. */ 359 /* Reenable channel measurements, if needed. */
355 cmf_reenable(cdev); 360 PREPARE_WORK(&cdev->private->kick_work, cmf_reenable_delayed);
356 wake_up(&cdev->private->wait_q); 361 queue_work(ccw_device_work, &cdev->private->kick_work);
357 } else 362 return;
358 /* Driver doesn't want device back. */ 363 }
359 ccw_device_do_unreg_rereg(work); 364 /* Driver doesn't want device back. */
365 ccw_device_set_notoper(cdev);
366 PREPARE_WORK(&cdev->private->kick_work, ccw_device_do_unreg_rereg);
367 queue_work(ccw_device_work, &cdev->private->kick_work);
360} 368}
361 369
362/* 370/*
@@ -386,8 +394,7 @@ ccw_device_done(struct ccw_device *cdev, int state)
386 394
387 if (cdev->private->flags.donotify) { 395 if (cdev->private->flags.donotify) {
388 cdev->private->flags.donotify = 0; 396 cdev->private->flags.donotify = 0;
389 PREPARE_WORK(&cdev->private->kick_work, ccw_device_oper_notify); 397 ccw_device_oper_notify(cdev);
390 queue_work(ccw_device_notify_work, &cdev->private->kick_work);
391 } 398 }
392 wake_up(&cdev->private->wait_q); 399 wake_up(&cdev->private->wait_q);
393 400
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h
index 8484b83698e1..5a4d85b829ad 100644
--- a/drivers/s390/cio/qdio_debug.h
+++ b/drivers/s390/cio/qdio_debug.h
@@ -61,18 +61,18 @@
61 61
62/* s390dbf views */ 62/* s390dbf views */
63#define QDIO_DBF_SETUP_LEN 8 63#define QDIO_DBF_SETUP_LEN 8
64#define QDIO_DBF_SETUP_PAGES 4 64#define QDIO_DBF_SETUP_PAGES 8
65#define QDIO_DBF_SETUP_NR_AREAS 1 65#define QDIO_DBF_SETUP_NR_AREAS 1
66 66
67#define QDIO_DBF_TRACE_LEN 8 67#define QDIO_DBF_TRACE_LEN 8
68#define QDIO_DBF_TRACE_NR_AREAS 2 68#define QDIO_DBF_TRACE_NR_AREAS 2
69 69
70#ifdef CONFIG_QDIO_DEBUG 70#ifdef CONFIG_QDIO_DEBUG
71#define QDIO_DBF_TRACE_PAGES 16 71#define QDIO_DBF_TRACE_PAGES 32
72#define QDIO_DBF_SETUP_LEVEL 6 72#define QDIO_DBF_SETUP_LEVEL 6
73#define QDIO_DBF_TRACE_LEVEL 4 73#define QDIO_DBF_TRACE_LEVEL 4
74#else /* !CONFIG_QDIO_DEBUG */ 74#else /* !CONFIG_QDIO_DEBUG */
75#define QDIO_DBF_TRACE_PAGES 4 75#define QDIO_DBF_TRACE_PAGES 8
76#define QDIO_DBF_SETUP_LEVEL 2 76#define QDIO_DBF_SETUP_LEVEL 2
77#define QDIO_DBF_TRACE_LEVEL 2 77#define QDIO_DBF_TRACE_LEVEL 2
78#endif /* CONFIG_QDIO_DEBUG */ 78#endif /* CONFIG_QDIO_DEBUG */
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index d15648514a0f..e6eabc853422 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -330,6 +330,7 @@ static int qdio_siga_output(struct qdio_q *q)
330 int cc; 330 int cc;
331 u32 busy_bit; 331 u32 busy_bit;
332 u64 start_time = 0; 332 u64 start_time = 0;
333 char dbf_text[15];
333 334
334 QDIO_DBF_TEXT5(0, trace, "sigaout"); 335 QDIO_DBF_TEXT5(0, trace, "sigaout");
335 QDIO_DBF_HEX5(0, trace, &q, sizeof(void *)); 336 QDIO_DBF_HEX5(0, trace, &q, sizeof(void *));
@@ -338,6 +339,9 @@ static int qdio_siga_output(struct qdio_q *q)
338again: 339again:
339 cc = qdio_do_siga_output(q, &busy_bit); 340 cc = qdio_do_siga_output(q, &busy_bit);
340 if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) { 341 if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) {
342 sprintf(dbf_text, "bb%4x%2x", q->irq_ptr->schid.sch_no, q->nr);
343 QDIO_DBF_TEXT3(0, trace, dbf_text);
344
341 if (!start_time) 345 if (!start_time)
342 start_time = get_usecs(); 346 start_time = get_usecs();
343 else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE) 347 else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE)
@@ -748,16 +752,18 @@ static void qdio_kick_outbound_q(struct qdio_q *q)
748 rc = qdio_siga_output(q); 752 rc = qdio_siga_output(q);
749 switch (rc) { 753 switch (rc) {
750 case 0: 754 case 0:
751 /* went smooth this time, reset timestamp */
752 q->u.out.timestamp = 0;
753
754 /* TODO: improve error handling for CC=0 case */ 755 /* TODO: improve error handling for CC=0 case */
755#ifdef CONFIG_QDIO_DEBUG 756#ifdef CONFIG_QDIO_DEBUG
756 QDIO_DBF_TEXT3(0, trace, "cc2reslv"); 757 if (q->u.out.timestamp) {
757 sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, q->nr, 758 QDIO_DBF_TEXT3(0, trace, "cc2reslv");
758 atomic_read(&q->u.out.busy_siga_counter)); 759 sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no,
759 QDIO_DBF_TEXT3(0, trace, dbf_text); 760 q->nr,
761 atomic_read(&q->u.out.busy_siga_counter));
762 QDIO_DBF_TEXT3(0, trace, dbf_text);
763 }
760#endif /* CONFIG_QDIO_DEBUG */ 764#endif /* CONFIG_QDIO_DEBUG */
765 /* went smooth this time, reset timestamp */
766 q->u.out.timestamp = 0;
761 break; 767 break;
762 /* cc=2 and busy bit */ 768 /* cc=2 and busy bit */
763 case (2 | QDIO_ERROR_SIGA_BUSY): 769 case (2 | QDIO_ERROR_SIGA_BUSY):
@@ -1066,14 +1072,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1066 if (IS_ERR(irb)) { 1072 if (IS_ERR(irb)) {
1067 switch (PTR_ERR(irb)) { 1073 switch (PTR_ERR(irb)) {
1068 case -EIO: 1074 case -EIO:
1069 sprintf(dbf_text, "ierr%4x", 1075 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no);
1070 cdev->private->schid.sch_no);
1071 QDIO_DBF_TEXT2(1, setup, dbf_text); 1076 QDIO_DBF_TEXT2(1, setup, dbf_text);
1072 qdio_int_error(cdev); 1077 qdio_int_error(cdev);
1073 return; 1078 return;
1074 case -ETIMEDOUT: 1079 case -ETIMEDOUT:
1075 sprintf(dbf_text, "qtoh%4x", 1080 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no);
1076 cdev->private->schid.sch_no);
1077 QDIO_DBF_TEXT2(1, setup, dbf_text); 1081 QDIO_DBF_TEXT2(1, setup, dbf_text);
1078 qdio_int_error(cdev); 1082 qdio_int_error(cdev);
1079 return; 1083 return;
@@ -1124,8 +1128,10 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1124struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev) 1128struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev)
1125{ 1129{
1126 struct qdio_irq *irq_ptr; 1130 struct qdio_irq *irq_ptr;
1131 char dbf_text[15];
1127 1132
1128 QDIO_DBF_TEXT0(0, setup, "getssqd"); 1133 sprintf(dbf_text, "qssq%4x", cdev->private->schid.sch_no);
1134 QDIO_DBF_TEXT0(0, setup, dbf_text);
1129 1135
1130 irq_ptr = cdev->private->qdio_data; 1136 irq_ptr = cdev->private->qdio_data;
1131 if (!irq_ptr) 1137 if (!irq_ptr)
@@ -1149,14 +1155,13 @@ int qdio_cleanup(struct ccw_device *cdev, int how)
1149 char dbf_text[15]; 1155 char dbf_text[15];
1150 int rc; 1156 int rc;
1151 1157
1158 sprintf(dbf_text, "qcln%4x", cdev->private->schid.sch_no);
1159 QDIO_DBF_TEXT0(0, setup, dbf_text);
1160
1152 irq_ptr = cdev->private->qdio_data; 1161 irq_ptr = cdev->private->qdio_data;
1153 if (!irq_ptr) 1162 if (!irq_ptr)
1154 return -ENODEV; 1163 return -ENODEV;
1155 1164
1156 sprintf(dbf_text, "qcln%4x", irq_ptr->schid.sch_no);
1157 QDIO_DBF_TEXT1(0, trace, dbf_text);
1158 QDIO_DBF_TEXT0(0, setup, dbf_text);
1159
1160 rc = qdio_shutdown(cdev, how); 1165 rc = qdio_shutdown(cdev, how);
1161 if (rc == 0) 1166 if (rc == 0)
1162 rc = qdio_free(cdev); 1167 rc = qdio_free(cdev);
@@ -1191,6 +1196,9 @@ int qdio_shutdown(struct ccw_device *cdev, int how)
1191 unsigned long flags; 1196 unsigned long flags;
1192 char dbf_text[15]; 1197 char dbf_text[15];
1193 1198
1199 sprintf(dbf_text, "qshu%4x", cdev->private->schid.sch_no);
1200 QDIO_DBF_TEXT0(0, setup, dbf_text);
1201
1194 irq_ptr = cdev->private->qdio_data; 1202 irq_ptr = cdev->private->qdio_data;
1195 if (!irq_ptr) 1203 if (!irq_ptr)
1196 return -ENODEV; 1204 return -ENODEV;
@@ -1205,10 +1213,6 @@ int qdio_shutdown(struct ccw_device *cdev, int how)
1205 return 0; 1213 return 0;
1206 } 1214 }
1207 1215
1208 sprintf(dbf_text, "qsqs%4x", irq_ptr->schid.sch_no);
1209 QDIO_DBF_TEXT1(0, trace, dbf_text);
1210 QDIO_DBF_TEXT0(0, setup, dbf_text);
1211
1212 tiqdio_remove_input_queues(irq_ptr); 1216 tiqdio_remove_input_queues(irq_ptr);
1213 qdio_shutdown_queues(cdev); 1217 qdio_shutdown_queues(cdev);
1214 qdio_shutdown_debug_entries(irq_ptr, cdev); 1218 qdio_shutdown_debug_entries(irq_ptr, cdev);
@@ -1247,7 +1251,6 @@ no_cleanup:
1247 1251
1248 qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); 1252 qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
1249 mutex_unlock(&irq_ptr->setup_mutex); 1253 mutex_unlock(&irq_ptr->setup_mutex);
1250 module_put(THIS_MODULE);
1251 if (rc) 1254 if (rc)
1252 return rc; 1255 return rc;
1253 return 0; 1256 return 0;
@@ -1263,16 +1266,14 @@ int qdio_free(struct ccw_device *cdev)
1263 struct qdio_irq *irq_ptr; 1266 struct qdio_irq *irq_ptr;
1264 char dbf_text[15]; 1267 char dbf_text[15];
1265 1268
1269 sprintf(dbf_text, "qfre%4x", cdev->private->schid.sch_no);
1270 QDIO_DBF_TEXT0(0, setup, dbf_text);
1271
1266 irq_ptr = cdev->private->qdio_data; 1272 irq_ptr = cdev->private->qdio_data;
1267 if (!irq_ptr) 1273 if (!irq_ptr)
1268 return -ENODEV; 1274 return -ENODEV;
1269 1275
1270 mutex_lock(&irq_ptr->setup_mutex); 1276 mutex_lock(&irq_ptr->setup_mutex);
1271
1272 sprintf(dbf_text, "qfqs%4x", irq_ptr->schid.sch_no);
1273 QDIO_DBF_TEXT1(0, trace, dbf_text);
1274 QDIO_DBF_TEXT0(0, setup, dbf_text);
1275
1276 cdev->private->qdio_data = NULL; 1277 cdev->private->qdio_data = NULL;
1277 mutex_unlock(&irq_ptr->setup_mutex); 1278 mutex_unlock(&irq_ptr->setup_mutex);
1278 1279
@@ -1295,7 +1296,6 @@ int qdio_initialize(struct qdio_initialize *init_data)
1295 1296
1296 sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no); 1297 sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no);
1297 QDIO_DBF_TEXT0(0, setup, dbf_text); 1298 QDIO_DBF_TEXT0(0, setup, dbf_text);
1298 QDIO_DBF_TEXT0(0, trace, dbf_text);
1299 1299
1300 rc = qdio_allocate(init_data); 1300 rc = qdio_allocate(init_data);
1301 if (rc) 1301 if (rc)
@@ -1319,7 +1319,6 @@ int qdio_allocate(struct qdio_initialize *init_data)
1319 1319
1320 sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no); 1320 sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no);
1321 QDIO_DBF_TEXT0(0, setup, dbf_text); 1321 QDIO_DBF_TEXT0(0, setup, dbf_text);
1322 QDIO_DBF_TEXT0(0, trace, dbf_text);
1323 1322
1324 if ((init_data->no_input_qs && !init_data->input_handler) || 1323 if ((init_data->no_input_qs && !init_data->input_handler) ||
1325 (init_data->no_output_qs && !init_data->output_handler)) 1324 (init_data->no_output_qs && !init_data->output_handler))
@@ -1389,6 +1388,9 @@ int qdio_establish(struct qdio_initialize *init_data)
1389 unsigned long saveflags; 1388 unsigned long saveflags;
1390 int rc; 1389 int rc;
1391 1390
1391 sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no);
1392 QDIO_DBF_TEXT0(0, setup, dbf_text);
1393
1392 irq_ptr = cdev->private->qdio_data; 1394 irq_ptr = cdev->private->qdio_data;
1393 if (!irq_ptr) 1395 if (!irq_ptr)
1394 return -ENODEV; 1396 return -ENODEV;
@@ -1396,13 +1398,6 @@ int qdio_establish(struct qdio_initialize *init_data)
1396 if (cdev->private->state != DEV_STATE_ONLINE) 1398 if (cdev->private->state != DEV_STATE_ONLINE)
1397 return -EINVAL; 1399 return -EINVAL;
1398 1400
1399 if (!try_module_get(THIS_MODULE))
1400 return -EINVAL;
1401
1402 sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no);
1403 QDIO_DBF_TEXT0(0, setup, dbf_text);
1404 QDIO_DBF_TEXT0(0, trace, dbf_text);
1405
1406 mutex_lock(&irq_ptr->setup_mutex); 1401 mutex_lock(&irq_ptr->setup_mutex);
1407 qdio_setup_irq(init_data); 1402 qdio_setup_irq(init_data);
1408 1403
@@ -1472,6 +1467,9 @@ int qdio_activate(struct ccw_device *cdev)
1472 unsigned long saveflags; 1467 unsigned long saveflags;
1473 char dbf_text[20]; 1468 char dbf_text[20];
1474 1469
1470 sprintf(dbf_text, "qact%4x", cdev->private->schid.sch_no);
1471 QDIO_DBF_TEXT0(0, setup, dbf_text);
1472
1475 irq_ptr = cdev->private->qdio_data; 1473 irq_ptr = cdev->private->qdio_data;
1476 if (!irq_ptr) 1474 if (!irq_ptr)
1477 return -ENODEV; 1475 return -ENODEV;
@@ -1485,10 +1483,6 @@ int qdio_activate(struct ccw_device *cdev)
1485 goto out; 1483 goto out;
1486 } 1484 }
1487 1485
1488 sprintf(dbf_text, "qact%4x", irq_ptr->schid.sch_no);
1489 QDIO_DBF_TEXT2(0, setup, dbf_text);
1490 QDIO_DBF_TEXT2(0, trace, dbf_text);
1491
1492 irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd; 1486 irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd;
1493 irq_ptr->ccw.flags = CCW_FLAG_SLI; 1487 irq_ptr->ccw.flags = CCW_FLAG_SLI;
1494 irq_ptr->ccw.count = irq_ptr->aqueue.count; 1488 irq_ptr->ccw.count = irq_ptr->aqueue.count;
@@ -1663,7 +1657,7 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
1663#ifdef CONFIG_QDIO_DEBUG 1657#ifdef CONFIG_QDIO_DEBUG
1664 char dbf_text[20]; 1658 char dbf_text[20];
1665 1659
1666 sprintf(dbf_text, "doQD%04x", cdev->private->schid.sch_no); 1660 sprintf(dbf_text, "doQD%4x", cdev->private->schid.sch_no);
1667 QDIO_DBF_TEXT3(0, trace, dbf_text); 1661 QDIO_DBF_TEXT3(0, trace, dbf_text);
1668#endif /* CONFIG_QDIO_DEBUG */ 1662#endif /* CONFIG_QDIO_DEBUG */
1669 1663
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 1bd2a208db28..1679e2f91c94 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -165,7 +165,7 @@ static void setup_queues(struct qdio_irq *irq_ptr,
165 void **output_sbal_array = qdio_init->output_sbal_addr_array; 165 void **output_sbal_array = qdio_init->output_sbal_addr_array;
166 int i; 166 int i;
167 167
168 sprintf(dbf_text, "qfqs%4x", qdio_init->cdev->private->schid.sch_no); 168 sprintf(dbf_text, "qset%4x", qdio_init->cdev->private->schid.sch_no);
169 QDIO_DBF_TEXT0(0, setup, dbf_text); 169 QDIO_DBF_TEXT0(0, setup, dbf_text);
170 170
171 for_each_input_queue(irq_ptr, q, i) { 171 for_each_input_queue(irq_ptr, q, i) {
@@ -285,7 +285,7 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr)
285 rc = __get_ssqd_info(irq_ptr); 285 rc = __get_ssqd_info(irq_ptr);
286 if (rc) { 286 if (rc) {
287 QDIO_DBF_TEXT2(0, setup, "ssqdasig"); 287 QDIO_DBF_TEXT2(0, setup, "ssqdasig");
288 sprintf(dbf_text, "schno%x", irq_ptr->schid.sch_no); 288 sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no);
289 QDIO_DBF_TEXT2(0, setup, dbf_text); 289 QDIO_DBF_TEXT2(0, setup, dbf_text);
290 sprintf(dbf_text, "rc:%d", rc); 290 sprintf(dbf_text, "rc:%d", rc);
291 QDIO_DBF_TEXT2(0, setup, dbf_text); 291 QDIO_DBF_TEXT2(0, setup, dbf_text);
@@ -447,7 +447,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
447{ 447{
448 char s[80]; 448 char s[80];
449 449
450 sprintf(s, "%s ", cdev->dev.bus_id); 450 sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no);
451 451
452 switch (irq_ptr->qib.qfmt) { 452 switch (irq_ptr->qib.qfmt) {
453 case QDIO_QETH_QFMT: 453 case QDIO_QETH_QFMT:
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 9291a771d812..ea7f61400267 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -113,7 +113,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr)
113 struct qdio_q *q; 113 struct qdio_q *q;
114 int i; 114 int i;
115 115
116 for_each_input_queue(irq_ptr, q, i) { 116 for (i = 0; i < irq_ptr->nr_input_qs; i++) {
117 q = irq_ptr->input_qs[i];
118 /* if establish triggered an error */
119 if (!q || !q->entry.prev || !q->entry.next)
120 continue;
117 list_del_rcu(&q->entry); 121 list_del_rcu(&q->entry);
118 synchronize_rcu(); 122 synchronize_rcu();
119 } 123 }
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c
index 49ae1cd25caa..2de1e2fccbf9 100644
--- a/drivers/s390/net/ctcm_mpc.c
+++ b/drivers/s390/net/ctcm_mpc.c
@@ -19,7 +19,6 @@
19#undef DEBUGDATA 19#undef DEBUGDATA
20#undef DEBUGCCW 20#undef DEBUGCCW
21 21
22#include <linux/version.h>
23#include <linux/module.h> 22#include <linux/module.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index e7c7b4ebc1fe..2dee69da35cf 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -376,7 +376,7 @@ static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h)
376 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' || 376 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' ||
377 inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') 377 inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd')
378 return SCSI_DH_NOSYS; 378 return SCSI_DH_NOSYS;
379 h->lun = scsilun_to_int((struct scsi_lun *)inqp->lun); 379 h->lun = inqp->lun[7]; /* Uses only the last byte */
380 } 380 }
381 return err; 381 return err;
382} 382}
@@ -386,6 +386,7 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
386 int err; 386 int err;
387 struct c9_inquiry *inqp; 387 struct c9_inquiry *inqp;
388 388
389 h->lun_state = RDAC_LUN_UNOWNED;
389 err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h); 390 err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
390 if (err == SCSI_DH_OK) { 391 if (err == SCSI_DH_OK) {
391 inqp = &h->inq.c9; 392 inqp = &h->inq.c9;
diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h
index 19406cea6d6a..179ad77f6cc9 100644
--- a/drivers/scsi/dpt/dpti_i2o.h
+++ b/drivers/scsi/dpt/dpti_i2o.h
@@ -21,7 +21,6 @@
21 21
22#include <linux/i2o-dev.h> 22#include <linux/i2o-dev.h>
23 23
24#include <linux/version.h>
25#include <linux/notifier.h> 24#include <linux/notifier.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27 26
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index ae560bc04f9d..4e0b7c8eb32e 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -556,11 +556,12 @@ static void ibmvfc_link_down(struct ibmvfc_host *vhost,
556/** 556/**
557 * ibmvfc_init_host - Start host initialization 557 * ibmvfc_init_host - Start host initialization
558 * @vhost: ibmvfc host struct 558 * @vhost: ibmvfc host struct
559 * @relogin: is this a re-login?
559 * 560 *
560 * Return value: 561 * Return value:
561 * nothing 562 * nothing
562 **/ 563 **/
563static void ibmvfc_init_host(struct ibmvfc_host *vhost) 564static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin)
564{ 565{
565 struct ibmvfc_target *tgt; 566 struct ibmvfc_target *tgt;
566 567
@@ -574,6 +575,11 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost)
574 } 575 }
575 576
576 if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) { 577 if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) {
578 if (!relogin) {
579 memset(vhost->async_crq.msgs, 0, PAGE_SIZE);
580 vhost->async_crq.cur = 0;
581 }
582
577 list_for_each_entry(tgt, &vhost->targets, queue) 583 list_for_each_entry(tgt, &vhost->targets, queue)
578 tgt->need_login = 1; 584 tgt->need_login = 1;
579 scsi_block_requests(vhost->host); 585 scsi_block_requests(vhost->host);
@@ -1059,9 +1065,10 @@ static void ibmvfc_get_starget_port_id(struct scsi_target *starget)
1059static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost) 1065static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost)
1060{ 1066{
1061 long timeout = wait_event_timeout(vhost->init_wait_q, 1067 long timeout = wait_event_timeout(vhost->init_wait_q,
1062 (vhost->state == IBMVFC_ACTIVE || 1068 ((vhost->state == IBMVFC_ACTIVE ||
1063 vhost->state == IBMVFC_HOST_OFFLINE || 1069 vhost->state == IBMVFC_HOST_OFFLINE ||
1064 vhost->state == IBMVFC_LINK_DEAD), 1070 vhost->state == IBMVFC_LINK_DEAD) &&
1071 vhost->action == IBMVFC_HOST_ACTION_NONE),
1065 (init_timeout * HZ)); 1072 (init_timeout * HZ));
1066 1073
1067 return timeout ? 0 : -EIO; 1074 return timeout ? 0 : -EIO;
@@ -1450,8 +1457,8 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
1450 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; 1457 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd;
1451 struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; 1458 struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp;
1452 struct scsi_cmnd *cmnd = evt->cmnd; 1459 struct scsi_cmnd *cmnd = evt->cmnd;
1453 int rsp_len = 0; 1460 u32 rsp_len = 0;
1454 int sense_len = rsp->fcp_sense_len; 1461 u32 sense_len = rsp->fcp_sense_len;
1455 1462
1456 if (cmnd) { 1463 if (cmnd) {
1457 if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID) 1464 if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID)
@@ -1468,7 +1475,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
1468 rsp_len = rsp->fcp_rsp_len; 1475 rsp_len = rsp->fcp_rsp_len;
1469 if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) 1476 if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE)
1470 sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; 1477 sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len;
1471 if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len) 1478 if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8)
1472 memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); 1479 memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len);
1473 1480
1474 ibmvfc_log_error(evt); 1481 ibmvfc_log_error(evt);
@@ -2077,17 +2084,18 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2077{ 2084{
2078 const char *desc = ibmvfc_get_ae_desc(crq->event); 2085 const char *desc = ibmvfc_get_ae_desc(crq->event);
2079 2086
2080 ibmvfc_log(vhost, 3, "%s event received\n", desc); 2087 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx,"
2088 " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name);
2081 2089
2082 switch (crq->event) { 2090 switch (crq->event) {
2083 case IBMVFC_AE_LINK_UP: 2091 case IBMVFC_AE_LINK_UP:
2084 case IBMVFC_AE_RESUME: 2092 case IBMVFC_AE_RESUME:
2085 vhost->events_to_log |= IBMVFC_AE_LINKUP; 2093 vhost->events_to_log |= IBMVFC_AE_LINKUP;
2086 ibmvfc_init_host(vhost); 2094 ibmvfc_init_host(vhost, 1);
2087 break; 2095 break;
2088 case IBMVFC_AE_SCN_FABRIC: 2096 case IBMVFC_AE_SCN_FABRIC:
2089 vhost->events_to_log |= IBMVFC_AE_RSCN; 2097 vhost->events_to_log |= IBMVFC_AE_RSCN;
2090 ibmvfc_init_host(vhost); 2098 ibmvfc_init_host(vhost, 1);
2091 break; 2099 break;
2092 case IBMVFC_AE_SCN_NPORT: 2100 case IBMVFC_AE_SCN_NPORT:
2093 case IBMVFC_AE_SCN_GROUP: 2101 case IBMVFC_AE_SCN_GROUP:
@@ -2133,13 +2141,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost)
2133 /* Send back a response */ 2141 /* Send back a response */
2134 rc = ibmvfc_send_crq_init_complete(vhost); 2142 rc = ibmvfc_send_crq_init_complete(vhost);
2135 if (rc == 0) 2143 if (rc == 0)
2136 ibmvfc_init_host(vhost); 2144 ibmvfc_init_host(vhost, 0);
2137 else 2145 else
2138 dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc); 2146 dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc);
2139 break; 2147 break;
2140 case IBMVFC_CRQ_INIT_COMPLETE: 2148 case IBMVFC_CRQ_INIT_COMPLETE:
2141 dev_info(vhost->dev, "Partner initialization complete\n"); 2149 dev_info(vhost->dev, "Partner initialization complete\n");
2142 ibmvfc_init_host(vhost); 2150 ibmvfc_init_host(vhost, 0);
2143 break; 2151 break;
2144 default: 2152 default:
2145 dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format); 2153 dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format);
@@ -3357,8 +3365,6 @@ static void ibmvfc_npiv_login(struct ibmvfc_host *vhost)
3357 mad->buffer.va = vhost->login_buf_dma; 3365 mad->buffer.va = vhost->login_buf_dma;
3358 mad->buffer.len = sizeof(*vhost->login_buf); 3366 mad->buffer.len = sizeof(*vhost->login_buf);
3359 3367
3360 memset(vhost->async_crq.msgs, 0, PAGE_SIZE);
3361 vhost->async_crq.cur = 0;
3362 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); 3368 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT);
3363 3369
3364 if (!ibmvfc_send_event(evt, vhost, default_timeout)) 3370 if (!ibmvfc_send_event(evt, vhost, default_timeout))
@@ -3601,8 +3607,9 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
3601 } 3607 }
3602 } 3608 }
3603 3609
3604 if (vhost->reinit) { 3610 if (vhost->reinit && !ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) {
3605 vhost->reinit = 0; 3611 vhost->reinit = 0;
3612 scsi_block_requests(vhost->host);
3606 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); 3613 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
3607 } else { 3614 } else {
3608 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE); 3615 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index 4bf6e374f076..fb3177ab6691 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -29,8 +29,8 @@
29#include "viosrp.h" 29#include "viosrp.h"
30 30
31#define IBMVFC_NAME "ibmvfc" 31#define IBMVFC_NAME "ibmvfc"
32#define IBMVFC_DRIVER_VERSION "1.0.1" 32#define IBMVFC_DRIVER_VERSION "1.0.2"
33#define IBMVFC_DRIVER_DATE "(July 11, 2008)" 33#define IBMVFC_DRIVER_DATE "(August 14, 2008)"
34 34
35#define IBMVFC_DEFAULT_TIMEOUT 15 35#define IBMVFC_DEFAULT_TIMEOUT 15
36#define IBMVFC_INIT_TIMEOUT 30 36#define IBMVFC_INIT_TIMEOUT 30
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 6b24b9cdb04c..7b1502c0ab6e 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1636,7 +1636,7 @@ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
1636 unsigned long desired_io = max_requests * sizeof(union viosrp_iu); 1636 unsigned long desired_io = max_requests * sizeof(union viosrp_iu);
1637 1637
1638 /* add io space for sg data */ 1638 /* add io space for sg data */
1639 desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 1639 desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 512 *
1640 IBMVSCSI_CMDS_PER_LUN_DEFAULT); 1640 IBMVSCSI_CMDS_PER_LUN_DEFAULT);
1641 1641
1642 return desired_io; 1642 return desired_io;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 7c615c70ec5c..bc9e6ddf41df 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -165,7 +165,6 @@
165#include <asm/byteorder.h> 165#include <asm/byteorder.h>
166#include <asm/page.h> 166#include <asm/page.h>
167#include <linux/stddef.h> 167#include <linux/stddef.h>
168#include <linux/version.h>
169#include <linux/string.h> 168#include <linux/string.h>
170#include <linux/errno.h> 169#include <linux/errno.h>
171#include <linux/kernel.h> 170#include <linux/kernel.h>
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index e0657b6f009c..4e49fbcfe8af 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -50,7 +50,6 @@
50#ifndef _IPS_H_ 50#ifndef _IPS_H_
51 #define _IPS_H_ 51 #define _IPS_H_
52 52
53#include <linux/version.h>
54#include <linux/nmi.h> 53#include <linux/nmi.h>
55 #include <asm/uaccess.h> 54 #include <asm/uaccess.h>
56 #include <asm/io.h> 55 #include <asm/io.h>
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 90272e65957a..094b47e94b29 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -27,7 +27,6 @@
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/ctype.h> 29#include <linux/ctype.h>
30#include <linux/version.h>
31 30
32#include <scsi/scsi.h> 31#include <scsi/scsi.h>
33#include <scsi/scsi_device.h> 32#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index fc7ac158476c..97b763378e7d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_sas.c 12 * FILE : megaraid_sas.c
13 * Version : v00.00.03.20-rc1 13 * Version : v00.00.04.01-rc1
14 * 14 *
15 * Authors: 15 * Authors:
16 * (email-id : megaraidlinux@lsi.com) 16 * (email-id : megaraidlinux@lsi.com)
@@ -71,6 +71,10 @@ static struct pci_device_id megasas_pci_table[] = {
71 /* ppc IOP */ 71 /* ppc IOP */
72 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, 72 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)},
73 /* ppc IOP */ 73 /* ppc IOP */
74 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078GEN2)},
75 /* gen2*/
76 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS0079GEN2)},
77 /* gen2*/
74 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, 78 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)},
75 /* xscale IOP, vega */ 79 /* xscale IOP, vega */
76 {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, 80 {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)},
@@ -198,6 +202,9 @@ megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
198 */ 202 */
199 writel(status, &regs->outbound_intr_status); 203 writel(status, &regs->outbound_intr_status);
200 204
205 /* Dummy readl to force pci flush */
206 readl(&regs->outbound_intr_status);
207
201 return 0; 208 return 0;
202} 209}
203 210
@@ -293,6 +300,9 @@ megasas_clear_intr_ppc(struct megasas_register_set __iomem * regs)
293 */ 300 */
294 writel(status, &regs->outbound_doorbell_clear); 301 writel(status, &regs->outbound_doorbell_clear);
295 302
303 /* Dummy readl to force pci flush */
304 readl(&regs->outbound_doorbell_clear);
305
296 return 0; 306 return 0;
297} 307}
298/** 308/**
@@ -318,6 +328,99 @@ static struct megasas_instance_template megasas_instance_template_ppc = {
318}; 328};
319 329
320/** 330/**
331* The following functions are defined for gen2 (deviceid : 0x78 0x79)
332* controllers
333*/
334
335/**
336 * megasas_enable_intr_gen2 - Enables interrupts
337 * @regs: MFI register set
338 */
339static inline void
340megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs)
341{
342 writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
343
344 /* write ~0x00000005 (4 & 1) to the intr mask*/
345 writel(~MFI_GEN2_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask);
346
347 /* Dummy readl to force pci flush */
348 readl(&regs->outbound_intr_mask);
349}
350
351/**
352 * megasas_disable_intr_gen2 - Disables interrupt
353 * @regs: MFI register set
354 */
355static inline void
356megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs)
357{
358 u32 mask = 0xFFFFFFFF;
359 writel(mask, &regs->outbound_intr_mask);
360 /* Dummy readl to force pci flush */
361 readl(&regs->outbound_intr_mask);
362}
363
364/**
365 * megasas_read_fw_status_reg_gen2 - returns the current FW status value
366 * @regs: MFI register set
367 */
368static u32
369megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs)
370{
371 return readl(&(regs)->outbound_scratch_pad);
372}
373
374/**
375 * megasas_clear_interrupt_gen2 - Check & clear interrupt
376 * @regs: MFI register set
377 */
378static int
379megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
380{
381 u32 status;
382 /*
383 * Check if it is our interrupt
384 */
385 status = readl(&regs->outbound_intr_status);
386
387 if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
388 return 1;
389
390 /*
391 * Clear the interrupt by writing back the same value
392 */
393 writel(status, &regs->outbound_doorbell_clear);
394
395 /* Dummy readl to force pci flush */
396 readl(&regs->outbound_intr_status);
397
398 return 0;
399}
400/**
401 * megasas_fire_cmd_gen2 - Sends command to the FW
402 * @frame_phys_addr : Physical address of cmd
403 * @frame_count : Number of frames for the command
404 * @regs : MFI register set
405 */
406static inline void
407megasas_fire_cmd_gen2(dma_addr_t frame_phys_addr, u32 frame_count,
408 struct megasas_register_set __iomem *regs)
409{
410 writel((frame_phys_addr | (frame_count<<1))|1,
411 &(regs)->inbound_queue_port);
412}
413
414static struct megasas_instance_template megasas_instance_template_gen2 = {
415
416 .fire_cmd = megasas_fire_cmd_gen2,
417 .enable_intr = megasas_enable_intr_gen2,
418 .disable_intr = megasas_disable_intr_gen2,
419 .clear_intr = megasas_clear_intr_gen2,
420 .read_fw_status_reg = megasas_read_fw_status_reg_gen2,
421};
422
423/**
321* This is the end of set of functions & definitions 424* This is the end of set of functions & definitions
322* specific to ppc (deviceid : 0x60) controllers 425* specific to ppc (deviceid : 0x60) controllers
323*/ 426*/
@@ -1976,7 +2079,12 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1976 /* 2079 /*
1977 * Map the message registers 2080 * Map the message registers
1978 */ 2081 */
1979 instance->base_addr = pci_resource_start(instance->pdev, 0); 2082 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) ||
2083 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) {
2084 instance->base_addr = pci_resource_start(instance->pdev, 1);
2085 } else {
2086 instance->base_addr = pci_resource_start(instance->pdev, 0);
2087 }
1980 2088
1981 if (pci_request_regions(instance->pdev, "megasas: LSI")) { 2089 if (pci_request_regions(instance->pdev, "megasas: LSI")) {
1982 printk(KERN_DEBUG "megasas: IO memory region busy!\n"); 2090 printk(KERN_DEBUG "megasas: IO memory region busy!\n");
@@ -1998,6 +2106,10 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1998 case PCI_DEVICE_ID_LSI_SAS1078DE: 2106 case PCI_DEVICE_ID_LSI_SAS1078DE:
1999 instance->instancet = &megasas_instance_template_ppc; 2107 instance->instancet = &megasas_instance_template_ppc;
2000 break; 2108 break;
2109 case PCI_DEVICE_ID_LSI_SAS1078GEN2:
2110 case PCI_DEVICE_ID_LSI_SAS0079GEN2:
2111 instance->instancet = &megasas_instance_template_gen2;
2112 break;
2001 case PCI_DEVICE_ID_LSI_SAS1064R: 2113 case PCI_DEVICE_ID_LSI_SAS1064R:
2002 case PCI_DEVICE_ID_DELL_PERC5: 2114 case PCI_DEVICE_ID_DELL_PERC5:
2003 default: 2115 default:
@@ -2857,6 +2969,7 @@ static void megasas_shutdown(struct pci_dev *pdev)
2857{ 2969{
2858 struct megasas_instance *instance = pci_get_drvdata(pdev); 2970 struct megasas_instance *instance = pci_get_drvdata(pdev);
2859 megasas_flush_cache(instance); 2971 megasas_flush_cache(instance);
2972 megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN);
2860} 2973}
2861 2974
2862/** 2975/**
@@ -3292,7 +3405,7 @@ megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t coun
3292 return retval; 3405 return retval;
3293} 3406}
3294 3407
3295static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUGO, megasas_sysfs_show_dbg_lvl, 3408static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUSR, megasas_sysfs_show_dbg_lvl,
3296 megasas_sysfs_set_dbg_lvl); 3409 megasas_sysfs_set_dbg_lvl);
3297 3410
3298static ssize_t 3411static ssize_t
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index b0c41e671702..0d033248fdf1 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,9 +18,9 @@
18/* 18/*
19 * MegaRAID SAS Driver meta data 19 * MegaRAID SAS Driver meta data
20 */ 20 */
21#define MEGASAS_VERSION "00.00.03.20-rc1" 21#define MEGASAS_VERSION "00.00.04.01"
22#define MEGASAS_RELDATE "March 10, 2008" 22#define MEGASAS_RELDATE "July 24, 2008"
23#define MEGASAS_EXT_VERSION "Mon. March 10 11:02:31 PDT 2008" 23#define MEGASAS_EXT_VERSION "Thu July 24 11:41:51 PST 2008"
24 24
25/* 25/*
26 * Device IDs 26 * Device IDs
@@ -28,6 +28,8 @@
28#define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 28#define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
29#define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C 29#define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C
30#define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 30#define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
31#define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078
32#define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079
31 33
32/* 34/*
33 * ===================================== 35 * =====================================
@@ -580,6 +582,8 @@ struct megasas_ctrl_info {
580#define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) 582#define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10)
581 583
582#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 584#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
585#define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
586#define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
583 587
584/* 588/*
585* register set for both 1068 and 1078 controllers 589* register set for both 1068 and 1078 controllers
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index edf9fdb3cb3c..22052bb7becb 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -23,7 +23,6 @@
23 * 1.2: PowerPC (big endian) support. 23 * 1.2: PowerPC (big endian) support.
24 */ 24 */
25 25
26#include <linux/version.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/kernel.h> 28#include <linux/kernel.h>
diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h
index 6715ecb3bfca..9565acf1aa72 100644
--- a/drivers/scsi/nsp32.h
+++ b/drivers/scsi/nsp32.h
@@ -16,7 +16,6 @@
16#ifndef _NSP32_H 16#ifndef _NSP32_H
17#define _NSP32_H 17#define _NSP32_H
18 18
19#include <linux/version.h>
20//#define NSP32_DEBUG 9 19//#define NSP32_DEBUG 9
21 20
22/* 21/*
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index a221b6ef9fa9..24e6cb8396e3 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -25,7 +25,6 @@
25 25
26***********************************************************************/ 26***********************************************************************/
27 27
28#include <linux/version.h>
29#include <linux/module.h> 28#include <linux/module.h>
30#include <linux/kernel.h> 29#include <linux/kernel.h>
31#include <linux/init.h> 30#include <linux/init.h>
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index a319a20ed440..45e7dcb4b34d 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -993,6 +993,17 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
993{ 993{
994 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; 994 fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
995 995
996 /*
997 * At this point all fcport's software-states are cleared. Perform any
998 * final cleanup of firmware resources (PCBs and XCBs).
999 */
1000 if (fcport->loop_id != FC_NO_LOOP_ID) {
1001 fcport->ha->isp_ops->fabric_logout(fcport->ha, fcport->loop_id,
1002 fcport->d_id.b.domain, fcport->d_id.b.area,
1003 fcport->d_id.b.al_pa);
1004 fcport->loop_id = FC_NO_LOOP_ID;
1005 }
1006
996 qla2x00_abort_fcport_cmds(fcport); 1007 qla2x00_abort_fcport_cmds(fcport);
997 scsi_target_unblock(&rport->dev); 1008 scsi_target_unblock(&rport->dev);
998} 1009}
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6da31ba94404..94a720eabfd8 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2237,6 +2237,7 @@ typedef struct scsi_qla_host {
2237#define REGISTER_FDMI_NEEDED 26 2237#define REGISTER_FDMI_NEEDED 26
2238#define FCPORT_UPDATE_NEEDED 27 2238#define FCPORT_UPDATE_NEEDED 27
2239#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */ 2239#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */
2240#define UNLOADING 29
2240 2241
2241 uint32_t device_flags; 2242 uint32_t device_flags;
2242#define DFLG_LOCAL_DEVICES BIT_0 2243#define DFLG_LOCAL_DEVICES BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 601a6b29750c..ee89ddd64aae 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -976,8 +976,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
976 &ha->fw_attributes, &ha->fw_memory_size); 976 &ha->fw_attributes, &ha->fw_memory_size);
977 qla2x00_resize_request_q(ha); 977 qla2x00_resize_request_q(ha);
978 ha->flags.npiv_supported = 0; 978 ha->flags.npiv_supported = 0;
979 if ((IS_QLA24XX(ha) || IS_QLA25XX(ha)) && 979 if ((IS_QLA24XX(ha) || IS_QLA25XX(ha) ||
980 (ha->fw_attributes & BIT_2)) { 980 IS_QLA84XX(ha)) &&
981 (ha->fw_attributes & BIT_2)) {
981 ha->flags.npiv_supported = 1; 982 ha->flags.npiv_supported = 1;
982 if ((!ha->max_npiv_vports) || 983 if ((!ha->max_npiv_vports) ||
983 ((ha->max_npiv_vports + 1) % 984 ((ha->max_npiv_vports + 1) %
@@ -3251,6 +3252,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3251{ 3252{
3252 int rval; 3253 int rval;
3253 uint8_t status = 0; 3254 uint8_t status = 0;
3255 scsi_qla_host_t *vha;
3254 3256
3255 if (ha->flags.online) { 3257 if (ha->flags.online) {
3256 ha->flags.online = 0; 3258 ha->flags.online = 0;
@@ -3265,6 +3267,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3265 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 3267 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
3266 atomic_set(&ha->loop_state, LOOP_DOWN); 3268 atomic_set(&ha->loop_state, LOOP_DOWN);
3267 qla2x00_mark_all_devices_lost(ha, 0); 3269 qla2x00_mark_all_devices_lost(ha, 0);
3270 list_for_each_entry(vha, &ha->vp_list, vp_list)
3271 qla2x00_mark_all_devices_lost(vha, 0);
3268 } else { 3272 } else {
3269 if (!atomic_read(&ha->loop_down_timer)) 3273 if (!atomic_read(&ha->loop_down_timer))
3270 atomic_set(&ha->loop_down_timer, 3274 atomic_set(&ha->loop_down_timer,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 874d802edb7d..45a3b93eed57 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -879,11 +879,12 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t sense_len)
879 sp->request_sense_ptr += sense_len; 879 sp->request_sense_ptr += sense_len;
880 sp->request_sense_length -= sense_len; 880 sp->request_sense_length -= sense_len;
881 if (sp->request_sense_length != 0) 881 if (sp->request_sense_length != 0)
882 sp->ha->status_srb = sp; 882 sp->fcport->ha->status_srb = sp;
883 883
884 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " 884 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) "
885 "cmd=%p pid=%ld\n", __func__, sp->ha->host_no, cp->device->channel, 885 "cmd=%p pid=%ld\n", __func__, sp->fcport->ha->host_no,
886 cp->device->id, cp->device->lun, cp, cp->serial_number)); 886 cp->device->channel, cp->device->id, cp->device->lun, cp,
887 cp->serial_number));
887 if (sense_len) 888 if (sense_len)
888 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, 889 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
889 CMD_ACTUAL_SNSLEN(cp))); 890 CMD_ACTUAL_SNSLEN(cp)));
@@ -1184,9 +1185,8 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1184 atomic_read(&fcport->state))); 1185 atomic_read(&fcport->state)));
1185 1186
1186 cp->result = DID_BUS_BUSY << 16; 1187 cp->result = DID_BUS_BUSY << 16;
1187 if (atomic_read(&fcport->state) == FCS_ONLINE) { 1188 if (atomic_read(&fcport->state) == FCS_ONLINE)
1188 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1189 qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1);
1189 }
1190 break; 1190 break;
1191 1191
1192 case CS_RESET: 1192 case CS_RESET:
@@ -1229,7 +1229,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1229 1229
1230 /* Check to see if logout occurred. */ 1230 /* Check to see if logout occurred. */
1231 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) 1231 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT))
1232 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1232 qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1);
1233 break; 1233 break;
1234 1234
1235 default: 1235 default:
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index bc90d6b8d0a0..813bc7784c0a 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2686,7 +2686,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha,
2686 set_bit(VP_IDX_ACQUIRED, &vha->vp_flags); 2686 set_bit(VP_IDX_ACQUIRED, &vha->vp_flags);
2687 set_bit(VP_DPC_NEEDED, &ha->dpc_flags); 2687 set_bit(VP_DPC_NEEDED, &ha->dpc_flags);
2688 2688
2689 wake_up_process(ha->dpc_thread); 2689 qla2xxx_wake_dpc(ha);
2690 } 2690 }
2691} 2691}
2692 2692
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 50baf6a1d67c..93560cd72784 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -6,7 +6,6 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <linux/version.h>
10#include <linux/moduleparam.h> 9#include <linux/moduleparam.h>
11#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
12#include <linux/smp_lock.h> 11#include <linux/smp_lock.h>
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 7c8af7ed2a5d..26afe44265c7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -780,7 +780,8 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha, unsigned int t,
780 sp = pha->outstanding_cmds[cnt]; 780 sp = pha->outstanding_cmds[cnt];
781 if (!sp) 781 if (!sp)
782 continue; 782 continue;
783 if (ha->vp_idx != sp->ha->vp_idx) 783
784 if (ha->vp_idx != sp->fcport->ha->vp_idx)
784 continue; 785 continue;
785 match = 0; 786 match = 0;
786 switch (type) { 787 switch (type) {
@@ -1080,9 +1081,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
1080 sp = ha->outstanding_cmds[cnt]; 1081 sp = ha->outstanding_cmds[cnt];
1081 if (sp) { 1082 if (sp) {
1082 ha->outstanding_cmds[cnt] = NULL; 1083 ha->outstanding_cmds[cnt] = NULL;
1083 sp->flags = 0;
1084 sp->cmd->result = res; 1084 sp->cmd->result = res;
1085 sp->cmd->host_scribble = (unsigned char *)NULL;
1086 qla2x00_sp_compl(ha, sp); 1085 qla2x00_sp_compl(ha, sp);
1087 } 1086 }
1088 } 1087 }
@@ -1776,10 +1775,15 @@ probe_out:
1776static void 1775static void
1777qla2x00_remove_one(struct pci_dev *pdev) 1776qla2x00_remove_one(struct pci_dev *pdev)
1778{ 1777{
1779 scsi_qla_host_t *ha; 1778 scsi_qla_host_t *ha, *vha, *temp;
1780 1779
1781 ha = pci_get_drvdata(pdev); 1780 ha = pci_get_drvdata(pdev);
1782 1781
1782 list_for_each_entry_safe(vha, temp, &ha->vp_list, vp_list)
1783 fc_vport_terminate(vha->fc_vport);
1784
1785 set_bit(UNLOADING, &ha->dpc_flags);
1786
1783 qla2x00_dfs_remove(ha); 1787 qla2x00_dfs_remove(ha);
1784 1788
1785 qla84xx_put_chip(ha); 1789 qla84xx_put_chip(ha);
@@ -2451,8 +2455,10 @@ qla2x00_do_dpc(void *data)
2451void 2455void
2452qla2xxx_wake_dpc(scsi_qla_host_t *ha) 2456qla2xxx_wake_dpc(scsi_qla_host_t *ha)
2453{ 2457{
2454 if (ha->dpc_thread) 2458 struct task_struct *t = ha->dpc_thread;
2455 wake_up_process(ha->dpc_thread); 2459
2460 if (!test_bit(UNLOADING, &ha->dpc_flags) && t)
2461 wake_up_process(t);
2456} 2462}
2457 2463
2458/* 2464/*
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 676c390db354..4160e4caa7b9 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.02.01-k6" 10#define QLA2XXX_VERSION "8.02.01-k7"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 2 13#define QLA_DRIVER_MINOR_VER 2
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index d831a2beff39..87ab2443e66d 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1165,15 +1165,19 @@ EXPORT_SYMBOL(ssb_dma_translation);
1165 1165
1166int ssb_dma_set_mask(struct ssb_device *dev, u64 mask) 1166int ssb_dma_set_mask(struct ssb_device *dev, u64 mask)
1167{ 1167{
1168#ifdef CONFIG_SSB_PCIHOST
1168 int err; 1169 int err;
1170#endif
1169 1171
1170 switch (dev->bus->bustype) { 1172 switch (dev->bus->bustype) {
1171 case SSB_BUSTYPE_PCI: 1173 case SSB_BUSTYPE_PCI:
1174#ifdef CONFIG_SSB_PCIHOST
1172 err = pci_set_dma_mask(dev->bus->host_pci, mask); 1175 err = pci_set_dma_mask(dev->bus->host_pci, mask);
1173 if (err) 1176 if (err)
1174 return err; 1177 return err;
1175 err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask); 1178 err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask);
1176 return err; 1179 return err;
1180#endif
1177 case SSB_BUSTYPE_SSB: 1181 case SSB_BUSTYPE_SSB:
1178 return dma_set_mask(dev->dev, mask); 1182 return dma_set_mask(dev->dev, mask);
1179 default: 1183 default:
@@ -1188,6 +1192,7 @@ void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
1188{ 1192{
1189 switch (dev->bus->bustype) { 1193 switch (dev->bus->bustype) {
1190 case SSB_BUSTYPE_PCI: 1194 case SSB_BUSTYPE_PCI:
1195#ifdef CONFIG_SSB_PCIHOST
1191 if (gfp_flags & GFP_DMA) { 1196 if (gfp_flags & GFP_DMA) {
1192 /* Workaround: The PCI API does not support passing 1197 /* Workaround: The PCI API does not support passing
1193 * a GFP flag. */ 1198 * a GFP flag. */
@@ -1195,6 +1200,7 @@ void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
1195 size, dma_handle, gfp_flags); 1200 size, dma_handle, gfp_flags);
1196 } 1201 }
1197 return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle); 1202 return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle);
1203#endif
1198 case SSB_BUSTYPE_SSB: 1204 case SSB_BUSTYPE_SSB:
1199 return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags); 1205 return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags);
1200 default: 1206 default:
@@ -1210,6 +1216,7 @@ void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
1210{ 1216{
1211 switch (dev->bus->bustype) { 1217 switch (dev->bus->bustype) {
1212 case SSB_BUSTYPE_PCI: 1218 case SSB_BUSTYPE_PCI:
1219#ifdef CONFIG_SSB_PCIHOST
1213 if (gfp_flags & GFP_DMA) { 1220 if (gfp_flags & GFP_DMA) {
1214 /* Workaround: The PCI API does not support passing 1221 /* Workaround: The PCI API does not support passing
1215 * a GFP flag. */ 1222 * a GFP flag. */
@@ -1220,6 +1227,7 @@ void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
1220 pci_free_consistent(dev->bus->host_pci, size, 1227 pci_free_consistent(dev->bus->host_pci, size,
1221 vaddr, dma_handle); 1228 vaddr, dma_handle);
1222 return; 1229 return;
1230#endif
1223 case SSB_BUSTYPE_SSB: 1231 case SSB_BUSTYPE_SSB:
1224 dma_free_coherent(dev->dev, size, vaddr, dma_handle); 1232 dma_free_coherent(dev->dev, size, vaddr, dma_handle);
1225 return; 1233 return;
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 2e9079df26b3..4190be64917f 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -33,6 +33,19 @@ config UIO_PDRV
33 33
34 If you don't know what to do here, say N. 34 If you don't know what to do here, say N.
35 35
36config UIO_PDRV_GENIRQ
37 tristate "Userspace I/O platform driver with generic IRQ handling"
38 help
39 Platform driver for Userspace I/O devices, including generic
40 interrupt handling code. Shared interrupts are not supported.
41
42 This kernel driver requires that the matching userspace driver
43 handles interrupts in a special way. Userspace is responsible
44 for acknowledging the hardware device if needed, and re-enabling
45 interrupts in the interrupt controller using the write() syscall.
46
47 If you don't know what to do here, say N.
48
36config UIO_SMX 49config UIO_SMX
37 tristate "SMX cryptengine UIO interface" 50 tristate "SMX cryptengine UIO interface"
38 default n 51 default n
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index e00ce0def1a0..8667bbdef904 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -1,4 +1,5 @@
1obj-$(CONFIG_UIO) += uio.o 1obj-$(CONFIG_UIO) += uio.o
2obj-$(CONFIG_UIO_CIF) += uio_cif.o 2obj-$(CONFIG_UIO_CIF) += uio_cif.o
3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o
4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
4obj-$(CONFIG_UIO_SMX) += uio_smx.o 5obj-$(CONFIG_UIO_SMX) += uio_smx.o
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c
index 5d0d2e85d982..0b4ef39cd85d 100644
--- a/drivers/uio/uio_pdrv.c
+++ b/drivers/uio/uio_pdrv.c
@@ -88,6 +88,8 @@ static int uio_pdrv_remove(struct platform_device *pdev)
88 88
89 uio_unregister_device(pdata->uioinfo); 89 uio_unregister_device(pdata->uioinfo);
90 90
91 kfree(pdata);
92
91 return 0; 93 return 0;
92} 94}
93 95
@@ -114,5 +116,5 @@ module_exit(uio_pdrv_exit);
114 116
115MODULE_AUTHOR("Uwe Kleine-Koenig"); 117MODULE_AUTHOR("Uwe Kleine-Koenig");
116MODULE_DESCRIPTION("Userspace I/O platform driver"); 118MODULE_DESCRIPTION("Userspace I/O platform driver");
117MODULE_LICENSE("GPL"); 119MODULE_LICENSE("GPL v2");
118MODULE_ALIAS("platform:" DRIVER_NAME); 120MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
new file mode 100644
index 000000000000..1f82c83a92ae
--- /dev/null
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -0,0 +1,188 @@
1/*
2 * drivers/uio/uio_pdrv_genirq.c
3 *
4 * Userspace I/O platform driver with generic IRQ handling code.
5 *
6 * Copyright (C) 2008 Magnus Damm
7 *
8 * Based on uio_pdrv.c by Uwe Kleine-Koenig,
9 * Copyright (C) 2008 by Digi International Inc.
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
15 */
16
17#include <linux/platform_device.h>
18#include <linux/uio_driver.h>
19#include <linux/spinlock.h>
20#include <linux/bitops.h>
21#include <linux/interrupt.h>
22#include <linux/stringify.h>
23
24#define DRIVER_NAME "uio_pdrv_genirq"
25
26struct uio_pdrv_genirq_platdata {
27 struct uio_info *uioinfo;
28 spinlock_t lock;
29 unsigned long flags;
30};
31
32static irqreturn_t uio_pdrv_genirq_handler(int irq, struct uio_info *dev_info)
33{
34 struct uio_pdrv_genirq_platdata *priv = dev_info->priv;
35
36 /* Just disable the interrupt in the interrupt controller, and
37 * remember the state so we can allow user space to enable it later.
38 */
39
40 if (!test_and_set_bit(0, &priv->flags))
41 disable_irq_nosync(irq);
42
43 return IRQ_HANDLED;
44}
45
46static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)
47{
48 struct uio_pdrv_genirq_platdata *priv = dev_info->priv;
49 unsigned long flags;
50
51 /* Allow user space to enable and disable the interrupt
52 * in the interrupt controller, but keep track of the
53 * state to prevent per-irq depth damage.
54 *
55 * Serialize this operation to support multiple tasks.
56 */
57
58 spin_lock_irqsave(&priv->lock, flags);
59 if (irq_on) {
60 if (test_and_clear_bit(0, &priv->flags))
61 enable_irq(dev_info->irq);
62 } else {
63 if (!test_and_set_bit(0, &priv->flags))
64 disable_irq(dev_info->irq);
65 }
66 spin_unlock_irqrestore(&priv->lock, flags);
67
68 return 0;
69}
70
71static int uio_pdrv_genirq_probe(struct platform_device *pdev)
72{
73 struct uio_info *uioinfo = pdev->dev.platform_data;
74 struct uio_pdrv_genirq_platdata *priv;
75 struct uio_mem *uiomem;
76 int ret = -EINVAL;
77 int i;
78
79 if (!uioinfo || !uioinfo->name || !uioinfo->version) {
80 dev_err(&pdev->dev, "missing platform_data\n");
81 goto bad0;
82 }
83
84 if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) {
85 dev_err(&pdev->dev, "interrupt configuration error\n");
86 goto bad0;
87 }
88
89 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
90 if (!priv) {
91 ret = -ENOMEM;
92 dev_err(&pdev->dev, "unable to kmalloc\n");
93 goto bad0;
94 }
95
96 priv->uioinfo = uioinfo;
97 spin_lock_init(&priv->lock);
98 priv->flags = 0; /* interrupt is enabled to begin with */
99
100 uiomem = &uioinfo->mem[0];
101
102 for (i = 0; i < pdev->num_resources; ++i) {
103 struct resource *r = &pdev->resource[i];
104
105 if (r->flags != IORESOURCE_MEM)
106 continue;
107
108 if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) {
109 dev_warn(&pdev->dev, "device has more than "
110 __stringify(MAX_UIO_MAPS)
111 " I/O memory resources.\n");
112 break;
113 }
114
115 uiomem->memtype = UIO_MEM_PHYS;
116 uiomem->addr = r->start;
117 uiomem->size = r->end - r->start + 1;
118 ++uiomem;
119 }
120
121 while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) {
122 uiomem->size = 0;
123 ++uiomem;
124 }
125
126 /* This driver requires no hardware specific kernel code to handle
127 * interrupts. Instead, the interrupt handler simply disables the
128 * interrupt in the interrupt controller. User space is responsible
129 * for performing hardware specific acknowledge and re-enabling of
130 * the interrupt in the interrupt controller.
131 *
132 * Interrupt sharing is not supported.
133 */
134
135 uioinfo->irq_flags = IRQF_DISABLED;
136 uioinfo->handler = uio_pdrv_genirq_handler;
137 uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol;
138 uioinfo->priv = priv;
139
140 ret = uio_register_device(&pdev->dev, priv->uioinfo);
141 if (ret) {
142 dev_err(&pdev->dev, "unable to register uio device\n");
143 goto bad1;
144 }
145
146 platform_set_drvdata(pdev, priv);
147 return 0;
148 bad1:
149 kfree(priv);
150 bad0:
151 return ret;
152}
153
154static int uio_pdrv_genirq_remove(struct platform_device *pdev)
155{
156 struct uio_pdrv_genirq_platdata *priv = platform_get_drvdata(pdev);
157
158 uio_unregister_device(priv->uioinfo);
159 kfree(priv);
160 return 0;
161}
162
163static struct platform_driver uio_pdrv_genirq = {
164 .probe = uio_pdrv_genirq_probe,
165 .remove = uio_pdrv_genirq_remove,
166 .driver = {
167 .name = DRIVER_NAME,
168 .owner = THIS_MODULE,
169 },
170};
171
172static int __init uio_pdrv_genirq_init(void)
173{
174 return platform_driver_register(&uio_pdrv_genirq);
175}
176
177static void __exit uio_pdrv_genirq_exit(void)
178{
179 platform_driver_unregister(&uio_pdrv_genirq);
180}
181
182module_init(uio_pdrv_genirq_init);
183module_exit(uio_pdrv_genirq_exit);
184
185MODULE_AUTHOR("Magnus Damm");
186MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling");
187MODULE_LICENSE("GPL v2");
188MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index cb01b5106efd..b6483dd98acc 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -64,7 +64,6 @@
64#include <linux/ctype.h> 64#include <linux/ctype.h>
65#include <linux/sched.h> 65#include <linux/sched.h>
66#include <linux/kthread.h> 66#include <linux/kthread.h>
67#include <linux/version.h>
68#include <linux/mutex.h> 67#include <linux/mutex.h>
69#include <linux/freezer.h> 68#include <linux/freezer.h>
70 69
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index efc4373ededb..c257453fa9de 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -589,8 +589,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
589 tasklet_schedule(&acm->urb_task); 589 tasklet_schedule(&acm->urb_task);
590 590
591done: 591done:
592err_out:
593 mutex_unlock(&acm->mutex); 592 mutex_unlock(&acm->mutex);
593err_out:
594 mutex_unlock(&open_mutex); 594 mutex_unlock(&open_mutex);
595 return rv; 595 return rv;
596 596
@@ -1362,6 +1362,9 @@ static struct usb_device_id acm_ids[] = {
1362 { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ 1362 { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */
1363 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1363 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1364 }, 1364 },
1365 { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */
1366 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1367 },
1365 1368
1366 /* control interfaces with various AT-command sets */ 1369 /* control interfaces with various AT-command sets */
1367 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 1370 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2be37fe466f2..5a7fa6f09958 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -230,6 +230,13 @@ static int usb_probe_interface(struct device *dev)
230 */ 230 */
231 intf->pm_usage_cnt = !(driver->supports_autosuspend); 231 intf->pm_usage_cnt = !(driver->supports_autosuspend);
232 232
233 /* Carry out a deferred switch to altsetting 0 */
234 if (intf->needs_altsetting0) {
235 usb_set_interface(udev, intf->altsetting[0].
236 desc.bInterfaceNumber, 0);
237 intf->needs_altsetting0 = 0;
238 }
239
233 error = driver->probe(intf, id); 240 error = driver->probe(intf, id);
234 if (error) { 241 if (error) {
235 mark_quiesced(intf); 242 mark_quiesced(intf);
@@ -266,8 +273,17 @@ static int usb_unbind_interface(struct device *dev)
266 273
267 driver->disconnect(intf); 274 driver->disconnect(intf);
268 275
269 /* reset other interface state */ 276 /* Reset other interface state.
270 usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); 277 * We cannot do a Set-Interface if the device is suspended or
278 * if it is prepared for a system sleep (since installing a new
279 * altsetting means creating new endpoint device entries).
280 * When either of these happens, defer the Set-Interface.
281 */
282 if (!error && intf->dev.power.status == DPM_ON)
283 usb_set_interface(udev, intf->altsetting[0].
284 desc.bInterfaceNumber, 0);
285 else
286 intf->needs_altsetting0 = 1;
271 usb_set_intfdata(intf, NULL); 287 usb_set_intfdata(intf, NULL);
272 288
273 intf->condition = USB_INTERFACE_UNBOUND; 289 intf->condition = USB_INTERFACE_UNBOUND;
@@ -798,7 +814,8 @@ void usb_forced_unbind_intf(struct usb_interface *intf)
798 * The caller must hold @intf's device's lock, but not its pm_mutex 814 * The caller must hold @intf's device's lock, but not its pm_mutex
799 * and not @intf->dev.sem. 815 * and not @intf->dev.sem.
800 * 816 *
801 * FIXME: The caller must block system sleep transitions. 817 * Note: Rebinds will be skipped if a system sleep transition is in
818 * progress and the PM "complete" callback hasn't occurred yet.
802 */ 819 */
803void usb_rebind_intf(struct usb_interface *intf) 820void usb_rebind_intf(struct usb_interface *intf)
804{ 821{
@@ -814,10 +831,12 @@ void usb_rebind_intf(struct usb_interface *intf)
814 } 831 }
815 832
816 /* Try to rebind the interface */ 833 /* Try to rebind the interface */
817 intf->needs_binding = 0; 834 if (intf->dev.power.status == DPM_ON) {
818 rc = device_attach(&intf->dev); 835 intf->needs_binding = 0;
819 if (rc < 0) 836 rc = device_attach(&intf->dev);
820 dev_warn(&intf->dev, "rebind failed: %d\n", rc); 837 if (rc < 0)
838 dev_warn(&intf->dev, "rebind failed: %d\n", rc);
839 }
821} 840}
822 841
823#ifdef CONFIG_PM 842#ifdef CONFIG_PM
@@ -829,7 +848,6 @@ void usb_rebind_intf(struct usb_interface *intf)
829 * or rebind interfaces that have been unbound, according to @action. 848 * or rebind interfaces that have been unbound, according to @action.
830 * 849 *
831 * The caller must hold @udev's device lock. 850 * The caller must hold @udev's device lock.
832 * FIXME: For rebinds, the caller must block system sleep transitions.
833 */ 851 */
834static void do_unbind_rebind(struct usb_device *udev, int action) 852static void do_unbind_rebind(struct usb_device *udev, int action)
835{ 853{
@@ -851,22 +869,8 @@ static void do_unbind_rebind(struct usb_device *udev, int action)
851 } 869 }
852 break; 870 break;
853 case DO_REBIND: 871 case DO_REBIND:
854 if (intf->needs_binding) { 872 if (intf->needs_binding)
855
856 /* FIXME: The next line is needed because we are going to probe
857 * the interface, but as far as the PM core is concerned the
858 * interface is still suspended. The problem wouldn't exist
859 * if we could rebind the interface during the interface's own
860 * resume() call, but at the time the usb_device isn't locked!
861 *
862 * The real solution will be to carry this out during the device's
863 * complete() callback. Until that is implemented, we have to
864 * use this hack.
865 */
866// intf->dev.power.sleeping = 0;
867
868 usb_rebind_intf(intf); 873 usb_rebind_intf(intf);
869 }
870 break; 874 break;
871 } 875 }
872 } 876 }
@@ -926,14 +930,14 @@ static int usb_resume_device(struct usb_device *udev)
926} 930}
927 931
928/* Caller has locked intf's usb_device's pm mutex */ 932/* Caller has locked intf's usb_device's pm mutex */
929static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) 933static int usb_suspend_interface(struct usb_device *udev,
934 struct usb_interface *intf, pm_message_t msg)
930{ 935{
931 struct usb_driver *driver; 936 struct usb_driver *driver;
932 int status = 0; 937 int status = 0;
933 938
934 /* with no hardware, USB interfaces only use FREEZE and ON states */ 939 /* with no hardware, USB interfaces only use FREEZE and ON states */
935 if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 940 if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf))
936 !is_active(intf))
937 goto done; 941 goto done;
938 942
939 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ 943 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */
@@ -944,7 +948,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
944 status = driver->suspend(intf, msg); 948 status = driver->suspend(intf, msg);
945 if (status == 0) 949 if (status == 0)
946 mark_quiesced(intf); 950 mark_quiesced(intf);
947 else if (!interface_to_usbdev(intf)->auto_pm) 951 else if (!udev->auto_pm)
948 dev_err(&intf->dev, "%s error %d\n", 952 dev_err(&intf->dev, "%s error %d\n",
949 "suspend", status); 953 "suspend", status);
950 } else { 954 } else {
@@ -961,13 +965,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
961} 965}
962 966
963/* Caller has locked intf's usb_device's pm_mutex */ 967/* Caller has locked intf's usb_device's pm_mutex */
964static int usb_resume_interface(struct usb_interface *intf, int reset_resume) 968static int usb_resume_interface(struct usb_device *udev,
969 struct usb_interface *intf, int reset_resume)
965{ 970{
966 struct usb_driver *driver; 971 struct usb_driver *driver;
967 int status = 0; 972 int status = 0;
968 973
969 if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 974 if (udev->state == USB_STATE_NOTATTACHED || is_active(intf))
970 is_active(intf))
971 goto done; 975 goto done;
972 976
973 /* Don't let autoresume interfere with unbinding */ 977 /* Don't let autoresume interfere with unbinding */
@@ -975,8 +979,17 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
975 goto done; 979 goto done;
976 980
977 /* Can't resume it if it doesn't have a driver. */ 981 /* Can't resume it if it doesn't have a driver. */
978 if (intf->condition == USB_INTERFACE_UNBOUND) 982 if (intf->condition == USB_INTERFACE_UNBOUND) {
983
984 /* Carry out a deferred switch to altsetting 0 */
985 if (intf->needs_altsetting0 &&
986 intf->dev.power.status == DPM_ON) {
987 usb_set_interface(udev, intf->altsetting[0].
988 desc.bInterfaceNumber, 0);
989 intf->needs_altsetting0 = 0;
990 }
979 goto done; 991 goto done;
992 }
980 993
981 /* Don't resume if the interface is marked for rebinding */ 994 /* Don't resume if the interface is marked for rebinding */
982 if (intf->needs_binding) 995 if (intf->needs_binding)
@@ -1151,7 +1164,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1151 if (udev->actconfig) { 1164 if (udev->actconfig) {
1152 for (; i < udev->actconfig->desc.bNumInterfaces; i++) { 1165 for (; i < udev->actconfig->desc.bNumInterfaces; i++) {
1153 intf = udev->actconfig->interface[i]; 1166 intf = udev->actconfig->interface[i];
1154 status = usb_suspend_interface(intf, msg); 1167 status = usb_suspend_interface(udev, intf, msg);
1155 if (status != 0) 1168 if (status != 0)
1156 break; 1169 break;
1157 } 1170 }
@@ -1163,7 +1176,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1163 if (status != 0) { 1176 if (status != 0) {
1164 while (--i >= 0) { 1177 while (--i >= 0) {
1165 intf = udev->actconfig->interface[i]; 1178 intf = udev->actconfig->interface[i];
1166 usb_resume_interface(intf, 0); 1179 usb_resume_interface(udev, intf, 0);
1167 } 1180 }
1168 1181
1169 /* Try another autosuspend when the interfaces aren't busy */ 1182 /* Try another autosuspend when the interfaces aren't busy */
@@ -1276,7 +1289,7 @@ static int usb_resume_both(struct usb_device *udev)
1276 if (status == 0 && udev->actconfig) { 1289 if (status == 0 && udev->actconfig) {
1277 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1290 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1278 intf = udev->actconfig->interface[i]; 1291 intf = udev->actconfig->interface[i];
1279 usb_resume_interface(intf, udev->reset_resume); 1292 usb_resume_interface(udev, intf, udev->reset_resume);
1280 } 1293 }
1281 } 1294 }
1282 1295
@@ -1605,12 +1618,10 @@ int usb_external_resume_device(struct usb_device *udev)
1605 return status; 1618 return status;
1606} 1619}
1607 1620
1608static int usb_suspend(struct device *dev, pm_message_t message) 1621int usb_suspend(struct device *dev, pm_message_t message)
1609{ 1622{
1610 struct usb_device *udev; 1623 struct usb_device *udev;
1611 1624
1612 if (!is_usb_device(dev)) /* Ignore PM for interfaces */
1613 return 0;
1614 udev = to_usb_device(dev); 1625 udev = to_usb_device(dev);
1615 1626
1616 /* If udev is already suspended, we can skip this suspend and 1627 /* If udev is already suspended, we can skip this suspend and
@@ -1629,12 +1640,10 @@ static int usb_suspend(struct device *dev, pm_message_t message)
1629 return usb_external_suspend_device(udev, message); 1640 return usb_external_suspend_device(udev, message);
1630} 1641}
1631 1642
1632static int usb_resume(struct device *dev) 1643int usb_resume(struct device *dev)
1633{ 1644{
1634 struct usb_device *udev; 1645 struct usb_device *udev;
1635 1646
1636 if (!is_usb_device(dev)) /* Ignore PM for interfaces */
1637 return 0;
1638 udev = to_usb_device(dev); 1647 udev = to_usb_device(dev);
1639 1648
1640 /* If udev->skip_sys_resume is set then udev was already suspended 1649 /* If udev->skip_sys_resume is set then udev was already suspended
@@ -1646,17 +1655,10 @@ static int usb_resume(struct device *dev)
1646 return usb_external_resume_device(udev); 1655 return usb_external_resume_device(udev);
1647} 1656}
1648 1657
1649#else
1650
1651#define usb_suspend NULL
1652#define usb_resume NULL
1653
1654#endif /* CONFIG_PM */ 1658#endif /* CONFIG_PM */
1655 1659
1656struct bus_type usb_bus_type = { 1660struct bus_type usb_bus_type = {
1657 .name = "usb", 1661 .name = "usb",
1658 .match = usb_device_match, 1662 .match = usb_device_match,
1659 .uevent = usb_uevent, 1663 .uevent = usb_uevent,
1660 .suspend = usb_suspend,
1661 .resume = usb_resume,
1662}; 1664};
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index f7bfd72ef115..8abd4e59bf4a 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -924,15 +924,6 @@ static int register_root_hub(struct usb_hcd *hcd)
924 return retval; 924 return retval;
925} 925}
926 926
927void usb_enable_root_hub_irq (struct usb_bus *bus)
928{
929 struct usb_hcd *hcd;
930
931 hcd = container_of (bus, struct usb_hcd, self);
932 if (hcd->driver->hub_irq_enable && hcd->state != HC_STATE_HALT)
933 hcd->driver->hub_irq_enable (hcd);
934}
935
936 927
937/*-------------------------------------------------------------------------*/ 928/*-------------------------------------------------------------------------*/
938 929
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 5b0b59b0d89b..e710ce04e228 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -212,8 +212,6 @@ struct hc_driver {
212 int (*bus_suspend)(struct usb_hcd *); 212 int (*bus_suspend)(struct usb_hcd *);
213 int (*bus_resume)(struct usb_hcd *); 213 int (*bus_resume)(struct usb_hcd *);
214 int (*start_port_reset)(struct usb_hcd *, unsigned port_num); 214 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
215 void (*hub_irq_enable)(struct usb_hcd *);
216 /* Needed only if port-change IRQs are level-triggered */
217 215
218 /* force handover of high-speed port to full-speed companion */ 216 /* force handover of high-speed port to full-speed companion */
219 void (*relinquish_port)(struct usb_hcd *, int); 217 void (*relinquish_port)(struct usb_hcd *, int);
@@ -379,8 +377,6 @@ extern struct list_head usb_bus_list;
379extern struct mutex usb_bus_list_lock; 377extern struct mutex usb_bus_list_lock;
380extern wait_queue_head_t usb_kill_urb_queue; 378extern wait_queue_head_t usb_kill_urb_queue;
381 379
382extern void usb_enable_root_hub_irq(struct usb_bus *bus);
383
384extern int usb_find_interface_driver(struct usb_device *dev, 380extern int usb_find_interface_driver(struct usb_device *dev,
385 struct usb_interface *interface); 381 struct usb_interface *interface);
386 382
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 107e1d25ddec..6a5cb018383d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2102,8 +2102,6 @@ int usb_port_resume(struct usb_device *udev)
2102 } 2102 }
2103 2103
2104 clear_bit(port1, hub->busy_bits); 2104 clear_bit(port1, hub->busy_bits);
2105 if (!hub->hdev->parent && !hub->busy_bits[0])
2106 usb_enable_root_hub_irq(hub->hdev->bus);
2107 2105
2108 status = check_port_resume_type(udev, 2106 status = check_port_resume_type(udev,
2109 hub, port1, status, portchange, portstatus); 2107 hub, port1, status, portchange, portstatus);
@@ -3081,11 +3079,6 @@ static void hub_events(void)
3081 } 3079 }
3082 } 3080 }
3083 3081
3084 /* If this is a root hub, tell the HCD it's okay to
3085 * re-enable port-change interrupts now. */
3086 if (!hdev->parent && !hub->busy_bits[0])
3087 usb_enable_root_hub_irq(hdev->bus);
3088
3089loop_autopm: 3082loop_autopm:
3090 /* Allow autosuspend if we're not going to run again */ 3083 /* Allow autosuspend if we're not going to run again */
3091 if (list_empty(&hub->event_list)) 3084 if (list_empty(&hub->event_list))
@@ -3311,8 +3304,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
3311 break; 3304 break;
3312 } 3305 }
3313 clear_bit(port1, parent_hub->busy_bits); 3306 clear_bit(port1, parent_hub->busy_bits);
3314 if (!parent_hdev->parent && !parent_hub->busy_bits[0])
3315 usb_enable_root_hub_irq(parent_hdev->bus);
3316 3307
3317 if (ret < 0) 3308 if (ret < 0)
3318 goto re_enumerate; 3309 goto re_enumerate;
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c0b1ae25ae2a..47111e88f791 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
601void usb_unlink_anchored_urbs(struct usb_anchor *anchor) 601void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
602{ 602{
603 struct urb *victim; 603 struct urb *victim;
604 unsigned long flags;
604 605
605 spin_lock_irq(&anchor->lock); 606 spin_lock_irqsave(&anchor->lock, flags);
606 while (!list_empty(&anchor->urb_list)) { 607 while (!list_empty(&anchor->urb_list)) {
607 victim = list_entry(anchor->urb_list.prev, struct urb, 608 victim = list_entry(anchor->urb_list.prev, struct urb,
608 anchor_list); 609 anchor_list);
610 usb_get_urb(victim);
611 spin_unlock_irqrestore(&anchor->lock, flags);
609 /* this will unanchor the URB */ 612 /* this will unanchor the URB */
610 usb_unlink_urb(victim); 613 usb_unlink_urb(victim);
614 usb_put_urb(victim);
615 spin_lock_irqsave(&anchor->lock, flags);
611 } 616 }
612 spin_unlock_irq(&anchor->lock); 617 spin_unlock_irqrestore(&anchor->lock, flags);
613} 618}
614EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); 619EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs);
615 620
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 84fcaa6a21ec..be1fa0723f2c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -219,12 +219,6 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
219} 219}
220#endif /* CONFIG_HOTPLUG */ 220#endif /* CONFIG_HOTPLUG */
221 221
222struct device_type usb_device_type = {
223 .name = "usb_device",
224 .release = usb_release_dev,
225 .uevent = usb_dev_uevent,
226};
227
228#ifdef CONFIG_PM 222#ifdef CONFIG_PM
229 223
230static int ksuspend_usb_init(void) 224static int ksuspend_usb_init(void)
@@ -244,13 +238,80 @@ static void ksuspend_usb_cleanup(void)
244 destroy_workqueue(ksuspend_usb_wq); 238 destroy_workqueue(ksuspend_usb_wq);
245} 239}
246 240
241/* USB device Power-Management thunks.
242 * There's no need to distinguish here between quiescing a USB device
243 * and powering it down; the generic_suspend() routine takes care of
244 * it by skipping the usb_port_suspend() call for a quiesce. And for
245 * USB interfaces there's no difference at all.
246 */
247
248static int usb_dev_prepare(struct device *dev)
249{
250 return 0; /* Implement eventually? */
251}
252
253static void usb_dev_complete(struct device *dev)
254{
255 /* Currently used only for rebinding interfaces */
256 usb_resume(dev); /* Implement eventually? */
257}
258
259static int usb_dev_suspend(struct device *dev)
260{
261 return usb_suspend(dev, PMSG_SUSPEND);
262}
263
264static int usb_dev_resume(struct device *dev)
265{
266 return usb_resume(dev);
267}
268
269static int usb_dev_freeze(struct device *dev)
270{
271 return usb_suspend(dev, PMSG_FREEZE);
272}
273
274static int usb_dev_thaw(struct device *dev)
275{
276 return usb_resume(dev);
277}
278
279static int usb_dev_poweroff(struct device *dev)
280{
281 return usb_suspend(dev, PMSG_HIBERNATE);
282}
283
284static int usb_dev_restore(struct device *dev)
285{
286 return usb_resume(dev);
287}
288
289static struct pm_ops usb_device_pm_ops = {
290 .prepare = usb_dev_prepare,
291 .complete = usb_dev_complete,
292 .suspend = usb_dev_suspend,
293 .resume = usb_dev_resume,
294 .freeze = usb_dev_freeze,
295 .thaw = usb_dev_thaw,
296 .poweroff = usb_dev_poweroff,
297 .restore = usb_dev_restore,
298};
299
247#else 300#else
248 301
249#define ksuspend_usb_init() 0 302#define ksuspend_usb_init() 0
250#define ksuspend_usb_cleanup() do {} while (0) 303#define ksuspend_usb_cleanup() do {} while (0)
304#define usb_device_pm_ops (*(struct pm_ops *)0)
251 305
252#endif /* CONFIG_PM */ 306#endif /* CONFIG_PM */
253 307
308struct device_type usb_device_type = {
309 .name = "usb_device",
310 .release = usb_release_dev,
311 .uevent = usb_dev_uevent,
312 .pm = &usb_device_pm_ops,
313};
314
254 315
255/* Returns 1 if @usb_bus is WUSB, 0 otherwise */ 316/* Returns 1 if @usb_bus is WUSB, 0 otherwise */
256static unsigned usb_bus_is_wusb(struct usb_bus *bus) 317static unsigned usb_bus_is_wusb(struct usb_bus *bus)
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index d9a6e16dbf84..9a1a45ac3add 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -41,6 +41,9 @@ extern void usb_host_cleanup(void);
41 41
42#ifdef CONFIG_PM 42#ifdef CONFIG_PM
43 43
44extern int usb_suspend(struct device *dev, pm_message_t msg);
45extern int usb_resume(struct device *dev);
46
44extern void usb_autosuspend_work(struct work_struct *work); 47extern void usb_autosuspend_work(struct work_struct *work);
45extern int usb_port_suspend(struct usb_device *dev); 48extern int usb_port_suspend(struct usb_device *dev);
46extern int usb_port_resume(struct usb_device *dev); 49extern int usb_port_resume(struct usb_device *dev);
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 1500e1b3c302..abf8192f89e8 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -44,7 +44,6 @@
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/pci.h> 45#include <linux/pci.h>
46#include <linux/kernel.h> 46#include <linux/kernel.h>
47#include <linux/version.h>
48#include <linux/delay.h> 47#include <linux/delay.h>
49#include <linux/ioport.h> 48#include <linux/ioport.h>
50#include <linux/sched.h> 49#include <linux/sched.h>
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index a28513ecbe5b..7cbc78a6853d 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1622,7 +1622,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1622 struct pxa_udc *udc = the_controller; 1622 struct pxa_udc *udc = the_controller;
1623 int retval; 1623 int retval;
1624 1624
1625 if (!driver || driver->speed != USB_SPEED_FULL || !driver->bind 1625 if (!driver || driver->speed < USB_SPEED_FULL || !driver->bind
1626 || !driver->disconnect || !driver->setup) 1626 || !driver->disconnect || !driver->setup)
1627 return -EINVAL; 1627 return -EINVAL;
1628 if (!udc) 1628 if (!udc)
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index 538807384592..29d13ebe7500 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -35,7 +35,6 @@
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/version.h>
39#include <linux/clk.h> 38#include <linux/clk.h>
40 39
41#include <linux/debugfs.h> 40#include <linux/debugfs.h>
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index d22a84f86a33..8017f1cf78e2 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
988 /* 988 /*
989 * write bank1 address twice to ensure the 90ns delay (time 989 * write bank1 address twice to ensure the 90ns delay (time
990 * between BANK0 write and the priv_read_copy() call is at 990 * between BANK0 write and the priv_read_copy() call is at
991 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 92ns) 991 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 109ns)
992 */ 992 */
993 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + 993 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
994 HC_MEMORY_REG); 994 HC_MEMORY_REG);
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 6db7a2889e66..4ed228a89943 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -260,7 +260,6 @@ static const struct hc_driver ohci_at91_hc_driver = {
260 */ 260 */
261 .hub_status_data = ohci_hub_status_data, 261 .hub_status_data = ohci_hub_status_data,
262 .hub_control = ohci_hub_control, 262 .hub_control = ohci_hub_control,
263 .hub_irq_enable = ohci_rhsc_enable,
264#ifdef CONFIG_PM 263#ifdef CONFIG_PM
265 .bus_suspend = ohci_bus_suspend, 264 .bus_suspend = ohci_bus_suspend,
266 .bus_resume = ohci_bus_resume, 265 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index c0948008fe3d..2ac4e022a13f 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -163,7 +163,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
163 */ 163 */
164 .hub_status_data = ohci_hub_status_data, 164 .hub_status_data = ohci_hub_status_data,
165 .hub_control = ohci_hub_control, 165 .hub_control = ohci_hub_control,
166 .hub_irq_enable = ohci_rhsc_enable,
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168 .bus_suspend = ohci_bus_suspend, 167 .bus_suspend = ohci_bus_suspend,
169 .bus_resume = ohci_bus_resume, 168 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index cb0b506f8259..fb3055f084b5 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -134,7 +134,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = {
134 .get_frame_number = ohci_get_frame, 134 .get_frame_number = ohci_get_frame,
135 .hub_status_data = ohci_hub_status_data, 135 .hub_status_data = ohci_hub_status_data,
136 .hub_control = ohci_hub_control, 136 .hub_control = ohci_hub_control,
137 .hub_irq_enable = ohci_rhsc_enable,
138#ifdef CONFIG_PM 137#ifdef CONFIG_PM
139 .bus_suspend = ohci_bus_suspend, 138 .bus_suspend = ohci_bus_suspend,
140 .bus_resume = ohci_bus_resume, 139 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 439beb784f3e..7ea9a7b31155 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -36,18 +36,6 @@
36 36
37/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
38 38
39/* hcd->hub_irq_enable() */
40static void ohci_rhsc_enable (struct usb_hcd *hcd)
41{
42 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
43
44 spin_lock_irq(&ohci->lock);
45 if (!ohci->autostop)
46 del_timer(&hcd->rh_timer); /* Prevent next poll */
47 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
48 spin_unlock_irq(&ohci->lock);
49}
50
51#define OHCI_SCHED_ENABLES \ 39#define OHCI_SCHED_ENABLES \
52 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) 40 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
53 41
@@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
374 int any_connected) 362 int any_connected)
375{ 363{
376 int poll_rh = 1; 364 int poll_rh = 1;
365 int rhsc;
377 366
367 rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC;
378 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 368 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
379 369
380 case OHCI_USB_OPER: 370 case OHCI_USB_OPER:
381 /* keep on polling until we know a device is connected 371 /* If no status changes are pending, enable status-change
382 * and RHSC is enabled */ 372 * interrupts.
373 */
374 if (!rhsc && !changed) {
375 rhsc = OHCI_INTR_RHSC;
376 ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
377 }
378
379 /* Keep on polling until we know a device is connected
380 * and RHSC is enabled, or until we autostop.
381 */
383 if (!ohci->autostop) { 382 if (!ohci->autostop) {
384 if (any_connected || 383 if (any_connected ||
385 !device_may_wakeup(&ohci_to_hcd(ohci) 384 !device_may_wakeup(&ohci_to_hcd(ohci)
386 ->self.root_hub->dev)) { 385 ->self.root_hub->dev)) {
387 if (ohci_readl(ohci, &ohci->regs->intrenable) & 386 if (rhsc)
388 OHCI_INTR_RHSC)
389 poll_rh = 0; 387 poll_rh = 0;
390 } else { 388 } else {
391 ohci->autostop = 1; 389 ohci->autostop = 1;
@@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
398 ohci->autostop = 0; 396 ohci->autostop = 0;
399 ohci->next_statechange = jiffies + 397 ohci->next_statechange = jiffies +
400 STATECHANGE_DELAY; 398 STATECHANGE_DELAY;
401 } else if (time_after_eq(jiffies, 399 } else if (rhsc && time_after_eq(jiffies,
402 ohci->next_statechange) 400 ohci->next_statechange)
403 && !ohci->ed_rm_list 401 && !ohci->ed_rm_list
404 && !(ohci->hc_control & 402 && !(ohci->hc_control &
405 OHCI_SCHED_ENABLES)) { 403 OHCI_SCHED_ENABLES)) {
406 ohci_rh_suspend(ohci, 1); 404 ohci_rh_suspend(ohci, 1);
405 poll_rh = 0;
407 } 406 }
408 } 407 }
409 break; 408 break;
@@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
417 else 416 else
418 usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); 417 usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
419 } else { 418 } else {
419 if (!rhsc && (ohci->autostop ||
420 ohci_to_hcd(ohci)->self.root_hub->
421 do_remote_wakeup))
422 ohci_writel(ohci, OHCI_INTR_RHSC,
423 &ohci->regs->intrenable);
424
420 /* everything is idle, no need for polling */ 425 /* everything is idle, no need for polling */
421 poll_rh = 0; 426 poll_rh = 0;
422 } 427 }
@@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci)
438static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 443static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
439 int any_connected) 444 int any_connected)
440{ 445{
441 int poll_rh = 1; 446 /* If RHSC is enabled, don't poll */
442
443 /* keep on polling until RHSC is enabled */
444 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) 447 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
445 poll_rh = 0; 448 return 0;
446 return poll_rh; 449
450 /* If no status changes are pending, enable status-change interrupts */
451 if (!changed) {
452 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
453 return 0;
454 }
455 return 1;
447} 456}
448 457
449#endif /* CONFIG_PM */ 458#endif /* CONFIG_PM */
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 9e31d440d115..de42283149c7 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
193 */ 193 */
194 .hub_status_data = ohci_hub_status_data, 194 .hub_status_data = ohci_hub_status_data,
195 .hub_control = ohci_hub_control, 195 .hub_control = ohci_hub_control,
196 .hub_irq_enable = ohci_rhsc_enable,
197#ifdef CONFIG_PM 196#ifdef CONFIG_PM
198 .bus_suspend = ohci_bus_suspend, 197 .bus_suspend = ohci_bus_suspend,
199 .bus_resume = ohci_bus_resume, 198 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 3d532b709670..1eb64d08b60a 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -470,7 +470,6 @@ static const struct hc_driver ohci_omap_hc_driver = {
470 */ 470 */
471 .hub_status_data = ohci_hub_status_data, 471 .hub_status_data = ohci_hub_status_data,
472 .hub_control = ohci_hub_control, 472 .hub_control = ohci_hub_control,
473 .hub_irq_enable = ohci_rhsc_enable,
474#ifdef CONFIG_PM 473#ifdef CONFIG_PM
475 .bus_suspend = ohci_bus_suspend, 474 .bus_suspend = ohci_bus_suspend,
476 .bus_resume = ohci_bus_resume, 475 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 083e8df0a817..a9c2ae36c7ad 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -459,7 +459,6 @@ static const struct hc_driver ohci_pci_hc_driver = {
459 */ 459 */
460 .hub_status_data = ohci_hub_status_data, 460 .hub_status_data = ohci_hub_status_data,
461 .hub_control = ohci_hub_control, 461 .hub_control = ohci_hub_control,
462 .hub_irq_enable = ohci_rhsc_enable,
463#ifdef CONFIG_PM 462#ifdef CONFIG_PM
464 .bus_suspend = ohci_bus_suspend, 463 .bus_suspend = ohci_bus_suspend,
465 .bus_resume = ohci_bus_resume, 464 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index b02cd0761977..658a2a978c32 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -277,7 +277,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = {
277 */ 277 */
278 .hub_status_data = ohci_hub_status_data, 278 .hub_status_data = ohci_hub_status_data,
279 .hub_control = ohci_hub_control, 279 .hub_control = ohci_hub_control,
280 .hub_irq_enable = ohci_rhsc_enable,
281#ifdef CONFIG_PM 280#ifdef CONFIG_PM
282 .bus_suspend = ohci_bus_suspend, 281 .bus_suspend = ohci_bus_suspend,
283 .bus_resume = ohci_bus_resume, 282 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index 605d59cba28e..28467e288a93 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = {
201 */ 201 */
202 .hub_status_data = ohci_hub_status_data, 202 .hub_status_data = ohci_hub_status_data,
203 .hub_control = ohci_hub_control, 203 .hub_control = ohci_hub_control,
204 .hub_irq_enable = ohci_rhsc_enable,
205#ifdef CONFIG_PM 204#ifdef CONFIG_PM
206 .bus_suspend = ohci_bus_suspend, 205 .bus_suspend = ohci_bus_suspend,
207 .bus_resume = ohci_bus_resume, 206 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 91e6e101a4cc..7ac53264ead3 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
72 */ 72 */
73 .hub_status_data = ohci_hub_status_data, 73 .hub_status_data = ohci_hub_status_data,
74 .hub_control = ohci_hub_control, 74 .hub_control = ohci_hub_control,
75 .hub_irq_enable = ohci_rhsc_enable,
76#ifdef CONFIG_PM 75#ifdef CONFIG_PM
77 .bus_suspend = ohci_bus_suspend, 76 .bus_suspend = ohci_bus_suspend,
78 .bus_resume = ohci_bus_resume, 77 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 523c30125577..cd3398b675b2 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
172 */ 172 */
173 .hub_status_data = ohci_hub_status_data, 173 .hub_status_data = ohci_hub_status_data,
174 .hub_control = ohci_hub_control, 174 .hub_control = ohci_hub_control,
175 .hub_irq_enable = ohci_rhsc_enable,
176#ifdef CONFIG_PM 175#ifdef CONFIG_PM
177 .bus_suspend = ohci_bus_suspend, 176 .bus_suspend = ohci_bus_suspend,
178 .bus_resume = ohci_bus_resume, 177 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 55c95647f008..2089d8a46c4b 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = {
68 .get_frame_number = ohci_get_frame, 68 .get_frame_number = ohci_get_frame,
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72 .start_port_reset = ohci_start_port_reset, 71 .start_port_reset = ohci_start_port_reset,
73#if defined(CONFIG_PM) 72#if defined(CONFIG_PM)
74 .bus_suspend = ohci_bus_suspend, 73 .bus_suspend = ohci_bus_suspend,
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 8c9c4849db6e..7f0f35c78185 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -298,7 +298,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
298 */ 298 */
299 .hub_status_data = ohci_hub_status_data, 299 .hub_status_data = ohci_hub_status_data,
300 .hub_control = ohci_hub_control, 300 .hub_control = ohci_hub_control,
301 .hub_irq_enable = ohci_rhsc_enable,
302#ifdef CONFIG_PM 301#ifdef CONFIG_PM
303 .bus_suspend = ohci_bus_suspend, 302 .bus_suspend = ohci_bus_suspend,
304 .bus_resume = ohci_bus_resume, 303 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 9e3dc4069e8b..f46af7a718d4 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
466 */ 466 */
467 .hub_status_data = ohci_s3c2410_hub_status_data, 467 .hub_status_data = ohci_s3c2410_hub_status_data,
468 .hub_control = ohci_s3c2410_hub_control, 468 .hub_control = ohci_s3c2410_hub_control,
469 .hub_irq_enable = ohci_rhsc_enable,
470#ifdef CONFIG_PM 469#ifdef CONFIG_PM
471 .bus_suspend = ohci_bus_suspend, 470 .bus_suspend = ohci_bus_suspend,
472 .bus_resume = ohci_bus_resume, 471 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 4626b002e670..e4bbe8e188e4 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
231 */ 231 */
232 .hub_status_data = ohci_hub_status_data, 232 .hub_status_data = ohci_hub_status_data,
233 .hub_control = ohci_hub_control, 233 .hub_control = ohci_hub_control,
234 .hub_irq_enable = ohci_rhsc_enable,
235#ifdef CONFIG_PM 234#ifdef CONFIG_PM
236 .bus_suspend = ohci_bus_suspend, 235 .bus_suspend = ohci_bus_suspend,
237 .bus_resume = ohci_bus_resume, 236 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
index e7ee607278fe..60f03cc7ec4f 100644
--- a/drivers/usb/host/ohci-sh.c
+++ b/drivers/usb/host/ohci-sh.c
@@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = {
68 */ 68 */
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72#ifdef CONFIG_PM 71#ifdef CONFIG_PM
73 .bus_suspend = ohci_bus_suspend, 72 .bus_suspend = ohci_bus_suspend,
74 .bus_resume = ohci_bus_resume, 73 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 21b164e4abeb..cff23637cfcc 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = {
75 */ 75 */
76 .hub_status_data = ohci_hub_status_data, 76 .hub_status_data = ohci_hub_status_data,
77 .hub_control = ohci_hub_control, 77 .hub_control = ohci_hub_control,
78 .hub_irq_enable = ohci_rhsc_enable,
79#ifdef CONFIG_PM 78#ifdef CONFIG_PM
80 .bus_suspend = ohci_bus_suspend, 79 .bus_suspend = ohci_bus_suspend,
81 .bus_resume = ohci_bus_resume, 80 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 3660c83d80af..23fd6a886bdd 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
81 81
82 .hub_status_data = ohci_hub_status_data, 82 .hub_status_data = ohci_hub_status_data,
83 .hub_control = ohci_hub_control, 83 .hub_control = ohci_hub_control,
84 .hub_irq_enable = ohci_rhsc_enable,
85#ifdef CONFIG_PM 84#ifdef CONFIG_PM
86 .bus_suspend = ohci_bus_suspend, 85 .bus_suspend = ohci_bus_suspend,
87 .bus_resume = ohci_bus_resume, 86 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 20ad3c48fcb2..228f2b070f2b 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num)
2934 return 0; 2934 return 0;
2935} 2935}
2936 2936
2937static void u132_hub_irq_enable(struct usb_hcd *hcd)
2938{
2939 struct u132 *u132 = hcd_to_u132(hcd);
2940 if (u132->going > 1) {
2941 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
2942 , u132->going);
2943 } else if (u132->going > 0)
2944 dev_err(&u132->platform_dev->dev, "device is being removed\n");
2945}
2946
2947 2937
2948#ifdef CONFIG_PM 2938#ifdef CONFIG_PM
2949static int u132_bus_suspend(struct usb_hcd *hcd) 2939static int u132_bus_suspend(struct usb_hcd *hcd)
@@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = {
2995 .bus_suspend = u132_bus_suspend, 2985 .bus_suspend = u132_bus_suspend,
2996 .bus_resume = u132_bus_resume, 2986 .bus_resume = u132_bus_resume,
2997 .start_port_reset = u132_start_port_reset, 2987 .start_port_reset = u132_start_port_reset,
2998 .hub_irq_enable = u132_hub_irq_enable,
2999}; 2988};
3000 2989
3001/* 2990/*
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index e6ca9979e3ae..a4ef77ef917d 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -19,7 +19,6 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/poll.h> 21#include <linux/poll.h>
22#include <linux/version.h>
23#include <linux/usb/iowarrior.h> 22#include <linux/usb/iowarrior.h>
24 23
25/* Version Information */ 24/* Version Information */
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index fbace41a7cba..69c34a58e205 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3270,6 +3270,7 @@ static struct usb_device_id sisusb_table [] = {
3270 { USB_DEVICE(0x0711, 0x0900) }, 3270 { USB_DEVICE(0x0711, 0x0900) },
3271 { USB_DEVICE(0x0711, 0x0901) }, 3271 { USB_DEVICE(0x0711, 0x0901) },
3272 { USB_DEVICE(0x0711, 0x0902) }, 3272 { USB_DEVICE(0x0711, 0x0902) },
3273 { USB_DEVICE(0x0711, 0x0918) },
3273 { USB_DEVICE(0x182d, 0x021c) }, 3274 { USB_DEVICE(0x182d, 0x021c) },
3274 { USB_DEVICE(0x182d, 0x0269) }, 3275 { USB_DEVICE(0x182d, 0x0269) },
3275 { } 3276 { }
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index faca4333f27a..a0017486ad4e 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -165,12 +165,11 @@ config USB_TUSB_OMAP_DMA
165 help 165 help
166 Enable DMA transfers on TUSB 6010 when OMAP DMA is available. 166 Enable DMA transfers on TUSB 6010 when OMAP DMA is available.
167 167
168config USB_MUSB_LOGLEVEL 168config USB_MUSB_DEBUG
169 depends on USB_MUSB_HDRC 169 depends on USB_MUSB_HDRC
170 int 'Logging Level (0 - none / 3 - annoying / ... )' 170 bool "Enable debugging messages"
171 default 0 171 default n
172 help 172 help
173 Set the logging level. 0 disables the debugging altogether, 173 This enables musb debugging. To set the logging level use the debug
174 although when USB_DEBUG is set the value is at least 1. 174 module parameter. Starting at level 3, per-transfer (urb, usb_request,
175 Starting at level 3, per-transfer (urb, usb_request, packet, 175 packet, or dma transfer) tracing may kick in.
176 or dma transfer) tracing may kick in.
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 88eb67de08ae..b6af0d687a73 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -64,23 +64,6 @@ endif
64 64
65# Debugging 65# Debugging
66 66
67MUSB_DEBUG:=$(CONFIG_USB_MUSB_LOGLEVEL) 67ifeq ($(CONFIG_USB_MUSB_DEBUG),y)
68 68 EXTRA_CFLAGS += -DDEBUG
69ifeq ("$(strip $(MUSB_DEBUG))","")
70 ifdef CONFIG_USB_DEBUG
71 MUSB_DEBUG:=1
72 else
73 MUSB_DEBUG:=0
74 endif
75endif 69endif
76
77ifneq ($(MUSB_DEBUG),0)
78 EXTRA_CFLAGS += -DDEBUG
79
80 ifeq ($(CONFIG_PROC_FS),y)
81 musb_hdrc-objs += musb_procfs.o
82 endif
83
84endif
85
86EXTRA_CFLAGS += -DMUSB_DEBUG=$(MUSB_DEBUG)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index d68ec6daf335..c5b8f0296fcf 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -114,23 +114,14 @@
114 114
115 115
116 116
117#if MUSB_DEBUG > 0 117unsigned debug;
118unsigned debug = MUSB_DEBUG; 118module_param(debug, uint, S_IRUGO | S_IWUSR);
119module_param(debug, uint, 0); 119MODULE_PARM_DESC(debug, "Debug message level. Default = 0");
120MODULE_PARM_DESC(debug, "initial debug message level");
121
122#define MUSB_VERSION_SUFFIX "/dbg"
123#endif
124 120
125#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" 121#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia"
126#define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" 122#define DRIVER_DESC "Inventra Dual-Role USB Controller Driver"
127 123
128#define MUSB_VERSION_BASE "6.0" 124#define MUSB_VERSION "6.0"
129
130#ifndef MUSB_VERSION_SUFFIX
131#define MUSB_VERSION_SUFFIX ""
132#endif
133#define MUSB_VERSION MUSB_VERSION_BASE MUSB_VERSION_SUFFIX
134 125
135#define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION 126#define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION
136 127
@@ -2037,6 +2028,8 @@ bad_config:
2037 musb->xceiv.state = OTG_STATE_A_IDLE; 2028 musb->xceiv.state = OTG_STATE_A_IDLE;
2038 2029
2039 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 2030 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
2031 if (status)
2032 goto fail;
2040 2033
2041 DBG(1, "%s mode, status %d, devctl %02x %c\n", 2034 DBG(1, "%s mode, status %d, devctl %02x %c\n",
2042 "HOST", status, 2035 "HOST", status,
@@ -2051,6 +2044,8 @@ bad_config:
2051 musb->xceiv.state = OTG_STATE_B_IDLE; 2044 musb->xceiv.state = OTG_STATE_B_IDLE;
2052 2045
2053 status = musb_gadget_setup(musb); 2046 status = musb_gadget_setup(musb);
2047 if (status)
2048 goto fail;
2054 2049
2055 DBG(1, "%s mode, status %d, dev%02x\n", 2050 DBG(1, "%s mode, status %d, dev%02x\n",
2056 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", 2051 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
@@ -2059,16 +2054,14 @@ bad_config:
2059 2054
2060 } 2055 }
2061 2056
2062 if (status == 0) 2057 return 0;
2063 musb_debug_create("driver/musb_hdrc", musb); 2058
2064 else {
2065fail: 2059fail:
2066 if (musb->clock) 2060 if (musb->clock)
2067 clk_put(musb->clock); 2061 clk_put(musb->clock);
2068 device_init_wakeup(dev, 0); 2062 device_init_wakeup(dev, 0);
2069 musb_free(musb); 2063 musb_free(musb);
2070 return status; 2064 return status;
2071 }
2072 2065
2073#ifdef CONFIG_SYSFS 2066#ifdef CONFIG_SYSFS
2074 status = device_create_file(dev, &dev_attr_mode); 2067 status = device_create_file(dev, &dev_attr_mode);
@@ -2131,7 +2124,6 @@ static int __devexit musb_remove(struct platform_device *pdev)
2131 * - OTG mode: both roles are deactivated (or never-activated) 2124 * - OTG mode: both roles are deactivated (or never-activated)
2132 */ 2125 */
2133 musb_shutdown(pdev); 2126 musb_shutdown(pdev);
2134 musb_debug_delete("driver/musb_hdrc", musb);
2135#ifdef CONFIG_USB_MUSB_HDRC_HCD 2127#ifdef CONFIG_USB_MUSB_HDRC_HCD
2136 if (musb->board_mode == MUSB_HOST) 2128 if (musb->board_mode == MUSB_HOST)
2137 usb_remove_hcd(musb_to_hcd(musb)); 2129 usb_remove_hcd(musb_to_hcd(musb));
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index eade46d81708..82227251931b 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -485,23 +485,4 @@ extern int musb_platform_get_vbus_status(struct musb *musb);
485extern int __init musb_platform_init(struct musb *musb); 485extern int __init musb_platform_init(struct musb *musb);
486extern int musb_platform_exit(struct musb *musb); 486extern int musb_platform_exit(struct musb *musb);
487 487
488/*-------------------------- ProcFS definitions ---------------------*/
489
490struct proc_dir_entry;
491
492#if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS)
493extern struct proc_dir_entry *musb_debug_create(char *name, struct musb *data);
494extern void musb_debug_delete(char *name, struct musb *data);
495
496#else
497static inline struct proc_dir_entry *
498musb_debug_create(char *name, struct musb *data)
499{
500 return NULL;
501}
502static inline void musb_debug_delete(char *name, struct musb *data)
503{
504}
505#endif
506
507#endif /* __MUSB_CORE_H__ */ 488#endif /* __MUSB_CORE_H__ */
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h
index 3bdb311e820d..4d2794441b15 100644
--- a/drivers/usb/musb/musb_debug.h
+++ b/drivers/usb/musb/musb_debug.h
@@ -48,11 +48,7 @@
48 __func__, __LINE__ , ## args); \ 48 __func__, __LINE__ , ## args); \
49 } } while (0) 49 } } while (0)
50 50
51#if MUSB_DEBUG > 0
52extern unsigned debug; 51extern unsigned debug;
53#else
54#define debug 0
55#endif
56 52
57static inline int _dbg_level(unsigned l) 53static inline int _dbg_level(unsigned l)
58{ 54{
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 48d7d3ccb243..a57652fff39c 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -476,6 +476,7 @@ static void ep0_rxstate(struct musb *musb)
476 return; 476 return;
477 musb->ackpend = 0; 477 musb->ackpend = 0;
478 } 478 }
479 musb_ep_select(musb->mregs, 0);
479 musb_writew(regs, MUSB_CSR0, tmp); 480 musb_writew(regs, MUSB_CSR0, tmp);
480} 481}
481 482
@@ -528,6 +529,7 @@ static void ep0_txstate(struct musb *musb)
528 } 529 }
529 530
530 /* send it out, triggering a "txpktrdy cleared" irq */ 531 /* send it out, triggering a "txpktrdy cleared" irq */
532 musb_ep_select(musb->mregs, 0);
531 musb_writew(regs, MUSB_CSR0, csr); 533 musb_writew(regs, MUSB_CSR0, csr);
532} 534}
533 535
diff --git a/drivers/usb/musb/musb_procfs.c b/drivers/usb/musb/musb_procfs.c
deleted file mode 100644
index 55e6b78bdccc..000000000000
--- a/drivers/usb/musb/musb_procfs.c
+++ /dev/null
@@ -1,830 +0,0 @@
1/*
2 * MUSB OTG driver debug support
3 *
4 * Copyright 2005 Mentor Graphics Corporation
5 * Copyright (C) 2005-2006 by Texas Instruments
6 * Copyright (C) 2006-2007 Nokia Corporation
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35#include <linux/kernel.h>
36#include <linux/proc_fs.h>
37#include <linux/seq_file.h>
38#include <linux/uaccess.h> /* FIXME remove procfs writes */
39#include <asm/arch/hardware.h>
40
41#include "musb_core.h"
42
43#include "davinci.h"
44
45#ifdef CONFIG_USB_MUSB_HDRC_HCD
46
47static int dump_qh(struct musb_qh *qh, char *buf, unsigned max)
48{
49 int count;
50 int tmp;
51 struct usb_host_endpoint *hep = qh->hep;
52 struct urb *urb;
53
54 count = snprintf(buf, max, " qh %p dev%d ep%d%s max%d\n",
55 qh, qh->dev->devnum, qh->epnum,
56 ({ char *s; switch (qh->type) {
57 case USB_ENDPOINT_XFER_BULK:
58 s = "-bulk"; break;
59 case USB_ENDPOINT_XFER_INT:
60 s = "-int"; break;
61 case USB_ENDPOINT_XFER_CONTROL:
62 s = ""; break;
63 default:
64 s = "iso"; break;
65 }; s; }),
66 qh->maxpacket);
67 if (count <= 0)
68 return 0;
69 buf += count;
70 max -= count;
71
72 list_for_each_entry(urb, &hep->urb_list, urb_list) {
73 tmp = snprintf(buf, max, "\t%s urb %p %d/%d\n",
74 usb_pipein(urb->pipe) ? "in" : "out",
75 urb, urb->actual_length,
76 urb->transfer_buffer_length);
77 if (tmp <= 0)
78 break;
79 tmp = min(tmp, (int)max);
80 count += tmp;
81 buf += tmp;
82 max -= tmp;
83 }
84 return count;
85}
86
87static int
88dump_queue(struct list_head *q, char *buf, unsigned max)
89{
90 int count = 0;
91 struct musb_qh *qh;
92
93 list_for_each_entry(qh, q, ring) {
94 int tmp;
95
96 tmp = dump_qh(qh, buf, max);
97 if (tmp <= 0)
98 break;
99 tmp = min(tmp, (int)max);
100 count += tmp;
101 buf += tmp;
102 max -= tmp;
103 }
104 return count;
105}
106
107#endif /* HCD */
108
109#ifdef CONFIG_USB_GADGET_MUSB_HDRC
110static int dump_ep(struct musb_ep *ep, char *buffer, unsigned max)
111{
112 char *buf = buffer;
113 int code = 0;
114 void __iomem *regs = ep->hw_ep->regs;
115 char *mode = "1buf";
116
117 if (ep->is_in) {
118 if (ep->hw_ep->tx_double_buffered)
119 mode = "2buf";
120 } else {
121 if (ep->hw_ep->rx_double_buffered)
122 mode = "2buf";
123 }
124
125 do {
126 struct usb_request *req;
127
128 code = snprintf(buf, max,
129 "\n%s (hw%d): %s%s, csr %04x maxp %04x\n",
130 ep->name, ep->current_epnum,
131 mode, ep->dma ? " dma" : "",
132 musb_readw(regs,
133 (ep->is_in || !ep->current_epnum)
134 ? MUSB_TXCSR
135 : MUSB_RXCSR),
136 musb_readw(regs, ep->is_in
137 ? MUSB_TXMAXP
138 : MUSB_RXMAXP)
139 );
140 if (code <= 0)
141 break;
142 code = min(code, (int) max);
143 buf += code;
144 max -= code;
145
146 if (is_cppi_enabled() && ep->current_epnum) {
147 unsigned cppi = ep->current_epnum - 1;
148 void __iomem *base = ep->musb->ctrl_base;
149 unsigned off1 = cppi << 2;
150 void __iomem *ram = base;
151 char tmp[16];
152
153 if (ep->is_in) {
154 ram += DAVINCI_TXCPPI_STATERAM_OFFSET(cppi);
155 tmp[0] = 0;
156 } else {
157 ram += DAVINCI_RXCPPI_STATERAM_OFFSET(cppi);
158 snprintf(tmp, sizeof tmp, "%d left, ",
159 musb_readl(base,
160 DAVINCI_RXCPPI_BUFCNT0_REG + off1));
161 }
162
163 code = snprintf(buf, max, "%cX DMA%d: %s"
164 "%08x %08x, %08x %08x; "
165 "%08x %08x %08x .. %08x\n",
166 ep->is_in ? 'T' : 'R',
167 ep->current_epnum - 1, tmp,
168 musb_readl(ram, 0 * 4),
169 musb_readl(ram, 1 * 4),
170 musb_readl(ram, 2 * 4),
171 musb_readl(ram, 3 * 4),
172 musb_readl(ram, 4 * 4),
173 musb_readl(ram, 5 * 4),
174 musb_readl(ram, 6 * 4),
175 musb_readl(ram, 7 * 4));
176 if (code <= 0)
177 break;
178 code = min(code, (int) max);
179 buf += code;
180 max -= code;
181 }
182
183 if (list_empty(&ep->req_list)) {
184 code = snprintf(buf, max, "\t(queue empty)\n");
185 if (code <= 0)
186 break;
187 code = min(code, (int) max);
188 buf += code;
189 max -= code;
190 break;
191 }
192 list_for_each_entry(req, &ep->req_list, list) {
193 code = snprintf(buf, max, "\treq %p, %s%s%d/%d\n",
194 req,
195 req->zero ? "zero, " : "",
196 req->short_not_ok ? "!short, " : "",
197 req->actual, req->length);
198 if (code <= 0)
199 break;
200 code = min(code, (int) max);
201 buf += code;
202 max -= code;
203 }
204 } while (0);
205 return buf - buffer;
206}
207#endif
208
209static int
210dump_end_info(struct musb *musb, u8 epnum, char *aBuffer, unsigned max)
211{
212 int code = 0;
213 char *buf = aBuffer;
214 struct musb_hw_ep *hw_ep = &musb->endpoints[epnum];
215
216 do {
217 musb_ep_select(musb->mregs, epnum);
218#ifdef CONFIG_USB_MUSB_HDRC_HCD
219 if (is_host_active(musb)) {
220 int dump_rx, dump_tx;
221 void __iomem *regs = hw_ep->regs;
222
223 /* TEMPORARY (!) until we have a real periodic
224 * schedule tree ...
225 */
226 if (!epnum) {
227 /* control is shared, uses RX queue
228 * but (mostly) shadowed tx registers
229 */
230 dump_tx = !list_empty(&musb->control);
231 dump_rx = 0;
232 } else if (hw_ep == musb->bulk_ep) {
233 dump_tx = !list_empty(&musb->out_bulk);
234 dump_rx = !list_empty(&musb->in_bulk);
235 } else if (musb->periodic[epnum]) {
236 struct usb_host_endpoint *hep;
237
238 hep = musb->periodic[epnum]->hep;
239 dump_rx = hep->desc.bEndpointAddress
240 & USB_ENDPOINT_DIR_MASK;
241 dump_tx = !dump_rx;
242 } else
243 break;
244 /* END TEMPORARY */
245
246
247 if (dump_rx) {
248 code = snprintf(buf, max,
249 "\nRX%d: %s rxcsr %04x interval %02x "
250 "max %04x type %02x; "
251 "dev %d hub %d port %d"
252 "\n",
253 epnum,
254 hw_ep->rx_double_buffered
255 ? "2buf" : "1buf",
256 musb_readw(regs, MUSB_RXCSR),
257 musb_readb(regs, MUSB_RXINTERVAL),
258 musb_readw(regs, MUSB_RXMAXP),
259 musb_readb(regs, MUSB_RXTYPE),
260 /* FIXME: assumes multipoint */
261 musb_readb(musb->mregs,
262 MUSB_BUSCTL_OFFSET(epnum,
263 MUSB_RXFUNCADDR)),
264 musb_readb(musb->mregs,
265 MUSB_BUSCTL_OFFSET(epnum,
266 MUSB_RXHUBADDR)),
267 musb_readb(musb->mregs,
268 MUSB_BUSCTL_OFFSET(epnum,
269 MUSB_RXHUBPORT))
270 );
271 if (code <= 0)
272 break;
273 code = min(code, (int) max);
274 buf += code;
275 max -= code;
276
277 if (is_cppi_enabled()
278 && epnum
279 && hw_ep->rx_channel) {
280 unsigned cppi = epnum - 1;
281 unsigned off1 = cppi << 2;
282 void __iomem *base;
283 void __iomem *ram;
284 char tmp[16];
285
286 base = musb->ctrl_base;
287 ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
288 cppi) + base;
289 snprintf(tmp, sizeof tmp, "%d left, ",
290 musb_readl(base,
291 DAVINCI_RXCPPI_BUFCNT0_REG
292 + off1));
293
294 code = snprintf(buf, max,
295 " rx dma%d: %s"
296 "%08x %08x, %08x %08x; "
297 "%08x %08x %08x .. %08x\n",
298 cppi, tmp,
299 musb_readl(ram, 0 * 4),
300 musb_readl(ram, 1 * 4),
301 musb_readl(ram, 2 * 4),
302 musb_readl(ram, 3 * 4),
303 musb_readl(ram, 4 * 4),
304 musb_readl(ram, 5 * 4),
305 musb_readl(ram, 6 * 4),
306 musb_readl(ram, 7 * 4));
307 if (code <= 0)
308 break;
309 code = min(code, (int) max);
310 buf += code;
311 max -= code;
312 }
313
314 if (hw_ep == musb->bulk_ep
315 && !list_empty(
316 &musb->in_bulk)) {
317 code = dump_queue(&musb->in_bulk,
318 buf, max);
319 if (code <= 0)
320 break;
321 code = min(code, (int) max);
322 buf += code;
323 max -= code;
324 } else if (musb->periodic[epnum]) {
325 code = dump_qh(musb->periodic[epnum],
326 buf, max);
327 if (code <= 0)
328 break;
329 code = min(code, (int) max);
330 buf += code;
331 max -= code;
332 }
333 }
334
335 if (dump_tx) {
336 code = snprintf(buf, max,
337 "\nTX%d: %s txcsr %04x interval %02x "
338 "max %04x type %02x; "
339 "dev %d hub %d port %d"
340 "\n",
341 epnum,
342 hw_ep->tx_double_buffered
343 ? "2buf" : "1buf",
344 musb_readw(regs, MUSB_TXCSR),
345 musb_readb(regs, MUSB_TXINTERVAL),
346 musb_readw(regs, MUSB_TXMAXP),
347 musb_readb(regs, MUSB_TXTYPE),
348 /* FIXME: assumes multipoint */
349 musb_readb(musb->mregs,
350 MUSB_BUSCTL_OFFSET(epnum,
351 MUSB_TXFUNCADDR)),
352 musb_readb(musb->mregs,
353 MUSB_BUSCTL_OFFSET(epnum,
354 MUSB_TXHUBADDR)),
355 musb_readb(musb->mregs,
356 MUSB_BUSCTL_OFFSET(epnum,
357 MUSB_TXHUBPORT))
358 );
359 if (code <= 0)
360 break;
361 code = min(code, (int) max);
362 buf += code;
363 max -= code;
364
365 if (is_cppi_enabled()
366 && epnum
367 && hw_ep->tx_channel) {
368 unsigned cppi = epnum - 1;
369 void __iomem *base;
370 void __iomem *ram;
371
372 base = musb->ctrl_base;
373 ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
374 cppi) + base;
375 code = snprintf(buf, max,
376 " tx dma%d: "
377 "%08x %08x, %08x %08x; "
378 "%08x %08x %08x .. %08x\n",
379 cppi,
380 musb_readl(ram, 0 * 4),
381 musb_readl(ram, 1 * 4),
382 musb_readl(ram, 2 * 4),
383 musb_readl(ram, 3 * 4),
384 musb_readl(ram, 4 * 4),
385 musb_readl(ram, 5 * 4),
386 musb_readl(ram, 6 * 4),
387 musb_readl(ram, 7 * 4));
388 if (code <= 0)
389 break;
390 code = min(code, (int) max);
391 buf += code;
392 max -= code;
393 }
394
395 if (hw_ep == musb->control_ep
396 && !list_empty(
397 &musb->control)) {
398 code = dump_queue(&musb->control,
399 buf, max);
400 if (code <= 0)
401 break;
402 code = min(code, (int) max);
403 buf += code;
404 max -= code;
405 } else if (hw_ep == musb->bulk_ep
406 && !list_empty(
407 &musb->out_bulk)) {
408 code = dump_queue(&musb->out_bulk,
409 buf, max);
410 if (code <= 0)
411 break;
412 code = min(code, (int) max);
413 buf += code;
414 max -= code;
415 } else if (musb->periodic[epnum]) {
416 code = dump_qh(musb->periodic[epnum],
417 buf, max);
418 if (code <= 0)
419 break;
420 code = min(code, (int) max);
421 buf += code;
422 max -= code;
423 }
424 }
425 }
426#endif
427#ifdef CONFIG_USB_GADGET_MUSB_HDRC
428 if (is_peripheral_active(musb)) {
429 code = 0;
430
431 if (hw_ep->ep_in.desc || !epnum) {
432 code = dump_ep(&hw_ep->ep_in, buf, max);
433 if (code <= 0)
434 break;
435 code = min(code, (int) max);
436 buf += code;
437 max -= code;
438 }
439 if (hw_ep->ep_out.desc) {
440 code = dump_ep(&hw_ep->ep_out, buf, max);
441 if (code <= 0)
442 break;
443 code = min(code, (int) max);
444 buf += code;
445 max -= code;
446 }
447 }
448#endif
449 } while (0);
450
451 return buf - aBuffer;
452}
453
454/* Dump the current status and compile options.
455 * @param musb the device driver instance
456 * @param buffer where to dump the status; it must be big enough to hold the
457 * result otherwise "BAD THINGS HAPPENS(TM)".
458 */
459static int dump_header_stats(struct musb *musb, char *buffer)
460{
461 int code, count = 0;
462 const void __iomem *mbase = musb->mregs;
463
464 *buffer = 0;
465 count = sprintf(buffer, "Status: %sHDRC, Mode=%s "
466 "(Power=%02x, DevCtl=%02x)\n",
467 (musb->is_multipoint ? "M" : ""), MUSB_MODE(musb),
468 musb_readb(mbase, MUSB_POWER),
469 musb_readb(mbase, MUSB_DEVCTL));
470 if (count <= 0)
471 return 0;
472 buffer += count;
473
474 code = sprintf(buffer, "OTG state: %s; %sactive\n",
475 otg_state_string(musb),
476 musb->is_active ? "" : "in");
477 if (code <= 0)
478 goto done;
479 buffer += code;
480 count += code;
481
482 code = sprintf(buffer,
483 "Options: "
484#ifdef CONFIG_MUSB_PIO_ONLY
485 "pio"
486#elif defined(CONFIG_USB_TI_CPPI_DMA)
487 "cppi-dma"
488#elif defined(CONFIG_USB_INVENTRA_DMA)
489 "musb-dma"
490#elif defined(CONFIG_USB_TUSB_OMAP_DMA)
491 "tusb-omap-dma"
492#else
493 "?dma?"
494#endif
495 ", "
496#ifdef CONFIG_USB_MUSB_OTG
497 "otg (peripheral+host)"
498#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
499 "peripheral"
500#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
501 "host"
502#endif
503 ", debug=%d [eps=%d]\n",
504 debug,
505 musb->nr_endpoints);
506 if (code <= 0)
507 goto done;
508 count += code;
509 buffer += code;
510
511#ifdef CONFIG_USB_GADGET_MUSB_HDRC
512 code = sprintf(buffer, "Peripheral address: %02x\n",
513 musb_readb(musb->ctrl_base, MUSB_FADDR));
514 if (code <= 0)
515 goto done;
516 buffer += code;
517 count += code;
518#endif
519
520#ifdef CONFIG_USB_MUSB_HDRC_HCD
521 code = sprintf(buffer, "Root port status: %08x\n",
522 musb->port1_status);
523 if (code <= 0)
524 goto done;
525 buffer += code;
526 count += code;
527#endif
528
529#ifdef CONFIG_ARCH_DAVINCI
530 code = sprintf(buffer,
531 "DaVinci: ctrl=%02x stat=%1x phy=%03x\n"
532 "\trndis=%05x auto=%04x intsrc=%08x intmsk=%08x"
533 "\n",
534 musb_readl(musb->ctrl_base, DAVINCI_USB_CTRL_REG),
535 musb_readl(musb->ctrl_base, DAVINCI_USB_STAT_REG),
536 __raw_readl((void __force __iomem *)
537 IO_ADDRESS(USBPHY_CTL_PADDR)),
538 musb_readl(musb->ctrl_base, DAVINCI_RNDIS_REG),
539 musb_readl(musb->ctrl_base, DAVINCI_AUTOREQ_REG),
540 musb_readl(musb->ctrl_base,
541 DAVINCI_USB_INT_SOURCE_REG),
542 musb_readl(musb->ctrl_base,
543 DAVINCI_USB_INT_MASK_REG));
544 if (code <= 0)
545 goto done;
546 count += code;
547 buffer += code;
548#endif /* DAVINCI */
549
550#ifdef CONFIG_USB_TUSB6010
551 code = sprintf(buffer,
552 "TUSB6010: devconf %08x, phy enable %08x drive %08x"
553 "\n\totg %03x timer %08x"
554 "\n\tprcm conf %08x mgmt %08x; int src %08x mask %08x"
555 "\n",
556 musb_readl(musb->ctrl_base, TUSB_DEV_CONF),
557 musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL_ENABLE),
558 musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL),
559 musb_readl(musb->ctrl_base, TUSB_DEV_OTG_STAT),
560 musb_readl(musb->ctrl_base, TUSB_DEV_OTG_TIMER),
561 musb_readl(musb->ctrl_base, TUSB_PRCM_CONF),
562 musb_readl(musb->ctrl_base, TUSB_PRCM_MNGMT),
563 musb_readl(musb->ctrl_base, TUSB_INT_SRC),
564 musb_readl(musb->ctrl_base, TUSB_INT_MASK));
565 if (code <= 0)
566 goto done;
567 count += code;
568 buffer += code;
569#endif /* DAVINCI */
570
571 if (is_cppi_enabled() && musb->dma_controller) {
572 code = sprintf(buffer,
573 "CPPI: txcr=%d txsrc=%01x txena=%01x; "
574 "rxcr=%d rxsrc=%01x rxena=%01x "
575 "\n",
576 musb_readl(musb->ctrl_base,
577 DAVINCI_TXCPPI_CTRL_REG),
578 musb_readl(musb->ctrl_base,
579 DAVINCI_TXCPPI_RAW_REG),
580 musb_readl(musb->ctrl_base,
581 DAVINCI_TXCPPI_INTENAB_REG),
582 musb_readl(musb->ctrl_base,
583 DAVINCI_RXCPPI_CTRL_REG),
584 musb_readl(musb->ctrl_base,
585 DAVINCI_RXCPPI_RAW_REG),
586 musb_readl(musb->ctrl_base,
587 DAVINCI_RXCPPI_INTENAB_REG));
588 if (code <= 0)
589 goto done;
590 count += code;
591 buffer += code;
592 }
593
594#ifdef CONFIG_USB_GADGET_MUSB_HDRC
595 if (is_peripheral_enabled(musb)) {
596 code = sprintf(buffer, "Gadget driver: %s\n",
597 musb->gadget_driver
598 ? musb->gadget_driver->driver.name
599 : "(none)");
600 if (code <= 0)
601 goto done;
602 count += code;
603 buffer += code;
604 }
605#endif
606
607done:
608 return count;
609}
610
611/* Write to ProcFS
612 *
613 * C soft-connect
614 * c soft-disconnect
615 * I enable HS
616 * i disable HS
617 * s stop session
618 * F force session (OTG-unfriendly)
619 * E rElinquish bus (OTG)
620 * H request host mode
621 * h cancel host request
622 * T start sending TEST_PACKET
623 * D<num> set/query the debug level
624 */
625static int musb_proc_write(struct file *file, const char __user *buffer,
626 unsigned long count, void *data)
627{
628 char cmd;
629 u8 reg;
630 struct musb *musb = (struct musb *)data;
631 void __iomem *mbase = musb->mregs;
632
633 /* MOD_INC_USE_COUNT; */
634
635 if (unlikely(copy_from_user(&cmd, buffer, 1)))
636 return -EFAULT;
637
638 switch (cmd) {
639 case 'C':
640 if (mbase) {
641 reg = musb_readb(mbase, MUSB_POWER)
642 | MUSB_POWER_SOFTCONN;
643 musb_writeb(mbase, MUSB_POWER, reg);
644 }
645 break;
646
647 case 'c':
648 if (mbase) {
649 reg = musb_readb(mbase, MUSB_POWER)
650 & ~MUSB_POWER_SOFTCONN;
651 musb_writeb(mbase, MUSB_POWER, reg);
652 }
653 break;
654
655 case 'I':
656 if (mbase) {
657 reg = musb_readb(mbase, MUSB_POWER)
658 | MUSB_POWER_HSENAB;
659 musb_writeb(mbase, MUSB_POWER, reg);
660 }
661 break;
662
663 case 'i':
664 if (mbase) {
665 reg = musb_readb(mbase, MUSB_POWER)
666 & ~MUSB_POWER_HSENAB;
667 musb_writeb(mbase, MUSB_POWER, reg);
668 }
669 break;
670
671 case 'F':
672 reg = musb_readb(mbase, MUSB_DEVCTL);
673 reg |= MUSB_DEVCTL_SESSION;
674 musb_writeb(mbase, MUSB_DEVCTL, reg);
675 break;
676
677 case 'H':
678 if (mbase) {
679 reg = musb_readb(mbase, MUSB_DEVCTL);
680 reg |= MUSB_DEVCTL_HR;
681 musb_writeb(mbase, MUSB_DEVCTL, reg);
682 /* MUSB_HST_MODE( ((struct musb*)data) ); */
683 /* WARNING("Host Mode\n"); */
684 }
685 break;
686
687 case 'h':
688 if (mbase) {
689 reg = musb_readb(mbase, MUSB_DEVCTL);
690 reg &= ~MUSB_DEVCTL_HR;
691 musb_writeb(mbase, MUSB_DEVCTL, reg);
692 }
693 break;
694
695 case 'T':
696 if (mbase) {
697 musb_load_testpacket(musb);
698 musb_writeb(mbase, MUSB_TESTMODE,
699 MUSB_TEST_PACKET);
700 }
701 break;
702
703#if (MUSB_DEBUG > 0)
704 /* set/read debug level */
705 case 'D':{
706 if (count > 1) {
707 char digits[8], *p = digits;
708 int i = 0, level = 0, sign = 1;
709 int len = min(count - 1, (unsigned long)8);
710
711 if (copy_from_user(&digits, &buffer[1], len))
712 return -EFAULT;
713
714 /* optional sign */
715 if (*p == '-') {
716 len -= 1;
717 sign = -sign;
718 p++;
719 }
720
721 /* read it */
722 while (i++ < len && *p > '0' && *p < '9') {
723 level = level * 10 + (*p - '0');
724 p++;
725 }
726
727 level *= sign;
728 DBG(1, "debug level %d\n", level);
729 debug = level;
730 }
731 }
732 break;
733
734
735 case '?':
736 INFO("?: you are seeing it\n");
737 INFO("C/c: soft connect enable/disable\n");
738 INFO("I/i: hispeed enable/disable\n");
739 INFO("F: force session start\n");
740 INFO("H: host mode\n");
741 INFO("T: start sending TEST_PACKET\n");
742 INFO("D: set/read dbug level\n");
743 break;
744#endif
745
746 default:
747 ERR("Command %c not implemented\n", cmd);
748 break;
749 }
750
751 musb_platform_try_idle(musb, 0);
752
753 return count;
754}
755
756static int musb_proc_read(char *page, char **start,
757 off_t off, int count, int *eof, void *data)
758{
759 char *buffer = page;
760 int code = 0;
761 unsigned long flags;
762 struct musb *musb = data;
763 unsigned epnum;
764
765 count -= off;
766 count -= 1; /* for NUL at end */
767 if (count <= 0)
768 return -EINVAL;
769
770 spin_lock_irqsave(&musb->lock, flags);
771
772 code = dump_header_stats(musb, buffer);
773 if (code > 0) {
774 buffer += code;
775 count -= code;
776 }
777
778 /* generate the report for the end points */
779 /* REVISIT ... not unless something's connected! */
780 for (epnum = 0; count >= 0 && epnum < musb->nr_endpoints;
781 epnum++) {
782 code = dump_end_info(musb, epnum, buffer, count);
783 if (code > 0) {
784 buffer += code;
785 count -= code;
786 }
787 }
788
789 musb_platform_try_idle(musb, 0);
790
791 spin_unlock_irqrestore(&musb->lock, flags);
792 *eof = 1;
793
794 return buffer - page;
795}
796
797void __devexit musb_debug_delete(char *name, struct musb *musb)
798{
799 if (musb->proc_entry)
800 remove_proc_entry(name, NULL);
801}
802
803struct proc_dir_entry *__init
804musb_debug_create(char *name, struct musb *data)
805{
806 struct proc_dir_entry *pde;
807
808 /* FIXME convert everything to seq_file; then later, debugfs */
809
810 if (!name)
811 return NULL;
812
813 pde = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, NULL);
814 data->proc_entry = pde;
815 if (pde) {
816 pde->data = data;
817 /* pde->owner = THIS_MODULE; */
818
819 pde->read_proc = musb_proc_read;
820 pde->write_proc = musb_proc_write;
821
822 pde->size = 0;
823
824 pr_debug("Registered /proc/%s\n", name);
825 } else {
826 pr_debug("Cannot create a valid proc file entry");
827 }
828
829 return pde;
830}
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 2e663f1afd5e..d95382088075 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -38,8 +38,6 @@
38#include <linux/usb.h> 38#include <linux/usb.h>
39#include <linux/usb/serial.h> 39#include <linux/usb/serial.h>
40 40
41#include <linux/version.h>
42
43/* the mode to be set when the port ist opened */ 41/* the mode to be set when the port ist opened */
44static int initial_mode = 1; 42static int initial_mode = 1;
45 43
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e143198aeb02..9f9cd36455f4 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -173,6 +173,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
173#define KYOCERA_PRODUCT_KPC680 0x180a 173#define KYOCERA_PRODUCT_KPC680 0x180a
174 174
175#define ANYDATA_VENDOR_ID 0x16d5 175#define ANYDATA_VENDOR_ID 0x16d5
176#define ANYDATA_PRODUCT_ADU_620UW 0x6202
176#define ANYDATA_PRODUCT_ADU_E100A 0x6501 177#define ANYDATA_PRODUCT_ADU_E100A 0x6501
177#define ANYDATA_PRODUCT_ADU_500A 0x6502 178#define ANYDATA_PRODUCT_ADU_500A 0x6502
178 179
@@ -318,6 +319,7 @@ static struct usb_device_id option_ids[] = {
318 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ 319 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
319 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 320 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
320 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 321 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
322 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
321 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, 323 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
322 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, 324 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) },
323 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, 325 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) },
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 4bd569e479a7..314d18694b6a 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -11,7 +11,6 @@
11 * Code is based on s3fb 11 * Code is based on s3fb
12 */ 12 */
13 13
14#include <linux/version.h>
15#include <linux/module.h> 14#include <linux/module.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index 940467aed13f..6d5aa806777e 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -733,7 +733,6 @@ static int bfin_bf54x_remove(struct platform_device *pdev)
733static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state) 733static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state)
734{ 734{
735 struct fb_info *fbinfo = platform_get_drvdata(pdev); 735 struct fb_info *fbinfo = platform_get_drvdata(pdev);
736 struct bfin_bf54xfb_info *info = fbinfo->par;
737 736
738 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN); 737 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN);
739 disable_dma(CH_EPPI0); 738 disable_dma(CH_EPPI0);
@@ -747,8 +746,18 @@ static int bfin_bf54x_resume(struct platform_device *pdev)
747 struct fb_info *fbinfo = platform_get_drvdata(pdev); 746 struct fb_info *fbinfo = platform_get_drvdata(pdev);
748 struct bfin_bf54xfb_info *info = fbinfo->par; 747 struct bfin_bf54xfb_info *info = fbinfo->par;
749 748
750 enable_dma(CH_EPPI0); 749 if (info->lq043_open_cnt) {
751 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN); 750
751 bfin_write_EPPI0_CONTROL(0);
752 SSYNC();
753
754 config_dma(info);
755 config_ppi(info);
756
757 /* start dma */
758 enable_dma(CH_EPPI0);
759 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN);
760 }
752 761
753 return 0; 762 return 0;
754} 763}
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 59df132cc375..4835bdc4e9f1 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -114,6 +114,17 @@ static struct vm_operations_struct fb_deferred_io_vm_ops = {
114 .page_mkwrite = fb_deferred_io_mkwrite, 114 .page_mkwrite = fb_deferred_io_mkwrite,
115}; 115};
116 116
117static int fb_deferred_io_set_page_dirty(struct page *page)
118{
119 if (!PageDirty(page))
120 SetPageDirty(page);
121 return 0;
122}
123
124static const struct address_space_operations fb_deferred_io_aops = {
125 .set_page_dirty = fb_deferred_io_set_page_dirty,
126};
127
117static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma) 128static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
118{ 129{
119 vma->vm_ops = &fb_deferred_io_vm_ops; 130 vma->vm_ops = &fb_deferred_io_vm_ops;
@@ -163,6 +174,14 @@ void fb_deferred_io_init(struct fb_info *info)
163} 174}
164EXPORT_SYMBOL_GPL(fb_deferred_io_init); 175EXPORT_SYMBOL_GPL(fb_deferred_io_init);
165 176
177void fb_deferred_io_open(struct fb_info *info,
178 struct inode *inode,
179 struct file *file)
180{
181 file->f_mapping->a_ops = &fb_deferred_io_aops;
182}
183EXPORT_SYMBOL_GPL(fb_deferred_io_open);
184
166void fb_deferred_io_cleanup(struct fb_info *info) 185void fb_deferred_io_cleanup(struct fb_info *info)
167{ 186{
168 void *screen_base = (void __force *) info->screen_base; 187 void *screen_base = (void __force *) info->screen_base;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6b487801eeae..98843c2ecf73 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1344,6 +1344,10 @@ fb_open(struct inode *inode, struct file *file)
1344 if (res) 1344 if (res)
1345 module_put(info->fbops->owner); 1345 module_put(info->fbops->owner);
1346 } 1346 }
1347#ifdef CONFIG_FB_DEFERRED_IO
1348 if (info->fbdefio)
1349 fb_deferred_io_open(info, inode, file);
1350#endif
1347out: 1351out:
1348 unlock_kernel(); 1352 unlock_kernel();
1349 return res; 1353 return res;
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 3f1ca2adda3d..c6dd924976a4 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -1746,6 +1746,7 @@ static void __devexit pm2fb_remove(struct pci_dev *pdev)
1746 release_mem_region(fix->mmio_start, fix->mmio_len); 1746 release_mem_region(fix->mmio_start, fix->mmio_len);
1747 1747
1748 pci_set_drvdata(pdev, NULL); 1748 pci_set_drvdata(pdev, NULL);
1749 fb_dealloc_cmap(&info->cmap);
1749 kfree(info->pixmap.addr); 1750 kfree(info->pixmap.addr);
1750 kfree(info); 1751 kfree(info);
1751} 1752}
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 8361bd0e3df1..4dcec48a1d78 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -11,7 +11,6 @@
11 * which is based on the code of neofb. 11 * which is based on the code of neofb.
12 */ 12 */
13 13
14#include <linux/version.h>
15#include <linux/module.h> 14#include <linux/module.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index f6ef6cca73cd..4c32c06579a0 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -595,6 +595,8 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev)
595 info->fbops = &sh_mobile_lcdc_ops; 595 info->fbops = &sh_mobile_lcdc_ops;
596 info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; 596 info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres;
597 info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; 597 info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres;
598 info->var.width = cfg->lcd_size_cfg.width;
599 info->var.height = cfg->lcd_size_cfg.height;
598 info->var.activate = FB_ACTIVATE_NOW; 600 info->var.activate = FB_ACTIVATE_NOW;
599 error = sh_mobile_lcdc_set_bpp(&info->var, cfg->bpp); 601 error = sh_mobile_lcdc_set_bpp(&info->var, cfg->bpp);
600 if (error) 602 if (error)
diff --git a/drivers/video/vermilion/vermilion.h b/drivers/video/vermilion/vermilion.h
index c4aba59d4809..7491abfcf1fc 100644
--- a/drivers/video/vermilion/vermilion.h
+++ b/drivers/video/vermilion/vermilion.h
@@ -30,7 +30,6 @@
30#define _VERMILION_H_ 30#define _VERMILION_H_
31 31
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/version.h>
34#include <linux/pci.h> 33#include <linux/pci.h>
35#include <asm/atomic.h> 34#include <asm/atomic.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 34aae7a2a62b..3df17dc8c3d7 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -12,7 +12,6 @@
12 * (http://davesdomain.org.uk/viafb/) 12 * (http://davesdomain.org.uk/viafb/)
13 */ 13 */
14 14
15#include <linux/version.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 7b3a8423f485..5da3d2423cc0 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -24,7 +24,6 @@
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/version.h>
28#include <linux/errno.h> 27#include <linux/errno.h>
29#include <linux/string.h> 28#include <linux/string.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 56372ecf1690..dfc0197905ca 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -914,7 +914,9 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs)
914 /* Stash our initial stack pointer into the mm structure */ 914 /* Stash our initial stack pointer into the mm structure */
915 current->mm->start_stack = (unsigned long )sp; 915 current->mm->start_stack = (unsigned long )sp;
916 916
917 917#ifdef FLAT_PLAT_INIT
918 FLAT_PLAT_INIT(regs);
919#endif
918 DBG_FLT("start_thread(regs=0x%x, entry=0x%x, start_stack=0x%x)\n", 920 DBG_FLT("start_thread(regs=0x%x, entry=0x%x, start_stack=0x%x)\n",
919 (int)regs, (int)start_addr, (int)current->mm->start_stack); 921 (int)regs, (int)start_addr, (int)current->mm->start_stack);
920 922
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 756205314c24..8d7e88e02e0f 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -120,8 +120,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
120 if (bprm->misc_bang) 120 if (bprm->misc_bang)
121 goto _ret; 121 goto _ret;
122 122
123 bprm->misc_bang = 1;
124
125 /* to keep locking time low, we copy the interpreter string */ 123 /* to keep locking time low, we copy the interpreter string */
126 read_lock(&entries_lock); 124 read_lock(&entries_lock);
127 fmt = check_file(bprm); 125 fmt = check_file(bprm);
@@ -199,6 +197,8 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
199 if (retval < 0) 197 if (retval < 0)
200 goto _error; 198 goto _error;
201 199
200 bprm->misc_bang = 1;
201
202 retval = search_binary_handler (bprm, regs); 202 retval = search_binary_handler (bprm, regs);
203 if (retval < 0) 203 if (retval < 0)
204 goto _error; 204 goto _error;
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 0c3b618c15b3..f40423eb1a14 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -43,58 +43,13 @@ static DEFINE_MUTEX(read_mutex);
43static int cramfs_iget5_test(struct inode *inode, void *opaque) 43static int cramfs_iget5_test(struct inode *inode, void *opaque)
44{ 44{
45 struct cramfs_inode *cramfs_inode = opaque; 45 struct cramfs_inode *cramfs_inode = opaque;
46 46 return inode->i_ino == CRAMINO(cramfs_inode) && inode->i_ino != 1;
47 if (inode->i_ino != CRAMINO(cramfs_inode))
48 return 0; /* does not match */
49
50 if (inode->i_ino != 1)
51 return 1;
52
53 /* all empty directories, char, block, pipe, and sock, share inode #1 */
54
55 if ((inode->i_mode != cramfs_inode->mode) ||
56 (inode->i_gid != cramfs_inode->gid) ||
57 (inode->i_uid != cramfs_inode->uid))
58 return 0; /* does not match */
59
60 if ((S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) &&
61 (inode->i_rdev != old_decode_dev(cramfs_inode->size)))
62 return 0; /* does not match */
63
64 return 1; /* matches */
65} 47}
66 48
67static int cramfs_iget5_set(struct inode *inode, void *opaque) 49static int cramfs_iget5_set(struct inode *inode, void *opaque)
68{ 50{
69 static struct timespec zerotime;
70 struct cramfs_inode *cramfs_inode = opaque; 51 struct cramfs_inode *cramfs_inode = opaque;
71 inode->i_mode = cramfs_inode->mode;
72 inode->i_uid = cramfs_inode->uid;
73 inode->i_size = cramfs_inode->size;
74 inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
75 inode->i_gid = cramfs_inode->gid;
76 /* Struct copy intentional */
77 inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
78 inode->i_ino = CRAMINO(cramfs_inode); 52 inode->i_ino = CRAMINO(cramfs_inode);
79 /* inode->i_nlink is left 1 - arguably wrong for directories,
80 but it's the best we can do without reading the directory
81 contents. 1 yields the right result in GNU find, even
82 without -noleaf option. */
83 if (S_ISREG(inode->i_mode)) {
84 inode->i_fop = &generic_ro_fops;
85 inode->i_data.a_ops = &cramfs_aops;
86 } else if (S_ISDIR(inode->i_mode)) {
87 inode->i_op = &cramfs_dir_inode_operations;
88 inode->i_fop = &cramfs_directory_operations;
89 } else if (S_ISLNK(inode->i_mode)) {
90 inode->i_op = &page_symlink_inode_operations;
91 inode->i_data.a_ops = &cramfs_aops;
92 } else {
93 inode->i_size = 0;
94 inode->i_blocks = 0;
95 init_special_inode(inode, inode->i_mode,
96 old_decode_dev(cramfs_inode->size));
97 }
98 return 0; 53 return 0;
99} 54}
100 55
@@ -104,12 +59,48 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
104 struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode), 59 struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode),
105 cramfs_iget5_test, cramfs_iget5_set, 60 cramfs_iget5_test, cramfs_iget5_set,
106 cramfs_inode); 61 cramfs_inode);
62 static struct timespec zerotime;
63
107 if (inode && (inode->i_state & I_NEW)) { 64 if (inode && (inode->i_state & I_NEW)) {
65 inode->i_mode = cramfs_inode->mode;
66 inode->i_uid = cramfs_inode->uid;
67 inode->i_size = cramfs_inode->size;
68 inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
69 inode->i_gid = cramfs_inode->gid;
70 /* Struct copy intentional */
71 inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
72 /* inode->i_nlink is left 1 - arguably wrong for directories,
73 but it's the best we can do without reading the directory
74 contents. 1 yields the right result in GNU find, even
75 without -noleaf option. */
76 if (S_ISREG(inode->i_mode)) {
77 inode->i_fop = &generic_ro_fops;
78 inode->i_data.a_ops = &cramfs_aops;
79 } else if (S_ISDIR(inode->i_mode)) {
80 inode->i_op = &cramfs_dir_inode_operations;
81 inode->i_fop = &cramfs_directory_operations;
82 } else if (S_ISLNK(inode->i_mode)) {
83 inode->i_op = &page_symlink_inode_operations;
84 inode->i_data.a_ops = &cramfs_aops;
85 } else {
86 inode->i_size = 0;
87 inode->i_blocks = 0;
88 init_special_inode(inode, inode->i_mode,
89 old_decode_dev(cramfs_inode->size));
90 }
108 unlock_new_inode(inode); 91 unlock_new_inode(inode);
109 } 92 }
110 return inode; 93 return inode;
111} 94}
112 95
96static void cramfs_drop_inode(struct inode *inode)
97{
98 if (inode->i_ino == 1)
99 generic_delete_inode(inode);
100 else
101 generic_drop_inode(inode);
102}
103
113/* 104/*
114 * We have our own block cache: don't fill up the buffer cache 105 * We have our own block cache: don't fill up the buffer cache
115 * with the rom-image, because the way the filesystem is set 106 * with the rom-image, because the way the filesystem is set
@@ -534,6 +525,7 @@ static const struct super_operations cramfs_ops = {
534 .put_super = cramfs_put_super, 525 .put_super = cramfs_put_super,
535 .remount_fs = cramfs_remount, 526 .remount_fs = cramfs_remount,
536 .statfs = cramfs_statfs, 527 .statfs = cramfs_statfs,
528 .drop_inode = cramfs_drop_inode,
537}; 529};
538 530
539static int cramfs_get_sb(struct file_system_type *fs_type, 531static int cramfs_get_sb(struct file_system_type *fs_type,
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 1ae5004e93fc..e9fa960ba6da 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1626,6 +1626,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
1626 free_blocks = 1626 free_blocks =
1627 percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); 1627 percpu_counter_sum_and_set(&sbi->s_freeblocks_counter);
1628#endif 1628#endif
1629 if (free_blocks <= root_blocks)
1630 /* we don't have free space */
1631 return 0;
1629 if (free_blocks - root_blocks < nblocks) 1632 if (free_blocks - root_blocks < nblocks)
1630 return free_blocks - root_blocks; 1633 return free_blocks - root_blocks;
1631 return nblocks; 1634 return nblocks;
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index d3d23d73c08b..ec8e33b45219 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -411,7 +411,7 @@ static int call_filldir(struct file * filp, void * dirent,
411 get_dtype(sb, fname->file_type)); 411 get_dtype(sb, fname->file_type));
412 if (error) { 412 if (error) {
413 filp->f_pos = curr_pos; 413 filp->f_pos = curr_pos;
414 info->extra_fname = fname->next; 414 info->extra_fname = fname;
415 return error; 415 return error;
416 } 416 }
417 fname = fname->next; 417 fname = fname->next;
@@ -450,11 +450,21 @@ static int ext4_dx_readdir(struct file * filp,
450 * If there are any leftover names on the hash collision 450 * If there are any leftover names on the hash collision
451 * chain, return them first. 451 * chain, return them first.
452 */ 452 */
453 if (info->extra_fname && 453 if (info->extra_fname) {
454 call_filldir(filp, dirent, filldir, info->extra_fname)) 454 if (call_filldir(filp, dirent, filldir, info->extra_fname))
455 goto finished; 455 goto finished;
456 456
457 if (!info->curr_node) 457 info->extra_fname = NULL;
458 info->curr_node = rb_next(info->curr_node);
459 if (!info->curr_node) {
460 if (info->next_hash == ~0) {
461 filp->f_pos = EXT4_HTREE_EOF;
462 goto finished;
463 }
464 info->curr_hash = info->next_hash;
465 info->curr_minor_hash = 0;
466 }
467 } else if (!info->curr_node)
458 info->curr_node = rb_first(&info->root); 468 info->curr_node = rb_first(&info->root);
459 469
460 while (1) { 470 while (1) {
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 6c7924d9e358..295003241d3d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1072,6 +1072,8 @@ extern void ext4_set_inode_flags(struct inode *);
1072extern void ext4_get_inode_flags(struct ext4_inode_info *); 1072extern void ext4_get_inode_flags(struct ext4_inode_info *);
1073extern void ext4_set_aops(struct inode *inode); 1073extern void ext4_set_aops(struct inode *inode);
1074extern int ext4_writepage_trans_blocks(struct inode *); 1074extern int ext4_writepage_trans_blocks(struct inode *);
1075extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks);
1076extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1075extern int ext4_block_truncate_page(handle_t *handle, 1077extern int ext4_block_truncate_page(handle_t *handle,
1076 struct address_space *mapping, loff_t from); 1078 struct address_space *mapping, loff_t from);
1077extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page); 1079extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page);
@@ -1227,6 +1229,8 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1227/* extents.c */ 1229/* extents.c */
1228extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 1230extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1229extern int ext4_ext_writepage_trans_blocks(struct inode *, int); 1231extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1232extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks,
1233 int chunk);
1230extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1234extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1231 ext4_lblk_t iblock, 1235 ext4_lblk_t iblock,
1232 unsigned long max_blocks, struct buffer_head *bh_result, 1236 unsigned long max_blocks, struct buffer_head *bh_result,
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h
index 6c166c0a54b7..d33dc56d6986 100644
--- a/fs/ext4/ext4_extents.h
+++ b/fs/ext4/ext4_extents.h
@@ -216,7 +216,9 @@ extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
216extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); 216extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
217extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); 217extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
218extern int ext4_extent_tree_init(handle_t *, struct inode *); 218extern int ext4_extent_tree_init(handle_t *, struct inode *);
219extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 219extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
220 int num,
221 struct ext4_ext_path *path);
220extern int ext4_ext_try_to_merge(struct inode *inode, 222extern int ext4_ext_try_to_merge(struct inode *inode,
221 struct ext4_ext_path *path, 223 struct ext4_ext_path *path,
222 struct ext4_extent *); 224 struct ext4_extent *);
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index eb8bc3afe6e9..b455c685a98b 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -51,6 +51,14 @@
51 EXT4_XATTR_TRANS_BLOCKS - 2 + \ 51 EXT4_XATTR_TRANS_BLOCKS - 2 + \
52 2*EXT4_QUOTA_TRANS_BLOCKS(sb)) 52 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
53 53
54/*
55 * Define the number of metadata blocks we need to account to modify data.
56 *
57 * This include super block, inode block, quota blocks and xattr blocks
58 */
59#define EXT4_META_TRANS_BLOCKS(sb) (EXT4_XATTR_TRANS_BLOCKS + \
60 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
61
54/* Delete operations potentially hit one directory's namespace plus an 62/* Delete operations potentially hit one directory's namespace plus an
55 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be 63 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
56 * generous. We can grow the delete transaction later if necessary. */ 64 * generous. We can grow the delete transaction later if necessary. */
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 612c3d2c3824..b24d3c53f20c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1747,54 +1747,61 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
1747} 1747}
1748 1748
1749/* 1749/*
1750 * ext4_ext_calc_credits_for_insert: 1750 * ext4_ext_calc_credits_for_single_extent:
1751 * This routine returns max. credits that the extent tree can consume. 1751 * This routine returns max. credits that needed to insert an extent
1752 * It should be OK for low-performance paths like ->writepage() 1752 * to the extent tree.
1753 * To allow many writing processes to fit into a single transaction, 1753 * When pass the actual path, the caller should calculate credits
1754 * the caller should calculate credits under i_data_sem and 1754 * under i_data_sem.
1755 * pass the actual path.
1756 */ 1755 */
1757int ext4_ext_calc_credits_for_insert(struct inode *inode, 1756int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks,
1758 struct ext4_ext_path *path) 1757 struct ext4_ext_path *path)
1759{ 1758{
1760 int depth, needed;
1761
1762 if (path) { 1759 if (path) {
1760 int depth = ext_depth(inode);
1761 int ret = 0;
1762
1763 /* probably there is space in leaf? */ 1763 /* probably there is space in leaf? */
1764 depth = ext_depth(inode);
1765 if (le16_to_cpu(path[depth].p_hdr->eh_entries) 1764 if (le16_to_cpu(path[depth].p_hdr->eh_entries)
1766 < le16_to_cpu(path[depth].p_hdr->eh_max)) 1765 < le16_to_cpu(path[depth].p_hdr->eh_max)) {
1767 return 1;
1768 }
1769 1766
1770 /* 1767 /*
1771 * given 32-bit logical block (4294967296 blocks), max. tree 1768 * There are some space in the leaf tree, no
1772 * can be 4 levels in depth -- 4 * 340^4 == 53453440000. 1769 * need to account for leaf block credit
1773 * Let's also add one more level for imbalance. 1770 *
1774 */ 1771 * bitmaps and block group descriptor blocks
1775 depth = 5; 1772 * and other metadat blocks still need to be
1776 1773 * accounted.
1777 /* allocation of new data block(s) */ 1774 */
1778 needed = 2; 1775 /* 1 bitmap, 1 block group descriptor */
1776 ret = 2 + EXT4_META_TRANS_BLOCKS(inode->i_sb);
1777 }
1778 }
1779 1779
1780 /* 1780 return ext4_chunk_trans_blocks(inode, nrblocks);
1781 * tree can be full, so it would need to grow in depth: 1781}
1782 * we need one credit to modify old root, credits for
1783 * new root will be added in split accounting
1784 */
1785 needed += 1;
1786 1782
1787 /* 1783/*
1788 * Index split can happen, we would need: 1784 * How many index/leaf blocks need to change/allocate to modify nrblocks?
1789 * allocate intermediate indexes (bitmap + group) 1785 *
1790 * + change two blocks at each level, but root (already included) 1786 * if nrblocks are fit in a single extent (chunk flag is 1), then
1791 */ 1787 * in the worse case, each tree level index/leaf need to be changed
1792 needed += (depth * 2) + (depth * 2); 1788 * if the tree split due to insert a new extent, then the old tree
1789 * index/leaf need to be updated too
1790 *
1791 * If the nrblocks are discontiguous, they could cause
1792 * the whole tree split more than once, but this is really rare.
1793 */
1794int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
1795{
1796 int index;
1797 int depth = ext_depth(inode);
1793 1798
1794 /* any allocation modifies superblock */ 1799 if (chunk)
1795 needed += 1; 1800 index = depth * 2;
1801 else
1802 index = depth * 3;
1796 1803
1797 return needed; 1804 return index;
1798} 1805}
1799 1806
1800static int ext4_remove_blocks(handle_t *handle, struct inode *inode, 1807static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
@@ -1921,9 +1928,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
1921 correct_index = 1; 1928 correct_index = 1;
1922 credits += (ext_depth(inode)) + 1; 1929 credits += (ext_depth(inode)) + 1;
1923 } 1930 }
1924#ifdef CONFIG_QUOTA
1925 credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb); 1931 credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
1926#endif
1927 1932
1928 err = ext4_ext_journal_restart(handle, credits); 1933 err = ext4_ext_journal_restart(handle, credits);
1929 if (err) 1934 if (err)
@@ -2805,7 +2810,7 @@ void ext4_ext_truncate(struct inode *inode)
2805 /* 2810 /*
2806 * probably first extent we're gonna free will be last in block 2811 * probably first extent we're gonna free will be last in block
2807 */ 2812 */
2808 err = ext4_writepage_trans_blocks(inode) + 3; 2813 err = ext4_writepage_trans_blocks(inode);
2809 handle = ext4_journal_start(inode, err); 2814 handle = ext4_journal_start(inode, err);
2810 if (IS_ERR(handle)) 2815 if (IS_ERR(handle))
2811 return; 2816 return;
@@ -2819,7 +2824,7 @@ void ext4_ext_truncate(struct inode *inode)
2819 down_write(&EXT4_I(inode)->i_data_sem); 2824 down_write(&EXT4_I(inode)->i_data_sem);
2820 ext4_ext_invalidate_cache(inode); 2825 ext4_ext_invalidate_cache(inode);
2821 2826
2822 ext4_mb_discard_inode_preallocations(inode); 2827 ext4_discard_reservation(inode);
2823 2828
2824 /* 2829 /*
2825 * TODO: optimization is possible here. 2830 * TODO: optimization is possible here.
@@ -2858,27 +2863,6 @@ out_stop:
2858 ext4_journal_stop(handle); 2863 ext4_journal_stop(handle);
2859} 2864}
2860 2865
2861/*
2862 * ext4_ext_writepage_trans_blocks:
2863 * calculate max number of blocks we could modify
2864 * in order to allocate new block for an inode
2865 */
2866int ext4_ext_writepage_trans_blocks(struct inode *inode, int num)
2867{
2868 int needed;
2869
2870 needed = ext4_ext_calc_credits_for_insert(inode, NULL);
2871
2872 /* caller wants to allocate num blocks, but note it includes sb */
2873 needed = needed * num - (num - 1);
2874
2875#ifdef CONFIG_QUOTA
2876 needed += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
2877#endif
2878
2879 return needed;
2880}
2881
2882static void ext4_falloc_update_inode(struct inode *inode, 2866static void ext4_falloc_update_inode(struct inode *inode,
2883 int mode, loff_t new_size, int update_ctime) 2867 int mode, loff_t new_size, int update_ctime)
2884{ 2868{
@@ -2939,10 +2923,9 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
2939 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) 2923 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits)
2940 - block; 2924 - block;
2941 /* 2925 /*
2942 * credits to insert 1 extent into extent tree + buffers to be able to 2926 * credits to insert 1 extent into extent tree
2943 * modify 1 super block, 1 block bitmap and 1 group descriptor.
2944 */ 2927 */
2945 credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; 2928 credits = ext4_chunk_trans_blocks(inode, max_blocks);
2946 mutex_lock(&inode->i_mutex); 2929 mutex_lock(&inode->i_mutex);
2947retry: 2930retry:
2948 while (ret >= 0 && ret < max_blocks) { 2931 while (ret >= 0 && ret < max_blocks) {
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 655e760212b8..f344834bbf58 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -351,7 +351,7 @@ find_close_to_parent:
351 goto found_flexbg; 351 goto found_flexbg;
352 } 352 }
353 353
354 if (best_flex < 0 || 354 if (flex_group[best_flex].free_inodes == 0 ||
355 (flex_group[i].free_blocks > 355 (flex_group[i].free_blocks >
356 flex_group[best_flex].free_blocks && 356 flex_group[best_flex].free_blocks &&
357 flex_group[i].free_inodes)) 357 flex_group[i].free_inodes))
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 59fbbe899acc..7e91913e325b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -41,6 +41,8 @@
41#include "acl.h" 41#include "acl.h"
42#include "ext4_extents.h" 42#include "ext4_extents.h"
43 43
44#define MPAGE_DA_EXTENT_TAIL 0x01
45
44static inline int ext4_begin_ordered_truncate(struct inode *inode, 46static inline int ext4_begin_ordered_truncate(struct inode *inode,
45 loff_t new_size) 47 loff_t new_size)
46{ 48{
@@ -1005,6 +1007,9 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
1005 */ 1007 */
1006static int ext4_calc_metadata_amount(struct inode *inode, int blocks) 1008static int ext4_calc_metadata_amount(struct inode *inode, int blocks)
1007{ 1009{
1010 if (!blocks)
1011 return 0;
1012
1008 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) 1013 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1009 return ext4_ext_calc_metadata_amount(inode, blocks); 1014 return ext4_ext_calc_metadata_amount(inode, blocks);
1010 1015
@@ -1041,18 +1046,6 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1041 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1046 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1042} 1047}
1043 1048
1044/* Maximum number of blocks we map for direct IO at once. */
1045#define DIO_MAX_BLOCKS 4096
1046/*
1047 * Number of credits we need for writing DIO_MAX_BLOCKS:
1048 * We need sb + group descriptor + bitmap + inode -> 4
1049 * For B blocks with A block pointers per block we need:
1050 * 1 (triple ind.) + (B/A/A + 2) (doubly ind.) + (B/A + 2) (indirect).
1051 * If we plug in 4096 for B and 256 for A (for 1KB block size), we get 25.
1052 */
1053#define DIO_CREDITS 25
1054
1055
1056/* 1049/*
1057 * The ext4_get_blocks_wrap() function try to look up the requested blocks, 1050 * The ext4_get_blocks_wrap() function try to look up the requested blocks,
1058 * and returns if the blocks are already mapped. 1051 * and returns if the blocks are already mapped.
@@ -1164,19 +1157,23 @@ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
1164 return retval; 1157 return retval;
1165} 1158}
1166 1159
1160/* Maximum number of blocks we map for direct IO at once. */
1161#define DIO_MAX_BLOCKS 4096
1162
1167static int ext4_get_block(struct inode *inode, sector_t iblock, 1163static int ext4_get_block(struct inode *inode, sector_t iblock,
1168 struct buffer_head *bh_result, int create) 1164 struct buffer_head *bh_result, int create)
1169{ 1165{
1170 handle_t *handle = ext4_journal_current_handle(); 1166 handle_t *handle = ext4_journal_current_handle();
1171 int ret = 0, started = 0; 1167 int ret = 0, started = 0;
1172 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 1168 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
1169 int dio_credits;
1173 1170
1174 if (create && !handle) { 1171 if (create && !handle) {
1175 /* Direct IO write... */ 1172 /* Direct IO write... */
1176 if (max_blocks > DIO_MAX_BLOCKS) 1173 if (max_blocks > DIO_MAX_BLOCKS)
1177 max_blocks = DIO_MAX_BLOCKS; 1174 max_blocks = DIO_MAX_BLOCKS;
1178 handle = ext4_journal_start(inode, DIO_CREDITS + 1175 dio_credits = ext4_chunk_trans_blocks(inode, max_blocks);
1179 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb)); 1176 handle = ext4_journal_start(inode, dio_credits);
1180 if (IS_ERR(handle)) { 1177 if (IS_ERR(handle)) {
1181 ret = PTR_ERR(handle); 1178 ret = PTR_ERR(handle);
1182 goto out; 1179 goto out;
@@ -1559,7 +1556,25 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1559 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1556 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1560 int total, mdb, mdb_free, release; 1557 int total, mdb, mdb_free, release;
1561 1558
1559 if (!to_free)
1560 return; /* Nothing to release, exit */
1561
1562 spin_lock(&EXT4_I(inode)->i_block_reservation_lock); 1562 spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
1563
1564 if (!EXT4_I(inode)->i_reserved_data_blocks) {
1565 /*
1566 * if there is no reserved blocks, but we try to free some
1567 * then the counter is messed up somewhere.
1568 * but since this function is called from invalidate
1569 * page, it's harmless to return without any action
1570 */
1571 printk(KERN_INFO "ext4 delalloc try to release %d reserved "
1572 "blocks for inode %lu, but there is no reserved "
1573 "data blocks\n", to_free, inode->i_ino);
1574 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1575 return;
1576 }
1577
1563 /* recalculate the number of metablocks still need to be reserved */ 1578 /* recalculate the number of metablocks still need to be reserved */
1564 total = EXT4_I(inode)->i_reserved_data_blocks - to_free; 1579 total = EXT4_I(inode)->i_reserved_data_blocks - to_free;
1565 mdb = ext4_calc_metadata_amount(inode, total); 1580 mdb = ext4_calc_metadata_amount(inode, total);
@@ -1613,11 +1628,13 @@ struct mpage_da_data {
1613 unsigned long first_page, next_page; /* extent of pages */ 1628 unsigned long first_page, next_page; /* extent of pages */
1614 get_block_t *get_block; 1629 get_block_t *get_block;
1615 struct writeback_control *wbc; 1630 struct writeback_control *wbc;
1631 int io_done;
1632 long pages_written;
1616}; 1633};
1617 1634
1618/* 1635/*
1619 * mpage_da_submit_io - walks through extent of pages and try to write 1636 * mpage_da_submit_io - walks through extent of pages and try to write
1620 * them with __mpage_writepage() 1637 * them with writepage() call back
1621 * 1638 *
1622 * @mpd->inode: inode 1639 * @mpd->inode: inode
1623 * @mpd->first_page: first page of the extent 1640 * @mpd->first_page: first page of the extent
@@ -1632,18 +1649,11 @@ struct mpage_da_data {
1632static int mpage_da_submit_io(struct mpage_da_data *mpd) 1649static int mpage_da_submit_io(struct mpage_da_data *mpd)
1633{ 1650{
1634 struct address_space *mapping = mpd->inode->i_mapping; 1651 struct address_space *mapping = mpd->inode->i_mapping;
1635 struct mpage_data mpd_pp = {
1636 .bio = NULL,
1637 .last_block_in_bio = 0,
1638 .get_block = mpd->get_block,
1639 .use_writepage = 1,
1640 };
1641 int ret = 0, err, nr_pages, i; 1652 int ret = 0, err, nr_pages, i;
1642 unsigned long index, end; 1653 unsigned long index, end;
1643 struct pagevec pvec; 1654 struct pagevec pvec;
1644 1655
1645 BUG_ON(mpd->next_page <= mpd->first_page); 1656 BUG_ON(mpd->next_page <= mpd->first_page);
1646
1647 pagevec_init(&pvec, 0); 1657 pagevec_init(&pvec, 0);
1648 index = mpd->first_page; 1658 index = mpd->first_page;
1649 end = mpd->next_page - 1; 1659 end = mpd->next_page - 1;
@@ -1661,8 +1671,9 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
1661 break; 1671 break;
1662 index++; 1672 index++;
1663 1673
1664 err = __mpage_writepage(page, mpd->wbc, &mpd_pp); 1674 err = mapping->a_ops->writepage(page, mpd->wbc);
1665 1675 if (!err)
1676 mpd->pages_written++;
1666 /* 1677 /*
1667 * In error case, we have to continue because 1678 * In error case, we have to continue because
1668 * remaining pages are still locked 1679 * remaining pages are still locked
@@ -1673,9 +1684,6 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
1673 } 1684 }
1674 pagevec_release(&pvec); 1685 pagevec_release(&pvec);
1675 } 1686 }
1676 if (mpd_pp.bio)
1677 mpage_bio_submit(WRITE, mpd_pp.bio);
1678
1679 return ret; 1687 return ret;
1680} 1688}
1681 1689
@@ -1698,7 +1706,7 @@ static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical,
1698 int blocks = exbh->b_size >> inode->i_blkbits; 1706 int blocks = exbh->b_size >> inode->i_blkbits;
1699 sector_t pblock = exbh->b_blocknr, cur_logical; 1707 sector_t pblock = exbh->b_blocknr, cur_logical;
1700 struct buffer_head *head, *bh; 1708 struct buffer_head *head, *bh;
1701 unsigned long index, end; 1709 pgoff_t index, end;
1702 struct pagevec pvec; 1710 struct pagevec pvec;
1703 int nr_pages, i; 1711 int nr_pages, i;
1704 1712
@@ -1741,6 +1749,13 @@ static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical,
1741 if (buffer_delay(bh)) { 1749 if (buffer_delay(bh)) {
1742 bh->b_blocknr = pblock; 1750 bh->b_blocknr = pblock;
1743 clear_buffer_delay(bh); 1751 clear_buffer_delay(bh);
1752 bh->b_bdev = inode->i_sb->s_bdev;
1753 } else if (buffer_unwritten(bh)) {
1754 bh->b_blocknr = pblock;
1755 clear_buffer_unwritten(bh);
1756 set_buffer_mapped(bh);
1757 set_buffer_new(bh);
1758 bh->b_bdev = inode->i_sb->s_bdev;
1744 } else if (buffer_mapped(bh)) 1759 } else if (buffer_mapped(bh))
1745 BUG_ON(bh->b_blocknr != pblock); 1760 BUG_ON(bh->b_blocknr != pblock);
1746 1761
@@ -1776,13 +1791,11 @@ static inline void __unmap_underlying_blocks(struct inode *inode,
1776 * 1791 *
1777 * The function skips space we know is already mapped to disk blocks. 1792 * The function skips space we know is already mapped to disk blocks.
1778 * 1793 *
1779 * The function ignores errors ->get_block() returns, thus real
1780 * error handling is postponed to __mpage_writepage()
1781 */ 1794 */
1782static void mpage_da_map_blocks(struct mpage_da_data *mpd) 1795static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1783{ 1796{
1797 int err = 0;
1784 struct buffer_head *lbh = &mpd->lbh; 1798 struct buffer_head *lbh = &mpd->lbh;
1785 int err = 0, remain = lbh->b_size;
1786 sector_t next = lbh->b_blocknr; 1799 sector_t next = lbh->b_blocknr;
1787 struct buffer_head new; 1800 struct buffer_head new;
1788 1801
@@ -1792,38 +1805,36 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1792 if (buffer_mapped(lbh) && !buffer_delay(lbh)) 1805 if (buffer_mapped(lbh) && !buffer_delay(lbh))
1793 return; 1806 return;
1794 1807
1795 while (remain) { 1808 new.b_state = lbh->b_state;
1796 new.b_state = lbh->b_state; 1809 new.b_blocknr = 0;
1797 new.b_blocknr = 0; 1810 new.b_size = lbh->b_size;
1798 new.b_size = remain;
1799 err = mpd->get_block(mpd->inode, next, &new, 1);
1800 if (err) {
1801 /*
1802 * Rather than implement own error handling
1803 * here, we just leave remaining blocks
1804 * unallocated and try again with ->writepage()
1805 */
1806 break;
1807 }
1808 BUG_ON(new.b_size == 0);
1809 1811
1810 if (buffer_new(&new)) 1812 /*
1811 __unmap_underlying_blocks(mpd->inode, &new); 1813 * If we didn't accumulate anything
1814 * to write simply return
1815 */
1816 if (!new.b_size)
1817 return;
1818 err = mpd->get_block(mpd->inode, next, &new, 1);
1819 if (err)
1820 return;
1821 BUG_ON(new.b_size == 0);
1812 1822
1813 /* 1823 if (buffer_new(&new))
1814 * If blocks are delayed marked, we need to 1824 __unmap_underlying_blocks(mpd->inode, &new);
1815 * put actual blocknr and drop delayed bit
1816 */
1817 if (buffer_delay(lbh))
1818 mpage_put_bnr_to_bhs(mpd, next, &new);
1819 1825
1820 /* go for the remaining blocks */ 1826 /*
1821 next += new.b_size >> mpd->inode->i_blkbits; 1827 * If blocks are delayed marked, we need to
1822 remain -= new.b_size; 1828 * put actual blocknr and drop delayed bit
1823 } 1829 */
1830 if (buffer_delay(lbh) || buffer_unwritten(lbh))
1831 mpage_put_bnr_to_bhs(mpd, next, &new);
1832
1833 return;
1824} 1834}
1825 1835
1826#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | (1 << BH_Delay)) 1836#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | \
1837 (1 << BH_Delay) | (1 << BH_Unwritten))
1827 1838
1828/* 1839/*
1829 * mpage_add_bh_to_extent - try to add one more block to extent of blocks 1840 * mpage_add_bh_to_extent - try to add one more block to extent of blocks
@@ -1837,41 +1848,61 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1837static void mpage_add_bh_to_extent(struct mpage_da_data *mpd, 1848static void mpage_add_bh_to_extent(struct mpage_da_data *mpd,
1838 sector_t logical, struct buffer_head *bh) 1849 sector_t logical, struct buffer_head *bh)
1839{ 1850{
1840 struct buffer_head *lbh = &mpd->lbh;
1841 sector_t next; 1851 sector_t next;
1852 size_t b_size = bh->b_size;
1853 struct buffer_head *lbh = &mpd->lbh;
1854 int nrblocks = lbh->b_size >> mpd->inode->i_blkbits;
1842 1855
1843 next = lbh->b_blocknr + (lbh->b_size >> mpd->inode->i_blkbits); 1856 /* check if thereserved journal credits might overflow */
1844 1857 if (!(EXT4_I(mpd->inode)->i_flags & EXT4_EXTENTS_FL)) {
1858 if (nrblocks >= EXT4_MAX_TRANS_DATA) {
1859 /*
1860 * With non-extent format we are limited by the journal
1861 * credit available. Total credit needed to insert
1862 * nrblocks contiguous blocks is dependent on the
1863 * nrblocks. So limit nrblocks.
1864 */
1865 goto flush_it;
1866 } else if ((nrblocks + (b_size >> mpd->inode->i_blkbits)) >
1867 EXT4_MAX_TRANS_DATA) {
1868 /*
1869 * Adding the new buffer_head would make it cross the
1870 * allowed limit for which we have journal credit
1871 * reserved. So limit the new bh->b_size
1872 */
1873 b_size = (EXT4_MAX_TRANS_DATA - nrblocks) <<
1874 mpd->inode->i_blkbits;
1875 /* we will do mpage_da_submit_io in the next loop */
1876 }
1877 }
1845 /* 1878 /*
1846 * First block in the extent 1879 * First block in the extent
1847 */ 1880 */
1848 if (lbh->b_size == 0) { 1881 if (lbh->b_size == 0) {
1849 lbh->b_blocknr = logical; 1882 lbh->b_blocknr = logical;
1850 lbh->b_size = bh->b_size; 1883 lbh->b_size = b_size;
1851 lbh->b_state = bh->b_state & BH_FLAGS; 1884 lbh->b_state = bh->b_state & BH_FLAGS;
1852 return; 1885 return;
1853 } 1886 }
1854 1887
1888 next = lbh->b_blocknr + nrblocks;
1855 /* 1889 /*
1856 * Can we merge the block to our big extent? 1890 * Can we merge the block to our big extent?
1857 */ 1891 */
1858 if (logical == next && (bh->b_state & BH_FLAGS) == lbh->b_state) { 1892 if (logical == next && (bh->b_state & BH_FLAGS) == lbh->b_state) {
1859 lbh->b_size += bh->b_size; 1893 lbh->b_size += b_size;
1860 return; 1894 return;
1861 } 1895 }
1862 1896
1897flush_it:
1863 /* 1898 /*
1864 * We couldn't merge the block to our extent, so we 1899 * We couldn't merge the block to our extent, so we
1865 * need to flush current extent and start new one 1900 * need to flush current extent and start new one
1866 */ 1901 */
1867 mpage_da_map_blocks(mpd); 1902 mpage_da_map_blocks(mpd);
1868 1903 mpage_da_submit_io(mpd);
1869 /* 1904 mpd->io_done = 1;
1870 * Now start a new extent 1905 return;
1871 */
1872 lbh->b_size = bh->b_size;
1873 lbh->b_state = bh->b_state & BH_FLAGS;
1874 lbh->b_blocknr = logical;
1875} 1906}
1876 1907
1877/* 1908/*
@@ -1891,17 +1922,35 @@ static int __mpage_da_writepage(struct page *page,
1891 struct buffer_head *bh, *head, fake; 1922 struct buffer_head *bh, *head, fake;
1892 sector_t logical; 1923 sector_t logical;
1893 1924
1925 if (mpd->io_done) {
1926 /*
1927 * Rest of the page in the page_vec
1928 * redirty then and skip then. We will
1929 * try to to write them again after
1930 * starting a new transaction
1931 */
1932 redirty_page_for_writepage(wbc, page);
1933 unlock_page(page);
1934 return MPAGE_DA_EXTENT_TAIL;
1935 }
1894 /* 1936 /*
1895 * Can we merge this page to current extent? 1937 * Can we merge this page to current extent?
1896 */ 1938 */
1897 if (mpd->next_page != page->index) { 1939 if (mpd->next_page != page->index) {
1898 /* 1940 /*
1899 * Nope, we can't. So, we map non-allocated blocks 1941 * Nope, we can't. So, we map non-allocated blocks
1900 * and start IO on them using __mpage_writepage() 1942 * and start IO on them using writepage()
1901 */ 1943 */
1902 if (mpd->next_page != mpd->first_page) { 1944 if (mpd->next_page != mpd->first_page) {
1903 mpage_da_map_blocks(mpd); 1945 mpage_da_map_blocks(mpd);
1904 mpage_da_submit_io(mpd); 1946 mpage_da_submit_io(mpd);
1947 /*
1948 * skip rest of the page in the page_vec
1949 */
1950 mpd->io_done = 1;
1951 redirty_page_for_writepage(wbc, page);
1952 unlock_page(page);
1953 return MPAGE_DA_EXTENT_TAIL;
1905 } 1954 }
1906 1955
1907 /* 1956 /*
@@ -1932,6 +1981,8 @@ static int __mpage_da_writepage(struct page *page,
1932 set_buffer_dirty(bh); 1981 set_buffer_dirty(bh);
1933 set_buffer_uptodate(bh); 1982 set_buffer_uptodate(bh);
1934 mpage_add_bh_to_extent(mpd, logical, bh); 1983 mpage_add_bh_to_extent(mpd, logical, bh);
1984 if (mpd->io_done)
1985 return MPAGE_DA_EXTENT_TAIL;
1935 } else { 1986 } else {
1936 /* 1987 /*
1937 * Page with regular buffer heads, just add all dirty ones 1988 * Page with regular buffer heads, just add all dirty ones
@@ -1940,8 +1991,12 @@ static int __mpage_da_writepage(struct page *page,
1940 bh = head; 1991 bh = head;
1941 do { 1992 do {
1942 BUG_ON(buffer_locked(bh)); 1993 BUG_ON(buffer_locked(bh));
1943 if (buffer_dirty(bh)) 1994 if (buffer_dirty(bh) &&
1995 (!buffer_mapped(bh) || buffer_delay(bh))) {
1944 mpage_add_bh_to_extent(mpd, logical, bh); 1996 mpage_add_bh_to_extent(mpd, logical, bh);
1997 if (mpd->io_done)
1998 return MPAGE_DA_EXTENT_TAIL;
1999 }
1945 logical++; 2000 logical++;
1946 } while ((bh = bh->b_this_page) != head); 2001 } while ((bh = bh->b_this_page) != head);
1947 } 2002 }
@@ -1960,22 +2015,13 @@ static int __mpage_da_writepage(struct page *page,
1960 * 2015 *
1961 * This is a library function, which implements the writepages() 2016 * This is a library function, which implements the writepages()
1962 * address_space_operation. 2017 * address_space_operation.
1963 *
1964 * In order to avoid duplication of logic that deals with partial pages,
1965 * multiple bio per page, etc, we find non-allocated blocks, allocate
1966 * them with minimal calls to ->get_block() and re-use __mpage_writepage()
1967 *
1968 * It's important that we call __mpage_writepage() only once for each
1969 * involved page, otherwise we'd have to implement more complicated logic
1970 * to deal with pages w/o PG_lock or w/ PG_writeback and so on.
1971 *
1972 * See comments to mpage_writepages()
1973 */ 2018 */
1974static int mpage_da_writepages(struct address_space *mapping, 2019static int mpage_da_writepages(struct address_space *mapping,
1975 struct writeback_control *wbc, 2020 struct writeback_control *wbc,
1976 get_block_t get_block) 2021 get_block_t get_block)
1977{ 2022{
1978 struct mpage_da_data mpd; 2023 struct mpage_da_data mpd;
2024 long to_write;
1979 int ret; 2025 int ret;
1980 2026
1981 if (!get_block) 2027 if (!get_block)
@@ -1989,17 +2035,22 @@ static int mpage_da_writepages(struct address_space *mapping,
1989 mpd.first_page = 0; 2035 mpd.first_page = 0;
1990 mpd.next_page = 0; 2036 mpd.next_page = 0;
1991 mpd.get_block = get_block; 2037 mpd.get_block = get_block;
2038 mpd.io_done = 0;
2039 mpd.pages_written = 0;
2040
2041 to_write = wbc->nr_to_write;
1992 2042
1993 ret = write_cache_pages(mapping, wbc, __mpage_da_writepage, &mpd); 2043 ret = write_cache_pages(mapping, wbc, __mpage_da_writepage, &mpd);
1994 2044
1995 /* 2045 /*
1996 * Handle last extent of pages 2046 * Handle last extent of pages
1997 */ 2047 */
1998 if (mpd.next_page != mpd.first_page) { 2048 if (!mpd.io_done && mpd.next_page != mpd.first_page) {
1999 mpage_da_map_blocks(&mpd); 2049 mpage_da_map_blocks(&mpd);
2000 mpage_da_submit_io(&mpd); 2050 mpage_da_submit_io(&mpd);
2001 } 2051 }
2002 2052
2053 wbc->nr_to_write = to_write - mpd.pages_written;
2003 return ret; 2054 return ret;
2004} 2055}
2005 2056
@@ -2204,63 +2255,95 @@ static int ext4_da_writepage(struct page *page,
2204} 2255}
2205 2256
2206/* 2257/*
2207 * For now just follow the DIO way to estimate the max credits 2258 * This is called via ext4_da_writepages() to
2208 * needed to write out EXT4_MAX_WRITEBACK_PAGES. 2259 * calulate the total number of credits to reserve to fit
2209 * todo: need to calculate the max credits need for 2260 * a single extent allocation into a single transaction,
2210 * extent based files, currently the DIO credits is based on 2261 * ext4_da_writpeages() will loop calling this before
2211 * indirect-blocks mapping way. 2262 * the block allocation.
2212 *
2213 * Probably should have a generic way to calculate credits
2214 * for DIO, writepages, and truncate
2215 */ 2263 */
2216#define EXT4_MAX_WRITEBACK_PAGES DIO_MAX_BLOCKS 2264
2217#define EXT4_MAX_WRITEBACK_CREDITS DIO_CREDITS 2265static int ext4_da_writepages_trans_blocks(struct inode *inode)
2266{
2267 int max_blocks = EXT4_I(inode)->i_reserved_data_blocks;
2268
2269 /*
2270 * With non-extent format the journal credit needed to
2271 * insert nrblocks contiguous block is dependent on
2272 * number of contiguous block. So we will limit
2273 * number of contiguous block to a sane value
2274 */
2275 if (!(inode->i_flags & EXT4_EXTENTS_FL) &&
2276 (max_blocks > EXT4_MAX_TRANS_DATA))
2277 max_blocks = EXT4_MAX_TRANS_DATA;
2278
2279 return ext4_chunk_trans_blocks(inode, max_blocks);
2280}
2218 2281
2219static int ext4_da_writepages(struct address_space *mapping, 2282static int ext4_da_writepages(struct address_space *mapping,
2220 struct writeback_control *wbc) 2283 struct writeback_control *wbc)
2221{ 2284{
2222 struct inode *inode = mapping->host;
2223 handle_t *handle = NULL; 2285 handle_t *handle = NULL;
2224 int needed_blocks;
2225 int ret = 0;
2226 long to_write;
2227 loff_t range_start = 0; 2286 loff_t range_start = 0;
2287 struct inode *inode = mapping->host;
2288 int needed_blocks, ret = 0, nr_to_writebump = 0;
2289 long to_write, pages_skipped = 0;
2290 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2228 2291
2229 /* 2292 /*
2230 * No pages to write? This is mainly a kludge to avoid starting 2293 * No pages to write? This is mainly a kludge to avoid starting
2231 * a transaction for special inodes like journal inode on last iput() 2294 * a transaction for special inodes like journal inode on last iput()
2232 * because that could violate lock ordering on umount 2295 * because that could violate lock ordering on umount
2233 */ 2296 */
2234 if (!mapping->nrpages) 2297 if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
2235 return 0; 2298 return 0;
2236
2237 /* 2299 /*
2238 * Estimate the worse case needed credits to write out 2300 * Make sure nr_to_write is >= sbi->s_mb_stream_request
2239 * EXT4_MAX_BUF_BLOCKS pages 2301 * This make sure small files blocks are allocated in
2302 * single attempt. This ensure that small files
2303 * get less fragmented.
2240 */ 2304 */
2241 needed_blocks = EXT4_MAX_WRITEBACK_CREDITS; 2305 if (wbc->nr_to_write < sbi->s_mb_stream_request) {
2306 nr_to_writebump = sbi->s_mb_stream_request - wbc->nr_to_write;
2307 wbc->nr_to_write = sbi->s_mb_stream_request;
2308 }
2242 2309
2243 to_write = wbc->nr_to_write; 2310 if (!wbc->range_cyclic)
2244 if (!wbc->range_cyclic) {
2245 /* 2311 /*
2246 * If range_cyclic is not set force range_cont 2312 * If range_cyclic is not set force range_cont
2247 * and save the old writeback_index 2313 * and save the old writeback_index
2248 */ 2314 */
2249 wbc->range_cont = 1; 2315 wbc->range_cont = 1;
2250 range_start = wbc->range_start;
2251 }
2252 2316
2253 while (!ret && to_write) { 2317 range_start = wbc->range_start;
2318 pages_skipped = wbc->pages_skipped;
2319
2320restart_loop:
2321 to_write = wbc->nr_to_write;
2322 while (!ret && to_write > 0) {
2323
2324 /*
2325 * we insert one extent at a time. So we need
2326 * credit needed for single extent allocation.
2327 * journalled mode is currently not supported
2328 * by delalloc
2329 */
2330 BUG_ON(ext4_should_journal_data(inode));
2331 needed_blocks = ext4_da_writepages_trans_blocks(inode);
2332
2254 /* start a new transaction*/ 2333 /* start a new transaction*/
2255 handle = ext4_journal_start(inode, needed_blocks); 2334 handle = ext4_journal_start(inode, needed_blocks);
2256 if (IS_ERR(handle)) { 2335 if (IS_ERR(handle)) {
2257 ret = PTR_ERR(handle); 2336 ret = PTR_ERR(handle);
2337 printk(KERN_EMERG "%s: jbd2_start: "
2338 "%ld pages, ino %lu; err %d\n", __func__,
2339 wbc->nr_to_write, inode->i_ino, ret);
2340 dump_stack();
2258 goto out_writepages; 2341 goto out_writepages;
2259 } 2342 }
2260 if (ext4_should_order_data(inode)) { 2343 if (ext4_should_order_data(inode)) {
2261 /* 2344 /*
2262 * With ordered mode we need to add 2345 * With ordered mode we need to add
2263 * the inode to the journal handle 2346 * the inode to the journal handl
2264 * when we do block allocation. 2347 * when we do block allocation.
2265 */ 2348 */
2266 ret = ext4_jbd2_file_inode(handle, inode); 2349 ret = ext4_jbd2_file_inode(handle, inode);
@@ -2268,20 +2351,20 @@ static int ext4_da_writepages(struct address_space *mapping,
2268 ext4_journal_stop(handle); 2351 ext4_journal_stop(handle);
2269 goto out_writepages; 2352 goto out_writepages;
2270 } 2353 }
2271
2272 } 2354 }
2273 /*
2274 * set the max dirty pages could be write at a time
2275 * to fit into the reserved transaction credits
2276 */
2277 if (wbc->nr_to_write > EXT4_MAX_WRITEBACK_PAGES)
2278 wbc->nr_to_write = EXT4_MAX_WRITEBACK_PAGES;
2279 2355
2280 to_write -= wbc->nr_to_write; 2356 to_write -= wbc->nr_to_write;
2281 ret = mpage_da_writepages(mapping, wbc, 2357 ret = mpage_da_writepages(mapping, wbc,
2282 ext4_da_get_block_write); 2358 ext4_da_get_block_write);
2283 ext4_journal_stop(handle); 2359 ext4_journal_stop(handle);
2284 if (wbc->nr_to_write) { 2360 if (ret == MPAGE_DA_EXTENT_TAIL) {
2361 /*
2362 * got one extent now try with
2363 * rest of the pages
2364 */
2365 to_write += wbc->nr_to_write;
2366 ret = 0;
2367 } else if (wbc->nr_to_write) {
2285 /* 2368 /*
2286 * There is no more writeout needed 2369 * There is no more writeout needed
2287 * or we requested for a noblocking writeout 2370 * or we requested for a noblocking writeout
@@ -2293,10 +2376,18 @@ static int ext4_da_writepages(struct address_space *mapping,
2293 wbc->nr_to_write = to_write; 2376 wbc->nr_to_write = to_write;
2294 } 2377 }
2295 2378
2296out_writepages: 2379 if (wbc->range_cont && (pages_skipped != wbc->pages_skipped)) {
2297 wbc->nr_to_write = to_write; 2380 /* We skipped pages in this loop */
2298 if (range_start)
2299 wbc->range_start = range_start; 2381 wbc->range_start = range_start;
2382 wbc->nr_to_write = to_write +
2383 wbc->pages_skipped - pages_skipped;
2384 wbc->pages_skipped = pages_skipped;
2385 goto restart_loop;
2386 }
2387
2388out_writepages:
2389 wbc->nr_to_write = to_write - nr_to_writebump;
2390 wbc->range_start = range_start;
2300 return ret; 2391 return ret;
2301} 2392}
2302 2393
@@ -3486,6 +3577,9 @@ void ext4_truncate(struct inode *inode)
3486 * modify the block allocation tree. 3577 * modify the block allocation tree.
3487 */ 3578 */
3488 down_write(&ei->i_data_sem); 3579 down_write(&ei->i_data_sem);
3580
3581 ext4_discard_reservation(inode);
3582
3489 /* 3583 /*
3490 * The orphan list entry will now protect us from any crash which 3584 * The orphan list entry will now protect us from any crash which
3491 * occurs before the truncate completes, so it is now safe to propagate 3585 * occurs before the truncate completes, so it is now safe to propagate
@@ -3555,8 +3649,6 @@ do_indirects:
3555 ; 3649 ;
3556 } 3650 }
3557 3651
3558 ext4_discard_reservation(inode);
3559
3560 up_write(&ei->i_data_sem); 3652 up_write(&ei->i_data_sem);
3561 inode->i_mtime = inode->i_ctime = ext4_current_time(inode); 3653 inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
3562 ext4_mark_inode_dirty(handle, inode); 3654 ext4_mark_inode_dirty(handle, inode);
@@ -4324,57 +4416,129 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
4324 return 0; 4416 return 0;
4325} 4417}
4326 4418
4419static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,
4420 int chunk)
4421{
4422 int indirects;
4423
4424 /* if nrblocks are contiguous */
4425 if (chunk) {
4426 /*
4427 * With N contiguous data blocks, it need at most
4428 * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) indirect blocks
4429 * 2 dindirect blocks
4430 * 1 tindirect block
4431 */
4432 indirects = nrblocks / EXT4_ADDR_PER_BLOCK(inode->i_sb);
4433 return indirects + 3;
4434 }
4435 /*
4436 * if nrblocks are not contiguous, worse case, each block touch
4437 * a indirect block, and each indirect block touch a double indirect
4438 * block, plus a triple indirect block
4439 */
4440 indirects = nrblocks * 2 + 1;
4441 return indirects;
4442}
4443
4444static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
4445{
4446 if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
4447 return ext4_indirect_trans_blocks(inode, nrblocks, 0);
4448 return ext4_ext_index_trans_blocks(inode, nrblocks, 0);
4449}
4327/* 4450/*
4328 * How many blocks doth make a writepage()? 4451 * Account for index blocks, block groups bitmaps and block group
4329 * 4452 * descriptor blocks if modify datablocks and index blocks
4330 * With N blocks per page, it may be: 4453 * worse case, the indexs blocks spread over different block groups
4331 * N data blocks
4332 * 2 indirect block
4333 * 2 dindirect
4334 * 1 tindirect
4335 * N+5 bitmap blocks (from the above)
4336 * N+5 group descriptor summary blocks
4337 * 1 inode block
4338 * 1 superblock.
4339 * 2 * EXT4_SINGLEDATA_TRANS_BLOCKS for the quote files
4340 * 4454 *
4341 * 3 * (N + 5) + 2 + 2 * EXT4_SINGLEDATA_TRANS_BLOCKS 4455 * If datablocks are discontiguous, they are possible to spread over
4456 * different block groups too. If they are contiugous, with flexbg,
4457 * they could still across block group boundary.
4342 * 4458 *
4343 * With ordered or writeback data it's the same, less the N data blocks. 4459 * Also account for superblock, inode, quota and xattr blocks
4460 */
4461int ext4_meta_trans_blocks(struct inode *inode, int nrblocks, int chunk)
4462{
4463 int groups, gdpblocks;
4464 int idxblocks;
4465 int ret = 0;
4466
4467 /*
4468 * How many index blocks need to touch to modify nrblocks?
4469 * The "Chunk" flag indicating whether the nrblocks is
4470 * physically contiguous on disk
4471 *
4472 * For Direct IO and fallocate, they calls get_block to allocate
4473 * one single extent at a time, so they could set the "Chunk" flag
4474 */
4475 idxblocks = ext4_index_trans_blocks(inode, nrblocks, chunk);
4476
4477 ret = idxblocks;
4478
4479 /*
4480 * Now let's see how many group bitmaps and group descriptors need
4481 * to account
4482 */
4483 groups = idxblocks;
4484 if (chunk)
4485 groups += 1;
4486 else
4487 groups += nrblocks;
4488
4489 gdpblocks = groups;
4490 if (groups > EXT4_SB(inode->i_sb)->s_groups_count)
4491 groups = EXT4_SB(inode->i_sb)->s_groups_count;
4492 if (groups > EXT4_SB(inode->i_sb)->s_gdb_count)
4493 gdpblocks = EXT4_SB(inode->i_sb)->s_gdb_count;
4494
4495 /* bitmaps and block group descriptor blocks */
4496 ret += groups + gdpblocks;
4497
4498 /* Blocks for super block, inode, quota and xattr blocks */
4499 ret += EXT4_META_TRANS_BLOCKS(inode->i_sb);
4500
4501 return ret;
4502}
4503
4504/*
4505 * Calulate the total number of credits to reserve to fit
4506 * the modification of a single pages into a single transaction,
4507 * which may include multiple chunks of block allocations.
4344 * 4508 *
4345 * If the inode's direct blocks can hold an integral number of pages then a 4509 * This could be called via ext4_write_begin()
4346 * page cannot straddle two indirect blocks, and we can only touch one indirect
4347 * and dindirect block, and the "5" above becomes "3".
4348 * 4510 *
4349 * This still overestimates under most circumstances. If we were to pass the 4511 * We need to consider the worse case, when
4350 * start and end offsets in here as well we could do block_to_path() on each 4512 * one new block per extent.
4351 * block and work out the exact number of indirects which are touched. Pah.
4352 */ 4513 */
4353
4354int ext4_writepage_trans_blocks(struct inode *inode) 4514int ext4_writepage_trans_blocks(struct inode *inode)
4355{ 4515{
4356 int bpp = ext4_journal_blocks_per_page(inode); 4516 int bpp = ext4_journal_blocks_per_page(inode);
4357 int indirects = (EXT4_NDIR_BLOCKS % bpp) ? 5 : 3;
4358 int ret; 4517 int ret;
4359 4518
4360 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) 4519 ret = ext4_meta_trans_blocks(inode, bpp, 0);
4361 return ext4_ext_writepage_trans_blocks(inode, bpp);
4362 4520
4521 /* Account for data blocks for journalled mode */
4363 if (ext4_should_journal_data(inode)) 4522 if (ext4_should_journal_data(inode))
4364 ret = 3 * (bpp + indirects) + 2; 4523 ret += bpp;
4365 else
4366 ret = 2 * (bpp + indirects) + 2;
4367
4368#ifdef CONFIG_QUOTA
4369 /* We know that structure was already allocated during DQUOT_INIT so
4370 * we will be updating only the data blocks + inodes */
4371 ret += 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
4372#endif
4373
4374 return ret; 4524 return ret;
4375} 4525}
4376 4526
4377/* 4527/*
4528 * Calculate the journal credits for a chunk of data modification.
4529 *
4530 * This is called from DIO, fallocate or whoever calling
4531 * ext4_get_blocks_wrap() to map/allocate a chunk of contigous disk blocks.
4532 *
4533 * journal buffers for data blocks are not included here, as DIO
4534 * and fallocate do no need to journal data buffers.
4535 */
4536int ext4_chunk_trans_blocks(struct inode *inode, int nrblocks)
4537{
4538 return ext4_meta_trans_blocks(inode, nrblocks, 1);
4539}
4540
4541/*
4378 * The caller must have previously called ext4_reserve_inode_write(). 4542 * The caller must have previously called ext4_reserve_inode_write().
4379 * Give this, we know that the caller already has write access to iloc->bh. 4543 * Give this, we know that the caller already has write access to iloc->bh.
4380 */ 4544 */
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 865e9ddb44d4..e0e3a5eb1ddb 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3282,6 +3282,35 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
3282} 3282}
3283 3283
3284/* 3284/*
3285 * Return the prealloc space that have minimal distance
3286 * from the goal block. @cpa is the prealloc
3287 * space that is having currently known minimal distance
3288 * from the goal block.
3289 */
3290static struct ext4_prealloc_space *
3291ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
3292 struct ext4_prealloc_space *pa,
3293 struct ext4_prealloc_space *cpa)
3294{
3295 ext4_fsblk_t cur_distance, new_distance;
3296
3297 if (cpa == NULL) {
3298 atomic_inc(&pa->pa_count);
3299 return pa;
3300 }
3301 cur_distance = abs(goal_block - cpa->pa_pstart);
3302 new_distance = abs(goal_block - pa->pa_pstart);
3303
3304 if (cur_distance < new_distance)
3305 return cpa;
3306
3307 /* drop the previous reference */
3308 atomic_dec(&cpa->pa_count);
3309 atomic_inc(&pa->pa_count);
3310 return pa;
3311}
3312
3313/*
3285 * search goal blocks in preallocated space 3314 * search goal blocks in preallocated space
3286 */ 3315 */
3287static noinline_for_stack int 3316static noinline_for_stack int
@@ -3290,7 +3319,8 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3290 int order, i; 3319 int order, i;
3291 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); 3320 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
3292 struct ext4_locality_group *lg; 3321 struct ext4_locality_group *lg;
3293 struct ext4_prealloc_space *pa; 3322 struct ext4_prealloc_space *pa, *cpa = NULL;
3323 ext4_fsblk_t goal_block;
3294 3324
3295 /* only data can be preallocated */ 3325 /* only data can be preallocated */
3296 if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) 3326 if (!(ac->ac_flags & EXT4_MB_HINT_DATA))
@@ -3333,6 +3363,13 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3333 /* The max size of hash table is PREALLOC_TB_SIZE */ 3363 /* The max size of hash table is PREALLOC_TB_SIZE */
3334 order = PREALLOC_TB_SIZE - 1; 3364 order = PREALLOC_TB_SIZE - 1;
3335 3365
3366 goal_block = ac->ac_g_ex.fe_group * EXT4_BLOCKS_PER_GROUP(ac->ac_sb) +
3367 ac->ac_g_ex.fe_start +
3368 le32_to_cpu(EXT4_SB(ac->ac_sb)->s_es->s_first_data_block);
3369 /*
3370 * search for the prealloc space that is having
3371 * minimal distance from the goal block.
3372 */
3336 for (i = order; i < PREALLOC_TB_SIZE; i++) { 3373 for (i = order; i < PREALLOC_TB_SIZE; i++) {
3337 rcu_read_lock(); 3374 rcu_read_lock();
3338 list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[i], 3375 list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[i],
@@ -3340,17 +3377,19 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3340 spin_lock(&pa->pa_lock); 3377 spin_lock(&pa->pa_lock);
3341 if (pa->pa_deleted == 0 && 3378 if (pa->pa_deleted == 0 &&
3342 pa->pa_free >= ac->ac_o_ex.fe_len) { 3379 pa->pa_free >= ac->ac_o_ex.fe_len) {
3343 atomic_inc(&pa->pa_count); 3380
3344 ext4_mb_use_group_pa(ac, pa); 3381 cpa = ext4_mb_check_group_pa(goal_block,
3345 spin_unlock(&pa->pa_lock); 3382 pa, cpa);
3346 ac->ac_criteria = 20;
3347 rcu_read_unlock();
3348 return 1;
3349 } 3383 }
3350 spin_unlock(&pa->pa_lock); 3384 spin_unlock(&pa->pa_lock);
3351 } 3385 }
3352 rcu_read_unlock(); 3386 rcu_read_unlock();
3353 } 3387 }
3388 if (cpa) {
3389 ext4_mb_use_group_pa(ac, cpa);
3390 ac->ac_criteria = 20;
3391 return 1;
3392 }
3354 return 0; 3393 return 0;
3355} 3394}
3356 3395
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index b9e077ba07e9..46fc0b5b12ba 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -53,7 +53,8 @@ static int finish_range(handle_t *handle, struct inode *inode,
53 * credit. But below we try to not accumalate too much 53 * credit. But below we try to not accumalate too much
54 * of them by restarting the journal. 54 * of them by restarting the journal.
55 */ 55 */
56 needed = ext4_ext_calc_credits_for_insert(inode, path); 56 needed = ext4_ext_calc_credits_for_single_extent(inode,
57 lb->last_block - lb->first_block + 1, path);
57 58
58 /* 59 /*
59 * Make sure the credit we accumalated is not really high 60 * Make sure the credit we accumalated is not really high
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 0a9265164265..b3d35604ea18 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -773,7 +773,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
773 773
774 if (reserved_gdb || gdb_off == 0) { 774 if (reserved_gdb || gdb_off == 0) {
775 if (!EXT4_HAS_COMPAT_FEATURE(sb, 775 if (!EXT4_HAS_COMPAT_FEATURE(sb,
776 EXT4_FEATURE_COMPAT_RESIZE_INODE)){ 776 EXT4_FEATURE_COMPAT_RESIZE_INODE)
777 || !le16_to_cpu(es->s_reserved_gdt_blocks)) {
777 ext4_warning(sb, __func__, 778 ext4_warning(sb, __func__,
778 "No reserved GDT blocks, can't resize"); 779 "No reserved GDT blocks, can't resize");
779 return -EPERM; 780 return -EPERM;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d5d77958b861..566344b926b7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -568,6 +568,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
568#endif 568#endif
569 ei->i_block_alloc_info = NULL; 569 ei->i_block_alloc_info = NULL;
570 ei->vfs_inode.i_version = 1; 570 ei->vfs_inode.i_version = 1;
571 ei->vfs_inode.i_data.writeback_index = 0;
571 memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache)); 572 memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache));
572 INIT_LIST_HEAD(&ei->i_prealloc_list); 573 INIT_LIST_HEAD(&ei->i_prealloc_list);
573 spin_lock_init(&ei->i_prealloc_lock); 574 spin_lock_init(&ei->i_prealloc_lock);
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 6d266d793e2c..80ff3381fa21 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -562,26 +562,23 @@ static int fat_write_inode(struct inode *inode, int wait)
562 struct buffer_head *bh; 562 struct buffer_head *bh;
563 struct msdos_dir_entry *raw_entry; 563 struct msdos_dir_entry *raw_entry;
564 loff_t i_pos; 564 loff_t i_pos;
565 int err = 0; 565 int err;
566 566
567retry: 567retry:
568 i_pos = MSDOS_I(inode)->i_pos; 568 i_pos = MSDOS_I(inode)->i_pos;
569 if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) 569 if (inode->i_ino == MSDOS_ROOT_INO || !i_pos)
570 return 0; 570 return 0;
571 571
572 lock_super(sb);
573 bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); 572 bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits);
574 if (!bh) { 573 if (!bh) {
575 printk(KERN_ERR "FAT: unable to read inode block " 574 printk(KERN_ERR "FAT: unable to read inode block "
576 "for updating (i_pos %lld)\n", i_pos); 575 "for updating (i_pos %lld)\n", i_pos);
577 err = -EIO; 576 return -EIO;
578 goto out;
579 } 577 }
580 spin_lock(&sbi->inode_hash_lock); 578 spin_lock(&sbi->inode_hash_lock);
581 if (i_pos != MSDOS_I(inode)->i_pos) { 579 if (i_pos != MSDOS_I(inode)->i_pos) {
582 spin_unlock(&sbi->inode_hash_lock); 580 spin_unlock(&sbi->inode_hash_lock);
583 brelse(bh); 581 brelse(bh);
584 unlock_super(sb);
585 goto retry; 582 goto retry;
586 } 583 }
587 584
@@ -607,11 +604,10 @@ retry:
607 } 604 }
608 spin_unlock(&sbi->inode_hash_lock); 605 spin_unlock(&sbi->inode_hash_lock);
609 mark_buffer_dirty(bh); 606 mark_buffer_dirty(bh);
607 err = 0;
610 if (wait) 608 if (wait)
611 err = sync_dirty_buffer(bh); 609 err = sync_dirty_buffer(bh);
612 brelse(bh); 610 brelse(bh);
613out:
614 unlock_super(sb);
615 return err; 611 return err;
616} 612}
617 613
diff --git a/fs/ioprio.c b/fs/ioprio.c
index c4a1c3c65aac..da3cc460d4df 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -115,11 +115,11 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
115 pgrp = task_pgrp(current); 115 pgrp = task_pgrp(current);
116 else 116 else
117 pgrp = find_vpid(who); 117 pgrp = find_vpid(who);
118 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 118 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
119 ret = set_task_ioprio(p, ioprio); 119 ret = set_task_ioprio(p, ioprio);
120 if (ret) 120 if (ret)
121 break; 121 break;
122 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 122 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
123 break; 123 break;
124 case IOPRIO_WHO_USER: 124 case IOPRIO_WHO_USER:
125 if (!who) 125 if (!who)
@@ -204,7 +204,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
204 pgrp = task_pgrp(current); 204 pgrp = task_pgrp(current);
205 else 205 else
206 pgrp = find_vpid(who); 206 pgrp = find_vpid(who);
207 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 207 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
208 tmpio = get_task_ioprio(p); 208 tmpio = get_task_ioprio(p);
209 if (tmpio < 0) 209 if (tmpio < 0)
210 continue; 210 continue;
@@ -212,7 +212,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
212 ret = tmpio; 212 ret = tmpio;
213 else 213 else
214 ret = ioprio_best(ret, tmpio); 214 ret = ioprio_best(ret, tmpio);
215 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 215 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
216 break; 216 break;
217 case IOPRIO_WHO_USER: 217 case IOPRIO_WHO_USER:
218 if (!who) 218 if (!who)
diff --git a/fs/jffs2/jffs2_fs_i.h b/fs/jffs2/jffs2_fs_i.h
index 31559f45fdde..4c41db91eaa4 100644
--- a/fs/jffs2/jffs2_fs_i.h
+++ b/fs/jffs2/jffs2_fs_i.h
@@ -12,7 +12,6 @@
12#ifndef _JFFS2_FS_I 12#ifndef _JFFS2_FS_I
13#define _JFFS2_FS_I 13#define _JFFS2_FS_I
14 14
15#include <linux/version.h>
16#include <linux/rbtree.h> 15#include <linux/rbtree.h>
17#include <linux/posix_acl.h> 16#include <linux/posix_acl.h>
18#include <linux/mutex.h> 17#include <linux/mutex.h>
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 79ecd281d2cb..3f87d2632947 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -52,14 +52,14 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
52 } 52 }
53 53
54 seq_printf(m, 54 seq_printf(m,
55 "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n", 55 "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
56 vma->vm_start, 56 vma->vm_start,
57 vma->vm_end, 57 vma->vm_end,
58 flags & VM_READ ? 'r' : '-', 58 flags & VM_READ ? 'r' : '-',
59 flags & VM_WRITE ? 'w' : '-', 59 flags & VM_WRITE ? 'w' : '-',
60 flags & VM_EXEC ? 'x' : '-', 60 flags & VM_EXEC ? 'x' : '-',
61 flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p', 61 flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
62 vma->vm_pgoff << PAGE_SHIFT, 62 ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
63 MAJOR(dev), MINOR(dev), ino, &len); 63 MAJOR(dev), MINOR(dev), ino, &len);
64 64
65 if (file) { 65 if (file) {
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 7546a918f790..73d1891ee625 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -219,14 +219,14 @@ static int show_map(struct seq_file *m, void *v)
219 ino = inode->i_ino; 219 ino = inode->i_ino;
220 } 220 }
221 221
222 seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n", 222 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
223 vma->vm_start, 223 vma->vm_start,
224 vma->vm_end, 224 vma->vm_end,
225 flags & VM_READ ? 'r' : '-', 225 flags & VM_READ ? 'r' : '-',
226 flags & VM_WRITE ? 'w' : '-', 226 flags & VM_WRITE ? 'w' : '-',
227 flags & VM_EXEC ? 'x' : '-', 227 flags & VM_EXEC ? 'x' : '-',
228 flags & VM_MAYSHARE ? 's' : 'p', 228 flags & VM_MAYSHARE ? 's' : 'p',
229 vma->vm_pgoff << PAGE_SHIFT, 229 ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
230 MAJOR(dev), MINOR(dev), ino, &len); 230 MAJOR(dev), MINOR(dev), ino, &len);
231 231
232 /* 232 /*
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
index cdc2d3464a1a..2813cdd72375 100644
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -18,7 +18,6 @@
18#ifndef __XFS_DMAPI_H__ 18#ifndef __XFS_DMAPI_H__
19#define __XFS_DMAPI_H__ 19#define __XFS_DMAPI_H__
20 20
21#include <linux/version.h>
22/* Values used to define the on-disk version of dm_attrname_t. All 21/* Values used to define the on-disk version of dm_attrname_t. All
23 * on-disk attribute names start with the 8-byte string "SGI_DMI_". 22 * on-disk attribute names start with the 8-byte string "SGI_DMI_".
24 * 23 *
diff --git a/include/asm-cris/Kbuild b/include/asm-cris/Kbuild
index b7037d80d461..d5b631935ec8 100644
--- a/include/asm-cris/Kbuild
+++ b/include/asm-cris/Kbuild
@@ -1,6 +1,5 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += arch/
4header-y += arch-v10/ 3header-y += arch-v10/
5header-y += arch-v32/ 4header-y += arch-v32/
6 5
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 20e44fe00abf..ca7475e73b5e 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -271,6 +271,8 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
272} 272}
273 273
274#define ioremap_wc ioremap_nocache
275
274extern void iounmap(void volatile __iomem *addr); 276extern void iounmap(void volatile __iomem *addr);
275 277
276static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 278static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
diff --git a/include/asm-mn10300/io.h b/include/asm-mn10300/io.h
index b8b6dc878250..c1a4119e6497 100644
--- a/include/asm-mn10300/io.h
+++ b/include/asm-mn10300/io.h
@@ -259,6 +259,8 @@ static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
259 return (void *) (offset | 0x20000000); 259 return (void *) (offset | 0x20000000);
260} 260}
261 261
262#define ioremap_wc ioremap_nocache
263
262static inline void iounmap(void *addr) 264static inline void iounmap(void *addr)
263{ 265{
264} 266}
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
index 2f5a792b0acc..762f6a6bc707 100644
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -91,6 +91,7 @@
91#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ 91#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
92#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ 92#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
93#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ 93#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */
94#define X86_FEATURE_XMM4_2 (4*32+20) /* Streaming SIMD Extensions-4.2 */
94 95
95/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ 96/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
96#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ 97#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */
@@ -189,6 +190,7 @@ extern const char * const x86_power_flags[32];
189#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) 190#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
190#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) 191#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
191#define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT) 192#define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT)
193#define cpu_has_xmm4_2 boot_cpu_has(X86_FEATURE_XMM4_2)
192 194
193#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) 195#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
194# define cpu_has_invlpg 1 196# define cpu_has_invlpg 1
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index ca110ee73f07..2362cfda1fbc 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -52,14 +52,14 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
52{ 52{
53 DECLARE_ARGS(val, low, high); 53 DECLARE_ARGS(val, low, high);
54 54
55 asm volatile("2: rdmsr ; xor %0,%0\n" 55 asm volatile("2: rdmsr ; xor %[err],%[err]\n"
56 "1:\n\t" 56 "1:\n\t"
57 ".section .fixup,\"ax\"\n\t" 57 ".section .fixup,\"ax\"\n\t"
58 "3: mov %3,%0 ; jmp 1b\n\t" 58 "3: mov %[fault],%[err] ; jmp 1b\n\t"
59 ".previous\n\t" 59 ".previous\n\t"
60 _ASM_EXTABLE(2b, 3b) 60 _ASM_EXTABLE(2b, 3b)
61 : "=r" (*err), EAX_EDX_RET(val, low, high) 61 : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
62 : "c" (msr), "i" (-EFAULT)); 62 : "c" (msr), [fault] "i" (-EFAULT));
63 return EAX_EDX_VAL(val, low, high); 63 return EAX_EDX_VAL(val, low, high);
64} 64}
65 65
@@ -73,15 +73,15 @@ static inline int native_write_msr_safe(unsigned int msr,
73 unsigned low, unsigned high) 73 unsigned low, unsigned high)
74{ 74{
75 int err; 75 int err;
76 asm volatile("2: wrmsr ; xor %0,%0\n" 76 asm volatile("2: wrmsr ; xor %[err],%[err]\n"
77 "1:\n\t" 77 "1:\n\t"
78 ".section .fixup,\"ax\"\n\t" 78 ".section .fixup,\"ax\"\n\t"
79 "3: mov %4,%0 ; jmp 1b\n\t" 79 "3: mov %[fault],%[err] ; jmp 1b\n\t"
80 ".previous\n\t" 80 ".previous\n\t"
81 _ASM_EXTABLE(2b, 3b) 81 _ASM_EXTABLE(2b, 3b)
82 : "=a" (err) 82 : [err] "=a" (err)
83 : "c" (msr), "0" (low), "d" (high), 83 : "c" (msr), "0" (low), "d" (high),
84 "i" (-EFAULT) 84 [fault] "i" (-EFAULT)
85 : "memory"); 85 : "memory");
86 return err; 86 return err;
87} 87}
@@ -192,19 +192,20 @@ do { \
192#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) 192#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
193 193
194#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
195void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 195int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
196void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 196int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
197int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 197int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
198
199int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 198int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
200#else /* CONFIG_SMP */ 199#else /* CONFIG_SMP */
201static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) 200static inline int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
202{ 201{
203 rdmsr(msr_no, *l, *h); 202 rdmsr(msr_no, *l, *h);
203 return 0;
204} 204}
205static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) 205static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
206{ 206{
207 wrmsr(msr_no, l, h); 207 wrmsr(msr_no, l, h);
208 return 0;
208} 209}
209static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, 210static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no,
210 u32 *l, u32 *h) 211 u32 *l, u32 *h)
diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h
index 8e15dd28c91f..04ee0610014a 100644
--- a/include/asm-x86/xen/hypervisor.h
+++ b/include/asm-x86/xen/hypervisor.h
@@ -35,7 +35,6 @@
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/version.h>
39 38
40#include <xen/interface/xen.h> 39#include <xen/interface/xen.h>
41#include <xen/interface/version.h> 40#include <xen/interface/version.h>
diff --git a/include/linux/device.h b/include/linux/device.h
index d24a47f80f9c..4d8372d135df 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -358,6 +358,7 @@ struct device {
358 358
359 struct kobject kobj; 359 struct kobject kobj;
360 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 360 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
361 const char *init_name; /* initial name of the device */
361 struct device_type *type; 362 struct device_type *type;
362 unsigned uevent_suppress:1; 363 unsigned uevent_suppress:1;
363 364
@@ -406,7 +407,7 @@ struct device {
406/* Get the wakeup routines, which depend on struct device */ 407/* Get the wakeup routines, which depend on struct device */
407#include <linux/pm_wakeup.h> 408#include <linux/pm_wakeup.h>
408 409
409static inline const char *dev_name(struct device *dev) 410static inline const char *dev_name(const struct device *dev)
410{ 411{
411 /* will be changed into kobject_name(&dev->kobj) in the near future */ 412 /* will be changed into kobject_name(&dev->kobj) in the near future */
412 return dev->bus_id; 413 return dev->bus_id;
@@ -518,7 +519,7 @@ extern void device_shutdown(void);
518extern void sysdev_shutdown(void); 519extern void sysdev_shutdown(void);
519 520
520/* debugging and troubleshooting/diagnostic helpers. */ 521/* debugging and troubleshooting/diagnostic helpers. */
521extern const char *dev_driver_string(struct device *dev); 522extern const char *dev_driver_string(const struct device *dev);
522#define dev_printk(level, dev, format, arg...) \ 523#define dev_printk(level, dev, format, arg...) \
523 printk(level "%s %s: " format , dev_driver_string(dev) , \ 524 printk(level "%s %s: " format , dev_driver_string(dev) , \
524 dev_name(dev) , ## arg) 525 dev_name(dev) , ## arg)
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index f5abd1306638..27e772cefb6a 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -35,6 +35,27 @@ enum fid_type {
35 FILEID_INO32_GEN_PARENT = 2, 35 FILEID_INO32_GEN_PARENT = 2,
36 36
37 /* 37 /*
38 * 64 bit object ID, 64 bit root object ID,
39 * 32 bit generation number.
40 */
41 FILEID_BTRFS_WITHOUT_PARENT = 0x4d,
42
43 /*
44 * 64 bit object ID, 64 bit root object ID,
45 * 32 bit generation number,
46 * 64 bit parent object ID, 32 bit parent generation.
47 */
48 FILEID_BTRFS_WITH_PARENT = 0x4e,
49
50 /*
51 * 64 bit object ID, 64 bit root object ID,
52 * 32 bit generation number,
53 * 64 bit parent object ID, 32 bit parent generation,
54 * 64 bit parent root object ID.
55 */
56 FILEID_BTRFS_WITH_PARENT_ROOT = 0x4f,
57
58 /*
38 * 32 bit block number, 16 bit partition reference, 59 * 32 bit block number, 16 bit partition reference,
39 * 16 bit unused, 32 bit generation number. 60 * 16 bit unused, 32 bit generation number.
40 */ 61 */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 3b8870e32afd..531ccd5f5960 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -976,6 +976,9 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
976 976
977/* drivers/video/fb_defio.c */ 977/* drivers/video/fb_defio.c */
978extern void fb_deferred_io_init(struct fb_info *info); 978extern void fb_deferred_io_init(struct fb_info *info);
979extern void fb_deferred_io_open(struct fb_info *info,
980 struct inode *inode,
981 struct file *file);
979extern void fb_deferred_io_cleanup(struct fb_info *info); 982extern void fb_deferred_io_cleanup(struct fb_info *info);
980extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 983extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
981 int datasync); 984 int datasync);
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h
index 809bb9ffc788..36b61ff39277 100644
--- a/include/linux/fs_uart_pd.h
+++ b/include/linux/fs_uart_pd.h
@@ -12,7 +12,6 @@
12#ifndef FS_UART_PD_H 12#ifndef FS_UART_PD_H
13#define FS_UART_PD_H 13#define FS_UART_PD_H
14 14
15#include <linux/version.h>
16#include <asm/types.h> 15#include <asm/types.h>
17 16
18enum fs_uart_id { 17enum fs_uart_id {
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 4c6307ad9fdb..8529f57ba263 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -45,6 +45,7 @@
45#define TUNGETFEATURES _IOR('T', 207, unsigned int) 45#define TUNGETFEATURES _IOR('T', 207, unsigned int)
46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) 46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
47#define TUNSETTXFILTER _IOW('T', 209, unsigned int) 47#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
48#define TUNGETIFF _IOR('T', 210, unsigned int)
48 49
49/* TUNSETIFF ifr flags */ 50/* TUNSETIFF ifr flags */
50#define IFF_TUN 0x0001 51#define IFF_TUN 0x0001
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 06b80337303b..225bfc5bd9ec 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -163,6 +163,7 @@ enum {
163 ATA_DEV_NONE = 9, /* no device */ 163 ATA_DEV_NONE = 9, /* no device */
164 164
165 /* struct ata_link flags */ 165 /* struct ata_link flags */
166 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
166 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 167 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
167 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 168 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
168 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ 169 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
@@ -646,6 +647,7 @@ struct ata_link {
646 647
647 unsigned int flags; /* ATA_LFLAG_xxx */ 648 unsigned int flags; /* ATA_LFLAG_xxx */
648 649
650 u32 saved_scontrol; /* SControl on probe */
649 unsigned int hw_sata_spd_limit; 651 unsigned int hw_sata_spd_limit;
650 unsigned int sata_spd_limit; 652 unsigned int sata_spd_limit;
651 unsigned int sata_spd; /* current SATA PHY speed */ 653 unsigned int sata_spd; /* current SATA PHY speed */
@@ -1427,6 +1429,28 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies,
1427 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1429 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1428} 1430}
1429 1431
1432/* Don't open code these in drivers as there are traps. Firstly the range may
1433 change in future hardware and specs, secondly 0xFF means 'no DMA' but is
1434 > UDMA_0. Dyma ddreigiau */
1435
1436static inline int ata_using_mwdma(struct ata_device *adev)
1437{
1438 if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4)
1439 return 1;
1440 return 0;
1441}
1442
1443static inline int ata_using_udma(struct ata_device *adev)
1444{
1445 if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7)
1446 return 1;
1447 return 0;
1448}
1449
1450static inline int ata_dma_enabled(struct ata_device *adev)
1451{
1452 return (adev->dma_mode == 0xFF ? 0 : 1);
1453}
1430 1454
1431/************************************************************************** 1455/**************************************************************************
1432 * PMP - drivers/ata/libata-pmp.c 1456 * PMP - drivers/ata/libata-pmp.c
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 3ba25065fa96..8837928fbf33 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -57,6 +57,15 @@ static inline acpi_status pcie_osc_support_set(u32 flags)
57{ 57{
58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); 58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
59} 59}
60static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
61{
62 /* Find root host bridge */
63 while (pdev->bus->self)
64 pdev = pdev->bus->self;
65
66 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
67 pdev->bus->number);
68}
60#else 69#else
61#if !defined(AE_ERROR) 70#if !defined(AE_ERROR)
62typedef u32 acpi_status; 71typedef u32 acpi_status;
@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
66{return AE_ERROR;} 75{return AE_ERROR;}
67static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 76static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
68static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} 77static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
78static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
79{ return NULL; }
69#endif 80#endif
70 81
71#endif /* _PCI_ACPI_H_ */ 82#endif /* _PCI_ACPI_H_ */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9ec2bcce8e83..f1624b396754 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2428,6 +2428,9 @@
2428#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2428#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a
2429#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2429#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2430#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2430#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2431#define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10
2432#define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11
2433#define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30
2431#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2434#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2432#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2435#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2433#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2436#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 22921ac4cfd9..d7e98ff8021e 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -161,4 +161,13 @@ pid_t pid_vnr(struct pid *pid);
161 } \ 161 } \
162 } while (0) 162 } while (0)
163 163
164#define do_each_pid_thread(pid, type, task) \
165 do_each_pid_task(pid, type, task) { \
166 struct task_struct *tg___ = task; \
167 do {
168
169#define while_each_pid_thread(pid, type, task) \
170 } while_each_thread(tg___, task); \
171 task = tg___; \
172 } while_each_pid_task(pid, type, task)
164#endif /* _LINUX_PID_H */ 173#endif /* _LINUX_PID_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 69407f85e10b..fed6f5e0b411 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -102,7 +102,7 @@ int try_to_unmap(struct page *, int ignore_refs);
102 * Called from mm/filemap_xip.c to unmap empty zero page 102 * Called from mm/filemap_xip.c to unmap empty zero page
103 */ 103 */
104pte_t *page_check_address(struct page *, struct mm_struct *, 104pte_t *page_check_address(struct page *, struct mm_struct *,
105 unsigned long, spinlock_t **); 105 unsigned long, spinlock_t **, int);
106 106
107/* 107/*
108 * Used by swapoff to help locate where page is expected in vma. 108 * Used by swapoff to help locate where page is expected in vma.
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 358661c9990e..909923717830 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1452,6 +1452,10 @@ extern int skb_copy_datagram_iovec(const struct sk_buff *from,
1452extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, 1452extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1453 int hlen, 1453 int hlen,
1454 struct iovec *iov); 1454 struct iovec *iov);
1455extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1456 int offset,
1457 struct iovec *from,
1458 int len);
1455extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1459extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1456extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1460extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1457 unsigned int flags); 1461 unsigned int flags);
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d3c02695dc5d..8cf8cfe2cc97 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -74,10 +74,13 @@ extern struct tick_device *tick_get_device(int cpu);
74extern int tick_init_highres(void); 74extern int tick_init_highres(void);
75extern int tick_program_event(ktime_t expires, int force); 75extern int tick_program_event(ktime_t expires, int force);
76extern void tick_setup_sched_timer(void); 76extern void tick_setup_sched_timer(void);
77# endif
78
79# if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
77extern void tick_cancel_sched_timer(int cpu); 80extern void tick_cancel_sched_timer(int cpu);
78# else 81# else
79static inline void tick_cancel_sched_timer(int cpu) { } 82static inline void tick_cancel_sched_timer(int cpu) { }
80# endif /* HIGHRES */ 83# endif
81 84
82# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
83extern struct tick_device *tick_get_broadcast_device(void); 86extern struct tick_device *tick_get_broadcast_device(void);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0924cd9c30f6..94ac74aba6b6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -110,6 +110,8 @@ enum usb_interface_condition {
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
112 * capability during autosuspend. 112 * capability during autosuspend.
113 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
114 * has been deferred.
113 * @needs_binding: flag set when the driver should be re-probed or unbound 115 * @needs_binding: flag set when the driver should be re-probed or unbound
114 * following a reset or suspend operation it doesn't support. 116 * following a reset or suspend operation it doesn't support.
115 * @dev: driver model's view of this device 117 * @dev: driver model's view of this device
@@ -162,6 +164,7 @@ struct usb_interface {
162 unsigned is_active:1; /* the interface is not suspended */ 164 unsigned is_active:1; /* the interface is not suspended */
163 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 165 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
164 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 166 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
167 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
165 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 168 unsigned needs_binding:1; /* needs delayed unbind/rebind */
166 169
167 struct device dev; /* interface specific device info */ 170 struct device dev; /* interface specific device info */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 06b28142b3ab..c216de528b08 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -80,7 +80,8 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
80 struct net_device *dev, 80 struct net_device *dev,
81 int strict); 81 int strict);
82 82
83extern int ipv6_dev_get_saddr(struct net_device *dev, 83extern int ipv6_dev_get_saddr(struct net *net,
84 struct net_device *dev,
84 const struct in6_addr *daddr, 85 const struct in6_addr *daddr,
85 unsigned int srcprefs, 86 unsigned int srcprefs,
86 struct in6_addr *saddr); 87 struct in6_addr *saddr);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index bc391ba101e9..5f53db7e4e57 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -107,6 +107,7 @@ struct rt6_rtnl_dump_arg
107{ 107{
108 struct sk_buff *skb; 108 struct sk_buff *skb;
109 struct netlink_callback *cb; 109 struct netlink_callback *cb;
110 struct net *net;
110}; 111};
111 112
112extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 113extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b397e4d984c7..ff137fd7714f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -708,10 +708,7 @@ enum ieee80211_tkip_key_type {
708 * rely on the host system for such buffering. This option is used 708 * rely on the host system for such buffering. This option is used
709 * to configure the IEEE 802.11 upper layer to buffer broadcast and 709 * to configure the IEEE 802.11 upper layer to buffer broadcast and
710 * multicast frames when there are power saving stations so that 710 * multicast frames when there are power saving stations so that
711 * the driver can fetch them with ieee80211_get_buffered_bc(). Note 711 * the driver can fetch them with ieee80211_get_buffered_bc().
712 * that not setting this flag works properly only when the
713 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
714 * otherwise the stack will not know when the DTIM beacon was sent.
715 * 712 *
716 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE: 713 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
717 * Hardware is not capable of short slot operation on the 2.4 GHz band. 714 * Hardware is not capable of short slot operation on the 2.4 GHz band.
@@ -1099,10 +1096,8 @@ enum ieee80211_ampdu_mlme_action {
1099 * See the section "Frame filtering" for more information. 1096 * See the section "Frame filtering" for more information.
1100 * This callback must be implemented and atomic. 1097 * This callback must be implemented and atomic.
1101 * 1098 *
1102 * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon 1099 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1103 * generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set) 1100 * must be set or cleared for a given AID. Must be atomic.
1104 * mac80211 calls this function when a TIM bit must be set or cleared
1105 * for a given AID. Must be atomic.
1106 * 1101 *
1107 * @set_key: See the section "Hardware crypto acceleration" 1102 * @set_key: See the section "Hardware crypto acceleration"
1108 * This callback can sleep, and is only called between add_interface 1103 * This callback can sleep, and is only called between add_interface
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 853fe83d9f37..b786a5b09253 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -78,6 +78,7 @@ extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
78 78
79extern int register_qdisc(struct Qdisc_ops *qops); 79extern int register_qdisc(struct Qdisc_ops *qops);
80extern int unregister_qdisc(struct Qdisc_ops *qops); 80extern int unregister_qdisc(struct Qdisc_ops *qops);
81extern void qdisc_list_del(struct Qdisc *q);
81extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); 82extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
82extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); 83extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
83extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, 84extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a7abfda3e447..b1d2cfea89c5 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -27,6 +27,7 @@ enum qdisc_state_t
27{ 27{
28 __QDISC_STATE_RUNNING, 28 __QDISC_STATE_RUNNING,
29 __QDISC_STATE_SCHED, 29 __QDISC_STATE_SCHED,
30 __QDISC_STATE_DEACTIVATED,
30}; 31};
31 32
32struct qdisc_size_table { 33struct qdisc_size_table {
@@ -60,7 +61,6 @@ struct Qdisc
60 struct gnet_stats_basic bstats; 61 struct gnet_stats_basic bstats;
61 struct gnet_stats_queue qstats; 62 struct gnet_stats_queue qstats;
62 struct gnet_stats_rate_est rate_est; 63 struct gnet_stats_rate_est rate_est;
63 struct rcu_head q_rcu;
64 int (*reshape_fail)(struct sk_buff *skb, 64 int (*reshape_fail)(struct sk_buff *skb,
65 struct Qdisc *q); 65 struct Qdisc *q);
66 66
@@ -193,6 +193,11 @@ static inline struct Qdisc *qdisc_root(struct Qdisc *qdisc)
193 return qdisc->dev_queue->qdisc; 193 return qdisc->dev_queue->qdisc;
194} 194}
195 195
196static inline struct Qdisc *qdisc_root_sleeping(struct Qdisc *qdisc)
197{
198 return qdisc->dev_queue->qdisc_sleeping;
199}
200
196/* The qdisc root lock is a mechanism by which to top level 201/* The qdisc root lock is a mechanism by which to top level
197 * of a qdisc tree can be locked from any qdisc node in the 202 * of a qdisc tree can be locked from any qdisc node in the
198 * forest. This allows changing the configuration of some 203 * forest. This allows changing the configuration of some
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 291d56a19167..80b2e93c2936 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -6,6 +6,7 @@
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <scsi/scsi.h>
9#include <asm/atomic.h> 10#include <asm/atomic.h>
10 11
11struct request_queue; 12struct request_queue;
@@ -426,7 +427,7 @@ static inline int scsi_device_enclosure(struct scsi_device *sdev)
426 427
427static inline int scsi_device_protection(struct scsi_device *sdev) 428static inline int scsi_device_protection(struct scsi_device *sdev)
428{ 429{
429 return sdev->inquiry[5] & (1<<0); 430 return sdev->scsi_level > SCSI_2 && sdev->inquiry[5] & (1<<0);
430} 431}
431 432
432#define MODULE_ALIAS_SCSI_DEVICE(type) \ 433#define MODULE_ALIAS_SCSI_DEVICE(type) \
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 21575fc46d05..1d3ef29a2583 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/version.h>
18#include <linux/nsproxy.h> 17#include <linux/nsproxy.h>
19#include <linux/init_task.h> 18#include <linux/init_task.h>
20#include <linux/mnt_namespace.h> 19#include <linux/mnt_namespace.h>
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index a0abf9a463f9..80ccac849e46 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -14,7 +14,6 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/file.h> 15#include <linux/file.h>
16#include <linux/utsname.h> 16#include <linux/utsname.h>
17#include <linux/version.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <linux/bitops.h> 18#include <linux/bitops.h>
20#include <linux/genhd.h> 19#include <linux/genhd.h>
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index f14f372cf6f5..467d5940f624 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -77,6 +77,7 @@ void wakeme_after_rcu(struct rcu_head *head)
77 * sections are delimited by rcu_read_lock() and rcu_read_unlock(), 77 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
78 * and may be nested. 78 * and may be nested.
79 */ 79 */
80void synchronize_rcu(void); /* Makes kernel-doc tools happy */
80synchronize_rcu_xxx(synchronize_rcu, call_rcu) 81synchronize_rcu_xxx(synchronize_rcu, call_rcu)
81EXPORT_SYMBOL_GPL(synchronize_rcu); 82EXPORT_SYMBOL_GPL(synchronize_rcu);
82 83
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 862b06bd560a..9353ca78154e 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -8,6 +8,6 @@ SCHED_FEAT(SYNC_WAKEUPS, 1)
8SCHED_FEAT(HRTICK, 1) 8SCHED_FEAT(HRTICK, 1)
9SCHED_FEAT(DOUBLE_TICK, 0) 9SCHED_FEAT(DOUBLE_TICK, 0)
10SCHED_FEAT(ASYM_GRAN, 1) 10SCHED_FEAT(ASYM_GRAN, 1)
11SCHED_FEAT(LB_BIAS, 0) 11SCHED_FEAT(LB_BIAS, 1)
12SCHED_FEAT(LB_WAKEUP_UPDATE, 1) 12SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
13SCHED_FEAT(ASYM_EFF_LOAD, 1) 13SCHED_FEAT(ASYM_EFF_LOAD, 1)
diff --git a/kernel/signal.c b/kernel/signal.c
index c539f60c6f41..e661b01d340f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1338,6 +1338,7 @@ int do_notify_parent(struct task_struct *tsk, int sig)
1338 struct siginfo info; 1338 struct siginfo info;
1339 unsigned long flags; 1339 unsigned long flags;
1340 struct sighand_struct *psig; 1340 struct sighand_struct *psig;
1341 int ret = sig;
1341 1342
1342 BUG_ON(sig == -1); 1343 BUG_ON(sig == -1);
1343 1344
@@ -1402,7 +1403,7 @@ int do_notify_parent(struct task_struct *tsk, int sig)
1402 * is implementation-defined: we do (if you don't want 1403 * is implementation-defined: we do (if you don't want
1403 * it, just use SIG_IGN instead). 1404 * it, just use SIG_IGN instead).
1404 */ 1405 */
1405 tsk->exit_signal = -1; 1406 ret = tsk->exit_signal = -1;
1406 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) 1407 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
1407 sig = -1; 1408 sig = -1;
1408 } 1409 }
@@ -1411,7 +1412,7 @@ int do_notify_parent(struct task_struct *tsk, int sig)
1411 __wake_up_parent(tsk, tsk->parent); 1412 __wake_up_parent(tsk, tsk->parent);
1412 spin_unlock_irqrestore(&psig->siglock, flags); 1413 spin_unlock_irqrestore(&psig->siglock, flags);
1413 1414
1414 return sig; 1415 return ret;
1415} 1416}
1416 1417
1417static void do_notify_parent_cldstop(struct task_struct *tsk, int why) 1418static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
diff --git a/kernel/smp.c b/kernel/smp.c
index 782e2b93e465..f362a8553777 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -210,8 +210,10 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
210{ 210{
211 struct call_single_data d; 211 struct call_single_data d;
212 unsigned long flags; 212 unsigned long flags;
213 /* prevent preemption and reschedule on another processor */ 213 /* prevent preemption and reschedule on another processor,
214 as well as CPU removal */
214 int me = get_cpu(); 215 int me = get_cpu();
216 int err = 0;
215 217
216 /* Can deadlock when called with interrupts disabled */ 218 /* Can deadlock when called with interrupts disabled */
217 WARN_ON(irqs_disabled()); 219 WARN_ON(irqs_disabled());
@@ -220,7 +222,7 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
220 local_irq_save(flags); 222 local_irq_save(flags);
221 func(info); 223 func(info);
222 local_irq_restore(flags); 224 local_irq_restore(flags);
223 } else { 225 } else if ((unsigned)cpu < NR_CPUS && cpu_online(cpu)) {
224 struct call_single_data *data = NULL; 226 struct call_single_data *data = NULL;
225 227
226 if (!wait) { 228 if (!wait) {
@@ -236,10 +238,12 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
236 data->func = func; 238 data->func = func;
237 data->info = info; 239 data->info = info;
238 generic_exec_single(cpu, data); 240 generic_exec_single(cpu, data);
241 } else {
242 err = -ENXIO; /* CPU not online */
239 } 243 }
240 244
241 put_cpu(); 245 put_cpu();
242 return 0; 246 return err;
243} 247}
244EXPORT_SYMBOL(smp_call_function_single); 248EXPORT_SYMBOL(smp_call_function_single);
245 249
diff --git a/kernel/sys.c b/kernel/sys.c
index 3dacb00a7f76..038a7bc0901d 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -169,9 +169,9 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
169 pgrp = find_vpid(who); 169 pgrp = find_vpid(who);
170 else 170 else
171 pgrp = task_pgrp(current); 171 pgrp = task_pgrp(current);
172 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 172 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
173 error = set_one_prio(p, niceval, error); 173 error = set_one_prio(p, niceval, error);
174 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 174 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
175 break; 175 break;
176 case PRIO_USER: 176 case PRIO_USER:
177 user = current->user; 177 user = current->user;
@@ -229,11 +229,11 @@ asmlinkage long sys_getpriority(int which, int who)
229 pgrp = find_vpid(who); 229 pgrp = find_vpid(who);
230 else 230 else
231 pgrp = task_pgrp(current); 231 pgrp = task_pgrp(current);
232 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 232 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
233 niceval = 20 - task_nice(p); 233 niceval = 20 - task_nice(p);
234 if (niceval > retval) 234 if (niceval > retval)
235 retval = niceval; 235 retval = niceval;
236 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 236 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
237 break; 237 break;
238 case PRIO_USER: 238 case PRIO_USER:
239 user = current->user; 239 user = current->user;
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f5da526424a9..7a46bde78c66 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -643,17 +643,21 @@ void tick_setup_sched_timer(void)
643 ts->nohz_mode = NOHZ_MODE_HIGHRES; 643 ts->nohz_mode = NOHZ_MODE_HIGHRES;
644#endif 644#endif
645} 645}
646#endif /* HIGH_RES_TIMERS */
646 647
648#if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
647void tick_cancel_sched_timer(int cpu) 649void tick_cancel_sched_timer(int cpu)
648{ 650{
649 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); 651 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
650 652
653# ifdef CONFIG_HIGH_RES_TIMERS
651 if (ts->sched_timer.base) 654 if (ts->sched_timer.base)
652 hrtimer_cancel(&ts->sched_timer); 655 hrtimer_cancel(&ts->sched_timer);
656# endif
653 657
654 ts->nohz_mode = NOHZ_MODE_INACTIVE; 658 ts->nohz_mode = NOHZ_MODE_INACTIVE;
655} 659}
656#endif /* HIGH_RES_TIMERS */ 660#endif
657 661
658/** 662/**
659 * Async notification about clocksource changes 663 * Async notification about clocksource changes
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index a9ab0596de44..532858fa5b88 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/version.h>
10#include <linux/nsproxy.h> 9#include <linux/nsproxy.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 64d398f12444..815237a55af8 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/uts.h> 13#include <linux/uts.h>
14#include <linux/utsname.h> 14#include <linux/utsname.h>
15#include <linux/version.h>
16#include <linux/err.h> 15#include <linux/err.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
18 17
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index fe3a56c2256d..4ab9659d269e 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/uts.h> 13#include <linux/uts.h>
14#include <linux/utsname.h> 14#include <linux/utsname.h>
15#include <linux/version.h>
16#include <linux/sysctl.h> 15#include <linux/sysctl.h>
17 16
18static void *get_uts(ctl_table *table, int write) 17static void *get_uts(ctl_table *table, int write)
diff --git a/lib/kobject.c b/lib/kobject.c
index bd732ffebc85..fbf0ae282376 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -223,8 +223,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
223 return -ENOMEM; 223 return -ENOMEM;
224 224
225 /* ewww... some of these buggers have '/' in the name ... */ 225 /* ewww... some of these buggers have '/' in the name ... */
226 s = strchr(kobj->name, '/'); 226 while ((s = strchr(kobj->name, '/')))
227 if (s)
228 s[0] = '!'; 227 s[0] = '!';
229 228
230 kfree(old_name); 229 kfree(old_name);
diff --git a/mm/bootmem.c b/mm/bootmem.c
index e023c68b0255..ad8eec6e44a8 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -405,6 +405,29 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size,
405} 405}
406#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 406#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
407 407
408static unsigned long align_idx(struct bootmem_data *bdata, unsigned long idx,
409 unsigned long step)
410{
411 unsigned long base = bdata->node_min_pfn;
412
413 /*
414 * Align the index with respect to the node start so that the
415 * combination of both satisfies the requested alignment.
416 */
417
418 return ALIGN(base + idx, step) - base;
419}
420
421static unsigned long align_off(struct bootmem_data *bdata, unsigned long off,
422 unsigned long align)
423{
424 unsigned long base = PFN_PHYS(bdata->node_min_pfn);
425
426 /* Same as align_idx for byte offsets */
427
428 return ALIGN(base + off, align) - base;
429}
430
408static void * __init alloc_bootmem_core(struct bootmem_data *bdata, 431static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
409 unsigned long size, unsigned long align, 432 unsigned long size, unsigned long align,
410 unsigned long goal, unsigned long limit) 433 unsigned long goal, unsigned long limit)
@@ -441,7 +464,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
441 else 464 else
442 start = ALIGN(min, step); 465 start = ALIGN(min, step);
443 466
444 sidx = start - bdata->node_min_pfn;; 467 sidx = start - bdata->node_min_pfn;
445 midx = max - bdata->node_min_pfn; 468 midx = max - bdata->node_min_pfn;
446 469
447 if (bdata->hint_idx > sidx) { 470 if (bdata->hint_idx > sidx) {
@@ -450,7 +473,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
450 * catch the fallback below. 473 * catch the fallback below.
451 */ 474 */
452 fallback = sidx + 1; 475 fallback = sidx + 1;
453 sidx = ALIGN(bdata->hint_idx, step); 476 sidx = align_idx(bdata, bdata->hint_idx, step);
454 } 477 }
455 478
456 while (1) { 479 while (1) {
@@ -459,7 +482,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
459 unsigned long eidx, i, start_off, end_off; 482 unsigned long eidx, i, start_off, end_off;
460find_block: 483find_block:
461 sidx = find_next_zero_bit(bdata->node_bootmem_map, midx, sidx); 484 sidx = find_next_zero_bit(bdata->node_bootmem_map, midx, sidx);
462 sidx = ALIGN(sidx, step); 485 sidx = align_idx(bdata, sidx, step);
463 eidx = sidx + PFN_UP(size); 486 eidx = sidx + PFN_UP(size);
464 487
465 if (sidx >= midx || eidx > midx) 488 if (sidx >= midx || eidx > midx)
@@ -467,7 +490,7 @@ find_block:
467 490
468 for (i = sidx; i < eidx; i++) 491 for (i = sidx; i < eidx; i++)
469 if (test_bit(i, bdata->node_bootmem_map)) { 492 if (test_bit(i, bdata->node_bootmem_map)) {
470 sidx = ALIGN(i, step); 493 sidx = align_idx(bdata, i, step);
471 if (sidx == i) 494 if (sidx == i)
472 sidx += step; 495 sidx += step;
473 goto find_block; 496 goto find_block;
@@ -475,7 +498,7 @@ find_block:
475 498
476 if (bdata->last_end_off & (PAGE_SIZE - 1) && 499 if (bdata->last_end_off & (PAGE_SIZE - 1) &&
477 PFN_DOWN(bdata->last_end_off) + 1 == sidx) 500 PFN_DOWN(bdata->last_end_off) + 1 == sidx)
478 start_off = ALIGN(bdata->last_end_off, align); 501 start_off = align_off(bdata, bdata->last_end_off, align);
479 else 502 else
480 start_off = PFN_PHYS(sidx); 503 start_off = PFN_PHYS(sidx);
481 504
@@ -499,7 +522,7 @@ find_block:
499 } 522 }
500 523
501 if (fallback) { 524 if (fallback) {
502 sidx = ALIGN(fallback - 1, step); 525 sidx = align_idx(bdata, fallback - 1, step);
503 fallback = 0; 526 fallback = 0;
504 goto find_block; 527 goto find_block;
505 } 528 }
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 380ab402d711..b5167dfb2f2d 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -15,6 +15,8 @@
15#include <linux/rmap.h> 15#include <linux/rmap.h>
16#include <linux/mmu_notifier.h> 16#include <linux/mmu_notifier.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/seqlock.h>
19#include <linux/mutex.h>
18#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
19#include <asm/io.h> 21#include <asm/io.h>
20 22
@@ -22,22 +24,18 @@
22 * We do use our own empty page to avoid interference with other users 24 * We do use our own empty page to avoid interference with other users
23 * of ZERO_PAGE(), such as /dev/zero 25 * of ZERO_PAGE(), such as /dev/zero
24 */ 26 */
27static DEFINE_MUTEX(xip_sparse_mutex);
28static seqcount_t xip_sparse_seq = SEQCNT_ZERO;
25static struct page *__xip_sparse_page; 29static struct page *__xip_sparse_page;
26 30
31/* called under xip_sparse_mutex */
27static struct page *xip_sparse_page(void) 32static struct page *xip_sparse_page(void)
28{ 33{
29 if (!__xip_sparse_page) { 34 if (!__xip_sparse_page) {
30 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO); 35 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
31 36
32 if (page) { 37 if (page)
33 static DEFINE_SPINLOCK(xip_alloc_lock); 38 __xip_sparse_page = page;
34 spin_lock(&xip_alloc_lock);
35 if (!__xip_sparse_page)
36 __xip_sparse_page = page;
37 else
38 __free_page(page);
39 spin_unlock(&xip_alloc_lock);
40 }
41 } 39 }
42 return __xip_sparse_page; 40 return __xip_sparse_page;
43} 41}
@@ -174,18 +172,23 @@ __xip_unmap (struct address_space * mapping,
174 pte_t pteval; 172 pte_t pteval;
175 spinlock_t *ptl; 173 spinlock_t *ptl;
176 struct page *page; 174 struct page *page;
175 unsigned count;
176 int locked = 0;
177
178 count = read_seqcount_begin(&xip_sparse_seq);
177 179
178 page = __xip_sparse_page; 180 page = __xip_sparse_page;
179 if (!page) 181 if (!page)
180 return; 182 return;
181 183
184retry:
182 spin_lock(&mapping->i_mmap_lock); 185 spin_lock(&mapping->i_mmap_lock);
183 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { 186 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
184 mm = vma->vm_mm; 187 mm = vma->vm_mm;
185 address = vma->vm_start + 188 address = vma->vm_start +
186 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 189 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
187 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 190 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
188 pte = page_check_address(page, mm, address, &ptl); 191 pte = page_check_address(page, mm, address, &ptl, 1);
189 if (pte) { 192 if (pte) {
190 /* Nuke the page table entry. */ 193 /* Nuke the page table entry. */
191 flush_cache_page(vma, address, pte_pfn(*pte)); 194 flush_cache_page(vma, address, pte_pfn(*pte));
@@ -198,6 +201,14 @@ __xip_unmap (struct address_space * mapping,
198 } 201 }
199 } 202 }
200 spin_unlock(&mapping->i_mmap_lock); 203 spin_unlock(&mapping->i_mmap_lock);
204
205 if (locked) {
206 mutex_unlock(&xip_sparse_mutex);
207 } else if (read_seqcount_retry(&xip_sparse_seq, count)) {
208 mutex_lock(&xip_sparse_mutex);
209 locked = 1;
210 goto retry;
211 }
201} 212}
202 213
203/* 214/*
@@ -218,7 +229,7 @@ static int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
218 int error; 229 int error;
219 230
220 /* XXX: are VM_FAULT_ codes OK? */ 231 /* XXX: are VM_FAULT_ codes OK? */
221 232again:
222 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 233 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
223 if (vmf->pgoff >= size) 234 if (vmf->pgoff >= size)
224 return VM_FAULT_SIGBUS; 235 return VM_FAULT_SIGBUS;
@@ -237,8 +248,10 @@ static int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
237 int err; 248 int err;
238 249
239 /* maybe shared writable, allocate new block */ 250 /* maybe shared writable, allocate new block */
251 mutex_lock(&xip_sparse_mutex);
240 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1, 252 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1,
241 &xip_mem, &xip_pfn); 253 &xip_mem, &xip_pfn);
254 mutex_unlock(&xip_sparse_mutex);
242 if (error) 255 if (error)
243 return VM_FAULT_SIGBUS; 256 return VM_FAULT_SIGBUS;
244 /* unmap sparse mappings at pgoff from all other vmas */ 257 /* unmap sparse mappings at pgoff from all other vmas */
@@ -252,14 +265,34 @@ found:
252 BUG_ON(err); 265 BUG_ON(err);
253 return VM_FAULT_NOPAGE; 266 return VM_FAULT_NOPAGE;
254 } else { 267 } else {
268 int err, ret = VM_FAULT_OOM;
269
270 mutex_lock(&xip_sparse_mutex);
271 write_seqcount_begin(&xip_sparse_seq);
272 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 0,
273 &xip_mem, &xip_pfn);
274 if (unlikely(!error)) {
275 write_seqcount_end(&xip_sparse_seq);
276 mutex_unlock(&xip_sparse_mutex);
277 goto again;
278 }
279 if (error != -ENODATA)
280 goto out;
255 /* not shared and writable, use xip_sparse_page() */ 281 /* not shared and writable, use xip_sparse_page() */
256 page = xip_sparse_page(); 282 page = xip_sparse_page();
257 if (!page) 283 if (!page)
258 return VM_FAULT_OOM; 284 goto out;
285 err = vm_insert_page(vma, (unsigned long)vmf->virtual_address,
286 page);
287 if (err == -ENOMEM)
288 goto out;
259 289
260 page_cache_get(page); 290 ret = VM_FAULT_NOPAGE;
261 vmf->page = page; 291out:
262 return 0; 292 write_seqcount_end(&xip_sparse_seq);
293 mutex_unlock(&xip_sparse_mutex);
294
295 return ret;
263 } 296 }
264} 297}
265 298
@@ -308,8 +341,10 @@ __xip_file_write(struct file *filp, const char __user *buf,
308 &xip_mem, &xip_pfn); 341 &xip_mem, &xip_pfn);
309 if (status == -ENODATA) { 342 if (status == -ENODATA) {
310 /* we allocate a new page unmap it */ 343 /* we allocate a new page unmap it */
344 mutex_lock(&xip_sparse_mutex);
311 status = a_ops->get_xip_mem(mapping, index, 1, 345 status = a_ops->get_xip_mem(mapping, index, 1,
312 &xip_mem, &xip_pfn); 346 &xip_mem, &xip_pfn);
347 mutex_unlock(&xip_sparse_mutex);
313 if (!status) 348 if (!status)
314 /* unmap page at pgoff from all other vmas */ 349 /* unmap page at pgoff from all other vmas */
315 __xip_unmap(mapping, index); 350 __xip_unmap(mapping, index);
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 936ef2efd892..4e0e26591dfa 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -12,7 +12,7 @@
12#include "internal.h" 12#include "internal.h"
13 13
14#ifdef CONFIG_DEBUG_MEMORY_INIT 14#ifdef CONFIG_DEBUG_MEMORY_INIT
15int __meminitdata mminit_loglevel; 15int mminit_loglevel;
16 16
17#ifndef SECTIONS_SHIFT 17#ifndef SECTIONS_SHIFT
18#define SECTIONS_SHIFT 0 18#define SECTIONS_SHIFT 0
diff --git a/mm/rmap.c b/mm/rmap.c
index 1ea4e6fcee77..0383acfcb068 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -224,10 +224,14 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
224/* 224/*
225 * Check that @page is mapped at @address into @mm. 225 * Check that @page is mapped at @address into @mm.
226 * 226 *
227 * If @sync is false, page_check_address may perform a racy check to avoid
228 * the page table lock when the pte is not present (helpful when reclaiming
229 * highly shared pages).
230 *
227 * On success returns with pte mapped and locked. 231 * On success returns with pte mapped and locked.
228 */ 232 */
229pte_t *page_check_address(struct page *page, struct mm_struct *mm, 233pte_t *page_check_address(struct page *page, struct mm_struct *mm,
230 unsigned long address, spinlock_t **ptlp) 234 unsigned long address, spinlock_t **ptlp, int sync)
231{ 235{
232 pgd_t *pgd; 236 pgd_t *pgd;
233 pud_t *pud; 237 pud_t *pud;
@@ -249,7 +253,7 @@ pte_t *page_check_address(struct page *page, struct mm_struct *mm,
249 253
250 pte = pte_offset_map(pmd, address); 254 pte = pte_offset_map(pmd, address);
251 /* Make a quick check before getting the lock */ 255 /* Make a quick check before getting the lock */
252 if (!pte_present(*pte)) { 256 if (!sync && !pte_present(*pte)) {
253 pte_unmap(pte); 257 pte_unmap(pte);
254 return NULL; 258 return NULL;
255 } 259 }
@@ -281,7 +285,7 @@ static int page_referenced_one(struct page *page,
281 if (address == -EFAULT) 285 if (address == -EFAULT)
282 goto out; 286 goto out;
283 287
284 pte = page_check_address(page, mm, address, &ptl); 288 pte = page_check_address(page, mm, address, &ptl, 0);
285 if (!pte) 289 if (!pte)
286 goto out; 290 goto out;
287 291
@@ -450,7 +454,7 @@ static int page_mkclean_one(struct page *page, struct vm_area_struct *vma)
450 if (address == -EFAULT) 454 if (address == -EFAULT)
451 goto out; 455 goto out;
452 456
453 pte = page_check_address(page, mm, address, &ptl); 457 pte = page_check_address(page, mm, address, &ptl, 1);
454 if (!pte) 458 if (!pte)
455 goto out; 459 goto out;
456 460
@@ -659,23 +663,30 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
659 } 663 }
660 664
661 /* 665 /*
662 * It would be tidy to reset the PageAnon mapping here, 666 * Now that the last pte has gone, s390 must transfer dirty
663 * but that might overwrite a racing page_add_anon_rmap 667 * flag from storage key to struct page. We can usually skip
664 * which increments mapcount after us but sets mapping 668 * this if the page is anon, so about to be freed; but perhaps
665 * before us: so leave the reset to free_hot_cold_page, 669 * not if it's in swapcache - there might be another pte slot
666 * and remember that it's only reliable while mapped. 670 * containing the swap entry, but page not yet written to swap.
667 * Leaving it set also helps swapoff to reinstate ptes
668 * faster for those pages still in swapcache.
669 */ 671 */
670 if ((!PageAnon(page) || PageSwapCache(page)) && 672 if ((!PageAnon(page) || PageSwapCache(page)) &&
671 page_test_dirty(page)) { 673 page_test_dirty(page)) {
672 page_clear_dirty(page); 674 page_clear_dirty(page);
673 set_page_dirty(page); 675 set_page_dirty(page);
674 } 676 }
675 mem_cgroup_uncharge_page(page);
676 677
678 mem_cgroup_uncharge_page(page);
677 __dec_zone_page_state(page, 679 __dec_zone_page_state(page,
678 PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED); 680 PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED);
681 /*
682 * It would be tidy to reset the PageAnon mapping here,
683 * but that might overwrite a racing page_add_anon_rmap
684 * which increments mapcount after us but sets mapping
685 * before us: so leave the reset to free_hot_cold_page,
686 * and remember that it's only reliable while mapped.
687 * Leaving it set also helps swapoff to reinstate ptes
688 * faster for those pages still in swapcache.
689 */
679 } 690 }
680} 691}
681 692
@@ -697,7 +708,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
697 if (address == -EFAULT) 708 if (address == -EFAULT)
698 goto out; 709 goto out;
699 710
700 pte = page_check_address(page, mm, address, &ptl); 711 pte = page_check_address(page, mm, address, &ptl, 0);
701 if (!pte) 712 if (!pte)
702 goto out; 713 goto out;
703 714
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 167cf2dc8a03..797c3831cbec 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -60,7 +60,7 @@ void show_swap_cache_info(void)
60 printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n", 60 printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n",
61 swap_cache_info.add_total, swap_cache_info.del_total, 61 swap_cache_info.add_total, swap_cache_info.del_total,
62 swap_cache_info.find_success, swap_cache_info.find_total); 62 swap_cache_info.find_success, swap_cache_info.find_total);
63 printk("Free swap = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10)); 63 printk("Free swap = %ldkB\n", nr_swap_pages << (PAGE_SHIFT - 10));
64 printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10)); 64 printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
65} 65}
66 66
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 4e59df5f8e05..1edfdf4c095b 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -456,7 +456,7 @@ static void __exit bt_exit(void)
456subsys_initcall(bt_init); 456subsys_initcall(bt_init);
457module_exit(bt_exit); 457module_exit(bt_exit);
458 458
459MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 459MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
460MODULE_DESCRIPTION("Bluetooth Core ver " VERSION); 460MODULE_DESCRIPTION("Bluetooth Core ver " VERSION);
461MODULE_VERSION(VERSION); 461MODULE_VERSION(VERSION);
462MODULE_LICENSE("GPL"); 462MODULE_LICENSE("GPL");
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 12bba6207a8d..80ba30cf4b68 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -736,7 +736,7 @@ MODULE_PARM_DESC(compress_src, "Compress sources headers");
736module_param(compress_dst, bool, 0644); 736module_param(compress_dst, bool, 0644);
737MODULE_PARM_DESC(compress_dst, "Compress destination headers"); 737MODULE_PARM_DESC(compress_dst, "Compress destination headers");
738 738
739MODULE_AUTHOR("David Libault <david.libault@inventel.fr>, Maxim Krasnyansky <maxk@qualcomm.com>"); 739MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
740MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION); 740MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION);
741MODULE_VERSION(VERSION); 741MODULE_VERSION(VERSION);
742MODULE_LICENSE("GPL"); 742MODULE_LICENSE("GPL");
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index c85bf8f678dc..f4f6615cad9f 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -3,8 +3,6 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6#include <linux/platform_device.h>
7
8#include <net/bluetooth/bluetooth.h> 6#include <net/bluetooth/bluetooth.h>
9#include <net/bluetooth/hci_core.h> 7#include <net/bluetooth/hci_core.h>
10 8
@@ -12,10 +10,164 @@
12#undef BT_DBG 10#undef BT_DBG
13#define BT_DBG(D...) 11#define BT_DBG(D...)
14#endif 12#endif
13
14struct class *bt_class = NULL;
15EXPORT_SYMBOL_GPL(bt_class);
16
15static struct workqueue_struct *btaddconn; 17static struct workqueue_struct *btaddconn;
16static struct workqueue_struct *btdelconn; 18static struct workqueue_struct *btdelconn;
17 19
18static inline char *typetostr(int type) 20static inline char *link_typetostr(int type)
21{
22 switch (type) {
23 case ACL_LINK:
24 return "ACL";
25 case SCO_LINK:
26 return "SCO";
27 case ESCO_LINK:
28 return "eSCO";
29 default:
30 return "UNKNOWN";
31 }
32}
33
34static ssize_t show_link_type(struct device *dev, struct device_attribute *attr, char *buf)
35{
36 struct hci_conn *conn = dev_get_drvdata(dev);
37 return sprintf(buf, "%s\n", link_typetostr(conn->type));
38}
39
40static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf)
41{
42 struct hci_conn *conn = dev_get_drvdata(dev);
43 bdaddr_t bdaddr;
44 baswap(&bdaddr, &conn->dst);
45 return sprintf(buf, "%s\n", batostr(&bdaddr));
46}
47
48static ssize_t show_link_features(struct device *dev, struct device_attribute *attr, char *buf)
49{
50 struct hci_conn *conn = dev_get_drvdata(dev);
51
52 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
53 conn->features[0], conn->features[1],
54 conn->features[2], conn->features[3],
55 conn->features[4], conn->features[5],
56 conn->features[6], conn->features[7]);
57}
58
59#define LINK_ATTR(_name,_mode,_show,_store) \
60struct device_attribute link_attr_##_name = __ATTR(_name,_mode,_show,_store)
61
62static LINK_ATTR(type, S_IRUGO, show_link_type, NULL);
63static LINK_ATTR(address, S_IRUGO, show_link_address, NULL);
64static LINK_ATTR(features, S_IRUGO, show_link_features, NULL);
65
66static struct attribute *bt_link_attrs[] = {
67 &link_attr_type.attr,
68 &link_attr_address.attr,
69 &link_attr_features.attr,
70 NULL
71};
72
73static struct attribute_group bt_link_group = {
74 .attrs = bt_link_attrs,
75};
76
77static struct attribute_group *bt_link_groups[] = {
78 &bt_link_group,
79 NULL
80};
81
82static void bt_link_release(struct device *dev)
83{
84 void *data = dev_get_drvdata(dev);
85 kfree(data);
86}
87
88static struct device_type bt_link = {
89 .name = "link",
90 .groups = bt_link_groups,
91 .release = bt_link_release,
92};
93
94static void add_conn(struct work_struct *work)
95{
96 struct hci_conn *conn = container_of(work, struct hci_conn, work);
97
98 flush_workqueue(btdelconn);
99
100 if (device_add(&conn->dev) < 0) {
101 BT_ERR("Failed to register connection device");
102 return;
103 }
104}
105
106void hci_conn_add_sysfs(struct hci_conn *conn)
107{
108 struct hci_dev *hdev = conn->hdev;
109
110 BT_DBG("conn %p", conn);
111
112 conn->dev.type = &bt_link;
113 conn->dev.class = bt_class;
114 conn->dev.parent = &hdev->dev;
115
116 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "%s:%d",
117 hdev->name, conn->handle);
118
119 dev_set_drvdata(&conn->dev, conn);
120
121 device_initialize(&conn->dev);
122
123 INIT_WORK(&conn->work, add_conn);
124
125 queue_work(btaddconn, &conn->work);
126}
127
128/*
129 * The rfcomm tty device will possibly retain even when conn
130 * is down, and sysfs doesn't support move zombie device,
131 * so we should move the device before conn device is destroyed.
132 */
133static int __match_tty(struct device *dev, void *data)
134{
135 return !strncmp(dev->bus_id, "rfcomm", 6);
136}
137
138static void del_conn(struct work_struct *work)
139{
140 struct hci_conn *conn = container_of(work, struct hci_conn, work);
141 struct hci_dev *hdev = conn->hdev;
142
143 while (1) {
144 struct device *dev;
145
146 dev = device_find_child(&conn->dev, NULL, __match_tty);
147 if (!dev)
148 break;
149 device_move(dev, NULL);
150 put_device(dev);
151 }
152
153 device_del(&conn->dev);
154 put_device(&conn->dev);
155 hci_dev_put(hdev);
156}
157
158void hci_conn_del_sysfs(struct hci_conn *conn)
159{
160 BT_DBG("conn %p", conn);
161
162 if (!device_is_registered(&conn->dev))
163 return;
164
165 INIT_WORK(&conn->work, del_conn);
166
167 queue_work(btdelconn, &conn->work);
168}
169
170static inline char *host_typetostr(int type)
19{ 171{
20 switch (type) { 172 switch (type) {
21 case HCI_VIRTUAL: 173 case HCI_VIRTUAL:
@@ -40,7 +192,7 @@ static inline char *typetostr(int type)
40static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) 192static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
41{ 193{
42 struct hci_dev *hdev = dev_get_drvdata(dev); 194 struct hci_dev *hdev = dev_get_drvdata(dev);
43 return sprintf(buf, "%s\n", typetostr(hdev->type)); 195 return sprintf(buf, "%s\n", host_typetostr(hdev->type));
44} 196}
45 197
46static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) 198static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
@@ -221,183 +373,62 @@ static DEVICE_ATTR(sniff_max_interval, S_IRUGO | S_IWUSR,
221static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR, 373static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
222 show_sniff_min_interval, store_sniff_min_interval); 374 show_sniff_min_interval, store_sniff_min_interval);
223 375
224static struct device_attribute *bt_attrs[] = { 376static struct attribute *bt_host_attrs[] = {
225 &dev_attr_type, 377 &dev_attr_type.attr,
226 &dev_attr_name, 378 &dev_attr_name.attr,
227 &dev_attr_class, 379 &dev_attr_class.attr,
228 &dev_attr_address, 380 &dev_attr_address.attr,
229 &dev_attr_features, 381 &dev_attr_features.attr,
230 &dev_attr_manufacturer, 382 &dev_attr_manufacturer.attr,
231 &dev_attr_hci_version, 383 &dev_attr_hci_version.attr,
232 &dev_attr_hci_revision, 384 &dev_attr_hci_revision.attr,
233 &dev_attr_inquiry_cache, 385 &dev_attr_inquiry_cache.attr,
234 &dev_attr_idle_timeout, 386 &dev_attr_idle_timeout.attr,
235 &dev_attr_sniff_max_interval, 387 &dev_attr_sniff_max_interval.attr,
236 &dev_attr_sniff_min_interval, 388 &dev_attr_sniff_min_interval.attr,
237 NULL 389 NULL
238}; 390};
239 391
240static ssize_t show_conn_type(struct device *dev, struct device_attribute *attr, char *buf) 392static struct attribute_group bt_host_group = {
241{ 393 .attrs = bt_host_attrs,
242 struct hci_conn *conn = dev_get_drvdata(dev);
243 return sprintf(buf, "%s\n", conn->type == ACL_LINK ? "ACL" : "SCO");
244}
245
246static ssize_t show_conn_address(struct device *dev, struct device_attribute *attr, char *buf)
247{
248 struct hci_conn *conn = dev_get_drvdata(dev);
249 bdaddr_t bdaddr;
250 baswap(&bdaddr, &conn->dst);
251 return sprintf(buf, "%s\n", batostr(&bdaddr));
252}
253
254static ssize_t show_conn_features(struct device *dev, struct device_attribute *attr, char *buf)
255{
256 struct hci_conn *conn = dev_get_drvdata(dev);
257
258 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
259 conn->features[0], conn->features[1],
260 conn->features[2], conn->features[3],
261 conn->features[4], conn->features[5],
262 conn->features[6], conn->features[7]);
263}
264
265#define CONN_ATTR(_name,_mode,_show,_store) \
266struct device_attribute conn_attr_##_name = __ATTR(_name,_mode,_show,_store)
267
268static CONN_ATTR(type, S_IRUGO, show_conn_type, NULL);
269static CONN_ATTR(address, S_IRUGO, show_conn_address, NULL);
270static CONN_ATTR(features, S_IRUGO, show_conn_features, NULL);
271
272static struct device_attribute *conn_attrs[] = {
273 &conn_attr_type,
274 &conn_attr_address,
275 &conn_attr_features,
276 NULL
277}; 394};
278 395
279struct class *bt_class = NULL; 396static struct attribute_group *bt_host_groups[] = {
280EXPORT_SYMBOL_GPL(bt_class); 397 &bt_host_group,
281 398 NULL
282static struct bus_type bt_bus = {
283 .name = "bluetooth",
284}; 399};
285 400
286static struct platform_device *bt_platform; 401static void bt_host_release(struct device *dev)
287
288static void bt_release(struct device *dev)
289{ 402{
290 void *data = dev_get_drvdata(dev); 403 void *data = dev_get_drvdata(dev);
291 kfree(data); 404 kfree(data);
292} 405}
293 406
294static void add_conn(struct work_struct *work) 407static struct device_type bt_host = {
295{ 408 .name = "host",
296 struct hci_conn *conn = container_of(work, struct hci_conn, work); 409 .groups = bt_host_groups,
297 int i; 410 .release = bt_host_release,
298 411};
299 flush_workqueue(btdelconn);
300
301 if (device_add(&conn->dev) < 0) {
302 BT_ERR("Failed to register connection device");
303 return;
304 }
305
306 for (i = 0; conn_attrs[i]; i++)
307 if (device_create_file(&conn->dev, conn_attrs[i]) < 0)
308 BT_ERR("Failed to create connection attribute");
309}
310
311void hci_conn_add_sysfs(struct hci_conn *conn)
312{
313 struct hci_dev *hdev = conn->hdev;
314
315 BT_DBG("conn %p", conn);
316
317 conn->dev.bus = &bt_bus;
318 conn->dev.parent = &hdev->dev;
319
320 conn->dev.release = bt_release;
321
322 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "%s:%d",
323 hdev->name, conn->handle);
324
325 dev_set_drvdata(&conn->dev, conn);
326
327 device_initialize(&conn->dev);
328
329 INIT_WORK(&conn->work, add_conn);
330
331 queue_work(btaddconn, &conn->work);
332}
333
334/*
335 * The rfcomm tty device will possibly retain even when conn
336 * is down, and sysfs doesn't support move zombie device,
337 * so we should move the device before conn device is destroyed.
338 */
339static int __match_tty(struct device *dev, void *data)
340{
341 return !strncmp(dev->bus_id, "rfcomm", 6);
342}
343
344static void del_conn(struct work_struct *work)
345{
346 struct hci_conn *conn = container_of(work, struct hci_conn, work);
347 struct hci_dev *hdev = conn->hdev;
348
349 while (1) {
350 struct device *dev;
351
352 dev = device_find_child(&conn->dev, NULL, __match_tty);
353 if (!dev)
354 break;
355 device_move(dev, NULL);
356 put_device(dev);
357 }
358
359 device_del(&conn->dev);
360 put_device(&conn->dev);
361 hci_dev_put(hdev);
362}
363
364void hci_conn_del_sysfs(struct hci_conn *conn)
365{
366 BT_DBG("conn %p", conn);
367
368 if (!device_is_registered(&conn->dev))
369 return;
370
371 INIT_WORK(&conn->work, del_conn);
372
373 queue_work(btdelconn, &conn->work);
374}
375 412
376int hci_register_sysfs(struct hci_dev *hdev) 413int hci_register_sysfs(struct hci_dev *hdev)
377{ 414{
378 struct device *dev = &hdev->dev; 415 struct device *dev = &hdev->dev;
379 unsigned int i;
380 int err; 416 int err;
381 417
382 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); 418 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
383 419
384 dev->bus = &bt_bus; 420 dev->type = &bt_host;
421 dev->class = bt_class;
385 dev->parent = hdev->parent; 422 dev->parent = hdev->parent;
386 423
387 strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); 424 strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
388 425
389 dev->release = bt_release;
390
391 dev_set_drvdata(dev, hdev); 426 dev_set_drvdata(dev, hdev);
392 427
393 err = device_register(dev); 428 err = device_register(dev);
394 if (err < 0) 429 if (err < 0)
395 return err; 430 return err;
396 431
397 for (i = 0; bt_attrs[i]; i++)
398 if (device_create_file(dev, bt_attrs[i]) < 0)
399 BT_ERR("Failed to create device attribute");
400
401 return 0; 432 return 0;
402} 433}
403 434
@@ -410,59 +441,30 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
410 441
411int __init bt_sysfs_init(void) 442int __init bt_sysfs_init(void)
412{ 443{
413 int err;
414
415 btaddconn = create_singlethread_workqueue("btaddconn"); 444 btaddconn = create_singlethread_workqueue("btaddconn");
416 if (!btaddconn) { 445 if (!btaddconn)
417 err = -ENOMEM; 446 return -ENOMEM;
418 goto out;
419 }
420 447
421 btdelconn = create_singlethread_workqueue("btdelconn"); 448 btdelconn = create_singlethread_workqueue("btdelconn");
422 if (!btdelconn) { 449 if (!btdelconn) {
423 err = -ENOMEM; 450 destroy_workqueue(btaddconn);
424 goto out_del; 451 return -ENOMEM;
425 }
426
427 bt_platform = platform_device_register_simple("bluetooth", -1, NULL, 0);
428 if (IS_ERR(bt_platform)) {
429 err = PTR_ERR(bt_platform);
430 goto out_platform;
431 } 452 }
432 453
433 err = bus_register(&bt_bus);
434 if (err < 0)
435 goto out_bus;
436
437 bt_class = class_create(THIS_MODULE, "bluetooth"); 454 bt_class = class_create(THIS_MODULE, "bluetooth");
438 if (IS_ERR(bt_class)) { 455 if (IS_ERR(bt_class)) {
439 err = PTR_ERR(bt_class); 456 destroy_workqueue(btdelconn);
440 goto out_class; 457 destroy_workqueue(btaddconn);
458 return PTR_ERR(bt_class);
441 } 459 }
442 460
443 return 0; 461 return 0;
444
445out_class:
446 bus_unregister(&bt_bus);
447out_bus:
448 platform_device_unregister(bt_platform);
449out_platform:
450 destroy_workqueue(btdelconn);
451out_del:
452 destroy_workqueue(btaddconn);
453out:
454 return err;
455} 462}
456 463
457void bt_sysfs_cleanup(void) 464void bt_sysfs_cleanup(void)
458{ 465{
459 destroy_workqueue(btaddconn); 466 destroy_workqueue(btaddconn);
460
461 destroy_workqueue(btdelconn); 467 destroy_workqueue(btdelconn);
462 468
463 class_destroy(bt_class); 469 class_destroy(bt_class);
464
465 bus_unregister(&bt_bus);
466
467 platform_device_unregister(bt_platform);
468} 470}
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index c1239852834a..3396d5bdef1c 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -2516,7 +2516,7 @@ EXPORT_SYMBOL(l2cap_load);
2516module_init(l2cap_init); 2516module_init(l2cap_init);
2517module_exit(l2cap_exit); 2517module_exit(l2cap_exit);
2518 2518
2519MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 2519MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
2520MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION); 2520MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION);
2521MODULE_VERSION(VERSION); 2521MODULE_VERSION(VERSION);
2522MODULE_LICENSE("GPL"); 2522MODULE_LICENSE("GPL");
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 6cfc7ba611b3..ba537fae0a4c 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2115,7 +2115,7 @@ MODULE_PARM_DESC(channel_mtu, "Default MTU for the RFCOMM channel");
2115module_param(l2cap_mtu, uint, 0644); 2115module_param(l2cap_mtu, uint, 0644);
2116MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection"); 2116MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection");
2117 2117
2118MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 2118MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
2119MODULE_DESCRIPTION("Bluetooth RFCOMM ver " VERSION); 2119MODULE_DESCRIPTION("Bluetooth RFCOMM ver " VERSION);
2120MODULE_VERSION(VERSION); 2120MODULE_VERSION(VERSION);
2121MODULE_LICENSE("GPL"); 2121MODULE_LICENSE("GPL");
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 8cda49874868..a16011fedc1d 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -1002,7 +1002,7 @@ module_exit(sco_exit);
1002module_param(disable_esco, bool, 0644); 1002module_param(disable_esco, bool, 0644);
1003MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation"); 1003MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation");
1004 1004
1005MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 1005MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
1006MODULE_DESCRIPTION("Bluetooth SCO ver " VERSION); 1006MODULE_DESCRIPTION("Bluetooth SCO ver " VERSION);
1007MODULE_VERSION(VERSION); 1007MODULE_VERSION(VERSION);
1008MODULE_LICENSE("GPL"); 1008MODULE_LICENSE("GPL");
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 9b58d70b0e7d..4f52c3d50ebe 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -148,11 +148,16 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
148} 148}
149 149
150static struct ethtool_ops br_ethtool_ops = { 150static struct ethtool_ops br_ethtool_ops = {
151 .get_drvinfo = br_getinfo, 151 .get_drvinfo = br_getinfo,
152 .get_link = ethtool_op_get_link, 152 .get_link = ethtool_op_get_link,
153 .set_sg = br_set_sg, 153 .get_tx_csum = ethtool_op_get_tx_csum,
154 .set_tx_csum = br_set_tx_csum, 154 .set_tx_csum = br_set_tx_csum,
155 .set_tso = br_set_tso, 155 .get_sg = ethtool_op_get_sg,
156 .set_sg = br_set_sg,
157 .get_tso = ethtool_op_get_tso,
158 .set_tso = br_set_tso,
159 .get_ufo = ethtool_op_get_ufo,
160 .get_flags = ethtool_op_get_flags,
156}; 161};
157 162
158void br_dev_setup(struct net_device *dev) 163void br_dev_setup(struct net_device *dev)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index dd61dcad6019..52f577a0f544 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -339,6 +339,93 @@ fault:
339 return -EFAULT; 339 return -EFAULT;
340} 340}
341 341
342/**
343 * skb_copy_datagram_from_iovec - Copy a datagram from an iovec.
344 * @skb: buffer to copy
345 * @offset: offset in the buffer to start copying to
346 * @from: io vector to copy to
347 * @len: amount of data to copy to buffer from iovec
348 *
349 * Returns 0 or -EFAULT.
350 * Note: the iovec is modified during the copy.
351 */
352int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset,
353 struct iovec *from, int len)
354{
355 int start = skb_headlen(skb);
356 int i, copy = start - offset;
357
358 /* Copy header. */
359 if (copy > 0) {
360 if (copy > len)
361 copy = len;
362 if (memcpy_fromiovec(skb->data + offset, from, copy))
363 goto fault;
364 if ((len -= copy) == 0)
365 return 0;
366 offset += copy;
367 }
368
369 /* Copy paged appendix. Hmm... why does this look so complicated? */
370 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
371 int end;
372
373 WARN_ON(start > offset + len);
374
375 end = start + skb_shinfo(skb)->frags[i].size;
376 if ((copy = end - offset) > 0) {
377 int err;
378 u8 *vaddr;
379 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
380 struct page *page = frag->page;
381
382 if (copy > len)
383 copy = len;
384 vaddr = kmap(page);
385 err = memcpy_fromiovec(vaddr + frag->page_offset +
386 offset - start, from, copy);
387 kunmap(page);
388 if (err)
389 goto fault;
390
391 if (!(len -= copy))
392 return 0;
393 offset += copy;
394 }
395 start = end;
396 }
397
398 if (skb_shinfo(skb)->frag_list) {
399 struct sk_buff *list = skb_shinfo(skb)->frag_list;
400
401 for (; list; list = list->next) {
402 int end;
403
404 WARN_ON(start > offset + len);
405
406 end = start + list->len;
407 if ((copy = end - offset) > 0) {
408 if (copy > len)
409 copy = len;
410 if (skb_copy_datagram_from_iovec(list,
411 offset - start,
412 from, copy))
413 goto fault;
414 if ((len -= copy) == 0)
415 return 0;
416 offset += copy;
417 }
418 start = end;
419 }
420 }
421 if (!len)
422 return 0;
423
424fault:
425 return -EFAULT;
426}
427EXPORT_SYMBOL(skb_copy_datagram_from_iovec);
428
342static int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset, 429static int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset,
343 u8 __user *to, int len, 430 u8 __user *to, int len,
344 __wsum *csump) 431 __wsum *csump)
diff --git a/net/core/dev.c b/net/core/dev.c
index 600bb23c4c2e..60c51f765887 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1339,19 +1339,23 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1339} 1339}
1340 1340
1341 1341
1342void __netif_schedule(struct Qdisc *q) 1342static inline void __netif_reschedule(struct Qdisc *q)
1343{ 1343{
1344 if (!test_and_set_bit(__QDISC_STATE_SCHED, &q->state)) { 1344 struct softnet_data *sd;
1345 struct softnet_data *sd; 1345 unsigned long flags;
1346 unsigned long flags;
1347 1346
1348 local_irq_save(flags); 1347 local_irq_save(flags);
1349 sd = &__get_cpu_var(softnet_data); 1348 sd = &__get_cpu_var(softnet_data);
1350 q->next_sched = sd->output_queue; 1349 q->next_sched = sd->output_queue;
1351 sd->output_queue = q; 1350 sd->output_queue = q;
1352 raise_softirq_irqoff(NET_TX_SOFTIRQ); 1351 raise_softirq_irqoff(NET_TX_SOFTIRQ);
1353 local_irq_restore(flags); 1352 local_irq_restore(flags);
1354 } 1353}
1354
1355void __netif_schedule(struct Qdisc *q)
1356{
1357 if (!test_and_set_bit(__QDISC_STATE_SCHED, &q->state))
1358 __netif_reschedule(q);
1355} 1359}
1356EXPORT_SYMBOL(__netif_schedule); 1360EXPORT_SYMBOL(__netif_schedule);
1357 1361
@@ -1800,9 +1804,13 @@ gso:
1800 1804
1801 spin_lock(root_lock); 1805 spin_lock(root_lock);
1802 1806
1803 rc = qdisc_enqueue_root(skb, q); 1807 if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
1804 qdisc_run(q); 1808 kfree_skb(skb);
1805 1809 rc = NET_XMIT_DROP;
1810 } else {
1811 rc = qdisc_enqueue_root(skb, q);
1812 qdisc_run(q);
1813 }
1806 spin_unlock(root_lock); 1814 spin_unlock(root_lock);
1807 1815
1808 goto out; 1816 goto out;
@@ -1974,15 +1982,17 @@ static void net_tx_action(struct softirq_action *h)
1974 1982
1975 head = head->next_sched; 1983 head = head->next_sched;
1976 1984
1977 smp_mb__before_clear_bit();
1978 clear_bit(__QDISC_STATE_SCHED, &q->state);
1979
1980 root_lock = qdisc_lock(q); 1985 root_lock = qdisc_lock(q);
1981 if (spin_trylock(root_lock)) { 1986 if (spin_trylock(root_lock)) {
1987 smp_mb__before_clear_bit();
1988 clear_bit(__QDISC_STATE_SCHED,
1989 &q->state);
1982 qdisc_run(q); 1990 qdisc_run(q);
1983 spin_unlock(root_lock); 1991 spin_unlock(root_lock);
1984 } else { 1992 } else {
1985 __netif_schedule(q); 1993 if (!test_bit(__QDISC_STATE_DEACTIVATED,
1994 &q->state))
1995 __netif_reschedule(q);
1986 } 1996 }
1987 } 1997 }
1988 } 1998 }
@@ -2084,7 +2094,8 @@ static int ing_filter(struct sk_buff *skb)
2084 q = rxq->qdisc; 2094 q = rxq->qdisc;
2085 if (q != &noop_qdisc) { 2095 if (q != &noop_qdisc) {
2086 spin_lock(qdisc_lock(q)); 2096 spin_lock(qdisc_lock(q));
2087 result = qdisc_enqueue_root(skb, q); 2097 if (likely(!test_bit(__QDISC_STATE_DEACTIVATED, &q->state)))
2098 result = qdisc_enqueue_root(skb, q);
2088 spin_unlock(qdisc_lock(q)); 2099 spin_unlock(qdisc_lock(q));
2089 } 2100 }
2090 2101
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index a89f32fa94f6..57abe8266be1 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -99,7 +99,7 @@ struct gen_estimator_head
99 99
100static struct gen_estimator_head elist[EST_MAX_INTERVAL+1]; 100static struct gen_estimator_head elist[EST_MAX_INTERVAL+1];
101 101
102/* Protects against NULL dereference and RCU write-side */ 102/* Protects against NULL dereference */
103static DEFINE_RWLOCK(est_lock); 103static DEFINE_RWLOCK(est_lock);
104 104
105static void est_timer(unsigned long arg) 105static void est_timer(unsigned long arg)
@@ -185,7 +185,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
185 est->last_packets = bstats->packets; 185 est->last_packets = bstats->packets;
186 est->avpps = rate_est->pps<<10; 186 est->avpps = rate_est->pps<<10;
187 187
188 write_lock_bh(&est_lock);
189 if (!elist[idx].timer.function) { 188 if (!elist[idx].timer.function) {
190 INIT_LIST_HEAD(&elist[idx].list); 189 INIT_LIST_HEAD(&elist[idx].list);
191 setup_timer(&elist[idx].timer, est_timer, idx); 190 setup_timer(&elist[idx].timer, est_timer, idx);
@@ -195,7 +194,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
195 mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx)); 194 mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx));
196 195
197 list_add_rcu(&est->list, &elist[idx].list); 196 list_add_rcu(&est->list, &elist[idx].list);
198 write_unlock_bh(&est_lock);
199 return 0; 197 return 0;
200} 198}
201 199
@@ -214,6 +212,7 @@ static void __gen_kill_estimator(struct rcu_head *head)
214 * Removes the rate estimator specified by &bstats and &rate_est 212 * Removes the rate estimator specified by &bstats and &rate_est
215 * and deletes the timer. 213 * and deletes the timer.
216 * 214 *
215 * NOTE: Called under rtnl_mutex
217 */ 216 */
218void gen_kill_estimator(struct gnet_stats_basic *bstats, 217void gen_kill_estimator(struct gnet_stats_basic *bstats,
219 struct gnet_stats_rate_est *rate_est) 218 struct gnet_stats_rate_est *rate_est)
@@ -227,17 +226,17 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
227 if (!elist[idx].timer.function) 226 if (!elist[idx].timer.function)
228 continue; 227 continue;
229 228
230 write_lock_bh(&est_lock);
231 list_for_each_entry_safe(e, n, &elist[idx].list, list) { 229 list_for_each_entry_safe(e, n, &elist[idx].list, list) {
232 if (e->rate_est != rate_est || e->bstats != bstats) 230 if (e->rate_est != rate_est || e->bstats != bstats)
233 continue; 231 continue;
234 232
233 write_lock_bh(&est_lock);
235 e->bstats = NULL; 234 e->bstats = NULL;
235 write_unlock_bh(&est_lock);
236 236
237 list_del_rcu(&e->list); 237 list_del_rcu(&e->list);
238 call_rcu(&e->e_rcu, __gen_kill_estimator); 238 call_rcu(&e->e_rcu, __gen_kill_estimator);
239 } 239 }
240 write_unlock_bh(&est_lock);
241 } 240 }
242} 241}
243 242
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 84640172d65d..ca1ccdf1ef76 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2256,14 +2256,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2256 segs = nskb; 2256 segs = nskb;
2257 tail = nskb; 2257 tail = nskb;
2258 2258
2259 nskb->dev = skb->dev; 2259 __copy_skb_header(nskb, skb);
2260 skb_copy_queue_mapping(nskb, skb);
2261 nskb->priority = skb->priority;
2262 nskb->protocol = skb->protocol;
2263 nskb->vlan_tci = skb->vlan_tci;
2264 nskb->dst = dst_clone(skb->dst);
2265 memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
2266 nskb->pkt_type = skb->pkt_type;
2267 nskb->mac_len = skb->mac_len; 2260 nskb->mac_len = skb->mac_len;
2268 2261
2269 skb_reserve(nskb, headroom); 2262 skb_reserve(nskb, headroom);
@@ -2274,6 +2267,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2274 skb_copy_from_linear_data(skb, skb_put(nskb, doffset), 2267 skb_copy_from_linear_data(skb, skb_put(nskb, doffset),
2275 doffset); 2268 doffset);
2276 if (!sg) { 2269 if (!sg) {
2270 nskb->ip_summed = CHECKSUM_NONE;
2277 nskb->csum = skb_copy_and_csum_bits(skb, offset, 2271 nskb->csum = skb_copy_and_csum_bits(skb, offset,
2278 skb_put(nskb, len), 2272 skb_put(nskb, len),
2279 len, 0); 2273 len, 0);
@@ -2283,8 +2277,6 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2283 frag = skb_shinfo(nskb)->frags; 2277 frag = skb_shinfo(nskb)->frags;
2284 k = 0; 2278 k = 0;
2285 2279
2286 nskb->ip_summed = CHECKSUM_PARTIAL;
2287 nskb->csum = skb->csum;
2288 skb_copy_from_linear_data_offset(skb, offset, 2280 skb_copy_from_linear_data_offset(skb, offset,
2289 skb_put(nskb, hsize), hsize); 2281 skb_put(nskb, hsize), hsize);
2290 2282
diff --git a/net/dccp/input.c b/net/dccp/input.c
index df2f110df94a..803933ab396d 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -411,12 +411,6 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
411 struct dccp_sock *dp = dccp_sk(sk); 411 struct dccp_sock *dp = dccp_sk(sk);
412 long tstamp = dccp_timestamp(); 412 long tstamp = dccp_timestamp();
413 413
414 /* Stop the REQUEST timer */
415 inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
416 WARN_ON(sk->sk_send_head == NULL);
417 __kfree_skb(sk->sk_send_head);
418 sk->sk_send_head = NULL;
419
420 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, 414 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
421 dp->dccps_awl, dp->dccps_awh)) { 415 dp->dccps_awl, dp->dccps_awh)) {
422 dccp_pr_debug("invalid ackno: S.AWL=%llu, " 416 dccp_pr_debug("invalid ackno: S.AWL=%llu, "
@@ -441,6 +435,12 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
441 DCCP_ACKVEC_STATE_RECEIVED)) 435 DCCP_ACKVEC_STATE_RECEIVED))
442 goto out_invalid_packet; /* FIXME: change error code */ 436 goto out_invalid_packet; /* FIXME: change error code */
443 437
438 /* Stop the REQUEST timer */
439 inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
440 WARN_ON(sk->sk_send_head == NULL);
441 kfree_skb(sk->sk_send_head);
442 sk->sk_send_head = NULL;
443
444 dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq; 444 dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq;
445 dccp_update_gsr(sk, dp->dccps_isr); 445 dccp_update_gsr(sk, dp->dccps_isr);
446 /* 446 /*
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 860558633b2c..55c355e63234 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -204,18 +204,22 @@ static struct sock *icmp_sk(struct net *net)
204 return net->ipv4.icmp_sk[smp_processor_id()]; 204 return net->ipv4.icmp_sk[smp_processor_id()];
205} 205}
206 206
207static inline int icmp_xmit_lock(struct sock *sk) 207static inline struct sock *icmp_xmit_lock(struct net *net)
208{ 208{
209 struct sock *sk;
210
209 local_bh_disable(); 211 local_bh_disable();
210 212
213 sk = icmp_sk(net);
214
211 if (unlikely(!spin_trylock(&sk->sk_lock.slock))) { 215 if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {
212 /* This can happen if the output path signals a 216 /* This can happen if the output path signals a
213 * dst_link_failure() for an outgoing ICMP packet. 217 * dst_link_failure() for an outgoing ICMP packet.
214 */ 218 */
215 local_bh_enable(); 219 local_bh_enable();
216 return 1; 220 return NULL;
217 } 221 }
218 return 0; 222 return sk;
219} 223}
220 224
221static inline void icmp_xmit_unlock(struct sock *sk) 225static inline void icmp_xmit_unlock(struct sock *sk)
@@ -354,15 +358,17 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
354 struct ipcm_cookie ipc; 358 struct ipcm_cookie ipc;
355 struct rtable *rt = skb->rtable; 359 struct rtable *rt = skb->rtable;
356 struct net *net = dev_net(rt->u.dst.dev); 360 struct net *net = dev_net(rt->u.dst.dev);
357 struct sock *sk = icmp_sk(net); 361 struct sock *sk;
358 struct inet_sock *inet = inet_sk(sk); 362 struct inet_sock *inet;
359 __be32 daddr; 363 __be32 daddr;
360 364
361 if (ip_options_echo(&icmp_param->replyopts, skb)) 365 if (ip_options_echo(&icmp_param->replyopts, skb))
362 return; 366 return;
363 367
364 if (icmp_xmit_lock(sk)) 368 sk = icmp_xmit_lock(net);
369 if (sk == NULL)
365 return; 370 return;
371 inet = inet_sk(sk);
366 372
367 icmp_param->data.icmph.checksum = 0; 373 icmp_param->data.icmph.checksum = 0;
368 374
@@ -419,7 +425,6 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
419 if (!rt) 425 if (!rt)
420 goto out; 426 goto out;
421 net = dev_net(rt->u.dst.dev); 427 net = dev_net(rt->u.dst.dev);
422 sk = icmp_sk(net);
423 428
424 /* 429 /*
425 * Find the original header. It is expected to be valid, of course. 430 * Find the original header. It is expected to be valid, of course.
@@ -483,7 +488,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
483 } 488 }
484 } 489 }
485 490
486 if (icmp_xmit_lock(sk)) 491 sk = icmp_xmit_lock(net);
492 if (sk == NULL)
487 return; 493 return;
488 494
489 /* 495 /*
diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c
index 49587a497229..462a22c97877 100644
--- a/net/ipv4/netfilter/ipt_addrtype.c
+++ b/net/ipv4/netfilter/ipt_addrtype.c
@@ -70,7 +70,7 @@ addrtype_mt_v1(const struct sk_buff *skb, const struct net_device *in,
70 (info->flags & IPT_ADDRTYPE_INVERT_SOURCE); 70 (info->flags & IPT_ADDRTYPE_INVERT_SOURCE);
71 if (ret && info->dest) 71 if (ret && info->dest)
72 ret &= match_type(dev, iph->daddr, info->dest) ^ 72 ret &= match_type(dev, iph->daddr, info->dest) ^
73 (info->flags & IPT_ADDRTYPE_INVERT_DEST); 73 !!(info->flags & IPT_ADDRTYPE_INVERT_DEST);
74 return ret; 74 return ret;
75} 75}
76 76
diff --git a/net/ipv4/netfilter/nf_nat_proto_common.c b/net/ipv4/netfilter/nf_nat_proto_common.c
index 91537f11273f..6c4f11f51446 100644
--- a/net/ipv4/netfilter/nf_nat_proto_common.c
+++ b/net/ipv4/netfilter/nf_nat_proto_common.c
@@ -73,9 +73,13 @@ bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
73 range_size = ntohs(range->max.all) - min + 1; 73 range_size = ntohs(range->max.all) - min + 1;
74 } 74 }
75 75
76 off = *rover;
77 if (range->flags & IP_NAT_RANGE_PROTO_RANDOM) 76 if (range->flags & IP_NAT_RANGE_PROTO_RANDOM)
78 off = net_random(); 77 off = secure_ipv4_port_ephemeral(tuple->src.u3.ip, tuple->dst.u3.ip,
78 maniptype == IP_NAT_MANIP_SRC
79 ? tuple->dst.u.all
80 : tuple->src.u.all);
81 else
82 off = *rover;
79 83
80 for (i = 0; i < range_size; i++, off++) { 84 for (i = 0; i < range_size; i++, off++) {
81 *portptr = htons(min + off % range_size); 85 *portptr = htons(min + off % range_size);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 16fc6f454a31..cca921ea8550 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2914,6 +2914,68 @@ static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
2914 return 0; 2914 return 0;
2915} 2915}
2916 2916
2917static void rt_secret_reschedule(int old)
2918{
2919 struct net *net;
2920 int new = ip_rt_secret_interval;
2921 int diff = new - old;
2922
2923 if (!diff)
2924 return;
2925
2926 rtnl_lock();
2927 for_each_net(net) {
2928 int deleted = del_timer_sync(&net->ipv4.rt_secret_timer);
2929
2930 if (!new)
2931 continue;
2932
2933 if (deleted) {
2934 long time = net->ipv4.rt_secret_timer.expires - jiffies;
2935
2936 if (time <= 0 || (time += diff) <= 0)
2937 time = 0;
2938
2939 net->ipv4.rt_secret_timer.expires = time;
2940 } else
2941 net->ipv4.rt_secret_timer.expires = new;
2942
2943 net->ipv4.rt_secret_timer.expires += jiffies;
2944 add_timer(&net->ipv4.rt_secret_timer);
2945 }
2946 rtnl_unlock();
2947}
2948
2949static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write,
2950 struct file *filp,
2951 void __user *buffer, size_t *lenp,
2952 loff_t *ppos)
2953{
2954 int old = ip_rt_secret_interval;
2955 int ret = proc_dointvec_jiffies(ctl, write, filp, buffer, lenp, ppos);
2956
2957 rt_secret_reschedule(old);
2958
2959 return ret;
2960}
2961
2962static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table,
2963 int __user *name,
2964 int nlen,
2965 void __user *oldval,
2966 size_t __user *oldlenp,
2967 void __user *newval,
2968 size_t newlen)
2969{
2970 int old = ip_rt_secret_interval;
2971 int ret = sysctl_jiffies(table, name, nlen, oldval, oldlenp, newval,
2972 newlen);
2973
2974 rt_secret_reschedule(old);
2975
2976 return ret;
2977}
2978
2917static ctl_table ipv4_route_table[] = { 2979static ctl_table ipv4_route_table[] = {
2918 { 2980 {
2919 .ctl_name = NET_IPV4_ROUTE_GC_THRESH, 2981 .ctl_name = NET_IPV4_ROUTE_GC_THRESH,
@@ -3048,8 +3110,8 @@ static ctl_table ipv4_route_table[] = {
3048 .data = &ip_rt_secret_interval, 3110 .data = &ip_rt_secret_interval,
3049 .maxlen = sizeof(int), 3111 .maxlen = sizeof(int),
3050 .mode = 0644, 3112 .mode = 0644,
3051 .proc_handler = &proc_dointvec_jiffies, 3113 .proc_handler = &ipv4_sysctl_rt_secret_interval,
3052 .strategy = &sysctl_jiffies, 3114 .strategy = &ipv4_sysctl_rt_secret_interval_strategy,
3053 }, 3115 },
3054 { .ctl_name = 0 } 3116 { .ctl_name = 0 }
3055}; 3117};
@@ -3126,10 +3188,12 @@ static __net_init int rt_secret_timer_init(struct net *net)
3126 net->ipv4.rt_secret_timer.data = (unsigned long)net; 3188 net->ipv4.rt_secret_timer.data = (unsigned long)net;
3127 init_timer_deferrable(&net->ipv4.rt_secret_timer); 3189 init_timer_deferrable(&net->ipv4.rt_secret_timer);
3128 3190
3129 net->ipv4.rt_secret_timer.expires = 3191 if (ip_rt_secret_interval) {
3130 jiffies + net_random() % ip_rt_secret_interval + 3192 net->ipv4.rt_secret_timer.expires =
3131 ip_rt_secret_interval; 3193 jiffies + net_random() % ip_rt_secret_interval +
3132 add_timer(&net->ipv4.rt_secret_timer); 3194 ip_rt_secret_interval;
3195 add_timer(&net->ipv4.rt_secret_timer);
3196 }
3133 return 0; 3197 return 0;
3134} 3198}
3135 3199
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a7842c54f58a..7b6a584b62dd 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1106,13 +1106,12 @@ out:
1106 return ret; 1106 return ret;
1107} 1107}
1108 1108
1109int ipv6_dev_get_saddr(struct net_device *dst_dev, 1109int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
1110 const struct in6_addr *daddr, unsigned int prefs, 1110 const struct in6_addr *daddr, unsigned int prefs,
1111 struct in6_addr *saddr) 1111 struct in6_addr *saddr)
1112{ 1112{
1113 struct ipv6_saddr_score scores[2], 1113 struct ipv6_saddr_score scores[2],
1114 *score = &scores[0], *hiscore = &scores[1]; 1114 *score = &scores[0], *hiscore = &scores[1];
1115 struct net *net = dev_net(dst_dev);
1116 struct ipv6_saddr_dst dst; 1115 struct ipv6_saddr_dst dst;
1117 struct net_device *dev; 1116 struct net_device *dev;
1118 int dst_type; 1117 int dst_type;
@@ -1689,6 +1688,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
1689 .fc_dst_len = plen, 1688 .fc_dst_len = plen,
1690 .fc_flags = RTF_UP | flags, 1689 .fc_flags = RTF_UP | flags,
1691 .fc_nlinfo.nl_net = dev_net(dev), 1690 .fc_nlinfo.nl_net = dev_net(dev),
1691 .fc_protocol = RTPROT_KERNEL,
1692 }; 1692 };
1693 1693
1694 ipv6_addr_copy(&cfg.fc_dst, pfx); 1694 ipv6_addr_copy(&cfg.fc_dst, pfx);
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 8d05527524e3..f5de3f9dc692 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -93,7 +93,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
93 if (flags & RT6_LOOKUP_F_SRCPREF_COA) 93 if (flags & RT6_LOOKUP_F_SRCPREF_COA)
94 srcprefs |= IPV6_PREFER_SRC_COA; 94 srcprefs |= IPV6_PREFER_SRC_COA;
95 95
96 if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev, 96 if (ipv6_dev_get_saddr(net,
97 ip6_dst_idev(&rt->u.dst)->dev,
97 &flp->fl6_dst, srcprefs, 98 &flp->fl6_dst, srcprefs,
98 &saddr)) 99 &saddr))
99 goto again; 100 goto again;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index abedf95fdf2d..b3157a0cc15d 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -91,19 +91,22 @@ static struct inet6_protocol icmpv6_protocol = {
91 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, 91 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
92}; 92};
93 93
94static __inline__ int icmpv6_xmit_lock(struct sock *sk) 94static __inline__ struct sock *icmpv6_xmit_lock(struct net *net)
95{ 95{
96 struct sock *sk;
97
96 local_bh_disable(); 98 local_bh_disable();
97 99
100 sk = icmpv6_sk(net);
98 if (unlikely(!spin_trylock(&sk->sk_lock.slock))) { 101 if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {
99 /* This can happen if the output path (f.e. SIT or 102 /* This can happen if the output path (f.e. SIT or
100 * ip6ip6 tunnel) signals dst_link_failure() for an 103 * ip6ip6 tunnel) signals dst_link_failure() for an
101 * outgoing ICMP6 packet. 104 * outgoing ICMP6 packet.
102 */ 105 */
103 local_bh_enable(); 106 local_bh_enable();
104 return 1; 107 return NULL;
105 } 108 }
106 return 0; 109 return sk;
107} 110}
108 111
109static __inline__ void icmpv6_xmit_unlock(struct sock *sk) 112static __inline__ void icmpv6_xmit_unlock(struct sock *sk)
@@ -392,11 +395,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
392 fl.fl_icmp_code = code; 395 fl.fl_icmp_code = code;
393 security_skb_classify_flow(skb, &fl); 396 security_skb_classify_flow(skb, &fl);
394 397
395 sk = icmpv6_sk(net); 398 sk = icmpv6_xmit_lock(net);
396 np = inet6_sk(sk); 399 if (sk == NULL)
397
398 if (icmpv6_xmit_lock(sk))
399 return; 400 return;
401 np = inet6_sk(sk);
400 402
401 if (!icmpv6_xrlim_allow(sk, type, &fl)) 403 if (!icmpv6_xrlim_allow(sk, type, &fl))
402 goto out; 404 goto out;
@@ -539,11 +541,10 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
539 fl.fl_icmp_type = ICMPV6_ECHO_REPLY; 541 fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
540 security_skb_classify_flow(skb, &fl); 542 security_skb_classify_flow(skb, &fl);
541 543
542 sk = icmpv6_sk(net); 544 sk = icmpv6_xmit_lock(net);
543 np = inet6_sk(sk); 545 if (sk == NULL)
544
545 if (icmpv6_xmit_lock(sk))
546 return; 546 return;
547 np = inet6_sk(sk);
547 548
548 if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) 549 if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
549 fl.oif = np->mcast_oif; 550 fl.oif = np->mcast_oif;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 52dddc25d3e6..29c7c99e69f7 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -378,6 +378,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
378 378
379 arg.skb = skb; 379 arg.skb = skb;
380 arg.cb = cb; 380 arg.cb = cb;
381 arg.net = net;
381 w->args = &arg; 382 w->args = &arg;
382 383
383 for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) { 384 for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) {
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a4402de425d9..0e844c2736a7 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -934,7 +934,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
934 goto out_err_release; 934 goto out_err_release;
935 935
936 if (ipv6_addr_any(&fl->fl6_src)) { 936 if (ipv6_addr_any(&fl->fl6_src)) {
937 err = ipv6_dev_get_saddr(ip6_dst_idev(*dst)->dev, 937 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
938 &fl->fl6_dst, 938 &fl->fl6_dst,
939 sk ? inet6_sk(sk)->srcprefs : 0, 939 sk ? inet6_sk(sk)->srcprefs : 0,
940 &fl->fl6_src); 940 &fl->fl6_src);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 741cfcd96f88..4e5eac301f91 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -911,7 +911,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
911 } else { 911 } else {
912 if (np->rxopt.bits.rxinfo) { 912 if (np->rxopt.bits.rxinfo) {
913 struct in6_pktinfo src_info; 913 struct in6_pktinfo src_info;
914 src_info.ipi6_ifindex = np->mcast_oif; 914 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif : sk->sk_bound_dev_if;
915 ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr); 915 ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr);
916 put_cmsg(&msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info); 916 put_cmsg(&msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);
917 } 917 }
@@ -921,7 +921,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
921 } 921 }
922 if (np->rxopt.bits.rxoinfo) { 922 if (np->rxopt.bits.rxoinfo) {
923 struct in6_pktinfo src_info; 923 struct in6_pktinfo src_info;
924 src_info.ipi6_ifindex = np->mcast_oif; 924 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif : sk->sk_bound_dev_if;
925 ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr); 925 ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr);
926 put_cmsg(&msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info); 926 put_cmsg(&msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);
927 } 927 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index beb48e3f038a..f1c62ba0f56b 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -549,7 +549,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
549 override = 0; 549 override = 0;
550 in6_ifa_put(ifp); 550 in6_ifa_put(ifp);
551 } else { 551 } else {
552 if (ipv6_dev_get_saddr(dev, daddr, 552 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
553 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs, 553 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
554 &tmpaddr)) 554 &tmpaddr))
555 return; 555 return;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 41b165ffb369..9af6115f0f50 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2106,7 +2106,8 @@ static inline size_t rt6_nlmsg_size(void)
2106 + nla_total_size(sizeof(struct rta_cacheinfo)); 2106 + nla_total_size(sizeof(struct rta_cacheinfo));
2107} 2107}
2108 2108
2109static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, 2109static int rt6_fill_node(struct net *net,
2110 struct sk_buff *skb, struct rt6_info *rt,
2110 struct in6_addr *dst, struct in6_addr *src, 2111 struct in6_addr *dst, struct in6_addr *src,
2111 int iif, int type, u32 pid, u32 seq, 2112 int iif, int type, u32 pid, u32 seq,
2112 int prefix, int nowait, unsigned int flags) 2113 int prefix, int nowait, unsigned int flags)
@@ -2189,7 +2190,7 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2189 } else if (dst) { 2190 } else if (dst) {
2190 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst); 2191 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
2191 struct in6_addr saddr_buf; 2192 struct in6_addr saddr_buf;
2192 if (ipv6_dev_get_saddr(idev ? idev->dev : NULL, 2193 if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
2193 dst, 0, &saddr_buf) == 0) 2194 dst, 0, &saddr_buf) == 0)
2194 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf); 2195 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
2195 } 2196 }
@@ -2234,7 +2235,8 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
2234 } else 2235 } else
2235 prefix = 0; 2236 prefix = 0;
2236 2237
2237 return rt6_fill_node(arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE, 2238 return rt6_fill_node(arg->net,
2239 arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE,
2238 NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq, 2240 NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq,
2239 prefix, 0, NLM_F_MULTI); 2241 prefix, 0, NLM_F_MULTI);
2240} 2242}
@@ -2300,7 +2302,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2300 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl); 2302 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl);
2301 skb->dst = &rt->u.dst; 2303 skb->dst = &rt->u.dst;
2302 2304
2303 err = rt6_fill_node(skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, 2305 err = rt6_fill_node(net, skb, rt, &fl.fl6_dst, &fl.fl6_src, iif,
2304 RTM_NEWROUTE, NETLINK_CB(in_skb).pid, 2306 RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
2305 nlh->nlmsg_seq, 0, 0, 0); 2307 nlh->nlmsg_seq, 0, 0, 0);
2306 if (err < 0) { 2308 if (err < 0) {
@@ -2327,7 +2329,7 @@ void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)
2327 if (skb == NULL) 2329 if (skb == NULL)
2328 goto errout; 2330 goto errout;
2329 2331
2330 err = rt6_fill_node(skb, rt, NULL, NULL, 0, 2332 err = rt6_fill_node(net, skb, rt, NULL, NULL, 0,
2331 event, info->pid, seq, 0, 0, 0); 2333 event, info->pid, seq, 0, 0, 0);
2332 if (err < 0) { 2334 if (err < 0) {
2333 /* -EMSGSIZE implies BUG in rt6_nlmsg_size() */ 2335 /* -EMSGSIZE implies BUG in rt6_nlmsg_size() */
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 8f1e0543b3c4..08e4cbbe3f04 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -52,12 +52,14 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr,
52static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) 52static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr)
53{ 53{
54 struct dst_entry *dst; 54 struct dst_entry *dst;
55 struct net_device *dev;
55 56
56 dst = xfrm6_dst_lookup(0, NULL, daddr); 57 dst = xfrm6_dst_lookup(0, NULL, daddr);
57 if (IS_ERR(dst)) 58 if (IS_ERR(dst))
58 return -EHOSTUNREACH; 59 return -EHOSTUNREACH;
59 60
60 ipv6_dev_get_saddr(ip6_dst_idev(dst)->dev, 61 dev = ip6_dst_idev(dst)->dev;
62 ipv6_dev_get_saddr(dev_net(dev), dev,
61 (struct in6_addr *)&daddr->a6, 0, 63 (struct in6_addr *)&daddr->a6, 0,
62 (struct in6_addr *)&saddr->a6); 64 (struct in6_addr *)&saddr->a6);
63 dst_release(dst); 65 dst_release(dst);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e1d11c9b6729..1e97fb9fb34b 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2103,6 +2103,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2103 rcu_read_unlock(); 2103 rcu_read_unlock();
2104 return; 2104 return;
2105 } 2105 }
2106 /* update new sta with its last rx activity */
2107 sta->last_rx = jiffies;
2106 } 2108 }
2107 2109
2108 /* 2110 /*
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 105a616c5c78..a8752031adcb 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -968,7 +968,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[])
968 /* need to zero data of old helper */ 968 /* need to zero data of old helper */
969 memset(&help->help, 0, sizeof(help->help)); 969 memset(&help->help, 0, sizeof(help->help));
970 } else { 970 } else {
971 help = nf_ct_helper_ext_add(ct, GFP_KERNEL); 971 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
972 if (help == NULL) 972 if (help == NULL)
973 return -ENOMEM; 973 return -ENOMEM;
974 } 974 }
@@ -1136,16 +1136,33 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1136 ct->timeout.expires = jiffies + ct->timeout.expires * HZ; 1136 ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
1137 ct->status |= IPS_CONFIRMED; 1137 ct->status |= IPS_CONFIRMED;
1138 1138
1139 rcu_read_lock();
1140 helper = __nf_ct_helper_find(rtuple);
1141 if (helper) {
1142 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
1143 if (help == NULL) {
1144 rcu_read_unlock();
1145 err = -ENOMEM;
1146 goto err;
1147 }
1148 /* not in hash table yet so not strictly necessary */
1149 rcu_assign_pointer(help->helper, helper);
1150 }
1151
1139 if (cda[CTA_STATUS]) { 1152 if (cda[CTA_STATUS]) {
1140 err = ctnetlink_change_status(ct, cda); 1153 err = ctnetlink_change_status(ct, cda);
1141 if (err < 0) 1154 if (err < 0) {
1155 rcu_read_unlock();
1142 goto err; 1156 goto err;
1157 }
1143 } 1158 }
1144 1159
1145 if (cda[CTA_PROTOINFO]) { 1160 if (cda[CTA_PROTOINFO]) {
1146 err = ctnetlink_change_protoinfo(ct, cda); 1161 err = ctnetlink_change_protoinfo(ct, cda);
1147 if (err < 0) 1162 if (err < 0) {
1163 rcu_read_unlock();
1148 goto err; 1164 goto err;
1165 }
1149 } 1166 }
1150 1167
1151 nf_ct_acct_ext_add(ct, GFP_KERNEL); 1168 nf_ct_acct_ext_add(ct, GFP_KERNEL);
@@ -1155,19 +1172,6 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1155 ct->mark = ntohl(nla_get_be32(cda[CTA_MARK])); 1172 ct->mark = ntohl(nla_get_be32(cda[CTA_MARK]));
1156#endif 1173#endif
1157 1174
1158 rcu_read_lock();
1159 helper = __nf_ct_helper_find(rtuple);
1160 if (helper) {
1161 help = nf_ct_helper_ext_add(ct, GFP_KERNEL);
1162 if (help == NULL) {
1163 rcu_read_unlock();
1164 err = -ENOMEM;
1165 goto err;
1166 }
1167 /* not in hash table yet so not strictly necessary */
1168 rcu_assign_pointer(help->helper, helper);
1169 }
1170
1171 /* setup master conntrack: this is a confirmed expectation */ 1175 /* setup master conntrack: this is a confirmed expectation */
1172 if (master_ct) { 1176 if (master_ct) {
1173 __set_bit(IPS_EXPECTED_BIT, &ct->status); 1177 __set_bit(IPS_EXPECTED_BIT, &ct->status);
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index d2d45655cd1a..35a9994e2339 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -150,6 +150,8 @@ static void update_rfkill_state(struct rfkill *rfkill)
150 * calls and handling all the red tape such as issuing notifications 150 * calls and handling all the red tape such as issuing notifications
151 * if the call is successful. 151 * if the call is successful.
152 * 152 *
153 * Suspended devices are not touched at all, and -EAGAIN is returned.
154 *
153 * Note that the @force parameter cannot override a (possibly cached) 155 * Note that the @force parameter cannot override a (possibly cached)
154 * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of 156 * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of
155 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or 157 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or
@@ -168,6 +170,9 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
168 int retval = 0; 170 int retval = 0;
169 enum rfkill_state oldstate, newstate; 171 enum rfkill_state oldstate, newstate;
170 172
173 if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
174 return -EBUSY;
175
171 oldstate = rfkill->state; 176 oldstate = rfkill->state;
172 177
173 if (rfkill->get_state && !force && 178 if (rfkill->get_state && !force &&
@@ -214,7 +219,7 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
214 * 219 *
215 * This function toggles the state of all switches of given type, 220 * This function toggles the state of all switches of given type,
216 * unless a specific switch is claimed by userspace (in which case, 221 * unless a specific switch is claimed by userspace (in which case,
217 * that switch is left alone). 222 * that switch is left alone) or suspended.
218 */ 223 */
219void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) 224void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
220{ 225{
@@ -239,8 +244,8 @@ EXPORT_SYMBOL(rfkill_switch_all);
239/** 244/**
240 * rfkill_epo - emergency power off all transmitters 245 * rfkill_epo - emergency power off all transmitters
241 * 246 *
242 * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring 247 * This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED,
243 * everything in its path but rfkill_mutex and rfkill->mutex. 248 * ignoring everything in its path but rfkill_mutex and rfkill->mutex.
244 */ 249 */
245void rfkill_epo(void) 250void rfkill_epo(void)
246{ 251{
@@ -458,13 +463,14 @@ static int rfkill_resume(struct device *dev)
458 if (dev->power.power_state.event != PM_EVENT_ON) { 463 if (dev->power.power_state.event != PM_EVENT_ON) {
459 mutex_lock(&rfkill->mutex); 464 mutex_lock(&rfkill->mutex);
460 465
466 dev->power.power_state.event = PM_EVENT_ON;
467
461 /* restore radio state AND notify everybody */ 468 /* restore radio state AND notify everybody */
462 rfkill_toggle_radio(rfkill, rfkill->state, 1); 469 rfkill_toggle_radio(rfkill, rfkill->state, 1);
463 470
464 mutex_unlock(&rfkill->mutex); 471 mutex_unlock(&rfkill->mutex);
465 } 472 }
466 473
467 dev->power.power_state = PMSG_ON;
468 return 0; 474 return 0;
469} 475}
470#else 476#else
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index d2b6f54a6261..5cafdd4c8018 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -280,7 +280,7 @@ replay:
280 if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) { 280 if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
281 spin_lock_bh(root_lock); 281 spin_lock_bh(root_lock);
282 *back = tp->next; 282 *back = tp->next;
283 spin_lock_bh(root_lock); 283 spin_unlock_bh(root_lock);
284 284
285 tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); 285 tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
286 tcf_destroy(tp); 286 tcf_destroy(tp);
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index c25465e5607a..e7fb9e0d21b4 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -27,6 +27,7 @@
27#include <linux/kmod.h> 27#include <linux/kmod.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/hrtimer.h> 29#include <linux/hrtimer.h>
30#include <linux/lockdep.h>
30 31
31#include <net/net_namespace.h> 32#include <net/net_namespace.h>
32#include <net/sock.h> 33#include <net/sock.h>
@@ -198,19 +199,53 @@ struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle)
198 return NULL; 199 return NULL;
199} 200}
200 201
202/*
203 * This lock is needed until some qdiscs stop calling qdisc_tree_decrease_qlen()
204 * without rtnl_lock(); currently hfsc_dequeue(), netem_dequeue(), tbf_dequeue()
205 */
206static DEFINE_SPINLOCK(qdisc_list_lock);
207
208static void qdisc_list_add(struct Qdisc *q)
209{
210 if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) {
211 spin_lock_bh(&qdisc_list_lock);
212 list_add_tail(&q->list, &qdisc_root_sleeping(q)->list);
213 spin_unlock_bh(&qdisc_list_lock);
214 }
215}
216
217void qdisc_list_del(struct Qdisc *q)
218{
219 if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) {
220 spin_lock_bh(&qdisc_list_lock);
221 list_del(&q->list);
222 spin_unlock_bh(&qdisc_list_lock);
223 }
224}
225EXPORT_SYMBOL(qdisc_list_del);
226
201struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) 227struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
202{ 228{
203 unsigned int i; 229 unsigned int i;
230 struct Qdisc *q;
231
232 spin_lock_bh(&qdisc_list_lock);
204 233
205 for (i = 0; i < dev->num_tx_queues; i++) { 234 for (i = 0; i < dev->num_tx_queues; i++) {
206 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 235 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
207 struct Qdisc *q, *txq_root = txq->qdisc_sleeping; 236 struct Qdisc *txq_root = txq->qdisc_sleeping;
208 237
209 q = qdisc_match_from_root(txq_root, handle); 238 q = qdisc_match_from_root(txq_root, handle);
210 if (q) 239 if (q)
211 return q; 240 goto unlock;
212 } 241 }
213 return qdisc_match_from_root(dev->rx_queue.qdisc_sleeping, handle); 242
243 q = qdisc_match_from_root(dev->rx_queue.qdisc_sleeping, handle);
244
245unlock:
246 spin_unlock_bh(&qdisc_list_lock);
247
248 return q;
214} 249}
215 250
216static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid) 251static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
@@ -331,7 +366,7 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
331 if (!s || tsize != s->tsize || (!tab && tsize > 0)) 366 if (!s || tsize != s->tsize || (!tab && tsize > 0))
332 return ERR_PTR(-EINVAL); 367 return ERR_PTR(-EINVAL);
333 368
334 spin_lock_bh(&qdisc_stab_lock); 369 spin_lock(&qdisc_stab_lock);
335 370
336 list_for_each_entry(stab, &qdisc_stab_list, list) { 371 list_for_each_entry(stab, &qdisc_stab_list, list) {
337 if (memcmp(&stab->szopts, s, sizeof(*s))) 372 if (memcmp(&stab->szopts, s, sizeof(*s)))
@@ -339,11 +374,11 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
339 if (tsize > 0 && memcmp(stab->data, tab, tsize * sizeof(u16))) 374 if (tsize > 0 && memcmp(stab->data, tab, tsize * sizeof(u16)))
340 continue; 375 continue;
341 stab->refcnt++; 376 stab->refcnt++;
342 spin_unlock_bh(&qdisc_stab_lock); 377 spin_unlock(&qdisc_stab_lock);
343 return stab; 378 return stab;
344 } 379 }
345 380
346 spin_unlock_bh(&qdisc_stab_lock); 381 spin_unlock(&qdisc_stab_lock);
347 382
348 stab = kmalloc(sizeof(*stab) + tsize * sizeof(u16), GFP_KERNEL); 383 stab = kmalloc(sizeof(*stab) + tsize * sizeof(u16), GFP_KERNEL);
349 if (!stab) 384 if (!stab)
@@ -354,9 +389,9 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
354 if (tsize > 0) 389 if (tsize > 0)
355 memcpy(stab->data, tab, tsize * sizeof(u16)); 390 memcpy(stab->data, tab, tsize * sizeof(u16));
356 391
357 spin_lock_bh(&qdisc_stab_lock); 392 spin_lock(&qdisc_stab_lock);
358 list_add_tail(&stab->list, &qdisc_stab_list); 393 list_add_tail(&stab->list, &qdisc_stab_list);
359 spin_unlock_bh(&qdisc_stab_lock); 394 spin_unlock(&qdisc_stab_lock);
360 395
361 return stab; 396 return stab;
362} 397}
@@ -366,14 +401,14 @@ void qdisc_put_stab(struct qdisc_size_table *tab)
366 if (!tab) 401 if (!tab)
367 return; 402 return;
368 403
369 spin_lock_bh(&qdisc_stab_lock); 404 spin_lock(&qdisc_stab_lock);
370 405
371 if (--tab->refcnt == 0) { 406 if (--tab->refcnt == 0) {
372 list_del(&tab->list); 407 list_del(&tab->list);
373 kfree(tab); 408 kfree(tab);
374 } 409 }
375 410
376 spin_unlock_bh(&qdisc_stab_lock); 411 spin_unlock(&qdisc_stab_lock);
377} 412}
378EXPORT_SYMBOL(qdisc_put_stab); 413EXPORT_SYMBOL(qdisc_put_stab);
379 414
@@ -426,7 +461,7 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
426 461
427 wd->qdisc->flags &= ~TCQ_F_THROTTLED; 462 wd->qdisc->flags &= ~TCQ_F_THROTTLED;
428 smp_wmb(); 463 smp_wmb();
429 __netif_schedule(wd->qdisc); 464 __netif_schedule(qdisc_root(wd->qdisc));
430 465
431 return HRTIMER_NORESTART; 466 return HRTIMER_NORESTART;
432} 467}
@@ -443,6 +478,10 @@ void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires)
443{ 478{
444 ktime_t time; 479 ktime_t time;
445 480
481 if (test_bit(__QDISC_STATE_DEACTIVATED,
482 &qdisc_root_sleeping(wd->qdisc)->state))
483 return;
484
446 wd->qdisc->flags |= TCQ_F_THROTTLED; 485 wd->qdisc->flags |= TCQ_F_THROTTLED;
447 time = ktime_set(0, 0); 486 time = ktime_set(0, 0);
448 time = ktime_add_ns(time, PSCHED_US2NS(expires)); 487 time = ktime_add_ns(time, PSCHED_US2NS(expires));
@@ -637,11 +676,8 @@ static void notify_and_destroy(struct sk_buff *skb, struct nlmsghdr *n, u32 clid
637 if (new || old) 676 if (new || old)
638 qdisc_notify(skb, n, clid, old, new); 677 qdisc_notify(skb, n, clid, old, new);
639 678
640 if (old) { 679 if (old)
641 spin_lock_bh(&old->q.lock);
642 qdisc_destroy(old); 680 qdisc_destroy(old);
643 spin_unlock_bh(&old->q.lock);
644 }
645} 681}
646 682
647/* Graft qdisc "new" to class "classid" of qdisc "parent" or 683/* Graft qdisc "new" to class "classid" of qdisc "parent" or
@@ -707,6 +743,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
707 return err; 743 return err;
708} 744}
709 745
746/* lockdep annotation is needed for ingress; egress gets it only for name */
747static struct lock_class_key qdisc_tx_lock;
748static struct lock_class_key qdisc_rx_lock;
749
710/* 750/*
711 Allocate and initialize new qdisc. 751 Allocate and initialize new qdisc.
712 752
@@ -767,6 +807,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
767 if (handle == TC_H_INGRESS) { 807 if (handle == TC_H_INGRESS) {
768 sch->flags |= TCQ_F_INGRESS; 808 sch->flags |= TCQ_F_INGRESS;
769 handle = TC_H_MAKE(TC_H_INGRESS, 0); 809 handle = TC_H_MAKE(TC_H_INGRESS, 0);
810 lockdep_set_class(qdisc_lock(sch), &qdisc_rx_lock);
770 } else { 811 } else {
771 if (handle == 0) { 812 if (handle == 0) {
772 handle = qdisc_alloc_handle(dev); 813 handle = qdisc_alloc_handle(dev);
@@ -774,6 +815,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
774 if (handle == 0) 815 if (handle == 0)
775 goto err_out3; 816 goto err_out3;
776 } 817 }
818 lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock);
777 } 819 }
778 820
779 sch->handle = handle; 821 sch->handle = handle;
@@ -802,8 +844,8 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
802 goto err_out3; 844 goto err_out3;
803 } 845 }
804 } 846 }
805 if ((parent != TC_H_ROOT) && !(sch->flags & TCQ_F_INGRESS)) 847
806 list_add_tail(&sch->list, &dev_queue->qdisc_sleeping->list); 848 qdisc_list_add(sch);
807 849
808 return sch; 850 return sch;
809 } 851 }
@@ -1084,20 +1126,13 @@ create_n_graft:
1084 } 1126 }
1085 1127
1086graft: 1128graft:
1087 if (1) { 1129 err = qdisc_graft(dev, p, skb, n, clid, q, NULL);
1088 spinlock_t *root_lock; 1130 if (err) {
1089 1131 if (q)
1090 err = qdisc_graft(dev, p, skb, n, clid, q, NULL); 1132 qdisc_destroy(q);
1091 if (err) { 1133 return err;
1092 if (q) {
1093 root_lock = qdisc_root_lock(q);
1094 spin_lock_bh(root_lock);
1095 qdisc_destroy(q);
1096 spin_unlock_bh(root_lock);
1097 }
1098 return err;
1099 }
1100 } 1134 }
1135
1101 return 0; 1136 return 0;
1102} 1137}
1103 1138
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 4e261ce62f48..8fa90d68ec6d 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -521,6 +521,10 @@ static void cbq_ovl_delay(struct cbq_class *cl)
521 struct cbq_sched_data *q = qdisc_priv(cl->qdisc); 521 struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
522 psched_tdiff_t delay = cl->undertime - q->now; 522 psched_tdiff_t delay = cl->undertime - q->now;
523 523
524 if (test_bit(__QDISC_STATE_DEACTIVATED,
525 &qdisc_root_sleeping(cl->qdisc)->state))
526 return;
527
524 if (!cl->delayed) { 528 if (!cl->delayed) {
525 psched_time_t sched = q->now; 529 psched_time_t sched = q->now;
526 ktime_t expires; 530 ktime_t expires;
@@ -654,7 +658,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
654 } 658 }
655 659
656 sch->flags &= ~TCQ_F_THROTTLED; 660 sch->flags &= ~TCQ_F_THROTTLED;
657 __netif_schedule(sch); 661 __netif_schedule(qdisc_root(sch));
658 return HRTIMER_NORESTART; 662 return HRTIMER_NORESTART;
659} 663}
660 664
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 468574682caa..5f0ade7806a7 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -518,15 +518,17 @@ void qdisc_reset(struct Qdisc *qdisc)
518} 518}
519EXPORT_SYMBOL(qdisc_reset); 519EXPORT_SYMBOL(qdisc_reset);
520 520
521/* this is the rcu callback function to clean up a qdisc when there 521void qdisc_destroy(struct Qdisc *qdisc)
522 * are no further references to it */
523
524static void __qdisc_destroy(struct rcu_head *head)
525{ 522{
526 struct Qdisc *qdisc = container_of(head, struct Qdisc, q_rcu);
527 const struct Qdisc_ops *ops = qdisc->ops; 523 const struct Qdisc_ops *ops = qdisc->ops;
528 524
525 if (qdisc->flags & TCQ_F_BUILTIN ||
526 !atomic_dec_and_test(&qdisc->refcnt))
527 return;
528
529#ifdef CONFIG_NET_SCHED 529#ifdef CONFIG_NET_SCHED
530 qdisc_list_del(qdisc);
531
530 qdisc_put_stab(qdisc->stab); 532 qdisc_put_stab(qdisc->stab);
531#endif 533#endif
532 gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est); 534 gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est);
@@ -542,20 +544,6 @@ static void __qdisc_destroy(struct rcu_head *head)
542 544
543 kfree((char *) qdisc - qdisc->padded); 545 kfree((char *) qdisc - qdisc->padded);
544} 546}
545
546/* Under qdisc_lock(qdisc) and BH! */
547
548void qdisc_destroy(struct Qdisc *qdisc)
549{
550 if (qdisc->flags & TCQ_F_BUILTIN ||
551 !atomic_dec_and_test(&qdisc->refcnt))
552 return;
553
554 if (qdisc->parent)
555 list_del(&qdisc->list);
556
557 call_rcu(&qdisc->q_rcu, __qdisc_destroy);
558}
559EXPORT_SYMBOL(qdisc_destroy); 547EXPORT_SYMBOL(qdisc_destroy);
560 548
561static bool dev_all_qdisc_sleeping_noop(struct net_device *dev) 549static bool dev_all_qdisc_sleeping_noop(struct net_device *dev)
@@ -597,6 +585,9 @@ static void transition_one_qdisc(struct net_device *dev,
597 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping; 585 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping;
598 int *need_watchdog_p = _need_watchdog; 586 int *need_watchdog_p = _need_watchdog;
599 587
588 if (!(new_qdisc->flags & TCQ_F_BUILTIN))
589 clear_bit(__QDISC_STATE_DEACTIVATED, &new_qdisc->state);
590
600 rcu_assign_pointer(dev_queue->qdisc, new_qdisc); 591 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
601 if (need_watchdog_p && new_qdisc != &noqueue_qdisc) 592 if (need_watchdog_p && new_qdisc != &noqueue_qdisc)
602 *need_watchdog_p = 1; 593 *need_watchdog_p = 1;
@@ -640,6 +631,9 @@ static void dev_deactivate_queue(struct net_device *dev,
640 if (qdisc) { 631 if (qdisc) {
641 spin_lock_bh(qdisc_lock(qdisc)); 632 spin_lock_bh(qdisc_lock(qdisc));
642 633
634 if (!(qdisc->flags & TCQ_F_BUILTIN))
635 set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
636
643 dev_queue->qdisc = qdisc_default; 637 dev_queue->qdisc = qdisc_default;
644 qdisc_reset(qdisc); 638 qdisc_reset(qdisc);
645 639
@@ -647,7 +641,7 @@ static void dev_deactivate_queue(struct net_device *dev,
647 } 641 }
648} 642}
649 643
650static bool some_qdisc_is_busy(struct net_device *dev, int lock) 644static bool some_qdisc_is_busy(struct net_device *dev)
651{ 645{
652 unsigned int i; 646 unsigned int i;
653 647
@@ -661,14 +655,12 @@ static bool some_qdisc_is_busy(struct net_device *dev, int lock)
661 q = dev_queue->qdisc_sleeping; 655 q = dev_queue->qdisc_sleeping;
662 root_lock = qdisc_lock(q); 656 root_lock = qdisc_lock(q);
663 657
664 if (lock) 658 spin_lock_bh(root_lock);
665 spin_lock_bh(root_lock);
666 659
667 val = (test_bit(__QDISC_STATE_RUNNING, &q->state) || 660 val = (test_bit(__QDISC_STATE_RUNNING, &q->state) ||
668 test_bit(__QDISC_STATE_SCHED, &q->state)); 661 test_bit(__QDISC_STATE_SCHED, &q->state));
669 662
670 if (lock) 663 spin_unlock_bh(root_lock);
671 spin_unlock_bh(root_lock);
672 664
673 if (val) 665 if (val)
674 return true; 666 return true;
@@ -678,8 +670,6 @@ static bool some_qdisc_is_busy(struct net_device *dev, int lock)
678 670
679void dev_deactivate(struct net_device *dev) 671void dev_deactivate(struct net_device *dev)
680{ 672{
681 bool running;
682
683 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc); 673 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc);
684 dev_deactivate_queue(dev, &dev->rx_queue, &noop_qdisc); 674 dev_deactivate_queue(dev, &dev->rx_queue, &noop_qdisc);
685 675
@@ -689,25 +679,8 @@ void dev_deactivate(struct net_device *dev)
689 synchronize_rcu(); 679 synchronize_rcu();
690 680
691 /* Wait for outstanding qdisc_run calls. */ 681 /* Wait for outstanding qdisc_run calls. */
692 do { 682 while (some_qdisc_is_busy(dev))
693 while (some_qdisc_is_busy(dev, 0)) 683 yield();
694 yield();
695
696 /*
697 * Double-check inside queue lock to ensure that all effects
698 * of the queue run are visible when we return.
699 */
700 running = some_qdisc_is_busy(dev, 1);
701
702 /*
703 * The running flag should never be set at this point because
704 * we've already set dev->qdisc to noop_qdisc *inside* the same
705 * pair of spin locks. That is, if any qdisc_run starts after
706 * our initial test it should see the noop_qdisc and then
707 * clear the RUNNING bit before dropping the queue lock. So
708 * if it is set here then we've found a bug.
709 */
710 } while (WARN_ON_ONCE(running));
711} 684}
712 685
713static void dev_init_scheduler_queue(struct net_device *dev, 686static void dev_init_scheduler_queue(struct net_device *dev,
@@ -736,14 +709,10 @@ static void shutdown_scheduler_queue(struct net_device *dev,
736 struct Qdisc *qdisc_default = _qdisc_default; 709 struct Qdisc *qdisc_default = _qdisc_default;
737 710
738 if (qdisc) { 711 if (qdisc) {
739 spinlock_t *root_lock = qdisc_lock(qdisc);
740
741 dev_queue->qdisc = qdisc_default; 712 dev_queue->qdisc = qdisc_default;
742 dev_queue->qdisc_sleeping = qdisc_default; 713 dev_queue->qdisc_sleeping = qdisc_default;
743 714
744 spin_lock_bh(root_lock);
745 qdisc_destroy(qdisc); 715 qdisc_destroy(qdisc);
746 spin_unlock_bh(root_lock);
747 } 716 }
748} 717}
749 718
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 6febd245e62b..0df0df202ed0 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -577,7 +577,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
577 sch->qstats.drops++; 577 sch->qstats.drops++;
578 cl->qstats.drops++; 578 cl->qstats.drops++;
579 } 579 }
580 return NET_XMIT_DROP; 580 return ret;
581 } else { 581 } else {
582 cl->bstats.packets += 582 cl->bstats.packets +=
583 skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1; 583 skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
@@ -623,7 +623,7 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
623 sch->qstats.drops++; 623 sch->qstats.drops++;
624 cl->qstats.drops++; 624 cl->qstats.drops++;
625 } 625 }
626 return NET_XMIT_DROP; 626 return ret;
627 } else 627 } else
628 htb_activate(q, cl); 628 htb_activate(q, cl);
629 629
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index eac197610edf..a6697c686c7f 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -113,11 +113,11 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
113 if ((ret = qdisc->ops->requeue(skb, qdisc)) == NET_XMIT_SUCCESS) { 113 if ((ret = qdisc->ops->requeue(skb, qdisc)) == NET_XMIT_SUCCESS) {
114 sch->q.qlen++; 114 sch->q.qlen++;
115 sch->qstats.requeues++; 115 sch->qstats.requeues++;
116 return 0; 116 return NET_XMIT_SUCCESS;
117 } 117 }
118 if (net_xmit_drop_count(ret)) 118 if (net_xmit_drop_count(ret))
119 sch->qstats.drops++; 119 sch->qstats.drops++;
120 return NET_XMIT_DROP; 120 return ret;
121} 121}
122 122
123 123
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 7d3b7ff3bf07..94c61598b86a 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -123,15 +123,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
123 struct tbf_sched_data *q = qdisc_priv(sch); 123 struct tbf_sched_data *q = qdisc_priv(sch);
124 int ret; 124 int ret;
125 125
126 if (qdisc_pkt_len(skb) > q->max_size) { 126 if (qdisc_pkt_len(skb) > q->max_size)
127 sch->qstats.drops++; 127 return qdisc_reshape_fail(skb, sch);
128#ifdef CONFIG_NET_CLS_ACT
129 if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
130#endif
131 kfree_skb(skb);
132
133 return NET_XMIT_DROP;
134 }
135 128
136 ret = qdisc_enqueue(skb, q->qdisc); 129 ret = qdisc_enqueue(skb, q->qdisc);
137 if (ret != 0) { 130 if (ret != 0) {
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index e39a0cdef184..4c8d9f45ce09 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -103,6 +103,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
103 103
104 /* Initialize the CHUNKS parameter */ 104 /* Initialize the CHUNKS parameter */
105 auth_chunks->param_hdr.type = SCTP_PARAM_CHUNKS; 105 auth_chunks->param_hdr.type = SCTP_PARAM_CHUNKS;
106 auth_chunks->param_hdr.length = htons(sizeof(sctp_paramhdr_t));
106 107
107 /* If the Add-IP functionality is enabled, we must 108 /* If the Add-IP functionality is enabled, we must
108 * authenticate, ASCONF and ASCONF-ACK chunks 109 * authenticate, ASCONF and ASCONF-ACK chunks
@@ -110,8 +111,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
110 if (sctp_addip_enable) { 111 if (sctp_addip_enable) {
111 auth_chunks->chunks[0] = SCTP_CID_ASCONF; 112 auth_chunks->chunks[0] = SCTP_CID_ASCONF;
112 auth_chunks->chunks[1] = SCTP_CID_ASCONF_ACK; 113 auth_chunks->chunks[1] = SCTP_CID_ASCONF_ACK;
113 auth_chunks->param_hdr.length = 114 auth_chunks->param_hdr.length += htons(2);
114 htons(sizeof(sctp_paramhdr_t) + 2);
115 } 115 }
116 } 116 }
117 117
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 483a01d0740a..47f91afa0211 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -319,7 +319,8 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
319 __func__, asoc, dst, NIP6(daddr->v6.sin6_addr)); 319 __func__, asoc, dst, NIP6(daddr->v6.sin6_addr));
320 320
321 if (!asoc) { 321 if (!asoc) {
322 ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, 322 ipv6_dev_get_saddr(sock_net(sctp_opt2sk(sk)),
323 dst ? ip6_dst_idev(dst)->dev : NULL,
323 &daddr->v6.sin6_addr, 324 &daddr->v6.sin6_addr,
324 inet6_sk(&sk->inet.sk)->srcprefs, 325 inet6_sk(&sk->inet.sk)->srcprefs,
325 &saddr->v6.sin6_addr); 326 &saddr->v6.sin6_addr);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index dbb79adf8f3c..bb5c9ef13046 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3055,6 +3055,9 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk,
3055{ 3055{
3056 struct sctp_authchunk val; 3056 struct sctp_authchunk val;
3057 3057
3058 if (!sctp_auth_enable)
3059 return -EACCES;
3060
3058 if (optlen != sizeof(struct sctp_authchunk)) 3061 if (optlen != sizeof(struct sctp_authchunk))
3059 return -EINVAL; 3062 return -EINVAL;
3060 if (copy_from_user(&val, optval, optlen)) 3063 if (copy_from_user(&val, optval, optlen))
@@ -3085,6 +3088,9 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk,
3085 struct sctp_hmacalgo *hmacs; 3088 struct sctp_hmacalgo *hmacs;
3086 int err; 3089 int err;
3087 3090
3091 if (!sctp_auth_enable)
3092 return -EACCES;
3093
3088 if (optlen < sizeof(struct sctp_hmacalgo)) 3094 if (optlen < sizeof(struct sctp_hmacalgo))
3089 return -EINVAL; 3095 return -EINVAL;
3090 3096
@@ -3123,6 +3129,9 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
3123 struct sctp_association *asoc; 3129 struct sctp_association *asoc;
3124 int ret; 3130 int ret;
3125 3131
3132 if (!sctp_auth_enable)
3133 return -EACCES;
3134
3126 if (optlen <= sizeof(struct sctp_authkey)) 3135 if (optlen <= sizeof(struct sctp_authkey))
3127 return -EINVAL; 3136 return -EINVAL;
3128 3137
@@ -3160,6 +3169,9 @@ static int sctp_setsockopt_active_key(struct sock *sk,
3160 struct sctp_authkeyid val; 3169 struct sctp_authkeyid val;
3161 struct sctp_association *asoc; 3170 struct sctp_association *asoc;
3162 3171
3172 if (!sctp_auth_enable)
3173 return -EACCES;
3174
3163 if (optlen != sizeof(struct sctp_authkeyid)) 3175 if (optlen != sizeof(struct sctp_authkeyid))
3164 return -EINVAL; 3176 return -EINVAL;
3165 if (copy_from_user(&val, optval, optlen)) 3177 if (copy_from_user(&val, optval, optlen))
@@ -3185,6 +3197,9 @@ static int sctp_setsockopt_del_key(struct sock *sk,
3185 struct sctp_authkeyid val; 3197 struct sctp_authkeyid val;
3186 struct sctp_association *asoc; 3198 struct sctp_association *asoc;
3187 3199
3200 if (!sctp_auth_enable)
3201 return -EACCES;
3202
3188 if (optlen != sizeof(struct sctp_authkeyid)) 3203 if (optlen != sizeof(struct sctp_authkeyid))
3189 return -EINVAL; 3204 return -EINVAL;
3190 if (copy_from_user(&val, optval, optlen)) 3205 if (copy_from_user(&val, optval, optlen))
@@ -5197,19 +5212,29 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
5197static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, 5212static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
5198 char __user *optval, int __user *optlen) 5213 char __user *optval, int __user *optlen)
5199{ 5214{
5215 struct sctp_hmacalgo __user *p = (void __user *)optval;
5200 struct sctp_hmac_algo_param *hmacs; 5216 struct sctp_hmac_algo_param *hmacs;
5201 __u16 param_len; 5217 __u16 data_len = 0;
5218 u32 num_idents;
5219
5220 if (!sctp_auth_enable)
5221 return -EACCES;
5202 5222
5203 hmacs = sctp_sk(sk)->ep->auth_hmacs_list; 5223 hmacs = sctp_sk(sk)->ep->auth_hmacs_list;
5204 param_len = ntohs(hmacs->param_hdr.length); 5224 data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t);
5205 5225
5206 if (len < param_len) 5226 if (len < sizeof(struct sctp_hmacalgo) + data_len)
5207 return -EINVAL; 5227 return -EINVAL;
5228
5229 len = sizeof(struct sctp_hmacalgo) + data_len;
5230 num_idents = data_len / sizeof(u16);
5231
5208 if (put_user(len, optlen)) 5232 if (put_user(len, optlen))
5209 return -EFAULT; 5233 return -EFAULT;
5210 if (copy_to_user(optval, hmacs->hmac_ids, len)) 5234 if (put_user(num_idents, &p->shmac_num_idents))
5235 return -EFAULT;
5236 if (copy_to_user(p->shmac_idents, hmacs->hmac_ids, data_len))
5211 return -EFAULT; 5237 return -EFAULT;
5212
5213 return 0; 5238 return 0;
5214} 5239}
5215 5240
@@ -5219,6 +5244,9 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
5219 struct sctp_authkeyid val; 5244 struct sctp_authkeyid val;
5220 struct sctp_association *asoc; 5245 struct sctp_association *asoc;
5221 5246
5247 if (!sctp_auth_enable)
5248 return -EACCES;
5249
5222 if (len < sizeof(struct sctp_authkeyid)) 5250 if (len < sizeof(struct sctp_authkeyid))
5223 return -EINVAL; 5251 return -EINVAL;
5224 if (copy_from_user(&val, optval, sizeof(struct sctp_authkeyid))) 5252 if (copy_from_user(&val, optval, sizeof(struct sctp_authkeyid)))
@@ -5233,6 +5261,12 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
5233 else 5261 else
5234 val.scact_keynumber = sctp_sk(sk)->ep->active_key_id; 5262 val.scact_keynumber = sctp_sk(sk)->ep->active_key_id;
5235 5263
5264 len = sizeof(struct sctp_authkeyid);
5265 if (put_user(len, optlen))
5266 return -EFAULT;
5267 if (copy_to_user(optval, &val, len))
5268 return -EFAULT;
5269
5236 return 0; 5270 return 0;
5237} 5271}
5238 5272
@@ -5243,13 +5277,16 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5243 struct sctp_authchunks val; 5277 struct sctp_authchunks val;
5244 struct sctp_association *asoc; 5278 struct sctp_association *asoc;
5245 struct sctp_chunks_param *ch; 5279 struct sctp_chunks_param *ch;
5246 u32 num_chunks; 5280 u32 num_chunks = 0;
5247 char __user *to; 5281 char __user *to;
5248 5282
5249 if (len <= sizeof(struct sctp_authchunks)) 5283 if (!sctp_auth_enable)
5284 return -EACCES;
5285
5286 if (len < sizeof(struct sctp_authchunks))
5250 return -EINVAL; 5287 return -EINVAL;
5251 5288
5252 if (copy_from_user(&val, p, sizeof(struct sctp_authchunks))) 5289 if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks)))
5253 return -EFAULT; 5290 return -EFAULT;
5254 5291
5255 to = p->gauth_chunks; 5292 to = p->gauth_chunks;
@@ -5258,20 +5295,21 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5258 return -EINVAL; 5295 return -EINVAL;
5259 5296
5260 ch = asoc->peer.peer_chunks; 5297 ch = asoc->peer.peer_chunks;
5298 if (!ch)
5299 goto num;
5261 5300
5262 /* See if the user provided enough room for all the data */ 5301 /* See if the user provided enough room for all the data */
5263 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); 5302 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5264 if (len < num_chunks) 5303 if (len < num_chunks)
5265 return -EINVAL; 5304 return -EINVAL;
5266 5305
5267 len = num_chunks; 5306 if (copy_to_user(to, ch->chunks, num_chunks))
5268 if (put_user(len, optlen))
5269 return -EFAULT; 5307 return -EFAULT;
5308num:
5309 len = sizeof(struct sctp_authchunks) + num_chunks;
5310 if (put_user(len, optlen)) return -EFAULT;
5270 if (put_user(num_chunks, &p->gauth_number_of_chunks)) 5311 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5271 return -EFAULT; 5312 return -EFAULT;
5272 if (copy_to_user(to, ch->chunks, len))
5273 return -EFAULT;
5274
5275 return 0; 5313 return 0;
5276} 5314}
5277 5315
@@ -5282,13 +5320,16 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5282 struct sctp_authchunks val; 5320 struct sctp_authchunks val;
5283 struct sctp_association *asoc; 5321 struct sctp_association *asoc;
5284 struct sctp_chunks_param *ch; 5322 struct sctp_chunks_param *ch;
5285 u32 num_chunks; 5323 u32 num_chunks = 0;
5286 char __user *to; 5324 char __user *to;
5287 5325
5288 if (len <= sizeof(struct sctp_authchunks)) 5326 if (!sctp_auth_enable)
5327 return -EACCES;
5328
5329 if (len < sizeof(struct sctp_authchunks))
5289 return -EINVAL; 5330 return -EINVAL;
5290 5331
5291 if (copy_from_user(&val, p, sizeof(struct sctp_authchunks))) 5332 if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks)))
5292 return -EFAULT; 5333 return -EFAULT;
5293 5334
5294 to = p->gauth_chunks; 5335 to = p->gauth_chunks;
@@ -5301,17 +5342,21 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5301 else 5342 else
5302 ch = sctp_sk(sk)->ep->auth_chunk_list; 5343 ch = sctp_sk(sk)->ep->auth_chunk_list;
5303 5344
5345 if (!ch)
5346 goto num;
5347
5304 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); 5348 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5305 if (len < num_chunks) 5349 if (len < sizeof(struct sctp_authchunks) + num_chunks)
5306 return -EINVAL; 5350 return -EINVAL;
5307 5351
5308 len = num_chunks; 5352 if (copy_to_user(to, ch->chunks, num_chunks))
5353 return -EFAULT;
5354num:
5355 len = sizeof(struct sctp_authchunks) + num_chunks;
5309 if (put_user(len, optlen)) 5356 if (put_user(len, optlen))
5310 return -EFAULT; 5357 return -EFAULT;
5311 if (put_user(num_chunks, &p->gauth_number_of_chunks)) 5358 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5312 return -EFAULT; 5359 return -EFAULT;
5313 if (copy_to_user(to, ch->chunks, len))
5314 return -EFAULT;
5315 5360
5316 return 0; 5361 return 0;
5317} 5362}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 4fa1f3ad2513..4c9890ec2528 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -344,14 +344,20 @@ static void do_pnp_device_entry(void *symval, unsigned long size,
344 struct module *mod) 344 struct module *mod)
345{ 345{
346 const unsigned long id_size = sizeof(struct pnp_device_id); 346 const unsigned long id_size = sizeof(struct pnp_device_id);
347 const struct pnp_device_id *id = symval; 347 const unsigned int count = (size / id_size)-1;
348 const struct pnp_device_id *devs = symval;
349 unsigned int i;
348 350
349 device_id_check(mod->name, "pnp", size, id_size, symval); 351 device_id_check(mod->name, "pnp", size, id_size, symval);
350 352
351 buf_printf(&mod->dev_table_buf, 353 for (i = 0; i < count; i++) {
352 "MODULE_ALIAS(\"pnp:d%s*\");\n", id->id); 354 const char *id = (char *)devs[i].id;
353 buf_printf(&mod->dev_table_buf, 355
354 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id->id); 356 buf_printf(&mod->dev_table_buf,
357 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
358 buf_printf(&mod->dev_table_buf,
359 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
360 }
355} 361}
356 362
357/* looks like: "pnp:dD" for every device of the card */ 363/* looks like: "pnp:dD" for every device of the card */
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index ee0741f9eb53..fbef38a9604a 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -38,7 +38,6 @@
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/version.h>
42#include <sound/core.h> 41#include <sound/core.h>
43#include <sound/initval.h> 42#include <sound/initval.h>
44#include <sound/pcm.h> 43#include <sound/pcm.h>
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index a73d6ca0a906..1c53e337ecb2 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -278,6 +278,9 @@ enum {
278/* Defines for Nvidia HDA support */ 278/* Defines for Nvidia HDA support */
279#define NVIDIA_HDA_TRANSREG_ADDR 0x4e 279#define NVIDIA_HDA_TRANSREG_ADDR 0x4e
280#define NVIDIA_HDA_ENABLE_COHBITS 0x0f 280#define NVIDIA_HDA_ENABLE_COHBITS 0x0f
281#define NVIDIA_HDA_ISTRM_COH 0x4d
282#define NVIDIA_HDA_OSTRM_COH 0x4c
283#define NVIDIA_HDA_ENABLE_COHBIT 0x01
281 284
282/* Defines for Intel SCH HDA snoop control */ 285/* Defines for Intel SCH HDA snoop control */
283#define INTEL_SCH_HDA_DEVC 0x78 286#define INTEL_SCH_HDA_DEVC 0x78
@@ -900,6 +903,12 @@ static void azx_init_pci(struct azx *chip)
900 update_pci_byte(chip->pci, 903 update_pci_byte(chip->pci,
901 NVIDIA_HDA_TRANSREG_ADDR, 904 NVIDIA_HDA_TRANSREG_ADDR,
902 0x0f, NVIDIA_HDA_ENABLE_COHBITS); 905 0x0f, NVIDIA_HDA_ENABLE_COHBITS);
906 update_pci_byte(chip->pci,
907 NVIDIA_HDA_ISTRM_COH,
908 0x01, NVIDIA_HDA_ENABLE_COHBIT);
909 update_pci_byte(chip->pci,
910 NVIDIA_HDA_OSTRM_COH,
911 0x01, NVIDIA_HDA_ENABLE_COHBIT);
903 break; 912 break;
904 case AZX_DRIVER_SCH: 913 case AZX_DRIVER_SCH:
905 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); 914 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b80e725432f0..909f1c101c95 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -952,7 +952,7 @@ do_sku:
952 tmp | 0x2010); 952 tmp | 0x2010);
953 break; 953 break;
954 case 0x10ec0888: 954 case 0x10ec0888:
955 alc888_coef_init(codec); 955 /*alc888_coef_init(codec);*/ /* called in alc_init() */
956 break; 956 break;
957 case 0x10ec0267: 957 case 0x10ec0267:
958 case 0x10ec0268: 958 case 0x10ec0268:
@@ -2439,6 +2439,8 @@ static int alc_init(struct hda_codec *codec)
2439 unsigned int i; 2439 unsigned int i;
2440 2440
2441 alc_fix_pll(codec); 2441 alc_fix_pll(codec);
2442 if (codec->vendor_id == 0x10ec0888)
2443 alc888_coef_init(codec);
2442 2444
2443 for (i = 0; i < spec->num_init_verbs; i++) 2445 for (i = 0; i < spec->num_init_verbs; i++)
2444 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2446 snd_hda_sequence_write(codec, spec->init_verbs[i]);
@@ -8426,8 +8428,6 @@ static int patch_alc883(struct hda_codec *codec)
8426 codec->patch_ops = alc_patch_ops; 8428 codec->patch_ops = alc_patch_ops;
8427 if (board_config == ALC883_AUTO) 8429 if (board_config == ALC883_AUTO)
8428 spec->init_hook = alc883_auto_init; 8430 spec->init_hook = alc883_auto_init;
8429 else if (codec->vendor_id == 0x10ec0888)
8430 spec->init_hook = alc888_coef_init;
8431 8431
8432#ifdef CONFIG_SND_HDA_POWER_SAVE 8432#ifdef CONFIG_SND_HDA_POWER_SAVE
8433 if (!spec->loopback.amplist) 8433 if (!spec->loopback.amplist)
diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c
index b081e83766b7..b81d6b2cfa1d 100644
--- a/sound/soc/at91/eti_b1_wm8731.c
+++ b/sound/soc/at91/eti_b1_wm8731.c
@@ -22,7 +22,6 @@
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <linux/version.h>
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/clk.h> 26#include <linux/clk.h>
28#include <linux/timer.h> 27#include <linux/timer.h>
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 8604809f0c36..dc7b18fd2782 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -34,7 +34,6 @@
34 34
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
37#include <linux/version.h>
38#include <linux/kernel.h> 37#include <linux/kernel.h>
39#include <linux/init.h> 38#include <linux/init.h>
40#include <linux/delay.h> 39#include <linux/delay.h>
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 1fb7f9a7aecd..2f1c91b1d556 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/version.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/device.h> 17#include <linux/device.h>
19#include <sound/core.h> 18#include <sound/core.h>