aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
commita215aa7b9ab3759c047201199fba64d3042d7f13 (patch)
treebca37493d9b2233450e6d3ffced1261d0e4f71fe /drivers
parentd31199a77ef606f1d06894385f1852181ba6136b (diff)
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/dswexec.c19
-rw-r--r--drivers/acpi/battery.c38
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/debugfs.c2
-rw-r--r--drivers/acpi/ec.c3
-rw-r--r--drivers/ata/ahci.h1
-rw-r--r--drivers/ata/libahci.c18
-rw-r--r--drivers/ata/libata-scsi.c5
-rw-r--r--drivers/ata/libata-sff.c7
-rw-r--r--drivers/ata/pata_mpc52xx.c2
-rw-r--r--drivers/ata/sata_via.c9
-rw-r--r--drivers/block/xen-blkfront.c2
-rw-r--r--drivers/bluetooth/hci_ldisc.c7
-rw-r--r--drivers/char/agp/intel-agp.c28
-rw-r--r--drivers/char/agp/intel-gtt.c63
-rw-r--r--drivers/char/hpet.c17
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c42
-rw-r--r--drivers/char/n_gsm.c6
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
-rw-r--r--drivers/char/ramoops.c12
-rw-r--r--drivers/char/tpm/tpm.c28
-rw-r--r--drivers/char/tpm/tpm.h2
-rw-r--r--drivers/char/tpm/tpm_tis.c28
-rw-r--r--drivers/char/tty_buffer.c14
-rw-r--r--drivers/char/tty_io.c13
-rw-r--r--drivers/char/tty_ldisc.c51
-rw-r--r--drivers/char/virtio_console.c15
-rw-r--r--drivers/char/vt_ioctl.c11
-rw-r--r--drivers/cpuidle/cpuidle.c82
-rw-r--r--drivers/crypto/padlock-aes.c2
-rw-r--r--drivers/dma/mv_xor.c2
-rw-r--r--drivers/edac/amd64_edac.c2
-rw-r--r--drivers/edac/edac_mc.c10
-rw-r--r--drivers/firewire/core-card.c11
-rw-r--r--drivers/firewire/ohci.c107
-rw-r--r--drivers/gpio/cs5535-gpio.c27
-rw-r--r--drivers/gpio/rdc321x-gpio.c2
-rw-r--r--drivers/gpu/drm/Kconfig3
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c5
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c36
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c10
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c21
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h17
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c4
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c11
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c60
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c8
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_irq.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c35
-rw-r--r--drivers/gpu/drm/radeon/atom.c1
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c3
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c4
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c25
-rw-r--r--drivers/gpu/drm/radeon/r100.c6
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h1
-rw-r--r--drivers/gpu/drm/radeon/r200.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c32
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c8
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c53
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c34
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c36
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c9
-rw-r--r--drivers/gpu/vga/vgaarb.c2
-rw-r--r--drivers/hid/hid-egalax.c16
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hwmon/adm1026.c20
-rw-r--r--drivers/hwmon/applesmc.c48
-rw-r--r--drivers/hwmon/lm63.c59
-rw-r--r--drivers/hwmon/lm85.c1
-rw-r--r--drivers/hwmon/via686a.c14
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c2
-rw-r--r--drivers/i2c/i2c-core.c14
-rw-r--r--drivers/idle/intel_idle.c2
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c99
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c2
-rw-r--r--drivers/input/mouse/bcm5974.c40
-rw-r--r--drivers/input/mouse/synaptics.h3
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h28
-rw-r--r--drivers/input/serio/i8042.c6
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c89
-rw-r--r--drivers/isdn/gigaset/isocdata.c8
-rw-r--r--drivers/leds/leds-ss4200.c1
-rw-r--r--drivers/md/dm-mpath.c12
-rw-r--r--drivers/md/dm-table.c5
-rw-r--r--drivers/md/dm.c5
-rw-r--r--drivers/md/md.c44
-rw-r--r--drivers/md/md.h3
-rw-r--r--drivers/md/raid1.c1
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/media/common/saa7146_hlp.c8
-rw-r--r--drivers/media/common/saa7146_video.c16
-rw-r--r--drivers/media/radio/radio-aimslab.c23
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c4
-rw-r--r--drivers/media/video/gspca/gspca.c4
-rw-r--r--drivers/media/video/gspca/sonixj.c20
-rw-r--r--drivers/media/video/hdpvr/hdpvr-video.c1
-rw-r--r--drivers/media/video/msp3400-driver.c7
-rw-r--r--drivers/media/video/mx2_camera.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c24
-rw-r--r--drivers/mfd/wm831x-core.c8
-rw-r--r--drivers/misc/ad525x_dpot-spi.c4
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c25
-rw-r--r--drivers/misc/sgi-xp/xpc_uv.c17
-rw-r--r--drivers/mmc/core/core.c3
-rw-r--r--drivers/mmc/host/at91_mci.c13
-rw-r--r--drivers/mmc/host/atmel-mci.c18
-rw-r--r--drivers/mmc/host/bfin_sdh.c2
-rw-r--r--drivers/net/8139cp.c10
-rw-r--r--drivers/net/atlx/atl1.c10
-rw-r--r--drivers/net/benet/be_cmds.c2
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/e1000/e1000_main.c12
-rw-r--r--drivers/net/fec.c4
-rw-r--r--drivers/net/ifb.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c11
-rw-r--r--drivers/net/jme.c22
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/phy/marvell.c31
-rw-r--r--drivers/net/pppoe.c2
-rw-r--r--drivers/net/r6040.c22
-rw-r--r--drivers/net/r8169.c23
-rw-r--r--drivers/net/tehuti.c4
-rw-r--r--drivers/net/usb/usbnet.c11
-rw-r--r--drivers/net/virtio_net.c27
-rw-r--r--drivers/net/wireless/ath/ath.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_calib.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h191
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c87
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h9
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_mac.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c14
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h12
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h13
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c60
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c41
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c96
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c49
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h15
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c116
-rw-r--r--drivers/net/wireless/b43/sdio.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h6
-rw-r--r--drivers/net/wireless/orinoco/main.c6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c14
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c14
-rw-r--r--drivers/net/wireless/orinoco/wext.c4
-rw-r--r--drivers/net/wireless/p54/eeprom.c4
-rw-r--r--drivers/net/wireless/p54/p54usb.c21
-rw-r--r--drivers/net/wireless/p54/txrx.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2800.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c59
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c13
-rw-r--r--drivers/net/xen-netfront.c4
-rw-r--r--drivers/oprofile/timer_int.c13
-rw-r--r--drivers/pci/dmar.c5
-rw-r--r--drivers/pci/pci-stub.c3
-rw-r--r--drivers/pci/pci-sysfs.c22
-rw-r--r--drivers/pci/pci.h7
-rw-r--r--drivers/pci/proc.c2
-rw-r--r--drivers/pci/quirks.c23
-rw-r--r--drivers/pcmcia/soc_common.c1
-rw-r--r--drivers/platform/x86/asus-laptop.c6
-rw-r--r--drivers/platform/x86/intel_ips.c36
-rw-r--r--drivers/platform/x86/wmi.c2
-rw-r--r--drivers/pnp/pnpacpi/core.c29
-rw-r--r--drivers/power/ds2760_battery.c2
-rw-r--r--drivers/power/jz4740-battery.c7
-rw-r--r--drivers/power/olpc_battery.c8
-rw-r--r--drivers/rtc/rtc-cmos.c16
-rw-r--r--drivers/rtc/rtc-rs5c372.c2
-rw-r--r--drivers/s390/cio/qdio.h6
-rw-r--r--drivers/s390/cio/qdio_main.c43
-rw-r--r--drivers/scsi/gdth.c8
-rw-r--r--drivers/scsi/libsas/sas_ata.c1
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c1
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c24
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c64
-rw-r--r--drivers/scsi/pmcraid.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c6
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.c1
-rw-r--r--drivers/scsi/scsi_lib.c6
-rw-r--r--drivers/scsi/scsi_sysfs.c3
-rw-r--r--drivers/scsi/sd.c24
-rw-r--r--drivers/serial/8250.c3
-rw-r--r--drivers/serial/mfd.c18
-rw-r--r--drivers/ssb/b43_pci_bridge.c1
-rw-r--r--drivers/ssb/pcmcia.c2
-rw-r--r--drivers/staging/asus_oled/asus_oled.c8
-rw-r--r--drivers/staging/batman-adv/soft-interface.c4
-rw-r--r--drivers/staging/comedi/drivers/jr3_pci.c7
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c3
-rw-r--r--drivers/staging/cx25821/cx25821-video.c8
-rw-r--r--drivers/staging/cx25821/cx25821-video.h2
-rw-r--r--drivers/staging/frontier/tranzport.c2
-rw-r--r--drivers/staging/hv/blkvsc_drv.c1
-rw-r--r--drivers/staging/hv/netvsc.c2
-rw-r--r--drivers/staging/hv/netvsc_drv.c1
-rw-r--r--drivers/staging/iio/accel/adis16220_core.c2
-rw-r--r--drivers/staging/line6/control.c204
-rw-r--r--drivers/staging/line6/midi.c4
-rw-r--r--drivers/staging/line6/pod.c32
-rw-r--r--drivers/staging/line6/toneport.c4
-rw-r--r--drivers/staging/line6/variax.c12
-rw-r--r--drivers/staging/phison/phison.c2
-rw-r--r--drivers/staging/rt2860/chips/rt3090.c3
-rw-r--r--drivers/staging/rt2860/chips/rt30xx.c4
-rw-r--r--drivers/staging/rt2860/rt_main_dev.c2
-rw-r--r--drivers/staging/rt2860/usb_main_dev.c3
-rw-r--r--drivers/staging/rtl8187se/r8185b_init.c30
-rw-r--r--drivers/staging/samsung-laptop/samsung-laptop.c2
-rw-r--r--drivers/staging/udlfb/udlfb.c2
-rw-r--r--drivers/staging/usbip/usbip_event.c16
-rw-r--r--drivers/staging/usbip/vhci_hcd.c16
-rw-r--r--drivers/staging/zram/zram_drv.c4
-rw-r--r--drivers/usb/atm/ueagle-atm.c7
-rw-r--r--drivers/usb/class/cdc-acm.c1
-rw-r--r--drivers/usb/core/devio.c7
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/hub.c35
-rw-r--r--drivers/usb/core/message.c14
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c3
-rw-r--r--drivers/usb/gadget/composite.c19
-rw-r--r--drivers/usb/gadget/f_acm.c2
-rw-r--r--drivers/usb/gadget/g_ffs.c4
-rw-r--r--drivers/usb/gadget/multi.c4
-rw-r--r--drivers/usb/gadget/printer.c19
-rw-r--r--drivers/usb/host/ehci-au1xxx.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c37
-rw-r--r--drivers/usb/host/ehci-hub.c7
-rw-r--r--drivers/usb/host/ehci-pci.c53
-rw-r--r--drivers/usb/host/ehci-sched.c79
-rw-r--r--drivers/usb/host/ehci.h1
-rw-r--r--drivers/usb/host/ohci-jz4740.c2
-rw-r--r--drivers/usb/host/r8a66597.h2
-rw-r--r--drivers/usb/host/xhci-hub.c7
-rw-r--r--drivers/usb/host/xhci-mem.c173
-rw-r--r--drivers/usb/host/xhci-ring.c1
-rw-r--r--drivers/usb/host/xhci.c32
-rw-r--r--drivers/usb/host/xhci.h32
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c6
-rw-r--r--drivers/usb/misc/iowarrior.c1
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c1
-rw-r--r--drivers/usb/misc/trancevibrator.c2
-rw-r--r--drivers/usb/misc/usbled.c2
-rw-r--r--drivers/usb/misc/usbsevseg.c10
-rw-r--r--drivers/usb/misc/uss720.c4
-rw-r--r--drivers/usb/musb/blackfin.c7
-rw-r--r--drivers/usb/musb/davinci.c2
-rw-r--r--drivers/usb/musb/musb_core.c5
-rw-r--r--drivers/usb/musb/omap2430.c1
-rw-r--r--drivers/usb/musb/tusb6010.c4
-rw-r--r--drivers/usb/serial/ch341.c10
-rw-r--r--drivers/usb/serial/cp210x.c18
-rw-r--r--drivers/usb/serial/digi_acceleport.c10
-rw-r--r--drivers/usb/serial/ftdi_sio.c83
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h87
-rw-r--r--drivers/usb/serial/generic.c20
-rw-r--r--drivers/usb/serial/io_edgeport.c4
-rw-r--r--drivers/usb/serial/io_tables.h1
-rw-r--r--drivers/usb/serial/iuu_phoenix.c1
-rw-r--r--drivers/usb/serial/keyspan.h4
-rw-r--r--drivers/usb/serial/keyspan_pda.c17
-rw-r--r--drivers/usb/serial/mct_u232.c7
-rw-r--r--drivers/usb/serial/moto_modem.c1
-rw-r--r--drivers/usb/serial/opticon.c6
-rw-r--r--drivers/usb/serial/option.c48
-rw-r--r--drivers/usb/serial/oti6858.c1
-rw-r--r--drivers/usb/serial/pl2303.c12
-rw-r--r--drivers/usb/serial/pl2303.h1
-rw-r--r--drivers/usb/serial/qcaux.c3
-rw-r--r--drivers/usb/serial/siemens_mpi.c1
-rw-r--r--drivers/usb/serial/spcp8x5.c7
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c2
-rw-r--r--drivers/usb/serial/usb-serial.c7
-rw-r--r--drivers/usb/serial/usb_debug.c1
-rw-r--r--drivers/usb/serial/visor.c11
-rw-r--r--drivers/usb/storage/sierra_ms.c2
-rw-r--r--drivers/usb/storage/unusual_cypress.h5
-rw-r--r--drivers/usb/storage/unusual_devs.h39
-rw-r--r--drivers/video/backlight/88pm860x_bl.c4
-rw-r--r--drivers/video/backlight/backlight.c12
-rw-r--r--drivers/video/via/accel.c7
-rw-r--r--drivers/video/via/via_i2c.c27
-rw-r--r--drivers/virtio/virtio_pci.c20
-rw-r--r--drivers/watchdog/rdc321x_wdt.c2
-rw-r--r--drivers/xen/events.c2
327 files changed, 3527 insertions, 1474 deletions
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index d555b374e314..6b0b5d08d97a 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
300 * we must enter this object into the namespace. The created 300 * we must enter this object into the namespace. The created
301 * object is temporary and will be deleted upon completion of 301 * object is temporary and will be deleted upon completion of
302 * the execution of this method. 302 * the execution of this method.
303 *
304 * Note 10/2010: Except for the Scope() op. This opcode does
305 * not actually create a new object, it refers to an existing
306 * object. However, for Scope(), we want to indeed open a
307 * new scope.
303 */ 308 */
304 status = acpi_ds_load2_begin_op(walk_state, NULL); 309 if (op->common.aml_opcode != AML_SCOPE_OP) {
310 status =
311 acpi_ds_load2_begin_op(walk_state, NULL);
312 } else {
313 status =
314 acpi_ds_scope_stack_push(op->named.node,
315 op->named.node->
316 type, walk_state);
317 if (ACPI_FAILURE(status)) {
318 return_ACPI_STATUS(status);
319 }
320 }
305 } 321 }
306
307 break; 322 break;
308 323
309 case AML_CLASS_EXECUTE: 324 case AML_CLASS_EXECUTE:
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 98417201e9ce..4c0a0a37d46e 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -98,6 +98,7 @@ enum {
98 * due to bad math. 98 * due to bad math.
99 */ 99 */
100 ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, 100 ACPI_BATTERY_QUIRK_SIGNED16_CURRENT,
101 ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY,
101}; 102};
102 103
103struct acpi_battery { 104struct acpi_battery {
@@ -412,6 +413,8 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
412 result = extract_package(battery, buffer.pointer, 413 result = extract_package(battery, buffer.pointer,
413 info_offsets, ARRAY_SIZE(info_offsets)); 414 info_offsets, ARRAY_SIZE(info_offsets));
414 kfree(buffer.pointer); 415 kfree(buffer.pointer);
416 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
417 battery->full_charge_capacity = battery->design_capacity;
415 return result; 418 return result;
416} 419}
417 420
@@ -448,6 +451,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
448 battery->rate_now != -1) 451 battery->rate_now != -1)
449 battery->rate_now = abs((s16)battery->rate_now); 452 battery->rate_now = abs((s16)battery->rate_now);
450 453
454 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)
455 && battery->capacity_now >= 0 && battery->capacity_now <= 100)
456 battery->capacity_now = (battery->capacity_now *
457 battery->full_charge_capacity) / 100;
451 return result; 458 return result;
452} 459}
453 460
@@ -561,6 +568,33 @@ static void acpi_battery_quirks(struct acpi_battery *battery)
561 } 568 }
562} 569}
563 570
571/*
572 * According to the ACPI spec, some kinds of primary batteries can
573 * report percentage battery remaining capacity directly to OS.
574 * In this case, it reports the Last Full Charged Capacity == 100
575 * and BatteryPresentRate == 0xFFFFFFFF.
576 *
577 * Now we found some battery reports percentage remaining capacity
578 * even if it's rechargeable.
579 * https://bugzilla.kernel.org/show_bug.cgi?id=15979
580 *
581 * Handle this correctly so that they won't break userspace.
582 */
583static void acpi_battery_quirks2(struct acpi_battery *battery)
584{
585 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
586 return ;
587
588 if (battery->full_charge_capacity == 100 &&
589 battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN &&
590 battery->capacity_now >=0 && battery->capacity_now <= 100) {
591 set_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags);
592 battery->full_charge_capacity = battery->design_capacity;
593 battery->capacity_now = (battery->capacity_now *
594 battery->full_charge_capacity) / 100;
595 }
596}
597
564static int acpi_battery_update(struct acpi_battery *battery) 598static int acpi_battery_update(struct acpi_battery *battery)
565{ 599{
566 int result, old_present = acpi_battery_present(battery); 600 int result, old_present = acpi_battery_present(battery);
@@ -586,7 +620,9 @@ static int acpi_battery_update(struct acpi_battery *battery)
586 if (!battery->bat.dev) 620 if (!battery->bat.dev)
587 sysfs_add_battery(battery); 621 sysfs_add_battery(battery);
588#endif 622#endif
589 return acpi_battery_get_state(battery); 623 result = acpi_battery_get_state(battery);
624 acpi_battery_quirks2(battery);
625 return result;
590} 626}
591 627
592/* -------------------------------------------------------------------------- 628/* --------------------------------------------------------------------------
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 310e3b9749cb..d68bd61072bb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -935,6 +935,12 @@ static int __init acpi_bus_init(void)
935 goto error1; 935 goto error1;
936 } 936 }
937 937
938 /*
939 * _PDC control method may load dynamic SSDT tables,
940 * and we need to install the table handler before that.
941 */
942 acpi_sysfs_init();
943
938 acpi_early_processor_set_pdc(); 944 acpi_early_processor_set_pdc();
939 945
940 /* 946 /*
@@ -1026,7 +1032,6 @@ static int __init acpi_init(void)
1026 acpi_scan_init(); 1032 acpi_scan_init();
1027 acpi_ec_init(); 1033 acpi_ec_init();
1028 acpi_power_init(); 1034 acpi_power_init();
1029 acpi_sysfs_init();
1030 acpi_debugfs_init(); 1035 acpi_debugfs_init();
1031 acpi_sleep_proc_init(); 1036 acpi_sleep_proc_init();
1032 acpi_wakeup_device_init(); 1037 acpi_wakeup_device_init();
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c
index 7de27d49c4b9..74c4a398604a 100644
--- a/drivers/acpi/debugfs.c
+++ b/drivers/acpi/debugfs.c
@@ -79,7 +79,7 @@ int __init acpi_debugfs_init(void)
79 if (!acpi_dir) 79 if (!acpi_dir)
80 goto err; 80 goto err;
81 81
82 cm_dentry = debugfs_create_file("custom_method", S_IWUGO, 82 cm_dentry = debugfs_create_file("custom_method", S_IWUSR,
83 acpi_dir, NULL, &cm_fops); 83 acpi_dir, NULL, &cm_fops);
84 if (!cm_dentry) 84 if (!cm_dentry)
85 goto err; 85 goto err;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f31291ba94d0..7bff18b33089 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -929,6 +929,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
929 ec_flag_msi, "MSI hardware", { 929 ec_flag_msi, "MSI hardware", {
930 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, 930 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL},
931 { 931 {
932 ec_flag_msi, "MSI hardware", {
933 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL},
934 {
932 ec_validate_ecdt, "ASUS hardware", { 935 ec_validate_ecdt, "ASUS hardware", {
933 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 936 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
934 {}, 937 {},
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index e5fdeebf9ef0..d1a0f5bfdfeb 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -72,6 +72,7 @@ enum {
72 AHCI_CMD_RESET = (1 << 8), 72 AHCI_CMD_RESET = (1 << 8),
73 AHCI_CMD_CLR_BUSY = (1 << 10), 73 AHCI_CMD_CLR_BUSY = (1 << 10),
74 74
75 RX_FIS_PIO_SETUP = 0x20, /* offset of PIO Setup FIS data */
75 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ 76 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */
76 RX_FIS_SDB = 0x58, /* offset of SDB FIS data */ 77 RX_FIS_SDB = 0x58, /* offset of SDB FIS data */
77 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ 78 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 8eea309ea212..137514dbbf65 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1830,12 +1830,24 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
1830static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) 1830static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
1831{ 1831{
1832 struct ahci_port_priv *pp = qc->ap->private_data; 1832 struct ahci_port_priv *pp = qc->ap->private_data;
1833 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 1833 u8 *rx_fis = pp->rx_fis;
1834 1834
1835 if (pp->fbs_enabled) 1835 if (pp->fbs_enabled)
1836 d2h_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; 1836 rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ;
1837
1838 /*
1839 * After a successful execution of an ATA PIO data-in command,
1840 * the device doesn't send D2H Reg FIS to update the TF and
1841 * the host should take TF and E_Status from the preceding PIO
1842 * Setup FIS.
1843 */
1844 if (qc->tf.protocol == ATA_PROT_PIO && qc->dma_dir == DMA_FROM_DEVICE &&
1845 !(qc->flags & ATA_QCFLAG_FAILED)) {
1846 ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf);
1847 qc->result_tf.command = (rx_fis + RX_FIS_PIO_SETUP)[15];
1848 } else
1849 ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf);
1837 1850
1838 ata_tf_from_fis(d2h_fis, &qc->result_tf);
1839 return true; 1851 return true;
1840} 1852}
1841 1853
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a89172c100f5..7bb6787de550 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2577,8 +2577,11 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2577 * 2577 *
2578 * If door lock fails, always clear sdev->locked to 2578 * If door lock fails, always clear sdev->locked to
2579 * avoid this infinite loop. 2579 * avoid this infinite loop.
2580 *
2581 * This may happen before SCSI scan is complete. Make
2582 * sure qc->dev->sdev isn't NULL before dereferencing.
2580 */ 2583 */
2581 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) 2584 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
2582 qc->dev->sdev->locked = 0; 2585 qc->dev->sdev->locked = 0;
2583 2586
2584 qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; 2587 qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index e30c537cce32..c55988b4f900 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1532,11 +1532,10 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap,
1532 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) 1532 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
1533 return ata_sff_idle_irq(ap); 1533 return ata_sff_idle_irq(ap);
1534 break; 1534 break;
1535 case HSM_ST: 1535 case HSM_ST_IDLE:
1536 case HSM_ST_LAST:
1537 break;
1538 default:
1539 return ata_sff_idle_irq(ap); 1536 return ata_sff_idle_irq(ap);
1537 default:
1538 break;
1540 } 1539 }
1541 1540
1542 /* check main status, clearing INTRQ if needed */ 1541 /* check main status, clearing INTRQ if needed */
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 8cc536e49a0a..d7d8026cde99 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -610,7 +610,7 @@ static struct scsi_host_template mpc52xx_ata_sht = {
610}; 610};
611 611
612static struct ata_port_operations mpc52xx_ata_port_ops = { 612static struct ata_port_operations mpc52xx_ata_port_ops = {
613 .inherits = &ata_sff_port_ops, 613 .inherits = &ata_bmdma_port_ops,
614 .sff_dev_select = mpc52xx_ata_dev_select, 614 .sff_dev_select = mpc52xx_ata_dev_select,
615 .set_piomode = mpc52xx_ata_set_piomode, 615 .set_piomode = mpc52xx_ata_set_piomode,
616 .set_dmamode = mpc52xx_ata_set_dmamode, 616 .set_dmamode = mpc52xx_ata_set_dmamode,
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 4730c42a5ee5..c51b8d25cfa8 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -538,7 +538,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
538 return 0; 538 return 0;
539} 539}
540 540
541static void svia_configure(struct pci_dev *pdev) 541static void svia_configure(struct pci_dev *pdev, int board_id)
542{ 542{
543 u8 tmp8; 543 u8 tmp8;
544 544
@@ -577,7 +577,7 @@ static void svia_configure(struct pci_dev *pdev)
577 } 577 }
578 578
579 /* 579 /*
580 * vt6421 has problems talking to some drives. The following 580 * vt6420/1 has problems talking to some drives. The following
581 * is the fix from Joseph Chan <JosephChan@via.com.tw>. 581 * is the fix from Joseph Chan <JosephChan@via.com.tw>.
582 * 582 *
583 * When host issues HOLD, device may send up to 20DW of data 583 * When host issues HOLD, device may send up to 20DW of data
@@ -596,8 +596,9 @@ static void svia_configure(struct pci_dev *pdev)
596 * 596 *
597 * https://bugzilla.kernel.org/show_bug.cgi?id=15173 597 * https://bugzilla.kernel.org/show_bug.cgi?id=15173
598 * http://article.gmane.org/gmane.linux.ide/46352 598 * http://article.gmane.org/gmane.linux.ide/46352
599 * http://thread.gmane.org/gmane.linux.kernel/1062139
599 */ 600 */
600 if (pdev->device == 0x3249) { 601 if (board_id == vt6420 || board_id == vt6421) {
601 pci_read_config_byte(pdev, 0x52, &tmp8); 602 pci_read_config_byte(pdev, 0x52, &tmp8);
602 tmp8 |= 1 << 2; 603 tmp8 |= 1 << 2;
603 pci_write_config_byte(pdev, 0x52, tmp8); 604 pci_write_config_byte(pdev, 0x52, tmp8);
@@ -652,7 +653,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
652 if (rc) 653 if (rc)
653 return rc; 654 return rc;
654 655
655 svia_configure(pdev); 656 svia_configure(pdev, board_id);
656 657
657 pci_set_master(pdev); 658 pci_set_master(pdev);
658 return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, 659 return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index ab735a605cf3..d773397575db 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -71,7 +71,7 @@ struct blk_shadow {
71 71
72static const struct block_device_operations xlvbd_block_fops; 72static const struct block_device_operations xlvbd_block_fops;
73 73
74#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) 74#define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE)
75 75
76/* 76/*
77 * We have one of these per vbd, whether ide, scsi or 'other'. They 77 * We have one of these per vbd, whether ide, scsi or 'other'. They
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 998833d93c13..17361bad46dd 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)
256 256
257 BT_DBG("tty %p", tty); 257 BT_DBG("tty %p", tty);
258 258
259 /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
260 the pointer */
259 if (hu) 261 if (hu)
260 return -EEXIST; 262 return -EEXIST;
261 263
264 /* Error if the tty has no write op instead of leaving an exploitable
265 hole */
266 if (tty->ops->write == NULL)
267 return -EOPNOTSUPP;
268
262 if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { 269 if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
263 BT_ERR("Can't allocate control structure"); 270 BT_ERR("Can't allocate control structure");
264 return -ENFILE; 271 return -ENFILE;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index cd18493c9527..aa5c782bf015 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -927,20 +927,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
927 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); 927 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
928 928
929 /* 929 /*
930 * If the device has not been properly setup, the following will catch
931 * the problem and should stop the system from crashing.
932 * 20030610 - hamish@zot.org
933 */
934 if (pci_enable_device(pdev)) {
935 dev_err(&pdev->dev, "can't enable PCI device\n");
936 agp_put_bridge(bridge);
937 return -ENODEV;
938 }
939
940 /*
941 * The following fixes the case where the BIOS has "forgotten" to 930 * The following fixes the case where the BIOS has "forgotten" to
942 * provide an address range for the GART. 931 * provide an address range for the GART.
943 * 20030610 - hamish@zot.org 932 * 20030610 - hamish@zot.org
933 * This happens before pci_enable_device() intentionally;
934 * calling pci_enable_device() before assigning the resource
935 * will result in the GART being disabled on machines with such
936 * BIOSs (the GART ends up with a BAR starting at 0, which
937 * conflicts a lot of other devices).
944 */ 938 */
945 r = &pdev->resource[0]; 939 r = &pdev->resource[0];
946 if (!r->start && r->end) { 940 if (!r->start && r->end) {
@@ -951,6 +945,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
951 } 945 }
952 } 946 }
953 947
948 /*
949 * If the device has not been properly setup, the following will catch
950 * the problem and should stop the system from crashing.
951 * 20030610 - hamish@zot.org
952 */
953 if (pci_enable_device(pdev)) {
954 dev_err(&pdev->dev, "can't enable PCI device\n");
955 agp_put_bridge(bridge);
956 return -ENODEV;
957 }
958
954 /* Fill in the mode register */ 959 /* Fill in the mode register */
955 if (cap_ptr) { 960 if (cap_ptr) {
956 pci_read_config_dword(pdev, 961 pci_read_config_dword(pdev,
@@ -1049,6 +1054,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
1049 ID(PCI_DEVICE_ID_INTEL_G45_HB), 1054 ID(PCI_DEVICE_ID_INTEL_G45_HB),
1050 ID(PCI_DEVICE_ID_INTEL_G41_HB), 1055 ID(PCI_DEVICE_ID_INTEL_G41_HB),
1051 ID(PCI_DEVICE_ID_INTEL_B43_HB), 1056 ID(PCI_DEVICE_ID_INTEL_B43_HB),
1057 ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
1052 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), 1058 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
1053 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), 1059 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
1054 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), 1060 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 75e0a3497888..6ea3bf6e5b1a 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -534,7 +534,7 @@ static void intel_i830_init_gtt_entries(void)
534 534
535 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 535 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl);
536 536
537 if (IS_I965) { 537 if (IS_G33 || IS_I965) {
538 u32 pgetbl_ctl; 538 u32 pgetbl_ctl;
539 pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); 539 pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL);
540 540
@@ -567,22 +567,6 @@ static void intel_i830_init_gtt_entries(void)
567 size = 512; 567 size = 512;
568 } 568 }
569 size += 4; /* add in BIOS popup space */ 569 size += 4; /* add in BIOS popup space */
570 } else if (IS_G33 && !IS_PINEVIEW) {
571 /* G33's GTT size defined in gmch_ctrl */
572 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) {
573 case G33_PGETBL_SIZE_1M:
574 size = 1024;
575 break;
576 case G33_PGETBL_SIZE_2M:
577 size = 2048;
578 break;
579 default:
580 dev_info(&agp_bridge->dev->dev,
581 "unknown page table size 0x%x, assuming 512KB\n",
582 (gmch_ctrl & G33_PGETBL_SIZE_MASK));
583 size = 512;
584 }
585 size += 4;
586 } else if (IS_G4X || IS_PINEVIEW) { 570 } else if (IS_G4X || IS_PINEVIEW) {
587 /* On 4 series hardware, GTT stolen is separate from graphics 571 /* On 4 series hardware, GTT stolen is separate from graphics
588 * stolen, ignore it in stolen gtt entries counting. However, 572 * stolen, ignore it in stolen gtt entries counting. However,
@@ -1257,24 +1241,31 @@ static int intel_i915_get_gtt_size(void)
1257 int size; 1241 int size;
1258 1242
1259 if (IS_G33) { 1243 if (IS_G33) {
1260 u16 gmch_ctrl; 1244 u32 pgetbl_ctl;
1245 pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL);
1261 1246
1262 /* G33's GTT size defined in gmch_ctrl */ 1247 switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) {
1263 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 1248 case I965_PGETBL_SIZE_128KB:
1264 switch (gmch_ctrl & I830_GMCH_GMS_MASK) { 1249 size = 128;
1265 case I830_GMCH_GMS_STOLEN_512: 1250 break;
1251 case I965_PGETBL_SIZE_256KB:
1252 size = 256;
1253 break;
1254 case I965_PGETBL_SIZE_512KB:
1266 size = 512; 1255 size = 512;
1267 break; 1256 break;
1268 case I830_GMCH_GMS_STOLEN_1024: 1257 case I965_PGETBL_SIZE_1MB:
1269 size = 1024; 1258 size = 1024;
1270 break; 1259 break;
1271 case I830_GMCH_GMS_STOLEN_8192: 1260 case I965_PGETBL_SIZE_2MB:
1272 size = 8*1024; 1261 size = 2048;
1262 break;
1263 case I965_PGETBL_SIZE_1_5MB:
1264 size = 1024 + 512;
1273 break; 1265 break;
1274 default: 1266 default:
1275 dev_info(&agp_bridge->dev->dev, 1267 dev_info(&intel_private.pcidev->dev,
1276 "unknown page table size 0x%x, assuming 512KB\n", 1268 "unknown page table size, assuming 512KB\n");
1277 (gmch_ctrl & I830_GMCH_GMS_MASK));
1278 size = 512; 1269 size = 512;
1279 } 1270 }
1280 } else { 1271 } else {
@@ -1306,14 +1297,6 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
1306 pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); 1297 pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp);
1307 pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); 1298 pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2);
1308 1299
1309 gtt_map_size = intel_i915_get_gtt_size();
1310
1311 intel_private.gtt = ioremap(temp2, gtt_map_size);
1312 if (!intel_private.gtt)
1313 return -ENOMEM;
1314
1315 intel_private.gtt_total_size = gtt_map_size / 4;
1316
1317 temp &= 0xfff80000; 1300 temp &= 0xfff80000;
1318 1301
1319 intel_private.registers = ioremap(temp, 128 * 4096); 1302 intel_private.registers = ioremap(temp, 128 * 4096);
@@ -1322,6 +1305,14 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
1322 return -ENOMEM; 1305 return -ENOMEM;
1323 } 1306 }
1324 1307
1308 gtt_map_size = intel_i915_get_gtt_size();
1309
1310 intel_private.gtt = ioremap(temp2, gtt_map_size);
1311 if (!intel_private.gtt)
1312 return -ENOMEM;
1313
1314 intel_private.gtt_total_size = gtt_map_size / 4;
1315
1325 temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; 1316 temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000;
1326 global_cache_flush(); /* FIXME: ? */ 1317 global_cache_flush(); /* FIXME: ? */
1327 1318
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index a0a1829d3198..f8e7d89ceb2c 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -479,6 +479,21 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp)
479 if (irq) { 479 if (irq) {
480 unsigned long irq_flags; 480 unsigned long irq_flags;
481 481
482 if (devp->hd_flags & HPET_SHARED_IRQ) {
483 /*
484 * To prevent the interrupt handler from seeing an
485 * unwanted interrupt status bit, program the timer
486 * so that it will not fire in the near future ...
487 */
488 writel(readl(&timer->hpet_config) & ~Tn_TYPE_CNF_MASK,
489 &timer->hpet_config);
490 write_counter(read_counter(&hpet->hpet_mc),
491 &timer->hpet_compare);
492 /* ... and clear any left-over status. */
493 isr = 1 << (devp - devp->hd_hpets->hp_dev);
494 writel(isr, &hpet->hpet_isr);
495 }
496
482 sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); 497 sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev));
483 irq_flags = devp->hd_flags & HPET_SHARED_IRQ 498 irq_flags = devp->hd_flags & HPET_SHARED_IRQ
484 ? IRQF_SHARED : IRQF_DISABLED; 499 ? IRQF_SHARED : IRQF_DISABLED;
@@ -970,6 +985,8 @@ static int hpet_acpi_add(struct acpi_device *device)
970 return -ENODEV; 985 return -ENODEV;
971 986
972 if (!data.hd_address || !data.hd_nirqs) { 987 if (!data.hd_address || !data.hd_nirqs) {
988 if (data.hd_address)
989 iounmap(data.hd_address);
973 printk("%s: no address or irqs in _CRS\n", __func__); 990 printk("%s: no address or irqs in _CRS\n", __func__);
974 return -ENODEV; 991 return -ENODEV;
975 } 992 }
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 7bd7c45b53ef..22abd188fe12 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -320,6 +320,7 @@ static int unload_when_empty = 1;
320static int add_smi(struct smi_info *smi); 320static int add_smi(struct smi_info *smi);
321static int try_smi_init(struct smi_info *smi); 321static int try_smi_init(struct smi_info *smi);
322static void cleanup_one_si(struct smi_info *to_clean); 322static void cleanup_one_si(struct smi_info *to_clean);
323static void cleanup_ipmi_si(void);
323 324
324static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); 325static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list);
325static int register_xaction_notifier(struct notifier_block *nb) 326static int register_xaction_notifier(struct notifier_block *nb)
@@ -1665,6 +1666,17 @@ static int check_hotmod_int_op(const char *curr, const char *option,
1665 return 0; 1666 return 0;
1666} 1667}
1667 1668
1669static struct smi_info *smi_info_alloc(void)
1670{
1671 struct smi_info *info = kzalloc(sizeof(*info), GFP_KERNEL);
1672
1673 if (info) {
1674 spin_lock_init(&info->si_lock);
1675 spin_lock_init(&info->msg_lock);
1676 }
1677 return info;
1678}
1679
1668static int hotmod_handler(const char *val, struct kernel_param *kp) 1680static int hotmod_handler(const char *val, struct kernel_param *kp)
1669{ 1681{
1670 char *str = kstrdup(val, GFP_KERNEL); 1682 char *str = kstrdup(val, GFP_KERNEL);
@@ -1779,7 +1791,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
1779 } 1791 }
1780 1792
1781 if (op == HM_ADD) { 1793 if (op == HM_ADD) {
1782 info = kzalloc(sizeof(*info), GFP_KERNEL); 1794 info = smi_info_alloc();
1783 if (!info) { 1795 if (!info) {
1784 rv = -ENOMEM; 1796 rv = -ENOMEM;
1785 goto out; 1797 goto out;
@@ -1844,7 +1856,7 @@ static __devinit void hardcode_find_bmc(void)
1844 if (!ports[i] && !addrs[i]) 1856 if (!ports[i] && !addrs[i])
1845 continue; 1857 continue;
1846 1858
1847 info = kzalloc(sizeof(*info), GFP_KERNEL); 1859 info = smi_info_alloc();
1848 if (!info) 1860 if (!info)
1849 return; 1861 return;
1850 1862
@@ -2028,7 +2040,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
2028 return -ENODEV; 2040 return -ENODEV;
2029 } 2041 }
2030 2042
2031 info = kzalloc(sizeof(*info), GFP_KERNEL); 2043 info = smi_info_alloc();
2032 if (!info) { 2044 if (!info) {
2033 printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); 2045 printk(KERN_ERR PFX "Could not allocate SI data (3)\n");
2034 return -ENOMEM; 2046 return -ENOMEM;
@@ -2138,7 +2150,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
2138 if (!acpi_dev) 2150 if (!acpi_dev)
2139 return -ENODEV; 2151 return -ENODEV;
2140 2152
2141 info = kzalloc(sizeof(*info), GFP_KERNEL); 2153 info = smi_info_alloc();
2142 if (!info) 2154 if (!info)
2143 return -ENOMEM; 2155 return -ENOMEM;
2144 2156
@@ -2319,7 +2331,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
2319{ 2331{
2320 struct smi_info *info; 2332 struct smi_info *info;
2321 2333
2322 info = kzalloc(sizeof(*info), GFP_KERNEL); 2334 info = smi_info_alloc();
2323 if (!info) { 2335 if (!info) {
2324 printk(KERN_ERR PFX "Could not allocate SI data\n"); 2336 printk(KERN_ERR PFX "Could not allocate SI data\n");
2325 return; 2337 return;
@@ -2426,7 +2438,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
2426 int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK; 2438 int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK;
2427 struct smi_info *info; 2439 struct smi_info *info;
2428 2440
2429 info = kzalloc(sizeof(*info), GFP_KERNEL); 2441 info = smi_info_alloc();
2430 if (!info) 2442 if (!info)
2431 return -ENOMEM; 2443 return -ENOMEM;
2432 2444
@@ -2567,7 +2579,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2567 return -EINVAL; 2579 return -EINVAL;
2568 } 2580 }
2569 2581
2570 info = kzalloc(sizeof(*info), GFP_KERNEL); 2582 info = smi_info_alloc();
2571 2583
2572 if (!info) { 2584 if (!info) {
2573 dev_err(&dev->dev, 2585 dev_err(&dev->dev,
@@ -3014,7 +3026,7 @@ static __devinit void default_find_bmc(void)
3014 if (check_legacy_ioport(ipmi_defaults[i].port)) 3026 if (check_legacy_ioport(ipmi_defaults[i].port))
3015 continue; 3027 continue;
3016#endif 3028#endif
3017 info = kzalloc(sizeof(*info), GFP_KERNEL); 3029 info = smi_info_alloc();
3018 if (!info) 3030 if (!info)
3019 return; 3031 return;
3020 3032
@@ -3139,9 +3151,6 @@ static int try_smi_init(struct smi_info *new_smi)
3139 goto out_err; 3151 goto out_err;
3140 } 3152 }
3141 3153
3142 spin_lock_init(&(new_smi->si_lock));
3143 spin_lock_init(&(new_smi->msg_lock));
3144
3145 /* Do low-level detection first. */ 3154 /* Do low-level detection first. */
3146 if (new_smi->handlers->detect(new_smi->si_sm)) { 3155 if (new_smi->handlers->detect(new_smi->si_sm)) {
3147 if (new_smi->addr_source) 3156 if (new_smi->addr_source)
@@ -3428,16 +3437,7 @@ static __devinit int init_ipmi_si(void)
3428 mutex_lock(&smi_infos_lock); 3437 mutex_lock(&smi_infos_lock);
3429 if (unload_when_empty && list_empty(&smi_infos)) { 3438 if (unload_when_empty && list_empty(&smi_infos)) {
3430 mutex_unlock(&smi_infos_lock); 3439 mutex_unlock(&smi_infos_lock);
3431#ifdef CONFIG_PCI 3440 cleanup_ipmi_si();
3432 if (pci_registered)
3433 pci_unregister_driver(&ipmi_pci_driver);
3434#endif
3435
3436#ifdef CONFIG_PPC_OF
3437 if (of_registered)
3438 of_unregister_platform_driver(&ipmi_of_platform_driver);
3439#endif
3440 driver_unregister(&ipmi_driver.driver);
3441 printk(KERN_WARNING PFX 3441 printk(KERN_WARNING PFX
3442 "Unable to find any System Interface(s)\n"); 3442 "Unable to find any System Interface(s)\n");
3443 return -ENODEV; 3443 return -ENODEV;
diff --git a/drivers/char/n_gsm.c b/drivers/char/n_gsm.c
index 04ef3ef0a422..0e62674072eb 100644
--- a/drivers/char/n_gsm.c
+++ b/drivers/char/n_gsm.c
@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
716 if (msg->len < 128) 716 if (msg->len < 128)
717 *--dp = (msg->len << 1) | EA; 717 *--dp = (msg->len << 1) | EA;
718 else { 718 else {
719 *--dp = (msg->len >> 6) | EA; 719 *--dp = (msg->len >> 7); /* bits 7 - 15 */
720 *--dp = (msg->len & 127) << 1; 720 *--dp = (msg->len & 127) << 1; /* bits 0 - 6 */
721 } 721 }
722 } 722 }
723 723
@@ -968,6 +968,8 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data,
968{ 968{
969 struct gsm_msg *msg; 969 struct gsm_msg *msg;
970 msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype); 970 msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype);
971 if (msg == NULL)
972 return;
971 msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ 973 msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */
972 msg->data[1] = (dlen << 1) | EA; 974 msg->data[1] = (dlen << 1) | EA;
973 memcpy(msg->data + 2, data, dlen); 975 memcpy(msg->data + 2, data, dlen);
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 9ecd6bef5d3b..45f9fad4f5dc 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -4127,6 +4127,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4127 if (cmd != SIOCWANDEV) 4127 if (cmd != SIOCWANDEV)
4128 return hdlc_ioctl(dev, ifr, cmd); 4128 return hdlc_ioctl(dev, ifr, cmd);
4129 4129
4130 memset(&new_line, 0, size);
4131
4130 switch(ifr->ifr_settings.type) { 4132 switch(ifr->ifr_settings.type) {
4131 case IF_GET_IFACE: /* return current sync_serial_settings */ 4133 case IF_GET_IFACE: /* return current sync_serial_settings */
4132 4134
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 74f00b5ffa36..9445f48c692f 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -27,7 +27,6 @@
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28 28
29#define RAMOOPS_KERNMSG_HDR "====" 29#define RAMOOPS_KERNMSG_HDR "===="
30#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval))
31 30
32#define RECORD_SIZE 4096 31#define RECORD_SIZE 4096
33 32
@@ -63,8 +62,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
63 struct ramoops_context, dump); 62 struct ramoops_context, dump);
64 unsigned long s1_start, s2_start; 63 unsigned long s1_start, s2_start;
65 unsigned long l1_cpy, l2_cpy; 64 unsigned long l1_cpy, l2_cpy;
66 int res; 65 int res, hdr_size;
67 char *buf; 66 char *buf, *buf_orig;
68 struct timeval timestamp; 67 struct timeval timestamp;
69 68
70 /* Only dump oopses if dump_oops is set */ 69 /* Only dump oopses if dump_oops is set */
@@ -72,6 +71,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
72 return; 71 return;
73 72
74 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); 73 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE));
74 buf_orig = buf;
75
75 memset(buf, '\0', RECORD_SIZE); 76 memset(buf, '\0', RECORD_SIZE);
76 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); 77 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR);
77 buf += res; 78 buf += res;
@@ -79,8 +80,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
79 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); 80 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec);
80 buf += res; 81 buf += res;
81 82
82 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); 83 hdr_size = buf - buf_orig;
83 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); 84 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size));
85 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy);
84 86
85 s2_start = l2 - l2_cpy; 87 s2_start = l2 - l2_cpy;
86 s1_start = l1 - l1_cpy; 88 s1_start = l1 - l1_cpy;
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 05ad4a17a28f..2ec5f33cdbd0 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -354,12 +354,14 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip,
354 tpm_protected_ordinal_duration[ordinal & 354 tpm_protected_ordinal_duration[ordinal &
355 TPM_PROTECTED_ORDINAL_MASK]; 355 TPM_PROTECTED_ORDINAL_MASK];
356 356
357 if (duration_idx != TPM_UNDEFINED) 357 if (duration_idx != TPM_UNDEFINED) {
358 duration = chip->vendor.duration[duration_idx]; 358 duration = chip->vendor.duration[duration_idx];
359 if (duration <= 0) 359 /* if duration is 0, it's because chip->vendor.duration wasn't */
360 /* filled yet, so we set the lowest timeout just to give enough */
361 /* time for tpm_get_timeouts() to succeed */
362 return (duration <= 0 ? HZ : duration);
363 } else
360 return 2 * 60 * HZ; 364 return 2 * 60 * HZ;
361 else
362 return duration;
363} 365}
364EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); 366EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
365 367
@@ -565,9 +567,11 @@ duration:
565 if (rc) 567 if (rc)
566 return; 568 return;
567 569
568 if (be32_to_cpu(tpm_cmd.header.out.return_code) 570 if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
569 != 3 * sizeof(u32)) 571 be32_to_cpu(tpm_cmd.header.out.length)
572 != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32))
570 return; 573 return;
574
571 duration_cap = &tpm_cmd.params.getcap_out.cap.duration; 575 duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
572 chip->vendor.duration[TPM_SHORT] = 576 chip->vendor.duration[TPM_SHORT] =
573 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); 577 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short));
@@ -911,6 +915,18 @@ ssize_t tpm_show_caps_1_2(struct device * dev,
911} 915}
912EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); 916EXPORT_SYMBOL_GPL(tpm_show_caps_1_2);
913 917
918ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
919 char *buf)
920{
921 struct tpm_chip *chip = dev_get_drvdata(dev);
922
923 return sprintf(buf, "%d %d %d\n",
924 jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
925 jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
926 jiffies_to_usecs(chip->vendor.duration[TPM_LONG]));
927}
928EXPORT_SYMBOL_GPL(tpm_show_timeouts);
929
914ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, 930ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
915 const char *buf, size_t count) 931 const char *buf, size_t count)
916{ 932{
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 792868d24f2a..ba1779c2cffd 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -56,6 +56,8 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr,
56 char *); 56 char *);
57extern ssize_t tpm_show_temp_deactivated(struct device *, 57extern ssize_t tpm_show_temp_deactivated(struct device *,
58 struct device_attribute *attr, char *); 58 struct device_attribute *attr, char *);
59extern ssize_t tpm_show_timeouts(struct device *,
60 struct device_attribute *attr, char *);
59 61
60struct tpm_chip; 62struct tpm_chip;
61 63
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1030f8420137..3e1f2bbeec11 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/acpi.h>
28#include "tpm.h" 29#include "tpm.h"
29 30
30#define TPM_HEADER_SIZE 10 31#define TPM_HEADER_SIZE 10
@@ -78,6 +79,26 @@ enum tis_defaults {
78static LIST_HEAD(tis_chips); 79static LIST_HEAD(tis_chips);
79static DEFINE_SPINLOCK(tis_lock); 80static DEFINE_SPINLOCK(tis_lock);
80 81
82#ifdef CONFIG_ACPI
83static int is_itpm(struct pnp_dev *dev)
84{
85 struct acpi_device *acpi = pnp_acpi_device(dev);
86 struct acpi_hardware_id *id;
87
88 list_for_each_entry(id, &acpi->pnp.ids, list) {
89 if (!strcmp("INTC0102", id->id))
90 return 1;
91 }
92
93 return 0;
94}
95#else
96static int is_itpm(struct pnp_dev *dev)
97{
98 return 0;
99}
100#endif
101
81static int check_locality(struct tpm_chip *chip, int l) 102static int check_locality(struct tpm_chip *chip, int l)
82{ 103{
83 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & 104 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
@@ -355,6 +376,7 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
355 NULL); 376 NULL);
356static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); 377static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL);
357static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); 378static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
379static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
358 380
359static struct attribute *tis_attrs[] = { 381static struct attribute *tis_attrs[] = {
360 &dev_attr_pubek.attr, 382 &dev_attr_pubek.attr,
@@ -364,7 +386,8 @@ static struct attribute *tis_attrs[] = {
364 &dev_attr_owned.attr, 386 &dev_attr_owned.attr,
365 &dev_attr_temp_deactivated.attr, 387 &dev_attr_temp_deactivated.attr,
366 &dev_attr_caps.attr, 388 &dev_attr_caps.attr,
367 &dev_attr_cancel.attr, NULL, 389 &dev_attr_cancel.attr,
390 &dev_attr_timeouts.attr, NULL,
368}; 391};
369 392
370static struct attribute_group tis_attr_grp = { 393static struct attribute_group tis_attr_grp = {
@@ -472,6 +495,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
472 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 495 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
473 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 496 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
474 497
498 if (is_itpm(to_pnp_dev(dev)))
499 itpm = 1;
500
475 if (itpm) 501 if (itpm)
476 dev_info(dev, "Intel iTPM workaround enabled\n"); 502 dev_info(dev, "Intel iTPM workaround enabled\n");
477 503
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
index cc1e9850d655..d8210ca00720 100644
--- a/drivers/char/tty_buffer.c
+++ b/drivers/char/tty_buffer.c
@@ -413,7 +413,8 @@ static void flush_to_ldisc(struct work_struct *work)
413 spin_lock_irqsave(&tty->buf.lock, flags); 413 spin_lock_irqsave(&tty->buf.lock, flags);
414 414
415 if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { 415 if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
416 struct tty_buffer *head; 416 struct tty_buffer *head, *tail = tty->buf.tail;
417 int seen_tail = 0;
417 while ((head = tty->buf.head) != NULL) { 418 while ((head = tty->buf.head) != NULL) {
418 int count; 419 int count;
419 char *char_buf; 420 char *char_buf;
@@ -423,6 +424,15 @@ static void flush_to_ldisc(struct work_struct *work)
423 if (!count) { 424 if (!count) {
424 if (head->next == NULL) 425 if (head->next == NULL)
425 break; 426 break;
427 /*
428 There's a possibility tty might get new buffer
429 added during the unlock window below. We could
430 end up spinning in here forever hogging the CPU
431 completely. To avoid this let's have a rest each
432 time we processed the tail buffer.
433 */
434 if (tail == head)
435 seen_tail = 1;
426 tty->buf.head = head->next; 436 tty->buf.head = head->next;
427 tty_buffer_free(tty, head); 437 tty_buffer_free(tty, head);
428 continue; 438 continue;
@@ -432,7 +442,7 @@ static void flush_to_ldisc(struct work_struct *work)
432 line discipline as we want to empty the queue */ 442 line discipline as we want to empty the queue */
433 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) 443 if (test_bit(TTY_FLUSHPENDING, &tty->flags))
434 break; 444 break;
435 if (!tty->receive_room) { 445 if (!tty->receive_room || seen_tail) {
436 schedule_delayed_work(&tty->buf.work, 1); 446 schedule_delayed_work(&tty->buf.work, 1);
437 break; 447 break;
438 } 448 }
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 613c852ee0fe..e0f7f4b8c286 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -553,6 +553,9 @@ void __tty_hangup(struct tty_struct *tty)
553 553
554 tty_lock(); 554 tty_lock();
555 555
556 /* some functions below drop BTM, so we need this bit */
557 set_bit(TTY_HUPPING, &tty->flags);
558
556 /* inuse_filps is protected by the single tty lock, 559 /* inuse_filps is protected by the single tty lock,
557 this really needs to change if we want to flush the 560 this really needs to change if we want to flush the
558 workqueue with the lock held */ 561 workqueue with the lock held */
@@ -572,6 +575,10 @@ void __tty_hangup(struct tty_struct *tty)
572 } 575 }
573 spin_unlock(&tty_files_lock); 576 spin_unlock(&tty_files_lock);
574 577
578 /*
579 * it drops BTM and thus races with reopen
580 * we protect the race by TTY_HUPPING
581 */
575 tty_ldisc_hangup(tty); 582 tty_ldisc_hangup(tty);
576 583
577 read_lock(&tasklist_lock); 584 read_lock(&tasklist_lock);
@@ -609,7 +616,6 @@ void __tty_hangup(struct tty_struct *tty)
609 tty->session = NULL; 616 tty->session = NULL;
610 tty->pgrp = NULL; 617 tty->pgrp = NULL;
611 tty->ctrl_status = 0; 618 tty->ctrl_status = 0;
612 set_bit(TTY_HUPPED, &tty->flags);
613 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 619 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
614 620
615 /* Account for the p->signal references we killed */ 621 /* Account for the p->signal references we killed */
@@ -635,6 +641,7 @@ void __tty_hangup(struct tty_struct *tty)
635 * can't yet guarantee all that. 641 * can't yet guarantee all that.
636 */ 642 */
637 set_bit(TTY_HUPPED, &tty->flags); 643 set_bit(TTY_HUPPED, &tty->flags);
644 clear_bit(TTY_HUPPING, &tty->flags);
638 tty_ldisc_enable(tty); 645 tty_ldisc_enable(tty);
639 646
640 tty_unlock(); 647 tty_unlock();
@@ -1304,7 +1311,9 @@ static int tty_reopen(struct tty_struct *tty)
1304{ 1311{
1305 struct tty_driver *driver = tty->driver; 1312 struct tty_driver *driver = tty->driver;
1306 1313
1307 if (test_bit(TTY_CLOSING, &tty->flags)) 1314 if (test_bit(TTY_CLOSING, &tty->flags) ||
1315 test_bit(TTY_HUPPING, &tty->flags) ||
1316 test_bit(TTY_LDISC_CHANGING, &tty->flags))
1308 return -EIO; 1317 return -EIO;
1309 1318
1310 if (driver->type == TTY_DRIVER_TYPE_PTY && 1319 if (driver->type == TTY_DRIVER_TYPE_PTY &&
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 412f9775d19c..4214d58276f7 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -47,6 +47,7 @@
47 47
48static DEFINE_SPINLOCK(tty_ldisc_lock); 48static DEFINE_SPINLOCK(tty_ldisc_lock);
49static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); 49static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait);
50static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle);
50/* Line disc dispatch table */ 51/* Line disc dispatch table */
51static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; 52static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS];
52 53
@@ -83,6 +84,7 @@ static void put_ldisc(struct tty_ldisc *ld)
83 return; 84 return;
84 } 85 }
85 local_irq_restore(flags); 86 local_irq_restore(flags);
87 wake_up(&tty_ldisc_idle);
86} 88}
87 89
88/** 90/**
@@ -452,6 +454,8 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
452 /* BTM here locks versus a hangup event */ 454 /* BTM here locks versus a hangup event */
453 WARN_ON(!tty_locked()); 455 WARN_ON(!tty_locked());
454 ret = ld->ops->open(tty); 456 ret = ld->ops->open(tty);
457 if (ret)
458 clear_bit(TTY_LDISC_OPEN, &tty->flags);
455 return ret; 459 return ret;
456 } 460 }
457 return 0; 461 return 0;
@@ -531,6 +535,23 @@ static int tty_ldisc_halt(struct tty_struct *tty)
531} 535}
532 536
533/** 537/**
538 * tty_ldisc_wait_idle - wait for the ldisc to become idle
539 * @tty: tty to wait for
540 *
541 * Wait for the line discipline to become idle. The discipline must
542 * have been halted for this to guarantee it remains idle.
543 */
544static int tty_ldisc_wait_idle(struct tty_struct *tty)
545{
546 int ret;
547 ret = wait_event_interruptible_timeout(tty_ldisc_idle,
548 atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
549 if (ret < 0)
550 return ret;
551 return ret > 0 ? 0 : -EBUSY;
552}
553
554/**
534 * tty_set_ldisc - set line discipline 555 * tty_set_ldisc - set line discipline
535 * @tty: the terminal to set 556 * @tty: the terminal to set
536 * @ldisc: the line discipline 557 * @ldisc: the line discipline
@@ -634,8 +655,17 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
634 655
635 flush_scheduled_work(); 656 flush_scheduled_work();
636 657
658 retval = tty_ldisc_wait_idle(tty);
659
637 tty_lock(); 660 tty_lock();
638 mutex_lock(&tty->ldisc_mutex); 661 mutex_lock(&tty->ldisc_mutex);
662
663 /* handle wait idle failure locked */
664 if (retval) {
665 tty_ldisc_put(new_ldisc);
666 goto enable;
667 }
668
639 if (test_bit(TTY_HUPPED, &tty->flags)) { 669 if (test_bit(TTY_HUPPED, &tty->flags)) {
640 /* We were raced by the hangup method. It will have stomped 670 /* We were raced by the hangup method. It will have stomped
641 the ldisc data and closed the ldisc down */ 671 the ldisc data and closed the ldisc down */
@@ -669,6 +699,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
669 699
670 tty_ldisc_put(o_ldisc); 700 tty_ldisc_put(o_ldisc);
671 701
702enable:
672 /* 703 /*
673 * Allow ldisc referencing to occur again 704 * Allow ldisc referencing to occur again
674 */ 705 */
@@ -714,9 +745,12 @@ static void tty_reset_termios(struct tty_struct *tty)
714 * state closed 745 * state closed
715 */ 746 */
716 747
717static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) 748static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
718{ 749{
719 struct tty_ldisc *ld; 750 struct tty_ldisc *ld = tty_ldisc_get(ldisc);
751
752 if (IS_ERR(ld))
753 return -1;
720 754
721 tty_ldisc_close(tty, tty->ldisc); 755 tty_ldisc_close(tty, tty->ldisc);
722 tty_ldisc_put(tty->ldisc); 756 tty_ldisc_put(tty->ldisc);
@@ -724,10 +758,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
724 /* 758 /*
725 * Switch the line discipline back 759 * Switch the line discipline back
726 */ 760 */
727 ld = tty_ldisc_get(ldisc);
728 BUG_ON(IS_ERR(ld));
729 tty_ldisc_assign(tty, ld); 761 tty_ldisc_assign(tty, ld);
730 tty_set_termios_ldisc(tty, ldisc); 762 tty_set_termios_ldisc(tty, ldisc);
763
764 return 0;
731} 765}
732 766
733/** 767/**
@@ -802,13 +836,16 @@ void tty_ldisc_hangup(struct tty_struct *tty)
802 a FIXME */ 836 a FIXME */
803 if (tty->ldisc) { /* Not yet closed */ 837 if (tty->ldisc) { /* Not yet closed */
804 if (reset == 0) { 838 if (reset == 0) {
805 tty_ldisc_reinit(tty, tty->termios->c_line); 839
806 err = tty_ldisc_open(tty, tty->ldisc); 840 if (!tty_ldisc_reinit(tty, tty->termios->c_line))
841 err = tty_ldisc_open(tty, tty->ldisc);
842 else
843 err = 1;
807 } 844 }
808 /* If the re-open fails or we reset then go to N_TTY. The 845 /* If the re-open fails or we reset then go to N_TTY. The
809 N_TTY open cannot fail */ 846 N_TTY open cannot fail */
810 if (reset || err) { 847 if (reset || err) {
811 tty_ldisc_reinit(tty, N_TTY); 848 BUG_ON(tty_ldisc_reinit(tty, N_TTY));
812 WARN_ON(tty_ldisc_open(tty, tty->ldisc)); 849 WARN_ON(tty_ldisc_open(tty, tty->ldisc));
813 } 850 }
814 tty_ldisc_enable(tty); 851 tty_ldisc_enable(tty);
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 0f69c5ec0ecd..7dc855b074d3 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1314,6 +1314,17 @@ static void control_work_handler(struct work_struct *work)
1314 spin_unlock(&portdev->cvq_lock); 1314 spin_unlock(&portdev->cvq_lock);
1315} 1315}
1316 1316
1317static void out_intr(struct virtqueue *vq)
1318{
1319 struct port *port;
1320
1321 port = find_port_by_vq(vq->vdev->priv, vq);
1322 if (!port)
1323 return;
1324
1325 wake_up_interruptible(&port->waitqueue);
1326}
1327
1317static void in_intr(struct virtqueue *vq) 1328static void in_intr(struct virtqueue *vq)
1318{ 1329{
1319 struct port *port; 1330 struct port *port;
@@ -1430,7 +1441,7 @@ static int init_vqs(struct ports_device *portdev)
1430 */ 1441 */
1431 j = 0; 1442 j = 0;
1432 io_callbacks[j] = in_intr; 1443 io_callbacks[j] = in_intr;
1433 io_callbacks[j + 1] = NULL; 1444 io_callbacks[j + 1] = out_intr;
1434 io_names[j] = "input"; 1445 io_names[j] = "input";
1435 io_names[j + 1] = "output"; 1446 io_names[j + 1] = "output";
1436 j += 2; 1447 j += 2;
@@ -1444,7 +1455,7 @@ static int init_vqs(struct ports_device *portdev)
1444 for (i = 1; i < nr_ports; i++) { 1455 for (i = 1; i < nr_ports; i++) {
1445 j += 2; 1456 j += 2;
1446 io_callbacks[j] = in_intr; 1457 io_callbacks[j] = in_intr;
1447 io_callbacks[j + 1] = NULL; 1458 io_callbacks[j + 1] = out_intr;
1448 io_names[j] = "input"; 1459 io_names[j] = "input";
1449 io_names[j + 1] = "output"; 1460 io_names[j + 1] = "output";
1450 } 1461 }
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 38df8c19e74c..6b68a0fb4611 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -503,6 +503,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
503 struct kbd_struct * kbd; 503 struct kbd_struct * kbd;
504 unsigned int console; 504 unsigned int console;
505 unsigned char ucval; 505 unsigned char ucval;
506 unsigned int uival;
506 void __user *up = (void __user *)arg; 507 void __user *up = (void __user *)arg;
507 int i, perm; 508 int i, perm;
508 int ret = 0; 509 int ret = 0;
@@ -657,7 +658,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
657 break; 658 break;
658 659
659 case KDGETMODE: 660 case KDGETMODE:
660 ucval = vc->vc_mode; 661 uival = vc->vc_mode;
661 goto setint; 662 goto setint;
662 663
663 case KDMAPDISP: 664 case KDMAPDISP:
@@ -695,7 +696,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
695 break; 696 break;
696 697
697 case KDGKBMODE: 698 case KDGKBMODE:
698 ucval = ((kbd->kbdmode == VC_RAW) ? K_RAW : 699 uival = ((kbd->kbdmode == VC_RAW) ? K_RAW :
699 (kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW : 700 (kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW :
700 (kbd->kbdmode == VC_UNICODE) ? K_UNICODE : 701 (kbd->kbdmode == VC_UNICODE) ? K_UNICODE :
701 K_XLATE); 702 K_XLATE);
@@ -717,9 +718,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
717 break; 718 break;
718 719
719 case KDGKBMETA: 720 case KDGKBMETA:
720 ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); 721 uival = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT);
721 setint: 722 setint:
722 ret = put_user(ucval, (int __user *)arg); 723 ret = put_user(uival, (int __user *)arg);
723 break; 724 break;
724 725
725 case KDGETKEYCODE: 726 case KDGETKEYCODE:
@@ -949,7 +950,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
949 for (i = 0; i < MAX_NR_CONSOLES; ++i) 950 for (i = 0; i < MAX_NR_CONSOLES; ++i)
950 if (! VT_IS_IN_USE(i)) 951 if (! VT_IS_IN_USE(i))
951 break; 952 break;
952 ucval = i < MAX_NR_CONSOLES ? (i+1) : -1; 953 uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
953 goto setint; 954 goto setint;
954 955
955 /* 956 /*
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index a50710843378..97df791c74cb 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -154,6 +154,45 @@ void cpuidle_resume_and_unlock(void)
154 154
155EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock); 155EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);
156 156
157#ifdef CONFIG_ARCH_HAS_CPU_RELAX
158static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st)
159{
160 ktime_t t1, t2;
161 s64 diff;
162 int ret;
163
164 t1 = ktime_get();
165 local_irq_enable();
166 while (!need_resched())
167 cpu_relax();
168
169 t2 = ktime_get();
170 diff = ktime_to_us(ktime_sub(t2, t1));
171 if (diff > INT_MAX)
172 diff = INT_MAX;
173
174 ret = (int) diff;
175 return ret;
176}
177
178static void poll_idle_init(struct cpuidle_device *dev)
179{
180 struct cpuidle_state *state = &dev->states[0];
181
182 cpuidle_set_statedata(state, NULL);
183
184 snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
185 snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
186 state->exit_latency = 0;
187 state->target_residency = 0;
188 state->power_usage = -1;
189 state->flags = CPUIDLE_FLAG_POLL;
190 state->enter = poll_idle;
191}
192#else
193static void poll_idle_init(struct cpuidle_device *dev) {}
194#endif /* CONFIG_ARCH_HAS_CPU_RELAX */
195
157/** 196/**
158 * cpuidle_enable_device - enables idle PM for a CPU 197 * cpuidle_enable_device - enables idle PM for a CPU
159 * @dev: the CPU 198 * @dev: the CPU
@@ -178,6 +217,8 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
178 return ret; 217 return ret;
179 } 218 }
180 219
220 poll_idle_init(dev);
221
181 if ((ret = cpuidle_add_state_sysfs(dev))) 222 if ((ret = cpuidle_add_state_sysfs(dev)))
182 return ret; 223 return ret;
183 224
@@ -232,45 +273,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
232 273
233EXPORT_SYMBOL_GPL(cpuidle_disable_device); 274EXPORT_SYMBOL_GPL(cpuidle_disable_device);
234 275
235#ifdef CONFIG_ARCH_HAS_CPU_RELAX
236static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st)
237{
238 ktime_t t1, t2;
239 s64 diff;
240 int ret;
241
242 t1 = ktime_get();
243 local_irq_enable();
244 while (!need_resched())
245 cpu_relax();
246
247 t2 = ktime_get();
248 diff = ktime_to_us(ktime_sub(t2, t1));
249 if (diff > INT_MAX)
250 diff = INT_MAX;
251
252 ret = (int) diff;
253 return ret;
254}
255
256static void poll_idle_init(struct cpuidle_device *dev)
257{
258 struct cpuidle_state *state = &dev->states[0];
259
260 cpuidle_set_statedata(state, NULL);
261
262 snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
263 snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
264 state->exit_latency = 0;
265 state->target_residency = 0;
266 state->power_usage = -1;
267 state->flags = CPUIDLE_FLAG_POLL;
268 state->enter = poll_idle;
269}
270#else
271static void poll_idle_init(struct cpuidle_device *dev) {}
272#endif /* CONFIG_ARCH_HAS_CPU_RELAX */
273
274/** 276/**
275 * __cpuidle_register_device - internal register function called before register 277 * __cpuidle_register_device - internal register function called before register
276 * and enable routines 278 * and enable routines
@@ -291,8 +293,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
291 293
292 init_completion(&dev->kobj_unregister); 294 init_completion(&dev->kobj_unregister);
293 295
294 poll_idle_init(dev);
295
296 /* 296 /*
297 * cpuidle driver should set the dev->power_specified bit 297 * cpuidle driver should set the dev->power_specified bit
298 * before registering the device if the driver provides 298 * before registering the device if the driver provides
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 2e992bc8015b..8a515baa38f7 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -286,7 +286,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
286 if (initial) 286 if (initial)
287 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ 287 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
288 : "+S" (input), "+D" (output), "+a" (iv) 288 : "+S" (input), "+D" (output), "+a" (iv)
289 : "d" (control_word), "b" (key), "c" (count)); 289 : "d" (control_word), "b" (key), "c" (initial));
290 290
291 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ 291 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
292 : "+S" (input), "+D" (output), "+a" (iv) 292 : "+S" (input), "+D" (output), "+a" (iv)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 411d5bf50fc4..a25f5f61e0e0 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
449static void mv_xor_tasklet(unsigned long data) 449static void mv_xor_tasklet(unsigned long data)
450{ 450{
451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data; 451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data;
452 __mv_xor_slot_cleanup(chan); 452 mv_xor_slot_cleanup(chan);
453} 453}
454 454
455static struct mv_xor_desc_slot * 455static struct mv_xor_desc_slot *
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index e7d5d6b5dcf6..33780d856acb 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1572,7 +1572,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int dram_range,
1572 debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", 1572 debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n",
1573 hole_off, hole_valid, intlv_sel); 1573 hole_off, hole_valid, intlv_sel);
1574 1574
1575 if (intlv_en || 1575 if (intlv_en &&
1576 (intlv_sel != ((sys_addr >> 12) & intlv_en))) 1576 (intlv_sel != ((sys_addr >> 12) & intlv_en)))
1577 return -EINVAL; 1577 return -EINVAL;
1578 1578
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 6b21e25f7a84..6d2e34d0f52a 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -578,14 +578,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
578 return NULL; 578 return NULL;
579 } 579 }
580 580
581 /* marking MCI offline */
582 mci->op_state = OP_OFFLINE;
583
584 del_mc_from_global_list(mci); 581 del_mc_from_global_list(mci);
585 mutex_unlock(&mem_ctls_mutex); 582 mutex_unlock(&mem_ctls_mutex);
586 583
587 /* flush workq processes and remove sysfs */ 584 /* flush workq processes */
588 edac_mc_workq_teardown(mci); 585 edac_mc_workq_teardown(mci);
586
587 /* marking MCI offline */
588 mci->op_state = OP_OFFLINE;
589
590 /* remove from sysfs */
589 edac_remove_sysfs_mci_device(mci); 591 edac_remove_sysfs_mci_device(mci);
590 592
591 edac_printk(KERN_INFO, EDAC_MC, 593 edac_printk(KERN_INFO, EDAC_MC,
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index be0492398ef9..24ff35511e2b 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -75,6 +75,8 @@ static size_t config_rom_length = 1 + 4 + 1 + 1;
75#define BIB_IRMC ((1) << 31) 75#define BIB_IRMC ((1) << 31)
76#define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ 76#define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */
77 77
78#define CANON_OUI 0x000085
79
78static void generate_config_rom(struct fw_card *card, __be32 *config_rom) 80static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
79{ 81{
80 struct fw_descriptor *desc; 82 struct fw_descriptor *desc;
@@ -284,6 +286,7 @@ static void bm_work(struct work_struct *work)
284 bool root_device_is_running; 286 bool root_device_is_running;
285 bool root_device_is_cmc; 287 bool root_device_is_cmc;
286 bool irm_is_1394_1995_only; 288 bool irm_is_1394_1995_only;
289 bool keep_this_irm;
287 290
288 spin_lock_irq(&card->lock); 291 spin_lock_irq(&card->lock);
289 292
@@ -305,6 +308,10 @@ static void bm_work(struct work_struct *work)
305 irm_is_1394_1995_only = irm_device && irm_device->config_rom && 308 irm_is_1394_1995_only = irm_device && irm_device->config_rom &&
306 (irm_device->config_rom[2] & 0x000000f0) == 0; 309 (irm_device->config_rom[2] & 0x000000f0) == 0;
307 310
311 /* Canon MV5i works unreliably if it is not root node. */
312 keep_this_irm = irm_device && irm_device->config_rom &&
313 irm_device->config_rom[3] >> 8 == CANON_OUI;
314
308 root_id = root_node->node_id; 315 root_id = root_node->node_id;
309 irm_id = card->irm_node->node_id; 316 irm_id = card->irm_node->node_id;
310 local_id = card->local_node->node_id; 317 local_id = card->local_node->node_id;
@@ -333,7 +340,7 @@ static void bm_work(struct work_struct *work)
333 goto pick_me; 340 goto pick_me;
334 } 341 }
335 342
336 if (irm_is_1394_1995_only) { 343 if (irm_is_1394_1995_only && !keep_this_irm) {
337 new_root_id = local_id; 344 new_root_id = local_id;
338 fw_notify("%s, making local node (%02x) root.\n", 345 fw_notify("%s, making local node (%02x) root.\n",
339 "IRM is not 1394a compliant", new_root_id); 346 "IRM is not 1394a compliant", new_root_id);
@@ -382,7 +389,7 @@ static void bm_work(struct work_struct *work)
382 389
383 spin_lock_irq(&card->lock); 390 spin_lock_irq(&card->lock);
384 391
385 if (rcode != RCODE_COMPLETE) { 392 if (rcode != RCODE_COMPLETE && !keep_this_irm) {
386 /* 393 /*
387 * The lock request failed, maybe the IRM 394 * The lock request failed, maybe the IRM
388 * isn't really IRM capable after all. Let's 395 * isn't really IRM capable after all. Let's
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 9dcb17d51aee..a03cb6acaeda 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -242,6 +242,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
242 242
243static char ohci_driver_name[] = KBUILD_MODNAME; 243static char ohci_driver_name[] = KBUILD_MODNAME;
244 244
245#define PCI_DEVICE_ID_AGERE_FW643 0x5901
245#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 246#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380
246#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 247#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
247 248
@@ -253,18 +254,34 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
253 254
254/* In case of multiple matches in ohci_quirks[], only the first one is used. */ 255/* In case of multiple matches in ohci_quirks[], only the first one is used. */
255static const struct { 256static const struct {
256 unsigned short vendor, device, flags; 257 unsigned short vendor, device, revision, flags;
257} ohci_quirks[] = { 258} ohci_quirks[] = {
258 {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER | 259 {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID,
259 QUIRK_RESET_PACKET | 260 QUIRK_CYCLE_TIMER},
260 QUIRK_NO_1394A}, 261
261 {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET}, 262 {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID,
262 {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 263 QUIRK_BE_HEADERS},
263 {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, 264
264 {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 265 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
265 {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 266 QUIRK_NO_MSI},
266 {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 267
267 {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, 268 {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID,
269 QUIRK_NO_MSI},
270
271 {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID,
272 QUIRK_CYCLE_TIMER},
273
274 {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID,
275 QUIRK_CYCLE_TIMER},
276
277 {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID,
278 QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
279
280 {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID,
281 QUIRK_RESET_PACKET},
282
283 {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID,
284 QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
268}; 285};
269 286
270/* This overrides anything that was found in ohci_quirks[]. */ 287/* This overrides anything that was found in ohci_quirks[]. */
@@ -739,7 +756,7 @@ static void ar_context_tasklet(unsigned long data)
739 d = &ab->descriptor; 756 d = &ab->descriptor;
740 757
741 if (d->res_count == 0) { 758 if (d->res_count == 0) {
742 size_t size, rest, offset; 759 size_t size, size2, rest, pktsize, size3, offset;
743 dma_addr_t start_bus; 760 dma_addr_t start_bus;
744 void *start; 761 void *start;
745 762
@@ -750,25 +767,61 @@ static void ar_context_tasklet(unsigned long data)
750 */ 767 */
751 768
752 offset = offsetof(struct ar_buffer, data); 769 offset = offsetof(struct ar_buffer, data);
753 start = buffer = ab; 770 start = ab;
754 start_bus = le32_to_cpu(ab->descriptor.data_address) - offset; 771 start_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
772 buffer = ab->data;
755 773
756 ab = ab->next; 774 ab = ab->next;
757 d = &ab->descriptor; 775 d = &ab->descriptor;
758 size = buffer + PAGE_SIZE - ctx->pointer; 776 size = start + PAGE_SIZE - ctx->pointer;
777 /* valid buffer data in the next page */
759 rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count); 778 rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count);
779 /* what actually fits in this page */
780 size2 = min(rest, (size_t)PAGE_SIZE - offset - size);
760 memmove(buffer, ctx->pointer, size); 781 memmove(buffer, ctx->pointer, size);
761 memcpy(buffer + size, ab->data, rest); 782 memcpy(buffer + size, ab->data, size2);
762 ctx->current_buffer = ab; 783
763 ctx->pointer = (void *) ab->data + rest; 784 while (size > 0) {
764 end = buffer + size + rest; 785 void *next = handle_ar_packet(ctx, buffer);
786 pktsize = next - buffer;
787 if (pktsize >= size) {
788 /*
789 * We have handled all the data that was
790 * originally in this page, so we can now
791 * continue in the next page.
792 */
793 buffer = next;
794 break;
795 }
796 /* move the next packet to the start of the buffer */
797 memmove(buffer, next, size + size2 - pktsize);
798 size -= pktsize;
799 /* fill up this page again */
800 size3 = min(rest - size2,
801 (size_t)PAGE_SIZE - offset - size - size2);
802 memcpy(buffer + size + size2,
803 (void *) ab->data + size2, size3);
804 size2 += size3;
805 }
765 806
766 while (buffer < end) 807 if (rest > 0) {
767 buffer = handle_ar_packet(ctx, buffer); 808 /* handle the packets that are fully in the next page */
809 buffer = (void *) ab->data +
810 (buffer - (start + offset + size));
811 end = (void *) ab->data + rest;
812
813 while (buffer < end)
814 buffer = handle_ar_packet(ctx, buffer);
768 815
769 dma_free_coherent(ohci->card.device, PAGE_SIZE, 816 ctx->current_buffer = ab;
770 start, start_bus); 817 ctx->pointer = end;
771 ar_context_add_page(ctx); 818
819 dma_free_coherent(ohci->card.device, PAGE_SIZE,
820 start, start_bus);
821 ar_context_add_page(ctx);
822 } else {
823 ctx->pointer = start + PAGE_SIZE;
824 }
772 } else { 825 } else {
773 buffer = ctx->pointer; 826 buffer = ctx->pointer;
774 ctx->pointer = end = 827 ctx->pointer = end =
@@ -2885,9 +2938,11 @@ static int __devinit pci_probe(struct pci_dev *dev,
2885 } 2938 }
2886 2939
2887 for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) 2940 for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++)
2888 if (ohci_quirks[i].vendor == dev->vendor && 2941 if ((ohci_quirks[i].vendor == dev->vendor) &&
2889 (ohci_quirks[i].device == dev->device || 2942 (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID ||
2890 ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) { 2943 ohci_quirks[i].device == dev->device) &&
2944 (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID ||
2945 ohci_quirks[i].revision >= dev->revision)) {
2891 ohci->quirks = ohci_quirks[i].flags; 2946 ohci->quirks = ohci_quirks[i].flags;
2892 break; 2947 break;
2893 } 2948 }
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c
index e23c06893d19..d3e55a0ae92b 100644
--- a/drivers/gpio/cs5535-gpio.c
+++ b/drivers/gpio/cs5535-gpio.c
@@ -56,6 +56,29 @@ static struct cs5535_gpio_chip {
56 * registers, see include/linux/cs5535.h. 56 * registers, see include/linux/cs5535.h.
57 */ 57 */
58 58
59static void errata_outl(struct cs5535_gpio_chip *chip, u32 val,
60 unsigned int reg)
61{
62 unsigned long addr = chip->base + 0x80 + reg;
63
64 /*
65 * According to the CS5536 errata (#36), after suspend
66 * a write to the high bank GPIO register will clear all
67 * non-selected bits; the recommended workaround is a
68 * read-modify-write operation.
69 *
70 * Don't apply this errata to the edge status GPIOs, as writing
71 * to their lower bits will clear them.
72 */
73 if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) {
74 if (val & 0xffff)
75 val |= (inl(addr) & 0xffff); /* ignore the high bits */
76 else
77 val |= (inl(addr) ^ (val >> 16));
78 }
79 outl(val, addr);
80}
81
59static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, 82static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
60 unsigned int reg) 83 unsigned int reg)
61{ 84{
@@ -64,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
64 outl(1 << offset, chip->base + reg); 87 outl(1 << offset, chip->base + reg);
65 else 88 else
66 /* high bank register */ 89 /* high bank register */
67 outl(1 << (offset - 16), chip->base + 0x80 + reg); 90 errata_outl(chip, 1 << (offset - 16), reg);
68} 91}
69 92
70void cs5535_gpio_set(unsigned offset, unsigned int reg) 93void cs5535_gpio_set(unsigned offset, unsigned int reg)
@@ -86,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset,
86 outl(1 << (offset + 16), chip->base + reg); 109 outl(1 << (offset + 16), chip->base + reg);
87 else 110 else
88 /* high bank register */ 111 /* high bank register */
89 outl(1 << offset, chip->base + 0x80 + reg); 112 errata_outl(chip, 1 << offset, reg);
90} 113}
91 114
92void cs5535_gpio_clear(unsigned offset, unsigned int reg) 115void cs5535_gpio_clear(unsigned offset, unsigned int reg)
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c
index 2762698e0204..897e0577e65e 100644
--- a/drivers/gpio/rdc321x-gpio.c
+++ b/drivers/gpio/rdc321x-gpio.c
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev)
135 struct rdc321x_gpio *rdc321x_gpio_dev; 135 struct rdc321x_gpio *rdc321x_gpio_dev;
136 struct rdc321x_gpio_pdata *pdata; 136 struct rdc321x_gpio_pdata *pdata;
137 137
138 pdata = pdev->dev.platform_data; 138 pdata = platform_get_drvdata(pdev);
139 if (!pdata) { 139 if (!pdata) {
140 dev_err(&pdev->dev, "no platform data supplied\n"); 140 dev_err(&pdev->dev, "no platform data supplied\n");
141 return -ENODEV; 141 return -ENODEV;
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4cab0c6397e3..aa17594a674a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -97,7 +97,10 @@ config DRM_I830
97config DRM_I915 97config DRM_I915
98 tristate "i915 driver" 98 tristate "i915 driver"
99 depends on AGP_INTEL 99 depends on AGP_INTEL
100 # we need shmfs for the swappable backing store, and in particular
101 # the shmem_readpage() which depends upon tmpfs
100 select SHMEM 102 select SHMEM
103 select TMPFS
101 select DRM_KMS_HELPER 104 select DRM_KMS_HELPER
102 select FB_CFB_FILLRECT 105 select FB_CFB_FILLRECT
103 select FB_CFB_COPYAREA 106 select FB_CFB_COPYAREA
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 37e0b4fa482a..dfc635884619 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -156,12 +156,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] =
156 { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, 156 { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 },
157 { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, 157 { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 },
158 { DRM_MODE_CONNECTOR_Component, "Component", 0 }, 158 { DRM_MODE_CONNECTOR_Component, "Component", 0 },
159 { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, 159 { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 },
160 { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, 160 { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },
161 { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, 161 { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 },
162 { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, 162 { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 },
163 { DRM_MODE_CONNECTOR_TV, "TV", 0 }, 163 { DRM_MODE_CONNECTOR_TV, "TV", 0 },
164 { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, 164 { DRM_MODE_CONNECTOR_eDP, "eDP", 0 },
165}; 165};
166 166
167static struct drm_prop_enum_list drm_encoder_enum_list[] = 167static struct drm_prop_enum_list drm_encoder_enum_list[] =
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index dcbeb98f195a..ae9fb7a3afd6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -649,6 +649,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
649 old_fb)) { 649 old_fb)) {
650 DRM_ERROR("failed to set mode on [CRTC:%d]\n", 650 DRM_ERROR("failed to set mode on [CRTC:%d]\n",
651 set->crtc->base.id); 651 set->crtc->base.id);
652 set->crtc->fb = old_fb;
652 ret = -EINVAL; 653 ret = -EINVAL;
653 goto fail; 654 goto fail;
654 } 655 }
@@ -663,8 +664,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
663 set->crtc->fb = set->fb; 664 set->crtc->fb = set->fb;
664 ret = crtc_funcs->mode_set_base(set->crtc, 665 ret = crtc_funcs->mode_set_base(set->crtc,
665 set->x, set->y, old_fb); 666 set->x, set->y, old_fb);
666 if (ret != 0) 667 if (ret != 0) {
668 set->crtc->fb = old_fb;
667 goto fail; 669 goto fail;
670 }
668 } 671 }
669 672
670 kfree(save_connectors); 673 kfree(save_connectors);
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 2dd2c93ebfa3..e6fc48ea55a9 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -34,6 +34,7 @@
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_trace.h" 36#include "i915_trace.h"
37#include "../../../platform/x86/intel_ips.h"
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/vgaarb.h> 39#include <linux/vgaarb.h>
39#include <linux/acpi.h> 40#include <linux/acpi.h>
@@ -1418,9 +1419,15 @@ static int i915_load_modeset_init(struct drm_device *dev,
1418 if (ret) 1419 if (ret)
1419 DRM_INFO("failed to find VBIOS tables\n"); 1420 DRM_INFO("failed to find VBIOS tables\n");
1420 1421
1421 /* if we have > 1 VGA cards, then disable the radeon VGA resources */ 1422 /* If we have > 1 VGA cards, then we need to arbitrate access
1423 * to the common VGA resources.
1424 *
1425 * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA),
1426 * then we do not take part in VGA arbitration and the
1427 * vga_client_register() fails with -ENODEV.
1428 */
1422 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); 1429 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
1423 if (ret) 1430 if (ret && ret != -ENODEV)
1424 goto cleanup_ringbuffer; 1431 goto cleanup_ringbuffer;
1425 1432
1426 ret = vga_switcheroo_register_client(dev->pdev, 1433 ret = vga_switcheroo_register_client(dev->pdev,
@@ -2047,6 +2054,26 @@ out_unlock:
2047EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); 2054EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
2048 2055
2049/** 2056/**
2057 * Tells the intel_ips driver that the i915 driver is now loaded, if
2058 * IPS got loaded first.
2059 *
2060 * This awkward dance is so that neither module has to depend on the
2061 * other in order for IPS to do the appropriate communication of
2062 * GPU turbo limits to i915.
2063 */
2064static void
2065ips_ping_for_i915_load(void)
2066{
2067 void (*link)(void);
2068
2069 link = symbol_get(ips_link_to_i915_driver);
2070 if (link) {
2071 link();
2072 symbol_put(ips_link_to_i915_driver);
2073 }
2074}
2075
2076/**
2050 * i915_driver_load - setup chip and create an initial config 2077 * i915_driver_load - setup chip and create an initial config
2051 * @dev: DRM device 2078 * @dev: DRM device
2052 * @flags: startup flags 2079 * @flags: startup flags
@@ -2234,6 +2261,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2234 /* XXX Prevent module unload due to memory corruption bugs. */ 2261 /* XXX Prevent module unload due to memory corruption bugs. */
2235 __module_get(THIS_MODULE); 2262 __module_get(THIS_MODULE);
2236 2263
2264 ips_ping_for_i915_load();
2265
2237 return 0; 2266 return 0;
2238 2267
2239out_workqueue_free: 2268out_workqueue_free:
@@ -2306,6 +2335,9 @@ int i915_driver_unload(struct drm_device *dev)
2306 i915_gem_lastclose(dev); 2335 i915_gem_lastclose(dev);
2307 2336
2308 intel_cleanup_overlay(dev); 2337 intel_cleanup_overlay(dev);
2338
2339 if (!I915_NEED_GFX_HWS(dev))
2340 i915_free_hws(dev);
2309 } 2341 }
2310 2342
2311 intel_teardown_mchbar(dev); 2343 intel_teardown_mchbar(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6dbe14cc4f74..7792c8f7c6dd 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -53,7 +53,7 @@ extern int intel_agp_enabled;
53 53
54#define INTEL_VGA_DEVICE(id, info) { \ 54#define INTEL_VGA_DEVICE(id, info) { \
55 .class = PCI_CLASS_DISPLAY_VGA << 8, \ 55 .class = PCI_CLASS_DISPLAY_VGA << 8, \
56 .class_mask = 0xffff00, \ 56 .class_mask = 0xff0000, \
57 .vendor = 0x8086, \ 57 .vendor = 0x8086, \
58 .device = id, \ 58 .device = id, \
59 .subvendor = PCI_ANY_ID, \ 59 .subvendor = PCI_ANY_ID, \
@@ -414,6 +414,14 @@ int i965_reset(struct drm_device *dev, u8 flags)
414static int __devinit 414static int __devinit
415i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 415i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
416{ 416{
417 /* Only bind to function 0 of the device. Early generations
418 * used function 1 as a placeholder for multi-head. This causes
419 * us confusion instead, especially on the systems where both
420 * functions have the same PCI-ID!
421 */
422 if (PCI_FUNC(pdev->devfn))
423 return -ENODEV;
424
417 return drm_get_pci_dev(pdev, ent, &driver); 425 return drm_get_pci_dev(pdev, ent, &driver);
418} 426}
419 427
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 744225ebb4b2..477e4ac66639 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -310,6 +310,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
310 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 310 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
311 int ret = IRQ_NONE; 311 int ret = IRQ_NONE;
312 u32 de_iir, gt_iir, de_ier, pch_iir; 312 u32 de_iir, gt_iir, de_ier, pch_iir;
313 u32 hotplug_mask;
313 struct drm_i915_master_private *master_priv; 314 struct drm_i915_master_private *master_priv;
314 struct intel_ring_buffer *render_ring = &dev_priv->render_ring; 315 struct intel_ring_buffer *render_ring = &dev_priv->render_ring;
315 316
@@ -325,6 +326,11 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
325 if (de_iir == 0 && gt_iir == 0 && pch_iir == 0) 326 if (de_iir == 0 && gt_iir == 0 && pch_iir == 0)
326 goto done; 327 goto done;
327 328
329 if (HAS_PCH_CPT(dev))
330 hotplug_mask = SDE_HOTPLUG_MASK_CPT;
331 else
332 hotplug_mask = SDE_HOTPLUG_MASK;
333
328 ret = IRQ_HANDLED; 334 ret = IRQ_HANDLED;
329 335
330 if (dev->primary->master) { 336 if (dev->primary->master) {
@@ -366,10 +372,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
366 drm_handle_vblank(dev, 1); 372 drm_handle_vblank(dev, 1);
367 373
368 /* check event from PCH */ 374 /* check event from PCH */
369 if ((de_iir & DE_PCH_EVENT) && 375 if ((de_iir & DE_PCH_EVENT) && (pch_iir & hotplug_mask))
370 (pch_iir & SDE_HOTPLUG_MASK)) {
371 queue_work(dev_priv->wq, &dev_priv->hotplug_work); 376 queue_work(dev_priv->wq, &dev_priv->hotplug_work);
372 }
373 377
374 if (de_iir & DE_PCU_EVENT) { 378 if (de_iir & DE_PCU_EVENT) {
375 I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); 379 I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS));
@@ -1424,8 +1428,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1424 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | 1428 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
1425 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; 1429 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
1426 u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT; 1430 u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT;
1427 u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | 1431 u32 hotplug_mask;
1428 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1429 1432
1430 dev_priv->irq_mask_reg = ~display_mask; 1433 dev_priv->irq_mask_reg = ~display_mask;
1431 dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK; 1434 dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK;
@@ -1450,6 +1453,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1450 I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg); 1453 I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg);
1451 (void) I915_READ(GTIER); 1454 (void) I915_READ(GTIER);
1452 1455
1456 if (HAS_PCH_CPT(dev)) {
1457 hotplug_mask = SDE_CRT_HOTPLUG_CPT | SDE_PORTB_HOTPLUG_CPT |
1458 SDE_PORTC_HOTPLUG_CPT | SDE_PORTD_HOTPLUG_CPT ;
1459 } else {
1460 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
1461 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1462 }
1463
1453 dev_priv->pch_irq_mask_reg = ~hotplug_mask; 1464 dev_priv->pch_irq_mask_reg = ~hotplug_mask;
1454 dev_priv->pch_irq_enable_reg = hotplug_mask; 1465 dev_priv->pch_irq_enable_reg = hotplug_mask;
1455 1466
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 4f5e15577e89..7103d24c8213 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2551,6 +2551,10 @@
2551#define SDE_PORTD_HOTPLUG_CPT (1 << 23) 2551#define SDE_PORTD_HOTPLUG_CPT (1 << 23)
2552#define SDE_PORTC_HOTPLUG_CPT (1 << 22) 2552#define SDE_PORTC_HOTPLUG_CPT (1 << 22)
2553#define SDE_PORTB_HOTPLUG_CPT (1 << 21) 2553#define SDE_PORTB_HOTPLUG_CPT (1 << 21)
2554#define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \
2555 SDE_PORTD_HOTPLUG_CPT | \
2556 SDE_PORTC_HOTPLUG_CPT | \
2557 SDE_PORTB_HOTPLUG_CPT)
2554 2558
2555#define SDEISR 0xc4000 2559#define SDEISR 0xc4000
2556#define SDEIMR 0xc4004 2560#define SDEIMR 0xc4004
@@ -2722,6 +2726,9 @@
2722#define FDI_RXB_CHICKEN 0xc2010 2726#define FDI_RXB_CHICKEN 0xc2010
2723#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) 2727#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
2724 2728
2729#define SOUTH_DSPCLK_GATE_D 0xc2020
2730#define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29)
2731
2725/* CPU: FDI_TX */ 2732/* CPU: FDI_TX */
2726#define FDI_TXA_CTL 0x60100 2733#define FDI_TXA_CTL 0x60100
2727#define FDI_TXB_CTL 0x61100 2734#define FDI_TXB_CTL 0x61100
@@ -2946,6 +2953,7 @@
2946#define TRANS_DP_10BPC (1<<9) 2953#define TRANS_DP_10BPC (1<<9)
2947#define TRANS_DP_6BPC (2<<9) 2954#define TRANS_DP_6BPC (2<<9)
2948#define TRANS_DP_12BPC (3<<9) 2955#define TRANS_DP_12BPC (3<<9)
2956#define TRANS_DP_BPC_MASK (3<<9)
2949#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) 2957#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
2950#define TRANS_DP_VSYNC_ACTIVE_LOW 0 2958#define TRANS_DP_VSYNC_ACTIVE_LOW 0
2951#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) 2959#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
@@ -2959,10 +2967,11 @@
2959#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) 2967#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
2960#define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) 2968#define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
2961/* SNB B-stepping */ 2969/* SNB B-stepping */
2962#define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22) 2970#define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22)
2963#define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22) 2971#define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22)
2964#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22) 2972#define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22)
2965#define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22) 2973#define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22)
2974#define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22)
2966#define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) 2975#define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
2967 2976
2968#endif /* _I915_REG_H_ */ 2977#endif /* _I915_REG_H_ */
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 31f08581e93a..2df5b9aadd5b 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -862,8 +862,10 @@ int i915_restore_state(struct drm_device *dev)
862 /* Clock gating state */ 862 /* Clock gating state */
863 intel_init_clock_gating(dev); 863 intel_init_clock_gating(dev);
864 864
865 if (HAS_PCH_SPLIT(dev)) 865 if (HAS_PCH_SPLIT(dev)) {
866 ironlake_enable_drps(dev); 866 ironlake_enable_drps(dev);
867 intel_init_emon(dev);
868 }
867 869
868 /* Cache mode state */ 870 /* Cache mode state */
869 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); 871 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000);
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 197d4f32585a..0f950e74db3c 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -191,7 +191,8 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
191 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); 191 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
192 192
193 if (turn_off_dac) { 193 if (turn_off_dac) {
194 I915_WRITE(PCH_ADPA, temp); 194 /* Make sure hotplug is enabled */
195 I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE);
195 (void)I915_READ(PCH_ADPA); 196 (void)I915_READ(PCH_ADPA);
196 } 197 }
197 198
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 979228594599..932a061f28d0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2044,9 +2044,11 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
2044 2044
2045 reg = I915_READ(trans_dp_ctl); 2045 reg = I915_READ(trans_dp_ctl);
2046 reg &= ~(TRANS_DP_PORT_SEL_MASK | 2046 reg &= ~(TRANS_DP_PORT_SEL_MASK |
2047 TRANS_DP_SYNC_MASK); 2047 TRANS_DP_SYNC_MASK |
2048 TRANS_DP_BPC_MASK);
2048 reg |= (TRANS_DP_OUTPUT_ENABLE | 2049 reg |= (TRANS_DP_OUTPUT_ENABLE |
2049 TRANS_DP_ENH_FRAMING); 2050 TRANS_DP_ENH_FRAMING);
2051 reg |= TRANS_DP_8BPC;
2050 2052
2051 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) 2053 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
2052 reg |= TRANS_DP_HSYNC_ACTIVE_HIGH; 2054 reg |= TRANS_DP_HSYNC_ACTIVE_HIGH;
@@ -5674,6 +5676,13 @@ void intel_init_clock_gating(struct drm_device *dev)
5674 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); 5676 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate);
5675 5677
5676 /* 5678 /*
5679 * On Ibex Peak and Cougar Point, we need to disable clock
5680 * gating for the panel power sequencer or it will fail to
5681 * start up when no ports are active.
5682 */
5683 I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE);
5684
5685 /*
5677 * According to the spec the following bits should be set in 5686 * According to the spec the following bits should be set in
5678 * order to enable memory self-refresh 5687 * order to enable memory self-refresh
5679 * The bit 22/21 of 0x42004 5688 * The bit 22/21 of 0x42004
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 9ab8708ac6ba..0aa77f318790 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -425,6 +425,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
425 uint16_t address = algo_data->address; 425 uint16_t address = algo_data->address;
426 uint8_t msg[5]; 426 uint8_t msg[5];
427 uint8_t reply[2]; 427 uint8_t reply[2];
428 unsigned retry;
428 int msg_bytes; 429 int msg_bytes;
429 int reply_bytes; 430 int reply_bytes;
430 int ret; 431 int ret;
@@ -459,14 +460,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
459 break; 460 break;
460 } 461 }
461 462
462 for (;;) { 463 for (retry = 0; retry < 5; retry++) {
463 ret = intel_dp_aux_ch(intel_dp, 464 ret = intel_dp_aux_ch(intel_dp,
464 msg, msg_bytes, 465 msg, msg_bytes,
465 reply, reply_bytes); 466 reply, reply_bytes);
466 if (ret < 0) { 467 if (ret < 0) {
467 DRM_DEBUG_KMS("aux_ch failed %d\n", ret); 468 DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
468 return ret; 469 return ret;
469 } 470 }
471
472 switch (reply[0] & AUX_NATIVE_REPLY_MASK) {
473 case AUX_NATIVE_REPLY_ACK:
474 /* I2C-over-AUX Reply field is only valid
475 * when paired with AUX ACK.
476 */
477 break;
478 case AUX_NATIVE_REPLY_NACK:
479 DRM_DEBUG_KMS("aux_ch native nack\n");
480 return -EREMOTEIO;
481 case AUX_NATIVE_REPLY_DEFER:
482 udelay(100);
483 continue;
484 default:
485 DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
486 reply[0]);
487 return -EREMOTEIO;
488 }
489
470 switch (reply[0] & AUX_I2C_REPLY_MASK) { 490 switch (reply[0] & AUX_I2C_REPLY_MASK) {
471 case AUX_I2C_REPLY_ACK: 491 case AUX_I2C_REPLY_ACK:
472 if (mode == MODE_I2C_READ) { 492 if (mode == MODE_I2C_READ) {
@@ -474,17 +494,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
474 } 494 }
475 return reply_bytes - 1; 495 return reply_bytes - 1;
476 case AUX_I2C_REPLY_NACK: 496 case AUX_I2C_REPLY_NACK:
477 DRM_DEBUG_KMS("aux_ch nack\n"); 497 DRM_DEBUG_KMS("aux_i2c nack\n");
478 return -EREMOTEIO; 498 return -EREMOTEIO;
479 case AUX_I2C_REPLY_DEFER: 499 case AUX_I2C_REPLY_DEFER:
480 DRM_DEBUG_KMS("aux_ch defer\n"); 500 DRM_DEBUG_KMS("aux_i2c defer\n");
481 udelay(100); 501 udelay(100);
482 break; 502 break;
483 default: 503 default:
484 DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); 504 DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
485 return -EREMOTEIO; 505 return -EREMOTEIO;
486 } 506 }
487 } 507 }
508
509 DRM_ERROR("too many retries, giving up\n");
510 return -EREMOTEIO;
488} 511}
489 512
490static int 513static int
@@ -1070,18 +1093,27 @@ intel_dp_signal_levels(uint8_t train_set, int lane_count)
1070static uint32_t 1093static uint32_t
1071intel_gen6_edp_signal_levels(uint8_t train_set) 1094intel_gen6_edp_signal_levels(uint8_t train_set)
1072{ 1095{
1073 switch (train_set & (DP_TRAIN_VOLTAGE_SWING_MASK|DP_TRAIN_PRE_EMPHASIS_MASK)) { 1096 int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK |
1097 DP_TRAIN_PRE_EMPHASIS_MASK);
1098 switch (signal_levels) {
1074 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: 1099 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0:
1075 return EDP_LINK_TRAIN_400MV_0DB_SNB_B; 1100 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0:
1101 return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
1102 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5:
1103 return EDP_LINK_TRAIN_400MV_3_5DB_SNB_B;
1076 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: 1104 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6:
1077 return EDP_LINK_TRAIN_400MV_6DB_SNB_B; 1105 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6:
1106 return EDP_LINK_TRAIN_400_600MV_6DB_SNB_B;
1078 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: 1107 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5:
1079 return EDP_LINK_TRAIN_600MV_3_5DB_SNB_B; 1108 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5:
1109 return EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B;
1080 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: 1110 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0:
1081 return EDP_LINK_TRAIN_800MV_0DB_SNB_B; 1111 case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0:
1112 return EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B;
1082 default: 1113 default:
1083 DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level\n"); 1114 DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:"
1084 return EDP_LINK_TRAIN_400MV_0DB_SNB_B; 1115 "0x%x\n", signal_levels);
1116 return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
1085 } 1117 }
1086} 1118}
1087 1119
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8828b3ac6414..2b161375a38d 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -250,6 +250,7 @@ extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
250extern void intel_init_clock_gating(struct drm_device *dev); 250extern void intel_init_clock_gating(struct drm_device *dev);
251extern void ironlake_enable_drps(struct drm_device *dev); 251extern void ironlake_enable_drps(struct drm_device *dev);
252extern void ironlake_disable_drps(struct drm_device *dev); 252extern void ironlake_disable_drps(struct drm_device *dev);
253extern void intel_init_emon(struct drm_device *dev);
253 254
254extern int intel_pin_and_fence_fb_obj(struct drm_device *dev, 255extern int intel_pin_and_fence_fb_obj(struct drm_device *dev,
255 struct drm_gem_object *obj); 256 struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 6ec39a86ed06..c3b2208508fb 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -701,6 +701,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
701 }, 701 },
702 { 702 {
703 .callback = intel_no_lvds_dmi_callback, 703 .callback = intel_no_lvds_dmi_callback,
704 .ident = "AOpen i915GMm-HFS",
705 .matches = {
706 DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
707 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
708 },
709 },
710 {
711 .callback = intel_no_lvds_dmi_callback,
704 .ident = "Aopen i945GTt-VFA", 712 .ident = "Aopen i945GTt-VFA",
705 .matches = { 713 .matches = {
706 DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), 714 DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 1d306a458be6..743664187fef 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1367,6 +1367,12 @@ void intel_setup_overlay(struct drm_device *dev)
1367 goto out_free_bo; 1367 goto out_free_bo;
1368 } 1368 }
1369 overlay->flip_addr = overlay->reg_bo->gtt_offset; 1369 overlay->flip_addr = overlay->reg_bo->gtt_offset;
1370
1371 ret = i915_gem_object_set_to_gtt_domain(reg_bo, true);
1372 if (ret) {
1373 DRM_ERROR("failed to move overlay register bo into the GTT\n");
1374 goto out_unpin_bo;
1375 }
1370 } else { 1376 } else {
1371 ret = i915_gem_attach_phys_object(dev, reg_bo, 1377 ret = i915_gem_attach_phys_object(dev, reg_bo,
1372 I915_GEM_PHYS_OVERLAY_REGS, 1378 I915_GEM_PHYS_OVERLAY_REGS,
@@ -1399,6 +1405,8 @@ void intel_setup_overlay(struct drm_device *dev)
1399 DRM_INFO("initialized overlay support\n"); 1405 DRM_INFO("initialized overlay support\n");
1400 return; 1406 return;
1401 1407
1408out_unpin_bo:
1409 i915_gem_object_unpin(reg_bo);
1402out_free_bo: 1410out_free_bo:
1403 drm_gem_object_unreference(reg_bo); 1411 drm_gem_object_unreference(reg_bo);
1404out_free: 1412out_free:
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ee73e428a84a..b60652bfd1a3 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1498,10 +1498,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
1498 if (!intel_sdvo_write_cmd(intel_sdvo, 1498 if (!intel_sdvo_write_cmd(intel_sdvo,
1499 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) 1499 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0))
1500 return connector_status_unknown; 1500 return connector_status_unknown;
1501 if (intel_sdvo->is_tv) { 1501
1502 /* add 30ms delay when the output type is SDVO-TV */ 1502 /* add 30ms delay when the output type might be TV */
1503 if (intel_sdvo->caps.output_flags &
1504 (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_CVBS0))
1503 mdelay(30); 1505 mdelay(30);
1504 } 1506
1505 if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) 1507 if (!intel_sdvo_read_response(intel_sdvo, &response, 2))
1506 return connector_status_unknown; 1508 return connector_status_unknown;
1507 1509
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index b1be617373b6..c926d8891a46 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -531,6 +531,12 @@ struct drm_nouveau_private {
531 struct work_struct irq_work; 531 struct work_struct irq_work;
532 struct work_struct hpd_work; 532 struct work_struct hpd_work;
533 533
534 struct {
535 spinlock_t lock;
536 uint32_t hpd0_bits;
537 uint32_t hpd1_bits;
538 } hpd_state;
539
534 struct list_head vbl_waiting; 540 struct list_head vbl_waiting;
535 541
536 struct { 542 struct {
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 794b0ee30cf6..b62a601737a4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -52,6 +52,7 @@ nouveau_irq_preinstall(struct drm_device *dev)
52 if (dev_priv->card_type >= NV_50) { 52 if (dev_priv->card_type >= NV_50) {
53 INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); 53 INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
54 INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); 54 INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
55 spin_lock_init(&dev_priv->hpd_state.lock);
55 INIT_LIST_HEAD(&dev_priv->vbl_waiting); 56 INIT_LIST_HEAD(&dev_priv->vbl_waiting);
56 } 57 }
57} 58}
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 612fa6d6a0cb..d967cb65d641 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1012,11 +1012,18 @@ nv50_display_irq_hotplug_bh(struct work_struct *work)
1012 struct drm_connector *connector; 1012 struct drm_connector *connector;
1013 const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; 1013 const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 };
1014 uint32_t unplug_mask, plug_mask, change_mask; 1014 uint32_t unplug_mask, plug_mask, change_mask;
1015 uint32_t hpd0, hpd1 = 0; 1015 uint32_t hpd0, hpd1;
1016 1016
1017 hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); 1017 spin_lock_irq(&dev_priv->hpd_state.lock);
1018 hpd0 = dev_priv->hpd_state.hpd0_bits;
1019 dev_priv->hpd_state.hpd0_bits = 0;
1020 hpd1 = dev_priv->hpd_state.hpd1_bits;
1021 dev_priv->hpd_state.hpd1_bits = 0;
1022 spin_unlock_irq(&dev_priv->hpd_state.lock);
1023
1024 hpd0 &= nv_rd32(dev, 0xe050);
1018 if (dev_priv->chipset >= 0x90) 1025 if (dev_priv->chipset >= 0x90)
1019 hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); 1026 hpd1 &= nv_rd32(dev, 0xe070);
1020 1027
1021 plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); 1028 plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16);
1022 unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); 1029 unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000);
@@ -1058,10 +1065,6 @@ nv50_display_irq_hotplug_bh(struct work_struct *work)
1058 helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); 1065 helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF);
1059 } 1066 }
1060 1067
1061 nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054));
1062 if (dev_priv->chipset >= 0x90)
1063 nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074));
1064
1065 drm_helper_hpd_irq_event(dev); 1068 drm_helper_hpd_irq_event(dev);
1066} 1069}
1067 1070
@@ -1072,8 +1075,22 @@ nv50_display_irq_handler(struct drm_device *dev)
1072 uint32_t delayed = 0; 1075 uint32_t delayed = 0;
1073 1076
1074 if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { 1077 if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) {
1075 if (!work_pending(&dev_priv->hpd_work)) 1078 uint32_t hpd0_bits, hpd1_bits = 0;
1076 queue_work(dev_priv->wq, &dev_priv->hpd_work); 1079
1080 hpd0_bits = nv_rd32(dev, 0xe054);
1081 nv_wr32(dev, 0xe054, hpd0_bits);
1082
1083 if (dev_priv->chipset >= 0x90) {
1084 hpd1_bits = nv_rd32(dev, 0xe074);
1085 nv_wr32(dev, 0xe074, hpd1_bits);
1086 }
1087
1088 spin_lock(&dev_priv->hpd_state.lock);
1089 dev_priv->hpd_state.hpd0_bits |= hpd0_bits;
1090 dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
1091 spin_unlock(&dev_priv->hpd_state.lock);
1092
1093 queue_work(dev_priv->wq, &dev_priv->hpd_work);
1077 } 1094 }
1078 1095
1079 while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { 1096 while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 8e421f644a54..05efb5b9f13e 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
112 base += 3; 112 base += 3;
113 break; 113 break;
114 case ATOM_IIO_WRITE: 114 case ATOM_IIO_WRITE:
115 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
115 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); 116 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
116 base += 3; 117 base += 3;
117 break; 118 break;
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index cd0290f946cf..e226f47b497c 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
253 case DRM_MODE_DPMS_SUSPEND: 253 case DRM_MODE_DPMS_SUSPEND:
254 case DRM_MODE_DPMS_OFF: 254 case DRM_MODE_DPMS_OFF:
255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); 255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
256 atombios_blank_crtc(crtc, ATOM_ENABLE); 256 if (radeon_crtc->enabled)
257 atombios_blank_crtc(crtc, ATOM_ENABLE);
257 if (ASIC_IS_DCE3(rdev)) 258 if (ASIC_IS_DCE3(rdev))
258 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); 259 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
259 atombios_enable_crtc(crtc, ATOM_DISABLE); 260 atombios_enable_crtc(crtc, ATOM_DISABLE);
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 4e7778d44b8d..695de9a38506 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) 187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
188{ 188{
189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); 189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock);
190 int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); 190 int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock);
191 191
192 if ((lanes == 0) || (bw == 0)) 192 if ((lanes == 0) || (dp_clock == 0))
193 return MODE_CLOCK_HIGH; 193 return MODE_CLOCK_HIGH;
194 194
195 return MODE_OK; 195 return MODE_OK;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 2f93d46ae69a..9e3dd2fd2766 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1423,7 +1423,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev)
1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1424{ 1424{
1425 struct evergreen_mc_save save; 1425 struct evergreen_mc_save save;
1426 u32 srbm_reset = 0;
1427 u32 grbm_reset = 0; 1426 u32 grbm_reset = 0;
1428 1427
1429 dev_info(rdev->dev, "GPU softreset \n"); 1428 dev_info(rdev->dev, "GPU softreset \n");
@@ -1462,16 +1461,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1462 udelay(50); 1461 udelay(50);
1463 WREG32(GRBM_SOFT_RESET, 0); 1462 WREG32(GRBM_SOFT_RESET, 0);
1464 (void)RREG32(GRBM_SOFT_RESET); 1463 (void)RREG32(GRBM_SOFT_RESET);
1465
1466 /* reset all the system blocks */
1467 srbm_reset = SRBM_SOFT_RESET_ALL_MASK;
1468
1469 dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset);
1470 WREG32(SRBM_SOFT_RESET, srbm_reset);
1471 (void)RREG32(SRBM_SOFT_RESET);
1472 udelay(50);
1473 WREG32(SRBM_SOFT_RESET, 0);
1474 (void)RREG32(SRBM_SOFT_RESET);
1475 /* Wait a little for things to settle down */ 1464 /* Wait a little for things to settle down */
1476 udelay(50); 1465 udelay(50);
1477 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1466 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
@@ -1482,10 +1471,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1482 RREG32(GRBM_STATUS_SE1)); 1471 RREG32(GRBM_STATUS_SE1));
1483 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1472 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
1484 RREG32(SRBM_STATUS)); 1473 RREG32(SRBM_STATUS));
1485 /* After reset we need to reinit the asic as GPU often endup in an
1486 * incoherent state.
1487 */
1488 atom_asic_init(rdev->mode_info.atom_context);
1489 evergreen_mc_resume(rdev, &save); 1474 evergreen_mc_resume(rdev, &save);
1490 return 0; 1475 return 0;
1491} 1476}
@@ -2097,6 +2082,11 @@ int evergreen_resume(struct radeon_device *rdev)
2097{ 2082{
2098 int r; 2083 int r;
2099 2084
2085 /* reset the asic, the gfx blocks are often in a bad state
2086 * after the driver is unloaded or after a resume
2087 */
2088 if (radeon_asic_reset(rdev))
2089 dev_warn(rdev->dev, "GPU reset failed !\n");
2100 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 2090 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
2101 * posting will perform necessary task to bring back GPU into good 2091 * posting will perform necessary task to bring back GPU into good
2102 * shape. 2092 * shape.
@@ -2193,6 +2183,11 @@ int evergreen_init(struct radeon_device *rdev)
2193 r = radeon_atombios_init(rdev); 2183 r = radeon_atombios_init(rdev);
2194 if (r) 2184 if (r)
2195 return r; 2185 return r;
2186 /* reset the asic, the gfx blocks are often in a bad state
2187 * after the driver is unloaded or after a resume
2188 */
2189 if (radeon_asic_reset(rdev))
2190 dev_warn(rdev->dev, "GPU reset failed !\n");
2196 /* Post card if necessary */ 2191 /* Post card if necessary */
2197 if (!evergreen_card_posted(rdev)) { 2192 if (!evergreen_card_posted(rdev)) {
2198 if (!rdev->bios) { 2193 if (!rdev->bios) {
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e59422320bb6..0ba4163ee0a4 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2318,6 +2318,9 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - 2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
2319 * Novell bug 204882 + along with lots of ubuntu ones 2319 * Novell bug 204882 + along with lots of ubuntu ones
2320 */ 2320 */
2321 if (rdev->mc.aper_size > config_aper_size)
2322 config_aper_size = rdev->mc.aper_size;
2323
2321 if (config_aper_size > rdev->mc.real_vram_size) 2324 if (config_aper_size > rdev->mc.real_vram_size)
2322 rdev->mc.mc_vram_size = config_aper_size; 2325 rdev->mc.mc_vram_size = config_aper_size;
2323 else 2326 else
@@ -3225,6 +3228,8 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
3225 for (u = 0; u < track->num_texture; u++) { 3228 for (u = 0; u < track->num_texture; u++) {
3226 if (!track->textures[u].enabled) 3229 if (!track->textures[u].enabled)
3227 continue; 3230 continue;
3231 if (track->textures[u].lookup_disable)
3232 continue;
3228 robj = track->textures[u].robj; 3233 robj = track->textures[u].robj;
3229 if (robj == NULL) { 3234 if (robj == NULL) {
3230 DRM_ERROR("No texture bound to unit %u\n", u); 3235 DRM_ERROR("No texture bound to unit %u\n", u);
@@ -3459,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track
3459 track->textures[i].robj = NULL; 3464 track->textures[i].robj = NULL;
3460 /* CS IB emission code makes sure texture unit are disabled */ 3465 /* CS IB emission code makes sure texture unit are disabled */
3461 track->textures[i].enabled = false; 3466 track->textures[i].enabled = false;
3467 track->textures[i].lookup_disable = false;
3462 track->textures[i].roundup_w = true; 3468 track->textures[i].roundup_w = true;
3463 track->textures[i].roundup_h = true; 3469 track->textures[i].roundup_h = true;
3464 if (track->separate_cube) 3470 if (track->separate_cube)
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index f47cdca1c004..af65600e6564 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -46,6 +46,7 @@ struct r100_cs_track_texture {
46 unsigned height_11; 46 unsigned height_11;
47 bool use_pitch; 47 bool use_pitch;
48 bool enabled; 48 bool enabled;
49 bool lookup_disable;
49 bool roundup_w; 50 bool roundup_w;
50 bool roundup_h; 51 bool roundup_h;
51 unsigned compress_format; 52 unsigned compress_format;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 0266d72e0a4c..d2408c395619 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_parser *p,
447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); 447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK);
448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); 448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK);
449 } 449 }
450 if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE)
451 track->textures[i].lookup_disable = true;
450 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { 452 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) {
451 case R200_TXFORMAT_I8: 453 case R200_TXFORMAT_I8:
452 case R200_TXFORMAT_RGB332: 454 case R200_TXFORMAT_RGB332:
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7b65e4efe8af..74b9fb7a71df 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device *rdev)
97{ 97{
98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> 98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >>
99 ASIC_T_SHIFT; 99 ASIC_T_SHIFT;
100 u32 actual_temp = 0;
101 100
102 if ((temp >> 7) & 1) 101 return temp * 1000;
103 actual_temp = 0;
104 else
105 actual_temp = (temp >> 1) & 0xff;
106
107 return actual_temp * 1000;
108} 102}
109 103
110void r600_pm_get_dynpm_state(struct radeon_device *rdev) 104void r600_pm_get_dynpm_state(struct radeon_device *rdev)
@@ -884,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev)
884 u32 tmp; 878 u32 tmp;
885 879
886 /* flush hdp cache so updates hit vram */ 880 /* flush hdp cache so updates hit vram */
887 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { 881 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
882 !(rdev->flags & RADEON_IS_AGP)) {
888 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; 883 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr;
889 u32 tmp; 884 u32 tmp;
890 885
891 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 886 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
892 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 887 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
888 * This seems to cause problems on some AGP cards. Just use the old
889 * method for them.
893 */ 890 */
894 WREG32(HDP_DEBUG1, 0); 891 WREG32(HDP_DEBUG1, 0);
895 tmp = readl((void __iomem *)ptr); 892 tmp = readl((void __iomem *)ptr);
@@ -1201,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1201 mc->vram_end, mc->real_vram_size >> 20); 1198 mc->vram_end, mc->real_vram_size >> 20);
1202 } else { 1199 } else {
1203 u64 base = 0; 1200 u64 base = 0;
1204 if (rdev->flags & RADEON_IS_IGP) 1201 if (rdev->flags & RADEON_IS_IGP) {
1205 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; 1202 base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF;
1203 base <<= 24;
1204 }
1206 radeon_vram_location(rdev, &rdev->mc, base); 1205 radeon_vram_location(rdev, &rdev->mc, base);
1207 rdev->mc.gtt_base_align = 0; 1206 rdev->mc.gtt_base_align = 0;
1208 radeon_gtt_location(rdev, mc); 1207 radeon_gtt_location(rdev, mc);
@@ -1608,8 +1607,11 @@ void r600_gpu_init(struct radeon_device *rdev)
1608 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; 1607 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes;
1609 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1608 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1610 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1609 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1611 tiling_config |= GROUP_SIZE(0); 1610 tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
1612 rdev->config.r600.tiling_group_size = 256; 1611 if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
1612 rdev->config.r600.tiling_group_size = 512;
1613 else
1614 rdev->config.r600.tiling_group_size = 256;
1613 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; 1615 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT;
1614 if (tmp > 3) { 1616 if (tmp > 3) {
1615 tiling_config |= ROW_TILING(3); 1617 tiling_config |= ROW_TILING(3);
@@ -3528,10 +3530,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
3528void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) 3530void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
3529{ 3531{
3530 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 3532 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
3531 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 3533 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL.
3534 * This seems to cause problems on some AGP cards. Just use the old
3535 * method for them.
3532 */ 3536 */
3533 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && 3537 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
3534 rdev->vram_scratch.ptr) { 3538 rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) {
3535 void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 3539 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
3536 u32 tmp; 3540 u32 tmp;
3537 3541
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 3473c00781ff..e5d4928fd2dc 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -650,8 +650,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
650 int src_x = src_gpu_addr & 255; 650 int src_x = src_gpu_addr & 255;
651 int dst_x = dst_gpu_addr & 255; 651 int dst_x = dst_gpu_addr & 255;
652 int h = 1; 652 int h = 1;
653 src_gpu_addr = src_gpu_addr & ~255; 653 src_gpu_addr = src_gpu_addr & ~255ULL;
654 dst_gpu_addr = dst_gpu_addr & ~255; 654 dst_gpu_addr = dst_gpu_addr & ~255ULL;
655 655
656 if (!src_x && !dst_x) { 656 if (!src_x && !dst_x) {
657 h = (cur_size / max_bytes); 657 h = (cur_size / max_bytes);
@@ -744,8 +744,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
744 int src_x = (src_gpu_addr & 255); 744 int src_x = (src_gpu_addr & 255);
745 int dst_x = (dst_gpu_addr & 255); 745 int dst_x = (dst_gpu_addr & 255);
746 int h = 1; 746 int h = 1;
747 src_gpu_addr = src_gpu_addr & ~255; 747 src_gpu_addr = src_gpu_addr & ~255ULL;
748 dst_gpu_addr = dst_gpu_addr & ~255; 748 dst_gpu_addr = dst_gpu_addr & ~255ULL;
749 749
750 if (!src_x && !dst_x) { 750 if (!src_x && !dst_x) {
751 h = (cur_size / max_bytes); 751 h = (cur_size / max_bytes);
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 250a3a918193..478fddf08f9a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -228,7 +228,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
228 __func__, __LINE__, pitch); 228 __func__, __LINE__, pitch);
229 return -EINVAL; 229 return -EINVAL;
230 } 230 }
231 if (!IS_ALIGNED((height / 8), track->nbanks)) { 231 if (!IS_ALIGNED((height / 8), track->npipes)) {
232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", 232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n",
233 __func__, __LINE__, height); 233 __func__, __LINE__, height);
234 return -EINVAL; 234 return -EINVAL;
@@ -367,7 +367,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
367 __func__, __LINE__, pitch); 367 __func__, __LINE__, pitch);
368 return -EINVAL; 368 return -EINVAL;
369 } 369 }
370 if ((height / 8) & (track->nbanks - 1)) { 370 if (!IS_ALIGNED((height / 8), track->npipes)) {
371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n", 371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n",
372 __func__, __LINE__, height); 372 __func__, __LINE__, height);
373 return -EINVAL; 373 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h
index d84612ae47e0..33cda016b083 100644
--- a/drivers/gpu/drm/radeon/r600_reg.h
+++ b/drivers/gpu/drm/radeon/r600_reg.h
@@ -86,6 +86,7 @@
86#define R600_HDP_NONSURFACE_BASE 0x2c04 86#define R600_HDP_NONSURFACE_BASE 0x2c04
87 87
88#define R600_BUS_CNTL 0x5420 88#define R600_BUS_CNTL 0x5420
89# define R600_BIOS_ROM_DIS (1 << 1)
89#define R600_CONFIG_CNTL 0x5424 90#define R600_CONFIG_CNTL 0x5424
90#define R600_CONFIG_MEMSIZE 0x5428 91#define R600_CONFIG_MEMSIZE 0x5428
91#define R600_CONFIG_F0_BASE 0x542C 92#define R600_CONFIG_F0_BASE 0x542C
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 8e43ddae70cc..85a0d9f1f82b 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
98 } 98 }
99 } 99 }
100 100
101 /* some DCE3 boards have bad data for this entry */
102 if (ASIC_IS_DCE3(rdev)) {
103 if ((i == 4) &&
104 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
105 (gpio->sucI2cId.ucAccess == 0x94))
106 gpio->sucI2cId.ucAccess = 0x14;
107 }
108
101 if (gpio->sucI2cId.ucAccess == id) { 109 if (gpio->sucI2cId.ucAccess == id) {
102 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 110 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
103 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 111 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)
174 } 182 }
175 } 183 }
176 184
185 /* some DCE3 boards have bad data for this entry */
186 if (ASIC_IS_DCE3(rdev)) {
187 if ((i == 4) &&
188 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
189 (gpio->sucI2cId.ucAccess == 0x94))
190 gpio->sucI2cId.ucAccess = 0x14;
191 }
192
177 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 193 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
178 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 194 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
179 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; 195 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4;
@@ -297,7 +313,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
297 uint16_t *line_mux, 313 uint16_t *line_mux,
298 struct radeon_hpd *hpd) 314 struct radeon_hpd *hpd)
299{ 315{
300 struct radeon_device *rdev = dev->dev_private;
301 316
302 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ 317 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
303 if ((dev->pdev->device == 0x791e) && 318 if ((dev->pdev->device == 0x791e) &&
@@ -372,6 +387,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
372 *line_mux = 0x90; 387 *line_mux = 0x90;
373 } 388 }
374 389
390 /* mac rv630, rv730, others */
391 if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
392 (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
393 *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
394 *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
395 }
396
375 /* ASUS HD 3600 XT board lists the DVI port as HDMI */ 397 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
376 if ((dev->pdev->device == 0x9598) && 398 if ((dev->pdev->device == 0x9598) &&
377 (dev->pdev->subsystem_vendor == 0x1043) && 399 (dev->pdev->subsystem_vendor == 0x1043) &&
@@ -409,21 +431,23 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
409 } 431 }
410 } 432 }
411 433
412 /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ 434 /* Acer laptop (Acer TravelMate 5730G) has an HDMI port
435 * on the laptop and a DVI port on the docking station and
436 * both share the same encoder, hpd pin, and ddc line.
437 * So while the bios table is technically correct,
438 * we drop the DVI port here since xrandr has no concept of
439 * encoders and will try and drive both connectors
440 * with different crtcs which isn't possible on the hardware
441 * side and leaves no crtcs for LVDS or VGA.
442 */
413 if ((dev->pdev->device == 0x95c4) && 443 if ((dev->pdev->device == 0x95c4) &&
414 (dev->pdev->subsystem_vendor == 0x1025) && 444 (dev->pdev->subsystem_vendor == 0x1025) &&
415 (dev->pdev->subsystem_device == 0x013c)) { 445 (dev->pdev->subsystem_device == 0x013c)) {
416 struct radeon_gpio_rec gpio;
417
418 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
419 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { 447 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
420 gpio = radeon_lookup_gpio(rdev, 6); 448 /* actually it's a DVI-D port not DVI-I */
421 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
422 *connector_type = DRM_MODE_CONNECTOR_DVID; 449 *connector_type = DRM_MODE_CONNECTOR_DVID;
423 } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && 450 return false;
424 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
425 gpio = radeon_lookup_gpio(rdev, 7);
426 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
427 } 451 }
428 } 452 }
429 453
@@ -2279,7 +2303,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
2279 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; 2303 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;
2280 2304
2281 /* tell the bios not to handle mode switching */ 2305 /* tell the bios not to handle mode switching */
2282 bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); 2306 bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH;
2283 2307
2284 if (rdev->family >= CHIP_R600) { 2308 if (rdev->family >= CHIP_R600) {
2285 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); 2309 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
@@ -2330,10 +2354,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock)
2330 else 2354 else
2331 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); 2355 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
2332 2356
2333 if (lock) 2357 if (lock) {
2334 bios_6_scratch |= ATOM_S6_CRITICAL_STATE; 2358 bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
2335 else 2359 bios_6_scratch &= ~ATOM_S6_ACC_MODE;
2360 } else {
2336 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; 2361 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
2362 bios_6_scratch |= ATOM_S6_ACC_MODE;
2363 }
2337 2364
2338 if (rdev->family >= CHIP_R600) 2365 if (rdev->family >= CHIP_R600)
2339 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); 2366 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 654787ec43f4..8f2c7b50dcf5 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
130 } 130 }
131 return true; 131 return true;
132} 132}
133
133static bool r700_read_disabled_bios(struct radeon_device *rdev) 134static bool r700_read_disabled_bios(struct radeon_device *rdev)
134{ 135{
135 uint32_t viph_control; 136 uint32_t viph_control;
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
143 bool r; 144 bool r;
144 145
145 viph_control = RREG32(RADEON_VIPH_CONTROL); 146 viph_control = RREG32(RADEON_VIPH_CONTROL);
146 bus_cntl = RREG32(RADEON_BUS_CNTL); 147 bus_cntl = RREG32(R600_BUS_CNTL);
147 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 148 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
148 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 149 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
149 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 150 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
152 /* disable VIP */ 153 /* disable VIP */
153 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 154 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
154 /* enable the rom */ 155 /* enable the rom */
155 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 156 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
156 /* Disable VGA mode */ 157 /* Disable VGA mode */
157 WREG32(AVIVO_D1VGA_CONTROL, 158 WREG32(AVIVO_D1VGA_CONTROL,
158 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 159 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
191 cg_spll_status = RREG32(R600_CG_SPLL_STATUS); 192 cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
192 } 193 }
193 WREG32(RADEON_VIPH_CONTROL, viph_control); 194 WREG32(RADEON_VIPH_CONTROL, viph_control);
194 WREG32(RADEON_BUS_CNTL, bus_cntl); 195 WREG32(R600_BUS_CNTL, bus_cntl);
195 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 196 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
196 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 197 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
197 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 198 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
216 bool r; 217 bool r;
217 218
218 viph_control = RREG32(RADEON_VIPH_CONTROL); 219 viph_control = RREG32(RADEON_VIPH_CONTROL);
219 bus_cntl = RREG32(RADEON_BUS_CNTL); 220 bus_cntl = RREG32(R600_BUS_CNTL);
220 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 221 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
221 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 222 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
222 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 223 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
231 /* disable VIP */ 232 /* disable VIP */
232 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 233 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
233 /* enable the rom */ 234 /* enable the rom */
234 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 235 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
235 /* Disable VGA mode */ 236 /* Disable VGA mode */
236 WREG32(AVIVO_D1VGA_CONTROL, 237 WREG32(AVIVO_D1VGA_CONTROL,
237 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 238 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
262 263
263 /* restore regs */ 264 /* restore regs */
264 WREG32(RADEON_VIPH_CONTROL, viph_control); 265 WREG32(RADEON_VIPH_CONTROL, viph_control);
265 WREG32(RADEON_BUS_CNTL, bus_cntl); 266 WREG32(R600_BUS_CNTL, bus_cntl);
266 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 267 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
267 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 268 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
268 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 269 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 7b7ea269549c..137b8075f6e7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
571 } 571 }
572 572
573 if (clk_mask && data_mask) { 573 if (clk_mask && data_mask) {
574 /* system specific masks */
574 i2c.mask_clk_mask = clk_mask; 575 i2c.mask_clk_mask = clk_mask;
575 i2c.mask_data_mask = data_mask; 576 i2c.mask_data_mask = data_mask;
576 i2c.a_clk_mask = clk_mask; 577 i2c.a_clk_mask = clk_mask;
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
579 i2c.en_data_mask = data_mask; 580 i2c.en_data_mask = data_mask;
580 i2c.y_clk_mask = clk_mask; 581 i2c.y_clk_mask = clk_mask;
581 i2c.y_data_mask = data_mask; 582 i2c.y_data_mask = data_mask;
583 } else if ((ddc_line == RADEON_GPIOPAD_MASK) ||
584 (ddc_line == RADEON_MDGPIO_MASK)) {
585 /* default gpiopad masks */
586 i2c.mask_clk_mask = (0x20 << 8);
587 i2c.mask_data_mask = 0x80;
588 i2c.a_clk_mask = (0x20 << 8);
589 i2c.a_data_mask = 0x80;
590 i2c.en_clk_mask = (0x20 << 8);
591 i2c.en_data_mask = 0x80;
592 i2c.y_clk_mask = (0x20 << 8);
593 i2c.y_data_mask = 0x80;
582 } else { 594 } else {
595 /* default masks for ddc pads */
583 i2c.mask_clk_mask = RADEON_GPIO_EN_1; 596 i2c.mask_clk_mask = RADEON_GPIO_EN_1;
584 i2c.mask_data_mask = RADEON_GPIO_EN_0; 597 i2c.mask_data_mask = RADEON_GPIO_EN_0;
585 i2c.a_clk_mask = RADEON_GPIO_A_1; 598 i2c.a_clk_mask = RADEON_GPIO_A_1;
@@ -716,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
716 clk = RBIOS8(offset + 3 + (i * 5) + 3); 729 clk = RBIOS8(offset + 3 + (i * 5) + 3);
717 data = RBIOS8(offset + 3 + (i * 5) + 4); 730 data = RBIOS8(offset + 3 + (i * 5) + 4);
718 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 731 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
719 clk, data); 732 (1 << clk), (1 << data));
720 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); 733 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
721 break; 734 break;
722 } 735 }
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index ecc1a8fafbfd..5e222c9739c7 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1119 /* no HPD on analog connectors */ 1119 /* no HPD on analog connectors */
1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1122 connector->interlace_allowed = true;
1123 connector->doublescan_allowed = true;
1122 break; 1124 break;
1123 case DRM_MODE_CONNECTOR_DVIA: 1125 case DRM_MODE_CONNECTOR_DVIA:
1124 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1126 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1134 1); 1136 1);
1135 /* no HPD on analog connectors */ 1137 /* no HPD on analog connectors */
1136 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1138 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1139 connector->interlace_allowed = true;
1140 connector->doublescan_allowed = true;
1137 break; 1141 break;
1138 case DRM_MODE_CONNECTOR_DVII: 1142 case DRM_MODE_CONNECTOR_DVII:
1139 case DRM_MODE_CONNECTOR_DVID: 1143 case DRM_MODE_CONNECTOR_DVID:
@@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1163 rdev->mode_info.load_detect_property, 1167 rdev->mode_info.load_detect_property,
1164 1); 1168 1);
1165 } 1169 }
1170 connector->interlace_allowed = true;
1171 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1172 connector->doublescan_allowed = true;
1173 else
1174 connector->doublescan_allowed = false;
1166 break; 1175 break;
1167 case DRM_MODE_CONNECTOR_HDMIA: 1176 case DRM_MODE_CONNECTOR_HDMIA:
1168 case DRM_MODE_CONNECTOR_HDMIB: 1177 case DRM_MODE_CONNECTOR_HDMIB:
@@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1186 rdev->mode_info.underscan_property, 1195 rdev->mode_info.underscan_property,
1187 UNDERSCAN_AUTO); 1196 UNDERSCAN_AUTO);
1188 subpixel_order = SubPixelHorizontalRGB; 1197 subpixel_order = SubPixelHorizontalRGB;
1198 connector->interlace_allowed = true;
1199 if (connector_type == DRM_MODE_CONNECTOR_HDMIB)
1200 connector->doublescan_allowed = true;
1201 else
1202 connector->doublescan_allowed = false;
1189 break; 1203 break;
1190 case DRM_MODE_CONNECTOR_DisplayPort: 1204 case DRM_MODE_CONNECTOR_DisplayPort:
1191 case DRM_MODE_CONNECTOR_eDP: 1205 case DRM_MODE_CONNECTOR_eDP:
@@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1216 drm_connector_attach_property(&radeon_connector->base, 1230 drm_connector_attach_property(&radeon_connector->base,
1217 rdev->mode_info.underscan_property, 1231 rdev->mode_info.underscan_property,
1218 UNDERSCAN_AUTO); 1232 UNDERSCAN_AUTO);
1233 connector->interlace_allowed = true;
1234 /* in theory with a DP to VGA converter... */
1235 connector->doublescan_allowed = false;
1219 break; 1236 break;
1220 case DRM_MODE_CONNECTOR_SVIDEO: 1237 case DRM_MODE_CONNECTOR_SVIDEO:
1221 case DRM_MODE_CONNECTOR_Composite: 1238 case DRM_MODE_CONNECTOR_Composite:
@@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1231 radeon_atombios_get_tv_info(rdev)); 1248 radeon_atombios_get_tv_info(rdev));
1232 /* no HPD on analog connectors */ 1249 /* no HPD on analog connectors */
1233 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1250 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1251 connector->interlace_allowed = false;
1252 connector->doublescan_allowed = false;
1234 break; 1253 break;
1235 case DRM_MODE_CONNECTOR_LVDS: 1254 case DRM_MODE_CONNECTOR_LVDS:
1236 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); 1255 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
@@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1249 dev->mode_config.scaling_mode_property, 1268 dev->mode_config.scaling_mode_property,
1250 DRM_MODE_SCALE_FULLSCREEN); 1269 DRM_MODE_SCALE_FULLSCREEN);
1251 subpixel_order = SubPixelHorizontalRGB; 1270 subpixel_order = SubPixelHorizontalRGB;
1271 connector->interlace_allowed = false;
1272 connector->doublescan_allowed = false;
1252 break; 1273 break;
1253 } 1274 }
1254 1275
@@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1326 /* no HPD on analog connectors */ 1347 /* no HPD on analog connectors */
1327 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1348 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1328 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1349 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1350 connector->interlace_allowed = true;
1351 connector->doublescan_allowed = true;
1329 break; 1352 break;
1330 case DRM_MODE_CONNECTOR_DVIA: 1353 case DRM_MODE_CONNECTOR_DVIA:
1331 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1354 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1341 1); 1364 1);
1342 /* no HPD on analog connectors */ 1365 /* no HPD on analog connectors */
1343 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1366 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1367 connector->interlace_allowed = true;
1368 connector->doublescan_allowed = true;
1344 break; 1369 break;
1345 case DRM_MODE_CONNECTOR_DVII: 1370 case DRM_MODE_CONNECTOR_DVII:
1346 case DRM_MODE_CONNECTOR_DVID: 1371 case DRM_MODE_CONNECTOR_DVID:
@@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_device *dev,
1358 1); 1383 1);
1359 } 1384 }
1360 subpixel_order = SubPixelHorizontalRGB; 1385 subpixel_order = SubPixelHorizontalRGB;
1386 connector->interlace_allowed = true;
1387 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1388 connector->doublescan_allowed = true;
1389 else
1390 connector->doublescan_allowed = false;
1361 break; 1391 break;
1362 case DRM_MODE_CONNECTOR_SVIDEO: 1392 case DRM_MODE_CONNECTOR_SVIDEO:
1363 case DRM_MODE_CONNECTOR_Composite: 1393 case DRM_MODE_CONNECTOR_Composite:
@@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1380 radeon_combios_get_tv_info(rdev)); 1410 radeon_combios_get_tv_info(rdev));
1381 /* no HPD on analog connectors */ 1411 /* no HPD on analog connectors */
1382 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1412 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1413 connector->interlace_allowed = false;
1414 connector->doublescan_allowed = false;
1383 break; 1415 break;
1384 case DRM_MODE_CONNECTOR_LVDS: 1416 case DRM_MODE_CONNECTOR_LVDS:
1385 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); 1417 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type);
@@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1393 dev->mode_config.scaling_mode_property, 1425 dev->mode_config.scaling_mode_property,
1394 DRM_MODE_SCALE_FULLSCREEN); 1426 DRM_MODE_SCALE_FULLSCREEN);
1395 subpixel_order = SubPixelHorizontalRGB; 1427 subpixel_order = SubPixelHorizontalRGB;
1428 connector->interlace_allowed = false;
1429 connector->doublescan_allowed = false;
1396 break; 1430 break;
1397 } 1431 }
1398 1432
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 256d204a6d24..ed5e153384ac 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -829,11 +829,6 @@ int radeon_resume_kms(struct drm_device *dev)
829 radeon_pm_resume(rdev); 829 radeon_pm_resume(rdev);
830 radeon_restore_bios_scratch_regs(rdev); 830 radeon_restore_bios_scratch_regs(rdev);
831 831
832 /* turn on display hw */
833 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
834 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
835 }
836
837 radeon_fbdev_set_suspend(rdev, 0); 832 radeon_fbdev_set_suspend(rdev, 0);
838 release_console_sem(); 833 release_console_sem();
839 834
@@ -841,6 +836,10 @@ int radeon_resume_kms(struct drm_device *dev)
841 radeon_hpd_init(rdev); 836 radeon_hpd_init(rdev);
842 /* blat the mode back in */ 837 /* blat the mode back in */
843 drm_helper_resume_force_mode(dev); 838 drm_helper_resume_force_mode(dev);
839 /* turn on display hw */
840 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
841 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
842 }
844 return 0; 843 return 0;
845} 844}
846 845
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index b92d2f2fcbed..4da243ac79d7 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -629,6 +629,10 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll,
629 *frac_fb_div_p = best_frac_feedback_div; 629 *frac_fb_div_p = best_frac_feedback_div;
630 *ref_div_p = best_ref_div; 630 *ref_div_p = best_ref_div;
631 *post_div_p = best_post_div; 631 *post_div_p = best_post_div;
632 DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
633 freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div,
634 best_ref_div, best_post_div);
635
632} 636}
633 637
634static bool 638static bool
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 2c293e8304d6..b82015e148e6 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
595int 595int
596atombios_get_encoder_mode(struct drm_encoder *encoder) 596atombios_get_encoder_mode(struct drm_encoder *encoder)
597{ 597{
598 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
598 struct drm_device *dev = encoder->dev; 599 struct drm_device *dev = encoder->dev;
599 struct radeon_device *rdev = dev->dev_private; 600 struct radeon_device *rdev = dev->dev_private;
600 struct drm_connector *connector; 601 struct drm_connector *connector;
@@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
602 struct radeon_connector_atom_dig *dig_connector; 603 struct radeon_connector_atom_dig *dig_connector;
603 604
604 connector = radeon_get_connector_for_encoder(encoder); 605 connector = radeon_get_connector_for_encoder(encoder);
605 if (!connector) 606 if (!connector) {
606 return 0; 607 switch (radeon_encoder->encoder_id) {
607 608 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
609 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
610 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
611 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
612 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
613 return ATOM_ENCODER_MODE_DVI;
614 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
615 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
616 default:
617 return ATOM_ENCODER_MODE_CRT;
618 }
619 }
608 radeon_connector = to_radeon_connector(connector); 620 radeon_connector = to_radeon_connector(connector);
609 621
610 switch (connector->connector_type) { 622 switch (connector->connector_type) {
@@ -1547,6 +1559,23 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1547 struct radeon_device *rdev = dev->dev_private; 1559 struct radeon_device *rdev = dev->dev_private;
1548 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1560 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1549 struct radeon_encoder_atom_dig *dig; 1561 struct radeon_encoder_atom_dig *dig;
1562
1563 /* check for pre-DCE3 cards with shared encoders;
1564 * can't really use the links individually, so don't disable
1565 * the encoder if it's in use by another connector
1566 */
1567 if (!ASIC_IS_DCE3(rdev)) {
1568 struct drm_encoder *other_encoder;
1569 struct radeon_encoder *other_radeon_encoder;
1570
1571 list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) {
1572 other_radeon_encoder = to_radeon_encoder(other_encoder);
1573 if ((radeon_encoder->encoder_id == other_radeon_encoder->encoder_id) &&
1574 drm_helper_encoder_in_use(other_encoder))
1575 goto disable_done;
1576 }
1577 }
1578
1550 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1579 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1551 1580
1552 switch (radeon_encoder->encoder_id) { 1581 switch (radeon_encoder->encoder_id) {
@@ -1586,6 +1615,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1586 break; 1615 break;
1587 } 1616 }
1588 1617
1618disable_done:
1589 if (radeon_encoder_is_digital(encoder)) { 1619 if (radeon_encoder_is_digital(encoder)) {
1590 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) 1620 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI)
1591 r600_hdmi_disable(encoder); 1621 r600_hdmi_disable(encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index 6a13ee38a5b9..acae80ee91a2 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -946,6 +946,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
946 i2c->rec = *rec; 946 i2c->rec = *rec;
947 i2c->adapter.owner = THIS_MODULE; 947 i2c->adapter.owner = THIS_MODULE;
948 i2c->dev = dev; 948 i2c->dev = dev;
949 sprintf(i2c->adapter.name, "Radeon aux bus %s", name);
949 i2c_set_adapdata(&i2c->adapter, i2c); 950 i2c_set_adapdata(&i2c->adapter, i2c);
950 i2c->adapter.algo_data = &i2c->algo.dp; 951 i2c->adapter.algo_data = &i2c->algo.dp;
951 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; 952 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index b3b5306bb578..25d345ecee8e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
102 type = ttm_bo_type_device; 102 type = ttm_bo_type_device;
103 } 103 }
104 *bo_ptr = NULL; 104 *bo_ptr = NULL;
105
106retry:
105 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); 107 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
106 if (bo == NULL) 108 if (bo == NULL)
107 return -ENOMEM; 109 return -ENOMEM;
@@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
109 bo->gobj = gobj; 111 bo->gobj = gobj;
110 bo->surface_reg = -1; 112 bo->surface_reg = -1;
111 INIT_LIST_HEAD(&bo->list); 113 INIT_LIST_HEAD(&bo->list);
112
113retry:
114 radeon_ttm_placement_from_domain(bo, domain); 114 radeon_ttm_placement_from_domain(bo, domain);
115 /* Kernel allocation are uninterruptible */ 115 /* Kernel allocation are uninterruptible */
116 mutex_lock(&rdev->vram_mutex); 116 mutex_lock(&rdev->vram_mutex);
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index c332f46340d5..64928814de53 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -2836,6 +2836,7 @@
2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) 2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) 2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24 2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24
2839# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
2839# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) 2840# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
2840# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) 2841# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
2841# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) 2842# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 9490da700749..b88353d6ed2e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -643,10 +643,11 @@ static void rv770_gpu_init(struct radeon_device *rdev)
643 else 643 else
644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); 645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3);
646 646 gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
647 gb_tiling_config |= GROUP_SIZE(0); 647 if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
648 rdev->config.rv770.tiling_group_size = 256; 648 rdev->config.rv770.tiling_group_size = 512;
649 649 else
650 rdev->config.rv770.tiling_group_size = 256;
650 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { 651 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) {
651 gb_tiling_config |= ROW_TILING(3); 652 gb_tiling_config |= ROW_TILING(3);
652 gb_tiling_config |= SAMPLE_SPLIT(3); 653 gb_tiling_config |= SAMPLE_SPLIT(3);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index f366f968155a..d7def1790b41 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *pdev, void *cookie,
636 void (*irq_set_state)(void *cookie, bool state), 636 void (*irq_set_state)(void *cookie, bool state),
637 unsigned int (*set_vga_decode)(void *cookie, bool decode)) 637 unsigned int (*set_vga_decode)(void *cookie, bool decode))
638{ 638{
639 int ret = -1; 639 int ret = -ENODEV;
640 struct vga_device *vgadev; 640 struct vga_device *vgadev;
641 unsigned long flags; 641 unsigned long flags;
642 642
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c
index 8ca7f65cf2f8..54b017ad258d 100644
--- a/drivers/hid/hid-egalax.c
+++ b/drivers/hid/hid-egalax.c
@@ -31,7 +31,7 @@ struct egalax_data {
31 bool first; /* is this the first finger in the frame? */ 31 bool first; /* is this the first finger in the frame? */
32 bool valid; /* valid finger data, or just placeholder? */ 32 bool valid; /* valid finger data, or just placeholder? */
33 bool activity; /* at least one active finger previously? */ 33 bool activity; /* at least one active finger previously? */
34 __u16 lastx, lasty; /* latest valid (x, y) in the frame */ 34 __u16 lastx, lasty, lastz; /* latest valid (x, y, z) in the frame */
35}; 35};
36 36
37static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, 37static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
@@ -79,6 +79,10 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
79 case HID_DG_TIPPRESSURE: 79 case HID_DG_TIPPRESSURE:
80 hid_map_usage(hi, usage, bit, max, 80 hid_map_usage(hi, usage, bit, max,
81 EV_ABS, ABS_MT_PRESSURE); 81 EV_ABS, ABS_MT_PRESSURE);
82 /* touchscreen emulation */
83 input_set_abs_params(hi->input, ABS_PRESSURE,
84 field->logical_minimum,
85 field->logical_maximum, 0, 0);
82 return 1; 86 return 1;
83 } 87 }
84 return 0; 88 return 0;
@@ -109,8 +113,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
109 if (td->valid) { 113 if (td->valid) {
110 /* emit multitouch events */ 114 /* emit multitouch events */
111 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); 115 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id);
112 input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); 116 input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x >> 3);
113 input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); 117 input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y >> 3);
114 input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z); 118 input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z);
115 119
116 input_mt_sync(input); 120 input_mt_sync(input);
@@ -121,6 +125,7 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
121 */ 125 */
122 td->lastx = td->x; 126 td->lastx = td->x;
123 td->lasty = td->y; 127 td->lasty = td->y;
128 td->lastz = td->z;
124 } 129 }
125 130
126 /* 131 /*
@@ -129,8 +134,9 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
129 * the oldest on the panel, the one we want for single touch 134 * the oldest on the panel, the one we want for single touch
130 */ 135 */
131 if (!td->first && td->activity) { 136 if (!td->first && td->activity) {
132 input_event(input, EV_ABS, ABS_X, td->lastx); 137 input_event(input, EV_ABS, ABS_X, td->lastx >> 3);
133 input_event(input, EV_ABS, ABS_Y, td->lasty); 138 input_event(input, EV_ABS, ABS_Y, td->lasty >> 3);
139 input_event(input, EV_ABS, ABS_PRESSURE, td->lastz);
134 } 140 }
135 141
136 if (!td->valid) { 142 if (!td->valid) {
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index f0260c699adb..859ee7e39f5b 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -34,7 +34,6 @@ static const struct hid_blacklist {
34 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, 34 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
35 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 35 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
36 { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, 36 { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET },
37 { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT },
38 { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, 37 { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT },
39 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, 38 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT },
40 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 39 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 65335b268fa9..9975bbfb1b31 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -916,27 +916,27 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
916 int nr = sensor_attr->index; 916 int nr = sensor_attr->index;
917 struct i2c_client *client = to_i2c_client(dev); 917 struct i2c_client *client = to_i2c_client(dev);
918 struct adm1026_data *data = i2c_get_clientdata(client); 918 struct adm1026_data *data = i2c_get_clientdata(client);
919 int val, orig_div, new_div, shift; 919 int val, orig_div, new_div;
920 920
921 val = simple_strtol(buf, NULL, 10); 921 val = simple_strtol(buf, NULL, 10);
922 new_div = DIV_TO_REG(val); 922 new_div = DIV_TO_REG(val);
923 if (new_div == 0) { 923
924 return -EINVAL;
925 }
926 mutex_lock(&data->update_lock); 924 mutex_lock(&data->update_lock);
927 orig_div = data->fan_div[nr]; 925 orig_div = data->fan_div[nr];
928 data->fan_div[nr] = DIV_FROM_REG(new_div); 926 data->fan_div[nr] = DIV_FROM_REG(new_div);
929 927
930 if (nr < 4) { /* 0 <= nr < 4 */ 928 if (nr < 4) { /* 0 <= nr < 4 */
931 shift = 2 * nr;
932 adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, 929 adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3,
933 ((DIV_TO_REG(orig_div) & (~(0x03 << shift))) | 930 (DIV_TO_REG(data->fan_div[0]) << 0) |
934 (new_div << shift))); 931 (DIV_TO_REG(data->fan_div[1]) << 2) |
932 (DIV_TO_REG(data->fan_div[2]) << 4) |
933 (DIV_TO_REG(data->fan_div[3]) << 6));
935 } else { /* 3 < nr < 8 */ 934 } else { /* 3 < nr < 8 */
936 shift = 2 * (nr - 4);
937 adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, 935 adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7,
938 ((DIV_TO_REG(orig_div) & (~(0x03 << (2 * shift)))) | 936 (DIV_TO_REG(data->fan_div[4]) << 0) |
939 (new_div << shift))); 937 (DIV_TO_REG(data->fan_div[5]) << 2) |
938 (DIV_TO_REG(data->fan_div[6]) << 4) |
939 (DIV_TO_REG(data->fan_div[7]) << 6));
940 } 940 }
941 941
942 if (data->fan_div[nr] != orig_div) { 942 if (data->fan_div[nr] != orig_div) {
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index b6598aa557a0..87a5fd51dd5e 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -162,6 +162,10 @@ static const char *temperature_sensors_sets[][41] = {
162/* Set 22: MacBook Pro 7,1 */ 162/* Set 22: MacBook Pro 7,1 */
163 { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", 163 { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S",
164 "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, 164 "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL },
165/* Set 23: MacBook Air 3,1 */
166 { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3",
167 "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5",
168 "TH0F", "TH0O", "TM0P" },
165}; 169};
166 170
167/* List of keys used to read/write fan speeds */ 171/* List of keys used to read/write fan speeds */
@@ -444,38 +448,22 @@ static int applesmc_read_motion_sensor(int index, s16* value)
444} 448}
445 449
446/* 450/*
447 * applesmc_device_init - initialize the accelerometer. Returns zero on success 451 * applesmc_device_init - initialize the accelerometer. Can sleep.
448 * and negative error code on failure. Can sleep.
449 */ 452 */
450static int applesmc_device_init(void) 453static void applesmc_device_init(void)
451{ 454{
452 int total, ret = -ENXIO; 455 int total;
453 u8 buffer[2]; 456 u8 buffer[2];
454 457
455 if (!applesmc_accelerometer) 458 if (!applesmc_accelerometer)
456 return 0; 459 return;
457 460
458 mutex_lock(&applesmc_lock); 461 mutex_lock(&applesmc_lock);
459 462
460 for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { 463 for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
461 if (debug)
462 printk(KERN_DEBUG "applesmc try %d\n", total);
463 if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && 464 if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
464 (buffer[0] != 0x00 || buffer[1] != 0x00)) { 465 (buffer[0] != 0x00 || buffer[1] != 0x00))
465 if (total == INIT_TIMEOUT_MSECS) {
466 printk(KERN_DEBUG "applesmc: device has"
467 " already been initialized"
468 " (0x%02x, 0x%02x).\n",
469 buffer[0], buffer[1]);
470 } else {
471 printk(KERN_DEBUG "applesmc: device"
472 " successfully initialized"
473 " (0x%02x, 0x%02x).\n",
474 buffer[0], buffer[1]);
475 }
476 ret = 0;
477 goto out; 466 goto out;
478 }
479 buffer[0] = 0xe0; 467 buffer[0] = 0xe0;
480 buffer[1] = 0x00; 468 buffer[1] = 0x00;
481 applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); 469 applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
@@ -486,7 +474,6 @@ static int applesmc_device_init(void)
486 474
487out: 475out:
488 mutex_unlock(&applesmc_lock); 476 mutex_unlock(&applesmc_lock);
489 return ret;
490} 477}
491 478
492/* 479/*
@@ -512,13 +499,8 @@ static int applesmc_get_fan_count(void)
512/* Device model stuff */ 499/* Device model stuff */
513static int applesmc_probe(struct platform_device *dev) 500static int applesmc_probe(struct platform_device *dev)
514{ 501{
515 int ret; 502 applesmc_device_init();
516
517 ret = applesmc_device_init();
518 if (ret)
519 return ret;
520 503
521 printk(KERN_INFO "applesmc: device successfully initialized.\n");
522 return 0; 504 return 0;
523} 505}
524 506
@@ -535,9 +517,7 @@ static int applesmc_pm_resume(struct device *dev)
535/* Reinitialize device on resume from hibernation */ 517/* Reinitialize device on resume from hibernation */
536static int applesmc_pm_restore(struct device *dev) 518static int applesmc_pm_restore(struct device *dev)
537{ 519{
538 int ret = applesmc_device_init(); 520 applesmc_device_init();
539 if (ret)
540 return ret;
541 return applesmc_pm_resume(dev); 521 return applesmc_pm_resume(dev);
542} 522}
543 523
@@ -1524,11 +1504,17 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
1524 { .accelerometer = 1, .light = 1, .temperature_set = 21 }, 1504 { .accelerometer = 1, .light = 1, .temperature_set = 21 },
1525/* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ 1505/* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */
1526 { .accelerometer = 1, .light = 1, .temperature_set = 22 }, 1506 { .accelerometer = 1, .light = 1, .temperature_set = 22 },
1507/* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */
1508 { .accelerometer = 0, .light = 0, .temperature_set = 23 },
1527}; 1509};
1528 1510
1529/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". 1511/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
1530 * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ 1512 * So we need to put "Apple MacBook Pro" before "Apple MacBook". */
1531static __initdata struct dmi_system_id applesmc_whitelist[] = { 1513static __initdata struct dmi_system_id applesmc_whitelist[] = {
1514 { applesmc_dmi_match, "Apple MacBook Air 3", {
1515 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1516 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") },
1517 &applesmc_dmi_data[23]},
1532 { applesmc_dmi_match, "Apple MacBook Air 2", { 1518 { applesmc_dmi_match, "Apple MacBook Air 2", {
1533 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1519 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1534 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, 1520 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") },
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index 776aeb3019d2..508cb291f71b 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -98,6 +98,9 @@ static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END };
98 * value, it uses signed 8-bit values with LSB = 1 degree Celsius. 98 * value, it uses signed 8-bit values with LSB = 1 degree Celsius.
99 * For remote temperature, low and high limits, it uses signed 11-bit values 99 * For remote temperature, low and high limits, it uses signed 11-bit values
100 * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. 100 * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers.
101 * For LM64 the actual remote diode temperature is 16 degree Celsius higher
102 * than the register reading. Remote temperature setpoints have to be
103 * adapted accordingly.
101 */ 104 */
102 105
103#define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ 106#define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \
@@ -165,6 +168,8 @@ struct lm63_data {
165 struct mutex update_lock; 168 struct mutex update_lock;
166 char valid; /* zero until following fields are valid */ 169 char valid; /* zero until following fields are valid */
167 unsigned long last_updated; /* in jiffies */ 170 unsigned long last_updated; /* in jiffies */
171 int kind;
172 int temp2_offset;
168 173
169 /* registers values */ 174 /* registers values */
170 u8 config, config_fan; 175 u8 config, config_fan;
@@ -247,16 +252,34 @@ static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *dum
247 return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); 252 return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2);
248} 253}
249 254
250static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, 255/*
251 char *buf) 256 * There are 8bit registers for both local(temp1) and remote(temp2) sensor.
257 * For remote sensor registers temp2_offset has to be considered,
258 * for local sensor it must not.
259 * So we need separate 8bit accessors for local and remote sensor.
260 */
261static ssize_t show_local_temp8(struct device *dev,
262 struct device_attribute *devattr,
263 char *buf)
252{ 264{
253 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 265 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
254 struct lm63_data *data = lm63_update_device(dev); 266 struct lm63_data *data = lm63_update_device(dev);
255 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); 267 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index]));
256} 268}
257 269
258static ssize_t set_temp8(struct device *dev, struct device_attribute *dummy, 270static ssize_t show_remote_temp8(struct device *dev,
259 const char *buf, size_t count) 271 struct device_attribute *devattr,
272 char *buf)
273{
274 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
275 struct lm63_data *data = lm63_update_device(dev);
276 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])
277 + data->temp2_offset);
278}
279
280static ssize_t set_local_temp8(struct device *dev,
281 struct device_attribute *dummy,
282 const char *buf, size_t count)
260{ 283{
261 struct i2c_client *client = to_i2c_client(dev); 284 struct i2c_client *client = to_i2c_client(dev);
262 struct lm63_data *data = i2c_get_clientdata(client); 285 struct lm63_data *data = i2c_get_clientdata(client);
@@ -274,7 +297,8 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
274{ 297{
275 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 298 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
276 struct lm63_data *data = lm63_update_device(dev); 299 struct lm63_data *data = lm63_update_device(dev);
277 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])); 300 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])
301 + data->temp2_offset);
278} 302}
279 303
280static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, 304static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
@@ -294,7 +318,7 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
294 int nr = attr->index; 318 int nr = attr->index;
295 319
296 mutex_lock(&data->update_lock); 320 mutex_lock(&data->update_lock);
297 data->temp11[nr] = TEMP11_TO_REG(val); 321 data->temp11[nr] = TEMP11_TO_REG(val - data->temp2_offset);
298 i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], 322 i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2],
299 data->temp11[nr] >> 8); 323 data->temp11[nr] >> 8);
300 i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], 324 i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1],
@@ -310,6 +334,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute
310{ 334{
311 struct lm63_data *data = lm63_update_device(dev); 335 struct lm63_data *data = lm63_update_device(dev);
312 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) 336 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2])
337 + data->temp2_offset
313 - TEMP8_FROM_REG(data->temp2_crit_hyst)); 338 - TEMP8_FROM_REG(data->temp2_crit_hyst));
314} 339}
315 340
@@ -324,7 +349,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute *
324 long hyst; 349 long hyst;
325 350
326 mutex_lock(&data->update_lock); 351 mutex_lock(&data->update_lock);
327 hyst = TEMP8_FROM_REG(data->temp8[2]) - val; 352 hyst = TEMP8_FROM_REG(data->temp8[2]) + data->temp2_offset - val;
328 i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, 353 i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST,
329 HYST_TO_REG(hyst)); 354 HYST_TO_REG(hyst));
330 mutex_unlock(&data->update_lock); 355 mutex_unlock(&data->update_lock);
@@ -355,16 +380,21 @@ static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan,
355static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); 380static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1);
356static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); 381static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL);
357 382
358static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); 383static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_local_temp8, NULL, 0);
359static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp8, 384static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_local_temp8,
360 set_temp8, 1); 385 set_local_temp8, 1);
361 386
362static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); 387static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0);
363static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, 388static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11,
364 set_temp11, 1); 389 set_temp11, 1);
365static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, 390static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11,
366 set_temp11, 2); 391 set_temp11, 2);
367static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); 392/*
393 * On LM63, temp2_crit can be set only once, which should be job
394 * of the bootloader.
395 */
396static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_remote_temp8,
397 NULL, 2);
368static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, 398static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst,
369 set_temp2_crit_hyst); 399 set_temp2_crit_hyst);
370 400
@@ -479,7 +509,12 @@ static int lm63_probe(struct i2c_client *new_client,
479 data->valid = 0; 509 data->valid = 0;
480 mutex_init(&data->update_lock); 510 mutex_init(&data->update_lock);
481 511
482 /* Initialize the LM63 chip */ 512 /* Set the device type */
513 data->kind = id->driver_data;
514 if (data->kind == lm64)
515 data->temp2_offset = 16000;
516
517 /* Initialize chip */
483 lm63_init_client(new_client); 518 lm63_init_client(new_client);
484 519
485 /* Register sysfs hooks */ 520 /* Register sysfs hooks */
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index b3841a615595..2e8f0c9458d4 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -1259,6 +1259,7 @@ static int lm85_probe(struct i2c_client *client,
1259 switch (data->type) { 1259 switch (data->type) {
1260 case adm1027: 1260 case adm1027:
1261 case adt7463: 1261 case adt7463:
1262 case adt7468:
1262 case emc6d100: 1263 case emc6d100:
1263 case emc6d102: 1264 case emc6d102:
1264 data->freq_map = adm1027_freq_map; 1265 data->freq_map = adm1027_freq_map;
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index f397ce7ad598..b2074e3ba2f1 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -687,6 +687,13 @@ static int __devexit via686a_remove(struct platform_device *pdev)
687 return 0; 687 return 0;
688} 688}
689 689
690static void via686a_update_fan_div(struct via686a_data *data)
691{
692 int reg = via686a_read_value(data, VIA686A_REG_FANDIV);
693 data->fan_div[0] = (reg >> 4) & 0x03;
694 data->fan_div[1] = reg >> 6;
695}
696
690static void __devinit via686a_init_device(struct via686a_data *data) 697static void __devinit via686a_init_device(struct via686a_data *data)
691{ 698{
692 u8 reg; 699 u8 reg;
@@ -700,6 +707,9 @@ static void __devinit via686a_init_device(struct via686a_data *data)
700 via686a_write_value(data, VIA686A_REG_TEMP_MODE, 707 via686a_write_value(data, VIA686A_REG_TEMP_MODE,
701 (reg & ~VIA686A_TEMP_MODE_MASK) 708 (reg & ~VIA686A_TEMP_MODE_MASK)
702 | VIA686A_TEMP_MODE_CONTINUOUS); 709 | VIA686A_TEMP_MODE_CONTINUOUS);
710
711 /* Pre-read fan clock divisor values */
712 via686a_update_fan_div(data);
703} 713}
704 714
705static struct via686a_data *via686a_update_device(struct device *dev) 715static struct via686a_data *via686a_update_device(struct device *dev)
@@ -751,9 +761,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
751 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & 761 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) &
752 0xc0) >> 6; 762 0xc0) >> 6;
753 763
754 i = via686a_read_value(data, VIA686A_REG_FANDIV); 764 via686a_update_fan_div(data);
755 data->fan_div[0] = (i >> 4) & 0x03;
756 data->fan_div[1] = i >> 6;
757 data->alarms = 765 data->alarms =
758 via686a_read_value(data, 766 via686a_read_value(data,
759 VIA686A_REG_ALARM1) | 767 VIA686A_REG_ALARM1) |
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 5f6d7f89e225..ace67995d7de 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -224,7 +224,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
224 224
225 if (irq) { 225 if (irq) {
226 ret = request_irq(irq, i2c_pca_pf_handler, 226 ret = request_irq(irq, i2c_pca_pf_handler,
227 IRQF_TRIGGER_FALLING, i2c->adap.name, i2c); 227 IRQF_TRIGGER_FALLING, pdev->name, i2c);
228 if (ret) 228 if (ret)
229 goto e_reqirq; 229 goto e_reqirq;
230 } 230 }
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index bea4c5021d26..c16a448dfd0d 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1005,6 +1005,14 @@ static int i2c_do_del_adapter(struct i2c_driver *driver,
1005static int __unregister_client(struct device *dev, void *dummy) 1005static int __unregister_client(struct device *dev, void *dummy)
1006{ 1006{
1007 struct i2c_client *client = i2c_verify_client(dev); 1007 struct i2c_client *client = i2c_verify_client(dev);
1008 if (client && strcmp(client->name, "dummy"))
1009 i2c_unregister_device(client);
1010 return 0;
1011}
1012
1013static int __unregister_dummy(struct device *dev, void *dummy)
1014{
1015 struct i2c_client *client = i2c_verify_client(dev);
1008 if (client) 1016 if (client)
1009 i2c_unregister_device(client); 1017 i2c_unregister_device(client);
1010 return 0; 1018 return 0;
@@ -1059,8 +1067,12 @@ int i2c_del_adapter(struct i2c_adapter *adap)
1059 mutex_unlock(&adap->userspace_clients_lock); 1067 mutex_unlock(&adap->userspace_clients_lock);
1060 1068
1061 /* Detach any active clients. This can't fail, thus we do not 1069 /* Detach any active clients. This can't fail, thus we do not
1062 checking the returned value. */ 1070 * check the returned value. This is a two-pass process, because
1071 * we can't remove the dummy devices during the first pass: they
1072 * could have been instantiated by real devices wishing to clean
1073 * them up properly, so we give them a chance to do that first. */
1063 res = device_for_each_child(&adap->dev, NULL, __unregister_client); 1074 res = device_for_each_child(&adap->dev, NULL, __unregister_client);
1075 res = device_for_each_child(&adap->dev, NULL, __unregister_dummy);
1064 1076
1065#ifdef CONFIG_I2C_COMPAT 1077#ifdef CONFIG_I2C_COMPAT
1066 class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, 1078 class_compat_remove_link(i2c_adapter_compat_class, &adap->dev,
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index c37ef64d1465..cf88588a8e80 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -276,7 +276,7 @@ static int intel_idle_probe(void)
276 276
277 case 0x1C: /* 28 - Atom Processor */ 277 case 0x1C: /* 28 - Atom Processor */
278 case 0x26: /* 38 - Lincroft Atom Processor */ 278 case 0x26: /* 38 - Lincroft Atom Processor */
279 lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */ 279 lapic_timer_reliable_states = (1 << 1); /* C1 */
280 cpuidle_state_table = atom_cstates; 280 cpuidle_state_table = atom_cstates;
281 break; 281 break;
282#ifdef FUTURE_USE 282#ifdef FUTURE_USE
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 6fcfbeb24a23..abb87140f29f 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -891,68 +891,81 @@ out:
891 return ret ? ret : in_len; 891 return ret ? ret : in_len;
892} 892}
893 893
894static int copy_wc_to_user(void __user *dest, struct ib_wc *wc)
895{
896 struct ib_uverbs_wc tmp;
897
898 tmp.wr_id = wc->wr_id;
899 tmp.status = wc->status;
900 tmp.opcode = wc->opcode;
901 tmp.vendor_err = wc->vendor_err;
902 tmp.byte_len = wc->byte_len;
903 tmp.ex.imm_data = (__u32 __force) wc->ex.imm_data;
904 tmp.qp_num = wc->qp->qp_num;
905 tmp.src_qp = wc->src_qp;
906 tmp.wc_flags = wc->wc_flags;
907 tmp.pkey_index = wc->pkey_index;
908 tmp.slid = wc->slid;
909 tmp.sl = wc->sl;
910 tmp.dlid_path_bits = wc->dlid_path_bits;
911 tmp.port_num = wc->port_num;
912 tmp.reserved = 0;
913
914 if (copy_to_user(dest, &tmp, sizeof tmp))
915 return -EFAULT;
916
917 return 0;
918}
919
894ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, 920ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
895 const char __user *buf, int in_len, 921 const char __user *buf, int in_len,
896 int out_len) 922 int out_len)
897{ 923{
898 struct ib_uverbs_poll_cq cmd; 924 struct ib_uverbs_poll_cq cmd;
899 struct ib_uverbs_poll_cq_resp *resp; 925 struct ib_uverbs_poll_cq_resp resp;
926 u8 __user *header_ptr;
927 u8 __user *data_ptr;
900 struct ib_cq *cq; 928 struct ib_cq *cq;
901 struct ib_wc *wc; 929 struct ib_wc wc;
902 int ret = 0; 930 int ret;
903 int i;
904 int rsize;
905 931
906 if (copy_from_user(&cmd, buf, sizeof cmd)) 932 if (copy_from_user(&cmd, buf, sizeof cmd))
907 return -EFAULT; 933 return -EFAULT;
908 934
909 wc = kmalloc(cmd.ne * sizeof *wc, GFP_KERNEL);
910 if (!wc)
911 return -ENOMEM;
912
913 rsize = sizeof *resp + cmd.ne * sizeof(struct ib_uverbs_wc);
914 resp = kmalloc(rsize, GFP_KERNEL);
915 if (!resp) {
916 ret = -ENOMEM;
917 goto out_wc;
918 }
919
920 cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); 935 cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0);
921 if (!cq) { 936 if (!cq)
922 ret = -EINVAL; 937 return -EINVAL;
923 goto out;
924 }
925 938
926 resp->count = ib_poll_cq(cq, cmd.ne, wc); 939 /* we copy a struct ib_uverbs_poll_cq_resp to user space */
940 header_ptr = (void __user *)(unsigned long) cmd.response;
941 data_ptr = header_ptr + sizeof resp;
927 942
928 put_cq_read(cq); 943 memset(&resp, 0, sizeof resp);
944 while (resp.count < cmd.ne) {
945 ret = ib_poll_cq(cq, 1, &wc);
946 if (ret < 0)
947 goto out_put;
948 if (!ret)
949 break;
950
951 ret = copy_wc_to_user(data_ptr, &wc);
952 if (ret)
953 goto out_put;
929 954
930 for (i = 0; i < resp->count; i++) { 955 data_ptr += sizeof(struct ib_uverbs_wc);
931 resp->wc[i].wr_id = wc[i].wr_id; 956 ++resp.count;
932 resp->wc[i].status = wc[i].status;
933 resp->wc[i].opcode = wc[i].opcode;
934 resp->wc[i].vendor_err = wc[i].vendor_err;
935 resp->wc[i].byte_len = wc[i].byte_len;
936 resp->wc[i].ex.imm_data = (__u32 __force) wc[i].ex.imm_data;
937 resp->wc[i].qp_num = wc[i].qp->qp_num;
938 resp->wc[i].src_qp = wc[i].src_qp;
939 resp->wc[i].wc_flags = wc[i].wc_flags;
940 resp->wc[i].pkey_index = wc[i].pkey_index;
941 resp->wc[i].slid = wc[i].slid;
942 resp->wc[i].sl = wc[i].sl;
943 resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits;
944 resp->wc[i].port_num = wc[i].port_num;
945 } 957 }
946 958
947 if (copy_to_user((void __user *) (unsigned long) cmd.response, resp, rsize)) 959 if (copy_to_user(header_ptr, &resp, sizeof resp)) {
948 ret = -EFAULT; 960 ret = -EFAULT;
961 goto out_put;
962 }
949 963
950out: 964 ret = in_len;
951 kfree(resp);
952 965
953out_wc: 966out_put:
954 kfree(wc); 967 put_cq_read(cq);
955 return ret ? ret : in_len; 968 return ret;
956} 969}
957 970
958ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, 971ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file,
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 32d352a88d50..081d06110e33 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -383,7 +383,7 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb)
383 16)) | FW_WR_FLOWID(ep->hwtid)); 383 16)) | FW_WR_FLOWID(ep->hwtid));
384 384
385 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; 385 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
386 flowc->mnemval[0].val = cpu_to_be32(0); 386 flowc->mnemval[0].val = cpu_to_be32(PCI_FUNC(ep->com.dev->rdev.lldi.pdev->devfn) << 8);
387 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; 387 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
388 flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); 388 flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan);
389 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; 389 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index b95231763911..ee82851afe3e 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -55,6 +55,14 @@
55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
58/* MacbookAir3,2 (unibody), aka wellspring5 */
59#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
60#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
61#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
62/* MacbookAir3,1 (unibody), aka wellspring4 */
63#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
64#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
65#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
58 66
59#define BCM5974_DEVICE(prod) { \ 67#define BCM5974_DEVICE(prod) { \
60 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ 68 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -80,6 +88,14 @@ static const struct usb_device_id bcm5974_table[] = {
80 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), 88 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
81 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), 89 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
82 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), 90 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
91 /* MacbookAir3,2 */
92 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
93 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
94 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
95 /* MacbookAir3,1 */
96 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
97 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
98 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
83 /* Terminating entry */ 99 /* Terminating entry */
84 {} 100 {}
85}; 101};
@@ -234,6 +250,30 @@ static const struct bcm5974_config bcm5974_config_table[] = {
234 { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, 250 { DIM_X, DIM_X / SN_COORD, -4460, 5166 },
235 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } 251 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
236 }, 252 },
253 {
254 USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI,
255 USB_DEVICE_ID_APPLE_WELLSPRING4_ISO,
256 USB_DEVICE_ID_APPLE_WELLSPRING4_JIS,
257 HAS_INTEGRATED_BUTTON,
258 0x84, sizeof(struct bt_data),
259 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
260 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
261 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
262 { DIM_X, DIM_X / SN_COORD, -4620, 5140 },
263 { DIM_Y, DIM_Y / SN_COORD, -150, 6600 }
264 },
265 {
266 USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI,
267 USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO,
268 USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS,
269 HAS_INTEGRATED_BUTTON,
270 0x84, sizeof(struct bt_data),
271 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
272 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
273 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
274 { DIM_X, DIM_X / SN_COORD, -4616, 5112 },
275 { DIM_Y, DIM_Y / SN_COORD, -142, 5234 }
276 },
237 {} 277 {}
238}; 278};
239 279
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index b6aa7d20d8a3..298c8e505cc2 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -51,7 +51,8 @@
51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) 53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
54#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) 54#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */
55#define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */
55#define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) 56#define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000)
56 57
57/* synaptics modes query bits */ 58/* synaptics modes query bits */
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index ed7ad7416b24..a0730fdd31c4 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -333,6 +333,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
333 }, 333 },
334 }, 334 },
335 { 335 {
336 /* Sony Vaio VPCZ122GX */
337 .matches = {
338 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
339 DMI_MATCH(DMI_PRODUCT_NAME, "VPCZ122GX"),
340 },
341 },
342 {
336 /* Sony Vaio FS-115b */ 343 /* Sony Vaio FS-115b */
337 .matches = { 344 .matches = {
338 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 345 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
@@ -413,6 +420,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
413 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), 420 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
414 }, 421 },
415 }, 422 },
423 {
424 /* Dell Vostro V13 */
425 .matches = {
426 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
427 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
428 },
429 },
416 { } 430 { }
417}; 431};
418 432
@@ -534,6 +548,17 @@ static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
534}; 548};
535#endif 549#endif
536 550
551static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
552 {
553 /* Dell Vostro V13 */
554 .matches = {
555 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
556 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
557 },
558 },
559 { }
560};
561
537/* 562/*
538 * Some Wistron based laptops need us to explicitly enable the 'Dritek 563 * Some Wistron based laptops need us to explicitly enable the 'Dritek
539 * keyboard extension' to make their extra keys start generating scancodes. 564 * keyboard extension' to make their extra keys start generating scancodes.
@@ -886,6 +911,9 @@ static int __init i8042_platform_init(void)
886 if (dmi_check_system(i8042_dmi_nomux_table)) 911 if (dmi_check_system(i8042_dmi_nomux_table))
887 i8042_nomux = true; 912 i8042_nomux = true;
888 913
914 if (dmi_check_system(i8042_dmi_notimeout_table))
915 i8042_notimeout = true;
916
889 if (dmi_check_system(i8042_dmi_dritek_table)) 917 if (dmi_check_system(i8042_dmi_dritek_table))
890 i8042_dritek = true; 918 i8042_dritek = true;
891#endif /* CONFIG_X86 */ 919#endif /* CONFIG_X86 */
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index f58513160480..9e486502c03f 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -61,6 +61,10 @@ static bool i8042_noloop;
61module_param_named(noloop, i8042_noloop, bool, 0); 61module_param_named(noloop, i8042_noloop, bool, 0);
62MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); 62MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port");
63 63
64static bool i8042_notimeout;
65module_param_named(notimeout, i8042_notimeout, bool, 0);
66MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042");
67
64#ifdef CONFIG_X86 68#ifdef CONFIG_X86
65static bool i8042_dritek; 69static bool i8042_dritek;
66module_param_named(dritek, i8042_dritek, bool, 0); 70module_param_named(dritek, i8042_dritek, bool, 0);
@@ -503,7 +507,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
503 } else { 507 } else {
504 508
505 dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | 509 dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) |
506 ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); 510 ((str & I8042_STR_TIMEOUT && !i8042_notimeout) ? SERIO_TIMEOUT : 0);
507 511
508 port_no = (str & I8042_STR_AUXDATA) ? 512 port_no = (str & I8042_STR_AUXDATA) ?
509 I8042_AUX_PORT_NO : I8042_KBD_PORT_NO; 513 I8042_AUX_PORT_NO : I8042_KBD_PORT_NO;
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 707d9c94cf9e..131976d880d0 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -438,23 +438,27 @@ static void cmd_in_timeout(unsigned long data)
438 return; 438 return;
439 } 439 }
440 440
441 if (ucs->retry_cmd_in++ < BAS_RETRY) { 441 if (ucs->retry_cmd_in++ >= BAS_RETRY) {
442 dev_notice(cs->dev, "control read: timeout, retry %d\n",
443 ucs->retry_cmd_in);
444 rc = atread_submit(cs, BAS_TIMEOUT);
445 if (rc >= 0 || rc == -ENODEV)
446 /* resubmitted or disconnected */
447 /* - bypass regular exit block */
448 return;
449 } else {
450 dev_err(cs->dev, 442 dev_err(cs->dev,
451 "control read: timeout, giving up after %d tries\n", 443 "control read: timeout, giving up after %d tries\n",
452 ucs->retry_cmd_in); 444 ucs->retry_cmd_in);
445 kfree(ucs->rcvbuf);
446 ucs->rcvbuf = NULL;
447 ucs->rcvbuf_size = 0;
448 error_reset(cs);
449 return;
450 }
451
452 gig_dbg(DEBUG_USBREQ, "%s: timeout, retry %d",
453 __func__, ucs->retry_cmd_in);
454 rc = atread_submit(cs, BAS_TIMEOUT);
455 if (rc < 0) {
456 kfree(ucs->rcvbuf);
457 ucs->rcvbuf = NULL;
458 ucs->rcvbuf_size = 0;
459 if (rc != -ENODEV)
460 error_reset(cs);
453 } 461 }
454 kfree(ucs->rcvbuf);
455 ucs->rcvbuf = NULL;
456 ucs->rcvbuf_size = 0;
457 error_reset(cs);
458} 462}
459 463
460/* read_ctrl_callback 464/* read_ctrl_callback
@@ -470,18 +474,11 @@ static void read_ctrl_callback(struct urb *urb)
470 struct cardstate *cs = inbuf->cs; 474 struct cardstate *cs = inbuf->cs;
471 struct bas_cardstate *ucs = cs->hw.bas; 475 struct bas_cardstate *ucs = cs->hw.bas;
472 int status = urb->status; 476 int status = urb->status;
473 int have_data = 0;
474 unsigned numbytes; 477 unsigned numbytes;
475 int rc; 478 int rc;
476 479
477 update_basstate(ucs, 0, BS_ATRDPEND); 480 update_basstate(ucs, 0, BS_ATRDPEND);
478 wake_up(&ucs->waitqueue); 481 wake_up(&ucs->waitqueue);
479
480 if (!ucs->rcvbuf_size) {
481 dev_warn(cs->dev, "%s: no receive in progress\n", __func__);
482 return;
483 }
484
485 del_timer(&ucs->timer_cmd_in); 482 del_timer(&ucs->timer_cmd_in);
486 483
487 switch (status) { 484 switch (status) {
@@ -495,19 +492,10 @@ static void read_ctrl_callback(struct urb *urb)
495 numbytes = ucs->rcvbuf_size; 492 numbytes = ucs->rcvbuf_size;
496 } 493 }
497 494
498 /* copy received bytes to inbuf */ 495 /* copy received bytes to inbuf, notify event layer */
499 have_data = gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes); 496 if (gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes)) {
500 497 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
501 if (unlikely(numbytes < ucs->rcvbuf_size)) { 498 gigaset_schedule_event(cs);
502 /* incomplete - resubmit for remaining bytes */
503 ucs->rcvbuf_size -= numbytes;
504 ucs->retry_cmd_in = 0;
505 rc = atread_submit(cs, BAS_TIMEOUT);
506 if (rc >= 0 || rc == -ENODEV)
507 /* resubmitted or disconnected */
508 /* - bypass regular exit block */
509 return;
510 error_reset(cs);
511 } 499 }
512 break; 500 break;
513 501
@@ -516,37 +504,32 @@ static void read_ctrl_callback(struct urb *urb)
516 case -EINPROGRESS: /* pending */ 504 case -EINPROGRESS: /* pending */
517 case -ENODEV: /* device removed */ 505 case -ENODEV: /* device removed */
518 case -ESHUTDOWN: /* device shut down */ 506 case -ESHUTDOWN: /* device shut down */
519 /* no action necessary */ 507 /* no further action necessary */
520 gig_dbg(DEBUG_USBREQ, "%s: %s", 508 gig_dbg(DEBUG_USBREQ, "%s: %s",
521 __func__, get_usb_statmsg(status)); 509 __func__, get_usb_statmsg(status));
522 break; 510 break;
523 511
524 default: /* severe trouble */ 512 default: /* other errors: retry */
525 dev_warn(cs->dev, "control read: %s\n",
526 get_usb_statmsg(status));
527 if (ucs->retry_cmd_in++ < BAS_RETRY) { 513 if (ucs->retry_cmd_in++ < BAS_RETRY) {
528 dev_notice(cs->dev, "control read: retry %d\n", 514 gig_dbg(DEBUG_USBREQ, "%s: %s, retry %d", __func__,
529 ucs->retry_cmd_in); 515 get_usb_statmsg(status), ucs->retry_cmd_in);
530 rc = atread_submit(cs, BAS_TIMEOUT); 516 rc = atread_submit(cs, BAS_TIMEOUT);
531 if (rc >= 0 || rc == -ENODEV) 517 if (rc >= 0)
532 /* resubmitted or disconnected */ 518 /* successfully resubmitted, skip freeing */
533 /* - bypass regular exit block */
534 return; 519 return;
535 } else { 520 if (rc == -ENODEV)
536 dev_err(cs->dev, 521 /* disconnect, no further action necessary */
537 "control read: giving up after %d tries\n", 522 break;
538 ucs->retry_cmd_in);
539 } 523 }
524 dev_err(cs->dev, "control read: %s, giving up after %d tries\n",
525 get_usb_statmsg(status), ucs->retry_cmd_in);
540 error_reset(cs); 526 error_reset(cs);
541 } 527 }
542 528
529 /* read finished, free buffer */
543 kfree(ucs->rcvbuf); 530 kfree(ucs->rcvbuf);
544 ucs->rcvbuf = NULL; 531 ucs->rcvbuf = NULL;
545 ucs->rcvbuf_size = 0; 532 ucs->rcvbuf_size = 0;
546 if (have_data) {
547 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
548 gigaset_schedule_event(cs);
549 }
550} 533}
551 534
552/* atread_submit 535/* atread_submit
@@ -1598,13 +1581,13 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1598 1581
1599 ret = starturbs(bcs); 1582 ret = starturbs(bcs);
1600 if (ret < 0) { 1583 if (ret < 0) {
1584 spin_unlock_irqrestore(&cs->lock, flags);
1601 dev_err(cs->dev, 1585 dev_err(cs->dev,
1602 "could not start isochronous I/O for channel B%d: %s\n", 1586 "could not start isochronous I/O for channel B%d: %s\n",
1603 bcs->channel + 1, 1587 bcs->channel + 1,
1604 ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); 1588 ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret));
1605 if (ret != -ENODEV) 1589 if (ret != -ENODEV)
1606 error_hangup(bcs); 1590 error_hangup(bcs);
1607 spin_unlock_irqrestore(&cs->lock, flags);
1608 return ret; 1591 return ret;
1609 } 1592 }
1610 1593
@@ -1614,11 +1597,11 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1614 dev_err(cs->dev, "could not open channel B%d\n", 1597 dev_err(cs->dev, "could not open channel B%d\n",
1615 bcs->channel + 1); 1598 bcs->channel + 1);
1616 stopurbs(bcs->hw.bas); 1599 stopurbs(bcs->hw.bas);
1617 if (ret != -ENODEV)
1618 error_hangup(bcs);
1619 } 1600 }
1620 1601
1621 spin_unlock_irqrestore(&cs->lock, flags); 1602 spin_unlock_irqrestore(&cs->lock, flags);
1603 if (ret < 0 && ret != -ENODEV)
1604 error_hangup(bcs);
1622 return ret; 1605 return ret;
1623} 1606}
1624 1607
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 2dfd346fc889..f39ccdf87a17 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count,
842 842
843 if (unlikely(bcs->ignore)) { 843 if (unlikely(bcs->ignore)) {
844 bcs->ignore--; 844 bcs->ignore--;
845 hdlc_flush(bcs);
846 return; 845 return;
847 } 846 }
848 skb = bcs->rx_skb; 847 skb = bcs->rx_skb;
849 if (skb == NULL) 848 if (skb == NULL) {
850 skb = gigaset_new_rx_skb(bcs); 849 skb = gigaset_new_rx_skb(bcs);
851 bcs->hw.bas->goodbytes += skb->len; 850 if (skb == NULL)
851 return;
852 }
852 dobytes = bcs->rx_bufsize - skb->len; 853 dobytes = bcs->rx_bufsize - skb->len;
853 while (count > 0) { 854 while (count > 0) {
854 dst = skb_put(skb, count < dobytes ? count : dobytes); 855 dst = skb_put(skb, count < dobytes ? count : dobytes);
@@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
860 if (dobytes == 0) { 861 if (dobytes == 0) {
861 dump_bytes(DEBUG_STREAM_DUMP, 862 dump_bytes(DEBUG_STREAM_DUMP,
862 "rcv data", skb->data, skb->len); 863 "rcv data", skb->data, skb->len);
864 bcs->hw.bas->goodbytes += skb->len;
863 gigaset_skb_rcvd(bcs, skb); 865 gigaset_skb_rcvd(bcs, skb);
864 skb = gigaset_new_rx_skb(bcs); 866 skb = gigaset_new_rx_skb(bcs);
865 if (skb == NULL) 867 if (skb == NULL)
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
index a688293abd0b..614ebebaaa28 100644
--- a/drivers/leds/leds-ss4200.c
+++ b/drivers/leds/leds-ss4200.c
@@ -102,6 +102,7 @@ static struct dmi_system_id __initdata nas_led_whitelist[] = {
102 DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") 102 DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00")
103 } 103 }
104 }, 104 },
105 {}
105}; 106};
106 107
107/* 108/*
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 487ecda90ad4..406091f9692b 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -33,7 +33,6 @@ struct pgpath {
33 unsigned fail_count; /* Cumulative failure count */ 33 unsigned fail_count; /* Cumulative failure count */
34 34
35 struct dm_path path; 35 struct dm_path path;
36 struct work_struct deactivate_path;
37 struct work_struct activate_path; 36 struct work_struct activate_path;
38}; 37};
39 38
@@ -116,7 +115,6 @@ static struct workqueue_struct *kmultipathd, *kmpath_handlerd;
116static void process_queued_ios(struct work_struct *work); 115static void process_queued_ios(struct work_struct *work);
117static void trigger_event(struct work_struct *work); 116static void trigger_event(struct work_struct *work);
118static void activate_path(struct work_struct *work); 117static void activate_path(struct work_struct *work);
119static void deactivate_path(struct work_struct *work);
120 118
121 119
122/*----------------------------------------------- 120/*-----------------------------------------------
@@ -129,7 +127,6 @@ static struct pgpath *alloc_pgpath(void)
129 127
130 if (pgpath) { 128 if (pgpath) {
131 pgpath->is_active = 1; 129 pgpath->is_active = 1;
132 INIT_WORK(&pgpath->deactivate_path, deactivate_path);
133 INIT_WORK(&pgpath->activate_path, activate_path); 130 INIT_WORK(&pgpath->activate_path, activate_path);
134 } 131 }
135 132
@@ -141,14 +138,6 @@ static void free_pgpath(struct pgpath *pgpath)
141 kfree(pgpath); 138 kfree(pgpath);
142} 139}
143 140
144static void deactivate_path(struct work_struct *work)
145{
146 struct pgpath *pgpath =
147 container_of(work, struct pgpath, deactivate_path);
148
149 blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue);
150}
151
152static struct priority_group *alloc_priority_group(void) 141static struct priority_group *alloc_priority_group(void)
153{ 142{
154 struct priority_group *pg; 143 struct priority_group *pg;
@@ -995,7 +984,6 @@ static int fail_path(struct pgpath *pgpath)
995 pgpath->path.dev->name, m->nr_valid_paths); 984 pgpath->path.dev->name, m->nr_valid_paths);
996 985
997 schedule_work(&m->trigger_event); 986 schedule_work(&m->trigger_event);
998 queue_work(kmultipathd, &pgpath->deactivate_path);
999 987
1000out: 988out:
1001 spin_unlock_irqrestore(&m->lock, flags); 989 spin_unlock_irqrestore(&m->lock, flags);
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f9fc07d7a4b9..87e4e78790c0 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1136,11 +1136,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1136 */ 1136 */
1137 q->limits = *limits; 1137 q->limits = *limits;
1138 1138
1139 if (limits->no_cluster)
1140 queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q);
1141 else
1142 queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q);
1143
1144 if (!dm_table_supports_discards(t)) 1139 if (!dm_table_supports_discards(t))
1145 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); 1140 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q);
1146 else 1141 else
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index ac384b2a6a33..a173db5fc76a 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2111,13 +2111,14 @@ static void event_callback(void *context)
2111 wake_up(&md->eventq); 2111 wake_up(&md->eventq);
2112} 2112}
2113 2113
2114/*
2115 * Protected by md->suspend_lock obtained by dm_swap_table().
2116 */
2114static void __set_size(struct mapped_device *md, sector_t size) 2117static void __set_size(struct mapped_device *md, sector_t size)
2115{ 2118{
2116 set_capacity(md->disk, size); 2119 set_capacity(md->disk, size);
2117 2120
2118 mutex_lock(&md->bdev->bd_inode->i_mutex);
2119 i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); 2121 i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
2120 mutex_unlock(&md->bdev->bd_inode->i_mutex);
2121} 2122}
2122 2123
2123/* 2124/*
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f20d13e717d5..012859708a1b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -220,11 +220,14 @@ static int md_make_request(struct request_queue *q, struct bio *bio)
220 mddev_t *mddev = q->queuedata; 220 mddev_t *mddev = q->queuedata;
221 int rv; 221 int rv;
222 int cpu; 222 int cpu;
223 unsigned int sectors;
223 224
224 if (mddev == NULL || mddev->pers == NULL) { 225 if (mddev == NULL || mddev->pers == NULL
226 || !mddev->ready) {
225 bio_io_error(bio); 227 bio_io_error(bio);
226 return 0; 228 return 0;
227 } 229 }
230 smp_rmb(); /* Ensure implications of 'active' are visible */
228 rcu_read_lock(); 231 rcu_read_lock();
229 if (mddev->suspended || mddev->barrier) { 232 if (mddev->suspended || mddev->barrier) {
230 DEFINE_WAIT(__wait); 233 DEFINE_WAIT(__wait);
@@ -242,12 +245,16 @@ static int md_make_request(struct request_queue *q, struct bio *bio)
242 atomic_inc(&mddev->active_io); 245 atomic_inc(&mddev->active_io);
243 rcu_read_unlock(); 246 rcu_read_unlock();
244 247
248 /*
249 * save the sectors now since our bio can
250 * go away inside make_request
251 */
252 sectors = bio_sectors(bio);
245 rv = mddev->pers->make_request(mddev, bio); 253 rv = mddev->pers->make_request(mddev, bio);
246 254
247 cpu = part_stat_lock(); 255 cpu = part_stat_lock();
248 part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); 256 part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
249 part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], 257 part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors);
250 bio_sectors(bio));
251 part_stat_unlock(); 258 part_stat_unlock();
252 259
253 if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) 260 if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
@@ -1329,7 +1336,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
1329 md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, 1336 md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
1330 rdev->sb_page); 1337 rdev->sb_page);
1331 md_super_wait(rdev->mddev); 1338 md_super_wait(rdev->mddev);
1332 return num_sectors / 2; /* kB for sysfs */ 1339 return num_sectors;
1333} 1340}
1334 1341
1335 1342
@@ -1697,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
1697 md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, 1704 md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
1698 rdev->sb_page); 1705 rdev->sb_page);
1699 md_super_wait(rdev->mddev); 1706 md_super_wait(rdev->mddev);
1700 return num_sectors / 2; /* kB for sysfs */ 1707 return num_sectors;
1701} 1708}
1702 1709
1703static struct super_type super_types[] = { 1710static struct super_type super_types[] = {
@@ -2172,6 +2179,8 @@ repeat:
2172 if (!mddev->persistent) { 2179 if (!mddev->persistent) {
2173 clear_bit(MD_CHANGE_CLEAN, &mddev->flags); 2180 clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
2174 clear_bit(MD_CHANGE_DEVS, &mddev->flags); 2181 clear_bit(MD_CHANGE_DEVS, &mddev->flags);
2182 if (!mddev->external)
2183 clear_bit(MD_CHANGE_PENDING, &mddev->flags);
2175 wake_up(&mddev->sb_wait); 2184 wake_up(&mddev->sb_wait);
2176 return; 2185 return;
2177 } 2186 }
@@ -3107,7 +3116,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
3107 char nm[20]; 3116 char nm[20];
3108 if (rdev->raid_disk < 0) 3117 if (rdev->raid_disk < 0)
3109 continue; 3118 continue;
3110 if (rdev->new_raid_disk > mddev->raid_disks) 3119 if (rdev->new_raid_disk >= mddev->raid_disks)
3111 rdev->new_raid_disk = -1; 3120 rdev->new_raid_disk = -1;
3112 if (rdev->new_raid_disk == rdev->raid_disk) 3121 if (rdev->new_raid_disk == rdev->raid_disk)
3113 continue; 3122 continue;
@@ -4287,9 +4296,6 @@ static int md_alloc(dev_t dev, char *name)
4287 goto abort; 4296 goto abort;
4288 mddev->queue->queuedata = mddev; 4297 mddev->queue->queuedata = mddev;
4289 4298
4290 /* Can be unlocked because the queue is new: no concurrency */
4291 queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, mddev->queue);
4292
4293 blk_queue_make_request(mddev->queue, md_make_request); 4299 blk_queue_make_request(mddev->queue, md_make_request);
4294 4300
4295 disk = alloc_disk(1 << shift); 4301 disk = alloc_disk(1 << shift);
@@ -4555,7 +4561,8 @@ int md_run(mddev_t *mddev)
4555 mddev->safemode_timer.data = (unsigned long) mddev; 4561 mddev->safemode_timer.data = (unsigned long) mddev;
4556 mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ 4562 mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */
4557 mddev->in_sync = 1; 4563 mddev->in_sync = 1;
4558 4564 smp_wmb();
4565 mddev->ready = 1;
4559 list_for_each_entry(rdev, &mddev->disks, same_set) 4566 list_for_each_entry(rdev, &mddev->disks, same_set)
4560 if (rdev->raid_disk >= 0) { 4567 if (rdev->raid_disk >= 0) {
4561 char nm[20]; 4568 char nm[20];
@@ -4717,6 +4724,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes);
4717 4724
4718void md_stop(mddev_t *mddev) 4725void md_stop(mddev_t *mddev)
4719{ 4726{
4727 mddev->ready = 0;
4720 mddev->pers->stop(mddev); 4728 mddev->pers->stop(mddev);
4721 if (mddev->pers->sync_request && mddev->to_remove == NULL) 4729 if (mddev->pers->sync_request && mddev->to_remove == NULL)
4722 mddev->to_remove = &md_redundancy_group; 4730 mddev->to_remove = &md_redundancy_group;
@@ -5148,17 +5156,21 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
5148 PTR_ERR(rdev)); 5156 PTR_ERR(rdev));
5149 return PTR_ERR(rdev); 5157 return PTR_ERR(rdev);
5150 } 5158 }
5151 /* set save_raid_disk if appropriate */ 5159 /* set saved_raid_disk if appropriate */
5152 if (!mddev->persistent) { 5160 if (!mddev->persistent) {
5153 if (info->state & (1<<MD_DISK_SYNC) && 5161 if (info->state & (1<<MD_DISK_SYNC) &&
5154 info->raid_disk < mddev->raid_disks) 5162 info->raid_disk < mddev->raid_disks) {
5155 rdev->raid_disk = info->raid_disk; 5163 rdev->raid_disk = info->raid_disk;
5156 else 5164 set_bit(In_sync, &rdev->flags);
5165 } else
5157 rdev->raid_disk = -1; 5166 rdev->raid_disk = -1;
5158 } else 5167 } else
5159 super_types[mddev->major_version]. 5168 super_types[mddev->major_version].
5160 validate_super(mddev, rdev); 5169 validate_super(mddev, rdev);
5161 rdev->saved_raid_disk = rdev->raid_disk; 5170 if (test_bit(In_sync, &rdev->flags))
5171 rdev->saved_raid_disk = rdev->raid_disk;
5172 else
5173 rdev->saved_raid_disk = -1;
5162 5174
5163 clear_bit(In_sync, &rdev->flags); /* just to be sure */ 5175 clear_bit(In_sync, &rdev->flags); /* just to be sure */
5164 if (info->state & (1<<MD_DISK_WRITEMOSTLY)) 5176 if (info->state & (1<<MD_DISK_WRITEMOSTLY))
@@ -6036,8 +6048,8 @@ static int md_thread(void * arg)
6036 thread->timeout); 6048 thread->timeout);
6037 6049
6038 clear_bit(THREAD_WAKEUP, &thread->flags); 6050 clear_bit(THREAD_WAKEUP, &thread->flags);
6039 6051 if (!kthread_should_stop())
6040 thread->run(thread->mddev); 6052 thread->run(thread->mddev);
6041 } 6053 }
6042 6054
6043 return 0; 6055 return 0;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 3931299788dc..563ede31d5fc 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -149,7 +149,8 @@ struct mddev_s
149 * are happening, so run/ 149 * are happening, so run/
150 * takeover/stop are not safe 150 * takeover/stop are not safe
151 */ 151 */
152 152 int ready; /* See when safe to pass
153 * IO requests down */
153 struct gendisk *gendisk; 154 struct gendisk *gendisk;
154 155
155 struct kobject kobj; 156 struct kobject kobj;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 0b830bbe1d8b..d8b2d7b0c3be 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1210,6 +1210,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
1210 * is not possible. 1210 * is not possible.
1211 */ 1211 */
1212 if (!test_bit(Faulty, &rdev->flags) && 1212 if (!test_bit(Faulty, &rdev->flags) &&
1213 !mddev->recovery_disabled &&
1213 mddev->degraded < conf->raid_disks) { 1214 mddev->degraded < conf->raid_disks) {
1214 err = -EBUSY; 1215 err = -EBUSY;
1215 goto abort; 1216 goto abort;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 84718383124d..838c275fd3c8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2396,13 +2396,13 @@ static int run(mddev_t *mddev)
2396 return 0; 2396 return 0;
2397 2397
2398out_free_conf: 2398out_free_conf:
2399 md_unregister_thread(mddev->thread);
2399 if (conf->r10bio_pool) 2400 if (conf->r10bio_pool)
2400 mempool_destroy(conf->r10bio_pool); 2401 mempool_destroy(conf->r10bio_pool);
2401 safe_put_page(conf->tmppage); 2402 safe_put_page(conf->tmppage);
2402 kfree(conf->mirrors); 2403 kfree(conf->mirrors);
2403 kfree(conf); 2404 kfree(conf);
2404 mddev->private = NULL; 2405 mddev->private = NULL;
2405 md_unregister_thread(mddev->thread);
2406out: 2406out:
2407 return -EIO; 2407 return -EIO;
2408} 2408}
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c
index 05bde9ccb770..1d1d8d200755 100644
--- a/drivers/media/common/saa7146_hlp.c
+++ b/drivers/media/common/saa7146_hlp.c
@@ -558,7 +558,7 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e
558static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) 558static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat)
559{ 559{
560 struct saa7146_vv *vv = dev->vv_data; 560 struct saa7146_vv *vv = dev->vv_data;
561 struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); 561 struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev, pixelformat);
562 562
563 int b_depth = vv->ov_fmt->depth; 563 int b_depth = vv->ov_fmt->depth;
564 int b_bpl = vv->ov_fb.fmt.bytesperline; 564 int b_bpl = vv->ov_fb.fmt.bytesperline;
@@ -702,7 +702,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71
702 struct saa7146_vv *vv = dev->vv_data; 702 struct saa7146_vv *vv = dev->vv_data;
703 struct saa7146_video_dma vdma1; 703 struct saa7146_video_dma vdma1;
704 704
705 struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); 705 struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat);
706 706
707 int width = buf->fmt->width; 707 int width = buf->fmt->width;
708 int height = buf->fmt->height; 708 int height = buf->fmt->height;
@@ -827,7 +827,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71
827 struct saa7146_video_dma vdma2; 827 struct saa7146_video_dma vdma2;
828 struct saa7146_video_dma vdma3; 828 struct saa7146_video_dma vdma3;
829 829
830 struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); 830 struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat);
831 831
832 int width = buf->fmt->width; 832 int width = buf->fmt->width;
833 int height = buf->fmt->height; 833 int height = buf->fmt->height;
@@ -994,7 +994,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
994 994
995void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) 995void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
996{ 996{
997 struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); 997 struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat);
998 struct saa7146_vv *vv = dev->vv_data; 998 struct saa7146_vv *vv = dev->vv_data;
999 u32 vdma1_prot_addr; 999 u32 vdma1_prot_addr;
1000 1000
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index a212a91a30f0..5f01da182aff 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -84,7 +84,7 @@ static struct saa7146_format formats[] = {
84 84
85static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); 85static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format);
86 86
87struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) 87struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc)
88{ 88{
89 int i, j = NUM_FORMATS; 89 int i, j = NUM_FORMATS;
90 90
@@ -266,7 +266,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
266 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 266 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
267 struct scatterlist *list = dma->sglist; 267 struct scatterlist *list = dma->sglist;
268 int length = dma->sglen; 268 int length = dma->sglen;
269 struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); 269 struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat);
270 270
271 DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); 271 DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length));
272 272
@@ -408,7 +408,7 @@ static int video_begin(struct saa7146_fh *fh)
408 } 408 }
409 } 409 }
410 410
411 fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); 411 fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat);
412 /* we need to have a valid format set here */ 412 /* we need to have a valid format set here */
413 BUG_ON(NULL == fmt); 413 BUG_ON(NULL == fmt);
414 414
@@ -460,7 +460,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
460 return -EBUSY; 460 return -EBUSY;
461 } 461 }
462 462
463 fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); 463 fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat);
464 /* we need to have a valid format set here */ 464 /* we need to have a valid format set here */
465 BUG_ON(NULL == fmt); 465 BUG_ON(NULL == fmt);
466 466
@@ -536,7 +536,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
536 return -EPERM; 536 return -EPERM;
537 537
538 /* check args */ 538 /* check args */
539 fmt = format_by_fourcc(dev, fb->fmt.pixelformat); 539 fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat);
540 if (NULL == fmt) 540 if (NULL == fmt)
541 return -EINVAL; 541 return -EINVAL;
542 542
@@ -760,7 +760,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
760 760
761 DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); 761 DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh));
762 762
763 fmt = format_by_fourcc(dev, f->fmt.pix.pixelformat); 763 fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat);
764 if (NULL == fmt) 764 if (NULL == fmt)
765 return -EINVAL; 765 return -EINVAL;
766 766
@@ -1264,7 +1264,7 @@ static int buffer_prepare(struct videobuf_queue *q,
1264 buf->fmt = &fh->video_fmt; 1264 buf->fmt = &fh->video_fmt;
1265 buf->vb.field = fh->video_fmt.field; 1265 buf->vb.field = fh->video_fmt.field;
1266 1266
1267 sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); 1267 sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat);
1268 1268
1269 release_all_pagetables(dev, buf); 1269 release_all_pagetables(dev, buf);
1270 if( 0 != IS_PLANAR(sfmt->trans)) { 1270 if( 0 != IS_PLANAR(sfmt->trans)) {
@@ -1378,7 +1378,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
1378 fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; 1378 fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24;
1379 fh->video_fmt.bytesperline = 0; 1379 fh->video_fmt.bytesperline = 0;
1380 fh->video_fmt.field = V4L2_FIELD_ANY; 1380 fh->video_fmt.field = V4L2_FIELD_ANY;
1381 sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); 1381 sfmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat);
1382 fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; 1382 fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8;
1383 1383
1384 videobuf_queue_sg_init(&fh->video_q, &video_qops, 1384 videobuf_queue_sg_init(&fh->video_q, &video_qops,
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 5bf4985daede..19448144eb3a 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -31,7 +31,6 @@
31#include <linux/module.h> /* Modules */ 31#include <linux/module.h> /* Modules */
32#include <linux/init.h> /* Initdata */ 32#include <linux/init.h> /* Initdata */
33#include <linux/ioport.h> /* request_region */ 33#include <linux/ioport.h> /* request_region */
34#include <linux/delay.h> /* udelay */
35#include <linux/videodev2.h> /* kernel radio structs */ 34#include <linux/videodev2.h> /* kernel radio structs */
36#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 35#include <linux/version.h> /* for KERNEL_VERSION MACRO */
37#include <linux/io.h> /* outb, outb_p */ 36#include <linux/io.h> /* outb, outb_p */
@@ -71,27 +70,17 @@ static struct rtrack rtrack_card;
71 70
72/* local things */ 71/* local things */
73 72
74static void sleep_delay(long n)
75{
76 /* Sleep nicely for 'n' uS */
77 int d = n / msecs_to_jiffies(1000);
78 if (!d)
79 udelay(n);
80 else
81 msleep(jiffies_to_msecs(d));
82}
83
84static void rt_decvol(struct rtrack *rt) 73static void rt_decvol(struct rtrack *rt)
85{ 74{
86 outb(0x58, rt->io); /* volume down + sigstr + on */ 75 outb(0x58, rt->io); /* volume down + sigstr + on */
87 sleep_delay(100000); 76 msleep(100);
88 outb(0xd8, rt->io); /* volume steady + sigstr + on */ 77 outb(0xd8, rt->io); /* volume steady + sigstr + on */
89} 78}
90 79
91static void rt_incvol(struct rtrack *rt) 80static void rt_incvol(struct rtrack *rt)
92{ 81{
93 outb(0x98, rt->io); /* volume up + sigstr + on */ 82 outb(0x98, rt->io); /* volume up + sigstr + on */
94 sleep_delay(100000); 83 msleep(100);
95 outb(0xd8, rt->io); /* volume steady + sigstr + on */ 84 outb(0xd8, rt->io); /* volume steady + sigstr + on */
96} 85}
97 86
@@ -120,7 +109,7 @@ static int rt_setvol(struct rtrack *rt, int vol)
120 109
121 if (vol == 0) { /* volume = 0 means mute the card */ 110 if (vol == 0) { /* volume = 0 means mute the card */
122 outb(0x48, rt->io); /* volume down but still "on" */ 111 outb(0x48, rt->io); /* volume down but still "on" */
123 sleep_delay(2000000); /* make sure it's totally down */ 112 msleep(2000); /* make sure it's totally down */
124 outb(0xd0, rt->io); /* volume steady, off */ 113 outb(0xd0, rt->io); /* volume steady, off */
125 rt->curvol = 0; /* track the volume state! */ 114 rt->curvol = 0; /* track the volume state! */
126 mutex_unlock(&rt->lock); 115 mutex_unlock(&rt->lock);
@@ -155,7 +144,7 @@ static void send_0_byte(struct rtrack *rt)
155 outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */ 144 outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */
156 outb_p(128+64+16+8+2+1, rt->io); /* clock */ 145 outb_p(128+64+16+8+2+1, rt->io); /* clock */
157 } 146 }
158 sleep_delay(1000); 147 msleep(1);
159} 148}
160 149
161static void send_1_byte(struct rtrack *rt) 150static void send_1_byte(struct rtrack *rt)
@@ -169,7 +158,7 @@ static void send_1_byte(struct rtrack *rt)
169 outb_p(128+64+16+8+4+2+1, rt->io); /* clock */ 158 outb_p(128+64+16+8+4+2+1, rt->io); /* clock */
170 } 159 }
171 160
172 sleep_delay(1000); 161 msleep(1);
173} 162}
174 163
175static int rt_setfreq(struct rtrack *rt, unsigned long freq) 164static int rt_setfreq(struct rtrack *rt, unsigned long freq)
@@ -427,7 +416,7 @@ static int __init rtrack_init(void)
427 416
428 /* this ensures that the volume is all the way down */ 417 /* this ensures that the volume is all the way down */
429 outb(0x48, rt->io); /* volume down but still "on" */ 418 outb(0x48, rt->io); /* volume down but still "on" */
430 sleep_delay(2000000); /* make sure it's totally down */ 419 msleep(2000); /* make sure it's totally down */
431 outb(0xc0, rt->io); /* steady volume, mute card */ 420 outb(0xc0, rt->io); /* steady volume, mute card */
432 421
433 return 0; 422 return 0;
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index f6b62e7398af..11c987eb6df9 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -815,6 +815,7 @@ static void cx23885_dev_checkrevision(struct cx23885_dev *dev)
815 case 0x0e: 815 case 0x0e:
816 /* CX23887-15Z */ 816 /* CX23887-15Z */
817 dev->hwrevision = 0xc0; 817 dev->hwrevision = 0xc0;
818 break;
818 case 0x0f: 819 case 0x0f:
819 /* CX23887-14Z */ 820 /* CX23887-14Z */
820 dev->hwrevision = 0xb1; 821 dev->hwrevision = 0xb1;
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index e7efb4bffabd..6e80376b8410 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1621,11 +1621,11 @@ struct em28xx_board em28xx_boards[] = {
1621 .input = { { 1621 .input = { {
1622 .type = EM28XX_VMUX_COMPOSITE1, 1622 .type = EM28XX_VMUX_COMPOSITE1,
1623 .vmux = SAA7115_COMPOSITE0, 1623 .vmux = SAA7115_COMPOSITE0,
1624 .amux = EM28XX_AMUX_VIDEO2, 1624 .amux = EM28XX_AMUX_LINE_IN,
1625 }, { 1625 }, {
1626 .type = EM28XX_VMUX_SVIDEO, 1626 .type = EM28XX_VMUX_SVIDEO,
1627 .vmux = SAA7115_SVIDEO3, 1627 .vmux = SAA7115_SVIDEO3,
1628 .amux = EM28XX_AMUX_VIDEO2, 1628 .amux = EM28XX_AMUX_LINE_IN,
1629 } }, 1629 } },
1630 }, 1630 },
1631 [EM2860_BOARD_TERRATEC_AV350] = { 1631 [EM2860_BOARD_TERRATEC_AV350] = {
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 78abc1c1f9d5..a50bf65de06e 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -652,7 +652,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
652 : USB_ENDPOINT_XFER_ISOC; 652 : USB_ENDPOINT_XFER_ISOC;
653 i = gspca_dev->alt; /* previous alt setting */ 653 i = gspca_dev->alt; /* previous alt setting */
654 if (gspca_dev->cam.reverse_alts) { 654 if (gspca_dev->cam.reverse_alts) {
655 if (gspca_dev->audio) 655 if (gspca_dev->audio && i < gspca_dev->nbalt - 2)
656 i++; 656 i++;
657 while (++i < gspca_dev->nbalt) { 657 while (++i < gspca_dev->nbalt) {
658 ep = alt_xfer(&intf->altsetting[i], xfer); 658 ep = alt_xfer(&intf->altsetting[i], xfer);
@@ -660,7 +660,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
660 break; 660 break;
661 } 661 }
662 } else { 662 } else {
663 if (gspca_dev->audio) 663 if (gspca_dev->audio && i > 1)
664 i--; 664 i--;
665 while (--i >= 0) { 665 while (--i >= 0) {
666 ep = alt_xfer(&intf->altsetting[i], xfer); 666 ep = alt_xfer(&intf->altsetting[i], xfer);
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 370544361be2..248c2e62b278 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -56,6 +56,7 @@ struct sd {
56 u8 jpegqual; /* webcam quality */ 56 u8 jpegqual; /* webcam quality */
57 57
58 u8 reg18; 58 u8 reg18;
59 u8 flags;
59 60
60 s8 ag_cnt; 61 s8 ag_cnt;
61#define AG_CNT_START 13 62#define AG_CNT_START 13
@@ -87,6 +88,9 @@ enum sensors {
87 SENSOR_SP80708, 88 SENSOR_SP80708,
88}; 89};
89 90
91/* device flags */
92#define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */
93
90/* V4L2 controls supported by the driver */ 94/* V4L2 controls supported by the driver */
91static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); 95static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
92static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); 96static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
@@ -1777,7 +1781,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
1777 struct cam *cam; 1781 struct cam *cam;
1778 1782
1779 sd->bridge = id->driver_info >> 16; 1783 sd->bridge = id->driver_info >> 16;
1780 sd->sensor = id->driver_info; 1784 sd->sensor = id->driver_info >> 8;
1785 sd->flags = id->driver_info;
1781 1786
1782 cam = &gspca_dev->cam; 1787 cam = &gspca_dev->cam;
1783 if (sd->sensor == SENSOR_ADCM1700) { 1788 if (sd->sensor == SENSOR_ADCM1700) {
@@ -2474,8 +2479,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2474 reg1 = 0x44; 2479 reg1 = 0x44;
2475 reg17 = 0xa2; 2480 reg17 = 0xa2;
2476 break; 2481 break;
2477 default: 2482 case SENSOR_SP80708:
2478/* case SENSOR_SP80708: */
2479 init = sp80708_sensor_param1; 2483 init = sp80708_sensor_param1;
2480 if (mode) { 2484 if (mode) {
2481/*?? reg1 = 0x04; * 320 clk 48Mhz */ 2485/*?? reg1 = 0x04; * 320 clk 48Mhz */
@@ -2985,14 +2989,18 @@ static const struct sd_desc sd_desc = {
2985/* -- module initialisation -- */ 2989/* -- module initialisation -- */
2986#define BS(bridge, sensor) \ 2990#define BS(bridge, sensor) \
2987 .driver_info = (BRIDGE_ ## bridge << 16) \ 2991 .driver_info = (BRIDGE_ ## bridge << 16) \
2988 | SENSOR_ ## sensor 2992 | (SENSOR_ ## sensor << 8)
2993#define BSF(bridge, sensor, flags) \
2994 .driver_info = (BRIDGE_ ## bridge << 16) \
2995 | (SENSOR_ ## sensor << 8) \
2996 | (flags)
2989static const __devinitdata struct usb_device_id device_table[] = { 2997static const __devinitdata struct usb_device_id device_table[] = {
2990#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 2998#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2991 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, 2999 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)},
2992 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, 3000 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
2993#endif 3001#endif
2994 {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, 3002 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)},
2995 {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, 3003 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)},
2996 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, 3004 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)},
2997 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, 3005 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)},
2998 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, 3006 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index 4863a21b1f24..93f795960a94 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -157,6 +157,7 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count)
157 mem, dev->bulk_in_size, 157 mem, dev->bulk_in_size,
158 hdpvr_read_bulk_callback, buf); 158 hdpvr_read_bulk_callback, buf);
159 159
160 buf->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
160 buf->status = BUFSTAT_AVAILABLE; 161 buf->status = BUFSTAT_AVAILABLE;
161 list_add_tail(&buf->buff_list, &dev->free_buff_list); 162 list_add_tail(&buf->buff_list, &dev->free_buff_list);
162 } 163 }
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 0e412131da7c..4897d90f6a25 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -382,7 +382,12 @@ static int msp_s_ctrl(struct v4l2_ctrl *ctrl)
382 382
383void msp_update_volume(struct msp_state *state) 383void msp_update_volume(struct msp_state *state)
384{ 384{
385 v4l2_ctrl_s_ctrl(state->volume, v4l2_ctrl_g_ctrl(state->volume)); 385 /* Force an update of the volume/mute cluster */
386 v4l2_ctrl_lock(state->volume);
387 state->volume->val = state->volume->cur.val;
388 state->muted->val = state->muted->cur.val;
389 msp_s_ctrl(state->volume);
390 v4l2_ctrl_unlock(state->volume);
386} 391}
387 392
388/* --- v4l2 ioctls --- */ 393/* --- v4l2 ioctls --- */
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index b6ea67221d1d..15cb5b3f8ac2 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -791,8 +791,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd,
791 791
792 if (common_flags & SOCAM_PCLK_SAMPLE_RISING) 792 if (common_flags & SOCAM_PCLK_SAMPLE_RISING)
793 csicr1 |= CSICR1_REDGE; 793 csicr1 |= CSICR1_REDGE;
794 if (common_flags & SOCAM_PCLK_SAMPLE_FALLING)
795 csicr1 |= CSICR1_INV_PCLK;
796 if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) 794 if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH)
797 csicr1 |= CSICR1_SOF_POL; 795 csicr1 |= CSICR1_SOF_POL;
798 if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) 796 if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH)
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index bb8d83d8ddaf..7c74751d299e 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = {
6661 .subdevice = 0x2804, 6661 .subdevice = 0x2804,
6662 .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, 6662 .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000,
6663 }, { 6663 }, {
6664 .vendor = PCI_VENDOR_ID_PHILIPS,
6665 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
6666 .subvendor = 0x5ace, /* Beholder Intl. Ltd. */
6667 .subdevice = 0x7190,
6668 .driver_data = SAA7134_BOARD_BEHOLD_H7,
6669 }, {
6670 .vendor = PCI_VENDOR_ID_PHILIPS,
6671 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
6672 .subvendor = 0x5ace, /* Beholder Intl. Ltd. */
6673 .subdevice = 0x7090,
6674 .driver_data = SAA7134_BOARD_BEHOLD_A7,
6675 }, {
6664 /* --- boards without eeprom + subsystem ID --- */ 6676 /* --- boards without eeprom + subsystem ID --- */
6665 .vendor = PCI_VENDOR_ID_PHILIPS, 6677 .vendor = PCI_VENDOR_ID_PHILIPS,
6666 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 6678 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -6698,18 +6710,6 @@ struct pci_device_id saa7134_pci_tbl[] = {
6698 .subvendor = PCI_ANY_ID, 6710 .subvendor = PCI_ANY_ID,
6699 .subdevice = PCI_ANY_ID, 6711 .subdevice = PCI_ANY_ID,
6700 .driver_data = SAA7134_BOARD_UNKNOWN, 6712 .driver_data = SAA7134_BOARD_UNKNOWN,
6701 }, {
6702 .vendor = PCI_VENDOR_ID_PHILIPS,
6703 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
6704 .subvendor = 0x5ace, /* Beholder Intl. Ltd. */
6705 .subdevice = 0x7190,
6706 .driver_data = SAA7134_BOARD_BEHOLD_H7,
6707 }, {
6708 .vendor = PCI_VENDOR_ID_PHILIPS,
6709 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
6710 .subvendor = 0x5ace, /* Beholder Intl. Ltd. */
6711 .subdevice = 0x7090,
6712 .driver_data = SAA7134_BOARD_BEHOLD_A7,
6713 },{ 6713 },{
6714 /* --- end of list --- */ 6714 /* --- end of list --- */
6715 } 6715 }
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 1e7aaaf6cc6f..b5347167aa72 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1464,7 +1464,11 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1464 dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); 1464 dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret);
1465 goto err; 1465 goto err;
1466 } 1466 }
1467 if (ret != 0x6204) { 1467 switch (ret) {
1468 case 0x6204:
1469 case 0x6246:
1470 break;
1471 default:
1468 dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); 1472 dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret);
1469 ret = -EINVAL; 1473 ret = -EINVAL;
1470 goto err; 1474 goto err;
@@ -1617,7 +1621,7 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1617 case WM8321: 1621 case WM8321:
1618 ret = mfd_add_devices(wm831x->dev, -1, 1622 ret = mfd_add_devices(wm831x->dev, -1,
1619 wm8320_devs, ARRAY_SIZE(wm8320_devs), 1623 wm8320_devs, ARRAY_SIZE(wm8320_devs),
1620 NULL, 0); 1624 NULL, wm831x->irq_base);
1621 break; 1625 break;
1622 1626
1623 default: 1627 default:
diff --git a/drivers/misc/ad525x_dpot-spi.c b/drivers/misc/ad525x_dpot-spi.c
index b8c6df9c8437..6cfcb636577a 100644
--- a/drivers/misc/ad525x_dpot-spi.c
+++ b/drivers/misc/ad525x_dpot-spi.c
@@ -53,13 +53,13 @@ static int write8(void *client, u8 val)
53static int write16(void *client, u8 reg, u8 val) 53static int write16(void *client, u8 reg, u8 val)
54{ 54{
55 u8 data[2] = {reg, val}; 55 u8 data[2] = {reg, val};
56 return spi_write(client, data, 1); 56 return spi_write(client, data, 2);
57} 57}
58 58
59static int write24(void *client, u8 reg, u16 val) 59static int write24(void *client, u8 reg, u16 val)
60{ 60{
61 u8 data[3] = {reg, val >> 8, val}; 61 u8 data[3] = {reg, val >> 8, val};
62 return spi_write(client, data, 1); 62 return spi_write(client, data, 3);
63} 63}
64 64
65static int read8(void *client) 65static int read8(void *client)
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index d551f09ccb79..6956f7e7d439 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -439,18 +439,23 @@ xpc_discovery(void)
439 * nodes that can comprise an access protection grouping. The access 439 * nodes that can comprise an access protection grouping. The access
440 * protection is in regards to memory, IOI and IPI. 440 * protection is in regards to memory, IOI and IPI.
441 */ 441 */
442 max_regions = 64;
443 region_size = xp_region_size; 442 region_size = xp_region_size;
444 443
445 switch (region_size) { 444 if (is_uv())
446 case 128: 445 max_regions = 256;
447 max_regions *= 2; 446 else {
448 case 64: 447 max_regions = 64;
449 max_regions *= 2; 448
450 case 32: 449 switch (region_size) {
451 max_regions *= 2; 450 case 128:
452 region_size = 16; 451 max_regions *= 2;
453 DBUG_ON(!is_shub2()); 452 case 64:
453 max_regions *= 2;
454 case 32:
455 max_regions *= 2;
456 region_size = 16;
457 DBUG_ON(!is_shub2());
458 }
454 } 459 }
455 460
456 for (region = 0; region < max_regions; region++) { 461 for (region = 0; region < max_regions; region++) {
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 1f59ee2226ca..17bbacb1b4b1 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -417,6 +417,7 @@ xpc_process_activate_IRQ_rcvd_uv(void)
417static void 417static void
418xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, 418xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
419 struct xpc_activate_mq_msghdr_uv *msg_hdr, 419 struct xpc_activate_mq_msghdr_uv *msg_hdr,
420 int part_setup,
420 int *wakeup_hb_checker) 421 int *wakeup_hb_checker)
421{ 422{
422 unsigned long irq_flags; 423 unsigned long irq_flags;
@@ -481,6 +482,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
481 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: { 482 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: {
482 struct xpc_activate_mq_msg_chctl_closerequest_uv *msg; 483 struct xpc_activate_mq_msg_chctl_closerequest_uv *msg;
483 484
485 if (!part_setup)
486 break;
487
484 msg = container_of(msg_hdr, struct 488 msg = container_of(msg_hdr, struct
485 xpc_activate_mq_msg_chctl_closerequest_uv, 489 xpc_activate_mq_msg_chctl_closerequest_uv,
486 hdr); 490 hdr);
@@ -497,6 +501,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
497 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: { 501 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: {
498 struct xpc_activate_mq_msg_chctl_closereply_uv *msg; 502 struct xpc_activate_mq_msg_chctl_closereply_uv *msg;
499 503
504 if (!part_setup)
505 break;
506
500 msg = container_of(msg_hdr, struct 507 msg = container_of(msg_hdr, struct
501 xpc_activate_mq_msg_chctl_closereply_uv, 508 xpc_activate_mq_msg_chctl_closereply_uv,
502 hdr); 509 hdr);
@@ -511,6 +518,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
511 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: { 518 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: {
512 struct xpc_activate_mq_msg_chctl_openrequest_uv *msg; 519 struct xpc_activate_mq_msg_chctl_openrequest_uv *msg;
513 520
521 if (!part_setup)
522 break;
523
514 msg = container_of(msg_hdr, struct 524 msg = container_of(msg_hdr, struct
515 xpc_activate_mq_msg_chctl_openrequest_uv, 525 xpc_activate_mq_msg_chctl_openrequest_uv,
516 hdr); 526 hdr);
@@ -528,6 +538,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
528 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: { 538 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: {
529 struct xpc_activate_mq_msg_chctl_openreply_uv *msg; 539 struct xpc_activate_mq_msg_chctl_openreply_uv *msg;
530 540
541 if (!part_setup)
542 break;
543
531 msg = container_of(msg_hdr, struct 544 msg = container_of(msg_hdr, struct
532 xpc_activate_mq_msg_chctl_openreply_uv, hdr); 545 xpc_activate_mq_msg_chctl_openreply_uv, hdr);
533 args = &part->remote_openclose_args[msg->ch_number]; 546 args = &part->remote_openclose_args[msg->ch_number];
@@ -545,6 +558,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
545 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: { 558 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: {
546 struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; 559 struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg;
547 560
561 if (!part_setup)
562 break;
563
548 msg = container_of(msg_hdr, struct 564 msg = container_of(msg_hdr, struct
549 xpc_activate_mq_msg_chctl_opencomplete_uv, hdr); 565 xpc_activate_mq_msg_chctl_opencomplete_uv, hdr);
550 spin_lock_irqsave(&part->chctl_lock, irq_flags); 566 spin_lock_irqsave(&part->chctl_lock, irq_flags);
@@ -621,6 +637,7 @@ xpc_handle_activate_IRQ_uv(int irq, void *dev_id)
621 637
622 part_referenced = xpc_part_ref(part); 638 part_referenced = xpc_part_ref(part);
623 xpc_handle_activate_mq_msg_uv(part, msg_hdr, 639 xpc_handle_activate_mq_msg_uv(part, msg_hdr,
640 part_referenced,
624 &wakeup_hb_checker); 641 &wakeup_hb_checker);
625 if (part_referenced) 642 if (part_referenced)
626 xpc_part_deref(part); 643 xpc_part_deref(part);
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 09eee6df0653..994454295184 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1514,7 +1514,7 @@ void mmc_stop_host(struct mmc_host *host)
1514 1514
1515 if (host->caps & MMC_CAP_DISABLE) 1515 if (host->caps & MMC_CAP_DISABLE)
1516 cancel_delayed_work(&host->disable); 1516 cancel_delayed_work(&host->disable);
1517 cancel_delayed_work(&host->detect); 1517 cancel_delayed_work_sync(&host->detect);
1518 mmc_flush_scheduled_work(); 1518 mmc_flush_scheduled_work();
1519 1519
1520 /* clear pm flags now and let card drivers set them as needed */ 1520 /* clear pm flags now and let card drivers set them as needed */
@@ -1720,6 +1720,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
1720 1720
1721 case PM_POST_SUSPEND: 1721 case PM_POST_SUSPEND:
1722 case PM_POST_HIBERNATION: 1722 case PM_POST_HIBERNATION:
1723 case PM_POST_RESTORE:
1723 1724
1724 spin_lock_irqsave(&host->lock, flags); 1725 spin_lock_irqsave(&host->lock, flags);
1725 host->rescan_disable = 0; 1726 host->rescan_disable = 0;
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 87226cd202a5..57bb421ba1b2 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -69,6 +69,7 @@
69#include <linux/highmem.h> 69#include <linux/highmem.h>
70 70
71#include <linux/mmc/host.h> 71#include <linux/mmc/host.h>
72#include <linux/mmc/sdio.h>
72 73
73#include <asm/io.h> 74#include <asm/io.h>
74#include <asm/irq.h> 75#include <asm/irq.h>
@@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
493 else if (data->flags & MMC_DATA_WRITE) 494 else if (data->flags & MMC_DATA_WRITE)
494 cmdr |= AT91_MCI_TRCMD_START; 495 cmdr |= AT91_MCI_TRCMD_START;
495 496
496 if (data->flags & MMC_DATA_STREAM) 497 if (cmd->opcode == SD_IO_RW_EXTENDED) {
497 cmdr |= AT91_MCI_TRTYP_STREAM; 498 cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK;
498 if (data->blocks > 1) 499 } else {
499 cmdr |= AT91_MCI_TRTYP_MULTIPLE; 500 if (data->flags & MMC_DATA_STREAM)
501 cmdr |= AT91_MCI_TRTYP_STREAM;
502 if (data->blocks > 1)
503 cmdr |= AT91_MCI_TRTYP_MULTIPLE;
504 }
500 } 505 }
501 else { 506 else {
502 block_length = 0; 507 block_length = 0;
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 95ef864ad8f9..3a569bfe3886 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -26,6 +26,7 @@
26#include <linux/stat.h> 26#include <linux/stat.h>
27 27
28#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
29#include <linux/mmc/sdio.h>
29 30
30#include <mach/atmel-mci.h> 31#include <mach/atmel-mci.h>
31#include <linux/atmel-mci.h> 32#include <linux/atmel-mci.h>
@@ -532,12 +533,17 @@ static u32 atmci_prepare_command(struct mmc_host *mmc,
532 data = cmd->data; 533 data = cmd->data;
533 if (data) { 534 if (data) {
534 cmdr |= MCI_CMDR_START_XFER; 535 cmdr |= MCI_CMDR_START_XFER;
535 if (data->flags & MMC_DATA_STREAM) 536
536 cmdr |= MCI_CMDR_STREAM; 537 if (cmd->opcode == SD_IO_RW_EXTENDED) {
537 else if (data->blocks > 1) 538 cmdr |= MCI_CMDR_SDIO_BLOCK;
538 cmdr |= MCI_CMDR_MULTI_BLOCK; 539 } else {
539 else 540 if (data->flags & MMC_DATA_STREAM)
540 cmdr |= MCI_CMDR_BLOCK; 541 cmdr |= MCI_CMDR_STREAM;
542 else if (data->blocks > 1)
543 cmdr |= MCI_CMDR_MULTI_BLOCK;
544 else
545 cmdr |= MCI_CMDR_BLOCK;
546 }
541 547
542 if (data->flags & MMC_DATA_READ) 548 if (data->flags & MMC_DATA_READ)
543 cmdr |= MCI_CMDR_TRDIR_READ; 549 cmdr |= MCI_CMDR_TRDIR_READ;
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index 4b0e677d7295..5164edfeabdd 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -462,7 +462,7 @@ static int __devinit sdh_probe(struct platform_device *pdev)
462 goto out; 462 goto out;
463 } 463 }
464 464
465 mmc = mmc_alloc_host(sizeof(*mmc), &pdev->dev); 465 mmc = mmc_alloc_host(sizeof(struct sdh_host), &pdev->dev);
466 if (!mmc) { 466 if (!mmc) {
467 ret = -ENOMEM; 467 ret = -ENOMEM;
468 goto out; 468 goto out;
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 4a4f6b81e32d..70609eefc2de 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -490,13 +490,11 @@ static inline unsigned int cp_rx_csum_ok (u32 status)
490{ 490{
491 unsigned int protocol = (status >> 16) & 0x3; 491 unsigned int protocol = (status >> 16) & 0x3;
492 492
493 if (likely((protocol == RxProtoTCP) && (!(status & TCPFail)))) 493 if (((protocol == RxProtoTCP) && !(status & TCPFail)) ||
494 ((protocol == RxProtoUDP) && !(status & UDPFail)))
494 return 1; 495 return 1;
495 else if ((protocol == RxProtoUDP) && (!(status & UDPFail))) 496 else
496 return 1; 497 return 0;
497 else if ((protocol == RxProtoIP) && (!(status & IPFail)))
498 return 1;
499 return 0;
500} 498}
501 499
502static int cp_rx_poll(struct napi_struct *napi, int budget) 500static int cp_rx_poll(struct napi_struct *napi, int budget)
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index c73be2848319..67f75c17919c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3503,6 +3503,8 @@ static int atl1_set_ringparam(struct net_device *netdev,
3503 struct atl1_rfd_ring rfd_old, rfd_new; 3503 struct atl1_rfd_ring rfd_old, rfd_new;
3504 struct atl1_rrd_ring rrd_old, rrd_new; 3504 struct atl1_rrd_ring rrd_old, rrd_new;
3505 struct atl1_ring_header rhdr_old, rhdr_new; 3505 struct atl1_ring_header rhdr_old, rhdr_new;
3506 struct atl1_smb smb;
3507 struct atl1_cmb cmb;
3506 int err; 3508 int err;
3507 3509
3508 tpd_old = adapter->tpd_ring; 3510 tpd_old = adapter->tpd_ring;
@@ -3543,11 +3545,19 @@ static int atl1_set_ringparam(struct net_device *netdev,
3543 adapter->rrd_ring = rrd_old; 3545 adapter->rrd_ring = rrd_old;
3544 adapter->tpd_ring = tpd_old; 3546 adapter->tpd_ring = tpd_old;
3545 adapter->ring_header = rhdr_old; 3547 adapter->ring_header = rhdr_old;
3548 /*
3549 * Save SMB and CMB, since atl1_free_ring_resources
3550 * will clear them.
3551 */
3552 smb = adapter->smb;
3553 cmb = adapter->cmb;
3546 atl1_free_ring_resources(adapter); 3554 atl1_free_ring_resources(adapter);
3547 adapter->rfd_ring = rfd_new; 3555 adapter->rfd_ring = rfd_new;
3548 adapter->rrd_ring = rrd_new; 3556 adapter->rrd_ring = rrd_new;
3549 adapter->tpd_ring = tpd_new; 3557 adapter->tpd_ring = tpd_new;
3550 adapter->ring_header = rhdr_new; 3558 adapter->ring_header = rhdr_new;
3559 adapter->smb = smb;
3560 adapter->cmb = cmb;
3551 3561
3552 err = atl1_up(adapter); 3562 err = atl1_up(adapter);
3553 if (err) 3563 if (err)
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 34abcc9403d6..dc913b986795 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1179,7 +1179,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
1179 1179
1180 i = 0; 1180 i = 0;
1181 netdev_for_each_mc_addr(ha, netdev) 1181 netdev_for_each_mc_addr(ha, netdev)
1182 memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); 1182 memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN);
1183 } else { 1183 } else {
1184 req->promiscuous = 1; 1184 req->promiscuous = 1;
1185 } 1185 }
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c6fdd851579a..c867cf901f9f 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -240,11 +240,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n
240 240
241 bond_for_each_slave(bond, slave, i) { 241 bond_for_each_slave(bond, slave, i) {
242 if (slave->dev == slave_dev) { 242 if (slave->dev == slave_dev) {
243 break; 243 return slave;
244 } 244 }
245 } 245 }
246 246
247 return slave; 247 return 0;
248} 248}
249 249
250static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) 250static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 5cc39ed289c6..71324286b1e7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -31,7 +31,7 @@
31 31
32char e1000_driver_name[] = "e1000"; 32char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
34#define DRV_VERSION "7.3.21-k6-NAPI" 34#define DRV_VERSION "7.3.21-k8-NAPI"
35const char e1000_driver_version[] = DRV_VERSION; 35const char e1000_driver_version[] = DRV_VERSION;
36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 36static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
37 37
@@ -483,9 +483,6 @@ void e1000_down(struct e1000_adapter *adapter)
483 struct net_device *netdev = adapter->netdev; 483 struct net_device *netdev = adapter->netdev;
484 u32 rctl, tctl; 484 u32 rctl, tctl;
485 485
486 /* signal that we're down so the interrupt handler does not
487 * reschedule our watchdog timer */
488 set_bit(__E1000_DOWN, &adapter->flags);
489 486
490 /* disable receives in the hardware */ 487 /* disable receives in the hardware */
491 rctl = er32(RCTL); 488 rctl = er32(RCTL);
@@ -506,6 +503,13 @@ void e1000_down(struct e1000_adapter *adapter)
506 503
507 e1000_irq_disable(adapter); 504 e1000_irq_disable(adapter);
508 505
506 /*
507 * Setting DOWN must be after irq_disable to prevent
508 * a screaming interrupt. Setting DOWN also prevents
509 * timers and tasks from rescheduling.
510 */
511 set_bit(__E1000_DOWN, &adapter->flags);
512
509 del_timer_sync(&adapter->tx_fifo_stall_timer); 513 del_timer_sync(&adapter->tx_fifo_stall_timer);
510 del_timer_sync(&adapter->watchdog_timer); 514 del_timer_sync(&adapter->watchdog_timer);
511 del_timer_sync(&adapter->phy_info_timer); 515 del_timer_sync(&adapter->phy_info_timer);
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index cce32d43175f..52e9ca8de4b2 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -651,8 +651,8 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
651 fep->mii_timeout = 0; 651 fep->mii_timeout = 0;
652 init_completion(&fep->mdio_done); 652 init_completion(&fep->mdio_done);
653 653
654 /* start a read op */ 654 /* start a write op */
655 writel(FEC_MMFR_ST | FEC_MMFR_OP_READ | 655 writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE |
656 FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | 656 FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) |
657 FEC_MMFR_TA | FEC_MMFR_DATA(value), 657 FEC_MMFR_TA | FEC_MMFR_DATA(value),
658 fep->hwp + FEC_MII_DATA); 658 fep->hwp + FEC_MII_DATA);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index ab9f675c5b8b..fe337bd121aa 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev)
104 rcu_read_unlock(); 104 rcu_read_unlock();
105 dev_kfree_skb(skb); 105 dev_kfree_skb(skb);
106 stats->tx_dropped++; 106 stats->tx_dropped++;
107 if (skb_queue_len(&dp->tq) != 0)
108 goto resched;
107 break; 109 break;
108 } 110 }
109 rcu_read_unlock(); 111 rcu_read_unlock();
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index e32af434cc9d..0e7f086d28db 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2651,9 +2651,16 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2651 int rx_buf_len; 2651 int rx_buf_len;
2652 2652
2653 /* Decide whether to use packet split mode or not */ 2653 /* Decide whether to use packet split mode or not */
2654 /* On by default */
2655 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
2656
2654 /* Do not use packet split if we're in SR-IOV Mode */ 2657 /* Do not use packet split if we're in SR-IOV Mode */
2655 if (!adapter->num_vfs) 2658 if (adapter->num_vfs)
2656 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; 2659 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
2660
2661 /* Disable packet split due to 82599 erratum #45 */
2662 if (hw->mac.type == ixgbe_mac_82599EB)
2663 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
2657 2664
2658 /* Set the RX buffer length according to the mode */ 2665 /* Set the RX buffer length according to the mode */
2659 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 2666 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 99f24f5cac53..f0643ac4aff1 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -1575,6 +1575,16 @@ jme_free_irq(struct jme_adapter *jme)
1575 } 1575 }
1576} 1576}
1577 1577
1578static inline void
1579jme_phy_on(struct jme_adapter *jme)
1580{
1581 u32 bmcr;
1582
1583 bmcr = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_BMCR);
1584 bmcr &= ~BMCR_PDOWN;
1585 jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_BMCR, bmcr);
1586}
1587
1578static int 1588static int
1579jme_open(struct net_device *netdev) 1589jme_open(struct net_device *netdev)
1580{ 1590{
@@ -1595,10 +1605,12 @@ jme_open(struct net_device *netdev)
1595 1605
1596 jme_start_irq(jme); 1606 jme_start_irq(jme);
1597 1607
1598 if (test_bit(JME_FLAG_SSET, &jme->flags)) 1608 if (test_bit(JME_FLAG_SSET, &jme->flags)) {
1609 jme_phy_on(jme);
1599 jme_set_settings(netdev, &jme->old_ecmd); 1610 jme_set_settings(netdev, &jme->old_ecmd);
1600 else 1611 } else {
1601 jme_reset_phy_processor(jme); 1612 jme_reset_phy_processor(jme);
1613 }
1602 1614
1603 jme_reset_link(jme); 1615 jme_reset_link(jme);
1604 1616
@@ -3006,10 +3018,12 @@ jme_resume(struct pci_dev *pdev)
3006 jme_clear_pm(jme); 3018 jme_clear_pm(jme);
3007 pci_restore_state(pdev); 3019 pci_restore_state(pdev);
3008 3020
3009 if (test_bit(JME_FLAG_SSET, &jme->flags)) 3021 if (test_bit(JME_FLAG_SSET, &jme->flags)) {
3022 jme_phy_on(jme);
3010 jme_set_settings(netdev, &jme->old_ecmd); 3023 jme_set_settings(netdev, &jme->old_ecmd);
3011 else 3024 } else {
3012 jme_reset_phy_processor(jme); 3025 jme_reset_phy_processor(jme);
3026 }
3013 3027
3014 jme_start_irq(jme); 3028 jme_start_irq(jme);
3015 netif_device_attach(netdev); 3029 netif_device_attach(netdev);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index f9b509a6b09a..b12553bb5ecc 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1622,6 +1622,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1622 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), 1622 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9),
1623 PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), 1623 PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722),
1624 PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), 1624 PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2),
1625 PCMCIA_DEVICE_PROD_ID12("corega", "Ether CF-TD", 0x0a21501a, 0x6589340a),
1625 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), 1626 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd),
1626 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), 1627 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d),
1627 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), 1628 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 0101f2bdf400..c1ba49b772ff 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -196,20 +196,27 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
196 MII_88E1121_PHY_MSCR_PAGE); 196 MII_88E1121_PHY_MSCR_PAGE);
197 if (err < 0) 197 if (err < 0)
198 return err; 198 return err;
199 mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
200 MII_88E1121_PHY_MSCR_DELAY_MASK;
201 199
202 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) 200 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
203 mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY | 201 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
204 MII_88E1121_PHY_MSCR_TX_DELAY); 202 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
205 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) 203 (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
206 mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
207 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
208 mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
209 204
210 err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr); 205 mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
211 if (err < 0) 206 MII_88E1121_PHY_MSCR_DELAY_MASK;
212 return err; 207
208 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
209 mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
210 MII_88E1121_PHY_MSCR_TX_DELAY);
211 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
212 mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
213 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
214 mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
215
216 err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
217 if (err < 0)
218 return err;
219 }
213 220
214 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); 221 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);
215 222
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index c07de359dc07..6a3eae2407c1 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -948,7 +948,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
948 948
949abort: 949abort:
950 kfree_skb(skb); 950 kfree_skb(skb);
951 return 0; 951 return 1;
952} 952}
953 953
954/************************************************************************ 954/************************************************************************
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 142c381e1d73..80666f097ce6 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -893,16 +893,18 @@ static void r6040_multicast_list(struct net_device *dev)
893 /* Multicast Address 1~4 case */ 893 /* Multicast Address 1~4 case */
894 i = 0; 894 i = 0;
895 netdev_for_each_mc_addr(ha, dev) { 895 netdev_for_each_mc_addr(ha, dev) {
896 if (i < MCAST_MAX) { 896 if (i >= MCAST_MAX)
897 adrp = (u16 *) ha->addr; 897 break;
898 iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); 898 adrp = (u16 *) ha->addr;
899 iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); 899 iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
900 iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); 900 iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
901 } else { 901 iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
902 iowrite16(0xffff, ioaddr + MID_1L + 8 * i); 902 i++;
903 iowrite16(0xffff, ioaddr + MID_1M + 8 * i); 903 }
904 iowrite16(0xffff, ioaddr + MID_1H + 8 * i); 904 while (i < MCAST_MAX) {
905 } 905 iowrite16(0xffff, ioaddr + MID_1L + 8 * i);
906 iowrite16(0xffff, ioaddr + MID_1M + 8 * i);
907 iowrite16(0xffff, ioaddr + MID_1H + 8 * i);
906 i++; 908 i++;
907 } 909 }
908} 910}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 992db2fa136e..ed65e4a473ec 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -855,10 +855,10 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
855 else 855 else
856 tp->features &= ~RTL_FEATURE_WOL; 856 tp->features &= ~RTL_FEATURE_WOL;
857 __rtl8169_set_wol(tp, wol->wolopts); 857 __rtl8169_set_wol(tp, wol->wolopts);
858 device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
859
860 spin_unlock_irq(&tp->lock); 858 spin_unlock_irq(&tp->lock);
861 859
860 device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
861
862 return 0; 862 return 0;
863} 863}
864 864
@@ -2936,7 +2936,7 @@ static const struct rtl_cfg_info {
2936 .hw_start = rtl_hw_start_8168, 2936 .hw_start = rtl_hw_start_8168,
2937 .region = 2, 2937 .region = 2,
2938 .align = 8, 2938 .align = 8,
2939 .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | 2939 .intr_event = SYSErr | LinkChg | RxOverflow |
2940 TxErr | TxOK | RxOK | RxErr, 2940 TxErr | TxOK | RxOK | RxErr,
2941 .napi_event = TxErr | TxOK | RxOK | RxOverflow, 2941 .napi_event = TxErr | TxOK | RxOK | RxOverflow,
2942 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, 2942 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI,
@@ -4455,14 +4455,12 @@ static inline int rtl8169_fragmented_frame(u32 status)
4455 return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); 4455 return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag);
4456} 4456}
4457 4457
4458static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) 4458static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
4459{ 4459{
4460 u32 opts1 = le32_to_cpu(desc->opts1);
4461 u32 status = opts1 & RxProtoMask; 4460 u32 status = opts1 & RxProtoMask;
4462 4461
4463 if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || 4462 if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
4464 ((status == RxProtoUDP) && !(opts1 & UDPFail)) || 4463 ((status == RxProtoUDP) && !(opts1 & UDPFail)))
4465 ((status == RxProtoIP) && !(opts1 & IPFail)))
4466 skb->ip_summed = CHECKSUM_UNNECESSARY; 4464 skb->ip_summed = CHECKSUM_UNNECESSARY;
4467 else 4465 else
4468 skb->ip_summed = CHECKSUM_NONE; 4466 skb->ip_summed = CHECKSUM_NONE;
@@ -4551,8 +4549,6 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4551 continue; 4549 continue;
4552 } 4550 }
4553 4551
4554 rtl8169_rx_csum(skb, desc);
4555
4556 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { 4552 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) {
4557 dma_sync_single_for_device(&pdev->dev, addr, 4553 dma_sync_single_for_device(&pdev->dev, addr,
4558 pkt_size, PCI_DMA_FROMDEVICE); 4554 pkt_size, PCI_DMA_FROMDEVICE);
@@ -4563,6 +4559,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4563 tp->Rx_skbuff[entry] = NULL; 4559 tp->Rx_skbuff[entry] = NULL;
4564 } 4560 }
4565 4561
4562 rtl8169_rx_csum(skb, status);
4566 skb_put(skb, pkt_size); 4563 skb_put(skb, pkt_size);
4567 skb->protocol = eth_type_trans(skb, dev); 4564 skb->protocol = eth_type_trans(skb, dev);
4568 4565
@@ -4630,7 +4627,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4630 } 4627 }
4631 4628
4632 /* Work around for rx fifo overflow */ 4629 /* Work around for rx fifo overflow */
4633 if (unlikely(status & RxFIFOOver)) { 4630 if (unlikely(status & RxFIFOOver) &&
4631 (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
4634 netif_stop_queue(dev); 4632 netif_stop_queue(dev);
4635 rtl8169_tx_timeout(dev); 4633 rtl8169_tx_timeout(dev);
4636 break; 4634 break;
@@ -4891,6 +4889,9 @@ static int rtl8169_resume(struct device *device)
4891{ 4889{
4892 struct pci_dev *pdev = to_pci_dev(device); 4890 struct pci_dev *pdev = to_pci_dev(device);
4893 struct net_device *dev = pci_get_drvdata(pdev); 4891 struct net_device *dev = pci_get_drvdata(pdev);
4892 struct rtl8169_private *tp = netdev_priv(dev);
4893
4894 rtl8169_init_phy(dev, tp);
4894 4895
4895 if (netif_running(dev)) 4896 if (netif_running(dev))
4896 __rtl8169_resume(dev); 4897 __rtl8169_resume(dev);
@@ -4931,6 +4932,8 @@ static int rtl8169_runtime_resume(struct device *device)
4931 tp->saved_wolopts = 0; 4932 tp->saved_wolopts = 0;
4932 spin_unlock_irq(&tp->lock); 4933 spin_unlock_irq(&tp->lock);
4933 4934
4935 rtl8169_init_phy(dev, tp);
4936
4934 __rtl8169_resume(dev); 4937 __rtl8169_resume(dev);
4935 4938
4936 return 0; 4939 return 0;
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 737df6032bbc..2ce585a511d9 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -324,7 +324,7 @@ static int bdx_fw_load(struct bdx_priv *priv)
324 ENTER; 324 ENTER;
325 master = READ_REG(priv, regINIT_SEMAPHORE); 325 master = READ_REG(priv, regINIT_SEMAPHORE);
326 if (!READ_REG(priv, regINIT_STATUS) && master) { 326 if (!READ_REG(priv, regINIT_STATUS) && master) {
327 rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev); 327 rc = request_firmware(&fw, "tehuti/bdx.bin", &priv->pdev->dev);
328 if (rc) 328 if (rc)
329 goto out; 329 goto out;
330 bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); 330 bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size);
@@ -2516,4 +2516,4 @@ module_exit(bdx_module_exit);
2516MODULE_LICENSE("GPL"); 2516MODULE_LICENSE("GPL");
2517MODULE_AUTHOR(DRIVER_AUTHOR); 2517MODULE_AUTHOR(DRIVER_AUTHOR);
2518MODULE_DESCRIPTION(BDX_DRV_DESC); 2518MODULE_DESCRIPTION(BDX_DRV_DESC);
2519MODULE_FIRMWARE("tehuti/firmware.bin"); 2519MODULE_FIRMWARE("tehuti/bdx.bin");
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ca7fc9df1ccf..c04d49e31f81 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -45,6 +45,7 @@
45#include <linux/usb/usbnet.h> 45#include <linux/usb/usbnet.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/kernel.h> 47#include <linux/kernel.h>
48#include <linux/pm_runtime.h>
48 49
49#define DRIVER_VERSION "22-Aug-2005" 50#define DRIVER_VERSION "22-Aug-2005"
50 51
@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1273 struct usb_device *xdev; 1274 struct usb_device *xdev;
1274 int status; 1275 int status;
1275 const char *name; 1276 const char *name;
1277 struct usb_driver *driver = to_usb_driver(udev->dev.driver);
1278
1279 /* usbnet already took usb runtime pm, so have to enable the feature
1280 * for usb interface, otherwise usb_autopm_get_interface may return
1281 * failure if USB_SUSPEND(RUNTIME_PM) is enabled.
1282 */
1283 if (!driver->supports_autosuspend) {
1284 driver->supports_autosuspend = 1;
1285 pm_runtime_enable(&udev->dev);
1286 }
1276 1287
1277 name = udev->dev.driver->name; 1288 name = udev->dev.driver->name;
1278 info = (struct driver_info *) prod->driver_info; 1289 info = (struct driver_info *) prod->driver_info;
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4598e9d2608f..65d3d801a258 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq)
446 } 446 }
447} 447}
448 448
449static void virtnet_napi_enable(struct virtnet_info *vi)
450{
451 napi_enable(&vi->napi);
452
453 /* If all buffers were filled by other side before we napi_enabled, we
454 * won't get another interrupt, so process any outstanding packets
455 * now. virtnet_poll wants re-enable the queue, so we disable here.
456 * We synchronize against interrupts via NAPI_STATE_SCHED */
457 if (napi_schedule_prep(&vi->napi)) {
458 virtqueue_disable_cb(vi->rvq);
459 __napi_schedule(&vi->napi);
460 }
461}
462
449static void refill_work(struct work_struct *work) 463static void refill_work(struct work_struct *work)
450{ 464{
451 struct virtnet_info *vi; 465 struct virtnet_info *vi;
@@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work)
454 vi = container_of(work, struct virtnet_info, refill.work); 468 vi = container_of(work, struct virtnet_info, refill.work);
455 napi_disable(&vi->napi); 469 napi_disable(&vi->napi);
456 still_empty = !try_fill_recv(vi, GFP_KERNEL); 470 still_empty = !try_fill_recv(vi, GFP_KERNEL);
457 napi_enable(&vi->napi); 471 virtnet_napi_enable(vi);
458 472
459 /* In theory, this can happen: if we don't get any buffers in 473 /* In theory, this can happen: if we don't get any buffers in
460 * we will *never* try to fill again. */ 474 * we will *never* try to fill again. */
@@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev)
638{ 652{
639 struct virtnet_info *vi = netdev_priv(dev); 653 struct virtnet_info *vi = netdev_priv(dev);
640 654
641 napi_enable(&vi->napi); 655 virtnet_napi_enable(vi);
642
643 /* If all buffers were filled by other side before we napi_enabled, we
644 * won't get another interrupt, so process any outstanding packets
645 * now. virtnet_poll wants re-enable the queue, so we disable here.
646 * We synchronize against interrupts via NAPI_STATE_SCHED */
647 if (napi_schedule_prep(&vi->napi)) {
648 virtqueue_disable_cb(vi->rvq);
649 __napi_schedule(&vi->napi);
650 }
651 return 0; 656 return 0;
652} 657}
653 658
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index d32f2828b098..a706202fa67c 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -119,6 +119,7 @@ struct ath_common {
119 119
120 u32 keymax; 120 u32 keymax;
121 DECLARE_BITMAP(keymap, ATH_KEYMAX); 121 DECLARE_BITMAP(keymap, ATH_KEYMAX);
122 DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
122 u8 splitmic; 123 u8 splitmic;
123 124
124 struct ath_regulatory regulatory; 125 struct ath_regulatory regulatory;
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index fe7418aefc4a..d4ee07084c4d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -710,10 +710,6 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah,
710 710
711 /* Do NF cal only at longer intervals */ 711 /* Do NF cal only at longer intervals */
712 if (longcal || nfcal_pending) { 712 if (longcal || nfcal_pending) {
713 /* Do periodic PAOffset Cal */
714 ar9002_hw_pa_cal(ah, false);
715 ar9002_hw_olc_temp_compensation(ah);
716
717 /* 713 /*
718 * Get the value from the previous NF cal and update 714 * Get the value from the previous NF cal and update
719 * history buffer. 715 * history buffer.
@@ -728,8 +724,12 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah,
728 ath9k_hw_loadnf(ah, ah->curchan); 724 ath9k_hw_loadnf(ah, ah->curchan);
729 } 725 }
730 726
731 if (longcal) 727 if (longcal) {
732 ath9k_hw_start_nfcal(ah, false); 728 ath9k_hw_start_nfcal(ah, false);
729 /* Do periodic PAOffset Cal */
730 ar9002_hw_pa_cal(ah, false);
731 ar9002_hw_olc_temp_compensation(ah);
732 }
733 } 733 }
734 734
735 return iscaldone; 735 return iscaldone;
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 303c63da5ea3..ab1c50b8326d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -411,6 +411,9 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
411 val &= ~(AR_WA_BIT6 | AR_WA_BIT7); 411 val &= ~(AR_WA_BIT6 | AR_WA_BIT7);
412 } 412 }
413 413
414 if (AR_SREV_9280(ah))
415 val |= AR_WA_BIT22;
416
414 if (AR_SREV_9285E_20(ah)) 417 if (AR_SREV_9285E_20(ah))
415 val |= AR_WA_BIT23; 418 val |= AR_WA_BIT23;
416 419
@@ -442,9 +445,8 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
442 } 445 }
443 446
444 /* WAR for ASPM system hang */ 447 /* WAR for ASPM system hang */
445 if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) { 448 if (AR_SREV_9285(ah) || AR_SREV_9287(ah))
446 val |= (AR_WA_BIT6 | AR_WA_BIT7); 449 val |= (AR_WA_BIT6 | AR_WA_BIT7);
447 }
448 450
449 if (AR_SREV_9285E_20(ah)) 451 if (AR_SREV_9285E_20(ah))
450 val |= AR_WA_BIT23; 452 val |= AR_WA_BIT23;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index ec98ab50748a..a14a5e43cf56 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -34,6 +34,10 @@ static const u32 ar9300_2p2_radio_postamble[][5] = {
34 34
35static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { 35static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = {
36 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 36 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
37 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
38 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
39 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
40 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
37 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 41 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
38 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 42 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
39 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 43 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
@@ -99,6 +103,30 @@ static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = {
99 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 103 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
100 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 104 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
101 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 105 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
106 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
107 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
108 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
109 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
110 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
111 {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000},
112 {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501},
113 {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501},
114 {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03},
115 {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
116 {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04},
117 {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005},
118 {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
119 {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
120 {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
121 {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
122 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
123 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
124 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
125 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
126 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
127 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
128 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
129 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
102 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 130 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
103 {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, 131 {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
104 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 132 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -118,7 +146,7 @@ static const u32 ar9300Modes_fast_clock_2p2[][3] = {
118 {0x00008014, 0x044c044c, 0x08980898}, 146 {0x00008014, 0x044c044c, 0x08980898},
119 {0x0000801c, 0x148ec02b, 0x148ec057}, 147 {0x0000801c, 0x148ec02b, 0x148ec057},
120 {0x00008318, 0x000044c0, 0x00008980}, 148 {0x00008318, 0x000044c0, 0x00008980},
121 {0x00009e00, 0x03721821, 0x03721821}, 149 {0x00009e00, 0x0372131c, 0x0372131c},
122 {0x0000a230, 0x0000000b, 0x00000016}, 150 {0x0000a230, 0x0000000b, 0x00000016},
123 {0x0000a254, 0x00000898, 0x00001130}, 151 {0x0000a254, 0x00000898, 0x00001130},
124}; 152};
@@ -595,15 +623,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = {
595 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, 623 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
596 {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, 624 {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c},
597 {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, 625 {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4},
598 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, 626 {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0},
599 {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, 627 {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020},
600 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, 628 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
601 {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, 629 {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e},
602 {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, 630 {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e},
603 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 631 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
604 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, 632 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
605 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, 633 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
606 {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, 634 {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
635 {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222},
607 {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, 636 {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27},
608 {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, 637 {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012},
609 {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, 638 {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000},
@@ -624,16 +653,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = {
624 {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, 653 {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
625 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 654 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
626 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, 655 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
627 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 656 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
628 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 657 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
629 {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 658 {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
630 {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 659 {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000},
631 {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 660 {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
632 {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 661 {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
633 {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, 662 {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
634 {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, 663 {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
635 {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 664 {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
636 {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 665 {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000},
637 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 666 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
638 {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, 667 {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
639 {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, 668 {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
@@ -649,13 +678,13 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
649 {0x00009814, 0x9280c00a}, 678 {0x00009814, 0x9280c00a},
650 {0x00009818, 0x00000000}, 679 {0x00009818, 0x00000000},
651 {0x0000981c, 0x00020028}, 680 {0x0000981c, 0x00020028},
652 {0x00009834, 0x5f3ca3de}, 681 {0x00009834, 0x6400a290},
653 {0x00009838, 0x0108ecff}, 682 {0x00009838, 0x0108ecff},
654 {0x0000983c, 0x14750600}, 683 {0x0000983c, 0x14750600},
655 {0x00009880, 0x201fff00}, 684 {0x00009880, 0x201fff00},
656 {0x00009884, 0x00001042}, 685 {0x00009884, 0x00001042},
657 {0x000098a4, 0x00200400}, 686 {0x000098a4, 0x00200400},
658 {0x000098b0, 0x52440bbe}, 687 {0x000098b0, 0x32840bbe},
659 {0x000098d0, 0x004b6a8e}, 688 {0x000098d0, 0x004b6a8e},
660 {0x000098d4, 0x00000820}, 689 {0x000098d4, 0x00000820},
661 {0x000098dc, 0x00000000}, 690 {0x000098dc, 0x00000000},
@@ -681,7 +710,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
681 {0x00009e30, 0x06336f77}, 710 {0x00009e30, 0x06336f77},
682 {0x00009e34, 0x6af6532f}, 711 {0x00009e34, 0x6af6532f},
683 {0x00009e38, 0x0cc80c00}, 712 {0x00009e38, 0x0cc80c00},
684 {0x00009e3c, 0xcf946222},
685 {0x00009e40, 0x0d261820}, 713 {0x00009e40, 0x0d261820},
686 {0x00009e4c, 0x00001004}, 714 {0x00009e4c, 0x00001004},
687 {0x00009e50, 0x00ff03f1}, 715 {0x00009e50, 0x00ff03f1},
@@ -694,7 +722,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
694 {0x0000a220, 0x00000000}, 722 {0x0000a220, 0x00000000},
695 {0x0000a224, 0x00000000}, 723 {0x0000a224, 0x00000000},
696 {0x0000a228, 0x10002310}, 724 {0x0000a228, 0x10002310},
697 {0x0000a22c, 0x01036a1e}, 725 {0x0000a22c, 0x01036a27},
698 {0x0000a23c, 0x00000000}, 726 {0x0000a23c, 0x00000000},
699 {0x0000a244, 0x0c000000}, 727 {0x0000a244, 0x0c000000},
700 {0x0000a2a0, 0x00000001}, 728 {0x0000a2a0, 0x00000001},
@@ -702,10 +730,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
702 {0x0000a2c8, 0x00000000}, 730 {0x0000a2c8, 0x00000000},
703 {0x0000a2cc, 0x18c43433}, 731 {0x0000a2cc, 0x18c43433},
704 {0x0000a2d4, 0x00000000}, 732 {0x0000a2d4, 0x00000000},
705 {0x0000a2dc, 0x00000000},
706 {0x0000a2e0, 0x00000000},
707 {0x0000a2e4, 0x00000000},
708 {0x0000a2e8, 0x00000000},
709 {0x0000a2ec, 0x00000000}, 733 {0x0000a2ec, 0x00000000},
710 {0x0000a2f0, 0x00000000}, 734 {0x0000a2f0, 0x00000000},
711 {0x0000a2f4, 0x00000000}, 735 {0x0000a2f4, 0x00000000},
@@ -753,33 +777,17 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
753 {0x0000a430, 0x1ce739ce}, 777 {0x0000a430, 0x1ce739ce},
754 {0x0000a434, 0x00000000}, 778 {0x0000a434, 0x00000000},
755 {0x0000a438, 0x00001801}, 779 {0x0000a438, 0x00001801},
756 {0x0000a43c, 0x00000000}, 780 {0x0000a43c, 0x00100000},
757 {0x0000a440, 0x00000000}, 781 {0x0000a440, 0x00000000},
758 {0x0000a444, 0x00000000}, 782 {0x0000a444, 0x00000000},
759 {0x0000a448, 0x06000080}, 783 {0x0000a448, 0x06000080},
760 {0x0000a44c, 0x00000001}, 784 {0x0000a44c, 0x00000001},
761 {0x0000a450, 0x00010000}, 785 {0x0000a450, 0x00010000},
762 {0x0000a458, 0x00000000}, 786 {0x0000a458, 0x00000000},
763 {0x0000a600, 0x00000000},
764 {0x0000a604, 0x00000000},
765 {0x0000a608, 0x00000000},
766 {0x0000a60c, 0x00000000},
767 {0x0000a610, 0x00000000},
768 {0x0000a614, 0x00000000},
769 {0x0000a618, 0x00000000},
770 {0x0000a61c, 0x00000000},
771 {0x0000a620, 0x00000000},
772 {0x0000a624, 0x00000000},
773 {0x0000a628, 0x00000000},
774 {0x0000a62c, 0x00000000},
775 {0x0000a630, 0x00000000},
776 {0x0000a634, 0x00000000},
777 {0x0000a638, 0x00000000},
778 {0x0000a63c, 0x00000000},
779 {0x0000a640, 0x00000000}, 787 {0x0000a640, 0x00000000},
780 {0x0000a644, 0x3fad9d74}, 788 {0x0000a644, 0x3fad9d74},
781 {0x0000a648, 0x0048060a}, 789 {0x0000a648, 0x0048060a},
782 {0x0000a64c, 0x00000637}, 790 {0x0000a64c, 0x00003c37},
783 {0x0000a670, 0x03020100}, 791 {0x0000a670, 0x03020100},
784 {0x0000a674, 0x09080504}, 792 {0x0000a674, 0x09080504},
785 {0x0000a678, 0x0d0c0b0a}, 793 {0x0000a678, 0x0d0c0b0a},
@@ -802,10 +810,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
802 {0x0000a8f4, 0x00000000}, 810 {0x0000a8f4, 0x00000000},
803 {0x0000b2d0, 0x00000080}, 811 {0x0000b2d0, 0x00000080},
804 {0x0000b2d4, 0x00000000}, 812 {0x0000b2d4, 0x00000000},
805 {0x0000b2dc, 0x00000000},
806 {0x0000b2e0, 0x00000000},
807 {0x0000b2e4, 0x00000000},
808 {0x0000b2e8, 0x00000000},
809 {0x0000b2ec, 0x00000000}, 813 {0x0000b2ec, 0x00000000},
810 {0x0000b2f0, 0x00000000}, 814 {0x0000b2f0, 0x00000000},
811 {0x0000b2f4, 0x00000000}, 815 {0x0000b2f4, 0x00000000},
@@ -820,10 +824,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
820 {0x0000b8f4, 0x00000000}, 824 {0x0000b8f4, 0x00000000},
821 {0x0000c2d0, 0x00000080}, 825 {0x0000c2d0, 0x00000080},
822 {0x0000c2d4, 0x00000000}, 826 {0x0000c2d4, 0x00000000},
823 {0x0000c2dc, 0x00000000},
824 {0x0000c2e0, 0x00000000},
825 {0x0000c2e4, 0x00000000},
826 {0x0000c2e8, 0x00000000},
827 {0x0000c2ec, 0x00000000}, 827 {0x0000c2ec, 0x00000000},
828 {0x0000c2f0, 0x00000000}, 828 {0x0000c2f0, 0x00000000},
829 {0x0000c2f4, 0x00000000}, 829 {0x0000c2f4, 0x00000000},
@@ -835,6 +835,10 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
835 835
836static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { 836static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
838 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
839 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
840 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
841 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
838 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, 842 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
839 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, 843 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
840 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, 844 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
@@ -855,7 +859,7 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
855 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, 859 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
856 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, 860 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
857 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, 861 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
858 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, 862 {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
859 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, 863 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
860 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, 864 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
861 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, 865 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
@@ -900,6 +904,30 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
900 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 904 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
901 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 905 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
902 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 906 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
907 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
908 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
909 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
910 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
911 {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
912 {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
913 {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
914 {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
915 {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
916 {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
917 {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
918 {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
919 {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
920 {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
921 {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
922 {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
923 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
924 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
925 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
926 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
927 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
928 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
929 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
930 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
903 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, 931 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
904 {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, 932 {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
905 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, 933 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
@@ -913,6 +941,10 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
913 941
914static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { 942static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
915 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 943 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
944 {0x0000a2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
945 {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
946 {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
947 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
916 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, 948 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
917 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, 949 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
918 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, 950 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
@@ -933,7 +965,7 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
933 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, 965 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
934 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, 966 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
935 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, 967 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
936 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, 968 {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
937 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, 969 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
938 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, 970 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
939 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, 971 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
@@ -978,6 +1010,30 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
978 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1010 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
979 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1011 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
980 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, 1012 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
1013 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1014 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1015 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1016 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1017 {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
1018 {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
1019 {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
1020 {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
1021 {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
1022 {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
1023 {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
1024 {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1025 {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1026 {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1027 {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1028 {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
1029 {0x0000b2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
1030 {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
1031 {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
1032 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1033 {0x0000c2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800},
1034 {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000},
1035 {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000},
1036 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
981 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, 1037 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
982 {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, 1038 {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
983 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 1039 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -1151,14 +1207,14 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = {
1151 {0x0000b074, 0x00000000}, 1207 {0x0000b074, 0x00000000},
1152 {0x0000b078, 0x00000000}, 1208 {0x0000b078, 0x00000000},
1153 {0x0000b07c, 0x00000000}, 1209 {0x0000b07c, 0x00000000},
1154 {0x0000b080, 0x32323232}, 1210 {0x0000b080, 0x2a2d2f32},
1155 {0x0000b084, 0x2f2f3232}, 1211 {0x0000b084, 0x21232328},
1156 {0x0000b088, 0x23282a2d}, 1212 {0x0000b088, 0x19191c1e},
1157 {0x0000b08c, 0x1c1e2123}, 1213 {0x0000b08c, 0x12141417},
1158 {0x0000b090, 0x14171919}, 1214 {0x0000b090, 0x07070e0e},
1159 {0x0000b094, 0x0e0e1214}, 1215 {0x0000b094, 0x03030305},
1160 {0x0000b098, 0x03050707}, 1216 {0x0000b098, 0x00000003},
1161 {0x0000b09c, 0x00030303}, 1217 {0x0000b09c, 0x00000000},
1162 {0x0000b0a0, 0x00000000}, 1218 {0x0000b0a0, 0x00000000},
1163 {0x0000b0a4, 0x00000000}, 1219 {0x0000b0a4, 0x00000000},
1164 {0x0000b0a8, 0x00000000}, 1220 {0x0000b0a8, 0x00000000},
@@ -1251,6 +1307,10 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = {
1251 1307
1252static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { 1308static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = {
1253 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 1309 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
1310 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1311 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1312 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1313 {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1254 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 1314 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
1255 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1315 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1256 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 1316 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
@@ -1316,6 +1376,30 @@ static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = {
1316 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1376 {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1317 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1377 {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1318 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, 1378 {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
1379 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1380 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1381 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1382 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1383 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1384 {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000},
1385 {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501},
1386 {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501},
1387 {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03},
1388 {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
1389 {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04},
1390 {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005},
1391 {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1392 {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1393 {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1394 {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005},
1395 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1396 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1397 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1398 {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1399 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800},
1400 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000},
1401 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000},
1402 {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1319 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 1403 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
1320 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, 1404 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
1321 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 1405 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
@@ -1414,15 +1498,10 @@ static const u32 ar9300_2p2_mac_core[][2] = {
1414 {0x00008144, 0xffffffff}, 1498 {0x00008144, 0xffffffff},
1415 {0x00008168, 0x00000000}, 1499 {0x00008168, 0x00000000},
1416 {0x0000816c, 0x00000000}, 1500 {0x0000816c, 0x00000000},
1417 {0x00008170, 0x18486200},
1418 {0x00008174, 0x33332210},
1419 {0x00008178, 0x00000000},
1420 {0x0000817c, 0x00020000},
1421 {0x000081c0, 0x00000000}, 1501 {0x000081c0, 0x00000000},
1422 {0x000081c4, 0x33332210}, 1502 {0x000081c4, 0x33332210},
1423 {0x000081c8, 0x00000000}, 1503 {0x000081c8, 0x00000000},
1424 {0x000081cc, 0x00000000}, 1504 {0x000081cc, 0x00000000},
1425 {0x000081d4, 0x00000000},
1426 {0x000081ec, 0x00000000}, 1505 {0x000081ec, 0x00000000},
1427 {0x000081f0, 0x00000000}, 1506 {0x000081f0, 0x00000000},
1428 {0x000081f4, 0x00000000}, 1507 {0x000081f4, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 057fb69ddf7f..5f03c534af6e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -22,12 +22,14 @@
22#define COMP_CKSUM_LEN 2 22#define COMP_CKSUM_LEN 2
23 23
24#define AR_CH0_TOP (0x00016288) 24#define AR_CH0_TOP (0x00016288)
25#define AR_CH0_TOP_XPABIASLVL (0x3) 25#define AR_CH0_TOP_XPABIASLVL (0x300)
26#define AR_CH0_TOP_XPABIASLVL_S (8) 26#define AR_CH0_TOP_XPABIASLVL_S (8)
27 27
28#define AR_CH0_THERM (0x00016290) 28#define AR_CH0_THERM (0x00016290)
29#define AR_CH0_THERM_SPARE (0x3f) 29#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
30#define AR_CH0_THERM_SPARE_S (0) 30#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
31#define AR_CH0_THERM_XPASHORT2GND 0x4
32#define AR_CH0_THERM_XPASHORT2GND_S 2
31 33
32#define AR_SWITCH_TABLE_COM_ALL (0xffff) 34#define AR_SWITCH_TABLE_COM_ALL (0xffff)
33#define AR_SWITCH_TABLE_COM_ALL_S (0) 35#define AR_SWITCH_TABLE_COM_ALL_S (0)
@@ -55,6 +57,8 @@
55#define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ 57#define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
56#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ 58#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
57 59
60#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
61
58static const struct ar9300_eeprom ar9300_default = { 62static const struct ar9300_eeprom ar9300_default = {
59 .eepromVersion = 2, 63 .eepromVersion = 2,
60 .templateVersion = 2, 64 .templateVersion = 2,
@@ -290,20 +294,21 @@ static const struct ar9300_eeprom ar9300_default = {
290 } 294 }
291 }, 295 },
292 .ctlPowerData_2G = { 296 .ctlPowerData_2G = {
293 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 297 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
294 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 298 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
295 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 299 { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
296 300
297 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 301 { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
298 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 302 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
299 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 303 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
300 304
301 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 305 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
302 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 306 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
303 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 307 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
304 308
305 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 309 { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
306 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 310 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
311 { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
307 }, 312 },
308 .modalHeader5G = { 313 .modalHeader5G = {
309 /* 4 idle,t1,t2,b (4 bits per setting) */ 314 /* 4 idle,t1,t2,b (4 bits per setting) */
@@ -568,56 +573,56 @@ static const struct ar9300_eeprom ar9300_default = {
568 .ctlPowerData_5G = { 573 .ctlPowerData_5G = {
569 { 574 {
570 { 575 {
571 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 576 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
572 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 577 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
573 } 578 }
574 }, 579 },
575 { 580 {
576 { 581 {
577 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 582 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
578 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 583 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
579 } 584 }
580 }, 585 },
581 { 586 {
582 { 587 {
583 {60, 0}, {60, 1}, {60, 0}, {60, 1}, 588 CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
584 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 589 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
585 } 590 }
586 }, 591 },
587 { 592 {
588 { 593 {
589 {60, 0}, {60, 1}, {60, 1}, {60, 0}, 594 CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
590 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 595 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
591 } 596 }
592 }, 597 },
593 { 598 {
594 { 599 {
595 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 600 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
596 {60, 0}, {60, 0}, {60, 0}, {60, 0}, 601 CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
597 } 602 }
598 }, 603 },
599 { 604 {
600 { 605 {
601 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 606 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
602 {60, 1}, {60, 0}, {60, 0}, {60, 0}, 607 CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
603 } 608 }
604 }, 609 },
605 { 610 {
606 { 611 {
607 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 612 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
608 {60, 1}, {60, 1}, {60, 1}, {60, 1}, 613 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
609 } 614 }
610 }, 615 },
611 { 616 {
612 { 617 {
613 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 618 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
614 {60, 1}, {60, 1}, {60, 1}, {60, 0}, 619 CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
615 } 620 }
616 }, 621 },
617 { 622 {
618 { 623 {
619 {60, 1}, {60, 0}, {60, 1}, {60, 1}, 624 CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
620 {60, 1}, {60, 1}, {60, 0}, {60, 1}, 625 CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
621 } 626 }
622 }, 627 },
623 } 628 }
@@ -992,9 +997,9 @@ static s32 ar9003_hw_xpa_bias_level_get(struct ath_hw *ah, bool is2ghz)
992static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) 997static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
993{ 998{
994 int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz); 999 int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz);
995 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, (bias & 0x3)); 1000 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
996 REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_SPARE, 1001 REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, bias >> 2);
997 ((bias >> 2) & 0x3)); 1002 REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1);
998} 1003}
999 1004
1000static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) 1005static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
@@ -1827,9 +1832,9 @@ static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep,
1827 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; 1832 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
1828 1833
1829 if (is2GHz) 1834 if (is2GHz)
1830 return ctl_2g[idx].ctlEdges[edge].tPower; 1835 return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]);
1831 else 1836 else
1832 return ctl_5g[idx].ctlEdges[edge].tPower; 1837 return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]);
1833} 1838}
1834 1839
1835static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, 1840static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
@@ -1847,12 +1852,12 @@ static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
1847 1852
1848 if (is2GHz) { 1853 if (is2GHz) {
1849 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && 1854 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
1850 ctl_2g[idx].ctlEdges[edge - 1].flag) 1855 CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1]))
1851 return ctl_2g[idx].ctlEdges[edge - 1].tPower; 1856 return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]);
1852 } else { 1857 } else {
1853 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && 1858 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
1854 ctl_5g[idx].ctlEdges[edge - 1].flag) 1859 CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1]))
1855 return ctl_5g[idx].ctlEdges[edge - 1].tPower; 1860 return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
1856 } 1861 }
1857 1862
1858 return AR9300_MAX_RATE_POWER; 1863 return AR9300_MAX_RATE_POWER;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index 3c533bb983c7..655b3033396c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -261,17 +261,12 @@ struct cal_tgt_pow_ht {
261 u8 tPow2x[14]; 261 u8 tPow2x[14];
262} __packed; 262} __packed;
263 263
264struct cal_ctl_edge_pwr {
265 u8 tPower:6,
266 flag:2;
267} __packed;
268
269struct cal_ctl_data_2g { 264struct cal_ctl_data_2g {
270 struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; 265 u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G];
271} __packed; 266} __packed;
272 267
273struct cal_ctl_data_5g { 268struct cal_ctl_data_5g {
274 struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; 269 u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G];
275} __packed; 270} __packed;
276 271
277struct ar9300_eeprom { 272struct ar9300_eeprom {
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 5b995bee70ae..1a0ab706a18f 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -616,7 +616,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
616 rxs->rs_status |= ATH9K_RXERR_DECRYPT; 616 rxs->rs_status |= ATH9K_RXERR_DECRYPT;
617 } else if (rxsp->status11 & AR_MichaelErr) { 617 } else if (rxsp->status11 & AR_MichaelErr) {
618 rxs->rs_status |= ATH9K_RXERR_MIC; 618 rxs->rs_status |= ATH9K_RXERR_MIC;
619 } 619 } else if (rxsp->status11 & AR_KeyMiss)
620 rxs->rs_status |= ATH9K_RXERR_DECRYPT;
620 } 621 }
621 622
622 return 0; 623 return 0;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 7c38229ba670..716db414c258 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -347,6 +347,10 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
347 (((Y[6] - Y[3]) * 1 << scale_factor) + 347 (((Y[6] - Y[3]) * 1 << scale_factor) +
348 (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); 348 (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]);
349 349
350 /* prevent division by zero */
351 if (G_fxp == 0)
352 return false;
353
350 Y_intercept = 354 Y_intercept =
351 (G_fxp * (x_est[0] - x_est[3]) + 355 (G_fxp * (x_est[0] - x_est[3]) +
352 (1 << scale_factor)) / (1 << scale_factor) + Y[3]; 356 (1 << scale_factor)) / (1 << scale_factor) + Y[3];
@@ -356,14 +360,12 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
356 360
357 for (i = 0; i <= 3; i++) { 361 for (i = 0; i <= 3; i++) {
358 y_est[i] = i * 32; 362 y_est[i] = i * 32;
359
360 /* prevent division by zero */
361 if (G_fxp == 0)
362 return false;
363
364 x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; 363 x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp;
365 } 364 }
366 365
366 if (y_est[max_index] == 0)
367 return false;
368
367 x_est_fxp1_nonlin = 369 x_est_fxp1_nonlin =
368 x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + 370 x_est[max_index] - ((1 << scale_factor) * y_est[max_index] +
369 G_fxp) / G_fxp; 371 G_fxp) / G_fxp;
@@ -457,6 +459,8 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
457 459
458 Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); 460 Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10);
459 scale_B = scale_B / (1 << Q_scale_B); 461 scale_B = scale_B / (1 << Q_scale_B);
462 if (scale_B == 0)
463 return false;
460 Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); 464 Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10);
461 Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); 465 Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10);
462 beta_raw = beta_raw / (1 << Q_beta); 466 beta_raw = beta_raw / (1 << Q_beta);
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 07f26ee7a723..852745c2b752 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -177,8 +177,8 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
177 177
178/* returns delimiter padding required given the packet length */ 178/* returns delimiter padding required given the packet length */
179#define ATH_AGGR_GET_NDELIM(_len) \ 179#define ATH_AGGR_GET_NDELIM(_len) \
180 (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ? \ 180 (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \
181 (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2) 181 DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ))
182 182
183#define BAW_WITHIN(_start, _bawsz, _seqno) \ 183#define BAW_WITHIN(_start, _bawsz, _seqno) \
184 ((((_seqno) - (_start)) & 4095) < (_bawsz)) 184 ((((_seqno) - (_start)) & 4095) < (_bawsz))
@@ -312,7 +312,6 @@ struct ath_rx {
312 u8 rxotherant; 312 u8 rxotherant;
313 u32 *rxlink; 313 u32 *rxlink;
314 unsigned int rxfilter; 314 unsigned int rxfilter;
315 spinlock_t rxflushlock;
316 spinlock_t rxbuflock; 315 spinlock_t rxbuflock;
317 struct list_head rxbuf; 316 struct list_head rxbuf;
318 struct ath_descdma rxdma; 317 struct ath_descdma rxdma;
@@ -346,8 +345,8 @@ void ath_tx_tasklet(struct ath_softc *sc);
346void ath_tx_edma_tasklet(struct ath_softc *sc); 345void ath_tx_edma_tasklet(struct ath_softc *sc);
347void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb); 346void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb);
348bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); 347bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno);
349void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 348int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
350 u16 tid, u16 *ssn); 349 u16 tid, u16 *ssn);
351void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 350void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
352void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 351void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
353void ath9k_enable_ps(struct ath_softc *sc); 352void ath9k_enable_ps(struct ath_softc *sc);
@@ -516,7 +515,6 @@ void ath_deinit_leds(struct ath_softc *sc);
516#define SC_OP_RXFLUSH BIT(7) 515#define SC_OP_RXFLUSH BIT(7)
517#define SC_OP_LED_ASSOCIATED BIT(8) 516#define SC_OP_LED_ASSOCIATED BIT(8)
518#define SC_OP_LED_ON BIT(9) 517#define SC_OP_LED_ON BIT(9)
519#define SC_OP_SCANNING BIT(10)
520#define SC_OP_TSF_RESET BIT(11) 518#define SC_OP_TSF_RESET BIT(11)
521#define SC_OP_BT_PRIORITY_DETECTED BIT(12) 519#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
522#define SC_OP_BT_SCAN BIT(13) 520#define SC_OP_BT_SCAN BIT(13)
@@ -558,9 +556,9 @@ struct ath_softc {
558 struct ath_hw *sc_ah; 556 struct ath_hw *sc_ah;
559 void __iomem *mem; 557 void __iomem *mem;
560 int irq; 558 int irq;
561 spinlock_t sc_resetlock;
562 spinlock_t sc_serial_rw; 559 spinlock_t sc_serial_rw;
563 spinlock_t sc_pm_lock; 560 spinlock_t sc_pm_lock;
561 spinlock_t sc_pcu_lock;
564 struct mutex mutex; 562 struct mutex mutex;
565 struct work_struct paprd_work; 563 struct work_struct paprd_work;
566 struct work_struct hw_check_work; 564 struct work_struct hw_check_work;
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 4d4b22d52dfd..20cf2d4e58b9 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -366,7 +366,7 @@ void ath_beacon_tasklet(unsigned long data)
366 ath_print(common, ATH_DBG_BEACON, 366 ath_print(common, ATH_DBG_BEACON,
367 "beacon is officially stuck\n"); 367 "beacon is officially stuck\n");
368 sc->sc_flags |= SC_OP_TSF_RESET; 368 sc->sc_flags |= SC_OP_TSF_RESET;
369 ath_reset(sc, false); 369 ath_reset(sc, true);
370 } 370 }
371 371
372 return; 372 return;
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index c86f7d3593ab..108b43369f7c 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -366,9 +366,13 @@ int ath9k_cmn_key_config(struct ath_common *common,
366 set_bit(idx, common->keymap); 366 set_bit(idx, common->keymap);
367 if (key->alg == ALG_TKIP) { 367 if (key->alg == ALG_TKIP) {
368 set_bit(idx + 64, common->keymap); 368 set_bit(idx + 64, common->keymap);
369 set_bit(idx, common->tkip_keymap);
370 set_bit(idx + 64, common->tkip_keymap);
369 if (common->splitmic) { 371 if (common->splitmic) {
370 set_bit(idx + 32, common->keymap); 372 set_bit(idx + 32, common->keymap);
371 set_bit(idx + 64 + 32, common->keymap); 373 set_bit(idx + 64 + 32, common->keymap);
374 set_bit(idx + 32, common->tkip_keymap);
375 set_bit(idx + 64 + 32, common->tkip_keymap);
372 } 376 }
373 } 377 }
374 378
@@ -393,10 +397,17 @@ void ath9k_cmn_key_delete(struct ath_common *common,
393 return; 397 return;
394 398
395 clear_bit(key->hw_key_idx + 64, common->keymap); 399 clear_bit(key->hw_key_idx + 64, common->keymap);
400
401 clear_bit(key->hw_key_idx, common->tkip_keymap);
402 clear_bit(key->hw_key_idx + 64, common->tkip_keymap);
403
396 if (common->splitmic) { 404 if (common->splitmic) {
397 ath9k_hw_keyreset(ah, key->hw_key_idx + 32); 405 ath9k_hw_keyreset(ah, key->hw_key_idx + 32);
398 clear_bit(key->hw_key_idx + 32, common->keymap); 406 clear_bit(key->hw_key_idx + 32, common->keymap);
399 clear_bit(key->hw_key_idx + 64 + 32, common->keymap); 407 clear_bit(key->hw_key_idx + 64 + 32, common->keymap);
408
409 clear_bit(key->hw_key_idx + 32, common->tkip_keymap);
410 clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap);
400 } 411 }
401} 412}
402EXPORT_SYMBOL(ath9k_cmn_key_delete); 413EXPORT_SYMBOL(ath9k_cmn_key_delete);
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 1266333f586d..2bbf94d0191e 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower,
240 for (i = 0; (i < num_band_edges) && 240 for (i = 0; (i < num_band_edges) &&
241 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { 241 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
242 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { 242 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
243 twiceMaxEdgePower = pRdEdgesPower[i].tPower; 243 twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl);
244 break; 244 break;
245 } else if ((i > 0) && 245 } else if ((i > 0) &&
246 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, 246 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
247 is2GHz))) { 247 is2GHz))) {
248 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, 248 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
249 is2GHz) < freq && 249 is2GHz) < freq &&
250 pRdEdgesPower[i - 1].flag) { 250 CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) {
251 twiceMaxEdgePower = 251 twiceMaxEdgePower =
252 pRdEdgesPower[i - 1].tPower; 252 CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl);
253 } 253 }
254 break; 254 break;
255 } 255 }
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 0b09db0f8e7d..17068f9c026e 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -233,6 +233,9 @@
233 233
234#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 234#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1)
235 235
236#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
237#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
238
236enum eeprom_param { 239enum eeprom_param {
237 EEP_NFTHRESH_5, 240 EEP_NFTHRESH_5,
238 EEP_NFTHRESH_2, 241 EEP_NFTHRESH_2,
@@ -533,18 +536,10 @@ struct cal_target_power_ht {
533 u8 tPow2x[8]; 536 u8 tPow2x[8];
534} __packed; 537} __packed;
535 538
536
537#ifdef __BIG_ENDIAN_BITFIELD
538struct cal_ctl_edges {
539 u8 bChannel;
540 u8 flag:2, tPower:6;
541} __packed;
542#else
543struct cal_ctl_edges { 539struct cal_ctl_edges {
544 u8 bChannel; 540 u8 bChannel;
545 u8 tPower:6, flag:2; 541 u8 ctl;
546} __packed; 542} __packed;
547#endif
548 543
549struct cal_data_op_loop_ar9287 { 544struct cal_data_op_loop_ar9287 {
550 u8 pwrPdg[2][5]; 545 u8 pwrPdg[2][5];
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index dff2da777312..7cb356e8a531 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -37,7 +37,7 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah)
37 int addr, eep_start_loc; 37 int addr, eep_start_loc;
38 eep_data = (u16 *)eep; 38 eep_data = (u16 *)eep;
39 39
40 if (ah->hw_version.devid == 0x7015) 40 if (AR9287_HTC_DEVID(ah))
41 eep_start_loc = AR9287_HTC_EEP_START_LOC; 41 eep_start_loc = AR9287_HTC_EEP_START_LOC;
42 else 42 else
43 eep_start_loc = AR9287_EEP_START_LOC; 43 eep_start_loc = AR9287_EEP_START_LOC;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index afa2b73ddbdd..a48eb570a47c 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -1062,15 +1062,19 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah,
1062 case 1: 1062 case 1:
1063 break; 1063 break;
1064 case 2: 1064 case 2:
1065 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; 1065 if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
1066 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
1067 else
1068 scaledPower = 0;
1066 break; 1069 break;
1067 case 3: 1070 case 3:
1068 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; 1071 if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
1072 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
1073 else
1074 scaledPower = 0;
1069 break; 1075 break;
1070 } 1076 }
1071 1077
1072 scaledPower = max((u16)0, scaledPower);
1073
1074 if (IS_CHAN_2GHZ(chan)) { 1078 if (IS_CHAN_2GHZ(chan)) {
1075 numCtlModes = ARRAY_SIZE(ctlModesFor11g) - 1079 numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
1076 SUB_NUM_CTL_MODES_AT_2G_40; 1080 SUB_NUM_CTL_MODES_AT_2G_40;
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 17e7a9a367e7..0e9bbb13ba66 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -35,8 +35,14 @@ static struct usb_device_id ath9k_hif_usb_ids[] = {
35 { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ 35 { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */
36 { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ 36 { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */
37 { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ 37 { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */
38 { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */
39 { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */
40 { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */
41 { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */
38 { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ 42 { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */
39 { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ 43 { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */
44 { USB_DEVICE(0x040D, 0x3801) }, /* VIA */
45 { USB_DEVICE(0x1668, 0x1200) }, /* Verizon */
40 { }, 46 { },
41}; 47};
42 48
@@ -138,16 +144,36 @@ static void hif_usb_tx_cb(struct urb *urb)
138 case -ENODEV: 144 case -ENODEV:
139 case -ESHUTDOWN: 145 case -ESHUTDOWN:
140 /* 146 /*
141 * The URB has been killed, free the SKBs 147 * The URB has been killed, free the SKBs.
142 * and return.
143 */ 148 */
144 ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue); 149 ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
145 return; 150
151 /*
152 * If the URBs are being flushed, no need to add this
153 * URB to the free list.
154 */
155 spin_lock(&hif_dev->tx.tx_lock);
156 if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
157 spin_unlock(&hif_dev->tx.tx_lock);
158 return;
159 }
160 spin_unlock(&hif_dev->tx.tx_lock);
161
162 /*
163 * In the stop() case, this URB has to be added to
164 * the free list.
165 */
166 goto add_free;
146 default: 167 default:
147 break; 168 break;
148 } 169 }
149 170
150 /* Check if TX has been stopped */ 171 /*
172 * Check if TX has been stopped, this is needed because
173 * this CB could have been invoked just after the TX lock
174 * was released in hif_stop() and kill_urb() hasn't been
175 * called yet.
176 */
151 spin_lock(&hif_dev->tx.tx_lock); 177 spin_lock(&hif_dev->tx.tx_lock);
152 if (hif_dev->tx.flags & HIF_USB_TX_STOP) { 178 if (hif_dev->tx.flags & HIF_USB_TX_STOP) {
153 spin_unlock(&hif_dev->tx.tx_lock); 179 spin_unlock(&hif_dev->tx.tx_lock);
@@ -299,6 +325,7 @@ static void hif_usb_start(void *hif_handle, u8 pipe_id)
299static void hif_usb_stop(void *hif_handle, u8 pipe_id) 325static void hif_usb_stop(void *hif_handle, u8 pipe_id)
300{ 326{
301 struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; 327 struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
328 struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL;
302 unsigned long flags; 329 unsigned long flags;
303 330
304 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); 331 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
@@ -306,6 +333,12 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id)
306 hif_dev->tx.tx_skb_cnt = 0; 333 hif_dev->tx.tx_skb_cnt = 0;
307 hif_dev->tx.flags |= HIF_USB_TX_STOP; 334 hif_dev->tx.flags |= HIF_USB_TX_STOP;
308 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); 335 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
336
337 /* The pending URBs have to be canceled. */
338 list_for_each_entry_safe(tx_buf, tx_buf_tmp,
339 &hif_dev->tx.tx_pending, list) {
340 usb_kill_urb(tx_buf->urb);
341 }
309} 342}
310 343
311static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb, 344static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb,
@@ -571,6 +604,7 @@ free:
571static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) 604static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
572{ 605{
573 struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; 606 struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL;
607 unsigned long flags;
574 608
575 list_for_each_entry_safe(tx_buf, tx_buf_tmp, 609 list_for_each_entry_safe(tx_buf, tx_buf_tmp,
576 &hif_dev->tx.tx_buf, list) { 610 &hif_dev->tx.tx_buf, list) {
@@ -581,6 +615,10 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
581 kfree(tx_buf); 615 kfree(tx_buf);
582 } 616 }
583 617
618 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
619 hif_dev->tx.flags |= HIF_USB_TX_FLUSH;
620 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
621
584 list_for_each_entry_safe(tx_buf, tx_buf_tmp, 622 list_for_each_entry_safe(tx_buf, tx_buf_tmp,
585 &hif_dev->tx.tx_pending, list) { 623 &hif_dev->tx.tx_pending, list) {
586 usb_kill_urb(tx_buf->urb); 624 usb_kill_urb(tx_buf->urb);
@@ -799,10 +837,18 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
799 } 837 }
800 kfree(buf); 838 kfree(buf);
801 839
802 if ((hif_dev->device_id == 0x7010) || (hif_dev->device_id == 0x7015)) 840 switch (hif_dev->device_id) {
841 case 0x7010:
842 case 0x7015:
843 case 0x9018:
844 case 0xA704:
845 case 0x1200:
803 firm_offset = AR7010_FIRMWARE_TEXT; 846 firm_offset = AR7010_FIRMWARE_TEXT;
804 else 847 break;
848 default:
805 firm_offset = AR9271_FIRMWARE_TEXT; 849 firm_offset = AR9271_FIRMWARE_TEXT;
850 break;
851 }
806 852
807 /* 853 /*
808 * Issue FW download complete command to firmware. 854 * Issue FW download complete command to firmware.
@@ -903,6 +949,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
903 case 0x7010: 949 case 0x7010:
904 case 0x7015: 950 case 0x7015:
905 case 0x9018: 951 case 0x9018:
952 case 0xA704:
953 case 0x1200:
906 if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) 954 if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202)
907 hif_dev->fw_name = FIRMWARE_AR7010_1_1; 955 hif_dev->fw_name = FIRMWARE_AR7010_1_1;
908 else 956 else
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
index 2daf97b11c08..30d09389d437 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.h
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
@@ -62,6 +62,7 @@ struct tx_buf {
62}; 62};
63 63
64#define HIF_USB_TX_STOP BIT(0) 64#define HIF_USB_TX_STOP BIT(0)
65#define HIF_USB_TX_FLUSH BIT(1)
65 66
66struct hif_usb_tx { 67struct hif_usb_tx {
67 u8 flags; 68 u8 flags;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 2d4279191d7a..e5a0122fc341 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -247,6 +247,8 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid)
247 case 0x7010: 247 case 0x7010:
248 case 0x7015: 248 case 0x7015:
249 case 0x9018: 249 case 0x9018:
250 case 0xA704:
251 case 0x1200:
250 priv->htc->credits = 45; 252 priv->htc->credits = 45;
251 break; 253 break;
252 default: 254 default:
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 2a6e45a293a9..f06eeab2a572 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -121,7 +121,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb)
121 tx_hdr.data_type = ATH9K_HTC_NORMAL; 121 tx_hdr.data_type = ATH9K_HTC_NORMAL;
122 } 122 }
123 123
124 if (ieee80211_is_data(fc)) { 124 if (ieee80211_is_data_qos(fc)) {
125 qc = ieee80211_get_qos_ctl(hdr); 125 qc = ieee80211_get_qos_ctl(hdr);
126 tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; 126 tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
127 } 127 }
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 3384ca164562..5250c8dc83e1 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -387,6 +387,9 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
387 else 387 else
388 ah->config.ht_enable = 0; 388 ah->config.ht_enable = 0;
389 389
390 /* PAPRD needs some more work to be enabled */
391 ah->config.paprd_disable = 1;
392
390 ah->config.rx_intr_mitigation = true; 393 ah->config.rx_intr_mitigation = true;
391 ah->config.pcieSerDesWrite = true; 394 ah->config.pcieSerDesWrite = true;
392 395
@@ -486,6 +489,7 @@ static int ath9k_hw_post_init(struct ath_hw *ah)
486 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 489 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
487 "Failed allocating banks for " 490 "Failed allocating banks for "
488 "external radio\n"); 491 "external radio\n");
492 ath9k_hw_rf_free_ext_banks(ah);
489 return ecode; 493 return ecode;
490 } 494 }
491 495
@@ -2263,7 +2267,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2263 pCap->rx_status_len = sizeof(struct ar9003_rxs); 2267 pCap->rx_status_len = sizeof(struct ar9003_rxs);
2264 pCap->tx_desc_len = sizeof(struct ar9003_txc); 2268 pCap->tx_desc_len = sizeof(struct ar9003_txc);
2265 pCap->txs_len = sizeof(struct ar9003_txs); 2269 pCap->txs_len = sizeof(struct ar9003_txs);
2266 if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) 2270 if (!ah->config.paprd_disable &&
2271 ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
2267 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; 2272 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
2268 } else { 2273 } else {
2269 pCap->tx_desc_len = sizeof(struct ath_desc); 2274 pCap->tx_desc_len = sizeof(struct ath_desc);
@@ -2350,7 +2355,8 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
2350 val = REG_READ(ah, AR7010_GPIO_IN); 2355 val = REG_READ(ah, AR7010_GPIO_IN);
2351 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; 2356 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0;
2352 } else if (AR_SREV_9300_20_OR_LATER(ah)) 2357 } else if (AR_SREV_9300_20_OR_LATER(ah))
2353 return MS_REG_READ(AR9300, gpio) != 0; 2358 return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) &
2359 AR_GPIO_BIT(gpio)) != 0;
2354 else if (AR_SREV_9271(ah)) 2360 else if (AR_SREV_9271(ah))
2355 return MS_REG_READ(AR9271, gpio) != 0; 2361 return MS_REG_READ(AR9271, gpio) != 0;
2356 else if (AR_SREV_9287_10_OR_LATER(ah)) 2362 else if (AR_SREV_9287_10_OR_LATER(ah))
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 399f7c1283cd..e58ff11cb85c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -240,6 +240,7 @@ struct ath9k_ops_config {
240 u32 pcie_waen; 240 u32 pcie_waen;
241 u8 analog_shiftreg; 241 u8 analog_shiftreg;
242 u8 ht_enable; 242 u8 ht_enable;
243 u8 paprd_disable;
243 u32 ofdm_trig_low; 244 u32 ofdm_trig_low;
244 u32 ofdm_trig_high; 245 u32 ofdm_trig_high;
245 u32 cck_trig_high; 246 u32 cck_trig_high;
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 243c1775f343..2e4724f1c662 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(blink, "Enable LED blink on activity");
56 * on 5 MHz steps, we support the channels which we know 56 * on 5 MHz steps, we support the channels which we know
57 * we have calibration data for all cards though to make 57 * we have calibration data for all cards though to make
58 * this static */ 58 * this static */
59static struct ieee80211_channel ath9k_2ghz_chantable[] = { 59static const struct ieee80211_channel ath9k_2ghz_chantable[] = {
60 CHAN2G(2412, 0), /* Channel 1 */ 60 CHAN2G(2412, 0), /* Channel 1 */
61 CHAN2G(2417, 1), /* Channel 2 */ 61 CHAN2G(2417, 1), /* Channel 2 */
62 CHAN2G(2422, 2), /* Channel 3 */ 62 CHAN2G(2422, 2), /* Channel 3 */
@@ -77,7 +77,7 @@ static struct ieee80211_channel ath9k_2ghz_chantable[] = {
77 * on 5 MHz steps, we support the channels which we know 77 * on 5 MHz steps, we support the channels which we know
78 * we have calibration data for all cards though to make 78 * we have calibration data for all cards though to make
79 * this static */ 79 * this static */
80static struct ieee80211_channel ath9k_5ghz_chantable[] = { 80static const struct ieee80211_channel ath9k_5ghz_chantable[] = {
81 /* _We_ call this UNII 1 */ 81 /* _We_ call this UNII 1 */
82 CHAN5G(5180, 14), /* Channel 36 */ 82 CHAN5G(5180, 14), /* Channel 36 */
83 CHAN5G(5200, 15), /* Channel 40 */ 83 CHAN5G(5200, 15), /* Channel 40 */
@@ -477,10 +477,17 @@ err:
477 return -EIO; 477 return -EIO;
478} 478}
479 479
480static void ath9k_init_channels_rates(struct ath_softc *sc) 480static int ath9k_init_channels_rates(struct ath_softc *sc)
481{ 481{
482 void *channels;
483
482 if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { 484 if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) {
483 sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; 485 channels = kmemdup(ath9k_2ghz_chantable,
486 sizeof(ath9k_2ghz_chantable), GFP_KERNEL);
487 if (!channels)
488 return -ENOMEM;
489
490 sc->sbands[IEEE80211_BAND_2GHZ].channels = channels;
484 sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; 491 sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
485 sc->sbands[IEEE80211_BAND_2GHZ].n_channels = 492 sc->sbands[IEEE80211_BAND_2GHZ].n_channels =
486 ARRAY_SIZE(ath9k_2ghz_chantable); 493 ARRAY_SIZE(ath9k_2ghz_chantable);
@@ -490,7 +497,15 @@ static void ath9k_init_channels_rates(struct ath_softc *sc)
490 } 497 }
491 498
492 if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { 499 if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) {
493 sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; 500 channels = kmemdup(ath9k_5ghz_chantable,
501 sizeof(ath9k_5ghz_chantable), GFP_KERNEL);
502 if (!channels) {
503 if (sc->sbands[IEEE80211_BAND_2GHZ].channels)
504 kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels);
505 return -ENOMEM;
506 }
507
508 sc->sbands[IEEE80211_BAND_5GHZ].channels = channels;
494 sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; 509 sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ;
495 sc->sbands[IEEE80211_BAND_5GHZ].n_channels = 510 sc->sbands[IEEE80211_BAND_5GHZ].n_channels =
496 ARRAY_SIZE(ath9k_5ghz_chantable); 511 ARRAY_SIZE(ath9k_5ghz_chantable);
@@ -499,6 +514,7 @@ static void ath9k_init_channels_rates(struct ath_softc *sc)
499 sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = 514 sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates =
500 ARRAY_SIZE(ath9k_legacy_rates) - 4; 515 ARRAY_SIZE(ath9k_legacy_rates) - 4;
501 } 516 }
517 return 0;
502} 518}
503 519
504static void ath9k_init_misc(struct ath_softc *sc) 520static void ath9k_init_misc(struct ath_softc *sc)
@@ -558,7 +574,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
558 common->debug_mask = ath9k_debug; 574 common->debug_mask = ath9k_debug;
559 575
560 spin_lock_init(&sc->wiphy_lock); 576 spin_lock_init(&sc->wiphy_lock);
561 spin_lock_init(&sc->sc_resetlock);
562 spin_lock_init(&sc->sc_serial_rw); 577 spin_lock_init(&sc->sc_serial_rw);
563 spin_lock_init(&sc->sc_pm_lock); 578 spin_lock_init(&sc->sc_pm_lock);
564 mutex_init(&sc->mutex); 579 mutex_init(&sc->mutex);
@@ -593,8 +608,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
593 if (ret) 608 if (ret)
594 goto err_btcoex; 609 goto err_btcoex;
595 610
611 ret = ath9k_init_channels_rates(sc);
612 if (ret)
613 goto err_btcoex;
614
596 ath9k_init_crypto(sc); 615 ath9k_init_crypto(sc);
597 ath9k_init_channels_rates(sc);
598 ath9k_init_misc(sc); 616 ath9k_init_misc(sc);
599 617
600 return 0; 618 return 0;
@@ -641,7 +659,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
641 BIT(NL80211_IFTYPE_ADHOC) | 659 BIT(NL80211_IFTYPE_ADHOC) |
642 BIT(NL80211_IFTYPE_MESH_POINT); 660 BIT(NL80211_IFTYPE_MESH_POINT);
643 661
644 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 662 if (AR_SREV_5416(sc->sc_ah))
663 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
645 664
646 hw->queues = 4; 665 hw->queues = 4;
647 hw->max_rates = 4; 666 hw->max_rates = 4;
@@ -751,6 +770,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
751{ 770{
752 int i = 0; 771 int i = 0;
753 772
773 if (sc->sbands[IEEE80211_BAND_2GHZ].channels)
774 kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels);
775
776 if (sc->sbands[IEEE80211_BAND_5GHZ].channels)
777 kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels);
778
754 if ((sc->btcoex.no_stomp_timer) && 779 if ((sc->btcoex.no_stomp_timer) &&
755 sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 780 sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
756 ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); 781 ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer);
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index e955bb9d98cb..79302b1e0910 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -713,6 +713,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
713 rs->rs_status |= ATH9K_RXERR_DECRYPT; 713 rs->rs_status |= ATH9K_RXERR_DECRYPT;
714 else if (ads.ds_rxstatus8 & AR_MichaelErr) 714 else if (ads.ds_rxstatus8 & AR_MichaelErr)
715 rs->rs_status |= ATH9K_RXERR_MIC; 715 rs->rs_status |= ATH9K_RXERR_MIC;
716 else if (ads.ds_rxstatus8 & AR_KeyMiss)
717 rs->rs_status |= ATH9K_RXERR_DECRYPT;
716 } 718 }
717 719
718 return 0; 720 return 0;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 3caa32316e7b..9790d3a86535 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -213,6 +213,9 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
213 */ 213 */
214 ath9k_hw_set_interrupts(ah, 0); 214 ath9k_hw_set_interrupts(ah, 0);
215 ath_drain_all_txq(sc, false); 215 ath_drain_all_txq(sc, false);
216
217 spin_lock_bh(&sc->sc_pcu_lock);
218
216 stopped = ath_stoprecv(sc); 219 stopped = ath_stoprecv(sc);
217 220
218 /* XXX: do not flush receive queue here. We don't want 221 /* XXX: do not flush receive queue here. We don't want
@@ -230,34 +233,35 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
230 sc->sc_ah->curchan->channel, 233 sc->sc_ah->curchan->channel,
231 channel->center_freq, conf_is_ht40(conf)); 234 channel->center_freq, conf_is_ht40(conf));
232 235
233 spin_lock_bh(&sc->sc_resetlock);
234
235 r = ath9k_hw_reset(ah, hchan, caldata, fastcc); 236 r = ath9k_hw_reset(ah, hchan, caldata, fastcc);
236 if (r) { 237 if (r) {
237 ath_print(common, ATH_DBG_FATAL, 238 ath_print(common, ATH_DBG_FATAL,
238 "Unable to reset channel (%u MHz), " 239 "Unable to reset channel (%u MHz), "
239 "reset status %d\n", 240 "reset status %d\n",
240 channel->center_freq, r); 241 channel->center_freq, r);
241 spin_unlock_bh(&sc->sc_resetlock); 242 spin_unlock_bh(&sc->sc_pcu_lock);
242 goto ps_restore; 243 goto ps_restore;
243 } 244 }
244 spin_unlock_bh(&sc->sc_resetlock);
245 245
246 if (ath_startrecv(sc) != 0) { 246 if (ath_startrecv(sc) != 0) {
247 ath_print(common, ATH_DBG_FATAL, 247 ath_print(common, ATH_DBG_FATAL,
248 "Unable to restart recv logic\n"); 248 "Unable to restart recv logic\n");
249 r = -EIO; 249 r = -EIO;
250 spin_unlock_bh(&sc->sc_pcu_lock);
250 goto ps_restore; 251 goto ps_restore;
251 } 252 }
252 253
254 spin_unlock_bh(&sc->sc_pcu_lock);
255
253 ath_cache_conf_rate(sc, &hw->conf); 256 ath_cache_conf_rate(sc, &hw->conf);
254 ath_update_txpow(sc); 257 ath_update_txpow(sc);
255 ath9k_hw_set_interrupts(ah, ah->imask); 258 ath9k_hw_set_interrupts(ah, ah->imask);
256 259
257 if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) { 260 if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) {
258 ath_start_ani(common); 261 if (sc->sc_flags & SC_OP_BEACONS)
262 ath_beacon_config(sc, NULL);
259 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); 263 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
260 ath_beacon_config(sc, NULL); 264 ath_start_ani(common);
261 } 265 }
262 266
263 ps_restore: 267 ps_restore:
@@ -269,6 +273,7 @@ static void ath_paprd_activate(struct ath_softc *sc)
269{ 273{
270 struct ath_hw *ah = sc->sc_ah; 274 struct ath_hw *ah = sc->sc_ah;
271 struct ath9k_hw_cal_data *caldata = ah->caldata; 275 struct ath9k_hw_cal_data *caldata = ah->caldata;
276 struct ath_common *common = ath9k_hw_common(ah);
272 int chain; 277 int chain;
273 278
274 if (!caldata || !caldata->paprd_done) 279 if (!caldata || !caldata->paprd_done)
@@ -277,7 +282,7 @@ static void ath_paprd_activate(struct ath_softc *sc)
277 ath9k_ps_wakeup(sc); 282 ath9k_ps_wakeup(sc);
278 ar9003_paprd_enable(ah, false); 283 ar9003_paprd_enable(ah, false);
279 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 284 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
280 if (!(ah->caps.tx_chainmask & BIT(chain))) 285 if (!(common->tx_chainmask & BIT(chain)))
281 continue; 286 continue;
282 287
283 ar9003_paprd_populate_single_table(ah, caldata, chain); 288 ar9003_paprd_populate_single_table(ah, caldata, chain);
@@ -299,6 +304,7 @@ void ath_paprd_calibrate(struct work_struct *work)
299 struct ieee80211_supported_band *sband = &sc->sbands[band]; 304 struct ieee80211_supported_band *sband = &sc->sbands[band];
300 struct ath_tx_control txctl; 305 struct ath_tx_control txctl;
301 struct ath9k_hw_cal_data *caldata = ah->caldata; 306 struct ath9k_hw_cal_data *caldata = ah->caldata;
307 struct ath_common *common = ath9k_hw_common(ah);
302 int qnum, ftype; 308 int qnum, ftype;
303 int chain_ok = 0; 309 int chain_ok = 0;
304 int chain; 310 int chain;
@@ -332,7 +338,7 @@ void ath_paprd_calibrate(struct work_struct *work)
332 ath9k_ps_wakeup(sc); 338 ath9k_ps_wakeup(sc);
333 ar9003_paprd_init_table(ah); 339 ar9003_paprd_init_table(ah);
334 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 340 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
335 if (!(ah->caps.tx_chainmask & BIT(chain))) 341 if (!(common->tx_chainmask & BIT(chain)))
336 continue; 342 continue;
337 343
338 chain_ok = 0; 344 chain_ok = 0;
@@ -550,7 +556,7 @@ void ath_hw_check(struct work_struct *work)
550 556
551 msleep(1); 557 msleep(1);
552 } 558 }
553 ath_reset(sc, false); 559 ath_reset(sc, true);
554 560
555out: 561out:
556 ath9k_ps_restore(sc); 562 ath9k_ps_restore(sc);
@@ -568,7 +574,7 @@ void ath9k_tasklet(unsigned long data)
568 ath9k_ps_wakeup(sc); 574 ath9k_ps_wakeup(sc);
569 575
570 if (status & ATH9K_INT_FATAL) { 576 if (status & ATH9K_INT_FATAL) {
571 ath_reset(sc, false); 577 ath_reset(sc, true);
572 ath9k_ps_restore(sc); 578 ath9k_ps_restore(sc);
573 return; 579 return;
574 } 580 }
@@ -583,7 +589,7 @@ void ath9k_tasklet(unsigned long data)
583 rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); 589 rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN);
584 590
585 if (status & rxmask) { 591 if (status & rxmask) {
586 spin_lock_bh(&sc->rx.rxflushlock); 592 spin_lock_bh(&sc->sc_pcu_lock);
587 593
588 /* Check for high priority Rx first */ 594 /* Check for high priority Rx first */
589 if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && 595 if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) &&
@@ -591,7 +597,7 @@ void ath9k_tasklet(unsigned long data)
591 ath_rx_tasklet(sc, 0, true); 597 ath_rx_tasklet(sc, 0, true);
592 598
593 ath_rx_tasklet(sc, 0, false); 599 ath_rx_tasklet(sc, 0, false);
594 spin_unlock_bh(&sc->rx.rxflushlock); 600 spin_unlock_bh(&sc->sc_pcu_lock);
595 } 601 }
596 602
597 if (status & ATH9K_INT_TX) { 603 if (status & ATH9K_INT_TX) {
@@ -838,7 +844,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
838 if (!ah->curchan) 844 if (!ah->curchan)
839 ah->curchan = ath_get_curchannel(sc, sc->hw); 845 ah->curchan = ath_get_curchannel(sc, sc->hw);
840 846
841 spin_lock_bh(&sc->sc_resetlock); 847 spin_lock_bh(&sc->sc_pcu_lock);
842 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 848 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
843 if (r) { 849 if (r) {
844 ath_print(common, ATH_DBG_FATAL, 850 ath_print(common, ATH_DBG_FATAL,
@@ -846,14 +852,15 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
846 "reset status %d\n", 852 "reset status %d\n",
847 channel->center_freq, r); 853 channel->center_freq, r);
848 } 854 }
849 spin_unlock_bh(&sc->sc_resetlock);
850 855
851 ath_update_txpow(sc); 856 ath_update_txpow(sc);
852 if (ath_startrecv(sc) != 0) { 857 if (ath_startrecv(sc) != 0) {
853 ath_print(common, ATH_DBG_FATAL, 858 ath_print(common, ATH_DBG_FATAL,
854 "Unable to restart recv logic\n"); 859 "Unable to restart recv logic\n");
860 spin_unlock_bh(&sc->sc_pcu_lock);
855 return; 861 return;
856 } 862 }
863 spin_unlock_bh(&sc->sc_pcu_lock);
857 864
858 if (sc->sc_flags & SC_OP_BEACONS) 865 if (sc->sc_flags & SC_OP_BEACONS)
859 ath_beacon_config(sc, NULL); /* restart beacons */ 866 ath_beacon_config(sc, NULL); /* restart beacons */
@@ -892,13 +899,15 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
892 ath9k_hw_set_interrupts(ah, 0); 899 ath9k_hw_set_interrupts(ah, 0);
893 900
894 ath_drain_all_txq(sc, false); /* clear pending tx frames */ 901 ath_drain_all_txq(sc, false); /* clear pending tx frames */
902
903 spin_lock_bh(&sc->sc_pcu_lock);
904
895 ath_stoprecv(sc); /* turn off frame recv */ 905 ath_stoprecv(sc); /* turn off frame recv */
896 ath_flushrecv(sc); /* flush recv queue */ 906 ath_flushrecv(sc); /* flush recv queue */
897 907
898 if (!ah->curchan) 908 if (!ah->curchan)
899 ah->curchan = ath_get_curchannel(sc, hw); 909 ah->curchan = ath_get_curchannel(sc, hw);
900 910
901 spin_lock_bh(&sc->sc_resetlock);
902 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 911 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
903 if (r) { 912 if (r) {
904 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 913 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
@@ -906,9 +915,11 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
906 "reset status %d\n", 915 "reset status %d\n",
907 channel->center_freq, r); 916 channel->center_freq, r);
908 } 917 }
909 spin_unlock_bh(&sc->sc_resetlock);
910 918
911 ath9k_hw_phy_disable(ah); 919 ath9k_hw_phy_disable(ah);
920
921 spin_unlock_bh(&sc->sc_pcu_lock);
922
912 ath9k_hw_configpcipowersave(ah, 1, 1); 923 ath9k_hw_configpcipowersave(ah, 1, 1);
913 ath9k_ps_restore(sc); 924 ath9k_ps_restore(sc);
914 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); 925 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP);
@@ -928,20 +939,23 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
928 939
929 ath9k_hw_set_interrupts(ah, 0); 940 ath9k_hw_set_interrupts(ah, 0);
930 ath_drain_all_txq(sc, retry_tx); 941 ath_drain_all_txq(sc, retry_tx);
942
943 spin_lock_bh(&sc->sc_pcu_lock);
944
931 ath_stoprecv(sc); 945 ath_stoprecv(sc);
932 ath_flushrecv(sc); 946 ath_flushrecv(sc);
933 947
934 spin_lock_bh(&sc->sc_resetlock);
935 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); 948 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
936 if (r) 949 if (r)
937 ath_print(common, ATH_DBG_FATAL, 950 ath_print(common, ATH_DBG_FATAL,
938 "Unable to reset hardware; reset status %d\n", r); 951 "Unable to reset hardware; reset status %d\n", r);
939 spin_unlock_bh(&sc->sc_resetlock);
940 952
941 if (ath_startrecv(sc) != 0) 953 if (ath_startrecv(sc) != 0)
942 ath_print(common, ATH_DBG_FATAL, 954 ath_print(common, ATH_DBG_FATAL,
943 "Unable to start recv logic\n"); 955 "Unable to start recv logic\n");
944 956
957 spin_unlock_bh(&sc->sc_pcu_lock);
958
945 /* 959 /*
946 * We may be doing a reset in response to a request 960 * We may be doing a reset in response to a request
947 * that changes the channel so update any state that 961 * that changes the channel so update any state that
@@ -951,7 +965,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
951 965
952 ath_update_txpow(sc); 966 ath_update_txpow(sc);
953 967
954 if (sc->sc_flags & SC_OP_BEACONS) 968 if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL)))
955 ath_beacon_config(sc, NULL); /* restart beacons */ 969 ath_beacon_config(sc, NULL); /* restart beacons */
956 970
957 ath9k_hw_set_interrupts(ah, ah->imask); 971 ath9k_hw_set_interrupts(ah, ah->imask);
@@ -1106,17 +1120,16 @@ static int ath9k_start(struct ieee80211_hw *hw)
1106 * be followed by initialization of the appropriate bits 1120 * be followed by initialization of the appropriate bits
1107 * and then setup of the interrupt mask. 1121 * and then setup of the interrupt mask.
1108 */ 1122 */
1109 spin_lock_bh(&sc->sc_resetlock); 1123 spin_lock_bh(&sc->sc_pcu_lock);
1110 r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); 1124 r = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
1111 if (r) { 1125 if (r) {
1112 ath_print(common, ATH_DBG_FATAL, 1126 ath_print(common, ATH_DBG_FATAL,
1113 "Unable to reset hardware; reset status %d " 1127 "Unable to reset hardware; reset status %d "
1114 "(freq %u MHz)\n", r, 1128 "(freq %u MHz)\n", r,
1115 curchan->center_freq); 1129 curchan->center_freq);
1116 spin_unlock_bh(&sc->sc_resetlock); 1130 spin_unlock_bh(&sc->sc_pcu_lock);
1117 goto mutex_unlock; 1131 goto mutex_unlock;
1118 } 1132 }
1119 spin_unlock_bh(&sc->sc_resetlock);
1120 1133
1121 /* 1134 /*
1122 * This is needed only to setup initial state 1135 * This is needed only to setup initial state
@@ -1135,8 +1148,10 @@ static int ath9k_start(struct ieee80211_hw *hw)
1135 ath_print(common, ATH_DBG_FATAL, 1148 ath_print(common, ATH_DBG_FATAL,
1136 "Unable to start recv logic\n"); 1149 "Unable to start recv logic\n");
1137 r = -EIO; 1150 r = -EIO;
1151 spin_unlock_bh(&sc->sc_pcu_lock);
1138 goto mutex_unlock; 1152 goto mutex_unlock;
1139 } 1153 }
1154 spin_unlock_bh(&sc->sc_pcu_lock);
1140 1155
1141 /* Setup our intr mask. */ 1156 /* Setup our intr mask. */
1142 ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | 1157 ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
@@ -1340,18 +1355,24 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1340 1355
1341 if (!(sc->sc_flags & SC_OP_INVALID)) { 1356 if (!(sc->sc_flags & SC_OP_INVALID)) {
1342 ath_drain_all_txq(sc, false); 1357 ath_drain_all_txq(sc, false);
1358 spin_lock_bh(&sc->sc_pcu_lock);
1343 ath_stoprecv(sc); 1359 ath_stoprecv(sc);
1344 ath9k_hw_phy_disable(ah); 1360 ath9k_hw_phy_disable(ah);
1345 } else 1361 spin_unlock_bh(&sc->sc_pcu_lock);
1362 } else {
1363 spin_lock_bh(&sc->sc_pcu_lock);
1346 sc->rx.rxlink = NULL; 1364 sc->rx.rxlink = NULL;
1365 spin_unlock_bh(&sc->sc_pcu_lock);
1366 }
1347 1367
1348 /* disable HAL and put h/w to sleep */ 1368 /* disable HAL and put h/w to sleep */
1349 ath9k_hw_disable(ah); 1369 ath9k_hw_disable(ah);
1350 ath9k_hw_configpcipowersave(ah, 1, 1); 1370 ath9k_hw_configpcipowersave(ah, 1, 1);
1351 ath9k_ps_restore(sc); 1371 ath9k_ps_restore(sc);
1352 1372
1353 /* Finally, put the chip in FULL SLEEP mode */ 1373 sc->ps_idle = true;
1354 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); 1374 ath9k_set_wiphy_idle(aphy, true);
1375 ath_radio_disable(sc, hw);
1355 1376
1356 sc->sc_flags |= SC_OP_INVALID; 1377 sc->sc_flags |= SC_OP_INVALID;
1357 1378
@@ -1455,6 +1476,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1455 struct ath_softc *sc = aphy->sc; 1476 struct ath_softc *sc = aphy->sc;
1456 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1477 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1457 struct ath_vif *avp = (void *)vif->drv_priv; 1478 struct ath_vif *avp = (void *)vif->drv_priv;
1479 bool bs_valid = false;
1458 int i; 1480 int i;
1459 1481
1460 ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1482 ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
@@ -1483,7 +1505,15 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1483 "slot\n", __func__); 1505 "slot\n", __func__);
1484 sc->beacon.bslot[i] = NULL; 1506 sc->beacon.bslot[i] = NULL;
1485 sc->beacon.bslot_aphy[i] = NULL; 1507 sc->beacon.bslot_aphy[i] = NULL;
1486 } 1508 } else if (sc->beacon.bslot[i])
1509 bs_valid = true;
1510 }
1511 if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) {
1512 /* Disable SWBA interrupt */
1513 sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
1514 ath9k_ps_wakeup(sc);
1515 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
1516 ath9k_ps_restore(sc);
1487 } 1517 }
1488 1518
1489 sc->nvifs--; 1519 sc->nvifs--;
@@ -1556,6 +1586,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1556 * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. 1586 * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode.
1557 */ 1587 */
1558 if (changed & IEEE80211_CONF_CHANGE_PS) { 1588 if (changed & IEEE80211_CONF_CHANGE_PS) {
1589 unsigned long flags;
1590 spin_lock_irqsave(&sc->sc_pm_lock, flags);
1559 if (conf->flags & IEEE80211_CONF_PS) { 1591 if (conf->flags & IEEE80211_CONF_PS) {
1560 sc->ps_flags |= PS_ENABLED; 1592 sc->ps_flags |= PS_ENABLED;
1561 /* 1593 /*
@@ -1570,7 +1602,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1570 sc->ps_enabled = false; 1602 sc->ps_enabled = false;
1571 sc->ps_flags &= ~(PS_ENABLED | 1603 sc->ps_flags &= ~(PS_ENABLED |
1572 PS_NULLFUNC_COMPLETED); 1604 PS_NULLFUNC_COMPLETED);
1573 ath9k_setpower(sc, ATH9K_PM_AWAKE); 1605 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
1574 if (!(ah->caps.hw_caps & 1606 if (!(ah->caps.hw_caps &
1575 ATH9K_HW_CAP_AUTOSLEEP)) { 1607 ATH9K_HW_CAP_AUTOSLEEP)) {
1576 ath9k_hw_setrxabort(sc->sc_ah, 0); 1608 ath9k_hw_setrxabort(sc->sc_ah, 0);
@@ -1585,6 +1617,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1585 } 1617 }
1586 } 1618 }
1587 } 1619 }
1620 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1588 } 1621 }
1589 1622
1590 if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1623 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
@@ -1968,8 +2001,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1968 break; 2001 break;
1969 case IEEE80211_AMPDU_TX_START: 2002 case IEEE80211_AMPDU_TX_START:
1970 ath9k_ps_wakeup(sc); 2003 ath9k_ps_wakeup(sc);
1971 ath_tx_aggr_start(sc, sta, tid, ssn); 2004 ret = ath_tx_aggr_start(sc, sta, tid, ssn);
1972 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 2005 if (!ret)
2006 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1973 ath9k_ps_restore(sc); 2007 ath9k_ps_restore(sc);
1974 break; 2008 break;
1975 case IEEE80211_AMPDU_TX_STOP: 2009 case IEEE80211_AMPDU_TX_STOP:
@@ -2032,7 +2066,6 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
2032 2066
2033 aphy->state = ATH_WIPHY_SCAN; 2067 aphy->state = ATH_WIPHY_SCAN;
2034 ath9k_wiphy_pause_all_forced(sc, aphy); 2068 ath9k_wiphy_pause_all_forced(sc, aphy);
2035 sc->sc_flags |= SC_OP_SCANNING;
2036 mutex_unlock(&sc->mutex); 2069 mutex_unlock(&sc->mutex);
2037} 2070}
2038 2071
@@ -2047,7 +2080,6 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2047 2080
2048 mutex_lock(&sc->mutex); 2081 mutex_lock(&sc->mutex);
2049 aphy->state = ATH_WIPHY_ACTIVE; 2082 aphy->state = ATH_WIPHY_ACTIVE;
2050 sc->sc_flags &= ~SC_OP_SCANNING;
2051 mutex_unlock(&sc->mutex); 2083 mutex_unlock(&sc->mutex);
2052} 2084}
2053 2085
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index b5b651413e77..894ebadbb1d3 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -290,6 +290,10 @@ static int ath_pci_resume(struct pci_dev *pdev)
290 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 290 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
291 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); 291 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
292 292
293 sc->ps_idle = true;
294 ath9k_set_wiphy_idle(aphy, true);
295 ath_radio_disable(sc, hw);
296
293 return 0; 297 return 0;
294} 298}
295 299
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index e49be733d546..5f825cec5b4d 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -538,7 +538,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv,
538 for (i = 0; i < rateset->rs_nrates; i++) { 538 for (i = 0; i < rateset->rs_nrates; i++) {
539 for (j = 0; j < rate_table->rate_cnt; j++) { 539 for (j = 0; j < rate_table->rate_cnt; j++) {
540 u32 phy = rate_table->info[j].phy; 540 u32 phy = rate_table->info[j].phy;
541 u16 rate_flags = rate_table->info[i].rate_flags; 541 u16 rate_flags = rate_table->info[j].rate_flags;
542 u8 rate = rateset->rs_rates[i]; 542 u8 rate = rateset->rs_rates[i];
543 u8 dot11rate = rate_table->info[j].dot11rate; 543 u8 dot11rate = rate_table->info[j].dot11rate;
544 544
@@ -1359,6 +1359,12 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1359 if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) 1359 if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED)
1360 return; 1360 return;
1361 1361
1362 if (!(tx_info->flags & IEEE80211_TX_STAT_AMPDU)) {
1363 tx_info->status.ampdu_ack_len =
1364 (tx_info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0);
1365 tx_info->status.ampdu_len = 1;
1366 }
1367
1362 /* 1368 /*
1363 * If an underrun error is seen assume it as an excessive retry only 1369 * If an underrun error is seen assume it as an excessive retry only
1364 * if max frame trigger level has been reached (2 KB for singel stream, 1370 * if max frame trigger level has been reached (2 KB for singel stream,
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index a3fc987ebab0..912f747593cd 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -288,19 +288,17 @@ static void ath_edma_start_recv(struct ath_softc *sc)
288 ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP, 288 ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP,
289 sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize); 289 sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize);
290 290
291 spin_unlock_bh(&sc->rx.rxbuflock);
292
293 ath_opmode_init(sc); 291 ath_opmode_init(sc);
294 292
295 ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_SCANNING)); 293 ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_OFFCHANNEL));
294
295 spin_unlock_bh(&sc->rx.rxbuflock);
296} 296}
297 297
298static void ath_edma_stop_recv(struct ath_softc *sc) 298static void ath_edma_stop_recv(struct ath_softc *sc)
299{ 299{
300 spin_lock_bh(&sc->rx.rxbuflock);
301 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); 300 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP);
302 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); 301 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP);
303 spin_unlock_bh(&sc->rx.rxbuflock);
304} 302}
305 303
306int ath_rx_init(struct ath_softc *sc, int nbufs) 304int ath_rx_init(struct ath_softc *sc, int nbufs)
@@ -310,7 +308,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
310 struct ath_buf *bf; 308 struct ath_buf *bf;
311 int error = 0; 309 int error = 0;
312 310
313 spin_lock_init(&sc->rx.rxflushlock); 311 spin_lock_init(&sc->sc_pcu_lock);
314 sc->sc_flags &= ~SC_OP_RXFLUSH; 312 sc->sc_flags &= ~SC_OP_RXFLUSH;
315 spin_lock_init(&sc->rx.rxbuflock); 313 spin_lock_init(&sc->rx.rxbuflock);
316 314
@@ -496,9 +494,10 @@ int ath_startrecv(struct ath_softc *sc)
496 ath9k_hw_rxena(ah); 494 ath9k_hw_rxena(ah);
497 495
498start_recv: 496start_recv:
499 spin_unlock_bh(&sc->rx.rxbuflock);
500 ath_opmode_init(sc); 497 ath_opmode_init(sc);
501 ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_SCANNING)); 498 ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_OFFCHANNEL));
499
500 spin_unlock_bh(&sc->rx.rxbuflock);
502 501
503 return 0; 502 return 0;
504} 503}
@@ -508,7 +507,8 @@ bool ath_stoprecv(struct ath_softc *sc)
508 struct ath_hw *ah = sc->sc_ah; 507 struct ath_hw *ah = sc->sc_ah;
509 bool stopped; 508 bool stopped;
510 509
511 ath9k_hw_stoppcurecv(ah); 510 spin_lock_bh(&sc->rx.rxbuflock);
511 ath9k_hw_abortpcurecv(ah);
512 ath9k_hw_setrxfilter(ah, 0); 512 ath9k_hw_setrxfilter(ah, 0);
513 stopped = ath9k_hw_stopdmarecv(ah); 513 stopped = ath9k_hw_stopdmarecv(ah);
514 514
@@ -516,19 +516,18 @@ bool ath_stoprecv(struct ath_softc *sc)
516 ath_edma_stop_recv(sc); 516 ath_edma_stop_recv(sc);
517 else 517 else
518 sc->rx.rxlink = NULL; 518 sc->rx.rxlink = NULL;
519 spin_unlock_bh(&sc->rx.rxbuflock);
519 520
520 return stopped; 521 return stopped;
521} 522}
522 523
523void ath_flushrecv(struct ath_softc *sc) 524void ath_flushrecv(struct ath_softc *sc)
524{ 525{
525 spin_lock_bh(&sc->rx.rxflushlock);
526 sc->sc_flags |= SC_OP_RXFLUSH; 526 sc->sc_flags |= SC_OP_RXFLUSH;
527 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) 527 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
528 ath_rx_tasklet(sc, 1, true); 528 ath_rx_tasklet(sc, 1, true);
529 ath_rx_tasklet(sc, 1, false); 529 ath_rx_tasklet(sc, 1, false);
530 sc->sc_flags &= ~SC_OP_RXFLUSH; 530 sc->sc_flags &= ~SC_OP_RXFLUSH;
531 spin_unlock_bh(&sc->rx.rxflushlock);
532} 531}
533 532
534static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) 533static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb)
@@ -631,7 +630,7 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
631 * No more broadcast/multicast frames to be received at this 630 * No more broadcast/multicast frames to be received at this
632 * point. 631 * point.
633 */ 632 */
634 sc->ps_flags &= ~PS_WAIT_FOR_CAB; 633 sc->ps_flags &= ~(PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON);
635 ath_print(common, ATH_DBG_PS, 634 ath_print(common, ATH_DBG_PS,
636 "All PS CAB frames received, back to sleep\n"); 635 "All PS CAB frames received, back to sleep\n");
637 } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && 636 } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) &&
@@ -870,15 +869,18 @@ static bool ath9k_rx_accept(struct ath_common *common,
870 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { 869 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
871 *decrypt_error = true; 870 *decrypt_error = true;
872 } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { 871 } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) {
873 if (ieee80211_is_ctl(fc)) 872 /*
874 /* 873 * The MIC error bit is only valid if the frame
875 * Sometimes, we get invalid 874 * is not a control frame or fragment, and it was
876 * MIC failures on valid control frames. 875 * decrypted using a valid TKIP key.
877 * Remove these mic errors. 876 */
878 */ 877 if (!ieee80211_is_ctl(fc) &&
879 rx_stats->rs_status &= ~ATH9K_RXERR_MIC; 878 !ieee80211_has_morefrags(fc) &&
880 else 879 !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
880 test_bit(rx_stats->rs_keyix, common->tkip_keymap))
881 rxs->flag |= RX_FLAG_MMIC_ERROR; 881 rxs->flag |= RX_FLAG_MMIC_ERROR;
882 else
883 rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
882 } 884 }
883 /* 885 /*
884 * Reject error frames with the exception of 886 * Reject error frames with the exception of
@@ -1033,9 +1035,11 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common,
1033 int hdrlen, padpos, padsize; 1035 int hdrlen, padpos, padsize;
1034 u8 keyix; 1036 u8 keyix;
1035 __le16 fc; 1037 __le16 fc;
1038 bool is_mc;
1036 1039
1037 /* see if any padding is done by the hw and remove it */ 1040 /* see if any padding is done by the hw and remove it */
1038 hdr = (struct ieee80211_hdr *) skb->data; 1041 hdr = (struct ieee80211_hdr *) skb->data;
1042 is_mc = !!is_multicast_ether_addr(hdr->addr1);
1039 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1043 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
1040 fc = hdr->frame_control; 1044 fc = hdr->frame_control;
1041 padpos = ath9k_cmn_padpos(hdr->frame_control); 1045 padpos = ath9k_cmn_padpos(hdr->frame_control);
@@ -1056,7 +1060,7 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common,
1056 1060
1057 keyix = rx_stats->rs_keyix; 1061 keyix = rx_stats->rs_keyix;
1058 1062
1059 if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error && 1063 if ((is_mc || !(keyix == ATH9K_RXKEYIX_INVALID)) && !decrypt_error &&
1060 ieee80211_has_protected(fc)) { 1064 ieee80211_has_protected(fc)) {
1061 rxs->flag |= RX_FLAG_DECRYPTED; 1065 rxs->flag |= RX_FLAG_DECRYPTED;
1062 } else if (ieee80211_has_protected(fc) 1066 } else if (ieee80211_has_protected(fc)
@@ -1096,6 +1100,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1096 u8 rx_status_len = ah->caps.rx_status_len; 1100 u8 rx_status_len = ah->caps.rx_status_len;
1097 u64 tsf = 0; 1101 u64 tsf = 0;
1098 u32 tsf_lower = 0; 1102 u32 tsf_lower = 0;
1103 unsigned long flags;
1099 1104
1100 if (edma) 1105 if (edma)
1101 dma_type = DMA_BIDIRECTIONAL; 1106 dma_type = DMA_BIDIRECTIONAL;
@@ -1204,11 +1209,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1204 sc->rx.rxotherant = 0; 1209 sc->rx.rxotherant = 0;
1205 } 1210 }
1206 1211
1212 spin_lock_irqsave(&sc->sc_pm_lock, flags);
1207 if (unlikely(ath9k_check_auto_sleep(sc) || 1213 if (unlikely(ath9k_check_auto_sleep(sc) ||
1208 (sc->ps_flags & (PS_WAIT_FOR_BEACON | 1214 (sc->ps_flags & (PS_WAIT_FOR_BEACON |
1209 PS_WAIT_FOR_CAB | 1215 PS_WAIT_FOR_CAB |
1210 PS_WAIT_FOR_PSPOLL_DATA)))) 1216 PS_WAIT_FOR_PSPOLL_DATA))))
1211 ath_rx_ps(sc, skb); 1217 ath_rx_ps(sc, skb);
1218 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1212 1219
1213 ath_rx_send_to_mac80211(hw, sc, skb, rxs); 1220 ath_rx_send_to_mac80211(hw, sc, skb, rxs);
1214 1221
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index d01c4adab8d6..86b0a4b1a72f 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -709,6 +709,7 @@
709#define AR_WA_RESET_EN (1 << 18) /* Sw Control to enable PCI-Reset to POR (bit 15) */ 709#define AR_WA_RESET_EN (1 << 18) /* Sw Control to enable PCI-Reset to POR (bit 15) */
710#define AR_WA_ANALOG_SHIFT (1 << 20) 710#define AR_WA_ANALOG_SHIFT (1 << 20)
711#define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */ 711#define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */
712#define AR_WA_BIT22 (1 << 22)
712#define AR9285_WA_DEFAULT 0x004a050b 713#define AR9285_WA_DEFAULT 0x004a050b
713#define AR9280_WA_DEFAULT 0x0040073b 714#define AR9280_WA_DEFAULT 0x0040073b
714#define AR_WA_DEFAULT 0x0000073f 715#define AR_WA_DEFAULT 0x0000073f
@@ -900,7 +901,13 @@
900#define AR_DEVID_7010(_ah) \ 901#define AR_DEVID_7010(_ah) \
901 (((_ah)->hw_version.devid == 0x7010) || \ 902 (((_ah)->hw_version.devid == 0x7010) || \
902 ((_ah)->hw_version.devid == 0x7015) || \ 903 ((_ah)->hw_version.devid == 0x7015) || \
903 ((_ah)->hw_version.devid == 0x9018)) 904 ((_ah)->hw_version.devid == 0x9018) || \
905 ((_ah)->hw_version.devid == 0xA704) || \
906 ((_ah)->hw_version.devid == 0x1200))
907
908#define AR9287_HTC_DEVID(_ah) \
909 (((_ah)->hw_version.devid == 0x7015) || \
910 ((_ah)->hw_version.devid == 0x1200))
904 911
905#define AR_RADIO_SREV_MAJOR 0xf0 912#define AR_RADIO_SREV_MAJOR 0xf0
906#define AR_RAD5133_SREV_MAJOR 0xc0 913#define AR_RAD5133_SREV_MAJOR 0xc0
@@ -1012,11 +1019,13 @@ enum {
1012#define AR9287_GPIO_IN_VAL_S 11 1019#define AR9287_GPIO_IN_VAL_S 11
1013#define AR9271_GPIO_IN_VAL 0xFFFF0000 1020#define AR9271_GPIO_IN_VAL 0xFFFF0000
1014#define AR9271_GPIO_IN_VAL_S 16 1021#define AR9271_GPIO_IN_VAL_S 16
1015#define AR9300_GPIO_IN_VAL 0x0001FFFF
1016#define AR9300_GPIO_IN_VAL_S 0
1017#define AR7010_GPIO_IN_VAL 0x0000FFFF 1022#define AR7010_GPIO_IN_VAL 0x0000FFFF
1018#define AR7010_GPIO_IN_VAL_S 0 1023#define AR7010_GPIO_IN_VAL_S 0
1019 1024
1025#define AR_GPIO_IN 0x404c
1026#define AR9300_GPIO_IN_VAL 0x0001FFFF
1027#define AR9300_GPIO_IN_VAL_S 0
1028
1020#define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) 1029#define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c)
1021#define AR_GPIO_OE_OUT_DRV 0x3 1030#define AR_GPIO_OE_OUT_DRV 0x3
1022#define AR_GPIO_OE_OUT_DRV_NO 0x0 1031#define AR_GPIO_OE_OUT_DRV_NO 0x0
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 4dda14e36227..8f00c6c13979 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -61,6 +61,8 @@ static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
61 struct ath_tx_status *ts, int txok); 61 struct ath_tx_status *ts, int txok);
62static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, 62static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
63 int nbad, int txok, bool update_rc); 63 int nbad, int txok, bool update_rc);
64static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
65 int seqno);
64 66
65enum { 67enum {
66 MCS_HT20, 68 MCS_HT20,
@@ -143,18 +145,23 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
143 struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum]; 145 struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
144 struct ath_buf *bf; 146 struct ath_buf *bf;
145 struct list_head bf_head; 147 struct list_head bf_head;
146 INIT_LIST_HEAD(&bf_head); 148 struct ath_tx_status ts;
147 149
148 WARN_ON(!tid->paused); 150 INIT_LIST_HEAD(&bf_head);
149 151
152 memset(&ts, 0, sizeof(ts));
150 spin_lock_bh(&txq->axq_lock); 153 spin_lock_bh(&txq->axq_lock);
151 tid->paused = false;
152 154
153 while (!list_empty(&tid->buf_q)) { 155 while (!list_empty(&tid->buf_q)) {
154 bf = list_first_entry(&tid->buf_q, struct ath_buf, list); 156 bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
155 BUG_ON(bf_isretried(bf));
156 list_move_tail(&bf->list, &bf_head); 157 list_move_tail(&bf->list, &bf_head);
157 ath_tx_send_ht_normal(sc, txq, tid, &bf_head); 158
159 if (bf_isretried(bf)) {
160 ath_tx_update_baw(sc, tid, bf->bf_seqno);
161 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
162 } else {
163 ath_tx_send_ht_normal(sc, txq, tid, &bf_head);
164 }
158 } 165 }
159 166
160 spin_unlock_bh(&txq->axq_lock); 167 spin_unlock_bh(&txq->axq_lock);
@@ -312,6 +319,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
312 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; 319 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
313 bool rc_update = true; 320 bool rc_update = true;
314 struct ieee80211_tx_rate rates[4]; 321 struct ieee80211_tx_rate rates[4];
322 int nframes;
315 323
316 skb = bf->bf_mpdu; 324 skb = bf->bf_mpdu;
317 hdr = (struct ieee80211_hdr *)skb->data; 325 hdr = (struct ieee80211_hdr *)skb->data;
@@ -320,6 +328,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
320 hw = bf->aphy->hw; 328 hw = bf->aphy->hw;
321 329
322 memcpy(rates, tx_info->control.rates, sizeof(rates)); 330 memcpy(rates, tx_info->control.rates, sizeof(rates));
331 nframes = bf->bf_nframes;
323 332
324 rcu_read_lock(); 333 rcu_read_lock();
325 334
@@ -337,7 +346,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
337 !bf->bf_stale || bf_next != NULL) 346 !bf->bf_stale || bf_next != NULL)
338 list_move_tail(&bf->list, &bf_head); 347 list_move_tail(&bf->list, &bf_head);
339 348
340 ath_tx_rc_status(bf, ts, 0, 0, false); 349 ath_tx_rc_status(bf, ts, 1, 0, false);
341 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 350 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
342 0, 0); 351 0, 0);
343 352
@@ -431,7 +440,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
431 list_move_tail(&bf->list, &bf_head); 440 list_move_tail(&bf->list, &bf_head);
432 } 441 }
433 442
434 if (!txpending) { 443 if (!txpending || (tid->state & AGGR_CLEANUP)) {
435 /* 444 /*
436 * complete the acked-ones/xretried ones; update 445 * complete the acked-ones/xretried ones; update
437 * block-ack window 446 * block-ack window
@@ -442,6 +451,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
442 451
443 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { 452 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
444 memcpy(tx_info->control.rates, rates, sizeof(rates)); 453 memcpy(tx_info->control.rates, rates, sizeof(rates));
454 bf->bf_nframes = nframes;
445 ath_tx_rc_status(bf, ts, nbad, txok, true); 455 ath_tx_rc_status(bf, ts, nbad, txok, true);
446 rc_update = false; 456 rc_update = false;
447 } else { 457 } else {
@@ -510,15 +520,12 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
510 } 520 }
511 521
512 if (tid->state & AGGR_CLEANUP) { 522 if (tid->state & AGGR_CLEANUP) {
523 ath_tx_flush_tid(sc, tid);
524
513 if (tid->baw_head == tid->baw_tail) { 525 if (tid->baw_head == tid->baw_tail) {
514 tid->state &= ~AGGR_ADDBA_COMPLETE; 526 tid->state &= ~AGGR_ADDBA_COMPLETE;
515 tid->state &= ~AGGR_CLEANUP; 527 tid->state &= ~AGGR_CLEANUP;
516
517 /* send buffered frames as singles */
518 ath_tx_flush_tid(sc, tid);
519 } 528 }
520 rcu_read_unlock();
521 return;
522 } 529 }
523 530
524 rcu_read_unlock(); 531 rcu_read_unlock();
@@ -785,17 +792,23 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
785 status != ATH_AGGR_BAW_CLOSED); 792 status != ATH_AGGR_BAW_CLOSED);
786} 793}
787 794
788void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 795int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
789 u16 tid, u16 *ssn) 796 u16 tid, u16 *ssn)
790{ 797{
791 struct ath_atx_tid *txtid; 798 struct ath_atx_tid *txtid;
792 struct ath_node *an; 799 struct ath_node *an;
793 800
794 an = (struct ath_node *)sta->drv_priv; 801 an = (struct ath_node *)sta->drv_priv;
795 txtid = ATH_AN_2_TID(an, tid); 802 txtid = ATH_AN_2_TID(an, tid);
803
804 if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE))
805 return -EAGAIN;
806
796 txtid->state |= AGGR_ADDBA_PROGRESS; 807 txtid->state |= AGGR_ADDBA_PROGRESS;
797 txtid->paused = true; 808 txtid->paused = true;
798 *ssn = txtid->seq_start; 809 *ssn = txtid->seq_start;
810
811 return 0;
799} 812}
800 813
801void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 814void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
@@ -803,12 +816,6 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
803 struct ath_node *an = (struct ath_node *)sta->drv_priv; 816 struct ath_node *an = (struct ath_node *)sta->drv_priv;
804 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); 817 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
805 struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum]; 818 struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum];
806 struct ath_tx_status ts;
807 struct ath_buf *bf;
808 struct list_head bf_head;
809
810 memset(&ts, 0, sizeof(ts));
811 INIT_LIST_HEAD(&bf_head);
812 819
813 if (txtid->state & AGGR_CLEANUP) 820 if (txtid->state & AGGR_CLEANUP)
814 return; 821 return;
@@ -818,31 +825,22 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
818 return; 825 return;
819 } 826 }
820 827
821 /* drop all software retried frames and mark this TID */
822 spin_lock_bh(&txq->axq_lock); 828 spin_lock_bh(&txq->axq_lock);
823 txtid->paused = true; 829 txtid->paused = true;
824 while (!list_empty(&txtid->buf_q)) {
825 bf = list_first_entry(&txtid->buf_q, struct ath_buf, list);
826 if (!bf_isretried(bf)) {
827 /*
828 * NB: it's based on the assumption that
829 * software retried frame will always stay
830 * at the head of software queue.
831 */
832 break;
833 }
834 list_move_tail(&bf->list, &bf_head);
835 ath_tx_update_baw(sc, txtid, bf->bf_seqno);
836 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
837 }
838 spin_unlock_bh(&txq->axq_lock);
839 830
840 if (txtid->baw_head != txtid->baw_tail) { 831 /*
832 * If frames are still being transmitted for this TID, they will be
833 * cleaned up during tx completion. To prevent race conditions, this
834 * TID can only be reused after all in-progress subframes have been
835 * completed.
836 */
837 if (txtid->baw_head != txtid->baw_tail)
841 txtid->state |= AGGR_CLEANUP; 838 txtid->state |= AGGR_CLEANUP;
842 } else { 839 else
843 txtid->state &= ~AGGR_ADDBA_COMPLETE; 840 txtid->state &= ~AGGR_ADDBA_COMPLETE;
844 ath_tx_flush_tid(sc, txtid); 841 spin_unlock_bh(&txq->axq_lock);
845 } 842
843 ath_tx_flush_tid(sc, txtid);
846} 844}
847 845
848void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 846void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
@@ -1103,15 +1101,6 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1103 txq->axq_tx_inprogress = false; 1101 txq->axq_tx_inprogress = false;
1104 spin_unlock_bh(&txq->axq_lock); 1102 spin_unlock_bh(&txq->axq_lock);
1105 1103
1106 /* flush any pending frames if aggregation is enabled */
1107 if (sc->sc_flags & SC_OP_TXAGGR) {
1108 if (!retry_tx) {
1109 spin_lock_bh(&txq->axq_lock);
1110 ath_txq_drain_pending_buffers(sc, txq);
1111 spin_unlock_bh(&txq->axq_lock);
1112 }
1113 }
1114
1115 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { 1104 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
1116 spin_lock_bh(&txq->axq_lock); 1105 spin_lock_bh(&txq->axq_lock);
1117 while (!list_empty(&txq->txq_fifo_pending)) { 1106 while (!list_empty(&txq->txq_fifo_pending)) {
@@ -1132,6 +1121,15 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1132 } 1121 }
1133 spin_unlock_bh(&txq->axq_lock); 1122 spin_unlock_bh(&txq->axq_lock);
1134 } 1123 }
1124
1125 /* flush any pending frames if aggregation is enabled */
1126 if (sc->sc_flags & SC_OP_TXAGGR) {
1127 if (!retry_tx) {
1128 spin_lock_bh(&txq->axq_lock);
1129 ath_txq_drain_pending_buffers(sc, txq);
1130 spin_unlock_bh(&txq->axq_lock);
1131 }
1132 }
1135} 1133}
1136 1134
1137void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) 1135void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
@@ -1162,13 +1160,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
1162 ath_print(common, ATH_DBG_FATAL, 1160 ath_print(common, ATH_DBG_FATAL,
1163 "Failed to stop TX DMA. Resetting hardware!\n"); 1161 "Failed to stop TX DMA. Resetting hardware!\n");
1164 1162
1165 spin_lock_bh(&sc->sc_resetlock); 1163 spin_lock_bh(&sc->sc_pcu_lock);
1166 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); 1164 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
1167 if (r) 1165 if (r)
1168 ath_print(common, ATH_DBG_FATAL, 1166 ath_print(common, ATH_DBG_FATAL,
1169 "Unable to reset hardware; reset status %d\n", 1167 "Unable to reset hardware; reset status %d\n",
1170 r); 1168 r);
1171 spin_unlock_bh(&sc->sc_resetlock); 1169 spin_unlock_bh(&sc->sc_pcu_lock);
1172 } 1170 }
1173 1171
1174 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 1172 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
@@ -2024,9 +2022,15 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
2024 2022
2025 if (ts->ts_status & ATH9K_TXERR_FILT) 2023 if (ts->ts_status & ATH9K_TXERR_FILT)
2026 tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 2024 tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
2027 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) 2025 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) {
2028 tx_info->flags |= IEEE80211_TX_STAT_AMPDU; 2026 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
2029 2027
2028 BUG_ON(nbad > bf->bf_nframes);
2029
2030 tx_info->status.ampdu_len = bf->bf_nframes;
2031 tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad;
2032 }
2033
2030 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && 2034 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 &&
2031 (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { 2035 (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) {
2032 if (ieee80211_is_data(hdr->frame_control)) { 2036 if (ieee80211_is_data(hdr->frame_control)) {
@@ -2036,8 +2040,6 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
2036 if ((ts->ts_status & ATH9K_TXERR_XRETRY) || 2040 if ((ts->ts_status & ATH9K_TXERR_XRETRY) ||
2037 (ts->ts_status & ATH9K_TXERR_FIFO)) 2041 (ts->ts_status & ATH9K_TXERR_FIFO))
2038 tx_info->pad[0] |= ATH_TX_INFO_XRETRY; 2042 tx_info->pad[0] |= ATH_TX_INFO_XRETRY;
2039 tx_info->status.ampdu_len = bf->bf_nframes;
2040 tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad;
2041 } 2043 }
2042 } 2044 }
2043 2045
@@ -2159,7 +2161,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2159 */ 2161 */
2160 if (ts.ts_status & ATH9K_TXERR_XRETRY) 2162 if (ts.ts_status & ATH9K_TXERR_XRETRY)
2161 bf->bf_state.bf_type |= BUF_XRETRY; 2163 bf->bf_state.bf_type |= BUF_XRETRY;
2162 ath_tx_rc_status(bf, &ts, 0, txok, true); 2164 ath_tx_rc_status(bf, &ts, txok ? 0 : 1, txok, true);
2163 } 2165 }
2164 2166
2165 if (bf_isampdu(bf)) 2167 if (bf_isampdu(bf))
@@ -2204,7 +2206,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
2204 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, 2206 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET,
2205 "tx hung, resetting the chip\n"); 2207 "tx hung, resetting the chip\n");
2206 ath9k_ps_wakeup(sc); 2208 ath9k_ps_wakeup(sc);
2207 ath_reset(sc, false); 2209 ath_reset(sc, true);
2208 ath9k_ps_restore(sc); 2210 ath9k_ps_restore(sc);
2209 } 2211 }
2210 2212
@@ -2288,7 +2290,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
2288 if (!bf_isampdu(bf)) { 2290 if (!bf_isampdu(bf)) {
2289 if (txs.ts_status & ATH9K_TXERR_XRETRY) 2291 if (txs.ts_status & ATH9K_TXERR_XRETRY)
2290 bf->bf_state.bf_type |= BUF_XRETRY; 2292 bf->bf_state.bf_type |= BUF_XRETRY;
2291 ath_tx_rc_status(bf, &txs, 0, txok, true); 2293 ath_tx_rc_status(bf, &txs, txok ? 0 : 1, txok, true);
2292 } 2294 }
2293 2295
2294 if (bf_isampdu(bf)) 2296 if (bf_isampdu(bf))
diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c
index 45933cf8e8c2..09e2dfd7b175 100644
--- a/drivers/net/wireless/b43/sdio.c
+++ b/drivers/net/wireless/b43/sdio.c
@@ -163,6 +163,7 @@ static int b43_sdio_probe(struct sdio_func *func,
163err_free_ssb: 163err_free_ssb:
164 kfree(sdio); 164 kfree(sdio);
165err_disable_func: 165err_disable_func:
166 sdio_claim_host(func);
166 sdio_disable_func(func); 167 sdio_disable_func(func);
167err_release_host: 168err_release_host:
168 sdio_release_host(func); 169 sdio_release_host(func);
@@ -175,7 +176,9 @@ static void b43_sdio_remove(struct sdio_func *func)
175 struct b43_sdio *sdio = sdio_get_drvdata(func); 176 struct b43_sdio *sdio = sdio_get_drvdata(func);
176 177
177 ssb_bus_unregister(&sdio->ssb); 178 ssb_bus_unregister(&sdio->ssb);
179 sdio_claim_host(func);
178 sdio_disable_func(func); 180 sdio_disable_func(func);
181 sdio_release_host(func);
179 kfree(sdio); 182 kfree(sdio);
180 sdio_set_drvdata(func, NULL); 183 sdio_set_drvdata(func, NULL);
181} 184}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 10d7b9b7f064..f735117d8fc2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1234,6 +1234,9 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
1234 /* only Re-enable if diabled by irq */ 1234 /* only Re-enable if diabled by irq */
1235 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1235 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1236 iwl_enable_interrupts(priv); 1236 iwl_enable_interrupts(priv);
1237 /* Re-enable RF_KILL if it occurred */
1238 else if (handled & CSR_INT_BIT_RF_KILL)
1239 iwl_enable_rfkill_int(priv);
1237 1240
1238#ifdef CONFIG_IWLWIFI_DEBUG 1241#ifdef CONFIG_IWLWIFI_DEBUG
1239 if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { 1242 if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
@@ -1449,6 +1452,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1449 /* only Re-enable if diabled by irq */ 1452 /* only Re-enable if diabled by irq */
1450 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1453 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1451 iwl_enable_interrupts(priv); 1454 iwl_enable_interrupts(priv);
1455 /* Re-enable RF_KILL if it occurred */
1456 else if (handled & CSR_INT_BIT_RF_KILL)
1457 iwl_enable_rfkill_int(priv);
1452} 1458}
1453 1459
1454/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ 1460/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
@@ -3260,9 +3266,10 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
3260 3266
3261 flush_workqueue(priv->workqueue); 3267 flush_workqueue(priv->workqueue);
3262 3268
3263 /* enable interrupts again in order to receive rfkill changes */ 3269 /* User space software may expect getting rfkill changes
3270 * even if interface is down */
3264 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 3271 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
3265 iwl_enable_interrupts(priv); 3272 iwl_enable_rfkill_int(priv);
3266 3273
3267 IWL_DEBUG_MAC80211(priv, "leave\n"); 3274 IWL_DEBUG_MAC80211(priv, "leave\n");
3268} 3275}
@@ -4103,14 +4110,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4103 * 8. Enable interrupts and read RFKILL state 4110 * 8. Enable interrupts and read RFKILL state
4104 *********************************************/ 4111 *********************************************/
4105 4112
4106 /* enable interrupts if needed: hw bug w/a */ 4113 /* enable rfkill interrupt: hw bug w/a */
4107 pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); 4114 pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
4108 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { 4115 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
4109 pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; 4116 pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
4110 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); 4117 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
4111 } 4118 }
4112 4119
4113 iwl_enable_interrupts(priv); 4120 iwl_enable_rfkill_int(priv);
4114 4121
4115 /* If platform's RF_KILL switch is NOT set to KILL */ 4122 /* If platform's RF_KILL switch is NOT set to KILL */
4116 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 4123 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 621abe3c5afc..1c6add90b5b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -168,6 +168,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv)
168 IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); 168 IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
169} 169}
170 170
171static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
172{
173 IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
174 iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
175}
176
171static inline void iwl_enable_interrupts(struct iwl_priv *priv) 177static inline void iwl_enable_interrupts(struct iwl_priv *priv)
172{ 178{
173 IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); 179 IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index e8e2d0f4763d..f800ef4e6554 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1813,6 +1813,12 @@ static int __orinoco_commit(struct orinoco_private *priv)
1813 struct net_device *dev = priv->ndev; 1813 struct net_device *dev = priv->ndev;
1814 int err = 0; 1814 int err = 0;
1815 1815
1816 /* If we've called commit, we are reconfiguring or bringing the
1817 * interface up. Maintaining countermeasures across this would
1818 * be confusing, so note that we've disabled them. The port will
1819 * be enabled later in orinoco_commit or __orinoco_up. */
1820 priv->tkip_cm_active = 0;
1821
1816 err = orinoco_hw_program_rids(priv); 1822 err = orinoco_hw_program_rids(priv);
1817 1823
1818 /* FIXME: what about netif_tx_lock */ 1824 /* FIXME: what about netif_tx_lock */
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index ef46a2d88539..083999faaa98 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -248,20 +248,20 @@ orinoco_cs_config(struct pcmcia_device *link)
248 goto failed; 248 goto failed;
249 } 249 }
250 250
251 ret = pcmcia_request_irq(link, orinoco_interrupt);
252 if (ret)
253 goto failed;
254
255 /* We initialize the hermes structure before completing PCMCIA
256 * configuration just in case the interrupt handler gets
257 * called. */
258 mem = ioport_map(link->resource[0]->start, 251 mem = ioport_map(link->resource[0]->start,
259 resource_size(link->resource[0])); 252 resource_size(link->resource[0]));
260 if (!mem) 253 if (!mem)
261 goto failed; 254 goto failed;
262 255
256 /* We initialize the hermes structure before completing PCMCIA
257 * configuration just in case the interrupt handler gets
258 * called. */
263 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 259 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
264 260
261 ret = pcmcia_request_irq(link, orinoco_interrupt);
262 if (ret)
263 goto failed;
264
265 /* 265 /*
266 * This actually configures the PCMCIA socket -- setting up 266 * This actually configures the PCMCIA socket -- setting up
267 * the I/O windows and the interrupt mapping, and putting the 267 * the I/O windows and the interrupt mapping, and putting the
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index 873877e17e1b..93070a3a5233 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -310,21 +310,21 @@ spectrum_cs_config(struct pcmcia_device *link)
310 goto failed; 310 goto failed;
311 } 311 }
312 312
313 ret = pcmcia_request_irq(link, orinoco_interrupt);
314 if (ret)
315 goto failed;
316
317 /* We initialize the hermes structure before completing PCMCIA
318 * configuration just in case the interrupt handler gets
319 * called. */
320 mem = ioport_map(link->resource[0]->start, 313 mem = ioport_map(link->resource[0]->start,
321 resource_size(link->resource[0])); 314 resource_size(link->resource[0]));
322 if (!mem) 315 if (!mem)
323 goto failed; 316 goto failed;
324 317
318 /* We initialize the hermes structure before completing PCMCIA
319 * configuration just in case the interrupt handler gets
320 * called. */
325 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 321 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
326 hw->eeprom_pda = true; 322 hw->eeprom_pda = true;
327 323
324 ret = pcmcia_request_irq(link, orinoco_interrupt);
325 if (ret)
326 goto failed;
327
328 /* 328 /*
329 * This actually configures the PCMCIA socket -- setting up 329 * This actually configures the PCMCIA socket -- setting up
330 * the I/O windows and the interrupt mapping, and putting the 330 * the I/O windows and the interrupt mapping, and putting the
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index cf7be1eb6124..56aab61fd4cb 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -904,10 +904,10 @@ static int orinoco_ioctl_set_auth(struct net_device *dev,
904 */ 904 */
905 if (param->value) { 905 if (param->value) {
906 priv->tkip_cm_active = 1; 906 priv->tkip_cm_active = 1;
907 ret = hermes_enable_port(hw, 0); 907 ret = hermes_disable_port(hw, 0);
908 } else { 908 } else {
909 priv->tkip_cm_active = 0; 909 priv->tkip_cm_active = 0;
910 ret = hermes_disable_port(hw, 0); 910 ret = hermes_enable_port(hw, 0);
911 } 911 }
912 break; 912 break;
913 913
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
index 78347041ec40..0a7ce37aa628 100644
--- a/drivers/net/wireless/p54/eeprom.c
+++ b/drivers/net/wireless/p54/eeprom.c
@@ -260,8 +260,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
260 list->max_entries = max_channel_num; 260 list->max_entries = max_channel_num;
261 list->channels = kzalloc(sizeof(struct p54_channel_entry) * 261 list->channels = kzalloc(sizeof(struct p54_channel_entry) *
262 max_channel_num, GFP_KERNEL); 262 max_channel_num, GFP_KERNEL);
263 if (!list->channels) 263 if (!list->channels) {
264 ret = -ENOMEM;
264 goto free; 265 goto free;
266 }
265 267
266 for (i = 0; i < max_channel_num; i++) { 268 for (i = 0; i < max_channel_num; i++) {
267 if (i < priv->iq_autocal_len) { 269 if (i < priv->iq_autocal_len) {
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index ad595958b7df..2325e56a9b0b 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -33,8 +33,18 @@ MODULE_ALIAS("prism54usb");
33MODULE_FIRMWARE("isl3886usb"); 33MODULE_FIRMWARE("isl3886usb");
34MODULE_FIRMWARE("isl3887usb"); 34MODULE_FIRMWARE("isl3887usb");
35 35
36/*
37 * Note:
38 *
39 * Always update our wiki's device list (located at:
40 * http://wireless.kernel.org/en/users/Drivers/p54/devices ),
41 * whenever you add a new device.
42 */
43
36static struct usb_device_id p54u_table[] __devinitdata = { 44static struct usb_device_id p54u_table[] __devinitdata = {
37 /* Version 1 devices (pci chip + net2280) */ 45 /* Version 1 devices (pci chip + net2280) */
46 {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */
47 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */
38 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ 48 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
39 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ 49 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */
40 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ 50 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
@@ -47,7 +57,13 @@ static struct usb_device_id p54u_table[] __devinitdata = {
47 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ 57 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */
48 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 58 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
49 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ 59 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */
60 {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */
61 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */
50 {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ 62 {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */
63 {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */
64 {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */
65 {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */
66 {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */
51 {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ 67 {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */
52 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ 68 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */
53 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ 69 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
@@ -60,6 +76,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
60 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ 76 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
61 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ 77 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
62 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ 78 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
79 {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */
63 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ 80 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
64 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 81 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
65 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 82 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
@@ -80,7 +97,9 @@ static struct usb_device_id p54u_table[] __devinitdata = {
80 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 97 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
81 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ 98 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
82 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 99 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
100 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */
83 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 101 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
102 {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */
84 {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ 103 {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */
85 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ 104 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
86 {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ 105 {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */
@@ -930,8 +949,8 @@ static int __devinit p54u_probe(struct usb_interface *intf,
930#ifdef CONFIG_PM 949#ifdef CONFIG_PM
931 /* ISL3887 needs a full reset on resume */ 950 /* ISL3887 needs a full reset on resume */
932 udev->reset_resume = 1; 951 udev->reset_resume = 1;
952#endif /* CONFIG_PM */
933 err = p54u_device_reset(dev); 953 err = p54u_device_reset(dev);
934#endif
935 954
936 priv->hw_type = P54U_3887; 955 priv->hw_type = P54U_3887;
937 dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); 956 dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr);
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 0e937dc0c9c4..3d5311330b4a 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -618,7 +618,7 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb,
618 else 618 else
619 *burst_possible = false; 619 *burst_possible = false;
620 620
621 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) 621 if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
622 *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; 622 *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;
623 623
624 if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) 624 if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5063e01410e5..6a6cd7142e31 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1488,8 +1488,10 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1488 spec->channels_info = info; 1488 spec->channels_info = info;
1489 1489
1490 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1490 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1491 for (i = 0; i < 14; i++) 1491 for (i = 0; i < 14; i++) {
1492 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1492 info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER);
1493 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1494 }
1493 1495
1494 return 0; 1496 return 0;
1495} 1497}
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index c2a555d5376b..ec3e8b329a67 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1802,12 +1802,16 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1802 spec->channels_info = info; 1802 spec->channels_info = info;
1803 1803
1804 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1804 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1805 for (i = 0; i < 14; i++) 1805 for (i = 0; i < 14; i++) {
1806 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1806 info[i].max_power = MAX_TXPOWER;
1807 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1808 }
1807 1809
1808 if (spec->num_channels > 14) { 1810 if (spec->num_channels > 14) {
1809 for (i = 14; i < spec->num_channels; i++) 1811 for (i = 14; i < spec->num_channels; i++) {
1810 info[i].tx_power1 = DEFAULT_TXPOWER; 1812 info[i].max_power = MAX_TXPOWER;
1813 info[i].default_power1 = DEFAULT_TXPOWER;
1814 }
1811 } 1815 }
1812 1816
1813 return 0; 1817 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index cdaf93f48263..ed4de3f02d40 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1705,12 +1705,16 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1705 spec->channels_info = info; 1705 spec->channels_info = info;
1706 1706
1707 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1707 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1708 for (i = 0; i < 14; i++) 1708 for (i = 0; i < 14; i++) {
1709 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1709 info[i].max_power = MAX_TXPOWER;
1710 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1711 }
1710 1712
1711 if (spec->num_channels > 14) { 1713 if (spec->num_channels > 14) {
1712 for (i = 14; i < spec->num_channels; i++) 1714 for (i = 14; i < spec->num_channels; i++) {
1713 info[i].tx_power1 = DEFAULT_TXPOWER; 1715 info[i].max_power = MAX_TXPOWER;
1716 info[i].default_power1 = DEFAULT_TXPOWER;
1717 }
1714 } 1718 }
1715 1719
1716 return 0; 1720 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index ed4ebcdde7c9..616b71a4ad1f 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -1841,6 +1841,13 @@ struct mac_iveiv_entry {
1841#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) 1841#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)
1842 1842
1843/* 1843/*
1844 * EEPROM Maximum TX power values
1845 */
1846#define EEPROM_MAX_TX_POWER 0x0027
1847#define EEPROM_MAX_TX_POWER_24GHZ FIELD16(0x00ff)
1848#define EEPROM_MAX_TX_POWER_5GHZ FIELD16(0xff00)
1849
1850/*
1844 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. 1851 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power.
1845 * This is delta in 40MHZ. 1852 * This is delta in 40MHZ.
1846 * VALUE: Tx Power dalta value (MAX=4) 1853 * VALUE: Tx Power dalta value (MAX=4)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b66e0fd8f0fa..60039d3fe0a0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1120,27 +1120,27 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev,
1120 * double meaning, and we should set a 7DBm boost flag. 1120 * double meaning, and we should set a 7DBm boost flag.
1121 */ 1121 */
1122 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, 1122 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST,
1123 (info->tx_power1 >= 0)); 1123 (info->default_power1 >= 0));
1124 1124
1125 if (info->tx_power1 < 0) 1125 if (info->default_power1 < 0)
1126 info->tx_power1 += 7; 1126 info->default_power1 += 7;
1127 1127
1128 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, 1128 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A,
1129 TXPOWER_A_TO_DEV(info->tx_power1)); 1129 TXPOWER_A_TO_DEV(info->default_power1));
1130 1130
1131 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, 1131 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST,
1132 (info->tx_power2 >= 0)); 1132 (info->default_power2 >= 0));
1133 1133
1134 if (info->tx_power2 < 0) 1134 if (info->default_power2 < 0)
1135 info->tx_power2 += 7; 1135 info->default_power2 += 7;
1136 1136
1137 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, 1137 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A,
1138 TXPOWER_A_TO_DEV(info->tx_power2)); 1138 TXPOWER_A_TO_DEV(info->default_power2));
1139 } else { 1139 } else {
1140 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, 1140 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G,
1141 TXPOWER_G_TO_DEV(info->tx_power1)); 1141 TXPOWER_G_TO_DEV(info->default_power1));
1142 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, 1142 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G,
1143 TXPOWER_G_TO_DEV(info->tx_power2)); 1143 TXPOWER_G_TO_DEV(info->default_power2));
1144 } 1144 }
1145 1145
1146 rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); 1146 rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
@@ -1180,13 +1180,11 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1180 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); 1180 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
1181 1181
1182 rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); 1182 rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr);
1183 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, 1183 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1);
1184 TXPOWER_G_TO_DEV(info->tx_power1));
1185 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); 1184 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr);
1186 1185
1187 rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); 1186 rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr);
1188 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, 1187 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2);
1189 TXPOWER_G_TO_DEV(info->tx_power2));
1190 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); 1188 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr);
1191 1189
1192 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); 1190 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr);
@@ -2516,6 +2514,13 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
2516 default_lna_gain); 2514 default_lna_gain);
2517 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); 2515 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
2518 2516
2517 rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &word);
2518 if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_24GHZ) == 0xff)
2519 rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_24GHZ, MAX_G_TXPOWER);
2520 if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_5GHZ) == 0xff)
2521 rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_5GHZ, MAX_A_TXPOWER);
2522 rt2x00_eeprom_write(rt2x00dev, EEPROM_MAX_TX_POWER, word);
2523
2519 return 0; 2524 return 0;
2520} 2525}
2521EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); 2526EXPORT_SYMBOL_GPL(rt2800_validate_eeprom);
@@ -2755,9 +2760,10 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2755{ 2760{
2756 struct hw_mode_spec *spec = &rt2x00dev->spec; 2761 struct hw_mode_spec *spec = &rt2x00dev->spec;
2757 struct channel_info *info; 2762 struct channel_info *info;
2758 char *tx_power1; 2763 char *default_power1;
2759 char *tx_power2; 2764 char *default_power2;
2760 unsigned int i; 2765 unsigned int i;
2766 unsigned short max_power;
2761 u16 eeprom; 2767 u16 eeprom;
2762 2768
2763 /* 2769 /*
@@ -2871,21 +2877,26 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2871 2877
2872 spec->channels_info = info; 2878 spec->channels_info = info;
2873 2879
2874 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); 2880 rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &eeprom);
2875 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); 2881 max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_24GHZ);
2882 default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
2883 default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
2876 2884
2877 for (i = 0; i < 14; i++) { 2885 for (i = 0; i < 14; i++) {
2878 info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]); 2886 info[i].max_power = max_power;
2879 info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]); 2887 info[i].default_power1 = TXPOWER_G_FROM_DEV(default_power1[i]);
2888 info[i].default_power2 = TXPOWER_G_FROM_DEV(default_power2[i]);
2880 } 2889 }
2881 2890
2882 if (spec->num_channels > 14) { 2891 if (spec->num_channels > 14) {
2883 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); 2892 max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_5GHZ);
2884 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); 2893 default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
2894 default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
2885 2895
2886 for (i = 14; i < spec->num_channels; i++) { 2896 for (i = 14; i < spec->num_channels; i++) {
2887 info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]); 2897 info[i].max_power = max_power;
2888 info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]); 2898 info[i].default_power1 = TXPOWER_A_FROM_DEV(default_power1[i]);
2899 info[i].default_power2 = TXPOWER_A_FROM_DEV(default_power2[i]);
2889 } 2900 }
2890 } 2901 }
2891 2902
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index c21af38cc5af..6b2b92bfbc6b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -212,8 +212,9 @@ struct channel_info {
212 unsigned int flags; 212 unsigned int flags;
213#define GEOGRAPHY_ALLOWED 0x00000001 213#define GEOGRAPHY_ALLOWED 0x00000001
214 214
215 short tx_power1; 215 short max_power;
216 short tx_power2; 216 short default_power1;
217 short default_power2;
217}; 218};
218 219
219/* 220/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 585e8166f22a..19f86ce13df5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -710,7 +710,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
710 for (i = 0; i < spec->num_channels; i++) { 710 for (i = 0; i < spec->num_channels; i++) {
711 rt2x00lib_channel(&channels[i], 711 rt2x00lib_channel(&channels[i],
712 spec->channels[i].channel, 712 spec->channels[i].channel,
713 spec->channels_info[i].tx_power1, i); 713 spec->channels_info[i].max_power, i);
714 } 714 }
715 715
716 /* 716 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e539c6cb636f..73d6382663b4 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2661,13 +2661,17 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2661 spec->channels_info = info; 2661 spec->channels_info = info;
2662 2662
2663 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); 2663 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START);
2664 for (i = 0; i < 14; i++) 2664 for (i = 0; i < 14; i++) {
2665 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2665 info[i].max_power = MAX_TXPOWER;
2666 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2667 }
2666 2668
2667 if (spec->num_channels > 14) { 2669 if (spec->num_channels > 14) {
2668 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); 2670 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
2669 for (i = 14; i < spec->num_channels; i++) 2671 for (i = 14; i < spec->num_channels; i++) {
2670 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2672 info[i].max_power = MAX_TXPOWER;
2673 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2674 }
2671 } 2675 }
2672 2676
2673 return 0; 2677 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index aa9de18fd410..c457d65f81a7 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2091,13 +2091,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2091 spec->channels_info = info; 2091 spec->channels_info = info;
2092 2092
2093 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); 2093 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START);
2094 for (i = 0; i < 14; i++) 2094 for (i = 0; i < 14; i++) {
2095 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2095 info[i].max_power = MAX_TXPOWER;
2096 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2097 }
2096 2098
2097 if (spec->num_channels > 14) { 2099 if (spec->num_channels > 14) {
2098 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); 2100 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
2099 for (i = 14; i < spec->num_channels; i++) 2101 for (i = 14; i < spec->num_channels; i++) {
2100 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2102 info[i].max_power = MAX_TXPOWER;
2103 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2104 }
2101 } 2105 }
2102 2106
2103 return 0; 2107 return 0;
@@ -2391,6 +2395,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2391 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, 2395 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
2392 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, 2396 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
2393 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, 2397 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) },
2398 { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) },
2394 /* Qcom */ 2399 /* Qcom */
2395 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, 2400 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) },
2396 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, 2401 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index b50fedcef8ac..42dad59cadb0 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -66,8 +66,8 @@ struct netfront_cb {
66 66
67#define GRANT_INVALID_REF 0 67#define GRANT_INVALID_REF 0
68 68
69#define NET_TX_RING_SIZE __RING_SIZE((struct xen_netif_tx_sring *)0, PAGE_SIZE) 69#define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE)
70#define NET_RX_RING_SIZE __RING_SIZE((struct xen_netif_rx_sring *)0, PAGE_SIZE) 70#define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE)
71#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) 71#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
72 72
73struct netfront_info { 73struct netfront_info {
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
index dc0ae4d14dff..010725117dbb 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
@@ -21,6 +21,7 @@
21#include "oprof.h" 21#include "oprof.h"
22 22
23static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer); 23static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer);
24static int ctr_running;
24 25
25static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer) 26static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer)
26{ 27{
@@ -33,6 +34,9 @@ static void __oprofile_hrtimer_start(void *unused)
33{ 34{
34 struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer); 35 struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer);
35 36
37 if (!ctr_running)
38 return;
39
36 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 40 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
37 hrtimer->function = oprofile_hrtimer_notify; 41 hrtimer->function = oprofile_hrtimer_notify;
38 42
@@ -42,7 +46,10 @@ static void __oprofile_hrtimer_start(void *unused)
42 46
43static int oprofile_hrtimer_start(void) 47static int oprofile_hrtimer_start(void)
44{ 48{
49 get_online_cpus();
50 ctr_running = 1;
45 on_each_cpu(__oprofile_hrtimer_start, NULL, 1); 51 on_each_cpu(__oprofile_hrtimer_start, NULL, 1);
52 put_online_cpus();
46 return 0; 53 return 0;
47} 54}
48 55
@@ -50,6 +57,9 @@ static void __oprofile_hrtimer_stop(int cpu)
50{ 57{
51 struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); 58 struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu);
52 59
60 if (!ctr_running)
61 return;
62
53 hrtimer_cancel(hrtimer); 63 hrtimer_cancel(hrtimer);
54} 64}
55 65
@@ -57,8 +67,11 @@ static void oprofile_hrtimer_stop(void)
57{ 67{
58 int cpu; 68 int cpu;
59 69
70 get_online_cpus();
60 for_each_online_cpu(cpu) 71 for_each_online_cpu(cpu)
61 __oprofile_hrtimer_stop(cpu); 72 __oprofile_hrtimer_stop(cpu);
73 ctr_running = 0;
74 put_online_cpus();
62} 75}
63 76
64static int __cpuinit oprofile_cpu_notify(struct notifier_block *self, 77static int __cpuinit oprofile_cpu_notify(struct notifier_block *self,
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 0a19708074c2..a286959db67e 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -1414,6 +1414,11 @@ int __init enable_drhd_fault_handling(void)
1414 (unsigned long long)drhd->reg_base_addr, ret); 1414 (unsigned long long)drhd->reg_base_addr, ret);
1415 return -1; 1415 return -1;
1416 } 1416 }
1417
1418 /*
1419 * Clear any previous faults.
1420 */
1421 dmar_fault(iommu->irq, iommu);
1417 } 1422 }
1418 1423
1419 return 0; 1424 return 0;
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c
index f7b68ca6cc98..4ae494bb1d50 100644
--- a/drivers/pci/pci-stub.c
+++ b/drivers/pci/pci-stub.c
@@ -54,6 +54,9 @@ static int __init pci_stub_init(void)
54 subdevice = PCI_ANY_ID, class=0, class_mask=0; 54 subdevice = PCI_ANY_ID, class=0, class_mask=0;
55 int fields; 55 int fields;
56 56
57 if (!strlen(id))
58 continue;
59
57 fields = sscanf(id, "%x:%x:%x:%x:%x:%x", 60 fields = sscanf(id, "%x:%x:%x:%x:%x:%x",
58 &vendor, &device, &subvendor, &subdevice, 61 &vendor, &device, &subvendor, &subdevice,
59 &class, &class_mask); 62 &class, &class_mask);
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index b5a7d9bfcb24..4835a02ec017 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -705,17 +705,21 @@ void pci_remove_legacy_files(struct pci_bus *b)
705 705
706#ifdef HAVE_PCI_MMAP 706#ifdef HAVE_PCI_MMAP
707 707
708int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) 708int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
709 enum pci_mmap_api mmap_api)
709{ 710{
710 unsigned long nr, start, size; 711 unsigned long nr, start, size, pci_start;
711 712
713 if (pci_resource_len(pdev, resno) == 0)
714 return 0;
712 nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 715 nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
713 start = vma->vm_pgoff; 716 start = vma->vm_pgoff;
714 size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; 717 size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1;
715 if (start < size && size - start >= nr) 718 pci_start = (mmap_api == PCI_MMAP_PROCFS) ?
719 pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0;
720 if (start >= pci_start && start < pci_start + size &&
721 start + nr <= pci_start + size)
716 return 1; 722 return 1;
717 WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n",
718 current->comm, start, start+nr, pci_name(pdev), resno, size);
719 return 0; 723 return 0;
720} 724}
721 725
@@ -745,8 +749,14 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
745 if (i >= PCI_ROM_RESOURCE) 749 if (i >= PCI_ROM_RESOURCE)
746 return -ENODEV; 750 return -ENODEV;
747 751
748 if (!pci_mmap_fits(pdev, i, vma)) 752 if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) {
753 WARN(1, "process \"%s\" tried to map 0x%08lx bytes "
754 "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n",
755 current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff,
756 pci_name(pdev), i,
757 pci_resource_start(pdev, i), pci_resource_len(pdev, i));
749 return -EINVAL; 758 return -EINVAL;
759 }
750 760
751 /* pci_mmap_page_range() expects the same kind of entry as coming 761 /* pci_mmap_page_range() expects the same kind of entry as coming
752 * from /proc/bus/pci/ which is a "user visible" value. If this is 762 * from /proc/bus/pci/ which is a "user visible" value. If this is
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 6beb11b617a9..1001b1d7e041 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -22,8 +22,13 @@ extern void pci_remove_firmware_label_files(struct pci_dev *pdev);
22#endif 22#endif
23extern void pci_cleanup_rom(struct pci_dev *dev); 23extern void pci_cleanup_rom(struct pci_dev *dev);
24#ifdef HAVE_PCI_MMAP 24#ifdef HAVE_PCI_MMAP
25enum pci_mmap_api {
26 PCI_MMAP_SYSFS, /* mmap on /sys/bus/pci/devices/<BDF>/resource<N> */
27 PCI_MMAP_PROCFS /* mmap on /proc/bus/pci/<BDF> */
28};
25extern int pci_mmap_fits(struct pci_dev *pdev, int resno, 29extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
26 struct vm_area_struct *vma); 30 struct vm_area_struct *vmai,
31 enum pci_mmap_api mmap_api);
27#endif 32#endif
28int pci_probe_reset_function(struct pci_dev *dev); 33int pci_probe_reset_function(struct pci_dev *dev);
29 34
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 01f0306525a5..4aae016c79d0 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -260,7 +260,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
260 260
261 /* Make sure the caller is mapping a real resource for this device */ 261 /* Make sure the caller is mapping a real resource for this device */
262 for (i = 0; i < PCI_ROM_RESOURCE; i++) { 262 for (i = 0; i < PCI_ROM_RESOURCE; i++) {
263 if (pci_mmap_fits(dev, i, vma)) 263 if (pci_mmap_fits(dev, i, vma, PCI_MMAP_PROCFS))
264 break; 264 break;
265 } 265 }
266 266
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 857ae01734a6..32ae8188c094 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2714,6 +2714,29 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_m
2714DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2714DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2715#endif /*CONFIG_MMC_RICOH_MMC*/ 2715#endif /*CONFIG_MMC_RICOH_MMC*/
2716 2716
2717#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
2718#define VTUNCERRMSK_REG 0x1ac
2719#define VTD_MSK_SPEC_ERRORS (1 << 31)
2720/*
2721 * This is a quirk for masking vt-d spec defined errors to platform error
2722 * handling logic. With out this, platforms using Intel 7500, 5500 chipsets
2723 * (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based
2724 * on the RAS config settings of the platform) when a vt-d fault happens.
2725 * The resulting SMI caused the system to hang.
2726 *
2727 * VT-d spec related errors are already handled by the VT-d OS code, so no
2728 * need to report the same error through other channels.
2729 */
2730static void vtd_mask_spec_errors(struct pci_dev *dev)
2731{
2732 u32 word;
2733
2734 pci_read_config_dword(dev, VTUNCERRMSK_REG, &word);
2735 pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
2736}
2737DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, vtd_mask_spec_errors);
2738DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
2739#endif
2717 2740
2718static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, 2741static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2719 struct pci_fixup *end) 2742 struct pci_fixup *end)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 6f1a86b43c60..fd4c25ac18ec 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -65,6 +65,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
65 va_end(args); 65 va_end(args);
66 } 66 }
67} 67}
68EXPORT_SYMBOL(soc_pcmcia_debug);
68 69
69#endif 70#endif
70 71
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index b756e07d41b4..e8acb1c7b194 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1065,9 +1065,9 @@ static ssize_t store_gps(struct device *dev, struct device_attribute *attr,
1065 */ 1065 */
1066static int asus_gps_rfkill_set(void *data, bool blocked) 1066static int asus_gps_rfkill_set(void *data, bool blocked)
1067{ 1067{
1068 acpi_handle handle = data; 1068 struct asus_laptop *asus = data;
1069 1069
1070 return asus_gps_switch(handle, !blocked); 1070 return asus_gps_switch(asus, !blocked);
1071} 1071}
1072 1072
1073static const struct rfkill_ops asus_gps_rfkill_ops = { 1073static const struct rfkill_ops asus_gps_rfkill_ops = {
@@ -1094,7 +1094,7 @@ static int asus_rfkill_init(struct asus_laptop *asus)
1094 1094
1095 asus->gps_rfkill = rfkill_alloc("asus-gps", &asus->platform_device->dev, 1095 asus->gps_rfkill = rfkill_alloc("asus-gps", &asus->platform_device->dev,
1096 RFKILL_TYPE_GPS, 1096 RFKILL_TYPE_GPS,
1097 &asus_gps_rfkill_ops, NULL); 1097 &asus_gps_rfkill_ops, asus);
1098 if (!asus->gps_rfkill) 1098 if (!asus->gps_rfkill)
1099 return -EINVAL; 1099 return -EINVAL;
1100 1100
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index c44a5e8b8b82..f0b3ad13c273 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -75,6 +75,7 @@
75#include <drm/i915_drm.h> 75#include <drm/i915_drm.h>
76#include <asm/msr.h> 76#include <asm/msr.h>
77#include <asm/processor.h> 77#include <asm/processor.h>
78#include "intel_ips.h"
78 79
79#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 80#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32
80 81
@@ -245,6 +246,7 @@
245#define thm_writel(off, val) writel((val), ips->regmap + (off)) 246#define thm_writel(off, val) writel((val), ips->regmap + (off))
246 247
247static const int IPS_ADJUST_PERIOD = 5000; /* ms */ 248static const int IPS_ADJUST_PERIOD = 5000; /* ms */
249static bool late_i915_load = false;
248 250
249/* For initial average collection */ 251/* For initial average collection */
250static const int IPS_SAMPLE_PERIOD = 200; /* ms */ 252static const int IPS_SAMPLE_PERIOD = 200; /* ms */
@@ -339,6 +341,9 @@ struct ips_driver {
339 u64 orig_turbo_ratios; 341 u64 orig_turbo_ratios;
340}; 342};
341 343
344static bool
345ips_gpu_turbo_enabled(struct ips_driver *ips);
346
342/** 347/**
343 * ips_cpu_busy - is CPU busy? 348 * ips_cpu_busy - is CPU busy?
344 * @ips: IPS driver struct 349 * @ips: IPS driver struct
@@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
517 */ 522 */
518static bool ips_gpu_busy(struct ips_driver *ips) 523static bool ips_gpu_busy(struct ips_driver *ips)
519{ 524{
520 if (!ips->gpu_turbo_enabled) 525 if (!ips_gpu_turbo_enabled(ips))
521 return false; 526 return false;
522 527
523 return ips->gpu_busy(); 528 return ips->gpu_busy();
@@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips)
532 */ 537 */
533static void ips_gpu_raise(struct ips_driver *ips) 538static void ips_gpu_raise(struct ips_driver *ips)
534{ 539{
535 if (!ips->gpu_turbo_enabled) 540 if (!ips_gpu_turbo_enabled(ips))
536 return; 541 return;
537 542
538 if (!ips->gpu_raise()) 543 if (!ips->gpu_raise())
@@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips)
549 */ 554 */
550static void ips_gpu_lower(struct ips_driver *ips) 555static void ips_gpu_lower(struct ips_driver *ips)
551{ 556{
552 if (!ips->gpu_turbo_enabled) 557 if (!ips_gpu_turbo_enabled(ips))
553 return; 558 return;
554 559
555 if (!ips->gpu_lower()) 560 if (!ips->gpu_lower())
@@ -1454,6 +1459,31 @@ out_err:
1454 return false; 1459 return false;
1455} 1460}
1456 1461
1462static bool
1463ips_gpu_turbo_enabled(struct ips_driver *ips)
1464{
1465 if (!ips->gpu_busy && late_i915_load) {
1466 if (ips_get_i915_syms(ips)) {
1467 dev_info(&ips->dev->dev,
1468 "i915 driver attached, reenabling gpu turbo\n");
1469 ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS);
1470 }
1471 }
1472
1473 return ips->gpu_turbo_enabled;
1474}
1475
1476void
1477ips_link_to_i915_driver()
1478{
1479 /* We can't cleanly get at the various ips_driver structs from
1480 * this caller (the i915 driver), so just set a flag saying
1481 * that it's time to try getting the symbols again.
1482 */
1483 late_i915_load = true;
1484}
1485EXPORT_SYMBOL_GPL(ips_link_to_i915_driver);
1486
1457static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { 1487static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = {
1458 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 1488 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
1459 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, 1489 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), },
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index b2978a04317f..677783475d84 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -801,7 +801,7 @@ static bool guid_already_parsed(const char *guid_string)
801 wblock = list_entry(p, struct wmi_block, list); 801 wblock = list_entry(p, struct wmi_block, list);
802 gblock = &wblock->gblock; 802 gblock = &wblock->gblock;
803 803
804 if (strncmp(gblock->guid, guid_string, 16) == 0) 804 if (memcmp(gblock->guid, guid_string, 16) == 0)
805 return true; 805 return true;
806 } 806 }
807 return false; 807 return false;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index dc4e32e031e9..0d943eea1c2d 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -28,7 +28,7 @@
28#include "../base.h" 28#include "../base.h"
29#include "pnpacpi.h" 29#include "pnpacpi.h"
30 30
31static int num = 0; 31static int num;
32 32
33/* We need only to blacklist devices that have already an acpi driver that 33/* We need only to blacklist devices that have already an acpi driver that
34 * can't use pnp layer. We don't need to blacklist device that are directly 34 * can't use pnp layer. We don't need to blacklist device that are directly
@@ -180,11 +180,24 @@ struct pnp_protocol pnpacpi_protocol = {
180}; 180};
181EXPORT_SYMBOL(pnpacpi_protocol); 181EXPORT_SYMBOL(pnpacpi_protocol);
182 182
183static char *pnpacpi_get_id(struct acpi_device *device)
184{
185 struct acpi_hardware_id *id;
186
187 list_for_each_entry(id, &device->pnp.ids, list) {
188 if (ispnpidacpi(id->id))
189 return id->id;
190 }
191
192 return NULL;
193}
194
183static int __init pnpacpi_add_device(struct acpi_device *device) 195static int __init pnpacpi_add_device(struct acpi_device *device)
184{ 196{
185 acpi_handle temp = NULL; 197 acpi_handle temp = NULL;
186 acpi_status status; 198 acpi_status status;
187 struct pnp_dev *dev; 199 struct pnp_dev *dev;
200 char *pnpid;
188 struct acpi_hardware_id *id; 201 struct acpi_hardware_id *id;
189 202
190 /* 203 /*
@@ -192,11 +205,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
192 * driver should not be loaded. 205 * driver should not be loaded.
193 */ 206 */
194 status = acpi_get_handle(device->handle, "_CRS", &temp); 207 status = acpi_get_handle(device->handle, "_CRS", &temp);
195 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || 208 if (ACPI_FAILURE(status))
196 is_exclusive_device(device) || (!device->status.present)) 209 return 0;
210
211 pnpid = pnpacpi_get_id(device);
212 if (!pnpid)
213 return 0;
214
215 if (is_exclusive_device(device) || !device->status.present)
197 return 0; 216 return 0;
198 217
199 dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); 218 dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid);
200 if (!dev) 219 if (!dev)
201 return -ENOMEM; 220 return -ENOMEM;
202 221
@@ -227,7 +246,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
227 pnpacpi_parse_resource_option_data(dev); 246 pnpacpi_parse_resource_option_data(dev);
228 247
229 list_for_each_entry(id, &device->pnp.ids, list) { 248 list_for_each_entry(id, &device->pnp.ids, list) {
230 if (!strcmp(id->id, acpi_device_hid(device))) 249 if (!strcmp(id->id, pnpid))
231 continue; 250 continue;
232 if (!ispnpidacpi(id->id)) 251 if (!ispnpidacpi(id->id))
233 continue; 252 continue;
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 4d3b27228a2e..c8d26df9f145 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -212,7 +212,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
212 if (di->rem_capacity > 100) 212 if (di->rem_capacity > 100)
213 di->rem_capacity = 100; 213 di->rem_capacity = 100;
214 214
215 if (di->current_uA >= 100L) 215 if (di->current_uA < -100L)
216 di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) 216 di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L)
217 / (di->current_uA / 100L); 217 / (di->current_uA / 100L);
218 else 218 else
diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c
index 20c4b952e9bd..a74cb0ac3d48 100644
--- a/drivers/power/jz4740-battery.c
+++ b/drivers/power/jz4740-battery.c
@@ -47,6 +47,8 @@ struct jz_battery {
47 47
48 struct power_supply battery; 48 struct power_supply battery;
49 struct delayed_work work; 49 struct delayed_work work;
50
51 struct mutex lock;
50}; 52};
51 53
52static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) 54static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy)
@@ -68,6 +70,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery)
68 unsigned long val; 70 unsigned long val;
69 long voltage; 71 long voltage;
70 72
73 mutex_lock(&battery->lock);
74
71 INIT_COMPLETION(battery->read_completion); 75 INIT_COMPLETION(battery->read_completion);
72 76
73 enable_irq(battery->irq); 77 enable_irq(battery->irq);
@@ -91,6 +95,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery)
91 battery->cell->disable(battery->pdev); 95 battery->cell->disable(battery->pdev);
92 disable_irq(battery->irq); 96 disable_irq(battery->irq);
93 97
98 mutex_unlock(&battery->lock);
99
94 return voltage; 100 return voltage;
95} 101}
96 102
@@ -291,6 +297,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
291 jz_battery->pdev = pdev; 297 jz_battery->pdev = pdev;
292 298
293 init_completion(&jz_battery->read_completion); 299 init_completion(&jz_battery->read_completion);
300 mutex_init(&jz_battery->lock);
294 301
295 INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); 302 INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work);
296 303
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index aafc1c506eda..5bc1dcf7785e 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -271,14 +271,14 @@ static int olpc_bat_get_property(struct power_supply *psy,
271 if (ret) 271 if (ret)
272 return ret; 272 return ret;
273 273
274 val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32; 274 val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32;
275 break; 275 break;
276 case POWER_SUPPLY_PROP_CURRENT_AVG: 276 case POWER_SUPPLY_PROP_CURRENT_AVG:
277 ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); 277 ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
278 if (ret) 278 if (ret)
279 return ret; 279 return ret;
280 280
281 val->intval = (int)be16_to_cpu(ec_word) * 15625L / 120; 281 val->intval = (s16)be16_to_cpu(ec_word) * 15625L / 120;
282 break; 282 break;
283 case POWER_SUPPLY_PROP_CAPACITY: 283 case POWER_SUPPLY_PROP_CAPACITY:
284 ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1); 284 ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1);
@@ -299,7 +299,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
299 if (ret) 299 if (ret)
300 return ret; 300 return ret;
301 301
302 val->intval = (int)be16_to_cpu(ec_word) * 100 / 256; 302 val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256;
303 break; 303 break;
304 case POWER_SUPPLY_PROP_TEMP_AMBIENT: 304 case POWER_SUPPLY_PROP_TEMP_AMBIENT:
305 ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); 305 ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
@@ -313,7 +313,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
313 if (ret) 313 if (ret)
314 return ret; 314 return ret;
315 315
316 val->intval = (int)be16_to_cpu(ec_word) * 6250 / 15; 316 val->intval = (s16)be16_to_cpu(ec_word) * 6250 / 15;
317 break; 317 break;
318 case POWER_SUPPLY_PROP_SERIAL_NUMBER: 318 case POWER_SUPPLY_PROP_SERIAL_NUMBER:
319 ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); 319 ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 5856167a0c90..dd8242d489b8 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -36,6 +36,7 @@
36#include <linux/platform_device.h> 36#include <linux/platform_device.h>
37#include <linux/mod_devicetable.h> 37#include <linux/mod_devicetable.h>
38#include <linux/log2.h> 38#include <linux/log2.h>
39#include <linux/pm.h>
39 40
40/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ 41/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
41#include <asm-generic/rtc.h> 42#include <asm-generic/rtc.h>
@@ -850,7 +851,7 @@ static void __exit cmos_do_remove(struct device *dev)
850 851
851#ifdef CONFIG_PM 852#ifdef CONFIG_PM
852 853
853static int cmos_suspend(struct device *dev, pm_message_t mesg) 854static int cmos_suspend(struct device *dev)
854{ 855{
855 struct cmos_rtc *cmos = dev_get_drvdata(dev); 856 struct cmos_rtc *cmos = dev_get_drvdata(dev);
856 unsigned char tmp; 857 unsigned char tmp;
@@ -898,7 +899,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)
898 */ 899 */
899static inline int cmos_poweroff(struct device *dev) 900static inline int cmos_poweroff(struct device *dev)
900{ 901{
901 return cmos_suspend(dev, PMSG_HIBERNATE); 902 return cmos_suspend(dev);
902} 903}
903 904
904static int cmos_resume(struct device *dev) 905static int cmos_resume(struct device *dev)
@@ -945,9 +946,9 @@ static int cmos_resume(struct device *dev)
945 return 0; 946 return 0;
946} 947}
947 948
949static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
950
948#else 951#else
949#define cmos_suspend NULL
950#define cmos_resume NULL
951 952
952static inline int cmos_poweroff(struct device *dev) 953static inline int cmos_poweroff(struct device *dev)
953{ 954{
@@ -1077,7 +1078,7 @@ static void __exit cmos_pnp_remove(struct pnp_dev *pnp)
1077 1078
1078static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg) 1079static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg)
1079{ 1080{
1080 return cmos_suspend(&pnp->dev, mesg); 1081 return cmos_suspend(&pnp->dev);
1081} 1082}
1082 1083
1083static int cmos_pnp_resume(struct pnp_dev *pnp) 1084static int cmos_pnp_resume(struct pnp_dev *pnp)
@@ -1157,8 +1158,9 @@ static struct platform_driver cmos_platform_driver = {
1157 .shutdown = cmos_platform_shutdown, 1158 .shutdown = cmos_platform_shutdown,
1158 .driver = { 1159 .driver = {
1159 .name = (char *) driver_name, 1160 .name = (char *) driver_name,
1160 .suspend = cmos_suspend, 1161#ifdef CONFIG_PM
1161 .resume = cmos_resume, 1162 .pm = &cmos_pm_ops,
1163#endif
1162 } 1164 }
1163}; 1165};
1164 1166
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 90cf0a6ff23e..dd14e202c2c8 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -207,7 +207,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
207static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) 207static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
208{ 208{
209 struct rs5c372 *rs5c = i2c_get_clientdata(client); 209 struct rs5c372 *rs5c = i2c_get_clientdata(client);
210 unsigned char buf[8]; 210 unsigned char buf[7];
211 int addr; 211 int addr;
212 212
213 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " 213 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d "
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index f0037eefd44e..142af5bc3a4f 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -91,6 +91,12 @@ enum qdio_irq_states {
91#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ 91#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */
92#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ 92#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */
93 93
94/* SIGA flags */
95#define QDIO_SIGA_WRITE 0x00
96#define QDIO_SIGA_READ 0x01
97#define QDIO_SIGA_SYNC 0x02
98#define QDIO_SIGA_QEBSM_FLAG 0x80
99
94#ifdef CONFIG_64BIT 100#ifdef CONFIG_64BIT
95static inline int do_sqbs(u64 token, unsigned char state, int queue, 101static inline int do_sqbs(u64 token, unsigned char state, int queue,
96 int *start, int *count) 102 int *start, int *count)
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 00520f9a7a8e..1763afcd89ec 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -29,11 +29,12 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\
29MODULE_DESCRIPTION("QDIO base support"); 29MODULE_DESCRIPTION("QDIO base support");
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32static inline int do_siga_sync(struct subchannel_id schid, 32static inline int do_siga_sync(unsigned long schid,
33 unsigned int out_mask, unsigned int in_mask) 33 unsigned int out_mask, unsigned int in_mask,
34 unsigned int fc)
34{ 35{
35 register unsigned long __fc asm ("0") = 2; 36 register unsigned long __fc asm ("0") = fc;
36 register struct subchannel_id __schid asm ("1") = schid; 37 register unsigned long __schid asm ("1") = schid;
37 register unsigned long out asm ("2") = out_mask; 38 register unsigned long out asm ("2") = out_mask;
38 register unsigned long in asm ("3") = in_mask; 39 register unsigned long in asm ("3") = in_mask;
39 int cc; 40 int cc;
@@ -47,10 +48,11 @@ static inline int do_siga_sync(struct subchannel_id schid,
47 return cc; 48 return cc;
48} 49}
49 50
50static inline int do_siga_input(struct subchannel_id schid, unsigned int mask) 51static inline int do_siga_input(unsigned long schid, unsigned int mask,
52 unsigned int fc)
51{ 53{
52 register unsigned long __fc asm ("0") = 1; 54 register unsigned long __fc asm ("0") = fc;
53 register struct subchannel_id __schid asm ("1") = schid; 55 register unsigned long __schid asm ("1") = schid;
54 register unsigned long __mask asm ("2") = mask; 56 register unsigned long __mask asm ("2") = mask;
55 int cc; 57 int cc;
56 58
@@ -279,6 +281,8 @@ void qdio_init_buf_states(struct qdio_irq *irq_ptr)
279static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, 281static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
280 unsigned int input) 282 unsigned int input)
281{ 283{
284 unsigned long schid = *((u32 *) &q->irq_ptr->schid);
285 unsigned int fc = QDIO_SIGA_SYNC;
282 int cc; 286 int cc;
283 287
284 if (!need_siga_sync(q)) 288 if (!need_siga_sync(q))
@@ -287,7 +291,12 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
287 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); 291 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr);
288 qperf_inc(q, siga_sync); 292 qperf_inc(q, siga_sync);
289 293
290 cc = do_siga_sync(q->irq_ptr->schid, output, input); 294 if (is_qebsm(q)) {
295 schid = q->irq_ptr->sch_token;
296 fc |= QDIO_SIGA_QEBSM_FLAG;
297 }
298
299 cc = do_siga_sync(schid, output, input, fc);
291 if (cc) 300 if (cc)
292 DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc); 301 DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc);
293 return cc; 302 return cc;
@@ -313,8 +322,8 @@ static inline int qdio_siga_sync_all(struct qdio_q *q)
313 322
314static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) 323static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit)
315{ 324{
316 unsigned long schid; 325 unsigned long schid = *((u32 *) &q->irq_ptr->schid);
317 unsigned int fc = 0; 326 unsigned int fc = QDIO_SIGA_WRITE;
318 u64 start_time = 0; 327 u64 start_time = 0;
319 int cc; 328 int cc;
320 329
@@ -323,11 +332,8 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit)
323 332
324 if (is_qebsm(q)) { 333 if (is_qebsm(q)) {
325 schid = q->irq_ptr->sch_token; 334 schid = q->irq_ptr->sch_token;
326 fc |= 0x80; 335 fc |= QDIO_SIGA_QEBSM_FLAG;
327 } 336 }
328 else
329 schid = *((u32 *)&q->irq_ptr->schid);
330
331again: 337again:
332 cc = do_siga_output(schid, q->mask, busy_bit, fc); 338 cc = do_siga_output(schid, q->mask, busy_bit, fc);
333 339
@@ -347,12 +353,19 @@ again:
347 353
348static inline int qdio_siga_input(struct qdio_q *q) 354static inline int qdio_siga_input(struct qdio_q *q)
349{ 355{
356 unsigned long schid = *((u32 *) &q->irq_ptr->schid);
357 unsigned int fc = QDIO_SIGA_READ;
350 int cc; 358 int cc;
351 359
352 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); 360 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr);
353 qperf_inc(q, siga_read); 361 qperf_inc(q, siga_read);
354 362
355 cc = do_siga_input(q->irq_ptr->schid, q->mask); 363 if (is_qebsm(q)) {
364 schid = q->irq_ptr->sch_token;
365 fc |= QDIO_SIGA_QEBSM_FLAG;
366 }
367
368 cc = do_siga_input(schid, q->mask, fc);
356 if (cc) 369 if (cc)
357 DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc); 370 DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc);
358 return cc; 371 return cc;
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index b860d650a563..4cf7ffa2dad3 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4175,6 +4175,14 @@ static int ioc_general(void __user *arg, char *cmnd)
4175 ha = gdth_find_ha(gen.ionode); 4175 ha = gdth_find_ha(gen.ionode);
4176 if (!ha) 4176 if (!ha)
4177 return -EFAULT; 4177 return -EFAULT;
4178
4179 if (gen.data_len > INT_MAX)
4180 return -EINVAL;
4181 if (gen.sense_len > INT_MAX)
4182 return -EINVAL;
4183 if (gen.data_len + gen.sense_len > INT_MAX)
4184 return -EINVAL;
4185
4178 if (gen.data_len + gen.sense_len != 0) { 4186 if (gen.data_len + gen.sense_len != 0) {
4179 if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, 4187 if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len,
4180 FALSE, &paddr))) 4188 FALSE, &paddr)))
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 042153cbbde1..ddbade7beec9 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -347,6 +347,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
347static struct ata_port_operations sas_sata_ops = { 347static struct ata_port_operations sas_sata_ops = {
348 .phy_reset = sas_ata_phy_reset, 348 .phy_reset = sas_ata_phy_reset,
349 .post_internal_cmd = sas_ata_post_internal, 349 .post_internal_cmd = sas_ata_post_internal,
350 .qc_defer = ata_std_qc_defer,
350 .qc_prep = ata_noop_qc_prep, 351 .qc_prep = ata_noop_qc_prep,
351 .qc_issue = sas_ata_qc_issue, 352 .qc_issue = sas_ata_qc_issue,
352 .qc_fill_rtf = sas_ata_qc_fill_rtf, 353 .qc_fill_rtf = sas_ata_qc_fill_rtf,
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index f0cfba9a1fc8..baf2b6039952 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -649,6 +649,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
649 649
650 spin_lock_irqsave(shost->host_lock, flags); 650 spin_lock_irqsave(shost->host_lock, flags);
651 list_splice_init(&shost->eh_cmd_q, &eh_work_q); 651 list_splice_init(&shost->eh_cmd_q, &eh_work_q);
652 shost->host_eh_scheduled = 0;
652 spin_unlock_irqrestore(shost->host_lock, flags); 653 spin_unlock_irqrestore(shost->host_lock, flags);
653 654
654 SAS_DPRINTK("Enter %s\n", __func__); 655 SAS_DPRINTK("Enter %s\n", __func__);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 57bcd5c9dcff..9e590265a020 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -2057,9 +2057,9 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2057 /* adjust hba_queue_depth, reply_free_queue_depth, 2057 /* adjust hba_queue_depth, reply_free_queue_depth,
2058 * and queue_size 2058 * and queue_size
2059 */ 2059 */
2060 ioc->hba_queue_depth -= queue_diff; 2060 ioc->hba_queue_depth -= (queue_diff / 2);
2061 ioc->reply_free_queue_depth -= queue_diff; 2061 ioc->reply_free_queue_depth -= (queue_diff / 2);
2062 queue_size -= queue_diff; 2062 queue_size = facts->MaxReplyDescriptorPostQueueDepth;
2063 } 2063 }
2064 ioc->reply_post_queue_depth = queue_size; 2064 ioc->reply_post_queue_depth = queue_size;
2065 2065
@@ -3662,6 +3662,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3662 ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; 3662 ioc->scsih_cmds.status = MPT2_CMD_NOT_USED;
3663 mutex_init(&ioc->scsih_cmds.mutex); 3663 mutex_init(&ioc->scsih_cmds.mutex);
3664 3664
3665 /* scsih internal command bits */
3666 ioc->scsih_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
3667 ioc->scsih_cmds.status = MPT2_CMD_NOT_USED;
3668 mutex_init(&ioc->scsih_cmds.mutex);
3669
3665 /* task management internal command bits */ 3670 /* task management internal command bits */
3666 ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); 3671 ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
3667 ioc->tm_cmds.status = MPT2_CMD_NOT_USED; 3672 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
@@ -3786,6 +3791,8 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc)
3786static void 3791static void
3787_base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) 3792_base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
3788{ 3793{
3794 mpt2sas_scsih_reset_handler(ioc, reset_phase);
3795 mpt2sas_ctl_reset_handler(ioc, reset_phase);
3789 switch (reset_phase) { 3796 switch (reset_phase) {
3790 case MPT2_IOC_PRE_RESET: 3797 case MPT2_IOC_PRE_RESET:
3791 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " 3798 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: "
@@ -3816,8 +3823,6 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
3816 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); 3823 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__));
3817 break; 3824 break;
3818 } 3825 }
3819 mpt2sas_scsih_reset_handler(ioc, reset_phase);
3820 mpt2sas_ctl_reset_handler(ioc, reset_phase);
3821} 3826}
3822 3827
3823/** 3828/**
@@ -3871,6 +3876,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3871{ 3876{
3872 int r; 3877 int r;
3873 unsigned long flags; 3878 unsigned long flags;
3879 u8 pe_complete = ioc->wait_for_port_enable_to_complete;
3874 3880
3875 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, 3881 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name,
3876 __func__)); 3882 __func__));
@@ -3913,6 +3919,14 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3913 if (r) 3919 if (r)
3914 goto out; 3920 goto out;
3915 _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); 3921 _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET);
3922
3923 /* If this hard reset is called while port enable is active, then
3924 * there is no reason to call make_ioc_operational
3925 */
3926 if (pe_complete) {
3927 r = -EFAULT;
3928 goto out;
3929 }
3916 r = _base_make_ioc_operational(ioc, sleep_flag); 3930 r = _base_make_ioc_operational(ioc, sleep_flag);
3917 if (!r) 3931 if (!r)
3918 _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); 3932 _base_reset_handler(ioc, MPT2_IOC_DONE_RESET);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 16e99b686354..794d927f70c1 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -819,7 +819,7 @@ _scsih_is_end_device(u32 device_info)
819} 819}
820 820
821/** 821/**
822 * mptscsih_get_scsi_lookup - returns scmd entry 822 * _scsih_scsi_lookup_get - returns scmd entry
823 * @ioc: per adapter object 823 * @ioc: per adapter object
824 * @smid: system request message index 824 * @smid: system request message index
825 * 825 *
@@ -832,6 +832,28 @@ _scsih_scsi_lookup_get(struct MPT2SAS_ADAPTER *ioc, u16 smid)
832} 832}
833 833
834/** 834/**
835 * _scsih_scsi_lookup_get_clear - returns scmd entry
836 * @ioc: per adapter object
837 * @smid: system request message index
838 *
839 * Returns the smid stored scmd pointer.
840 * Then will derefrence the stored scmd pointer.
841 */
842static inline struct scsi_cmnd *
843_scsih_scsi_lookup_get_clear(struct MPT2SAS_ADAPTER *ioc, u16 smid)
844{
845 unsigned long flags;
846 struct scsi_cmnd *scmd;
847
848 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
849 scmd = ioc->scsi_lookup[smid - 1].scmd;
850 ioc->scsi_lookup[smid - 1].scmd = NULL;
851 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
852
853 return scmd;
854}
855
856/**
835 * _scsih_scsi_lookup_find_by_scmd - scmd lookup 857 * _scsih_scsi_lookup_find_by_scmd - scmd lookup
836 * @ioc: per adapter object 858 * @ioc: per adapter object
837 * @smid: system request message index 859 * @smid: system request message index
@@ -2957,9 +2979,6 @@ _scsih_check_topo_delete_events(struct MPT2SAS_ADAPTER *ioc,
2957 u16 handle; 2979 u16 handle;
2958 2980
2959 for (i = 0 ; i < event_data->NumEntries; i++) { 2981 for (i = 0 ; i < event_data->NumEntries; i++) {
2960 if (event_data->PHY[i].PhyStatus &
2961 MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT)
2962 continue;
2963 handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); 2982 handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle);
2964 if (!handle) 2983 if (!handle)
2965 continue; 2984 continue;
@@ -3186,7 +3205,7 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc)
3186 u16 count = 0; 3205 u16 count = 0;
3187 3206
3188 for (smid = 1; smid <= ioc->scsiio_depth; smid++) { 3207 for (smid = 1; smid <= ioc->scsiio_depth; smid++) {
3189 scmd = _scsih_scsi_lookup_get(ioc, smid); 3208 scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
3190 if (!scmd) 3209 if (!scmd)
3191 continue; 3210 continue;
3192 count++; 3211 count++;
@@ -3778,7 +3797,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
3778 u32 response_code = 0; 3797 u32 response_code = 0;
3779 3798
3780 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); 3799 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply);
3781 scmd = _scsih_scsi_lookup_get(ioc, smid); 3800 scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
3782 if (scmd == NULL) 3801 if (scmd == NULL)
3783 return 1; 3802 return 1;
3784 3803
@@ -4940,6 +4959,12 @@ _scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc,
4940 event_data); 4959 event_data);
4941#endif 4960#endif
4942 4961
4962 /* In MPI Revision K (0xC), the internal device reset complete was
4963 * implemented, so avoid setting tm_busy flag for older firmware.
4964 */
4965 if ((ioc->facts.HeaderVersion >> 8) < 0xC)
4966 return;
4967
4943 if (event_data->ReasonCode != 4968 if (event_data->ReasonCode !=
4944 MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && 4969 MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET &&
4945 event_data->ReasonCode != 4970 event_data->ReasonCode !=
@@ -5034,6 +5059,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
5034 struct fw_event_work *fw_event) 5059 struct fw_event_work *fw_event)
5035{ 5060{
5036 struct scsi_cmnd *scmd; 5061 struct scsi_cmnd *scmd;
5062 struct scsi_device *sdev;
5037 u16 smid, handle; 5063 u16 smid, handle;
5038 u32 lun; 5064 u32 lun;
5039 struct MPT2SAS_DEVICE *sas_device_priv_data; 5065 struct MPT2SAS_DEVICE *sas_device_priv_data;
@@ -5044,12 +5070,17 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
5044 Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; 5070 Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data;
5045#endif 5071#endif
5046 u16 ioc_status; 5072 u16 ioc_status;
5073 unsigned long flags;
5074 int r;
5075
5047 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " 5076 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: "
5048 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, 5077 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum,
5049 event_data->PortWidth)); 5078 event_data->PortWidth));
5050 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, 5079 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name,
5051 __func__)); 5080 __func__));
5052 5081
5082 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
5083 ioc->broadcast_aen_busy = 0;
5053 termination_count = 0; 5084 termination_count = 0;
5054 query_count = 0; 5085 query_count = 0;
5055 mpi_reply = ioc->tm_cmds.reply; 5086 mpi_reply = ioc->tm_cmds.reply;
@@ -5057,7 +5088,8 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
5057 scmd = _scsih_scsi_lookup_get(ioc, smid); 5088 scmd = _scsih_scsi_lookup_get(ioc, smid);
5058 if (!scmd) 5089 if (!scmd)
5059 continue; 5090 continue;
5060 sas_device_priv_data = scmd->device->hostdata; 5091 sdev = scmd->device;
5092 sas_device_priv_data = sdev->hostdata;
5061 if (!sas_device_priv_data || !sas_device_priv_data->sas_target) 5093 if (!sas_device_priv_data || !sas_device_priv_data->sas_target)
5062 continue; 5094 continue;
5063 /* skip hidden raid components */ 5095 /* skip hidden raid components */
@@ -5073,6 +5105,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
5073 lun = sas_device_priv_data->lun; 5105 lun = sas_device_priv_data->lun;
5074 query_count++; 5106 query_count++;
5075 5107
5108 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
5076 mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, 5109 mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun,
5077 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); 5110 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL);
5078 ioc->tm_cmds.status = MPT2_CMD_NOT_USED; 5111 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
@@ -5082,14 +5115,20 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
5082 (mpi_reply->ResponseCode == 5115 (mpi_reply->ResponseCode ==
5083 MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || 5116 MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED ||
5084 mpi_reply->ResponseCode == 5117 mpi_reply->ResponseCode ==
5085 MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) 5118 MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) {
5119 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
5086 continue; 5120 continue;
5087 5121 }
5088 mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, 5122 r = mpt2sas_scsih_issue_tm(ioc, handle, sdev->channel, sdev->id,
5089 MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30, NULL); 5123 sdev->lun, MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK, smid, 30,
5124 scmd);
5125 if (r == FAILED)
5126 sdev_printk(KERN_WARNING, sdev, "task abort: FAILED "
5127 "scmd(%p)\n", scmd);
5090 termination_count += le32_to_cpu(mpi_reply->TerminationCount); 5128 termination_count += le32_to_cpu(mpi_reply->TerminationCount);
5129 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
5091 } 5130 }
5092 ioc->broadcast_aen_busy = 0; 5131 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
5093 5132
5094 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT 5133 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT
5095 "%s - exit, query_count = %d termination_count = %d\n", 5134 "%s - exit, query_count = %d termination_count = %d\n",
@@ -6685,6 +6724,7 @@ _scsih_remove(struct pci_dev *pdev)
6685 destroy_workqueue(wq); 6724 destroy_workqueue(wq);
6686 6725
6687 /* release all the volumes */ 6726 /* release all the volumes */
6727 _scsih_ir_shutdown(ioc);
6688 list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, 6728 list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list,
6689 list) { 6729 list) {
6690 if (raid_device->starget) { 6730 if (raid_device->starget) {
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
index 6cfa0145a1d7..dd78f9e8eb9b 100644
--- a/drivers/scsi/pmcraid.h
+++ b/drivers/scsi/pmcraid.h
@@ -568,7 +568,6 @@ struct pmcraid_cmd {
568 struct pmcraid_control_block *ioa_cb; 568 struct pmcraid_control_block *ioa_cb;
569 dma_addr_t ioa_cb_bus_addr; 569 dma_addr_t ioa_cb_bus_addr;
570 dma_addr_t dma_handle; 570 dma_addr_t dma_handle;
571 u8 *sense_buffer;
572 571
573 /* pointer to mid layer structure of SCSI commands */ 572 /* pointer to mid layer structure of SCSI commands */
574 struct scsi_cmnd *scsi_cmd; 573 struct scsi_cmnd *scsi_cmd;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 1a1b281cea33..16df82ac1b26 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -92,6 +92,7 @@ extern int ql2xshiftctondsd;
92extern int ql2xdbwr; 92extern int ql2xdbwr;
93extern int ql2xdontresethba; 93extern int ql2xdontresethba;
94extern int ql2xasynctmfenable; 94extern int ql2xasynctmfenable;
95extern int ql2xgffidenable;
95extern int ql2xenabledif; 96extern int ql2xenabledif;
96extern int ql2xenablehba_err_chk; 97extern int ql2xenablehba_err_chk;
97extern int ql2xtargetreset; 98extern int ql2xtargetreset;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 9c383baebe27..49e7b0916364 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3258,8 +3258,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
3258 continue; 3258 continue;
3259 3259
3260 /* Bypass ports whose FCP-4 type is not FCP_SCSI */ 3260 /* Bypass ports whose FCP-4 type is not FCP_SCSI */
3261 if (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && 3261 if (ql2xgffidenable &&
3262 new_fcport->fc4_type != FC4_TYPE_UNKNOWN) 3262 (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI &&
3263 new_fcport->fc4_type != FC4_TYPE_UNKNOWN))
3263 continue; 3264 continue;
3264 3265
3265 /* Locate matching device in database. */ 3266 /* Locate matching device in database. */
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 579f02854665..de844996743c 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1061,6 +1061,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1061 fcp_cmnd->additional_cdb_len |= 2; 1061 fcp_cmnd->additional_cdb_len |= 2;
1062 1062
1063 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); 1063 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun);
1064 host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun));
1064 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); 1065 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
1065 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); 1066 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len);
1066 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( 1067 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32(
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 0a71cc71eab2..424cf189af27 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2740,6 +2740,7 @@ sufficient_dsds:
2740 goto queuing_error_fcp_cmnd; 2740 goto queuing_error_fcp_cmnd;
2741 2741
2742 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); 2742 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
2743 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
2743 2744
2744 /* build FCP_CMND IU */ 2745 /* build FCP_CMND IU */
2745 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); 2746 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1e4bff695254..202a31ab2f18 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -160,6 +160,11 @@ MODULE_PARM_DESC(ql2xtargetreset,
160 "Enable target reset." 160 "Enable target reset."
161 "Default is 1 - use hw defaults."); 161 "Default is 1 - use hw defaults.");
162 162
163int ql2xgffidenable;
164module_param(ql2xgffidenable, int, S_IRUGO|S_IRUSR);
165MODULE_PARM_DESC(ql2xgffidenable,
166 "Enables GFF_ID checks of port type. "
167 "Default is 0 - Do not use GFF_ID information.");
163 168
164int ql2xasynctmfenable; 169int ql2xasynctmfenable;
165module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); 170module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR);
@@ -2090,6 +2095,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2090 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); 2095 ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
2091 ha->gid_list_info_size = 8; 2096 ha->gid_list_info_size = 8;
2092 ha->optrom_size = OPTROM_SIZE_82XX; 2097 ha->optrom_size = OPTROM_SIZE_82XX;
2098 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX;
2093 ha->isp_ops = &qla82xx_isp_ops; 2099 ha->isp_ops = &qla82xx_isp_ops;
2094 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; 2100 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF;
2095 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; 2101 ha->flash_data_off = FARX_ACCESS_FLASH_DATA;
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 5d4a3822382d..449256f2c5f8 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -5,6 +5,7 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/io.h>
8#include <linux/pci.h> 9#include <linux/pci.h>
9#include "ql4_def.h" 10#include "ql4_def.h"
10#include "ql4_glbl.h" 11#include "ql4_glbl.h"
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ee02d3838a0a..5bff8a2396e4 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1632,9 +1632,8 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
1632 1632
1633 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); 1633 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev));
1634 1634
1635 /* New queue, no concurrency on queue_flags */
1636 if (!shost->use_clustering) 1635 if (!shost->use_clustering)
1637 queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q); 1636 q->limits.cluster = 0;
1638 1637
1639 /* 1638 /*
1640 * set a reasonable default alignment on word boundaries: the 1639 * set a reasonable default alignment on word boundaries: the
@@ -2428,7 +2427,8 @@ scsi_internal_device_unblock(struct scsi_device *sdev)
2428 sdev->sdev_state = SDEV_RUNNING; 2427 sdev->sdev_state = SDEV_RUNNING;
2429 else if (sdev->sdev_state == SDEV_CREATED_BLOCK) 2428 else if (sdev->sdev_state == SDEV_CREATED_BLOCK)
2430 sdev->sdev_state = SDEV_CREATED; 2429 sdev->sdev_state = SDEV_CREATED;
2431 else 2430 else if (sdev->sdev_state != SDEV_CANCEL &&
2431 sdev->sdev_state != SDEV_OFFLINE)
2432 return -EINVAL; 2432 return -EINVAL;
2433 2433
2434 spin_lock_irqsave(q->queue_lock, flags); 2434 spin_lock_irqsave(q->queue_lock, flags);
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index c3f67373a4f8..7a0ca6fdbd79 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -962,10 +962,11 @@ static void __scsi_remove_target(struct scsi_target *starget)
962 list_for_each_entry(sdev, &shost->__devices, siblings) { 962 list_for_each_entry(sdev, &shost->__devices, siblings) {
963 if (sdev->channel != starget->channel || 963 if (sdev->channel != starget->channel ||
964 sdev->id != starget->id || 964 sdev->id != starget->id ||
965 sdev->sdev_state == SDEV_DEL) 965 scsi_device_get(sdev))
966 continue; 966 continue;
967 spin_unlock_irqrestore(shost->host_lock, flags); 967 spin_unlock_irqrestore(shost->host_lock, flags);
968 scsi_remove_device(sdev); 968 scsi_remove_device(sdev);
969 scsi_device_put(sdev);
969 spin_lock_irqsave(shost->host_lock, flags); 970 spin_lock_irqsave(shost->host_lock, flags);
970 goto restart; 971 goto restart;
971 } 972 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ffa0689ee840..c52273c1327a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1153,6 +1153,12 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
1153 u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); 1153 u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512);
1154 u64 bad_lba; 1154 u64 bad_lba;
1155 int info_valid; 1155 int info_valid;
1156 /*
1157 * resid is optional but mostly filled in. When it's unused,
1158 * its value is zero, so we assume the whole buffer transferred
1159 */
1160 unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd);
1161 unsigned int good_bytes;
1156 1162
1157 if (scmd->request->cmd_type != REQ_TYPE_FS) 1163 if (scmd->request->cmd_type != REQ_TYPE_FS)
1158 return 0; 1164 return 0;
@@ -1186,7 +1192,8 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
1186 /* This computation should always be done in terms of 1192 /* This computation should always be done in terms of
1187 * the resolution of the device's medium. 1193 * the resolution of the device's medium.
1188 */ 1194 */
1189 return (bad_lba - start_lba) * scmd->device->sector_size; 1195 good_bytes = (bad_lba - start_lba) * scmd->device->sector_size;
1196 return min(good_bytes, transferred);
1190} 1197}
1191 1198
1192/** 1199/**
@@ -2252,11 +2259,10 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
2252 index = sdkp->index; 2259 index = sdkp->index;
2253 dev = &sdp->sdev_gendev; 2260 dev = &sdp->sdev_gendev;
2254 2261
2255 if (index < SD_MAX_DISKS) { 2262 gd->major = sd_major((index & 0xf0) >> 4);
2256 gd->major = sd_major((index & 0xf0) >> 4); 2263 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
2257 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); 2264 gd->minors = SD_MINORS;
2258 gd->minors = SD_MINORS; 2265
2259 }
2260 gd->fops = &sd_fops; 2266 gd->fops = &sd_fops;
2261 gd->private_data = &sdkp->driver; 2267 gd->private_data = &sdkp->driver;
2262 gd->queue = sdkp->device->request_queue; 2268 gd->queue = sdkp->device->request_queue;
@@ -2346,6 +2352,12 @@ static int sd_probe(struct device *dev)
2346 if (error) 2352 if (error)
2347 goto out_put; 2353 goto out_put;
2348 2354
2355 if (index >= SD_MAX_DISKS) {
2356 error = -ENODEV;
2357 sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name space exhausted.\n");
2358 goto out_free_index;
2359 }
2360
2349 error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN); 2361 error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN);
2350 if (error) 2362 if (error)
2351 goto out_free_index; 2363 goto out_free_index;
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 24110f6f61e0..c9e86deba5e3 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -241,7 +241,8 @@ static const struct serial8250_config uart_config[] = {
241 .fifo_size = 128, 241 .fifo_size = 128,
242 .tx_loadsz = 128, 242 .tx_loadsz = 128,
243 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, 243 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
244 .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, 244 /* UART_CAP_EFR breaks billionon CF bluetooth card. */
245 .flags = UART_CAP_FIFO | UART_CAP_SLEEP,
245 }, 246 },
246 [PORT_16654] = { 247 [PORT_16654] = {
247 .name = "ST16654", 248 .name = "ST16654",
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c
index 5dff45c76d32..f083f7c90c29 100644
--- a/drivers/serial/mfd.c
+++ b/drivers/serial/mfd.c
@@ -892,8 +892,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios,
892 unsigned char cval, fcr = 0; 892 unsigned char cval, fcr = 0;
893 unsigned long flags; 893 unsigned long flags;
894 unsigned int baud, quot; 894 unsigned int baud, quot;
895 u32 mul = 0x3600; 895 u32 ps, mul;
896 u32 ps = 0x10;
897 896
898 switch (termios->c_cflag & CSIZE) { 897 switch (termios->c_cflag & CSIZE) {
899 case CS5: 898 case CS5:
@@ -937,20 +936,19 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios,
937 ps = 0xC; 936 ps = 0xC;
938 quot = 1; 937 quot = 1;
939 break; 938 break;
940 case 2500000:
941 mul = 0x2710;
942 ps = 0x10;
943 quot = 1;
944 break;
945 case 18432000: 939 case 18432000:
946 mul = 0x2400; 940 mul = 0x2400;
947 ps = 0x10; 941 ps = 0x10;
948 quot = 1; 942 quot = 1;
949 break; 943 break;
944 case 3000000:
945 case 2500000:
946 case 2000000:
950 case 1500000: 947 case 1500000:
951 mul = 0x1D4C; 948 case 1000000:
952 ps = 0xc; 949 case 500000:
953 quot = 1; 950 /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */
951 mul = baud / 500000 * 0x9C4;
954 break; 952 break;
955 default: 953 default:
956 ; 954 ;
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c
index ef9c6a04ad8f..744d3f6e4709 100644
--- a/drivers/ssb/b43_pci_bridge.c
+++ b/drivers/ssb/b43_pci_bridge.c
@@ -24,6 +24,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = {
24 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, 24 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) },
25 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, 25 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) },
26 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, 26 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) },
27 { PCI_DEVICE(PCI_VENDOR_ID_BCM_GVC, 0x4318) },
27 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, 28 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) },
28 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, 29 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) },
29 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, 30 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) },
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index 526682d68de8..17053a5eb258 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -734,7 +734,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
734 734
735 /* Fetch the vendor specific tuples. */ 735 /* Fetch the vendor specific tuples. */
736 res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, 736 res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS,
737 ssb_pcmcia_do_get_invariants, sprom); 737 ssb_pcmcia_do_get_invariants, iv);
738 if ((res == 0) || (res == -ENOSPC)) 738 if ((res == 0) || (res == -ENOSPC))
739 return 0; 739 return 0;
740 740
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index 5b279fb30f3f..62445551eecf 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -620,13 +620,13 @@ static ssize_t class_set_picture(struct device *device,
620 620
621#define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file 621#define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file
622 622
623static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, 623static DEVICE_ATTR(asus_oled_enabled, S_IWUSR | S_IRUGO,
624 get_enabled, set_enabled); 624 get_enabled, set_enabled);
625static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture); 625static DEVICE_ATTR(asus_oled_picture, S_IWUSR , NULL, set_picture);
626 626
627static DEVICE_ATTR(enabled, S_IWUGO | S_IRUGO, 627static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO,
628 class_get_enabled, class_set_enabled); 628 class_get_enabled, class_set_enabled);
629static DEVICE_ATTR(picture, S_IWUGO, NULL, class_set_picture); 629static DEVICE_ATTR(picture, S_IWUSR, NULL, class_set_picture);
630 630
631static int asus_oled_probe(struct usb_interface *interface, 631static int asus_oled_probe(struct usb_interface *interface,
632 const struct usb_device_id *id) 632 const struct usb_device_id *id)
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index 2ea97de435ce..876be5a2913d 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -246,6 +246,10 @@ void interface_rx(struct sk_buff *skb, int hdr_size)
246 skb_pull_rcsum(skb, hdr_size); 246 skb_pull_rcsum(skb, hdr_size);
247/* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ 247/* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/
248 248
249 if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) {
250 kfree_skb(skb);
251 return;
252 }
249 skb->dev = dev; 253 skb->dev = dev;
250 skb->protocol = eth_type_trans(skb, dev); 254 skb->protocol = eth_type_trans(skb, dev);
251 255
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index 8b383ee959b2..5c6c72744167 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -54,6 +54,7 @@ Devices: [JR3] PCI force sensor board (jr3_pci)
54 54
55#define PCI_VENDOR_ID_JR3 0x1762 55#define PCI_VENDOR_ID_JR3 0x1762
56#define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111 56#define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111
57#define PCI_DEVICE_ID_JR3_1_CHANNEL_NEW 0x1111
57#define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112 58#define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112
58#define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113 59#define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113
59#define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114 60#define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114
@@ -73,6 +74,8 @@ static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = {
73 { 74 {
74 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL, 75 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL,
75 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 76 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
77 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW,
78 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
76 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL, 79 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL,
77 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 80 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
78 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL, 81 PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL,
@@ -807,6 +810,10 @@ static int jr3_pci_attach(struct comedi_device *dev,
807 devpriv->n_channels = 1; 810 devpriv->n_channels = 1;
808 } 811 }
809 break; 812 break;
813 case PCI_DEVICE_ID_JR3_1_CHANNEL_NEW:{
814 devpriv->n_channels = 1;
815 }
816 break;
810 case PCI_DEVICE_ID_JR3_2_CHANNEL:{ 817 case PCI_DEVICE_ID_JR3_2_CHANNEL:{
811 devpriv->n_channels = 2; 818 devpriv->n_channels = 2;
812 } 819 }
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 3acf7e62bec4..681312d1911c 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -572,7 +572,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
572 /* grab our IRQ */ 572 /* grab our IRQ */
573 if (irq) { 573 if (irq) {
574 isr_flags = 0; 574 isr_flags = 0;
575 if (thisboard->bustype == pci_bustype) 575 if (thisboard->bustype == pci_bustype
576 || thisboard->bustype == pcmcia_bustype)
576 isr_flags |= IRQF_SHARED; 577 isr_flags |= IRQF_SHARED;
577 if (request_irq(irq, labpc_interrupt, isr_flags, 578 if (request_irq(irq, labpc_interrupt, isr_flags,
578 driver_labpc.driver_name, dev)) { 579 driver_labpc.driver_name, dev)) {
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
index 1d5e8796d383..0d318c739528 100644
--- a/drivers/staging/cx25821/cx25821-video.c
+++ b/drivers/staging/cx25821/cx25821-video.c
@@ -92,7 +92,7 @@ int cx25821_get_format_size(void)
92 return ARRAY_SIZE(formats); 92 return ARRAY_SIZE(formats);
93} 93}
94 94
95struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) 95struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc)
96{ 96{
97 unsigned int i; 97 unsigned int i;
98 98
@@ -848,7 +848,7 @@ static int video_open(struct file *file)
848 pix_format = 848 pix_format =
849 (dev->channels[ch_id].pixel_formats == 849 (dev->channels[ch_id].pixel_formats ==
850 PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; 850 PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV;
851 fh->fmt = format_by_fourcc(pix_format); 851 fh->fmt = cx25821_format_by_fourcc(pix_format);
852 852
853 v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); 853 v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio);
854 854
@@ -1009,7 +1009,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1009 if (0 != err) 1009 if (0 != err)
1010 return err; 1010 return err;
1011 1011
1012 fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); 1012 fh->fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat);
1013 fh->vidq.field = f->fmt.pix.field; 1013 fh->vidq.field = f->fmt.pix.field;
1014 1014
1015 /* check if width and height is valid based on set standard */ 1015 /* check if width and height is valid based on set standard */
@@ -1117,7 +1117,7 @@ int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fo
1117 enum v4l2_field field; 1117 enum v4l2_field field;
1118 unsigned int maxw, maxh; 1118 unsigned int maxw, maxh;
1119 1119
1120 fmt = format_by_fourcc(f->fmt.pix.pixelformat); 1120 fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat);
1121 if (NULL == fmt) 1121 if (NULL == fmt)
1122 return -EINVAL; 1122 return -EINVAL;
1123 1123
diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h
index cc6034b1a95d..a2415d33235b 100644
--- a/drivers/staging/cx25821/cx25821-video.h
+++ b/drivers/staging/cx25821/cx25821-video.h
@@ -87,7 +87,7 @@ extern unsigned int vid_limit;
87 87
88#define FORMAT_FLAGS_PACKED 0x01 88#define FORMAT_FLAGS_PACKED 0x01
89extern struct cx25821_fmt formats[]; 89extern struct cx25821_fmt formats[];
90extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); 90extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc);
91extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; 91extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
92 92
93extern void cx25821_dump_video_queue(struct cx25821_dev *dev, 93extern void cx25821_dump_video_queue(struct cx25821_dev *dev,
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c
index eed74f0fe0b6..f21a0e8d8d9b 100644
--- a/drivers/staging/frontier/tranzport.c
+++ b/drivers/staging/frontier/tranzport.c
@@ -204,7 +204,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev)
204 t->value = temp; \ 204 t->value = temp; \
205 return count; \ 205 return count; \
206 } \ 206 } \
207 static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 207 static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value);
208 208
209show_int(enable); 209show_int(enable);
210show_int(offline); 210show_int(offline);
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index ff1d24720f11..26d3677755d1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -369,6 +369,7 @@ static int blkvsc_probe(struct device *device)
369 blkdev->gd->first_minor = 0; 369 blkdev->gd->first_minor = 0;
370 blkdev->gd->fops = &block_ops; 370 blkdev->gd->fops = &block_ops;
371 blkdev->gd->private_data = blkdev; 371 blkdev->gd->private_data = blkdev;
372 blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
372 sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); 373 sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
373 374
374 blkvsc_do_inquiry(blkdev); 375 blkvsc_do_inquiry(blkdev);
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 1d2ebbe17e2c..95dee473d81d 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -1250,7 +1250,7 @@ static void NetVscOnChannelCallback(void *Context)
1250 /* ASSERT(device); */ 1250 /* ASSERT(device); */
1251 1251
1252 packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), 1252 packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char),
1253 GFP_KERNEL); 1253 GFP_ATOMIC);
1254 if (!packet) 1254 if (!packet)
1255 return; 1255 return;
1256 buffer = packet; 1256 buffer = packet;
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 64a01147ecae..d2d5608b5eb4 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -233,6 +233,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
233 if (status == 1) { 233 if (status == 1) {
234 netif_carrier_on(net); 234 netif_carrier_on(net);
235 netif_wake_queue(net); 235 netif_wake_queue(net);
236 netif_notify_peers(net);
236 } else { 237 } else {
237 netif_carrier_off(net); 238 netif_carrier_off(net);
238 netif_stop_queue(net); 239 netif_stop_queue(net);
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c
index bb7d76539cd7..ab2d5fa0349f 100644
--- a/drivers/staging/iio/accel/adis16220_core.c
+++ b/drivers/staging/iio/accel/adis16220_core.c
@@ -506,7 +506,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL,
506 adis16220_write_reset, 0); 506 adis16220_write_reset, 0);
507 507
508#define IIO_DEV_ATTR_CAPTURE(_store) \ 508#define IIO_DEV_ATTR_CAPTURE(_store) \
509 IIO_DEVICE_ATTR(capture, S_IWUGO, NULL, _store, 0) 509 IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0)
510 510
511static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); 511static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture);
512 512
diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c
index 0b598526de62..e414571938a3 100644
--- a/drivers/staging/line6/control.c
+++ b/drivers/staging/line6/control.c
@@ -268,210 +268,210 @@ VARIAX_PARAM_R(float, mix2);
268VARIAX_PARAM_R(float, mix1); 268VARIAX_PARAM_R(float, mix1);
269VARIAX_PARAM_R(int, pickup_wiring); 269VARIAX_PARAM_R(int, pickup_wiring);
270 270
271static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak); 271static DEVICE_ATTR(tweak, S_IWUSR | S_IRUGO, pod_get_tweak, pod_set_tweak);
272static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, 272static DEVICE_ATTR(wah_position, S_IWUSR | S_IRUGO, pod_get_wah_position,
273 pod_set_wah_position); 273 pod_set_wah_position);
274static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, 274static DEVICE_ATTR(compression_gain, S_IWUSR | S_IRUGO,
275 pod_get_compression_gain, pod_set_compression_gain); 275 pod_get_compression_gain, pod_set_compression_gain);
276static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, 276static DEVICE_ATTR(vol_pedal_position, S_IWUSR | S_IRUGO,
277 pod_get_vol_pedal_position, pod_set_vol_pedal_position); 277 pod_get_vol_pedal_position, pod_set_vol_pedal_position);
278static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, 278static DEVICE_ATTR(compression_threshold, S_IWUSR | S_IRUGO,
279 pod_get_compression_threshold, 279 pod_get_compression_threshold,
280 pod_set_compression_threshold); 280 pod_set_compression_threshold);
281static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan); 281static DEVICE_ATTR(pan, S_IWUSR | S_IRUGO, pod_get_pan, pod_set_pan);
282static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, 282static DEVICE_ATTR(amp_model_setup, S_IWUSR | S_IRUGO, pod_get_amp_model_setup,
283 pod_set_amp_model_setup); 283 pod_set_amp_model_setup);
284static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, 284static DEVICE_ATTR(amp_model, S_IWUSR | S_IRUGO, pod_get_amp_model,
285 pod_set_amp_model); 285 pod_set_amp_model);
286static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive); 286static DEVICE_ATTR(drive, S_IWUSR | S_IRUGO, pod_get_drive, pod_set_drive);
287static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass); 287static DEVICE_ATTR(bass, S_IWUSR | S_IRUGO, pod_get_bass, pod_set_bass);
288static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid); 288static DEVICE_ATTR(mid, S_IWUSR | S_IRUGO, pod_get_mid, pod_set_mid);
289static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid); 289static DEVICE_ATTR(lowmid, S_IWUSR | S_IRUGO, pod_get_lowmid, pod_set_lowmid);
290static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble); 290static DEVICE_ATTR(treble, S_IWUSR | S_IRUGO, pod_get_treble, pod_set_treble);
291static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, 291static DEVICE_ATTR(highmid, S_IWUSR | S_IRUGO, pod_get_highmid,
292 pod_set_highmid); 292 pod_set_highmid);
293static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, 293static DEVICE_ATTR(chan_vol, S_IWUSR | S_IRUGO, pod_get_chan_vol,
294 pod_set_chan_vol); 294 pod_set_chan_vol);
295static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, 295static DEVICE_ATTR(reverb_mix, S_IWUSR | S_IRUGO, pod_get_reverb_mix,
296 pod_set_reverb_mix); 296 pod_set_reverb_mix);
297static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, 297static DEVICE_ATTR(effect_setup, S_IWUSR | S_IRUGO, pod_get_effect_setup,
298 pod_set_effect_setup); 298 pod_set_effect_setup);
299static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, 299static DEVICE_ATTR(band_1_frequency, S_IWUSR | S_IRUGO,
300 pod_get_band_1_frequency, pod_set_band_1_frequency); 300 pod_get_band_1_frequency, pod_set_band_1_frequency);
301static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, 301static DEVICE_ATTR(presence, S_IWUSR | S_IRUGO, pod_get_presence,
302 pod_set_presence); 302 pod_set_presence);
303static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, 303static DEVICE_ATTR2(treble__bass, treble, S_IWUSR | S_IRUGO,
304 pod_get_treble__bass, pod_set_treble__bass); 304 pod_get_treble__bass, pod_set_treble__bass);
305static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, 305static DEVICE_ATTR(noise_gate_enable, S_IWUSR | S_IRUGO,
306 pod_get_noise_gate_enable, pod_set_noise_gate_enable); 306 pod_get_noise_gate_enable, pod_set_noise_gate_enable);
307static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, 307static DEVICE_ATTR(gate_threshold, S_IWUSR | S_IRUGO, pod_get_gate_threshold,
308 pod_set_gate_threshold); 308 pod_set_gate_threshold);
309static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, 309static DEVICE_ATTR(gate_decay_time, S_IWUSR | S_IRUGO, pod_get_gate_decay_time,
310 pod_set_gate_decay_time); 310 pod_set_gate_decay_time);
311static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, 311static DEVICE_ATTR(stomp_enable, S_IWUSR | S_IRUGO, pod_get_stomp_enable,
312 pod_set_stomp_enable); 312 pod_set_stomp_enable);
313static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, 313static DEVICE_ATTR(comp_enable, S_IWUSR | S_IRUGO, pod_get_comp_enable,
314 pod_set_comp_enable); 314 pod_set_comp_enable);
315static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, 315static DEVICE_ATTR(stomp_time, S_IWUSR | S_IRUGO, pod_get_stomp_time,
316 pod_set_stomp_time); 316 pod_set_stomp_time);
317static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, 317static DEVICE_ATTR(delay_enable, S_IWUSR | S_IRUGO, pod_get_delay_enable,
318 pod_set_delay_enable); 318 pod_set_delay_enable);
319static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, 319static DEVICE_ATTR(mod_param_1, S_IWUSR | S_IRUGO, pod_get_mod_param_1,
320 pod_set_mod_param_1); 320 pod_set_mod_param_1);
321static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, 321static DEVICE_ATTR(delay_param_1, S_IWUSR | S_IRUGO, pod_get_delay_param_1,
322 pod_set_delay_param_1); 322 pod_set_delay_param_1);
323static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, 323static DEVICE_ATTR(delay_param_1_note_value, S_IWUSR | S_IRUGO,
324 pod_get_delay_param_1_note_value, 324 pod_get_delay_param_1_note_value,
325 pod_set_delay_param_1_note_value); 325 pod_set_delay_param_1_note_value);
326static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, 326static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUSR | S_IRUGO,
327 pod_get_band_2_frequency__bass, 327 pod_get_band_2_frequency__bass,
328 pod_set_band_2_frequency__bass); 328 pod_set_band_2_frequency__bass);
329static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, 329static DEVICE_ATTR(delay_param_2, S_IWUSR | S_IRUGO, pod_get_delay_param_2,
330 pod_set_delay_param_2); 330 pod_set_delay_param_2);
331static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, 331static DEVICE_ATTR(delay_volume_mix, S_IWUSR | S_IRUGO,
332 pod_get_delay_volume_mix, pod_set_delay_volume_mix); 332 pod_get_delay_volume_mix, pod_set_delay_volume_mix);
333static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, 333static DEVICE_ATTR(delay_param_3, S_IWUSR | S_IRUGO, pod_get_delay_param_3,
334 pod_set_delay_param_3); 334 pod_set_delay_param_3);
335static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, 335static DEVICE_ATTR(reverb_enable, S_IWUSR | S_IRUGO, pod_get_reverb_enable,
336 pod_set_reverb_enable); 336 pod_set_reverb_enable);
337static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, 337static DEVICE_ATTR(reverb_type, S_IWUSR | S_IRUGO, pod_get_reverb_type,
338 pod_set_reverb_type); 338 pod_set_reverb_type);
339static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, 339static DEVICE_ATTR(reverb_decay, S_IWUSR | S_IRUGO, pod_get_reverb_decay,
340 pod_set_reverb_decay); 340 pod_set_reverb_decay);
341static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, 341static DEVICE_ATTR(reverb_tone, S_IWUSR | S_IRUGO, pod_get_reverb_tone,
342 pod_set_reverb_tone); 342 pod_set_reverb_tone);
343static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, 343static DEVICE_ATTR(reverb_pre_delay, S_IWUSR | S_IRUGO,
344 pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); 344 pod_get_reverb_pre_delay, pod_set_reverb_pre_delay);
345static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, 345static DEVICE_ATTR(reverb_pre_post, S_IWUSR | S_IRUGO, pod_get_reverb_pre_post,
346 pod_set_reverb_pre_post); 346 pod_set_reverb_pre_post);
347static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, 347static DEVICE_ATTR(band_2_frequency, S_IWUSR | S_IRUGO,
348 pod_get_band_2_frequency, pod_set_band_2_frequency); 348 pod_get_band_2_frequency, pod_set_band_2_frequency);
349static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, 349static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUSR | S_IRUGO,
350 pod_get_band_3_frequency__bass, 350 pod_get_band_3_frequency__bass,
351 pod_set_band_3_frequency__bass); 351 pod_set_band_3_frequency__bass);
352static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, 352static DEVICE_ATTR(wah_enable, S_IWUSR | S_IRUGO, pod_get_wah_enable,
353 pod_set_wah_enable); 353 pod_set_wah_enable);
354static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, 354static DEVICE_ATTR(modulation_lo_cut, S_IWUSR | S_IRUGO,
355 pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); 355 pod_get_modulation_lo_cut, pod_set_modulation_lo_cut);
356static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, 356static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUSR | S_IRUGO,
357 pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); 357 pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut);
358static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, 358static DEVICE_ATTR(volume_pedal_minimum, S_IWUSR | S_IRUGO,
359 pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); 359 pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum);
360static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, 360static DEVICE_ATTR(eq_pre_post, S_IWUSR | S_IRUGO, pod_get_eq_pre_post,
361 pod_set_eq_pre_post); 361 pod_set_eq_pre_post);
362static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, 362static DEVICE_ATTR(volume_pre_post, S_IWUSR | S_IRUGO, pod_get_volume_pre_post,
363 pod_set_volume_pre_post); 363 pod_set_volume_pre_post);
364static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, 364static DEVICE_ATTR(di_model, S_IWUSR | S_IRUGO, pod_get_di_model,
365 pod_set_di_model); 365 pod_set_di_model);
366static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, 366static DEVICE_ATTR(di_delay, S_IWUSR | S_IRUGO, pod_get_di_delay,
367 pod_set_di_delay); 367 pod_set_di_delay);
368static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, 368static DEVICE_ATTR(mod_enable, S_IWUSR | S_IRUGO, pod_get_mod_enable,
369 pod_set_mod_enable); 369 pod_set_mod_enable);
370static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, 370static DEVICE_ATTR(mod_param_1_note_value, S_IWUSR | S_IRUGO,
371 pod_get_mod_param_1_note_value, 371 pod_get_mod_param_1_note_value,
372 pod_set_mod_param_1_note_value); 372 pod_set_mod_param_1_note_value);
373static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, 373static DEVICE_ATTR(mod_param_2, S_IWUSR | S_IRUGO, pod_get_mod_param_2,
374 pod_set_mod_param_2); 374 pod_set_mod_param_2);
375static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, 375static DEVICE_ATTR(mod_param_3, S_IWUSR | S_IRUGO, pod_get_mod_param_3,
376 pod_set_mod_param_3); 376 pod_set_mod_param_3);
377static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, 377static DEVICE_ATTR(mod_param_4, S_IWUSR | S_IRUGO, pod_get_mod_param_4,
378 pod_set_mod_param_4); 378 pod_set_mod_param_4);
379static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, 379static DEVICE_ATTR(mod_param_5, S_IWUSR | S_IRUGO, pod_get_mod_param_5,
380 pod_set_mod_param_5); 380 pod_set_mod_param_5);
381static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, 381static DEVICE_ATTR(mod_volume_mix, S_IWUSR | S_IRUGO, pod_get_mod_volume_mix,
382 pod_set_mod_volume_mix); 382 pod_set_mod_volume_mix);
383static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, 383static DEVICE_ATTR(mod_pre_post, S_IWUSR | S_IRUGO, pod_get_mod_pre_post,
384 pod_set_mod_pre_post); 384 pod_set_mod_pre_post);
385static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, 385static DEVICE_ATTR(modulation_model, S_IWUSR | S_IRUGO,
386 pod_get_modulation_model, pod_set_modulation_model); 386 pod_get_modulation_model, pod_set_modulation_model);
387static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, 387static DEVICE_ATTR(band_3_frequency, S_IWUSR | S_IRUGO,
388 pod_get_band_3_frequency, pod_set_band_3_frequency); 388 pod_get_band_3_frequency, pod_set_band_3_frequency);
389static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, 389static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUSR | S_IRUGO,
390 pod_get_band_4_frequency__bass, 390 pod_get_band_4_frequency__bass,
391 pod_set_band_4_frequency__bass); 391 pod_set_band_4_frequency__bass);
392static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, 392static DEVICE_ATTR(mod_param_1_double_precision, S_IWUSR | S_IRUGO,
393 pod_get_mod_param_1_double_precision, 393 pod_get_mod_param_1_double_precision,
394 pod_set_mod_param_1_double_precision); 394 pod_set_mod_param_1_double_precision);
395static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, 395static DEVICE_ATTR(delay_param_1_double_precision, S_IWUSR | S_IRUGO,
396 pod_get_delay_param_1_double_precision, 396 pod_get_delay_param_1_double_precision,
397 pod_set_delay_param_1_double_precision); 397 pod_set_delay_param_1_double_precision);
398static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, 398static DEVICE_ATTR(eq_enable, S_IWUSR | S_IRUGO, pod_get_eq_enable,
399 pod_set_eq_enable); 399 pod_set_eq_enable);
400static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap); 400static DEVICE_ATTR(tap, S_IWUSR | S_IRUGO, pod_get_tap, pod_set_tap);
401static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, 401static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUSR | S_IRUGO,
402 pod_get_volume_tweak_pedal_assign, 402 pod_get_volume_tweak_pedal_assign,
403 pod_set_volume_tweak_pedal_assign); 403 pod_set_volume_tweak_pedal_assign);
404static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, 404static DEVICE_ATTR(band_5_frequency, S_IWUSR | S_IRUGO,
405 pod_get_band_5_frequency, pod_set_band_5_frequency); 405 pod_get_band_5_frequency, pod_set_band_5_frequency);
406static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner); 406static DEVICE_ATTR(tuner, S_IWUSR | S_IRUGO, pod_get_tuner, pod_set_tuner);
407static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, 407static DEVICE_ATTR(mic_selection, S_IWUSR | S_IRUGO, pod_get_mic_selection,
408 pod_set_mic_selection); 408 pod_set_mic_selection);
409static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, 409static DEVICE_ATTR(cabinet_model, S_IWUSR | S_IRUGO, pod_get_cabinet_model,
410 pod_set_cabinet_model); 410 pod_set_cabinet_model);
411static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, 411static DEVICE_ATTR(stomp_model, S_IWUSR | S_IRUGO, pod_get_stomp_model,
412 pod_set_stomp_model); 412 pod_set_stomp_model);
413static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, 413static DEVICE_ATTR(roomlevel, S_IWUSR | S_IRUGO, pod_get_roomlevel,
414 pod_set_roomlevel); 414 pod_set_roomlevel);
415static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, 415static DEVICE_ATTR(band_4_frequency, S_IWUSR | S_IRUGO,
416 pod_get_band_4_frequency, pod_set_band_4_frequency); 416 pod_get_band_4_frequency, pod_set_band_4_frequency);
417static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, 417static DEVICE_ATTR(band_6_frequency, S_IWUSR | S_IRUGO,
418 pod_get_band_6_frequency, pod_set_band_6_frequency); 418 pod_get_band_6_frequency, pod_set_band_6_frequency);
419static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, 419static DEVICE_ATTR(stomp_param_1_note_value, S_IWUSR | S_IRUGO,
420 pod_get_stomp_param_1_note_value, 420 pod_get_stomp_param_1_note_value,
421 pod_set_stomp_param_1_note_value); 421 pod_set_stomp_param_1_note_value);
422static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, 422static DEVICE_ATTR(stomp_param_2, S_IWUSR | S_IRUGO, pod_get_stomp_param_2,
423 pod_set_stomp_param_2); 423 pod_set_stomp_param_2);
424static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, 424static DEVICE_ATTR(stomp_param_3, S_IWUSR | S_IRUGO, pod_get_stomp_param_3,
425 pod_set_stomp_param_3); 425 pod_set_stomp_param_3);
426static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, 426static DEVICE_ATTR(stomp_param_4, S_IWUSR | S_IRUGO, pod_get_stomp_param_4,
427 pod_set_stomp_param_4); 427 pod_set_stomp_param_4);
428static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, 428static DEVICE_ATTR(stomp_param_5, S_IWUSR | S_IRUGO, pod_get_stomp_param_5,
429 pod_set_stomp_param_5); 429 pod_set_stomp_param_5);
430static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, 430static DEVICE_ATTR(stomp_param_6, S_IWUSR | S_IRUGO, pod_get_stomp_param_6,
431 pod_set_stomp_param_6); 431 pod_set_stomp_param_6);
432static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, 432static DEVICE_ATTR(amp_switch_select, S_IWUSR | S_IRUGO,
433 pod_get_amp_switch_select, pod_set_amp_switch_select); 433 pod_get_amp_switch_select, pod_set_amp_switch_select);
434static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, 434static DEVICE_ATTR(delay_param_4, S_IWUSR | S_IRUGO, pod_get_delay_param_4,
435 pod_set_delay_param_4); 435 pod_set_delay_param_4);
436static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, 436static DEVICE_ATTR(delay_param_5, S_IWUSR | S_IRUGO, pod_get_delay_param_5,
437 pod_set_delay_param_5); 437 pod_set_delay_param_5);
438static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, 438static DEVICE_ATTR(delay_pre_post, S_IWUSR | S_IRUGO, pod_get_delay_pre_post,
439 pod_set_delay_pre_post); 439 pod_set_delay_pre_post);
440static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, 440static DEVICE_ATTR(delay_model, S_IWUSR | S_IRUGO, pod_get_delay_model,
441 pod_set_delay_model); 441 pod_set_delay_model);
442static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, 442static DEVICE_ATTR(delay_verb_model, S_IWUSR | S_IRUGO,
443 pod_get_delay_verb_model, pod_set_delay_verb_model); 443 pod_get_delay_verb_model, pod_set_delay_verb_model);
444static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, 444static DEVICE_ATTR(tempo_msb, S_IWUSR | S_IRUGO, pod_get_tempo_msb,
445 pod_set_tempo_msb); 445 pod_set_tempo_msb);
446static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, 446static DEVICE_ATTR(tempo_lsb, S_IWUSR | S_IRUGO, pod_get_tempo_lsb,
447 pod_set_tempo_lsb); 447 pod_set_tempo_lsb);
448static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, 448static DEVICE_ATTR(wah_model, S_IWUSR | S_IRUGO, pod_get_wah_model,
449 pod_set_wah_model); 449 pod_set_wah_model);
450static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, 450static DEVICE_ATTR(bypass_volume, S_IWUSR | S_IRUGO, pod_get_bypass_volume,
451 pod_set_bypass_volume); 451 pod_set_bypass_volume);
452static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, 452static DEVICE_ATTR(fx_loop_on_off, S_IWUSR | S_IRUGO, pod_get_fx_loop_on_off,
453 pod_set_fx_loop_on_off); 453 pod_set_fx_loop_on_off);
454static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, 454static DEVICE_ATTR(tweak_param_select, S_IWUSR | S_IRUGO,
455 pod_get_tweak_param_select, pod_set_tweak_param_select); 455 pod_get_tweak_param_select, pod_set_tweak_param_select);
456static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, 456static DEVICE_ATTR(amp1_engage, S_IWUSR | S_IRUGO, pod_get_amp1_engage,
457 pod_set_amp1_engage); 457 pod_set_amp1_engage);
458static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, 458static DEVICE_ATTR(band_1_gain, S_IWUSR | S_IRUGO, pod_get_band_1_gain,
459 pod_set_band_1_gain); 459 pod_set_band_1_gain);
460static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, 460static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUSR | S_IRUGO,
461 pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); 461 pod_get_band_2_gain__bass, pod_set_band_2_gain__bass);
462static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, 462static DEVICE_ATTR(band_2_gain, S_IWUSR | S_IRUGO, pod_get_band_2_gain,
463 pod_set_band_2_gain); 463 pod_set_band_2_gain);
464static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, 464static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUSR | S_IRUGO,
465 pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); 465 pod_get_band_3_gain__bass, pod_set_band_3_gain__bass);
466static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, 466static DEVICE_ATTR(band_3_gain, S_IWUSR | S_IRUGO, pod_get_band_3_gain,
467 pod_set_band_3_gain); 467 pod_set_band_3_gain);
468static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, 468static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUSR | S_IRUGO,
469 pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); 469 pod_get_band_4_gain__bass, pod_set_band_4_gain__bass);
470static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, 470static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUSR | S_IRUGO,
471 pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); 471 pod_get_band_5_gain__bass, pod_set_band_5_gain__bass);
472static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, 472static DEVICE_ATTR(band_4_gain, S_IWUSR | S_IRUGO, pod_get_band_4_gain,
473 pod_set_band_4_gain); 473 pod_set_band_4_gain);
474static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, 474static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUSR | S_IRUGO,
475 pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); 475 pod_get_band_6_gain__bass, pod_set_band_6_gain__bass);
476static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); 476static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write);
477static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, 477static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable,
diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c
index 32b6ca75cadb..9b42e34763f1 100644
--- a/drivers/staging/line6/midi.c
+++ b/drivers/staging/line6/midi.c
@@ -362,8 +362,8 @@ static ssize_t midi_set_midi_mask_receive(struct device *dev,
362 return count; 362 return count;
363} 363}
364 364
365static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); 365static DEVICE_ATTR(midi_mask_transmit, S_IWUSR | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit);
366static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); 366static DEVICE_ATTR(midi_mask_receive, S_IWUSR | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive);
367 367
368/* MIDI device destructor */ 368/* MIDI device destructor */
369static int snd_line6_midi_free(struct snd_device *device) 369static int snd_line6_midi_free(struct snd_device *device)
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 28f514611abc..63318d717cd7 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -952,33 +952,33 @@ POD_GET_SYSTEM_PARAM(tuner_pitch, 1, 1);
952#undef GET_SYSTEM_PARAM 952#undef GET_SYSTEM_PARAM
953 953
954/* POD special files: */ 954/* POD special files: */
955static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, pod_set_channel); 955static DEVICE_ATTR(channel, S_IWUSR | S_IRUGO, pod_get_channel, pod_set_channel);
956static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); 956static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write);
957static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); 957static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write);
958static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); 958static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write);
959static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump); 959static DEVICE_ATTR(dump, S_IWUSR | S_IRUGO, pod_get_dump, pod_set_dump);
960static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); 960static DEVICE_ATTR(dump_buf, S_IWUSR | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf);
961static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish); 961static DEVICE_ATTR(finish, S_IWUSR, line6_nop_read, pod_set_finish);
962static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write); 962static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write);
963static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); 963static DEVICE_ATTR(midi_postprocess, S_IWUSR | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess);
964static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); 964static DEVICE_ATTR(monitor_level, S_IWUSR | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level);
965static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); 965static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write);
966static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); 966static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write);
967static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_amp_setup); 967static DEVICE_ATTR(retrieve_amp_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_amp_setup);
968static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, pod_set_retrieve_channel); 968static DEVICE_ATTR(retrieve_channel, S_IWUSR, line6_nop_read, pod_set_retrieve_channel);
969static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_effects_setup); 969static DEVICE_ATTR(retrieve_effects_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_effects_setup);
970static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, pod_set_routing); 970static DEVICE_ATTR(routing, S_IWUSR | S_IRUGO, pod_get_routing, pod_set_routing);
971static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write); 971static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write);
972static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, pod_set_store_amp_setup); 972static DEVICE_ATTR(store_amp_setup, S_IWUSR, line6_nop_read, pod_set_store_amp_setup);
973static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, pod_set_store_channel); 973static DEVICE_ATTR(store_channel, S_IWUSR, line6_nop_read, pod_set_store_channel);
974static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, pod_set_store_effects_setup); 974static DEVICE_ATTR(store_effects_setup, S_IWUSR, line6_nop_read, pod_set_store_effects_setup);
975static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); 975static DEVICE_ATTR(tuner_freq, S_IWUSR | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq);
976static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); 976static DEVICE_ATTR(tuner_mute, S_IWUSR | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute);
977static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); 977static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write);
978static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); 978static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write);
979 979
980#if CREATE_RAW_FILE 980#if CREATE_RAW_FILE
981static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); 981static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw);
982#endif 982#endif
983 983
984/* 984/*
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index e6770ea17936..db421781d550 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -124,9 +124,9 @@ static ssize_t toneport_set_led_green(struct device *dev,
124 return count; 124 return count;
125} 125}
126 126
127static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, 127static DEVICE_ATTR(led_red, S_IWUSR | S_IRUGO, line6_nop_read,
128 toneport_set_led_red); 128 toneport_set_led_red);
129static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, 129static DEVICE_ATTR(led_green, S_IWUSR | S_IRUGO, line6_nop_read,
130 toneport_set_led_green); 130 toneport_set_led_green);
131 131
132static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) 132static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2)
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index 58ddbe6393ff..b2fc09b05939 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -389,17 +389,17 @@ static ssize_t variax_set_raw2(struct device *dev,
389#endif 389#endif
390 390
391/* Variax workbench special files: */ 391/* Variax workbench special files: */
392static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, variax_set_model); 392static DEVICE_ATTR(model, S_IWUSR | S_IRUGO, variax_get_model, variax_set_model);
393static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, variax_set_volume); 393static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO, variax_get_volume, variax_set_volume);
394static DEVICE_ATTR(tone, S_IWUGO | S_IRUGO, variax_get_tone, variax_set_tone); 394static DEVICE_ATTR(tone, S_IWUSR | S_IRUGO, variax_get_tone, variax_set_tone);
395static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); 395static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write);
396static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); 396static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write);
397static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); 397static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write);
398static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, variax_set_active); 398static DEVICE_ATTR(active, S_IWUSR | S_IRUGO, variax_get_active, variax_set_active);
399 399
400#if CREATE_RAW_FILE 400#if CREATE_RAW_FILE
401static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); 401static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw);
402static DEVICE_ATTR(raw2, S_IWUGO, line6_nop_read, variax_set_raw2); 402static DEVICE_ATTR(raw2, S_IWUSR, line6_nop_read, variax_set_raw2);
403#endif 403#endif
404 404
405 405
diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c
index 42783d7367e3..677152044f45 100644
--- a/drivers/staging/phison/phison.c
+++ b/drivers/staging/phison/phison.c
@@ -62,7 +62,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
62 }; 62 };
63 const struct ata_port_info *ppi[] = { &info, NULL }; 63 const struct ata_port_info *ppi[] = { &info, NULL };
64 64
65 ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL, 0); 65 ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0);
66 66
67 dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); 67 dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret);
68 68
diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c
index c2933c69bc04..cbc59f8a7c24 100644
--- a/drivers/staging/rt2860/chips/rt3090.c
+++ b/drivers/staging/rt2860/chips/rt3090.c
@@ -51,7 +51,8 @@ void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd)
51 if (IS_RT3090(pAd)) { 51 if (IS_RT3090(pAd)) {
52 /* Init RF calibration */ 52 /* Init RF calibration */
53 /* Driver should toggle RF R30 bit7 before init RF registers */ 53 /* Driver should toggle RF R30 bit7 before init RF registers */
54 u32 RfReg = 0, data; 54 u8 RfReg;
55 u32 data;
55 56
56 RT30xxReadRFRegister(pAd, RF_R30, (u8 *)&RfReg); 57 RT30xxReadRFRegister(pAd, RF_R30, (u8 *)&RfReg);
57 RfReg |= 0x80; 58 RfReg |= 0x80;
diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c
index 4367a196aeff..88eba5192edc 100644
--- a/drivers/staging/rt2860/chips/rt30xx.c
+++ b/drivers/staging/rt2860/chips/rt30xx.c
@@ -53,7 +53,7 @@ struct rt_reg_pair RT30xx_RFRegTable[] = {
53 , 53 ,
54 {RF_R06, 0x02} 54 {RF_R06, 0x02}
55 , 55 ,
56 {RF_R07, 0x70} 56 {RF_R07, 0x60}
57 , 57 ,
58 {RF_R09, 0x0F} 58 {RF_R09, 0x0F}
59 , 59 ,
@@ -441,7 +441,7 @@ void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd)
441 441
442 /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */ 442 /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */
443 RT30xxReadRFRegister(pAd, RF_R07, &RFValue); 443 RT30xxReadRFRegister(pAd, RF_R07, &RFValue);
444 RFValue |= 0x30; 444 RFValue |= 0x20;
445 RT30xxWriteRFRegister(pAd, RF_R07, RFValue); 445 RT30xxWriteRFRegister(pAd, RF_R07, RFValue);
446 446
447 /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */ 447 /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */
diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c
index ad60ceaf4b88..caf8b7623cb1 100644
--- a/drivers/staging/rt2860/rt_main_dev.c
+++ b/drivers/staging/rt2860/rt_main_dev.c
@@ -483,8 +483,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd,
483 net_dev->ml_priv = (void *)pAd; 483 net_dev->ml_priv = (void *)pAd;
484 pAd->net_dev = net_dev; 484 pAd->net_dev = net_dev;
485 485
486 netif_stop_queue(net_dev);
487
488 return net_dev; 486 return net_dev;
489 487
490} 488}
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c
index ebf9074a9083..aca0c468fa6c 100644
--- a/drivers/staging/rt2860/usb_main_dev.c
+++ b/drivers/staging/rt2860/usb_main_dev.c
@@ -65,6 +65,7 @@ struct usb_device_id rtusb_usb_id[] = {
65 {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ 65 {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */
66 {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ 66 {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */
67 {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */ 67 {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */
68 {USB_DEVICE(0x050D, 0x935A)}, /* Belkin F6D4050 v1 */
68 {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */ 69 {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */
69 {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ 70 {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */
70 {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ 71 {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */
@@ -105,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = {
105 {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ 106 {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */
106 {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ 107 {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */
107 {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ 108 {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */
109 {USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */
108 {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ 110 {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */
109 {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ 111 {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */
110 {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ 112 {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */
@@ -181,6 +183,7 @@ struct usb_device_id rtusb_usb_id[] = {
181 {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ 183 {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */
182 {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ 184 {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */
183 {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ 185 {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */
186 {USB_DEVICE(0x0411, 0x015D)}, /* Buffalo Airstation WLI-UC-GN */
184 {} /* Terminating entry */ 187 {} /* Terminating entry */
185}; 188};
186 189
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index a0ece1fd64a5..e7e8745c9478 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -268,8 +268,12 @@ HwHSSIThreeWire(
268 } 268 }
269 udelay(10); 269 udelay(10);
270 } 270 }
271 if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) 271 if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) {
272 panic("HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n", u1bTmp); 272 printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:"
273 " %#X RE|WE bits are not clear!!\n", u1bTmp);
274 dump_stack();
275 return 0;
276 }
273 277
274 // RTL8187S HSSI Read/Write Function 278 // RTL8187S HSSI Read/Write Function
275 u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); 279 u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
@@ -309,13 +313,23 @@ HwHSSIThreeWire(
309 int idx; 313 int idx;
310 int ByteCnt = nDataBufBitCnt / 8; 314 int ByteCnt = nDataBufBitCnt / 8;
311 //printk("%d\n",nDataBufBitCnt); 315 //printk("%d\n",nDataBufBitCnt);
312 if ((nDataBufBitCnt % 8) != 0) 316 if ((nDataBufBitCnt % 8) != 0) {
313 panic("HwThreeWire(): nDataBufBitCnt(%d) should be multiple of 8!!!\n", 317 printk(KERN_ERR "rtl8187se: "
314 nDataBufBitCnt); 318 "HwThreeWire(): nDataBufBitCnt(%d)"
319 " should be multiple of 8!!!\n",
320 nDataBufBitCnt);
321 dump_stack();
322 nDataBufBitCnt += 8;
323 nDataBufBitCnt &= ~7;
324 }
315 325
316 if (nDataBufBitCnt > 64) 326 if (nDataBufBitCnt > 64) {
317 panic("HwThreeWire(): nDataBufBitCnt(%d) should <= 64!!!\n", 327 printk(KERN_ERR "rtl8187se: HwThreeWire():"
318 nDataBufBitCnt); 328 " nDataBufBitCnt(%d) should <= 64!!!\n",
329 nDataBufBitCnt);
330 dump_stack();
331 nDataBufBitCnt = 64;
332 }
319 333
320 for(idx = 0; idx < ByteCnt; idx++) 334 for(idx = 0; idx < ByteCnt; idx++)
321 { 335 {
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c
index eb44b60e1eb5..ac2bf11e1119 100644
--- a/drivers/staging/samsung-laptop/samsung-laptop.c
+++ b/drivers/staging/samsung-laptop/samsung-laptop.c
@@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct device *dev,
356 } 356 }
357 return count; 357 return count;
358} 358}
359static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, 359static DEVICE_ATTR(silent, S_IWUSR | S_IRUGO,
360 get_silent_state, set_silent_state); 360 get_silent_state, set_silent_state);
361 361
362 362
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c
index c7e061e5e04d..456cd5c95765 100644
--- a/drivers/staging/udlfb/udlfb.c
+++ b/drivers/staging/udlfb/udlfb.c
@@ -1143,7 +1143,7 @@ static struct device_attribute fb_device_attrs[] = {
1143 __ATTR_RO(metrics_bytes_sent), 1143 __ATTR_RO(metrics_bytes_sent),
1144 __ATTR_RO(metrics_cpu_kcycles_used), 1144 __ATTR_RO(metrics_cpu_kcycles_used),
1145 __ATTR_RO(metrics_misc), 1145 __ATTR_RO(metrics_misc),
1146 __ATTR(metrics_reset, S_IWUGO, NULL, metrics_reset_store), 1146 __ATTR(metrics_reset, S_IWUSR, NULL, metrics_reset_store),
1147 __ATTR_RW(use_defio), 1147 __ATTR_RW(use_defio),
1148}; 1148};
1149 1149
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index a2566f1075d5..af3832b03e4b 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -38,21 +38,13 @@ static int event_handler(struct usbip_device *ud)
38 ud->eh_ops.shutdown(ud); 38 ud->eh_ops.shutdown(ud);
39 39
40 ud->event &= ~USBIP_EH_SHUTDOWN; 40 ud->event &= ~USBIP_EH_SHUTDOWN;
41
42 break;
43 } 41 }
44 42
45 /* Stop the error handler. */
46 if (ud->event & USBIP_EH_BYE)
47 return -1;
48
49 /* Reset the device. */ 43 /* Reset the device. */
50 if (ud->event & USBIP_EH_RESET) { 44 if (ud->event & USBIP_EH_RESET) {
51 ud->eh_ops.reset(ud); 45 ud->eh_ops.reset(ud);
52 46
53 ud->event &= ~USBIP_EH_RESET; 47 ud->event &= ~USBIP_EH_RESET;
54
55 break;
56 } 48 }
57 49
58 /* Mark the device as unusable. */ 50 /* Mark the device as unusable. */
@@ -60,13 +52,11 @@ static int event_handler(struct usbip_device *ud)
60 ud->eh_ops.unusable(ud); 52 ud->eh_ops.unusable(ud);
61 53
62 ud->event &= ~USBIP_EH_UNUSABLE; 54 ud->event &= ~USBIP_EH_UNUSABLE;
63
64 break;
65 } 55 }
66 56
67 /* NOTREACHED */ 57 /* Stop the error handler. */
68 printk(KERN_ERR "%s: unknown event\n", __func__); 58 if (ud->event & USBIP_EH_BYE)
69 return -1; 59 return -1;
70 } 60 }
71 61
72 return 0; 62 return 0;
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index 0574d848b900..08bd26a245d5 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -164,6 +164,8 @@ void rh_port_disconnect(int rhport)
164 * spin_unlock(&vdev->ud.lock); */ 164 * spin_unlock(&vdev->ud.lock); */
165 165
166 spin_unlock_irqrestore(&the_controller->lock, flags); 166 spin_unlock_irqrestore(&the_controller->lock, flags);
167
168 usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
167} 169}
168 170
169 171
@@ -797,20 +799,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
797 spin_unlock_irqrestore(&vdev->priv_lock, flags2); 799 spin_unlock_irqrestore(&vdev->priv_lock, flags2);
798 } 800 }
799 801
800
801 if (!vdev->ud.tcp_socket) {
802 /* tcp connection is closed */
803 usbip_uinfo("vhci_hcd: vhci_urb_dequeue() gives back urb %p\n",
804 urb);
805
806 usb_hcd_unlink_urb_from_ep(hcd, urb);
807
808 spin_unlock_irqrestore(&the_controller->lock, flags);
809 usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb,
810 urb->status);
811 spin_lock_irqsave(&the_controller->lock, flags);
812 }
813
814 spin_unlock_irqrestore(&the_controller->lock, flags); 802 spin_unlock_irqrestore(&the_controller->lock, flags);
815 803
816 usbip_dbg_vhci_hc("leave\n"); 804 usbip_dbg_vhci_hc("leave\n");
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 722c840ac638..7e89383599e1 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -235,6 +235,7 @@ static int zram_read(struct zram *zram, struct bio *bio)
235 235
236 if (zram_test_flag(zram, index, ZRAM_ZERO)) { 236 if (zram_test_flag(zram, index, ZRAM_ZERO)) {
237 handle_zero_page(page); 237 handle_zero_page(page);
238 index++;
238 continue; 239 continue;
239 } 240 }
240 241
@@ -243,12 +244,14 @@ static int zram_read(struct zram *zram, struct bio *bio)
243 pr_debug("Read before write: sector=%lu, size=%u", 244 pr_debug("Read before write: sector=%lu, size=%u",
244 (ulong)(bio->bi_sector), bio->bi_size); 245 (ulong)(bio->bi_sector), bio->bi_size);
245 /* Do nothing */ 246 /* Do nothing */
247 index++;
246 continue; 248 continue;
247 } 249 }
248 250
249 /* Page is stored uncompressed since it's incompressible */ 251 /* Page is stored uncompressed since it's incompressible */
250 if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { 252 if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
251 handle_uncompressed_page(zram, page, index); 253 handle_uncompressed_page(zram, page, index);
254 index++;
252 continue; 255 continue;
253 } 256 }
254 257
@@ -324,6 +327,7 @@ static int zram_write(struct zram *zram, struct bio *bio)
324 mutex_unlock(&zram->lock); 327 mutex_unlock(&zram->lock);
325 zram_stat_inc(&zram->stats.pages_zero); 328 zram_stat_inc(&zram->stats.pages_zero);
326 zram_set_flag(zram, index, ZRAM_ZERO); 329 zram_set_flag(zram, index, ZRAM_ZERO);
330 index++;
327 continue; 331 continue;
328 } 332 }
329 333
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index ea071a5b6eee..44447f54942f 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2301,7 +2301,7 @@ out:
2301 return ret; 2301 return ret;
2302} 2302}
2303 2303
2304static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); 2304static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot);
2305 2305
2306static ssize_t read_human_status(struct device *dev, 2306static ssize_t read_human_status(struct device *dev,
2307 struct device_attribute *attr, char *buf) 2307 struct device_attribute *attr, char *buf)
@@ -2364,8 +2364,7 @@ out:
2364 return ret; 2364 return ret;
2365} 2365}
2366 2366
2367static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, 2367static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL);
2368 read_human_status, NULL);
2369 2368
2370static ssize_t read_delin(struct device *dev, struct device_attribute *attr, 2369static ssize_t read_delin(struct device *dev, struct device_attribute *attr,
2371 char *buf) 2370 char *buf)
@@ -2397,7 +2396,7 @@ out:
2397 return ret; 2396 return ret;
2398} 2397}
2399 2398
2400static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); 2399static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL);
2401 2400
2402#define UEA_ATTR(name, reset) \ 2401#define UEA_ATTR(name, reset) \
2403 \ 2402 \
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index bc62fae0680f..3ffa43477609 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1607,6 +1607,7 @@ static const struct usb_device_id acm_ids[] = {
1607 { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ 1607 { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */
1608 { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ 1608 { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */
1609 { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ 1609 { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */
1610 { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */
1610 { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ 1611 { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */
1611 1612
1612 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ 1613 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f1aaff6202a5..045bb4b823e1 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg)
965 965
966static int proc_connectinfo(struct dev_state *ps, void __user *arg) 966static int proc_connectinfo(struct dev_state *ps, void __user *arg)
967{ 967{
968 struct usbdevfs_connectinfo ci; 968 struct usbdevfs_connectinfo ci = {
969 .devnum = ps->dev->devnum,
970 .slow = ps->dev->speed == USB_SPEED_LOW
971 };
969 972
970 ci.devnum = ps->dev->devnum;
971 ci.slow = ps->dev->speed == USB_SPEED_LOW;
972 if (copy_to_user(arg, &ci, sizeof(ci))) 973 if (copy_to_user(arg, &ci, sizeof(ci)))
973 return -EFAULT; 974 return -EFAULT;
974 return 0; 975 return 0;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5cca00a6d09d..b5c965c031f9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1945,7 +1945,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
1945 1945
1946 dev_dbg(&rhdev->dev, "usb %s%s\n", 1946 dev_dbg(&rhdev->dev, "usb %s%s\n",
1947 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); 1947 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume");
1948 clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
1949 if (!hcd->driver->bus_resume) 1948 if (!hcd->driver->bus_resume)
1950 return -ENOENT; 1949 return -ENOENT;
1951 if (hcd->state == HC_STATE_RUNNING) 1950 if (hcd->state == HC_STATE_RUNNING)
@@ -1953,6 +1952,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
1953 1952
1954 hcd->state = HC_STATE_RESUMING; 1953 hcd->state = HC_STATE_RESUMING;
1955 status = hcd->driver->bus_resume(hcd); 1954 status = hcd->driver->bus_resume(hcd);
1955 clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
1956 if (status == 0) { 1956 if (status == 0) {
1957 /* TRSMRCY = 10 msec */ 1957 /* TRSMRCY = 10 msec */
1958 msleep(10); 1958 msleep(10);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 84c1897188d2..6c16c4f2c741 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -677,6 +677,8 @@ static void hub_init_func3(struct work_struct *ws);
677static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) 677static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
678{ 678{
679 struct usb_device *hdev = hub->hdev; 679 struct usb_device *hdev = hub->hdev;
680 struct usb_hcd *hcd;
681 int ret;
680 int port1; 682 int port1;
681 int status; 683 int status;
682 bool need_debounce_delay = false; 684 bool need_debounce_delay = false;
@@ -715,6 +717,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
715 usb_autopm_get_interface_no_resume( 717 usb_autopm_get_interface_no_resume(
716 to_usb_interface(hub->intfdev)); 718 to_usb_interface(hub->intfdev));
717 return; /* Continues at init2: below */ 719 return; /* Continues at init2: below */
720 } else if (type == HUB_RESET_RESUME) {
721 /* The internal host controller state for the hub device
722 * may be gone after a host power loss on system resume.
723 * Update the device's info so the HW knows it's a hub.
724 */
725 hcd = bus_to_hcd(hdev->bus);
726 if (hcd->driver->update_hub_device) {
727 ret = hcd->driver->update_hub_device(hcd, hdev,
728 &hub->tt, GFP_NOIO);
729 if (ret < 0) {
730 dev_err(hub->intfdev, "Host not "
731 "accepting hub info "
732 "update.\n");
733 dev_err(hub->intfdev, "LS/FS devices "
734 "and hubs may not work "
735 "under this hub\n.");
736 }
737 }
738 hub_power_on(hub, true);
718 } else { 739 } else {
719 hub_power_on(hub, true); 740 hub_power_on(hub, true);
720 } 741 }
@@ -2722,6 +2743,11 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2722 udev->ttport = hdev->ttport; 2743 udev->ttport = hdev->ttport;
2723 } else if (udev->speed != USB_SPEED_HIGH 2744 } else if (udev->speed != USB_SPEED_HIGH
2724 && hdev->speed == USB_SPEED_HIGH) { 2745 && hdev->speed == USB_SPEED_HIGH) {
2746 if (!hub->tt.hub) {
2747 dev_err(&udev->dev, "parent hub has no TT\n");
2748 retval = -EINVAL;
2749 goto fail;
2750 }
2725 udev->tt = &hub->tt; 2751 udev->tt = &hub->tt;
2726 udev->ttport = port1; 2752 udev->ttport = port1;
2727 } 2753 }
@@ -2860,13 +2886,16 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2860 else 2886 else
2861 i = udev->descriptor.bMaxPacketSize0; 2887 i = udev->descriptor.bMaxPacketSize0;
2862 if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { 2888 if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) {
2863 if (udev->speed != USB_SPEED_FULL || 2889 if (udev->speed == USB_SPEED_LOW ||
2864 !(i == 8 || i == 16 || i == 32 || i == 64)) { 2890 !(i == 8 || i == 16 || i == 32 || i == 64)) {
2865 dev_err(&udev->dev, "ep0 maxpacket = %d\n", i); 2891 dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i);
2866 retval = -EMSGSIZE; 2892 retval = -EMSGSIZE;
2867 goto fail; 2893 goto fail;
2868 } 2894 }
2869 dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); 2895 if (udev->speed == USB_SPEED_FULL)
2896 dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
2897 else
2898 dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i);
2870 udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); 2899 udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
2871 usb_ep0_reinit(udev); 2900 usb_ep0_reinit(udev);
2872 } 2901 }
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 9f0ce7de0e36..d6e3e410477e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1140,13 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1140{ 1140{
1141 int i; 1141 int i;
1142 1142
1143 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
1144 skip_ep0 ? "non-ep0" : "all");
1145 for (i = skip_ep0; i < 16; ++i) {
1146 usb_disable_endpoint(dev, i, true);
1147 usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1148 }
1149
1150 /* getting rid of interfaces will disconnect 1143 /* getting rid of interfaces will disconnect
1151 * any drivers bound to them (a key side effect) 1144 * any drivers bound to them (a key side effect)
1152 */ 1145 */
@@ -1176,6 +1169,13 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1176 if (dev->state == USB_STATE_CONFIGURED) 1169 if (dev->state == USB_STATE_CONFIGURED)
1177 usb_set_device_state(dev, USB_STATE_ADDRESS); 1170 usb_set_device_state(dev, USB_STATE_ADDRESS);
1178 } 1171 }
1172
1173 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
1174 skip_ep0 ? "non-ep0" : "all");
1175 for (i = skip_ep0; i < 16; ++i) {
1176 usb_disable_endpoint(dev, i, true);
1177 usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1178 }
1179} 1179}
1180 1180
1181/** 1181/**
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index d623c7bda1f6..2d19d88846ef 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -2014,6 +2014,9 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2014 } else { 2014 } else {
2015 disable_irq(gpio_to_irq(udc->vbus_pin)); 2015 disable_irq(gpio_to_irq(udc->vbus_pin));
2016 } 2016 }
2017 } else {
2018 /* gpio_request fail so use -EINVAL for gpio_is_valid */
2019 udc->vbus_pin = -EINVAL;
2017 } 2020 }
2018 } 2021 }
2019 2022
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 1160c55de7f2..67746b19ac54 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -901,7 +901,8 @@ unknown:
901 */ 901 */
902 switch (ctrl->bRequestType & USB_RECIP_MASK) { 902 switch (ctrl->bRequestType & USB_RECIP_MASK) {
903 case USB_RECIP_INTERFACE: 903 case USB_RECIP_INTERFACE:
904 f = cdev->config->interface[intf]; 904 if (cdev->config)
905 f = cdev->config->interface[intf];
905 break; 906 break;
906 907
907 case USB_RECIP_ENDPOINT: 908 case USB_RECIP_ENDPOINT:
@@ -1082,14 +1083,6 @@ static int composite_bind(struct usb_gadget *gadget)
1082 */ 1083 */
1083 usb_ep_autoconfig_reset(cdev->gadget); 1084 usb_ep_autoconfig_reset(cdev->gadget);
1084 1085
1085 /* standardized runtime overrides for device ID data */
1086 if (idVendor)
1087 cdev->desc.idVendor = cpu_to_le16(idVendor);
1088 if (idProduct)
1089 cdev->desc.idProduct = cpu_to_le16(idProduct);
1090 if (bcdDevice)
1091 cdev->desc.bcdDevice = cpu_to_le16(bcdDevice);
1092
1093 /* composite gadget needs to assign strings for whole device (like 1086 /* composite gadget needs to assign strings for whole device (like
1094 * serial number), register function drivers, potentially update 1087 * serial number), register function drivers, potentially update
1095 * power state and consumption, etc 1088 * power state and consumption, etc
@@ -1101,6 +1094,14 @@ static int composite_bind(struct usb_gadget *gadget)
1101 cdev->desc = *composite->dev; 1094 cdev->desc = *composite->dev;
1102 cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; 1095 cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
1103 1096
1097 /* standardized runtime overrides for device ID data */
1098 if (idVendor)
1099 cdev->desc.idVendor = cpu_to_le16(idVendor);
1100 if (idProduct)
1101 cdev->desc.idProduct = cpu_to_le16(idProduct);
1102 if (bcdDevice)
1103 cdev->desc.bcdDevice = cpu_to_le16(bcdDevice);
1104
1104 /* strings can't be assigned before bind() allocates the 1105 /* strings can't be assigned before bind() allocates the
1105 * releavnt identifiers 1106 * releavnt identifiers
1106 */ 1107 */
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index d47a123f15ab..bd6226cbae86 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -111,7 +111,7 @@ acm_iad_descriptor = {
111 .bInterfaceCount = 2, // control + data 111 .bInterfaceCount = 2, // control + data
112 .bFunctionClass = USB_CLASS_COMM, 112 .bFunctionClass = USB_CLASS_COMM,
113 .bFunctionSubClass = USB_CDC_SUBCLASS_ACM, 113 .bFunctionSubClass = USB_CDC_SUBCLASS_ACM,
114 .bFunctionProtocol = USB_CDC_PROTO_NONE, 114 .bFunctionProtocol = USB_CDC_ACM_PROTO_AT_V25TER,
115 /* .iFunction = DYNAMIC */ 115 /* .iFunction = DYNAMIC */
116}; 116};
117 117
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index a9474f8d5325..3c2f0a43c9c6 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -53,8 +53,8 @@ MODULE_AUTHOR("Michal Nazarewicz");
53MODULE_LICENSE("GPL"); 53MODULE_LICENSE("GPL");
54 54
55 55
56static unsigned short gfs_vendor_id = 0x0525; /* XXX NetChip */ 56static unsigned short gfs_vendor_id = 0x1d6b; /* Linux Foundation */
57static unsigned short gfs_product_id = 0xa4ac; /* XXX */ 57static unsigned short gfs_product_id = 0x0105; /* FunctionFS Gadget */
58 58
59static struct usb_device_descriptor gfs_dev_desc = { 59static struct usb_device_descriptor gfs_dev_desc = {
60 .bLength = sizeof gfs_dev_desc, 60 .bLength = sizeof gfs_dev_desc,
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 795d76232167..36d67a32abef 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -74,8 +74,8 @@ MODULE_LICENSE("GPL");
74 74
75/***************************** Device Descriptor ****************************/ 75/***************************** Device Descriptor ****************************/
76 76
77#define MULTI_VENDOR_NUM 0x0525 /* XXX NetChip */ 77#define MULTI_VENDOR_NUM 0x1d6b /* Linux Foundation */
78#define MULTI_PRODUCT_NUM 0xa4ab /* XXX */ 78#define MULTI_PRODUCT_NUM 0x0104 /* Multifunction Composite Gadget */
79 79
80 80
81enum { 81enum {
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index cf241c371a71..15222ebf3422 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget;
131 * parameters are in UTF-8 (superset of ASCII's 7 bit characters). 131 * parameters are in UTF-8 (superset of ASCII's 7 bit characters).
132 */ 132 */
133 133
134static ushort __initdata idVendor; 134static ushort idVendor;
135module_param(idVendor, ushort, S_IRUGO); 135module_param(idVendor, ushort, S_IRUGO);
136MODULE_PARM_DESC(idVendor, "USB Vendor ID"); 136MODULE_PARM_DESC(idVendor, "USB Vendor ID");
137 137
138static ushort __initdata idProduct; 138static ushort idProduct;
139module_param(idProduct, ushort, S_IRUGO); 139module_param(idProduct, ushort, S_IRUGO);
140MODULE_PARM_DESC(idProduct, "USB Product ID"); 140MODULE_PARM_DESC(idProduct, "USB Product ID");
141 141
142static ushort __initdata bcdDevice; 142static ushort bcdDevice;
143module_param(bcdDevice, ushort, S_IRUGO); 143module_param(bcdDevice, ushort, S_IRUGO);
144MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); 144MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)");
145 145
146static char *__initdata iManufacturer; 146static char *iManufacturer;
147module_param(iManufacturer, charp, S_IRUGO); 147module_param(iManufacturer, charp, S_IRUGO);
148MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); 148MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");
149 149
150static char *__initdata iProduct; 150static char *iProduct;
151module_param(iProduct, charp, S_IRUGO); 151module_param(iProduct, charp, S_IRUGO);
152MODULE_PARM_DESC(iProduct, "USB Product string"); 152MODULE_PARM_DESC(iProduct, "USB Product string");
153 153
154static char *__initdata iSerialNum; 154static char *iSerialNum;
155module_param(iSerialNum, charp, S_IRUGO); 155module_param(iSerialNum, charp, S_IRUGO);
156MODULE_PARM_DESC(iSerialNum, "1"); 156MODULE_PARM_DESC(iSerialNum, "1");
157 157
158static char *__initdata iPNPstring; 158static char *iPNPstring;
159module_param(iPNPstring, charp, S_IRUGO); 159module_param(iPNPstring, charp, S_IRUGO);
160MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); 160MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;");
161 161
@@ -1596,13 +1596,12 @@ cleanup(void)
1596 int status; 1596 int status;
1597 1597
1598 mutex_lock(&usb_printer_gadget.lock_printer_io); 1598 mutex_lock(&usb_printer_gadget.lock_printer_io);
1599 class_destroy(usb_gadget_class);
1600 unregister_chrdev_region(g_printer_devno, 2);
1601
1602 status = usb_gadget_unregister_driver(&printer_driver); 1599 status = usb_gadget_unregister_driver(&printer_driver);
1603 if (status) 1600 if (status)
1604 ERROR(dev, "usb_gadget_unregister_driver %x\n", status); 1601 ERROR(dev, "usb_gadget_unregister_driver %x\n", status);
1605 1602
1603 unregister_chrdev_region(g_printer_devno, 2);
1604 class_destroy(usb_gadget_class);
1606 mutex_unlock(&usb_printer_gadget.lock_printer_io); 1605 mutex_unlock(&usb_printer_gadget.lock_printer_io);
1607} 1606}
1608module_exit(cleanup); 1607module_exit(cleanup);
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 2baf8a849086..a869e3c103d3 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -227,8 +227,8 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
227 * mark HW unaccessible. The PM and USB cores make sure that 227 * mark HW unaccessible. The PM and USB cores make sure that
228 * the root hub is either suspended or stopped. 228 * the root hub is either suspended or stopped.
229 */ 229 */
230 spin_lock_irqsave(&ehci->lock, flags);
231 ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); 230 ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev));
231 spin_lock_irqsave(&ehci->lock, flags);
232 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 232 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
233 (void)ehci_readl(ehci, &ehci->regs->intr_enable); 233 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
234 234
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 76b7fd2d838a..b349021c052b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1063,7 +1063,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
1063 &debug_registers_fops)) 1063 &debug_registers_fops))
1064 goto file_error; 1064 goto file_error;
1065 1065
1066 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, 1066 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus,
1067 &debug_lpm_fops)) 1067 &debug_lpm_fops))
1068 goto file_error; 1068 goto file_error;
1069 1069
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 34a928d3b7d2..597ed102d54f 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -114,6 +114,9 @@ MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us\n");
114 114
115#define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) 115#define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)
116 116
117/* for ASPM quirk of ISOC on AMD SB800 */
118static struct pci_dev *amd_nb_dev;
119
117/*-------------------------------------------------------------------------*/ 120/*-------------------------------------------------------------------------*/
118 121
119#include "ehci.h" 122#include "ehci.h"
@@ -514,6 +517,11 @@ static void ehci_stop (struct usb_hcd *hcd)
514 spin_unlock_irq (&ehci->lock); 517 spin_unlock_irq (&ehci->lock);
515 ehci_mem_cleanup (ehci); 518 ehci_mem_cleanup (ehci);
516 519
520 if (amd_nb_dev) {
521 pci_dev_put(amd_nb_dev);
522 amd_nb_dev = NULL;
523 }
524
517#ifdef EHCI_STATS 525#ifdef EHCI_STATS
518 ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n", 526 ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
519 ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim, 527 ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
@@ -549,6 +557,8 @@ static int ehci_init(struct usb_hcd *hcd)
549 ehci->iaa_watchdog.function = ehci_iaa_watchdog; 557 ehci->iaa_watchdog.function = ehci_iaa_watchdog;
550 ehci->iaa_watchdog.data = (unsigned long) ehci; 558 ehci->iaa_watchdog.data = (unsigned long) ehci;
551 559
560 hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
561
552 /* 562 /*
553 * hw default: 1K periodic list heads, one per frame. 563 * hw default: 1K periodic list heads, one per frame.
554 * periodic_size can shrink by USBCMD update if hcc_params allows. 564 * periodic_size can shrink by USBCMD update if hcc_params allows.
@@ -556,11 +566,20 @@ static int ehci_init(struct usb_hcd *hcd)
556 ehci->periodic_size = DEFAULT_I_TDPS; 566 ehci->periodic_size = DEFAULT_I_TDPS;
557 INIT_LIST_HEAD(&ehci->cached_itd_list); 567 INIT_LIST_HEAD(&ehci->cached_itd_list);
558 INIT_LIST_HEAD(&ehci->cached_sitd_list); 568 INIT_LIST_HEAD(&ehci->cached_sitd_list);
569
570 if (HCC_PGM_FRAMELISTLEN(hcc_params)) {
571 /* periodic schedule size can be smaller than default */
572 switch (EHCI_TUNE_FLS) {
573 case 0: ehci->periodic_size = 1024; break;
574 case 1: ehci->periodic_size = 512; break;
575 case 2: ehci->periodic_size = 256; break;
576 default: BUG();
577 }
578 }
559 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) 579 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
560 return retval; 580 return retval;
561 581
562 /* controllers may cache some of the periodic schedule ... */ 582 /* controllers may cache some of the periodic schedule ... */
563 hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
564 if (HCC_ISOC_CACHE(hcc_params)) // full frame cache 583 if (HCC_ISOC_CACHE(hcc_params)) // full frame cache
565 ehci->i_thresh = 2 + 8; 584 ehci->i_thresh = 2 + 8;
566 else // N microframes cached 585 else // N microframes cached
@@ -614,12 +633,6 @@ static int ehci_init(struct usb_hcd *hcd)
614 /* periodic schedule size can be smaller than default */ 633 /* periodic schedule size can be smaller than default */
615 temp &= ~(3 << 2); 634 temp &= ~(3 << 2);
616 temp |= (EHCI_TUNE_FLS << 2); 635 temp |= (EHCI_TUNE_FLS << 2);
617 switch (EHCI_TUNE_FLS) {
618 case 0: ehci->periodic_size = 1024; break;
619 case 1: ehci->periodic_size = 512; break;
620 case 2: ehci->periodic_size = 256; break;
621 default: BUG();
622 }
623 } 636 }
624 if (HCC_LPM(hcc_params)) { 637 if (HCC_LPM(hcc_params)) {
625 /* support link power management EHCI 1.1 addendum */ 638 /* support link power management EHCI 1.1 addendum */
@@ -1048,10 +1061,11 @@ rescan:
1048 tmp && tmp != qh; 1061 tmp && tmp != qh;
1049 tmp = tmp->qh_next.qh) 1062 tmp = tmp->qh_next.qh)
1050 continue; 1063 continue;
1051 /* periodic qh self-unlinks on empty */ 1064 /* periodic qh self-unlinks on empty, and a COMPLETING qh
1052 if (!tmp) 1065 * may already be unlinked.
1053 goto nogood; 1066 */
1054 unlink_async (ehci, qh); 1067 if (tmp)
1068 unlink_async(ehci, qh);
1055 /* FALL THROUGH */ 1069 /* FALL THROUGH */
1056 case QH_STATE_UNLINK: /* wait for hw to finish? */ 1070 case QH_STATE_UNLINK: /* wait for hw to finish? */
1057 case QH_STATE_UNLINK_WAIT: 1071 case QH_STATE_UNLINK_WAIT:
@@ -1068,7 +1082,6 @@ idle_timeout:
1068 } 1082 }
1069 /* else FALL THROUGH */ 1083 /* else FALL THROUGH */
1070 default: 1084 default:
1071nogood:
1072 /* caller was supposed to have unlinked any requests; 1085 /* caller was supposed to have unlinked any requests;
1073 * that's not our job. just leak this memory. 1086 * that's not our job. just leak this memory.
1074 */ 1087 */
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 796ea0c8900f..8a515f0d5988 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -111,6 +111,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
111{ 111{
112 int port; 112 int port;
113 u32 temp; 113 u32 temp;
114 unsigned long flags;
114 115
115 /* If remote wakeup is enabled for the root hub but disabled 116 /* If remote wakeup is enabled for the root hub but disabled
116 * for the controller, we must adjust all the port wakeup flags 117 * for the controller, we must adjust all the port wakeup flags
@@ -120,6 +121,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
120 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) 121 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
121 return; 122 return;
122 123
124 spin_lock_irqsave(&ehci->lock, flags);
125
123 /* clear phy low-power mode before changing wakeup flags */ 126 /* clear phy low-power mode before changing wakeup flags */
124 if (ehci->has_hostpc) { 127 if (ehci->has_hostpc) {
125 port = HCS_N_PORTS(ehci->hcs_params); 128 port = HCS_N_PORTS(ehci->hcs_params);
@@ -131,7 +134,9 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
131 temp = ehci_readl(ehci, hostpc_reg); 134 temp = ehci_readl(ehci, hostpc_reg);
132 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); 135 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg);
133 } 136 }
137 spin_unlock_irqrestore(&ehci->lock, flags);
134 msleep(5); 138 msleep(5);
139 spin_lock_irqsave(&ehci->lock, flags);
135 } 140 }
136 141
137 port = HCS_N_PORTS(ehci->hcs_params); 142 port = HCS_N_PORTS(ehci->hcs_params);
@@ -170,6 +175,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
170 /* Does the root hub have a port wakeup pending? */ 175 /* Does the root hub have a port wakeup pending? */
171 if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) 176 if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD))
172 usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); 177 usb_hcd_resume_root_hub(ehci_to_hcd(ehci));
178
179 spin_unlock_irqrestore(&ehci->lock, flags);
173} 180}
174 181
175static int ehci_bus_suspend (struct usb_hcd *hcd) 182static int ehci_bus_suspend (struct usb_hcd *hcd)
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index a1e8d273103f..566791e04e8c 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -41,6 +41,42 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
41 return 0; 41 return 0;
42} 42}
43 43
44static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci)
45{
46 struct pci_dev *amd_smbus_dev;
47 u8 rev = 0;
48
49 amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL);
50 if (amd_smbus_dev) {
51 pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
52 if (rev < 0x40) {
53 pci_dev_put(amd_smbus_dev);
54 amd_smbus_dev = NULL;
55 return 0;
56 }
57 } else {
58 amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL);
59 if (!amd_smbus_dev)
60 return 0;
61 pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
62 if (rev < 0x11 || rev > 0x18) {
63 pci_dev_put(amd_smbus_dev);
64 amd_smbus_dev = NULL;
65 return 0;
66 }
67 }
68
69 if (!amd_nb_dev)
70 amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL);
71
72 ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n");
73
74 pci_dev_put(amd_smbus_dev);
75 amd_smbus_dev = NULL;
76
77 return 1;
78}
79
44/* called during probe() after chip reset completes */ 80/* called during probe() after chip reset completes */
45static int ehci_pci_setup(struct usb_hcd *hcd) 81static int ehci_pci_setup(struct usb_hcd *hcd)
46{ 82{
@@ -99,6 +135,9 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
99 /* cache this readonly data; minimize chip reads */ 135 /* cache this readonly data; minimize chip reads */
100 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); 136 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
101 137
138 if (ehci_quirk_amd_hudson(ehci))
139 ehci->amd_l1_fix = 1;
140
102 retval = ehci_halt(ehci); 141 retval = ehci_halt(ehci);
103 if (retval) 142 if (retval)
104 return retval; 143 return retval;
@@ -148,6 +187,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
148 if (pdev->revision < 0xa4) 187 if (pdev->revision < 0xa4)
149 ehci->no_selective_suspend = 1; 188 ehci->no_selective_suspend = 1;
150 break; 189 break;
190
191 /* MCP89 chips on the MacBookAir3,1 give EPROTO when
192 * fetching device descriptors unless LPM is disabled.
193 * There are also intermittent problems enumerating
194 * devices with PPCD enabled.
195 */
196 case 0x0d9d:
197 ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89");
198 ehci->has_lpm = 0;
199 ehci->has_ppcd = 0;
200 ehci->command &= ~CMD_PPCEE;
201 break;
151 } 202 }
152 break; 203 break;
153 case PCI_VENDOR_ID_VIA: 204 case PCI_VENDOR_ID_VIA:
@@ -296,8 +347,8 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
296 * mark HW unaccessible. The PM and USB cores make sure that 347 * mark HW unaccessible. The PM and USB cores make sure that
297 * the root hub is either suspended or stopped. 348 * the root hub is either suspended or stopped.
298 */ 349 */
299 spin_lock_irqsave (&ehci->lock, flags);
300 ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); 350 ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup);
351 spin_lock_irqsave (&ehci->lock, flags);
301 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 352 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
302 (void)ehci_readl(ehci, &ehci->regs->intr_enable); 353 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
303 354
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a92526d6e5ae..724ba7133c4f 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1583,6 +1583,63 @@ itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd)
1583 *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); 1583 *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD);
1584} 1584}
1585 1585
1586#define AB_REG_BAR_LOW 0xe0
1587#define AB_REG_BAR_HIGH 0xe1
1588#define AB_INDX(addr) ((addr) + 0x00)
1589#define AB_DATA(addr) ((addr) + 0x04)
1590#define NB_PCIE_INDX_ADDR 0xe0
1591#define NB_PCIE_INDX_DATA 0xe4
1592#define NB_PIF0_PWRDOWN_0 0x01100012
1593#define NB_PIF0_PWRDOWN_1 0x01100013
1594
1595static void ehci_quirk_amd_L1(struct ehci_hcd *ehci, int disable)
1596{
1597 u32 addr, addr_low, addr_high, val;
1598
1599 outb_p(AB_REG_BAR_LOW, 0xcd6);
1600 addr_low = inb_p(0xcd7);
1601 outb_p(AB_REG_BAR_HIGH, 0xcd6);
1602 addr_high = inb_p(0xcd7);
1603 addr = addr_high << 8 | addr_low;
1604 outl_p(0x30, AB_INDX(addr));
1605 outl_p(0x40, AB_DATA(addr));
1606 outl_p(0x34, AB_INDX(addr));
1607 val = inl_p(AB_DATA(addr));
1608
1609 if (disable) {
1610 val &= ~0x8;
1611 val |= (1 << 4) | (1 << 9);
1612 } else {
1613 val |= 0x8;
1614 val &= ~((1 << 4) | (1 << 9));
1615 }
1616 outl_p(val, AB_DATA(addr));
1617
1618 if (amd_nb_dev) {
1619 addr = NB_PIF0_PWRDOWN_0;
1620 pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr);
1621 pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val);
1622 if (disable)
1623 val &= ~(0x3f << 7);
1624 else
1625 val |= 0x3f << 7;
1626
1627 pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val);
1628
1629 addr = NB_PIF0_PWRDOWN_1;
1630 pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr);
1631 pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val);
1632 if (disable)
1633 val &= ~(0x3f << 7);
1634 else
1635 val |= 0x3f << 7;
1636
1637 pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val);
1638 }
1639
1640 return;
1641}
1642
1586/* fit urb's itds into the selected schedule slot; activate as needed */ 1643/* fit urb's itds into the selected schedule slot; activate as needed */
1587static int 1644static int
1588itd_link_urb ( 1645itd_link_urb (
@@ -1609,6 +1666,12 @@ itd_link_urb (
1609 urb->interval, 1666 urb->interval,
1610 next_uframe >> 3, next_uframe & 0x7); 1667 next_uframe >> 3, next_uframe & 0x7);
1611 } 1668 }
1669
1670 if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
1671 if (ehci->amd_l1_fix == 1)
1672 ehci_quirk_amd_L1(ehci, 1);
1673 }
1674
1612 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; 1675 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++;
1613 1676
1614 /* fill iTDs uframe by uframe */ 1677 /* fill iTDs uframe by uframe */
@@ -1733,6 +1796,11 @@ itd_complete (
1733 (void) disable_periodic(ehci); 1796 (void) disable_periodic(ehci);
1734 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 1797 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
1735 1798
1799 if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
1800 if (ehci->amd_l1_fix == 1)
1801 ehci_quirk_amd_L1(ehci, 0);
1802 }
1803
1736 if (unlikely(list_is_singular(&stream->td_list))) { 1804 if (unlikely(list_is_singular(&stream->td_list))) {
1737 ehci_to_hcd(ehci)->self.bandwidth_allocated 1805 ehci_to_hcd(ehci)->self.bandwidth_allocated
1738 -= stream->bandwidth; 1806 -= stream->bandwidth;
@@ -2018,6 +2086,12 @@ sitd_link_urb (
2018 (next_uframe >> 3) & (ehci->periodic_size - 1), 2086 (next_uframe >> 3) & (ehci->periodic_size - 1),
2019 stream->interval, hc32_to_cpu(ehci, stream->splits)); 2087 stream->interval, hc32_to_cpu(ehci, stream->splits));
2020 } 2088 }
2089
2090 if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
2091 if (ehci->amd_l1_fix == 1)
2092 ehci_quirk_amd_L1(ehci, 1);
2093 }
2094
2021 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; 2095 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++;
2022 2096
2023 /* fill sITDs frame by frame */ 2097 /* fill sITDs frame by frame */
@@ -2118,6 +2192,11 @@ sitd_complete (
2118 (void) disable_periodic(ehci); 2192 (void) disable_periodic(ehci);
2119 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 2193 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
2120 2194
2195 if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
2196 if (ehci->amd_l1_fix == 1)
2197 ehci_quirk_amd_L1(ehci, 0);
2198 }
2199
2121 if (list_is_singular(&stream->td_list)) { 2200 if (list_is_singular(&stream->td_list)) {
2122 ehci_to_hcd(ehci)->self.bandwidth_allocated 2201 ehci_to_hcd(ehci)->self.bandwidth_allocated
2123 -= stream->bandwidth; 2202 -= stream->bandwidth;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index bde823f704e9..fd1c53da89e4 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -130,6 +130,7 @@ struct ehci_hcd { /* one per controller */
130 unsigned has_amcc_usb23:1; 130 unsigned has_amcc_usb23:1;
131 unsigned need_io_watchdog:1; 131 unsigned need_io_watchdog:1;
132 unsigned broken_periodic:1; 132 unsigned broken_periodic:1;
133 unsigned amd_l1_fix:1;
133 unsigned fs_i_thresh:1; /* Intel iso scheduling */ 134 unsigned fs_i_thresh:1; /* Intel iso scheduling */
134 135
135 /* required for usb32 quirk */ 136 /* required for usb32 quirk */
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c
index 10e1872f3ab9..931d588c3fb5 100644
--- a/drivers/usb/host/ohci-jz4740.c
+++ b/drivers/usb/host/ohci-jz4740.c
@@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_jz4740_driver = {
273 }, 273 },
274}; 274};
275 275
276MODULE_ALIAS("platfrom:jz4740-ohci"); 276MODULE_ALIAS("platform:jz4740-ohci");
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index 95d0f5adfdcf..25563e9a90bc 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -227,7 +227,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
227 int odd = len & 0x0001; 227 int odd = len & 0x0001;
228 228
229 len = len / 2; 229 len = len / 2;
230 ioread16_rep(fifoaddr, buf, len); 230 iowrite16_rep(fifoaddr, buf, len);
231 if (unlikely(odd)) { 231 if (unlikely(odd)) {
232 buf = &buf[len]; 232 buf = &buf[len];
233 iowrite8((unsigned char)*buf, fifoaddr); 233 iowrite8((unsigned char)*buf, fifoaddr);
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a1a7a9795536..480936a870ce 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -132,6 +132,13 @@ static u32 xhci_port_state_to_neutral(u32 state)
132static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, 132static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex,
133 u32 __iomem *addr, u32 port_status) 133 u32 __iomem *addr, u32 port_status)
134{ 134{
135 /* Don't allow the USB core to disable SuperSpeed ports. */
136 if (xhci->port_array[wIndex] == 0x03) {
137 xhci_dbg(xhci, "Ignoring request to disable "
138 "SuperSpeed port.\n");
139 return;
140 }
141
135 /* Write 1 to disable the port */ 142 /* Write 1 to disable the port */
136 xhci_writel(xhci, port_status | PORT_PE, addr); 143 xhci_writel(xhci, port_status | PORT_PE, addr);
137 port_status = xhci_readl(xhci, addr); 144 port_status = xhci_readl(xhci, addr);
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 4e51343ddffc..6627a956fa8e 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1043,7 +1043,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
1043 if (udev->speed == USB_SPEED_SUPER) 1043 if (udev->speed == USB_SPEED_SUPER)
1044 return ep->ss_ep_comp.wBytesPerInterval; 1044 return ep->ss_ep_comp.wBytesPerInterval;
1045 1045
1046 max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1046 max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize);
1047 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; 1047 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
1048 /* A 0 in max burst means 1 transfer per ESIT */ 1048 /* A 0 in max burst means 1 transfer per ESIT */
1049 return max_packet * (max_burst + 1); 1049 return max_packet * (max_burst + 1);
@@ -1133,7 +1133,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1133 /* Fall through */ 1133 /* Fall through */
1134 case USB_SPEED_FULL: 1134 case USB_SPEED_FULL:
1135 case USB_SPEED_LOW: 1135 case USB_SPEED_LOW:
1136 max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1136 max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize);
1137 ep_ctx->ep_info2 |= MAX_PACKET(max_packet); 1137 ep_ctx->ep_info2 |= MAX_PACKET(max_packet);
1138 break; 1138 break;
1139 default: 1139 default:
@@ -1441,6 +1441,13 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1441 xhci->dcbaa = NULL; 1441 xhci->dcbaa = NULL;
1442 1442
1443 scratchpad_free(xhci); 1443 scratchpad_free(xhci);
1444
1445 xhci->num_usb2_ports = 0;
1446 xhci->num_usb3_ports = 0;
1447 kfree(xhci->usb2_ports);
1448 kfree(xhci->usb3_ports);
1449 kfree(xhci->port_array);
1450
1444 xhci->page_size = 0; 1451 xhci->page_size = 0;
1445 xhci->page_shift = 0; 1452 xhci->page_shift = 0;
1446} 1453}
@@ -1624,6 +1631,166 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci)
1624 &xhci->ir_set->erst_dequeue); 1631 &xhci->ir_set->erst_dequeue);
1625} 1632}
1626 1633
1634static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
1635 u32 __iomem *addr, u8 major_revision)
1636{
1637 u32 temp, port_offset, port_count;
1638 int i;
1639
1640 if (major_revision > 0x03) {
1641 xhci_warn(xhci, "Ignoring unknown port speed, "
1642 "Ext Cap %p, revision = 0x%x\n",
1643 addr, major_revision);
1644 /* Ignoring port protocol we can't understand. FIXME */
1645 return;
1646 }
1647
1648 /* Port offset and count in the third dword, see section 7.2 */
1649 temp = xhci_readl(xhci, addr + 2);
1650 port_offset = XHCI_EXT_PORT_OFF(temp);
1651 port_count = XHCI_EXT_PORT_COUNT(temp);
1652 xhci_dbg(xhci, "Ext Cap %p, port offset = %u, "
1653 "count = %u, revision = 0x%x\n",
1654 addr, port_offset, port_count, major_revision);
1655 /* Port count includes the current port offset */
1656 if (port_offset == 0 || (port_offset + port_count - 1) > num_ports)
1657 /* WTF? "Valid values are ‘1’ to MaxPorts" */
1658 return;
1659 port_offset--;
1660 for (i = port_offset; i < (port_offset + port_count); i++) {
1661 /* Duplicate entry. Ignore the port if the revisions differ. */
1662 if (xhci->port_array[i] != 0) {
1663 xhci_warn(xhci, "Duplicate port entry, Ext Cap %p,"
1664 " port %u\n", addr, i);
1665 xhci_warn(xhci, "Port was marked as USB %u, "
1666 "duplicated as USB %u\n",
1667 xhci->port_array[i], major_revision);
1668 /* Only adjust the roothub port counts if we haven't
1669 * found a similar duplicate.
1670 */
1671 if (xhci->port_array[i] != major_revision &&
1672 xhci->port_array[i] != (u8) -1) {
1673 if (xhci->port_array[i] == 0x03)
1674 xhci->num_usb3_ports--;
1675 else
1676 xhci->num_usb2_ports--;
1677 xhci->port_array[i] = (u8) -1;
1678 }
1679 /* FIXME: Should we disable the port? */
1680 continue;
1681 }
1682 xhci->port_array[i] = major_revision;
1683 if (major_revision == 0x03)
1684 xhci->num_usb3_ports++;
1685 else
1686 xhci->num_usb2_ports++;
1687 }
1688 /* FIXME: Should we disable ports not in the Extended Capabilities? */
1689}
1690
1691/*
1692 * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that
1693 * specify what speeds each port is supposed to be. We can't count on the port
1694 * speed bits in the PORTSC register being correct until a device is connected,
1695 * but we need to set up the two fake roothubs with the correct number of USB
1696 * 3.0 and USB 2.0 ports at host controller initialization time.
1697 */
1698static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
1699{
1700 u32 __iomem *addr;
1701 u32 offset;
1702 unsigned int num_ports;
1703 int i, port_index;
1704
1705 addr = &xhci->cap_regs->hcc_params;
1706 offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr));
1707 if (offset == 0) {
1708 xhci_err(xhci, "No Extended Capability registers, "
1709 "unable to set up roothub.\n");
1710 return -ENODEV;
1711 }
1712
1713 num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1714 xhci->port_array = kzalloc(sizeof(*xhci->port_array)*num_ports, flags);
1715 if (!xhci->port_array)
1716 return -ENOMEM;
1717
1718 /*
1719 * For whatever reason, the first capability offset is from the
1720 * capability register base, not from the HCCPARAMS register.
1721 * See section 5.3.6 for offset calculation.
1722 */
1723 addr = &xhci->cap_regs->hc_capbase + offset;
1724 while (1) {
1725 u32 cap_id;
1726
1727 cap_id = xhci_readl(xhci, addr);
1728 if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL)
1729 xhci_add_in_port(xhci, num_ports, addr,
1730 (u8) XHCI_EXT_PORT_MAJOR(cap_id));
1731 offset = XHCI_EXT_CAPS_NEXT(cap_id);
1732 if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports)
1733 == num_ports)
1734 break;
1735 /*
1736 * Once you're into the Extended Capabilities, the offset is
1737 * always relative to the register holding the offset.
1738 */
1739 addr += offset;
1740 }
1741
1742 if (xhci->num_usb2_ports == 0 && xhci->num_usb3_ports == 0) {
1743 xhci_warn(xhci, "No ports on the roothubs?\n");
1744 return -ENODEV;
1745 }
1746 xhci_dbg(xhci, "Found %u USB 2.0 ports and %u USB 3.0 ports.\n",
1747 xhci->num_usb2_ports, xhci->num_usb3_ports);
1748 /*
1749 * Note we could have all USB 3.0 ports, or all USB 2.0 ports.
1750 * Not sure how the USB core will handle a hub with no ports...
1751 */
1752 if (xhci->num_usb2_ports) {
1753 xhci->usb2_ports = kmalloc(sizeof(*xhci->usb2_ports)*
1754 xhci->num_usb2_ports, flags);
1755 if (!xhci->usb2_ports)
1756 return -ENOMEM;
1757
1758 port_index = 0;
1759 for (i = 0; i < num_ports; i++) {
1760 if (xhci->port_array[i] == 0x03 ||
1761 xhci->port_array[i] == 0 ||
1762 xhci->port_array[i] == -1)
1763 continue;
1764
1765 xhci->usb2_ports[port_index] =
1766 &xhci->op_regs->port_status_base +
1767 NUM_PORT_REGS*i;
1768 xhci_dbg(xhci, "USB 2.0 port at index %u, "
1769 "addr = %p\n", i,
1770 xhci->usb2_ports[port_index]);
1771 port_index++;
1772 }
1773 }
1774 if (xhci->num_usb3_ports) {
1775 xhci->usb3_ports = kmalloc(sizeof(*xhci->usb3_ports)*
1776 xhci->num_usb3_ports, flags);
1777 if (!xhci->usb3_ports)
1778 return -ENOMEM;
1779
1780 port_index = 0;
1781 for (i = 0; i < num_ports; i++)
1782 if (xhci->port_array[i] == 0x03) {
1783 xhci->usb3_ports[port_index] =
1784 &xhci->op_regs->port_status_base +
1785 NUM_PORT_REGS*i;
1786 xhci_dbg(xhci, "USB 3.0 port at index %u, "
1787 "addr = %p\n", i,
1788 xhci->usb3_ports[port_index]);
1789 port_index++;
1790 }
1791 }
1792 return 0;
1793}
1627 1794
1628int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) 1795int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
1629{ 1796{
@@ -1804,6 +1971,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
1804 1971
1805 if (scratchpad_alloc(xhci, flags)) 1972 if (scratchpad_alloc(xhci, flags))
1806 goto fail; 1973 goto fail;
1974 if (xhci_setup_port_arrays(xhci, flags))
1975 goto fail;
1807 1976
1808 return 0; 1977 return 0;
1809 1978
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 48e60d166ff0..e7547d8b3d67 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2028,7 +2028,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
2028 2028
2029 if (!(status & STS_EINT)) { 2029 if (!(status & STS_EINT)) {
2030 spin_unlock(&xhci->lock); 2030 spin_unlock(&xhci->lock);
2031 xhci_warn(xhci, "Spurious interrupt.\n");
2032 return IRQ_NONE; 2031 return IRQ_NONE;
2033 } 2032 }
2034 xhci_dbg(xhci, "op reg status = %08x\n", status); 2033 xhci_dbg(xhci, "op reg status = %08x\n", status);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d5c550ea3e68..96ef552cfeb3 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -508,9 +508,10 @@ void xhci_stop(struct usb_hcd *hcd)
508 spin_lock_irq(&xhci->lock); 508 spin_lock_irq(&xhci->lock);
509 xhci_halt(xhci); 509 xhci_halt(xhci);
510 xhci_reset(xhci); 510 xhci_reset(xhci);
511 xhci_cleanup_msix(xhci);
512 spin_unlock_irq(&xhci->lock); 511 spin_unlock_irq(&xhci->lock);
513 512
513 xhci_cleanup_msix(xhci);
514
514#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING 515#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING
515 /* Tell the event ring poll function not to reschedule */ 516 /* Tell the event ring poll function not to reschedule */
516 xhci->zombie = 1; 517 xhci->zombie = 1;
@@ -544,9 +545,10 @@ void xhci_shutdown(struct usb_hcd *hcd)
544 545
545 spin_lock_irq(&xhci->lock); 546 spin_lock_irq(&xhci->lock);
546 xhci_halt(xhci); 547 xhci_halt(xhci);
547 xhci_cleanup_msix(xhci);
548 spin_unlock_irq(&xhci->lock); 548 spin_unlock_irq(&xhci->lock);
549 549
550 xhci_cleanup_msix(xhci);
551
550 xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", 552 xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n",
551 xhci_readl(xhci, &xhci->op_regs->status)); 553 xhci_readl(xhci, &xhci->op_regs->status));
552} 554}
@@ -1284,6 +1286,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
1284 cmd_completion = command->completion; 1286 cmd_completion = command->completion;
1285 cmd_status = &command->status; 1287 cmd_status = &command->status;
1286 command->command_trb = xhci->cmd_ring->enqueue; 1288 command->command_trb = xhci->cmd_ring->enqueue;
1289
1290 /* Enqueue pointer can be left pointing to the link TRB,
1291 * we must handle that
1292 */
1293 if ((command->command_trb->link.control & TRB_TYPE_BITMASK)
1294 == TRB_TYPE(TRB_LINK))
1295 command->command_trb =
1296 xhci->cmd_ring->enq_seg->next->trbs;
1297
1287 list_add_tail(&command->cmd_list, &virt_dev->cmd_list); 1298 list_add_tail(&command->cmd_list, &virt_dev->cmd_list);
1288 } else { 1299 } else {
1289 in_ctx = virt_dev->in_ctx; 1300 in_ctx = virt_dev->in_ctx;
@@ -1993,6 +2004,15 @@ int xhci_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
1993 /* Attempt to submit the Reset Device command to the command ring */ 2004 /* Attempt to submit the Reset Device command to the command ring */
1994 spin_lock_irqsave(&xhci->lock, flags); 2005 spin_lock_irqsave(&xhci->lock, flags);
1995 reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; 2006 reset_device_cmd->command_trb = xhci->cmd_ring->enqueue;
2007
2008 /* Enqueue pointer can be left pointing to the link TRB,
2009 * we must handle that
2010 */
2011 if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK)
2012 == TRB_TYPE(TRB_LINK))
2013 reset_device_cmd->command_trb =
2014 xhci->cmd_ring->enq_seg->next->trbs;
2015
1996 list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); 2016 list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list);
1997 ret = xhci_queue_reset_device(xhci, slot_id); 2017 ret = xhci_queue_reset_device(xhci, slot_id);
1998 if (ret) { 2018 if (ret) {
@@ -2148,8 +2168,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
2148 xhci_err(xhci, "Error while assigning device slot ID\n"); 2168 xhci_err(xhci, "Error while assigning device slot ID\n");
2149 return 0; 2169 return 0;
2150 } 2170 }
2151 /* xhci_alloc_virt_device() does not touch rings; no need to lock */ 2171 /* xhci_alloc_virt_device() does not touch rings; no need to lock.
2152 if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { 2172 * Use GFP_NOIO, since this function can be called from
2173 * xhci_discover_or_reset_device(), which may be called as part of
2174 * mass storage driver error handling.
2175 */
2176 if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) {
2153 /* Disable slot, if we can do it without mem alloc */ 2177 /* Disable slot, if we can do it without mem alloc */
2154 xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); 2178 xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n");
2155 spin_lock_irqsave(&xhci->lock, flags); 2179 spin_lock_irqsave(&xhci->lock, flags);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 34a60d9f056a..404ecbce5128 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -448,6 +448,24 @@ struct xhci_doorbell_array {
448 448
449 449
450/** 450/**
451 * struct xhci_protocol_caps
452 * @revision: major revision, minor revision, capability ID,
453 * and next capability pointer.
454 * @name_string: Four ASCII characters to say which spec this xHC
455 * follows, typically "USB ".
456 * @port_info: Port offset, count, and protocol-defined information.
457 */
458struct xhci_protocol_caps {
459 u32 revision;
460 u32 name_string;
461 u32 port_info;
462};
463
464#define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff)
465#define XHCI_EXT_PORT_OFF(x) ((x) & 0xff)
466#define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff)
467
468/**
451 * struct xhci_container_ctx 469 * struct xhci_container_ctx
452 * @type: Type of context. Used to calculated offsets to contained contexts. 470 * @type: Type of context. Used to calculated offsets to contained contexts.
453 * @size: Size of the context data 471 * @size: Size of the context data
@@ -614,6 +632,11 @@ struct xhci_ep_ctx {
614#define MAX_PACKET_MASK (0xffff << 16) 632#define MAX_PACKET_MASK (0xffff << 16)
615#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) 633#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
616 634
635/* Get max packet size from ep desc. Bit 10..0 specify the max packet size.
636 * USB2.0 spec 9.6.6.
637 */
638#define GET_MAX_PACKET(p) ((p) & 0x7ff)
639
617/* tx_info bitmasks */ 640/* tx_info bitmasks */
618#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) 641#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
619#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) 642#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
@@ -1199,6 +1222,15 @@ struct xhci_hcd {
1199#define XHCI_LINK_TRB_QUIRK (1 << 0) 1222#define XHCI_LINK_TRB_QUIRK (1 << 0)
1200#define XHCI_RESET_EP_QUIRK (1 << 1) 1223#define XHCI_RESET_EP_QUIRK (1 << 1)
1201#define XHCI_NEC_HOST (1 << 2) 1224#define XHCI_NEC_HOST (1 << 2)
1225
1226 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
1227 u8 *port_array;
1228 /* Array of pointers to USB 3.0 PORTSC registers */
1229 u32 __iomem **usb3_ports;
1230 unsigned int num_usb3_ports;
1231 /* Array of pointers to USB 2.0 PORTSC registers */
1232 u32 __iomem **usb2_ports;
1233 unsigned int num_usb2_ports;
1202}; 1234};
1203 1235
1204/* For testing purposes */ 1236/* For testing purposes */
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 2f43c57743c9..9251773ecef4 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev,
196 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); 196 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1);
197} 197}
198 198
199static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, 199static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler);
200 get_port0_handler, set_port0_handler);
201 200
202static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, 201static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler);
203 get_port1_handler, set_port1_handler);
204 202
205 203
206static int cypress_probe(struct usb_interface *interface, 204static int cypress_probe(struct usb_interface *interface,
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index bc88c79875a1..0db05b252e3b 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
553 /* needed for power consumption */ 553 /* needed for power consumption */
554 struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; 554 struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc;
555 555
556 memset(&info, 0, sizeof(info));
556 /* directly from the descriptor */ 557 /* directly from the descriptor */
557 info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); 558 info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
558 info.product = dev->product_id; 559 info.product = dev->product_id;
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 70d00e99a4b4..dd573abd2d1e 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3008#else 3008#else
3009 x.sisusb_conactive = 0; 3009 x.sisusb_conactive = 0;
3010#endif 3010#endif
3011 memset(x.sisusb_reserved, 0, sizeof(x.sisusb_reserved));
3011 3012
3012 if (copy_to_user((void __user *)arg, &x, sizeof(x))) 3013 if (copy_to_user((void __user *)arg, &x, sizeof(x)))
3013 retval = -EFAULT; 3014 retval = -EFAULT;
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index d77aba46ae85..f63776a48e2a 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
86 return count; 86 return count;
87} 87}
88 88
89static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); 89static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed);
90 90
91static int tv_probe(struct usb_interface *interface, 91static int tv_probe(struct usb_interface *interface,
92 const struct usb_device_id *id) 92 const struct usb_device_id *id)
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 63da2c3c838f..c96f51de1696 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
94 change_color(led); \ 94 change_color(led); \
95 return count; \ 95 return count; \
96} \ 96} \
97static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 97static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value);
98show_set(blue); 98show_set(blue);
99show_set(red); 99show_set(red);
100show_set(green); 100show_set(green);
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index de8ef945b536..417b8f207e8b 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \
192 \ 192 \
193 return count; \ 193 return count; \
194} \ 194} \
195static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); 195static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name);
196 196
197static ssize_t show_attr_text(struct device *dev, 197static ssize_t show_attr_text(struct device *dev,
198 struct device_attribute *attr, char *buf) 198 struct device_attribute *attr, char *buf)
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev,
223 return count; 223 return count;
224} 224}
225 225
226static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); 226static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text);
227 227
228static ssize_t show_attr_decimals(struct device *dev, 228static ssize_t show_attr_decimals(struct device *dev,
229 struct device_attribute *attr, char *buf) 229 struct device_attribute *attr, char *buf)
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev,
272 return count; 272 return count;
273} 273}
274 274
275static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, 275static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals);
276 show_attr_decimals, set_attr_decimals);
277 276
278static ssize_t show_attr_textmode(struct device *dev, 277static ssize_t show_attr_textmode(struct device *dev,
279 struct device_attribute *attr, char *buf) 278 struct device_attribute *attr, char *buf)
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev,
319 return -EINVAL; 318 return -EINVAL;
320} 319}
321 320
322static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, 321static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode);
323 show_attr_textmode, set_attr_textmode);
324 322
325 323
326MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); 324MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 796e2f68f749..4ff21587ab03 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -3,7 +3,7 @@
3/* 3/*
4 * uss720.c -- USS720 USB Parport Cable. 4 * uss720.c -- USS720 USB Parport Cable.
5 * 5 *
6 * Copyright (C) 1999, 2005 6 * Copyright (C) 1999, 2005, 2010
7 * Thomas Sailer (t.sailer@alumni.ethz.ch) 7 * Thomas Sailer (t.sailer@alumni.ethz.ch)
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -776,6 +776,8 @@ static const struct usb_device_id uss720_table[] = {
776 { USB_DEVICE(0x0557, 0x2001) }, 776 { USB_DEVICE(0x0557, 0x2001) },
777 { USB_DEVICE(0x0729, 0x1284) }, 777 { USB_DEVICE(0x0729, 0x1284) },
778 { USB_DEVICE(0x1293, 0x0002) }, 778 { USB_DEVICE(0x1293, 0x0002) },
779 { USB_DEVICE(0x1293, 0x0002) },
780 { USB_DEVICE(0x050d, 0x0002) },
779 { } /* Terminating entry */ 781 { } /* Terminating entry */
780}; 782};
781 783
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index b611420a8050..611a9d274363 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -342,8 +342,10 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
342 342
343 usb_nop_xceiv_register(); 343 usb_nop_xceiv_register();
344 musb->xceiv = otg_get_transceiver(); 344 musb->xceiv = otg_get_transceiver();
345 if (!musb->xceiv) 345 if (!musb->xceiv) {
346 gpio_free(musb->config->gpio_vrsel);
346 return -ENODEV; 347 return -ENODEV;
348 }
347 349
348 if (ANOMALY_05000346) { 350 if (ANOMALY_05000346) {
349 bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); 351 bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
@@ -394,8 +396,9 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
394 396
395int musb_platform_exit(struct musb *musb) 397int musb_platform_exit(struct musb *musb)
396{ 398{
397
398 gpio_free(musb->config->gpio_vrsel); 399 gpio_free(musb->config->gpio_vrsel);
399 400
401 otg_put_transceiver(musb->xceiv);
402 usb_nop_xceiv_unregister();
400 return 0; 403 return 0;
401} 404}
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 57624361c1de..6e67629f50cc 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -446,6 +446,7 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
446fail: 446fail:
447 clk_disable(musb->clock); 447 clk_disable(musb->clock);
448 448
449 otg_put_transceiver(musb->xceiv);
449 usb_nop_xceiv_unregister(); 450 usb_nop_xceiv_unregister();
450 return -ENODEV; 451 return -ENODEV;
451} 452}
@@ -496,6 +497,7 @@ int musb_platform_exit(struct musb *musb)
496 497
497 clk_disable(musb->clock); 498 clk_disable(musb->clock);
498 499
500 otg_put_transceiver(musb->xceiv);
499 usb_nop_xceiv_unregister(); 501 usb_nop_xceiv_unregister();
500 502
501 return 0; 503 return 0;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 540c766c4f86..0707b296cce4 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1921,10 +1921,6 @@ static void musb_free(struct musb *musb)
1921 dma_controller_destroy(c); 1921 dma_controller_destroy(c);
1922 } 1922 }
1923 1923
1924#ifdef CONFIG_USB_MUSB_OTG
1925 put_device(musb->xceiv->dev);
1926#endif
1927
1928#ifdef CONFIG_USB_MUSB_HDRC_HCD 1924#ifdef CONFIG_USB_MUSB_HDRC_HCD
1929 usb_put_hcd(musb_to_hcd(musb)); 1925 usb_put_hcd(musb_to_hcd(musb));
1930#else 1926#else
@@ -2247,7 +2243,6 @@ static int __exit musb_remove(struct platform_device *pdev)
2247#endif 2243#endif
2248 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); 2244 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2249 musb_platform_exit(musb); 2245 musb_platform_exit(musb);
2250 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2251 2246
2252 musb_free(musb); 2247 musb_free(musb);
2253 iounmap(ctrl_base); 2248 iounmap(ctrl_base);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2111a241dd03..ed618bde1eec 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -320,5 +320,6 @@ int musb_platform_exit(struct musb *musb)
320 320
321 musb_platform_suspend(musb); 321 musb_platform_suspend(musb);
322 322
323 otg_put_transceiver(musb->xceiv);
323 return 0; 324 return 0;
324} 325}
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 3c48e77a0aa2..bde40efc7046 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1152,6 +1152,8 @@ done:
1152 if (ret < 0) { 1152 if (ret < 0) {
1153 if (sync) 1153 if (sync)
1154 iounmap(sync); 1154 iounmap(sync);
1155
1156 otg_put_transceiver(musb->xceiv);
1155 usb_nop_xceiv_unregister(); 1157 usb_nop_xceiv_unregister();
1156 } 1158 }
1157 return ret; 1159 return ret;
@@ -1166,6 +1168,8 @@ int musb_platform_exit(struct musb *musb)
1166 musb->board_set_power(0); 1168 musb->board_set_power(0);
1167 1169
1168 iounmap(musb->sync_va); 1170 iounmap(musb->sync_va);
1171
1172 otg_put_transceiver(musb->xceiv);
1169 usb_nop_xceiv_unregister(); 1173 usb_nop_xceiv_unregister();
1170 return 0; 1174 return 0;
1171} 1175}
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 63f7cc45bcac..7b8815ddf368 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb)
486 if (actual_length >= 4) { 486 if (actual_length >= 4) {
487 struct ch341_private *priv = usb_get_serial_port_data(port); 487 struct ch341_private *priv = usb_get_serial_port_data(port);
488 unsigned long flags; 488 unsigned long flags;
489 u8 prev_line_status = priv->line_status;
489 490
490 spin_lock_irqsave(&priv->lock, flags); 491 spin_lock_irqsave(&priv->lock, flags);
491 priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; 492 priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT;
492 if ((data[1] & CH341_MULT_STAT)) 493 if ((data[1] & CH341_MULT_STAT))
493 priv->multi_status_change = 1; 494 priv->multi_status_change = 1;
494 spin_unlock_irqrestore(&priv->lock, flags); 495 spin_unlock_irqrestore(&priv->lock, flags);
496
497 if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) {
498 struct tty_struct *tty = tty_port_tty_get(&port->port);
499 if (tty)
500 usb_serial_handle_dcd_change(port, tty,
501 priv->line_status & CH341_BIT_DCD);
502 tty_kref_put(tty);
503 }
504
495 wake_up_interruptible(&priv->delta_msr_wait); 505 wake_up_interruptible(&priv->delta_msr_wait);
496 } 506 }
497 507
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4f1744c5871f..735ea03157ab 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -49,11 +49,11 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
49static void cp210x_break_ctl(struct tty_struct *, int); 49static void cp210x_break_ctl(struct tty_struct *, int);
50static int cp210x_startup(struct usb_serial *); 50static int cp210x_startup(struct usb_serial *);
51static void cp210x_dtr_rts(struct usb_serial_port *p, int on); 51static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
52static int cp210x_carrier_raised(struct usb_serial_port *p);
53 52
54static int debug; 53static int debug;
55 54
56static const struct usb_device_id id_table[] = { 55static const struct usb_device_id id_table[] = {
56 { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */
57 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ 57 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
58 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 58 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
59 { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 59 { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
@@ -86,7 +86,6 @@ static const struct usb_device_id id_table[] = {
86 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ 86 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
87 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 87 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
88 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ 88 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
89 { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */
90 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 89 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
91 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 90 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
92 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ 91 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
@@ -109,7 +108,9 @@ static const struct usb_device_id id_table[] = {
109 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ 108 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
110 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ 109 { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
111 { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ 110 { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */
111 { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */
112 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ 112 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
113 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
113 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ 114 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
114 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ 115 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
115 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 116 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
@@ -132,6 +133,7 @@ static const struct usb_device_id id_table[] = {
132 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ 133 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
133 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ 134 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
134 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 135 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
136 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
135 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 137 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
136 { } /* Terminating Entry */ 138 { } /* Terminating Entry */
137}; 139};
@@ -163,8 +165,7 @@ static struct usb_serial_driver cp210x_device = {
163 .tiocmget = cp210x_tiocmget, 165 .tiocmget = cp210x_tiocmget,
164 .tiocmset = cp210x_tiocmset, 166 .tiocmset = cp210x_tiocmset,
165 .attach = cp210x_startup, 167 .attach = cp210x_startup,
166 .dtr_rts = cp210x_dtr_rts, 168 .dtr_rts = cp210x_dtr_rts
167 .carrier_raised = cp210x_carrier_raised
168}; 169};
169 170
170/* Config request types */ 171/* Config request types */
@@ -763,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
763 return result; 764 return result;
764} 765}
765 766
766static int cp210x_carrier_raised(struct usb_serial_port *p)
767{
768 unsigned int control;
769 cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
770 if (control & CONTROL_DCD)
771 return 1;
772 return 0;
773}
774
775static void cp210x_break_ctl (struct tty_struct *tty, int break_state) 767static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
776{ 768{
777 struct usb_serial_port *port = tty->driver_data; 769 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index b92070c103cd..666e5a6edd82 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty);
455static int digi_chars_in_buffer(struct tty_struct *tty); 455static int digi_chars_in_buffer(struct tty_struct *tty);
456static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); 456static int digi_open(struct tty_struct *tty, struct usb_serial_port *port);
457static void digi_close(struct usb_serial_port *port); 457static void digi_close(struct usb_serial_port *port);
458static int digi_carrier_raised(struct usb_serial_port *port);
459static void digi_dtr_rts(struct usb_serial_port *port, int on); 458static void digi_dtr_rts(struct usb_serial_port *port, int on);
460static int digi_startup_device(struct usb_serial *serial); 459static int digi_startup_device(struct usb_serial *serial);
461static int digi_startup(struct usb_serial *serial); 460static int digi_startup(struct usb_serial *serial);
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = {
511 .open = digi_open, 510 .open = digi_open,
512 .close = digi_close, 511 .close = digi_close,
513 .dtr_rts = digi_dtr_rts, 512 .dtr_rts = digi_dtr_rts,
514 .carrier_raised = digi_carrier_raised,
515 .write = digi_write, 513 .write = digi_write,
516 .write_room = digi_write_room, 514 .write_room = digi_write_room,
517 .write_bulk_callback = digi_write_bulk_callback, 515 .write_bulk_callback = digi_write_bulk_callback,
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on)
1339 digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); 1337 digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1);
1340} 1338}
1341 1339
1342static int digi_carrier_raised(struct usb_serial_port *port)
1343{
1344 struct digi_port *priv = usb_get_serial_port_data(port);
1345 if (priv->dp_modem_signals & TIOCM_CD)
1346 return 1;
1347 return 0;
1348}
1349
1350static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) 1340static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
1351{ 1341{
1352 int ret; 1342 int ret;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 97cc87d654ce..88bef0276876 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -99,6 +99,7 @@ struct ftdi_sio_quirk {
99static int ftdi_jtag_probe(struct usb_serial *serial); 99static int ftdi_jtag_probe(struct usb_serial *serial);
100static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); 100static int ftdi_mtxorb_hack_setup(struct usb_serial *serial);
101static int ftdi_NDI_device_setup(struct usb_serial *serial); 101static int ftdi_NDI_device_setup(struct usb_serial *serial);
102static int ftdi_stmclite_probe(struct usb_serial *serial);
102static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); 103static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
103static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); 104static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
104 105
@@ -122,6 +123,10 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
122 .port_probe = ftdi_HE_TIRA1_setup, 123 .port_probe = ftdi_HE_TIRA1_setup,
123}; 124};
124 125
126static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
127 .probe = ftdi_stmclite_probe,
128};
129
125/* 130/*
126 * The 8U232AM has the same API as the sio except for: 131 * The 8U232AM has the same API as the sio except for:
127 * - it can support MUCH higher baudrates; up to: 132 * - it can support MUCH higher baudrates; up to:
@@ -177,6 +182,7 @@ static struct usb_device_id id_table_combined [] = {
177 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, 182 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) },
178 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, 183 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
179 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, 184 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
185 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
180 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 186 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
181 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 187 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
182 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 188 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
@@ -200,6 +206,7 @@ static struct usb_device_id id_table_combined [] = {
200 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 206 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
201 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 207 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
202 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, 208 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) },
209 { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) },
203 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, 210 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) },
204 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, 211 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) },
205 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, 212 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) },
@@ -613,6 +620,7 @@ static struct usb_device_id id_table_combined [] = {
613 { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, 620 { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) },
614 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, 621 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
615 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 622 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
623 { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) },
616 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, 624 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
617 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 625 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
618 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 626 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
@@ -673,8 +681,17 @@ static struct usb_device_id id_table_combined [] = {
673 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 681 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
674 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, 682 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
675 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 683 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
676 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, 684 { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
677 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, 685 { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
686 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
687 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) },
688 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) },
689 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) },
690 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) },
691 { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) },
692 { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) },
693 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) },
694 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) },
678 { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, 695 { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
679 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, 696 { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
680 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, 697 { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
@@ -696,6 +713,7 @@ static struct usb_device_id id_table_combined [] = {
696 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 713 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
697 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 714 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
698 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, 715 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
716 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
699 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 717 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
700 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 718 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
701 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 719 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
@@ -715,8 +733,37 @@ static struct usb_device_id id_table_combined [] = {
715 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 733 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
716 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 734 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
717 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 735 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
736
737 /* Papouch devices based on FTDI chip */
738 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) },
739 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) },
740 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) },
741 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) },
742 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) },
743 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) },
744 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) },
745 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) },
746 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) },
747 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) },
748 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
749 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) },
750 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) },
751 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) },
718 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, 752 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
753 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) },
754 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) },
755 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) },
756 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) },
757 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) },
758 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) },
759 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) },
760 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) },
761 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) },
762 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) },
719 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, 763 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) },
764 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) },
765 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) },
766
720 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, 767 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
721 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, 768 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
722 { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, 769 { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
@@ -751,6 +798,7 @@ static struct usb_device_id id_table_combined [] = {
751 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), 798 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
752 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 799 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
753 { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, 800 { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
801 { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) },
754 { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), 802 { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
755 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 803 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
756 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, 804 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) },
@@ -761,6 +809,14 @@ static struct usb_device_id id_table_combined [] = {
761 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, 809 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) },
762 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, 810 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) },
763 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, 811 { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) },
812 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
813 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
814 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
815 { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
816 { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
817 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
818 { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
819 .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
764 { }, /* Optional parameter entry */ 820 { }, /* Optional parameter entry */
765 { } /* Terminating entry */ 821 { } /* Terminating entry */
766}; 822};
@@ -1642,6 +1698,25 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
1642} 1698}
1643 1699
1644/* 1700/*
1701 * First and second port on STMCLiteadaptors is reserved for JTAG interface
1702 * and the forth port for pio
1703 */
1704static int ftdi_stmclite_probe(struct usb_serial *serial)
1705{
1706 struct usb_device *udev = serial->dev;
1707 struct usb_interface *interface = serial->interface;
1708
1709 dbg("%s", __func__);
1710
1711 if (interface == udev->actconfig->interface[2])
1712 return 0;
1713
1714 dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
1715
1716 return -ENODEV;
1717}
1718
1719/*
1645 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. 1720 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
1646 * We have to correct it if we want to read from it. 1721 * We have to correct it if we want to read from it.
1647 */ 1722 */
@@ -2028,8 +2103,6 @@ static void ftdi_set_termios(struct tty_struct *tty,
2028 "urb failed to set to rts/cts flow control\n"); 2103 "urb failed to set to rts/cts flow control\n");
2029 } 2104 }
2030 2105
2031 /* raise DTR/RTS */
2032 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2033 } else { 2106 } else {
2034 /* 2107 /*
2035 * Xon/Xoff code 2108 * Xon/Xoff code
@@ -2077,8 +2150,6 @@ static void ftdi_set_termios(struct tty_struct *tty,
2077 } 2150 }
2078 } 2151 }
2079 2152
2080 /* lower DTR/RTS */
2081 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2082 } 2153 }
2083 return; 2154 return;
2084} 2155}
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 15a4583775ad..3523df534a27 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -61,6 +61,7 @@
61#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9 61#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9
62#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA 62#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
63#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB 63#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
64#define FTDI_OPENDCC_GBM_PID 0xBFDC
64 65
65/* 66/*
66 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) 67 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
@@ -113,6 +114,9 @@
113/* Lenz LI-USB Computer Interface. */ 114/* Lenz LI-USB Computer Interface. */
114#define FTDI_LENZ_LIUSB_PID 0xD780 115#define FTDI_LENZ_LIUSB_PID 0xD780
115 116
117/* Vardaan Enterprises Serial Interface VEUSB422R3 */
118#define FTDI_VARDAAN_PID 0xF070
119
116/* 120/*
117 * Xsens Technologies BV products (http://www.xsens.com). 121 * Xsens Technologies BV products (http://www.xsens.com).
118 */ 122 */
@@ -514,6 +518,12 @@
514#define RATOC_PRODUCT_ID_USB60F 0xb020 518#define RATOC_PRODUCT_ID_USB60F 0xb020
515 519
516/* 520/*
521 * Acton Research Corp.
522 */
523#define ACTON_VID 0x0647 /* Vendor ID */
524#define ACTON_SPECTRAPRO_PID 0x0100
525
526/*
517 * Contec products (http://www.contec.com) 527 * Contec products (http://www.contec.com)
518 * Submitted by Daniel Sangorrin 528 * Submitted by Daniel Sangorrin
519 */ 529 */
@@ -565,11 +575,23 @@
565#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ 575#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
566 576
567/* 577/*
568 * Icom ID-1 digital transceiver 578 * Definitions for Icom Inc. devices
569 */ 579 */
570 580#define ICOM_VID 0x0C26 /* Icom vendor ID */
571#define ICOM_ID1_VID 0x0C26 581/* Note: ID-1 is a communications tranceiver for HAM-radio operators */
572#define ICOM_ID1_PID 0x0004 582#define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */
583/* Note: OPC is an Optional cable to connect an Icom Tranceiver */
584#define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */
585/* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */
586#define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */
587#define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */
588#define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/
589#define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */
590#define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */
591#define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */
592#define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */
593#define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */
594#define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */
573 595
574/* 596/*
575 * GN Otometrics (http://www.otometrics.com) 597 * GN Otometrics (http://www.otometrics.com)
@@ -720,6 +742,7 @@
720 */ 742 */
721#define RTSYSTEMS_VID 0x2100 /* Vendor ID */ 743#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
722#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ 744#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
745#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
723 746
724/* 747/*
725 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 748 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
@@ -1017,14 +1040,45 @@
1017#define WHT_PID 0x0004 /* Wireless Handheld Terminal */ 1040#define WHT_PID 0x0004 /* Wireless Handheld Terminal */
1018 1041
1019/* 1042/*
1043 * STMicroelectonics
1044 */
1045#define ST_VID 0x0483
1046#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */
1047
1048/*
1020 * Papouch products (http://www.papouch.com/) 1049 * Papouch products (http://www.papouch.com/)
1021 * Submitted by Folkert van Heusden 1050 * Submitted by Folkert van Heusden
1022 */ 1051 */
1023 1052
1024#define PAPOUCH_VID 0x5050 /* Vendor ID */ 1053#define PAPOUCH_VID 0x5050 /* Vendor ID */
1054#define PAPOUCH_SB485_PID 0x0100 /* Papouch SB485 USB-485/422 Converter */
1055#define PAPOUCH_AP485_PID 0x0101 /* AP485 USB-RS485 Converter */
1056#define PAPOUCH_SB422_PID 0x0102 /* Papouch SB422 USB-RS422 Converter */
1057#define PAPOUCH_SB485_2_PID 0x0103 /* Papouch SB485 USB-485/422 Converter */
1058#define PAPOUCH_AP485_2_PID 0x0104 /* AP485 USB-RS485 Converter */
1059#define PAPOUCH_SB422_2_PID 0x0105 /* Papouch SB422 USB-RS422 Converter */
1060#define PAPOUCH_SB485S_PID 0x0106 /* Papouch SB485S USB-485/422 Converter */
1061#define PAPOUCH_SB485C_PID 0x0107 /* Papouch SB485C USB-485/422 Converter */
1062#define PAPOUCH_LEC_PID 0x0300 /* LEC USB Converter */
1063#define PAPOUCH_SB232_PID 0x0301 /* Papouch SB232 USB-RS232 Converter */
1025#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ 1064#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
1026#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */ 1065#define PAPOUCH_IRAMP_PID 0x0500 /* Papouch IRAmp Duplex */
1066#define PAPOUCH_DRAK5_PID 0x0700 /* Papouch DRAK5 */
1067#define PAPOUCH_QUIDO8x8_PID 0x0800 /* Papouch Quido 8/8 Module */
1068#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Papouch Quido 4/4 Module */
1069#define PAPOUCH_QUIDO2x2_PID 0x0a00 /* Papouch Quido 2/2 Module */
1070#define PAPOUCH_QUIDO10x1_PID 0x0b00 /* Papouch Quido 10/1 Module */
1071#define PAPOUCH_QUIDO30x3_PID 0x0c00 /* Papouch Quido 30/3 Module */
1072#define PAPOUCH_QUIDO60x3_PID 0x0d00 /* Papouch Quido 60(100)/3 Module */
1073#define PAPOUCH_QUIDO2x16_PID 0x0e00 /* Papouch Quido 2/16 Module */
1074#define PAPOUCH_QUIDO3x32_PID 0x0f00 /* Papouch Quido 3/32 Module */
1075#define PAPOUCH_DRAK6_PID 0x1000 /* Papouch DRAK6 */
1076#define PAPOUCH_UPSUSB_PID 0x8000 /* Papouch UPS-USB adapter */
1077#define PAPOUCH_MU_PID 0x8001 /* MU controller */
1078#define PAPOUCH_SIMUKEY_PID 0x8002 /* Papouch SimuKey */
1027#define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */ 1079#define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */
1080#define PAPOUCH_GMUX_PID 0x8004 /* Papouch GOLIATH MUX */
1081#define PAPOUCH_GMSR_PID 0x8005 /* Papouch GOLIATH MSR */
1028 1082
1029/* 1083/*
1030 * Marvell SheevaPlug 1084 * Marvell SheevaPlug
@@ -1051,6 +1105,11 @@
1051#define MJSG_HD_RADIO_PID 0x937C 1105#define MJSG_HD_RADIO_PID 0x937C
1052 1106
1053/* 1107/*
1108 * D.O.Tec products (http://www.directout.eu)
1109 */
1110#define FTDI_DOTEC_PID 0x9868
1111
1112/*
1054 * Xverve Signalyzer tools (http://www.signalyzer.com/) 1113 * Xverve Signalyzer tools (http://www.signalyzer.com/)
1055 */ 1114 */
1056#define XVERVE_SIGNALYZER_ST_PID 0xBCA0 1115#define XVERVE_SIGNALYZER_ST_PID 0xBCA0
@@ -1063,3 +1122,21 @@
1063 * Submitted by John G. Rogers 1122 * Submitted by John G. Rogers
1064 */ 1123 */
1065#define SEGWAY_RMP200_PID 0xe729 1124#define SEGWAY_RMP200_PID 0xe729
1125
1126
1127/*
1128 * Accesio USB Data Acquisition products (http://www.accesio.com/)
1129 */
1130#define ACCESIO_COM4SM_PID 0xD578
1131
1132/* www.sciencescope.co.uk educational dataloggers */
1133#define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18
1134#define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C
1135#define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D
1136
1137/*
1138 * Milkymist One JTAG/Serial
1139 */
1140#define QIHARDWARE_VID 0x20B7
1141#define MILKYMISTONE_JTAGSERIAL_PID 0x0713
1142
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index e6833e216fc9..e4db5ad2bc55 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port)
479} 479}
480EXPORT_SYMBOL_GPL(usb_serial_handle_break); 480EXPORT_SYMBOL_GPL(usb_serial_handle_break);
481 481
482/**
483 * usb_serial_handle_dcd_change - handle a change of carrier detect state
484 * @port: usb_serial_port structure for the open port
485 * @tty: tty_struct structure for the port
486 * @status: new carrier detect status, nonzero if active
487 */
488void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
489 struct tty_struct *tty, unsigned int status)
490{
491 struct tty_port *port = &usb_port->port;
492
493 dbg("%s - port %d, status %d", __func__, usb_port->number, status);
494
495 if (status)
496 wake_up_interruptible(&port->open_wait);
497 else if (tty && !C_CLOCAL(tty))
498 tty_hangup(tty);
499}
500EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change);
501
482int usb_serial_generic_resume(struct usb_serial *serial) 502int usb_serial_generic_resume(struct usb_serial *serial)
483{ 503{
484 struct usb_serial_port *port; 504 struct usb_serial_port *port;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 76e6fb3aab7a..db0e3fe4acf5 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2894,8 +2894,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2894 2894
2895 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); 2895 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build);
2896 2896
2897 edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; 2897 edge_serial->product_info.FirmwareMajorVersion = rec->data[0];
2898 edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; 2898 edge_serial->product_info.FirmwareMinorVersion = rec->data[1];
2899 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); 2899 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build);
2900 2900
2901 for (rec = ihex_next_binrec(rec); rec; 2901 for (rec = ihex_next_binrec(rec); rec;
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index feb56a4ca799..1021a2c1c927 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -196,6 +196,7 @@ static struct usb_serial_driver epic_device = {
196 .name = "epic", 196 .name = "epic",
197 }, 197 },
198 .description = "EPiC device", 198 .description = "EPiC device",
199 .usb_driver = &io_driver,
199 .id_table = Epic_port_id_table, 200 .id_table = Epic_port_id_table,
200 .num_ports = 1, 201 .num_ports = 1,
201 .open = edge_open, 202 .open = edge_open,
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index efc72113216b..7d26e3558721 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -1276,6 +1276,7 @@ static struct usb_serial_driver iuu_device = {
1276 .name = "iuu_phoenix", 1276 .name = "iuu_phoenix",
1277 }, 1277 },
1278 .id_table = id_table, 1278 .id_table = id_table,
1279 .usb_driver = &iuu_driver,
1279 .num_ports = 1, 1280 .num_ports = 1,
1280 .bulk_in_size = 512, 1281 .bulk_in_size = 512,
1281 .bulk_out_size = 512, 1282 .bulk_out_size = 512,
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index bf3297ddd186..1ab6ea8c4602 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = {
546 .name = "keyspan_no_firm", 546 .name = "keyspan_no_firm",
547 }, 547 },
548 .description = "Keyspan - (without firmware)", 548 .description = "Keyspan - (without firmware)",
549 .usb_driver = &keyspan_driver,
549 .id_table = keyspan_pre_ids, 550 .id_table = keyspan_pre_ids,
550 .num_ports = 1, 551 .num_ports = 1,
551 .attach = keyspan_fake_startup, 552 .attach = keyspan_fake_startup,
@@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = {
557 .name = "keyspan_1", 558 .name = "keyspan_1",
558 }, 559 },
559 .description = "Keyspan 1 port adapter", 560 .description = "Keyspan 1 port adapter",
561 .usb_driver = &keyspan_driver,
560 .id_table = keyspan_1port_ids, 562 .id_table = keyspan_1port_ids,
561 .num_ports = 1, 563 .num_ports = 1,
562 .open = keyspan_open, 564 .open = keyspan_open,
@@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = {
579 .name = "keyspan_2", 581 .name = "keyspan_2",
580 }, 582 },
581 .description = "Keyspan 2 port adapter", 583 .description = "Keyspan 2 port adapter",
584 .usb_driver = &keyspan_driver,
582 .id_table = keyspan_2port_ids, 585 .id_table = keyspan_2port_ids,
583 .num_ports = 2, 586 .num_ports = 2,
584 .open = keyspan_open, 587 .open = keyspan_open,
@@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = {
601 .name = "keyspan_4", 604 .name = "keyspan_4",
602 }, 605 },
603 .description = "Keyspan 4 port adapter", 606 .description = "Keyspan 4 port adapter",
607 .usb_driver = &keyspan_driver,
604 .id_table = keyspan_4port_ids, 608 .id_table = keyspan_4port_ids,
605 .num_ports = 4, 609 .num_ports = 4,
606 .open = keyspan_open, 610 .open = keyspan_open,
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 185fe9a7d4e0..2cbd661a92f7 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -680,22 +680,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on)
680 } 680 }
681} 681}
682 682
683static int keyspan_pda_carrier_raised(struct usb_serial_port *port)
684{
685 struct usb_serial *serial = port->serial;
686 unsigned char modembits;
687
688 /* If we can read the modem status and the DCD is low then
689 carrier is not raised yet */
690 if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) {
691 if (!(modembits & (1>>6)))
692 return 0;
693 }
694 /* Carrier raised, or we failed (eg disconnected) so
695 progress accordingly */
696 return 1;
697}
698
699 683
700static int keyspan_pda_open(struct tty_struct *tty, 684static int keyspan_pda_open(struct tty_struct *tty,
701 struct usb_serial_port *port) 685 struct usb_serial_port *port)
@@ -882,7 +866,6 @@ static struct usb_serial_driver keyspan_pda_device = {
882 .id_table = id_table_std, 866 .id_table = id_table_std,
883 .num_ports = 1, 867 .num_ports = 1,
884 .dtr_rts = keyspan_pda_dtr_rts, 868 .dtr_rts = keyspan_pda_dtr_rts,
885 .carrier_raised = keyspan_pda_carrier_raised,
886 .open = keyspan_pda_open, 869 .open = keyspan_pda_open,
887 .close = keyspan_pda_close, 870 .close = keyspan_pda_close,
888 .write = keyspan_pda_write, 871 .write = keyspan_pda_write,
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 7aa01b95b1d4..2849f8c32015 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -549,9 +549,12 @@ static void mct_u232_close(struct usb_serial_port *port)
549{ 549{
550 dbg("%s port %d", __func__, port->number); 550 dbg("%s port %d", __func__, port->number);
551 551
552 usb_serial_generic_close(port); 552 if (port->serial->dev) {
553 if (port->serial->dev) 553 /* shutdown our urbs */
554 usb_kill_urb(port->write_urb);
555 usb_kill_urb(port->read_urb);
554 usb_kill_urb(port->interrupt_in_urb); 556 usb_kill_urb(port->interrupt_in_urb);
557 }
555} /* mct_u232_close */ 558} /* mct_u232_close */
556 559
557 560
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c
index cf1718394e18..653465f61d4a 100644
--- a/drivers/usb/serial/moto_modem.c
+++ b/drivers/usb/serial/moto_modem.c
@@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = {
44 .name = "moto-modem", 44 .name = "moto-modem",
45 }, 45 },
46 .id_table = id_table, 46 .id_table = id_table,
47 .usb_driver = &moto_driver,
47 .num_ports = 1, 48 .num_ports = 1,
48}; 49};
49 50
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index ed01f3b2de8c..9ff19c8a122e 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -96,8 +96,8 @@ static void opticon_bulk_callback(struct urb *urb)
96 /* real data, send it to the tty layer */ 96 /* real data, send it to the tty layer */
97 tty = tty_port_tty_get(&port->port); 97 tty = tty_port_tty_get(&port->port);
98 if (tty) { 98 if (tty) {
99 tty_insert_flip_string(tty, data, 99 tty_insert_flip_string(tty, data + 2,
100 data_length); 100 data_length);
101 tty_flip_buffer_push(tty); 101 tty_flip_buffer_push(tty);
102 tty_kref_put(tty); 102 tty_kref_put(tty);
103 } 103 }
@@ -130,7 +130,7 @@ exit:
130 priv->bulk_address), 130 priv->bulk_address),
131 priv->bulk_in_buffer, priv->buffer_size, 131 priv->bulk_in_buffer, priv->buffer_size,
132 opticon_bulk_callback, priv); 132 opticon_bulk_callback, priv);
133 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 133 result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC);
134 if (result) 134 if (result)
135 dev_err(&port->dev, 135 dev_err(&port->dev,
136 "%s - failed resubmitting read urb, error %d\n", 136 "%s - failed resubmitting read urb, error %d\n",
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index c46911af282f..0dbcf124689d 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb);
382#define HAIER_VENDOR_ID 0x201e 382#define HAIER_VENDOR_ID 0x201e
383#define HAIER_PRODUCT_CE100 0x2009 383#define HAIER_PRODUCT_CE100 0x2009
384 384
385#define CINTERION_VENDOR_ID 0x0681 385/* Cinterion (formerly Siemens) products */
386#define SIEMENS_VENDOR_ID 0x0681
387#define CINTERION_VENDOR_ID 0x1e2d
388#define CINTERION_PRODUCT_HC25_MDM 0x0047
389#define CINTERION_PRODUCT_HC25_MDMNET 0x0040
390#define CINTERION_PRODUCT_HC28_MDM 0x004C
391#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */
392#define CINTERION_PRODUCT_EU3_E 0x0051
393#define CINTERION_PRODUCT_EU3_P 0x0052
394#define CINTERION_PRODUCT_PH8 0x0053
386 395
387/* Olivetti products */ 396/* Olivetti products */
388#define OLIVETTI_VENDOR_ID 0x0b3c 397#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -512,7 +521,7 @@ static const struct usb_device_id option_ids[] = {
512 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, 521 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) },
513 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, 522 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) },
514 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, 523 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
515 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, 524 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },
516 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, 525 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
517 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, 526 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
518 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, 527 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
@@ -622,6 +631,7 @@ static const struct usb_device_id option_ids[] = {
622 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, 631 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) },
623 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, 632 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) },
624 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, 633 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
634 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) },
625 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, 635 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
626 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, 636 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
627 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) }, 637 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) },
@@ -633,38 +643,52 @@ static const struct usb_device_id option_ids[] = {
633 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, 643 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) },
634 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, 644 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
635 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, 645 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) },
636 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, 646 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */
637 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, 647 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
638 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, 648 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
639 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, 649 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
640 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) }, 650 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) },
641 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, 651 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) },
642 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, 652 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) },
653 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) },
643 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, 654 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) },
655 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) },
644 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, 656 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) },
657 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) },
645 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, 658 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) },
646 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, 659 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) },
660 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) },
647 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, 661 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) },
648 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, 662 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) },
663 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) },
649 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, 664 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
650 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, 665 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) },
666 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */
651 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, 667 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
652 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, 668 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) },
669 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) },
653 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, 670 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
654 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, 671 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) },
672 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
655 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, 673 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
656 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, 674 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
657 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, 675 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) },
658 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, 676 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) },
677 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) },
659 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, 678 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
679 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) },
660 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, 680 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) },
681 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
661 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, 682 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) },
683 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) },
662 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, 684 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) },
685 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0079, 0xff, 0xff, 0xff) },
663 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) }, 686 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) },
687 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) },
664 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, 688 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
665 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, 689 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) },
666 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
667 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, 690 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) },
691 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
668 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, 692 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
669 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, 693 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
670 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) }, 694 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
@@ -880,6 +904,8 @@ static const struct usb_device_id option_ids[] = {
880 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 904 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, 905 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
882 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, 906 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
907 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
908 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 909 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
884 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 910 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 911 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
@@ -922,7 +948,17 @@ static const struct usb_device_id option_ids[] = {
922 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, 948 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
923 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, 949 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
924 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, 950 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
925 { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, 951 /* Cinterion */
952 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
953 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
954 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
955 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
956 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
957 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
958 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
959 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
960 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
961
926 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, 962 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
927 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ 963 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
928 { } /* Terminating entry */ 964 { } /* Terminating entry */
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index e199b0f4f99c..1c46a863295b 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = {
157 .name = "oti6858", 157 .name = "oti6858",
158 }, 158 },
159 .id_table = id_table, 159 .id_table = id_table,
160 .usb_driver = &oti6858_driver,
160 .num_ports = 1, 161 .num_ports = 1,
161 .open = oti6858_open, 162 .open = oti6858_open,
162 .close = oti6858_close, 163 .close = oti6858_close,
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 8ae4c6cbc38a..08c9181b8e48 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = {
50 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, 50 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
51 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, 51 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
52 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, 52 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
53 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) },
53 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 54 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
54 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 55 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
55 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 56 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
677{ 678{
678 679
679 struct pl2303_private *priv = usb_get_serial_port_data(port); 680 struct pl2303_private *priv = usb_get_serial_port_data(port);
681 struct tty_struct *tty;
680 unsigned long flags; 682 unsigned long flags;
681 u8 status_idx = UART_STATE; 683 u8 status_idx = UART_STATE;
682 u8 length = UART_STATE + 1; 684 u8 length = UART_STATE + 1;
685 u8 prev_line_status;
683 u16 idv, idp; 686 u16 idv, idp;
684 687
685 idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); 688 idv = le16_to_cpu(port->serial->dev->descriptor.idVendor);
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
701 704
702 /* Save off the uart status for others to look at */ 705 /* Save off the uart status for others to look at */
703 spin_lock_irqsave(&priv->lock, flags); 706 spin_lock_irqsave(&priv->lock, flags);
707 prev_line_status = priv->line_status;
704 priv->line_status = data[status_idx]; 708 priv->line_status = data[status_idx];
705 spin_unlock_irqrestore(&priv->lock, flags); 709 spin_unlock_irqrestore(&priv->lock, flags);
706 if (priv->line_status & UART_BREAK_ERROR) 710 if (priv->line_status & UART_BREAK_ERROR)
707 usb_serial_handle_break(port); 711 usb_serial_handle_break(port);
708 wake_up_interruptible(&priv->delta_msr_wait); 712 wake_up_interruptible(&priv->delta_msr_wait);
713
714 tty = tty_port_tty_get(&port->port);
715 if (!tty)
716 return;
717 if ((priv->line_status ^ prev_line_status) & UART_DCD)
718 usb_serial_handle_dcd_change(port, tty,
719 priv->line_status & UART_DCD);
720 tty_kref_put(tty);
709} 721}
710 722
711static void pl2303_read_int_callback(struct urb *urb) 723static void pl2303_read_int_callback(struct urb *urb)
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 43eb9bdad422..1b025f75dafd 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -21,6 +21,7 @@
21#define PL2303_PRODUCT_ID_MMX 0x0612 21#define PL2303_PRODUCT_ID_MMX 0x0612
22#define PL2303_PRODUCT_ID_GPRS 0x0609 22#define PL2303_PRODUCT_ID_GPRS 0x0609
23#define PL2303_PRODUCT_ID_HCR331 0x331a 23#define PL2303_PRODUCT_ID_HCR331 0x331a
24#define PL2303_PRODUCT_ID_MOTOROLA 0x0307
24 25
25#define ATEN_VENDOR_ID 0x0557 26#define ATEN_VENDOR_ID 0x0557
26#define ATEN_VENDOR_ID2 0x0547 27#define ATEN_VENDOR_ID2 0x0547
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index 214a3e504292..30b73e68a904 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -36,6 +36,7 @@
36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712 36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712
37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714 37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714
38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715
39#define PANTECH_PRODUCT_UML290_VZW 0x3718
39 40
40/* CMOTECH devices */ 41/* CMOTECH devices */
41#define CMOTECH_VENDOR_ID 0x16d8 42#define CMOTECH_VENDOR_ID 0x16d8
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = {
66 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, 67 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
67 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, 68 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
68 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, 69 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
70 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) },
69 { }, 71 { },
70}; 72};
71MODULE_DEVICE_TABLE(usb, id_table); 73MODULE_DEVICE_TABLE(usb, id_table);
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = {
84 .name = "qcaux", 86 .name = "qcaux",
85 }, 87 },
86 .id_table = id_table, 88 .id_table = id_table,
89 .usb_driver = &qcaux_driver,
87 .num_ports = 1, 90 .num_ports = 1,
88}; 91};
89 92
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c
index cb8195cabfde..74cd4ccdb3fc 100644
--- a/drivers/usb/serial/siemens_mpi.c
+++ b/drivers/usb/serial/siemens_mpi.c
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = {
42 .name = "siemens_mpi", 42 .name = "siemens_mpi",
43 }, 43 },
44 .id_table = id_table, 44 .id_table = id_table,
45 .usb_driver = &siemens_usb_mpi_driver,
45 .num_ports = 1, 46 .num_ports = 1,
46}; 47};
47 48
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 329d311a35d9..f88bc511da65 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg {
133 133
134/* how come ??? */ 134/* how come ??? */
135#define UART_STATE 0x08 135#define UART_STATE 0x08
136#define UART_STATE_TRANSIENT_MASK 0x74 136#define UART_STATE_TRANSIENT_MASK 0x75
137#define UART_DCD 0x01 137#define UART_DCD 0x01
138#define UART_DSR 0x02 138#define UART_DSR 0x02
139#define UART_BREAK_ERROR 0x04 139#define UART_BREAK_ERROR 0x04
@@ -526,6 +526,10 @@ static void spcp8x5_process_read_urb(struct urb *urb)
526 /* overrun is special, not associated with a char */ 526 /* overrun is special, not associated with a char */
527 if (status & UART_OVERRUN_ERROR) 527 if (status & UART_OVERRUN_ERROR)
528 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 528 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
529
530 if (status & UART_DCD)
531 usb_serial_handle_dcd_change(port, tty,
532 priv->line_status & MSR_STATUS_LINE_DCD);
529 } 533 }
530 534
531 tty_insert_flip_string_fixed_flag(tty, data, tty_flag, 535 tty_insert_flip_string_fixed_flag(tty, data, tty_flag,
@@ -646,6 +650,7 @@ static struct usb_serial_driver spcp8x5_device = {
646 .name = "SPCP8x5", 650 .name = "SPCP8x5",
647 }, 651 },
648 .id_table = id_table, 652 .id_table = id_table,
653 .usb_driver = &spcp8x5_driver,
649 .num_ports = 1, 654 .num_ports = 1,
650 .open = spcp8x5_open, 655 .open = spcp8x5_open,
651 .dtr_rts = spcp8x5_dtr_rts, 656 .dtr_rts = spcp8x5_dtr_rts,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 90979a1f5311..c58ef5434733 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -365,9 +365,9 @@ failed_1port:
365 365
366static void __exit ti_exit(void) 366static void __exit ti_exit(void)
367{ 367{
368 usb_deregister(&ti_usb_driver);
368 usb_serial_deregister(&ti_1port_device); 369 usb_serial_deregister(&ti_1port_device);
369 usb_serial_deregister(&ti_2port_device); 370 usb_serial_deregister(&ti_2port_device);
370 usb_deregister(&ti_usb_driver);
371} 371}
372 372
373 373
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 7a2177c79bde..6afd8e848117 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -52,6 +52,7 @@ static struct usb_driver usb_serial_driver = {
52 .suspend = usb_serial_suspend, 52 .suspend = usb_serial_suspend,
53 .resume = usb_serial_resume, 53 .resume = usb_serial_resume,
54 .no_dynamic_id = 1, 54 .no_dynamic_id = 1,
55 .supports_autosuspend = 1,
55}; 56};
56 57
57/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead 58/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead
@@ -1334,6 +1335,12 @@ int usb_serial_register(struct usb_serial_driver *driver)
1334 1335
1335 if (!driver->description) 1336 if (!driver->description)
1336 driver->description = driver->driver.name; 1337 driver->description = driver->driver.name;
1338 if (!driver->usb_driver) {
1339 WARN(1, "Serial driver %s has no usb_driver\n",
1340 driver->description);
1341 return -EINVAL;
1342 }
1343 driver->usb_driver->supports_autosuspend = 1;
1337 1344
1338 /* Add this device to our list of devices */ 1345 /* Add this device to our list of devices */
1339 mutex_lock(&table_lock); 1346 mutex_lock(&table_lock);
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index f2ed6a31be77..95a82148ee81 100644
--- a/drivers/usb/serial/usb_debug.c
+++ b/drivers/usb/serial/usb_debug.c
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = {
75 .name = "debug", 75 .name = "debug",
76 }, 76 },
77 .id_table = id_table, 77 .id_table = id_table,
78 .usb_driver = &debug_driver,
78 .num_ports = 1, 79 .num_ports = 1,
79 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, 80 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE,
80 .break_ctl = usb_debug_break_ctl, 81 .break_ctl = usb_debug_break_ctl,
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index eb76aaef4268..15a5d89b7f39 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -606,6 +606,10 @@ static int treo_attach(struct usb_serial *serial)
606 606
607static int clie_5_attach(struct usb_serial *serial) 607static int clie_5_attach(struct usb_serial *serial)
608{ 608{
609 struct usb_serial_port *port;
610 unsigned int pipe;
611 int j;
612
609 dbg("%s", __func__); 613 dbg("%s", __func__);
610 614
611 /* TH55 registers 2 ports. 615 /* TH55 registers 2 ports.
@@ -621,9 +625,14 @@ static int clie_5_attach(struct usb_serial *serial)
621 return -1; 625 return -1;
622 626
623 /* port 0 now uses the modified endpoint Address */ 627 /* port 0 now uses the modified endpoint Address */
624 serial->port[0]->bulk_out_endpointAddress = 628 port = serial->port[0];
629 port->bulk_out_endpointAddress =
625 serial->port[1]->bulk_out_endpointAddress; 630 serial->port[1]->bulk_out_endpointAddress;
626 631
632 pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress);
633 for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j)
634 port->write_urbs[j]->pipe = pipe;
635
627 return 0; 636 return 0;
628} 637}
629 638
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c
index 57fc2f532cab..ceba512f84d0 100644
--- a/drivers/usb/storage/sierra_ms.c
+++ b/drivers/usb/storage/sierra_ms.c
@@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr,
121 } 121 }
122 return result; 122 return result;
123} 123}
124static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); 124static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL);
125 125
126int sierra_ms_init(struct us_data *us) 126int sierra_ms_init(struct us_data *us)
127{ 127{
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h
index 44be6d75dab6..fba2824085b4 100644
--- a/drivers/usb/storage/unusual_cypress.h
+++ b/drivers/usb/storage/unusual_cypress.h
@@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
31 "Cypress ISD-300LP", 31 "Cypress ISD-300LP",
32 US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0), 32 US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
33 33
34UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999,
35 "Super Top",
36 "USB 2.0 SATA BRIDGE",
37 US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
38
34#endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ 39#endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 2c897eefadde..b0c0a33910e8 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -481,6 +481,13 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220,
481 US_SC_DEVICE, US_PR_DEVICE, NULL, 481 US_SC_DEVICE, US_PR_DEVICE, NULL,
482 US_FL_MAX_SECTORS_64), 482 US_FL_MAX_SECTORS_64),
483 483
484/* Reported by Vitaly Kuznetsov <vitty@altlinux.ru> */
485UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999,
486 "Samsung",
487 "YP-CP3",
488 US_SC_DEVICE, US_PR_DEVICE, NULL,
489 US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG),
490
484/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. 491/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
485 * Device uses standards-violating 32-byte Bulk Command Block Wrappers and 492 * Device uses standards-violating 32-byte Bulk Command Block Wrappers and
486 * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. 493 * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011.
@@ -1036,6 +1043,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110,
1036 US_SC_DEVICE, US_PR_DEVICE, NULL, 1043 US_SC_DEVICE, US_PR_DEVICE, NULL,
1037 US_FL_BULK32), 1044 US_FL_BULK32),
1038 1045
1046/* Reported by <ttkspam@free.fr>
1047 * The device reports a vendor-specific device class, requiring an
1048 * explicit vendor/product match.
1049 */
1050UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002,
1051 "MagicPixel",
1052 "FW_Omega2",
1053 US_SC_DEVICE, US_PR_DEVICE, NULL, 0),
1054
1039/* Andrew Lunn <andrew@lunn.ch> 1055/* Andrew Lunn <andrew@lunn.ch>
1040 * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL 1056 * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL
1041 * on LUN 4. 1057 * on LUN 4.
@@ -1380,6 +1396,13 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100,
1380 US_SC_DEVICE, US_PR_DEVICE, NULL, 1396 US_SC_DEVICE, US_PR_DEVICE, NULL,
1381 US_FL_IGNORE_RESIDUE ), 1397 US_FL_IGNORE_RESIDUE ),
1382 1398
1399/* Submitted by Nick Holloway */
1400UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100,
1401 "VTech",
1402 "Kidizoom",
1403 US_SC_DEVICE, US_PR_DEVICE, NULL,
1404 US_FL_FIX_CAPACITY ),
1405
1383/* Reported by Michael Stattmann <michael@stattmann.com> */ 1406/* Reported by Michael Stattmann <michael@stattmann.com> */
1384UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, 1407UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1385 "Sony Ericsson", 1408 "Sony Ericsson",
@@ -1859,6 +1882,22 @@ UNUSUAL_DEV( 0x1908, 0x1320, 0x0000, 0x0000,
1859 US_SC_DEVICE, US_PR_DEVICE, NULL, 1882 US_SC_DEVICE, US_PR_DEVICE, NULL,
1860 US_FL_BAD_SENSE ), 1883 US_FL_BAD_SENSE ),
1861 1884
1885/* Patch by Richard Schütz <r.schtz@t-online.de>
1886 * This external hard drive enclosure uses a JMicron chip which
1887 * needs the US_FL_IGNORE_RESIDUE flag to work properly. */
1888UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000,
1889 "TrekStor GmbH & Co. KG",
1890 "DataStation maxi g.u",
1891 US_SC_DEVICE, US_PR_DEVICE, NULL,
1892 US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
1893
1894/* Reported by Jasper Mackenzie <scarletpimpernal@hotmail.com> */
1895UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000,
1896 "Coby Electronics",
1897 "MP3 Player",
1898 US_SC_DEVICE, US_PR_DEVICE, NULL,
1899 US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
1900
1862UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, 1901UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
1863 "ST", 1902 "ST",
1864 "2A", 1903 "2A",
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index 38ffc3fbcbe4..c06c667e9ca9 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -21,7 +21,7 @@
21#define MAX_BRIGHTNESS (0xFF) 21#define MAX_BRIGHTNESS (0xFF)
22#define MIN_BRIGHTNESS (0) 22#define MIN_BRIGHTNESS (0)
23 23
24#define CURRENT_MASK (0x1F << 1) 24#define CURRENT_BITMASK (0x1F << 1)
25 25
26struct pm860x_backlight_data { 26struct pm860x_backlight_data {
27 struct pm860x_chip *chip; 27 struct pm860x_chip *chip;
@@ -85,7 +85,7 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness)
85 if ((data->current_brightness == 0) && brightness) { 85 if ((data->current_brightness == 0) && brightness) {
86 if (data->iset) { 86 if (data->iset) {
87 ret = pm860x_set_bits(data->i2c, wled_idc(data->port), 87 ret = pm860x_set_bits(data->i2c, wled_idc(data->port),
88 CURRENT_MASK, data->iset); 88 CURRENT_BITMASK, data->iset);
89 if (ret < 0) 89 if (ret < 0)
90 goto out; 90 goto out;
91 } 91 }
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index e207810bba3c..08703299ef61 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state)
197{ 197{
198 struct backlight_device *bd = to_backlight_device(dev); 198 struct backlight_device *bd = to_backlight_device(dev);
199 199
200 if (bd->ops->options & BL_CORE_SUSPENDRESUME) { 200 mutex_lock(&bd->ops_lock);
201 mutex_lock(&bd->ops_lock); 201 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
202 bd->props.state |= BL_CORE_SUSPENDED; 202 bd->props.state |= BL_CORE_SUSPENDED;
203 backlight_update_status(bd); 203 backlight_update_status(bd);
204 mutex_unlock(&bd->ops_lock);
205 } 204 }
205 mutex_unlock(&bd->ops_lock);
206 206
207 return 0; 207 return 0;
208} 208}
@@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev)
211{ 211{
212 struct backlight_device *bd = to_backlight_device(dev); 212 struct backlight_device *bd = to_backlight_device(dev);
213 213
214 if (bd->ops->options & BL_CORE_SUSPENDRESUME) { 214 mutex_lock(&bd->ops_lock);
215 mutex_lock(&bd->ops_lock); 215 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
216 bd->props.state &= ~BL_CORE_SUSPENDED; 216 bd->props.state &= ~BL_CORE_SUSPENDED;
217 backlight_update_status(bd); 217 backlight_update_status(bd);
218 mutex_unlock(&bd->ops_lock);
219 } 218 }
219 mutex_unlock(&bd->ops_lock);
220 220
221 return 0; 221 return 0;
222} 222}
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index e44893ea590d..c2f4e6e166f1 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -283,11 +283,12 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
283 writel(tmp, engine + 0x1C); 283 writel(tmp, engine + 0x1C);
284 } 284 }
285 285
286 if (op != VIA_BITBLT_COLOR) 286 if (op == VIA_BITBLT_FILL) {
287 writel(fg_color, engine + 0x58);
288 } else if (op == VIA_BITBLT_MONO) {
287 writel(fg_color, engine + 0x4C); 289 writel(fg_color, engine + 0x4C);
288
289 if (op == VIA_BITBLT_MONO)
290 writel(bg_color, engine + 0x50); 290 writel(bg_color, engine + 0x50);
291 }
291 292
292 if (op == VIA_BITBLT_FILL) 293 if (op == VIA_BITBLT_FILL)
293 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; 294 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001;
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c
index da9e4ca94b17..021112e279de 100644
--- a/drivers/video/via/via_i2c.c
+++ b/drivers/video/via/via_i2c.c
@@ -114,6 +114,7 @@ static void via_i2c_setsda(void *data, int state)
114 114
115int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) 115int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
116{ 116{
117 int ret;
117 u8 mm1[] = {0x00}; 118 u8 mm1[] = {0x00};
118 struct i2c_msg msgs[2]; 119 struct i2c_msg msgs[2];
119 120
@@ -126,11 +127,18 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
126 mm1[0] = index; 127 mm1[0] = index;
127 msgs[0].len = 1; msgs[1].len = 1; 128 msgs[0].len = 1; msgs[1].len = 1;
128 msgs[0].buf = mm1; msgs[1].buf = pdata; 129 msgs[0].buf = mm1; msgs[1].buf = pdata;
129 return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); 130 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2);
131 if (ret == 2)
132 ret = 0;
133 else if (ret >= 0)
134 ret = -EIO;
135
136 return ret;
130} 137}
131 138
132int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) 139int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
133{ 140{
141 int ret;
134 u8 msg[2] = { index, data }; 142 u8 msg[2] = { index, data };
135 struct i2c_msg msgs; 143 struct i2c_msg msgs;
136 144
@@ -140,11 +148,18 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
140 msgs.addr = slave_addr / 2; 148 msgs.addr = slave_addr / 2;
141 msgs.len = 2; 149 msgs.len = 2;
142 msgs.buf = msg; 150 msgs.buf = msg;
143 return i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); 151 ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1);
152 if (ret == 1)
153 ret = 0;
154 else if (ret >= 0)
155 ret = -EIO;
156
157 return ret;
144} 158}
145 159
146int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) 160int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len)
147{ 161{
162 int ret;
148 u8 mm1[] = {0x00}; 163 u8 mm1[] = {0x00};
149 struct i2c_msg msgs[2]; 164 struct i2c_msg msgs[2];
150 165
@@ -156,7 +171,13 @@ int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len
156 mm1[0] = index; 171 mm1[0] = index;
157 msgs[0].len = 1; msgs[1].len = buff_len; 172 msgs[0].len = 1; msgs[1].len = buff_len;
158 msgs[0].buf = mm1; msgs[1].buf = buff; 173 msgs[0].buf = mm1; msgs[1].buf = buff;
159 return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); 174 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2);
175 if (ret == 2)
176 ret = 0;
177 else if (ret >= 0)
178 ret = -EIO;
179
180 return ret;
160} 181}
161 182
162/* 183/*
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index ef8d9d558fc7..4fb5b2bf2348 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -96,11 +96,6 @@ static struct pci_device_id virtio_pci_id_table[] = {
96 96
97MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); 97MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
98 98
99/* A PCI device has it's own struct device and so does a virtio device so
100 * we create a place for the virtio devices to show up in sysfs. I think it
101 * would make more sense for virtio to not insist on having it's own device. */
102static struct device *virtio_pci_root;
103
104/* Convert a generic virtio device to our structure */ 99/* Convert a generic virtio device to our structure */
105static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) 100static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
106{ 101{
@@ -629,7 +624,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
629 if (vp_dev == NULL) 624 if (vp_dev == NULL)
630 return -ENOMEM; 625 return -ENOMEM;
631 626
632 vp_dev->vdev.dev.parent = virtio_pci_root; 627 vp_dev->vdev.dev.parent = &pci_dev->dev;
633 vp_dev->vdev.dev.release = virtio_pci_release_dev; 628 vp_dev->vdev.dev.release = virtio_pci_release_dev;
634 vp_dev->vdev.config = &virtio_pci_config_ops; 629 vp_dev->vdev.config = &virtio_pci_config_ops;
635 vp_dev->pci_dev = pci_dev; 630 vp_dev->pci_dev = pci_dev;
@@ -717,17 +712,7 @@ static struct pci_driver virtio_pci_driver = {
717 712
718static int __init virtio_pci_init(void) 713static int __init virtio_pci_init(void)
719{ 714{
720 int err; 715 return pci_register_driver(&virtio_pci_driver);
721
722 virtio_pci_root = root_device_register("virtio-pci");
723 if (IS_ERR(virtio_pci_root))
724 return PTR_ERR(virtio_pci_root);
725
726 err = pci_register_driver(&virtio_pci_driver);
727 if (err)
728 root_device_unregister(virtio_pci_root);
729
730 return err;
731} 716}
732 717
733module_init(virtio_pci_init); 718module_init(virtio_pci_init);
@@ -735,7 +720,6 @@ module_init(virtio_pci_init);
735static void __exit virtio_pci_exit(void) 720static void __exit virtio_pci_exit(void)
736{ 721{
737 pci_unregister_driver(&virtio_pci_driver); 722 pci_unregister_driver(&virtio_pci_driver);
738 root_device_unregister(virtio_pci_root);
739} 723}
740 724
741module_exit(virtio_pci_exit); 725module_exit(virtio_pci_exit);
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 428f8a1583e8..3939e53f5f98 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
231 struct resource *r; 231 struct resource *r;
232 struct rdc321x_wdt_pdata *pdata; 232 struct rdc321x_wdt_pdata *pdata;
233 233
234 pdata = pdev->dev.platform_data; 234 pdata = platform_get_drvdata(pdev);
235 if (!pdata) { 235 if (!pdata) {
236 dev_err(&pdev->dev, "no platform data supplied\n"); 236 dev_err(&pdev->dev, "no platform data supplied\n");
237 return -ENODEV; 237 return -ENODEV;
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 13365ba35218..a68cc62574ed 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -261,7 +261,7 @@ static void init_evtchn_cpu_bindings(void)
261 } 261 }
262#endif 262#endif
263 263
264 memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); 264 memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s));
265} 265}
266 266
267static inline void clear_evtchn(int port) 267static inline void clear_evtchn(int port)