aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/acpi/acpi_pad.c2
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/hest.c4
-rw-r--r--drivers/acpi/power_meter.c2
-rw-r--r--drivers/acpi/sbshc.c2
-rw-r--r--drivers/acpi/sleep.c56
-rw-r--r--drivers/ata/libata-eh.c5
-rw-r--r--drivers/ata/pata_pcmcia.c4
-rw-r--r--drivers/block/drbd/drbd_main.c1
-rw-r--r--drivers/block/drbd/drbd_receiver.c3
-rw-r--r--drivers/block/drbd/drbd_worker.c2
-rw-r--r--drivers/block/pktcdvd.c17
-rw-r--r--drivers/char/isicom.c9
-rw-r--r--drivers/char/istallion.c2
-rw-r--r--drivers/char/mxser.c3
-rw-r--r--drivers/char/riscom8.c1
-rw-r--r--drivers/char/stallion.c7
-rw-r--r--drivers/cpufreq/cpufreq.c19
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c8
-rw-r--r--drivers/cpuidle/governors/menu.c9
-rw-r--r--drivers/dma/shdma.c27
-rw-r--r--drivers/dma/txx9dmac.c2
-rw-r--r--drivers/edac/edac_mce_amd.c5
-rw-r--r--drivers/firewire/core-iso.c14
-rw-r--r--drivers/firewire/ohci.c23
-rw-r--r--drivers/gpio/gpiolib.c3
-rw-r--r--drivers/gpio/it8761e_gpio.c18
-rw-r--r--drivers/gpio/pca953x.c14
-rw-r--r--drivers/gpio/pl061.c14
-rw-r--r--drivers/gpu/drm/drm_irq.c1
-rw-r--r--drivers/gpu/drm/drm_memory.c2
-rw-r--r--drivers/gpu/drm/drm_sysfs.c21
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c14
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c5
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h10
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c151
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c22
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c16
-rw-r--r--drivers/gpu/drm/i915/i915_opregion.c54
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h13
-rw-r--r--drivers/gpu/drm/i915/intel_display.c11
-rw-r--r--drivers/gpu/drm/radeon/atombios.h2
-rw-r--r--drivers/gpu/drm/radeon/r100.c2
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h2
-rw-r--r--drivers/gpu/drm/radeon/r300.c7
-rw-r--r--drivers/gpu/drm/radeon/r300_cmdbuf.c2
-rw-r--r--drivers/gpu/drm/radeon/r420.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_agp.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c63
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_state.c19
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c30
-rw-r--r--drivers/gpu/drm/ttm/ttm_lock.c5
-rw-r--r--drivers/gpu/drm/via/via_video.c2
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
-rw-r--r--drivers/hid/hid-cherry.c1
-rw-r--r--drivers/hid/hid-core.c10
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-ntrig.c72
-rw-r--r--drivers/hid/hid-sony.c2
-rw-r--r--drivers/hid/hid-wacom.c1
-rw-r--r--drivers/hid/usbhid/hid-core.c13
-rw-r--r--drivers/hwmon/applesmc.c61
-rw-r--r--drivers/hwmon/asc7621.c63
-rw-r--r--drivers/hwmon/asus_atk0110.c4
-rw-r--r--drivers/hwmon/hp_accel.c6
-rw-r--r--drivers/i2c/busses/i2c-imx.c6
-rw-r--r--drivers/i2c/busses/i2c-octeon.c4
-rw-r--r--drivers/i2c/busses/i2c-omap.c10
-rw-r--r--drivers/i2c/busses/i2c-pnx.c8
-rw-r--r--drivers/i2c/busses/i2c-stu300.c2
-rw-r--r--drivers/i2c/i2c-core.c63
-rw-r--r--drivers/ide/ide-cs.c4
-rw-r--r--drivers/input/joydev.c18
-rw-r--r--drivers/input/misc/ati_remote.c14
-rw-r--r--drivers/input/mouse/alps.c1
-rw-r--r--drivers/input/mouse/elantech.c84
-rw-r--r--drivers/input/mouse/psmouse-base.c18
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/input/mouse/synaptics.c35
-rw-r--r--drivers/input/mouse/synaptics.h4
-rw-r--r--drivers/input/touchscreen/eeti_ts.c56
-rw-r--r--drivers/md/md.c10
-rw-r--r--drivers/md/raid5.c54
-rw-r--r--drivers/media/common/saa7146_fops.c11
-rw-r--r--drivers/media/common/saa7146_video.c8
-rw-r--r--drivers/media/dvb/frontends/stv090x.c4
-rw-r--r--drivers/media/dvb/ttpci/budget.c3
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c38
-rw-r--r--drivers/media/video/gspca/sn9c20x.c2
-rw-r--r--drivers/media/video/gspca/spca508.c1
-rw-r--r--drivers/media/video/gspca/spca561.c1
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c2
-rw-r--r--drivers/media/video/hexium_gemini.c3
-rw-r--r--drivers/media/video/hexium_orion.c4
-rw-r--r--drivers/media/video/mx1_camera.c8
-rw-r--r--drivers/media/video/mxb.c17
-rw-r--r--drivers/media/video/omap24xxcam.c2
-rw-r--r--drivers/media/video/pxa_camera.c11
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c2
-rw-r--r--drivers/misc/Kconfig16
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/vmware_balloon.c832
-rw-r--r--drivers/mmc/host/atmel-mci.c18
-rw-r--r--drivers/mtd/Makefile2
-rw-r--r--drivers/mtd/internal.h17
-rw-r--r--drivers/mtd/mtdbdi.c43
-rw-r--r--drivers/mtd/mtdcore.c79
-rw-r--r--drivers/mtd/mtdsuper.c2
-rw-r--r--drivers/mtd/nand/orion_nand.c8
-rw-r--r--drivers/net/3c501.c2
-rw-r--r--drivers/net/3c503.c2
-rw-r--r--drivers/net/3c505.c7
-rw-r--r--drivers/net/3c507.c4
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/3c515.c6
-rw-r--r--drivers/net/3c523.c3
-rw-r--r--drivers/net/3c59x.c7
-rw-r--r--drivers/net/7990.c6
-rw-r--r--drivers/net/8139cp.c3
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/82596.c3
-rw-r--r--drivers/net/a2065.c4
-rw-r--r--drivers/net/ac3200.c2
-rw-r--r--drivers/net/acenic.c2
-rw-r--r--drivers/net/amd8111e.c2
-rw-r--r--drivers/net/apne.c1
-rw-r--r--drivers/net/appletalk/cops.c9
-rw-r--r--drivers/net/appletalk/ltpc.c1
-rw-r--r--drivers/net/arcnet/arcnet.c1
-rw-r--r--drivers/net/ariadne.c2
-rw-r--r--drivers/net/arm/am79c961a.c1
-rw-r--r--drivers/net/arm/at91_ether.c1
-rw-r--r--drivers/net/arm/ep93xx_eth.c12
-rw-r--r--drivers/net/arm/ether1.c1
-rw-r--r--drivers/net/arm/ether3.c1
-rw-r--r--drivers/net/arm/ixp4xx_eth.c1
-rw-r--r--drivers/net/arm/ks8695net.c2
-rw-r--r--drivers/net/arm/w90p910_ether.c6
-rw-r--r--drivers/net/at1700.c5
-rw-r--r--drivers/net/atarilance.c5
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c2
-rw-r--r--drivers/net/atl1c/atl1c_main.c2
-rw-r--r--drivers/net/atl1e/atl1e_ethtool.c2
-rw-r--r--drivers/net/atl1e/atl1e_main.c7
-rw-r--r--drivers/net/atlx/atl1.c3
-rw-r--r--drivers/net/atlx/atl2.c1
-rw-r--r--drivers/net/atp.c4
-rw-r--r--drivers/net/au1000_eth.c3
-rw-r--r--drivers/net/ax88796.c1
-rw-r--r--drivers/net/b44.c2
-rw-r--r--drivers/net/bcm63xx_enet.c1
-rw-r--r--drivers/net/benet/be_ethtool.c3
-rw-r--r--drivers/net/benet/be_main.c12
-rw-r--r--drivers/net/bfin_mac.c5
-rw-r--r--drivers/net/bmac.c3
-rw-r--r--drivers/net/can/at91_can.c1
-rw-r--r--drivers/net/can/bfin_can.c2
-rw-r--r--drivers/net/can/mcp251x.c1
-rw-r--r--drivers/net/can/sja1000/sja1000.c2
-rw-r--r--drivers/net/can/usb/ems_usb.c4
-rw-r--r--drivers/net/cassini.c1
-rw-r--r--drivers/net/cnic.c3
-rw-r--r--drivers/net/cpmac.c1
-rw-r--r--drivers/net/cris/eth_v10.c2
-rw-r--r--drivers/net/cs89x0.c3
-rw-r--r--drivers/net/cxgb3/l2t.c1
-rw-r--r--drivers/net/cxgb4/cxgb4.h4
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c25
-rw-r--r--drivers/net/cxgb4/t4_hw.c31
-rw-r--r--drivers/net/cxgb4/t4fw_api.h4
-rw-r--r--drivers/net/davinci_emac.c1
-rw-r--r--drivers/net/de600.c4
-rw-r--r--drivers/net/de620.c1
-rw-r--r--drivers/net/declance.c4
-rw-r--r--drivers/net/depca.c9
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/dm9000.c6
-rw-r--r--drivers/net/dnet.c2
-rw-r--r--drivers/net/e100.c1
-rw-r--r--drivers/net/e1000/e1000_ethtool.c4
-rw-r--r--drivers/net/e1000/e1000_main.c51
-rw-r--r--drivers/net/e1000/e1000_param.c8
-rw-r--r--drivers/net/e1000e/82571.c23
-rw-r--r--drivers/net/e1000e/defines.h7
-rw-r--r--drivers/net/e1000e/es2lan.c11
-rw-r--r--drivers/net/e1000e/ethtool.c9
-rw-r--r--drivers/net/e1000e/hw.h5
-rw-r--r--drivers/net/e1000e/ich8lan.c355
-rw-r--r--drivers/net/e1000e/lib.c39
-rw-r--r--drivers/net/e1000e/netdev.c94
-rw-r--r--drivers/net/e1000e/param.c4
-rw-r--r--drivers/net/e1000e/phy.c21
-rw-r--r--drivers/net/e2100.c1
-rw-r--r--drivers/net/eepro.c3
-rw-r--r--drivers/net/eexpress.c5
-rw-r--r--drivers/net/ehea/ehea_main.c6
-rw-r--r--drivers/net/enc28j60.c2
-rw-r--r--drivers/net/epic100.c7
-rw-r--r--drivers/net/es3210.c2
-rw-r--r--drivers/net/eth16i.c5
-rw-r--r--drivers/net/ethoc.c1
-rw-r--r--drivers/net/ewrk3.c5
-rw-r--r--drivers/net/fealnx.c3
-rw-r--r--drivers/net/fec.c4
-rw-r--r--drivers/net/fec_mpc52xx.c1
-rw-r--r--drivers/net/forcedeth.c2
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c2
-rw-r--r--drivers/net/gianfar.c10
-rw-r--r--drivers/net/hamachi.c3
-rw-r--r--drivers/net/hamradio/scc.c1
-rw-r--r--drivers/net/hp-plus.c4
-rw-r--r--drivers/net/hp.c3
-rw-r--r--drivers/net/hp100.c10
-rw-r--r--drivers/net/ibmveth.c3
-rw-r--r--drivers/net/ifb.c1
-rw-r--r--drivers/net/igb/e1000_82575.c2
-rw-r--r--drivers/net/igb/igb_main.c3
-rw-r--r--drivers/net/igbvf/ethtool.c2
-rw-r--r--drivers/net/ioc3-eth.c1
-rw-r--r--drivers/net/irda/au1k_ir.c1
-rw-r--r--drivers/net/irda/donauboe.c2
-rw-r--r--drivers/net/irda/mcs7780.c4
-rw-r--r--drivers/net/irda/pxaficp_ir.c1
-rw-r--r--drivers/net/irda/sa1100_ir.c2
-rw-r--r--drivers/net/irda/sir_dev.c1
-rw-r--r--drivers/net/irda/smsc-ircc2.c3
-rw-r--r--drivers/net/irda/vlsi_ir.c1
-rw-r--r--drivers/net/irda/w83977af_ir.c2
-rw-r--r--drivers/net/ixgb/ixgb_ee.c10
-rw-r--r--drivers/net/ixgb/ixgb_hw.c17
-rw-r--r--drivers/net/ixgb/ixgb_main.c52
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c8
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c403
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c523
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h17
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c28
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h33
-rw-r--r--drivers/net/ixgbevf/ixgbevf_main.c6
-rw-r--r--drivers/net/ixp2000/ixpdev.c2
-rw-r--r--drivers/net/jme.c4
-rw-r--r--drivers/net/lance.c4
-rw-r--r--drivers/net/lib82596.c3
-rw-r--r--drivers/net/lib8390.c4
-rw-r--r--drivers/net/ll_temac_main.c2
-rw-r--r--drivers/net/lne390.c2
-rw-r--r--drivers/net/lp486e.c2
-rw-r--r--drivers/net/mac8390.c2
-rw-r--r--drivers/net/mac89x0.c1
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/macmace.c1
-rw-r--r--drivers/net/meth.c4
-rw-r--r--drivers/net/mlx4/en_ethtool.c2
-rw-r--r--drivers/net/mv643xx_eth.c1
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/ne-h8300.c1
-rw-r--r--drivers/net/ne.c1
-rw-r--r--drivers/net/ne2.c1
-rw-r--r--drivers/net/ne2k-pci.c1
-rw-r--r--drivers/net/ne3210.c2
-rw-r--r--drivers/net/netx-eth.c1
-rw-r--r--drivers/net/netxen/netxen_nic.h5
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c3
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h8
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c119
-rw-r--r--drivers/net/netxen/netxen_nic_init.c5
-rw-r--r--drivers/net/netxen/netxen_nic_main.c45
-rw-r--r--drivers/net/ni5010.c5
-rw-r--r--drivers/net/ni52.c7
-rw-r--r--drivers/net/ni65.c5
-rw-r--r--drivers/net/octeon/octeon_mgmt.c2
-rw-r--r--drivers/net/pasemi_mac.c2
-rw-r--r--drivers/net/pci-skeleton.c1
-rw-r--r--drivers/net/pcmcia/3c574_cs.c6
-rw-r--r--drivers/net/pcmcia/3c589_cs.c3
-rw-r--r--drivers/net/pcmcia/axnet_cs.c4
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c3
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c2
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c6
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c8
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c3
-rw-r--r--drivers/net/pcnet32.c9
-rw-r--r--drivers/net/phy/mdio-octeon.c10
-rw-r--r--drivers/net/phy/micrel.c1
-rw-r--r--drivers/net/phy/national.c3
-rw-r--r--drivers/net/plip.c4
-rw-r--r--drivers/net/ps3_gelic_net.c3
-rw-r--r--drivers/net/ps3_gelic_wireless.c1
-rw-r--r--drivers/net/qla3xxx.c6
-rw-r--r--drivers/net/qlcnic/qlcnic.h15
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c10
-rw-r--r--drivers/net/qlcnic/qlcnic_hdr.h7
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c5
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c48
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c219
-rw-r--r--drivers/net/qlge/qlge_ethtool.c2
-rw-r--r--drivers/net/r6040.c1
-rw-r--r--drivers/net/rrunner.c1
-rw-r--r--drivers/net/s2io.c3
-rw-r--r--drivers/net/s6gmac.c2
-rw-r--r--drivers/net/sb1000.c5
-rw-r--r--drivers/net/sb1250-mac.c4
-rw-r--r--drivers/net/sc92031.c2
-rw-r--r--drivers/net/seeq8005.c4
-rw-r--r--drivers/net/sgiseeq.c6
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/sis900.c11
-rw-r--r--drivers/net/skfp/skfddi.c3
-rw-r--r--drivers/net/sky2.c55
-rw-r--r--drivers/net/slhc.c1
-rw-r--r--drivers/net/slip.c2
-rw-r--r--drivers/net/smc-mca.c1
-rw-r--r--drivers/net/smc-ultra.c1
-rw-r--r--drivers/net/smc-ultra32.c1
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/smc9194.c5
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/smsc911x.c1
-rw-r--r--drivers/net/smsc9420.c2
-rw-r--r--drivers/net/sonic.c4
-rw-r--r--drivers/net/spider_net.c2
-rw-r--r--drivers/net/starfire.c6
-rw-r--r--drivers/net/stmmac/dwmac1000_core.c8
-rw-r--r--drivers/net/stmmac/dwmac1000_dma.c2
-rw-r--r--drivers/net/stmmac/dwmac100_core.c5
-rw-r--r--drivers/net/stmmac/dwmac100_dma.c4
-rw-r--r--drivers/net/stmmac/dwmac_lib.c12
-rw-r--r--drivers/net/stmmac/enh_desc.c5
-rw-r--r--drivers/net/stmmac/norm_desc.c4
-rw-r--r--drivers/net/stmmac/stmmac_ethtool.c7
-rw-r--r--drivers/net/stmmac/stmmac_main.c22
-rw-r--r--drivers/net/stmmac/stmmac_timer.c6
-rw-r--r--drivers/net/stnic.c1
-rw-r--r--drivers/net/sun3_82586.c7
-rw-r--r--drivers/net/sun3lance.c8
-rw-r--r--drivers/net/sunbmac.c2
-rw-r--r--drivers/net/sundance.c8
-rw-r--r--drivers/net/sungem.c3
-rw-r--r--drivers/net/sunhme.c3
-rw-r--r--drivers/net/sunlance.c3
-rw-r--r--drivers/net/sunqe.c1
-rw-r--r--drivers/net/sunvnet.c1
-rw-r--r--drivers/net/tc35815.c2
-rw-r--r--drivers/net/tlan.c3
-rw-r--r--drivers/net/tokenring/ibmtr.c1
-rw-r--r--drivers/net/tokenring/madgemc.c12
-rw-r--r--drivers/net/tokenring/smctr.c4
-rw-r--r--drivers/net/tokenring/tms380tr.c49
-rw-r--r--drivers/net/tulip/de2104x.c1
-rw-r--r--drivers/net/tulip/de4x5.c73
-rw-r--r--drivers/net/tulip/dmfe.c5
-rw-r--r--drivers/net/tulip/media.c2
-rw-r--r--drivers/net/tulip/pnic.c2
-rw-r--r--drivers/net/tulip/tulip_core.c4
-rw-r--r--drivers/net/tulip/uli526x.c4
-rw-r--r--drivers/net/tulip/winbond-840.c6
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/net/typhoon.c2
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/net/usb/hso.c4
-rw-r--r--drivers/net/usb/kaweth.c1
-rw-r--r--drivers/net/usb/pegasus.c3
-rw-r--r--drivers/net/usb/rndis_host.c18
-rw-r--r--drivers/net/veth.c1
-rw-r--r--drivers/net/via-rhine.c4
-rw-r--r--drivers/net/via-velocity.c1
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c1
-rw-r--r--drivers/net/vxge/vxge-config.c17
-rw-r--r--drivers/net/vxge/vxge-main.c4
-rw-r--r--drivers/net/vxge/vxge-traffic.c28
-rw-r--r--drivers/net/wan/dscc4.c2
-rw-r--r--drivers/net/wan/hd64570.c1
-rw-r--r--drivers/net/wan/hd64572.c1
-rw-r--r--drivers/net/wan/ixp4xx_hss.c1
-rw-r--r--drivers/net/wan/lmc/lmc_main.c6
-rw-r--r--drivers/net/wan/pc300_drv.c3
-rw-r--r--drivers/net/wan/wanxl.c1
-rw-r--r--drivers/net/wd.c1
-rw-r--r--drivers/net/wimax/i2400m/control.c2
-rw-r--r--drivers/net/wimax/i2400m/driver.c2
-rw-r--r--drivers/net/wimax/i2400m/netdev.c2
-rw-r--r--drivers/net/wimax/i2400m/rx.c7
-rw-r--r--drivers/net/wimax/i2400m/sdio-rx.c2
-rw-r--r--drivers/net/wimax/i2400m/usb-notif.c1
-rw-r--r--drivers/net/wireless/Kconfig1
-rw-r--r--drivers/net/wireless/at76c50x-usb.c1
-rw-r--r--drivers/net/wireless/ath/ar9170/ar9170.h52
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c558
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c16
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/ani.c6
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c2
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_initvals.h204
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c49
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_beacon.c39
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c42
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c20
-rw-r--r--drivers/net/wireless/ath/regd.c1
-rw-r--r--drivers/net/wireless/atmel.c1
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c1
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c2
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_rx.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-calib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c2
-rw-r--r--drivers/net/wireless/libertas/cfg.c1
-rw-r--r--drivers/net/wireless/libertas/debugfs.c3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c4
-rw-r--r--drivers/net/wireless/libertas/main.c2
-rw-r--r--drivers/net/wireless/libertas/rx.c1
-rw-r--r--drivers/net/wireless/libertas/tx.c2
-rw-r--r--drivers/net/wireless/libertas_tf/if_usb.c1
-rw-r--r--drivers/net/wireless/libertas_tf/main.c1
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c19
-rw-r--r--drivers/net/wireless/orinoco/cfg.c1
-rw-r--r--drivers/net/wireless/orinoco/main.c172
-rw-r--r--drivers/net/wireless/orinoco/orinoco.h6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_usb.c91
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c2
-rw-r--r--drivers/net/wireless/ray_cs.c6
-rw-r--r--drivers/net/wireless/rndis_wlan.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c22
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c22
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c66
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c178
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c166
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c176
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.h40
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00crypto.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00ht.c17
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00reg.h10
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c41
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c51
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180.h11
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c96
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_rx.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.c12
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.h3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_io.h4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c63
-rw-r--r--drivers/net/wireless/wl3501_cs.c5
-rw-r--r--drivers/net/wireless/zd1201.c6
-rw-r--r--drivers/net/xilinx_emaclite.c5
-rw-r--r--drivers/net/yellowfin.c1
-rw-r--r--drivers/net/znet.c2
-rw-r--r--drivers/net/zorro8390.c1
-rw-r--r--drivers/of/of_mdio.c2
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c3
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c3
-rw-r--r--drivers/pci/pci.c6
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c10
-rw-r--r--drivers/pci/probe.c23
-rw-r--r--drivers/pcmcia/cs.c16
-rw-r--r--drivers/pcmcia/db1xxx_ss.c16
-rw-r--r--drivers/pcmcia/ds.c55
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c7
-rw-r--r--drivers/platform/x86/Kconfig1
-rw-r--r--drivers/platform/x86/asus-laptop.c8
-rw-r--r--drivers/platform/x86/dell-wmi.c3
-rw-r--r--drivers/platform/x86/eeepc-laptop.c3
-rw-r--r--drivers/platform/x86/eeepc-wmi.c333
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c26
-rw-r--r--drivers/pnp/resource.c4
-rw-r--r--drivers/regulator/max8925-regulator.c2
-rw-r--r--drivers/regulator/mc13783-regulator.c3
-rw-r--r--drivers/s390/block/dasd.c3
-rw-r--r--drivers/s390/block/dasd_3990_erp.c7
-rw-r--r--drivers/s390/char/zcore.c6
-rw-r--r--drivers/s390/cio/chsc.c29
-rw-r--r--drivers/s390/cio/chsc_sch.c2
-rw-r--r--drivers/s390/cio/cio.c18
-rw-r--r--drivers/s390/cio/css.c16
-rw-r--r--drivers/s390/cio/device_fsm.c2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c6
-rw-r--r--drivers/scsi/advansys.c50
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c1
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c13
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c13
-rw-r--r--drivers/scsi/dpt_i2o.c15
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c29
-rw-r--r--drivers/scsi/libiscsi.c2
-rw-r--r--drivers/scsi/libsas/sas_ata.c4
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c1
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c2
-rw-r--r--drivers/scsi/scsi_debug.c3
-rw-r--r--drivers/scsi/scsi_error.c15
-rw-r--r--drivers/scsi/sd.c1
-rw-r--r--drivers/scsi/wd7000.c2
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/mcf.c6
-rw-r--r--drivers/serial/mpc52xx_uart.c33
-rw-r--r--drivers/serial/pmac_zilog.c4
-rw-r--r--drivers/serial/serial_ks8695.c1
-rw-r--r--drivers/spi/omap2_mcspi.c5
-rw-r--r--drivers/spi/spi.c8
-rw-r--r--drivers/staging/dt3155/dt3155_drv.c18
-rw-r--r--drivers/staging/hv/Hv.c2
-rw-r--r--drivers/staging/hv/RndisFilter.c1
-rw-r--r--drivers/staging/hv/netvsc_drv.c3
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c2
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c3
-rw-r--r--drivers/staging/iio/adc/max1363_core.c2
-rw-r--r--drivers/staging/iio/industrialio-core.c3
-rw-r--r--drivers/staging/iio/light/tsl2563.c2
-rw-r--r--drivers/staging/iio/ring_sw.c2
-rw-r--r--drivers/staging/octeon/cvmx-helper-board.c8
-rw-r--r--drivers/staging/rt2860/usb_main_dev.c1
-rw-r--r--drivers/staging/rtl8192su/r8192U_core.c3
-rw-r--r--drivers/staging/usbip/usbip_event.c3
-rw-r--r--drivers/staging/vme/bridges/vme_tsi148.c3
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/core/Kconfig2
-rw-r--r--drivers/usb/core/driver.c49
-rw-r--r--drivers/usb/core/generic.c2
-rw-r--r--drivers/usb/core/inode.c4
-rw-r--r--drivers/usb/core/usb.c20
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c7
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ehci-mem.c2
-rw-r--r--drivers/usb/host/ehci-omap.c6
-rw-r--r--drivers/usb/host/ehci-sched.c40
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/ohci-at91.c2
-rw-r--r--drivers/usb/host/ohci-da8xx.c2
-rw-r--r--drivers/usb/host/ohci-hub.c2
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c6
-rw-r--r--drivers/usb/host/sl811-hcd.c6
-rw-r--r--drivers/usb/host/xhci-mem.c65
-rw-r--r--drivers/usb/host/xhci.h4
-rw-r--r--drivers/usb/misc/usbsevseg.c15
-rw-r--r--drivers/usb/musb/Kconfig2
-rw-r--r--drivers/usb/musb/Makefile2
-rw-r--r--drivers/usb/musb/blackfin.c8
-rw-r--r--drivers/usb/musb/davinci.c2
-rw-r--r--drivers/usb/musb/musb_core.c77
-rw-r--r--drivers/usb/musb/musb_core.h2
-rw-r--r--drivers/usb/musb/musb_host.c1
-rw-r--r--drivers/usb/musb/omap2430.c3
-rw-r--r--drivers/usb/musb/tusb6010.c13
-rw-r--r--drivers/usb/musb/tusb6010_omap.c22
-rw-r--r--drivers/usb/serial/option.c10
-rw-r--r--drivers/usb/serial/pl2303.c2
-rw-r--r--drivers/usb/serial/pl2303.h5
-rw-r--r--drivers/usb/serial/qcaux.c10
-rw-r--r--drivers/usb/serial/sierra.c1
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c26
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h3
-rw-r--r--drivers/usb/wusbcore/devconnect.c2
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c15
-rw-r--r--drivers/video/efifb.c3
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c27
-rw-r--r--drivers/virtio/virtio_balloon.c3
-rw-r--r--drivers/w1/masters/omap_hdq.c1
-rw-r--r--drivers/w1/slaves/w1_therm.c5
-rw-r--r--drivers/watchdog/booke_wdt.c2
-rw-r--r--drivers/watchdog/ep93xx_wdt.c2
-rw-r--r--drivers/watchdog/sb_wdog.c4
-rw-r--r--drivers/watchdog/sbc_fitpc2_wdt.c14
597 files changed, 5215 insertions, 4419 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index 34f1e1064dbc..f42a03029b7c 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_SFI) += sfi/
17obj-$(CONFIG_PNP) += pnp/ 17obj-$(CONFIG_PNP) += pnp/
18obj-$(CONFIG_ARM_AMBA) += amba/ 18obj-$(CONFIG_ARM_AMBA) += amba/
19 19
20obj-$(CONFIG_VIRTIO) += virtio/
20obj-$(CONFIG_XEN) += xen/ 21obj-$(CONFIG_XEN) += xen/
21 22
22# regulators early, since some subsystems rely on them to initialize 23# regulators early, since some subsystems rely on them to initialize
@@ -108,7 +109,6 @@ obj-$(CONFIG_PPC_PS3) += ps3/
108obj-$(CONFIG_OF) += of/ 109obj-$(CONFIG_OF) += of/
109obj-$(CONFIG_SSB) += ssb/ 110obj-$(CONFIG_SSB) += ssb/
110obj-$(CONFIG_VHOST_NET) += vhost/ 111obj-$(CONFIG_VHOST_NET) += vhost/
111obj-$(CONFIG_VIRTIO) += virtio/
112obj-$(CONFIG_VLYNQ) += vlynq/ 112obj-$(CONFIG_VLYNQ) += vlynq/
113obj-$(CONFIG_STAGING) += staging/ 113obj-$(CONFIG_STAGING) += staging/
114obj-y += platform/ 114obj-y += platform/
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 19dacfd43163..62122134693b 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -31,7 +31,7 @@
31#include <acpi/acpi_bus.h> 31#include <acpi/acpi_bus.h>
32#include <acpi/acpi_drivers.h> 32#include <acpi/acpi_drivers.h>
33 33
34#define ACPI_PROCESSOR_AGGREGATOR_CLASS "processor_aggregator" 34#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
35#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" 35#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
36#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 36#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
37static DEFINE_MUTEX(isolated_cpus_lock); 37static DEFINE_MUTEX(isolated_cpus_lock);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 37132dc2da03..743576bf1bd7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -527,7 +527,7 @@ int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id,
527 if (!event_is_open) 527 if (!event_is_open)
528 return 0; 528 return 0;
529 529
530 event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); 530 event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
531 if (!event) 531 if (!event)
532 return -ENOMEM; 532 return -ENOMEM;
533 533
diff --git a/drivers/acpi/hest.c b/drivers/acpi/hest.c
index 4bb18c980ac6..1c527a192872 100644
--- a/drivers/acpi/hest.c
+++ b/drivers/acpi/hest.c
@@ -123,6 +123,10 @@ int acpi_hest_firmware_first_pci(struct pci_dev *pci)
123{ 123{
124 acpi_status status = AE_NOT_FOUND; 124 acpi_status status = AE_NOT_FOUND;
125 struct acpi_table_header *hest = NULL; 125 struct acpi_table_header *hest = NULL;
126
127 if (acpi_disabled)
128 return 0;
129
126 status = acpi_get_table(ACPI_SIG_HEST, 1, &hest); 130 status = acpi_get_table(ACPI_SIG_HEST, 1, &hest);
127 131
128 if (ACPI_SUCCESS(status)) { 132 if (ACPI_SUCCESS(status)) {
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
index e8c32a49f14e..66f67293341e 100644
--- a/drivers/acpi/power_meter.c
+++ b/drivers/acpi/power_meter.c
@@ -35,7 +35,7 @@
35#define ACPI_POWER_METER_NAME "power_meter" 35#define ACPI_POWER_METER_NAME "power_meter"
36ACPI_MODULE_NAME(ACPI_POWER_METER_NAME); 36ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
37#define ACPI_POWER_METER_DEVICE_NAME "Power Meter" 37#define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
38#define ACPI_POWER_METER_CLASS "power_meter_resource" 38#define ACPI_POWER_METER_CLASS "pwr_meter_resource"
39 39
40#define NUM_SENSORS 17 40#define NUM_SENSORS 17
41 41
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index 36704b887ccf..f8be23b6c129 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -18,7 +18,7 @@
18 18
19#define PREFIX "ACPI: " 19#define PREFIX "ACPI: "
20 20
21#define ACPI_SMB_HC_CLASS "smbus_host_controller" 21#define ACPI_SMB_HC_CLASS "smbus_host_ctl"
22#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC" 22#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC"
23 23
24struct acpi_smb_hc { 24struct acpi_smb_hc {
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index f74834a544fd..baa76bbf244a 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -450,6 +450,38 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
450 }, 450 },
451 }, 451 },
452 { 452 {
453 .callback = init_set_sci_en_on_resume,
454 .ident = "Lenovo ThinkPad T410",
455 .matches = {
456 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
457 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
458 },
459 },
460 {
461 .callback = init_set_sci_en_on_resume,
462 .ident = "Lenovo ThinkPad T510",
463 .matches = {
464 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
465 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
466 },
467 },
468 {
469 .callback = init_set_sci_en_on_resume,
470 .ident = "Lenovo ThinkPad W510",
471 .matches = {
472 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
473 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
474 },
475 },
476 {
477 .callback = init_set_sci_en_on_resume,
478 .ident = "Lenovo ThinkPad X201[s]",
479 .matches = {
480 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
481 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
482 },
483 },
484 {
453 .callback = init_old_suspend_ordering, 485 .callback = init_old_suspend_ordering,
454 .ident = "Panasonic CF51-2L", 486 .ident = "Panasonic CF51-2L",
455 .matches = { 487 .matches = {
@@ -458,6 +490,30 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
458 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), 490 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
459 }, 491 },
460 }, 492 },
493 {
494 .callback = init_set_sci_en_on_resume,
495 .ident = "Dell Studio 1558",
496 .matches = {
497 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
498 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1558"),
499 },
500 },
501 {
502 .callback = init_set_sci_en_on_resume,
503 .ident = "Dell Studio 1557",
504 .matches = {
505 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
506 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
507 },
508 },
509 {
510 .callback = init_set_sci_en_on_resume,
511 .ident = "Dell Studio 1555",
512 .matches = {
513 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
514 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1555"),
515 },
516 },
461 {}, 517 {},
462}; 518};
463#endif /* CONFIG_SUSPEND */ 519#endif /* CONFIG_SUSPEND */
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 9f6cfac0f2cc..228740f356c9 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -879,6 +879,8 @@ static void ata_eh_set_pending(struct ata_port *ap, int fastdrain)
879void ata_qc_schedule_eh(struct ata_queued_cmd *qc) 879void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
880{ 880{
881 struct ata_port *ap = qc->ap; 881 struct ata_port *ap = qc->ap;
882 struct request_queue *q = qc->scsicmd->device->request_queue;
883 unsigned long flags;
882 884
883 WARN_ON(!ap->ops->error_handler); 885 WARN_ON(!ap->ops->error_handler);
884 886
@@ -890,7 +892,9 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
890 * Note that ATA_QCFLAG_FAILED is unconditionally set after 892 * Note that ATA_QCFLAG_FAILED is unconditionally set after
891 * this function completes. 893 * this function completes.
892 */ 894 */
895 spin_lock_irqsave(q->queue_lock, flags);
893 blk_abort_request(qc->scsicmd->request); 896 blk_abort_request(qc->scsicmd->request);
897 spin_unlock_irqrestore(q->queue_lock, flags);
894} 898}
895 899
896/** 900/**
@@ -1624,6 +1628,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
1624 } 1628 }
1625 1629
1626 /* okay, this error is ours */ 1630 /* okay, this error is ours */
1631 memset(&tf, 0, sizeof(tf));
1627 rc = ata_eh_read_log_10h(dev, &tag, &tf); 1632 rc = ata_eh_read_log_10h(dev, &tag, &tf);
1628 if (rc) { 1633 if (rc) {
1629 ata_link_printk(link, KERN_ERR, "failed to read log page 10h " 1634 ata_link_printk(link, KERN_ERR, "failed to read log page 10h "
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 3c3172d3c34e..d94b8f0bd743 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -424,6 +424,8 @@ static struct pcmcia_device_id pcmcia_devices[] = {
424 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420), 424 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420),
425 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 425 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
426 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 426 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
427 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 1GB", 0x2e6d1829, 0x55d5bffb),
428 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 4GB", 0x2e6d1829, 0x531e7d10),
427 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 429 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),
428 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 430 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
429 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 431 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
@@ -444,6 +446,8 @@ static struct pcmcia_device_id pcmcia_devices[] = {
444 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), 446 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
445 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), 447 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2),
446 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), 448 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
449 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF133", 0x709b1bf1, 0x7558f133),
450 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS8GCF133", 0x709b1bf1, 0xb2f89b47),
447 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 451 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
448 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), 452 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
449 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 453 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 67e0fc542249..93d1f9b469d4 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1695,6 +1695,7 @@ int drbd_send_protocol(struct drbd_conf *mdev)
1695 cf |= CF_DRY_RUN; 1695 cf |= CF_DRY_RUN;
1696 else { 1696 else {
1697 dev_err(DEV, "--dry-run is not supported by peer"); 1697 dev_err(DEV, "--dry-run is not supported by peer");
1698 kfree(p);
1698 return 0; 1699 return 0;
1699 } 1700 }
1700 } 1701 }
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index ed9f1de24a71..3f096e7959b4 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -899,7 +899,8 @@ retry:
899 899
900 drbd_thread_start(&mdev->asender); 900 drbd_thread_start(&mdev->asender);
901 901
902 drbd_send_protocol(mdev); 902 if (!drbd_send_protocol(mdev))
903 return -1;
903 drbd_send_sync_param(mdev, &mdev->sync_conf); 904 drbd_send_sync_param(mdev, &mdev->sync_conf);
904 drbd_send_sizes(mdev, 0); 905 drbd_send_sizes(mdev, 0);
905 drbd_send_uuids(mdev); 906 drbd_send_uuids(mdev);
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 44bf6d11197e..d48a1dfd7b24 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -235,7 +235,7 @@ void drbd_endio_pri(struct bio *bio, int error)
235 if (unlikely(error)) { 235 if (unlikely(error)) {
236 what = (bio_data_dir(bio) == WRITE) 236 what = (bio_data_dir(bio) == WRITE)
237 ? write_completed_with_error 237 ? write_completed_with_error
238 : (bio_rw(bio) == READA) 238 : (bio_rw(bio) == READ)
239 ? read_completed_with_error 239 ? read_completed_with_error
240 : read_ahead_completed_with_error; 240 : read_ahead_completed_with_error;
241 } else 241 } else
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index ddf19425245d..8a549db2aa78 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -48,6 +48,7 @@
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/compat.h>
51#include <linux/kthread.h> 52#include <linux/kthread.h>
52#include <linux/errno.h> 53#include <linux/errno.h>
53#include <linux/spinlock.h> 54#include <linux/spinlock.h>
@@ -2984,7 +2985,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd)
2984 mutex_unlock(&ctl_mutex); 2985 mutex_unlock(&ctl_mutex);
2985} 2986}
2986 2987
2987static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 2988static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2988{ 2989{
2989 void __user *argp = (void __user *)arg; 2990 void __user *argp = (void __user *)arg;
2990 struct pkt_ctrl_command ctrl_cmd; 2991 struct pkt_ctrl_command ctrl_cmd;
@@ -3021,10 +3022,20 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
3021 return ret; 3022 return ret;
3022} 3023}
3023 3024
3025#ifdef CONFIG_COMPAT
3026static long pkt_ctl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3027{
3028 return pkt_ctl_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
3029}
3030#endif
3024 3031
3025static const struct file_operations pkt_ctl_fops = { 3032static const struct file_operations pkt_ctl_fops = {
3026 .ioctl = pkt_ctl_ioctl, 3033 .open = nonseekable_open,
3027 .owner = THIS_MODULE, 3034 .unlocked_ioctl = pkt_ctl_ioctl,
3035#ifdef CONFIG_COMPAT
3036 .compat_ioctl = pkt_ctl_compat_ioctl,
3037#endif
3038 .owner = THIS_MODULE,
3028}; 3039};
3029 3040
3030static struct miscdevice pkt_misc = { 3041static struct miscdevice pkt_misc = {
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 0fa2e4a0835d..c1ab303455cf 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -879,8 +879,8 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
879 if (tport == NULL) 879 if (tport == NULL)
880 return -ENODEV; 880 return -ENODEV;
881 port = container_of(tport, struct isi_port, port); 881 port = container_of(tport, struct isi_port, port);
882 card = &isi_card[BOARD(tty->index)];
883 882
883 tty->driver_data = port;
884 return tty_port_open(tport, tty, filp); 884 return tty_port_open(tport, tty, filp);
885} 885}
886 886
@@ -936,7 +936,12 @@ static void isicom_shutdown(struct tty_port *port)
936static void isicom_close(struct tty_struct *tty, struct file *filp) 936static void isicom_close(struct tty_struct *tty, struct file *filp)
937{ 937{
938 struct isi_port *ip = tty->driver_data; 938 struct isi_port *ip = tty->driver_data;
939 struct tty_port *port = &ip->port; 939 struct tty_port *port;
940
941 if (ip == NULL)
942 return;
943
944 port = &ip->port;
940 if (isicom_paranoia_check(ip, tty->name, "isicom_close")) 945 if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
941 return; 946 return;
942 tty_port_close(port, tty, filp); 947 tty_port_close(port, tty, filp);
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 4cd6c527ee41..4e395c956a09 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -827,6 +827,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
827 return -ENODEV; 827 return -ENODEV;
828 if (portp->devnr < 1) 828 if (portp->devnr < 1)
829 return -ENODEV; 829 return -ENODEV;
830
831 tty->driver_data = portp;
830 return tty_port_open(&portp->port, tty, filp); 832 return tty_port_open(&portp->port, tty, filp);
831} 833}
832 834
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 47023053ee85..d2692d443f7b 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1011,6 +1011,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
1011 if (!info->ioaddr) 1011 if (!info->ioaddr)
1012 return -ENODEV; 1012 return -ENODEV;
1013 1013
1014 tty->driver_data = info;
1014 return tty_port_open(&info->port, tty, filp); 1015 return tty_port_open(&info->port, tty, filp);
1015} 1016}
1016 1017
@@ -1074,7 +1075,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1074 struct mxser_port *info = tty->driver_data; 1075 struct mxser_port *info = tty->driver_data;
1075 struct tty_port *port = &info->port; 1076 struct tty_port *port = &info->port;
1076 1077
1077 if (tty->index == MXSER_PORTS) 1078 if (tty->index == MXSER_PORTS || info == NULL)
1078 return; 1079 return;
1079 if (tty_port_close_start(port, tty, filp) == 0) 1080 if (tty_port_close_start(port, tty, filp) == 0)
1080 return; 1081 return;
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 0a8d1e56c993..b02332a5412f 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -909,6 +909,7 @@ static int rc_open(struct tty_struct *tty, struct file *filp)
909 if (error) 909 if (error)
910 return error; 910 return error;
911 911
912 tty->driver_data = port;
912 return tty_port_open(&port->port, tty, filp); 913 return tty_port_open(&port->port, tty, filp);
913} 914}
914 915
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 0e511d61f544..6049fd731924 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -724,7 +724,6 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
724{ 724{
725 struct stlport *portp; 725 struct stlport *portp;
726 struct stlbrd *brdp; 726 struct stlbrd *brdp;
727 struct tty_port *port;
728 unsigned int minordev, brdnr, panelnr; 727 unsigned int minordev, brdnr, panelnr;
729 int portnr; 728 int portnr;
730 729
@@ -754,7 +753,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
754 portp = brdp->panels[panelnr]->ports[portnr]; 753 portp = brdp->panels[panelnr]->ports[portnr];
755 if (portp == NULL) 754 if (portp == NULL)
756 return -ENODEV; 755 return -ENODEV;
757 port = &portp->port; 756
757 tty->driver_data = portp;
758 return tty_port_open(&portp->port, tty, filp); 758 return tty_port_open(&portp->port, tty, filp);
759 759
760} 760}
@@ -841,7 +841,8 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
841 pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp); 841 pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp);
842 842
843 portp = tty->driver_data; 843 portp = tty->driver_data;
844 BUG_ON(portp == NULL); 844 if(portp == NULL)
845 return;
845 tty_port_close(&portp->port, tty, filp); 846 tty_port_close(&portp->port, tty, filp);
846} 847}
847 848
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 2d5d575e889d..75d293eeb3ee 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1113,6 +1113,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1113 unsigned int cpu = sys_dev->id; 1113 unsigned int cpu = sys_dev->id;
1114 unsigned long flags; 1114 unsigned long flags;
1115 struct cpufreq_policy *data; 1115 struct cpufreq_policy *data;
1116 struct kobject *kobj;
1117 struct completion *cmp;
1116#ifdef CONFIG_SMP 1118#ifdef CONFIG_SMP
1117 struct sys_device *cpu_sys_dev; 1119 struct sys_device *cpu_sys_dev;
1118 unsigned int j; 1120 unsigned int j;
@@ -1141,10 +1143,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1141 dprintk("removing link\n"); 1143 dprintk("removing link\n");
1142 cpumask_clear_cpu(cpu, data->cpus); 1144 cpumask_clear_cpu(cpu, data->cpus);
1143 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1145 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1144 sysfs_remove_link(&sys_dev->kobj, "cpufreq"); 1146 kobj = &sys_dev->kobj;
1145 cpufreq_cpu_put(data); 1147 cpufreq_cpu_put(data);
1146 cpufreq_debug_enable_ratelimit(); 1148 cpufreq_debug_enable_ratelimit();
1147 unlock_policy_rwsem_write(cpu); 1149 unlock_policy_rwsem_write(cpu);
1150 sysfs_remove_link(kobj, "cpufreq");
1148 return 0; 1151 return 0;
1149 } 1152 }
1150#endif 1153#endif
@@ -1181,7 +1184,10 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1181 data->governor->name, CPUFREQ_NAME_LEN); 1184 data->governor->name, CPUFREQ_NAME_LEN);
1182#endif 1185#endif
1183 cpu_sys_dev = get_cpu_sysdev(j); 1186 cpu_sys_dev = get_cpu_sysdev(j);
1184 sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); 1187 kobj = &cpu_sys_dev->kobj;
1188 unlock_policy_rwsem_write(cpu);
1189 sysfs_remove_link(kobj, "cpufreq");
1190 lock_policy_rwsem_write(cpu);
1185 cpufreq_cpu_put(data); 1191 cpufreq_cpu_put(data);
1186 } 1192 }
1187 } 1193 }
@@ -1192,19 +1198,22 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1192 if (cpufreq_driver->target) 1198 if (cpufreq_driver->target)
1193 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1199 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1194 1200
1195 kobject_put(&data->kobj); 1201 kobj = &data->kobj;
1202 cmp = &data->kobj_unregister;
1203 unlock_policy_rwsem_write(cpu);
1204 kobject_put(kobj);
1196 1205
1197 /* we need to make sure that the underlying kobj is actually 1206 /* we need to make sure that the underlying kobj is actually
1198 * not referenced anymore by anybody before we proceed with 1207 * not referenced anymore by anybody before we proceed with
1199 * unloading. 1208 * unloading.
1200 */ 1209 */
1201 dprintk("waiting for dropping of refcount\n"); 1210 dprintk("waiting for dropping of refcount\n");
1202 wait_for_completion(&data->kobj_unregister); 1211 wait_for_completion(cmp);
1203 dprintk("wait complete\n"); 1212 dprintk("wait complete\n");
1204 1213
1214 lock_policy_rwsem_write(cpu);
1205 if (cpufreq_driver->exit) 1215 if (cpufreq_driver->exit)
1206 cpufreq_driver->exit(data); 1216 cpufreq_driver->exit(data);
1207
1208 unlock_policy_rwsem_write(cpu); 1217 unlock_policy_rwsem_write(cpu);
1209 1218
1210 free_cpumask_var(data->related_cpus); 1219 free_cpumask_var(data->related_cpus);
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 599a40b25cb0..3a147874a465 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -444,6 +444,7 @@ static struct attribute_group dbs_attr_group_old = {
444static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) 444static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
445{ 445{
446 unsigned int load = 0; 446 unsigned int load = 0;
447 unsigned int max_load = 0;
447 unsigned int freq_target; 448 unsigned int freq_target;
448 449
449 struct cpufreq_policy *policy; 450 struct cpufreq_policy *policy;
@@ -501,6 +502,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
501 continue; 502 continue;
502 503
503 load = 100 * (wall_time - idle_time) / wall_time; 504 load = 100 * (wall_time - idle_time) / wall_time;
505
506 if (load > max_load)
507 max_load = load;
504 } 508 }
505 509
506 /* 510 /*
@@ -511,7 +515,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
511 return; 515 return;
512 516
513 /* Check for frequency increase */ 517 /* Check for frequency increase */
514 if (load > dbs_tuners_ins.up_threshold) { 518 if (max_load > dbs_tuners_ins.up_threshold) {
515 this_dbs_info->down_skip = 0; 519 this_dbs_info->down_skip = 0;
516 520
517 /* if we are already at full speed then break out early */ 521 /* if we are already at full speed then break out early */
@@ -538,7 +542,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
538 * can support the current CPU usage without triggering the up 542 * can support the current CPU usage without triggering the up
539 * policy. To be safe, we focus 10 points under the threshold. 543 * policy. To be safe, we focus 10 points under the threshold.
540 */ 544 */
541 if (load < (dbs_tuners_ins.down_threshold - 10)) { 545 if (max_load < (dbs_tuners_ins.down_threshold - 10)) {
542 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 546 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
543 547
544 this_dbs_info->requested_freq -= freq_target; 548 this_dbs_info->requested_freq -= freq_target;
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 1aea7157d8ff..f8e57c6303f2 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -100,7 +100,6 @@ struct menu_device {
100 int needs_update; 100 int needs_update;
101 101
102 unsigned int expected_us; 102 unsigned int expected_us;
103 unsigned int measured_us;
104 u64 predicted_us; 103 u64 predicted_us;
105 unsigned int exit_us; 104 unsigned int exit_us;
106 unsigned int bucket; 105 unsigned int bucket;
@@ -187,14 +186,14 @@ static int menu_select(struct cpuidle_device *dev)
187 int i; 186 int i;
188 int multiplier; 187 int multiplier;
189 188
190 data->last_state_idx = 0;
191 data->exit_us = 0;
192
193 if (data->needs_update) { 189 if (data->needs_update) {
194 menu_update(dev); 190 menu_update(dev);
195 data->needs_update = 0; 191 data->needs_update = 0;
196 } 192 }
197 193
194 data->last_state_idx = 0;
195 data->exit_us = 0;
196
198 /* Special case when user has set very strict latency requirement */ 197 /* Special case when user has set very strict latency requirement */
199 if (unlikely(latency_req == 0)) 198 if (unlikely(latency_req == 0))
200 return 0; 199 return 0;
@@ -294,7 +293,7 @@ static void menu_update(struct cpuidle_device *dev)
294 new_factor = data->correction_factor[data->bucket] 293 new_factor = data->correction_factor[data->bucket]
295 * (DECAY - 1) / DECAY; 294 * (DECAY - 1) / DECAY;
296 295
297 if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING) 296 if (data->expected_us > 0 && measured_us < MAX_INTERESTING)
298 new_factor += RESOLUTION * measured_us / data->expected_us; 297 new_factor += RESOLUTION * measured_us / data->expected_us;
299 else 298 else
300 /* 299 /*
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 7cc31b3f40d8..6f25a20de99f 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -290,6 +290,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
290 struct sh_dmae_chan *sh_chan = to_sh_chan(chan); 290 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
291 struct sh_desc *desc; 291 struct sh_desc *desc;
292 struct sh_dmae_slave *param = chan->private; 292 struct sh_dmae_slave *param = chan->private;
293 int ret;
293 294
294 pm_runtime_get_sync(sh_chan->dev); 295 pm_runtime_get_sync(sh_chan->dev);
295 296
@@ -301,11 +302,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
301 struct sh_dmae_slave_config *cfg; 302 struct sh_dmae_slave_config *cfg;
302 303
303 cfg = sh_dmae_find_slave(sh_chan, param->slave_id); 304 cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
304 if (!cfg) 305 if (!cfg) {
305 return -EINVAL; 306 ret = -EINVAL;
307 goto efindslave;
308 }
306 309
307 if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) 310 if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) {
308 return -EBUSY; 311 ret = -EBUSY;
312 goto etestused;
313 }
309 314
310 param->config = cfg; 315 param->config = cfg;
311 316
@@ -334,10 +339,20 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
334 } 339 }
335 spin_unlock_bh(&sh_chan->desc_lock); 340 spin_unlock_bh(&sh_chan->desc_lock);
336 341
337 if (!sh_chan->descs_allocated) 342 if (!sh_chan->descs_allocated) {
338 pm_runtime_put(sh_chan->dev); 343 ret = -ENOMEM;
344 goto edescalloc;
345 }
339 346
340 return sh_chan->descs_allocated; 347 return sh_chan->descs_allocated;
348
349edescalloc:
350 if (param)
351 clear_bit(param->slave_id, sh_dmae_slave_used);
352etestused:
353efindslave:
354 pm_runtime_put(sh_chan->dev);
355 return ret;
341} 356}
342 357
343/* 358/*
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 3ebc61067e54..75fcf1ac8bb7 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -1359,3 +1359,5 @@ module_exit(txx9dmac_exit);
1359MODULE_LICENSE("GPL"); 1359MODULE_LICENSE("GPL");
1360MODULE_DESCRIPTION("TXx9 DMA Controller driver"); 1360MODULE_DESCRIPTION("TXx9 DMA Controller driver");
1361MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); 1361MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
1362MODULE_ALIAS("platform:txx9dmac");
1363MODULE_ALIAS("platform:txx9dmac-chan");
diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c
index f5b6d9fe4def..97e64bcdbc06 100644
--- a/drivers/edac/edac_mce_amd.c
+++ b/drivers/edac/edac_mce_amd.c
@@ -294,7 +294,6 @@ wrong_ls_mce:
294void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors) 294void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
295{ 295{
296 u32 ec = ERROR_CODE(regs->nbsl); 296 u32 ec = ERROR_CODE(regs->nbsl);
297 u32 xec = EXT_ERROR_CODE(regs->nbsl);
298 297
299 if (!handle_errors) 298 if (!handle_errors)
300 return; 299 return;
@@ -324,7 +323,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
324 pr_cont("\n"); 323 pr_cont("\n");
325 } 324 }
326 325
327 pr_emerg("%s.\n", EXT_ERR_MSG(xec)); 326 pr_emerg("%s.\n", EXT_ERR_MSG(regs->nbsl));
328 327
329 if (BUS_ERROR(ec) && nb_bus_decoder) 328 if (BUS_ERROR(ec) && nb_bus_decoder)
330 nb_bus_decoder(node_id, regs); 329 nb_bus_decoder(node_id, regs);
@@ -374,7 +373,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,
374 ((m->status & MCI_STATUS_PCC) ? "yes" : "no")); 373 ((m->status & MCI_STATUS_PCC) ? "yes" : "no"));
375 374
376 /* do the two bits[14:13] together */ 375 /* do the two bits[14:13] together */
377 ecc = m->status & (3ULL << 45); 376 ecc = (m->status >> 45) & 0x3;
378 if (ecc) 377 if (ecc)
379 pr_cont(", %sECC Error", ((ecc == 2) ? "C" : "U")); 378 pr_cont(", %sECC Error", ((ecc == 2) ? "C" : "U"));
380 379
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 3784a47865b7..8f5aebfb29df 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -190,7 +190,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
190 for (try = 0; try < 5; try++) { 190 for (try = 0; try < 5; try++) {
191 new = allocate ? old - bandwidth : old + bandwidth; 191 new = allocate ? old - bandwidth : old + bandwidth;
192 if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL) 192 if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
193 break; 193 return -EBUSY;
194 194
195 data[0] = cpu_to_be32(old); 195 data[0] = cpu_to_be32(old);
196 data[1] = cpu_to_be32(new); 196 data[1] = cpu_to_be32(new);
@@ -218,7 +218,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
218 u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) 218 u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
219{ 219{
220 __be32 c, all, old; 220 __be32 c, all, old;
221 int i, retry = 5; 221 int i, ret = -EIO, retry = 5;
222 222
223 old = all = allocate ? cpu_to_be32(~0) : 0; 223 old = all = allocate ? cpu_to_be32(~0) : 0;
224 224
@@ -226,6 +226,8 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
226 if (!(channels_mask & 1 << i)) 226 if (!(channels_mask & 1 << i))
227 continue; 227 continue;
228 228
229 ret = -EBUSY;
230
229 c = cpu_to_be32(1 << (31 - i)); 231 c = cpu_to_be32(1 << (31 - i));
230 if ((old & c) != (all & c)) 232 if ((old & c) != (all & c))
231 continue; 233 continue;
@@ -251,12 +253,16 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
251 253
252 /* 1394-1995 IRM, fall through to retry. */ 254 /* 1394-1995 IRM, fall through to retry. */
253 default: 255 default:
254 if (retry--) 256 if (retry) {
257 retry--;
255 i--; 258 i--;
259 } else {
260 ret = -EIO;
261 }
256 } 262 }
257 } 263 }
258 264
259 return -EIO; 265 return ret;
260} 266}
261 267
262static void deallocate_channel(struct fw_card *card, int irm_id, 268static void deallocate_channel(struct fw_card *card, int irm_id,
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 0cf4d7f562c5..94b16e0340ae 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -1158,7 +1158,7 @@ static void handle_local_lock(struct fw_ohci *ohci,
1158 struct fw_packet *packet, u32 csr) 1158 struct fw_packet *packet, u32 csr)
1159{ 1159{
1160 struct fw_packet response; 1160 struct fw_packet response;
1161 int tcode, length, ext_tcode, sel; 1161 int tcode, length, ext_tcode, sel, try;
1162 __be32 *payload, lock_old; 1162 __be32 *payload, lock_old;
1163 u32 lock_arg, lock_data; 1163 u32 lock_arg, lock_data;
1164 1164
@@ -1185,21 +1185,26 @@ static void handle_local_lock(struct fw_ohci *ohci,
1185 reg_write(ohci, OHCI1394_CSRCompareData, lock_arg); 1185 reg_write(ohci, OHCI1394_CSRCompareData, lock_arg);
1186 reg_write(ohci, OHCI1394_CSRControl, sel); 1186 reg_write(ohci, OHCI1394_CSRControl, sel);
1187 1187
1188 if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) 1188 for (try = 0; try < 20; try++)
1189 lock_old = cpu_to_be32(reg_read(ohci, OHCI1394_CSRData)); 1189 if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) {
1190 else 1190 lock_old = cpu_to_be32(reg_read(ohci,
1191 fw_notify("swap not done yet\n"); 1191 OHCI1394_CSRData));
1192 fw_fill_response(&response, packet->header,
1193 RCODE_COMPLETE,
1194 &lock_old, sizeof(lock_old));
1195 goto out;
1196 }
1197
1198 fw_error("swap not done (CSR lock timeout)\n");
1199 fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0);
1192 1200
1193 fw_fill_response(&response, packet->header,
1194 RCODE_COMPLETE, &lock_old, sizeof(lock_old));
1195 out: 1201 out:
1196 fw_core_handle_response(&ohci->card, &response); 1202 fw_core_handle_response(&ohci->card, &response);
1197} 1203}
1198 1204
1199static void handle_local_request(struct context *ctx, struct fw_packet *packet) 1205static void handle_local_request(struct context *ctx, struct fw_packet *packet)
1200{ 1206{
1201 u64 offset; 1207 u64 offset, csr;
1202 u32 csr;
1203 1208
1204 if (ctx == &ctx->ohci->at_request_ctx) { 1209 if (ctx == &ctx->ohci->at_request_ctx) {
1205 packet->ack = ACK_PENDING; 1210 packet->ack = ACK_PENDING;
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 76be229c814d..eb0c3fe44b29 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -416,7 +416,8 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
416 return 0; 416 return 0;
417 417
418free_sd: 418free_sd:
419 sysfs_put(pdesc->value_sd); 419 if (pdesc)
420 sysfs_put(pdesc->value_sd);
420free_id: 421free_id:
421 idr_remove(&pdesc_idr, id); 422 idr_remove(&pdesc_idr, id);
422 desc->flags &= GPIO_FLAGS_MASK; 423 desc->flags &= GPIO_FLAGS_MASK;
diff --git a/drivers/gpio/it8761e_gpio.c b/drivers/gpio/it8761e_gpio.c
index 753219cf993a..41a9388f2fde 100644
--- a/drivers/gpio/it8761e_gpio.c
+++ b/drivers/gpio/it8761e_gpio.c
@@ -80,8 +80,8 @@ static int it8761e_gpio_get(struct gpio_chip *gc, unsigned gpio_num)
80 u16 reg; 80 u16 reg;
81 u8 bit; 81 u8 bit;
82 82
83 bit = gpio_num % 7; 83 bit = gpio_num % 8;
84 reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba; 84 reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;
85 85
86 return !!(inb(reg) & (1 << bit)); 86 return !!(inb(reg) & (1 << bit));
87} 87}
@@ -91,8 +91,8 @@ static int it8761e_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num)
91 u8 curr_dirs; 91 u8 curr_dirs;
92 u8 io_reg, bit; 92 u8 io_reg, bit;
93 93
94 bit = gpio_num % 7; 94 bit = gpio_num % 8;
95 io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO; 95 io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;
96 96
97 spin_lock(&sio_lock); 97 spin_lock(&sio_lock);
98 98
@@ -116,8 +116,8 @@ static void it8761e_gpio_set(struct gpio_chip *gc,
116 u8 curr_vals, bit; 116 u8 curr_vals, bit;
117 u16 reg; 117 u16 reg;
118 118
119 bit = gpio_num % 7; 119 bit = gpio_num % 8;
120 reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba; 120 reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;
121 121
122 spin_lock(&sio_lock); 122 spin_lock(&sio_lock);
123 123
@@ -135,8 +135,8 @@ static int it8761e_gpio_direction_out(struct gpio_chip *gc,
135{ 135{
136 u8 curr_dirs, io_reg, bit; 136 u8 curr_dirs, io_reg, bit;
137 137
138 bit = gpio_num % 7; 138 bit = gpio_num % 8;
139 io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO; 139 io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;
140 140
141 it8761e_gpio_set(gc, gpio_num, val); 141 it8761e_gpio_set(gc, gpio_num, val);
142 142
@@ -200,7 +200,7 @@ static int __init it8761e_gpio_init(void)
200 return -EBUSY; 200 return -EBUSY;
201 201
202 it8761e_gpio_chip.base = -1; 202 it8761e_gpio_chip.base = -1;
203 it8761e_gpio_chip.ngpio = 14; 203 it8761e_gpio_chip.ngpio = 16;
204 204
205 err = gpiochip_add(&it8761e_gpio_chip); 205 err = gpiochip_add(&it8761e_gpio_chip);
206 if (err < 0) 206 if (err < 0)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 7d521e1d17e1..b827c976dc62 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -252,6 +252,18 @@ static void pca953x_irq_bus_lock(unsigned int irq)
252static void pca953x_irq_bus_sync_unlock(unsigned int irq) 252static void pca953x_irq_bus_sync_unlock(unsigned int irq)
253{ 253{
254 struct pca953x_chip *chip = get_irq_chip_data(irq); 254 struct pca953x_chip *chip = get_irq_chip_data(irq);
255 uint16_t new_irqs;
256 uint16_t level;
257
258 /* Look for any newly setup interrupt */
259 new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
260 new_irqs &= ~chip->reg_direction;
261
262 while (new_irqs) {
263 level = __ffs(new_irqs);
264 pca953x_gpio_direction_input(&chip->gpio_chip, level);
265 new_irqs &= ~(1 << level);
266 }
255 267
256 mutex_unlock(&chip->irq_lock); 268 mutex_unlock(&chip->irq_lock);
257} 269}
@@ -278,7 +290,7 @@ static int pca953x_irq_set_type(unsigned int irq, unsigned int type)
278 else 290 else
279 chip->irq_trig_raise &= ~mask; 291 chip->irq_trig_raise &= ~mask;
280 292
281 return pca953x_gpio_direction_input(&chip->gpio_chip, level); 293 return 0;
282} 294}
283 295
284static struct irq_chip pca953x_irq_chip = { 296static struct irq_chip pca953x_irq_chip = {
diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c
index 5ad8f778ced4..105701a1f05b 100644
--- a/drivers/gpio/pl061.c
+++ b/drivers/gpio/pl061.c
@@ -91,6 +91,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
91 gpiodir = readb(chip->base + GPIODIR); 91 gpiodir = readb(chip->base + GPIODIR);
92 gpiodir |= 1 << offset; 92 gpiodir |= 1 << offset;
93 writeb(gpiodir, chip->base + GPIODIR); 93 writeb(gpiodir, chip->base + GPIODIR);
94
95 /*
96 * gpio value is set again, because pl061 doesn't allow to set value of
97 * a gpio pin before configuring it in OUT mode.
98 */
99 writeb(!!value << offset, chip->base + (1 << (offset + 2)));
94 spin_unlock_irqrestore(&chip->lock, flags); 100 spin_unlock_irqrestore(&chip->lock, flags);
95 101
96 return 0; 102 return 0;
@@ -183,7 +189,7 @@ static int pl061_irq_type(unsigned irq, unsigned trigger)
183 gpioibe &= ~(1 << offset); 189 gpioibe &= ~(1 << offset);
184 if (trigger & IRQ_TYPE_EDGE_RISING) 190 if (trigger & IRQ_TYPE_EDGE_RISING)
185 gpioiev |= 1 << offset; 191 gpioiev |= 1 << offset;
186 else 192 else if (trigger & IRQ_TYPE_EDGE_FALLING)
187 gpioiev &= ~(1 << offset); 193 gpioiev &= ~(1 << offset);
188 } 194 }
189 writeb(gpioibe, chip->base + GPIOIBE); 195 writeb(gpioibe, chip->base + GPIOIBE);
@@ -204,7 +210,7 @@ static struct irq_chip pl061_irqchip = {
204 210
205static void pl061_irq_handler(unsigned irq, struct irq_desc *desc) 211static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
206{ 212{
207 struct list_head *chip_list = get_irq_chip_data(irq); 213 struct list_head *chip_list = get_irq_data(irq);
208 struct list_head *ptr; 214 struct list_head *ptr;
209 struct pl061_gpio *chip; 215 struct pl061_gpio *chip;
210 216
@@ -297,9 +303,9 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
297 goto iounmap; 303 goto iounmap;
298 } 304 }
299 INIT_LIST_HEAD(chip_list); 305 INIT_LIST_HEAD(chip_list);
300 set_irq_chip_data(irq, chip_list); 306 set_irq_data(irq, chip_list);
301 } else 307 } else
302 chip_list = get_irq_chip_data(irq); 308 chip_list = get_irq_data(irq);
303 list_add(&chip->list, chip_list); 309 list_add(&chip->list, chip_list);
304 310
305 for (i = 0; i < PL061_GPIO_NR; i++) { 311 for (i = 0; i < PL061_GPIO_NR; i++) {
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 3bd872761567..a263b7070fc6 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -476,6 +476,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
476 unsigned long irqflags; 476 unsigned long irqflags;
477 477
478 spin_lock_irqsave(&dev->vbl_lock, irqflags); 478 spin_lock_irqsave(&dev->vbl_lock, irqflags);
479 dev->driver->disable_vblank(dev, crtc);
479 DRM_WAKEUP(&dev->vbl_queue[crtc]); 480 DRM_WAKEUP(&dev->vbl_queue[crtc]);
480 dev->vblank_enabled[crtc] = 0; 481 dev->vblank_enabled[crtc] = 0;
481 dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc); 482 dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc);
diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index e4865f99989c..7732268eced2 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -77,7 +77,7 @@ static void *agp_remap(unsigned long offset, unsigned long size,
77 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >= 77 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
78 (offset + size)) 78 (offset + size))
79 break; 79 break;
80 if (!agpmem) 80 if (&agpmem->head == &dev->agp->memory)
81 return NULL; 81 return NULL;
82 82
83 /* 83 /*
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 1a1825b29f5f..25bbd30ed7af 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -354,7 +354,10 @@ static struct bin_attribute edid_attr = {
354int drm_sysfs_connector_add(struct drm_connector *connector) 354int drm_sysfs_connector_add(struct drm_connector *connector)
355{ 355{
356 struct drm_device *dev = connector->dev; 356 struct drm_device *dev = connector->dev;
357 int ret = 0, i, j; 357 int attr_cnt = 0;
358 int opt_cnt = 0;
359 int i;
360 int ret = 0;
358 361
359 /* We shouldn't get called more than once for the same connector */ 362 /* We shouldn't get called more than once for the same connector */
360 BUG_ON(device_is_registered(&connector->kdev)); 363 BUG_ON(device_is_registered(&connector->kdev));
@@ -377,8 +380,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
377 380
378 /* Standard attributes */ 381 /* Standard attributes */
379 382
380 for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) { 383 for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) {
381 ret = device_create_file(&connector->kdev, &connector_attrs[i]); 384 ret = device_create_file(&connector->kdev, &connector_attrs[attr_cnt]);
382 if (ret) 385 if (ret)
383 goto err_out_files; 386 goto err_out_files;
384 } 387 }
@@ -394,8 +397,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
394 case DRM_MODE_CONNECTOR_SVIDEO: 397 case DRM_MODE_CONNECTOR_SVIDEO:
395 case DRM_MODE_CONNECTOR_Component: 398 case DRM_MODE_CONNECTOR_Component:
396 case DRM_MODE_CONNECTOR_TV: 399 case DRM_MODE_CONNECTOR_TV:
397 for (i = 0; i < ARRAY_SIZE(connector_attrs_opt1); i++) { 400 for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) {
398 ret = device_create_file(&connector->kdev, &connector_attrs_opt1[i]); 401 ret = device_create_file(&connector->kdev, &connector_attrs_opt1[opt_cnt]);
399 if (ret) 402 if (ret)
400 goto err_out_files; 403 goto err_out_files;
401 } 404 }
@@ -414,10 +417,10 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
414 return 0; 417 return 0;
415 418
416err_out_files: 419err_out_files:
417 if (i > 0) 420 for (i = 0; i < opt_cnt; i++)
418 for (j = 0; j < i; j++) 421 device_remove_file(&connector->kdev, &connector_attrs_opt1[i]);
419 device_remove_file(&connector->kdev, 422 for (i = 0; i < attr_cnt; i++)
420 &connector_attrs[i]); 423 device_remove_file(&connector->kdev, &connector_attrs[i]);
421 device_unregister(&connector->kdev); 424 device_unregister(&connector->kdev);
422 425
423out: 426out:
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 2dc93939507d..c3cfafcbfe7d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1357,6 +1357,8 @@ static void i915_setup_compression(struct drm_device *dev, int size)
1357 1357
1358 dev_priv->cfb_size = size; 1358 dev_priv->cfb_size = size;
1359 1359
1360 dev_priv->compressed_fb = compressed_fb;
1361
1360 if (IS_GM45(dev)) { 1362 if (IS_GM45(dev)) {
1361 g4x_disable_fbc(dev); 1363 g4x_disable_fbc(dev);
1362 I915_WRITE(DPFC_CB_BASE, compressed_fb->start); 1364 I915_WRITE(DPFC_CB_BASE, compressed_fb->start);
@@ -1364,12 +1366,22 @@ static void i915_setup_compression(struct drm_device *dev, int size)
1364 i8xx_disable_fbc(dev); 1366 i8xx_disable_fbc(dev);
1365 I915_WRITE(FBC_CFB_BASE, cfb_base); 1367 I915_WRITE(FBC_CFB_BASE, cfb_base);
1366 I915_WRITE(FBC_LL_BASE, ll_base); 1368 I915_WRITE(FBC_LL_BASE, ll_base);
1369 dev_priv->compressed_llb = compressed_llb;
1367 } 1370 }
1368 1371
1369 DRM_DEBUG("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n", cfb_base, 1372 DRM_DEBUG("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n", cfb_base,
1370 ll_base, size >> 20); 1373 ll_base, size >> 20);
1371} 1374}
1372 1375
1376static void i915_cleanup_compression(struct drm_device *dev)
1377{
1378 struct drm_i915_private *dev_priv = dev->dev_private;
1379
1380 drm_mm_put_block(dev_priv->compressed_fb);
1381 if (!IS_GM45(dev))
1382 drm_mm_put_block(dev_priv->compressed_llb);
1383}
1384
1373/* true = enable decode, false = disable decoder */ 1385/* true = enable decode, false = disable decoder */
1374static unsigned int i915_vga_set_decode(void *cookie, bool state) 1386static unsigned int i915_vga_set_decode(void *cookie, bool state)
1375{ 1387{
@@ -1787,6 +1799,8 @@ int i915_driver_unload(struct drm_device *dev)
1787 mutex_lock(&dev->struct_mutex); 1799 mutex_lock(&dev->struct_mutex);
1788 i915_gem_cleanup_ringbuffer(dev); 1800 i915_gem_cleanup_ringbuffer(dev);
1789 mutex_unlock(&dev->struct_mutex); 1801 mutex_unlock(&dev->struct_mutex);
1802 if (I915_HAS_FBC(dev) && i915_powersave)
1803 i915_cleanup_compression(dev);
1790 drm_mm_takedown(&dev_priv->vram); 1804 drm_mm_takedown(&dev_priv->vram);
1791 i915_gem_lastclose(dev); 1805 i915_gem_lastclose(dev);
1792 1806
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 0af3dcc85ce9..cc03537bb883 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -69,7 +69,8 @@ const static struct intel_device_info intel_845g_info = {
69}; 69};
70 70
71const static struct intel_device_info intel_i85x_info = { 71const static struct intel_device_info intel_i85x_info = {
72 .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, 72 .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1,
73 .cursor_needs_physical = 1,
73}; 74};
74 75
75const static struct intel_device_info intel_i865g_info = { 76const static struct intel_device_info intel_i865g_info = {
@@ -151,7 +152,7 @@ const static struct pci_device_id pciidlist[] = {
151 INTEL_VGA_DEVICE(0x3577, &intel_i830_info), 152 INTEL_VGA_DEVICE(0x3577, &intel_i830_info),
152 INTEL_VGA_DEVICE(0x2562, &intel_845g_info), 153 INTEL_VGA_DEVICE(0x2562, &intel_845g_info),
153 INTEL_VGA_DEVICE(0x3582, &intel_i85x_info), 154 INTEL_VGA_DEVICE(0x3582, &intel_i85x_info),
154 INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info), 155 INTEL_VGA_DEVICE(0x358e, &intel_i85x_info),
155 INTEL_VGA_DEVICE(0x2572, &intel_i865g_info), 156 INTEL_VGA_DEVICE(0x2572, &intel_i865g_info),
156 INTEL_VGA_DEVICE(0x2582, &intel_i915g_info), 157 INTEL_VGA_DEVICE(0x2582, &intel_i915g_info),
157 INTEL_VGA_DEVICE(0x258a, &intel_i915g_info), 158 INTEL_VGA_DEVICE(0x258a, &intel_i915g_info),
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6960849522f8..6e4790065d9e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -195,6 +195,7 @@ struct intel_overlay;
195struct intel_device_info { 195struct intel_device_info {
196 u8 is_mobile : 1; 196 u8 is_mobile : 1;
197 u8 is_i8xx : 1; 197 u8 is_i8xx : 1;
198 u8 is_i85x : 1;
198 u8 is_i915g : 1; 199 u8 is_i915g : 1;
199 u8 is_i9xx : 1; 200 u8 is_i9xx : 1;
200 u8 is_i945gm : 1; 201 u8 is_i945gm : 1;
@@ -235,11 +236,14 @@ typedef struct drm_i915_private {
235 236
236 drm_dma_handle_t *status_page_dmah; 237 drm_dma_handle_t *status_page_dmah;
237 void *hw_status_page; 238 void *hw_status_page;
239 void *seqno_page;
238 dma_addr_t dma_status_page; 240 dma_addr_t dma_status_page;
239 uint32_t counter; 241 uint32_t counter;
240 unsigned int status_gfx_addr; 242 unsigned int status_gfx_addr;
243 unsigned int seqno_gfx_addr;
241 drm_local_map_t hws_map; 244 drm_local_map_t hws_map;
242 struct drm_gem_object *hws_obj; 245 struct drm_gem_object *hws_obj;
246 struct drm_gem_object *seqno_obj;
243 struct drm_gem_object *pwrctx; 247 struct drm_gem_object *pwrctx;
244 248
245 struct resource mch_res; 249 struct resource mch_res;
@@ -630,6 +634,9 @@ typedef struct drm_i915_private {
630 u8 max_delay; 634 u8 max_delay;
631 635
632 enum no_fbc_reason no_fbc_reason; 636 enum no_fbc_reason no_fbc_reason;
637
638 struct drm_mm_node *compressed_fb;
639 struct drm_mm_node *compressed_llb;
633} drm_i915_private_t; 640} drm_i915_private_t;
634 641
635/** driver private structure attached to each drm_gem_object */ 642/** driver private structure attached to each drm_gem_object */
@@ -1070,7 +1077,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1070 1077
1071#define IS_I830(dev) ((dev)->pci_device == 0x3577) 1078#define IS_I830(dev) ((dev)->pci_device == 0x3577)
1072#define IS_845G(dev) ((dev)->pci_device == 0x2562) 1079#define IS_845G(dev) ((dev)->pci_device == 0x2562)
1073#define IS_I85X(dev) ((dev)->pci_device == 0x3582) 1080#define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
1074#define IS_I865G(dev) ((dev)->pci_device == 0x2572) 1081#define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1075#define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx) 1082#define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx)
1076#define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) 1083#define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
@@ -1135,6 +1142,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1135 1142
1136#define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \ 1143#define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
1137 IS_GEN6(dev)) 1144 IS_GEN6(dev))
1145#define HAS_PIPE_CONTROL(dev) (IS_IRONLAKE(dev) || IS_GEN6(dev))
1138 1146
1139#define PRIMARY_RINGBUFFER_SIZE (128*1024) 1147#define PRIMARY_RINGBUFFER_SIZE (128*1024)
1140 1148
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 80871c62a571..ef3d91dda71a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1588,6 +1588,13 @@ i915_gem_process_flushing_list(struct drm_device *dev,
1588 } 1588 }
1589} 1589}
1590 1590
1591#define PIPE_CONTROL_FLUSH(addr) \
1592 OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE | \
1593 PIPE_CONTROL_DEPTH_STALL); \
1594 OUT_RING(addr | PIPE_CONTROL_GLOBAL_GTT); \
1595 OUT_RING(0); \
1596 OUT_RING(0); \
1597
1591/** 1598/**
1592 * Creates a new sequence number, emitting a write of it to the status page 1599 * Creates a new sequence number, emitting a write of it to the status page
1593 * plus an interrupt, which will trigger i915_user_interrupt_handler. 1600 * plus an interrupt, which will trigger i915_user_interrupt_handler.
@@ -1622,13 +1629,47 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
1622 if (dev_priv->mm.next_gem_seqno == 0) 1629 if (dev_priv->mm.next_gem_seqno == 0)
1623 dev_priv->mm.next_gem_seqno++; 1630 dev_priv->mm.next_gem_seqno++;
1624 1631
1625 BEGIN_LP_RING(4); 1632 if (HAS_PIPE_CONTROL(dev)) {
1626 OUT_RING(MI_STORE_DWORD_INDEX); 1633 u32 scratch_addr = dev_priv->seqno_gfx_addr + 128;
1627 OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
1628 OUT_RING(seqno);
1629 1634
1630 OUT_RING(MI_USER_INTERRUPT); 1635 /*
1631 ADVANCE_LP_RING(); 1636 * Workaround qword write incoherence by flushing the
1637 * PIPE_NOTIFY buffers out to memory before requesting
1638 * an interrupt.
1639 */
1640 BEGIN_LP_RING(32);
1641 OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
1642 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH);
1643 OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
1644 OUT_RING(seqno);
1645 OUT_RING(0);
1646 PIPE_CONTROL_FLUSH(scratch_addr);
1647 scratch_addr += 128; /* write to separate cachelines */
1648 PIPE_CONTROL_FLUSH(scratch_addr);
1649 scratch_addr += 128;
1650 PIPE_CONTROL_FLUSH(scratch_addr);
1651 scratch_addr += 128;
1652 PIPE_CONTROL_FLUSH(scratch_addr);
1653 scratch_addr += 128;
1654 PIPE_CONTROL_FLUSH(scratch_addr);
1655 scratch_addr += 128;
1656 PIPE_CONTROL_FLUSH(scratch_addr);
1657 OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
1658 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH |
1659 PIPE_CONTROL_NOTIFY);
1660 OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
1661 OUT_RING(seqno);
1662 OUT_RING(0);
1663 ADVANCE_LP_RING();
1664 } else {
1665 BEGIN_LP_RING(4);
1666 OUT_RING(MI_STORE_DWORD_INDEX);
1667 OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
1668 OUT_RING(seqno);
1669
1670 OUT_RING(MI_USER_INTERRUPT);
1671 ADVANCE_LP_RING();
1672 }
1632 1673
1633 DRM_DEBUG_DRIVER("%d\n", seqno); 1674 DRM_DEBUG_DRIVER("%d\n", seqno);
1634 1675
@@ -1752,7 +1793,10 @@ i915_get_gem_seqno(struct drm_device *dev)
1752{ 1793{
1753 drm_i915_private_t *dev_priv = dev->dev_private; 1794 drm_i915_private_t *dev_priv = dev->dev_private;
1754 1795
1755 return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX); 1796 if (HAS_PIPE_CONTROL(dev))
1797 return ((volatile u32 *)(dev_priv->seqno_page))[0];
1798 else
1799 return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
1756} 1800}
1757 1801
1758/** 1802/**
@@ -2362,6 +2406,12 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
2362 pitch_val = obj_priv->stride / tile_width; 2406 pitch_val = obj_priv->stride / tile_width;
2363 pitch_val = ffs(pitch_val) - 1; 2407 pitch_val = ffs(pitch_val) - 1;
2364 2408
2409 if (obj_priv->tiling_mode == I915_TILING_Y &&
2410 HAS_128_BYTE_Y_TILING(dev))
2411 WARN_ON(pitch_val > I830_FENCE_MAX_PITCH_VAL);
2412 else
2413 WARN_ON(pitch_val > I915_FENCE_MAX_PITCH_VAL);
2414
2365 val = obj_priv->gtt_offset; 2415 val = obj_priv->gtt_offset;
2366 if (obj_priv->tiling_mode == I915_TILING_Y) 2416 if (obj_priv->tiling_mode == I915_TILING_Y)
2367 val |= 1 << I830_FENCE_TILING_Y_SHIFT; 2417 val |= 1 << I830_FENCE_TILING_Y_SHIFT;
@@ -4546,6 +4596,49 @@ i915_gem_idle(struct drm_device *dev)
4546 return 0; 4596 return 0;
4547} 4597}
4548 4598
4599/*
4600 * 965+ support PIPE_CONTROL commands, which provide finer grained control
4601 * over cache flushing.
4602 */
4603static int
4604i915_gem_init_pipe_control(struct drm_device *dev)
4605{
4606 drm_i915_private_t *dev_priv = dev->dev_private;
4607 struct drm_gem_object *obj;
4608 struct drm_i915_gem_object *obj_priv;
4609 int ret;
4610
4611 obj = drm_gem_object_alloc(dev, 4096);
4612 if (obj == NULL) {
4613 DRM_ERROR("Failed to allocate seqno page\n");
4614 ret = -ENOMEM;
4615 goto err;
4616 }
4617 obj_priv = to_intel_bo(obj);
4618 obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
4619
4620 ret = i915_gem_object_pin(obj, 4096);
4621 if (ret)
4622 goto err_unref;
4623
4624 dev_priv->seqno_gfx_addr = obj_priv->gtt_offset;
4625 dev_priv->seqno_page = kmap(obj_priv->pages[0]);
4626 if (dev_priv->seqno_page == NULL)
4627 goto err_unpin;
4628
4629 dev_priv->seqno_obj = obj;
4630 memset(dev_priv->seqno_page, 0, PAGE_SIZE);
4631
4632 return 0;
4633
4634err_unpin:
4635 i915_gem_object_unpin(obj);
4636err_unref:
4637 drm_gem_object_unreference(obj);
4638err:
4639 return ret;
4640}
4641
4549static int 4642static int
4550i915_gem_init_hws(struct drm_device *dev) 4643i915_gem_init_hws(struct drm_device *dev)
4551{ 4644{
@@ -4563,7 +4656,8 @@ i915_gem_init_hws(struct drm_device *dev)
4563 obj = drm_gem_object_alloc(dev, 4096); 4656 obj = drm_gem_object_alloc(dev, 4096);
4564 if (obj == NULL) { 4657 if (obj == NULL) {
4565 DRM_ERROR("Failed to allocate status page\n"); 4658 DRM_ERROR("Failed to allocate status page\n");
4566 return -ENOMEM; 4659 ret = -ENOMEM;
4660 goto err;
4567 } 4661 }
4568 obj_priv = to_intel_bo(obj); 4662 obj_priv = to_intel_bo(obj);
4569 obj_priv->agp_type = AGP_USER_CACHED_MEMORY; 4663 obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
@@ -4571,7 +4665,7 @@ i915_gem_init_hws(struct drm_device *dev)
4571 ret = i915_gem_object_pin(obj, 4096); 4665 ret = i915_gem_object_pin(obj, 4096);
4572 if (ret != 0) { 4666 if (ret != 0) {
4573 drm_gem_object_unreference(obj); 4667 drm_gem_object_unreference(obj);
4574 return ret; 4668 goto err_unref;
4575 } 4669 }
4576 4670
4577 dev_priv->status_gfx_addr = obj_priv->gtt_offset; 4671 dev_priv->status_gfx_addr = obj_priv->gtt_offset;
@@ -4580,10 +4674,16 @@ i915_gem_init_hws(struct drm_device *dev)
4580 if (dev_priv->hw_status_page == NULL) { 4674 if (dev_priv->hw_status_page == NULL) {
4581 DRM_ERROR("Failed to map status page.\n"); 4675 DRM_ERROR("Failed to map status page.\n");
4582 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); 4676 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
4583 i915_gem_object_unpin(obj); 4677 ret = -EINVAL;
4584 drm_gem_object_unreference(obj); 4678 goto err_unpin;
4585 return -EINVAL;
4586 } 4679 }
4680
4681 if (HAS_PIPE_CONTROL(dev)) {
4682 ret = i915_gem_init_pipe_control(dev);
4683 if (ret)
4684 goto err_unpin;
4685 }
4686
4587 dev_priv->hws_obj = obj; 4687 dev_priv->hws_obj = obj;
4588 memset(dev_priv->hw_status_page, 0, PAGE_SIZE); 4688 memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
4589 if (IS_GEN6(dev)) { 4689 if (IS_GEN6(dev)) {
@@ -4596,6 +4696,30 @@ i915_gem_init_hws(struct drm_device *dev)
4596 DRM_DEBUG_DRIVER("hws offset: 0x%08x\n", dev_priv->status_gfx_addr); 4696 DRM_DEBUG_DRIVER("hws offset: 0x%08x\n", dev_priv->status_gfx_addr);
4597 4697
4598 return 0; 4698 return 0;
4699
4700err_unpin:
4701 i915_gem_object_unpin(obj);
4702err_unref:
4703 drm_gem_object_unreference(obj);
4704err:
4705 return 0;
4706}
4707
4708static void
4709i915_gem_cleanup_pipe_control(struct drm_device *dev)
4710{
4711 drm_i915_private_t *dev_priv = dev->dev_private;
4712 struct drm_gem_object *obj;
4713 struct drm_i915_gem_object *obj_priv;
4714
4715 obj = dev_priv->seqno_obj;
4716 obj_priv = to_intel_bo(obj);
4717 kunmap(obj_priv->pages[0]);
4718 i915_gem_object_unpin(obj);
4719 drm_gem_object_unreference(obj);
4720 dev_priv->seqno_obj = NULL;
4721
4722 dev_priv->seqno_page = NULL;
4599} 4723}
4600 4724
4601static void 4725static void
@@ -4619,6 +4743,9 @@ i915_gem_cleanup_hws(struct drm_device *dev)
4619 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); 4743 memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
4620 dev_priv->hw_status_page = NULL; 4744 dev_priv->hw_status_page = NULL;
4621 4745
4746 if (HAS_PIPE_CONTROL(dev))
4747 i915_gem_cleanup_pipe_control(dev);
4748
4622 /* Write high address into HWS_PGA when disabling. */ 4749 /* Write high address into HWS_PGA when disabling. */
4623 I915_WRITE(HWS_PGA, 0x1ffff000); 4750 I915_WRITE(HWS_PGA, 0x1ffff000);
4624} 4751}
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index 449157f71610..4bdccefcf2cf 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -202,21 +202,17 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
202 * reg, so dont bother to check the size */ 202 * reg, so dont bother to check the size */
203 if (stride / 128 > I965_FENCE_MAX_PITCH_VAL) 203 if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
204 return false; 204 return false;
205 } else if (IS_I9XX(dev)) { 205 } else if (IS_GEN3(dev) || IS_GEN2(dev)) {
206 uint32_t pitch_val = ffs(stride / tile_width) - 1; 206 if (stride > 8192)
207
208 /* XXX: For Y tiling, FENCE_MAX_PITCH_VAL is actually 6 (8KB)
209 * instead of 4 (2KB) on 945s.
210 */
211 if (pitch_val > I915_FENCE_MAX_PITCH_VAL ||
212 size > (I830_FENCE_MAX_SIZE_VAL << 20))
213 return false; 207 return false;
214 } else {
215 uint32_t pitch_val = ffs(stride / tile_width) - 1;
216 208
217 if (pitch_val > I830_FENCE_MAX_PITCH_VAL || 209 if (IS_GEN3(dev)) {
218 size > (I830_FENCE_MAX_SIZE_VAL << 19)) 210 if (size > I830_FENCE_MAX_SIZE_VAL << 20)
219 return false; 211 return false;
212 } else {
213 if (size > I830_FENCE_MAX_SIZE_VAL << 19)
214 return false;
215 }
220 } 216 }
221 217
222 /* 965+ just needs multiples of tile width */ 218 /* 965+ just needs multiples of tile width */
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 6421481d6222..df6a9cd82c4d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -349,7 +349,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
349 READ_BREADCRUMB(dev_priv); 349 READ_BREADCRUMB(dev_priv);
350 } 350 }
351 351
352 if (gt_iir & GT_USER_INTERRUPT) { 352 if (gt_iir & GT_PIPE_NOTIFY) {
353 u32 seqno = i915_get_gem_seqno(dev); 353 u32 seqno = i915_get_gem_seqno(dev);
354 dev_priv->mm.irq_gem_seqno = seqno; 354 dev_priv->mm.irq_gem_seqno = seqno;
355 trace_i915_gem_request_complete(dev, seqno); 355 trace_i915_gem_request_complete(dev, seqno);
@@ -456,11 +456,15 @@ i915_error_object_create(struct drm_device *dev,
456 456
457 for (page = 0; page < page_count; page++) { 457 for (page = 0; page < page_count; page++) {
458 void *s, *d = kmalloc(PAGE_SIZE, GFP_ATOMIC); 458 void *s, *d = kmalloc(PAGE_SIZE, GFP_ATOMIC);
459 unsigned long flags;
460
459 if (d == NULL) 461 if (d == NULL)
460 goto unwind; 462 goto unwind;
461 s = kmap_atomic(src_priv->pages[page], KM_USER0); 463 local_irq_save(flags);
464 s = kmap_atomic(src_priv->pages[page], KM_IRQ0);
462 memcpy(d, s, PAGE_SIZE); 465 memcpy(d, s, PAGE_SIZE);
463 kunmap_atomic(s, KM_USER0); 466 kunmap_atomic(s, KM_IRQ0);
467 local_irq_restore(flags);
464 dst->pages[page] = d; 468 dst->pages[page] = d;
465 } 469 }
466 dst->page_count = page_count; 470 dst->page_count = page_count;
@@ -1005,7 +1009,7 @@ void i915_user_irq_get(struct drm_device *dev)
1005 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags); 1009 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
1006 if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) { 1010 if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) {
1007 if (HAS_PCH_SPLIT(dev)) 1011 if (HAS_PCH_SPLIT(dev))
1008 ironlake_enable_graphics_irq(dev_priv, GT_USER_INTERRUPT); 1012 ironlake_enable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
1009 else 1013 else
1010 i915_enable_irq(dev_priv, I915_USER_INTERRUPT); 1014 i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
1011 } 1015 }
@@ -1021,7 +1025,7 @@ void i915_user_irq_put(struct drm_device *dev)
1021 BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0); 1025 BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
1022 if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) { 1026 if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
1023 if (HAS_PCH_SPLIT(dev)) 1027 if (HAS_PCH_SPLIT(dev))
1024 ironlake_disable_graphics_irq(dev_priv, GT_USER_INTERRUPT); 1028 ironlake_disable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
1025 else 1029 else
1026 i915_disable_irq(dev_priv, I915_USER_INTERRUPT); 1030 i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
1027 } 1031 }
@@ -1305,7 +1309,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1305 /* enable kind of interrupts always enabled */ 1309 /* enable kind of interrupts always enabled */
1306 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | 1310 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
1307 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; 1311 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
1308 u32 render_mask = GT_USER_INTERRUPT; 1312 u32 render_mask = GT_PIPE_NOTIFY;
1309 u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | 1313 u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
1310 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; 1314 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1311 1315
diff --git a/drivers/gpu/drm/i915/i915_opregion.c b/drivers/gpu/drm/i915/i915_opregion.c
index 7cc8410239cb..8fcc75c1aa28 100644
--- a/drivers/gpu/drm/i915/i915_opregion.c
+++ b/drivers/gpu/drm/i915/i915_opregion.c
@@ -382,8 +382,57 @@ static void intel_didl_outputs(struct drm_device *dev)
382 struct drm_i915_private *dev_priv = dev->dev_private; 382 struct drm_i915_private *dev_priv = dev->dev_private;
383 struct intel_opregion *opregion = &dev_priv->opregion; 383 struct intel_opregion *opregion = &dev_priv->opregion;
384 struct drm_connector *connector; 384 struct drm_connector *connector;
385 acpi_handle handle;
386 struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
387 unsigned long long device_id;
388 acpi_status status;
385 int i = 0; 389 int i = 0;
386 390
391 handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
392 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev)))
393 return;
394
395 if (acpi_is_video_device(acpi_dev))
396 acpi_video_bus = acpi_dev;
397 else {
398 list_for_each_entry(acpi_cdev, &acpi_dev->children, node) {
399 if (acpi_is_video_device(acpi_cdev)) {
400 acpi_video_bus = acpi_cdev;
401 break;
402 }
403 }
404 }
405
406 if (!acpi_video_bus) {
407 printk(KERN_WARNING "No ACPI video bus found\n");
408 return;
409 }
410
411 list_for_each_entry(acpi_cdev, &acpi_video_bus->children, node) {
412 if (i >= 8) {
413 dev_printk (KERN_ERR, &dev->pdev->dev,
414 "More than 8 outputs detected\n");
415 return;
416 }
417 status =
418 acpi_evaluate_integer(acpi_cdev->handle, "_ADR",
419 NULL, &device_id);
420 if (ACPI_SUCCESS(status)) {
421 if (!device_id)
422 goto blind_set;
423 opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f);
424 i++;
425 }
426 }
427
428end:
429 /* If fewer than 8 outputs, the list must be null terminated */
430 if (i < 8)
431 opregion->acpi->didl[i] = 0;
432 return;
433
434blind_set:
435 i = 0;
387 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 436 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
388 int output_type = ACPI_OTHER_OUTPUT; 437 int output_type = ACPI_OTHER_OUTPUT;
389 if (i >= 8) { 438 if (i >= 8) {
@@ -416,10 +465,7 @@ static void intel_didl_outputs(struct drm_device *dev)
416 opregion->acpi->didl[i] |= (1<<31) | output_type | i; 465 opregion->acpi->didl[i] |= (1<<31) | output_type | i;
417 i++; 466 i++;
418 } 467 }
419 468 goto end;
420 /* If fewer than 8 outputs, the list must be null terminated */
421 if (i < 8)
422 opregion->acpi->didl[i] = 0;
423} 469}
424 470
425int intel_opregion_init(struct drm_device *dev, int resume) 471int intel_opregion_init(struct drm_device *dev, int resume)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index cbbf59f56dfa..4cbc5210fd30 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -230,6 +230,16 @@
230#define ASYNC_FLIP (1<<22) 230#define ASYNC_FLIP (1<<22)
231#define DISPLAY_PLANE_A (0<<20) 231#define DISPLAY_PLANE_A (0<<20)
232#define DISPLAY_PLANE_B (1<<20) 232#define DISPLAY_PLANE_B (1<<20)
233#define GFX_OP_PIPE_CONTROL ((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
234#define PIPE_CONTROL_QW_WRITE (1<<14)
235#define PIPE_CONTROL_DEPTH_STALL (1<<13)
236#define PIPE_CONTROL_WC_FLUSH (1<<12)
237#define PIPE_CONTROL_IS_FLUSH (1<<11) /* MBZ on Ironlake */
238#define PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
239#define PIPE_CONTROL_ISP_DIS (1<<9)
240#define PIPE_CONTROL_NOTIFY (1<<8)
241#define PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
242#define PIPE_CONTROL_STALL_EN (1<<1) /* in addr word, Ironlake+ only */
233 243
234/* 244/*
235 * Fence registers 245 * Fence registers
@@ -241,7 +251,7 @@
241#define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8) 251#define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
242#define I830_FENCE_PITCH_SHIFT 4 252#define I830_FENCE_PITCH_SHIFT 4
243#define I830_FENCE_REG_VALID (1<<0) 253#define I830_FENCE_REG_VALID (1<<0)
244#define I915_FENCE_MAX_PITCH_VAL 0x10 254#define I915_FENCE_MAX_PITCH_VAL 4
245#define I830_FENCE_MAX_PITCH_VAL 6 255#define I830_FENCE_MAX_PITCH_VAL 6
246#define I830_FENCE_MAX_SIZE_VAL (1<<8) 256#define I830_FENCE_MAX_SIZE_VAL (1<<8)
247 257
@@ -2285,6 +2295,7 @@
2285#define DEIER 0x4400c 2295#define DEIER 0x4400c
2286 2296
2287/* GT interrupt */ 2297/* GT interrupt */
2298#define GT_PIPE_NOTIFY (1 << 4)
2288#define GT_SYNC_STATUS (1 << 2) 2299#define GT_SYNC_STATUS (1 << 2)
2289#define GT_USER_INTERRUPT (1 << 0) 2300#define GT_USER_INTERRUPT (1 << 0)
2290 2301
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e7356fb6c918..c7502b6b1600 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4853,17 +4853,18 @@ static void intel_init_display(struct drm_device *dev)
4853 dev_priv->display.update_wm = g4x_update_wm; 4853 dev_priv->display.update_wm = g4x_update_wm;
4854 else if (IS_I965G(dev)) 4854 else if (IS_I965G(dev))
4855 dev_priv->display.update_wm = i965_update_wm; 4855 dev_priv->display.update_wm = i965_update_wm;
4856 else if (IS_I9XX(dev) || IS_MOBILE(dev)) { 4856 else if (IS_I9XX(dev)) {
4857 dev_priv->display.update_wm = i9xx_update_wm; 4857 dev_priv->display.update_wm = i9xx_update_wm;
4858 dev_priv->display.get_fifo_size = i9xx_get_fifo_size; 4858 dev_priv->display.get_fifo_size = i9xx_get_fifo_size;
4859 } else if (IS_I85X(dev)) {
4860 dev_priv->display.update_wm = i9xx_update_wm;
4861 dev_priv->display.get_fifo_size = i85x_get_fifo_size;
4859 } else { 4862 } else {
4860 if (IS_I85X(dev)) 4863 dev_priv->display.update_wm = i830_update_wm;
4861 dev_priv->display.get_fifo_size = i85x_get_fifo_size; 4864 if (IS_845G(dev))
4862 else if (IS_845G(dev))
4863 dev_priv->display.get_fifo_size = i845_get_fifo_size; 4865 dev_priv->display.get_fifo_size = i845_get_fifo_size;
4864 else 4866 else
4865 dev_priv->display.get_fifo_size = i830_get_fifo_size; 4867 dev_priv->display.get_fifo_size = i830_get_fifo_size;
4866 dev_priv->display.update_wm = i830_update_wm;
4867 } 4868 }
4868} 4869}
4869 4870
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h
index 6732b5dd8ff4..27e2c715be11 100644
--- a/drivers/gpu/drm/radeon/atombios.h
+++ b/drivers/gpu/drm/radeon/atombios.h
@@ -2912,7 +2912,7 @@ typedef struct _ATOM_ANALOG_TV_INFO_V1_2
2912 UCHAR ucTV_BootUpDefaultStandard; 2912 UCHAR ucTV_BootUpDefaultStandard;
2913 UCHAR ucExt_TV_ASIC_ID; 2913 UCHAR ucExt_TV_ASIC_ID;
2914 UCHAR ucExt_TV_ASIC_SlaveAddr; 2914 UCHAR ucExt_TV_ASIC_SlaveAddr;
2915 ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING]; 2915 ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING_V1_2];
2916}ATOM_ANALOG_TV_INFO_V1_2; 2916}ATOM_ANALOG_TV_INFO_V1_2;
2917 2917
2918typedef struct _ATOM_DPCD_INFO 2918typedef struct _ATOM_DPCD_INFO
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index d7388fdb6d0b..cf60c0b3ef15 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2975,7 +2975,7 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)
2975 2975
2976 for (i = 0; i < track->num_cb; i++) { 2976 for (i = 0; i < track->num_cb; i++) {
2977 if (track->cb[i].robj == NULL) { 2977 if (track->cb[i].robj == NULL) {
2978 if (!(track->fastfill || track->color_channel_mask || 2978 if (!(track->zb_cb_clear || track->color_channel_mask ||
2979 track->blend_read_enable)) { 2979 track->blend_read_enable)) {
2980 continue; 2980 continue;
2981 } 2981 }
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index fadfe68de9cc..f47cdca1c004 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -75,7 +75,7 @@ struct r100_cs_track {
75 struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; 75 struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE];
76 bool z_enabled; 76 bool z_enabled;
77 bool separate_cube; 77 bool separate_cube;
78 bool fastfill; 78 bool zb_cb_clear;
79 bool blend_read_enable; 79 bool blend_read_enable;
80}; 80};
81 81
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index bd75f99bd65e..a5ff8076b423 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -324,13 +324,12 @@ void r300_gpu_init(struct radeon_device *rdev)
324 uint32_t gb_tile_config, tmp; 324 uint32_t gb_tile_config, tmp;
325 325
326 r100_hdp_reset(rdev); 326 r100_hdp_reset(rdev);
327 /* FIXME: rv380 one pipes ? */
328 if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) || 327 if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) ||
329 (rdev->family == CHIP_R350)) { 328 (rdev->family == CHIP_R350 && rdev->pdev->device != 0x4148)) {
330 /* r300,r350 */ 329 /* r300,r350 */
331 rdev->num_gb_pipes = 2; 330 rdev->num_gb_pipes = 2;
332 } else { 331 } else {
333 /* rv350,rv370,rv380,r300 AD */ 332 /* rv350,rv370,rv380,r300 AD, r350 AH */
334 rdev->num_gb_pipes = 1; 333 rdev->num_gb_pipes = 1;
335 } 334 }
336 rdev->num_z_pipes = 1; 335 rdev->num_z_pipes = 1;
@@ -1045,7 +1044,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
1045 break; 1044 break;
1046 case 0x4d1c: 1045 case 0x4d1c:
1047 /* ZB_BW_CNTL */ 1046 /* ZB_BW_CNTL */
1048 track->fastfill = !!(idx_value & (1 << 2)); 1047 track->zb_cb_clear = !!(idx_value & (1 << 5));
1049 break; 1048 break;
1050 case 0x4e04: 1049 case 0x4e04:
1051 /* RB3D_BLENDCNTL */ 1050 /* RB3D_BLENDCNTL */
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c
index ea46d558e8f3..c5c2742e4140 100644
--- a/drivers/gpu/drm/radeon/r300_cmdbuf.c
+++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c
@@ -921,7 +921,7 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
921 921
922 ptr_addr = drm_buffer_read_object(cmdbuf->buffer, 922 ptr_addr = drm_buffer_read_object(cmdbuf->buffer,
923 sizeof(stack_ptr_addr), &stack_ptr_addr); 923 sizeof(stack_ptr_addr), &stack_ptr_addr);
924 ref_age_base = (u32 *)(unsigned long)*ptr_addr; 924 ref_age_base = (u32 *)(unsigned long)get_unaligned(ptr_addr);
925 925
926 for (i=0; i < header.scratch.n_bufs; i++) { 926 for (i=0; i < header.scratch.n_bufs; i++) {
927 buf_idx = drm_buffer_pointer_to_dword(cmdbuf->buffer, 0); 927 buf_idx = drm_buffer_pointer_to_dword(cmdbuf->buffer, 0);
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 3dc968c9f5a4..c2bda4ad62e7 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -59,6 +59,12 @@ void r420_pipes_init(struct radeon_device *rdev)
59 /* get max number of pipes */ 59 /* get max number of pipes */
60 gb_pipe_select = RREG32(0x402C); 60 gb_pipe_select = RREG32(0x402C);
61 num_pipes = ((gb_pipe_select >> 12) & 3) + 1; 61 num_pipes = ((gb_pipe_select >> 12) & 3) + 1;
62
63 /* SE chips have 1 pipe */
64 if ((rdev->pdev->device == 0x5e4c) ||
65 (rdev->pdev->device == 0x5e4f))
66 num_pipes = 1;
67
62 rdev->num_gb_pipes = num_pipes; 68 rdev->num_gb_pipes = num_pipes;
63 tmp = 0; 69 tmp = 0;
64 switch (num_pipes) { 70 switch (num_pipes) {
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
index c4457791dff1..28e473f1f56f 100644
--- a/drivers/gpu/drm/radeon/radeon_agp.c
+++ b/drivers/gpu/drm/radeon/radeon_agp.c
@@ -134,12 +134,10 @@ int radeon_agp_init(struct radeon_device *rdev)
134 int ret; 134 int ret;
135 135
136 /* Acquire AGP. */ 136 /* Acquire AGP. */
137 if (!rdev->ddev->agp->acquired) { 137 ret = drm_agp_acquire(rdev->ddev);
138 ret = drm_agp_acquire(rdev->ddev); 138 if (ret) {
139 if (ret) { 139 DRM_ERROR("Unable to acquire AGP: %d\n", ret);
140 DRM_ERROR("Unable to acquire AGP: %d\n", ret); 140 return ret;
141 return ret;
142 }
143 } 141 }
144 142
145 ret = drm_agp_info(rdev->ddev, &info); 143 ret = drm_agp_info(rdev->ddev, &info);
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 5673665ff216..9916d825401c 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1264,7 +1264,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
1264 switch (crev) { 1264 switch (crev) {
1265 case 1: 1265 case 1:
1266 tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); 1266 tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset);
1267 if (index > MAX_SUPPORTED_TV_TIMING) 1267 if (index >= MAX_SUPPORTED_TV_TIMING)
1268 return false; 1268 return false;
1269 1269
1270 mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total); 1270 mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total);
@@ -1302,7 +1302,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
1302 break; 1302 break;
1303 case 2: 1303 case 2:
1304 tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2 *)(mode_info->atom_context->bios + data_offset); 1304 tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2 *)(mode_info->atom_context->bios + data_offset);
1305 if (index > MAX_SUPPORTED_TV_TIMING_V1_2) 1305 if (index >= MAX_SUPPORTED_TV_TIMING_V1_2)
1306 return false; 1306 return false;
1307 1307
1308 dtd_timings = &tv_info_v1_2->aModeTimings[index]; 1308 dtd_timings = &tv_info_v1_2->aModeTimings[index];
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 1331351c5178..4559a53d5e57 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1316,6 +1316,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1316 radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); 1316 radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI");
1317 if (!radeon_connector->ddc_bus) 1317 if (!radeon_connector->ddc_bus)
1318 goto failed; 1318 goto failed;
1319 }
1320 if (connector_type == DRM_MODE_CONNECTOR_DVII) {
1319 radeon_connector->dac_load_detect = true; 1321 radeon_connector->dac_load_detect = true;
1320 drm_connector_attach_property(&radeon_connector->base, 1322 drm_connector_attach_property(&radeon_connector->base,
1321 rdev->mode_info.load_detect_property, 1323 rdev->mode_info.load_detect_property,
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 419630dd2075..2f042a3c0e62 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -435,14 +435,19 @@ static void radeon_init_pipes(struct drm_device *dev)
435 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { 435 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) {
436 gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); 436 gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT);
437 dev_priv->num_gb_pipes = ((gb_pipe_sel >> 12) & 0x3) + 1; 437 dev_priv->num_gb_pipes = ((gb_pipe_sel >> 12) & 0x3) + 1;
438 /* SE cards have 1 pipe */
439 if ((dev->pdev->device == 0x5e4c) ||
440 (dev->pdev->device == 0x5e4f))
441 dev_priv->num_gb_pipes = 1;
438 } else { 442 } else {
439 /* R3xx */ 443 /* R3xx */
440 if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300 && 444 if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300 &&
441 dev->pdev->device != 0x4144) || 445 dev->pdev->device != 0x4144) ||
442 ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350)) { 446 ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350 &&
447 dev->pdev->device != 0x4148)) {
443 dev_priv->num_gb_pipes = 2; 448 dev_priv->num_gb_pipes = 2;
444 } else { 449 } else {
445 /* RV3xx/R300 AD */ 450 /* RV3xx/R300 AD/R350 AH */
446 dev_priv->num_gb_pipes = 1; 451 dev_priv->num_gb_pipes = 1;
447 } 452 }
448 } 453 }
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index b8d672828246..bb1c122cad21 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -86,12 +86,12 @@ static void evergreen_crtc_load_lut(struct drm_crtc *crtc)
86 WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN + radeon_crtc->crtc_offset, 0xffff); 86 WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN + radeon_crtc->crtc_offset, 0xffff);
87 WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_RED + radeon_crtc->crtc_offset, 0xffff); 87 WREG32(EVERGREEN_DC_LUT_WHITE_OFFSET_RED + radeon_crtc->crtc_offset, 0xffff);
88 88
89 WREG32(EVERGREEN_DC_LUT_RW_MODE, radeon_crtc->crtc_id); 89 WREG32(EVERGREEN_DC_LUT_RW_MODE + radeon_crtc->crtc_offset, 0);
90 WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK, 0x00000007); 90 WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK + radeon_crtc->crtc_offset, 0x00000007);
91 91
92 WREG32(EVERGREEN_DC_LUT_RW_INDEX, 0); 92 WREG32(EVERGREEN_DC_LUT_RW_INDEX + radeon_crtc->crtc_offset, 0);
93 for (i = 0; i < 256; i++) { 93 for (i = 0; i < 256; i++) {
94 WREG32(EVERGREEN_DC_LUT_30_COLOR, 94 WREG32(EVERGREEN_DC_LUT_30_COLOR + radeon_crtc->crtc_offset,
95 (radeon_crtc->lut_r[i] << 20) | 95 (radeon_crtc->lut_r[i] << 20) |
96 (radeon_crtc->lut_g[i] << 10) | 96 (radeon_crtc->lut_g[i] << 10) |
97 (radeon_crtc->lut_b[i] << 0)); 97 (radeon_crtc->lut_b[i] << 0));
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 4b05563d99e1..b3749d47be7b 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -216,6 +216,7 @@ static struct drm_driver driver_old = {
216 .mmap = drm_mmap, 216 .mmap = drm_mmap,
217 .poll = drm_poll, 217 .poll = drm_poll,
218 .fasync = drm_fasync, 218 .fasync = drm_fasync,
219 .read = drm_read,
219#ifdef CONFIG_COMPAT 220#ifdef CONFIG_COMPAT
220 .compat_ioctl = radeon_compat_ioctl, 221 .compat_ioctl = radeon_compat_ioctl,
221#endif 222#endif
@@ -304,6 +305,7 @@ static struct drm_driver kms_driver = {
304 .mmap = radeon_mmap, 305 .mmap = radeon_mmap,
305 .poll = drm_poll, 306 .poll = drm_poll,
306 .fasync = drm_fasync, 307 .fasync = drm_fasync,
308 .read = drm_read,
307#ifdef CONFIG_COMPAT 309#ifdef CONFIG_COMPAT
308 .compat_ioctl = radeon_kms_compat_ioctl, 310 .compat_ioctl = radeon_kms_compat_ioctl,
309#endif 311#endif
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 30293bec0801..c5ddaf58563a 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -254,6 +254,53 @@ radeon_get_atom_connector_priv_from_encoder(struct drm_encoder *encoder)
254 return dig_connector; 254 return dig_connector;
255} 255}
256 256
257void radeon_panel_mode_fixup(struct drm_encoder *encoder,
258 struct drm_display_mode *adjusted_mode)
259{
260 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
261 struct drm_device *dev = encoder->dev;
262 struct radeon_device *rdev = dev->dev_private;
263 struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
264 unsigned hblank = native_mode->htotal - native_mode->hdisplay;
265 unsigned vblank = native_mode->vtotal - native_mode->vdisplay;
266 unsigned hover = native_mode->hsync_start - native_mode->hdisplay;
267 unsigned vover = native_mode->vsync_start - native_mode->vdisplay;
268 unsigned hsync_width = native_mode->hsync_end - native_mode->hsync_start;
269 unsigned vsync_width = native_mode->vsync_end - native_mode->vsync_start;
270
271 adjusted_mode->clock = native_mode->clock;
272 adjusted_mode->flags = native_mode->flags;
273
274 if (ASIC_IS_AVIVO(rdev)) {
275 adjusted_mode->hdisplay = native_mode->hdisplay;
276 adjusted_mode->vdisplay = native_mode->vdisplay;
277 }
278
279 adjusted_mode->htotal = native_mode->hdisplay + hblank;
280 adjusted_mode->hsync_start = native_mode->hdisplay + hover;
281 adjusted_mode->hsync_end = adjusted_mode->hsync_start + hsync_width;
282
283 adjusted_mode->vtotal = native_mode->vdisplay + vblank;
284 adjusted_mode->vsync_start = native_mode->vdisplay + vover;
285 adjusted_mode->vsync_end = adjusted_mode->vsync_start + vsync_width;
286
287 drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
288
289 if (ASIC_IS_AVIVO(rdev)) {
290 adjusted_mode->crtc_hdisplay = native_mode->hdisplay;
291 adjusted_mode->crtc_vdisplay = native_mode->vdisplay;
292 }
293
294 adjusted_mode->crtc_htotal = adjusted_mode->crtc_hdisplay + hblank;
295 adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hdisplay + hover;
296 adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + hsync_width;
297
298 adjusted_mode->crtc_vtotal = adjusted_mode->crtc_vdisplay + vblank;
299 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + vover;
300 adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + vsync_width;
301
302}
303
257static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, 304static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
258 struct drm_display_mode *mode, 305 struct drm_display_mode *mode,
259 struct drm_display_mode *adjusted_mode) 306 struct drm_display_mode *adjusted_mode)
@@ -275,18 +322,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
275 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; 322 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
276 323
277 /* get the native mode for LVDS */ 324 /* get the native mode for LVDS */
278 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { 325 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
279 struct drm_display_mode *native_mode = &radeon_encoder->native_mode; 326 radeon_panel_mode_fixup(encoder, adjusted_mode);
280 int mode_id = adjusted_mode->base.id;
281 *adjusted_mode = *native_mode;
282 if (!ASIC_IS_AVIVO(rdev)) {
283 adjusted_mode->hdisplay = mode->hdisplay;
284 adjusted_mode->vdisplay = mode->vdisplay;
285 adjusted_mode->crtc_hdisplay = mode->hdisplay;
286 adjusted_mode->crtc_vdisplay = mode->vdisplay;
287 }
288 adjusted_mode->base.id = mode_id;
289 }
290 327
291 /* get the native mode for TV */ 328 /* get the native mode for TV */
292 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) { 329 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) {
@@ -1326,7 +1363,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1326 1363
1327 radeon_encoder->pixel_clock = adjusted_mode->clock; 1364 radeon_encoder->pixel_clock = adjusted_mode->clock;
1328 1365
1329 if (ASIC_IS_AVIVO(rdev)) { 1366 if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE4(rdev)) {
1330 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) 1367 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT))
1331 atombios_yuv_setup(encoder, true); 1368 atombios_yuv_setup(encoder, true);
1332 else 1369 else
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d3657dcfdd26..c633319f98ed 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -165,7 +165,7 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc)
165{ 165{
166 struct radeon_device *rdev = dev->dev_private; 166 struct radeon_device *rdev = dev->dev_private;
167 167
168 if (crtc < 0 || crtc > 1) { 168 if (crtc < 0 || crtc >= rdev->num_crtc) {
169 DRM_ERROR("Invalid crtc %d\n", crtc); 169 DRM_ERROR("Invalid crtc %d\n", crtc);
170 return -EINVAL; 170 return -EINVAL;
171 } 171 }
@@ -177,7 +177,7 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
177{ 177{
178 struct radeon_device *rdev = dev->dev_private; 178 struct radeon_device *rdev = dev->dev_private;
179 179
180 if (crtc < 0 || crtc > 1) { 180 if (crtc < 0 || crtc >= rdev->num_crtc) {
181 DRM_ERROR("Invalid crtc %d\n", crtc); 181 DRM_ERROR("Invalid crtc %d\n", crtc);
182 return -EINVAL; 182 return -EINVAL;
183 } 183 }
@@ -191,7 +191,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
191{ 191{
192 struct radeon_device *rdev = dev->dev_private; 192 struct radeon_device *rdev = dev->dev_private;
193 193
194 if (crtc < 0 || crtc > 1) { 194 if (crtc < 0 || crtc >= rdev->num_crtc) {
195 DRM_ERROR("Invalid crtc %d\n", crtc); 195 DRM_ERROR("Invalid crtc %d\n", crtc);
196 return; 196 return;
197 } 197 }
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 2441cca7d775..0274abe17ad9 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -228,16 +228,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
228 drm_mode_set_crtcinfo(adjusted_mode, 0); 228 drm_mode_set_crtcinfo(adjusted_mode, 0);
229 229
230 /* get the native mode for LVDS */ 230 /* get the native mode for LVDS */
231 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { 231 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
232 struct drm_display_mode *native_mode = &radeon_encoder->native_mode; 232 radeon_panel_mode_fixup(encoder, adjusted_mode);
233 int mode_id = adjusted_mode->base.id;
234 *adjusted_mode = *native_mode;
235 adjusted_mode->hdisplay = mode->hdisplay;
236 adjusted_mode->vdisplay = mode->vdisplay;
237 adjusted_mode->crtc_hdisplay = mode->hdisplay;
238 adjusted_mode->crtc_vdisplay = mode->vdisplay;
239 adjusted_mode->base.id = mode_id;
240 }
241 233
242 return true; 234 return true;
243} 235}
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 0b8e32776b10..5413fcd63086 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -558,6 +558,8 @@ extern int radeon_static_clocks_init(struct drm_device *dev);
558bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, 558bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
559 struct drm_display_mode *mode, 559 struct drm_display_mode *mode,
560 struct drm_display_mode *adjusted_mode); 560 struct drm_display_mode *adjusted_mode);
561void radeon_panel_mode_fixup(struct drm_encoder *encoder,
562 struct drm_display_mode *adjusted_mode);
561void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc); 563void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc);
562 564
563/* legacy tv */ 565/* legacy tv */
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
index 40ab6d9c3736..cc5316dcf580 100644
--- a/drivers/gpu/drm/radeon/radeon_state.c
+++ b/drivers/gpu/drm/radeon/radeon_state.c
@@ -424,7 +424,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
424 if ((*cmd & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) && 424 if ((*cmd & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) &&
425 (*cmd & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { 425 (*cmd & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) {
426 u32 *cmd3 = drm_buffer_pointer_to_dword(cmdbuf->buffer, 3); 426 u32 *cmd3 = drm_buffer_pointer_to_dword(cmdbuf->buffer, 3);
427 offset = *cmd << 10; 427 offset = *cmd3 << 10;
428 if (radeon_check_and_fixup_offset 428 if (radeon_check_and_fixup_offset
429 (dev_priv, file_priv, &offset)) { 429 (dev_priv, file_priv, &offset)) {
430 DRM_ERROR("Invalid second packet offset\n"); 430 DRM_ERROR("Invalid second packet offset\n");
@@ -2895,9 +2895,12 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
2895 return rv; 2895 return rv;
2896 rv = drm_buffer_copy_from_user(cmdbuf->buffer, buffer, 2896 rv = drm_buffer_copy_from_user(cmdbuf->buffer, buffer,
2897 cmdbuf->bufsz); 2897 cmdbuf->bufsz);
2898 if (rv) 2898 if (rv) {
2899 drm_buffer_free(cmdbuf->buffer);
2899 return rv; 2900 return rv;
2900 } 2901 }
2902 } else
2903 goto done;
2901 2904
2902 orig_nbox = cmdbuf->nbox; 2905 orig_nbox = cmdbuf->nbox;
2903 2906
@@ -2905,8 +2908,7 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
2905 int temp; 2908 int temp;
2906 temp = r300_do_cp_cmdbuf(dev, file_priv, cmdbuf); 2909 temp = r300_do_cp_cmdbuf(dev, file_priv, cmdbuf);
2907 2910
2908 if (cmdbuf->bufsz != 0) 2911 drm_buffer_free(cmdbuf->buffer);
2909 drm_buffer_free(cmdbuf->buffer);
2910 2912
2911 return temp; 2913 return temp;
2912 } 2914 }
@@ -3012,16 +3014,15 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
3012 } 3014 }
3013 } 3015 }
3014 3016
3015 if (cmdbuf->bufsz != 0) 3017 drm_buffer_free(cmdbuf->buffer);
3016 drm_buffer_free(cmdbuf->buffer);
3017 3018
3019 done:
3018 DRM_DEBUG("DONE\n"); 3020 DRM_DEBUG("DONE\n");
3019 COMMIT_RING(); 3021 COMMIT_RING();
3020 return 0; 3022 return 0;
3021 3023
3022 err: 3024 err:
3023 if (cmdbuf->bufsz != 0) 3025 drm_buffer_free(cmdbuf->buffer);
3024 drm_buffer_free(cmdbuf->buffer);
3025 return -EINVAL; 3026 return -EINVAL;
3026} 3027}
3027 3028
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index dd47b2a9a791..0e3754a3a303 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1716,40 +1716,12 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
1716} 1716}
1717EXPORT_SYMBOL(ttm_bo_wait); 1717EXPORT_SYMBOL(ttm_bo_wait);
1718 1718
1719void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo)
1720{
1721 atomic_set(&bo->reserved, 0);
1722 wake_up_all(&bo->event_queue);
1723}
1724
1725int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
1726 bool no_wait)
1727{
1728 int ret;
1729
1730 while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) {
1731 if (no_wait)
1732 return -EBUSY;
1733 else if (interruptible) {
1734 ret = wait_event_interruptible
1735 (bo->event_queue, atomic_read(&bo->reserved) == 0);
1736 if (unlikely(ret != 0))
1737 return ret;
1738 } else {
1739 wait_event(bo->event_queue,
1740 atomic_read(&bo->reserved) == 0);
1741 }
1742 }
1743 return 0;
1744}
1745
1746int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait) 1719int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
1747{ 1720{
1748 int ret = 0; 1721 int ret = 0;
1749 1722
1750 /* 1723 /*
1751 * Using ttm_bo_reserve instead of ttm_bo_block_reservation 1724 * Using ttm_bo_reserve makes sure the lru lists are updated.
1752 * makes sure the lru lists are updated.
1753 */ 1725 */
1754 1726
1755 ret = ttm_bo_reserve(bo, true, no_wait, false, 0); 1727 ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
diff --git a/drivers/gpu/drm/ttm/ttm_lock.c b/drivers/gpu/drm/ttm/ttm_lock.c
index 3d172ef04ee1..de41e55a944a 100644
--- a/drivers/gpu/drm/ttm/ttm_lock.c
+++ b/drivers/gpu/drm/ttm/ttm_lock.c
@@ -204,7 +204,6 @@ static int __ttm_vt_unlock(struct ttm_lock *lock)
204 lock->flags &= ~TTM_VT_LOCK; 204 lock->flags &= ~TTM_VT_LOCK;
205 wake_up_all(&lock->queue); 205 wake_up_all(&lock->queue);
206 spin_unlock(&lock->lock); 206 spin_unlock(&lock->lock);
207 printk(KERN_INFO TTM_PFX "vt unlock.\n");
208 207
209 return ret; 208 return ret;
210} 209}
@@ -265,10 +264,8 @@ int ttm_vt_lock(struct ttm_lock *lock,
265 ttm_lock_type, &ttm_vt_lock_remove, NULL); 264 ttm_lock_type, &ttm_vt_lock_remove, NULL);
266 if (ret) 265 if (ret)
267 (void)__ttm_vt_unlock(lock); 266 (void)__ttm_vt_unlock(lock);
268 else { 267 else
269 lock->vt_holder = tfile; 268 lock->vt_holder = tfile;
270 printk(KERN_INFO TTM_PFX "vt lock.\n");
271 }
272 269
273 return ret; 270 return ret;
274} 271}
diff --git a/drivers/gpu/drm/via/via_video.c b/drivers/gpu/drm/via/via_video.c
index 6ec04ac12459..6efac8117c93 100644
--- a/drivers/gpu/drm/via/via_video.c
+++ b/drivers/gpu/drm/via/via_video.c
@@ -75,7 +75,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_
75 75
76 DRM_DEBUG("\n"); 76 DRM_DEBUG("\n");
77 77
78 if (fx->lock > VIA_NR_XVMC_LOCKS) 78 if (fx->lock >= VIA_NR_XVMC_LOCKS)
79 return -EFAULT; 79 return -EFAULT;
80 80
81 lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx->lock); 81 lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx->lock);
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index d6d1149d525d..c8768f38511e 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -276,8 +276,10 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
276 276
277 mutex_lock(&vgasr_mutex); 277 mutex_lock(&vgasr_mutex);
278 278
279 if (!vgasr_priv.active) 279 if (!vgasr_priv.active) {
280 return -EINVAL; 280 cnt = -EINVAL;
281 goto out;
282 }
281 283
282 /* pwr off the device not in use */ 284 /* pwr off the device not in use */
283 if (strncmp(usercmd, "OFF", 3) == 0) { 285 if (strncmp(usercmd, "OFF", 3) == 0) {
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
index 7e597d7f770f..24663a8717b1 100644
--- a/drivers/hid/hid-cherry.c
+++ b/drivers/hid/hid-cherry.c
@@ -59,6 +59,7 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
59 59
60static const struct hid_device_id ch_devices[] = { 60static const struct hid_device_id ch_devices[] = {
61 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 61 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
62 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
62 { } 63 { }
63}; 64};
64MODULE_DEVICE_TABLE(hid, ch_devices); 65MODULE_DEVICE_TABLE(hid, ch_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2e2aa759d230..143e788b729b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1043,13 +1043,8 @@ void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1043 1043
1044 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 1044 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1045 hid->hiddev_report_event(hid, report); 1045 hid->hiddev_report_event(hid, report);
1046 if (hid->claimed & HID_CLAIMED_HIDRAW) { 1046 if (hid->claimed & HID_CLAIMED_HIDRAW)
1047 /* numbered reports need to be passed with the report num */ 1047 hidraw_report_event(hid, data, size);
1048 if (report_enum->numbered)
1049 hidraw_report_event(hid, data - 1, size + 1);
1050 else
1051 hidraw_report_event(hid, data, size);
1052 }
1053 1048
1054 for (a = 0; a < report->maxfield; a++) 1049 for (a = 0; a < report->maxfield; a++)
1055 hid_input_field(hid, report->field[a], cdata, interrupt); 1050 hid_input_field(hid, report->field[a], cdata, interrupt);
@@ -1296,6 +1291,7 @@ static const struct hid_device_id hid_blacklist[] = {
1296 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1291 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1292 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1293 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 797e06470356..09d27649a0f7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -131,6 +131,7 @@
131 131
132#define USB_VENDOR_ID_CHERRY 0x046a 132#define USB_VENDOR_ID_CHERRY 0x046a
133#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 133#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
134#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
134 135
135#define USB_VENDOR_ID_CHIC 0x05fe 136#define USB_VENDOR_ID_CHIC 0x05fe
136#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 137#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 9b24fc510712..4777bbfa1cc2 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * HID driver for N-Trig touchscreens 2 * HID driver for N-Trig touchscreens
3 * 3 *
4 * Copyright (c) 2008 Rafi Rubin 4 * Copyright (c) 2008-2010 Rafi Rubin
5 * Copyright (c) 2009 Stephane Chatty 5 * Copyright (c) 2009-2010 Stephane Chatty
6 * 6 *
7 */ 7 */
8 8
@@ -15,6 +15,8 @@
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/hid.h> 17#include <linux/hid.h>
18#include <linux/usb.h>
19#include "usbhid/usbhid.h"
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/slab.h> 21#include <linux/slab.h>
20 22
@@ -22,17 +24,16 @@
22 24
23#define NTRIG_DUPLICATE_USAGES 0x001 25#define NTRIG_DUPLICATE_USAGES 0x001
24 26
25#define nt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
26 EV_KEY, (c))
27
28struct ntrig_data { 27struct ntrig_data {
29 /* Incoming raw values for a single contact */ 28 /* Incoming raw values for a single contact */
30 __u16 x, y, w, h; 29 __u16 x, y, w, h;
31 __u16 id; 30 __u16 id;
32 __u8 confidence; 31
32 bool tipswitch;
33 bool confidence;
34 bool first_contact_touch;
33 35
34 bool reading_mt; 36 bool reading_mt;
35 __u8 first_contact_confidence;
36 37
37 __u8 mt_footer[4]; 38 __u8 mt_footer[4];
38 __u8 mt_foot_count; 39 __u8 mt_foot_count;
@@ -139,9 +140,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
139 case 0xff000001: 140 case 0xff000001:
140 /* Tag indicating the start of a multitouch group */ 141 /* Tag indicating the start of a multitouch group */
141 nd->reading_mt = 1; 142 nd->reading_mt = 1;
142 nd->first_contact_confidence = 0; 143 nd->first_contact_touch = 0;
143 break; 144 break;
144 case HID_DG_TIPSWITCH: 145 case HID_DG_TIPSWITCH:
146 nd->tipswitch = value;
145 /* Prevent emission of touch until validated */ 147 /* Prevent emission of touch until validated */
146 return 1; 148 return 1;
147 case HID_DG_CONFIDENCE: 149 case HID_DG_CONFIDENCE:
@@ -169,8 +171,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
169 * to emit a normal (X, Y) position 171 * to emit a normal (X, Y) position
170 */ 172 */
171 if (!nd->reading_mt) { 173 if (!nd->reading_mt) {
174 /*
175 * TipSwitch indicates the presence of a
176 * finger in single touch mode.
177 */
178 input_report_key(input, BTN_TOUCH,
179 nd->tipswitch);
172 input_report_key(input, BTN_TOOL_DOUBLETAP, 180 input_report_key(input, BTN_TOOL_DOUBLETAP,
173 (nd->confidence != 0)); 181 nd->tipswitch);
174 input_event(input, EV_ABS, ABS_X, nd->x); 182 input_event(input, EV_ABS, ABS_X, nd->x);
175 input_event(input, EV_ABS, ABS_Y, nd->y); 183 input_event(input, EV_ABS, ABS_Y, nd->y);
176 } 184 }
@@ -209,7 +217,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
209 217
210 /* emit a normal (X, Y) for the first point only */ 218 /* emit a normal (X, Y) for the first point only */
211 if (nd->id == 0) { 219 if (nd->id == 0) {
212 nd->first_contact_confidence = nd->confidence; 220 /*
221 * TipSwitch is superfluous in multitouch
222 * mode. The footer events tell us
223 * if there is a finger on the screen or
224 * not.
225 */
226 nd->first_contact_touch = nd->confidence;
213 input_event(input, EV_ABS, ABS_X, nd->x); 227 input_event(input, EV_ABS, ABS_X, nd->x);
214 input_event(input, EV_ABS, ABS_Y, nd->y); 228 input_event(input, EV_ABS, ABS_Y, nd->y);
215 } 229 }
@@ -239,30 +253,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
239 253
240 nd->reading_mt = 0; 254 nd->reading_mt = 0;
241 255
242 if (nd->first_contact_confidence) { 256 if (nd->first_contact_touch) {
243 switch (value) { 257 input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
244 case 0: /* for single touch devices */
245 case 1:
246 input_report_key(input,
247 BTN_TOOL_DOUBLETAP, 1);
248 break;
249 case 2:
250 input_report_key(input,
251 BTN_TOOL_TRIPLETAP, 1);
252 break;
253 case 3:
254 default:
255 input_report_key(input,
256 BTN_TOOL_QUADTAP, 1);
257 }
258 input_report_key(input, BTN_TOUCH, 1); 258 input_report_key(input, BTN_TOUCH, 1);
259 } else { 259 } else {
260 input_report_key(input, 260 input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
261 BTN_TOOL_DOUBLETAP, 0);
262 input_report_key(input,
263 BTN_TOOL_TRIPLETAP, 0);
264 input_report_key(input,
265 BTN_TOOL_QUADTAP, 0);
266 input_report_key(input, BTN_TOUCH, 0); 261 input_report_key(input, BTN_TOUCH, 0);
267 } 262 }
268 break; 263 break;
@@ -286,6 +281,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
286 struct ntrig_data *nd; 281 struct ntrig_data *nd;
287 struct hid_input *hidinput; 282 struct hid_input *hidinput;
288 struct input_dev *input; 283 struct input_dev *input;
284 struct hid_report *report;
289 285
290 if (id->driver_data) 286 if (id->driver_data)
291 hdev->quirks |= HID_QUIRK_MULTI_INPUT; 287 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
@@ -327,13 +323,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
327 __clear_bit(BTN_TOOL_PEN, input->keybit); 323 __clear_bit(BTN_TOOL_PEN, input->keybit);
328 __clear_bit(BTN_TOOL_FINGER, input->keybit); 324 __clear_bit(BTN_TOOL_FINGER, input->keybit);
329 __clear_bit(BTN_0, input->keybit); 325 __clear_bit(BTN_0, input->keybit);
330 /*
331 * A little something special to enable
332 * two and three finger taps.
333 */
334 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); 326 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
335 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
336 __set_bit(BTN_TOOL_QUADTAP, input->keybit);
337 /* 327 /*
338 * The physical touchscreen (single touch) 328 * The physical touchscreen (single touch)
339 * input has a value for physical, whereas 329 * input has a value for physical, whereas
@@ -349,6 +339,12 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
349 } 339 }
350 } 340 }
351 341
342 /* This is needed for devices with more recent firmware versions */
343 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
344 if (report)
345 usbhid_submit_report(hdev, report, USB_DIR_OUT);
346
347
352 return 0; 348 return 0;
353err_free: 349err_free:
354 kfree(nd); 350 kfree(nd);
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 7502a4b2fa86..402d5574b574 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -76,7 +76,7 @@ static int sony_set_operational_usb(struct hid_device *hdev)
76 76
77static int sony_set_operational_bt(struct hid_device *hdev) 77static int sony_set_operational_bt(struct hid_device *hdev)
78{ 78{
79 unsigned char buf[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00 }; 79 unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
80 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); 80 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
81} 81}
82 82
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index f7700cf49721..f947d8337e21 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -277,7 +277,6 @@ static int __init wacom_init(void)
277 ret = hid_register_driver(&wacom_driver); 277 ret = hid_register_driver(&wacom_driver);
278 if (ret) 278 if (ret)
279 printk(KERN_ERR "can't register wacom driver\n"); 279 printk(KERN_ERR "can't register wacom driver\n");
280 printk(KERN_ERR "wacom driver registered\n");
281 return ret; 280 return ret;
282} 281}
283 282
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 56d06cd8075b..7b85b696fdab 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -999,13 +999,6 @@ static int usbhid_start(struct hid_device *hid)
999 } 999 }
1000 } 1000 }
1001 1001
1002 init_waitqueue_head(&usbhid->wait);
1003 INIT_WORK(&usbhid->reset_work, hid_reset);
1004 INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1005 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1006
1007 spin_lock_init(&usbhid->lock);
1008
1009 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); 1002 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
1010 if (!usbhid->urbctrl) { 1003 if (!usbhid->urbctrl) {
1011 ret = -ENOMEM; 1004 ret = -ENOMEM;
@@ -1179,6 +1172,12 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1179 usbhid->intf = intf; 1172 usbhid->intf = intf;
1180 usbhid->ifnum = interface->desc.bInterfaceNumber; 1173 usbhid->ifnum = interface->desc.bInterfaceNumber;
1181 1174
1175 init_waitqueue_head(&usbhid->wait);
1176 INIT_WORK(&usbhid->reset_work, hid_reset);
1177 INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1178 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1179 spin_lock_init(&usbhid->lock);
1180
1182 ret = hid_add_device(hid); 1181 ret = hid_add_device(hid);
1183 if (ret) { 1182 if (ret) {
1184 if (ret != -ENODEV) 1183 if (ret != -ENODEV)
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0f28d91f29d8..f085c18d2905 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -195,6 +195,9 @@ static unsigned int applesmc_accelerometer;
195/* Indicates whether this computer has light sensors and keyboard backlight. */ 195/* Indicates whether this computer has light sensors and keyboard backlight. */
196static unsigned int applesmc_light; 196static unsigned int applesmc_light;
197 197
198/* The number of fans handled by the driver */
199static unsigned int fans_handled;
200
198/* Indicates which temperature sensors set to use. */ 201/* Indicates which temperature sensors set to use. */
199static unsigned int applesmc_temperature_set; 202static unsigned int applesmc_temperature_set;
200 203
@@ -1492,39 +1495,24 @@ static int __init applesmc_init(void)
1492 1495
1493 /* create fan files */ 1496 /* create fan files */
1494 count = applesmc_get_fan_count(); 1497 count = applesmc_get_fan_count();
1495 if (count < 0) { 1498 if (count < 0)
1496 printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); 1499 printk(KERN_ERR "applesmc: Cannot get the number of fans.\n");
1497 } else { 1500 else
1498 printk(KERN_INFO "applesmc: %d fans found.\n", count); 1501 printk(KERN_INFO "applesmc: %d fans found.\n", count);
1499 1502
1500 switch (count) { 1503 if (count > 4) {
1501 default: 1504 count = 4;
1502 printk(KERN_WARNING "applesmc: More than 4 fans found," 1505 printk(KERN_WARNING "applesmc: More than 4 fans found,"
1503 " but at most 4 fans are supported" 1506 " but at most 4 fans are supported"
1504 " by the driver.\n"); 1507 " by the driver.\n");
1505 case 4: 1508 }
1506 ret = sysfs_create_group(&pdev->dev.kobj, 1509
1507 &fan_attribute_groups[3]); 1510 while (fans_handled < count) {
1508 if (ret) 1511 ret = sysfs_create_group(&pdev->dev.kobj,
1509 goto out_key_enumeration; 1512 &fan_attribute_groups[fans_handled]);
1510 case 3: 1513 if (ret)
1511 ret = sysfs_create_group(&pdev->dev.kobj, 1514 goto out_fans;
1512 &fan_attribute_groups[2]); 1515 fans_handled++;
1513 if (ret)
1514 goto out_key_enumeration;
1515 case 2:
1516 ret = sysfs_create_group(&pdev->dev.kobj,
1517 &fan_attribute_groups[1]);
1518 if (ret)
1519 goto out_key_enumeration;
1520 case 1:
1521 ret = sysfs_create_group(&pdev->dev.kobj,
1522 &fan_attribute_groups[0]);
1523 if (ret)
1524 goto out_fan_1;
1525 case 0:
1526 ;
1527 }
1528 } 1516 }
1529 1517
1530 for (i = 0; 1518 for (i = 0;
@@ -1593,10 +1581,10 @@ out_accelerometer:
1593 applesmc_release_accelerometer(); 1581 applesmc_release_accelerometer();
1594out_temperature: 1582out_temperature:
1595 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); 1583 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
1596 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1584out_fans:
1597out_fan_1: 1585 while (fans_handled)
1598 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1586 sysfs_remove_group(&pdev->dev.kobj,
1599out_key_enumeration: 1587 &fan_attribute_groups[--fans_handled]);
1600 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1588 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1601out_name: 1589out_name:
1602 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1590 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
@@ -1622,8 +1610,9 @@ static void __exit applesmc_exit(void)
1622 if (applesmc_accelerometer) 1610 if (applesmc_accelerometer)
1623 applesmc_release_accelerometer(); 1611 applesmc_release_accelerometer();
1624 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); 1612 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
1625 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1613 while (fans_handled)
1626 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1614 sysfs_remove_group(&pdev->dev.kobj,
1615 &fan_attribute_groups[--fans_handled]);
1627 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1616 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1628 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1617 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
1629 platform_device_unregister(pdev); 1618 platform_device_unregister(pdev);
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index 7f948105d8ad..0f388adc6187 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -268,8 +268,11 @@ static ssize_t store_fan16(struct device *dev,
268 if (strict_strtol(buf, 10, &reqval)) 268 if (strict_strtol(buf, 10, &reqval))
269 return -EINVAL; 269 return -EINVAL;
270 270
271 /* If a minimum RPM of zero is requested, then we set the register to
272 0xffff. This value allows the fan to be stopped completely without
273 generating an alarm. */
271 reqval = 274 reqval =
272 (SENSORS_LIMIT((reqval) <= 0 ? 0 : 5400000 / (reqval), 0, 65534)); 275 (reqval <= 0 ? 0xffff : SENSORS_LIMIT(5400000 / reqval, 0, 0xfffe));
273 276
274 mutex_lock(&data->update_lock); 277 mutex_lock(&data->update_lock);
275 data->reg[param->msb[0]] = (reqval >> 8) & 0xff; 278 data->reg[param->msb[0]] = (reqval >> 8) & 0xff;
@@ -285,8 +288,9 @@ static ssize_t store_fan16(struct device *dev,
285 * Voltages are scaled in the device so that the nominal voltage 288 * Voltages are scaled in the device so that the nominal voltage
286 * is 3/4ths of the 0-255 range (i.e. 192). 289 * is 3/4ths of the 0-255 range (i.e. 192).
287 * If all voltages are 'normal' then all voltage registers will 290 * If all voltages are 'normal' then all voltage registers will
288 * read 0xC0. This doesn't help us if we don't have a point of refernce. 291 * read 0xC0.
289 * The data sheet however provides us with the full scale value for each 292 *
293 * The data sheet provides us with the 3/4 scale value for each voltage
290 * which is stored in in_scaling. The sda->index parameter value provides 294 * which is stored in in_scaling. The sda->index parameter value provides
291 * the index into in_scaling. 295 * the index into in_scaling.
292 * 296 *
@@ -295,7 +299,7 @@ static ssize_t store_fan16(struct device *dev,
295 */ 299 */
296 300
297static int asc7621_in_scaling[] = { 301static int asc7621_in_scaling[] = {
298 3320, 3000, 4380, 6640, 16000 302 2500, 2250, 3300, 5000, 12000
299}; 303};
300 304
301static ssize_t show_in10(struct device *dev, struct device_attribute *attr, 305static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
@@ -306,19 +310,12 @@ static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
306 u8 nr = sda->index; 310 u8 nr = sda->index;
307 311
308 mutex_lock(&data->update_lock); 312 mutex_lock(&data->update_lock);
309 regval = (data->reg[param->msb[0]] * asc7621_in_scaling[nr]) / 256; 313 regval = (data->reg[param->msb[0]] << 8) | (data->reg[param->lsb[0]]);
310
311 /* The LSB value is a 2-bit scaling of the MSB's LSbit value.
312 * I.E. If the maximim voltage for this input is 6640 millivolts then
313 * a MSB register value of 0 = 0mv and 255 = 6640mv.
314 * A 1 step change therefore represents 25.9mv (6640 / 256).
315 * The extra 2-bits therefore represent increments of 6.48mv.
316 */
317 regval += ((asc7621_in_scaling[nr] / 256) / 4) *
318 (data->reg[param->lsb[0]] >> 6);
319
320 mutex_unlock(&data->update_lock); 314 mutex_unlock(&data->update_lock);
321 315
316 /* The LSB value is a 2-bit scaling of the MSB's LSbit value. */
317 regval = (regval >> 6) * asc7621_in_scaling[nr] / (0xc0 << 2);
318
322 return sprintf(buf, "%u\n", regval); 319 return sprintf(buf, "%u\n", regval);
323} 320}
324 321
@@ -331,7 +328,7 @@ static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
331 328
332 return sprintf(buf, "%u\n", 329 return sprintf(buf, "%u\n",
333 ((data->reg[param->msb[0]] * 330 ((data->reg[param->msb[0]] *
334 asc7621_in_scaling[nr]) / 256)); 331 asc7621_in_scaling[nr]) / 0xc0));
335} 332}
336 333
337static ssize_t store_in8(struct device *dev, struct device_attribute *attr, 334static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
@@ -344,9 +341,11 @@ static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
344 if (strict_strtol(buf, 10, &reqval)) 341 if (strict_strtol(buf, 10, &reqval))
345 return -EINVAL; 342 return -EINVAL;
346 343
347 reqval = SENSORS_LIMIT(reqval, 0, asc7621_in_scaling[nr]); 344 reqval = SENSORS_LIMIT(reqval, 0, 0xffff);
345
346 reqval = reqval * 0xc0 / asc7621_in_scaling[nr];
348 347
349 reqval = (reqval * 255 + 128) / asc7621_in_scaling[nr]; 348 reqval = SENSORS_LIMIT(reqval, 0, 0xff);
350 349
351 mutex_lock(&data->update_lock); 350 mutex_lock(&data->update_lock);
352 data->reg[param->msb[0]] = reqval; 351 data->reg[param->msb[0]] = reqval;
@@ -846,11 +845,11 @@ static struct asc7621_param asc7621_params[] = {
846 PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8), 845 PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8),
847 PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8), 846 PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8),
848 847
849 PREAD(in0_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 0, bitmask), 848 PREAD(in0_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 0, bitmask),
850 PREAD(in1_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 1, bitmask), 849 PREAD(in1_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 1, bitmask),
851 PREAD(in2_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 2, bitmask), 850 PREAD(in2_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 2, bitmask),
852 PREAD(in3_alarm, 3, PRI_LOW, 0x41, 0, 0x01, 3, bitmask), 851 PREAD(in3_alarm, 3, PRI_HIGH, 0x41, 0, 0x01, 3, bitmask),
853 PREAD(in4_alarm, 4, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), 852 PREAD(in4_alarm, 4, PRI_HIGH, 0x42, 0, 0x01, 0, bitmask),
854 853
855 PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16), 854 PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16),
856 PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16), 855 PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16),
@@ -862,10 +861,10 @@ static struct asc7621_param asc7621_params[] = {
862 PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16), 861 PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16),
863 PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16), 862 PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16),
864 863
865 PREAD(fan1_alarm, 0, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), 864 PREAD(fan1_alarm, 0, PRI_HIGH, 0x42, 0, 0x01, 2, bitmask),
866 PREAD(fan2_alarm, 1, PRI_LOW, 0x42, 0, 0x01, 1, bitmask), 865 PREAD(fan2_alarm, 1, PRI_HIGH, 0x42, 0, 0x01, 3, bitmask),
867 PREAD(fan3_alarm, 2, PRI_LOW, 0x42, 0, 0x01, 2, bitmask), 866 PREAD(fan3_alarm, 2, PRI_HIGH, 0x42, 0, 0x01, 4, bitmask),
868 PREAD(fan4_alarm, 3, PRI_LOW, 0x42, 0, 0x01, 3, bitmask), 867 PREAD(fan4_alarm, 3, PRI_HIGH, 0x42, 0, 0x01, 5, bitmask),
869 868
870 PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10), 869 PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10),
871 PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10), 870 PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10),
@@ -886,10 +885,10 @@ static struct asc7621_param asc7621_params[] = {
886 PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8), 885 PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8),
887 PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8), 886 PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8),
888 887
889 PREAD(temp1_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 4, bitmask), 888 PREAD(temp1_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 4, bitmask),
890 PREAD(temp2_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 5, bitmask), 889 PREAD(temp2_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 5, bitmask),
891 PREAD(temp3_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 6, bitmask), 890 PREAD(temp3_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 6, bitmask),
892 PREAD(temp4_alarm, 3, PRI_LOW, 0x43, 0, 0x01, 0, bitmask), 891 PREAD(temp4_alarm, 3, PRI_HIGH, 0x43, 0, 0x01, 0, bitmask),
893 892
894 PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask), 893 PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask),
895 PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask), 894 PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask),
@@ -898,7 +897,7 @@ static struct asc7621_param asc7621_params[] = {
898 897
899 PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask), 898 PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask),
900 PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask), 899 PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask),
901 PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x64, 0, 0x01, 3, bitmask), 900 PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x63, 0, 0x01, 3, bitmask),
902 PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask), 901 PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask),
903 902
904 PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st), 903 PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st),
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 75f3fa55663d..16c420240724 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -1169,15 +1169,19 @@ static int atk_create_files(struct atk_data *data)
1169 int err; 1169 int err;
1170 1170
1171 list_for_each_entry(s, &data->sensor_list, list) { 1171 list_for_each_entry(s, &data->sensor_list, list) {
1172 sysfs_attr_init(&s->input_attr.attr);
1172 err = device_create_file(data->hwmon_dev, &s->input_attr); 1173 err = device_create_file(data->hwmon_dev, &s->input_attr);
1173 if (err) 1174 if (err)
1174 return err; 1175 return err;
1176 sysfs_attr_init(&s->label_attr.attr);
1175 err = device_create_file(data->hwmon_dev, &s->label_attr); 1177 err = device_create_file(data->hwmon_dev, &s->label_attr);
1176 if (err) 1178 if (err)
1177 return err; 1179 return err;
1180 sysfs_attr_init(&s->limit1_attr.attr);
1178 err = device_create_file(data->hwmon_dev, &s->limit1_attr); 1181 err = device_create_file(data->hwmon_dev, &s->limit1_attr);
1179 if (err) 1182 if (err)
1180 return err; 1183 return err;
1184 sysfs_attr_init(&s->limit2_attr.attr);
1181 err = device_create_file(data->hwmon_dev, &s->limit2_attr); 1185 err = device_create_file(data->hwmon_dev, &s->limit2_attr);
1182 if (err) 1186 if (err)
1183 return err; 1187 return err;
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index be475e844c2a..7580f55e67e3 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -217,6 +217,10 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
217 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted), 217 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted),
218 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted), 218 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted),
219 AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted), 219 AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted),
220 AXIS_DMI_MATCH("HPB432x", "HP ProBook 432", xy_rotated_left),
221 AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left),
222 AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted),
223 AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap),
220 { NULL, } 224 { NULL, }
221/* Laptop models without axis info (yet): 225/* Laptop models without axis info (yet):
222 * "NC6910" "HP Compaq 6910" 226 * "NC6910" "HP Compaq 6910"
@@ -324,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
324 lis3lv02d_joystick_disable(); 328 lis3lv02d_joystick_disable();
325 lis3lv02d_poweroff(&lis3_dev); 329 lis3lv02d_poweroff(&lis3_dev);
326 330
327 flush_work(&hpled_led.work);
328 led_classdev_unregister(&hpled_led.led_classdev); 331 led_classdev_unregister(&hpled_led.led_classdev);
332 flush_work(&hpled_led.work);
329 333
330 return lis3lv02d_remove_fs(&lis3_dev); 334 return lis3lv02d_remove_fs(&lis3_dev);
331} 335}
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index f7e27b702375..d1ff9408dc1f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -146,10 +146,10 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
146 "<%s> I2C Interrupted\n", __func__); 146 "<%s> I2C Interrupted\n", __func__);
147 return -EINTR; 147 return -EINTR;
148 } 148 }
149 if (time_after(jiffies, orig_jiffies + HZ / 1000)) { 149 if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {
150 dev_dbg(&i2c_imx->adapter.dev, 150 dev_dbg(&i2c_imx->adapter.dev,
151 "<%s> I2C bus is busy\n", __func__); 151 "<%s> I2C bus is busy\n", __func__);
152 return -EIO; 152 return -ETIMEDOUT;
153 } 153 }
154 schedule(); 154 schedule();
155 } 155 }
@@ -444,6 +444,8 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
444 result = i2c_imx_read(i2c_imx, &msgs[i]); 444 result = i2c_imx_read(i2c_imx, &msgs[i]);
445 else 445 else
446 result = i2c_imx_write(i2c_imx, &msgs[i]); 446 result = i2c_imx_write(i2c_imx, &msgs[i]);
447 if (result)
448 goto fail0;
447 } 449 }
448 450
449fail0: 451fail0:
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index a2481f40ea1c..0e9f85d0a835 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -447,7 +447,7 @@ static struct i2c_adapter octeon_i2c_ops = {
447/** 447/**
448 * octeon_i2c_setclock - Calculate and set clock divisors. 448 * octeon_i2c_setclock - Calculate and set clock divisors.
449 */ 449 */
450static int __init octeon_i2c_setclock(struct octeon_i2c *i2c) 450static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)
451{ 451{
452 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff; 452 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
453 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; 453 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
@@ -490,7 +490,7 @@ static int __init octeon_i2c_setclock(struct octeon_i2c *i2c)
490 return 0; 490 return 0;
491} 491}
492 492
493static int __init octeon_i2c_initlowlevel(struct octeon_i2c *i2c) 493static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
494{ 494{
495 u8 status; 495 u8 status;
496 int tries; 496 int tries;
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 6bd0f19cd451..389ac6032a7b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -903,6 +903,11 @@ omap_i2c_probe(struct platform_device *pdev)
903 903
904 platform_set_drvdata(pdev, dev); 904 platform_set_drvdata(pdev, dev);
905 905
906 if (cpu_is_omap7xx())
907 dev->reg_shift = 1;
908 else
909 dev->reg_shift = 2;
910
906 if ((r = omap_i2c_get_clocks(dev)) != 0) 911 if ((r = omap_i2c_get_clocks(dev)) != 0)
907 goto err_iounmap; 912 goto err_iounmap;
908 913
@@ -926,11 +931,6 @@ omap_i2c_probe(struct platform_device *pdev)
926 dev->b_hw = 1; /* Enable hardware fixes */ 931 dev->b_hw = 1; /* Enable hardware fixes */
927 } 932 }
928 933
929 if (cpu_is_omap7xx())
930 dev->reg_shift = 1;
931 else
932 dev->reg_shift = 2;
933
934 /* reset ASAP, clearing any IRQs */ 934 /* reset ASAP, clearing any IRQs */
935 omap_i2c_init(dev); 935 omap_i2c_init(dev);
936 936
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 247103372a06..a97e3fec8148 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -173,6 +173,9 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
173 /* We still have something to talk about... */ 173 /* We still have something to talk about... */
174 val = *alg_data->mif.buf++; 174 val = *alg_data->mif.buf++;
175 175
176 if (alg_data->mif.len == 1)
177 val |= stop_bit;
178
176 alg_data->mif.len--; 179 alg_data->mif.len--;
177 iowrite32(val, I2C_REG_TX(alg_data)); 180 iowrite32(val, I2C_REG_TX(alg_data));
178 181
@@ -246,6 +249,9 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
246 __func__); 249 __func__);
247 250
248 if (alg_data->mif.len == 1) { 251 if (alg_data->mif.len == 1) {
252 /* Last byte, do not acknowledge next rcv. */
253 val |= stop_bit;
254
249 /* 255 /*
250 * Enable interrupt RFDAIE (data in Rx fifo), 256 * Enable interrupt RFDAIE (data in Rx fifo),
251 * and disable DRMIE (need data for Tx) 257 * and disable DRMIE (need data for Tx)
@@ -633,6 +639,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
633 */ 639 */
634 640
635 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; 641 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2;
642 if (tmp > 0x3FF)
643 tmp = 0x3FF;
636 iowrite32(tmp, I2C_REG_CKH(alg_data)); 644 iowrite32(tmp, I2C_REG_CKH(alg_data));
637 iowrite32(tmp, I2C_REG_CKL(alg_data)); 645 iowrite32(tmp, I2C_REG_CKL(alg_data));
638 646
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 1f5b38be73bc..495be451d326 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -498,7 +498,7 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
498 int i = 0; 498 int i = 0;
499 499
500 /* Locate the apropriate clock setting */ 500 /* Locate the apropriate clock setting */
501 while (i < ARRAY_SIZE(stu300_clktable) && 501 while (i < ARRAY_SIZE(stu300_clktable) - 1 &&
502 stu300_clktable[i].rate < clkrate) 502 stu300_clktable[i].rate < clkrate)
503 i++; 503 i++;
504 504
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 3202a86f420e..c2258a51fe0c 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -40,12 +40,11 @@
40#include "i2c-core.h" 40#include "i2c-core.h"
41 41
42 42
43/* core_lock protects i2c_adapter_idr, userspace_devices, and guarantees 43/* core_lock protects i2c_adapter_idr, and guarantees
44 that device detection, deletion of detected devices, and attach_adapter 44 that device detection, deletion of detected devices, and attach_adapter
45 and detach_adapter calls are serialized */ 45 and detach_adapter calls are serialized */
46static DEFINE_MUTEX(core_lock); 46static DEFINE_MUTEX(core_lock);
47static DEFINE_IDR(i2c_adapter_idr); 47static DEFINE_IDR(i2c_adapter_idr);
48static LIST_HEAD(userspace_devices);
49 48
50static struct device_type i2c_client_type; 49static struct device_type i2c_client_type;
51static int i2c_check_addr(struct i2c_adapter *adapter, int addr); 50static int i2c_check_addr(struct i2c_adapter *adapter, int addr);
@@ -117,8 +116,10 @@ static int i2c_device_probe(struct device *dev)
117 dev_dbg(dev, "probe\n"); 116 dev_dbg(dev, "probe\n");
118 117
119 status = driver->probe(client, i2c_match_id(driver->id_table, client)); 118 status = driver->probe(client, i2c_match_id(driver->id_table, client));
120 if (status) 119 if (status) {
121 client->driver = NULL; 120 client->driver = NULL;
121 i2c_set_clientdata(client, NULL);
122 }
122 return status; 123 return status;
123} 124}
124 125
@@ -139,8 +140,10 @@ static int i2c_device_remove(struct device *dev)
139 dev->driver = NULL; 140 dev->driver = NULL;
140 status = 0; 141 status = 0;
141 } 142 }
142 if (status == 0) 143 if (status == 0) {
143 client->driver = NULL; 144 client->driver = NULL;
145 i2c_set_clientdata(client, NULL);
146 }
144 return status; 147 return status;
145} 148}
146 149
@@ -538,9 +541,9 @@ i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr,
538 return -EEXIST; 541 return -EEXIST;
539 542
540 /* Keep track of the added device */ 543 /* Keep track of the added device */
541 mutex_lock(&core_lock); 544 i2c_lock_adapter(adap);
542 list_add_tail(&client->detected, &userspace_devices); 545 list_add_tail(&client->detected, &adap->userspace_clients);
543 mutex_unlock(&core_lock); 546 i2c_unlock_adapter(adap);
544 dev_info(dev, "%s: Instantiated device %s at 0x%02hx\n", "new_device", 547 dev_info(dev, "%s: Instantiated device %s at 0x%02hx\n", "new_device",
545 info.type, info.addr); 548 info.type, info.addr);
546 549
@@ -579,9 +582,10 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr,
579 582
580 /* Make sure the device was added through sysfs */ 583 /* Make sure the device was added through sysfs */
581 res = -ENOENT; 584 res = -ENOENT;
582 mutex_lock(&core_lock); 585 i2c_lock_adapter(adap);
583 list_for_each_entry_safe(client, next, &userspace_devices, detected) { 586 list_for_each_entry_safe(client, next, &adap->userspace_clients,
584 if (client->addr == addr && client->adapter == adap) { 587 detected) {
588 if (client->addr == addr) {
585 dev_info(dev, "%s: Deleting device %s at 0x%02hx\n", 589 dev_info(dev, "%s: Deleting device %s at 0x%02hx\n",
586 "delete_device", client->name, client->addr); 590 "delete_device", client->name, client->addr);
587 591
@@ -591,7 +595,7 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr,
591 break; 595 break;
592 } 596 }
593 } 597 }
594 mutex_unlock(&core_lock); 598 i2c_unlock_adapter(adap);
595 599
596 if (res < 0) 600 if (res < 0)
597 dev_err(dev, "%s: Can't find device in list\n", 601 dev_err(dev, "%s: Can't find device in list\n",
@@ -673,6 +677,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
673 } 677 }
674 678
675 rt_mutex_init(&adap->bus_lock); 679 rt_mutex_init(&adap->bus_lock);
680 INIT_LIST_HEAD(&adap->userspace_clients);
676 681
677 /* Set default timeout to 1 second if not already set */ 682 /* Set default timeout to 1 second if not already set */
678 if (adap->timeout == 0) 683 if (adap->timeout == 0)
@@ -875,14 +880,15 @@ int i2c_del_adapter(struct i2c_adapter *adap)
875 return res; 880 return res;
876 881
877 /* Remove devices instantiated from sysfs */ 882 /* Remove devices instantiated from sysfs */
878 list_for_each_entry_safe(client, next, &userspace_devices, detected) { 883 i2c_lock_adapter(adap);
879 if (client->adapter == adap) { 884 list_for_each_entry_safe(client, next, &adap->userspace_clients,
880 dev_dbg(&adap->dev, "Removing %s at 0x%x\n", 885 detected) {
881 client->name, client->addr); 886 dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name,
882 list_del(&client->detected); 887 client->addr);
883 i2c_unregister_device(client); 888 list_del(&client->detected);
884 } 889 i2c_unregister_device(client);
885 } 890 }
891 i2c_unlock_adapter(adap);
886 892
887 /* Detach any active clients. This can't fail, thus we do not 893 /* Detach any active clients. This can't fail, thus we do not
888 checking the returned value. */ 894 checking the returned value. */
@@ -1260,12 +1266,23 @@ static int i2c_detect_address(struct i2c_client *temp_client,
1260 return 0; 1266 return 0;
1261 1267
1262 /* Make sure there is something at this address */ 1268 /* Make sure there is something at this address */
1263 if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) 1269 if (addr == 0x73 && (adapter->class & I2C_CLASS_HWMON)) {
1264 return 0; 1270 /* Special probe for FSC hwmon chips */
1271 union i2c_smbus_data dummy;
1265 1272
1266 /* Prevent 24RF08 corruption */ 1273 if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0,
1267 if ((addr & ~0x0f) == 0x50) 1274 I2C_SMBUS_BYTE_DATA, &dummy) < 0)
1268 i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); 1275 return 0;
1276 } else {
1277 if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1278 I2C_SMBUS_QUICK, NULL) < 0)
1279 return 0;
1280
1281 /* Prevent 24RF08 corruption */
1282 if ((addr & ~0x0f) == 0x50)
1283 i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1284 I2C_SMBUS_QUICK, NULL);
1285 }
1269 1286
1270 /* Finally call the custom detection function */ 1287 /* Finally call the custom detection function */
1271 memset(&info, 0, sizeof(struct i2c_board_info)); 1288 memset(&info, 0, sizeof(struct i2c_board_info));
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index ab87e4f7cec9..b85450865ff0 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -409,6 +409,8 @@ static struct pcmcia_device_id ide_ids[] = {
409 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420), 409 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420),
410 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 410 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
411 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 411 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
412 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 1GB", 0x2e6d1829, 0x55d5bffb),
413 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 4GB", 0x2e6d1829, 0x531e7d10),
412 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 414 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),
413 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 415 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
414 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 416 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
@@ -429,6 +431,8 @@ static struct pcmcia_device_id ide_ids[] = {
429 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), 431 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
430 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), 432 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2),
431 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), 433 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
434 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF133", 0x709b1bf1, 0x7558f133),
435 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS8GCF133", 0x709b1bf1, 0xb2f89b47),
432 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 436 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
433 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), 437 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
434 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 438 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index c52bec4d0530..423e0e6031ab 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -929,6 +929,24 @@ static const struct input_device_id joydev_ids[] = {
929 .evbit = { BIT_MASK(EV_ABS) }, 929 .evbit = { BIT_MASK(EV_ABS) },
930 .absbit = { BIT_MASK(ABS_THROTTLE) }, 930 .absbit = { BIT_MASK(ABS_THROTTLE) },
931 }, 931 },
932 {
933 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
934 INPUT_DEVICE_ID_MATCH_KEYBIT,
935 .evbit = { BIT_MASK(EV_KEY) },
936 .keybit = {[BIT_WORD(BTN_JOYSTICK)] = BIT_MASK(BTN_JOYSTICK) },
937 },
938 {
939 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
940 INPUT_DEVICE_ID_MATCH_KEYBIT,
941 .evbit = { BIT_MASK(EV_KEY) },
942 .keybit = { [BIT_WORD(BTN_GAMEPAD)] = BIT_MASK(BTN_GAMEPAD) },
943 },
944 {
945 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
946 INPUT_DEVICE_ID_MATCH_KEYBIT,
947 .evbit = { BIT_MASK(EV_KEY) },
948 .keybit = { [BIT_WORD(BTN_TRIGGER_HAPPY)] = BIT_MASK(BTN_TRIGGER_HAPPY) },
949 },
932 { } /* Terminating entry */ 950 { } /* Terminating entry */
933}; 951};
934 952
diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c
index 614b65d78fe9..e8bbc619f6df 100644
--- a/drivers/input/misc/ati_remote.c
+++ b/drivers/input/misc/ati_remote.c
@@ -98,10 +98,12 @@
98 * Module and Version Information, Module Parameters 98 * Module and Version Information, Module Parameters
99 */ 99 */
100 100
101#define ATI_REMOTE_VENDOR_ID 0x0bc7 101#define ATI_REMOTE_VENDOR_ID 0x0bc7
102#define ATI_REMOTE_PRODUCT_ID 0x004 102#define LOLA_REMOTE_PRODUCT_ID 0x0002
103#define LOLA_REMOTE_PRODUCT_ID 0x002 103#define LOLA2_REMOTE_PRODUCT_ID 0x0003
104#define MEDION_REMOTE_PRODUCT_ID 0x006 104#define ATI_REMOTE_PRODUCT_ID 0x0004
105#define NVIDIA_REMOTE_PRODUCT_ID 0x0005
106#define MEDION_REMOTE_PRODUCT_ID 0x0006
105 107
106#define DRIVER_VERSION "2.2.1" 108#define DRIVER_VERSION "2.2.1"
107#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>" 109#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>"
@@ -142,8 +144,10 @@ MODULE_PARM_DESC(repeat_delay, "Delay before sending repeats, default = 500 msec
142#define err(format, arg...) printk(KERN_ERR format , ## arg) 144#define err(format, arg...) printk(KERN_ERR format , ## arg)
143 145
144static struct usb_device_id ati_remote_table[] = { 146static struct usb_device_id ati_remote_table[] = {
145 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
146 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) }, 147 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },
148 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID) },
149 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
150 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID) },
147 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID) }, 151 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID) },
148 {} /* Terminating entry */ 152 {} /* Terminating entry */
149}; 153};
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0d22cb9ce42e..99d58764ef03 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -64,7 +64,6 @@ static const struct alps_model_info alps_model_data[] = {
64 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, 64 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
65 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, 65 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
66 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 66 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
67 { { 0x73, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, /* HP Pavilion dm3 */
68 { { 0x52, 0x01, 0x14 }, 0xff, 0xff, 67 { { 0x52, 0x01, 0x14 }, 0xff, 0xff,
69 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ 68 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
70}; 69};
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index a138b5da79f9..0520c2e19927 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -25,6 +25,10 @@
25 printk(KERN_DEBUG format, ##arg); \ 25 printk(KERN_DEBUG format, ##arg); \
26 } while (0) 26 } while (0)
27 27
28static bool force_elantech;
29module_param_named(force_elantech, force_elantech, bool, 0644);
30MODULE_PARM_DESC(force_elantech, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default).");
31
28/* 32/*
29 * Send a Synaptics style sliced query command 33 * Send a Synaptics style sliced query command
30 */ 34 */
@@ -182,13 +186,17 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
182 static int old_fingers; 186 static int old_fingers;
183 187
184 if (etd->fw_version_maj == 0x01) { 188 if (etd->fw_version_maj == 0x01) {
185 /* byte 0: D U p1 p2 1 p3 R L 189 /*
186 byte 1: f 0 th tw x9 x8 y9 y8 */ 190 * byte 0: D U p1 p2 1 p3 R L
191 * byte 1: f 0 th tw x9 x8 y9 y8
192 */
187 fingers = ((packet[1] & 0x80) >> 7) + 193 fingers = ((packet[1] & 0x80) >> 7) +
188 ((packet[1] & 0x30) >> 4); 194 ((packet[1] & 0x30) >> 4);
189 } else { 195 } else {
190 /* byte 0: n1 n0 p2 p1 1 p3 R L 196 /*
191 byte 1: 0 0 0 0 x9 x8 y9 y8 */ 197 * byte 0: n1 n0 p2 p1 1 p3 R L
198 * byte 1: 0 0 0 0 x9 x8 y9 y8
199 */
192 fingers = (packet[0] & 0xc0) >> 6; 200 fingers = (packet[0] & 0xc0) >> 6;
193 } 201 }
194 202
@@ -202,13 +210,15 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
202 210
203 input_report_key(dev, BTN_TOUCH, fingers != 0); 211 input_report_key(dev, BTN_TOUCH, fingers != 0);
204 212
205 /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 213 /*
206 byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */ 214 * byte 2: x7 x6 x5 x4 x3 x2 x1 x0
215 * byte 3: y7 y6 y5 y4 y3 y2 y1 y0
216 */
207 if (fingers) { 217 if (fingers) {
208 input_report_abs(dev, ABS_X, 218 input_report_abs(dev, ABS_X,
209 ((packet[1] & 0x0c) << 6) | packet[2]); 219 ((packet[1] & 0x0c) << 6) | packet[2]);
210 input_report_abs(dev, ABS_Y, ETP_YMAX_V1 - 220 input_report_abs(dev, ABS_Y,
211 (((packet[1] & 0x03) << 8) | packet[3])); 221 ETP_YMAX_V1 - (((packet[1] & 0x03) << 8) | packet[3]));
212 } 222 }
213 223
214 input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); 224 input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
@@ -247,34 +257,47 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
247 257
248 switch (fingers) { 258 switch (fingers) {
249 case 1: 259 case 1:
250 /* byte 1: x15 x14 x13 x12 x11 x10 x9 x8 260 /*
251 byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */ 261 * byte 1: . . . . . x10 x9 x8
252 input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]); 262 * byte 2: x7 x6 x5 x4 x4 x2 x1 x0
253 /* byte 4: y15 y14 y13 y12 y11 y10 y8 y8 263 */
254 byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */ 264 input_report_abs(dev, ABS_X,
255 input_report_abs(dev, ABS_Y, ETP_YMAX_V2 - 265 ((packet[1] & 0x07) << 8) | packet[2]);
256 ((packet[4] << 8) | packet[5])); 266 /*
267 * byte 4: . . . . . . y9 y8
268 * byte 5: y7 y6 y5 y4 y3 y2 y1 y0
269 */
270 input_report_abs(dev, ABS_Y,
271 ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]));
257 break; 272 break;
258 273
259 case 2: 274 case 2:
260 /* The coordinate of each finger is reported separately with 275 /*
261 a lower resolution for two finger touches */ 276 * The coordinate of each finger is reported separately
262 /* byte 0: . . ay8 ax8 . . . . 277 * with a lower resolution for two finger touches:
263 byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */ 278 * byte 0: . . ay8 ax8 . . . .
279 * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
280 */
264 x1 = ((packet[0] & 0x10) << 4) | packet[1]; 281 x1 = ((packet[0] & 0x10) << 4) | packet[1];
265 /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ 282 /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */
266 y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); 283 y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]);
267 /* byte 3: . . by8 bx8 . . . . 284 /*
268 byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */ 285 * byte 3: . . by8 bx8 . . . .
286 * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
287 */
269 x2 = ((packet[3] & 0x10) << 4) | packet[4]; 288 x2 = ((packet[3] & 0x10) << 4) | packet[4];
270 /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ 289 /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */
271 y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); 290 y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]);
272 /* For compatibility with the X Synaptics driver scale up one 291 /*
273 coordinate and report as ordinary mouse movent */ 292 * For compatibility with the X Synaptics driver scale up
293 * one coordinate and report as ordinary mouse movent
294 */
274 input_report_abs(dev, ABS_X, x1 << 2); 295 input_report_abs(dev, ABS_X, x1 << 2);
275 input_report_abs(dev, ABS_Y, y1 << 2); 296 input_report_abs(dev, ABS_Y, y1 << 2);
276 /* For compatibility with the proprietary X Elantech driver 297 /*
277 report both coordinates as hat coordinates */ 298 * For compatibility with the proprietary X Elantech driver
299 * report both coordinates as hat coordinates
300 */
278 input_report_abs(dev, ABS_HAT0X, x1); 301 input_report_abs(dev, ABS_HAT0X, x1);
279 input_report_abs(dev, ABS_HAT0Y, y1); 302 input_report_abs(dev, ABS_HAT0Y, y1);
280 input_report_abs(dev, ABS_HAT1X, x2); 303 input_report_abs(dev, ABS_HAT1X, x2);
@@ -596,8 +619,12 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
596 param[0], param[1], param[2]); 619 param[0], param[1], param[2]);
597 620
598 if (param[0] == 0 || param[1] != 0) { 621 if (param[0] == 0 || param[1] != 0) {
599 pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n"); 622 if (!force_elantech) {
600 return -1; 623 pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
624 return -1;
625 }
626
627 pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
601 } 628 }
602 629
603 if (set_properties) { 630 if (set_properties) {
@@ -666,7 +693,8 @@ int elantech_init(struct psmouse *psmouse)
666 * Assume every version greater than this is new EeePC style 693 * Assume every version greater than this is new EeePC style
667 * hardware with 6 byte packets 694 * hardware with 6 byte packets
668 */ 695 */
669 if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) { 696 if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) ||
697 etd->fw_version_maj > 0x02) {
670 etd->hw_version = 2; 698 etd->hw_version = 2;
671 /* For now show extra debug information */ 699 /* For now show extra debug information */
672 etd->debug = 1; 700 etd->debug = 1;
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index d8c0c8d6992c..cbc807264940 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -110,6 +110,7 @@ static struct workqueue_struct *kpsmoused_wq;
110struct psmouse_protocol { 110struct psmouse_protocol {
111 enum psmouse_type type; 111 enum psmouse_type type;
112 bool maxproto; 112 bool maxproto;
113 bool ignore_parity; /* Protocol should ignore parity errors from KBC */
113 const char *name; 114 const char *name;
114 const char *alias; 115 const char *alias;
115 int (*detect)(struct psmouse *, bool); 116 int (*detect)(struct psmouse *, bool);
@@ -288,7 +289,9 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
288 if (psmouse->state == PSMOUSE_IGNORE) 289 if (psmouse->state == PSMOUSE_IGNORE)
289 goto out; 290 goto out;
290 291
291 if (flags & (SERIO_PARITY|SERIO_TIMEOUT)) { 292 if (unlikely((flags & SERIO_TIMEOUT) ||
293 ((flags & SERIO_PARITY) && !psmouse->ignore_parity))) {
294
292 if (psmouse->state == PSMOUSE_ACTIVATED) 295 if (psmouse->state == PSMOUSE_ACTIVATED)
293 printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", 296 printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n",
294 flags & SERIO_TIMEOUT ? " timeout" : "", 297 flags & SERIO_TIMEOUT ? " timeout" : "",
@@ -759,6 +762,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
759 .name = "PS/2", 762 .name = "PS/2",
760 .alias = "bare", 763 .alias = "bare",
761 .maxproto = true, 764 .maxproto = true,
765 .ignore_parity = true,
762 .detect = ps2bare_detect, 766 .detect = ps2bare_detect,
763 }, 767 },
764#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP 768#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
@@ -786,6 +790,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
786 .name = "ImPS/2", 790 .name = "ImPS/2",
787 .alias = "imps", 791 .alias = "imps",
788 .maxproto = true, 792 .maxproto = true,
793 .ignore_parity = true,
789 .detect = intellimouse_detect, 794 .detect = intellimouse_detect,
790 }, 795 },
791 { 796 {
@@ -793,6 +798,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
793 .name = "ImExPS/2", 798 .name = "ImExPS/2",
794 .alias = "exps", 799 .alias = "exps",
795 .maxproto = true, 800 .maxproto = true,
801 .ignore_parity = true,
796 .detect = im_explorer_detect, 802 .detect = im_explorer_detect,
797 }, 803 },
798#ifdef CONFIG_MOUSE_PS2_SYNAPTICS 804#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
@@ -1222,6 +1228,7 @@ static void psmouse_disconnect(struct serio *serio)
1222static int psmouse_switch_protocol(struct psmouse *psmouse, 1228static int psmouse_switch_protocol(struct psmouse *psmouse,
1223 const struct psmouse_protocol *proto) 1229 const struct psmouse_protocol *proto)
1224{ 1230{
1231 const struct psmouse_protocol *selected_proto;
1225 struct input_dev *input_dev = psmouse->dev; 1232 struct input_dev *input_dev = psmouse->dev;
1226 1233
1227 input_dev->dev.parent = &psmouse->ps2dev.serio->dev; 1234 input_dev->dev.parent = &psmouse->ps2dev.serio->dev;
@@ -1245,9 +1252,14 @@ static int psmouse_switch_protocol(struct psmouse *psmouse,
1245 return -1; 1252 return -1;
1246 1253
1247 psmouse->type = proto->type; 1254 psmouse->type = proto->type;
1248 } else 1255 selected_proto = proto;
1256 } else {
1249 psmouse->type = psmouse_extensions(psmouse, 1257 psmouse->type = psmouse_extensions(psmouse,
1250 psmouse_max_proto, true); 1258 psmouse_max_proto, true);
1259 selected_proto = psmouse_protocol_by_type(psmouse->type);
1260 }
1261
1262 psmouse->ignore_parity = selected_proto->ignore_parity;
1251 1263
1252 /* 1264 /*
1253 * If mouse's packet size is 3 there is no point in polling the 1265 * If mouse's packet size is 3 there is no point in polling the
@@ -1267,7 +1279,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse,
1267 psmouse->resync_time = 0; 1279 psmouse->resync_time = 0;
1268 1280
1269 snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", 1281 snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s",
1270 psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name); 1282 selected_proto->name, psmouse->vendor, psmouse->name);
1271 1283
1272 input_dev->name = psmouse->devname; 1284 input_dev->name = psmouse->devname;
1273 input_dev->phys = psmouse->phys; 1285 input_dev->phys = psmouse->phys;
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index e053bdd137ff..593e910bfc7a 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -47,6 +47,7 @@ struct psmouse {
47 unsigned char pktcnt; 47 unsigned char pktcnt;
48 unsigned char pktsize; 48 unsigned char pktsize;
49 unsigned char type; 49 unsigned char type;
50 bool ignore_parity;
50 bool acks_disable_command; 51 bool acks_disable_command;
51 unsigned int model; 52 unsigned int model;
52 unsigned long last; 53 unsigned long last;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 026df6010161..ebd7a99efeae 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -137,7 +137,8 @@ static int synaptics_capability(struct psmouse *psmouse)
137 if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) 137 if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap))
138 return -1; 138 return -1;
139 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 139 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
140 priv->ext_cap = 0; 140 priv->ext_cap = priv->ext_cap_0c = 0;
141
141 if (!SYN_CAP_VALID(priv->capabilities)) 142 if (!SYN_CAP_VALID(priv->capabilities))
142 return -1; 143 return -1;
143 144
@@ -150,7 +151,7 @@ static int synaptics_capability(struct psmouse *psmouse)
150 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { 151 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
151 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { 152 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
152 printk(KERN_ERR "Synaptics claims to have extended capabilities," 153 printk(KERN_ERR "Synaptics claims to have extended capabilities,"
153 " but I'm not able to read them."); 154 " but I'm not able to read them.\n");
154 } else { 155 } else {
155 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 156 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
156 157
@@ -162,6 +163,16 @@ static int synaptics_capability(struct psmouse *psmouse)
162 priv->ext_cap &= 0xff0fff; 163 priv->ext_cap &= 0xff0fff;
163 } 164 }
164 } 165 }
166
167 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
168 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
169 printk(KERN_ERR "Synaptics claims to have extended capability 0x0c,"
170 " but I'm not able to read it.\n");
171 } else {
172 priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
173 }
174 }
175
165 return 0; 176 return 0;
166} 177}
167 178
@@ -348,7 +359,15 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
348 hw->left = (buf[0] & 0x01) ? 1 : 0; 359 hw->left = (buf[0] & 0x01) ? 1 : 0;
349 hw->right = (buf[0] & 0x02) ? 1 : 0; 360 hw->right = (buf[0] & 0x02) ? 1 : 0;
350 361
351 if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { 362 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
363 /*
364 * Clickpad's button is transmitted as middle button,
365 * however, since it is primary button, we will report
366 * it as BTN_LEFT.
367 */
368 hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
369
370 } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
352 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; 371 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
353 if (hw->w == 2) 372 if (hw->w == 2)
354 hw->scroll = (signed char)(buf[1]); 373 hw->scroll = (signed char)(buf[1]);
@@ -593,6 +612,12 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
593 612
594 dev->absres[ABS_X] = priv->x_res; 613 dev->absres[ABS_X] = priv->x_res;
595 dev->absres[ABS_Y] = priv->y_res; 614 dev->absres[ABS_Y] = priv->y_res;
615
616 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
617 /* Clickpads report only left button */
618 __clear_bit(BTN_RIGHT, dev->keybit);
619 __clear_bit(BTN_MIDDLE, dev->keybit);
620 }
596} 621}
597 622
598static void synaptics_disconnect(struct psmouse *psmouse) 623static void synaptics_disconnect(struct psmouse *psmouse)
@@ -697,10 +722,10 @@ int synaptics_init(struct psmouse *psmouse)
697 722
698 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 723 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
699 724
700 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n", 725 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
701 SYN_ID_MODEL(priv->identity), 726 SYN_ID_MODEL(priv->identity),
702 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), 727 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
703 priv->model_id, priv->capabilities, priv->ext_cap); 728 priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
704 729
705 set_input_params(psmouse->dev, priv); 730 set_input_params(psmouse->dev, priv);
706 731
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index f0f40a331dc8..ae37c5d162a4 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -18,6 +18,7 @@
18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
19#define SYN_QUE_RESOLUTION 0x08 19#define SYN_QUE_RESOLUTION 0x08
20#define SYN_QUE_EXT_CAPAB 0x09 20#define SYN_QUE_EXT_CAPAB 0x09
21#define SYN_QUE_EXT_CAPAB_0C 0x0c
21 22
22/* synatics modes */ 23/* synatics modes */
23#define SYN_BIT_ABSOLUTE_MODE (1 << 7) 24#define SYN_BIT_ABSOLUTE_MODE (1 << 7)
@@ -48,6 +49,8 @@
48#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) 49#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47)
49#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 50#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
50#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 51#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
52#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
53#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100)
51 54
52/* synaptics modes query bits */ 55/* synaptics modes query bits */
53#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) 56#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
@@ -96,6 +99,7 @@ struct synaptics_data {
96 unsigned long int model_id; /* Model-ID */ 99 unsigned long int model_id; /* Model-ID */
97 unsigned long int capabilities; /* Capabilities */ 100 unsigned long int capabilities; /* Capabilities */
98 unsigned long int ext_cap; /* Extended Capabilities */ 101 unsigned long int ext_cap; /* Extended Capabilities */
102 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
99 unsigned long int identity; /* Identification */ 103 unsigned long int identity; /* Identification */
100 int x_res; /* X resolution in units/mm */ 104 int x_res; /* X resolution in units/mm */
101 int y_res; /* Y resolution in units/mm */ 105 int y_res; /* Y resolution in units/mm */
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 204b8a1a601c..75f8b73010fa 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -124,14 +124,25 @@ static irqreturn_t eeti_ts_isr(int irq, void *dev_id)
124 return IRQ_HANDLED; 124 return IRQ_HANDLED;
125} 125}
126 126
127static int eeti_ts_open(struct input_dev *dev) 127static void eeti_ts_start(struct eeti_ts_priv *priv)
128{ 128{
129 struct eeti_ts_priv *priv = input_get_drvdata(dev);
130
131 enable_irq(priv->irq); 129 enable_irq(priv->irq);
132 130
133 /* Read the events once to arm the IRQ */ 131 /* Read the events once to arm the IRQ */
134 eeti_ts_read(&priv->work); 132 eeti_ts_read(&priv->work);
133}
134
135static void eeti_ts_stop(struct eeti_ts_priv *priv)
136{
137 disable_irq(priv->irq);
138 cancel_work_sync(&priv->work);
139}
140
141static int eeti_ts_open(struct input_dev *dev)
142{
143 struct eeti_ts_priv *priv = input_get_drvdata(dev);
144
145 eeti_ts_start(priv);
135 146
136 return 0; 147 return 0;
137} 148}
@@ -140,8 +151,7 @@ static void eeti_ts_close(struct input_dev *dev)
140{ 151{
141 struct eeti_ts_priv *priv = input_get_drvdata(dev); 152 struct eeti_ts_priv *priv = input_get_drvdata(dev);
142 153
143 disable_irq(priv->irq); 154 eeti_ts_stop(priv);
144 cancel_work_sync(&priv->work);
145} 155}
146 156
147static int __devinit eeti_ts_probe(struct i2c_client *client, 157static int __devinit eeti_ts_probe(struct i2c_client *client,
@@ -153,10 +163,12 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
153 unsigned int irq_flags; 163 unsigned int irq_flags;
154 int err = -ENOMEM; 164 int err = -ENOMEM;
155 165
156 /* In contrast to what's described in the datasheet, there seems 166 /*
167 * In contrast to what's described in the datasheet, there seems
157 * to be no way of probing the presence of that device using I2C 168 * to be no way of probing the presence of that device using I2C
158 * commands. So we need to blindly believe it is there, and wait 169 * commands. So we need to blindly believe it is there, and wait
159 * for interrupts to occur. */ 170 * for interrupts to occur.
171 */
160 172
161 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 173 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
162 if (!priv) { 174 if (!priv) {
@@ -212,9 +224,11 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
212 goto err2; 224 goto err2;
213 } 225 }
214 226
215 /* Disable the irq for now. It will be enabled once the input device 227 /*
216 * is opened. */ 228 * Disable the device for now. It will be enabled once the
217 disable_irq(priv->irq); 229 * input device is opened.
230 */
231 eeti_ts_stop(priv);
218 232
219 device_init_wakeup(&client->dev, 0); 233 device_init_wakeup(&client->dev, 0);
220 return 0; 234 return 0;
@@ -235,6 +249,12 @@ static int __devexit eeti_ts_remove(struct i2c_client *client)
235 struct eeti_ts_priv *priv = i2c_get_clientdata(client); 249 struct eeti_ts_priv *priv = i2c_get_clientdata(client);
236 250
237 free_irq(priv->irq, priv); 251 free_irq(priv->irq, priv);
252 /*
253 * eeti_ts_stop() leaves IRQ disabled. We need to re-enable it
254 * so that device still works if we reload the driver.
255 */
256 enable_irq(priv->irq);
257
238 input_unregister_device(priv->input); 258 input_unregister_device(priv->input);
239 i2c_set_clientdata(client, NULL); 259 i2c_set_clientdata(client, NULL);
240 kfree(priv); 260 kfree(priv);
@@ -246,6 +266,14 @@ static int __devexit eeti_ts_remove(struct i2c_client *client)
246static int eeti_ts_suspend(struct i2c_client *client, pm_message_t mesg) 266static int eeti_ts_suspend(struct i2c_client *client, pm_message_t mesg)
247{ 267{
248 struct eeti_ts_priv *priv = i2c_get_clientdata(client); 268 struct eeti_ts_priv *priv = i2c_get_clientdata(client);
269 struct input_dev *input_dev = priv->input;
270
271 mutex_lock(&input_dev->mutex);
272
273 if (input_dev->users)
274 eeti_ts_stop(priv);
275
276 mutex_unlock(&input_dev->mutex);
249 277
250 if (device_may_wakeup(&client->dev)) 278 if (device_may_wakeup(&client->dev))
251 enable_irq_wake(priv->irq); 279 enable_irq_wake(priv->irq);
@@ -256,10 +284,18 @@ static int eeti_ts_suspend(struct i2c_client *client, pm_message_t mesg)
256static int eeti_ts_resume(struct i2c_client *client) 284static int eeti_ts_resume(struct i2c_client *client)
257{ 285{
258 struct eeti_ts_priv *priv = i2c_get_clientdata(client); 286 struct eeti_ts_priv *priv = i2c_get_clientdata(client);
287 struct input_dev *input_dev = priv->input;
259 288
260 if (device_may_wakeup(&client->dev)) 289 if (device_may_wakeup(&client->dev))
261 disable_irq_wake(priv->irq); 290 disable_irq_wake(priv->irq);
262 291
292 mutex_lock(&input_dev->mutex);
293
294 if (input_dev->users)
295 eeti_ts_start(priv);
296
297 mutex_unlock(&input_dev->mutex);
298
263 return 0; 299 return 0;
264} 300}
265#else 301#else
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9712b2e97be4..cefd63daff31 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2109,12 +2109,18 @@ repeat:
2109 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ 2109 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
2110 /* .. if the array isn't clean, an 'even' event must also go 2110 /* .. if the array isn't clean, an 'even' event must also go
2111 * to spares. */ 2111 * to spares. */
2112 if ((mddev->events&1)==0) 2112 if ((mddev->events&1)==0) {
2113 nospares = 0; 2113 nospares = 0;
2114 sync_req = 2; /* force a second update to get the
2115 * even/odd in sync */
2116 }
2114 } else { 2117 } else {
2115 /* otherwise an 'odd' event must go to spares */ 2118 /* otherwise an 'odd' event must go to spares */
2116 if ((mddev->events&1)) 2119 if ((mddev->events&1)) {
2117 nospares = 0; 2120 nospares = 0;
2121 sync_req = 2; /* force a second update to get the
2122 * even/odd in sync */
2123 }
2118 } 2124 }
2119 } 2125 }
2120 2126
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e3e9a36ea3b7..15348c393b5d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1527,7 +1527,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1527 1527
1528 clear_bit(R5_UPTODATE, &sh->dev[i].flags); 1528 clear_bit(R5_UPTODATE, &sh->dev[i].flags);
1529 atomic_inc(&rdev->read_errors); 1529 atomic_inc(&rdev->read_errors);
1530 if (conf->mddev->degraded) 1530 if (conf->mddev->degraded >= conf->max_degraded)
1531 printk_rl(KERN_WARNING 1531 printk_rl(KERN_WARNING
1532 "raid5:%s: read error not correctable " 1532 "raid5:%s: read error not correctable "
1533 "(sector %llu on %s).\n", 1533 "(sector %llu on %s).\n",
@@ -1650,8 +1650,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1650 int previous, int *dd_idx, 1650 int previous, int *dd_idx,
1651 struct stripe_head *sh) 1651 struct stripe_head *sh)
1652{ 1652{
1653 long stripe; 1653 sector_t stripe, stripe2;
1654 unsigned long chunk_number; 1654 sector_t chunk_number;
1655 unsigned int chunk_offset; 1655 unsigned int chunk_offset;
1656 int pd_idx, qd_idx; 1656 int pd_idx, qd_idx;
1657 int ddf_layout = 0; 1657 int ddf_layout = 0;
@@ -1671,18 +1671,13 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1671 */ 1671 */
1672 chunk_offset = sector_div(r_sector, sectors_per_chunk); 1672 chunk_offset = sector_div(r_sector, sectors_per_chunk);
1673 chunk_number = r_sector; 1673 chunk_number = r_sector;
1674 BUG_ON(r_sector != chunk_number);
1675 1674
1676 /* 1675 /*
1677 * Compute the stripe number 1676 * Compute the stripe number
1678 */ 1677 */
1679 stripe = chunk_number / data_disks; 1678 stripe = chunk_number;
1680 1679 *dd_idx = sector_div(stripe, data_disks);
1681 /* 1680 stripe2 = stripe;
1682 * Compute the data disk and parity disk indexes inside the stripe
1683 */
1684 *dd_idx = chunk_number % data_disks;
1685
1686 /* 1681 /*
1687 * Select the parity disk based on the user selected algorithm. 1682 * Select the parity disk based on the user selected algorithm.
1688 */ 1683 */
@@ -1694,21 +1689,21 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1694 case 5: 1689 case 5:
1695 switch (algorithm) { 1690 switch (algorithm) {
1696 case ALGORITHM_LEFT_ASYMMETRIC: 1691 case ALGORITHM_LEFT_ASYMMETRIC:
1697 pd_idx = data_disks - stripe % raid_disks; 1692 pd_idx = data_disks - sector_div(stripe2, raid_disks);
1698 if (*dd_idx >= pd_idx) 1693 if (*dd_idx >= pd_idx)
1699 (*dd_idx)++; 1694 (*dd_idx)++;
1700 break; 1695 break;
1701 case ALGORITHM_RIGHT_ASYMMETRIC: 1696 case ALGORITHM_RIGHT_ASYMMETRIC:
1702 pd_idx = stripe % raid_disks; 1697 pd_idx = sector_div(stripe2, raid_disks);
1703 if (*dd_idx >= pd_idx) 1698 if (*dd_idx >= pd_idx)
1704 (*dd_idx)++; 1699 (*dd_idx)++;
1705 break; 1700 break;
1706 case ALGORITHM_LEFT_SYMMETRIC: 1701 case ALGORITHM_LEFT_SYMMETRIC:
1707 pd_idx = data_disks - stripe % raid_disks; 1702 pd_idx = data_disks - sector_div(stripe2, raid_disks);
1708 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; 1703 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1709 break; 1704 break;
1710 case ALGORITHM_RIGHT_SYMMETRIC: 1705 case ALGORITHM_RIGHT_SYMMETRIC:
1711 pd_idx = stripe % raid_disks; 1706 pd_idx = sector_div(stripe2, raid_disks);
1712 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; 1707 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1713 break; 1708 break;
1714 case ALGORITHM_PARITY_0: 1709 case ALGORITHM_PARITY_0:
@@ -1728,7 +1723,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1728 1723
1729 switch (algorithm) { 1724 switch (algorithm) {
1730 case ALGORITHM_LEFT_ASYMMETRIC: 1725 case ALGORITHM_LEFT_ASYMMETRIC:
1731 pd_idx = raid_disks - 1 - (stripe % raid_disks); 1726 pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1732 qd_idx = pd_idx + 1; 1727 qd_idx = pd_idx + 1;
1733 if (pd_idx == raid_disks-1) { 1728 if (pd_idx == raid_disks-1) {
1734 (*dd_idx)++; /* Q D D D P */ 1729 (*dd_idx)++; /* Q D D D P */
@@ -1737,7 +1732,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1737 (*dd_idx) += 2; /* D D P Q D */ 1732 (*dd_idx) += 2; /* D D P Q D */
1738 break; 1733 break;
1739 case ALGORITHM_RIGHT_ASYMMETRIC: 1734 case ALGORITHM_RIGHT_ASYMMETRIC:
1740 pd_idx = stripe % raid_disks; 1735 pd_idx = sector_div(stripe2, raid_disks);
1741 qd_idx = pd_idx + 1; 1736 qd_idx = pd_idx + 1;
1742 if (pd_idx == raid_disks-1) { 1737 if (pd_idx == raid_disks-1) {
1743 (*dd_idx)++; /* Q D D D P */ 1738 (*dd_idx)++; /* Q D D D P */
@@ -1746,12 +1741,12 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1746 (*dd_idx) += 2; /* D D P Q D */ 1741 (*dd_idx) += 2; /* D D P Q D */
1747 break; 1742 break;
1748 case ALGORITHM_LEFT_SYMMETRIC: 1743 case ALGORITHM_LEFT_SYMMETRIC:
1749 pd_idx = raid_disks - 1 - (stripe % raid_disks); 1744 pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1750 qd_idx = (pd_idx + 1) % raid_disks; 1745 qd_idx = (pd_idx + 1) % raid_disks;
1751 *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; 1746 *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
1752 break; 1747 break;
1753 case ALGORITHM_RIGHT_SYMMETRIC: 1748 case ALGORITHM_RIGHT_SYMMETRIC:
1754 pd_idx = stripe % raid_disks; 1749 pd_idx = sector_div(stripe2, raid_disks);
1755 qd_idx = (pd_idx + 1) % raid_disks; 1750 qd_idx = (pd_idx + 1) % raid_disks;
1756 *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; 1751 *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
1757 break; 1752 break;
@@ -1770,7 +1765,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1770 /* Exactly the same as RIGHT_ASYMMETRIC, but or 1765 /* Exactly the same as RIGHT_ASYMMETRIC, but or
1771 * of blocks for computing Q is different. 1766 * of blocks for computing Q is different.
1772 */ 1767 */
1773 pd_idx = stripe % raid_disks; 1768 pd_idx = sector_div(stripe2, raid_disks);
1774 qd_idx = pd_idx + 1; 1769 qd_idx = pd_idx + 1;
1775 if (pd_idx == raid_disks-1) { 1770 if (pd_idx == raid_disks-1) {
1776 (*dd_idx)++; /* Q D D D P */ 1771 (*dd_idx)++; /* Q D D D P */
@@ -1785,7 +1780,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1785 * D D D P Q rather than 1780 * D D D P Q rather than
1786 * Q D D D P 1781 * Q D D D P
1787 */ 1782 */
1788 pd_idx = raid_disks - 1 - ((stripe + 1) % raid_disks); 1783 stripe2 += 1;
1784 pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1789 qd_idx = pd_idx + 1; 1785 qd_idx = pd_idx + 1;
1790 if (pd_idx == raid_disks-1) { 1786 if (pd_idx == raid_disks-1) {
1791 (*dd_idx)++; /* Q D D D P */ 1787 (*dd_idx)++; /* Q D D D P */
@@ -1797,7 +1793,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1797 1793
1798 case ALGORITHM_ROTATING_N_CONTINUE: 1794 case ALGORITHM_ROTATING_N_CONTINUE:
1799 /* Same as left_symmetric but Q is before P */ 1795 /* Same as left_symmetric but Q is before P */
1800 pd_idx = raid_disks - 1 - (stripe % raid_disks); 1796 pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1801 qd_idx = (pd_idx + raid_disks - 1) % raid_disks; 1797 qd_idx = (pd_idx + raid_disks - 1) % raid_disks;
1802 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; 1798 *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1803 ddf_layout = 1; 1799 ddf_layout = 1;
@@ -1805,27 +1801,27 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1805 1801
1806 case ALGORITHM_LEFT_ASYMMETRIC_6: 1802 case ALGORITHM_LEFT_ASYMMETRIC_6:
1807 /* RAID5 left_asymmetric, with Q on last device */ 1803 /* RAID5 left_asymmetric, with Q on last device */
1808 pd_idx = data_disks - stripe % (raid_disks-1); 1804 pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
1809 if (*dd_idx >= pd_idx) 1805 if (*dd_idx >= pd_idx)
1810 (*dd_idx)++; 1806 (*dd_idx)++;
1811 qd_idx = raid_disks - 1; 1807 qd_idx = raid_disks - 1;
1812 break; 1808 break;
1813 1809
1814 case ALGORITHM_RIGHT_ASYMMETRIC_6: 1810 case ALGORITHM_RIGHT_ASYMMETRIC_6:
1815 pd_idx = stripe % (raid_disks-1); 1811 pd_idx = sector_div(stripe2, raid_disks-1);
1816 if (*dd_idx >= pd_idx) 1812 if (*dd_idx >= pd_idx)
1817 (*dd_idx)++; 1813 (*dd_idx)++;
1818 qd_idx = raid_disks - 1; 1814 qd_idx = raid_disks - 1;
1819 break; 1815 break;
1820 1816
1821 case ALGORITHM_LEFT_SYMMETRIC_6: 1817 case ALGORITHM_LEFT_SYMMETRIC_6:
1822 pd_idx = data_disks - stripe % (raid_disks-1); 1818 pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
1823 *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); 1819 *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
1824 qd_idx = raid_disks - 1; 1820 qd_idx = raid_disks - 1;
1825 break; 1821 break;
1826 1822
1827 case ALGORITHM_RIGHT_SYMMETRIC_6: 1823 case ALGORITHM_RIGHT_SYMMETRIC_6:
1828 pd_idx = stripe % (raid_disks-1); 1824 pd_idx = sector_div(stripe2, raid_disks-1);
1829 *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); 1825 *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
1830 qd_idx = raid_disks - 1; 1826 qd_idx = raid_disks - 1;
1831 break; 1827 break;
@@ -1870,14 +1866,14 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
1870 : conf->algorithm; 1866 : conf->algorithm;
1871 sector_t stripe; 1867 sector_t stripe;
1872 int chunk_offset; 1868 int chunk_offset;
1873 int chunk_number, dummy1, dd_idx = i; 1869 sector_t chunk_number;
1870 int dummy1, dd_idx = i;
1874 sector_t r_sector; 1871 sector_t r_sector;
1875 struct stripe_head sh2; 1872 struct stripe_head sh2;
1876 1873
1877 1874
1878 chunk_offset = sector_div(new_sector, sectors_per_chunk); 1875 chunk_offset = sector_div(new_sector, sectors_per_chunk);
1879 stripe = new_sector; 1876 stripe = new_sector;
1880 BUG_ON(new_sector != stripe);
1881 1877
1882 if (i == sh->pd_idx) 1878 if (i == sh->pd_idx)
1883 return 0; 1879 return 0;
@@ -1970,7 +1966,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
1970 } 1966 }
1971 1967
1972 chunk_number = stripe * data_disks + i; 1968 chunk_number = stripe * data_disks + i;
1973 r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset; 1969 r_sector = chunk_number * sectors_per_chunk + chunk_offset;
1974 1970
1975 check = raid5_compute_sector(conf, r_sector, 1971 check = raid5_compute_sector(conf, r_sector,
1976 previous, &dummy1, &sh2); 1972 previous, &dummy1, &sh2);
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index fd8e1f45be36..7364b9642d00 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -423,15 +423,14 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)
423 } 423 }
424} 424}
425 425
426int saa7146_vv_devinit(struct saa7146_dev *dev)
427{
428 return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
429}
430EXPORT_SYMBOL_GPL(saa7146_vv_devinit);
431
432int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 426int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
433{ 427{
434 struct saa7146_vv *vv; 428 struct saa7146_vv *vv;
429 int err;
430
431 err = v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
432 if (err)
433 return err;
435 434
436 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); 435 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
437 if (vv == NULL) { 436 if (vv == NULL) {
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 5ed75263340a..b8b2c551a1e2 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -558,9 +558,11 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
558 /* ok, accept it */ 558 /* ok, accept it */
559 vv->ov_fb = *fb; 559 vv->ov_fb = *fb;
560 vv->ov_fmt = fmt; 560 vv->ov_fmt = fmt;
561 if (0 == vv->ov_fb.fmt.bytesperline) 561
562 vv->ov_fb.fmt.bytesperline = 562 if (vv->ov_fb.fmt.bytesperline < vv->ov_fb.fmt.width) {
563 vv->ov_fb.fmt.width * fmt->depth / 8; 563 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
564 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
565 }
564 566
565 mutex_unlock(&dev->lock); 567 mutex_unlock(&dev->lock);
566 return 0; 568 return 0;
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index a3c07fe0e6c4..96972804f4ad 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -4470,6 +4470,10 @@ static int stv090x_setup(struct dvb_frontend *fe)
4470 if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0) 4470 if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0)
4471 goto err; 4471 goto err;
4472 4472
4473 /* workaround for stuck DiSEqC output */
4474 if (config->diseqc_envelope_mode)
4475 stv090x_send_diseqc_burst(fe, SEC_MINI_A);
4476
4473 return 0; 4477 return 0;
4474err: 4478err:
4475 dprintk(FE_ERROR, 1, "I/O error"); 4479 dprintk(FE_ERROR, 1, "I/O error");
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 9fdf26cc6998..1500210c06cf 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -643,9 +643,6 @@ static void frontend_init(struct budget *budget)
643 &budget->i2c_adap, 643 &budget->i2c_adap,
644 &tt1600_isl6423_config); 644 &tt1600_isl6423_config);
645 645
646 } else {
647 dvb_frontend_detach(budget->dvb_frontend);
648 budget->dvb_frontend = NULL;
649 } 646 }
650 } 647 }
651 break; 648 break;
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f8fc8654693d..9644cf760aaa 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -361,7 +361,7 @@ config VIDEO_SAA717X
361 361
362config VIDEO_SAA7191 362config VIDEO_SAA7191
363 tristate "Philips SAA7191 video decoder" 363 tristate "Philips SAA7191 video decoder"
364 depends on VIDEO_V4L1 && I2C 364 depends on VIDEO_V4L2 && I2C
365 ---help--- 365 ---help---
366 Support for the Philips SAA7191 video decoder. 366 Support for the Philips SAA7191 video decoder.
367 367
@@ -756,7 +756,7 @@ source "drivers/media/video/saa7134/Kconfig"
756 756
757config VIDEO_MXB 757config VIDEO_MXB
758 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" 758 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
759 depends on PCI && VIDEO_V4L1 && I2C 759 depends on PCI && VIDEO_V4L2 && I2C
760 select VIDEO_SAA7146_VV 760 select VIDEO_SAA7146_VV
761 select VIDEO_TUNER 761 select VIDEO_TUNER
762 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO 762 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index b88b6174a331..c51c386559f2 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -160,8 +160,6 @@ obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
160obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o 160obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
161obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o 161obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
162 162
163obj-$(CONFIG_ARCH_DAVINCI) += davinci/
164
165obj-$(CONFIG_VIDEO_AU0828) += au0828/ 163obj-$(CONFIG_VIDEO_AU0828) += au0828/
166 164
167obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/ 165obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 7cf042f9b377..398dbe71cb82 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -223,7 +223,6 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
223 BUG_ON(!dev->hw_ops.get_frame_format); 223 BUG_ON(!dev->hw_ops.get_frame_format);
224 BUG_ON(!dev->hw_ops.get_pixel_format); 224 BUG_ON(!dev->hw_ops.get_pixel_format);
225 BUG_ON(!dev->hw_ops.set_pixel_format); 225 BUG_ON(!dev->hw_ops.set_pixel_format);
226 BUG_ON(!dev->hw_ops.set_params);
227 BUG_ON(!dev->hw_ops.set_image_window); 226 BUG_ON(!dev->hw_ops.set_image_window);
228 BUG_ON(!dev->hw_ops.get_image_window); 227 BUG_ON(!dev->hw_ops.get_image_window);
229 BUG_ON(!dev->hw_ops.get_line_length); 228 BUG_ON(!dev->hw_ops.get_line_length);
@@ -1689,11 +1688,12 @@ static long vpfe_param_handler(struct file *file, void *priv,
1689 struct vpfe_device *vpfe_dev = video_drvdata(file); 1688 struct vpfe_device *vpfe_dev = video_drvdata(file);
1690 int ret = 0; 1689 int ret = 0;
1691 1690
1692 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n"); 1691 v4l2_dbg(2, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n");
1693 1692
1694 if (vpfe_dev->started) { 1693 if (vpfe_dev->started) {
1695 /* only allowed if streaming is not started */ 1694 /* only allowed if streaming is not started */
1696 v4l2_err(&vpfe_dev->v4l2_dev, "device already started\n"); 1695 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1696 "device already started\n");
1697 return -EBUSY; 1697 return -EBUSY;
1698 } 1698 }
1699 1699
@@ -1705,16 +1705,23 @@ static long vpfe_param_handler(struct file *file, void *priv,
1705 case VPFE_CMD_S_CCDC_RAW_PARAMS: 1705 case VPFE_CMD_S_CCDC_RAW_PARAMS:
1706 v4l2_warn(&vpfe_dev->v4l2_dev, 1706 v4l2_warn(&vpfe_dev->v4l2_dev,
1707 "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n"); 1707 "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n");
1708 ret = ccdc_dev->hw_ops.set_params(param); 1708 if (ccdc_dev->hw_ops.set_params) {
1709 if (ret) { 1709 ret = ccdc_dev->hw_ops.set_params(param);
1710 v4l2_err(&vpfe_dev->v4l2_dev, 1710 if (ret) {
1711 "Error in setting parameters in CCDC\n"); 1711 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1712 goto unlock_out; 1712 "Error setting parameters in CCDC\n");
1713 } 1713 goto unlock_out;
1714 if (vpfe_get_ccdc_image_format(vpfe_dev, &vpfe_dev->fmt) < 0) { 1714 }
1715 v4l2_err(&vpfe_dev->v4l2_dev, 1715 if (vpfe_get_ccdc_image_format(vpfe_dev,
1716 "Invalid image format at CCDC\n"); 1716 &vpfe_dev->fmt) < 0) {
1717 goto unlock_out; 1717 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1718 "Invalid image format at CCDC\n");
1719 goto unlock_out;
1720 }
1721 } else {
1722 ret = -EINVAL;
1723 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1724 "VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n");
1718 } 1725 }
1719 break; 1726 break;
1720 default: 1727 default:
@@ -1830,7 +1837,7 @@ static __init int vpfe_probe(struct platform_device *pdev)
1830 if (NULL == ccdc_cfg) { 1837 if (NULL == ccdc_cfg) {
1831 v4l2_err(pdev->dev.driver, 1838 v4l2_err(pdev->dev.driver,
1832 "Memory allocation failed for ccdc_cfg\n"); 1839 "Memory allocation failed for ccdc_cfg\n");
1833 goto probe_free_dev_mem; 1840 goto probe_free_lock;
1834 } 1841 }
1835 1842
1836 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); 1843 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
@@ -1982,8 +1989,9 @@ probe_out_video_release:
1982probe_out_release_irq: 1989probe_out_release_irq:
1983 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); 1990 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
1984probe_free_ccdc_cfg_mem: 1991probe_free_ccdc_cfg_mem:
1985 mutex_unlock(&ccdc_lock);
1986 kfree(ccdc_cfg); 1992 kfree(ccdc_cfg);
1993probe_free_lock:
1994 mutex_unlock(&ccdc_lock);
1987probe_free_dev_mem: 1995probe_free_dev_mem:
1988 kfree(vpfe_dev); 1996 kfree(vpfe_dev);
1989 return ret; 1997 return ret;
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 38a6e15e096b..3dee3e5844b6 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -1427,7 +1427,7 @@ static int input_kthread(void *data)
1427 struct gspca_dev *gspca_dev = (struct gspca_dev *)data; 1427 struct gspca_dev *gspca_dev = (struct gspca_dev *)data;
1428 struct sd *sd = (struct sd *) gspca_dev; 1428 struct sd *sd = (struct sd *) gspca_dev;
1429 1429
1430 DECLARE_WAIT_QUEUE_HEAD(wait); 1430 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait);
1431 set_freezable(); 1431 set_freezable();
1432 for (;;) { 1432 for (;;) {
1433 if (kthread_should_stop()) 1433 if (kthread_should_stop())
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 15b2eef8a3f6..edf0fe157501 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1513,7 +1513,6 @@ static const struct sd_desc sd_desc = {
1513static const __devinitdata struct usb_device_id device_table[] = { 1513static const __devinitdata struct usb_device_id device_table[] = {
1514 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, 1514 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1515 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, 1515 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1516 {USB_DEVICE(0x0461, 0x0815), .driver_info = MicroInnovationIC200},
1517 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, 1516 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
1518 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam}, 1517 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
1519 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2}, 1518 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index dc7f2b0fbc79..b9c80e2103b9 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1053,6 +1053,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
1053 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, 1053 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1054 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, 1054 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1055 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, 1055 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
1056 {USB_DEVICE(0x0461, 0x0815), .driver_info = Rev072A},
1056 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A}, 1057 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A},
1057 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A}, 1058 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A},
1058 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A}, 1059 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A},
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index af73da34c83f..14f179a19485 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -524,8 +524,6 @@ static const __devinitdata struct usb_device_id device_table[] = {
524 {USB_DEVICE(0x046D, 0x08F5), .driver_info = BRIDGE_ST6422 }, 524 {USB_DEVICE(0x046D, 0x08F5), .driver_info = BRIDGE_ST6422 },
525 /* QuickCam Messenger (new) */ 525 /* QuickCam Messenger (new) */
526 {USB_DEVICE(0x046D, 0x08F6), .driver_info = BRIDGE_ST6422 }, 526 {USB_DEVICE(0x046D, 0x08F6), .driver_info = BRIDGE_ST6422 },
527 /* QuickCam Messenger (new) */
528 {USB_DEVICE(0x046D, 0x08DA), .driver_info = BRIDGE_ST6422 },
529 {} 527 {}
530}; 528};
531MODULE_DEVICE_TABLE(usb, device_table); 529MODULE_DEVICE_TABLE(usb, device_table);
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index e620a3a92f25..ad2c232baa6d 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -356,9 +356,6 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
356 356
357 DEB_EE((".\n")); 357 DEB_EE((".\n"));
358 358
359 ret = saa7146_vv_devinit(dev);
360 if (ret)
361 return ret;
362 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 359 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
363 if (NULL == hexium) { 360 if (NULL == hexium) {
364 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); 361 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index fe596a1c12a8..938a1f8f880a 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -216,10 +216,6 @@ static int hexium_probe(struct saa7146_dev *dev)
216 return -EFAULT; 216 return -EFAULT;
217 } 217 }
218 218
219 err = saa7146_vv_devinit(dev);
220 if (err)
221 return err;
222
223 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 219 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
224 if (NULL == hexium) { 220 if (NULL == hexium) {
225 printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); 221 printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c
index 3c8ebfcb742e..34a66019190e 100644
--- a/drivers/media/video/mx1_camera.c
+++ b/drivers/media/video/mx1_camera.c
@@ -49,8 +49,6 @@
49/* 49/*
50 * CSI registers 50 * CSI registers
51 */ 51 */
52#define DMA_CCR(x) (0x8c + ((x) << 6)) /* Control Registers */
53#define DMA_DIMR 0x08 /* Interrupt mask Register */
54#define CSICR1 0x00 /* CSI Control Register 1 */ 52#define CSICR1 0x00 /* CSI Control Register 1 */
55#define CSISR 0x08 /* CSI Status Register */ 53#define CSISR 0x08 /* CSI Status Register */
56#define CSIRXR 0x10 /* CSI RxFIFO Register */ 54#define CSIRXR 0x10 /* CSI RxFIFO Register */
@@ -784,7 +782,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev)
784 pcdev); 782 pcdev);
785 783
786 imx_dma_config_channel(pcdev->dma_chan, IMX_DMA_TYPE_FIFO, 784 imx_dma_config_channel(pcdev->dma_chan, IMX_DMA_TYPE_FIFO,
787 IMX_DMA_MEMSIZE_32, DMA_REQ_CSI_R, 0); 785 IMX_DMA_MEMSIZE_32, MX1_DMA_REQ_CSI_R, 0);
788 /* burst length : 16 words = 64 bytes */ 786 /* burst length : 16 words = 64 bytes */
789 imx_dma_config_burstlen(pcdev->dma_chan, 0); 787 imx_dma_config_burstlen(pcdev->dma_chan, 0);
790 788
@@ -798,8 +796,8 @@ static int __init mx1_camera_probe(struct platform_device *pdev)
798 set_fiq_handler(&mx1_camera_sof_fiq_start, &mx1_camera_sof_fiq_end - 796 set_fiq_handler(&mx1_camera_sof_fiq_start, &mx1_camera_sof_fiq_end -
799 &mx1_camera_sof_fiq_start); 797 &mx1_camera_sof_fiq_start);
800 798
801 regs.ARM_r8 = DMA_BASE + DMA_DIMR; 799 regs.ARM_r8 = (long)MX1_DMA_DIMR;
802 regs.ARM_r9 = DMA_BASE + DMA_CCR(pcdev->dma_chan); 800 regs.ARM_r9 = (long)MX1_DMA_CCR(pcdev->dma_chan);
803 regs.ARM_r10 = (long)pcdev->base + CSICR1; 801 regs.ARM_r10 = (long)pcdev->base + CSICR1;
804 regs.ARM_fp = (long)pcdev->base + CSISR; 802 regs.ARM_fp = (long)pcdev->base + CSISR;
805 regs.ARM_sp = 1 << pcdev->dma_chan; 803 regs.ARM_sp = 1 << pcdev->dma_chan;
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 9f01f14e4aa2..ef0c8178f255 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -169,11 +169,7 @@ static struct saa7146_extension extension;
169static int mxb_probe(struct saa7146_dev *dev) 169static int mxb_probe(struct saa7146_dev *dev)
170{ 170{
171 struct mxb *mxb = NULL; 171 struct mxb *mxb = NULL;
172 int err;
173 172
174 err = saa7146_vv_devinit(dev);
175 if (err)
176 return err;
177 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); 173 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
178 if (mxb == NULL) { 174 if (mxb == NULL) {
179 DEB_D(("not enough kernel memory.\n")); 175 DEB_D(("not enough kernel memory.\n"));
@@ -699,14 +695,17 @@ static struct saa7146_ext_vv vv_data;
699/* this function only gets called when the probing was successful */ 695/* this function only gets called when the probing was successful */
700static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) 696static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
701{ 697{
702 struct mxb *mxb = (struct mxb *)dev->ext_priv; 698 struct mxb *mxb;
703 699
704 DEB_EE(("dev:%p\n", dev)); 700 DEB_EE(("dev:%p\n", dev));
705 701
706 /* checking for i2c-devices can be omitted here, because we
707 already did this in "mxb_vl42_probe" */
708
709 saa7146_vv_init(dev, &vv_data); 702 saa7146_vv_init(dev, &vv_data);
703 if (mxb_probe(dev)) {
704 saa7146_vv_release(dev);
705 return -1;
706 }
707 mxb = (struct mxb *)dev->ext_priv;
708
710 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl; 709 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl;
711 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl; 710 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl;
712 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl; 711 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl;
@@ -726,6 +725,7 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data
726 vv_data.ops.vidioc_default = vidioc_default; 725 vv_data.ops.vidioc_default = vidioc_default;
727 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { 726 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
728 ERR(("cannot register capture v4l2 device. skipping.\n")); 727 ERR(("cannot register capture v4l2 device. skipping.\n"));
728 saa7146_vv_release(dev);
729 return -1; 729 return -1;
730 } 730 }
731 731
@@ -846,7 +846,6 @@ static struct saa7146_extension extension = {
846 .pci_tbl = &pci_tbl[0], 846 .pci_tbl = &pci_tbl[0],
847 .module = THIS_MODULE, 847 .module = THIS_MODULE,
848 848
849 .probe = mxb_probe,
850 .attach = mxb_attach, 849 .attach = mxb_attach,
851 .detach = mxb_detach, 850 .detach = mxb_detach,
852 851
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index b189fe63394b..ce76d952e161 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1405,7 +1405,7 @@ static int omap24xxcam_mmap_buffers(struct file *file,
1405 } 1405 }
1406 1406
1407 size = 0; 1407 size = 0;
1408 for (i = first; i <= last; i++) { 1408 for (i = first; i <= last && i < VIDEO_MAX_FRAME; i++) {
1409 struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]); 1409 struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]);
1410 1410
1411 for (j = 0; j < dma->sglen; j++) { 1411 for (j = 0; j < dma->sglen; j++) {
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 5ecc30daef2d..04bf5c11308d 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -609,12 +609,9 @@ static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev,
609 */ 609 */
610static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev) 610static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev)
611{ 611{
612 unsigned long cicr0, cifr; 612 unsigned long cicr0;
613 613
614 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); 614 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__);
615 /* Reset the FIFOs */
616 cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F;
617 __raw_writel(cifr, pcdev->base + CIFR);
618 /* Enable End-Of-Frame Interrupt */ 615 /* Enable End-Of-Frame Interrupt */
619 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB; 616 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB;
620 cicr0 &= ~CICR0_EOFM; 617 cicr0 &= ~CICR0_EOFM;
@@ -935,7 +932,7 @@ static void pxa_camera_deactivate(struct pxa_camera_dev *pcdev)
935static irqreturn_t pxa_camera_irq(int irq, void *data) 932static irqreturn_t pxa_camera_irq(int irq, void *data)
936{ 933{
937 struct pxa_camera_dev *pcdev = data; 934 struct pxa_camera_dev *pcdev = data;
938 unsigned long status, cicr0; 935 unsigned long status, cifr, cicr0;
939 struct pxa_buffer *buf; 936 struct pxa_buffer *buf;
940 struct videobuf_buffer *vb; 937 struct videobuf_buffer *vb;
941 938
@@ -949,6 +946,10 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
949 __raw_writel(status, pcdev->base + CISR); 946 __raw_writel(status, pcdev->base + CISR);
950 947
951 if (status & CISR_EOF) { 948 if (status & CISR_EOF) {
949 /* Reset the FIFOs */
950 cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F;
951 __raw_writel(cifr, pcdev->base + CIFR);
952
952 pcdev->active = list_first_entry(&pcdev->capture, 953 pcdev->active = list_first_entry(&pcdev->capture,
953 struct pxa_buffer, vb.queue); 954 struct pxa_buffer, vb.queue);
954 vb = &pcdev->active->vb; 955 vb = &pcdev->active->vb;
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 6e16b3979326..1ad980f8e770 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1633,7 +1633,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1633 height = pix->height; 1633 height = pix->height;
1634 1634
1635 pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt); 1635 pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt);
1636 if (pix->bytesperline < 0) 1636 if ((int)pix->bytesperline < 0)
1637 return pix->bytesperline; 1637 return pix->bytesperline;
1638 pix->sizeimage = height * pix->bytesperline; 1638 pix->sizeimage = height * pix->bytesperline;
1639 1639
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 2191c8d896a0..0d0d625fece2 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -311,6 +311,22 @@ config TI_DAC7512
311 This driver can also be built as a module. If so, the module 311 This driver can also be built as a module. If so, the module
312 will be calles ti_dac7512. 312 will be calles ti_dac7512.
313 313
314config VMWARE_BALLOON
315 tristate "VMware Balloon Driver"
316 depends on X86
317 help
318 This is VMware physical memory management driver which acts
319 like a "balloon" that can be inflated to reclaim physical pages
320 by reserving them in the guest and invalidating them in the
321 monitor, freeing up the underlying machine pages so they can
322 be allocated to other guests. The balloon can also be deflated
323 to allow the guest to use more physical memory.
324
325 If unsure, say N.
326
327 To compile this driver as a module, choose M here: the
328 module will be called vmware_balloon.
329
314source "drivers/misc/c2port/Kconfig" 330source "drivers/misc/c2port/Kconfig"
315source "drivers/misc/eeprom/Kconfig" 331source "drivers/misc/eeprom/Kconfig"
316source "drivers/misc/cb710/Kconfig" 332source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 27c484355414..7b6f7eefdf8d 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -29,3 +29,4 @@ obj-$(CONFIG_C2PORT) += c2port/
29obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ 29obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/
30obj-y += eeprom/ 30obj-y += eeprom/
31obj-y += cb710/ 31obj-y += cb710/
32obj-$(CONFIG_VMWARE_BALLOON) += vmware_balloon.o
diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmware_balloon.c
new file mode 100644
index 000000000000..e7161c4e3798
--- /dev/null
+++ b/drivers/misc/vmware_balloon.c
@@ -0,0 +1,832 @@
1/*
2 * VMware Balloon driver.
3 *
4 * Copyright (C) 2000-2010, VMware, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; version 2 of the License and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 * NON INFRINGEMENT. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Maintained by: Dmitry Torokhov <dtor@vmware.com>
21 */
22
23/*
24 * This is VMware physical memory management driver for Linux. The driver
25 * acts like a "balloon" that can be inflated to reclaim physical pages by
26 * reserving them in the guest and invalidating them in the monitor,
27 * freeing up the underlying machine pages so they can be allocated to
28 * other guests. The balloon can also be deflated to allow the guest to
29 * use more physical memory. Higher level policies can control the sizes
30 * of balloons in VMs in order to manage physical memory resources.
31 */
32
33//#define DEBUG
34#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
35
36#include <linux/types.h>
37#include <linux/kernel.h>
38#include <linux/mm.h>
39#include <linux/sched.h>
40#include <linux/module.h>
41#include <linux/workqueue.h>
42#include <linux/debugfs.h>
43#include <linux/seq_file.h>
44#include <asm/vmware.h>
45
46MODULE_AUTHOR("VMware, Inc.");
47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
48MODULE_VERSION("1.2.1.0-K");
49MODULE_ALIAS("dmi:*:svnVMware*:*");
50MODULE_ALIAS("vmware_vmmemctl");
51MODULE_LICENSE("GPL");
52
53/*
54 * Various constants controlling rate of inflaint/deflating balloon,
55 * measured in pages.
56 */
57
58/*
59 * Rate of allocating memory when there is no memory pressure
60 * (driver performs non-sleeping allocations).
61 */
62#define VMW_BALLOON_NOSLEEP_ALLOC_MAX 16384U
63
64/*
65 * Rates of memory allocaton when guest experiences memory pressure
66 * (driver performs sleeping allocations).
67 */
68#define VMW_BALLOON_RATE_ALLOC_MIN 512U
69#define VMW_BALLOON_RATE_ALLOC_MAX 2048U
70#define VMW_BALLOON_RATE_ALLOC_INC 16U
71
72/*
73 * Rates for releasing pages while deflating balloon.
74 */
75#define VMW_BALLOON_RATE_FREE_MIN 512U
76#define VMW_BALLOON_RATE_FREE_MAX 16384U
77#define VMW_BALLOON_RATE_FREE_INC 16U
78
79/*
80 * When guest is under memory pressure, use a reduced page allocation
81 * rate for next several cycles.
82 */
83#define VMW_BALLOON_SLOW_CYCLES 4
84
85/*
86 * Use __GFP_HIGHMEM to allow pages from HIGHMEM zone. We don't
87 * allow wait (__GFP_WAIT) for NOSLEEP page allocations. Use
88 * __GFP_NOWARN, to suppress page allocation failure warnings.
89 */
90#define VMW_PAGE_ALLOC_NOSLEEP (__GFP_HIGHMEM|__GFP_NOWARN)
91
92/*
93 * Use GFP_HIGHUSER when executing in a separate kernel thread
94 * context and allocation can sleep. This is less stressful to
95 * the guest memory system, since it allows the thread to block
96 * while memory is reclaimed, and won't take pages from emergency
97 * low-memory pools.
98 */
99#define VMW_PAGE_ALLOC_CANSLEEP (GFP_HIGHUSER)
100
101/* Maximum number of page allocations without yielding processor */
102#define VMW_BALLOON_YIELD_THRESHOLD 1024
103
104
105/*
106 * Hypervisor communication port definitions.
107 */
108#define VMW_BALLOON_HV_PORT 0x5670
109#define VMW_BALLOON_HV_MAGIC 0x456c6d6f
110#define VMW_BALLOON_PROTOCOL_VERSION 2
111#define VMW_BALLOON_GUEST_ID 1 /* Linux */
112
113#define VMW_BALLOON_CMD_START 0
114#define VMW_BALLOON_CMD_GET_TARGET 1
115#define VMW_BALLOON_CMD_LOCK 2
116#define VMW_BALLOON_CMD_UNLOCK 3
117#define VMW_BALLOON_CMD_GUEST_ID 4
118
119/* error codes */
120#define VMW_BALLOON_SUCCESS 0
121#define VMW_BALLOON_FAILURE -1
122#define VMW_BALLOON_ERROR_CMD_INVALID 1
123#define VMW_BALLOON_ERROR_PPN_INVALID 2
124#define VMW_BALLOON_ERROR_PPN_LOCKED 3
125#define VMW_BALLOON_ERROR_PPN_UNLOCKED 4
126#define VMW_BALLOON_ERROR_PPN_PINNED 5
127#define VMW_BALLOON_ERROR_PPN_NOTNEEDED 6
128#define VMW_BALLOON_ERROR_RESET 7
129#define VMW_BALLOON_ERROR_BUSY 8
130
131#define VMWARE_BALLOON_CMD(cmd, data, result) \
132({ \
133 unsigned long __stat, __dummy1, __dummy2; \
134 __asm__ __volatile__ ("inl (%%dx)" : \
135 "=a"(__stat), \
136 "=c"(__dummy1), \
137 "=d"(__dummy2), \
138 "=b"(result) : \
139 "0"(VMW_BALLOON_HV_MAGIC), \
140 "1"(VMW_BALLOON_CMD_##cmd), \
141 "2"(VMW_BALLOON_HV_PORT), \
142 "3"(data) : \
143 "memory"); \
144 result &= -1UL; \
145 __stat & -1UL; \
146})
147
148#ifdef CONFIG_DEBUG_FS
149struct vmballoon_stats {
150 unsigned int timer;
151
152 /* allocation statustics */
153 unsigned int alloc;
154 unsigned int alloc_fail;
155 unsigned int sleep_alloc;
156 unsigned int sleep_alloc_fail;
157 unsigned int refused_alloc;
158 unsigned int refused_free;
159 unsigned int free;
160
161 /* monitor operations */
162 unsigned int lock;
163 unsigned int lock_fail;
164 unsigned int unlock;
165 unsigned int unlock_fail;
166 unsigned int target;
167 unsigned int target_fail;
168 unsigned int start;
169 unsigned int start_fail;
170 unsigned int guest_type;
171 unsigned int guest_type_fail;
172};
173
174#define STATS_INC(stat) (stat)++
175#else
176#define STATS_INC(stat)
177#endif
178
179struct vmballoon {
180
181 /* list of reserved physical pages */
182 struct list_head pages;
183
184 /* transient list of non-balloonable pages */
185 struct list_head refused_pages;
186
187 /* balloon size in pages */
188 unsigned int size;
189 unsigned int target;
190
191 /* reset flag */
192 bool reset_required;
193
194 /* adjustment rates (pages per second) */
195 unsigned int rate_alloc;
196 unsigned int rate_free;
197
198 /* slowdown page allocations for next few cycles */
199 unsigned int slow_allocation_cycles;
200
201#ifdef CONFIG_DEBUG_FS
202 /* statistics */
203 struct vmballoon_stats stats;
204
205 /* debugfs file exporting statistics */
206 struct dentry *dbg_entry;
207#endif
208
209 struct sysinfo sysinfo;
210
211 struct delayed_work dwork;
212};
213
214static struct vmballoon balloon;
215static struct workqueue_struct *vmballoon_wq;
216
217/*
218 * Send "start" command to the host, communicating supported version
219 * of the protocol.
220 */
221static bool vmballoon_send_start(struct vmballoon *b)
222{
223 unsigned long status, dummy;
224
225 STATS_INC(b->stats.start);
226
227 status = VMWARE_BALLOON_CMD(START, VMW_BALLOON_PROTOCOL_VERSION, dummy);
228 if (status == VMW_BALLOON_SUCCESS)
229 return true;
230
231 pr_debug("%s - failed, hv returns %ld\n", __func__, status);
232 STATS_INC(b->stats.start_fail);
233 return false;
234}
235
236static bool vmballoon_check_status(struct vmballoon *b, unsigned long status)
237{
238 switch (status) {
239 case VMW_BALLOON_SUCCESS:
240 return true;
241
242 case VMW_BALLOON_ERROR_RESET:
243 b->reset_required = true;
244 /* fall through */
245
246 default:
247 return false;
248 }
249}
250
251/*
252 * Communicate guest type to the host so that it can adjust ballooning
253 * algorithm to the one most appropriate for the guest. This command
254 * is normally issued after sending "start" command and is part of
255 * standard reset sequence.
256 */
257static bool vmballoon_send_guest_id(struct vmballoon *b)
258{
259 unsigned long status, dummy;
260
261 status = VMWARE_BALLOON_CMD(GUEST_ID, VMW_BALLOON_GUEST_ID, dummy);
262
263 STATS_INC(b->stats.guest_type);
264
265 if (vmballoon_check_status(b, status))
266 return true;
267
268 pr_debug("%s - failed, hv returns %ld\n", __func__, status);
269 STATS_INC(b->stats.guest_type_fail);
270 return false;
271}
272
273/*
274 * Retrieve desired balloon size from the host.
275 */
276static bool vmballoon_send_get_target(struct vmballoon *b, u32 *new_target)
277{
278 unsigned long status;
279 unsigned long target;
280 unsigned long limit;
281 u32 limit32;
282
283 /*
284 * si_meminfo() is cheap. Moreover, we want to provide dynamic
285 * max balloon size later. So let us call si_meminfo() every
286 * iteration.
287 */
288 si_meminfo(&b->sysinfo);
289 limit = b->sysinfo.totalram;
290
291 /* Ensure limit fits in 32-bits */
292 limit32 = (u32)limit;
293 if (limit != limit32)
294 return false;
295
296 /* update stats */
297 STATS_INC(b->stats.target);
298
299 status = VMWARE_BALLOON_CMD(GET_TARGET, limit, target);
300 if (vmballoon_check_status(b, status)) {
301 *new_target = target;
302 return true;
303 }
304
305 pr_debug("%s - failed, hv returns %ld\n", __func__, status);
306 STATS_INC(b->stats.target_fail);
307 return false;
308}
309
310/*
311 * Notify the host about allocated page so that host can use it without
312 * fear that guest will need it. Host may reject some pages, we need to
313 * check the return value and maybe submit a different page.
314 */
315static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn)
316{
317 unsigned long status, dummy;
318 u32 pfn32;
319
320 pfn32 = (u32)pfn;
321 if (pfn32 != pfn)
322 return false;
323
324 STATS_INC(b->stats.lock);
325
326 status = VMWARE_BALLOON_CMD(LOCK, pfn, dummy);
327 if (vmballoon_check_status(b, status))
328 return true;
329
330 pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status);
331 STATS_INC(b->stats.lock_fail);
332 return false;
333}
334
335/*
336 * Notify the host that guest intends to release given page back into
337 * the pool of available (to the guest) pages.
338 */
339static bool vmballoon_send_unlock_page(struct vmballoon *b, unsigned long pfn)
340{
341 unsigned long status, dummy;
342 u32 pfn32;
343
344 pfn32 = (u32)pfn;
345 if (pfn32 != pfn)
346 return false;
347
348 STATS_INC(b->stats.unlock);
349
350 status = VMWARE_BALLOON_CMD(UNLOCK, pfn, dummy);
351 if (vmballoon_check_status(b, status))
352 return true;
353
354 pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status);
355 STATS_INC(b->stats.unlock_fail);
356 return false;
357}
358
359/*
360 * Quickly release all pages allocated for the balloon. This function is
361 * called when host decides to "reset" balloon for one reason or another.
362 * Unlike normal "deflate" we do not (shall not) notify host of the pages
363 * being released.
364 */
365static void vmballoon_pop(struct vmballoon *b)
366{
367 struct page *page, *next;
368 unsigned int count = 0;
369
370 list_for_each_entry_safe(page, next, &b->pages, lru) {
371 list_del(&page->lru);
372 __free_page(page);
373 STATS_INC(b->stats.free);
374 b->size--;
375
376 if (++count >= b->rate_free) {
377 count = 0;
378 cond_resched();
379 }
380 }
381}
382
383/*
384 * Perform standard reset sequence by popping the balloon (in case it
385 * is not empty) and then restarting protocol. This operation normally
386 * happens when host responds with VMW_BALLOON_ERROR_RESET to a command.
387 */
388static void vmballoon_reset(struct vmballoon *b)
389{
390 /* free all pages, skipping monitor unlock */
391 vmballoon_pop(b);
392
393 if (vmballoon_send_start(b)) {
394 b->reset_required = false;
395 if (!vmballoon_send_guest_id(b))
396 pr_err("failed to send guest ID to the host\n");
397 }
398}
399
400/*
401 * Allocate (or reserve) a page for the balloon and notify the host. If host
402 * refuses the page put it on "refuse" list and allocate another one until host
403 * is satisfied. "Refused" pages are released at the end of inflation cycle
404 * (when we allocate b->rate_alloc pages).
405 */
406static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
407{
408 struct page *page;
409 gfp_t flags;
410 bool locked = false;
411
412 do {
413 if (!can_sleep)
414 STATS_INC(b->stats.alloc);
415 else
416 STATS_INC(b->stats.sleep_alloc);
417
418 flags = can_sleep ? VMW_PAGE_ALLOC_CANSLEEP : VMW_PAGE_ALLOC_NOSLEEP;
419 page = alloc_page(flags);
420 if (!page) {
421 if (!can_sleep)
422 STATS_INC(b->stats.alloc_fail);
423 else
424 STATS_INC(b->stats.sleep_alloc_fail);
425 return -ENOMEM;
426 }
427
428 /* inform monitor */
429 locked = vmballoon_send_lock_page(b, page_to_pfn(page));
430 if (!locked) {
431 if (b->reset_required) {
432 __free_page(page);
433 return -EIO;
434 }
435
436 /* place on list of non-balloonable pages, retry allocation */
437 list_add(&page->lru, &b->refused_pages);
438 STATS_INC(b->stats.refused_alloc);
439 }
440 } while (!locked);
441
442 /* track allocated page */
443 list_add(&page->lru, &b->pages);
444
445 /* update balloon size */
446 b->size++;
447
448 return 0;
449}
450
451/*
452 * Release the page allocated for the balloon. Note that we first notify
453 * the host so it can make sure the page will be available for the guest
454 * to use, if needed.
455 */
456static int vmballoon_release_page(struct vmballoon *b, struct page *page)
457{
458 if (!vmballoon_send_unlock_page(b, page_to_pfn(page)))
459 return -EIO;
460
461 list_del(&page->lru);
462
463 /* deallocate page */
464 __free_page(page);
465 STATS_INC(b->stats.free);
466
467 /* update balloon size */
468 b->size--;
469
470 return 0;
471}
472
473/*
474 * Release pages that were allocated while attempting to inflate the
475 * balloon but were refused by the host for one reason or another.
476 */
477static void vmballoon_release_refused_pages(struct vmballoon *b)
478{
479 struct page *page, *next;
480
481 list_for_each_entry_safe(page, next, &b->refused_pages, lru) {
482 list_del(&page->lru);
483 __free_page(page);
484 STATS_INC(b->stats.refused_free);
485 }
486}
487
488/*
489 * Inflate the balloon towards its target size. Note that we try to limit
490 * the rate of allocation to make sure we are not choking the rest of the
491 * system.
492 */
493static void vmballoon_inflate(struct vmballoon *b)
494{
495 unsigned int goal;
496 unsigned int rate;
497 unsigned int i;
498 unsigned int allocations = 0;
499 int error = 0;
500 bool alloc_can_sleep = false;
501
502 pr_debug("%s - size: %d, target %d\n", __func__, b->size, b->target);
503
504 /*
505 * First try NOSLEEP page allocations to inflate balloon.
506 *
507 * If we do not throttle nosleep allocations, we can drain all
508 * free pages in the guest quickly (if the balloon target is high).
509 * As a side-effect, draining free pages helps to inform (force)
510 * the guest to start swapping if balloon target is not met yet,
511 * which is a desired behavior. However, balloon driver can consume
512 * all available CPU cycles if too many pages are allocated in a
513 * second. Therefore, we throttle nosleep allocations even when
514 * the guest is not under memory pressure. OTOH, if we have already
515 * predicted that the guest is under memory pressure, then we
516 * slowdown page allocations considerably.
517 */
518
519 goal = b->target - b->size;
520 /*
521 * Start with no sleep allocation rate which may be higher
522 * than sleeping allocation rate.
523 */
524 rate = b->slow_allocation_cycles ?
525 b->rate_alloc : VMW_BALLOON_NOSLEEP_ALLOC_MAX;
526
527 pr_debug("%s - goal: %d, no-sleep rate: %d, sleep rate: %d\n",
528 __func__, goal, rate, b->rate_alloc);
529
530 for (i = 0; i < goal; i++) {
531
532 error = vmballoon_reserve_page(b, alloc_can_sleep);
533 if (error) {
534 if (error != -ENOMEM) {
535 /*
536 * Not a page allocation failure, stop this
537 * cycle. Maybe we'll get new target from
538 * the host soon.
539 */
540 break;
541 }
542
543 if (alloc_can_sleep) {
544 /*
545 * CANSLEEP page allocation failed, so guest
546 * is under severe memory pressure. Quickly
547 * decrease allocation rate.
548 */
549 b->rate_alloc = max(b->rate_alloc / 2,
550 VMW_BALLOON_RATE_ALLOC_MIN);
551 break;
552 }
553
554 /*
555 * NOSLEEP page allocation failed, so the guest is
556 * under memory pressure. Let us slow down page
557 * allocations for next few cycles so that the guest
558 * gets out of memory pressure. Also, if we already
559 * allocated b->rate_alloc pages, let's pause,
560 * otherwise switch to sleeping allocations.
561 */
562 b->slow_allocation_cycles = VMW_BALLOON_SLOW_CYCLES;
563
564 if (i >= b->rate_alloc)
565 break;
566
567 alloc_can_sleep = true;
568 /* Lower rate for sleeping allocations. */
569 rate = b->rate_alloc;
570 }
571
572 if (++allocations > VMW_BALLOON_YIELD_THRESHOLD) {
573 cond_resched();
574 allocations = 0;
575 }
576
577 if (i >= rate) {
578 /* We allocated enough pages, let's take a break. */
579 break;
580 }
581 }
582
583 /*
584 * We reached our goal without failures so try increasing
585 * allocation rate.
586 */
587 if (error == 0 && i >= b->rate_alloc) {
588 unsigned int mult = i / b->rate_alloc;
589
590 b->rate_alloc =
591 min(b->rate_alloc + mult * VMW_BALLOON_RATE_ALLOC_INC,
592 VMW_BALLOON_RATE_ALLOC_MAX);
593 }
594
595 vmballoon_release_refused_pages(b);
596}
597
598/*
599 * Decrease the size of the balloon allowing guest to use more memory.
600 */
601static void vmballoon_deflate(struct vmballoon *b)
602{
603 struct page *page, *next;
604 unsigned int i = 0;
605 unsigned int goal;
606 int error;
607
608 pr_debug("%s - size: %d, target %d\n", __func__, b->size, b->target);
609
610 /* limit deallocation rate */
611 goal = min(b->size - b->target, b->rate_free);
612
613 pr_debug("%s - goal: %d, rate: %d\n", __func__, goal, b->rate_free);
614
615 /* free pages to reach target */
616 list_for_each_entry_safe(page, next, &b->pages, lru) {
617 error = vmballoon_release_page(b, page);
618 if (error) {
619 /* quickly decrease rate in case of error */
620 b->rate_free = max(b->rate_free / 2,
621 VMW_BALLOON_RATE_FREE_MIN);
622 return;
623 }
624
625 if (++i >= goal)
626 break;
627 }
628
629 /* slowly increase rate if there were no errors */
630 b->rate_free = min(b->rate_free + VMW_BALLOON_RATE_FREE_INC,
631 VMW_BALLOON_RATE_FREE_MAX);
632}
633
634/*
635 * Balloon work function: reset protocol, if needed, get the new size and
636 * adjust balloon as needed. Repeat in 1 sec.
637 */
638static void vmballoon_work(struct work_struct *work)
639{
640 struct delayed_work *dwork = to_delayed_work(work);
641 struct vmballoon *b = container_of(dwork, struct vmballoon, dwork);
642 unsigned int target;
643
644 STATS_INC(b->stats.timer);
645
646 if (b->reset_required)
647 vmballoon_reset(b);
648
649 if (b->slow_allocation_cycles > 0)
650 b->slow_allocation_cycles--;
651
652 if (vmballoon_send_get_target(b, &target)) {
653 /* update target, adjust size */
654 b->target = target;
655
656 if (b->size < target)
657 vmballoon_inflate(b);
658 else if (b->size > target)
659 vmballoon_deflate(b);
660 }
661
662 queue_delayed_work(vmballoon_wq, dwork, round_jiffies_relative(HZ));
663}
664
665/*
666 * DEBUGFS Interface
667 */
668#ifdef CONFIG_DEBUG_FS
669
670static int vmballoon_debug_show(struct seq_file *f, void *offset)
671{
672 struct vmballoon *b = f->private;
673 struct vmballoon_stats *stats = &b->stats;
674
675 /* format size info */
676 seq_printf(f,
677 "target: %8d pages\n"
678 "current: %8d pages\n",
679 b->target, b->size);
680
681 /* format rate info */
682 seq_printf(f,
683 "rateNoSleepAlloc: %8d pages/sec\n"
684 "rateSleepAlloc: %8d pages/sec\n"
685 "rateFree: %8d pages/sec\n",
686 VMW_BALLOON_NOSLEEP_ALLOC_MAX,
687 b->rate_alloc, b->rate_free);
688
689 seq_printf(f,
690 "\n"
691 "timer: %8u\n"
692 "start: %8u (%4u failed)\n"
693 "guestType: %8u (%4u failed)\n"
694 "lock: %8u (%4u failed)\n"
695 "unlock: %8u (%4u failed)\n"
696 "target: %8u (%4u failed)\n"
697 "primNoSleepAlloc: %8u (%4u failed)\n"
698 "primCanSleepAlloc: %8u (%4u failed)\n"
699 "primFree: %8u\n"
700 "errAlloc: %8u\n"
701 "errFree: %8u\n",
702 stats->timer,
703 stats->start, stats->start_fail,
704 stats->guest_type, stats->guest_type_fail,
705 stats->lock, stats->lock_fail,
706 stats->unlock, stats->unlock_fail,
707 stats->target, stats->target_fail,
708 stats->alloc, stats->alloc_fail,
709 stats->sleep_alloc, stats->sleep_alloc_fail,
710 stats->free,
711 stats->refused_alloc, stats->refused_free);
712
713 return 0;
714}
715
716static int vmballoon_debug_open(struct inode *inode, struct file *file)
717{
718 return single_open(file, vmballoon_debug_show, inode->i_private);
719}
720
721static const struct file_operations vmballoon_debug_fops = {
722 .owner = THIS_MODULE,
723 .open = vmballoon_debug_open,
724 .read = seq_read,
725 .llseek = seq_lseek,
726 .release = single_release,
727};
728
729static int __init vmballoon_debugfs_init(struct vmballoon *b)
730{
731 int error;
732
733 b->dbg_entry = debugfs_create_file("vmmemctl", S_IRUGO, NULL, b,
734 &vmballoon_debug_fops);
735 if (IS_ERR(b->dbg_entry)) {
736 error = PTR_ERR(b->dbg_entry);
737 pr_err("failed to create debugfs entry, error: %d\n", error);
738 return error;
739 }
740
741 return 0;
742}
743
744static void __exit vmballoon_debugfs_exit(struct vmballoon *b)
745{
746 debugfs_remove(b->dbg_entry);
747}
748
749#else
750
751static inline int vmballoon_debugfs_init(struct vmballoon *b)
752{
753 return 0;
754}
755
756static inline void vmballoon_debugfs_exit(struct vmballoon *b)
757{
758}
759
760#endif /* CONFIG_DEBUG_FS */
761
762static int __init vmballoon_init(void)
763{
764 int error;
765
766 /*
767 * Check if we are running on VMware's hypervisor and bail out
768 * if we are not.
769 */
770 if (!vmware_platform())
771 return -ENODEV;
772
773 vmballoon_wq = create_freezeable_workqueue("vmmemctl");
774 if (!vmballoon_wq) {
775 pr_err("failed to create workqueue\n");
776 return -ENOMEM;
777 }
778
779 INIT_LIST_HEAD(&balloon.pages);
780 INIT_LIST_HEAD(&balloon.refused_pages);
781
782 /* initialize rates */
783 balloon.rate_alloc = VMW_BALLOON_RATE_ALLOC_MAX;
784 balloon.rate_free = VMW_BALLOON_RATE_FREE_MAX;
785
786 INIT_DELAYED_WORK(&balloon.dwork, vmballoon_work);
787
788 /*
789 * Start balloon.
790 */
791 if (!vmballoon_send_start(&balloon)) {
792 pr_err("failed to send start command to the host\n");
793 error = -EIO;
794 goto fail;
795 }
796
797 if (!vmballoon_send_guest_id(&balloon)) {
798 pr_err("failed to send guest ID to the host\n");
799 error = -EIO;
800 goto fail;
801 }
802
803 error = vmballoon_debugfs_init(&balloon);
804 if (error)
805 goto fail;
806
807 queue_delayed_work(vmballoon_wq, &balloon.dwork, 0);
808
809 return 0;
810
811fail:
812 destroy_workqueue(vmballoon_wq);
813 return error;
814}
815module_init(vmballoon_init);
816
817static void __exit vmballoon_exit(void)
818{
819 cancel_delayed_work_sync(&balloon.dwork);
820 destroy_workqueue(vmballoon_wq);
821
822 vmballoon_debugfs_exit(&balloon);
823
824 /*
825 * Deallocate all reserved memory, and reset connection with monitor.
826 * Reset connection before deallocating memory to avoid potential for
827 * additional spurious resets from guest touching deallocated pages.
828 */
829 vmballoon_send_start(&balloon);
830 vmballoon_pop(&balloon);
831}
832module_exit(vmballoon_exit);
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 88be37d9e9a5..fb279f4ed8b3 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -266,7 +266,7 @@ static int atmci_req_show(struct seq_file *s, void *v)
266 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", 266 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
267 cmd->opcode, cmd->arg, cmd->flags, 267 cmd->opcode, cmd->arg, cmd->flags,
268 cmd->resp[0], cmd->resp[1], cmd->resp[2], 268 cmd->resp[0], cmd->resp[1], cmd->resp[2],
269 cmd->resp[2], cmd->error); 269 cmd->resp[3], cmd->error);
270 if (data) 270 if (data)
271 seq_printf(s, "DATA %u / %u * %u flg %x err %d\n", 271 seq_printf(s, "DATA %u / %u * %u flg %x err %d\n",
272 data->bytes_xfered, data->blocks, 272 data->bytes_xfered, data->blocks,
@@ -276,7 +276,7 @@ static int atmci_req_show(struct seq_file *s, void *v)
276 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", 276 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
277 stop->opcode, stop->arg, stop->flags, 277 stop->opcode, stop->arg, stop->flags,
278 stop->resp[0], stop->resp[1], stop->resp[2], 278 stop->resp[0], stop->resp[1], stop->resp[2],
279 stop->resp[2], stop->error); 279 stop->resp[3], stop->error);
280 } 280 }
281 281
282 spin_unlock_bh(&slot->host->lock); 282 spin_unlock_bh(&slot->host->lock);
@@ -569,9 +569,10 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
569{ 569{
570 struct mmc_data *data = host->data; 570 struct mmc_data *data = host->data;
571 571
572 dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len, 572 if (data)
573 ((data->flags & MMC_DATA_WRITE) 573 dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
574 ? DMA_TO_DEVICE : DMA_FROM_DEVICE)); 574 ((data->flags & MMC_DATA_WRITE)
575 ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
575} 576}
576 577
577static void atmci_stop_dma(struct atmel_mci *host) 578static void atmci_stop_dma(struct atmel_mci *host)
@@ -1099,8 +1100,8 @@ static void atmci_command_complete(struct atmel_mci *host,
1099 "command error: status=0x%08x\n", status); 1100 "command error: status=0x%08x\n", status);
1100 1101
1101 if (cmd->data) { 1102 if (cmd->data) {
1102 host->data = NULL;
1103 atmci_stop_dma(host); 1103 atmci_stop_dma(host);
1104 host->data = NULL;
1104 mci_writel(host, IDR, MCI_NOTBUSY 1105 mci_writel(host, IDR, MCI_NOTBUSY
1105 | MCI_TXRDY | MCI_RXRDY 1106 | MCI_TXRDY | MCI_RXRDY
1106 | ATMCI_DATA_ERROR_FLAGS); 1107 | ATMCI_DATA_ERROR_FLAGS);
@@ -1293,6 +1294,7 @@ static void atmci_tasklet_func(unsigned long priv)
1293 } else { 1294 } else {
1294 data->bytes_xfered = data->blocks * data->blksz; 1295 data->bytes_xfered = data->blocks * data->blksz;
1295 data->error = 0; 1296 data->error = 0;
1297 mci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS);
1296 } 1298 }
1297 1299
1298 if (!data->stop) { 1300 if (!data->stop) {
@@ -1751,13 +1753,13 @@ static int __init atmci_probe(struct platform_device *pdev)
1751 ret = -ENODEV; 1753 ret = -ENODEV;
1752 if (pdata->slot[0].bus_width) { 1754 if (pdata->slot[0].bus_width) {
1753 ret = atmci_init_slot(host, &pdata->slot[0], 1755 ret = atmci_init_slot(host, &pdata->slot[0],
1754 MCI_SDCSEL_SLOT_A, 0); 1756 0, MCI_SDCSEL_SLOT_A);
1755 if (!ret) 1757 if (!ret)
1756 nr_slots++; 1758 nr_slots++;
1757 } 1759 }
1758 if (pdata->slot[1].bus_width) { 1760 if (pdata->slot[1].bus_width) {
1759 ret = atmci_init_slot(host, &pdata->slot[1], 1761 ret = atmci_init_slot(host, &pdata->slot[1],
1760 MCI_SDCSEL_SLOT_B, 1); 1762 1, MCI_SDCSEL_SLOT_B);
1761 if (!ret) 1763 if (!ret)
1762 nr_slots++; 1764 nr_slots++;
1763 } 1765 }
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 82d1e4de475b..4521b1ecce45 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -4,7 +4,7 @@
4 4
5# Core functionality. 5# Core functionality.
6obj-$(CONFIG_MTD) += mtd.o 6obj-$(CONFIG_MTD) += mtd.o
7mtd-y := mtdcore.o mtdsuper.o mtdbdi.o 7mtd-y := mtdcore.o mtdsuper.o
8mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 8mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
9 9
10obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o 10obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
diff --git a/drivers/mtd/internal.h b/drivers/mtd/internal.h
deleted file mode 100644
index c658fe7216b5..000000000000
--- a/drivers/mtd/internal.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* Internal MTD definitions
2 *
3 * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12/*
13 * mtdbdi.c
14 */
15extern struct backing_dev_info mtd_bdi_unmappable;
16extern struct backing_dev_info mtd_bdi_ro_mappable;
17extern struct backing_dev_info mtd_bdi_rw_mappable;
diff --git a/drivers/mtd/mtdbdi.c b/drivers/mtd/mtdbdi.c
deleted file mode 100644
index 5ca5aed0b225..000000000000
--- a/drivers/mtd/mtdbdi.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/* MTD backing device capabilities
2 *
3 * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/backing-dev.h>
13#include <linux/mtd/mtd.h>
14#include "internal.h"
15
16/*
17 * backing device capabilities for non-mappable devices (such as NAND flash)
18 * - permits private mappings, copies are taken of the data
19 */
20struct backing_dev_info mtd_bdi_unmappable = {
21 .capabilities = BDI_CAP_MAP_COPY,
22};
23
24/*
25 * backing device capabilities for R/O mappable devices (such as ROM)
26 * - permits private mappings, copies are taken of the data
27 * - permits non-writable shared mappings
28 */
29struct backing_dev_info mtd_bdi_ro_mappable = {
30 .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
31 BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP),
32};
33
34/*
35 * backing device capabilities for writable mappable devices (such as RAM)
36 * - permits private mappings, copies are taken of the data
37 * - permits non-writable shared mappings
38 */
39struct backing_dev_info mtd_bdi_rw_mappable = {
40 .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
41 BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP |
42 BDI_CAP_WRITE_MAP),
43};
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 5b38b17d2229..b177e750efc3 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -2,6 +2,9 @@
2 * Core registration and callback routines for MTD 2 * Core registration and callback routines for MTD
3 * drivers and users. 3 * drivers and users.
4 * 4 *
5 * bdi bits are:
6 * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
5 */ 8 */
6 9
7#include <linux/module.h> 10#include <linux/module.h>
@@ -16,11 +19,39 @@
16#include <linux/init.h> 19#include <linux/init.h>
17#include <linux/mtd/compatmac.h> 20#include <linux/mtd/compatmac.h>
18#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/backing-dev.h>
19 23
20#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
21#include "internal.h"
22 25
23#include "mtdcore.h" 26#include "mtdcore.h"
27/*
28 * backing device capabilities for non-mappable devices (such as NAND flash)
29 * - permits private mappings, copies are taken of the data
30 */
31struct backing_dev_info mtd_bdi_unmappable = {
32 .capabilities = BDI_CAP_MAP_COPY,
33};
34
35/*
36 * backing device capabilities for R/O mappable devices (such as ROM)
37 * - permits private mappings, copies are taken of the data
38 * - permits non-writable shared mappings
39 */
40struct backing_dev_info mtd_bdi_ro_mappable = {
41 .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
42 BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP),
43};
44
45/*
46 * backing device capabilities for writable mappable devices (such as RAM)
47 * - permits private mappings, copies are taken of the data
48 * - permits non-writable shared mappings
49 */
50struct backing_dev_info mtd_bdi_rw_mappable = {
51 .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
52 BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP |
53 BDI_CAP_WRITE_MAP),
54};
24 55
25static int mtd_cls_suspend(struct device *dev, pm_message_t state); 56static int mtd_cls_suspend(struct device *dev, pm_message_t state);
26static int mtd_cls_resume(struct device *dev); 57static int mtd_cls_resume(struct device *dev);
@@ -628,20 +659,55 @@ done:
628/*====================================================================*/ 659/*====================================================================*/
629/* Init code */ 660/* Init code */
630 661
662static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name)
663{
664 int ret;
665
666 ret = bdi_init(bdi);
667 if (!ret)
668 ret = bdi_register(bdi, NULL, name);
669
670 if (ret)
671 bdi_destroy(bdi);
672
673 return ret;
674}
675
631static int __init init_mtd(void) 676static int __init init_mtd(void)
632{ 677{
633 int ret; 678 int ret;
679
634 ret = class_register(&mtd_class); 680 ret = class_register(&mtd_class);
681 if (ret)
682 goto err_reg;
683
684 ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap");
685 if (ret)
686 goto err_bdi1;
687
688 ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap");
689 if (ret)
690 goto err_bdi2;
691
692 ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap");
693 if (ret)
694 goto err_bdi3;
635 695
636 if (ret) {
637 pr_err("Error registering mtd class: %d\n", ret);
638 return ret;
639 }
640#ifdef CONFIG_PROC_FS 696#ifdef CONFIG_PROC_FS
641 if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) 697 if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
642 proc_mtd->read_proc = mtd_read_proc; 698 proc_mtd->read_proc = mtd_read_proc;
643#endif /* CONFIG_PROC_FS */ 699#endif /* CONFIG_PROC_FS */
644 return 0; 700 return 0;
701
702err_bdi3:
703 bdi_destroy(&mtd_bdi_ro_mappable);
704err_bdi2:
705 bdi_destroy(&mtd_bdi_unmappable);
706err_bdi1:
707 class_unregister(&mtd_class);
708err_reg:
709 pr_err("Error registering mtd class or bdi: %d\n", ret);
710 return ret;
645} 711}
646 712
647static void __exit cleanup_mtd(void) 713static void __exit cleanup_mtd(void)
@@ -651,6 +717,9 @@ static void __exit cleanup_mtd(void)
651 remove_proc_entry( "mtd", NULL); 717 remove_proc_entry( "mtd", NULL);
652#endif /* CONFIG_PROC_FS */ 718#endif /* CONFIG_PROC_FS */
653 class_unregister(&mtd_class); 719 class_unregister(&mtd_class);
720 bdi_destroy(&mtd_bdi_unmappable);
721 bdi_destroy(&mtd_bdi_ro_mappable);
722 bdi_destroy(&mtd_bdi_rw_mappable);
654} 723}
655 724
656module_init(init_mtd); 725module_init(init_mtd);
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index af8b42e0a55b..7c003191fca4 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -13,6 +13,7 @@
13#include <linux/mtd/super.h> 13#include <linux/mtd/super.h>
14#include <linux/namei.h> 14#include <linux/namei.h>
15#include <linux/ctype.h> 15#include <linux/ctype.h>
16#include <linux/slab.h>
16 17
17/* 18/*
18 * compare superblocks to see if they're equivalent 19 * compare superblocks to see if they're equivalent
@@ -44,6 +45,7 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
44 45
45 sb->s_mtd = mtd; 46 sb->s_mtd = mtd;
46 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); 47 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
48 sb->s_bdi = mtd->backing_dev_info;
47 return 0; 49 return 0;
48} 50}
49 51
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index f59c07427af3..d60fc5719fef 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -60,7 +60,13 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
60 } 60 }
61 buf64 = (uint64_t *)buf; 61 buf64 = (uint64_t *)buf;
62 while (i < len/8) { 62 while (i < len/8) {
63 uint64_t x; 63 /*
64 * Since GCC has no proper constraint (PR 43518)
65 * force x variable to r2/r3 registers as ldrd instruction
66 * requires first register to be even.
67 */
68 register uint64_t x asm ("r2");
69
64 asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base)); 70 asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base));
65 buf64[i++] = x; 71 buf64[i++] = x;
66 } 72 }
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index 3ea42ff17657..1776ab61b05f 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -480,7 +480,6 @@ static netdev_tx_t el_start_xmit(struct sk_buff *skb, struct net_device *dev)
480 /* fire ... Trigger xmit. */ 480 /* fire ... Trigger xmit. */
481 outb(AX_XMIT, AX_CMD); 481 outb(AX_XMIT, AX_CMD);
482 lp->loading = 0; 482 lp->loading = 0;
483 dev->trans_start = jiffies;
484 if (el_debug > 2) 483 if (el_debug > 2)
485 pr_debug(" queued xmit.\n"); 484 pr_debug(" queued xmit.\n");
486 dev_kfree_skb(skb); 485 dev_kfree_skb(skb);
@@ -727,7 +726,6 @@ static void el_receive(struct net_device *dev)
727 dev->stats.rx_packets++; 726 dev->stats.rx_packets++;
728 dev->stats.rx_bytes += pkt_len; 727 dev->stats.rx_bytes += pkt_len;
729 } 728 }
730 return;
731} 729}
732 730
733/** 731/**
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index b74a0eadbd6c..baac246561b9 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -573,7 +573,6 @@ el2_block_output(struct net_device *dev, int count,
573 } 573 }
574 blocked:; 574 blocked:;
575 outb_p(ei_status.interface_num==0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL); 575 outb_p(ei_status.interface_num==0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
576 return;
577} 576}
578 577
579/* Read the 4 byte, page aligned 8390 specific header. */ 578/* Read the 4 byte, page aligned 8390 specific header. */
@@ -689,7 +688,6 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring
689 } 688 }
690 blocked:; 689 blocked:;
691 outb_p(ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL); 690 outb_p(ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
692 return;
693} 691}
694 692
695 693
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 8d584f5fd02d..88d766ee0e1b 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -1055,7 +1055,7 @@ static void elp_timeout(struct net_device *dev)
1055 (stat & ACRF) ? "interrupt" : "command"); 1055 (stat & ACRF) ? "interrupt" : "command");
1056 if (elp_debug >= 1) 1056 if (elp_debug >= 1)
1057 pr_debug("%s: status %#02x\n", dev->name, stat); 1057 pr_debug("%s: status %#02x\n", dev->name, stat);
1058 dev->trans_start = jiffies; 1058 dev->trans_start = jiffies; /* prevent tx timeout */
1059 dev->stats.tx_dropped++; 1059 dev->stats.tx_dropped++;
1060 netif_wake_queue(dev); 1060 netif_wake_queue(dev);
1061} 1061}
@@ -1093,11 +1093,6 @@ static netdev_tx_t elp_start_xmit(struct sk_buff *skb, struct net_device *dev)
1093 if (elp_debug >= 3) 1093 if (elp_debug >= 3)
1094 pr_debug("%s: packet of length %d sent\n", dev->name, (int) skb->len); 1094 pr_debug("%s: packet of length %d sent\n", dev->name, (int) skb->len);
1095 1095
1096 /*
1097 * start the transmit timeout
1098 */
1099 dev->trans_start = jiffies;
1100
1101 prime_rx(dev); 1096 prime_rx(dev);
1102 spin_unlock_irqrestore(&adapter->lock, flags); 1097 spin_unlock_irqrestore(&adapter->lock, flags);
1103 netif_start_queue(dev); 1098 netif_start_queue(dev);
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index 9e95afa49fbe..82eaf65d2d85 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -504,7 +504,7 @@ static void el16_tx_timeout (struct net_device *dev)
504 outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */ 504 outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
505 lp->last_restart = dev->stats.tx_packets; 505 lp->last_restart = dev->stats.tx_packets;
506 } 506 }
507 dev->trans_start = jiffies; 507 dev->trans_start = jiffies; /* prevent tx timeout */
508 netif_wake_queue (dev); 508 netif_wake_queue (dev);
509} 509}
510 510
@@ -528,7 +528,6 @@ static netdev_tx_t el16_send_packet (struct sk_buff *skb,
528 528
529 hardware_send_packet (dev, buf, skb->len, length - skb->len); 529 hardware_send_packet (dev, buf, skb->len, length - skb->len);
530 530
531 dev->trans_start = jiffies;
532 /* Enable the 82586 interrupt input. */ 531 /* Enable the 82586 interrupt input. */
533 outb (0x84, ioaddr + MISC_CTRL); 532 outb (0x84, ioaddr + MISC_CTRL);
534 533
@@ -765,7 +764,6 @@ static void init_82586_mem(struct net_device *dev)
765 if (net_debug > 4) 764 if (net_debug > 4)
766 pr_debug("%s: Initialized 82586, status %04x.\n", dev->name, 765 pr_debug("%s: Initialized 82586, status %04x.\n", dev->name,
767 readw(shmem+iSCB_STATUS)); 766 readw(shmem+iSCB_STATUS));
768 return;
769} 767}
770 768
771static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad) 769static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad)
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index ab9bb3c52002..91abb965fb44 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -807,7 +807,7 @@ el3_tx_timeout (struct net_device *dev)
807 dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS), 807 dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
808 inw(ioaddr + TX_FREE)); 808 inw(ioaddr + TX_FREE));
809 dev->stats.tx_errors++; 809 dev->stats.tx_errors++;
810 dev->trans_start = jiffies; 810 dev->trans_start = jiffies; /* prevent tx timeout */
811 /* Issue TX_RESET and TX_START commands. */ 811 /* Issue TX_RESET and TX_START commands. */
812 outw(TxReset, ioaddr + EL3_CMD); 812 outw(TxReset, ioaddr + EL3_CMD);
813 outw(TxEnable, ioaddr + EL3_CMD); 813 outw(TxEnable, ioaddr + EL3_CMD);
@@ -868,7 +868,6 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
868 /* ... and the packet rounded to a doubleword. */ 868 /* ... and the packet rounded to a doubleword. */
869 outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2); 869 outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);
870 870
871 dev->trans_start = jiffies;
872 if (inw(ioaddr + TX_FREE) > 1536) 871 if (inw(ioaddr + TX_FREE) > 1536)
873 netif_start_queue(dev); 872 netif_start_queue(dev);
874 else 873 else
@@ -1038,7 +1037,6 @@ static void update_stats(struct net_device *dev)
1038 /* Back to window 1, and turn statistics back on. */ 1037 /* Back to window 1, and turn statistics back on. */
1039 EL3WINDOW(1); 1038 EL3WINDOW(1);
1040 outw(StatsEnable, ioaddr + EL3_CMD); 1039 outw(StatsEnable, ioaddr + EL3_CMD);
1041 return;
1042} 1040}
1043 1041
1044static int 1042static int
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 2e17837be546..3bba835f1a21 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -958,7 +958,6 @@ static void corkscrew_timer(unsigned long data)
958 dev->name, media_tbl[dev->if_port].name); 958 dev->name, media_tbl[dev->if_port].name);
959 959
960#endif /* AUTOMEDIA */ 960#endif /* AUTOMEDIA */
961 return;
962} 961}
963 962
964static void corkscrew_timeout(struct net_device *dev) 963static void corkscrew_timeout(struct net_device *dev)
@@ -992,7 +991,7 @@ static void corkscrew_timeout(struct net_device *dev)
992 if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress)) 991 if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress))
993 break; 992 break;
994 outw(TxEnable, ioaddr + EL3_CMD); 993 outw(TxEnable, ioaddr + EL3_CMD);
995 dev->trans_start = jiffies; 994 dev->trans_start = jiffies; /* prevent tx timeout */
996 dev->stats.tx_errors++; 995 dev->stats.tx_errors++;
997 dev->stats.tx_dropped++; 996 dev->stats.tx_dropped++;
998 netif_wake_queue(dev); 997 netif_wake_queue(dev);
@@ -1055,7 +1054,6 @@ static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
1055 prev_entry->status &= ~0x80000000; 1054 prev_entry->status &= ~0x80000000;
1056 netif_wake_queue(dev); 1055 netif_wake_queue(dev);
1057 } 1056 }
1058 dev->trans_start = jiffies;
1059 return NETDEV_TX_OK; 1057 return NETDEV_TX_OK;
1060 } 1058 }
1061 /* Put out the doubleword header... */ 1059 /* Put out the doubleword header... */
@@ -1091,7 +1089,6 @@ static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
1091 outw(SetTxThreshold + (1536 >> 2), ioaddr + EL3_CMD); 1089 outw(SetTxThreshold + (1536 >> 2), ioaddr + EL3_CMD);
1092#endif /* bus master */ 1090#endif /* bus master */
1093 1091
1094 dev->trans_start = jiffies;
1095 1092
1096 /* Clear the Tx status stack. */ 1093 /* Clear the Tx status stack. */
1097 { 1094 {
@@ -1518,7 +1515,6 @@ static void update_stats(int ioaddr, struct net_device *dev)
1518 1515
1519 /* We change back to window 7 (not 1) with the Vortex. */ 1516 /* We change back to window 7 (not 1) with the Vortex. */
1520 EL3WINDOW(7); 1517 EL3WINDOW(7);
1521 return;
1522} 1518}
1523 1519
1524/* This new version of set_rx_mode() supports v1.4 kernels. 1520/* This new version of set_rx_mode() supports v1.4 kernels.
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 55d219e585fb..a7b0e5e43a52 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -1152,7 +1152,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
1152 p->scb->cmd = CUC_START; 1152 p->scb->cmd = CUC_START;
1153 p->xmit_cmds[0]->cmd_status = 0; 1153 p->xmit_cmds[0]->cmd_status = 0;
1154 elmc_attn586(); 1154 elmc_attn586();
1155 dev->trans_start = jiffies;
1156 if (!i) { 1155 if (!i) {
1157 dev_kfree_skb(skb); 1156 dev_kfree_skb(skb);
1158 } 1157 }
@@ -1176,7 +1175,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
1176 p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0; 1175 p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
1177 1176
1178 p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0])); 1177 p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
1179 dev->trans_start = jiffies;
1180 p->nop_point = next_nop; 1178 p->nop_point = next_nop;
1181 dev_kfree_skb(skb); 1179 dev_kfree_skb(skb);
1182#endif 1180#endif
@@ -1190,7 +1188,6 @@ static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
1190 = make16((p->nop_cmds[next_nop])); 1188 = make16((p->nop_cmds[next_nop]));
1191 p->nop_cmds[next_nop]->cmd_status = 0; 1189 p->nop_cmds[next_nop]->cmd_status = 0;
1192 p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count])); 1190 p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
1193 dev->trans_start = jiffies;
1194 p->xmit_count = next_nop; 1191 p->xmit_count = next_nop;
1195 if (p->xmit_count != p->xmit_last) 1192 if (p->xmit_count != p->xmit_last)
1196 netif_wake_queue(dev); 1193 netif_wake_queue(dev);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 97525307ed27..d75803e6e527 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1855,7 +1855,6 @@ leave_media_alone:
1855 mod_timer(&vp->timer, RUN_AT(next_tick)); 1855 mod_timer(&vp->timer, RUN_AT(next_tick));
1856 if (vp->deferred) 1856 if (vp->deferred)
1857 iowrite16(FakeIntr, ioaddr + EL3_CMD); 1857 iowrite16(FakeIntr, ioaddr + EL3_CMD);
1858 return;
1859} 1858}
1860 1859
1861static void vortex_tx_timeout(struct net_device *dev) 1860static void vortex_tx_timeout(struct net_device *dev)
@@ -1917,7 +1916,7 @@ static void vortex_tx_timeout(struct net_device *dev)
1917 1916
1918 /* Issue Tx Enable */ 1917 /* Issue Tx Enable */
1919 iowrite16(TxEnable, ioaddr + EL3_CMD); 1918 iowrite16(TxEnable, ioaddr + EL3_CMD);
1920 dev->trans_start = jiffies; 1919 dev->trans_start = jiffies; /* prevent tx timeout */
1921 1920
1922 /* Switch to register set 7 for normal use. */ 1921 /* Switch to register set 7 for normal use. */
1923 EL3WINDOW(7); 1922 EL3WINDOW(7);
@@ -2063,7 +2062,6 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
2063 } 2062 }
2064 } 2063 }
2065 2064
2066 dev->trans_start = jiffies;
2067 2065
2068 /* Clear the Tx status stack. */ 2066 /* Clear the Tx status stack. */
2069 { 2067 {
@@ -2174,7 +2172,6 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2174 } 2172 }
2175 iowrite16(DownUnstall, ioaddr + EL3_CMD); 2173 iowrite16(DownUnstall, ioaddr + EL3_CMD);
2176 spin_unlock_irqrestore(&vp->lock, flags); 2174 spin_unlock_irqrestore(&vp->lock, flags);
2177 dev->trans_start = jiffies;
2178 return NETDEV_TX_OK; 2175 return NETDEV_TX_OK;
2179} 2176}
2180 2177
@@ -2800,7 +2797,6 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev)
2800 } 2797 }
2801 2798
2802 EL3WINDOW(old_window >> 13); 2799 EL3WINDOW(old_window >> 13);
2803 return;
2804} 2800}
2805 2801
2806static int vortex_nway_reset(struct net_device *dev) 2802static int vortex_nway_reset(struct net_device *dev)
@@ -3122,7 +3118,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
3122 iowrite16(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); 3118 iowrite16(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr);
3123 mdio_delay(); 3119 mdio_delay();
3124 } 3120 }
3125 return;
3126} 3121}
3127 3122
3128/* ACPI: Advanced Configuration and Power Interface. */ 3123/* ACPI: Advanced Configuration and Power Interface. */
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index f09e59451495..903bcb3ef5bd 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -262,7 +262,7 @@ static int lance_reset (struct net_device *dev)
262 262
263 load_csrs (lp); 263 load_csrs (lp);
264 lance_init_ring (dev); 264 lance_init_ring (dev);
265 dev->trans_start = jiffies; 265 dev->trans_start = jiffies; /* prevent tx timeout */
266 status = init_restart_lance (lp); 266 status = init_restart_lance (lp);
267#ifdef DEBUG_DRIVER 267#ifdef DEBUG_DRIVER
268 printk ("Lance restart=%d\n", status); 268 printk ("Lance restart=%d\n", status);
@@ -526,7 +526,7 @@ void lance_tx_timeout(struct net_device *dev)
526{ 526{
527 printk("lance_tx_timeout\n"); 527 printk("lance_tx_timeout\n");
528 lance_reset(dev); 528 lance_reset(dev);
529 dev->trans_start = jiffies; 529 dev->trans_start = jiffies; /* prevent tx timeout */
530 netif_wake_queue (dev); 530 netif_wake_queue (dev);
531} 531}
532EXPORT_SYMBOL_GPL(lance_tx_timeout); 532EXPORT_SYMBOL_GPL(lance_tx_timeout);
@@ -574,7 +574,6 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
574 outs++; 574 outs++;
575 /* Kick the lance: transmit now */ 575 /* Kick the lance: transmit now */
576 WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD); 576 WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD);
577 dev->trans_start = jiffies;
578 dev_kfree_skb (skb); 577 dev_kfree_skb (skb);
579 578
580 spin_lock_irqsave (&lp->devlock, flags); 579 spin_lock_irqsave (&lp->devlock, flags);
@@ -620,7 +619,6 @@ static void lance_load_multicast (struct net_device *dev)
620 crc = crc >> 26; 619 crc = crc >> 26;
621 mcast_table [crc >> 4] |= 1 << (crc & 0xf); 620 mcast_table [crc >> 4] |= 1 << (crc & 0xf);
622 } 621 }
623 return;
624} 622}
625 623
626 624
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 4e8d11cfe477..9c149750e2bf 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -882,7 +882,6 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
882 spin_unlock_irqrestore(&cp->lock, intr_flags); 882 spin_unlock_irqrestore(&cp->lock, intr_flags);
883 883
884 cpw8(TxPoll, NormalTxPoll); 884 cpw8(TxPoll, NormalTxPoll);
885 dev->trans_start = jiffies;
886 885
887 return NETDEV_TX_OK; 886 return NETDEV_TX_OK;
888} 887}
@@ -1225,8 +1224,6 @@ static void cp_tx_timeout(struct net_device *dev)
1225 netif_wake_queue(dev); 1224 netif_wake_queue(dev);
1226 1225
1227 spin_unlock_irqrestore(&cp->lock, flags); 1226 spin_unlock_irqrestore(&cp->lock, flags);
1228
1229 return;
1230} 1227}
1231 1228
1232#ifdef BROKEN 1229#ifdef BROKEN
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index d0cb372a0f0d..4ba72933f0da 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1716,8 +1716,6 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
1716 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), 1716 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
1717 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); 1717 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
1718 1718
1719 dev->trans_start = jiffies;
1720
1721 tp->cur_tx++; 1719 tp->cur_tx++;
1722 1720
1723 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) 1721 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 97c5fc019cd4..dd8dc15556cb 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1050,7 +1050,7 @@ static void i596_tx_timeout (struct net_device *dev)
1050 lp->last_restart = dev->stats.tx_packets; 1050 lp->last_restart = dev->stats.tx_packets;
1051 } 1051 }
1052 1052
1053 dev->trans_start = jiffies; 1053 dev->trans_start = jiffies; /* prevent tx timeout */
1054 netif_wake_queue (dev); 1054 netif_wake_queue (dev);
1055} 1055}
1056 1056
@@ -1060,7 +1060,6 @@ static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1060 struct tx_cmd *tx_cmd; 1060 struct tx_cmd *tx_cmd;
1061 struct i596_tbd *tbd; 1061 struct i596_tbd *tbd;
1062 short length = skb->len; 1062 short length = skb->len;
1063 dev->trans_start = jiffies;
1064 1063
1065 DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n", 1064 DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n",
1066 dev->name, skb->len, skb->data)); 1065 dev->name, skb->len, skb->data));
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index ce0a0b8787d8..541f9a20f519 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -525,7 +525,7 @@ static inline int lance_reset (struct net_device *dev)
525 load_csrs (lp); 525 load_csrs (lp);
526 526
527 lance_init_ring (dev); 527 lance_init_ring (dev);
528 dev->trans_start = jiffies; 528 dev->trans_start = jiffies; /* prevent tx timeout */
529 netif_start_queue(dev); 529 netif_start_queue(dev);
530 530
531 status = init_restart_lance (lp); 531 status = init_restart_lance (lp);
@@ -588,7 +588,6 @@ static netdev_tx_t lance_start_xmit (struct sk_buff *skb,
588 588
589 /* Kick the lance: transmit now */ 589 /* Kick the lance: transmit now */
590 ll->rdp = LE_C0_INEA | LE_C0_TDMD; 590 ll->rdp = LE_C0_INEA | LE_C0_TDMD;
591 dev->trans_start = jiffies;
592 dev_kfree_skb (skb); 591 dev_kfree_skb (skb);
593 592
594 local_irq_restore(flags); 593 local_irq_restore(flags);
@@ -628,7 +627,6 @@ static void lance_load_multicast (struct net_device *dev)
628 crc = crc >> 26; 627 crc = crc >> 26;
629 mcast_table [crc >> 4] |= 1 << (crc & 0xf); 628 mcast_table [crc >> 4] |= 1 << (crc & 0xf);
630 } 629 }
631 return;
632} 630}
633 631
634static void lance_set_multicast (struct net_device *dev) 632static void lance_set_multicast (struct net_device *dev)
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index eac73382c087..b9115a776fdd 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -307,8 +307,6 @@ static void ac_reset_8390(struct net_device *dev)
307 ei_status.txing = 0; 307 ei_status.txing = 0;
308 outb(AC_ENABLE, ioaddr + AC_RESET_PORT); 308 outb(AC_ENABLE, ioaddr + AC_RESET_PORT);
309 if (ei_debug > 1) printk("reset done\n"); 309 if (ei_debug > 1) printk("reset done\n");
310
311 return;
312} 310}
313 311
314/* Grab the 8390 specific header. Similar to the block_input routine, but 312/* Grab the 8390 specific header. Similar to the block_input routine, but
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 1328eb9b841d..b9a591604e5b 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2919,8 +2919,6 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz
2919 dest += tsize; 2919 dest += tsize;
2920 size -= tsize; 2920 size -= tsize;
2921 } 2921 }
2922
2923 return;
2924} 2922}
2925 2923
2926 2924
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 97d71a960602..585c25f4b60c 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1339,8 +1339,6 @@ static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb,
1339 writel( VAL1 | TDMD0, lp->mmio + CMD0); 1339 writel( VAL1 | TDMD0, lp->mmio + CMD0);
1340 writel( VAL2 | RDMD0,lp->mmio + CMD0); 1340 writel( VAL2 | RDMD0,lp->mmio + CMD0);
1341 1341
1342 dev->trans_start = jiffies;
1343
1344 if(amd8111e_tx_queue_avail(lp) < 0){ 1342 if(amd8111e_tx_queue_avail(lp) < 0){
1345 netif_stop_queue(dev); 1343 netif_stop_queue(dev);
1346 } 1344 }
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index 1437f5d12121..2fe60f168108 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -521,7 +521,6 @@ apne_block_output(struct net_device *dev, int count,
521 521
522 outb(ENISR_RDC, nic_base + NE_EN0_ISR); /* Ack intr. */ 522 outb(ENISR_RDC, nic_base + NE_EN0_ISR); /* Ack intr. */
523 ei_status.dmaing &= ~0x01; 523 ei_status.dmaing &= ~0x01;
524 return;
525} 524}
526 525
527static irqreturn_t apne_interrupt(int irq, void *dev_id) 526static irqreturn_t apne_interrupt(int irq, void *dev_id)
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 6f8d6206b5c4..748c9f526e71 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -593,8 +593,6 @@ static void cops_load (struct net_device *dev)
593 tangent_wait_reset(ioaddr); 593 tangent_wait_reset(ioaddr);
594 inb(ioaddr); /* Clear initial ready signal. */ 594 inb(ioaddr); /* Clear initial ready signal. */
595 } 595 }
596
597 return;
598} 596}
599 597
600/* 598/*
@@ -701,8 +699,6 @@ static void cops_poll(unsigned long ltdev)
701 /* poll 20 times per second */ 699 /* poll 20 times per second */
702 cops_timer.expires = jiffies + HZ/20; 700 cops_timer.expires = jiffies + HZ/20;
703 add_timer(&cops_timer); 701 add_timer(&cops_timer);
704
705 return;
706} 702}
707 703
708/* 704/*
@@ -866,7 +862,7 @@ static void cops_timeout(struct net_device *dev)
866 } 862 }
867 printk(KERN_WARNING "%s: Transmit timed out.\n", dev->name); 863 printk(KERN_WARNING "%s: Transmit timed out.\n", dev->name);
868 cops_jumpstart(dev); /* Restart the card. */ 864 cops_jumpstart(dev); /* Restart the card. */
869 dev->trans_start = jiffies; 865 dev->trans_start = jiffies; /* prevent tx timeout */
870 netif_wake_queue(dev); 866 netif_wake_queue(dev);
871} 867}
872 868
@@ -919,9 +915,8 @@ static netdev_tx_t cops_send_packet(struct sk_buff *skb,
919 /* Done sending packet, update counters and cleanup. */ 915 /* Done sending packet, update counters and cleanup. */
920 dev->stats.tx_packets++; 916 dev->stats.tx_packets++;
921 dev->stats.tx_bytes += skb->len; 917 dev->stats.tx_bytes += skb->len;
922 dev->trans_start = jiffies;
923 dev_kfree_skb (skb); 918 dev_kfree_skb (skb);
924 return NETDEV_TX_OK; 919 return NETDEV_TX_OK;
925} 920}
926 921
927/* 922/*
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6af65b656f31..adc07551739e 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -641,7 +641,6 @@ done:
641 inb_p(base+7); 641 inb_p(base+7);
642 inb_p(base+7); 642 inb_p(base+7);
643 } 643 }
644 return;
645} 644}
646 645
647 646
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index d8f029303754..a746ba272f04 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -654,7 +654,6 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
654 } 654 }
655 } 655 }
656 retval = NETDEV_TX_OK; 656 retval = NETDEV_TX_OK;
657 dev->trans_start = jiffies;
658 lp->next_tx = txbuf; 657 lp->next_tx = txbuf;
659 } else { 658 } else {
660 retval = NETDEV_TX_BUSY; 659 retval = NETDEV_TX_BUSY;
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index fa1a2354f5f9..705373a5308d 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -676,8 +676,6 @@ static netdev_tx_t ariadne_start_xmit(struct sk_buff *skb,
676 lance->RAP = CSR0; /* PCnet-ISA Controller Status */ 676 lance->RAP = CSR0; /* PCnet-ISA Controller Status */
677 lance->RDP = INEA|TDMD; 677 lance->RDP = INEA|TDMD;
678 678
679 dev->trans_start = jiffies;
680
681 if (lowb(priv->tx_ring[(entry+1) % TX_RING_SIZE]->TMD1) != 0) { 679 if (lowb(priv->tx_ring[(entry+1) % TX_RING_SIZE]->TMD1) != 0) {
682 netif_stop_queue(dev); 680 netif_stop_queue(dev);
683 priv->tx_full = 1; 681 priv->tx_full = 1;
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index a4b5b08276f8..8c496fb1ac9e 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -469,7 +469,6 @@ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
469 469
470 spin_lock_irqsave(&priv->chip_lock, flags); 470 spin_lock_irqsave(&priv->chip_lock, flags);
471 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA); 471 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
472 dev->trans_start = jiffies;
473 spin_unlock_irqrestore(&priv->chip_lock, flags); 472 spin_unlock_irqrestore(&priv->chip_lock, flags);
474 473
475 /* 474 /*
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 0adab30f626b..e07b314ed8fd 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -824,7 +824,6 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
824 /* Set length of the packet in the Transmit Control register */ 824 /* Set length of the packet in the Transmit Control register */
825 at91_emac_write(AT91_EMAC_TCR, skb->len); 825 at91_emac_write(AT91_EMAC_TCR, skb->len);
826 826
827 dev->trans_start = jiffies;
828 } else { 827 } else {
829 printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n"); 828 printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n");
830 return NETDEV_TX_BUSY; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb) 829 return NETDEV_TX_BUSY; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb)
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 6995169d285a..4a5ec9470aa1 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -311,11 +311,6 @@ err:
311 processed++; 311 processed++;
312 } 312 }
313 313
314 if (processed) {
315 wrw(ep, REG_RXDENQ, processed);
316 wrw(ep, REG_RXSTSENQ, processed);
317 }
318
319 return processed; 314 return processed;
320} 315}
321 316
@@ -350,6 +345,11 @@ poll_some_more:
350 goto poll_some_more; 345 goto poll_some_more;
351 } 346 }
352 347
348 if (rx) {
349 wrw(ep, REG_RXDENQ, rx);
350 wrw(ep, REG_RXSTSENQ, rx);
351 }
352
353 return rx; 353 return rx;
354} 354}
355 355
@@ -374,8 +374,6 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
374 skb->len, DMA_TO_DEVICE); 374 skb->len, DMA_TO_DEVICE);
375 dev_kfree_skb(skb); 375 dev_kfree_skb(skb);
376 376
377 dev->trans_start = jiffies;
378
379 spin_lock_irq(&ep->tx_pending_lock); 377 spin_lock_irq(&ep->tx_pending_lock);
380 ep->tx_pending++; 378 ep->tx_pending++;
381 if (ep->tx_pending == TX_QUEUE_ENTRIES) 379 if (ep->tx_pending == TX_QUEUE_ENTRIES)
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index e47c0d962857..b17ab5153f51 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -736,7 +736,6 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
736 local_irq_restore(flags); 736 local_irq_restore(flags);
737 737
738 /* handle transmit */ 738 /* handle transmit */
739 dev->trans_start = jiffies;
740 739
741 /* check to see if we have room for a full sized ether frame */ 740 /* check to see if we have room for a full sized ether frame */
742 tmp = priv(dev)->tx_head; 741 tmp = priv(dev)->tx_head;
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index d9de9bce2395..1361b7367c28 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -529,7 +529,6 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)
529 return NETDEV_TX_BUSY; /* unable to queue */ 529 return NETDEV_TX_BUSY; /* unable to queue */
530 } 530 }
531 531
532 dev->trans_start = jiffies;
533 ptr = 0x600 * priv(dev)->tx_head; 532 ptr = 0x600 * priv(dev)->tx_head;
534 priv(dev)->tx_head = next_ptr; 533 priv(dev)->tx_head = next_ptr;
535 next_ptr *= 0x600; 534 next_ptr *= 0x600;
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 7800d7dfd299..24df0325090c 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -708,7 +708,6 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
708 /* NPE firmware pads short frames with zeros internally */ 708 /* NPE firmware pads short frames with zeros internally */
709 wmb(); 709 wmb();
710 queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc); 710 queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc);
711 dev->trans_start = jiffies;
712 711
713 if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ 712 if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */
714#if DEBUG_TX 713#if DEBUG_TX
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 6404704f7eac..54c6d849cf25 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -1302,8 +1302,6 @@ ks8695_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1302 if (++ksp->tx_ring_used == MAX_TX_DESC) 1302 if (++ksp->tx_ring_used == MAX_TX_DESC)
1303 netif_stop_queue(ndev); 1303 netif_stop_queue(ndev);
1304 1304
1305 ndev->trans_start = jiffies;
1306
1307 /* Kick the TX DMA in case it decided to go IDLE */ 1305 /* Kick the TX DMA in case it decided to go IDLE */
1308 ks8695_writereg(ksp, KS8695_DTSC, 0); 1306 ks8695_writereg(ksp, KS8695_DTSC, 0);
1309 1307
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c
index 2491934b73e8..2e852463382b 100644
--- a/drivers/net/arm/w90p910_ether.c
+++ b/drivers/net/arm/w90p910_ether.c
@@ -483,7 +483,7 @@ static void w90p910_reset_mac(struct net_device *dev)
483 483
484 w90p910_init_desc(dev); 484 w90p910_init_desc(dev);
485 485
486 dev->trans_start = jiffies; 486 dev->trans_start = jiffies; /* prevent tx timeout */
487 ether->cur_tx = 0x0; 487 ether->cur_tx = 0x0;
488 ether->finish_tx = 0x0; 488 ether->finish_tx = 0x0;
489 ether->cur_rx = 0x0; 489 ether->cur_rx = 0x0;
@@ -497,7 +497,7 @@ static void w90p910_reset_mac(struct net_device *dev)
497 w90p910_trigger_tx(dev); 497 w90p910_trigger_tx(dev);
498 w90p910_trigger_rx(dev); 498 w90p910_trigger_rx(dev);
499 499
500 dev->trans_start = jiffies; 500 dev->trans_start = jiffies; /* prevent tx timeout */
501 501
502 if (netif_queue_stopped(dev)) 502 if (netif_queue_stopped(dev))
503 netif_wake_queue(dev); 503 netif_wake_queue(dev);
@@ -634,8 +634,6 @@ static int w90p910_send_frame(struct net_device *dev,
634 634
635 txbd = &ether->tdesc->desclist[ether->cur_tx]; 635 txbd = &ether->tdesc->desclist[ether->cur_tx];
636 636
637 dev->trans_start = jiffies;
638
639 if (txbd->mode & TX_OWEN_DMA) 637 if (txbd->mode & TX_OWEN_DMA)
640 netif_stop_queue(dev); 638 netif_stop_queue(dev);
641 639
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index 332f9806b78e..93185f5f09ac 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -583,7 +583,7 @@ static void net_tx_timeout (struct net_device *dev)
583 outb (0x00, ioaddr + TX_START); 583 outb (0x00, ioaddr + TX_START);
584 outb (0x03, ioaddr + COL16CNTL); 584 outb (0x03, ioaddr + COL16CNTL);
585 585
586 dev->trans_start = jiffies; 586 dev->trans_start = jiffies; /* prevent tx timeout */
587 587
588 lp->tx_started = 0; 588 lp->tx_started = 0;
589 lp->tx_queue_ready = 1; 589 lp->tx_queue_ready = 1;
@@ -636,7 +636,6 @@ static netdev_tx_t net_send_packet (struct sk_buff *skb,
636 outb (0x80 | lp->tx_queue, ioaddr + TX_START); 636 outb (0x80 | lp->tx_queue, ioaddr + TX_START);
637 lp->tx_queue = 0; 637 lp->tx_queue = 0;
638 lp->tx_queue_len = 0; 638 lp->tx_queue_len = 0;
639 dev->trans_start = jiffies;
640 lp->tx_started = 1; 639 lp->tx_started = 1;
641 netif_start_queue (dev); 640 netif_start_queue (dev);
642 } else if (lp->tx_queue_len < 4096 - 1502) 641 } else if (lp->tx_queue_len < 4096 - 1502)
@@ -796,7 +795,6 @@ net_rx(struct net_device *dev)
796 printk("%s: Exint Rx packet with mode %02x after %d ticks.\n", 795 printk("%s: Exint Rx packet with mode %02x after %d ticks.\n",
797 dev->name, inb(ioaddr + RX_MODE), i); 796 dev->name, inb(ioaddr + RX_MODE), i);
798 } 797 }
799 return;
800} 798}
801 799
802/* The inverse routine to net_open(). */ 800/* The inverse routine to net_open(). */
@@ -870,7 +868,6 @@ set_rx_mode(struct net_device *dev)
870 outw(saved_bank, ioaddr + CONFIG_0); 868 outw(saved_bank, ioaddr + CONFIG_0);
871 } 869 }
872 spin_unlock_irqrestore (&lp->lock, flags); 870 spin_unlock_irqrestore (&lp->lock, flags);
873 return;
874} 871}
875 872
876#ifdef MODULE 873#ifdef MODULE
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index a8686bfec7a1..b57d7dee389a 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -767,8 +767,8 @@ static void lance_tx_timeout (struct net_device *dev)
767 /* lance_restart, essentially */ 767 /* lance_restart, essentially */
768 lance_init_ring(dev); 768 lance_init_ring(dev);
769 REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT; 769 REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT;
770 dev->trans_start = jiffies; 770 dev->trans_start = jiffies; /* prevent tx timeout */
771 netif_wake_queue (dev); 771 netif_wake_queue(dev);
772} 772}
773 773
774/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ 774/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
@@ -836,7 +836,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
836 836
837 /* Trigger an immediate send poll. */ 837 /* Trigger an immediate send poll. */
838 DREG = CSR0_INEA | CSR0_TDMD; 838 DREG = CSR0_INEA | CSR0_TDMD;
839 dev->trans_start = jiffies;
840 839
841 if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) == 840 if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) ==
842 TMD1_OWN_HOST) 841 TMD1_OWN_HOST)
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 32339243d61f..7c521508313c 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -263,8 +263,6 @@ static void atl1c_get_wol(struct net_device *netdev,
263 wol->wolopts |= WAKE_MAGIC; 263 wol->wolopts |= WAKE_MAGIC;
264 if (adapter->wol & AT_WUFC_LNKC) 264 if (adapter->wol & AT_WUFC_LNKC)
265 wol->wolopts |= WAKE_PHY; 265 wol->wolopts |= WAKE_PHY;
266
267 return;
268} 266}
269 267
270static int atl1c_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 268static int atl1c_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 3d7051135c3a..1c3c046d5f34 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -317,8 +317,6 @@ static void atl1c_common_task(struct work_struct *work)
317 317
318 if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE) 318 if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE)
319 atl1c_check_link_status(adapter); 319 atl1c_check_link_status(adapter);
320
321 return;
322} 320}
323 321
324 322
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c
index ffd696ee7c8e..6943a6c3b948 100644
--- a/drivers/net/atl1e/atl1e_ethtool.c
+++ b/drivers/net/atl1e/atl1e_ethtool.c
@@ -338,8 +338,6 @@ static void atl1e_get_wol(struct net_device *netdev,
338 wol->wolopts |= WAKE_MAGIC; 338 wol->wolopts |= WAKE_MAGIC;
339 if (adapter->wol & AT_WUFC_LNKC) 339 if (adapter->wol & AT_WUFC_LNKC)
340 wol->wolopts |= WAKE_PHY; 340 wol->wolopts |= WAKE_PHY;
341
342 return;
343} 341}
344 342
345static int atl1e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 343static int atl1e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 7dd33776de00..1acea5774e89 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -707,8 +707,6 @@ static void atl1e_init_ring_resources(struct atl1e_adapter *adapter)
707 adapter->ring_vir_addr = NULL; 707 adapter->ring_vir_addr = NULL;
708 adapter->rx_ring.desc = NULL; 708 adapter->rx_ring.desc = NULL;
709 rwlock_init(&adapter->tx_ring.tx_lock); 709 rwlock_init(&adapter->tx_ring.tx_lock);
710
711 return;
712} 710}
713 711
714/* 712/*
@@ -905,8 +903,6 @@ static inline void atl1e_configure_des_ring(const struct atl1e_adapter *adapter)
905 AT_WRITE_REG(hw, REG_HOST_RXFPAGE_SIZE, rx_ring->page_size); 903 AT_WRITE_REG(hw, REG_HOST_RXFPAGE_SIZE, rx_ring->page_size);
906 /* Load all of base address above */ 904 /* Load all of base address above */
907 AT_WRITE_REG(hw, REG_LOAD_PTR, 1); 905 AT_WRITE_REG(hw, REG_LOAD_PTR, 1);
908
909 return;
910} 906}
911 907
912static inline void atl1e_configure_tx(struct atl1e_adapter *adapter) 908static inline void atl1e_configure_tx(struct atl1e_adapter *adapter)
@@ -950,7 +946,6 @@ static inline void atl1e_configure_tx(struct atl1e_adapter *adapter)
950 (((u16)hw->tpd_burst & TXQ_CTRL_NUM_TPD_BURST_MASK) 946 (((u16)hw->tpd_burst & TXQ_CTRL_NUM_TPD_BURST_MASK)
951 << TXQ_CTRL_NUM_TPD_BURST_SHIFT) 947 << TXQ_CTRL_NUM_TPD_BURST_SHIFT)
952 | TXQ_CTRL_ENH_MODE | TXQ_CTRL_EN); 948 | TXQ_CTRL_ENH_MODE | TXQ_CTRL_EN);
953 return;
954} 949}
955 950
956static inline void atl1e_configure_rx(struct atl1e_adapter *adapter) 951static inline void atl1e_configure_rx(struct atl1e_adapter *adapter)
@@ -1004,7 +999,6 @@ static inline void atl1e_configure_rx(struct atl1e_adapter *adapter)
1004 RXQ_CTRL_CUT_THRU_EN | RXQ_CTRL_EN; 999 RXQ_CTRL_CUT_THRU_EN | RXQ_CTRL_EN;
1005 1000
1006 AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data); 1001 AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data);
1007 return;
1008} 1002}
1009 1003
1010static inline void atl1e_configure_dma(struct atl1e_adapter *adapter) 1004static inline void atl1e_configure_dma(struct atl1e_adapter *adapter)
@@ -1024,7 +1018,6 @@ static inline void atl1e_configure_dma(struct atl1e_adapter *adapter)
1024 << DMA_CTRL_DMAW_DLY_CNT_SHIFT; 1018 << DMA_CTRL_DMAW_DLY_CNT_SHIFT;
1025 1019
1026 AT_WRITE_REG(hw, REG_DMA_CTRL, dma_ctrl_data); 1020 AT_WRITE_REG(hw, REG_DMA_CTRL, dma_ctrl_data);
1027 return;
1028} 1021}
1029 1022
1030static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter) 1023static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter)
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 33448a09b47f..63b9ba0cc67e 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1830,8 +1830,6 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
1830 adapter->hw_csum_good++; 1830 adapter->hw_csum_good++;
1831 return; 1831 return;
1832 } 1832 }
1833
1834 return;
1835} 1833}
1836 1834
1837/* 1835/*
@@ -3390,7 +3388,6 @@ static void atl1_get_wol(struct net_device *netdev,
3390 wol->wolopts = 0; 3388 wol->wolopts = 0;
3391 if (adapter->wol & ATLX_WUFC_MAG) 3389 if (adapter->wol & ATLX_WUFC_MAG)
3392 wol->wolopts |= WAKE_MAGIC; 3390 wol->wolopts |= WAKE_MAGIC;
3393 return;
3394} 3391}
3395 3392
3396static int atl1_set_wol(struct net_device *netdev, 3393static int atl1_set_wol(struct net_device *netdev,
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index fee9cf6a5bd4..8da87383fb39 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -892,7 +892,6 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb,
892 (adapter->txd_write_ptr >> 2)); 892 (adapter->txd_write_ptr >> 2));
893 893
894 mmiowb(); 894 mmiowb();
895 netdev->trans_start = jiffies;
896 dev_kfree_skb_any(skb); 895 dev_kfree_skb_any(skb);
897 return NETDEV_TX_OK; 896 return NETDEV_TX_OK;
898} 897}
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index 2bd1a5c0ec17..bd2f9d331dac 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -547,7 +547,7 @@ static void tx_timeout(struct net_device *dev)
547 dev->stats.tx_errors++; 547 dev->stats.tx_errors++;
548 /* Try to restart the adapter. */ 548 /* Try to restart the adapter. */
549 hardware_init(dev); 549 hardware_init(dev);
550 dev->trans_start = jiffies; 550 dev->trans_start = jiffies; /* prevent tx timeout */
551 netif_wake_queue(dev); 551 netif_wake_queue(dev);
552 dev->stats.tx_errors++; 552 dev->stats.tx_errors++;
553} 553}
@@ -586,7 +586,6 @@ static netdev_tx_t atp_send_packet(struct sk_buff *skb,
586 write_reg(ioaddr, IMR, ISR_RxOK | ISR_TxErr | ISR_TxOK); 586 write_reg(ioaddr, IMR, ISR_RxOK | ISR_TxErr | ISR_TxOK);
587 write_reg_high(ioaddr, IMR, ISRh_RxErr); 587 write_reg_high(ioaddr, IMR, ISRh_RxErr);
588 588
589 dev->trans_start = jiffies;
590 dev_kfree_skb (skb); 589 dev_kfree_skb (skb);
591 return NETDEV_TX_OK; 590 return NETDEV_TX_OK;
592} 591}
@@ -803,7 +802,6 @@ static void net_rx(struct net_device *dev)
803 done: 802 done:
804 write_reg(ioaddr, CMR1, CMR1_NextPkt); 803 write_reg(ioaddr, CMR1, CMR1_NextPkt);
805 lp->last_rx_time = jiffies; 804 lp->last_rx_time = jiffies;
806 return;
807} 805}
808 806
809static void read_block(long ioaddr, int length, unsigned char *p, int data_mode) 807static void read_block(long ioaddr, int length, unsigned char *p, int data_mode)
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 7abb2c84ba5d..ece6128bef14 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -924,7 +924,6 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
924 au_sync(); 924 au_sync();
925 dev_kfree_skb(skb); 925 dev_kfree_skb(skb);
926 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1); 926 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
927 dev->trans_start = jiffies;
928 return NETDEV_TX_OK; 927 return NETDEV_TX_OK;
929} 928}
930 929
@@ -937,7 +936,7 @@ static void au1000_tx_timeout(struct net_device *dev)
937 netdev_err(dev, "au1000_tx_timeout: dev=%p\n", dev); 936 netdev_err(dev, "au1000_tx_timeout: dev=%p\n", dev);
938 au1000_reset_mac(dev); 937 au1000_reset_mac(dev);
939 au1000_init(dev); 938 au1000_init(dev);
940 dev->trans_start = jiffies; 939 dev->trans_start = jiffies; /* prevent tx timeout */
941 netif_wake_queue(dev); 940 netif_wake_queue(dev);
942} 941}
943 942
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index b718dc60afc4..55c9958043c4 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -303,7 +303,6 @@ static void ax_block_output(struct net_device *dev, int count,
303 303
304 ei_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ 304 ei_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
305 ei_status.dmaing &= ~0x01; 305 ei_status.dmaing &= ~0x01;
306 return;
307} 306}
308 307
309/* definitions for accessing MII/EEPROM interface */ 308/* definitions for accessing MII/EEPROM interface */
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 458272196997..293f9c16e786 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1014,8 +1014,6 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
1014 if (TX_BUFFS_AVAIL(bp) < 1) 1014 if (TX_BUFFS_AVAIL(bp) < 1)
1015 netif_stop_queue(dev); 1015 netif_stop_queue(dev);
1016 1016
1017 dev->trans_start = jiffies;
1018
1019out_unlock: 1017out_unlock:
1020 spin_unlock_irqrestore(&bp->lock, flags); 1018 spin_unlock_irqrestore(&bp->lock, flags);
1021 1019
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index f48ba80025a2..faf5add894d7 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -565,7 +565,6 @@ static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
565 565
566 priv->stats.tx_bytes += skb->len; 566 priv->stats.tx_bytes += skb->len;
567 priv->stats.tx_packets++; 567 priv->stats.tx_packets++;
568 dev->trans_start = jiffies;
569 ret = NETDEV_TX_OK; 568 ret = NETDEV_TX_OK;
570 569
571out_unlock: 570out_unlock:
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index d488d52d710a..200e98515909 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -276,8 +276,6 @@ be_get_ethtool_stats(struct net_device *netdev,
276 data[i] = (et_stats[i].size == sizeof(u64)) ? 276 data[i] = (et_stats[i].size == sizeof(u64)) ?
277 *(u64 *)p: *(u32 *)p; 277 *(u64 *)p: *(u32 *)p;
278 } 278 }
279
280 return;
281} 279}
282 280
283static void 281static void
@@ -466,7 +464,6 @@ be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
466 else 464 else
467 wol->wolopts = 0; 465 wol->wolopts = 0;
468 memset(&wol->sopass, 0, sizeof(wol->sopass)); 466 memset(&wol->sopass, 0, sizeof(wol->sopass));
469 return;
470} 467}
471 468
472static int 469static int
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index fa10f13242c3..058d7f95f5ae 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -830,7 +830,6 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
830 830
831done: 831done:
832 be_rx_stats_update(adapter, pktsize, num_rcvd); 832 be_rx_stats_update(adapter, pktsize, num_rcvd);
833 return;
834} 833}
835 834
836/* Process the RX completion indicated by rxcp when GRO is disabled */ 835/* Process the RX completion indicated by rxcp when GRO is disabled */
@@ -884,8 +883,6 @@ static void be_rx_compl_process(struct be_adapter *adapter,
884 } else { 883 } else {
885 netif_receive_skb(skb); 884 netif_receive_skb(skb);
886 } 885 }
887
888 return;
889} 886}
890 887
891/* Process the RX completion indicated by rxcp when GRO is enabled */ 888/* Process the RX completion indicated by rxcp when GRO is enabled */
@@ -965,7 +962,6 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
965 } 962 }
966 963
967 be_rx_stats_update(adapter, pkt_size, num_rcvd); 964 be_rx_stats_update(adapter, pkt_size, num_rcvd);
968 return;
969} 965}
970 966
971static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) 967static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter)
@@ -1059,8 +1055,6 @@ static void be_post_rx_frags(struct be_adapter *adapter)
1059 /* Let be_worker replenish when memory is available */ 1055 /* Let be_worker replenish when memory is available */
1060 adapter->rx_post_starved = true; 1056 adapter->rx_post_starved = true;
1061 } 1057 }
1062
1063 return;
1064} 1058}
1065 1059
1066static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq) 1060static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq)
@@ -1622,7 +1616,6 @@ static void be_msix_enable(struct be_adapter *adapter)
1622 BE_NUM_MSIX_VECTORS); 1616 BE_NUM_MSIX_VECTORS);
1623 if (status == 0) 1617 if (status == 0)
1624 adapter->msix_enabled = true; 1618 adapter->msix_enabled = true;
1625 return;
1626} 1619}
1627 1620
1628static void be_sriov_enable(struct be_adapter *adapter) 1621static void be_sriov_enable(struct be_adapter *adapter)
@@ -1634,7 +1627,6 @@ static void be_sriov_enable(struct be_adapter *adapter)
1634 adapter->sriov_enabled = status ? false : true; 1627 adapter->sriov_enabled = status ? false : true;
1635 } 1628 }
1636#endif 1629#endif
1637 return;
1638} 1630}
1639 1631
1640static void be_sriov_disable(struct be_adapter *adapter) 1632static void be_sriov_disable(struct be_adapter *adapter)
@@ -1741,7 +1733,6 @@ static void be_irq_unregister(struct be_adapter *adapter)
1741 be_free_irq(adapter, &adapter->rx_eq); 1733 be_free_irq(adapter, &adapter->rx_eq);
1742done: 1734done:
1743 adapter->isr_registered = false; 1735 adapter->isr_registered = false;
1744 return;
1745} 1736}
1746 1737
1747static int be_open(struct net_device *netdev) 1738static int be_open(struct net_device *netdev)
@@ -2620,8 +2611,6 @@ static void be_shutdown(struct pci_dev *pdev)
2620 be_setup_wol(adapter, true); 2611 be_setup_wol(adapter, true);
2621 2612
2622 pci_disable_device(pdev); 2613 pci_disable_device(pdev);
2623
2624 return;
2625} 2614}
2626 2615
2627static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev, 2616static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev,
@@ -2703,7 +2692,6 @@ static void be_eeh_resume(struct pci_dev *pdev)
2703 return; 2692 return;
2704err: 2693err:
2705 dev_err(&adapter->pdev->dev, "EEH resume failed\n"); 2694 dev_err(&adapter->pdev->dev, "EEH resume failed\n");
2706 return;
2707} 2695}
2708 2696
2709static struct pci_error_handlers be_eeh_handlers = { 2697static struct pci_error_handlers be_eeh_handlers = {
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index c488cea8f455..35548701899f 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -654,7 +654,6 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
654out: 654out:
655 adjust_tx_list(); 655 adjust_tx_list();
656 current_tx_ptr = current_tx_ptr->next; 656 current_tx_ptr = current_tx_ptr->next;
657 dev->trans_start = jiffies;
658 dev->stats.tx_packets++; 657 dev->stats.tx_packets++;
659 dev->stats.tx_bytes += (skb->len); 658 dev->stats.tx_bytes += (skb->len);
660 return NETDEV_TX_OK; 659 return NETDEV_TX_OK;
@@ -805,7 +804,7 @@ static void bfin_mac_timeout(struct net_device *dev)
805 bfin_mac_enable(); 804 bfin_mac_enable();
806 805
807 /* We can accept TX packets again */ 806 /* We can accept TX packets again */
808 dev->trans_start = jiffies; 807 dev->trans_start = jiffies; /* prevent tx timeout */
809 netif_wake_queue(dev); 808 netif_wake_queue(dev);
810} 809}
811 810
@@ -836,8 +835,6 @@ static void bfin_mac_multicast_hash(struct net_device *dev)
836 835
837 bfin_write_EMAC_HASHHI(emac_hashhi); 836 bfin_write_EMAC_HASHHI(emac_hashhi);
838 bfin_write_EMAC_HASHLO(emac_hashlo); 837 bfin_write_EMAC_HASHLO(emac_hashlo);
839
840 return;
841} 838}
842 839
843/* 840/*
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 44ceecf9d103..39250b2ca886 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -167,7 +167,6 @@ static inline void
167dbdma_st32(volatile __u32 __iomem *a, unsigned long x) 167dbdma_st32(volatile __u32 __iomem *a, unsigned long x)
168{ 168{
169 __asm__ volatile( "stwbrx %0,0,%1" : : "r" (x), "r" (a) : "memory"); 169 __asm__ volatile( "stwbrx %0,0,%1" : : "r" (x), "r" (a) : "memory");
170 return;
171} 170}
172 171
173static inline unsigned long 172static inline unsigned long
@@ -382,8 +381,6 @@ bmac_init_registers(struct net_device *dev)
382 bmwrite(dev, RXCFG, RxCRCNoStrip | RxHashFilterEnable | RxRejectOwnPackets); 381 bmwrite(dev, RXCFG, RxCRCNoStrip | RxHashFilterEnable | RxRejectOwnPackets);
383 382
384 bmwrite(dev, INTDISABLE, EnableNormal); 383 bmwrite(dev, INTDISABLE, EnableNormal);
385
386 return;
387} 384}
388 385
389#if 0 386#if 0
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 5f983487d6e4..2d8bd86bc5e2 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -375,7 +375,6 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)
375 at91_write(priv, AT91_MCR(mb), reg_mcr); 375 at91_write(priv, AT91_MCR(mb), reg_mcr);
376 376
377 stats->tx_bytes += cf->can_dlc; 377 stats->tx_bytes += cf->can_dlc;
378 dev->trans_start = jiffies;
379 378
380 /* _NOTE_: substract AT91_MB_TX_FIRST offset from mb! */ 379 /* _NOTE_: substract AT91_MB_TX_FIRST offset from mb! */
381 can_put_echo_skb(skb, dev, mb - AT91_MB_TX_FIRST); 380 can_put_echo_skb(skb, dev, mb - AT91_MB_TX_FIRST);
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index d77264ad326d..b6e890d28366 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -269,8 +269,6 @@ static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
269 /* fill data length code */ 269 /* fill data length code */
270 bfin_write16(&reg->chl[TRANSMIT_CHL].dlc, dlc); 270 bfin_write16(&reg->chl[TRANSMIT_CHL].dlc, dlc);
271 271
272 dev->trans_start = jiffies;
273
274 can_put_echo_skb(skb, dev, 0); 272 can_put_echo_skb(skb, dev, 0);
275 273
276 /* set transmit request */ 274 /* set transmit request */
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 8431eb08075d..b11a0cb5ed81 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -475,7 +475,6 @@ static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb,
475 475
476 netif_stop_queue(net); 476 netif_stop_queue(net);
477 priv->tx_skb = skb; 477 priv->tx_skb = skb;
478 net->trans_start = jiffies;
479 queue_work(priv->wq, &priv->tx_work); 478 queue_work(priv->wq, &priv->tx_work);
480 479
481 return NETDEV_TX_OK; 480 return NETDEV_TX_OK;
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 618c11222abc..24b58619f7c1 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -292,8 +292,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,
292 for (i = 0; i < dlc; i++) 292 for (i = 0; i < dlc; i++)
293 priv->write_reg(priv, dreg++, cf->data[i]); 293 priv->write_reg(priv, dreg++, cf->data[i]);
294 294
295 dev->trans_start = jiffies;
296
297 can_put_echo_skb(skb, dev, 0); 295 can_put_echo_skb(skb, dev, 0);
298 296
299 priv->write_reg(priv, REG_CMR, CMD_TR); 297 priv->write_reg(priv, REG_CMR, CMD_TR);
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index d800b598ae3d..df0a6369d2f2 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -300,8 +300,6 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
300 else if (err) 300 else if (err)
301 dev_err(netdev->dev.parent, 301 dev_err(netdev->dev.parent,
302 "failed resubmitting intr urb: %d\n", err); 302 "failed resubmitting intr urb: %d\n", err);
303
304 return;
305} 303}
306 304
307static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) 305static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
@@ -497,8 +495,6 @@ resubmit_urb:
497 else if (retval) 495 else if (retval)
498 dev_err(netdev->dev.parent, 496 dev_err(netdev->dev.parent,
499 "failed resubmitting read bulk urb: %d\n", retval); 497 "failed resubmitting read bulk urb: %d\n", retval);
500
501 return;
502} 498}
503 499
504/* 500/*
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index bd857a20a755..6d76236ea069 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2889,7 +2889,6 @@ static netdev_tx_t cas_start_xmit(struct sk_buff *skb, struct net_device *dev)
2889 */ 2889 */
2890 if (cas_xmit_tx_ringN(cp, ring++ & N_TX_RINGS_MASK, skb)) 2890 if (cas_xmit_tx_ringN(cp, ring++ & N_TX_RINGS_MASK, skb))
2891 return NETDEV_TX_BUSY; 2891 return NETDEV_TX_BUSY;
2892 dev->trans_start = jiffies;
2893 return NETDEV_TX_OK; 2892 return NETDEV_TX_OK;
2894} 2893}
2895 2894
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 4b451a7c03e9..4b08b18ca5d6 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2092,7 +2092,6 @@ end:
2092 i += j; 2092 i += j;
2093 j = 1; 2093 j = 1;
2094 } 2094 }
2095 return;
2096} 2095}
2097 2096
2098static u16 cnic_bnx2_next_idx(u16 idx) 2097static u16 cnic_bnx2_next_idx(u16 idx)
@@ -2325,7 +2324,6 @@ done:
2325 status_idx, IGU_INT_ENABLE, 1); 2324 status_idx, IGU_INT_ENABLE, 1);
2326 2325
2327 cp->kcq_prod_idx = sw_prod; 2326 cp->kcq_prod_idx = sw_prod;
2328 return;
2329} 2327}
2330 2328
2331static int cnic_service_bnx2x(void *data, void *status_blk) 2329static int cnic_service_bnx2x(void *data, void *status_blk)
@@ -4628,7 +4626,6 @@ static void __exit cnic_exit(void)
4628{ 4626{
4629 unregister_netdevice_notifier(&cnic_netdev_notifier); 4627 unregister_netdevice_notifier(&cnic_netdev_notifier);
4630 cnic_release(); 4628 cnic_release();
4631 return;
4632} 4629}
4633 4630
4634module_init(cnic_init); 4631module_init(cnic_init);
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index bdfff784645c..3c58db595285 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -579,7 +579,6 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
579 } 579 }
580 580
581 spin_lock(&priv->lock); 581 spin_lock(&priv->lock);
582 dev->trans_start = jiffies;
583 spin_unlock(&priv->lock); 582 spin_unlock(&priv->lock);
584 desc->dataflags = CPMAC_SOP | CPMAC_EOP | CPMAC_OWN; 583 desc->dataflags = CPMAC_SOP | CPMAC_EOP | CPMAC_OWN;
585 desc->skb = skb; 584 desc->skb = skb;
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index f49ad8ed9b07..7e00027b9f8e 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -1108,7 +1108,7 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev)
1108 1108
1109 myNextTxDesc->skb = skb; 1109 myNextTxDesc->skb = skb;
1110 1110
1111 dev->trans_start = jiffies; 1111 dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
1112 1112
1113 e100_hardware_send_packet(np, buf, skb->len); 1113 e100_hardware_send_packet(np, buf, skb->len);
1114 1114
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 4c38491b8efb..2ccb9f12805b 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -902,7 +902,6 @@ get_dma_channel(struct net_device *dev)
902 return; 902 return;
903 } 903 }
904 } 904 }
905 return;
906} 905}
907 906
908static void 907static void
@@ -1554,7 +1553,6 @@ static netdev_tx_t net_send_packet(struct sk_buff *skb,struct net_device *dev)
1554 writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1553 writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1555 spin_unlock_irqrestore(&lp->lock, flags); 1554 spin_unlock_irqrestore(&lp->lock, flags);
1556 lp->stats.tx_bytes += skb->len; 1555 lp->stats.tx_bytes += skb->len;
1557 dev->trans_start = jiffies;
1558 dev_kfree_skb (skb); 1556 dev_kfree_skb (skb);
1559 1557
1560 /* 1558 /*
@@ -1673,7 +1671,6 @@ count_rx_errors(int status, struct net_local *lp)
1673 /* per str 172 */ 1671 /* per str 172 */
1674 lp->stats.rx_crc_errors++; 1672 lp->stats.rx_crc_errors++;
1675 if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++; 1673 if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++;
1676 return;
1677} 1674}
1678 1675
1679/* We have a good packet(s), get it/them out of the buffers. */ 1676/* We have a good packet(s), get it/them out of the buffers. */
diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index 2f3ee721c3e1..f452c4003253 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -207,7 +207,6 @@ again:
207 */ 207 */
208 neigh_event_send(e->neigh, NULL); 208 neigh_event_send(e->neigh, NULL);
209 } 209 }
210 return;
211} 210}
212 211
213EXPORT_SYMBOL(t3_l2t_send_event); 212EXPORT_SYMBOL(t3_l2t_send_event);
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index 8856a75fcc94..d3a5c3433df7 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -656,7 +656,6 @@ int t4_check_fw_version(struct adapter *adapter);
656int t4_prep_adapter(struct adapter *adapter); 656int t4_prep_adapter(struct adapter *adapter);
657int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); 657int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
658void t4_fatal_err(struct adapter *adapter); 658void t4_fatal_err(struct adapter *adapter);
659void t4_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on);
660int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, 659int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp,
661 int filter_index, int enable); 660 int filter_index, int enable);
662void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, 661void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp,
@@ -707,7 +706,8 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
707int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, 706int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
708 unsigned int vf, unsigned int viid); 707 unsigned int vf, unsigned int viid);
709int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 708int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
710 int mtu, int promisc, int all_multi, int bcast, bool sleep_ok); 709 int mtu, int promisc, int all_multi, int bcast, int vlanex,
710 bool sleep_ok);
711int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, 711int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
712 unsigned int viid, bool free, unsigned int naddr, 712 unsigned int viid, bool free, unsigned int naddr,
713 const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); 713 const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok);
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 1bad50041427..90d375b421cb 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -290,7 +290,7 @@ static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok)
290 if (ret == 0) 290 if (ret == 0)
291 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, mtu, 291 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, mtu,
292 (dev->flags & IFF_PROMISC) ? 1 : 0, 292 (dev->flags & IFF_PROMISC) ? 1 : 0,
293 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, 293 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, -1,
294 sleep_ok); 294 sleep_ok);
295 return ret; 295 return ret;
296} 296}
@@ -311,7 +311,7 @@ static int link_start(struct net_device *dev)
311 * that step explicitly. 311 * that step explicitly.
312 */ 312 */
313 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, dev->mtu, -1, -1, -1, 313 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, dev->mtu, -1, -1, -1,
314 true); 314 pi->vlan_grp != NULL, true);
315 if (ret == 0) { 315 if (ret == 0) {
316 ret = t4_change_mac(pi->adapter, 0, pi->viid, 316 ret = t4_change_mac(pi->adapter, 0, pi->viid,
317 pi->xact_addr_filt, dev->dev_addr, true, 317 pi->xact_addr_filt, dev->dev_addr, true,
@@ -859,6 +859,8 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
859 "RxCsumGood ", 859 "RxCsumGood ",
860 "VLANextractions ", 860 "VLANextractions ",
861 "VLANinsertions ", 861 "VLANinsertions ",
862 "GROpackets ",
863 "GROmerged ",
862}; 864};
863 865
864static int get_sset_count(struct net_device *dev, int sset) 866static int get_sset_count(struct net_device *dev, int sset)
@@ -922,6 +924,8 @@ struct queue_port_stats {
922 u64 rx_csum; 924 u64 rx_csum;
923 u64 vlan_ex; 925 u64 vlan_ex;
924 u64 vlan_ins; 926 u64 vlan_ins;
927 u64 gro_pkts;
928 u64 gro_merged;
925}; 929};
926 930
927static void collect_sge_port_stats(const struct adapter *adap, 931static void collect_sge_port_stats(const struct adapter *adap,
@@ -938,6 +942,8 @@ static void collect_sge_port_stats(const struct adapter *adap,
938 s->rx_csum += rx->stats.rx_cso; 942 s->rx_csum += rx->stats.rx_cso;
939 s->vlan_ex += rx->stats.vlan_ex; 943 s->vlan_ex += rx->stats.vlan_ex;
940 s->vlan_ins += tx->vlan_ins; 944 s->vlan_ins += tx->vlan_ins;
945 s->gro_pkts += rx->stats.lro_pkts;
946 s->gro_merged += rx->stats.lro_merged;
941 } 947 }
942} 948}
943 949
@@ -2614,7 +2620,7 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
2614 2620
2615 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */ 2621 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */
2616 return -EINVAL; 2622 return -EINVAL;
2617 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, new_mtu, -1, -1, -1, 2623 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, new_mtu, -1, -1, -1, -1,
2618 true); 2624 true);
2619 if (!ret) 2625 if (!ret)
2620 dev->mtu = new_mtu; 2626 dev->mtu = new_mtu;
@@ -2645,7 +2651,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2645 struct port_info *pi = netdev_priv(dev); 2651 struct port_info *pi = netdev_priv(dev);
2646 2652
2647 pi->vlan_grp = grp; 2653 pi->vlan_grp = grp;
2648 t4_set_vlan_accel(pi->adapter, 1 << pi->tx_chan, grp != NULL); 2654 t4_set_rxmode(pi->adapter, 0, pi->viid, -1, -1, -1, -1, grp != NULL,
2655 true);
2649} 2656}
2650 2657
2651#ifdef CONFIG_NET_POLL_CONTROLLER 2658#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -3079,6 +3086,12 @@ static void __devinit print_port_info(struct adapter *adap)
3079 3086
3080 int i; 3087 int i;
3081 char buf[80]; 3088 char buf[80];
3089 const char *spd = "";
3090
3091 if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB)
3092 spd = " 2.5 GT/s";
3093 else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB)
3094 spd = " 5 GT/s";
3082 3095
3083 for_each_port(adap, i) { 3096 for_each_port(adap, i) {
3084 struct net_device *dev = adap->port[i]; 3097 struct net_device *dev = adap->port[i];
@@ -3098,10 +3111,10 @@ static void __devinit print_port_info(struct adapter *adap)
3098 --bufp; 3111 --bufp;
3099 sprintf(bufp, "BASE-%s", base[pi->port_type]); 3112 sprintf(bufp, "BASE-%s", base[pi->port_type]);
3100 3113
3101 netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s\n", 3114 netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
3102 adap->params.vpd.id, adap->params.rev, 3115 adap->params.vpd.id, adap->params.rev,
3103 buf, is_offload(adap) ? "R" : "", 3116 buf, is_offload(adap) ? "R" : "",
3104 adap->params.pci.width, 3117 adap->params.pci.width, spd,
3105 (adap->flags & USING_MSIX) ? " MSI-X" : 3118 (adap->flags & USING_MSIX) ? " MSI-X" :
3106 (adap->flags & USING_MSI) ? " MSI" : ""); 3119 (adap->flags & USING_MSI) ? " MSI" : "");
3107 if (adap->name == dev->name) 3120 if (adap->name == dev->name)
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
index 2923dd43523d..da272a98fdbc 100644
--- a/drivers/net/cxgb4/t4_hw.c
+++ b/drivers/net/cxgb4/t4_hw.c
@@ -886,22 +886,6 @@ int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port)
886 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); 886 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
887} 887}
888 888
889/**
890 * t4_set_vlan_accel - configure HW VLAN extraction
891 * @adap: the adapter
892 * @ports: bitmap of adapter ports to operate on
893 * @on: enable (1) or disable (0) HW VLAN extraction
894 *
895 * Enables or disables HW extraction of VLAN tags for the ports specified
896 * by @ports. @ports is a bitmap with the ith bit designating the port
897 * associated with the ith adapter channel.
898 */
899void t4_set_vlan_accel(struct adapter *adap, unsigned int ports, int on)
900{
901 ports <<= VLANEXTENABLE_SHIFT;
902 t4_set_reg_field(adap, TP_OUT_CONFIG, ports, on ? ports : 0);
903}
904
905struct intr_info { 889struct intr_info {
906 unsigned int mask; /* bits to check in interrupt status */ 890 unsigned int mask; /* bits to check in interrupt status */
907 const char *msg; /* message to print or NULL */ 891 const char *msg; /* message to print or NULL */
@@ -2624,12 +2608,14 @@ int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
2624 * @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change 2608 * @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change
2625 * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change 2609 * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change
2626 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change 2610 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change
2611 * @vlanex: 1 to enable HW VLAN extraction, 0 to disable it, -1 no change
2627 * @sleep_ok: if true we may sleep while awaiting command completion 2612 * @sleep_ok: if true we may sleep while awaiting command completion
2628 * 2613 *
2629 * Sets Rx properties of a virtual interface. 2614 * Sets Rx properties of a virtual interface.
2630 */ 2615 */
2631int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 2616int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
2632 int mtu, int promisc, int all_multi, int bcast, bool sleep_ok) 2617 int mtu, int promisc, int all_multi, int bcast, int vlanex,
2618 bool sleep_ok)
2633{ 2619{
2634 struct fw_vi_rxmode_cmd c; 2620 struct fw_vi_rxmode_cmd c;
2635 2621
@@ -2642,15 +2628,18 @@ int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
2642 all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_MASK; 2628 all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_MASK;
2643 if (bcast < 0) 2629 if (bcast < 0)
2644 bcast = FW_VI_RXMODE_CMD_BROADCASTEN_MASK; 2630 bcast = FW_VI_RXMODE_CMD_BROADCASTEN_MASK;
2631 if (vlanex < 0)
2632 vlanex = FW_VI_RXMODE_CMD_VLANEXEN_MASK;
2645 2633
2646 memset(&c, 0, sizeof(c)); 2634 memset(&c, 0, sizeof(c));
2647 c.op_to_viid = htonl(FW_CMD_OP(FW_VI_RXMODE_CMD) | FW_CMD_REQUEST | 2635 c.op_to_viid = htonl(FW_CMD_OP(FW_VI_RXMODE_CMD) | FW_CMD_REQUEST |
2648 FW_CMD_WRITE | FW_VI_RXMODE_CMD_VIID(viid)); 2636 FW_CMD_WRITE | FW_VI_RXMODE_CMD_VIID(viid));
2649 c.retval_len16 = htonl(FW_LEN16(c)); 2637 c.retval_len16 = htonl(FW_LEN16(c));
2650 c.mtu_to_broadcasten = htonl(FW_VI_RXMODE_CMD_MTU(mtu) | 2638 c.mtu_to_vlanexen = htonl(FW_VI_RXMODE_CMD_MTU(mtu) |
2651 FW_VI_RXMODE_CMD_PROMISCEN(promisc) | 2639 FW_VI_RXMODE_CMD_PROMISCEN(promisc) |
2652 FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) | 2640 FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) |
2653 FW_VI_RXMODE_CMD_BROADCASTEN(bcast)); 2641 FW_VI_RXMODE_CMD_BROADCASTEN(bcast) |
2642 FW_VI_RXMODE_CMD_VLANEXEN(vlanex));
2654 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok); 2643 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok);
2655} 2644}
2656 2645
diff --git a/drivers/net/cxgb4/t4fw_api.h b/drivers/net/cxgb4/t4fw_api.h
index 3393d05a388a..63991d68950e 100644
--- a/drivers/net/cxgb4/t4fw_api.h
+++ b/drivers/net/cxgb4/t4fw_api.h
@@ -876,7 +876,7 @@ struct fw_vi_mac_cmd {
876struct fw_vi_rxmode_cmd { 876struct fw_vi_rxmode_cmd {
877 __be32 op_to_viid; 877 __be32 op_to_viid;
878 __be32 retval_len16; 878 __be32 retval_len16;
879 __be32 mtu_to_broadcasten; 879 __be32 mtu_to_vlanexen;
880 __be32 r4_lo; 880 __be32 r4_lo;
881}; 881};
882 882
@@ -888,6 +888,8 @@ struct fw_vi_rxmode_cmd {
888#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12) 888#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
889#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3 889#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
890#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10) 890#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
891#define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
892#define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
891 893
892struct fw_vi_enable_cmd { 894struct fw_vi_enable_cmd {
893 __be32 op_to_viid; 895 __be32 op_to_viid;
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 1f9df5c6a75a..08e82b1a0b33 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1468,7 +1468,6 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
1468 tx_buf.length = skb->len; 1468 tx_buf.length = skb->len;
1469 tx_buf.buf_token = (void *)skb; 1469 tx_buf.buf_token = (void *)skb;
1470 tx_buf.data_ptr = skb->data; 1470 tx_buf.data_ptr = skb->data;
1471 ndev->trans_start = jiffies;
1472 ret_code = emac_send(priv, &tx_packet, EMAC_DEF_TX_CH); 1471 ret_code = emac_send(priv, &tx_packet, EMAC_DEF_TX_CH);
1473 if (unlikely(ret_code != 0)) { 1472 if (unlikely(ret_code != 0)) {
1474 if (ret_code == EMAC_ERR_TX_OUT_OF_BD) { 1473 if (ret_code == EMAC_ERR_TX_OUT_OF_BD) {
diff --git a/drivers/net/de600.c b/drivers/net/de600.c
index 6b13f4fd2e96..23a65398d011 100644
--- a/drivers/net/de600.c
+++ b/drivers/net/de600.c
@@ -166,8 +166,8 @@ static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev)
166 int i; 166 int i;
167 167
168 if (free_tx_pages <= 0) { /* Do timeouts, to avoid hangs. */ 168 if (free_tx_pages <= 0) { /* Do timeouts, to avoid hangs. */
169 tickssofar = jiffies - dev->trans_start; 169 tickssofar = jiffies - dev_trans_start(dev);
170 if (tickssofar < 5) 170 if (tickssofar < HZ/20)
171 return NETDEV_TX_BUSY; 171 return NETDEV_TX_BUSY;
172 /* else */ 172 /* else */
173 printk(KERN_WARNING "%s: transmit timed out (%d), %s?\n", dev->name, tickssofar, "network cable problem"); 173 printk(KERN_WARNING "%s: transmit timed out (%d), %s?\n", dev->name, tickssofar, "network cable problem");
diff --git a/drivers/net/de620.c b/drivers/net/de620.c
index a0a6830b5e6d..f3650fd096f4 100644
--- a/drivers/net/de620.c
+++ b/drivers/net/de620.c
@@ -535,7 +535,6 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev)
535 } 535 }
536 de620_write_block(dev, buffer, skb->len, len-skb->len); 536 de620_write_block(dev, buffer, skb->len, len-skb->len);
537 537
538 dev->trans_start = jiffies;
539 if(!(using_txbuf == (TXBF0 | TXBF1))) 538 if(!(using_txbuf == (TXBF0 | TXBF1)))
540 netif_wake_queue(dev); 539 netif_wake_queue(dev);
541 540
diff --git a/drivers/net/declance.c b/drivers/net/declance.c
index fb3f0984c289..1d973db27c32 100644
--- a/drivers/net/declance.c
+++ b/drivers/net/declance.c
@@ -874,7 +874,7 @@ static inline int lance_reset(struct net_device *dev)
874 874
875 lance_init_ring(dev); 875 lance_init_ring(dev);
876 load_csrs(lp); 876 load_csrs(lp);
877 dev->trans_start = jiffies; 877 dev->trans_start = jiffies; /* prevent tx timeout */
878 status = init_restart_lance(lp); 878 status = init_restart_lance(lp);
879 return status; 879 return status;
880} 880}
@@ -930,7 +930,6 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
930 930
931 spin_unlock_irqrestore(&lp->lock, flags); 931 spin_unlock_irqrestore(&lp->lock, flags);
932 932
933 dev->trans_start = jiffies;
934 dev_kfree_skb(skb); 933 dev_kfree_skb(skb);
935 934
936 return NETDEV_TX_OK; 935 return NETDEV_TX_OK;
@@ -970,7 +969,6 @@ static void lance_load_multicast(struct net_device *dev)
970 crc = crc >> 26; 969 crc = crc >> 26;
971 *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); 970 *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
972 } 971 }
973 return;
974} 972}
975 973
976static void lance_set_multicast(struct net_device *dev) 974static void lance_set_multicast(struct net_device *dev)
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index a88300a0d1e8..bf66e9b3b19e 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -921,7 +921,7 @@ static void depca_tx_timeout(struct net_device *dev)
921 STOP_DEPCA; 921 STOP_DEPCA;
922 depca_init_ring(dev); 922 depca_init_ring(dev);
923 LoadCSRs(dev); 923 LoadCSRs(dev);
924 dev->trans_start = jiffies; 924 dev->trans_start = jiffies; /* prevent tx timeout */
925 netif_wake_queue(dev); 925 netif_wake_queue(dev);
926 InitRestartDepca(dev); 926 InitRestartDepca(dev);
927} 927}
@@ -954,7 +954,6 @@ static netdev_tx_t depca_start_xmit(struct sk_buff *skb,
954 outw(CSR0, DEPCA_ADDR); 954 outw(CSR0, DEPCA_ADDR);
955 outw(INEA | TDMD, DEPCA_DATA); 955 outw(INEA | TDMD, DEPCA_DATA);
956 956
957 dev->trans_start = jiffies;
958 dev_kfree_skb(skb); 957 dev_kfree_skb(skb);
959 } 958 }
960 if (TX_BUFFS_AVAIL) 959 if (TX_BUFFS_AVAIL)
@@ -1204,8 +1203,6 @@ static void LoadCSRs(struct net_device *dev)
1204 outw(ACON, DEPCA_DATA); 1203 outw(ACON, DEPCA_DATA);
1205 1204
1206 outw(CSR0, DEPCA_ADDR); /* Point back to CSR0 */ 1205 outw(CSR0, DEPCA_ADDR); /* Point back to CSR0 */
1207
1208 return;
1209} 1206}
1210 1207
1211static int InitRestartDepca(struct net_device *dev) 1208static int InitRestartDepca(struct net_device *dev)
@@ -1303,8 +1300,6 @@ static void SetMulticastFilter(struct net_device *dev)
1303 } 1300 }
1304 } 1301 }
1305 } 1302 }
1306
1307 return;
1308} 1303}
1309 1304
1310static int __init depca_common_init (u_long ioaddr, struct net_device **devp) 1305static int __init depca_common_init (u_long ioaddr, struct net_device **devp)
@@ -1909,8 +1904,6 @@ static void depca_dbg_open(struct net_device *dev)
1909 outw(CSR3, DEPCA_ADDR); 1904 outw(CSR3, DEPCA_ADDR);
1910 printk("CSR3: 0x%4.4x\n", inw(DEPCA_DATA)); 1905 printk("CSR3: 0x%4.4x\n", inw(DEPCA_DATA));
1911 } 1906 }
1912
1913 return;
1914} 1907}
1915 1908
1916/* 1909/*
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 6579225dbd91..a2f238d20caa 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -596,8 +596,6 @@ alloc_list (struct net_device *dev)
596 /* Set RFDListPtr */ 596 /* Set RFDListPtr */
597 writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0); 597 writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
598 writel (0, dev->base_addr + RFDListPtr1); 598 writel (0, dev->base_addr + RFDListPtr1);
599
600 return;
601} 599}
602 600
603static netdev_tx_t 601static netdev_tx_t
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index a818ea998bbe..254b6f724c60 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -769,7 +769,7 @@ dm9000_hash_table(struct net_device *dev)
769} 769}
770 770
771/* 771/*
772 * Initilize dm9000 board 772 * Initialize dm9000 board
773 */ 773 */
774static void 774static void
775dm9000_init_dm9000(struct net_device *dev) 775dm9000_init_dm9000(struct net_device *dev)
@@ -825,7 +825,7 @@ dm9000_init_dm9000(struct net_device *dev)
825 /* Init Driver variable */ 825 /* Init Driver variable */
826 db->tx_pkt_cnt = 0; 826 db->tx_pkt_cnt = 0;
827 db->queue_pkt_len = 0; 827 db->queue_pkt_len = 0;
828 dev->trans_start = 0; 828 dev->trans_start = jiffies;
829} 829}
830 830
831/* Our watchdog timed out. Called by the networking layer */ 831/* Our watchdog timed out. Called by the networking layer */
@@ -843,7 +843,7 @@ static void dm9000_timeout(struct net_device *dev)
843 dm9000_reset(db); 843 dm9000_reset(db);
844 dm9000_init_dm9000(dev); 844 dm9000_init_dm9000(dev);
845 /* We can accept TX packets again */ 845 /* We can accept TX packets again */
846 dev->trans_start = jiffies; 846 dev->trans_start = jiffies; /* prevent tx timeout */
847 netif_wake_queue(dev); 847 netif_wake_queue(dev);
848 848
849 /* Restore previous register address */ 849 /* Restore previous register address */
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index d51a83e69585..8b0f50bbf3e5 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -594,8 +594,6 @@ static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
594 594
595 spin_unlock_irqrestore(&bp->lock, flags); 595 spin_unlock_irqrestore(&bp->lock, flags);
596 596
597 dev->trans_start = jiffies;
598
599 return NETDEV_TX_OK; 597 return NETDEV_TX_OK;
600} 598}
601 599
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index ef97bfcef9dd..b194bad29ace 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1764,7 +1764,6 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1764 return NETDEV_TX_BUSY; 1764 return NETDEV_TX_BUSY;
1765 } 1765 }
1766 1766
1767 netdev->trans_start = jiffies;
1768 return NETDEV_TX_OK; 1767 return NETDEV_TX_OK;
1769} 1768}
1770 1769
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 2a3b2dccd06d..d5ff029aa7b2 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1015,8 +1015,6 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
1015 txdr->buffer_info = NULL; 1015 txdr->buffer_info = NULL;
1016 kfree(rxdr->buffer_info); 1016 kfree(rxdr->buffer_info);
1017 rxdr->buffer_info = NULL; 1017 rxdr->buffer_info = NULL;
1018
1019 return;
1020} 1018}
1021 1019
1022static int e1000_setup_desc_rings(struct e1000_adapter *adapter) 1020static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
@@ -1711,8 +1709,6 @@ static void e1000_get_wol(struct net_device *netdev,
1711 wol->wolopts |= WAKE_BCAST; 1709 wol->wolopts |= WAKE_BCAST;
1712 if (adapter->wol & E1000_WUFC_MAG) 1710 if (adapter->wol & E1000_WUFC_MAG)
1713 wol->wolopts |= WAKE_MAGIC; 1711 wol->wolopts |= WAKE_MAGIC;
1714
1715 return;
1716} 1712}
1717 1713
1718static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1714static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4dd2c23775cb..ebdea0891665 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2161,8 +2161,6 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2161 e1000_rar_set(hw, ha->addr, i++); 2161 e1000_rar_set(hw, ha->addr, i++);
2162 } 2162 }
2163 2163
2164 WARN_ON(i == rar_entries);
2165
2166 netdev_for_each_mc_addr(ha, netdev) { 2164 netdev_for_each_mc_addr(ha, netdev) {
2167 if (i == rar_entries) { 2165 if (i == rar_entries) {
2168 /* load any remaining addresses into the hash table */ 2166 /* load any remaining addresses into the hash table */
@@ -2546,8 +2544,6 @@ set_itr_now:
2546 adapter->itr = new_itr; 2544 adapter->itr = new_itr;
2547 ew32(ITR, 1000000000 / (new_itr * 256)); 2545 ew32(ITR, 1000000000 / (new_itr * 256));
2548 } 2546 }
2549
2550 return;
2551} 2547}
2552 2548
2553#define E1000_TX_FLAGS_CSUM 0x00000001 2549#define E1000_TX_FLAGS_CSUM 0x00000001
@@ -3789,6 +3785,31 @@ next_desc:
3789 return cleaned; 3785 return cleaned;
3790} 3786}
3791 3787
3788/*
3789 * this should improve performance for small packets with large amounts
3790 * of reassembly being done in the stack
3791 */
3792static void e1000_check_copybreak(struct net_device *netdev,
3793 struct e1000_buffer *buffer_info,
3794 u32 length, struct sk_buff **skb)
3795{
3796 struct sk_buff *new_skb;
3797
3798 if (length > copybreak)
3799 return;
3800
3801 new_skb = netdev_alloc_skb_ip_align(netdev, length);
3802 if (!new_skb)
3803 return;
3804
3805 skb_copy_to_linear_data_offset(new_skb, -NET_IP_ALIGN,
3806 (*skb)->data - NET_IP_ALIGN,
3807 length + NET_IP_ALIGN);
3808 /* save the skb in buffer_info as good */
3809 buffer_info->skb = *skb;
3810 *skb = new_skb;
3811}
3812
3792/** 3813/**
3793 * e1000_clean_rx_irq - Send received data up the network stack; legacy 3814 * e1000_clean_rx_irq - Send received data up the network stack; legacy
3794 * @adapter: board private structure 3815 * @adapter: board private structure
@@ -3887,26 +3908,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
3887 total_rx_bytes += length; 3908 total_rx_bytes += length;
3888 total_rx_packets++; 3909 total_rx_packets++;
3889 3910
3890 /* code added for copybreak, this should improve 3911 e1000_check_copybreak(netdev, buffer_info, length, &skb);
3891 * performance for small packets with large amounts 3912
3892 * of reassembly being done in the stack */
3893 if (length < copybreak) {
3894 struct sk_buff *new_skb =
3895 netdev_alloc_skb_ip_align(netdev, length);
3896 if (new_skb) {
3897 skb_copy_to_linear_data_offset(new_skb,
3898 -NET_IP_ALIGN,
3899 (skb->data -
3900 NET_IP_ALIGN),
3901 (length +
3902 NET_IP_ALIGN));
3903 /* save the skb in buffer_info as good */
3904 buffer_info->skb = skb;
3905 skb = new_skb;
3906 }
3907 /* else just continue with the old one */
3908 }
3909 /* end copybreak code */
3910 skb_put(skb, length); 3913 skb_put(skb, length);
3911 3914
3912 /* Receive Checksum Offload */ 3915 /* Receive Checksum Offload */
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index 9fbb562dc964..10d8d98bb797 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -188,14 +188,6 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
188 */ 188 */
189E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); 189E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
190 190
191/* Enable Kumeran Lock Loss workaround
192 *
193 * Valid Range: 0, 1
194 *
195 * Default Value: 1 (enabled)
196 */
197E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
198
199struct e1000_option { 191struct e1000_option {
200 enum { enable_option, range_option, list_option } type; 192 enum { enable_option, range_option, list_option } type;
201 const char *name; 193 const char *name;
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 1e73eddee24a..f654db9121de 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -234,9 +234,6 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
234 mac->mta_reg_count = 128; 234 mac->mta_reg_count = 128;
235 /* Set rar entry count */ 235 /* Set rar entry count */
236 mac->rar_entry_count = E1000_RAR_ENTRIES; 236 mac->rar_entry_count = E1000_RAR_ENTRIES;
237 /* Set if manageability features are enabled. */
238 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
239 ? true : false;
240 /* Adaptive IFS supported */ 237 /* Adaptive IFS supported */
241 mac->adaptive_ifs = true; 238 mac->adaptive_ifs = true;
242 239
@@ -271,6 +268,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
271 func->set_lan_id = e1000_set_lan_id_single_port; 268 func->set_lan_id = e1000_set_lan_id_single_port;
272 func->check_mng_mode = e1000e_check_mng_mode_generic; 269 func->check_mng_mode = e1000e_check_mng_mode_generic;
273 func->led_on = e1000e_led_on_generic; 270 func->led_on = e1000e_led_on_generic;
271
272 /* FWSM register */
273 mac->has_fwsm = true;
274 /*
275 * ARC supported; valid only if manageability features are
276 * enabled.
277 */
278 mac->arc_subsystem_valid =
279 (er32(FWSM) & E1000_FWSM_MODE_MASK)
280 ? true : false;
274 break; 281 break;
275 case e1000_82574: 282 case e1000_82574:
276 case e1000_82583: 283 case e1000_82583:
@@ -281,6 +288,9 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
281 default: 288 default:
282 func->check_mng_mode = e1000e_check_mng_mode_generic; 289 func->check_mng_mode = e1000e_check_mng_mode_generic;
283 func->led_on = e1000e_led_on_generic; 290 func->led_on = e1000e_led_on_generic;
291
292 /* FWSM register */
293 mac->has_fwsm = true;
284 break; 294 break;
285 } 295 }
286 296
@@ -993,9 +1003,10 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
993 /* ...for both queues. */ 1003 /* ...for both queues. */
994 switch (mac->type) { 1004 switch (mac->type) {
995 case e1000_82573: 1005 case e1000_82573:
1006 e1000e_enable_tx_pkt_filtering(hw);
1007 /* fall through */
996 case e1000_82574: 1008 case e1000_82574:
997 case e1000_82583: 1009 case e1000_82583:
998 e1000e_enable_tx_pkt_filtering(hw);
999 reg_data = er32(GCR); 1010 reg_data = er32(GCR);
1000 reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; 1011 reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
1001 ew32(GCR, reg_data); 1012 ew32(GCR, reg_data);
@@ -1137,8 +1148,6 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
1137 default: 1148 default:
1138 break; 1149 break;
1139 } 1150 }
1140
1141 return;
1142} 1151}
1143 1152
1144/** 1153/**
@@ -1642,8 +1651,6 @@ static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw)
1642 /* If the management interface is not enabled, then power down */ 1651 /* If the management interface is not enabled, then power down */
1643 if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw))) 1652 if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw)))
1644 e1000_power_down_phy_copper(hw); 1653 e1000_power_down_phy_copper(hw);
1645
1646 return;
1647} 1654}
1648 1655
1649/** 1656/**
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 7f760aa9efe5..4dc02c71ffd6 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -138,6 +138,11 @@
138/* Enable MNG packets to host memory */ 138/* Enable MNG packets to host memory */
139#define E1000_MANC_EN_MNG2HOST 0x00200000 139#define E1000_MANC_EN_MNG2HOST 0x00200000
140 140
141#define E1000_MANC2H_PORT_623 0x00000020 /* Port 0x26f */
142#define E1000_MANC2H_PORT_664 0x00000040 /* Port 0x298 */
143#define E1000_MDEF_PORT_623 0x00000800 /* Port 0x26f */
144#define E1000_MDEF_PORT_664 0x00000400 /* Port 0x298 */
145
141/* Receive Control */ 146/* Receive Control */
142#define E1000_RCTL_EN 0x00000002 /* enable */ 147#define E1000_RCTL_EN 0x00000002 /* enable */
143#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ 148#define E1000_RCTL_SBP 0x00000004 /* store bad packet */
@@ -624,6 +629,8 @@
624#define NVM_ALT_MAC_ADDR_PTR 0x0037 629#define NVM_ALT_MAC_ADDR_PTR 0x0037
625#define NVM_CHECKSUM_REG 0x003F 630#define NVM_CHECKSUM_REG 0x003F
626 631
632#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
633
627#define E1000_NVM_CFG_DONE_PORT_0 0x40000 /* MNG config cycle done */ 634#define E1000_NVM_CFG_DONE_PORT_0 0x40000 /* MNG config cycle done */
628#define E1000_NVM_CFG_DONE_PORT_1 0x80000 /* ...for second port */ 635#define E1000_NVM_CFG_DONE_PORT_1 0x80000 /* ...for second port */
629 636
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 27d21589a69a..38d79a669059 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -221,9 +221,12 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
221 mac->mta_reg_count = 128; 221 mac->mta_reg_count = 128;
222 /* Set rar entry count */ 222 /* Set rar entry count */
223 mac->rar_entry_count = E1000_RAR_ENTRIES; 223 mac->rar_entry_count = E1000_RAR_ENTRIES;
224 /* Set if manageability features are enabled. */ 224 /* FWSM register */
225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) 225 mac->has_fwsm = true;
226 ? true : false; 226 /* ARC supported; valid only if manageability features are enabled. */
227 mac->arc_subsystem_valid =
228 (er32(FWSM) & E1000_FWSM_MODE_MASK)
229 ? true : false;
227 /* Adaptive IFS not supported */ 230 /* Adaptive IFS not supported */
228 mac->adaptive_ifs = false; 231 mac->adaptive_ifs = false;
229 232
@@ -1380,8 +1383,6 @@ static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw)
1380 if (!(hw->mac.ops.check_mng_mode(hw) || 1383 if (!(hw->mac.ops.check_mng_mode(hw) ||
1381 hw->phy.ops.check_reset_block(hw))) 1384 hw->phy.ops.check_reset_block(hw)))
1382 e1000_power_down_phy_copper(hw); 1385 e1000_power_down_phy_copper(hw);
1383
1384 return;
1385} 1386}
1386 1387
1387/** 1388/**
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 6ff376cfe139..2c521218102b 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1737,6 +1737,12 @@ static void e1000_diag_test(struct net_device *netdev,
1737 if (if_running) 1737 if (if_running)
1738 dev_open(netdev); 1738 dev_open(netdev);
1739 } else { 1739 } else {
1740 if (!if_running && (adapter->flags & FLAG_HAS_AMT)) {
1741 clear_bit(__E1000_TESTING, &adapter->state);
1742 dev_open(netdev);
1743 set_bit(__E1000_TESTING, &adapter->state);
1744 }
1745
1740 e_info("online testing starting\n"); 1746 e_info("online testing starting\n");
1741 /* Online tests */ 1747 /* Online tests */
1742 if (e1000_link_test(adapter, &data[4])) 1748 if (e1000_link_test(adapter, &data[4]))
@@ -1748,6 +1754,9 @@ static void e1000_diag_test(struct net_device *netdev,
1748 data[2] = 0; 1754 data[2] = 0;
1749 data[3] = 0; 1755 data[3] = 0;
1750 1756
1757 if (!if_running && (adapter->flags & FLAG_HAS_AMT))
1758 dev_close(netdev);
1759
1751 clear_bit(__E1000_TESTING, &adapter->state); 1760 clear_bit(__E1000_TESTING, &adapter->state);
1752 } 1761 }
1753 msleep_interruptible(4 * 1000); 1762 msleep_interruptible(4 * 1000);
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 8bdcd5f24eff..5d1220d188d4 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -208,6 +208,8 @@ enum e1e_registers {
208 208
209 E1000_KMRNCTRLSTA = 0x00034, /* MAC-PHY interface - RW */ 209 E1000_KMRNCTRLSTA = 0x00034, /* MAC-PHY interface - RW */
210 E1000_MANC2H = 0x05860, /* Management Control To Host - RW */ 210 E1000_MANC2H = 0x05860, /* Management Control To Host - RW */
211 E1000_MDEF_BASE = 0x05890, /* Management Decision Filters */
212#define E1000_MDEF(_n) (E1000_MDEF_BASE + ((_n) * 4))
211 E1000_SW_FW_SYNC = 0x05B5C, /* Software-Firmware Synchronization - RW */ 213 E1000_SW_FW_SYNC = 0x05B5C, /* Software-Firmware Synchronization - RW */
212 E1000_GCR = 0x05B00, /* PCI-Ex Control */ 214 E1000_GCR = 0x05B00, /* PCI-Ex Control */
213 E1000_GCR2 = 0x05B64, /* PCI-Ex Control #2 */ 215 E1000_GCR2 = 0x05B64, /* PCI-Ex Control #2 */
@@ -380,6 +382,7 @@ enum e1e_registers {
380#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE 382#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE
381#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE 383#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
382#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF 384#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
385#define E1000_DEV_ID_ICH10_D_BM_V 0x1525
383#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA 386#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA
384#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB 387#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
385#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF 388#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
@@ -828,6 +831,7 @@ struct e1000_mac_info {
828 u8 forced_speed_duplex; 831 u8 forced_speed_duplex;
829 832
830 bool adaptive_ifs; 833 bool adaptive_ifs;
834 bool has_fwsm;
831 bool arc_subsystem_valid; 835 bool arc_subsystem_valid;
832 bool autoneg; 836 bool autoneg;
833 bool autoneg_failed; 837 bool autoneg_failed;
@@ -898,6 +902,7 @@ struct e1000_fc_info {
898 u32 high_water; /* Flow control high-water mark */ 902 u32 high_water; /* Flow control high-water mark */
899 u32 low_water; /* Flow control low-water mark */ 903 u32 low_water; /* Flow control low-water mark */
900 u16 pause_time; /* Flow control pause timer */ 904 u16 pause_time; /* Flow control pause timer */
905 u16 refresh_time; /* Flow control refresh timer */
901 bool send_xon; /* Flow control send XON */ 906 bool send_xon; /* Flow control send XON */
902 bool strict_ieee; /* Strict IEEE mode */ 907 bool strict_ieee; /* Strict IEEE mode */
903 enum e1000_fc_mode current_mode; /* FC mode in effect */ 908 enum e1000_fc_mode current_mode; /* FC mode in effect */
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index b8c4dce01a04..b2507d93de99 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -330,6 +330,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
330 phy->ops.get_cable_length = e1000_get_cable_length_82577; 330 phy->ops.get_cable_length = e1000_get_cable_length_82577;
331 phy->ops.get_info = e1000_get_phy_info_82577; 331 phy->ops.get_info = e1000_get_phy_info_82577;
332 phy->ops.commit = e1000e_phy_sw_reset; 332 phy->ops.commit = e1000e_phy_sw_reset;
333 break;
333 case e1000_phy_82578: 334 case e1000_phy_82578:
334 phy->ops.check_polarity = e1000_check_polarity_m88; 335 phy->ops.check_polarity = e1000_check_polarity_m88;
335 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88; 336 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88;
@@ -502,8 +503,10 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
502 mac->rar_entry_count = E1000_ICH_RAR_ENTRIES; 503 mac->rar_entry_count = E1000_ICH_RAR_ENTRIES;
503 if (mac->type == e1000_ich8lan) 504 if (mac->type == e1000_ich8lan)
504 mac->rar_entry_count--; 505 mac->rar_entry_count--;
505 /* Set if manageability features are enabled. */ 506 /* FWSM register */
506 mac->arc_subsystem_valid = true; 507 mac->has_fwsm = true;
508 /* ARC subsystem not supported */
509 mac->arc_subsystem_valid = false;
507 /* Adaptive IFS supported */ 510 /* Adaptive IFS supported */
508 mac->adaptive_ifs = true; 511 mac->adaptive_ifs = true;
509 512
@@ -687,8 +690,6 @@ static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw)
687static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) 690static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
688{ 691{
689 mutex_unlock(&nvm_mutex); 692 mutex_unlock(&nvm_mutex);
690
691 return;
692} 693}
693 694
694static DEFINE_MUTEX(swflag_mutex); 695static DEFINE_MUTEX(swflag_mutex);
@@ -767,8 +768,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
767 ew32(EXTCNF_CTRL, extcnf_ctrl); 768 ew32(EXTCNF_CTRL, extcnf_ctrl);
768 769
769 mutex_unlock(&swflag_mutex); 770 mutex_unlock(&swflag_mutex);
770
771 return;
772} 771}
773 772
774/** 773/**
@@ -815,11 +814,16 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
815 **/ 814 **/
816static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) 815static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
817{ 816{
817 struct e1000_adapter *adapter = hw->adapter;
818 struct e1000_phy_info *phy = &hw->phy; 818 struct e1000_phy_info *phy = &hw->phy;
819 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; 819 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
820 s32 ret_val; 820 s32 ret_val = 0;
821 u16 word_addr, reg_data, reg_addr, phy_page = 0; 821 u16 word_addr, reg_data, reg_addr, phy_page = 0;
822 822
823 if (!(hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) &&
824 !(hw->mac.type == e1000_pchlan))
825 return ret_val;
826
823 ret_val = hw->phy.ops.acquire(hw); 827 ret_val = hw->phy.ops.acquire(hw);
824 if (ret_val) 828 if (ret_val)
825 return ret_val; 829 return ret_val;
@@ -831,97 +835,87 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
831 * Therefore, after each PHY reset, we will load the 835 * Therefore, after each PHY reset, we will load the
832 * configuration data out of the NVM manually. 836 * configuration data out of the NVM manually.
833 */ 837 */
834 if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) || 838 if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
835 (hw->mac.type == e1000_pchlan)) { 839 (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) ||
836 struct e1000_adapter *adapter = hw->adapter; 840 (hw->mac.type == e1000_pchlan))
837 841 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
838 /* Check if SW needs to configure the PHY */ 842 else
839 if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || 843 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
840 (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) ||
841 (hw->mac.type == e1000_pchlan))
842 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
843 else
844 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
845 844
846 data = er32(FEXTNVM); 845 data = er32(FEXTNVM);
847 if (!(data & sw_cfg_mask)) 846 if (!(data & sw_cfg_mask))
848 goto out; 847 goto out;
849 848
850 /* Wait for basic configuration completes before proceeding */ 849 /*
851 e1000_lan_init_done_ich8lan(hw); 850 * Make sure HW does not configure LCD from PHY
851 * extended configuration before SW configuration
852 */
853 data = er32(EXTCNF_CTRL);
854 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
855 goto out;
856
857 cnf_size = er32(EXTCNF_SIZE);
858 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
859 cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
860 if (!cnf_size)
861 goto out;
852 862
863 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
864 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
865
866 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
867 (hw->mac.type == e1000_pchlan)) {
853 /* 868 /*
854 * Make sure HW does not configure LCD from PHY 869 * HW configures the SMBus address and LEDs when the
855 * extended configuration before SW configuration 870 * OEM and LCD Write Enable bits are set in the NVM.
871 * When both NVM bits are cleared, SW will configure
872 * them instead.
856 */ 873 */
857 data = er32(EXTCNF_CTRL); 874 data = er32(STRAP);
858 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) 875 data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
876 reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
877 reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
878 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
879 reg_data);
880 if (ret_val)
859 goto out; 881 goto out;
860 882
861 cnf_size = er32(EXTCNF_SIZE); 883 data = er32(LEDCTL);
862 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; 884 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_LED_CONFIG,
863 cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; 885 (u16)data);
864 if (!cnf_size) 886 if (ret_val)
865 goto out; 887 goto out;
888 }
866 889
867 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; 890 /* Configure LCD from extended configuration region. */
868 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
869
870 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
871 (hw->mac.type == e1000_pchlan)) {
872 /*
873 * HW configures the SMBus address and LEDs when the
874 * OEM and LCD Write Enable bits are set in the NVM.
875 * When both NVM bits are cleared, SW will configure
876 * them instead.
877 */
878 data = er32(STRAP);
879 data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
880 reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
881 reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
882 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
883 reg_data);
884 if (ret_val)
885 goto out;
886
887 data = er32(LEDCTL);
888 ret_val = e1000_write_phy_reg_hv_locked(hw,
889 HV_LED_CONFIG,
890 (u16)data);
891 if (ret_val)
892 goto out;
893 }
894 /* Configure LCD from extended configuration region. */
895 891
896 /* cnf_base_addr is in DWORD */ 892 /* cnf_base_addr is in DWORD */
897 word_addr = (u16)(cnf_base_addr << 1); 893 word_addr = (u16)(cnf_base_addr << 1);
898 894
899 for (i = 0; i < cnf_size; i++) { 895 for (i = 0; i < cnf_size; i++) {
900 ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1, 896 ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
901 &reg_data); 897 &reg_data);
902 if (ret_val) 898 if (ret_val)
903 goto out; 899 goto out;
904 900
905 ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1), 901 ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
906 1, &reg_addr); 902 1, &reg_addr);
907 if (ret_val) 903 if (ret_val)
908 goto out; 904 goto out;
909 905
910 /* Save off the PHY page for future writes. */ 906 /* Save off the PHY page for future writes. */
911 if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { 907 if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
912 phy_page = reg_data; 908 phy_page = reg_data;
913 continue; 909 continue;
914 } 910 }
915 911
916 reg_addr &= PHY_REG_MASK; 912 reg_addr &= PHY_REG_MASK;
917 reg_addr |= phy_page; 913 reg_addr |= phy_page;
918 914
919 ret_val = phy->ops.write_reg_locked(hw, 915 ret_val = phy->ops.write_reg_locked(hw, (u32)reg_addr,
920 (u32)reg_addr, 916 reg_data);
921 reg_data); 917 if (ret_val)
922 if (ret_val) 918 goto out;
923 goto out;
924 }
925 } 919 }
926 920
927out: 921out:
@@ -1259,30 +1253,26 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
1259} 1253}
1260 1254
1261/** 1255/**
1262 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset 1256 * e1000_post_phy_reset_ich8lan - Perform steps required after a PHY reset
1263 * @hw: pointer to the HW structure 1257 * @hw: pointer to the HW structure
1264 *
1265 * Resets the PHY
1266 * This is a function pointer entry point called by drivers
1267 * or other shared routines.
1268 **/ 1258 **/
1269static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) 1259static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1270{ 1260{
1271 s32 ret_val = 0; 1261 s32 ret_val = 0;
1272 u16 reg; 1262 u16 reg;
1273 1263
1274 ret_val = e1000e_phy_hw_reset_generic(hw); 1264 if (e1000_check_reset_block(hw))
1275 if (ret_val) 1265 goto out;
1276 return ret_val;
1277
1278 /* Allow time for h/w to get to a quiescent state after reset */
1279 mdelay(10);
1280 1266
1281 /* Perform any necessary post-reset workarounds */ 1267 /* Perform any necessary post-reset workarounds */
1282 if (hw->mac.type == e1000_pchlan) { 1268 switch (hw->mac.type) {
1269 case e1000_pchlan:
1283 ret_val = e1000_hv_phy_workarounds_ich8lan(hw); 1270 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
1284 if (ret_val) 1271 if (ret_val)
1285 return ret_val; 1272 goto out;
1273 break;
1274 default:
1275 break;
1286 } 1276 }
1287 1277
1288 /* Dummy read to clear the phy wakeup bit after lcd reset */ 1278 /* Dummy read to clear the phy wakeup bit after lcd reset */
@@ -1295,11 +1285,32 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
1295 goto out; 1285 goto out;
1296 1286
1297 /* Configure the LCD with the OEM bits in NVM */ 1287 /* Configure the LCD with the OEM bits in NVM */
1298 if (hw->mac.type == e1000_pchlan) 1288 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
1299 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
1300 1289
1301out: 1290out:
1302 return 0; 1291 return ret_val;
1292}
1293
1294/**
1295 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset
1296 * @hw: pointer to the HW structure
1297 *
1298 * Resets the PHY
1299 * This is a function pointer entry point called by drivers
1300 * or other shared routines.
1301 **/
1302static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
1303{
1304 s32 ret_val = 0;
1305
1306 ret_val = e1000e_phy_hw_reset_generic(hw);
1307 if (ret_val)
1308 goto out;
1309
1310 ret_val = e1000_post_phy_reset_ich8lan(hw);
1311
1312out:
1313 return ret_val;
1303} 1314}
1304 1315
1305/** 1316/**
@@ -1938,18 +1949,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1938 new_bank_offset = nvm->flash_bank_size; 1949 new_bank_offset = nvm->flash_bank_size;
1939 old_bank_offset = 0; 1950 old_bank_offset = 0;
1940 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); 1951 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
1941 if (ret_val) { 1952 if (ret_val)
1942 nvm->ops.release(hw); 1953 goto release;
1943 goto out;
1944 }
1945 } else { 1954 } else {
1946 old_bank_offset = nvm->flash_bank_size; 1955 old_bank_offset = nvm->flash_bank_size;
1947 new_bank_offset = 0; 1956 new_bank_offset = 0;
1948 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); 1957 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
1949 if (ret_val) { 1958 if (ret_val)
1950 nvm->ops.release(hw); 1959 goto release;
1951 goto out;
1952 }
1953 } 1960 }
1954 1961
1955 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 1962 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
@@ -2005,8 +2012,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2005 if (ret_val) { 2012 if (ret_val) {
2006 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ 2013 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
2007 e_dbg("Flash commit failed.\n"); 2014 e_dbg("Flash commit failed.\n");
2008 nvm->ops.release(hw); 2015 goto release;
2009 goto out;
2010 } 2016 }
2011 2017
2012 /* 2018 /*
@@ -2017,18 +2023,15 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2017 */ 2023 */
2018 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; 2024 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
2019 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); 2025 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
2020 if (ret_val) { 2026 if (ret_val)
2021 nvm->ops.release(hw); 2027 goto release;
2022 goto out; 2028
2023 }
2024 data &= 0xBFFF; 2029 data &= 0xBFFF;
2025 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, 2030 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2026 act_offset * 2 + 1, 2031 act_offset * 2 + 1,
2027 (u8)(data >> 8)); 2032 (u8)(data >> 8));
2028 if (ret_val) { 2033 if (ret_val)
2029 nvm->ops.release(hw); 2034 goto release;
2030 goto out;
2031 }
2032 2035
2033 /* 2036 /*
2034 * And invalidate the previously valid segment by setting 2037 * And invalidate the previously valid segment by setting
@@ -2038,10 +2041,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2038 */ 2041 */
2039 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; 2042 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
2040 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); 2043 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
2041 if (ret_val) { 2044 if (ret_val)
2042 nvm->ops.release(hw); 2045 goto release;
2043 goto out;
2044 }
2045 2046
2046 /* Great! Everything worked, we can now clear the cached entries. */ 2047 /* Great! Everything worked, we can now clear the cached entries. */
2047 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 2048 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
@@ -2049,14 +2050,17 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2049 dev_spec->shadow_ram[i].value = 0xFFFF; 2050 dev_spec->shadow_ram[i].value = 0xFFFF;
2050 } 2051 }
2051 2052
2053release:
2052 nvm->ops.release(hw); 2054 nvm->ops.release(hw);
2053 2055
2054 /* 2056 /*
2055 * Reload the EEPROM, or else modifications will not appear 2057 * Reload the EEPROM, or else modifications will not appear
2056 * until after the next adapter reset. 2058 * until after the next adapter reset.
2057 */ 2059 */
2058 e1000e_reload_nvm(hw); 2060 if (!ret_val) {
2059 msleep(10); 2061 e1000e_reload_nvm(hw);
2062 msleep(10);
2063 }
2060 2064
2061out: 2065out:
2062 if (ret_val) 2066 if (ret_val)
@@ -2517,9 +2521,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2517 * on the last TLP read/write transaction when MAC is reset. 2521 * on the last TLP read/write transaction when MAC is reset.
2518 */ 2522 */
2519 ret_val = e1000e_disable_pcie_master(hw); 2523 ret_val = e1000e_disable_pcie_master(hw);
2520 if (ret_val) { 2524 if (ret_val)
2521 e_dbg("PCI-E Master disable polling has failed.\n"); 2525 e_dbg("PCI-E Master disable polling has failed.\n");
2522 }
2523 2526
2524 e_dbg("Masking off all interrupts\n"); 2527 e_dbg("Masking off all interrupts\n");
2525 ew32(IMC, 0xffffffff); 2528 ew32(IMC, 0xffffffff);
@@ -2558,14 +2561,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2558 ctrl = er32(CTRL); 2561 ctrl = er32(CTRL);
2559 2562
2560 if (!e1000_check_reset_block(hw)) { 2563 if (!e1000_check_reset_block(hw)) {
2561 /* Clear PHY Reset Asserted bit */
2562 if (hw->mac.type >= e1000_pchlan) {
2563 u32 status = er32(STATUS);
2564 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
2565 }
2566
2567 /* 2564 /*
2568 * PHY HW reset requires MAC CORE reset at the same 2565 * Full-chip reset requires MAC and PHY reset at the same
2569 * time to make sure the interface between MAC and the 2566 * time to make sure the interface between MAC and the
2570 * external PHY is reset. 2567 * external PHY is reset.
2571 */ 2568 */
@@ -2579,39 +2576,16 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2579 if (!ret_val) 2576 if (!ret_val)
2580 e1000_release_swflag_ich8lan(hw); 2577 e1000_release_swflag_ich8lan(hw);
2581 2578
2582 /* Perform any necessary post-reset workarounds */ 2579 if (ctrl & E1000_CTRL_PHY_RST) {
2583 if (hw->mac.type == e1000_pchlan)
2584 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2585
2586 if (ctrl & E1000_CTRL_PHY_RST)
2587 ret_val = hw->phy.ops.get_cfg_done(hw); 2580 ret_val = hw->phy.ops.get_cfg_done(hw);
2581 if (ret_val)
2582 goto out;
2588 2583
2589 if (hw->mac.type >= e1000_ich10lan) { 2584 ret_val = e1000_post_phy_reset_ich8lan(hw);
2590 e1000_lan_init_done_ich8lan(hw);
2591 } else {
2592 ret_val = e1000e_get_auto_rd_done(hw);
2593 if (ret_val) {
2594 /*
2595 * When auto config read does not complete, do not
2596 * return with an error. This can happen in situations
2597 * where there is no eeprom and prevents getting link.
2598 */
2599 e_dbg("Auto Read Done did not complete\n");
2600 }
2601 }
2602 /* Dummy read to clear the phy wakeup bit after lcd reset */
2603 if (hw->mac.type == e1000_pchlan)
2604 e1e_rphy(hw, BM_WUC, &reg);
2605
2606 ret_val = e1000_sw_lcd_config_ich8lan(hw);
2607 if (ret_val)
2608 goto out;
2609
2610 if (hw->mac.type == e1000_pchlan) {
2611 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
2612 if (ret_val) 2585 if (ret_val)
2613 goto out; 2586 goto out;
2614 } 2587 }
2588
2615 /* 2589 /*
2616 * For PCH, this write will make sure that any noise 2590 * For PCH, this write will make sure that any noise
2617 * will be detected as a CRC error and be dropped rather than show up 2591 * will be detected as a CRC error and be dropped rather than show up
@@ -2778,8 +2752,6 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
2778 reg = er32(RFCTL); 2752 reg = er32(RFCTL);
2779 reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS); 2753 reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
2780 ew32(RFCTL, reg); 2754 ew32(RFCTL, reg);
2781
2782 return;
2783} 2755}
2784 2756
2785/** 2757/**
@@ -2829,6 +2801,8 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2829 ew32(FCTTV, hw->fc.pause_time); 2801 ew32(FCTTV, hw->fc.pause_time);
2830 if ((hw->phy.type == e1000_phy_82578) || 2802 if ((hw->phy.type == e1000_phy_82578) ||
2831 (hw->phy.type == e1000_phy_82577)) { 2803 (hw->phy.type == e1000_phy_82577)) {
2804 ew32(FCRTV_PCH, hw->fc.refresh_time);
2805
2832 ret_val = hw->phy.ops.write_reg(hw, 2806 ret_val = hw->phy.ops.write_reg(hw,
2833 PHY_REG(BM_PORT_CTRL_PAGE, 27), 2807 PHY_REG(BM_PORT_CTRL_PAGE, 27),
2834 hw->fc.pause_time); 2808 hw->fc.pause_time);
@@ -3157,8 +3131,6 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
3157 default: 3131 default:
3158 break; 3132 break;
3159 } 3133 }
3160
3161 return;
3162} 3134}
3163 3135
3164/** 3136/**
@@ -3295,33 +3267,50 @@ static s32 e1000_led_off_pchlan(struct e1000_hw *hw)
3295} 3267}
3296 3268
3297/** 3269/**
3298 * e1000_get_cfg_done_ich8lan - Read config done bit 3270 * e1000_get_cfg_done_ich8lan - Read config done bit after Full or PHY reset
3299 * @hw: pointer to the HW structure 3271 * @hw: pointer to the HW structure
3300 * 3272 *
3301 * Read the management control register for the config done bit for 3273 * Read appropriate register for the config done bit for completion status
3302 * completion status. NOTE: silicon which is EEPROM-less will fail trying 3274 * and configure the PHY through s/w for EEPROM-less parts.
3303 * to read the config done bit, so an error is *ONLY* logged and returns 3275 *
3304 * 0. If we were to return with error, EEPROM-less silicon 3276 * NOTE: some silicon which is EEPROM-less will fail trying to read the
3305 * would not be able to be reset or change link. 3277 * config done bit, so only an error is logged and continues. If we were
3278 * to return with error, EEPROM-less silicon would not be able to be reset
3279 * or change link.
3306 **/ 3280 **/
3307static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) 3281static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3308{ 3282{
3283 s32 ret_val = 0;
3309 u32 bank = 0; 3284 u32 bank = 0;
3285 u32 status;
3310 3286
3311 if (hw->mac.type >= e1000_pchlan) { 3287 e1000e_get_cfg_done(hw);
3312 u32 status = er32(STATUS);
3313 3288
3314 if (status & E1000_STATUS_PHYRA) 3289 /* Wait for indication from h/w that it has completed basic config */
3315 ew32(STATUS, status & ~E1000_STATUS_PHYRA); 3290 if (hw->mac.type >= e1000_ich10lan) {
3316 else 3291 e1000_lan_init_done_ich8lan(hw);
3317 e_dbg("PHY Reset Asserted not set - needs delay\n"); 3292 } else {
3293 ret_val = e1000e_get_auto_rd_done(hw);
3294 if (ret_val) {
3295 /*
3296 * When auto config read does not complete, do not
3297 * return with an error. This can happen in situations
3298 * where there is no eeprom and prevents getting link.
3299 */
3300 e_dbg("Auto Read Done did not complete\n");
3301 ret_val = 0;
3302 }
3318 } 3303 }
3319 3304
3320 e1000e_get_cfg_done(hw); 3305 /* Clear PHY Reset Asserted bit */
3306 status = er32(STATUS);
3307 if (status & E1000_STATUS_PHYRA)
3308 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
3309 else
3310 e_dbg("PHY Reset Asserted not set - needs delay\n");
3321 3311
3322 /* If EEPROM is not marked present, init the IGP 3 PHY manually */ 3312 /* If EEPROM is not marked present, init the IGP 3 PHY manually */
3323 if ((hw->mac.type != e1000_ich10lan) && 3313 if (hw->mac.type <= e1000_ich9lan) {
3324 (hw->mac.type != e1000_pchlan)) {
3325 if (((er32(EECD) & E1000_EECD_PRES) == 0) && 3314 if (((er32(EECD) & E1000_EECD_PRES) == 0) &&
3326 (hw->phy.type == e1000_phy_igp_3)) { 3315 (hw->phy.type == e1000_phy_igp_3)) {
3327 e1000e_phy_init_script_igp3(hw); 3316 e1000e_phy_init_script_igp3(hw);
@@ -3330,11 +3319,11 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3330 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) { 3319 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
3331 /* Maybe we should do a basic PHY config */ 3320 /* Maybe we should do a basic PHY config */
3332 e_dbg("EEPROM not present\n"); 3321 e_dbg("EEPROM not present\n");
3333 return -E1000_ERR_CONFIG; 3322 ret_val = -E1000_ERR_CONFIG;
3334 } 3323 }
3335 } 3324 }
3336 3325
3337 return 0; 3326 return ret_val;
3338} 3327}
3339 3328
3340/** 3329/**
@@ -3350,8 +3339,6 @@ static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw)
3350 if (!(hw->mac.ops.check_mng_mode(hw) || 3339 if (!(hw->mac.ops.check_mng_mode(hw) ||
3351 hw->phy.ops.check_reset_block(hw))) 3340 hw->phy.ops.check_reset_block(hw)))
3352 e1000_power_down_phy_copper(hw); 3341 e1000_power_down_phy_copper(hw);
3353
3354 return;
3355} 3342}
3356 3343
3357/** 3344/**
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index b0d2a60aa490..a968e3a416ac 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -2272,6 +2272,11 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
2272 u32 hicr; 2272 u32 hicr;
2273 u8 i; 2273 u8 i;
2274 2274
2275 if (!(hw->mac.arc_subsystem_valid)) {
2276 e_dbg("ARC subsystem not valid.\n");
2277 return -E1000_ERR_HOST_INTERFACE_COMMAND;
2278 }
2279
2275 /* Check that the host interface is enabled. */ 2280 /* Check that the host interface is enabled. */
2276 hicr = er32(HICR); 2281 hicr = er32(HICR);
2277 if ((hicr & E1000_HICR_EN) == 0) { 2282 if ((hicr & E1000_HICR_EN) == 0) {
@@ -2515,10 +2520,11 @@ s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
2515} 2520}
2516 2521
2517/** 2522/**
2518 * e1000e_enable_mng_pass_thru - Enable processing of ARP's 2523 * e1000e_enable_mng_pass_thru - Check if management passthrough is needed
2519 * @hw: pointer to the HW structure 2524 * @hw: pointer to the HW structure
2520 * 2525 *
2521 * Verifies the hardware needs to allow ARPs to be processed by the host. 2526 * Verifies the hardware needs to leave interface enabled so that frames can
2527 * be directed to and from the management interface.
2522 **/ 2528 **/
2523bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw) 2529bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
2524{ 2530{
@@ -2528,11 +2534,10 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
2528 2534
2529 manc = er32(MANC); 2535 manc = er32(MANC);
2530 2536
2531 if (!(manc & E1000_MANC_RCV_TCO_EN) || 2537 if (!(manc & E1000_MANC_RCV_TCO_EN))
2532 !(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) 2538 goto out;
2533 return ret_val;
2534 2539
2535 if (hw->mac.arc_subsystem_valid) { 2540 if (hw->mac.has_fwsm) {
2536 fwsm = er32(FWSM); 2541 fwsm = er32(FWSM);
2537 factps = er32(FACTPS); 2542 factps = er32(FACTPS);
2538 2543
@@ -2540,16 +2545,28 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
2540 ((fwsm & E1000_FWSM_MODE_MASK) == 2545 ((fwsm & E1000_FWSM_MODE_MASK) ==
2541 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) { 2546 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) {
2542 ret_val = true; 2547 ret_val = true;
2543 return ret_val; 2548 goto out;
2544 } 2549 }
2545 } else { 2550 } else if ((hw->mac.type == e1000_82574) ||
2546 if ((manc & E1000_MANC_SMBUS_EN) && 2551 (hw->mac.type == e1000_82583)) {
2547 !(manc & E1000_MANC_ASF_EN)) { 2552 u16 data;
2553
2554 factps = er32(FACTPS);
2555 e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
2556
2557 if (!(factps & E1000_FACTPS_MNGCG) &&
2558 ((data & E1000_NVM_INIT_CTRL2_MNGM) ==
2559 (e1000_mng_mode_pt << 13))) {
2548 ret_val = true; 2560 ret_val = true;
2549 return ret_val; 2561 goto out;
2550 } 2562 }
2563 } else if ((manc & E1000_MANC_SMBUS_EN) &&
2564 !(manc & E1000_MANC_ASF_EN)) {
2565 ret_val = true;
2566 goto out;
2551 } 2567 }
2552 2568
2569out:
2553 return ret_val; 2570 return ret_val;
2554} 2571}
2555 2572
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index c5f65a29865a..f5081cf898aa 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1767,8 +1767,6 @@ void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
1767 pci_disable_msi(adapter->pdev); 1767 pci_disable_msi(adapter->pdev);
1768 adapter->flags &= ~FLAG_MSI_ENABLED; 1768 adapter->flags &= ~FLAG_MSI_ENABLED;
1769 } 1769 }
1770
1771 return;
1772} 1770}
1773 1771
1774/** 1772/**
@@ -1820,8 +1818,6 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
1820 /* Don't do anything; this is the system default */ 1818 /* Don't do anything; this is the system default */
1821 break; 1819 break;
1822 } 1820 }
1823
1824 return;
1825} 1821}
1826 1822
1827/** 1823/**
@@ -2526,10 +2522,10 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter)
2526 } 2522 }
2527} 2523}
2528 2524
2529static void e1000_init_manageability(struct e1000_adapter *adapter) 2525static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
2530{ 2526{
2531 struct e1000_hw *hw = &adapter->hw; 2527 struct e1000_hw *hw = &adapter->hw;
2532 u32 manc, manc2h; 2528 u32 manc, manc2h, mdef, i, j;
2533 2529
2534 if (!(adapter->flags & FLAG_MNG_PT_ENABLED)) 2530 if (!(adapter->flags & FLAG_MNG_PT_ENABLED))
2535 return; 2531 return;
@@ -2543,10 +2539,49 @@ static void e1000_init_manageability(struct e1000_adapter *adapter)
2543 */ 2539 */
2544 manc |= E1000_MANC_EN_MNG2HOST; 2540 manc |= E1000_MANC_EN_MNG2HOST;
2545 manc2h = er32(MANC2H); 2541 manc2h = er32(MANC2H);
2546#define E1000_MNG2HOST_PORT_623 (1 << 5) 2542
2547#define E1000_MNG2HOST_PORT_664 (1 << 6) 2543 switch (hw->mac.type) {
2548 manc2h |= E1000_MNG2HOST_PORT_623; 2544 default:
2549 manc2h |= E1000_MNG2HOST_PORT_664; 2545 manc2h |= (E1000_MANC2H_PORT_623 | E1000_MANC2H_PORT_664);
2546 break;
2547 case e1000_82574:
2548 case e1000_82583:
2549 /*
2550 * Check if IPMI pass-through decision filter already exists;
2551 * if so, enable it.
2552 */
2553 for (i = 0, j = 0; i < 8; i++) {
2554 mdef = er32(MDEF(i));
2555
2556 /* Ignore filters with anything other than IPMI ports */
2557 if (mdef & !(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
2558 continue;
2559
2560 /* Enable this decision filter in MANC2H */
2561 if (mdef)
2562 manc2h |= (1 << i);
2563
2564 j |= mdef;
2565 }
2566
2567 if (j == (E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
2568 break;
2569
2570 /* Create new decision filter in an empty filter */
2571 for (i = 0, j = 0; i < 8; i++)
2572 if (er32(MDEF(i)) == 0) {
2573 ew32(MDEF(i), (E1000_MDEF_PORT_623 |
2574 E1000_MDEF_PORT_664));
2575 manc2h |= (1 << 1);
2576 j++;
2577 break;
2578 }
2579
2580 if (!j)
2581 e_warn("Unable to create IPMI pass-through filter\n");
2582 break;
2583 }
2584
2550 ew32(MANC2H, manc2h); 2585 ew32(MANC2H, manc2h);
2551 ew32(MANC, manc); 2586 ew32(MANC, manc);
2552} 2587}
@@ -2961,7 +2996,7 @@ static void e1000_configure(struct e1000_adapter *adapter)
2961 e1000_set_multi(adapter->netdev); 2996 e1000_set_multi(adapter->netdev);
2962 2997
2963 e1000_restore_vlan(adapter); 2998 e1000_restore_vlan(adapter);
2964 e1000_init_manageability(adapter); 2999 e1000_init_manageability_pt(adapter);
2965 3000
2966 e1000_configure_tx(adapter); 3001 e1000_configure_tx(adapter);
2967 e1000_setup_rctl(adapter); 3002 e1000_setup_rctl(adapter);
@@ -3095,6 +3130,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
3095 fc->high_water = 0x5000; 3130 fc->high_water = 0x5000;
3096 fc->low_water = 0x3000; 3131 fc->low_water = 0x3000;
3097 } 3132 }
3133 fc->refresh_time = 0x1000;
3098 } else { 3134 } else {
3099 if ((adapter->flags & FLAG_HAS_ERT) && 3135 if ((adapter->flags & FLAG_HAS_ERT) &&
3100 (adapter->netdev->mtu > ETH_DATA_LEN)) 3136 (adapter->netdev->mtu > ETH_DATA_LEN))
@@ -3132,10 +3168,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
3132 if (mac->ops.init_hw(hw)) 3168 if (mac->ops.init_hw(hw))
3133 e_err("Hardware Error\n"); 3169 e_err("Hardware Error\n");
3134 3170
3135 /* additional part of the flow-control workaround above */
3136 if (hw->mac.type == e1000_pchlan)
3137 ew32(FCRTV_PCH, 0x1000);
3138
3139 e1000_update_mng_vlan(adapter); 3171 e1000_update_mng_vlan(adapter);
3140 3172
3141 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 3173 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -3181,7 +3213,11 @@ int e1000e_up(struct e1000_adapter *adapter)
3181 netif_wake_queue(adapter->netdev); 3213 netif_wake_queue(adapter->netdev);
3182 3214
3183 /* fire a link change interrupt to start the watchdog */ 3215 /* fire a link change interrupt to start the watchdog */
3184 ew32(ICS, E1000_ICS_LSC); 3216 if (adapter->msix_entries)
3217 ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
3218 else
3219 ew32(ICS, E1000_ICS_LSC);
3220
3185 return 0; 3221 return 0;
3186} 3222}
3187 3223
@@ -3444,6 +3480,15 @@ static int e1000_open(struct net_device *netdev)
3444 if (err) 3480 if (err)
3445 goto err_setup_rx; 3481 goto err_setup_rx;
3446 3482
3483 /*
3484 * If AMT is enabled, let the firmware know that the network
3485 * interface is now open and reset the part to a known state.
3486 */
3487 if (adapter->flags & FLAG_HAS_AMT) {
3488 e1000_get_hw_control(adapter);
3489 e1000e_reset(adapter);
3490 }
3491
3447 e1000e_power_up_phy(adapter); 3492 e1000e_power_up_phy(adapter);
3448 3493
3449 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 3494 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
@@ -3452,13 +3497,6 @@ static int e1000_open(struct net_device *netdev)
3452 e1000_update_mng_vlan(adapter); 3497 e1000_update_mng_vlan(adapter);
3453 3498
3454 /* 3499 /*
3455 * If AMT is enabled, let the firmware know that the network
3456 * interface is now open
3457 */
3458 if (adapter->flags & FLAG_HAS_AMT)
3459 e1000_get_hw_control(adapter);
3460
3461 /*
3462 * before we allocate an interrupt, we must be ready to handle it. 3500 * before we allocate an interrupt, we must be ready to handle it.
3463 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt 3501 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
3464 * as soon as we call pci_request_irq, so we have to setup our 3502 * as soon as we call pci_request_irq, so we have to setup our
@@ -3496,7 +3534,10 @@ static int e1000_open(struct net_device *netdev)
3496 pm_runtime_put(&pdev->dev); 3534 pm_runtime_put(&pdev->dev);
3497 3535
3498 /* fire a link status change interrupt to start the watchdog */ 3536 /* fire a link status change interrupt to start the watchdog */
3499 ew32(ICS, E1000_ICS_LSC); 3537 if (adapter->msix_entries)
3538 ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
3539 else
3540 ew32(ICS, E1000_ICS_LSC);
3500 3541
3501 return 0; 3542 return 0;
3502 3543
@@ -5102,7 +5143,7 @@ static int __e1000_resume(struct pci_dev *pdev)
5102 5143
5103 e1000e_reset(adapter); 5144 e1000e_reset(adapter);
5104 5145
5105 e1000_init_manageability(adapter); 5146 e1000_init_manageability_pt(adapter);
5106 5147
5107 if (netif_running(netdev)) 5148 if (netif_running(netdev))
5108 e1000e_up(adapter); 5149 e1000e_up(adapter);
@@ -5303,7 +5344,7 @@ static void e1000_io_resume(struct pci_dev *pdev)
5303 struct net_device *netdev = pci_get_drvdata(pdev); 5344 struct net_device *netdev = pci_get_drvdata(pdev);
5304 struct e1000_adapter *adapter = netdev_priv(netdev); 5345 struct e1000_adapter *adapter = netdev_priv(netdev);
5305 5346
5306 e1000_init_manageability(adapter); 5347 e1000_init_manageability_pt(adapter);
5307 5348
5308 if (netif_running(netdev)) { 5349 if (netif_running(netdev)) {
5309 if (e1000e_up(adapter)) { 5350 if (e1000e_up(adapter)) {
@@ -5849,6 +5890,7 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
5849 5890
5850 { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LM), board_ich10lan }, 5891 { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LM), board_ich10lan },
5851 { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LF), board_ich10lan }, 5892 { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LF), board_ich10lan },
5893 { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_V), board_ich10lan },
5852 5894
5853 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LM), board_pchlan }, 5895 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LM), board_pchlan },
5854 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LC), board_pchlan }, 5896 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LC), board_pchlan },
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index 0f4077c3d538..a150e48a117f 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -286,7 +286,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
286 } 286 }
287 } 287 }
288 { /* Receive Interrupt Delay */ 288 { /* Receive Interrupt Delay */
289 struct e1000_option opt = { 289 static struct e1000_option opt = {
290 .type = range_option, 290 .type = range_option,
291 .name = "Receive Interrupt Delay", 291 .name = "Receive Interrupt Delay",
292 .err = "using default of " 292 .err = "using default of "
@@ -386,7 +386,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
386 } 386 }
387 } 387 }
388 { /* Interrupt Mode */ 388 { /* Interrupt Mode */
389 struct e1000_option opt = { 389 static struct e1000_option opt = {
390 .type = range_option, 390 .type = range_option,
391 .name = "Interrupt Mode", 391 .name = "Interrupt Mode",
392 .err = "defaulting to 2 (MSI-X)", 392 .err = "defaulting to 2 (MSI-X)",
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 7f3ceb9dad6a..b4ac82d51b20 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -3116,9 +3116,7 @@ s32 e1000_check_polarity_82577(struct e1000_hw *hw)
3116 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY 3116 * e1000_phy_force_speed_duplex_82577 - Force speed/duplex for I82577 PHY
3117 * @hw: pointer to the HW structure 3117 * @hw: pointer to the HW structure
3118 * 3118 *
3119 * Calls the PHY setup function to force speed and duplex. Clears the 3119 * Calls the PHY setup function to force speed and duplex.
3120 * auto-crossover to force MDI manually. Waits for link and returns
3121 * successful if link up is successful, else -E1000_ERR_PHY (-2).
3122 **/ 3120 **/
3123s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) 3121s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw)
3124{ 3122{
@@ -3137,23 +3135,6 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw)
3137 if (ret_val) 3135 if (ret_val)
3138 goto out; 3136 goto out;
3139 3137
3140 /*
3141 * Clear Auto-Crossover to force MDI manually. 82577 requires MDI
3142 * forced whenever speed and duplex are forced.
3143 */
3144 ret_val = phy->ops.read_reg(hw, I82577_PHY_CTRL_2, &phy_data);
3145 if (ret_val)
3146 goto out;
3147
3148 phy_data &= ~I82577_PHY_CTRL2_AUTO_MDIX;
3149 phy_data &= ~I82577_PHY_CTRL2_FORCE_MDI_MDIX;
3150
3151 ret_val = phy->ops.write_reg(hw, I82577_PHY_CTRL_2, phy_data);
3152 if (ret_val)
3153 goto out;
3154
3155 e_dbg("I82577_PHY_CTRL_2: %X\n", phy_data);
3156
3157 udelay(1); 3138 udelay(1);
3158 3139
3159 if (phy->autoneg_wait_to_complete) { 3140 if (phy->autoneg_wait_to_complete) {
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c
index ca93c9a9d372..06e72fbef862 100644
--- a/drivers/net/e2100.c
+++ b/drivers/net/e2100.c
@@ -328,7 +328,6 @@ e21_reset_8390(struct net_device *dev)
328 /* Set up the ASIC registers, just in case something changed them. */ 328 /* Set up the ASIC registers, just in case something changed them. */
329 329
330 if (ei_debug > 1) printk("reset done\n"); 330 if (ei_debug > 1) printk("reset done\n");
331 return;
332} 331}
333 332
334/* Grab the 8390 specific header. We put the 2k window so the header page 333/* Grab the 8390 specific header. We put the 2k window so the header page
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index eed65d821e47..8d97f168f018 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1161,8 +1161,7 @@ static netdev_tx_t eepro_send_packet(struct sk_buff *skb,
1161 /* we won't wake queue here because we're out of space */ 1161 /* we won't wake queue here because we're out of space */
1162 dev->stats.tx_dropped++; 1162 dev->stats.tx_dropped++;
1163 else { 1163 else {
1164 dev->stats.tx_bytes+=skb->len; 1164 dev->stats.tx_bytes+=skb->len;
1165 dev->trans_start = jiffies;
1166 netif_wake_queue(dev); 1165 netif_wake_queue(dev);
1167 } 1166 }
1168 1167
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index c31dd0685553..12c37d264108 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -543,7 +543,7 @@ static void unstick_cu(struct net_device *dev)
543 543
544 if (lp->started) 544 if (lp->started)
545 { 545 {
546 if (time_after(jiffies, dev->trans_start + 50)) 546 if (time_after(jiffies, dev_trans_start(dev) + HZ/2))
547 { 547 {
548 if (lp->tx_link==lp->last_tx_restart) 548 if (lp->tx_link==lp->last_tx_restart)
549 { 549 {
@@ -1018,7 +1018,7 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
1018 outw(lp->tx_head+0x16, ioaddr + DATAPORT); 1018 outw(lp->tx_head+0x16, ioaddr + DATAPORT);
1019 outw(0, ioaddr + DATAPORT); 1019 outw(0, ioaddr + DATAPORT);
1020 1020
1021 outsw(ioaddr + DATAPORT, buf, (len+1)>>1); 1021 outsw(ioaddr + DATAPORT, buf, (len+1)>>1);
1022 1022
1023 outw(lp->tx_tail+0xc, ioaddr + WRITE_PTR); 1023 outw(lp->tx_tail+0xc, ioaddr + WRITE_PTR);
1024 outw(lp->tx_head, ioaddr + DATAPORT); 1024 outw(lp->tx_head, ioaddr + DATAPORT);
@@ -1570,7 +1570,6 @@ static void eexp_hw_init586(struct net_device *dev)
1570#if NET_DEBUG > 6 1570#if NET_DEBUG > 6
1571 printk("%s: leaving eexp_hw_init586()\n", dev->name); 1571 printk("%s: leaving eexp_hw_init586()\n", dev->name);
1572#endif 1572#endif
1573 return;
1574} 1573}
1575 1574
1576static void eexp_setup_filter(struct net_device *dev) 1575static void eexp_setup_filter(struct net_device *dev)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 39774817c3eb..e8a8ccfedac6 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1881,7 +1881,6 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
1881 port->promisc = enable; 1881 port->promisc = enable;
1882out: 1882out:
1883 free_page((unsigned long)cb7); 1883 free_page((unsigned long)cb7);
1884 return;
1885} 1884}
1886 1885
1887static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, 1886static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr,
@@ -2025,7 +2024,6 @@ static void ehea_set_multicast_list(struct net_device *dev)
2025 } 2024 }
2026out: 2025out:
2027 ehea_update_bcmc_registrations(); 2026 ehea_update_bcmc_registrations();
2028 return;
2029} 2027}
2030 2028
2031static int ehea_change_mtu(struct net_device *dev, int new_mtu) 2029static int ehea_change_mtu(struct net_device *dev, int new_mtu)
@@ -2241,7 +2239,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2241 } 2239 }
2242 spin_unlock_irqrestore(&pr->netif_queue, flags); 2240 spin_unlock_irqrestore(&pr->netif_queue, flags);
2243 } 2241 }
2244 dev->trans_start = jiffies; 2242 dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
2245 spin_unlock(&pr->xmit_lock); 2243 spin_unlock(&pr->xmit_lock);
2246 2244
2247 return NETDEV_TX_OK; 2245 return NETDEV_TX_OK;
@@ -2338,7 +2336,6 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2338 ehea_error("modify_ehea_port failed"); 2336 ehea_error("modify_ehea_port failed");
2339out: 2337out:
2340 free_page((unsigned long)cb1); 2338 free_page((unsigned long)cb1);
2341 return;
2342} 2339}
2343 2340
2344int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp) 2341int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
@@ -2881,7 +2878,6 @@ static void ehea_reset_port(struct work_struct *work)
2881 netif_wake_queue(dev); 2878 netif_wake_queue(dev);
2882out: 2879out:
2883 mutex_unlock(&port->port_lock); 2880 mutex_unlock(&port->port_lock);
2884 return;
2885} 2881}
2886 2882
2887static void ehea_rereg_mrs(struct work_struct *work) 2883static void ehea_rereg_mrs(struct work_struct *work)
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index ff27f728fd9d..112c5aa9af7f 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1293,8 +1293,6 @@ static netdev_tx_t enc28j60_send_packet(struct sk_buff *skb,
1293 */ 1293 */
1294 netif_stop_queue(dev); 1294 netif_stop_queue(dev);
1295 1295
1296 /* save the timestamp */
1297 priv->netdev->trans_start = jiffies;
1298 /* Remember the skb for deferred processing */ 1296 /* Remember the skb for deferred processing */
1299 priv->tx_skb = skb; 1297 priv->tx_skb = skb;
1300 schedule_work(&priv->tx_work); 1298 schedule_work(&priv->tx_work);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 8b5a203d3aa2..6838dfc9ef23 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -652,7 +652,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int value)
652 if ((inl(ioaddr + MIICtrl) & MII_WRITEOP) == 0) 652 if ((inl(ioaddr + MIICtrl) & MII_WRITEOP) == 0)
653 break; 653 break;
654 } 654 }
655 return;
656} 655}
657 656
658 657
@@ -840,7 +839,6 @@ static void epic_restart(struct net_device *dev)
840 " interrupt %4.4x.\n", 839 " interrupt %4.4x.\n",
841 dev->name, (int)inl(ioaddr + COMMAND), (int)inl(ioaddr + GENCTL), 840 dev->name, (int)inl(ioaddr + COMMAND), (int)inl(ioaddr + GENCTL),
842 (int)inl(ioaddr + INTSTAT)); 841 (int)inl(ioaddr + INTSTAT));
843 return;
844} 842}
845 843
846static void check_media(struct net_device *dev) 844static void check_media(struct net_device *dev)
@@ -908,7 +906,7 @@ static void epic_tx_timeout(struct net_device *dev)
908 outl(TxQueued, dev->base_addr + COMMAND); 906 outl(TxQueued, dev->base_addr + COMMAND);
909 } 907 }
910 908
911 dev->trans_start = jiffies; 909 dev->trans_start = jiffies; /* prevent tx timeout */
912 ep->stats.tx_errors++; 910 ep->stats.tx_errors++;
913 if (!ep->tx_full) 911 if (!ep->tx_full)
914 netif_wake_queue(dev); 912 netif_wake_queue(dev);
@@ -958,7 +956,6 @@ static void epic_init_ring(struct net_device *dev)
958 (i+1)*sizeof(struct epic_tx_desc); 956 (i+1)*sizeof(struct epic_tx_desc);
959 } 957 }
960 ep->tx_ring[i-1].next = ep->tx_ring_dma; 958 ep->tx_ring[i-1].next = ep->tx_ring_dma;
961 return;
962} 959}
963 960
964static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev) 961static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -1006,7 +1003,6 @@ static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
1006 /* Trigger an immediate transmit demand. */ 1003 /* Trigger an immediate transmit demand. */
1007 outl(TxQueued, dev->base_addr + COMMAND); 1004 outl(TxQueued, dev->base_addr + COMMAND);
1008 1005
1009 dev->trans_start = jiffies;
1010 if (debug > 4) 1006 if (debug > 4)
1011 printk(KERN_DEBUG "%s: Queued Tx packet size %d to slot %d, " 1007 printk(KERN_DEBUG "%s: Queued Tx packet size %d to slot %d, "
1012 "flag %2.2x Tx status %8.8x.\n", 1008 "flag %2.2x Tx status %8.8x.\n",
@@ -1414,7 +1410,6 @@ static void set_rx_mode(struct net_device *dev)
1414 outw(((u16 *)mc_filter)[i], ioaddr + MC0 + i*4); 1410 outw(((u16 *)mc_filter)[i], ioaddr + MC0 + i*4);
1415 memcpy(ep->mc_filter, mc_filter, sizeof(mc_filter)); 1411 memcpy(ep->mc_filter, mc_filter, sizeof(mc_filter));
1416 } 1412 }
1417 return;
1418} 1413}
1419 1414
1420static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) 1415static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c
index 5569f2ffb62c..0ba5e7b90584 100644
--- a/drivers/net/es3210.c
+++ b/drivers/net/es3210.c
@@ -319,8 +319,6 @@ static void es_reset_8390(struct net_device *dev)
319 ei_status.txing = 0; 319 ei_status.txing = 0;
320 outb(0x01, ioaddr + ES_RESET_PORT); 320 outb(0x01, ioaddr + ES_RESET_PORT);
321 if (ei_debug > 1) printk("reset done\n"); 321 if (ei_debug > 1) printk("reset done\n");
322
323 return;
324} 322}
325 323
326/* 324/*
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index d4e24f08b3ba..874973f558e9 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -1027,7 +1027,7 @@ static void eth16i_timeout(struct net_device *dev)
1027 inw(ioaddr + TX_STATUS_REG), (inb(ioaddr + TX_STATUS_REG) & TX_DONE) ? 1027 inw(ioaddr + TX_STATUS_REG), (inb(ioaddr + TX_STATUS_REG) & TX_DONE) ?
1028 "IRQ conflict" : "network cable problem"); 1028 "IRQ conflict" : "network cable problem");
1029 1029
1030 dev->trans_start = jiffies; 1030 dev->trans_start = jiffies; /* prevent tx timeout */
1031 1031
1032 /* Let's dump all registers */ 1032 /* Let's dump all registers */
1033 if(eth16i_debug > 0) { 1033 if(eth16i_debug > 0) {
@@ -1047,7 +1047,7 @@ static void eth16i_timeout(struct net_device *dev)
1047 } 1047 }
1048 dev->stats.tx_errors++; 1048 dev->stats.tx_errors++;
1049 eth16i_reset(dev); 1049 eth16i_reset(dev);
1050 dev->trans_start = jiffies; 1050 dev->trans_start = jiffies; /* prevent tx timeout */
1051 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); 1051 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG);
1052 netif_wake_queue(dev); 1052 netif_wake_queue(dev);
1053} 1053}
@@ -1109,7 +1109,6 @@ static netdev_tx_t eth16i_tx(struct sk_buff *skb, struct net_device *dev)
1109 outb(TX_START | lp->tx_queue, ioaddr + TRANSMIT_START_REG); 1109 outb(TX_START | lp->tx_queue, ioaddr + TRANSMIT_START_REG);
1110 lp->tx_queue = 0; 1110 lp->tx_queue = 0;
1111 lp->tx_queue_len = 0; 1111 lp->tx_queue_len = 0;
1112 dev->trans_start = jiffies;
1113 lp->tx_started = 1; 1112 lp->tx_started = 1;
1114 netif_wake_queue(dev); 1113 netif_wake_queue(dev);
1115 } 1114 }
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index ad1bc7317df6..14cbde5cf68e 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -851,7 +851,6 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
851 netif_stop_queue(dev); 851 netif_stop_queue(dev);
852 } 852 }
853 853
854 dev->trans_start = jiffies;
855 spin_unlock_irq(&priv->lock); 854 spin_unlock_irq(&priv->lock);
856out: 855out:
857 dev_kfree_skb(skb); 856 dev_kfree_skb(skb);
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 11ba70f49971..380d0614a89a 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -757,7 +757,7 @@ static void ewrk3_timeout(struct net_device *dev)
757 */ 757 */
758 ENABLE_IRQs; 758 ENABLE_IRQs;
759 759
760 dev->trans_start = jiffies; 760 dev->trans_start = jiffies; /* prevent tx timeout */
761 netif_wake_queue(dev); 761 netif_wake_queue(dev);
762 } 762 }
763} 763}
@@ -862,7 +862,6 @@ static netdev_tx_t ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev)
862 spin_unlock_irq (&lp->hw_lock); 862 spin_unlock_irq (&lp->hw_lock);
863 863
864 dev->stats.tx_bytes += skb->len; 864 dev->stats.tx_bytes += skb->len;
865 dev->trans_start = jiffies;
866 dev_kfree_skb (skb); 865 dev_kfree_skb (skb);
867 866
868 /* Check for free resources: stop Tx queue if there are none */ 867 /* Check for free resources: stop Tx queue if there are none */
@@ -1370,8 +1369,6 @@ static void __init EthwrkSignature(char *name, char *eeprom_image)
1370 name[EWRK3_STRLEN] = '\0'; 1369 name[EWRK3_STRLEN] = '\0';
1371 } else 1370 } else
1372 name[0] = '\0'; 1371 name[0] = '\0';
1373
1374 return;
1375} 1372}
1376 1373
1377/* 1374/*
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 51b738dd6547..15f4f8d3d46d 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -1233,7 +1233,7 @@ static void fealnx_tx_timeout(struct net_device *dev)
1233 1233
1234 spin_unlock_irqrestore(&np->lock, flags); 1234 spin_unlock_irqrestore(&np->lock, flags);
1235 1235
1236 dev->trans_start = jiffies; 1236 dev->trans_start = jiffies; /* prevent tx timeout */
1237 np->stats.tx_errors++; 1237 np->stats.tx_errors++;
1238 netif_wake_queue(dev); /* or .._start_.. ?? */ 1238 netif_wake_queue(dev); /* or .._start_.. ?? */
1239} 1239}
@@ -1374,7 +1374,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1374 netif_stop_queue(dev); 1374 netif_stop_queue(dev);
1375 ++np->really_tx_count; 1375 ++np->really_tx_count;
1376 iowrite32(0, np->mem + TXPDR); 1376 iowrite32(0, np->mem + TXPDR);
1377 dev->trans_start = jiffies;
1378 1377
1379 spin_unlock_irqrestore(&np->lock, flags); 1378 spin_unlock_irqrestore(&np->lock, flags);
1380 return NETDEV_TX_OK; 1379 return NETDEV_TX_OK;
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 2b1651aee13f..42d9ac9ba395 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -275,8 +275,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
275 | BD_ENET_TX_LAST | BD_ENET_TX_TC); 275 | BD_ENET_TX_LAST | BD_ENET_TX_TC);
276 bdp->cbd_sc = status; 276 bdp->cbd_sc = status;
277 277
278 dev->trans_start = jiffies;
279
280 /* Trigger transmission start */ 278 /* Trigger transmission start */
281 writel(0, fep->hwp + FEC_X_DES_ACTIVE); 279 writel(0, fep->hwp + FEC_X_DES_ACTIVE);
282 280
@@ -1033,7 +1031,7 @@ fec_set_mac_address(struct net_device *dev, void *p)
1033 (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24), 1031 (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24),
1034 fep->hwp + FEC_ADDR_LOW); 1032 fep->hwp + FEC_ADDR_LOW);
1035 writel((dev->dev_addr[5] << 16) | (dev->dev_addr[4] << 24), 1033 writel((dev->dev_addr[5] << 16) | (dev->dev_addr[4] << 24),
1036 fep + FEC_ADDR_HIGH); 1034 fep->hwp + FEC_ADDR_HIGH);
1037 return 0; 1035 return 0;
1038} 1036}
1039 1037
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 0376c3e472a7..221f440c10f4 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -327,7 +327,6 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
327 } 327 }
328 328
329 spin_lock_irqsave(&priv->lock, flags); 329 spin_lock_irqsave(&priv->lock, flags);
330 dev->trans_start = jiffies;
331 330
332 bd = (struct bcom_fec_bd *) 331 bd = (struct bcom_fec_bd *)
333 bcom_prepare_next_buffer(priv->tx_dmatsk); 332 bcom_prepare_next_buffer(priv->tx_dmatsk);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index e282d0ae6a3d..268ea4d566d7 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2214,7 +2214,6 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2214 dprintk("\n"); 2214 dprintk("\n");
2215 } 2215 }
2216 2216
2217 dev->trans_start = jiffies;
2218 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 2217 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
2219 return NETDEV_TX_OK; 2218 return NETDEV_TX_OK;
2220} 2219}
@@ -2369,7 +2368,6 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2369 dprintk("\n"); 2368 dprintk("\n");
2370 } 2369 }
2371 2370
2372 dev->trans_start = jiffies;
2373 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 2371 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
2374 return NETDEV_TX_OK; 2372 return NETDEV_TX_OK;
2375} 2373}
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 0770e2f6da6b..0fb0fefcb787 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -674,8 +674,6 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
674 skb->data, skb->len, DMA_TO_DEVICE)); 674 skb->data, skb->len, DMA_TO_DEVICE));
675 CBDW_DATLEN(bdp, skb->len); 675 CBDW_DATLEN(bdp, skb->len);
676 676
677 dev->trans_start = jiffies;
678
679 /* 677 /*
680 * If this was the last BD in the ring, start at the beginning again. 678 * If this was the last BD in the ring, start at the beginning again.
681 */ 679 */
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5267c27e3174..43db5ab8ba3d 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1705,6 +1705,7 @@ static void free_skb_resources(struct gfar_private *priv)
1705 sizeof(struct rxbd8) * priv->total_rx_ring_size, 1705 sizeof(struct rxbd8) * priv->total_rx_ring_size,
1706 priv->tx_queue[0]->tx_bd_base, 1706 priv->tx_queue[0]->tx_bd_base,
1707 priv->tx_queue[0]->tx_bd_dma_base); 1707 priv->tx_queue[0]->tx_bd_dma_base);
1708 skb_queue_purge(&priv->rx_recycle);
1708} 1709}
1709 1710
1710void gfar_start(struct net_device *dev) 1711void gfar_start(struct net_device *dev)
@@ -1738,7 +1739,7 @@ void gfar_start(struct net_device *dev)
1738 gfar_write(&regs->imask, IMASK_DEFAULT); 1739 gfar_write(&regs->imask, IMASK_DEFAULT);
1739 } 1740 }
1740 1741
1741 dev->trans_start = jiffies; 1742 dev->trans_start = jiffies; /* prevent tx timeout */
1742} 1743}
1743 1744
1744void gfar_configure_coalescing(struct gfar_private *priv, 1745void gfar_configure_coalescing(struct gfar_private *priv,
@@ -2161,8 +2162,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2161 /* reduce TxBD free count */ 2162 /* reduce TxBD free count */
2162 tx_queue->num_txbdfree -= (nr_txbds); 2163 tx_queue->num_txbdfree -= (nr_txbds);
2163 2164
2164 dev->trans_start = jiffies;
2165
2166 /* If the next BD still needs to be cleaned up, then the bds 2165 /* If the next BD still needs to be cleaned up, then the bds
2167 are full. We need to tell the kernel to stop sending us stuff. */ 2166 are full. We need to tell the kernel to stop sending us stuff. */
2168 if (!tx_queue->num_txbdfree) { 2167 if (!tx_queue->num_txbdfree) {
@@ -2187,7 +2186,6 @@ static int gfar_close(struct net_device *dev)
2187 2186
2188 disable_napi(priv); 2187 disable_napi(priv);
2189 2188
2190 skb_queue_purge(&priv->rx_recycle);
2191 cancel_work_sync(&priv->reset_task); 2189 cancel_work_sync(&priv->reset_task);
2192 stop_gfar(dev); 2190 stop_gfar(dev);
2193 2191
@@ -3011,8 +3009,6 @@ static void gfar_set_multi(struct net_device *dev)
3011 gfar_set_hash_for_addr(dev, ha->addr); 3009 gfar_set_hash_for_addr(dev, ha->addr);
3012 } 3010 }
3013 } 3011 }
3014
3015 return;
3016} 3012}
3017 3013
3018 3014
@@ -3053,8 +3049,6 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr)
3053 tempval = gfar_read(priv->hash_regs[whichreg]); 3049 tempval = gfar_read(priv->hash_regs[whichreg]);
3054 tempval |= value; 3050 tempval |= value;
3055 gfar_write(priv->hash_regs[whichreg], tempval); 3051 gfar_write(priv->hash_regs[whichreg], tempval);
3056
3057 return;
3058} 3052}
3059 3053
3060 3054
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 83f43bb835d6..61f2b1cfcd46 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -859,7 +859,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
859 for (i = 10000; i >= 0; i--) 859 for (i = 10000; i >= 0; i--)
860 if ((readw(ioaddr + MII_Status) & 1) == 0) 860 if ((readw(ioaddr + MII_Status) & 1) == 0)
861 break; 861 break;
862 return;
863} 862}
864 863
865 864
@@ -1225,8 +1224,6 @@ static void hamachi_init_ring(struct net_device *dev)
1225 } 1224 }
1226 /* Mark the last entry of the ring */ 1225 /* Mark the last entry of the ring */
1227 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing); 1226 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing);
1228
1229 return;
1230} 1227}
1231 1228
1232 1229
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index f3a96b843911..9f64c8637208 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1629,7 +1629,6 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb)
1629 skb->protocol = ax25_type_trans(skb, scc->dev); 1629 skb->protocol = ax25_type_trans(skb, scc->dev);
1630 1630
1631 netif_rx(skb); 1631 netif_rx(skb);
1632 return;
1633} 1632}
1634 1633
1635/* ----> transmit frame <---- */ 1634/* ----> transmit frame <---- */
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index efdbcad63c67..82bffc3cabdf 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -351,7 +351,6 @@ hpp_reset_8390(struct net_device *dev)
351 printk("%s: hp_reset_8390() did not complete.\n", dev->name); 351 printk("%s: hp_reset_8390() did not complete.\n", dev->name);
352 352
353 if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies); 353 if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
354 return;
355} 354}
356 355
357/* The programmed-I/O version of reading the 4 byte 8390 specific header. 356/* The programmed-I/O version of reading the 4 byte 8390 specific header.
@@ -422,7 +421,6 @@ hpp_io_block_output(struct net_device *dev, int count,
422 int ioaddr = dev->base_addr - NIC_OFFSET; 421 int ioaddr = dev->base_addr - NIC_OFFSET;
423 outw(start_page << 8, ioaddr + HPP_OUT_ADDR); 422 outw(start_page << 8, ioaddr + HPP_OUT_ADDR);
424 outsl(ioaddr + HP_DATAPORT, buf, (count+3)>>2); 423 outsl(ioaddr + HP_DATAPORT, buf, (count+3)>>2);
425 return;
426} 424}
427 425
428static void 426static void
@@ -436,8 +434,6 @@ hpp_mem_block_output(struct net_device *dev, int count,
436 outw(option_reg & ~(MemDisable + BootROMEnb), ioaddr + HPP_OPTION); 434 outw(option_reg & ~(MemDisable + BootROMEnb), ioaddr + HPP_OPTION);
437 memcpy_toio(ei_status.mem, buf, (count + 3) & ~3); 435 memcpy_toio(ei_status.mem, buf, (count + 3) & ~3);
438 outw(option_reg, ioaddr + HPP_OPTION); 436 outw(option_reg, ioaddr + HPP_OPTION);
439
440 return;
441} 437}
442 438
443 439
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index 5c4d78c1ff42..86ececd3c658 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -240,7 +240,6 @@ hp_reset_8390(struct net_device *dev)
240 printk("%s: hp_reset_8390() did not complete.\n", dev->name); 240 printk("%s: hp_reset_8390() did not complete.\n", dev->name);
241 241
242 if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies); 242 if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
243 return;
244} 243}
245 244
246static void 245static void
@@ -360,7 +359,6 @@ hp_block_output(struct net_device *dev, int count,
360 dev->name, (start_page << 8) + count, addr); 359 dev->name, (start_page << 8) + count, addr);
361 } 360 }
362 outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE); 361 outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
363 return;
364} 362}
365 363
366/* This function resets the ethercard if something screws up. */ 364/* This function resets the ethercard if something screws up. */
@@ -371,7 +369,6 @@ hp_init_card(struct net_device *dev)
371 NS8390p_init(dev, 0); 369 NS8390p_init(dev, 0);
372 outb_p(irqmap[irq&0x0f] | HP_RUN, 370 outb_p(irqmap[irq&0x0f] | HP_RUN,
373 dev->base_addr - NIC_OFFSET + HP_CONFIGURE); 371 dev->base_addr - NIC_OFFSET + HP_CONFIGURE);
374 return;
375} 372}
376 373
377#ifdef MODULE 374#ifdef MODULE
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 0f3f6c2e6942..68e5ac8832ad 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1102,7 +1102,7 @@ static int hp100_open(struct net_device *dev)
1102 return -EAGAIN; 1102 return -EAGAIN;
1103 } 1103 }
1104 1104
1105 dev->trans_start = jiffies; 1105 dev->trans_start = jiffies; /* prevent tx timeout */
1106 netif_start_queue(dev); 1106 netif_start_queue(dev);
1107 1107
1108 lp->lan_type = hp100_sense_lan(dev); 1108 lp->lan_type = hp100_sense_lan(dev);
@@ -1510,7 +1510,7 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1510 printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); 1510 printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
1511#endif 1511#endif
1512 /* not waited long enough since last tx? */ 1512 /* not waited long enough since last tx? */
1513 if (time_before(jiffies, dev->trans_start + HZ)) 1513 if (time_before(jiffies, dev_trans_start(dev) + HZ))
1514 goto drop; 1514 goto drop;
1515 1515
1516 if (hp100_check_lan(dev)) 1516 if (hp100_check_lan(dev))
@@ -1547,7 +1547,6 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1547 } 1547 }
1548 } 1548 }
1549 1549
1550 dev->trans_start = jiffies;
1551 goto drop; 1550 goto drop;
1552 } 1551 }
1553 1552
@@ -1585,7 +1584,6 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1585 /* Update statistics */ 1584 /* Update statistics */
1586 lp->stats.tx_packets++; 1585 lp->stats.tx_packets++;
1587 lp->stats.tx_bytes += skb->len; 1586 lp->stats.tx_bytes += skb->len;
1588 dev->trans_start = jiffies;
1589 1587
1590 return NETDEV_TX_OK; 1588 return NETDEV_TX_OK;
1591 1589
@@ -1663,7 +1661,7 @@ static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
1663 printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i); 1661 printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
1664#endif 1662#endif
1665 /* not waited long enough since last failed tx try? */ 1663 /* not waited long enough since last failed tx try? */
1666 if (time_before(jiffies, dev->trans_start + HZ)) { 1664 if (time_before(jiffies, dev_trans_start(dev) + HZ)) {
1667#ifdef HP100_DEBUG 1665#ifdef HP100_DEBUG
1668 printk("hp100: %s: trans_start timing problem\n", 1666 printk("hp100: %s: trans_start timing problem\n",
1669 dev->name); 1667 dev->name);
@@ -1701,7 +1699,6 @@ static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
1701 mdelay(1); 1699 mdelay(1);
1702 } 1700 }
1703 } 1701 }
1704 dev->trans_start = jiffies;
1705 goto drop; 1702 goto drop;
1706 } 1703 }
1707 1704
@@ -1745,7 +1742,6 @@ static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
1745 1742
1746 lp->stats.tx_packets++; 1743 lp->stats.tx_packets++;
1747 lp->stats.tx_bytes += skb->len; 1744 lp->stats.tx_bytes += skb->len;
1748 dev->trans_start = jiffies;
1749 hp100_ints_on(); 1745 hp100_ints_on();
1750 spin_unlock_irqrestore(&lp->lock, flags); 1746 spin_unlock_irqrestore(&lp->lock, flags);
1751 1747
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 0d2c3ac2005e..3e4dead5a2f4 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -957,7 +957,7 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
957 } else { 957 } else {
958 tx_packets++; 958 tx_packets++;
959 tx_bytes += skb->len; 959 tx_bytes += skb->len;
960 netdev->trans_start = jiffies; 960 netdev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
961 } 961 }
962 962
963 if (!used_bounce) 963 if (!used_bounce)
@@ -1421,7 +1421,6 @@ static void ibmveth_proc_register_adapter(struct ibmveth_adapter *adapter)
1421 if (!entry) 1421 if (!entry)
1422 ibmveth_error_printk("Cannot create adapter proc entry"); 1422 ibmveth_error_printk("Cannot create adapter proc entry");
1423 } 1423 }
1424 return;
1425} 1424}
1426 1425
1427static void ibmveth_proc_unregister_adapter(struct ibmveth_adapter *adapter) 1426static void ibmveth_proc_unregister_adapter(struct ibmveth_adapter *adapter)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index f4081c0a2d9c..ab9f675c5b8b 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -182,7 +182,6 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
182 netif_stop_queue(dev); 182 netif_stop_queue(dev);
183 } 183 }
184 184
185 dev->trans_start = jiffies;
186 skb_queue_tail(&dp->rq, skb); 185 skb_queue_tail(&dp->rq, skb);
187 if (!dp->tasklet_pending) { 186 if (!dp->tasklet_pending) {
188 dp->tasklet_pending = 1; 187 dp->tasklet_pending = 1;
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index 3ef495537dc5..86438b59fa21 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -1214,8 +1214,6 @@ void igb_power_down_phy_copper_82575(struct e1000_hw *hw)
1214 /* If the management interface is not enabled, then power down */ 1214 /* If the management interface is not enabled, then power down */
1215 if (!(igb_enable_mng_pass_thru(hw) || igb_check_reset_block(hw))) 1215 if (!(igb_enable_mng_pass_thru(hw) || igb_check_reset_block(hw)))
1216 igb_power_down_phy_copper(hw); 1216 igb_power_down_phy_copper(hw);
1217
1218 return;
1219} 1217}
1220 1218
1221/** 1219/**
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 589cf4a6427a..3881918f5382 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1054,7 +1054,6 @@ msi_only:
1054out: 1054out:
1055 /* Notify the stack of the (possibly) reduced Tx Queue count. */ 1055 /* Notify the stack of the (possibly) reduced Tx Queue count. */
1056 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; 1056 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
1057 return;
1058} 1057}
1059 1058
1060/** 1059/**
@@ -3717,8 +3716,6 @@ set_itr_now:
3717 q_vector->itr_val = new_itr; 3716 q_vector->itr_val = new_itr;
3718 q_vector->set_itr = 1; 3717 q_vector->set_itr = 1;
3719 } 3718 }
3720
3721 return;
3722} 3719}
3723 3720
3724#define IGB_TX_FLAGS_CSUM 0x00000001 3721#define IGB_TX_FLAGS_CSUM 0x00000001
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c
index 8afff07ff559..103b3aa1afc2 100644
--- a/drivers/net/igbvf/ethtool.c
+++ b/drivers/net/igbvf/ethtool.c
@@ -390,8 +390,6 @@ static void igbvf_get_wol(struct net_device *netdev,
390{ 390{
391 wol->supported = 0; 391 wol->supported = 0;
392 wol->wolopts = 0; 392 wol->wolopts = 0;
393
394 return;
395} 393}
396 394
397static int igbvf_set_wol(struct net_device *netdev, 395static int igbvf_set_wol(struct net_device *netdev,
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 091ea3377ed0..e3b5e9490601 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1503,7 +1503,6 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
1503 1503
1504 BARRIER(); 1504 BARRIER();
1505 1505
1506 dev->trans_start = jiffies;
1507 ip->tx_skbs[produce] = skb; /* Remember skb */ 1506 ip->tx_skbs[produce] = skb; /* Remember skb */
1508 produce = (produce + 1) & 127; 1507 produce = (produce + 1) & 127;
1509 ip->tx_pi = produce; 1508 ip->tx_pi = produce;
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index b5cbd39d0685..a3d696a9456a 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -546,7 +546,6 @@ static int au1k_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
546 546
547 dev_kfree_skb(skb); 547 dev_kfree_skb(skb);
548 aup->tx_head = (aup->tx_head + 1) & (NUM_IR_DESC - 1); 548 aup->tx_head = (aup->tx_head + 1) & (NUM_IR_DESC - 1);
549 dev->trans_start = jiffies;
550 return NETDEV_TX_OK; 549 return NETDEV_TX_OK;
551} 550}
552 551
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index b7e6625ca75e..48bd5ec9f29b 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1002,8 +1002,6 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
1002 1002
1003 toshoboe_checkstuck (self); 1003 toshoboe_checkstuck (self);
1004 1004
1005 dev->trans_start = jiffies;
1006
1007 /* Check if we need to change the speed */ 1005 /* Check if we need to change the speed */
1008 /* But not now. Wait after transmission if mtt not required */ 1006 /* But not now. Wait after transmission if mtt not required */
1009 speed=irda_get_next_speed(skb); 1007 speed=irda_get_next_speed(skb);
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index c0e0bb9401d3..5b1036ac38d7 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -434,8 +434,6 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
434 434
435 mcs->netdev->stats.rx_packets++; 435 mcs->netdev->stats.rx_packets++;
436 mcs->netdev->stats.rx_bytes += new_len; 436 mcs->netdev->stats.rx_bytes += new_len;
437
438 return;
439} 437}
440 438
441/* Unwrap received packets at FIR speed. A 32 bit crc_ccitt checksum is 439/* Unwrap received packets at FIR speed. A 32 bit crc_ccitt checksum is
@@ -487,8 +485,6 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
487 485
488 mcs->netdev->stats.rx_packets++; 486 mcs->netdev->stats.rx_packets++;
489 mcs->netdev->stats.rx_bytes += new_len; 487 mcs->netdev->stats.rx_bytes += new_len;
490
491 return;
492} 488}
493 489
494 490
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 1a54f6bb68c5..c192c31e4c5c 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -556,7 +556,6 @@ static int pxa_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
556 } 556 }
557 557
558 dev_kfree_skb(skb); 558 dev_kfree_skb(skb);
559 dev->trans_start = jiffies;
560 return NETDEV_TX_OK; 559 return NETDEV_TX_OK;
561} 560}
562 561
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 1dcdce0631aa..da2705061a60 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -715,8 +715,6 @@ static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
715 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_TXE; 715 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_TXE;
716 } 716 }
717 717
718 dev->trans_start = jiffies;
719
720 return NETDEV_TX_OK; 718 return NETDEV_TX_OK;
721} 719}
722 720
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index de91cd14016b..1b051dab7b29 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -655,7 +655,6 @@ static netdev_tx_t sirdev_hard_xmit(struct sk_buff *skb,
655 655
656 if (likely(actual > 0)) { 656 if (likely(actual > 0)) {
657 dev->tx_skb = skb; 657 dev->tx_skb = skb;
658 ndev->trans_start = jiffies;
659 dev->tx_buff.data += actual; 658 dev->tx_buff.data += actual;
660 dev->tx_buff.len -= actual; 659 dev->tx_buff.len -= actual;
661 } 660 }
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 6af84d88cd03..d67e48418e55 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -868,7 +868,7 @@ static void smsc_ircc_timeout(struct net_device *dev)
868 spin_lock_irqsave(&self->lock, flags); 868 spin_lock_irqsave(&self->lock, flags);
869 smsc_ircc_sir_start(self); 869 smsc_ircc_sir_start(self);
870 smsc_ircc_change_speed(self, self->io.speed); 870 smsc_ircc_change_speed(self, self->io.speed);
871 dev->trans_start = jiffies; 871 dev->trans_start = jiffies; /* prevent tx timeout */
872 netif_wake_queue(dev); 872 netif_wake_queue(dev);
873 spin_unlock_irqrestore(&self->lock, flags); 873 spin_unlock_irqrestore(&self->lock, flags);
874} 874}
@@ -2822,7 +2822,6 @@ static void __init preconfigure_ali_port(struct pci_dev *dev,
2822 tmpbyte |= mask; 2822 tmpbyte |= mask;
2823 pci_write_config_byte(dev, reg, tmpbyte); 2823 pci_write_config_byte(dev, reg, tmpbyte);
2824 IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port); 2824 IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port);
2825 return;
2826} 2825}
2827 2826
2828static int __init preconfigure_through_ali(struct pci_dev *dev, 2827static int __init preconfigure_through_ali(struct pci_dev *dev,
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index e14505272870..c3d07382b7fa 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1037,7 +1037,6 @@ static netdev_tx_t vlsi_hard_start_xmit(struct sk_buff *skb,
1037 wmb(); 1037 wmb();
1038 outw(0, iobase+VLSI_PIO_PROMPT); 1038 outw(0, iobase+VLSI_PIO_PROMPT);
1039 } 1039 }
1040 ndev->trans_start = jiffies;
1041 1040
1042 if (ring_put(r) == NULL) { 1041 if (ring_put(r) == NULL) {
1043 netif_stop_queue(ndev); 1042 netif_stop_queue(ndev);
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index cb0cb758be64..1f9c3f08d1a3 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -515,7 +515,6 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
515 /* Check for empty frame */ 515 /* Check for empty frame */
516 if (!skb->len) { 516 if (!skb->len) {
517 w83977af_change_speed(self, speed); 517 w83977af_change_speed(self, speed);
518 dev->trans_start = jiffies;
519 dev_kfree_skb(skb); 518 dev_kfree_skb(skb);
520 return NETDEV_TX_OK; 519 return NETDEV_TX_OK;
521 } else 520 } else
@@ -549,7 +548,6 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
549 switch_bank(iobase, SET0); 548 switch_bank(iobase, SET0);
550 outb(ICR_ETXTHI, iobase+ICR); 549 outb(ICR_ETXTHI, iobase+ICR);
551 } 550 }
552 dev->trans_start = jiffies;
553 dev_kfree_skb(skb); 551 dev_kfree_skb(skb);
554 552
555 /* Restore set register */ 553 /* Restore set register */
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 06303a36aaf7..813993f9c65c 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -58,7 +58,6 @@ ixgb_raise_clock(struct ixgb_hw *hw,
58 *eecd_reg = *eecd_reg | IXGB_EECD_SK; 58 *eecd_reg = *eecd_reg | IXGB_EECD_SK;
59 IXGB_WRITE_REG(hw, EECD, *eecd_reg); 59 IXGB_WRITE_REG(hw, EECD, *eecd_reg);
60 udelay(50); 60 udelay(50);
61 return;
62} 61}
63 62
64/****************************************************************************** 63/******************************************************************************
@@ -77,7 +76,6 @@ ixgb_lower_clock(struct ixgb_hw *hw,
77 *eecd_reg = *eecd_reg & ~IXGB_EECD_SK; 76 *eecd_reg = *eecd_reg & ~IXGB_EECD_SK;
78 IXGB_WRITE_REG(hw, EECD, *eecd_reg); 77 IXGB_WRITE_REG(hw, EECD, *eecd_reg);
79 udelay(50); 78 udelay(50);
80 return;
81} 79}
82 80
83/****************************************************************************** 81/******************************************************************************
@@ -127,7 +125,6 @@ ixgb_shift_out_bits(struct ixgb_hw *hw,
127 /* We leave the "DI" bit set to "0" when we leave this routine. */ 125 /* We leave the "DI" bit set to "0" when we leave this routine. */
128 eecd_reg &= ~IXGB_EECD_DI; 126 eecd_reg &= ~IXGB_EECD_DI;
129 IXGB_WRITE_REG(hw, EECD, eecd_reg); 127 IXGB_WRITE_REG(hw, EECD, eecd_reg);
130 return;
131} 128}
132 129
133/****************************************************************************** 130/******************************************************************************
@@ -192,7 +189,6 @@ ixgb_setup_eeprom(struct ixgb_hw *hw)
192 /* Set CS */ 189 /* Set CS */
193 eecd_reg |= IXGB_EECD_CS; 190 eecd_reg |= IXGB_EECD_CS;
194 IXGB_WRITE_REG(hw, EECD, eecd_reg); 191 IXGB_WRITE_REG(hw, EECD, eecd_reg);
195 return;
196} 192}
197 193
198/****************************************************************************** 194/******************************************************************************
@@ -226,7 +222,6 @@ ixgb_standby_eeprom(struct ixgb_hw *hw)
226 eecd_reg &= ~IXGB_EECD_SK; 222 eecd_reg &= ~IXGB_EECD_SK;
227 IXGB_WRITE_REG(hw, EECD, eecd_reg); 223 IXGB_WRITE_REG(hw, EECD, eecd_reg);
228 udelay(50); 224 udelay(50);
229 return;
230} 225}
231 226
232/****************************************************************************** 227/******************************************************************************
@@ -250,7 +245,6 @@ ixgb_clock_eeprom(struct ixgb_hw *hw)
250 eecd_reg &= ~IXGB_EECD_SK; 245 eecd_reg &= ~IXGB_EECD_SK;
251 IXGB_WRITE_REG(hw, EECD, eecd_reg); 246 IXGB_WRITE_REG(hw, EECD, eecd_reg);
252 udelay(50); 247 udelay(50);
253 return;
254} 248}
255 249
256/****************************************************************************** 250/******************************************************************************
@@ -270,7 +264,6 @@ ixgb_cleanup_eeprom(struct ixgb_hw *hw)
270 IXGB_WRITE_REG(hw, EECD, eecd_reg); 264 IXGB_WRITE_REG(hw, EECD, eecd_reg);
271 265
272 ixgb_clock_eeprom(hw); 266 ixgb_clock_eeprom(hw);
273 return;
274} 267}
275 268
276/****************************************************************************** 269/******************************************************************************
@@ -359,7 +352,6 @@ ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
359 checksum = (u16) EEPROM_SUM - checksum; 352 checksum = (u16) EEPROM_SUM - checksum;
360 353
361 ixgb_write_eeprom(hw, EEPROM_CHECKSUM_REG, checksum); 354 ixgb_write_eeprom(hw, EEPROM_CHECKSUM_REG, checksum);
362 return;
363} 355}
364 356
365/****************************************************************************** 357/******************************************************************************
@@ -414,8 +406,6 @@ ixgb_write_eeprom(struct ixgb_hw *hw, u16 offset, u16 data)
414 406
415 /* clear the init_ctrl_reg_1 to signify that the cache is invalidated */ 407 /* clear the init_ctrl_reg_1 to signify that the cache is invalidated */
416 ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR); 408 ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR);
417
418 return;
419} 409}
420 410
421/****************************************************************************** 411/******************************************************************************
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index cd247b8d2b73..397acabccab6 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -413,8 +413,6 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
413 IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); 413 IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
414 IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); 414 IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
415 } 415 }
416
417 return;
418} 416}
419 417
420/****************************************************************************** 418/******************************************************************************
@@ -483,7 +481,6 @@ ixgb_mc_addr_list_update(struct ixgb_hw *hw,
483 } 481 }
484 482
485 pr_debug("MC Update Complete\n"); 483 pr_debug("MC Update Complete\n");
486 return;
487} 484}
488 485
489/****************************************************************************** 486/******************************************************************************
@@ -566,8 +563,6 @@ ixgb_mta_set(struct ixgb_hw *hw,
566 mta_reg |= (1 << hash_bit); 563 mta_reg |= (1 << hash_bit);
567 564
568 IXGB_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta_reg); 565 IXGB_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta_reg);
569
570 return;
571} 566}
572 567
573/****************************************************************************** 568/******************************************************************************
@@ -600,7 +595,6 @@ ixgb_rar_set(struct ixgb_hw *hw,
600 595
601 IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); 596 IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
602 IXGB_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); 597 IXGB_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high);
603 return;
604} 598}
605 599
606/****************************************************************************** 600/******************************************************************************
@@ -616,7 +610,6 @@ ixgb_write_vfta(struct ixgb_hw *hw,
616 u32 value) 610 u32 value)
617{ 611{
618 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value); 612 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value);
619 return;
620} 613}
621 614
622/****************************************************************************** 615/******************************************************************************
@@ -631,7 +624,6 @@ ixgb_clear_vfta(struct ixgb_hw *hw)
631 624
632 for (offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++) 625 for (offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++)
633 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0); 626 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
634 return;
635} 627}
636 628
637/****************************************************************************** 629/******************************************************************************
@@ -1050,7 +1042,6 @@ ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
1050 temp_reg = IXGB_READ_REG(hw, XOFFRXC); 1042 temp_reg = IXGB_READ_REG(hw, XOFFRXC);
1051 temp_reg = IXGB_READ_REG(hw, XOFFTXC); 1043 temp_reg = IXGB_READ_REG(hw, XOFFTXC);
1052 temp_reg = IXGB_READ_REG(hw, RJC); 1044 temp_reg = IXGB_READ_REG(hw, RJC);
1053 return;
1054} 1045}
1055 1046
1056/****************************************************************************** 1047/******************************************************************************
@@ -1066,7 +1057,6 @@ ixgb_led_on(struct ixgb_hw *hw)
1066 /* To turn on the LED, clear software-definable pin 0 (SDP0). */ 1057 /* To turn on the LED, clear software-definable pin 0 (SDP0). */
1067 ctrl0_reg &= ~IXGB_CTRL0_SDP0; 1058 ctrl0_reg &= ~IXGB_CTRL0_SDP0;
1068 IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg); 1059 IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg);
1069 return;
1070} 1060}
1071 1061
1072/****************************************************************************** 1062/******************************************************************************
@@ -1082,7 +1072,6 @@ ixgb_led_off(struct ixgb_hw *hw)
1082 /* To turn off the LED, set software-definable pin 0 (SDP0). */ 1072 /* To turn off the LED, set software-definable pin 0 (SDP0). */
1083 ctrl0_reg |= IXGB_CTRL0_SDP0; 1073 ctrl0_reg |= IXGB_CTRL0_SDP0;
1084 IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg); 1074 IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg);
1085 return;
1086} 1075}
1087 1076
1088/****************************************************************************** 1077/******************************************************************************
@@ -1122,8 +1111,6 @@ ixgb_get_bus_info(struct ixgb_hw *hw)
1122 1111
1123 hw->bus.width = (status_reg & IXGB_STATUS_BUS64) ? 1112 hw->bus.width = (status_reg & IXGB_STATUS_BUS64) ?
1124 ixgb_bus_width_64 : ixgb_bus_width_32; 1113 ixgb_bus_width_64 : ixgb_bus_width_32;
1125
1126 return;
1127} 1114}
1128 1115
1129/****************************************************************************** 1116/******************************************************************************
@@ -1210,8 +1197,6 @@ ixgb_optics_reset(struct ixgb_hw *hw)
1210 IXGB_PHY_ADDRESS, 1197 IXGB_PHY_ADDRESS,
1211 MDIO_MMD_PMAPMD); 1198 MDIO_MMD_PMAPMD);
1212 } 1199 }
1213
1214 return;
1215} 1200}
1216 1201
1217/****************************************************************************** 1202/******************************************************************************
@@ -1272,6 +1257,4 @@ ixgb_optics_reset_bcm(struct ixgb_hw *hw)
1272 1257
1273 /* SerDes needs extra delay */ 1258 /* SerDes needs extra delay */
1274 msleep(IXGB_SUN_PHY_RESET_DELAY); 1259 msleep(IXGB_SUN_PHY_RESET_DELAY);
1275
1276 return;
1277} 1260}
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d58ca6b578cc..c6b75c83100c 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1921,6 +1921,31 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
1921 } 1921 }
1922} 1922}
1923 1923
1924/*
1925 * this should improve performance for small packets with large amounts
1926 * of reassembly being done in the stack
1927 */
1928static void ixgb_check_copybreak(struct net_device *netdev,
1929 struct ixgb_buffer *buffer_info,
1930 u32 length, struct sk_buff **skb)
1931{
1932 struct sk_buff *new_skb;
1933
1934 if (length > copybreak)
1935 return;
1936
1937 new_skb = netdev_alloc_skb_ip_align(netdev, length);
1938 if (!new_skb)
1939 return;
1940
1941 skb_copy_to_linear_data_offset(new_skb, -NET_IP_ALIGN,
1942 (*skb)->data - NET_IP_ALIGN,
1943 length + NET_IP_ALIGN);
1944 /* save the skb in buffer_info as good */
1945 buffer_info->skb = *skb;
1946 *skb = new_skb;
1947}
1948
1924/** 1949/**
1925 * ixgb_clean_rx_irq - Send received data up the network stack, 1950 * ixgb_clean_rx_irq - Send received data up the network stack,
1926 * @adapter: board private structure 1951 * @adapter: board private structure
@@ -1957,11 +1982,14 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
1957 1982
1958 prefetch(skb->data - NET_IP_ALIGN); 1983 prefetch(skb->data - NET_IP_ALIGN);
1959 1984
1960 if (++i == rx_ring->count) i = 0; 1985 if (++i == rx_ring->count)
1986 i = 0;
1961 next_rxd = IXGB_RX_DESC(*rx_ring, i); 1987 next_rxd = IXGB_RX_DESC(*rx_ring, i);
1962 prefetch(next_rxd); 1988 prefetch(next_rxd);
1963 1989
1964 if ((j = i + 1) == rx_ring->count) j = 0; 1990 j = i + 1;
1991 if (j == rx_ring->count)
1992 j = 0;
1965 next2_buffer = &rx_ring->buffer_info[j]; 1993 next2_buffer = &rx_ring->buffer_info[j];
1966 prefetch(next2_buffer); 1994 prefetch(next2_buffer);
1967 1995
@@ -1997,25 +2025,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
1997 goto rxdesc_done; 2025 goto rxdesc_done;
1998 } 2026 }
1999 2027
2000 /* code added for copybreak, this should improve 2028 ixgb_check_copybreak(netdev, buffer_info, length, &skb);
2001 * performance for small packets with large amounts
2002 * of reassembly being done in the stack */
2003 if (length < copybreak) {
2004 struct sk_buff *new_skb =
2005 netdev_alloc_skb_ip_align(netdev, length);
2006 if (new_skb) {
2007 skb_copy_to_linear_data_offset(new_skb,
2008 -NET_IP_ALIGN,
2009 (skb->data -
2010 NET_IP_ALIGN),
2011 (length +
2012 NET_IP_ALIGN));
2013 /* save the skb in buffer_info as good */
2014 buffer_info->skb = skb;
2015 skb = new_skb;
2016 }
2017 }
2018 /* end copybreak code */
2019 2029
2020 /* Good Receive */ 2030 /* Good Receive */
2021 skb_put(skb, length); 2031 skb_put(skb, length);
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 35a06b47587b..f2b7ff44215b 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -42,9 +42,9 @@ static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
42 ixgbe_link_speed *speed, 42 ixgbe_link_speed *speed,
43 bool *autoneg); 43 bool *autoneg);
44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, 44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
45 ixgbe_link_speed speed, 45 ixgbe_link_speed speed,
46 bool autoneg, 46 bool autoneg,
47 bool autoneg_wait_to_complete); 47 bool autoneg_wait_to_complete);
48static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, 48static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
49 u8 *eeprom_data); 49 u8 *eeprom_data);
50 50
@@ -1221,7 +1221,7 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1221 1221
1222static struct ixgbe_eeprom_operations eeprom_ops_82598 = { 1222static struct ixgbe_eeprom_operations eeprom_ops_82598 = {
1223 .init_params = &ixgbe_init_eeprom_params_generic, 1223 .init_params = &ixgbe_init_eeprom_params_generic,
1224 .read = &ixgbe_read_eeprom_generic, 1224 .read = &ixgbe_read_eerd_generic,
1225 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, 1225 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
1226 .update_checksum = &ixgbe_update_eeprom_checksum_generic, 1226 .update_checksum = &ixgbe_update_eeprom_checksum_generic,
1227}; 1227};
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 38c384031c4c..dc197a4b0676 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -133,27 +133,6 @@ setup_sfp_out:
133 return ret_val; 133 return ret_val;
134} 134}
135 135
136/**
137 * ixgbe_get_pcie_msix_count_82599 - Gets MSI-X vector count
138 * @hw: pointer to hardware structure
139 *
140 * Read PCIe configuration space, and get the MSI-X vector count from
141 * the capabilities table.
142 **/
143static u32 ixgbe_get_pcie_msix_count_82599(struct ixgbe_hw *hw)
144{
145 struct ixgbe_adapter *adapter = hw->back;
146 u16 msix_count;
147 pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82599_CAPS,
148 &msix_count);
149 msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
150
151 /* MSI-X count is zero-based in HW, so increment to give proper value */
152 msix_count++;
153
154 return msix_count;
155}
156
157static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) 136static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw)
158{ 137{
159 struct ixgbe_mac_info *mac = &hw->mac; 138 struct ixgbe_mac_info *mac = &hw->mac;
@@ -165,7 +144,7 @@ static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw)
165 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES; 144 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
166 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES; 145 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
167 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES; 146 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
168 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw); 147 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw);
169 148
170 return 0; 149 return 0;
171} 150}
@@ -735,60 +714,6 @@ out:
735} 714}
736 715
737/** 716/**
738 * ixgbe_check_mac_link_82599 - Determine link and speed status
739 * @hw: pointer to hardware structure
740 * @speed: pointer to link speed
741 * @link_up: true when link is up
742 * @link_up_wait_to_complete: bool used to wait for link up or not
743 *
744 * Reads the links register to determine if link is up and the current speed
745 **/
746static s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw,
747 ixgbe_link_speed *speed,
748 bool *link_up,
749 bool link_up_wait_to_complete)
750{
751 u32 links_reg;
752 u32 i;
753
754 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
755 if (link_up_wait_to_complete) {
756 for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
757 if (links_reg & IXGBE_LINKS_UP) {
758 *link_up = true;
759 break;
760 } else {
761 *link_up = false;
762 }
763 msleep(100);
764 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
765 }
766 } else {
767 if (links_reg & IXGBE_LINKS_UP)
768 *link_up = true;
769 else
770 *link_up = false;
771 }
772
773 if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
774 IXGBE_LINKS_SPEED_10G_82599)
775 *speed = IXGBE_LINK_SPEED_10GB_FULL;
776 else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
777 IXGBE_LINKS_SPEED_1G_82599)
778 *speed = IXGBE_LINK_SPEED_1GB_FULL;
779 else
780 *speed = IXGBE_LINK_SPEED_100_FULL;
781
782 /* if link is down, zero out the current_mode */
783 if (*link_up == false) {
784 hw->fc.current_mode = ixgbe_fc_none;
785 hw->fc.fc_was_autonegged = false;
786 }
787
788 return 0;
789}
790
791/**
792 * ixgbe_setup_mac_link_82599 - Set MAC link speed 717 * ixgbe_setup_mac_link_82599 - Set MAC link speed
793 * @hw: pointer to hardware structure 718 * @hw: pointer to hardware structure
794 * @speed: new link speed 719 * @speed: new link speed
@@ -1050,243 +975,6 @@ reset_hw_out:
1050} 975}
1051 976
1052/** 977/**
1053 * ixgbe_clear_vmdq_82599 - Disassociate a VMDq pool index from a rx address
1054 * @hw: pointer to hardware struct
1055 * @rar: receive address register index to disassociate
1056 * @vmdq: VMDq pool index to remove from the rar
1057 **/
1058static s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
1059{
1060 u32 mpsar_lo, mpsar_hi;
1061 u32 rar_entries = hw->mac.num_rar_entries;
1062
1063 if (rar < rar_entries) {
1064 mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
1065 mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
1066
1067 if (!mpsar_lo && !mpsar_hi)
1068 goto done;
1069
1070 if (vmdq == IXGBE_CLEAR_VMDQ_ALL) {
1071 if (mpsar_lo) {
1072 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0);
1073 mpsar_lo = 0;
1074 }
1075 if (mpsar_hi) {
1076 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0);
1077 mpsar_hi = 0;
1078 }
1079 } else if (vmdq < 32) {
1080 mpsar_lo &= ~(1 << vmdq);
1081 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo);
1082 } else {
1083 mpsar_hi &= ~(1 << (vmdq - 32));
1084 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi);
1085 }
1086
1087 /* was that the last pool using this rar? */
1088 if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
1089 hw->mac.ops.clear_rar(hw, rar);
1090 } else {
1091 hw_dbg(hw, "RAR index %d is out of range.\n", rar);
1092 }
1093
1094done:
1095 return 0;
1096}
1097
1098/**
1099 * ixgbe_set_vmdq_82599 - Associate a VMDq pool index with a rx address
1100 * @hw: pointer to hardware struct
1101 * @rar: receive address register index to associate with a VMDq index
1102 * @vmdq: VMDq pool index
1103 **/
1104static s32 ixgbe_set_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
1105{
1106 u32 mpsar;
1107 u32 rar_entries = hw->mac.num_rar_entries;
1108
1109 if (rar < rar_entries) {
1110 if (vmdq < 32) {
1111 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
1112 mpsar |= 1 << vmdq;
1113 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar);
1114 } else {
1115 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
1116 mpsar |= 1 << (vmdq - 32);
1117 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar);
1118 }
1119 } else {
1120 hw_dbg(hw, "RAR index %d is out of range.\n", rar);
1121 }
1122 return 0;
1123}
1124
1125/**
1126 * ixgbe_set_vfta_82599 - Set VLAN filter table
1127 * @hw: pointer to hardware structure
1128 * @vlan: VLAN id to write to VLAN filter
1129 * @vind: VMDq output index that maps queue to VLAN id in VFVFB
1130 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
1131 *
1132 * Turn on/off specified VLAN in the VLAN filter table.
1133 **/
1134static s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, u32 vind,
1135 bool vlan_on)
1136{
1137 u32 regindex;
1138 u32 vlvf_index;
1139 u32 bitindex;
1140 u32 bits;
1141 u32 first_empty_slot;
1142 u32 vt_ctl;
1143
1144 if (vlan > 4095)
1145 return IXGBE_ERR_PARAM;
1146
1147 /*
1148 * this is a 2 part operation - first the VFTA, then the
1149 * VLVF and VLVFB if vind is set
1150 */
1151
1152 /* Part 1
1153 * The VFTA is a bitstring made up of 128 32-bit registers
1154 * that enable the particular VLAN id, much like the MTA:
1155 * bits[11-5]: which register
1156 * bits[4-0]: which bit in the register
1157 */
1158 regindex = (vlan >> 5) & 0x7F;
1159 bitindex = vlan & 0x1F;
1160 bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
1161 if (vlan_on)
1162 bits |= (1 << bitindex);
1163 else
1164 bits &= ~(1 << bitindex);
1165 IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
1166
1167
1168 /* Part 2
1169 * If VT mode is set
1170 * Either vlan_on
1171 * make sure the vlan is in VLVF
1172 * set the vind bit in the matching VLVFB
1173 * Or !vlan_on
1174 * clear the pool bit and possibly the vind
1175 */
1176 vt_ctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
1177 if (!(vt_ctl & IXGBE_VT_CTL_VT_ENABLE))
1178 goto out;
1179
1180 /* find the vlanid or the first empty slot */
1181 first_empty_slot = 0;
1182
1183 for (vlvf_index = 1; vlvf_index < IXGBE_VLVF_ENTRIES; vlvf_index++) {
1184 bits = IXGBE_READ_REG(hw, IXGBE_VLVF(vlvf_index));
1185 if (!bits && !first_empty_slot)
1186 first_empty_slot = vlvf_index;
1187 else if ((bits & 0x0FFF) == vlan)
1188 break;
1189 }
1190
1191 if (vlvf_index >= IXGBE_VLVF_ENTRIES) {
1192 if (first_empty_slot)
1193 vlvf_index = first_empty_slot;
1194 else {
1195 hw_dbg(hw, "No space in VLVF.\n");
1196 goto out;
1197 }
1198 }
1199
1200 if (vlan_on) {
1201 /* set the pool bit */
1202 if (vind < 32) {
1203 bits = IXGBE_READ_REG(hw,
1204 IXGBE_VLVFB(vlvf_index * 2));
1205 bits |= (1 << vind);
1206 IXGBE_WRITE_REG(hw,
1207 IXGBE_VLVFB(vlvf_index * 2), bits);
1208 } else {
1209 bits = IXGBE_READ_REG(hw,
1210 IXGBE_VLVFB((vlvf_index * 2) + 1));
1211 bits |= (1 << (vind - 32));
1212 IXGBE_WRITE_REG(hw,
1213 IXGBE_VLVFB((vlvf_index * 2) + 1), bits);
1214 }
1215 } else {
1216 /* clear the pool bit */
1217 if (vind < 32) {
1218 bits = IXGBE_READ_REG(hw,
1219 IXGBE_VLVFB(vlvf_index * 2));
1220 bits &= ~(1 << vind);
1221 IXGBE_WRITE_REG(hw,
1222 IXGBE_VLVFB(vlvf_index * 2), bits);
1223 bits |= IXGBE_READ_REG(hw,
1224 IXGBE_VLVFB((vlvf_index * 2) + 1));
1225 } else {
1226 bits = IXGBE_READ_REG(hw,
1227 IXGBE_VLVFB((vlvf_index * 2) + 1));
1228 bits &= ~(1 << (vind - 32));
1229 IXGBE_WRITE_REG(hw,
1230 IXGBE_VLVFB((vlvf_index * 2) + 1), bits);
1231 bits |= IXGBE_READ_REG(hw,
1232 IXGBE_VLVFB(vlvf_index * 2));
1233 }
1234 }
1235
1236 if (bits) {
1237 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index),
1238 (IXGBE_VLVF_VIEN | vlan));
1239 /* if bits is non-zero then some pools/VFs are still
1240 * using this VLAN ID. Force the VFTA entry to on */
1241 bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
1242 bits |= (1 << bitindex);
1243 IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
1244 }
1245 else
1246 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0);
1247
1248out:
1249 return 0;
1250}
1251
1252/**
1253 * ixgbe_clear_vfta_82599 - Clear VLAN filter table
1254 * @hw: pointer to hardware structure
1255 *
1256 * Clears the VLAN filer table, and the VMDq index associated with the filter
1257 **/
1258static s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
1259{
1260 u32 offset;
1261
1262 for (offset = 0; offset < hw->mac.vft_size; offset++)
1263 IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
1264
1265 for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) {
1266 IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0);
1267 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2), 0);
1268 IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset * 2) + 1), 0);
1269 }
1270
1271 return 0;
1272}
1273
1274/**
1275 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
1276 * @hw: pointer to hardware structure
1277 **/
1278static s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw)
1279{
1280 int i;
1281 hw_dbg(hw, " Clearing UTA\n");
1282
1283 for (i = 0; i < 128; i++)
1284 IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0);
1285
1286 return 0;
1287}
1288
1289/**
1290 * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables. 978 * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables.
1291 * @hw: pointer to hardware structure 979 * @hw: pointer to hardware structure
1292 **/ 980 **/
@@ -2550,75 +2238,6 @@ static s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)
2550} 2238}
2551 2239
2552/** 2240/**
2553 * ixgbe_get_san_mac_addr_offset_82599 - SAN MAC address offset for 82599
2554 * @hw: pointer to hardware structure
2555 * @san_mac_offset: SAN MAC address offset
2556 *
2557 * This function will read the EEPROM location for the SAN MAC address
2558 * pointer, and returns the value at that location. This is used in both
2559 * get and set mac_addr routines.
2560 **/
2561static s32 ixgbe_get_san_mac_addr_offset_82599(struct ixgbe_hw *hw,
2562 u16 *san_mac_offset)
2563{
2564 /*
2565 * First read the EEPROM pointer to see if the MAC addresses are
2566 * available.
2567 */
2568 hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
2569
2570 return 0;
2571}
2572
2573/**
2574 * ixgbe_get_san_mac_addr_82599 - SAN MAC address retrieval for 82599
2575 * @hw: pointer to hardware structure
2576 * @san_mac_addr: SAN MAC address
2577 *
2578 * Reads the SAN MAC address from the EEPROM, if it's available. This is
2579 * per-port, so set_lan_id() must be called before reading the addresses.
2580 * set_lan_id() is called by identify_sfp(), but this cannot be relied
2581 * upon for non-SFP connections, so we must call it here.
2582 **/
2583static s32 ixgbe_get_san_mac_addr_82599(struct ixgbe_hw *hw, u8 *san_mac_addr)
2584{
2585 u16 san_mac_data, san_mac_offset;
2586 u8 i;
2587
2588 /*
2589 * First read the EEPROM pointer to see if the MAC addresses are
2590 * available. If they're not, no point in calling set_lan_id() here.
2591 */
2592 ixgbe_get_san_mac_addr_offset_82599(hw, &san_mac_offset);
2593
2594 if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
2595 /*
2596 * No addresses available in this EEPROM. It's not an
2597 * error though, so just wipe the local address and return.
2598 */
2599 for (i = 0; i < 6; i++)
2600 san_mac_addr[i] = 0xFF;
2601
2602 goto san_mac_addr_out;
2603 }
2604
2605 /* make sure we know which port we need to program */
2606 hw->mac.ops.set_lan_id(hw);
2607 /* apply the port offset to the address offset */
2608 (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
2609 (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
2610 for (i = 0; i < 3; i++) {
2611 hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
2612 san_mac_addr[i * 2] = (u8)(san_mac_data);
2613 san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
2614 san_mac_offset++;
2615 }
2616
2617san_mac_addr_out:
2618 return 0;
2619}
2620
2621/**
2622 * ixgbe_verify_fw_version_82599 - verify fw version for 82599 2241 * ixgbe_verify_fw_version_82599 - verify fw version for 82599
2623 * @hw: pointer to hardware structure 2242 * @hw: pointer to hardware structure
2624 * 2243 *
@@ -2720,7 +2339,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2720 .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, 2339 .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599,
2721 .enable_rx_dma = &ixgbe_enable_rx_dma_82599, 2340 .enable_rx_dma = &ixgbe_enable_rx_dma_82599,
2722 .get_mac_addr = &ixgbe_get_mac_addr_generic, 2341 .get_mac_addr = &ixgbe_get_mac_addr_generic,
2723 .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599, 2342 .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic,
2724 .get_device_caps = &ixgbe_get_device_caps_82599, 2343 .get_device_caps = &ixgbe_get_device_caps_82599,
2725 .get_wwn_prefix = &ixgbe_get_wwn_prefix_82599, 2344 .get_wwn_prefix = &ixgbe_get_wwn_prefix_82599,
2726 .stop_adapter = &ixgbe_stop_adapter_generic, 2345 .stop_adapter = &ixgbe_stop_adapter_generic,
@@ -2729,7 +2348,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2729 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, 2348 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599,
2730 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, 2349 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599,
2731 .setup_link = &ixgbe_setup_mac_link_82599, 2350 .setup_link = &ixgbe_setup_mac_link_82599,
2732 .check_link = &ixgbe_check_mac_link_82599, 2351 .check_link = &ixgbe_check_mac_link_generic,
2733 .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 2352 .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
2734 .led_on = &ixgbe_led_on_generic, 2353 .led_on = &ixgbe_led_on_generic,
2735 .led_off = &ixgbe_led_off_generic, 2354 .led_off = &ixgbe_led_off_generic,
@@ -2737,23 +2356,23 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2737 .blink_led_stop = &ixgbe_blink_led_stop_generic, 2356 .blink_led_stop = &ixgbe_blink_led_stop_generic,
2738 .set_rar = &ixgbe_set_rar_generic, 2357 .set_rar = &ixgbe_set_rar_generic,
2739 .clear_rar = &ixgbe_clear_rar_generic, 2358 .clear_rar = &ixgbe_clear_rar_generic,
2740 .set_vmdq = &ixgbe_set_vmdq_82599, 2359 .set_vmdq = &ixgbe_set_vmdq_generic,
2741 .clear_vmdq = &ixgbe_clear_vmdq_82599, 2360 .clear_vmdq = &ixgbe_clear_vmdq_generic,
2742 .init_rx_addrs = &ixgbe_init_rx_addrs_generic, 2361 .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
2743 .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic, 2362 .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic,
2744 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, 2363 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
2745 .enable_mc = &ixgbe_enable_mc_generic, 2364 .enable_mc = &ixgbe_enable_mc_generic,
2746 .disable_mc = &ixgbe_disable_mc_generic, 2365 .disable_mc = &ixgbe_disable_mc_generic,
2747 .clear_vfta = &ixgbe_clear_vfta_82599, 2366 .clear_vfta = &ixgbe_clear_vfta_generic,
2748 .set_vfta = &ixgbe_set_vfta_82599, 2367 .set_vfta = &ixgbe_set_vfta_generic,
2749 .fc_enable = &ixgbe_fc_enable_generic, 2368 .fc_enable = &ixgbe_fc_enable_generic,
2750 .init_uta_tables = &ixgbe_init_uta_tables_82599, 2369 .init_uta_tables = &ixgbe_init_uta_tables_generic,
2751 .setup_sfp = &ixgbe_setup_sfp_modules_82599, 2370 .setup_sfp = &ixgbe_setup_sfp_modules_82599,
2752}; 2371};
2753 2372
2754static struct ixgbe_eeprom_operations eeprom_ops_82599 = { 2373static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
2755 .init_params = &ixgbe_init_eeprom_params_generic, 2374 .init_params = &ixgbe_init_eeprom_params_generic,
2756 .read = &ixgbe_read_eeprom_generic, 2375 .read = &ixgbe_read_eerd_generic,
2757 .write = &ixgbe_write_eeprom_generic, 2376 .write = &ixgbe_write_eeprom_generic,
2758 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, 2377 .validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
2759 .update_checksum = &ixgbe_update_eeprom_checksum_generic, 2378 .update_checksum = &ixgbe_update_eeprom_checksum_generic,
@@ -2762,7 +2381,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
2762static struct ixgbe_phy_operations phy_ops_82599 = { 2381static struct ixgbe_phy_operations phy_ops_82599 = {
2763 .identify = &ixgbe_identify_phy_82599, 2382 .identify = &ixgbe_identify_phy_82599,
2764 .identify_sfp = &ixgbe_identify_sfp_module_generic, 2383 .identify_sfp = &ixgbe_identify_sfp_module_generic,
2765 .init = &ixgbe_init_phy_ops_82599, 2384 .init = &ixgbe_init_phy_ops_82599,
2766 .reset = &ixgbe_reset_phy_generic, 2385 .reset = &ixgbe_reset_phy_generic,
2767 .read_reg = &ixgbe_read_phy_reg_generic, 2386 .read_reg = &ixgbe_read_phy_reg_generic,
2768 .write_reg = &ixgbe_write_phy_reg_generic, 2387 .write_reg = &ixgbe_write_phy_reg_generic,
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 6eb5814ca7da..1159d9138f05 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -34,7 +34,6 @@
34#include "ixgbe_common.h" 34#include "ixgbe_common.h"
35#include "ixgbe_phy.h" 35#include "ixgbe_phy.h"
36 36
37static s32 ixgbe_poll_eeprom_eerd_done(struct ixgbe_hw *hw);
38static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw); 37static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw);
39static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw); 38static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw);
40static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw); 39static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw);
@@ -595,14 +594,14 @@ out:
595} 594}
596 595
597/** 596/**
598 * ixgbe_read_eeprom_generic - Read EEPROM word using EERD 597 * ixgbe_read_eerd_generic - Read EEPROM word using EERD
599 * @hw: pointer to hardware structure 598 * @hw: pointer to hardware structure
600 * @offset: offset of word in the EEPROM to read 599 * @offset: offset of word in the EEPROM to read
601 * @data: word read from the EEPROM 600 * @data: word read from the EEPROM
602 * 601 *
603 * Reads a 16 bit word from the EEPROM using the EERD register. 602 * Reads a 16 bit word from the EEPROM using the EERD register.
604 **/ 603 **/
605s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data) 604s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data)
606{ 605{
607 u32 eerd; 606 u32 eerd;
608 s32 status; 607 s32 status;
@@ -614,15 +613,15 @@ s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data)
614 goto out; 613 goto out;
615 } 614 }
616 615
617 eerd = (offset << IXGBE_EEPROM_READ_ADDR_SHIFT) + 616 eerd = (offset << IXGBE_EEPROM_RW_ADDR_SHIFT) +
618 IXGBE_EEPROM_READ_REG_START; 617 IXGBE_EEPROM_RW_REG_START;
619 618
620 IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd); 619 IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd);
621 status = ixgbe_poll_eeprom_eerd_done(hw); 620 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_READ);
622 621
623 if (status == 0) 622 if (status == 0)
624 *data = (IXGBE_READ_REG(hw, IXGBE_EERD) >> 623 *data = (IXGBE_READ_REG(hw, IXGBE_EERD) >>
625 IXGBE_EEPROM_READ_REG_DATA); 624 IXGBE_EEPROM_RW_REG_DATA);
626 else 625 else
627 hw_dbg(hw, "Eeprom read timed out\n"); 626 hw_dbg(hw, "Eeprom read timed out\n");
628 627
@@ -631,20 +630,26 @@ out:
631} 630}
632 631
633/** 632/**
634 * ixgbe_poll_eeprom_eerd_done - Poll EERD status 633 * ixgbe_poll_eerd_eewr_done - Poll EERD read or EEWR write status
635 * @hw: pointer to hardware structure 634 * @hw: pointer to hardware structure
635 * @ee_reg: EEPROM flag for polling
636 * 636 *
637 * Polls the status bit (bit 1) of the EERD to determine when the read is done. 637 * Polls the status bit (bit 1) of the EERD or EEWR to determine when the
638 * read or write is done respectively.
638 **/ 639 **/
639static s32 ixgbe_poll_eeprom_eerd_done(struct ixgbe_hw *hw) 640s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg)
640{ 641{
641 u32 i; 642 u32 i;
642 u32 reg; 643 u32 reg;
643 s32 status = IXGBE_ERR_EEPROM; 644 s32 status = IXGBE_ERR_EEPROM;
644 645
645 for (i = 0; i < IXGBE_EERD_ATTEMPTS; i++) { 646 for (i = 0; i < IXGBE_EERD_EEWR_ATTEMPTS; i++) {
646 reg = IXGBE_READ_REG(hw, IXGBE_EERD); 647 if (ee_reg == IXGBE_NVM_POLL_READ)
647 if (reg & IXGBE_EEPROM_READ_REG_DONE) { 648 reg = IXGBE_READ_REG(hw, IXGBE_EERD);
649 else
650 reg = IXGBE_READ_REG(hw, IXGBE_EEWR);
651
652 if (reg & IXGBE_EEPROM_RW_REG_DONE) {
648 status = 0; 653 status = 0;
649 break; 654 break;
650 } 655 }
@@ -1392,14 +1397,17 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
1392 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); 1397 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
1393 fctrl |= IXGBE_FCTRL_UPE; 1398 fctrl |= IXGBE_FCTRL_UPE;
1394 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); 1399 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
1400 hw->addr_ctrl.uc_set_promisc = true;
1395 } 1401 }
1396 } else { 1402 } else {
1397 /* only disable if set by overflow, not by user */ 1403 /* only disable if set by overflow, not by user */
1398 if (old_promisc_setting && !hw->addr_ctrl.user_set_promisc) { 1404 if ((old_promisc_setting && hw->addr_ctrl.uc_set_promisc) &&
1405 !(hw->addr_ctrl.user_set_promisc)) {
1399 hw_dbg(hw, " Leaving address overflow promisc mode\n"); 1406 hw_dbg(hw, " Leaving address overflow promisc mode\n");
1400 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); 1407 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
1401 fctrl &= ~IXGBE_FCTRL_UPE; 1408 fctrl &= ~IXGBE_FCTRL_UPE;
1402 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); 1409 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
1410 hw->addr_ctrl.uc_set_promisc = false;
1403 } 1411 }
1404 } 1412 }
1405 1413
@@ -2252,3 +2260,490 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
2252 2260
2253 return 0; 2261 return 0;
2254} 2262}
2263
2264/**
2265 * ixgbe_get_san_mac_addr_offset - Get SAN MAC address offset from the EEPROM
2266 * @hw: pointer to hardware structure
2267 * @san_mac_offset: SAN MAC address offset
2268 *
2269 * This function will read the EEPROM location for the SAN MAC address
2270 * pointer, and returns the value at that location. This is used in both
2271 * get and set mac_addr routines.
2272 **/
2273static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw,
2274 u16 *san_mac_offset)
2275{
2276 /*
2277 * First read the EEPROM pointer to see if the MAC addresses are
2278 * available.
2279 */
2280 hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
2281
2282 return 0;
2283}
2284
2285/**
2286 * ixgbe_get_san_mac_addr_generic - SAN MAC address retrieval from the EEPROM
2287 * @hw: pointer to hardware structure
2288 * @san_mac_addr: SAN MAC address
2289 *
2290 * Reads the SAN MAC address from the EEPROM, if it's available. This is
2291 * per-port, so set_lan_id() must be called before reading the addresses.
2292 * set_lan_id() is called by identify_sfp(), but this cannot be relied
2293 * upon for non-SFP connections, so we must call it here.
2294 **/
2295s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
2296{
2297 u16 san_mac_data, san_mac_offset;
2298 u8 i;
2299
2300 /*
2301 * First read the EEPROM pointer to see if the MAC addresses are
2302 * available. If they're not, no point in calling set_lan_id() here.
2303 */
2304 ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
2305
2306 if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
2307 /*
2308 * No addresses available in this EEPROM. It's not an
2309 * error though, so just wipe the local address and return.
2310 */
2311 for (i = 0; i < 6; i++)
2312 san_mac_addr[i] = 0xFF;
2313
2314 goto san_mac_addr_out;
2315 }
2316
2317 /* make sure we know which port we need to program */
2318 hw->mac.ops.set_lan_id(hw);
2319 /* apply the port offset to the address offset */
2320 (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
2321 (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
2322 for (i = 0; i < 3; i++) {
2323 hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
2324 san_mac_addr[i * 2] = (u8)(san_mac_data);
2325 san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
2326 san_mac_offset++;
2327 }
2328
2329san_mac_addr_out:
2330 return 0;
2331}
2332
2333/**
2334 * ixgbe_get_pcie_msix_count_generic - Gets MSI-X vector count
2335 * @hw: pointer to hardware structure
2336 *
2337 * Read PCIe configuration space, and get the MSI-X vector count from
2338 * the capabilities table.
2339 **/
2340u32 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw)
2341{
2342 struct ixgbe_adapter *adapter = hw->back;
2343 u16 msix_count;
2344 pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82599_CAPS,
2345 &msix_count);
2346 msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
2347
2348 /* MSI-X count is zero-based in HW, so increment to give proper value */
2349 msix_count++;
2350
2351 return msix_count;
2352}
2353
2354/**
2355 * ixgbe_clear_vmdq_generic - Disassociate a VMDq pool index from a rx address
2356 * @hw: pointer to hardware struct
2357 * @rar: receive address register index to disassociate
2358 * @vmdq: VMDq pool index to remove from the rar
2359 **/
2360s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
2361{
2362 u32 mpsar_lo, mpsar_hi;
2363 u32 rar_entries = hw->mac.num_rar_entries;
2364
2365 if (rar < rar_entries) {
2366 mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
2367 mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
2368
2369 if (!mpsar_lo && !mpsar_hi)
2370 goto done;
2371
2372 if (vmdq == IXGBE_CLEAR_VMDQ_ALL) {
2373 if (mpsar_lo) {
2374 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0);
2375 mpsar_lo = 0;
2376 }
2377 if (mpsar_hi) {
2378 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0);
2379 mpsar_hi = 0;
2380 }
2381 } else if (vmdq < 32) {
2382 mpsar_lo &= ~(1 << vmdq);
2383 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo);
2384 } else {
2385 mpsar_hi &= ~(1 << (vmdq - 32));
2386 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi);
2387 }
2388
2389 /* was that the last pool using this rar? */
2390 if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
2391 hw->mac.ops.clear_rar(hw, rar);
2392 } else {
2393 hw_dbg(hw, "RAR index %d is out of range.\n", rar);
2394 }
2395
2396done:
2397 return 0;
2398}
2399
2400/**
2401 * ixgbe_set_vmdq_generic - Associate a VMDq pool index with a rx address
2402 * @hw: pointer to hardware struct
2403 * @rar: receive address register index to associate with a VMDq index
2404 * @vmdq: VMDq pool index
2405 **/
2406s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
2407{
2408 u32 mpsar;
2409 u32 rar_entries = hw->mac.num_rar_entries;
2410
2411 if (rar < rar_entries) {
2412 if (vmdq < 32) {
2413 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
2414 mpsar |= 1 << vmdq;
2415 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar);
2416 } else {
2417 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
2418 mpsar |= 1 << (vmdq - 32);
2419 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar);
2420 }
2421 } else {
2422 hw_dbg(hw, "RAR index %d is out of range.\n", rar);
2423 }
2424 return 0;
2425}
2426
2427/**
2428 * ixgbe_init_uta_tables_generic - Initialize the Unicast Table Array
2429 * @hw: pointer to hardware structure
2430 **/
2431s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw)
2432{
2433 int i;
2434
2435
2436 for (i = 0; i < 128; i++)
2437 IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0);
2438
2439 return 0;
2440}
2441
2442/**
2443 * ixgbe_find_vlvf_slot - find the vlanid or the first empty slot
2444 * @hw: pointer to hardware structure
2445 * @vlan: VLAN id to write to VLAN filter
2446 *
2447 * return the VLVF index where this VLAN id should be placed
2448 *
2449 **/
2450s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan)
2451{
2452 u32 bits = 0;
2453 u32 first_empty_slot = 0;
2454 s32 regindex;
2455
2456 /* short cut the special case */
2457 if (vlan == 0)
2458 return 0;
2459
2460 /*
2461 * Search for the vlan id in the VLVF entries. Save off the first empty
2462 * slot found along the way
2463 */
2464 for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) {
2465 bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex));
2466 if (!bits && !(first_empty_slot))
2467 first_empty_slot = regindex;
2468 else if ((bits & 0x0FFF) == vlan)
2469 break;
2470 }
2471
2472 /*
2473 * If regindex is less than IXGBE_VLVF_ENTRIES, then we found the vlan
2474 * in the VLVF. Else use the first empty VLVF register for this
2475 * vlan id.
2476 */
2477 if (regindex >= IXGBE_VLVF_ENTRIES) {
2478 if (first_empty_slot)
2479 regindex = first_empty_slot;
2480 else {
2481 hw_dbg(hw, "No space in VLVF.\n");
2482 regindex = IXGBE_ERR_NO_SPACE;
2483 }
2484 }
2485
2486 return regindex;
2487}
2488
2489/**
2490 * ixgbe_set_vfta_generic - Set VLAN filter table
2491 * @hw: pointer to hardware structure
2492 * @vlan: VLAN id to write to VLAN filter
2493 * @vind: VMDq output index that maps queue to VLAN id in VFVFB
2494 * @vlan_on: boolean flag to turn on/off VLAN in VFVF
2495 *
2496 * Turn on/off specified VLAN in the VLAN filter table.
2497 **/
2498s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
2499 bool vlan_on)
2500{
2501 s32 regindex;
2502 u32 bitindex;
2503 u32 vfta;
2504 u32 bits;
2505 u32 vt;
2506 u32 targetbit;
2507 bool vfta_changed = false;
2508
2509 if (vlan > 4095)
2510 return IXGBE_ERR_PARAM;
2511
2512 /*
2513 * this is a 2 part operation - first the VFTA, then the
2514 * VLVF and VLVFB if VT Mode is set
2515 * We don't write the VFTA until we know the VLVF part succeeded.
2516 */
2517
2518 /* Part 1
2519 * The VFTA is a bitstring made up of 128 32-bit registers
2520 * that enable the particular VLAN id, much like the MTA:
2521 * bits[11-5]: which register
2522 * bits[4-0]: which bit in the register
2523 */
2524 regindex = (vlan >> 5) & 0x7F;
2525 bitindex = vlan & 0x1F;
2526 targetbit = (1 << bitindex);
2527 vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
2528
2529 if (vlan_on) {
2530 if (!(vfta & targetbit)) {
2531 vfta |= targetbit;
2532 vfta_changed = true;
2533 }
2534 } else {
2535 if ((vfta & targetbit)) {
2536 vfta &= ~targetbit;
2537 vfta_changed = true;
2538 }
2539 }
2540
2541 /* Part 2
2542 * If VT Mode is set
2543 * Either vlan_on
2544 * make sure the vlan is in VLVF
2545 * set the vind bit in the matching VLVFB
2546 * Or !vlan_on
2547 * clear the pool bit and possibly the vind
2548 */
2549 vt = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
2550 if (vt & IXGBE_VT_CTL_VT_ENABLE) {
2551 s32 vlvf_index;
2552
2553 vlvf_index = ixgbe_find_vlvf_slot(hw, vlan);
2554 if (vlvf_index < 0)
2555 return vlvf_index;
2556
2557 if (vlan_on) {
2558 /* set the pool bit */
2559 if (vind < 32) {
2560 bits = IXGBE_READ_REG(hw,
2561 IXGBE_VLVFB(vlvf_index*2));
2562 bits |= (1 << vind);
2563 IXGBE_WRITE_REG(hw,
2564 IXGBE_VLVFB(vlvf_index*2),
2565 bits);
2566 } else {
2567 bits = IXGBE_READ_REG(hw,
2568 IXGBE_VLVFB((vlvf_index*2)+1));
2569 bits |= (1 << (vind-32));
2570 IXGBE_WRITE_REG(hw,
2571 IXGBE_VLVFB((vlvf_index*2)+1),
2572 bits);
2573 }
2574 } else {
2575 /* clear the pool bit */
2576 if (vind < 32) {
2577 bits = IXGBE_READ_REG(hw,
2578 IXGBE_VLVFB(vlvf_index*2));
2579 bits &= ~(1 << vind);
2580 IXGBE_WRITE_REG(hw,
2581 IXGBE_VLVFB(vlvf_index*2),
2582 bits);
2583 bits |= IXGBE_READ_REG(hw,
2584 IXGBE_VLVFB((vlvf_index*2)+1));
2585 } else {
2586 bits = IXGBE_READ_REG(hw,
2587 IXGBE_VLVFB((vlvf_index*2)+1));
2588 bits &= ~(1 << (vind-32));
2589 IXGBE_WRITE_REG(hw,
2590 IXGBE_VLVFB((vlvf_index*2)+1),
2591 bits);
2592 bits |= IXGBE_READ_REG(hw,
2593 IXGBE_VLVFB(vlvf_index*2));
2594 }
2595 }
2596
2597 /*
2598 * If there are still bits set in the VLVFB registers
2599 * for the VLAN ID indicated we need to see if the
2600 * caller is requesting that we clear the VFTA entry bit.
2601 * If the caller has requested that we clear the VFTA
2602 * entry bit but there are still pools/VFs using this VLAN
2603 * ID entry then ignore the request. We're not worried
2604 * about the case where we're turning the VFTA VLAN ID
2605 * entry bit on, only when requested to turn it off as
2606 * there may be multiple pools and/or VFs using the
2607 * VLAN ID entry. In that case we cannot clear the
2608 * VFTA bit until all pools/VFs using that VLAN ID have also
2609 * been cleared. This will be indicated by "bits" being
2610 * zero.
2611 */
2612 if (bits) {
2613 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index),
2614 (IXGBE_VLVF_VIEN | vlan));
2615 if (!vlan_on) {
2616 /* someone wants to clear the vfta entry
2617 * but some pools/VFs are still using it.
2618 * Ignore it. */
2619 vfta_changed = false;
2620 }
2621 }
2622 else
2623 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0);
2624 }
2625
2626 if (vfta_changed)
2627 IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), vfta);
2628
2629 return 0;
2630}
2631
2632/**
2633 * ixgbe_clear_vfta_generic - Clear VLAN filter table
2634 * @hw: pointer to hardware structure
2635 *
2636 * Clears the VLAN filer table, and the VMDq index associated with the filter
2637 **/
2638s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw)
2639{
2640 u32 offset;
2641
2642 for (offset = 0; offset < hw->mac.vft_size; offset++)
2643 IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
2644
2645 for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) {
2646 IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0);
2647 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset*2), 0);
2648 IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset*2)+1), 0);
2649 }
2650
2651 return 0;
2652}
2653
2654/**
2655 * ixgbe_check_mac_link_generic - Determine link and speed status
2656 * @hw: pointer to hardware structure
2657 * @speed: pointer to link speed
2658 * @link_up: true when link is up
2659 * @link_up_wait_to_complete: bool used to wait for link up or not
2660 *
2661 * Reads the links register to determine if link is up and the current speed
2662 **/
2663s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
2664 bool *link_up, bool link_up_wait_to_complete)
2665{
2666 u32 links_reg;
2667 u32 i;
2668
2669 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
2670 if (link_up_wait_to_complete) {
2671 for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
2672 if (links_reg & IXGBE_LINKS_UP) {
2673 *link_up = true;
2674 break;
2675 } else {
2676 *link_up = false;
2677 }
2678 msleep(100);
2679 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
2680 }
2681 } else {
2682 if (links_reg & IXGBE_LINKS_UP)
2683 *link_up = true;
2684 else
2685 *link_up = false;
2686 }
2687
2688 if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
2689 IXGBE_LINKS_SPEED_10G_82599)
2690 *speed = IXGBE_LINK_SPEED_10GB_FULL;
2691 else if ((links_reg & IXGBE_LINKS_SPEED_82599) ==
2692 IXGBE_LINKS_SPEED_1G_82599)
2693 *speed = IXGBE_LINK_SPEED_1GB_FULL;
2694 else
2695 *speed = IXGBE_LINK_SPEED_100_FULL;
2696
2697 /* if link is down, zero out the current_mode */
2698 if (*link_up == false) {
2699 hw->fc.current_mode = ixgbe_fc_none;
2700 hw->fc.fc_was_autonegged = false;
2701 }
2702
2703 return 0;
2704}
2705
2706/**
2707 * ixgbe_get_wwn_prefix_generic - Get alternative WWNN/WWPN prefix from
2708 * the EEPROM
2709 * @hw: pointer to hardware structure
2710 * @wwnn_prefix: the alternative WWNN prefix
2711 * @wwpn_prefix: the alternative WWPN prefix
2712 *
2713 * This function will read the EEPROM from the alternative SAN MAC address
2714 * block to check the support for the alternative WWNN/WWPN prefix support.
2715 **/
2716s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
2717 u16 *wwpn_prefix)
2718{
2719 u16 offset, caps;
2720 u16 alt_san_mac_blk_offset;
2721
2722 /* clear output first */
2723 *wwnn_prefix = 0xFFFF;
2724 *wwpn_prefix = 0xFFFF;
2725
2726 /* check if alternative SAN MAC is supported */
2727 hw->eeprom.ops.read(hw, IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR,
2728 &alt_san_mac_blk_offset);
2729
2730 if ((alt_san_mac_blk_offset == 0) ||
2731 (alt_san_mac_blk_offset == 0xFFFF))
2732 goto wwn_prefix_out;
2733
2734 /* check capability in alternative san mac address block */
2735 offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET;
2736 hw->eeprom.ops.read(hw, offset, &caps);
2737 if (!(caps & IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN))
2738 goto wwn_prefix_out;
2739
2740 /* get the corresponding prefix for WWNN/WWPN */
2741 offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET;
2742 hw->eeprom.ops.read(hw, offset, wwnn_prefix);
2743
2744 offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET;
2745 hw->eeprom.ops.read(hw, offset, wwpn_prefix);
2746
2747wwn_prefix_out:
2748 return 0;
2749}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 264eef575cd6..3080afb12bdf 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -30,6 +30,7 @@
30 30
31#include "ixgbe_type.h" 31#include "ixgbe_type.h"
32 32
33u32 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
33s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw); 34s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
34s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw); 35s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
35s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw); 36s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw);
@@ -45,12 +46,13 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
45 46
46s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw); 47s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
47s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data); 48s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
48s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data); 49s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data);
49s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, 50s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
50 u16 *data); 51 u16 *data);
51s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, 52s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw,
52 u16 *checksum_val); 53 u16 *checksum_val);
53s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw); 54s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw);
55s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg);
54 56
55s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, 57s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
56 u32 enable_addr); 58 u32 enable_addr);
@@ -70,9 +72,16 @@ s32 ixgbe_validate_mac_addr(u8 *mac_addr);
70s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); 72s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
71void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask); 73void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask);
72s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw); 74s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
73 75s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr);
74s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val); 76s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
75s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val); 77s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
78s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
79s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
80 u32 vind, bool vlan_on);
81s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw);
82s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw,
83 ixgbe_link_speed *speed,
84 bool *link_up, bool link_up_wait_to_complete);
76 85
77s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index); 86s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
78s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index); 87s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index dd4883f642be..71da325dfa80 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -488,7 +488,6 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
488 if (adapter->temp_dcb_cfg.pfc_mode_enable != 488 if (adapter->temp_dcb_cfg.pfc_mode_enable !=
489 adapter->dcb_cfg.pfc_mode_enable) 489 adapter->dcb_cfg.pfc_mode_enable)
490 adapter->dcb_set_bitmap |= BIT_PFC; 490 adapter->dcb_set_bitmap |= BIT_PFC;
491 return;
492} 491}
493 492
494/** 493/**
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index dc7fd5b70bc3..251767d9fe79 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -1493,8 +1493,6 @@ static void ixgbe_free_desc_rings(struct ixgbe_adapter *adapter)
1493 tx_ring->tx_buffer_info = NULL; 1493 tx_ring->tx_buffer_info = NULL;
1494 kfree(rx_ring->rx_buffer_info); 1494 kfree(rx_ring->rx_buffer_info);
1495 rx_ring->rx_buffer_info = NULL; 1495 rx_ring->rx_buffer_info = NULL;
1496
1497 return;
1498} 1496}
1499 1497
1500static int ixgbe_setup_desc_rings(struct ixgbe_adapter *adapter) 1498static int ixgbe_setup_desc_rings(struct ixgbe_adapter *adapter)
@@ -1973,8 +1971,6 @@ static void ixgbe_get_wol(struct net_device *netdev,
1973 wol->wolopts |= WAKE_BCAST; 1971 wol->wolopts |= WAKE_BCAST;
1974 if (adapter->wol & IXGBE_WUFC_MAG) 1972 if (adapter->wol & IXGBE_WUFC_MAG)
1975 wol->wolopts |= WAKE_MAGIC; 1973 wol->wolopts |= WAKE_MAGIC;
1976
1977 return;
1978} 1974}
1979 1975
1980static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1976static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index d1a1868df817..926ad8c2f2c7 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1160,6 +1160,7 @@ static inline struct sk_buff *ixgbe_transform_rsc_queue(struct sk_buff *skb,
1160 1160
1161struct ixgbe_rsc_cb { 1161struct ixgbe_rsc_cb {
1162 dma_addr_t dma; 1162 dma_addr_t dma;
1163 bool delay_unmap;
1163}; 1164};
1164 1165
1165#define IXGBE_RSC_CB(skb) ((struct ixgbe_rsc_cb *)(skb)->cb) 1166#define IXGBE_RSC_CB(skb) ((struct ixgbe_rsc_cb *)(skb)->cb)
@@ -1215,7 +1216,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1215 if (rx_buffer_info->dma) { 1216 if (rx_buffer_info->dma) {
1216 if ((adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) && 1217 if ((adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) &&
1217 (!(staterr & IXGBE_RXD_STAT_EOP)) && 1218 (!(staterr & IXGBE_RXD_STAT_EOP)) &&
1218 (!(skb->prev))) 1219 (!(skb->prev))) {
1219 /* 1220 /*
1220 * When HWRSC is enabled, delay unmapping 1221 * When HWRSC is enabled, delay unmapping
1221 * of the first packet. It carries the 1222 * of the first packet. It carries the
@@ -1223,12 +1224,14 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1223 * access the header after the writeback. 1224 * access the header after the writeback.
1224 * Only unmap it when EOP is reached 1225 * Only unmap it when EOP is reached
1225 */ 1226 */
1227 IXGBE_RSC_CB(skb)->delay_unmap = true;
1226 IXGBE_RSC_CB(skb)->dma = rx_buffer_info->dma; 1228 IXGBE_RSC_CB(skb)->dma = rx_buffer_info->dma;
1227 else 1229 } else {
1228 dma_unmap_single(&pdev->dev, 1230 dma_unmap_single(&pdev->dev,
1229 rx_buffer_info->dma, 1231 rx_buffer_info->dma,
1230 rx_ring->rx_buf_len, 1232 rx_ring->rx_buf_len,
1231 DMA_FROM_DEVICE); 1233 DMA_FROM_DEVICE);
1234 }
1232 rx_buffer_info->dma = 0; 1235 rx_buffer_info->dma = 0;
1233 skb_put(skb, len); 1236 skb_put(skb, len);
1234 } 1237 }
@@ -1276,12 +1279,13 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1276 if (skb->prev) 1279 if (skb->prev)
1277 skb = ixgbe_transform_rsc_queue(skb, &(rx_ring->rsc_count)); 1280 skb = ixgbe_transform_rsc_queue(skb, &(rx_ring->rsc_count));
1278 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 1281 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
1279 if (IXGBE_RSC_CB(skb)->dma) { 1282 if (IXGBE_RSC_CB(skb)->delay_unmap) {
1280 dma_unmap_single(&pdev->dev, 1283 dma_unmap_single(&pdev->dev,
1281 IXGBE_RSC_CB(skb)->dma, 1284 IXGBE_RSC_CB(skb)->dma,
1282 rx_ring->rx_buf_len, 1285 rx_ring->rx_buf_len,
1283 DMA_FROM_DEVICE); 1286 DMA_FROM_DEVICE);
1284 IXGBE_RSC_CB(skb)->dma = 0; 1287 IXGBE_RSC_CB(skb)->dma = 0;
1288 IXGBE_RSC_CB(skb)->delay_unmap = false;
1285 } 1289 }
1286 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) 1290 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)
1287 rx_ring->rsc_count += skb_shinfo(skb)->nr_frags; 1291 rx_ring->rsc_count += skb_shinfo(skb)->nr_frags;
@@ -1611,8 +1615,6 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector)
1611 1615
1612 ixgbe_write_eitr(q_vector); 1616 ixgbe_write_eitr(q_vector);
1613 } 1617 }
1614
1615 return;
1616} 1618}
1617 1619
1618static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) 1620static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
@@ -2176,8 +2178,6 @@ static void ixgbe_set_itr(struct ixgbe_adapter *adapter)
2176 2178
2177 ixgbe_write_eitr(q_vector); 2179 ixgbe_write_eitr(q_vector);
2178 } 2180 }
2179
2180 return;
2181} 2181}
2182 2182
2183/** 2183/**
@@ -2952,7 +2952,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
2952 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); 2952 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
2953 2953
2954 if (netdev->flags & IFF_PROMISC) { 2954 if (netdev->flags & IFF_PROMISC) {
2955 hw->addr_ctrl.user_set_promisc = 1; 2955 hw->addr_ctrl.user_set_promisc = true;
2956 fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); 2956 fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
2957 /* don't hardware filter vlans in promisc mode */ 2957 /* don't hardware filter vlans in promisc mode */
2958 ixgbe_vlan_filter_disable(adapter); 2958 ixgbe_vlan_filter_disable(adapter);
@@ -2960,11 +2960,11 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
2960 if (netdev->flags & IFF_ALLMULTI) { 2960 if (netdev->flags & IFF_ALLMULTI) {
2961 fctrl |= IXGBE_FCTRL_MPE; 2961 fctrl |= IXGBE_FCTRL_MPE;
2962 fctrl &= ~IXGBE_FCTRL_UPE; 2962 fctrl &= ~IXGBE_FCTRL_UPE;
2963 } else { 2963 } else if (!hw->addr_ctrl.uc_set_promisc) {
2964 fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); 2964 fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
2965 } 2965 }
2966 ixgbe_vlan_filter_enable(adapter); 2966 ixgbe_vlan_filter_enable(adapter);
2967 hw->addr_ctrl.user_set_promisc = 0; 2967 hw->addr_ctrl.user_set_promisc = false;
2968 } 2968 }
2969 2969
2970 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); 2970 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
@@ -3505,12 +3505,13 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
3505 rx_buffer_info->skb = NULL; 3505 rx_buffer_info->skb = NULL;
3506 do { 3506 do {
3507 struct sk_buff *this = skb; 3507 struct sk_buff *this = skb;
3508 if (IXGBE_RSC_CB(this)->dma) { 3508 if (IXGBE_RSC_CB(this)->delay_unmap) {
3509 dma_unmap_single(&pdev->dev, 3509 dma_unmap_single(&pdev->dev,
3510 IXGBE_RSC_CB(this)->dma, 3510 IXGBE_RSC_CB(this)->dma,
3511 rx_ring->rx_buf_len, 3511 rx_ring->rx_buf_len,
3512 DMA_FROM_DEVICE); 3512 DMA_FROM_DEVICE);
3513 IXGBE_RSC_CB(this)->dma = 0; 3513 IXGBE_RSC_CB(this)->dma = 0;
3514 IXGBE_RSC_CB(skb)->delay_unmap = false;
3514 } 3515 }
3515 skb = skb->prev; 3516 skb = skb->prev;
3516 dev_kfree_skb(this); 3517 dev_kfree_skb(this);
@@ -4461,7 +4462,6 @@ static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
4461 adapter->flags &= ~IXGBE_FLAG_MSI_ENABLED; 4462 adapter->flags &= ~IXGBE_FLAG_MSI_ENABLED;
4462 pci_disable_msi(adapter->pdev); 4463 pci_disable_msi(adapter->pdev);
4463 } 4464 }
4464 return;
4465} 4465}
4466 4466
4467/** 4467/**
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 4277cbbb8126..bd69196ff522 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -73,6 +73,7 @@
73/* NVM Registers */ 73/* NVM Registers */
74#define IXGBE_EEC 0x10010 74#define IXGBE_EEC 0x10010
75#define IXGBE_EERD 0x10014 75#define IXGBE_EERD 0x10014
76#define IXGBE_EEWR 0x10018
76#define IXGBE_FLA 0x1001C 77#define IXGBE_FLA 0x1001C
77#define IXGBE_EEMNGCTL 0x10110 78#define IXGBE_EEMNGCTL 0x10110
78#define IXGBE_EEMNGDATA 0x10114 79#define IXGBE_EEMNGDATA 0x10114
@@ -699,6 +700,7 @@
699#define IXGBE_MREVID 0x11064 700#define IXGBE_MREVID 0x11064
700#define IXGBE_DCA_ID 0x11070 701#define IXGBE_DCA_ID 0x11070
701#define IXGBE_DCA_CTRL 0x11074 702#define IXGBE_DCA_CTRL 0x11074
703#define IXGBE_SWFW_SYNC IXGBE_GSSR
702 704
703/* PCIe registers 82599-specific */ 705/* PCIe registers 82599-specific */
704#define IXGBE_GCR_EXT 0x11050 706#define IXGBE_GCR_EXT 0x11050
@@ -1463,8 +1465,9 @@
1463#define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ 1465#define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
1464#define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ 1466#define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
1465#define IXGBE_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ 1467#define IXGBE_SWSM_WMNG 0x00000004 /* Wake MNG Clock */
1468#define IXGBE_SWFW_REGSMP 0x80000000 /* Register Semaphore bit 31 */
1466 1469
1467/* GSSR definitions */ 1470/* SW_FW_SYNC/GSSR definitions */
1468#define IXGBE_GSSR_EEP_SM 0x0001 1471#define IXGBE_GSSR_EEP_SM 0x0001
1469#define IXGBE_GSSR_PHY0_SM 0x0002 1472#define IXGBE_GSSR_PHY0_SM 0x0002
1470#define IXGBE_GSSR_PHY1_SM 0x0004 1473#define IXGBE_GSSR_PHY1_SM 0x0004
@@ -1484,6 +1487,8 @@
1484#define IXGBE_EEC_GNT 0x00000080 /* EEPROM Access Grant */ 1487#define IXGBE_EEC_GNT 0x00000080 /* EEPROM Access Grant */
1485#define IXGBE_EEC_PRES 0x00000100 /* EEPROM Present */ 1488#define IXGBE_EEC_PRES 0x00000100 /* EEPROM Present */
1486#define IXGBE_EEC_ARD 0x00000200 /* EEPROM Auto Read Done */ 1489#define IXGBE_EEC_ARD 0x00000200 /* EEPROM Auto Read Done */
1490#define IXGBE_EEC_FLUP 0x00800000 /* Flash update command */
1491#define IXGBE_EEC_FLUDONE 0x04000000 /* Flash update done */
1487/* EEPROM Addressing bits based on type (0-small, 1-large) */ 1492/* EEPROM Addressing bits based on type (0-small, 1-large) */
1488#define IXGBE_EEC_ADDR_SIZE 0x00000400 1493#define IXGBE_EEC_ADDR_SIZE 0x00000400
1489#define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ 1494#define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */
@@ -1539,10 +1544,12 @@
1539#define IXGBE_EEPROM_ERASE256_OPCODE_SPI 0xDB /* EEPROM ERASE 256B */ 1544#define IXGBE_EEPROM_ERASE256_OPCODE_SPI 0xDB /* EEPROM ERASE 256B */
1540 1545
1541/* EEPROM Read Register */ 1546/* EEPROM Read Register */
1542#define IXGBE_EEPROM_READ_REG_DATA 16 /* data offset in EEPROM read reg */ 1547#define IXGBE_EEPROM_RW_REG_DATA 16 /* data offset in EEPROM read reg */
1543#define IXGBE_EEPROM_READ_REG_DONE 2 /* Offset to READ done bit */ 1548#define IXGBE_EEPROM_RW_REG_DONE 2 /* Offset to READ done bit */
1544#define IXGBE_EEPROM_READ_REG_START 1 /* First bit to start operation */ 1549#define IXGBE_EEPROM_RW_REG_START 1 /* First bit to start operation */
1545#define IXGBE_EEPROM_READ_ADDR_SHIFT 2 /* Shift to the address bits */ 1550#define IXGBE_EEPROM_RW_ADDR_SHIFT 2 /* Shift to the address bits */
1551#define IXGBE_NVM_POLL_WRITE 1 /* Flag for polling for write complete */
1552#define IXGBE_NVM_POLL_READ 0 /* Flag for polling for read complete */
1546 1553
1547#define IXGBE_ETH_LENGTH_OF_ADDRESS 6 1554#define IXGBE_ETH_LENGTH_OF_ADDRESS 6
1548 1555
@@ -1550,9 +1557,15 @@
1550#define IXGBE_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ 1557#define IXGBE_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */
1551#endif 1558#endif
1552 1559
1553#ifndef IXGBE_EERD_ATTEMPTS 1560#ifndef IXGBE_EERD_EEWR_ATTEMPTS
1554/* Number of 5 microseconds we wait for EERD read to complete */ 1561/* Number of 5 microseconds we wait for EERD read and
1555#define IXGBE_EERD_ATTEMPTS 100000 1562 * EERW write to complete */
1563#define IXGBE_EERD_EEWR_ATTEMPTS 100000
1564#endif
1565
1566#ifndef IXGBE_FLUDONE_ATTEMPTS
1567/* # attempts we wait for flush update to complete */
1568#define IXGBE_FLUDONE_ATTEMPTS 20000
1556#endif 1569#endif
1557 1570
1558#define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0 1571#define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0
@@ -2268,6 +2281,7 @@ struct ixgbe_addr_filter_info {
2268 u32 mc_addr_in_rar_count; 2281 u32 mc_addr_in_rar_count;
2269 u32 mta_in_use; 2282 u32 mta_in_use;
2270 u32 overflow_promisc; 2283 u32 overflow_promisc;
2284 bool uc_set_promisc;
2271 bool user_set_promisc; 2285 bool user_set_promisc;
2272}; 2286};
2273 2287
@@ -2475,6 +2489,7 @@ struct ixgbe_mac_info {
2475 u32 mcft_size; 2489 u32 mcft_size;
2476 u32 vft_size; 2490 u32 vft_size;
2477 u32 num_rar_entries; 2491 u32 num_rar_entries;
2492 u32 rar_highwater;
2478 u32 max_tx_queues; 2493 u32 max_tx_queues;
2479 u32 max_rx_queues; 2494 u32 max_rx_queues;
2480 u32 max_msix_vectors; 2495 u32 max_msix_vectors;
@@ -2581,8 +2596,10 @@ struct ixgbe_info {
2581#define IXGBE_ERR_SFP_NOT_SUPPORTED -19 2596#define IXGBE_ERR_SFP_NOT_SUPPORTED -19
2582#define IXGBE_ERR_SFP_NOT_PRESENT -20 2597#define IXGBE_ERR_SFP_NOT_PRESENT -20
2583#define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 2598#define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21
2599#define IXGBE_ERR_NO_SAN_ADDR_PTR -22
2584#define IXGBE_ERR_FDIR_REINIT_FAILED -23 2600#define IXGBE_ERR_FDIR_REINIT_FAILED -23
2585#define IXGBE_ERR_EEPROM_VERSION -24 2601#define IXGBE_ERR_EEPROM_VERSION -24
2602#define IXGBE_ERR_NO_SPACE -25
2586#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF 2603#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
2587 2604
2588#endif /* _IXGBE_TYPE_H_ */ 2605#endif /* _IXGBE_TYPE_H_ */
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index 460c37fee965..a16cff7e54a3 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -946,8 +946,6 @@ static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector)
946 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr); 946 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr);
947 ixgbevf_write_eitr(adapter, v_idx, itr_reg); 947 ixgbevf_write_eitr(adapter, v_idx, itr_reg);
948 } 948 }
949
950 return;
951} 949}
952 950
953static irqreturn_t ixgbevf_msix_mbx(int irq, void *data) 951static irqreturn_t ixgbevf_msix_mbx(int irq, void *data)
@@ -2151,8 +2149,6 @@ static void ixgbevf_reset_interrupt_capability(struct ixgbevf_adapter *adapter)
2151 pci_disable_msix(adapter->pdev); 2149 pci_disable_msix(adapter->pdev);
2152 kfree(adapter->msix_entries); 2150 kfree(adapter->msix_entries);
2153 adapter->msix_entries = NULL; 2151 adapter->msix_entries = NULL;
2154
2155 return;
2156} 2152}
2157 2153
2158/** 2154/**
@@ -3184,8 +3180,6 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3184 ixgbevf_tx_map(adapter, tx_ring, skb, tx_flags, first), 3180 ixgbevf_tx_map(adapter, tx_ring, skb, tx_flags, first),
3185 skb->len, hdr_len); 3181 skb->len, hdr_len);
3186 3182
3187 netdev->trans_start = jiffies;
3188
3189 ixgbevf_maybe_stop_tx(netdev, tx_ring, DESC_NEEDED); 3183 ixgbevf_maybe_stop_tx(netdev, tx_ring, DESC_NEEDED);
3190 3184
3191 return NETDEV_TX_OK; 3185 return NETDEV_TX_OK;
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index d5932ca3e27d..78ddd8b79e7e 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -64,8 +64,6 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev)
64 ixp2000_reg_write(RING_TX_PENDING, 64 ixp2000_reg_write(RING_TX_PENDING,
65 TX_BUF_DESC_BASE + (entry * sizeof(struct ixpdev_tx_desc))); 65 TX_BUF_DESC_BASE + (entry * sizeof(struct ixpdev_tx_desc)));
66 66
67 dev->trans_start = jiffies;
68
69 local_irq_save(flags); 67 local_irq_save(flags);
70 ip->tx_queue_entries++; 68 ip->tx_queue_entries++;
71 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) 69 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 4e868eeac89e..4a090650b5aa 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -103,8 +103,6 @@ jme_mdio_write(struct net_device *netdev,
103 103
104 if (i == 0) 104 if (i == 0)
105 jeprintk(jme->pdev, "phy(%d) write timeout : %d\n", phy, reg); 105 jeprintk(jme->pdev, "phy(%d) write timeout : %d\n", phy, reg);
106
107 return;
108} 106}
109 107
110static inline void 108static inline void
@@ -130,8 +128,6 @@ jme_reset_phy_processor(struct jme_adapter *jme)
130 jme_mdio_write(jme->dev, 128 jme_mdio_write(jme->dev,
131 jme->mii_if.phy_id, 129 jme->mii_if.phy_id,
132 MII_BMCR, val | BMCR_RESET); 130 MII_BMCR, val | BMCR_RESET);
133
134 return;
135} 131}
136 132
137static void 133static void
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 7b9447646f8a..21f8adaa87c1 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -945,7 +945,7 @@ static void lance_tx_timeout (struct net_device *dev)
945#endif 945#endif
946 lance_restart (dev, 0x0043, 1); 946 lance_restart (dev, 0x0043, 1);
947 947
948 dev->trans_start = jiffies; 948 dev->trans_start = jiffies; /* prevent tx timeout */
949 netif_wake_queue (dev); 949 netif_wake_queue (dev);
950} 950}
951 951
@@ -1011,8 +1011,6 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
1011 outw(0x0000, ioaddr+LANCE_ADDR); 1011 outw(0x0000, ioaddr+LANCE_ADDR);
1012 outw(0x0048, ioaddr+LANCE_DATA); 1012 outw(0x0048, ioaddr+LANCE_DATA);
1013 1013
1014 dev->trans_start = jiffies;
1015
1016 if ((lp->cur_tx - lp->dirty_tx) >= TX_RING_SIZE) 1014 if ((lp->cur_tx - lp->dirty_tx) >= TX_RING_SIZE)
1017 netif_stop_queue(dev); 1015 netif_stop_queue(dev);
1018 1016
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index 61c38ab4c247..de856d8abc90 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -963,7 +963,7 @@ static void i596_tx_timeout (struct net_device *dev)
963 lp->last_restart = dev->stats.tx_packets; 963 lp->last_restart = dev->stats.tx_packets;
964 } 964 }
965 965
966 dev->trans_start = jiffies; 966 dev->trans_start = jiffies; /* prevent tx timeout */
967 netif_wake_queue (dev); 967 netif_wake_queue (dev);
968} 968}
969 969
@@ -974,7 +974,6 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
974 struct tx_cmd *tx_cmd; 974 struct tx_cmd *tx_cmd;
975 struct i596_tbd *tbd; 975 struct i596_tbd *tbd;
976 short length = skb->len; 976 short length = skb->len;
977 dev->trans_start = jiffies;
978 977
979 DEB(DEB_STARTTX, printk(KERN_DEBUG 978 DEB(DEB_STARTTX, printk(KERN_DEBUG
980 "%s: i596_start_xmit(%x,%p) called\n", 979 "%s: i596_start_xmit(%x,%p) called\n",
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c
index 770b606a9e3a..316bb70775b1 100644
--- a/drivers/net/lib8390.c
+++ b/drivers/net/lib8390.c
@@ -257,7 +257,7 @@ static void __ei_tx_timeout(struct net_device *dev)
257{ 257{
258 unsigned long e8390_base = dev->base_addr; 258 unsigned long e8390_base = dev->base_addr;
259 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 259 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
260 int txsr, isr, tickssofar = jiffies - dev->trans_start; 260 int txsr, isr, tickssofar = jiffies - dev_trans_start(dev);
261 unsigned long flags; 261 unsigned long flags;
262 262
263 dev->stats.tx_errors++; 263 dev->stats.tx_errors++;
@@ -386,7 +386,6 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
386 { 386 {
387 ei_local->txing = 1; 387 ei_local->txing = 1;
388 NS8390_trigger_send(dev, send_length, output_page); 388 NS8390_trigger_send(dev, send_length, output_page);
389 dev->trans_start = jiffies;
390 if (output_page == ei_local->tx_start_page) 389 if (output_page == ei_local->tx_start_page)
391 { 390 {
392 ei_local->tx1 = -1; 391 ei_local->tx1 = -1;
@@ -792,7 +791,6 @@ static void ei_receive(struct net_device *dev)
792 /* We used to also ack ENISR_OVER here, but that would sometimes mask 791 /* We used to also ack ENISR_OVER here, but that would sometimes mask
793 a real overrun, leaving the 8390 in a stopped state with rec'vr off. */ 792 a real overrun, leaving the 8390 in a stopped state with rec'vr off. */
794 ei_outb_p(ENISR_RX+ENISR_RX_ERR, e8390_base+EN0_ISR); 793 ei_outb_p(ENISR_RX+ENISR_RX_ERR, e8390_base+EN0_ISR);
795 return;
796} 794}
797 795
798/** 796/**
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index 78c9a2e6e51e..b59b24d667f0 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -527,7 +527,7 @@ static void temac_device_reset(struct net_device *ndev)
527 dev_err(&ndev->dev, "Error setting TEMAC options\n"); 527 dev_err(&ndev->dev, "Error setting TEMAC options\n");
528 528
529 /* Init Driver variable */ 529 /* Init Driver variable */
530 ndev->trans_start = 0; 530 ndev->trans_start = jiffies; /* prevent tx timeout */
531} 531}
532 532
533void temac_adjust_link(struct net_device *ndev) 533void temac_adjust_link(struct net_device *ndev)
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c
index 41cbaaef0654..8a1097cf8a83 100644
--- a/drivers/net/lne390.c
+++ b/drivers/net/lne390.c
@@ -307,8 +307,6 @@ static void lne390_reset_8390(struct net_device *dev)
307 ei_status.txing = 0; 307 ei_status.txing = 0;
308 outb(0x01, ioaddr + LNE390_RESET_PORT); 308 outb(0x01, ioaddr + LNE390_RESET_PORT);
309 if (ei_debug > 1) printk("reset done\n"); 309 if (ei_debug > 1) printk("reset done\n");
310
311 return;
312} 310}
313 311
314/* 312/*
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index 72379c5439dc..3df046a58b1d 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -875,8 +875,6 @@ static netdev_tx_t i596_start_xmit (struct sk_buff *skb, struct net_device *dev)
875 length = ETH_ZLEN; 875 length = ETH_ZLEN;
876 } 876 }
877 877
878 dev->trans_start = jiffies;
879
880 tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC); 878 tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC);
881 if (tx_cmd == NULL) { 879 if (tx_cmd == NULL) {
882 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name); 880 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name);
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c
index c8e68fde0664..1136c9a22b67 100644
--- a/drivers/net/mac8390.c
+++ b/drivers/net/mac8390.c
@@ -661,7 +661,6 @@ static void mac8390_no_reset(struct net_device *dev)
661 ei_status.txing = 0; 661 ei_status.txing = 0;
662 if (ei_debug > 1) 662 if (ei_debug > 1)
663 pr_info("reset not supported\n"); 663 pr_info("reset not supported\n");
664 return;
665} 664}
666 665
667static void interlan_reset(struct net_device *dev) 666static void interlan_reset(struct net_device *dev)
@@ -673,7 +672,6 @@ static void interlan_reset(struct net_device *dev)
673 target[0xC0000] = 0; 672 target[0xC0000] = 0;
674 if (ei_debug > 1) 673 if (ei_debug > 1)
675 pr_cont("reset complete\n"); 674 pr_cont("reset complete\n");
676 return;
677} 675}
678 676
679/* dayna_memcpy_fromio/dayna_memcpy_toio */ 677/* dayna_memcpy_fromio/dayna_memcpy_toio */
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index c0876e915eed..69fa4ef64dd2 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -408,7 +408,6 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
408 skb->len+1); 408 skb->len+1);
409 409
410 local_irq_restore(flags); 410 local_irq_restore(flags);
411 dev->trans_start = jiffies;
412 dev_kfree_skb (skb); 411 dev_kfree_skb (skb);
413 412
414 return NETDEV_TX_OK; 413 return NETDEV_TX_OK;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index cf7debc865b3..40797fbdca9f 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -666,8 +666,6 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
666 666
667 spin_unlock_irqrestore(&bp->lock, flags); 667 spin_unlock_irqrestore(&bp->lock, flags);
668 668
669 dev->trans_start = jiffies;
670
671 return NETDEV_TX_OK; 669 return NETDEV_TX_OK;
672} 670}
673 671
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index a6e19fc8a80a..c685a4656878 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -488,7 +488,6 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
488 488
489 dev_kfree_skb(skb); 489 dev_kfree_skb(skb);
490 490
491 dev->trans_start = jiffies;
492 return NETDEV_TX_OK; 491 return NETDEV_TX_OK;
493} 492}
494 493
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index 9f72cb45f4af..42e3294671d7 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -746,10 +746,8 @@ static void meth_tx_timeout(struct net_device *dev)
746 /* Enable interrupt */ 746 /* Enable interrupt */
747 spin_unlock_irqrestore(&priv->meth_lock, flags); 747 spin_unlock_irqrestore(&priv->meth_lock, flags);
748 748
749 dev->trans_start = jiffies; 749 dev->trans_start = jiffies; /* prevent tx timeout */
750 netif_wake_queue(dev); 750 netif_wake_queue(dev);
751
752 return;
753} 751}
754 752
755/* 753/*
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
index 86467b444ac6..d5afd037cd7d 100644
--- a/drivers/net/mlx4/en_ethtool.c
+++ b/drivers/net/mlx4/en_ethtool.c
@@ -140,8 +140,6 @@ static void mlx4_en_get_wol(struct net_device *netdev,
140{ 140{
141 wol->supported = 0; 141 wol->supported = 0;
142 wol->wolopts = 0; 142 wol->wolopts = 0;
143
144 return;
145} 143}
146 144
147static int mlx4_en_get_sset_count(struct net_device *dev, int sset) 145static int mlx4_en_get_sset_count(struct net_device *dev, int sset)
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 4ee9d04f6599..1f724e53c728 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -882,7 +882,6 @@ static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
882 882
883 txq->tx_bytes += skb->len; 883 txq->tx_bytes += skb->len;
884 txq->tx_packets++; 884 txq->tx_packets++;
885 dev->trans_start = jiffies;
886 885
887 entries_left = txq->tx_ring_size - txq->tx_desc_count; 886 entries_left = txq->tx_ring_size - txq->tx_desc_count;
888 if (entries_left < MAX_SKB_FRAGS + 1) 887 if (entries_left < MAX_SKB_FRAGS + 1)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 9250bf6573ec..2a17b503feaa 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1905,7 +1905,7 @@ static void ns_tx_timeout(struct net_device *dev)
1905 spin_unlock_irq(&np->lock); 1905 spin_unlock_irq(&np->lock);
1906 enable_irq(dev->irq); 1906 enable_irq(dev->irq);
1907 1907
1908 dev->trans_start = jiffies; 1908 dev->trans_start = jiffies; /* prevent tx timeout */
1909 np->stats.tx_errors++; 1909 np->stats.tx_errors++;
1910 netif_wake_queue(dev); 1910 netif_wake_queue(dev);
1911} 1911}
@@ -2119,8 +2119,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
2119 } 2119 }
2120 spin_unlock_irqrestore(&np->lock, flags); 2120 spin_unlock_irqrestore(&np->lock, flags);
2121 2121
2122 dev->trans_start = jiffies;
2123
2124 if (netif_msg_tx_queued(np)) { 2122 if (netif_msg_tx_queued(np)) {
2125 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", 2123 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
2126 dev->name, np->cur_tx, entry); 2124 dev->name, np->cur_tx, entry);
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index 7bd6662d5b04..e0b0ef11f110 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -608,7 +608,6 @@ retry:
608 608
609 outb_p(ENISR_RDC, NE_BASE + EN0_ISR); /* Ack intr. */ 609 outb_p(ENISR_RDC, NE_BASE + EN0_ISR); /* Ack intr. */
610 ei_status.dmaing &= ~0x01; 610 ei_status.dmaing &= ~0x01;
611 return;
612} 611}
613 612
614 613
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index f4347f88b6f2..b8e2923a1d69 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -785,7 +785,6 @@ retry:
785 785
786 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ 786 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
787 ei_status.dmaing &= ~0x01; 787 ei_status.dmaing &= ~0x01;
788 return;
789} 788}
790 789
791static int __init ne_drv_probe(struct platform_device *pdev) 790static int __init ne_drv_probe(struct platform_device *pdev)
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index ff3c4c814988..70cdc6996342 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -730,7 +730,6 @@ retry:
730 730
731 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ 731 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
732 ei_status.dmaing &= ~0x01; 732 ei_status.dmaing &= ~0x01;
733 return;
734} 733}
735 734
736 735
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index 85aec4f10131..3c333cb5d34e 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -631,7 +631,6 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
631 631
632 outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ 632 outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
633 ei_status.dmaing &= ~0x01; 633 ei_status.dmaing &= ~0x01;
634 return;
635} 634}
636 635
637static void ne2k_pci_get_drvinfo(struct net_device *dev, 636static void ne2k_pci_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c
index a00bbfb9aed0..243ed2aee88e 100644
--- a/drivers/net/ne3210.c
+++ b/drivers/net/ne3210.c
@@ -255,8 +255,6 @@ static void ne3210_reset_8390(struct net_device *dev)
255 ei_status.txing = 0; 255 ei_status.txing = 0;
256 outb(0x01, ioaddr + NE3210_RESET_PORT); 256 outb(0x01, ioaddr + NE3210_RESET_PORT);
257 if (ei_debug > 1) printk("reset done\n"); 257 if (ei_debug > 1) printk("reset done\n");
258
259 return;
260} 258}
261 259
262/* 260/*
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index 64770298c4f7..2e4b42175f3f 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -126,7 +126,6 @@ netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
126 FIFO_PTR_FRAMENO(1) | 126 FIFO_PTR_FRAMENO(1) |
127 FIFO_PTR_FRAMELEN(len)); 127 FIFO_PTR_FRAMELEN(len));
128 128
129 ndev->trans_start = jiffies;
130 ndev->stats.tx_packets++; 129 ndev->stats.tx_packets++;
131 ndev->stats.tx_bytes += skb->len; 130 ndev->stats.tx_bytes += skb->len;
132 131
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 174ac8ef82fa..ffa1b9ce1cc5 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -95,6 +95,9 @@
95#define ADDR_IN_WINDOW1(off) \ 95#define ADDR_IN_WINDOW1(off) \
96 ((off > NETXEN_CRB_PCIX_HOST2) && (off < NETXEN_CRB_MAX)) ? 1 : 0 96 ((off > NETXEN_CRB_PCIX_HOST2) && (off < NETXEN_CRB_MAX)) ? 1 : 0
97 97
98#define ADDR_IN_RANGE(addr, low, high) \
99 (((addr) < (high)) && ((addr) >= (low)))
100
98/* 101/*
99 * normalize a 64MB crb address to 32MB PCI window 102 * normalize a 64MB crb address to 32MB PCI window
100 * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 103 * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
@@ -1352,6 +1355,8 @@ int netxen_config_rss(struct netxen_adapter *adapter, int enable);
1352int netxen_config_ipaddr(struct netxen_adapter *adapter, u32 ip, int cmd); 1355int netxen_config_ipaddr(struct netxen_adapter *adapter, u32 ip, int cmd);
1353int netxen_linkevent_request(struct netxen_adapter *adapter, int enable); 1356int netxen_linkevent_request(struct netxen_adapter *adapter, int enable);
1354void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup); 1357void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup);
1358void netxen_pci_camqm_read_2M(struct netxen_adapter *, u64, u64 *);
1359void netxen_pci_camqm_write_2M(struct netxen_adapter *, u64, u64);
1355 1360
1356int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); 1361int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu);
1357int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); 1362int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index aecba787f7c8..20f7c58bd092 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -632,6 +632,9 @@ static int netxen_nic_reg_test(struct net_device *dev)
632 if ((data_read & 0xffff) != adapter->pdev->vendor) 632 if ((data_read & 0xffff) != adapter->pdev->vendor)
633 return 1; 633 return 1;
634 634
635 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
636 return 0;
637
635 data_written = (u32)0xa5a5a5a5; 638 data_written = (u32)0xa5a5a5a5;
636 639
637 NXWR32(adapter, CRB_SCRATCHPAD_TEST, data_written); 640 NXWR32(adapter, CRB_SCRATCHPAD_TEST, data_written);
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 622e4c8be937..d8bd73d7e296 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -681,14 +681,8 @@ enum {
681#define MIU_TEST_AGT_ADDR_HI (0x08) 681#define MIU_TEST_AGT_ADDR_HI (0x08)
682#define MIU_TEST_AGT_WRDATA_LO (0x10) 682#define MIU_TEST_AGT_WRDATA_LO (0x10)
683#define MIU_TEST_AGT_WRDATA_HI (0x14) 683#define MIU_TEST_AGT_WRDATA_HI (0x14)
684#define MIU_TEST_AGT_WRDATA_UPPER_LO (0x20)
685#define MIU_TEST_AGT_WRDATA_UPPER_HI (0x24)
686#define MIU_TEST_AGT_WRDATA(i) (0x10+(0x10*((i)>>1))+(4*((i)&1)))
687#define MIU_TEST_AGT_RDDATA_LO (0x18) 684#define MIU_TEST_AGT_RDDATA_LO (0x18)
688#define MIU_TEST_AGT_RDDATA_HI (0x1c) 685#define MIU_TEST_AGT_RDDATA_HI (0x1c)
689#define MIU_TEST_AGT_RDDATA_UPPER_LO (0x28)
690#define MIU_TEST_AGT_RDDATA_UPPER_HI (0x2c)
691#define MIU_TEST_AGT_RDDATA(i) (0x18+(0x10*((i)>>1))+(4*((i)&1)))
692 686
693#define MIU_TEST_AGT_ADDR_MASK 0xfffffff8 687#define MIU_TEST_AGT_ADDR_MASK 0xfffffff8
694#define MIU_TEST_AGT_UPPER_ADDR(off) (0) 688#define MIU_TEST_AGT_UPPER_ADDR(off) (0)
@@ -789,9 +783,7 @@ enum {
789 * for backward compability 783 * for backward compability
790 */ 784 */
791#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8) 785#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
792#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
793#define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270) 786#define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270)
794#define CRB_NIC_MSI_MODE_FW NETXEN_NIC_REG(0x274)
795 787
796#define INTR_SCHEME_PERPORT 0x1 788#define INTR_SCHEME_PERPORT 0x1
797#define MSI_MODE_MULTIFUNC 0x1 789#define MSI_MODE_MULTIFUNC 0x1
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 5e5fe2fd6397..5c496f8d7c49 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -32,7 +32,6 @@
32#define MASK(n) ((1ULL<<(n))-1) 32#define MASK(n) ((1ULL<<(n))-1)
33#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) 33#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff))
34#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) 34#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff))
35#define OCM_WIN_P3P(addr) (addr & 0xffc0000)
36#define MS_WIN(addr) (addr & 0x0ffc0000) 35#define MS_WIN(addr) (addr & 0x0ffc0000)
37 36
38#define GET_MEM_OFFS_2M(addr) (addr & MASK(18)) 37#define GET_MEM_OFFS_2M(addr) (addr & MASK(18))
@@ -63,9 +62,6 @@ static inline void writeq(u64 val, void __iomem *addr)
63} 62}
64#endif 63#endif
65 64
66#define ADDR_IN_RANGE(addr, low, high) \
67 (((addr) < (high)) && ((addr) >= (low)))
68
69#define PCI_OFFSET_FIRST_RANGE(adapter, off) \ 65#define PCI_OFFSET_FIRST_RANGE(adapter, off) \
70 ((adapter)->ahw.pci_base0 + (off)) 66 ((adapter)->ahw.pci_base0 + (off))
71#define PCI_OFFSET_SECOND_RANGE(adapter, off) \ 67#define PCI_OFFSET_SECOND_RANGE(adapter, off) \
@@ -1391,18 +1387,8 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
1391 u64 addr, u32 *start) 1387 u64 addr, u32 *start)
1392{ 1388{
1393 u32 window; 1389 u32 window;
1394 struct pci_dev *pdev = adapter->pdev;
1395 1390
1396 if ((addr & 0x00ff800) == 0xff800) { 1391 window = OCM_WIN(addr);
1397 if (printk_ratelimit())
1398 dev_warn(&pdev->dev, "QM access not handled\n");
1399 return -EIO;
1400 }
1401
1402 if (NX_IS_REVISION_P3P(adapter->ahw.revision_id))
1403 window = OCM_WIN_P3P(addr);
1404 else
1405 window = OCM_WIN(addr);
1406 1392
1407 writel(window, adapter->ahw.ocm_win_crb); 1393 writel(window, adapter->ahw.ocm_win_crb);
1408 /* read back to flush */ 1394 /* read back to flush */
@@ -1419,7 +1405,7 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
1419{ 1405{
1420 void __iomem *addr, *mem_ptr = NULL; 1406 void __iomem *addr, *mem_ptr = NULL;
1421 resource_size_t mem_base; 1407 resource_size_t mem_base;
1422 int ret = -EIO; 1408 int ret;
1423 u32 start; 1409 u32 start;
1424 1410
1425 spin_lock(&adapter->ahw.mem_lock); 1411 spin_lock(&adapter->ahw.mem_lock);
@@ -1428,20 +1414,23 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
1428 if (ret != 0) 1414 if (ret != 0)
1429 goto unlock; 1415 goto unlock;
1430 1416
1431 addr = pci_base_offset(adapter, start); 1417 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
1432 if (addr) 1418 addr = adapter->ahw.pci_base0 + start;
1433 goto noremap; 1419 } else {
1434 1420 addr = pci_base_offset(adapter, start);
1435 mem_base = pci_resource_start(adapter->pdev, 0) + (start & PAGE_MASK); 1421 if (addr)
1422 goto noremap;
1423
1424 mem_base = pci_resource_start(adapter->pdev, 0) +
1425 (start & PAGE_MASK);
1426 mem_ptr = ioremap(mem_base, PAGE_SIZE);
1427 if (mem_ptr == NULL) {
1428 ret = -EIO;
1429 goto unlock;
1430 }
1436 1431
1437 mem_ptr = ioremap(mem_base, PAGE_SIZE); 1432 addr = mem_ptr + (start & (PAGE_SIZE-1));
1438 if (mem_ptr == NULL) {
1439 ret = -EIO;
1440 goto unlock;
1441 } 1433 }
1442
1443 addr = mem_ptr + (start & (PAGE_SIZE - 1));
1444
1445noremap: 1434noremap:
1446 if (op == 0) /* read */ 1435 if (op == 0) /* read */
1447 *data = readq(addr); 1436 *data = readq(addr);
@@ -1456,6 +1445,28 @@ unlock:
1456 return ret; 1445 return ret;
1457} 1446}
1458 1447
1448void
1449netxen_pci_camqm_read_2M(struct netxen_adapter *adapter, u64 off, u64 *data)
1450{
1451 void __iomem *addr = adapter->ahw.pci_base0 +
1452 NETXEN_PCI_CAMQM_2M_BASE + (off - NETXEN_PCI_CAMQM);
1453
1454 spin_lock(&adapter->ahw.mem_lock);
1455 *data = readq(addr);
1456 spin_unlock(&adapter->ahw.mem_lock);
1457}
1458
1459void
1460netxen_pci_camqm_write_2M(struct netxen_adapter *adapter, u64 off, u64 data)
1461{
1462 void __iomem *addr = adapter->ahw.pci_base0 +
1463 NETXEN_PCI_CAMQM_2M_BASE + (off - NETXEN_PCI_CAMQM);
1464
1465 spin_lock(&adapter->ahw.mem_lock);
1466 writeq(data, addr);
1467 spin_unlock(&adapter->ahw.mem_lock);
1468}
1469
1459#define MAX_CTL_CHECK 1000 1470#define MAX_CTL_CHECK 1000
1460 1471
1461static int 1472static int
@@ -1621,9 +1632,8 @@ static int
1621netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, 1632netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter,
1622 u64 off, u64 data) 1633 u64 off, u64 data)
1623{ 1634{
1624 int i, j, ret; 1635 int j, ret;
1625 u32 temp, off8; 1636 u32 temp, off8;
1626 u64 stride;
1627 void __iomem *mem_crb; 1637 void __iomem *mem_crb;
1628 1638
1629 /* Only 64-bit aligned access */ 1639 /* Only 64-bit aligned access */
@@ -1650,44 +1660,17 @@ netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter,
1650 return -EIO; 1660 return -EIO;
1651 1661
1652correct: 1662correct:
1653 stride = NX_IS_REVISION_P3P(adapter->ahw.revision_id) ? 16 : 8; 1663 off8 = off & 0xfffffff8;
1654
1655 off8 = off & ~(stride-1);
1656 1664
1657 spin_lock(&adapter->ahw.mem_lock); 1665 spin_lock(&adapter->ahw.mem_lock);
1658 1666
1659 writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); 1667 writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO));
1660 writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); 1668 writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI));
1661 1669
1662 i = 0;
1663 if (stride == 16) {
1664 writel(TA_CTL_ENABLE, (mem_crb + TEST_AGT_CTRL));
1665 writel((TA_CTL_START | TA_CTL_ENABLE),
1666 (mem_crb + TEST_AGT_CTRL));
1667
1668 for (j = 0; j < MAX_CTL_CHECK; j++) {
1669 temp = readl(mem_crb + TEST_AGT_CTRL);
1670 if ((temp & TA_CTL_BUSY) == 0)
1671 break;
1672 }
1673
1674 if (j >= MAX_CTL_CHECK) {
1675 ret = -EIO;
1676 goto done;
1677 }
1678
1679 i = (off & 0xf) ? 0 : 2;
1680 writel(readl(mem_crb + MIU_TEST_AGT_RDDATA(i)),
1681 mem_crb + MIU_TEST_AGT_WRDATA(i));
1682 writel(readl(mem_crb + MIU_TEST_AGT_RDDATA(i+1)),
1683 mem_crb + MIU_TEST_AGT_WRDATA(i+1));
1684 i = (off & 0xf) ? 2 : 0;
1685 }
1686
1687 writel(data & 0xffffffff, 1670 writel(data & 0xffffffff,
1688 mem_crb + MIU_TEST_AGT_WRDATA(i)); 1671 mem_crb + MIU_TEST_AGT_WRDATA_LO);
1689 writel((data >> 32) & 0xffffffff, 1672 writel((data >> 32) & 0xffffffff,
1690 mem_crb + MIU_TEST_AGT_WRDATA(i+1)); 1673 mem_crb + MIU_TEST_AGT_WRDATA_HI);
1691 1674
1692 writel((TA_CTL_ENABLE | TA_CTL_WRITE), (mem_crb + TEST_AGT_CTRL)); 1675 writel((TA_CTL_ENABLE | TA_CTL_WRITE), (mem_crb + TEST_AGT_CTRL));
1693 writel((TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE), 1676 writel((TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE),
@@ -1707,7 +1690,6 @@ correct:
1707 } else 1690 } else
1708 ret = 0; 1691 ret = 0;
1709 1692
1710done:
1711 spin_unlock(&adapter->ahw.mem_lock); 1693 spin_unlock(&adapter->ahw.mem_lock);
1712 1694
1713 return ret; 1695 return ret;
@@ -1719,7 +1701,7 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
1719{ 1701{
1720 int j, ret; 1702 int j, ret;
1721 u32 temp, off8; 1703 u32 temp, off8;
1722 u64 val, stride; 1704 u64 val;
1723 void __iomem *mem_crb; 1705 void __iomem *mem_crb;
1724 1706
1725 /* Only 64-bit aligned access */ 1707 /* Only 64-bit aligned access */
@@ -1748,9 +1730,7 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
1748 return -EIO; 1730 return -EIO;
1749 1731
1750correct: 1732correct:
1751 stride = NX_IS_REVISION_P3P(adapter->ahw.revision_id) ? 16 : 8; 1733 off8 = off & 0xfffffff8;
1752
1753 off8 = off & ~(stride-1);
1754 1734
1755 spin_lock(&adapter->ahw.mem_lock); 1735 spin_lock(&adapter->ahw.mem_lock);
1756 1736
@@ -1771,13 +1751,8 @@ correct:
1771 "failed to read through agent\n"); 1751 "failed to read through agent\n");
1772 ret = -EIO; 1752 ret = -EIO;
1773 } else { 1753 } else {
1774 off8 = MIU_TEST_AGT_RDDATA_LO; 1754 val = (u64)(readl(mem_crb + MIU_TEST_AGT_RDDATA_HI)) << 32;
1775 if ((stride == 16) && (off & 0xf)) 1755 val |= readl(mem_crb + MIU_TEST_AGT_RDDATA_LO);
1776 off8 = MIU_TEST_AGT_RDDATA_UPPER_LO;
1777
1778 temp = readl(mem_crb + off8 + 4);
1779 val = (u64)temp << 32;
1780 val |= readl(mem_crb + off8);
1781 *data = val; 1756 *data = val;
1782 ret = 0; 1757 ret = 0;
1783 } 1758 }
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 388feaf60ee7..045a7c8f5bdf 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1361,10 +1361,12 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
1361 return err; 1361 return err;
1362 1362
1363 NXWR32(adapter, CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT); 1363 NXWR32(adapter, CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT);
1364 NXWR32(adapter, CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC);
1365 NXWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE); 1364 NXWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
1366 NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK); 1365 NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
1367 1366
1367 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
1368 NXWR32(adapter, CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC);
1369
1368 return err; 1370 return err;
1369} 1371}
1370 1372
@@ -1899,6 +1901,5 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1899void netxen_nic_clear_stats(struct netxen_adapter *adapter) 1901void netxen_nic_clear_stats(struct netxen_adapter *adapter)
1900{ 1902{
1901 memset(&adapter->stats, 0, sizeof(adapter->stats)); 1903 memset(&adapter->stats, 0, sizeof(adapter->stats));
1902 return;
1903} 1904}
1904 1905
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index b665b420a4f2..c61a61f177b7 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -2537,14 +2537,24 @@ static int
2537netxen_sysfs_validate_crb(struct netxen_adapter *adapter, 2537netxen_sysfs_validate_crb(struct netxen_adapter *adapter,
2538 loff_t offset, size_t size) 2538 loff_t offset, size_t size)
2539{ 2539{
2540 size_t crb_size = 4;
2541
2540 if (!(adapter->flags & NETXEN_NIC_DIAG_ENABLED)) 2542 if (!(adapter->flags & NETXEN_NIC_DIAG_ENABLED))
2541 return -EIO; 2543 return -EIO;
2542 2544
2543 if ((size != 4) || (offset & 0x3)) 2545 if (offset < NETXEN_PCI_CRBSPACE) {
2544 return -EINVAL; 2546 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
2547 return -EINVAL;
2545 2548
2546 if (offset < NETXEN_PCI_CRBSPACE) 2549 if (ADDR_IN_RANGE(offset, NETXEN_PCI_CAMQM,
2547 return -EINVAL; 2550 NETXEN_PCI_CAMQM_2M_END))
2551 crb_size = 8;
2552 else
2553 return -EINVAL;
2554 }
2555
2556 if ((size != crb_size) || (offset & (crb_size-1)))
2557 return -EINVAL;
2548 2558
2549 return 0; 2559 return 0;
2550} 2560}
@@ -2556,14 +2566,23 @@ netxen_sysfs_read_crb(struct kobject *kobj, struct bin_attribute *attr,
2556 struct device *dev = container_of(kobj, struct device, kobj); 2566 struct device *dev = container_of(kobj, struct device, kobj);
2557 struct netxen_adapter *adapter = dev_get_drvdata(dev); 2567 struct netxen_adapter *adapter = dev_get_drvdata(dev);
2558 u32 data; 2568 u32 data;
2569 u64 qmdata;
2559 int ret; 2570 int ret;
2560 2571
2561 ret = netxen_sysfs_validate_crb(adapter, offset, size); 2572 ret = netxen_sysfs_validate_crb(adapter, offset, size);
2562 if (ret != 0) 2573 if (ret != 0)
2563 return ret; 2574 return ret;
2564 2575
2565 data = NXRD32(adapter, offset); 2576 if (NX_IS_REVISION_P3(adapter->ahw.revision_id) &&
2566 memcpy(buf, &data, size); 2577 ADDR_IN_RANGE(offset, NETXEN_PCI_CAMQM,
2578 NETXEN_PCI_CAMQM_2M_END)) {
2579 netxen_pci_camqm_read_2M(adapter, offset, &qmdata);
2580 memcpy(buf, &qmdata, size);
2581 } else {
2582 data = NXRD32(adapter, offset);
2583 memcpy(buf, &data, size);
2584 }
2585
2567 return size; 2586 return size;
2568} 2587}
2569 2588
@@ -2574,14 +2593,23 @@ netxen_sysfs_write_crb(struct kobject *kobj, struct bin_attribute *attr,
2574 struct device *dev = container_of(kobj, struct device, kobj); 2593 struct device *dev = container_of(kobj, struct device, kobj);
2575 struct netxen_adapter *adapter = dev_get_drvdata(dev); 2594 struct netxen_adapter *adapter = dev_get_drvdata(dev);
2576 u32 data; 2595 u32 data;
2596 u64 qmdata;
2577 int ret; 2597 int ret;
2578 2598
2579 ret = netxen_sysfs_validate_crb(adapter, offset, size); 2599 ret = netxen_sysfs_validate_crb(adapter, offset, size);
2580 if (ret != 0) 2600 if (ret != 0)
2581 return ret; 2601 return ret;
2582 2602
2583 memcpy(&data, buf, size); 2603 if (NX_IS_REVISION_P3(adapter->ahw.revision_id) &&
2584 NXWR32(adapter, offset, data); 2604 ADDR_IN_RANGE(offset, NETXEN_PCI_CAMQM,
2605 NETXEN_PCI_CAMQM_2M_END)) {
2606 memcpy(&qmdata, buf, size);
2607 netxen_pci_camqm_write_2M(adapter, offset, qmdata);
2608 } else {
2609 memcpy(&data, buf, size);
2610 NXWR32(adapter, offset, data);
2611 }
2612
2585 return size; 2613 return size;
2586} 2614}
2587 2615
@@ -2753,7 +2781,6 @@ netxen_config_indev_addr(struct net_device *dev, unsigned long event)
2753 } endfor_ifa(indev); 2781 } endfor_ifa(indev);
2754 2782
2755 in_dev_put(indev); 2783 in_dev_put(indev);
2756 return;
2757} 2784}
2758 2785
2759static int netxen_netdev_event(struct notifier_block *this, 2786static int netxen_netdev_event(struct notifier_block *this,
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index 3892330f244a..4d3f2e2b28bd 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -444,7 +444,7 @@ static void ni5010_timeout(struct net_device *dev)
444 /* Try to restart the adaptor. */ 444 /* Try to restart the adaptor. */
445 /* FIXME: Give it a real kick here */ 445 /* FIXME: Give it a real kick here */
446 chipset_init(dev, 1); 446 chipset_init(dev, 1);
447 dev->trans_start = jiffies; 447 dev->trans_start = jiffies; /* prevent tx timeout */
448 netif_wake_queue(dev); 448 netif_wake_queue(dev);
449} 449}
450 450
@@ -460,7 +460,6 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
460 460
461 netif_stop_queue(dev); 461 netif_stop_queue(dev);
462 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len); 462 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len);
463 dev->trans_start = jiffies;
464 dev_kfree_skb (skb); 463 dev_kfree_skb (skb);
465 return NETDEV_TX_OK; 464 return NETDEV_TX_OK;
466} 465}
@@ -515,8 +514,6 @@ static void dump_packet(void *buf, int len)
515 if (i % 16 == 15) printk("\n"); 514 if (i % 16 == 15) printk("\n");
516 } 515 }
517 printk("\n"); 516 printk("\n");
518
519 return;
520} 517}
521 518
522/* We have a good packet, get it out of the buffer. */ 519/* We have a good packet, get it out of the buffer. */
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index b7837ebd9a7d..9bddb5fa7a96 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -1147,7 +1147,7 @@ static void ni52_timeout(struct net_device *dev)
1147 writeb(CUC_START, &p->scb->cmd_cuc); 1147 writeb(CUC_START, &p->scb->cmd_cuc);
1148 ni_attn586(); 1148 ni_attn586();
1149 wait_for_scb_cmd(dev); 1149 wait_for_scb_cmd(dev);
1150 dev->trans_start = jiffies; 1150 dev->trans_start = jiffies; /* prevent tx timeout */
1151 return 0; 1151 return 0;
1152 } 1152 }
1153#endif 1153#endif
@@ -1165,7 +1165,7 @@ static void ni52_timeout(struct net_device *dev)
1165 ni52_close(dev); 1165 ni52_close(dev);
1166 ni52_open(dev); 1166 ni52_open(dev);
1167 } 1167 }
1168 dev->trans_start = jiffies; 1168 dev->trans_start = jiffies; /* prevent tx timeout */
1169} 1169}
1170 1170
1171/****************************************************** 1171/******************************************************
@@ -1218,7 +1218,6 @@ static netdev_tx_t ni52_send_packet(struct sk_buff *skb,
1218 writeb(CUC_START, &p->scb->cmd_cuc); 1218 writeb(CUC_START, &p->scb->cmd_cuc);
1219 } 1219 }
1220 ni_attn586(); 1220 ni_attn586();
1221 dev->trans_start = jiffies;
1222 if (!i) 1221 if (!i)
1223 dev_kfree_skb(skb); 1222 dev_kfree_skb(skb);
1224 wait_for_scb_cmd(dev); 1223 wait_for_scb_cmd(dev);
@@ -1240,7 +1239,6 @@ static netdev_tx_t ni52_send_packet(struct sk_buff *skb,
1240 writew(0, &p->nop_cmds[next_nop]->cmd_status); 1239 writew(0, &p->nop_cmds[next_nop]->cmd_status);
1241 1240
1242 writew(make16(p->xmit_cmds[0]), &p->nop_cmds[p->nop_point]->cmd_link); 1241 writew(make16(p->xmit_cmds[0]), &p->nop_cmds[p->nop_point]->cmd_link);
1243 dev->trans_start = jiffies;
1244 p->nop_point = next_nop; 1242 p->nop_point = next_nop;
1245 dev_kfree_skb(skb); 1243 dev_kfree_skb(skb);
1246# endif 1244# endif
@@ -1256,7 +1254,6 @@ static netdev_tx_t ni52_send_packet(struct sk_buff *skb,
1256 writew(0, &p->nop_cmds[next_nop]->cmd_status); 1254 writew(0, &p->nop_cmds[next_nop]->cmd_status);
1257 writew(make16(p->xmit_cmds[p->xmit_count]), 1255 writew(make16(p->xmit_cmds[p->xmit_count]),
1258 &p->nop_cmds[p->xmit_count]->cmd_link); 1256 &p->nop_cmds[p->xmit_count]->cmd_link);
1259 dev->trans_start = jiffies;
1260 p->xmit_count = next_nop; 1257 p->xmit_count = next_nop;
1261 { 1258 {
1262 unsigned long flags; 1259 unsigned long flags;
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c
index 9225c76cac40..da228a0dd6cd 100644
--- a/drivers/net/ni65.c
+++ b/drivers/net/ni65.c
@@ -784,7 +784,7 @@ static void ni65_stop_start(struct net_device *dev,struct priv *p)
784 if(!p->lock) 784 if(!p->lock)
785 if (p->tmdnum || !p->xmit_queued) 785 if (p->tmdnum || !p->xmit_queued)
786 netif_wake_queue(dev); 786 netif_wake_queue(dev);
787 dev->trans_start = jiffies; 787 dev->trans_start = jiffies; /* prevent tx timeout */
788 } 788 }
789 else 789 else
790 writedatareg(CSR0_STRT | csr0); 790 writedatareg(CSR0_STRT | csr0);
@@ -1150,7 +1150,7 @@ static void ni65_timeout(struct net_device *dev)
1150 printk("%02x ",p->tmdhead[i].u.s.status); 1150 printk("%02x ",p->tmdhead[i].u.s.status);
1151 printk("\n"); 1151 printk("\n");
1152 ni65_lance_reinit(dev); 1152 ni65_lance_reinit(dev);
1153 dev->trans_start = jiffies; 1153 dev->trans_start = jiffies; /* prevent tx timeout */
1154 netif_wake_queue(dev); 1154 netif_wake_queue(dev);
1155} 1155}
1156 1156
@@ -1213,7 +1213,6 @@ static netdev_tx_t ni65_send_packet(struct sk_buff *skb,
1213 netif_wake_queue(dev); 1213 netif_wake_queue(dev);
1214 1214
1215 p->lock = 0; 1215 p->lock = 0;
1216 dev->trans_start = jiffies;
1217 1216
1218 spin_unlock_irqrestore(&p->ring_lock, flags); 1217 spin_unlock_irqrestore(&p->ring_lock, flags);
1219 } 1218 }
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
index 392470333174..000e792d57c0 100644
--- a/drivers/net/octeon/octeon_mgmt.c
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -992,7 +992,6 @@ static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
992 /* Ring the bell. */ 992 /* Ring the bell. */
993 cvmx_write_csr(CVMX_MIXX_ORING2(port), 1); 993 cvmx_write_csr(CVMX_MIXX_ORING2(port), 1);
994 994
995 netdev->trans_start = jiffies;
996 rv = NETDEV_TX_OK; 995 rv = NETDEV_TX_OK;
997out: 996out:
998 octeon_mgmt_update_tx_stats(netdev); 997 octeon_mgmt_update_tx_stats(netdev);
@@ -1006,7 +1005,6 @@ static void octeon_mgmt_poll_controller(struct net_device *netdev)
1006 1005
1007 octeon_mgmt_receive_packets(p, 16); 1006 octeon_mgmt_receive_packets(p, 16);
1008 octeon_mgmt_update_rx_stats(netdev); 1007 octeon_mgmt_update_rx_stats(netdev);
1009 return;
1010} 1008}
1011#endif 1009#endif
1012 1010
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 370c147d08a3..8ab6ae0a6107 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -1472,8 +1472,6 @@ static void pasemi_mac_queue_csdesc(const struct sk_buff *skb,
1472 txring->next_to_fill = fill; 1472 txring->next_to_fill = fill;
1473 1473
1474 write_dma_reg(PAS_DMA_TXCHAN_INCR(txring->chan.chno), 2); 1474 write_dma_reg(PAS_DMA_TXCHAN_INCR(txring->chan.chno), 2);
1475
1476 return;
1477} 1475}
1478 1476
1479static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) 1477static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index dc3b4c7914fd..56f3fc45dbaa 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -1354,7 +1354,6 @@ static int netdrv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1354 NETDRV_W32(TxStatus0 + (entry * sizeof(u32)), 1354 NETDRV_W32(TxStatus0 + (entry * sizeof(u32)),
1355 tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); 1355 tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
1356 1356
1357 dev->trans_start = jiffies;
1358 atomic_inc(&tp->cur_tx); 1357 atomic_inc(&tp->cur_tx);
1359 if ((atomic_read(&tp->cur_tx) - atomic_read(&tp->dirty_tx)) >= NUM_TX_DESC) 1358 if ((atomic_read(&tp->cur_tx) - atomic_read(&tp->dirty_tx)) >= NUM_TX_DESC)
1360 netif_stop_queue(dev); 1359 netif_stop_queue(dev);
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 757f87bb1db3..29d288e7da93 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -622,8 +622,6 @@ static void mdio_write(unsigned int ioaddr, int phy_id, int location, int value)
622 outw(MDIO_ENB_IN, mdio_addr); 622 outw(MDIO_ENB_IN, mdio_addr);
623 outw(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); 623 outw(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr);
624 } 624 }
625
626 return;
627} 625}
628 626
629/* Reset and restore all of the 3c574 registers. */ 627/* Reset and restore all of the 3c574 registers. */
@@ -739,7 +737,7 @@ static void el3_tx_timeout(struct net_device *dev)
739 printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name); 737 printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name);
740 dump_status(dev); 738 dump_status(dev);
741 dev->stats.tx_errors++; 739 dev->stats.tx_errors++;
742 dev->trans_start = jiffies; 740 dev->trans_start = jiffies; /* prevent tx timeout */
743 /* Issue TX_RESET and TX_START commands. */ 741 /* Issue TX_RESET and TX_START commands. */
744 tc574_wait_for_completion(dev, TxReset); 742 tc574_wait_for_completion(dev, TxReset);
745 outw(TxEnable, ioaddr + EL3_CMD); 743 outw(TxEnable, ioaddr + EL3_CMD);
@@ -790,8 +788,6 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
790 /* ... and the packet rounded to a doubleword. */ 788 /* ... and the packet rounded to a doubleword. */
791 outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3)>>2); 789 outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3)>>2);
792 790
793 dev->trans_start = jiffies;
794
795 /* TxFree appears only in Window 1, not offset 0x1c. */ 791 /* TxFree appears only in Window 1, not offset 0x1c. */
796 if (inw(ioaddr + TxFree) <= 1536) { 792 if (inw(ioaddr + TxFree) <= 1536) {
797 netif_stop_queue(dev); 793 netif_stop_queue(dev);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 580977f56ad0..d6a459dd4894 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -563,7 +563,7 @@ static void el3_tx_timeout(struct net_device *dev)
563 netdev_warn(dev, "Transmit timed out!\n"); 563 netdev_warn(dev, "Transmit timed out!\n");
564 dump_status(dev); 564 dump_status(dev);
565 dev->stats.tx_errors++; 565 dev->stats.tx_errors++;
566 dev->trans_start = jiffies; 566 dev->trans_start = jiffies; /* prevent tx timeout */
567 /* Issue TX_RESET and TX_START commands. */ 567 /* Issue TX_RESET and TX_START commands. */
568 tc589_wait_for_completion(dev, TxReset); 568 tc589_wait_for_completion(dev, TxReset);
569 outw(TxEnable, ioaddr + EL3_CMD); 569 outw(TxEnable, ioaddr + EL3_CMD);
@@ -611,7 +611,6 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
611 /* ... and the packet rounded to a doubleword. */ 611 /* ... and the packet rounded to a doubleword. */
612 outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2); 612 outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);
613 613
614 dev->trans_start = jiffies;
615 if (inw(ioaddr + TX_FREE) <= 1536) { 614 if (inw(ioaddr + TX_FREE) <= 1536) {
616 netif_stop_queue(dev); 615 netif_stop_queue(dev);
617 /* Interrupt us when the FIFO has room for max-sized packet. */ 616 /* Interrupt us when the FIFO has room for max-sized packet. */
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 70fc9591821f..d605db28e6fa 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -1005,7 +1005,7 @@ static void axnet_tx_timeout(struct net_device *dev)
1005{ 1005{
1006 long e8390_base = dev->base_addr; 1006 long e8390_base = dev->base_addr;
1007 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1007 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
1008 int txsr, isr, tickssofar = jiffies - dev->trans_start; 1008 int txsr, isr, tickssofar = jiffies - dev_trans_start(dev);
1009 unsigned long flags; 1009 unsigned long flags;
1010 1010
1011 dev->stats.tx_errors++; 1011 dev->stats.tx_errors++;
@@ -1510,8 +1510,6 @@ static void ei_receive(struct net_device *dev)
1510 ei_local->current_page = next_frame; 1510 ei_local->current_page = next_frame;
1511 outb_p(next_frame-1, e8390_base+EN0_BOUNDARY); 1511 outb_p(next_frame-1, e8390_base+EN0_BOUNDARY);
1512 } 1512 }
1513
1514 return;
1515} 1513}
1516 1514
1517/** 1515/**
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 6734f7d6da98..451a4548494d 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -890,7 +890,6 @@ static netdev_tx_t fjn_start_xmit(struct sk_buff *skb,
890 lp->sent = lp->tx_queue ; 890 lp->sent = lp->tx_queue ;
891 lp->tx_queue = 0; 891 lp->tx_queue = 0;
892 lp->tx_queue_len = 0; 892 lp->tx_queue_len = 0;
893 dev->trans_start = jiffies;
894 lp->tx_started = 1; 893 lp->tx_started = 1;
895 netif_start_queue(dev); 894 netif_start_queue(dev);
896 } else { 895 } else {
@@ -1082,8 +1081,6 @@ static void fjn_rx(struct net_device *dev)
1082 "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); 1081 "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i);
1083 } 1082 }
1084*/ 1083*/
1085
1086 return;
1087} /* fjn_rx */ 1084} /* fjn_rx */
1088 1085
1089/*====================================================================*/ 1086/*====================================================================*/
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 37f4a6fdc3ef..3b0754b8ccd2 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -402,8 +402,6 @@ static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase)
402 402
403 /* 0x40 will release the card for use */ 403 /* 0x40 will release the card for use */
404 outb(0x40, dev->base_addr); 404 outb(0x40, dev->base_addr);
405
406 return;
407} 405}
408 406
409static struct pcmcia_device_id ibmtr_ids[] = { 407static struct pcmcia_device_id ibmtr_ids[] = {
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index c516c1996354..89ba2f12e018 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -903,7 +903,7 @@ static void mace_tx_timeout(struct net_device *dev)
903#else /* #if RESET_ON_TIMEOUT */ 903#else /* #if RESET_ON_TIMEOUT */
904 printk("NOT resetting card\n"); 904 printk("NOT resetting card\n");
905#endif /* #if RESET_ON_TIMEOUT */ 905#endif /* #if RESET_ON_TIMEOUT */
906 dev->trans_start = jiffies; 906 dev->trans_start = jiffies; /* prevent tx timeout */
907 netif_wake_queue(dev); 907 netif_wake_queue(dev);
908} 908}
909 909
@@ -945,8 +945,6 @@ static netdev_tx_t mace_start_xmit(struct sk_buff *skb,
945 outb(skb->data[skb->len-1], ioaddr + AM2150_XMT); 945 outb(skb->data[skb->len-1], ioaddr + AM2150_XMT);
946 } 946 }
947 947
948 dev->trans_start = jiffies;
949
950#if MULTI_TX 948#if MULTI_TX
951 if (lp->tx_free_frames > 0) 949 if (lp->tx_free_frames > 0)
952 netif_start_queue(dev); 950 netif_start_queue(dev);
@@ -1315,8 +1313,6 @@ static void update_stats(unsigned int ioaddr, struct net_device *dev)
1315 lp->linux_stats.tx_fifo_errors = lp->mace_stats.uflo; 1313 lp->linux_stats.tx_fifo_errors = lp->mace_stats.uflo;
1316 lp->linux_stats.tx_heartbeat_errors = lp->mace_stats.cerr; 1314 lp->linux_stats.tx_heartbeat_errors = lp->mace_stats.cerr;
1317 /* lp->linux_stats.tx_window_errors; */ 1315 /* lp->linux_stats.tx_window_errors; */
1318
1319 return;
1320} /* update_stats */ 1316} /* update_stats */
1321 1317
1322/* ---------------------------------------------------------------------------- 1318/* ----------------------------------------------------------------------------
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 949ac1a12537..7da544c5fd5a 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1239,7 +1239,6 @@ static void smc_hardware_send_packet(struct net_device * dev)
1239 dev_kfree_skb_irq(skb); 1239 dev_kfree_skb_irq(skb);
1240 dev->trans_start = jiffies; 1240 dev->trans_start = jiffies;
1241 netif_start_queue(dev); 1241 netif_start_queue(dev);
1242 return;
1243} 1242}
1244 1243
1245/*====================================================================*/ 1244/*====================================================================*/
@@ -1254,7 +1253,7 @@ static void smc_tx_timeout(struct net_device *dev)
1254 dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2)); 1253 dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2));
1255 dev->stats.tx_errors++; 1254 dev->stats.tx_errors++;
1256 smc_reset(dev); 1255 smc_reset(dev);
1257 dev->trans_start = jiffies; 1256 dev->trans_start = jiffies; /* prevent tx timeout */
1258 smc->saved_skb = NULL; 1257 smc->saved_skb = NULL;
1259 netif_wake_queue(dev); 1258 netif_wake_queue(dev);
1260} 1259}
@@ -1369,7 +1368,6 @@ static void smc_tx_err(struct net_device * dev)
1369 smc->packets_waiting--; 1368 smc->packets_waiting--;
1370 1369
1371 outw(saved_packet, ioaddr + PNR_ARR); 1370 outw(saved_packet, ioaddr + PNR_ARR);
1372 return;
1373} 1371}
1374 1372
1375/*====================================================================*/ 1373/*====================================================================*/
@@ -1589,8 +1587,6 @@ static void smc_rx(struct net_device *dev)
1589 } 1587 }
1590 /* Let the MMU free the memory of this packet. */ 1588 /* Let the MMU free the memory of this packet. */
1591 outw(MC_RELEASE, ioaddr + MMU_CMD); 1589 outw(MC_RELEASE, ioaddr + MMU_CMD);
1592
1593 return;
1594} 1590}
1595 1591
1596/*====================================================================== 1592/*======================================================================
@@ -1640,8 +1636,6 @@ static void set_rx_mode(struct net_device *dev)
1640 outw(rx_cfg_setting, ioaddr + RCR); 1636 outw(rx_cfg_setting, ioaddr + RCR);
1641 SMC_SELECT_BANK(2); 1637 SMC_SELECT_BANK(2);
1642 spin_unlock_irqrestore(&smc->lock, flags); 1638 spin_unlock_irqrestore(&smc->lock, flags);
1643
1644 return;
1645} 1639}
1646 1640
1647/*====================================================================== 1641/*======================================================================
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 656be931207a..6622f0401794 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1295,7 +1295,7 @@ xirc2ps_tx_timeout_task(struct work_struct *work)
1295 struct net_device *dev = local->dev; 1295 struct net_device *dev = local->dev;
1296 /* reset the card */ 1296 /* reset the card */
1297 do_reset(dev,1); 1297 do_reset(dev,1);
1298 dev->trans_start = jiffies; 1298 dev->trans_start = jiffies; /* prevent tx timeout */
1299 netif_wake_queue(dev); 1299 netif_wake_queue(dev);
1300} 1300}
1301 1301
@@ -1358,7 +1358,6 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1358 PutByte(XIRCREG_CR, TransmitPacket|EnableIntr); 1358 PutByte(XIRCREG_CR, TransmitPacket|EnableIntr);
1359 1359
1360 dev_kfree_skb (skb); 1360 dev_kfree_skb (skb);
1361 dev->trans_start = jiffies;
1362 dev->stats.tx_bytes += pktlen; 1361 dev->stats.tx_bytes += pktlen;
1363 netif_start_queue(dev); 1362 netif_start_queue(dev);
1364 return NETDEV_TX_OK; 1363 return NETDEV_TX_OK;
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index a2254f749a9a..c200c2821730 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -448,7 +448,7 @@ static void pcnet32_netif_stop(struct net_device *dev)
448{ 448{
449 struct pcnet32_private *lp = netdev_priv(dev); 449 struct pcnet32_private *lp = netdev_priv(dev);
450 450
451 dev->trans_start = jiffies; 451 dev->trans_start = jiffies; /* prevent tx timeout */
452 napi_disable(&lp->napi); 452 napi_disable(&lp->napi);
453 netif_tx_disable(dev); 453 netif_tx_disable(dev);
454} 454}
@@ -647,7 +647,6 @@ free_new_rx_ring:
647 (1 << size), 647 (1 << size),
648 new_rx_ring, 648 new_rx_ring,
649 new_ring_dma_addr); 649 new_ring_dma_addr);
650 return;
651} 650}
652 651
653static void pcnet32_purge_rx_ring(struct net_device *dev) 652static void pcnet32_purge_rx_ring(struct net_device *dev)
@@ -1215,7 +1214,6 @@ static void pcnet32_rx_entry(struct net_device *dev,
1215 skb->protocol = eth_type_trans(skb, dev); 1214 skb->protocol = eth_type_trans(skb, dev);
1216 netif_receive_skb(skb); 1215 netif_receive_skb(skb);
1217 dev->stats.rx_packets++; 1216 dev->stats.rx_packets++;
1218 return;
1219} 1217}
1220 1218
1221static int pcnet32_rx(struct net_device *dev, int budget) 1219static int pcnet32_rx(struct net_device *dev, int budget)
@@ -2398,7 +2396,7 @@ static void pcnet32_tx_timeout(struct net_device *dev)
2398 } 2396 }
2399 pcnet32_restart(dev, CSR0_NORMAL); 2397 pcnet32_restart(dev, CSR0_NORMAL);
2400 2398
2401 dev->trans_start = jiffies; 2399 dev->trans_start = jiffies; /* prevent tx timeout */
2402 netif_wake_queue(dev); 2400 netif_wake_queue(dev);
2403 2401
2404 spin_unlock_irqrestore(&lp->lock, flags); 2402 spin_unlock_irqrestore(&lp->lock, flags);
@@ -2449,8 +2447,6 @@ static netdev_tx_t pcnet32_start_xmit(struct sk_buff *skb,
2449 /* Trigger an immediate send poll. */ 2447 /* Trigger an immediate send poll. */
2450 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); 2448 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
2451 2449
2452 dev->trans_start = jiffies;
2453
2454 if (lp->tx_ring[(entry + 1) & lp->tx_mod_mask].base != 0) { 2450 if (lp->tx_ring[(entry + 1) & lp->tx_mod_mask].base != 0) {
2455 lp->tx_full = 1; 2451 lp->tx_full = 1;
2456 netif_stop_queue(dev); 2452 netif_stop_queue(dev);
@@ -2625,7 +2621,6 @@ static void pcnet32_load_multicast(struct net_device *dev)
2625 for (i = 0; i < 4; i++) 2621 for (i = 0; i < 4; i++)
2626 lp->a.write_csr(ioaddr, PCNET32_MC_FILTER + i, 2622 lp->a.write_csr(ioaddr, PCNET32_MC_FILTER + i,
2627 le16_to_cpu(mcast_table[i])); 2623 le16_to_cpu(mcast_table[i]));
2628 return;
2629} 2624}
2630 2625
2631/* 2626/*
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
index a872aea4ed74..f443d43edd80 100644
--- a/drivers/net/phy/mdio-octeon.c
+++ b/drivers/net/phy/mdio-octeon.c
@@ -88,6 +88,7 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
88static int __init octeon_mdiobus_probe(struct platform_device *pdev) 88static int __init octeon_mdiobus_probe(struct platform_device *pdev)
89{ 89{
90 struct octeon_mdiobus *bus; 90 struct octeon_mdiobus *bus;
91 union cvmx_smix_en smi_en;
91 int i; 92 int i;
92 int err = -ENOENT; 93 int err = -ENOENT;
93 94
@@ -103,6 +104,10 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev)
103 if (!bus->mii_bus) 104 if (!bus->mii_bus)
104 goto err; 105 goto err;
105 106
107 smi_en.u64 = 0;
108 smi_en.s.en = 1;
109 cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
110
106 /* 111 /*
107 * Standard Octeon evaluation boards don't support phy 112 * Standard Octeon evaluation boards don't support phy
108 * interrupts, we need to poll. 113 * interrupts, we need to poll.
@@ -133,17 +138,22 @@ err_register:
133 138
134err: 139err:
135 devm_kfree(&pdev->dev, bus); 140 devm_kfree(&pdev->dev, bus);
141 smi_en.u64 = 0;
142 cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
136 return err; 143 return err;
137} 144}
138 145
139static int __exit octeon_mdiobus_remove(struct platform_device *pdev) 146static int __exit octeon_mdiobus_remove(struct platform_device *pdev)
140{ 147{
141 struct octeon_mdiobus *bus; 148 struct octeon_mdiobus *bus;
149 union cvmx_smix_en smi_en;
142 150
143 bus = dev_get_drvdata(&pdev->dev); 151 bus = dev_get_drvdata(&pdev->dev);
144 152
145 mdiobus_unregister(bus->mii_bus); 153 mdiobus_unregister(bus->mii_bus);
146 mdiobus_free(bus->mii_bus); 154 mdiobus_free(bus->mii_bus);
155 smi_en.u64 = 0;
156 cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
147 return 0; 157 return 0;
148} 158}
149 159
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 68dd107bad24..0692f750c404 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -32,6 +32,7 @@ static int kszphy_config_init(struct phy_device *phydev)
32 32
33static struct phy_driver ks8001_driver = { 33static struct phy_driver ks8001_driver = {
34 .phy_id = PHY_ID_KS8001, 34 .phy_id = PHY_ID_KS8001,
35 .name = "Micrel KS8001",
35 .phy_id_mask = 0x00fffff0, 36 .phy_id_mask = 0x00fffff0,
36 .features = PHY_BASIC_FEATURES, 37 .features = PHY_BASIC_FEATURES,
37 .flags = PHY_POLL, 38 .flags = PHY_POLL,
diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c
index 729ab29ba28c..a73ba0bcc0ce 100644
--- a/drivers/net/phy/national.c
+++ b/drivers/net/phy/national.c
@@ -97,7 +97,6 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)
97 phy_write(phydev, NS_EXP_MEM_DATA, 0x0008); 97 phy_write(phydev, NS_EXP_MEM_DATA, 0x0008);
98 phy_write(phydev, MII_BMCR, (bmcr & ~BMCR_PDOWN)); 98 phy_write(phydev, MII_BMCR, (bmcr & ~BMCR_PDOWN));
99 phy_write(phydev, LED_CTRL_REG, mode); 99 phy_write(phydev, LED_CTRL_REG, mode);
100 return;
101} 100}
102 101
103static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable) 102static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
@@ -110,8 +109,6 @@ static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
110 109
111 printk(KERN_DEBUG "DP83865 PHY: 10BASE-T HDX loopback %s\n", 110 printk(KERN_DEBUG "DP83865 PHY: 10BASE-T HDX loopback %s\n",
112 (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on"); 111 (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on");
113
114 return;
115} 112}
116 113
117static int ns_config_init(struct phy_device *phydev) 114static int ns_config_init(struct phy_device *phydev)
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 9a2103a69e17..ec0349e84a8a 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -979,7 +979,6 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
979 printk(KERN_DEBUG "%s: send request\n", dev->name); 979 printk(KERN_DEBUG "%s: send request\n", dev->name);
980 980
981 spin_lock_irq(&nl->lock); 981 spin_lock_irq(&nl->lock);
982 dev->trans_start = jiffies;
983 snd->skb = skb; 982 snd->skb = skb;
984 snd->length.h = skb->len; 983 snd->length.h = skb->len;
985 snd->state = PLIP_PK_TRIGGER; 984 snd->state = PLIP_PK_TRIGGER;
@@ -1192,8 +1191,6 @@ plip_wakeup(void *handle)
1192 /* Clear the data port. */ 1191 /* Clear the data port. */
1193 write_data (dev, 0x00); 1192 write_data (dev, 0x00);
1194 } 1193 }
1195
1196 return;
1197} 1194}
1198 1195
1199static int 1196static int
@@ -1309,7 +1306,6 @@ err_parport_unregister:
1309 parport_unregister_device(nl->pardev); 1306 parport_unregister_device(nl->pardev);
1310err_free_dev: 1307err_free_dev:
1311 free_netdev(dev); 1308 free_netdev(dev);
1312 return;
1313} 1309}
1314 1310
1315/* plip_detach() is called (by the parport code) when a port is 1311/* plip_detach() is called (by the parport code) when a port is
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 022317db4673..87d6b8f36304 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -903,9 +903,6 @@ int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
903 gelic_descr_release_tx(card, descr->next); 903 gelic_descr_release_tx(card, descr->next);
904 card->tx_chain.tail = descr->next->next; 904 card->tx_chain.tail = descr->next->next;
905 dev_info(ctodev(card), "%s: kick failure\n", __func__); 905 dev_info(ctodev(card), "%s: kick failure\n", __func__);
906 } else {
907 /* OK, DMA started/reserved */
908 netdev->trans_start = jiffies;
909 } 906 }
910 907
911 spin_unlock_irqrestore(&card->tx_lock, flags); 908 spin_unlock_irqrestore(&card->tx_lock, flags);
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index d4ff627c6f7a..a7bc406658e1 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -301,7 +301,6 @@ static void gelic_wl_get_ch_info(struct gelic_wl_info *wl)
301 /* 16 bits of MSB has available channels */ 301 /* 16 bits of MSB has available channels */
302 wl->ch_info = ch_info_raw >> 48; 302 wl->ch_info = ch_info_raw >> 48;
303 } 303 }
304 return;
305} 304}
306 305
307/* SIOGIWRANGE */ 306/* SIOGIWRANGE */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 01a6ca303a17..54ebb65ada18 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -222,7 +222,6 @@ static void ql_write_common_reg_l(struct ql3_adapter *qdev,
222 writel(value, reg); 222 writel(value, reg);
223 readl(reg); 223 readl(reg);
224 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 224 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
225 return;
226} 225}
227 226
228static void ql_write_common_reg(struct ql3_adapter *qdev, 227static void ql_write_common_reg(struct ql3_adapter *qdev,
@@ -230,7 +229,6 @@ static void ql_write_common_reg(struct ql3_adapter *qdev,
230{ 229{
231 writel(value, reg); 230 writel(value, reg);
232 readl(reg); 231 readl(reg);
233 return;
234} 232}
235 233
236static void ql_write_nvram_reg(struct ql3_adapter *qdev, 234static void ql_write_nvram_reg(struct ql3_adapter *qdev,
@@ -239,7 +237,6 @@ static void ql_write_nvram_reg(struct ql3_adapter *qdev,
239 writel(value, reg); 237 writel(value, reg);
240 readl(reg); 238 readl(reg);
241 udelay(1); 239 udelay(1);
242 return;
243} 240}
244 241
245static void ql_write_page0_reg(struct ql3_adapter *qdev, 242static void ql_write_page0_reg(struct ql3_adapter *qdev,
@@ -249,7 +246,6 @@ static void ql_write_page0_reg(struct ql3_adapter *qdev,
249 ql_set_register_page(qdev,0); 246 ql_set_register_page(qdev,0);
250 writel(value, reg); 247 writel(value, reg);
251 readl(reg); 248 readl(reg);
252 return;
253} 249}
254 250
255/* 251/*
@@ -262,7 +258,6 @@ static void ql_write_page1_reg(struct ql3_adapter *qdev,
262 ql_set_register_page(qdev,1); 258 ql_set_register_page(qdev,1);
263 writel(value, reg); 259 writel(value, reg);
264 readl(reg); 260 readl(reg);
265 return;
266} 261}
267 262
268/* 263/*
@@ -275,7 +270,6 @@ static void ql_write_page2_reg(struct ql3_adapter *qdev,
275 ql_set_register_page(qdev,2); 270 ql_set_register_page(qdev,2);
276 writel(value, reg); 271 writel(value, reg);
277 readl(reg); 272 readl(reg);
278 return;
279} 273}
280 274
281static void ql_disable_interrupts(struct ql3_adapter *qdev) 275static void ql_disable_interrupts(struct ql3_adapter *qdev)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 2fba9cd5946f..2ed34cd43e1c 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -53,6 +53,7 @@
53#define _QLCNIC_LINUX_MINOR 0 53#define _QLCNIC_LINUX_MINOR 0
54#define _QLCNIC_LINUX_SUBVERSION 2 54#define _QLCNIC_LINUX_SUBVERSION 2
55#define QLCNIC_LINUX_VERSIONID "5.0.2" 55#define QLCNIC_LINUX_VERSIONID "5.0.2"
56#define QLCNIC_DRV_IDC_VER 0x01
56 57
57#define QLCNIC_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 58#define QLCNIC_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
58#define _major(v) (((v) >> 24) & 0xff) 59#define _major(v) (((v) >> 24) & 0xff)
@@ -98,8 +99,6 @@
98#define QLCNIC_CT_DEFAULT_RX_BUF_LEN 2048 99#define QLCNIC_CT_DEFAULT_RX_BUF_LEN 2048
99#define QLCNIC_LRO_BUFFER_EXTRA 2048 100#define QLCNIC_LRO_BUFFER_EXTRA 2048
100 101
101#define QLCNIC_RX_LRO_BUFFER_LENGTH (8060)
102
103/* Opcodes to be used with the commands */ 102/* Opcodes to be used with the commands */
104#define TX_ETHER_PKT 0x01 103#define TX_ETHER_PKT 0x01
105#define TX_TCP_PKT 0x02 104#define TX_TCP_PKT 0x02
@@ -133,7 +132,6 @@
133 132
134#define RCV_RING_NORMAL 0 133#define RCV_RING_NORMAL 0
135#define RCV_RING_JUMBO 1 134#define RCV_RING_JUMBO 1
136#define RCV_RING_LRO 2
137 135
138#define MIN_CMD_DESCRIPTORS 64 136#define MIN_CMD_DESCRIPTORS 64
139#define MIN_RCV_DESCRIPTORS 64 137#define MIN_RCV_DESCRIPTORS 64
@@ -144,7 +142,6 @@
144#define MAX_RCV_DESCRIPTORS_10G 8192 142#define MAX_RCV_DESCRIPTORS_10G 8192
145#define MAX_JUMBO_RCV_DESCRIPTORS_1G 512 143#define MAX_JUMBO_RCV_DESCRIPTORS_1G 512
146#define MAX_JUMBO_RCV_DESCRIPTORS_10G 1024 144#define MAX_JUMBO_RCV_DESCRIPTORS_10G 1024
147#define MAX_LRO_RCV_DESCRIPTORS 8
148 145
149#define DEFAULT_RCV_DESCRIPTORS_1G 2048 146#define DEFAULT_RCV_DESCRIPTORS_1G 2048
150#define DEFAULT_RCV_DESCRIPTORS_10G 4096 147#define DEFAULT_RCV_DESCRIPTORS_10G 4096
@@ -399,13 +396,9 @@ struct qlcnic_hardware_context {
399 396
400 unsigned long pci_len0; 397 unsigned long pci_len0;
401 398
402 u32 ocm_win;
403 u32 crb_win;
404
405 rwlock_t crb_lock; 399 rwlock_t crb_lock;
406 struct mutex mem_lock; 400 struct mutex mem_lock;
407 401
408 u8 cut_through;
409 u8 revision_id; 402 u8 revision_id;
410 u8 pci_func; 403 u8 pci_func;
411 u8 linkup; 404 u8 linkup;
@@ -920,14 +913,12 @@ struct qlcnic_adapter {
920 u16 num_txd; 913 u16 num_txd;
921 u16 num_rxd; 914 u16 num_rxd;
922 u16 num_jumbo_rxd; 915 u16 num_jumbo_rxd;
923 u16 num_lro_rxd;
924 916
925 u8 max_rds_rings; 917 u8 max_rds_rings;
926 u8 max_sds_rings; 918 u8 max_sds_rings;
927 u8 driver_mismatch; 919 u8 driver_mismatch;
928 u8 msix_supported; 920 u8 msix_supported;
929 u8 rx_csum; 921 u8 rx_csum;
930 u8 pci_using_dac;
931 u8 portnum; 922 u8 portnum;
932 u8 physical_port; 923 u8 physical_port;
933 924
@@ -969,6 +960,8 @@ struct qlcnic_adapter {
969 960
970 u8 mac_addr[ETH_ALEN]; 961 u8 mac_addr[ETH_ALEN];
971 962
963 u64 dev_rst_time;
964
972 struct qlcnic_adapter_stats stats; 965 struct qlcnic_adapter_stats stats;
973 966
974 struct qlcnic_recv_context recv_ctx; 967 struct qlcnic_recv_context recv_ctx;
@@ -1046,7 +1039,7 @@ int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter);
1046void qlcnic_request_firmware(struct qlcnic_adapter *adapter); 1039void qlcnic_request_firmware(struct qlcnic_adapter *adapter);
1047void qlcnic_release_firmware(struct qlcnic_adapter *adapter); 1040void qlcnic_release_firmware(struct qlcnic_adapter *adapter);
1048int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter); 1041int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter);
1049void qlcnic_setup_idc_param(struct qlcnic_adapter *adapter); 1042int qlcnic_setup_idc_param(struct qlcnic_adapter *adapter);
1050 1043
1051int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, int addr, int *valp); 1044int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, int addr, int *valp);
1052int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr, 1045int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr,
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 6cdc5ebb7411..3bd514ec7e8f 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -412,7 +412,6 @@ qlcnic_get_ringparam(struct net_device *dev,
412 412
413 ring->rx_pending = adapter->num_rxd; 413 ring->rx_pending = adapter->num_rxd;
414 ring->rx_jumbo_pending = adapter->num_jumbo_rxd; 414 ring->rx_jumbo_pending = adapter->num_jumbo_rxd;
415 ring->rx_jumbo_pending += adapter->num_lro_rxd;
416 ring->tx_pending = adapter->num_txd; 415 ring->tx_pending = adapter->num_txd;
417 416
418 if (adapter->ahw.port_type == QLCNIC_GBE) { 417 if (adapter->ahw.port_type == QLCNIC_GBE) {
@@ -606,19 +605,12 @@ qlcnic_set_pauseparam(struct net_device *netdev,
606static int qlcnic_reg_test(struct net_device *dev) 605static int qlcnic_reg_test(struct net_device *dev)
607{ 606{
608 struct qlcnic_adapter *adapter = netdev_priv(dev); 607 struct qlcnic_adapter *adapter = netdev_priv(dev);
609 u32 data_read, data_written; 608 u32 data_read;
610 609
611 data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0)); 610 data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0));
612 if ((data_read & 0xffff) != adapter->pdev->vendor) 611 if ((data_read & 0xffff) != adapter->pdev->vendor)
613 return 1; 612 return 1;
614 613
615 data_written = (u32)0xa5a5a5a5;
616
617 QLCWR32(adapter, CRB_SCRATCHPAD_TEST, data_written);
618 data_read = QLCRD32(adapter, CRB_SCRATCHPAD_TEST);
619 if (data_written != data_read)
620 return 1;
621
622 return 0; 614 return 0;
623} 615}
624 616
diff --git a/drivers/net/qlcnic/qlcnic_hdr.h b/drivers/net/qlcnic/qlcnic_hdr.h
index a984cd227582..13740785d051 100644
--- a/drivers/net/qlcnic/qlcnic_hdr.h
+++ b/drivers/net/qlcnic/qlcnic_hdr.h
@@ -585,15 +585,8 @@ enum {
585 * for backward compability 585 * for backward compability
586 */ 586 */
587#define CRB_NIC_CAPABILITIES_HOST QLCNIC_REG(0x1a8) 587#define CRB_NIC_CAPABILITIES_HOST QLCNIC_REG(0x1a8)
588#define CRB_NIC_CAPABILITIES_FW QLCNIC_REG(0x1dc)
589#define CRB_NIC_MSI_MODE_HOST QLCNIC_REG(0x270)
590#define CRB_NIC_MSI_MODE_FW QLCNIC_REG(0x274)
591 588
592#define INTR_SCHEME_PERPORT 0x1 589#define INTR_SCHEME_PERPORT 0x1
593#define MSI_MODE_MULTIFUNC 0x1
594
595/* used for ethtool tests */
596#define CRB_SCRATCHPAD_TEST QLCNIC_REG(0x280)
597 590
598/* 591/*
599 * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address 592 * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 7a72b8d06bcb..0c2e1f08f459 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -776,9 +776,6 @@ qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off)
776 776
777 window = CRB_HI(off); 777 window = CRB_HI(off);
778 778
779 if (adapter->ahw.crb_win == window)
780 return;
781
782 writel(window, addr); 779 writel(window, addr);
783 if (readl(addr) != window) { 780 if (readl(addr) != window) {
784 if (printk_ratelimit()) 781 if (printk_ratelimit())
@@ -786,7 +783,6 @@ qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off)
786 "failed to set CRB window to %d off 0x%lx\n", 783 "failed to set CRB window to %d off 0x%lx\n",
787 window, off); 784 window, off);
788 } 785 }
789 adapter->ahw.crb_win = window;
790} 786}
791 787
792int 788int
@@ -874,7 +870,6 @@ qlcnic_pci_set_window_2M(struct qlcnic_adapter *adapter,
874 /* read back to flush */ 870 /* read back to flush */
875 readl(adapter->ahw.ocm_win_crb); 871 readl(adapter->ahw.ocm_win_crb);
876 872
877 adapter->ahw.ocm_win = window;
878 *start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); 873 *start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr);
879 return 0; 874 return 0;
880} 875}
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 1b621ca13e25..77bfdaba83e8 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -230,17 +230,8 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
230 switch (ring) { 230 switch (ring) {
231 case RCV_RING_NORMAL: 231 case RCV_RING_NORMAL:
232 rds_ring->num_desc = adapter->num_rxd; 232 rds_ring->num_desc = adapter->num_rxd;
233 if (adapter->ahw.cut_through) { 233 rds_ring->dma_size = QLCNIC_P3_RX_BUF_MAX_LEN;
234 rds_ring->dma_size = 234 rds_ring->skb_size = rds_ring->dma_size + NET_IP_ALIGN;
235 QLCNIC_CT_DEFAULT_RX_BUF_LEN;
236 rds_ring->skb_size =
237 QLCNIC_CT_DEFAULT_RX_BUF_LEN;
238 } else {
239 rds_ring->dma_size =
240 QLCNIC_P3_RX_BUF_MAX_LEN;
241 rds_ring->skb_size =
242 rds_ring->dma_size + NET_IP_ALIGN;
243 }
244 break; 235 break;
245 236
246 case RCV_RING_JUMBO: 237 case RCV_RING_JUMBO:
@@ -254,13 +245,6 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
254 rds_ring->skb_size = 245 rds_ring->skb_size =
255 rds_ring->dma_size + NET_IP_ALIGN; 246 rds_ring->dma_size + NET_IP_ALIGN;
256 break; 247 break;
257
258 case RCV_RING_LRO:
259 rds_ring->num_desc = adapter->num_lro_rxd;
260 rds_ring->dma_size = QLCNIC_RX_LRO_BUFFER_LENGTH;
261 rds_ring->skb_size = rds_ring->dma_size + NET_IP_ALIGN;
262 break;
263
264 } 248 }
265 rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *) 249 rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *)
266 vmalloc(RCV_BUFF_RINGSIZE(rds_ring)); 250 vmalloc(RCV_BUFF_RINGSIZE(rds_ring));
@@ -530,10 +514,22 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
530 return 0; 514 return 0;
531} 515}
532 516
533void 517int
534qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) { 518qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
535 519
536 int timeo; 520 int timeo;
521 u32 val;
522
523 val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
524 val = (val >> (adapter->portnum * 4)) & 0xf;
525
526 if ((val & 0x3) != 1) {
527 dev_err(&adapter->pdev->dev, "Not an Ethernet NIC func=%u\n",
528 val);
529 return -EIO;
530 }
531
532 adapter->physical_port = (val >> 2);
537 533
538 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) 534 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
539 timeo = 30; 535 timeo = 30;
@@ -544,6 +540,8 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
544 timeo = 10; 540 timeo = 10;
545 541
546 adapter->reset_ack_timeo = timeo; 542 adapter->reset_ack_timeo = timeo;
543
544 return 0;
547} 545}
548 546
549static int 547static int
@@ -556,12 +554,10 @@ qlcnic_has_mn(struct qlcnic_adapter *adapter)
556 QLCNIC_FW_VERSION_OFFSET, (int *)&flashed_ver); 554 QLCNIC_FW_VERSION_OFFSET, (int *)&flashed_ver);
557 flashed_ver = QLCNIC_DECODE_VERSION(flashed_ver); 555 flashed_ver = QLCNIC_DECODE_VERSION(flashed_ver);
558 556
559 if (flashed_ver >= QLCNIC_VERSION_CODE(4, 0, 220)) { 557 capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY);
558 if (capability & QLCNIC_PEG_TUNE_MN_PRESENT)
559 return 1;
560 560
561 capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY);
562 if (capability & QLCNIC_PEG_TUNE_MN_PRESENT)
563 return 1;
564 }
565 return 0; 561 return 0;
566} 562}
567 563
@@ -1189,7 +1185,6 @@ int qlcnic_init_firmware(struct qlcnic_adapter *adapter)
1189 return err; 1185 return err;
1190 1186
1191 QLCWR32(adapter, CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT); 1187 QLCWR32(adapter, CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT);
1192 QLCWR32(adapter, CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC);
1193 QLCWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE); 1188 QLCWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
1194 QLCWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK); 1189 QLCWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
1195 1190
@@ -1280,8 +1275,7 @@ qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
1280 1275
1281 skb = buffer->skb; 1276 skb = buffer->skb;
1282 1277
1283 if (!adapter->ahw.cut_through) 1278 skb_reserve(skb, 2);
1284 skb_reserve(skb, 2);
1285 1279
1286 dma = pci_map_single(pdev, skb->data, 1280 dma = pci_map_single(pdev, skb->data,
1287 rds_ring->dma_size, PCI_DMA_FROMDEVICE); 1281 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index ee573fe52a8e..f1949c93ab25 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -84,6 +84,7 @@ static void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter);
84static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); 84static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter);
85static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); 85static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter);
86 86
87static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding);
87static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter); 88static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter);
88static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); 89static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter);
89 90
@@ -239,67 +240,6 @@ qlcnic_napi_disable(struct qlcnic_adapter *adapter)
239static void qlcnic_clear_stats(struct qlcnic_adapter *adapter) 240static void qlcnic_clear_stats(struct qlcnic_adapter *adapter)
240{ 241{
241 memset(&adapter->stats, 0, sizeof(adapter->stats)); 242 memset(&adapter->stats, 0, sizeof(adapter->stats));
242 return;
243}
244
245static int qlcnic_set_dma_mask(struct qlcnic_adapter *adapter)
246{
247 struct pci_dev *pdev = adapter->pdev;
248 u64 mask, cmask;
249
250 adapter->pci_using_dac = 0;
251
252 mask = DMA_BIT_MASK(39);
253 cmask = mask;
254
255 if (pci_set_dma_mask(pdev, mask) == 0 &&
256 pci_set_consistent_dma_mask(pdev, cmask) == 0) {
257 adapter->pci_using_dac = 1;
258 return 0;
259 }
260
261 return -EIO;
262}
263
264/* Update addressable range if firmware supports it */
265static int
266qlcnic_update_dma_mask(struct qlcnic_adapter *adapter)
267{
268 int change, shift, err;
269 u64 mask, old_mask, old_cmask;
270 struct pci_dev *pdev = adapter->pdev;
271
272 change = 0;
273
274 shift = QLCRD32(adapter, CRB_DMA_SHIFT);
275 if (shift > 32)
276 return 0;
277
278 if (shift > 9)
279 change = 1;
280
281 if (change) {
282 old_mask = pdev->dma_mask;
283 old_cmask = pdev->dev.coherent_dma_mask;
284
285 mask = DMA_BIT_MASK(32+shift);
286
287 err = pci_set_dma_mask(pdev, mask);
288 if (err)
289 goto err_out;
290
291 err = pci_set_consistent_dma_mask(pdev, mask);
292 if (err)
293 goto err_out;
294 dev_info(&pdev->dev, "using %d-bit dma mask\n", 32+shift);
295 }
296
297 return 0;
298
299err_out:
300 pci_set_dma_mask(pdev, old_mask);
301 pci_set_consistent_dma_mask(pdev, old_cmask);
302 return err;
303} 243}
304 244
305static void qlcnic_set_port_mode(struct qlcnic_adapter *adapter) 245static void qlcnic_set_port_mode(struct qlcnic_adapter *adapter)
@@ -518,13 +458,6 @@ qlcnic_setup_pci_map(struct qlcnic_adapter *adapter)
518 struct pci_dev *pdev = adapter->pdev; 458 struct pci_dev *pdev = adapter->pdev;
519 int pci_func = adapter->ahw.pci_func; 459 int pci_func = adapter->ahw.pci_func;
520 460
521 /*
522 * Set the CRB window to invalid. If any register in window 0 is
523 * accessed it should set the window to 0 and then reset it to 1.
524 */
525 adapter->ahw.crb_win = -1;
526 adapter->ahw.ocm_win = -1;
527
528 /* remap phys address */ 461 /* remap phys address */
529 mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ 462 mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */
530 mem_len = pci_resource_len(pdev, 0); 463 mem_len = pci_resource_len(pdev, 0);
@@ -611,22 +544,10 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
611 brd_name, adapter->ahw.revision_id); 544 brd_name, adapter->ahw.revision_id);
612 } 545 }
613 546
614 if (adapter->fw_version < QLCNIC_VERSION_CODE(3, 4, 216)) { 547 dev_info(&pdev->dev, "firmware v%d.%d.%d\n",
615 adapter->driver_mismatch = 1; 548 fw_major, fw_minor, fw_build);
616 dev_warn(&pdev->dev, "firmware version %d.%d.%d unsupported\n",
617 fw_major, fw_minor, fw_build);
618 return;
619 }
620
621 i = QLCRD32(adapter, QLCNIC_SRE_MISC);
622 adapter->ahw.cut_through = (i & 0x8000) ? 1 : 0;
623
624 dev_info(&pdev->dev, "firmware v%d.%d.%d [%s]\n",
625 fw_major, fw_minor, fw_build,
626 adapter->ahw.cut_through ? "cut-through" : "legacy");
627 549
628 if (adapter->fw_version >= QLCNIC_VERSION_CODE(4, 0, 222)) 550 adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
629 adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
630 551
631 adapter->flags &= ~QLCNIC_LRO_ENABLED; 552 adapter->flags &= ~QLCNIC_LRO_ENABLED;
632 553
@@ -643,7 +564,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
643 564
644 adapter->num_txd = MAX_CMD_DESCRIPTORS; 565 adapter->num_txd = MAX_CMD_DESCRIPTORS;
645 566
646 adapter->num_lro_rxd = 0;
647 adapter->max_rds_rings = 2; 567 adapter->max_rds_rings = 2;
648} 568}
649 569
@@ -652,10 +572,6 @@ qlcnic_start_firmware(struct qlcnic_adapter *adapter)
652{ 572{
653 int val, err, first_boot; 573 int val, err, first_boot;
654 574
655 err = qlcnic_set_dma_mask(adapter);
656 if (err)
657 return err;
658
659 err = qlcnic_can_start_firmware(adapter); 575 err = qlcnic_can_start_firmware(adapter);
660 if (err < 0) 576 if (err < 0)
661 return err; 577 return err;
@@ -705,8 +621,7 @@ wait_init:
705 goto err_out; 621 goto err_out;
706 622
707 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); 623 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY);
708 624 qlcnic_idc_debug_info(adapter, 1);
709 qlcnic_update_dma_mask(adapter);
710 625
711 qlcnic_check_options(adapter); 626 qlcnic_check_options(adapter);
712 627
@@ -1033,7 +948,7 @@ qlcnic_reset_context(struct qlcnic_adapter *adapter)
1033 948
1034static int 949static int
1035qlcnic_setup_netdev(struct qlcnic_adapter *adapter, 950qlcnic_setup_netdev(struct qlcnic_adapter *adapter,
1036 struct net_device *netdev) 951 struct net_device *netdev, u8 pci_using_dac)
1037{ 952{
1038 int err; 953 int err;
1039 struct pci_dev *pdev = adapter->pdev; 954 struct pci_dev *pdev = adapter->pdev;
@@ -1056,7 +971,7 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter,
1056 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6); 971 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1057 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6); 972 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1058 973
1059 if (adapter->pci_using_dac) { 974 if (pci_using_dac) {
1060 netdev->features |= NETIF_F_HIGHDMA; 975 netdev->features |= NETIF_F_HIGHDMA;
1061 netdev->vlan_features |= NETIF_F_HIGHDMA; 976 netdev->vlan_features |= NETIF_F_HIGHDMA;
1062 } 977 }
@@ -1086,6 +1001,22 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter,
1086 return 0; 1001 return 0;
1087} 1002}
1088 1003
1004static int qlcnic_set_dma_mask(struct pci_dev *pdev, u8 *pci_using_dac)
1005{
1006 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
1007 !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1008 *pci_using_dac = 1;
1009 else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) &&
1010 !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
1011 *pci_using_dac = 0;
1012 else {
1013 dev_err(&pdev->dev, "Unable to set DMA mask, aborting\n");
1014 return -EIO;
1015 }
1016
1017 return 0;
1018}
1019
1089static int __devinit 1020static int __devinit
1090qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1021qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1091{ 1022{
@@ -1094,6 +1025,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1094 int err; 1025 int err;
1095 int pci_func_id = PCI_FUNC(pdev->devfn); 1026 int pci_func_id = PCI_FUNC(pdev->devfn);
1096 uint8_t revision_id; 1027 uint8_t revision_id;
1028 uint8_t pci_using_dac;
1097 1029
1098 err = pci_enable_device(pdev); 1030 err = pci_enable_device(pdev);
1099 if (err) 1031 if (err)
@@ -1104,6 +1036,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1104 goto err_out_disable_pdev; 1036 goto err_out_disable_pdev;
1105 } 1037 }
1106 1038
1039 err = qlcnic_set_dma_mask(pdev, &pci_using_dac);
1040 if (err)
1041 goto err_out_disable_pdev;
1042
1107 err = pci_request_regions(pdev, qlcnic_driver_name); 1043 err = pci_request_regions(pdev, qlcnic_driver_name);
1108 if (err) 1044 if (err)
1109 goto err_out_disable_pdev; 1045 goto err_out_disable_pdev;
@@ -1122,6 +1058,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1122 adapter = netdev_priv(netdev); 1058 adapter = netdev_priv(netdev);
1123 adapter->netdev = netdev; 1059 adapter->netdev = netdev;
1124 adapter->pdev = pdev; 1060 adapter->pdev = pdev;
1061 adapter->dev_rst_time = jiffies;
1125 adapter->ahw.pci_func = pci_func_id; 1062 adapter->ahw.pci_func = pci_func_id;
1126 1063
1127 revision_id = pdev->revision; 1064 revision_id = pdev->revision;
@@ -1146,22 +1083,18 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1146 goto err_out_iounmap; 1083 goto err_out_iounmap;
1147 } 1084 }
1148 1085
1149 qlcnic_setup_idc_param(adapter); 1086 if (qlcnic_setup_idc_param(adapter))
1087 goto err_out_iounmap;
1150 1088
1151 err = qlcnic_start_firmware(adapter); 1089 err = qlcnic_start_firmware(adapter);
1152 if (err) 1090 if (err)
1153 goto err_out_decr_ref; 1091 goto err_out_decr_ref;
1154 1092
1155 /*
1156 * See if the firmware gave us a virtual-physical port mapping.
1157 */
1158 adapter->physical_port = adapter->portnum;
1159
1160 qlcnic_clear_stats(adapter); 1093 qlcnic_clear_stats(adapter);
1161 1094
1162 qlcnic_setup_intr(adapter); 1095 qlcnic_setup_intr(adapter);
1163 1096
1164 err = qlcnic_setup_netdev(adapter, netdev); 1097 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac);
1165 if (err) 1098 if (err)
1166 goto err_out_disable_msi; 1099 goto err_out_disable_msi;
1167 1100
@@ -1312,9 +1245,6 @@ qlcnic_resume(struct pci_dev *pdev)
1312 pci_set_master(pdev); 1245 pci_set_master(pdev);
1313 pci_restore_state(pdev); 1246 pci_restore_state(pdev);
1314 1247
1315 adapter->ahw.crb_win = -1;
1316 adapter->ahw.ocm_win = -1;
1317
1318 err = qlcnic_start_firmware(adapter); 1248 err = qlcnic_start_firmware(adapter);
1319 if (err) { 1249 if (err) {
1320 dev_err(&pdev->dev, "failed to start firmware\n"); 1250 dev_err(&pdev->dev, "failed to start firmware\n");
@@ -1960,6 +1890,19 @@ static void qlcnic_poll_controller(struct net_device *netdev)
1960} 1890}
1961#endif 1891#endif
1962 1892
1893static void
1894qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding)
1895{
1896 u32 val;
1897
1898 val = adapter->portnum & 0xf;
1899 val |= encoding << 7;
1900 val |= (jiffies - adapter->dev_rst_time) << 8;
1901
1902 QLCWR32(adapter, QLCNIC_CRB_DRV_SCRATCH, val);
1903 adapter->dev_rst_time = jiffies;
1904}
1905
1963static int 1906static int
1964qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state) 1907qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state)
1965{ 1908{
@@ -2044,12 +1987,25 @@ qlcnic_check_drv_state(struct qlcnic_adapter *adapter)
2044 return 1; 1987 return 1;
2045} 1988}
2046 1989
1990static int qlcnic_check_idc_ver(struct qlcnic_adapter *adapter)
1991{
1992 u32 val = QLCRD32(adapter, QLCNIC_CRB_DRV_IDC_VER);
1993
1994 if (val != QLCNIC_DRV_IDC_VER) {
1995 dev_warn(&adapter->pdev->dev, "IDC Version mismatch, driver's"
1996 " idc ver = %x; reqd = %x\n", QLCNIC_DRV_IDC_VER, val);
1997 }
1998
1999 return 0;
2000}
2001
2047static int 2002static int
2048qlcnic_can_start_firmware(struct qlcnic_adapter *adapter) 2003qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
2049{ 2004{
2050 u32 val, prev_state; 2005 u32 val, prev_state;
2051 u8 dev_init_timeo = adapter->dev_init_timeo; 2006 u8 dev_init_timeo = adapter->dev_init_timeo;
2052 u8 portnum = adapter->portnum; 2007 u8 portnum = adapter->portnum;
2008 u8 ret;
2053 2009
2054 if (test_and_clear_bit(__QLCNIC_START_FW, &adapter->state)) 2010 if (test_and_clear_bit(__QLCNIC_START_FW, &adapter->state))
2055 return 1; 2011 return 1;
@@ -2069,12 +2025,15 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
2069 switch (prev_state) { 2025 switch (prev_state) {
2070 case QLCNIC_DEV_COLD: 2026 case QLCNIC_DEV_COLD:
2071 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING); 2027 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING);
2028 QLCWR32(adapter, QLCNIC_CRB_DRV_IDC_VER, QLCNIC_DRV_IDC_VER);
2029 qlcnic_idc_debug_info(adapter, 0);
2072 qlcnic_api_unlock(adapter); 2030 qlcnic_api_unlock(adapter);
2073 return 1; 2031 return 1;
2074 2032
2075 case QLCNIC_DEV_READY: 2033 case QLCNIC_DEV_READY:
2034 ret = qlcnic_check_idc_ver(adapter);
2076 qlcnic_api_unlock(adapter); 2035 qlcnic_api_unlock(adapter);
2077 return 0; 2036 return ret;
2078 2037
2079 case QLCNIC_DEV_NEED_RESET: 2038 case QLCNIC_DEV_NEED_RESET:
2080 val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE); 2039 val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE);
@@ -2101,8 +2060,11 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
2101 2060
2102 do { 2061 do {
2103 msleep(1000); 2062 msleep(1000);
2104 } while ((QLCRD32(adapter, QLCNIC_CRB_DEV_STATE) != QLCNIC_DEV_READY) 2063 prev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
2105 && --dev_init_timeo); 2064
2065 if (prev_state == QLCNIC_DEV_QUISCENT)
2066 continue;
2067 } while ((prev_state != QLCNIC_DEV_READY) && --dev_init_timeo);
2106 2068
2107 if (!dev_init_timeo) { 2069 if (!dev_init_timeo) {
2108 dev_err(&adapter->pdev->dev, 2070 dev_err(&adapter->pdev->dev,
@@ -2117,9 +2079,10 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
2117 QLC_DEV_CLR_RST_QSCNT(val, portnum); 2079 QLC_DEV_CLR_RST_QSCNT(val, portnum);
2118 QLCWR32(adapter, QLCNIC_CRB_DRV_STATE, val); 2080 QLCWR32(adapter, QLCNIC_CRB_DRV_STATE, val);
2119 2081
2082 ret = qlcnic_check_idc_ver(adapter);
2120 qlcnic_api_unlock(adapter); 2083 qlcnic_api_unlock(adapter);
2121 2084
2122 return 0; 2085 return ret;
2123} 2086}
2124 2087
2125static void 2088static void
@@ -2132,6 +2095,14 @@ qlcnic_fwinit_work(struct work_struct *work)
2132 if (qlcnic_api_lock(adapter)) 2095 if (qlcnic_api_lock(adapter))
2133 goto err_ret; 2096 goto err_ret;
2134 2097
2098 dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
2099 if (dev_state == QLCNIC_DEV_QUISCENT) {
2100 qlcnic_api_unlock(adapter);
2101 qlcnic_schedule_work(adapter, qlcnic_fwinit_work,
2102 FW_POLL_DELAY * 2);
2103 return;
2104 }
2105
2135 if (adapter->fw_wait_cnt++ > adapter->reset_ack_timeo) { 2106 if (adapter->fw_wait_cnt++ > adapter->reset_ack_timeo) {
2136 dev_err(&adapter->pdev->dev, "Reset:Failed to get ack %d sec\n", 2107 dev_err(&adapter->pdev->dev, "Reset:Failed to get ack %d sec\n",
2137 adapter->reset_ack_timeo); 2108 adapter->reset_ack_timeo);
@@ -2141,11 +2112,25 @@ qlcnic_fwinit_work(struct work_struct *work)
2141 if (!qlcnic_check_drv_state(adapter)) { 2112 if (!qlcnic_check_drv_state(adapter)) {
2142skip_ack_check: 2113skip_ack_check:
2143 dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); 2114 dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
2115
2116 if (dev_state == QLCNIC_DEV_NEED_QUISCENT) {
2117 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE,
2118 QLCNIC_DEV_QUISCENT);
2119 qlcnic_schedule_work(adapter, qlcnic_fwinit_work,
2120 FW_POLL_DELAY * 2);
2121 QLCDB(adapter, DRV, "Quiscing the driver\n");
2122 qlcnic_idc_debug_info(adapter, 0);
2123
2124 qlcnic_api_unlock(adapter);
2125 return;
2126 }
2127
2144 if (dev_state == QLCNIC_DEV_NEED_RESET) { 2128 if (dev_state == QLCNIC_DEV_NEED_RESET) {
2145 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, 2129 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE,
2146 QLCNIC_DEV_INITIALIZING); 2130 QLCNIC_DEV_INITIALIZING);
2147 set_bit(__QLCNIC_START_FW, &adapter->state); 2131 set_bit(__QLCNIC_START_FW, &adapter->state);
2148 QLCDB(adapter, DRV, "Restarting fw\n"); 2132 QLCDB(adapter, DRV, "Restarting fw\n");
2133 qlcnic_idc_debug_info(adapter, 0);
2149 } 2134 }
2150 2135
2151 qlcnic_api_unlock(adapter); 2136 qlcnic_api_unlock(adapter);
@@ -2163,6 +2148,8 @@ skip_ack_check:
2163 QLCDB(adapter, HW, "Func waiting: Device state=%u\n", dev_state); 2148 QLCDB(adapter, HW, "Func waiting: Device state=%u\n", dev_state);
2164 2149
2165 switch (dev_state) { 2150 switch (dev_state) {
2151 case QLCNIC_DEV_QUISCENT:
2152 case QLCNIC_DEV_NEED_QUISCENT:
2166 case QLCNIC_DEV_NEED_RESET: 2153 case QLCNIC_DEV_NEED_RESET:
2167 qlcnic_schedule_work(adapter, 2154 qlcnic_schedule_work(adapter,
2168 qlcnic_fwinit_work, FW_POLL_DELAY); 2155 qlcnic_fwinit_work, FW_POLL_DELAY);
@@ -2239,6 +2226,7 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter)
2239 if (state == QLCNIC_DEV_READY) { 2226 if (state == QLCNIC_DEV_READY) {
2240 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_NEED_RESET); 2227 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_NEED_RESET);
2241 QLCDB(adapter, DRV, "NEED_RESET state set\n"); 2228 QLCDB(adapter, DRV, "NEED_RESET state set\n");
2229 qlcnic_idc_debug_info(adapter, 0);
2242 } 2230 }
2243 2231
2244 qlcnic_api_unlock(adapter); 2232 qlcnic_api_unlock(adapter);
@@ -2302,10 +2290,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
2302 if (qlcnic_check_temp(adapter)) 2290 if (qlcnic_check_temp(adapter))
2303 goto detach; 2291 goto detach;
2304 2292
2305 if (adapter->need_fw_reset) { 2293 if (adapter->need_fw_reset)
2306 qlcnic_dev_request_reset(adapter); 2294 qlcnic_dev_request_reset(adapter);
2307 goto detach;
2308 }
2309 2295
2310 state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); 2296 state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
2311 if (state == QLCNIC_DEV_NEED_RESET || state == QLCNIC_DEV_NEED_QUISCENT) 2297 if (state == QLCNIC_DEV_NEED_RESET || state == QLCNIC_DEV_NEED_QUISCENT)
@@ -2624,24 +2610,12 @@ qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter)
2624 2610
2625#define is_qlcnic_netdev(dev) (dev->netdev_ops == &qlcnic_netdev_ops) 2611#define is_qlcnic_netdev(dev) (dev->netdev_ops == &qlcnic_netdev_ops)
2626 2612
2627static int
2628qlcnic_destip_supported(struct qlcnic_adapter *adapter)
2629{
2630 if (adapter->ahw.cut_through)
2631 return 0;
2632
2633 return 1;
2634}
2635
2636static void 2613static void
2637qlcnic_config_indev_addr(struct net_device *dev, unsigned long event) 2614qlcnic_config_indev_addr(struct net_device *dev, unsigned long event)
2638{ 2615{
2639 struct in_device *indev; 2616 struct in_device *indev;
2640 struct qlcnic_adapter *adapter = netdev_priv(dev); 2617 struct qlcnic_adapter *adapter = netdev_priv(dev);
2641 2618
2642 if (!qlcnic_destip_supported(adapter))
2643 return;
2644
2645 indev = in_dev_get(dev); 2619 indev = in_dev_get(dev);
2646 if (!indev) 2620 if (!indev)
2647 return; 2621 return;
@@ -2662,7 +2636,6 @@ qlcnic_config_indev_addr(struct net_device *dev, unsigned long event)
2662 } endfor_ifa(indev); 2636 } endfor_ifa(indev);
2663 2637
2664 in_dev_put(indev); 2638 in_dev_put(indev);
2665 return;
2666} 2639}
2667 2640
2668static int qlcnic_netdev_event(struct notifier_block *this, 2641static int qlcnic_netdev_event(struct notifier_block *this,
@@ -2721,7 +2694,7 @@ recheck:
2721 2694
2722 adapter = netdev_priv(dev); 2695 adapter = netdev_priv(dev);
2723 2696
2724 if (!adapter || !qlcnic_destip_supported(adapter)) 2697 if (!adapter)
2725 goto done; 2698 goto done;
2726 2699
2727 if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) 2700 if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC)
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c
index 7e09ff4a5755..4892d64f4e05 100644
--- a/drivers/net/qlge/qlge_ethtool.c
+++ b/drivers/net/qlge/qlge_ethtool.c
@@ -181,8 +181,6 @@ quit:
181 spin_unlock(&qdev->stats_lock); 181 spin_unlock(&qdev->stats_lock);
182 182
183 QL_DUMP_STAT(qdev); 183 QL_DUMP_STAT(qdev);
184
185 return;
186} 184}
187 185
188static char ql_stats_str_arr[][ETH_GSTRING_LEN] = { 186static char ql_stats_str_arr[][ETH_GSTRING_LEN] = {
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 412291645596..3cc7befa3eb1 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -924,7 +924,6 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
924 if (!lp->tx_free_desc) 924 if (!lp->tx_free_desc)
925 netif_stop_queue(dev); 925 netif_stop_queue(dev);
926 926
927 dev->trans_start = jiffies;
928 spin_unlock_irqrestore(&lp->lock, flags); 927 spin_unlock_irqrestore(&lp->lock, flags);
929 928
930 return NETDEV_TX_OK; 929 return NETDEV_TX_OK;
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index f2e335f0d1b7..e26e107f93e0 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1467,7 +1467,6 @@ static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
1467 1467
1468 spin_unlock_irqrestore(&rrpriv->lock, flags); 1468 spin_unlock_irqrestore(&rrpriv->lock, flags);
1469 1469
1470 dev->trans_start = jiffies;
1471 return NETDEV_TX_OK; 1470 return NETDEV_TX_OK;
1472} 1471}
1473 1472
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index f155928bf14e..668327ccd8d0 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2943,7 +2943,6 @@ static void s2io_netpoll(struct net_device *dev)
2943 } 2943 }
2944 } 2944 }
2945 enable_irq(dev->irq); 2945 enable_irq(dev->irq);
2946 return;
2947} 2946}
2948#endif 2947#endif
2949 2948
@@ -4756,7 +4755,6 @@ reset:
4756 s2io_stop_all_tx_queue(sp); 4755 s2io_stop_all_tx_queue(sp);
4757 schedule_work(&sp->rst_timer_task); 4756 schedule_work(&sp->rst_timer_task);
4758 sw_stat->soft_reset_cnt++; 4757 sw_stat->soft_reset_cnt++;
4759 return;
4760} 4758}
4761 4759
4762/** 4760/**
@@ -8645,7 +8643,6 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
8645 first->truesize += skb->truesize; 8643 first->truesize += skb->truesize;
8646 lro->last_frag = skb; 8644 lro->last_frag = skb;
8647 swstats->clubbed_frms_cnt++; 8645 swstats->clubbed_frms_cnt++;
8648 return;
8649} 8646}
8650 8647
8651/** 8648/**
diff --git a/drivers/net/s6gmac.c b/drivers/net/s6gmac.c
index 6b12524ad7c1..a7ff8ea342b4 100644
--- a/drivers/net/s6gmac.c
+++ b/drivers/net/s6gmac.c
@@ -852,8 +852,8 @@ static int s6gmac_tx(struct sk_buff *skb, struct net_device *dev)
852{ 852{
853 struct s6gmac *pd = netdev_priv(dev); 853 struct s6gmac *pd = netdev_priv(dev);
854 unsigned long flags; 854 unsigned long flags;
855
855 spin_lock_irqsave(&pd->lock, flags); 856 spin_lock_irqsave(&pd->lock, flags);
856 dev->trans_start = jiffies;
857 writel(skb->len << S6_GMAC_BURST_PREWR_LEN | 857 writel(skb->len << S6_GMAC_BURST_PREWR_LEN |
858 0 << S6_GMAC_BURST_PREWR_CFE | 858 0 << S6_GMAC_BURST_PREWR_CFE |
859 1 << S6_GMAC_BURST_PREWR_PPE | 859 1 << S6_GMAC_BURST_PREWR_PPE |
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index abc8eefdd4b6..a9ae505e1baf 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -426,7 +426,6 @@ sb1000_send_command(const int ioaddr[], const char* name,
426 if (sb1000_debug > 3) 426 if (sb1000_debug > 3)
427 printk(KERN_DEBUG "%s: sb1000_send_command out: %02x%02x%02x%02x" 427 printk(KERN_DEBUG "%s: sb1000_send_command out: %02x%02x%02x%02x"
428 "%02x%02x\n", name, out[0], out[1], out[2], out[3], out[4], out[5]); 428 "%02x%02x\n", name, out[0], out[1], out[2], out[3], out[4], out[5]);
429 return;
430} 429}
431 430
432/* Card Read Status (to be used during frame rx) */ 431/* Card Read Status (to be used during frame rx) */
@@ -438,7 +437,6 @@ sb1000_read_status(const int ioaddr[], unsigned char in[])
438 in[3] = inb(ioaddr[0] + 3); 437 in[3] = inb(ioaddr[0] + 3);
439 in[4] = inb(ioaddr[0] + 4); 438 in[4] = inb(ioaddr[0] + 4);
440 in[0] = inb(ioaddr[0] + 5); 439 in[0] = inb(ioaddr[0] + 5);
441 return;
442} 440}
443 441
444/* Issue Read Command (to be used during frame rx) */ 442/* Issue Read Command (to be used during frame rx) */
@@ -450,7 +448,6 @@ sb1000_issue_read_command(const int ioaddr[], const char* name)
450 sb1000_wait_for_ready_clear(ioaddr, name); 448 sb1000_wait_for_ready_clear(ioaddr, name);
451 outb(0xa0, ioaddr[0] + 6); 449 outb(0xa0, ioaddr[0] + 6);
452 sb1000_send_command(ioaddr, name, Command0); 450 sb1000_send_command(ioaddr, name, Command0);
453 return;
454} 451}
455 452
456 453
@@ -733,7 +730,6 @@ sb1000_print_status_buffer(const char* name, unsigned char st[],
733 printk("\n"); 730 printk("\n");
734 } 731 }
735 } 732 }
736 return;
737} 733}
738 734
739/* 735/*
@@ -926,7 +922,6 @@ sb1000_error_dpc(struct net_device *dev)
926 sb1000_read_status(ioaddr, st); 922 sb1000_read_status(ioaddr, st);
927 if (st[1] & 0x10) 923 if (st[1] & 0x10)
928 lp->rx_error_dpc_count = ErrorDpcCounterInitialize; 924 lp->rx_error_dpc_count = ErrorDpcCounterInitialize;
929 return;
930} 925}
931 926
932 927
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index fec3c29b2ea8..1f3acc3a5dfd 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2068,8 +2068,6 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
2068 return NETDEV_TX_BUSY; 2068 return NETDEV_TX_BUSY;
2069 } 2069 }
2070 2070
2071 dev->trans_start = jiffies;
2072
2073 spin_unlock_irqrestore(&sc->sbm_lock, flags); 2071 spin_unlock_irqrestore(&sc->sbm_lock, flags);
2074 2072
2075 return NETDEV_TX_OK; 2073 return NETDEV_TX_OK;
@@ -2488,7 +2486,7 @@ static void sbmac_tx_timeout (struct net_device *dev)
2488 spin_lock_irqsave(&sc->sbm_lock, flags); 2486 spin_lock_irqsave(&sc->sbm_lock, flags);
2489 2487
2490 2488
2491 dev->trans_start = jiffies; 2489 dev->trans_start = jiffies; /* prevent tx timeout */
2492 dev->stats.tx_errors++; 2490 dev->stats.tx_errors++;
2493 2491
2494 spin_unlock_irqrestore(&sc->sbm_lock, flags); 2492 spin_unlock_irqrestore(&sc->sbm_lock, flags);
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 1b3260588933..8c4067af32b0 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -987,8 +987,6 @@ static netdev_tx_t sc92031_start_xmit(struct sk_buff *skb,
987 iowrite32(tx_status, port_base + TxStatus0 + entry * 4); 987 iowrite32(tx_status, port_base + TxStatus0 + entry * 4);
988 mmiowb(); 988 mmiowb();
989 989
990 dev->trans_start = jiffies;
991
992 if (priv->tx_head - priv->tx_tail >= NUM_TX_DESC) 990 if (priv->tx_head - priv->tx_tail >= NUM_TX_DESC)
993 netif_stop_queue(dev); 991 netif_stop_queue(dev);
994 992
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index 374832cca11f..d2fce98f557f 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -390,7 +390,7 @@ static void seeq8005_timeout(struct net_device *dev)
390 tx_done(dev) ? "IRQ conflict" : "network cable problem"); 390 tx_done(dev) ? "IRQ conflict" : "network cable problem");
391 /* Try to restart the adaptor. */ 391 /* Try to restart the adaptor. */
392 seeq8005_init(dev, 1); 392 seeq8005_init(dev, 1);
393 dev->trans_start = jiffies; 393 dev->trans_start = jiffies; /* prevent tx timeout */
394 netif_wake_queue(dev); 394 netif_wake_queue(dev);
395} 395}
396 396
@@ -411,7 +411,6 @@ static netdev_tx_t seeq8005_send_packet(struct sk_buff *skb,
411 netif_stop_queue(dev); 411 netif_stop_queue(dev);
412 412
413 hardware_send_packet(dev, buf, length); 413 hardware_send_packet(dev, buf, length);
414 dev->trans_start = jiffies;
415 dev->stats.tx_bytes += length; 414 dev->stats.tx_bytes += length;
416 dev_kfree_skb (skb); 415 dev_kfree_skb (skb);
417 /* You might need to clean up and record Tx statistics here. */ 416 /* You might need to clean up and record Tx statistics here. */
@@ -579,7 +578,6 @@ static void seeq8005_rx(struct net_device *dev)
579 /* If any worth-while packets have been received, netif_rx() 578 /* If any worth-while packets have been received, netif_rx()
580 has done a mark_bh(NET_BH) for us and will work on them 579 has done a mark_bh(NET_BH) for us and will work on them
581 when we get to the bottom-half routine. */ 580 when we get to the bottom-half routine. */
582 return;
583} 581}
584 582
585/* The inverse routine to net_open(). */ 583/* The inverse routine to net_open(). */
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c
index c8fc896fc460..cc4bd8c65f8b 100644
--- a/drivers/net/sgiseeq.c
+++ b/drivers/net/sgiseeq.c
@@ -574,7 +574,7 @@ static inline int sgiseeq_reset(struct net_device *dev)
574 if (err) 574 if (err)
575 return err; 575 return err;
576 576
577 dev->trans_start = jiffies; 577 dev->trans_start = jiffies; /* prevent tx timeout */
578 netif_wake_queue(dev); 578 netif_wake_queue(dev);
579 579
580 return 0; 580 return 0;
@@ -638,8 +638,6 @@ static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
638 if (!(hregs->tx_ctrl & HPC3_ETXCTRL_ACTIVE)) 638 if (!(hregs->tx_ctrl & HPC3_ETXCTRL_ACTIVE))
639 kick_tx(dev, sp, hregs); 639 kick_tx(dev, sp, hregs);
640 640
641 dev->trans_start = jiffies;
642
643 if (!TX_BUFFS_AVAIL(sp)) 641 if (!TX_BUFFS_AVAIL(sp))
644 netif_stop_queue(dev); 642 netif_stop_queue(dev);
645 spin_unlock_irqrestore(&sp->tx_lock, flags); 643 spin_unlock_irqrestore(&sp->tx_lock, flags);
@@ -652,7 +650,7 @@ static void timeout(struct net_device *dev)
652 printk(KERN_NOTICE "%s: transmit timed out, resetting\n", dev->name); 650 printk(KERN_NOTICE "%s: transmit timed out, resetting\n", dev->name);
653 sgiseeq_reset(dev); 651 sgiseeq_reset(dev);
654 652
655 dev->trans_start = jiffies; 653 dev->trans_start = jiffies; /* prevent tx timeout */
656 netif_wake_queue(dev); 654 netif_wake_queue(dev);
657} 655}
658 656
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 6242b85d5d15..586ed0915a29 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1148,8 +1148,6 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1148 if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS)) 1148 if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS))
1149 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR); 1149 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR);
1150 1150
1151 ndev->trans_start = jiffies;
1152
1153 return NETDEV_TX_OK; 1151 return NETDEV_TX_OK;
1154} 1152}
1155 1153
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 6293592635be..bbbded76ff14 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -858,7 +858,6 @@ static void mdio_reset(long mdio_addr)
858 outl(MDDIR | MDIO | MDC, mdio_addr); 858 outl(MDDIR | MDIO | MDC, mdio_addr);
859 mdio_delay(); 859 mdio_delay();
860 } 860 }
861 return;
862} 861}
863 862
864/** 863/**
@@ -953,8 +952,6 @@ static void mdio_write(struct net_device *net_dev, int phy_id, int location,
953 mdio_delay(); 952 mdio_delay();
954 } 953 }
955 outl(0x00, mdio_addr); 954 outl(0x00, mdio_addr);
956
957 return;
958} 955}
959 956
960 957
@@ -1264,7 +1261,6 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1264 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, 1261 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV,
1265 (reg14h | 0x2000) & 0xBFFF); 1262 (reg14h | 0x2000) & 0xBFFF);
1266 } 1263 }
1267 return;
1268} 1264}
1269 1265
1270/** 1266/**
@@ -1553,14 +1549,13 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1553 1549
1554 spin_unlock_irqrestore(&sis_priv->lock, flags); 1550 spin_unlock_irqrestore(&sis_priv->lock, flags);
1555 1551
1556 net_dev->trans_start = jiffies; 1552 net_dev->trans_start = jiffies; /* prevent tx timeout */
1557 1553
1558 /* load Transmit Descriptor Register */ 1554 /* load Transmit Descriptor Register */
1559 outl(sis_priv->tx_ring_dma, ioaddr + txdp); 1555 outl(sis_priv->tx_ring_dma, ioaddr + txdp);
1560 1556
1561 /* Enable all known interrupts by setting the interrupt mask. */ 1557 /* Enable all known interrupts by setting the interrupt mask. */
1562 outl((RxSOVR|RxORN|RxERR|RxOK|TxURN|TxERR|TxIDLE), ioaddr + imr); 1558 outl((RxSOVR|RxORN|RxERR|RxOK|TxURN|TxERR|TxIDLE), ioaddr + imr);
1563 return;
1564} 1559}
1565 1560
1566/** 1561/**
@@ -1623,8 +1618,6 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1623 1618
1624 spin_unlock_irqrestore(&sis_priv->lock, flags); 1619 spin_unlock_irqrestore(&sis_priv->lock, flags);
1625 1620
1626 net_dev->trans_start = jiffies;
1627
1628 if (netif_msg_tx_queued(sis_priv)) 1621 if (netif_msg_tx_queued(sis_priv))
1629 printk(KERN_DEBUG "%s: Queued Tx packet at %p size %d " 1622 printk(KERN_DEBUG "%s: Queued Tx packet at %p size %d "
1630 "to slot %d.\n", 1623 "to slot %d.\n",
@@ -2332,8 +2325,6 @@ static void set_rx_mode(struct net_device *net_dev)
2332 /* restore cr */ 2325 /* restore cr */
2333 outl(cr_saved, ioaddr + cr); 2326 outl(cr_saved, ioaddr + cr);
2334 } 2327 }
2335
2336 return;
2337} 2328}
2338 2329
2339/** 2330/**
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 7912606b0bc7..31b2dabf094c 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -844,7 +844,6 @@ static void skfp_ctl_set_multicast_list(struct net_device *dev)
844 spin_lock_irqsave(&bp->DriverLock, Flags); 844 spin_lock_irqsave(&bp->DriverLock, Flags);
845 skfp_ctl_set_multicast_list_wo_lock(dev); 845 skfp_ctl_set_multicast_list_wo_lock(dev);
846 spin_unlock_irqrestore(&bp->DriverLock, Flags); 846 spin_unlock_irqrestore(&bp->DriverLock, Flags);
847 return;
848} // skfp_ctl_set_multicast_list 847} // skfp_ctl_set_multicast_list
849 848
850 849
@@ -898,7 +897,6 @@ static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev)
898 /* Update adapter filters */ 897 /* Update adapter filters */
899 mac_update_multicast(smc); 898 mac_update_multicast(smc);
900 } 899 }
901 return;
902} // skfp_ctl_set_multicast_list_wo_lock 900} // skfp_ctl_set_multicast_list_wo_lock
903 901
904 902
@@ -1076,7 +1074,6 @@ static netdev_tx_t skfp_send_pkt(struct sk_buff *skb,
1076 if (bp->QueueSkb == 0) { 1074 if (bp->QueueSkb == 0) {
1077 netif_stop_queue(dev); 1075 netif_stop_queue(dev);
1078 } 1076 }
1079 dev->trans_start = jiffies;
1080 return NETDEV_TX_OK; 1077 return NETDEV_TX_OK;
1081 1078
1082} // skfp_send_pkt 1079} // skfp_send_pkt
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index bf9c05be347b..2111c7bbf578 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -53,7 +53,7 @@
53#include "sky2.h" 53#include "sky2.h"
54 54
55#define DRV_NAME "sky2" 55#define DRV_NAME "sky2"
56#define DRV_VERSION "1.27" 56#define DRV_VERSION "1.28"
57 57
58/* 58/*
59 * The Yukon II chipset takes 64 bit command blocks (called list elements) 59 * The Yukon II chipset takes 64 bit command blocks (called list elements)
@@ -2275,8 +2275,8 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2275 sky2_write32(hw, B0_IMSK, 0); 2275 sky2_write32(hw, B0_IMSK, 0);
2276 2276
2277 dev->trans_start = jiffies; /* prevent tx timeout */ 2277 dev->trans_start = jiffies; /* prevent tx timeout */
2278 netif_stop_queue(dev);
2279 napi_disable(&hw->napi); 2278 napi_disable(&hw->napi);
2279 netif_tx_disable(dev);
2280 2280
2281 synchronize_irq(hw->pdev->irq); 2281 synchronize_irq(hw->pdev->irq);
2282 2282
@@ -3312,18 +3312,14 @@ static int sky2_reattach(struct net_device *dev)
3312 return err; 3312 return err;
3313} 3313}
3314 3314
3315static void sky2_restart(struct work_struct *work) 3315static void sky2_all_down(struct sky2_hw *hw)
3316{ 3316{
3317 struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
3318 u32 imask;
3319 int i; 3317 int i;
3320 3318
3321 rtnl_lock(); 3319 sky2_read32(hw, B0_IMSK);
3322
3323 napi_disable(&hw->napi);
3324 synchronize_irq(hw->pdev->irq);
3325 imask = sky2_read32(hw, B0_IMSK);
3326 sky2_write32(hw, B0_IMSK, 0); 3320 sky2_write32(hw, B0_IMSK, 0);
3321 synchronize_irq(hw->pdev->irq);
3322 napi_disable(&hw->napi);
3327 3323
3328 for (i = 0; i < hw->ports; i++) { 3324 for (i = 0; i < hw->ports; i++) {
3329 struct net_device *dev = hw->dev[i]; 3325 struct net_device *dev = hw->dev[i];
@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_struct *work)
3336 netif_tx_disable(dev); 3332 netif_tx_disable(dev);
3337 sky2_hw_down(sky2); 3333 sky2_hw_down(sky2);
3338 } 3334 }
3335}
3339 3336
3340 sky2_reset(hw); 3337static void sky2_all_up(struct sky2_hw *hw)
3338{
3339 u32 imask = Y2_IS_BASE;
3340 int i;
3341 3341
3342 for (i = 0; i < hw->ports; i++) { 3342 for (i = 0; i < hw->ports; i++) {
3343 struct net_device *dev = hw->dev[i]; 3343 struct net_device *dev = hw->dev[i];
@@ -3347,6 +3347,8 @@ static void sky2_restart(struct work_struct *work)
3347 continue; 3347 continue;
3348 3348
3349 sky2_hw_up(sky2); 3349 sky2_hw_up(sky2);
3350 sky2_set_multicast(dev);
3351 imask |= portirq_msk[i];
3350 netif_wake_queue(dev); 3352 netif_wake_queue(dev);
3351 } 3353 }
3352 3354
@@ -3355,6 +3357,17 @@ static void sky2_restart(struct work_struct *work)
3355 3357
3356 sky2_read32(hw, B0_Y2_SP_LISR); 3358 sky2_read32(hw, B0_Y2_SP_LISR);
3357 napi_enable(&hw->napi); 3359 napi_enable(&hw->napi);
3360}
3361
3362static void sky2_restart(struct work_struct *work)
3363{
3364 struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
3365
3366 rtnl_lock();
3367
3368 sky2_all_down(hw);
3369 sky2_reset(hw);
3370 sky2_all_up(hw);
3358 3371
3359 rtnl_unlock(); 3372 rtnl_unlock();
3360} 3373}
@@ -4913,12 +4926,12 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
4913 cancel_work_sync(&hw->restart_work); 4926 cancel_work_sync(&hw->restart_work);
4914 4927
4915 rtnl_lock(); 4928 rtnl_lock();
4929
4930 sky2_all_down(hw);
4916 for (i = 0; i < hw->ports; i++) { 4931 for (i = 0; i < hw->ports; i++) {
4917 struct net_device *dev = hw->dev[i]; 4932 struct net_device *dev = hw->dev[i];
4918 struct sky2_port *sky2 = netdev_priv(dev); 4933 struct sky2_port *sky2 = netdev_priv(dev);
4919 4934
4920 sky2_detach(dev);
4921
4922 if (sky2->wol) 4935 if (sky2->wol)
4923 sky2_wol_init(sky2); 4936 sky2_wol_init(sky2);
4924 4937
@@ -4927,8 +4940,6 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
4927 4940
4928 device_set_wakeup_enable(&pdev->dev, wol != 0); 4941 device_set_wakeup_enable(&pdev->dev, wol != 0);
4929 4942
4930 sky2_write32(hw, B0_IMSK, 0);
4931 napi_disable(&hw->napi);
4932 sky2_power_aux(hw); 4943 sky2_power_aux(hw);
4933 rtnl_unlock(); 4944 rtnl_unlock();
4934 4945
@@ -4943,12 +4954,11 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
4943static int sky2_resume(struct pci_dev *pdev) 4954static int sky2_resume(struct pci_dev *pdev)
4944{ 4955{
4945 struct sky2_hw *hw = pci_get_drvdata(pdev); 4956 struct sky2_hw *hw = pci_get_drvdata(pdev);
4946 int i, err; 4957 int err;
4947 4958
4948 if (!hw) 4959 if (!hw)
4949 return 0; 4960 return 0;
4950 4961
4951 rtnl_lock();
4952 err = pci_set_power_state(pdev, PCI_D0); 4962 err = pci_set_power_state(pdev, PCI_D0);
4953 if (err) 4963 if (err)
4954 goto out; 4964 goto out;
@@ -4966,20 +4976,13 @@ static int sky2_resume(struct pci_dev *pdev)
4966 goto out; 4976 goto out;
4967 } 4977 }
4968 4978
4979 rtnl_lock();
4969 sky2_reset(hw); 4980 sky2_reset(hw);
4970 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4981 sky2_all_up(hw);
4971 napi_enable(&hw->napi);
4972
4973 for (i = 0; i < hw->ports; i++) {
4974 err = sky2_reattach(hw->dev[i]);
4975 if (err)
4976 goto out;
4977 }
4978 rtnl_unlock(); 4982 rtnl_unlock();
4979 4983
4980 return 0; 4984 return 0;
4981out: 4985out:
4982 rtnl_unlock();
4983 4986
4984 dev_err(&pdev->dev, "resume failed (%d)\n", err); 4987 dev_err(&pdev->dev, "resume failed (%d)\n", err);
4985 pci_disable_device(pdev); 4988 pci_disable_device(pdev);
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c
index 140d63f3cafa..ac279fad9d45 100644
--- a/drivers/net/slhc.c
+++ b/drivers/net/slhc.c
@@ -731,7 +731,6 @@ void
731slhc_free(struct slcompress *comp) 731slhc_free(struct slcompress *comp)
732{ 732{
733 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_free"); 733 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_free");
734 return;
735} 734}
736struct slcompress * 735struct slcompress *
737slhc_init(int rslots, int tslots) 736slhc_init(int rslots, int tslots)
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 89696156c059..d92772e992d2 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -458,7 +458,7 @@ static void sl_tx_timeout(struct net_device *dev)
458 * 14 Oct 1994 Dmitry Gorodchanin. 458 * 14 Oct 1994 Dmitry Gorodchanin.
459 */ 459 */
460#ifdef SL_CHECK_TRANSMIT 460#ifdef SL_CHECK_TRANSMIT
461 if (time_before(jiffies, dev->trans_start + 20 * HZ)) { 461 if (time_before(jiffies, dev_trans_start(dev) + 20 * HZ)) {
462 /* 20 sec timeout not reached */ 462 /* 20 sec timeout not reached */
463 goto out; 463 goto out;
464 } 464 }
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c
index a93f122e9a96..d07c39cb4daf 100644
--- a/drivers/net/smc-mca.c
+++ b/drivers/net/smc-mca.c
@@ -460,7 +460,6 @@ static void ultramca_reset_8390(struct net_device *dev)
460 460
461 if (ei_debug > 1) 461 if (ei_debug > 1)
462 printk("reset done\n"); 462 printk("reset done\n");
463 return;
464} 463}
465 464
466/* Grab the 8390 specific header. Similar to the block_input routine, but 465/* Grab the 8390 specific header. Similar to the block_input routine, but
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index 0291ea098a06..d2dd8e6113ab 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -421,7 +421,6 @@ ultra_reset_8390(struct net_device *dev)
421 outb(0x01, cmd_port + 6); /* Enable interrupts and memory. */ 421 outb(0x01, cmd_port + 6); /* Enable interrupts and memory. */
422 422
423 if (ei_debug > 1) printk("reset done\n"); 423 if (ei_debug > 1) printk("reset done\n");
424 return;
425} 424}
426 425
427/* Grab the 8390 specific header. Similar to the block_input routine, but 426/* Grab the 8390 specific header. Similar to the block_input routine, but
diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c
index 7a554adc70fb..e459c3b2510a 100644
--- a/drivers/net/smc-ultra32.c
+++ b/drivers/net/smc-ultra32.c
@@ -352,7 +352,6 @@ static void ultra32_reset_8390(struct net_device *dev)
352 outb(0x84, ioaddr + 5); /* Enable MEM16 & Disable Bus Master. */ 352 outb(0x84, ioaddr + 5); /* Enable MEM16 & Disable Bus Master. */
353 outb(0x01, ioaddr + 6); /* Enable Interrupts. */ 353 outb(0x01, ioaddr + 6); /* Enable Interrupts. */
354 if (ei_debug > 1) printk("reset done\n"); 354 if (ei_debug > 1) printk("reset done\n");
355 return;
356} 355}
357 356
358/* Grab the 8390 specific header. Similar to the block_input routine, but 357/* Grab the 8390 specific header. Similar to the block_input routine, but
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 1e49fcfa28ab..66831f378396 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1289,7 +1289,7 @@ static void smc911x_timeout(struct net_device *dev)
1289 schedule_work(&lp->phy_configure); 1289 schedule_work(&lp->phy_configure);
1290 1290
1291 /* We can accept TX packets again */ 1291 /* We can accept TX packets again */
1292 dev->trans_start = jiffies; 1292 dev->trans_start = jiffies; /* prevent tx timeout */
1293 netif_wake_queue(dev); 1293 netif_wake_queue(dev);
1294} 1294}
1295 1295
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index d76c8154f52b..7486d0908064 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -691,8 +691,6 @@ static void smc_hardware_send_packet( struct net_device * dev )
691 691
692 /* we can send another packet */ 692 /* we can send another packet */
693 netif_wake_queue(dev); 693 netif_wake_queue(dev);
694
695 return;
696} 694}
697 695
698/*------------------------------------------------------------------------- 696/*-------------------------------------------------------------------------
@@ -1164,7 +1162,7 @@ static void smc_timeout(struct net_device *dev)
1164 /* "kick" the adaptor */ 1162 /* "kick" the adaptor */
1165 smc_reset( dev->base_addr ); 1163 smc_reset( dev->base_addr );
1166 smc_enable( dev->base_addr ); 1164 smc_enable( dev->base_addr );
1167 dev->trans_start = jiffies; 1165 dev->trans_start = jiffies; /* prevent tx timeout */
1168 /* clear anything saved */ 1166 /* clear anything saved */
1169 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL; 1167 ((struct smc_local *)netdev_priv(dev))->saved_skb = NULL;
1170 netif_wake_queue(dev); 1168 netif_wake_queue(dev);
@@ -1355,7 +1353,6 @@ static void smc_tx( struct net_device * dev )
1355 lp->packets_waiting--; 1353 lp->packets_waiting--;
1356 1354
1357 outb( saved_packet, ioaddr + PNR_ARR ); 1355 outb( saved_packet, ioaddr + PNR_ARR );
1358 return;
1359} 1356}
1360 1357
1361/*-------------------------------------------------------------------- 1358/*--------------------------------------------------------------------
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 682bc4fe604f..10cf0cbc2185 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1360,7 +1360,7 @@ static void smc_timeout(struct net_device *dev)
1360 schedule_work(&lp->phy_configure); 1360 schedule_work(&lp->phy_configure);
1361 1361
1362 /* We can accept TX packets again */ 1362 /* We can accept TX packets again */
1363 dev->trans_start = jiffies; 1363 dev->trans_start = jiffies; /* prevent tx timeout */
1364 netif_wake_queue(dev); 1364 netif_wake_queue(dev);
1365} 1365}
1366 1366
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 746fb91a0fb0..89f35f94f720 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1335,7 +1335,6 @@ static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1335 smsc911x_tx_writefifo(pdata, (unsigned int *)bufp, wrsz); 1335 smsc911x_tx_writefifo(pdata, (unsigned int *)bufp, wrsz);
1336 freespace -= (skb->len + 32); 1336 freespace -= (skb->len + 32);
1337 dev_kfree_skb(skb); 1337 dev_kfree_skb(skb);
1338 dev->trans_start = jiffies;
1339 1338
1340 if (unlikely(smsc911x_tx_get_txstatcount(pdata) >= 30)) 1339 if (unlikely(smsc911x_tx_get_txstatcount(pdata) >= 30))
1341 smsc911x_tx_update_txcounters(dev); 1340 smsc911x_tx_update_txcounters(dev);
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index ada05c452175..6cdee6a15f9f 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1034,8 +1034,6 @@ static netdev_tx_t smsc9420_hard_start_xmit(struct sk_buff *skb,
1034 smsc9420_reg_write(pd, TX_POLL_DEMAND, 1); 1034 smsc9420_reg_write(pd, TX_POLL_DEMAND, 1);
1035 smsc9420_pci_flush_write(pd); 1035 smsc9420_pci_flush_write(pd);
1036 1036
1037 dev->trans_start = jiffies;
1038
1039 return NETDEV_TX_OK; 1037 return NETDEV_TX_OK;
1040} 1038}
1041 1039
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c
index e5d67327d707..26e25d7f5829 100644
--- a/drivers/net/sonic.c
+++ b/drivers/net/sonic.c
@@ -174,7 +174,7 @@ static void sonic_tx_timeout(struct net_device *dev)
174 /* Try to restart the adaptor. */ 174 /* Try to restart the adaptor. */
175 sonic_init(dev); 175 sonic_init(dev);
176 lp->stats.tx_errors++; 176 lp->stats.tx_errors++;
177 dev->trans_start = jiffies; 177 dev->trans_start = jiffies; /* prevent tx timeout */
178 netif_wake_queue(dev); 178 netif_wake_queue(dev);
179} 179}
180 180
@@ -263,8 +263,6 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
263 263
264 SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); 264 SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
265 265
266 dev->trans_start = jiffies;
267
268 return NETDEV_TX_OK; 266 return NETDEV_TX_OK;
269} 267}
270 268
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 3dff280b438b..1636a34d95dd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -2095,8 +2095,6 @@ static void spider_net_link_phy(unsigned long data)
2095 card->netdev->name, phy->speed, 2095 card->netdev->name, phy->speed,
2096 phy->duplex == 1 ? "Full" : "Half", 2096 phy->duplex == 1 ? "Full" : "Half",
2097 phy->autoneg == 1 ? "" : "no "); 2097 phy->autoneg == 1 ? "" : "no ");
2098
2099 return;
2100} 2098}
2101 2099
2102/** 2100/**
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 8a6d27cdc0bd..74b7ae76906e 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1173,7 +1173,7 @@ static void tx_timeout(struct net_device *dev)
1173 1173
1174 /* Trigger an immediate transmit demand. */ 1174 /* Trigger an immediate transmit demand. */
1175 1175
1176 dev->trans_start = jiffies; 1176 dev->trans_start = jiffies; /* prevent tx timeout */
1177 np->stats.tx_errors++; 1177 np->stats.tx_errors++;
1178 netif_wake_queue(dev); 1178 netif_wake_queue(dev);
1179} 1179}
@@ -1221,8 +1221,6 @@ static void init_ring(struct net_device *dev)
1221 1221
1222 for (i = 0; i < TX_RING_SIZE; i++) 1222 for (i = 0; i < TX_RING_SIZE; i++)
1223 memset(&np->tx_info[i], 0, sizeof(np->tx_info[i])); 1223 memset(&np->tx_info[i], 0, sizeof(np->tx_info[i]));
1224
1225 return;
1226} 1224}
1227 1225
1228 1226
@@ -1312,8 +1310,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1312 if ((np->cur_tx - np->dirty_tx) + 4 > TX_RING_SIZE) 1310 if ((np->cur_tx - np->dirty_tx) + 4 > TX_RING_SIZE)
1313 netif_stop_queue(dev); 1311 netif_stop_queue(dev);
1314 1312
1315 dev->trans_start = jiffies;
1316
1317 return NETDEV_TX_OK; 1313 return NETDEV_TX_OK;
1318} 1314}
1319 1315
diff --git a/drivers/net/stmmac/dwmac1000_core.c b/drivers/net/stmmac/dwmac1000_core.c
index 0aa89ae9b8e9..917b4e16923b 100644
--- a/drivers/net/stmmac/dwmac1000_core.c
+++ b/drivers/net/stmmac/dwmac1000_core.c
@@ -48,7 +48,6 @@ static void dwmac1000_core_init(unsigned long ioaddr)
48 /* Tag detection without filtering */ 48 /* Tag detection without filtering */
49 writel(0x0, ioaddr + GMAC_VLAN_TAG); 49 writel(0x0, ioaddr + GMAC_VLAN_TAG);
50#endif 50#endif
51 return;
52} 51}
53 52
54static void dwmac1000_dump_regs(unsigned long ioaddr) 53static void dwmac1000_dump_regs(unsigned long ioaddr)
@@ -61,7 +60,6 @@ static void dwmac1000_dump_regs(unsigned long ioaddr)
61 pr_info("\tReg No. %d (offset 0x%x): 0x%08x\n", i, 60 pr_info("\tReg No. %d (offset 0x%x): 0x%08x\n", i,
62 offset, readl(ioaddr + offset)); 61 offset, readl(ioaddr + offset));
63 } 62 }
64 return;
65} 63}
66 64
67static void dwmac1000_set_umac_addr(unsigned long ioaddr, unsigned char *addr, 65static void dwmac1000_set_umac_addr(unsigned long ioaddr, unsigned char *addr,
@@ -139,8 +137,6 @@ static void dwmac1000_set_filter(struct net_device *dev)
139 CHIP_DBG(KERN_INFO "\tFrame Filter reg: 0x%08x\n\tHash regs: " 137 CHIP_DBG(KERN_INFO "\tFrame Filter reg: 0x%08x\n\tHash regs: "
140 "HI 0x%08x, LO 0x%08x\n", readl(ioaddr + GMAC_FRAME_FILTER), 138 "HI 0x%08x, LO 0x%08x\n", readl(ioaddr + GMAC_FRAME_FILTER),
141 readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW)); 139 readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW));
142
143 return;
144} 140}
145 141
146static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex, 142static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
@@ -164,7 +160,6 @@ static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
164 } 160 }
165 161
166 writel(flow, ioaddr + GMAC_FLOW_CTRL); 162 writel(flow, ioaddr + GMAC_FLOW_CTRL);
167 return;
168} 163}
169 164
170static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode) 165static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode)
@@ -180,7 +175,6 @@ static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode)
180 } 175 }
181 176
182 writel(pmt, ioaddr + GMAC_PMT); 177 writel(pmt, ioaddr + GMAC_PMT);
183 return;
184} 178}
185 179
186 180
@@ -204,8 +198,6 @@ static void dwmac1000_irq_status(unsigned long ioaddr)
204 * status register. */ 198 * status register. */
205 readl(ioaddr + GMAC_PMT); 199 readl(ioaddr + GMAC_PMT);
206 } 200 }
207
208 return;
209} 201}
210 202
211struct stmmac_ops dwmac1000_ops = { 203struct stmmac_ops dwmac1000_ops = {
diff --git a/drivers/net/stmmac/dwmac1000_dma.c b/drivers/net/stmmac/dwmac1000_dma.c
index a547aa99e114..415805057cb0 100644
--- a/drivers/net/stmmac/dwmac1000_dma.c
+++ b/drivers/net/stmmac/dwmac1000_dma.c
@@ -107,7 +107,6 @@ static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode,
107 } 107 }
108 108
109 writel(csr6, ioaddr + DMA_CONTROL); 109 writel(csr6, ioaddr + DMA_CONTROL);
110 return;
111} 110}
112 111
113/* Not yet implemented --- no RMON module */ 112/* Not yet implemented --- no RMON module */
@@ -129,7 +128,6 @@ static void dwmac1000_dump_dma_regs(unsigned long ioaddr)
129 readl(ioaddr + DMA_BUS_MODE + offset)); 128 readl(ioaddr + DMA_BUS_MODE + offset));
130 } 129 }
131 } 130 }
132 return;
133} 131}
134 132
135struct stmmac_dma_ops dwmac1000_dma_ops = { 133struct stmmac_dma_ops dwmac1000_dma_ops = {
diff --git a/drivers/net/stmmac/dwmac100_core.c b/drivers/net/stmmac/dwmac100_core.c
index fab14a4cb14c..6f270a0e151a 100644
--- a/drivers/net/stmmac/dwmac100_core.c
+++ b/drivers/net/stmmac/dwmac100_core.c
@@ -40,7 +40,6 @@ static void dwmac100_core_init(unsigned long ioaddr)
40#ifdef STMMAC_VLAN_TAG_USED 40#ifdef STMMAC_VLAN_TAG_USED
41 writel(ETH_P_8021Q, ioaddr + MAC_VLAN1); 41 writel(ETH_P_8021Q, ioaddr + MAC_VLAN1);
42#endif 42#endif
43 return;
44} 43}
45 44
46static void dwmac100_dump_mac_regs(unsigned long ioaddr) 45static void dwmac100_dump_mac_regs(unsigned long ioaddr)
@@ -76,7 +75,6 @@ static void dwmac100_dump_mac_regs(unsigned long ioaddr)
76 MMC_HIGH_INTR_MASK, readl(ioaddr + MMC_HIGH_INTR_MASK)); 75 MMC_HIGH_INTR_MASK, readl(ioaddr + MMC_HIGH_INTR_MASK));
77 pr_info("\t MMC Low Interrupt Mask (offset 0x%x): 0x%08x\n", 76 pr_info("\t MMC Low Interrupt Mask (offset 0x%x): 0x%08x\n",
78 MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK)); 77 MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK));
79 return;
80} 78}
81 79
82static void dwmac100_irq_status(unsigned long ioaddr) 80static void dwmac100_irq_status(unsigned long ioaddr)
@@ -145,7 +143,6 @@ static void dwmac100_set_filter(struct net_device *dev)
145 "HI 0x%08x, LO 0x%08x\n", 143 "HI 0x%08x, LO 0x%08x\n",
146 __func__, readl(ioaddr + MAC_CONTROL), 144 __func__, readl(ioaddr + MAC_CONTROL),
147 readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW)); 145 readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW));
148 return;
149} 146}
150 147
151static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex, 148static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
@@ -156,8 +153,6 @@ static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
156 if (duplex) 153 if (duplex)
157 flow |= (pause_time << MAC_FLOW_CTRL_PT_SHIFT); 154 flow |= (pause_time << MAC_FLOW_CTRL_PT_SHIFT);
158 writel(flow, ioaddr + MAC_FLOW_CTRL); 155 writel(flow, ioaddr + MAC_FLOW_CTRL);
159
160 return;
161} 156}
162 157
163/* No PMT module supported for this Ethernet Controller. 158/* No PMT module supported for this Ethernet Controller.
diff --git a/drivers/net/stmmac/dwmac100_dma.c b/drivers/net/stmmac/dwmac100_dma.c
index 96d098d68ad6..2fece7b72727 100644
--- a/drivers/net/stmmac/dwmac100_dma.c
+++ b/drivers/net/stmmac/dwmac100_dma.c
@@ -71,8 +71,6 @@ static void dwmac100_dma_operation_mode(unsigned long ioaddr, int txmode,
71 csr6 |= DMA_CONTROL_TTC_128; 71 csr6 |= DMA_CONTROL_TTC_128;
72 72
73 writel(csr6, ioaddr + DMA_CONTROL); 73 writel(csr6, ioaddr + DMA_CONTROL);
74
75 return;
76} 74}
77 75
78static void dwmac100_dump_dma_regs(unsigned long ioaddr) 76static void dwmac100_dump_dma_regs(unsigned long ioaddr)
@@ -88,7 +86,6 @@ static void dwmac100_dump_dma_regs(unsigned long ioaddr)
88 DMA_CUR_TX_BUF_ADDR, readl(ioaddr + DMA_CUR_TX_BUF_ADDR)); 86 DMA_CUR_TX_BUF_ADDR, readl(ioaddr + DMA_CUR_TX_BUF_ADDR));
89 CHIP_DBG(KERN_DEBUG "\t CSR21 (offset 0x%x): 0x%08x\n", 87 CHIP_DBG(KERN_DEBUG "\t CSR21 (offset 0x%x): 0x%08x\n",
90 DMA_CUR_RX_BUF_ADDR, readl(ioaddr + DMA_CUR_RX_BUF_ADDR)); 88 DMA_CUR_RX_BUF_ADDR, readl(ioaddr + DMA_CUR_RX_BUF_ADDR));
91 return;
92} 89}
93 90
94/* DMA controller has two counters to track the number of 91/* DMA controller has two counters to track the number of
@@ -119,7 +116,6 @@ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
119 x->rx_missed_cntr += miss_f; 116 x->rx_missed_cntr += miss_f;
120 } 117 }
121 } 118 }
122 return;
123} 119}
124 120
125struct stmmac_dma_ops dwmac100_dma_ops = { 121struct stmmac_dma_ops dwmac100_dma_ops = {
diff --git a/drivers/net/stmmac/dwmac_lib.c b/drivers/net/stmmac/dwmac_lib.c
index 0a504adb7eb3..a85415216ef4 100644
--- a/drivers/net/stmmac/dwmac_lib.c
+++ b/drivers/net/stmmac/dwmac_lib.c
@@ -52,7 +52,6 @@ void dwmac_dma_start_tx(unsigned long ioaddr)
52 u32 value = readl(ioaddr + DMA_CONTROL); 52 u32 value = readl(ioaddr + DMA_CONTROL);
53 value |= DMA_CONTROL_ST; 53 value |= DMA_CONTROL_ST;
54 writel(value, ioaddr + DMA_CONTROL); 54 writel(value, ioaddr + DMA_CONTROL);
55 return;
56} 55}
57 56
58void dwmac_dma_stop_tx(unsigned long ioaddr) 57void dwmac_dma_stop_tx(unsigned long ioaddr)
@@ -60,7 +59,6 @@ void dwmac_dma_stop_tx(unsigned long ioaddr)
60 u32 value = readl(ioaddr + DMA_CONTROL); 59 u32 value = readl(ioaddr + DMA_CONTROL);
61 value &= ~DMA_CONTROL_ST; 60 value &= ~DMA_CONTROL_ST;
62 writel(value, ioaddr + DMA_CONTROL); 61 writel(value, ioaddr + DMA_CONTROL);
63 return;
64} 62}
65 63
66void dwmac_dma_start_rx(unsigned long ioaddr) 64void dwmac_dma_start_rx(unsigned long ioaddr)
@@ -68,8 +66,6 @@ void dwmac_dma_start_rx(unsigned long ioaddr)
68 u32 value = readl(ioaddr + DMA_CONTROL); 66 u32 value = readl(ioaddr + DMA_CONTROL);
69 value |= DMA_CONTROL_SR; 67 value |= DMA_CONTROL_SR;
70 writel(value, ioaddr + DMA_CONTROL); 68 writel(value, ioaddr + DMA_CONTROL);
71
72 return;
73} 69}
74 70
75void dwmac_dma_stop_rx(unsigned long ioaddr) 71void dwmac_dma_stop_rx(unsigned long ioaddr)
@@ -77,8 +73,6 @@ void dwmac_dma_stop_rx(unsigned long ioaddr)
77 u32 value = readl(ioaddr + DMA_CONTROL); 73 u32 value = readl(ioaddr + DMA_CONTROL);
78 value &= ~DMA_CONTROL_SR; 74 value &= ~DMA_CONTROL_SR;
79 writel(value, ioaddr + DMA_CONTROL); 75 writel(value, ioaddr + DMA_CONTROL);
80
81 return;
82} 76}
83 77
84#ifdef DWMAC_DMA_DEBUG 78#ifdef DWMAC_DMA_DEBUG
@@ -111,7 +105,6 @@ static void show_tx_process_state(unsigned int status)
111 default: 105 default:
112 break; 106 break;
113 } 107 }
114 return;
115} 108}
116 109
117static void show_rx_process_state(unsigned int status) 110static void show_rx_process_state(unsigned int status)
@@ -149,7 +142,6 @@ static void show_rx_process_state(unsigned int status)
149 default: 142 default:
150 break; 143 break;
151 } 144 }
152 return;
153} 145}
154#endif 146#endif
155 147
@@ -244,8 +236,6 @@ void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6],
244 writel(data, ioaddr + high); 236 writel(data, ioaddr + high);
245 data = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0]; 237 data = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0];
246 writel(data, ioaddr + low); 238 writel(data, ioaddr + low);
247
248 return;
249} 239}
250 240
251void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr, 241void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr,
@@ -264,7 +254,5 @@ void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr,
264 addr[3] = (lo_addr >> 24) & 0xff; 254 addr[3] = (lo_addr >> 24) & 0xff;
265 addr[4] = hi_addr & 0xff; 255 addr[4] = hi_addr & 0xff;
266 addr[5] = (hi_addr >> 8) & 0xff; 256 addr[5] = (hi_addr >> 8) & 0xff;
267
268 return;
269} 257}
270 258
diff --git a/drivers/net/stmmac/enh_desc.c b/drivers/net/stmmac/enh_desc.c
index eb5684a1f713..3c18ebece043 100644
--- a/drivers/net/stmmac/enh_desc.c
+++ b/drivers/net/stmmac/enh_desc.c
@@ -241,7 +241,6 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
241 p->des01.erx.disable_ic = 1; 241 p->des01.erx.disable_ic = 1;
242 p++; 242 p++;
243 } 243 }
244 return;
245} 244}
246 245
247static void enh_desc_init_tx_desc(struct dma_desc *p, unsigned int ring_size) 246static void enh_desc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
@@ -254,8 +253,6 @@ static void enh_desc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
254 p->des01.etx.end_ring = 1; 253 p->des01.etx.end_ring = 1;
255 p++; 254 p++;
256 } 255 }
257
258 return;
259} 256}
260 257
261static int enh_desc_get_tx_owner(struct dma_desc *p) 258static int enh_desc_get_tx_owner(struct dma_desc *p)
@@ -289,8 +286,6 @@ static void enh_desc_release_tx_desc(struct dma_desc *p)
289 286
290 memset(p, 0, sizeof(struct dma_desc)); 287 memset(p, 0, sizeof(struct dma_desc));
291 p->des01.etx.end_ring = ter; 288 p->des01.etx.end_ring = ter;
292
293 return;
294} 289}
295 290
296static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len, 291static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
diff --git a/drivers/net/stmmac/norm_desc.c b/drivers/net/stmmac/norm_desc.c
index ecfcc001a04a..31ad53643792 100644
--- a/drivers/net/stmmac/norm_desc.c
+++ b/drivers/net/stmmac/norm_desc.c
@@ -132,7 +132,6 @@ static void ndesc_init_rx_desc(struct dma_desc *p, unsigned int ring_size,
132 p->des01.rx.disable_ic = 1; 132 p->des01.rx.disable_ic = 1;
133 p++; 133 p++;
134 } 134 }
135 return;
136} 135}
137 136
138static void ndesc_init_tx_desc(struct dma_desc *p, unsigned int ring_size) 137static void ndesc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
@@ -144,7 +143,6 @@ static void ndesc_init_tx_desc(struct dma_desc *p, unsigned int ring_size)
144 p->des01.tx.end_ring = 1; 143 p->des01.tx.end_ring = 1;
145 p++; 144 p++;
146 } 145 }
147 return;
148} 146}
149 147
150static int ndesc_get_tx_owner(struct dma_desc *p) 148static int ndesc_get_tx_owner(struct dma_desc *p)
@@ -194,8 +192,6 @@ static void ndesc_release_tx_desc(struct dma_desc *p)
194 192
195 /* set termination field */ 193 /* set termination field */
196 p->des01.tx.end_ring = ter; 194 p->des01.tx.end_ring = ter;
197
198 return;
199} 195}
200 196
201static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len, 197static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c
index c021eaa3ca69..f080509923f0 100644
--- a/drivers/net/stmmac/stmmac_ethtool.c
+++ b/drivers/net/stmmac/stmmac_ethtool.c
@@ -102,7 +102,6 @@ void stmmac_ethtool_getdrvinfo(struct net_device *dev,
102 strcpy(info->version, DRV_MODULE_VERSION); 102 strcpy(info->version, DRV_MODULE_VERSION);
103 info->fw_version[0] = '\0'; 103 info->fw_version[0] = '\0';
104 info->n_stats = STMMAC_STATS_LEN; 104 info->n_stats = STMMAC_STATS_LEN;
105 return;
106} 105}
107 106
108int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) 107int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -194,8 +193,6 @@ void stmmac_ethtool_gregs(struct net_device *dev,
194 reg_space[i + 55] = 193 reg_space[i + 55] =
195 readl(dev->base_addr + (DMA_BUS_MODE + (i * 4))); 194 readl(dev->base_addr + (DMA_BUS_MODE + (i * 4)));
196 } 195 }
197
198 return;
199} 196}
200 197
201int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data) 198int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
@@ -233,7 +230,6 @@ stmmac_get_pauseparam(struct net_device *netdev,
233 pause->tx_pause = 1; 230 pause->tx_pause = 1;
234 231
235 spin_unlock(&priv->lock); 232 spin_unlock(&priv->lock);
236 return;
237} 233}
238 234
239static int 235static int
@@ -292,8 +288,6 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
292 data[i] = (stmmac_gstrings_stats[i].sizeof_stat == 288 data[i] = (stmmac_gstrings_stats[i].sizeof_stat ==
293 sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p); 289 sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
294 } 290 }
295
296 return;
297} 291}
298 292
299static int stmmac_get_sset_count(struct net_device *netdev, int sset) 293static int stmmac_get_sset_count(struct net_device *netdev, int sset)
@@ -323,7 +317,6 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
323 WARN_ON(1); 317 WARN_ON(1);
324 break; 318 break;
325 } 319 }
326 return;
327} 320}
328 321
329/* Currently only support WOL through Magic packet. */ 322/* Currently only support WOL through Magic packet. */
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 7ac6ddea989e..a31d580f306d 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -169,8 +169,6 @@ static void stmmac_verify_args(void)
169 flow_ctrl = FLOW_OFF; 169 flow_ctrl = FLOW_OFF;
170 if (unlikely((pause < 0) || (pause > 0xffff))) 170 if (unlikely((pause < 0) || (pause > 0xffff)))
171 pause = PAUSE_TIME; 171 pause = PAUSE_TIME;
172
173 return;
174} 172}
175 173
176#if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG) 174#if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
@@ -184,7 +182,6 @@ static void print_pkt(unsigned char *buf, int len)
184 pr_info(" %02x", buf[j]); 182 pr_info(" %02x", buf[j]);
185 } 183 }
186 pr_info("\n"); 184 pr_info("\n");
187 return;
188} 185}
189#endif 186#endif
190 187
@@ -514,7 +511,6 @@ static void init_dma_desc_rings(struct net_device *dev)
514 pr_info("TX descriptor ring:\n"); 511 pr_info("TX descriptor ring:\n");
515 display_ring(priv->dma_tx, txsize); 512 display_ring(priv->dma_tx, txsize);
516 } 513 }
517 return;
518} 514}
519 515
520static void dma_free_rx_skbufs(struct stmmac_priv *priv) 516static void dma_free_rx_skbufs(struct stmmac_priv *priv)
@@ -529,7 +525,6 @@ static void dma_free_rx_skbufs(struct stmmac_priv *priv)
529 } 525 }
530 priv->rx_skbuff[i] = NULL; 526 priv->rx_skbuff[i] = NULL;
531 } 527 }
532 return;
533} 528}
534 529
535static void dma_free_tx_skbufs(struct stmmac_priv *priv) 530static void dma_free_tx_skbufs(struct stmmac_priv *priv)
@@ -547,7 +542,6 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
547 priv->tx_skbuff[i] = NULL; 542 priv->tx_skbuff[i] = NULL;
548 } 543 }
549 } 544 }
550 return;
551} 545}
552 546
553static void free_dma_desc_resources(struct stmmac_priv *priv) 547static void free_dma_desc_resources(struct stmmac_priv *priv)
@@ -567,8 +561,6 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
567 kfree(priv->rx_skbuff_dma); 561 kfree(priv->rx_skbuff_dma);
568 kfree(priv->rx_skbuff); 562 kfree(priv->rx_skbuff);
569 kfree(priv->tx_skbuff); 563 kfree(priv->tx_skbuff);
570
571 return;
572} 564}
573 565
574/** 566/**
@@ -598,8 +590,6 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
598 } 590 }
599 } 591 }
600 tx_coe = priv->tx_coe; 592 tx_coe = priv->tx_coe;
601
602 return;
603} 593}
604 594
605/** 595/**
@@ -675,7 +665,6 @@ static void stmmac_tx(struct stmmac_priv *priv)
675 } 665 }
676 netif_tx_unlock(priv->dev); 666 netif_tx_unlock(priv->dev);
677 } 667 }
678 return;
679} 668}
680 669
681static inline void stmmac_enable_irq(struct stmmac_priv *priv) 670static inline void stmmac_enable_irq(struct stmmac_priv *priv)
@@ -731,8 +720,6 @@ void stmmac_schedule(struct net_device *dev)
731 priv->xstats.sched_timer_n++; 720 priv->xstats.sched_timer_n++;
732 721
733 _stmmac_schedule(priv); 722 _stmmac_schedule(priv);
734
735 return;
736} 723}
737 724
738static void stmmac_no_timer_started(unsigned int x) 725static void stmmac_no_timer_started(unsigned int x)
@@ -763,8 +750,6 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
763 750
764 priv->dev->stats.tx_errors++; 751 priv->dev->stats.tx_errors++;
765 netif_wake_queue(priv->dev); 752 netif_wake_queue(priv->dev);
766
767 return;
768} 753}
769 754
770 755
@@ -788,8 +773,6 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv)
788 stmmac_tx_err(priv); 773 stmmac_tx_err(priv);
789 } else if (unlikely(status == tx_hard_error)) 774 } else if (unlikely(status == tx_hard_error))
790 stmmac_tx_err(priv); 775 stmmac_tx_err(priv);
791
792 return;
793} 776}
794 777
795/** 778/**
@@ -1197,7 +1180,6 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
1197 } 1180 }
1198 priv->hw->desc->set_rx_owner(p + entry); 1181 priv->hw->desc->set_rx_owner(p + entry);
1199 } 1182 }
1200 return;
1201} 1183}
1202 1184
1203static int stmmac_rx(struct stmmac_priv *priv, int limit) 1185static int stmmac_rx(struct stmmac_priv *priv, int limit)
@@ -1331,7 +1313,6 @@ static void stmmac_tx_timeout(struct net_device *dev)
1331 1313
1332 /* Clear Tx resources and restart transmitting again */ 1314 /* Clear Tx resources and restart transmitting again */
1333 stmmac_tx_err(priv); 1315 stmmac_tx_err(priv);
1334 return;
1335} 1316}
1336 1317
1337/* Configuration changes (passed on by ifconfig) */ 1318/* Configuration changes (passed on by ifconfig) */
@@ -1373,7 +1354,6 @@ static void stmmac_multicast_list(struct net_device *dev)
1373 spin_lock(&priv->lock); 1354 spin_lock(&priv->lock);
1374 priv->hw->mac->set_filter(dev); 1355 priv->hw->mac->set_filter(dev);
1375 spin_unlock(&priv->lock); 1356 spin_unlock(&priv->lock);
1376 return;
1377} 1357}
1378 1358
1379/** 1359/**
@@ -1489,8 +1469,6 @@ static void stmmac_vlan_rx_register(struct net_device *dev,
1489 spin_lock(&priv->lock); 1469 spin_lock(&priv->lock);
1490 priv->vlgrp = grp; 1470 priv->vlgrp = grp;
1491 spin_unlock(&priv->lock); 1471 spin_unlock(&priv->lock);
1492
1493 return;
1494} 1472}
1495#endif 1473#endif
1496 1474
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c
index 679f61ffb1f8..2a0e1abde7e7 100644
--- a/drivers/net/stmmac/stmmac_timer.c
+++ b/drivers/net/stmmac/stmmac_timer.c
@@ -31,8 +31,6 @@ static void stmmac_timer_handler(void *data)
31 struct net_device *dev = (struct net_device *)data; 31 struct net_device *dev = (struct net_device *)data;
32 32
33 stmmac_schedule(dev); 33 stmmac_schedule(dev);
34
35 return;
36} 34}
37 35
38#define STMMAC_TIMER_MSG(timer, freq) \ 36#define STMMAC_TIMER_MSG(timer, freq) \
@@ -47,13 +45,11 @@ static void stmmac_rtc_start(unsigned int new_freq)
47{ 45{
48 rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq); 46 rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq);
49 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1); 47 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1);
50 return;
51} 48}
52 49
53static void stmmac_rtc_stop(void) 50static void stmmac_rtc_stop(void)
54{ 51{
55 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0); 52 rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0);
56 return;
57} 53}
58 54
59int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) 55int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
@@ -102,13 +98,11 @@ static void stmmac_tmu_start(unsigned int new_freq)
102{ 98{
103 clk_set_rate(timer_clock, new_freq); 99 clk_set_rate(timer_clock, new_freq);
104 clk_enable(timer_clock); 100 clk_enable(timer_clock);
105 return;
106} 101}
107 102
108static void stmmac_tmu_stop(void) 103static void stmmac_tmu_stop(void)
109{ 104{
110 clk_disable(timer_clock); 105 clk_disable(timer_clock);
111 return;
112} 106}
113 107
114int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) 108int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
diff --git a/drivers/net/stnic.c b/drivers/net/stnic.c
index 87a6b8eabc67..d85f0a84bc7b 100644
--- a/drivers/net/stnic.c
+++ b/drivers/net/stnic.c
@@ -280,7 +280,6 @@ stnic_init (struct net_device *dev)
280{ 280{
281 stnic_reset (dev); 281 stnic_reset (dev);
282 NS8390_init (dev, 0); 282 NS8390_init (dev, 0);
283 return;
284} 283}
285 284
286static void __exit stnic_cleanup(void) 285static void __exit stnic_cleanup(void)
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c
index 31ab4ab0796f..151312342243 100644
--- a/drivers/net/sun3_82586.c
+++ b/drivers/net/sun3_82586.c
@@ -985,7 +985,7 @@ static void sun3_82586_timeout(struct net_device *dev)
985 p->scb->cmd_cuc = CUC_START; 985 p->scb->cmd_cuc = CUC_START;
986 sun3_attn586(); 986 sun3_attn586();
987 WAIT_4_SCB_CMD(); 987 WAIT_4_SCB_CMD();
988 dev->trans_start = jiffies; 988 dev->trans_start = jiffies; /* prevent tx timeout */
989 return 0; 989 return 0;
990 } 990 }
991#endif 991#endif
@@ -998,7 +998,7 @@ static void sun3_82586_timeout(struct net_device *dev)
998 sun3_82586_close(dev); 998 sun3_82586_close(dev);
999 sun3_82586_open(dev); 999 sun3_82586_open(dev);
1000 } 1000 }
1001 dev->trans_start = jiffies; 1001 dev->trans_start = jiffies; /* prevent tx timeout */
1002} 1002}
1003 1003
1004/****************************************************** 1004/******************************************************
@@ -1062,7 +1062,6 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
1062 } 1062 }
1063 1063
1064 sun3_attn586(); 1064 sun3_attn586();
1065 dev->trans_start = jiffies;
1066 if(!i) 1065 if(!i)
1067 dev_kfree_skb(skb); 1066 dev_kfree_skb(skb);
1068 WAIT_4_SCB_CMD(); 1067 WAIT_4_SCB_CMD();
@@ -1082,7 +1081,6 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
1082 p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0; 1081 p->xmit_cmds[0]->cmd_status = p->nop_cmds[next_nop]->cmd_status = 0;
1083 1082
1084 p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0])); 1083 p->nop_cmds[p->nop_point]->cmd_link = make16((p->xmit_cmds[0]));
1085 dev->trans_start = jiffies;
1086 p->nop_point = next_nop; 1084 p->nop_point = next_nop;
1087 dev_kfree_skb(skb); 1085 dev_kfree_skb(skb);
1088# endif 1086# endif
@@ -1097,7 +1095,6 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
1097 p->nop_cmds[next_nop]->cmd_status = 0; 1095 p->nop_cmds[next_nop]->cmd_status = 0;
1098 1096
1099 p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count])); 1097 p->nop_cmds[p->xmit_count]->cmd_link = make16((p->xmit_cmds[p->xmit_count]));
1100 dev->trans_start = jiffies;
1101 p->xmit_count = next_nop; 1098 p->xmit_count = next_nop;
1102 1099
1103 { 1100 {
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index 1694ca5bfb41..358c22f9acbe 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -523,8 +523,8 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
523 523
524 /* Transmitter timeout, serious problems. */ 524 /* Transmitter timeout, serious problems. */
525 if (netif_queue_stopped(dev)) { 525 if (netif_queue_stopped(dev)) {
526 int tickssofar = jiffies - dev->trans_start; 526 int tickssofar = jiffies - dev_trans_start(dev);
527 if (tickssofar < 20) 527 if (tickssofar < HZ/5)
528 return NETDEV_TX_BUSY; 528 return NETDEV_TX_BUSY;
529 529
530 DPRINTK( 1, ( "%s: transmit timed out, status %04x, resetting.\n", 530 DPRINTK( 1, ( "%s: transmit timed out, status %04x, resetting.\n",
@@ -559,7 +559,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
559 REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT; 559 REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT;
560 560
561 netif_start_queue(dev); 561 netif_start_queue(dev);
562 dev->trans_start = jiffies;
563 562
564 return NETDEV_TX_OK; 563 return NETDEV_TX_OK;
565 } 564 }
@@ -637,8 +636,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
637 AREG = CSR0; 636 AREG = CSR0;
638 DPRINTK( 2, ( "%s: lance_start_xmit() exiting, csr0 %4.4x.\n", 637 DPRINTK( 2, ( "%s: lance_start_xmit() exiting, csr0 %4.4x.\n",
639 dev->name, DREG )); 638 dev->name, DREG ));
640 dev->trans_start = jiffies; 639 dev_kfree_skb(skb);
641 dev_kfree_skb( skb );
642 640
643 lp->lock = 0; 641 lp->lock = 0;
644 if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) == 642 if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) ==
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 52913155ce47..34446b6d9a3c 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -982,8 +982,6 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
982 sbus_writel(CREG_CTRL_TWAKEUP, bp->creg + CREG_CTRL); 982 sbus_writel(CREG_CTRL_TWAKEUP, bp->creg + CREG_CTRL);
983 983
984 984
985 dev->trans_start = jiffies;
986
987 return NETDEV_TX_OK; 985 return NETDEV_TX_OK;
988} 986}
989 987
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index da45f01279c4..2678588ea4b2 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -788,7 +788,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
788 iowrite8(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); 788 iowrite8(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr);
789 mdio_delay(); 789 mdio_delay();
790 } 790 }
791 return;
792} 791}
793 792
794static int mdio_wait_link(struct net_device *dev, int wait) 793static int mdio_wait_link(struct net_device *dev, int wait)
@@ -972,7 +971,7 @@ static void tx_timeout(struct net_device *dev)
972 971
973 dev->if_port = 0; 972 dev->if_port = 0;
974 973
975 dev->trans_start = jiffies; 974 dev->trans_start = jiffies; /* prevent tx timeout */
976 dev->stats.tx_errors++; 975 dev->stats.tx_errors++;
977 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { 976 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
978 netif_wake_queue(dev); 977 netif_wake_queue(dev);
@@ -1022,7 +1021,6 @@ static void init_ring(struct net_device *dev)
1022 np->tx_skbuff[i] = NULL; 1021 np->tx_skbuff[i] = NULL;
1023 np->tx_ring[i].status = 0; 1022 np->tx_ring[i].status = 0;
1024 } 1023 }
1025 return;
1026} 1024}
1027 1025
1028static void tx_poll (unsigned long data) 1026static void tx_poll (unsigned long data)
@@ -1049,7 +1047,6 @@ static void tx_poll (unsigned long data)
1049 if (ioread32 (np->base + TxListPtr) == 0) 1047 if (ioread32 (np->base + TxListPtr) == 0)
1050 iowrite32 (np->tx_ring_dma + head * sizeof(struct netdev_desc), 1048 iowrite32 (np->tx_ring_dma + head * sizeof(struct netdev_desc),
1051 np->base + TxListPtr); 1049 np->base + TxListPtr);
1052 return;
1053} 1050}
1054 1051
1055static netdev_tx_t 1052static netdev_tx_t
@@ -1084,7 +1081,6 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
1084 } else { 1081 } else {
1085 netif_stop_queue (dev); 1082 netif_stop_queue (dev);
1086 } 1083 }
1087 dev->trans_start = jiffies;
1088 if (netif_msg_tx_queued(np)) { 1084 if (netif_msg_tx_queued(np)) {
1089 printk (KERN_DEBUG 1085 printk (KERN_DEBUG
1090 "%s: Transmit frame #%d queued in slot %d.\n", 1086 "%s: Transmit frame #%d queued in slot %d.\n",
@@ -1379,7 +1375,6 @@ not_done:
1379 if (np->budget <= 0) 1375 if (np->budget <= 0)
1380 np->budget = RX_BUDGET; 1376 np->budget = RX_BUDGET;
1381 tasklet_schedule(&np->rx_tasklet); 1377 tasklet_schedule(&np->rx_tasklet);
1382 return;
1383} 1378}
1384 1379
1385static void refill_rx (struct net_device *dev) 1380static void refill_rx (struct net_device *dev)
@@ -1410,7 +1405,6 @@ static void refill_rx (struct net_device *dev)
1410 np->rx_ring[entry].status = 0; 1405 np->rx_ring[entry].status = 0;
1411 cnt++; 1406 cnt++;
1412 } 1407 }
1413 return;
1414} 1408}
1415static void netdev_error(struct net_device *dev, int intr_status) 1409static void netdev_error(struct net_device *dev, int intr_status)
1416{ 1410{
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 2b78e97ea9c0..434f9d735333 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1136,7 +1136,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
1136 writel(gp->tx_new, gp->regs + TXDMA_KICK); 1136 writel(gp->tx_new, gp->regs + TXDMA_KICK);
1137 spin_unlock_irqrestore(&gp->tx_lock, flags); 1137 spin_unlock_irqrestore(&gp->tx_lock, flags);
1138 1138
1139 dev->trans_start = jiffies; 1139 dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
1140 1140
1141 return NETDEV_TX_OK; 1141 return NETDEV_TX_OK;
1142} 1142}
@@ -2923,7 +2923,6 @@ static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
2923 dev_addr[1] = 0x00; 2923 dev_addr[1] = 0x00;
2924 dev_addr[2] = 0x20; 2924 dev_addr[2] = 0x20;
2925 get_random_bytes(dev_addr + 3, 3); 2925 get_random_bytes(dev_addr + 3, 3);
2926 return;
2927} 2926}
2928#endif /* not Sparc and not PPC */ 2927#endif /* not Sparc and not PPC */
2929 2928
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 982ff12764a3..30826eba1a53 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2341,8 +2341,6 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb,
2341 2341
2342 spin_unlock_irq(&hp->happy_lock); 2342 spin_unlock_irq(&hp->happy_lock);
2343 2343
2344 dev->trans_start = jiffies;
2345
2346 tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); 2344 tx_add_log(hp, TXLOG_ACTION_TXMIT, 0);
2347 return NETDEV_TX_OK; 2345 return NETDEV_TX_OK;
2348} 2346}
@@ -2945,7 +2943,6 @@ static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr)
2945 dev_addr[1] = 0x00; 2943 dev_addr[1] = 0x00;
2946 dev_addr[2] = 0x20; 2944 dev_addr[2] = 0x20;
2947 get_random_bytes(&dev_addr[3], 3); 2945 get_random_bytes(&dev_addr[3], 3);
2948 return;
2949} 2946}
2950#endif /* !(CONFIG_SPARC) */ 2947#endif /* !(CONFIG_SPARC) */
2951 2948
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index c7748b73fa09..f88a60fa25f8 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1003,7 +1003,7 @@ static int lance_reset(struct net_device *dev)
1003 } 1003 }
1004 lp->init_ring(dev); 1004 lp->init_ring(dev);
1005 load_csrs(lp); 1005 load_csrs(lp);
1006 dev->trans_start = jiffies; 1006 dev->trans_start = jiffies; /* prevent tx timeout */
1007 status = init_restart_lance(lp); 1007 status = init_restart_lance(lp);
1008 return status; 1008 return status;
1009} 1009}
@@ -1160,7 +1160,6 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
1160 1160
1161 spin_unlock_irq(&lp->lock); 1161 spin_unlock_irq(&lp->lock);
1162 1162
1163 dev->trans_start = jiffies;
1164 dev_kfree_skb(skb); 1163 dev_kfree_skb(skb);
1165 1164
1166 return NETDEV_TX_OK; 1165 return NETDEV_TX_OK;
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 239f09772191..a7542d25c845 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -602,7 +602,6 @@ static int qe_start_xmit(struct sk_buff *skb, struct net_device *dev)
602 qep->tx_new = NEXT_TX(entry); 602 qep->tx_new = NEXT_TX(entry);
603 603
604 /* Get it going. */ 604 /* Get it going. */
605 dev->trans_start = jiffies;
606 sbus_writel(CREG_CTRL_TWAKEUP, qep->qcregs + CREG_CTRL); 605 sbus_writel(CREG_CTRL_TWAKEUP, qep->qcregs + CREG_CTRL);
607 606
608 dev->stats.tx_packets++; 607 dev->stats.tx_packets++;
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
index 6cf8b06be5cd..d281a7b34701 100644
--- a/drivers/net/sunvnet.c
+++ b/drivers/net/sunvnet.c
@@ -717,7 +717,6 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
717 717
718 dev_kfree_skb(skb); 718 dev_kfree_skb(skb);
719 719
720 dev->trans_start = jiffies;
721 return NETDEV_TX_OK; 720 return NETDEV_TX_OK;
722 721
723out_dropped_unlock: 722out_dropped_unlock:
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 36149ddace46..be08b75dbc15 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -1357,8 +1357,6 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
1357 } 1357 }
1358 lp->tfd_start = (lp->tfd_start + 1) % TX_FD_NUM; 1358 lp->tfd_start = (lp->tfd_start + 1) % TX_FD_NUM;
1359 1359
1360 dev->trans_start = jiffies;
1361
1362 /* If we just used up the very last entry in the 1360 /* If we just used up the very last entry in the
1363 * TX ring on this device, tell the queueing 1361 * TX ring on this device, tell the queueing
1364 * layer to send no more. 1362 * layer to send no more.
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 8ffec22b74bf..ccee3eddc5f4 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -1034,7 +1034,7 @@ static void TLan_tx_timeout(struct net_device *dev)
1034 TLan_ResetLists( dev ); 1034 TLan_ResetLists( dev );
1035 TLan_ReadAndClearStats( dev, TLAN_IGNORE ); 1035 TLan_ReadAndClearStats( dev, TLAN_IGNORE );
1036 TLan_ResetAdapter( dev ); 1036 TLan_ResetAdapter( dev );
1037 dev->trans_start = jiffies; 1037 dev->trans_start = jiffies; /* prevent tx timeout */
1038 netif_wake_queue( dev ); 1038 netif_wake_queue( dev );
1039 1039
1040} 1040}
@@ -1147,7 +1147,6 @@ static netdev_tx_t TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
1147 1147
1148 CIRC_INC( priv->txTail, TLAN_NUM_TX_LISTS ); 1148 CIRC_INC( priv->txTail, TLAN_NUM_TX_LISTS );
1149 1149
1150 dev->trans_start = jiffies;
1151 return NETDEV_TX_OK; 1150 return NETDEV_TX_OK;
1152 1151
1153} /* TLan_StartTx */ 1152} /* TLan_StartTx */
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index eebdaae24328..91e6c78271a3 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -1041,7 +1041,6 @@ static netdev_tx_t tok_send_packet(struct sk_buff *skb,
1041 writew(ti->exsap_station_id, ti->srb + STATION_ID_OFST); 1041 writew(ti->exsap_station_id, ti->srb + STATION_ID_OFST);
1042 writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD); 1042 writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
1043 spin_unlock_irqrestore(&(ti->lock), flags); 1043 spin_unlock_irqrestore(&(ti->lock), flags);
1044 dev->trans_start = jiffies;
1045 return NETDEV_TX_OK; 1044 return NETDEV_TX_OK;
1046} 1045}
1047 1046
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
index 53f631ebb162..785ad1a2157b 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -109,7 +109,6 @@ static void madgemc_sifwriteb(struct net_device *dev, unsigned short val, unsign
109 SIFWRITEB(val, reg); 109 SIFWRITEB(val, reg);
110 madgemc_setregpage(dev, 0); 110 madgemc_setregpage(dev, 0);
111 } 111 }
112 return;
113} 112}
114 113
115/* 114/*
@@ -140,7 +139,6 @@ static void madgemc_sifwritew(struct net_device *dev, unsigned short val, unsign
140 SIFWRITEW(val, reg); 139 SIFWRITEW(val, reg);
141 madgemc_setregpage(dev, 0); 140 madgemc_setregpage(dev, 0);
142 } 141 }
143 return;
144} 142}
145 143
146static struct net_device_ops madgemc_netdev_ops __read_mostly; 144static struct net_device_ops madgemc_netdev_ops __read_mostly;
@@ -505,8 +503,6 @@ static void madgemc_setregpage(struct net_device *dev, int page)
505 dev->base_addr + MC_CONTROL_REG1); 503 dev->base_addr + MC_CONTROL_REG1);
506 } 504 }
507 reg1 = inb(dev->base_addr + MC_CONTROL_REG1); 505 reg1 = inb(dev->base_addr + MC_CONTROL_REG1);
508
509 return;
510} 506}
511 507
512/* 508/*
@@ -527,8 +523,6 @@ static void madgemc_setsifsel(struct net_device *dev, int val)
527 dev->base_addr + MC_CONTROL_REG0); 523 dev->base_addr + MC_CONTROL_REG0);
528 } 524 }
529 reg0 = inb(dev->base_addr + MC_CONTROL_REG0); 525 reg0 = inb(dev->base_addr + MC_CONTROL_REG0);
530
531 return;
532} 526}
533 527
534/* 528/*
@@ -550,8 +544,6 @@ static void madgemc_setint(struct net_device *dev, int val)
550 outb(reg1 | MC_CONTROL_REG1_SINTEN, 544 outb(reg1 | MC_CONTROL_REG1_SINTEN,
551 dev->base_addr + MC_CONTROL_REG1); 545 dev->base_addr + MC_CONTROL_REG1);
552 } 546 }
553
554 return;
555} 547}
556 548
557/* 549/*
@@ -594,8 +586,6 @@ static void madgemc_chipset_close(struct net_device *dev)
594 madgemc_setint(dev, 0); 586 madgemc_setint(dev, 0);
595 /* unmap SIF registers */ 587 /* unmap SIF registers */
596 madgemc_setsifsel(dev, 0); 588 madgemc_setsifsel(dev, 0);
597
598 return;
599} 589}
600 590
601/* 591/*
@@ -656,8 +646,6 @@ static void madgemc_read_rom(struct net_device *dev, struct card_info *card)
656 /* Restore original register values */ 646 /* Restore original register values */
657 outb(reg0, ioaddr + MC_CONTROL_REG0); 647 outb(reg0, ioaddr + MC_CONTROL_REG0);
658 outb(reg1, ioaddr + MC_CONTROL_REG1); 648 outb(reg1, ioaddr + MC_CONTROL_REG1);
659
660 return;
661} 649}
662 650
663static int madgemc_open(struct net_device *dev) 651static int madgemc_open(struct net_device *dev)
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index e40560137c46..0929fff5982c 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -4562,7 +4562,7 @@ static void smctr_timeout(struct net_device *dev)
4562 * fake transmission time and go on trying. Our own timeout 4562 * fake transmission time and go on trying. Our own timeout
4563 * routine is in sktr_timer_chk() 4563 * routine is in sktr_timer_chk()
4564 */ 4564 */
4565 dev->trans_start = jiffies; 4565 dev->trans_start = jiffies; /* prevent tx timeout */
4566 netif_wake_queue(dev); 4566 netif_wake_queue(dev);
4567} 4567}
4568 4568
@@ -5147,8 +5147,6 @@ static void smctr_set_multicast_list(struct net_device *dev)
5147{ 5147{
5148 if(smctr_debug > 10) 5148 if(smctr_debug > 10)
5149 printk(KERN_DEBUG "%s: smctr_set_multicast_list\n", dev->name); 5149 printk(KERN_DEBUG "%s: smctr_set_multicast_list\n", dev->name);
5150
5151 return;
5152} 5150}
5153 5151
5154static int smctr_set_page(struct net_device *dev, __u8 *buf) 5152static int smctr_set_page(struct net_device *dev, __u8 *buf)
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index c169fd05dde0..435ef7d5470f 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -325,8 +325,6 @@ static void tms380tr_timer_end_wait(unsigned long data)
325 tp->Sleeping = 0; 325 tp->Sleeping = 0;
326 wake_up_interruptible(&tp->wait_for_tok_int); 326 wake_up_interruptible(&tp->wait_for_tok_int);
327 } 327 }
328
329 return;
330} 328}
331 329
332/* 330/*
@@ -460,8 +458,6 @@ static void tms380tr_init_net_local(struct net_device *dev)
460 tp->RplHead = &tp->Rpl[0]; 458 tp->RplHead = &tp->Rpl[0];
461 tp->RplTail = &tp->Rpl[RPL_NUM-1]; 459 tp->RplTail = &tp->Rpl[RPL_NUM-1];
462 tp->RplTail->Status = (RX_START_FRAME | RX_END_FRAME | RX_FRAME_IRQ); 460 tp->RplTail->Status = (RX_START_FRAME | RX_END_FRAME | RX_FRAME_IRQ);
463
464 return;
465} 461}
466 462
467/* 463/*
@@ -481,8 +477,6 @@ static void tms380tr_init_ipb(struct net_local *tp)
481 tp->ipb.DMA_Abort_Thrhld = DMA_RETRIES; 477 tp->ipb.DMA_Abort_Thrhld = DMA_RETRIES;
482 tp->ipb.SCB_Addr = 0; 478 tp->ipb.SCB_Addr = 0;
483 tp->ipb.SSB_Addr = 0; 479 tp->ipb.SSB_Addr = 0;
484
485 return;
486} 480}
487 481
488/* 482/*
@@ -527,8 +521,6 @@ static void tms380tr_init_opb(struct net_device *dev)
527 521
528 tp->ocpl.ProdIDAddr[0] = LOWORD(Addr); 522 tp->ocpl.ProdIDAddr[0] = LOWORD(Addr);
529 tp->ocpl.ProdIDAddr[1] = HIWORD(Addr); 523 tp->ocpl.ProdIDAddr[1] = HIWORD(Addr);
530
531 return;
532} 524}
533 525
534/* 526/*
@@ -543,8 +535,6 @@ static void tms380tr_open_adapter(struct net_device *dev)
543 535
544 tp->OpenCommandIssued = 1; 536 tp->OpenCommandIssued = 1;
545 tms380tr_exec_cmd(dev, OC_OPEN); 537 tms380tr_exec_cmd(dev, OC_OPEN);
546
547 return;
548} 538}
549 539
550/* 540/*
@@ -554,8 +544,6 @@ static void tms380tr_open_adapter(struct net_device *dev)
554static void tms380tr_disable_interrupts(struct net_device *dev) 544static void tms380tr_disable_interrupts(struct net_device *dev)
555{ 545{
556 SIFWRITEB(0, SIFACL); 546 SIFWRITEB(0, SIFACL);
557
558 return;
559} 547}
560 548
561/* 549/*
@@ -565,8 +553,6 @@ static void tms380tr_disable_interrupts(struct net_device *dev)
565static void tms380tr_enable_interrupts(struct net_device *dev) 553static void tms380tr_enable_interrupts(struct net_device *dev)
566{ 554{
567 SIFWRITEB(ACL_SINTEN, SIFACL); 555 SIFWRITEB(ACL_SINTEN, SIFACL);
568
569 return;
570} 556}
571 557
572/* 558/*
@@ -578,8 +564,6 @@ static void tms380tr_exec_cmd(struct net_device *dev, unsigned short Command)
578 564
579 tp->CMDqueue |= Command; 565 tp->CMDqueue |= Command;
580 tms380tr_chk_outstanding_cmds(dev); 566 tms380tr_chk_outstanding_cmds(dev);
581
582 return;
583} 567}
584 568
585static void tms380tr_timeout(struct net_device *dev) 569static void tms380tr_timeout(struct net_device *dev)
@@ -592,7 +576,7 @@ static void tms380tr_timeout(struct net_device *dev)
592 * fake transmission time and go on trying. Our own timeout 576 * fake transmission time and go on trying. Our own timeout
593 * routine is in tms380tr_timer_chk() 577 * routine is in tms380tr_timer_chk()
594 */ 578 */
595 dev->trans_start = jiffies; 579 dev->trans_start = jiffies; /* prevent tx timeout */
596 netif_wake_queue(dev); 580 netif_wake_queue(dev);
597} 581}
598 582
@@ -712,8 +696,6 @@ static void tms380tr_chk_src_addr(unsigned char *frame, unsigned char *hw_addr)
712 SRBit = frame[8] & 0x80; 696 SRBit = frame[8] & 0x80;
713 memcpy(&frame[8], hw_addr, 6); 697 memcpy(&frame[8], hw_addr, 6);
714 frame[8] |= SRBit; 698 frame[8] |= SRBit;
715
716 return;
717} 699}
718 700
719/* 701/*
@@ -743,8 +725,6 @@ static void tms380tr_timer_chk(unsigned long data)
743 return; 725 return;
744 tp->ReOpenInProgress = 1; 726 tp->ReOpenInProgress = 1;
745 tms380tr_open_adapter(dev); 727 tms380tr_open_adapter(dev);
746
747 return;
748} 728}
749 729
750/* 730/*
@@ -863,8 +843,6 @@ static void tms380tr_reset_interrupt(struct net_device *dev)
863 * and clear STS_SYSTEM_IRQ bit: enable adapter for further interrupts. 843 * and clear STS_SYSTEM_IRQ bit: enable adapter for further interrupts.
864 */ 844 */
865 tms380tr_exec_sifcmd(dev, CMD_SSB_CLEAR | CMD_CLEAR_SYSTEM_IRQ); 845 tms380tr_exec_sifcmd(dev, CMD_SSB_CLEAR | CMD_CLEAR_SYSTEM_IRQ);
866
867 return;
868} 846}
869 847
870/* 848/*
@@ -1119,8 +1097,6 @@ static void tms380tr_cmd_status_irq(struct net_device *dev)
1119 tp->MacStat.frequency_errors += tp->errorlogtable.Frequency_Error; 1097 tp->MacStat.frequency_errors += tp->errorlogtable.Frequency_Error;
1120 tp->MacStat.internal_errors += tp->errorlogtable.Internal_Error; 1098 tp->MacStat.internal_errors += tp->errorlogtable.Internal_Error;
1121 } 1099 }
1122
1123 return;
1124} 1100}
1125 1101
1126/* 1102/*
@@ -1229,7 +1205,6 @@ static void tms380tr_set_multicast_list(struct net_device *dev)
1229 1205
1230 tp->ocpl.OPENOptions = OpenOptions; 1206 tp->ocpl.OPENOptions = OpenOptions;
1231 tms380tr_exec_cmd(dev, OC_MODIFY_OPEN_PARMS); 1207 tms380tr_exec_cmd(dev, OC_MODIFY_OPEN_PARMS);
1232 return;
1233} 1208}
1234 1209
1235/* 1210/*
@@ -1247,7 +1222,6 @@ void tms380tr_wait(unsigned long time)
1247#else 1222#else
1248 udelay(time); 1223 udelay(time);
1249#endif 1224#endif
1250 return;
1251} 1225}
1252 1226
1253/* 1227/*
@@ -1266,8 +1240,6 @@ static void tms380tr_exec_sifcmd(struct net_device *dev, unsigned int WriteValue
1266 SifStsValue = SIFREADW(SIFSTS); 1240 SifStsValue = SIFREADW(SIFSTS);
1267 } while((SifStsValue & CMD_INTERRUPT_ADAPTER) && loop_counter--); 1241 } while((SifStsValue & CMD_INTERRUPT_ADAPTER) && loop_counter--);
1268 SIFWRITEW(cmd, SIFCMD); 1242 SIFWRITEW(cmd, SIFCMD);
1269
1270 return;
1271} 1243}
1272 1244
1273/* 1245/*
@@ -1700,8 +1672,6 @@ static void tms380tr_chk_outstanding_cmds(struct net_device *dev)
1700 1672
1701 /* Execute SCB and generate IRQ when done. */ 1673 /* Execute SCB and generate IRQ when done. */
1702 tms380tr_exec_sifcmd(dev, CMD_EXECUTE | CMD_SCB_REQUEST); 1674 tms380tr_exec_sifcmd(dev, CMD_EXECUTE | CMD_SCB_REQUEST);
1703
1704 return;
1705} 1675}
1706 1676
1707/* 1677/*
@@ -1774,8 +1744,6 @@ static void tms380tr_ring_status_irq(struct net_device *dev)
1774 tp->AdapterOpenFlag = 0; 1744 tp->AdapterOpenFlag = 0;
1775 tms380tr_open_adapter(dev); 1745 tms380tr_open_adapter(dev);
1776 } 1746 }
1777
1778 return;
1779} 1747}
1780 1748
1781/* 1749/*
@@ -1932,8 +1900,6 @@ static void tms380tr_chk_irq(struct net_device *dev)
1932 /* Restart of firmware successful */ 1900 /* Restart of firmware successful */
1933 tp->AdapterOpenFlag = 1; 1901 tp->AdapterOpenFlag = 1;
1934 } 1902 }
1935
1936 return;
1937} 1903}
1938 1904
1939/* 1905/*
@@ -1988,8 +1954,6 @@ static void tms380tr_read_ram(struct net_device *dev, unsigned char *Data,
1988 /* Restore original values */ 1954 /* Restore original values */
1989 SIFWRITEW(old_sifadx, SIFADX); 1955 SIFWRITEW(old_sifadx, SIFADX);
1990 SIFWRITEW(old_sifadr, SIFADR); 1956 SIFWRITEW(old_sifadr, SIFADR);
1991
1992 return;
1993} 1957}
1994 1958
1995/* 1959/*
@@ -2021,8 +1985,6 @@ static void tms380tr_cancel_tx_queue(struct net_local* tp)
2021 dma_unmap_single(tp->pdev, tpl->DMABuff, tpl->Skb->len, DMA_TO_DEVICE); 1985 dma_unmap_single(tp->pdev, tpl->DMABuff, tpl->Skb->len, DMA_TO_DEVICE);
2022 dev_kfree_skb_any(tpl->Skb); 1986 dev_kfree_skb_any(tpl->Skb);
2023 } 1987 }
2024
2025 return;
2026} 1988}
2027 1989
2028/* 1990/*
@@ -2094,7 +2056,6 @@ static void tms380tr_tx_status_irq(struct net_device *dev)
2094 2056
2095 if(!tp->TplFree->NextTPLPtr->BusyFlag) 2057 if(!tp->TplFree->NextTPLPtr->BusyFlag)
2096 netif_wake_queue(dev); 2058 netif_wake_queue(dev);
2097 return;
2098} 2059}
2099 2060
2100/* 2061/*
@@ -2255,8 +2216,6 @@ static void tms380tr_rcv_status_irq(struct net_device *dev)
2255 /* Inform adapter about RPL valid. */ 2216 /* Inform adapter about RPL valid. */
2256 tms380tr_exec_sifcmd(dev, CMD_RX_VALID); 2217 tms380tr_exec_sifcmd(dev, CMD_RX_VALID);
2257 } 2218 }
2258
2259 return;
2260} 2219}
2261 2220
2262/* 2221/*
@@ -2269,8 +2228,6 @@ static void tms380tr_rcv_status_irq(struct net_device *dev)
2269static void tms380tr_write_rpl_status(RPL *rpl, unsigned int Status) 2228static void tms380tr_write_rpl_status(RPL *rpl, unsigned int Status)
2270{ 2229{
2271 rpl->Status = Status; 2230 rpl->Status = Status;
2272
2273 return;
2274} 2231}
2275 2232
2276/* 2233/*
@@ -2287,8 +2244,6 @@ static void tms380tr_update_rcv_stats(struct net_local *tp, unsigned char DataPt
2287 /* Test functional bit */ 2244 /* Test functional bit */
2288 if(DataPtr[2] & GROUP_BIT) 2245 if(DataPtr[2] & GROUP_BIT)
2289 tp->MacStat.multicast++; 2246 tp->MacStat.multicast++;
2290
2291 return;
2292} 2247}
2293 2248
2294static int tms380tr_set_mac_address(struct net_device *dev, void *addr) 2249static int tms380tr_set_mac_address(struct net_device *dev, void *addr)
@@ -2318,8 +2273,6 @@ static void tms380tr_dump(unsigned char *Data, int length)
2318 Data[j+0],Data[j+1],Data[j+2],Data[j+3], 2273 Data[j+0],Data[j+1],Data[j+2],Data[j+3],
2319 Data[j+4],Data[j+5],Data[j+6],Data[j+7]); 2274 Data[j+4],Data[j+5],Data[j+6],Data[j+7]);
2320 } 2275 }
2321
2322 return;
2323} 2276}
2324#endif 2277#endif
2325 2278
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 9c0f29ce8ba7..c0e70006374e 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -654,7 +654,6 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb,
654 654
655 /* Trigger an immediate transmit demand. */ 655 /* Trigger an immediate transmit demand. */
656 dw32(TxPoll, NormalTxPoll); 656 dw32(TxPoll, NormalTxPoll);
657 dev->trans_start = jiffies;
658 657
659 return NETDEV_TX_OK; 658 return NETDEV_TX_OK;
660} 659}
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index d818456f4713..75a64c88cf7a 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -1337,7 +1337,7 @@ de4x5_open(struct net_device *dev)
1337 } 1337 }
1338 1338
1339 lp->interrupt = UNMASK_INTERRUPTS; 1339 lp->interrupt = UNMASK_INTERRUPTS;
1340 dev->trans_start = jiffies; 1340 dev->trans_start = jiffies; /* prevent tx timeout */
1341 1341
1342 START_DE4X5; 1342 START_DE4X5;
1343 1343
@@ -1507,7 +1507,6 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
1507 outl(POLL_DEMAND, DE4X5_TPD);/* Start the TX */ 1507 outl(POLL_DEMAND, DE4X5_TPD);/* Start the TX */
1508 1508
1509 lp->tx_new = (++lp->tx_new) % lp->txRingSize; 1509 lp->tx_new = (++lp->tx_new) % lp->txRingSize;
1510 dev->trans_start = jiffies;
1511 1510
1512 if (TX_BUFFS_AVAIL) { 1511 if (TX_BUFFS_AVAIL) {
1513 netif_start_queue(dev); /* Another pkt may be queued */ 1512 netif_start_queue(dev); /* Another pkt may be queued */
@@ -1884,8 +1883,6 @@ de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len)
1884 if (lp->pktStats.bins[0] == 0) { /* Reset counters */ 1883 if (lp->pktStats.bins[0] == 0) { /* Reset counters */
1885 memset((char *)&lp->pktStats, 0, sizeof(lp->pktStats)); 1884 memset((char *)&lp->pktStats, 0, sizeof(lp->pktStats));
1886 } 1885 }
1887
1888 return;
1889} 1886}
1890 1887
1891/* 1888/*
@@ -1937,7 +1934,7 @@ set_multicast_list(struct net_device *dev)
1937 1934
1938 lp->tx_new = (++lp->tx_new) % lp->txRingSize; 1935 lp->tx_new = (++lp->tx_new) % lp->txRingSize;
1939 outl(POLL_DEMAND, DE4X5_TPD); /* Start the TX */ 1936 outl(POLL_DEMAND, DE4X5_TPD); /* Start the TX */
1940 dev->trans_start = jiffies; 1937 dev->trans_start = jiffies; /* prevent tx timeout */
1941 } 1938 }
1942 } 1939 }
1943} 1940}
@@ -1992,8 +1989,6 @@ SetMulticastFilter(struct net_device *dev)
1992 } 1989 }
1993 } 1990 }
1994 outl(omr, DE4X5_OMR); 1991 outl(omr, DE4X5_OMR);
1995
1996 return;
1997} 1992}
1998 1993
1999#ifdef CONFIG_EISA 1994#ifdef CONFIG_EISA
@@ -2188,8 +2183,6 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2188 return; 2183 return;
2189 } 2184 }
2190 } 2185 }
2191
2192 return;
2193} 2186}
2194 2187
2195/* 2188/*
@@ -3292,8 +3285,6 @@ de4x5_init_connection(struct net_device *dev)
3292 outl(POLL_DEMAND, DE4X5_TPD); 3285 outl(POLL_DEMAND, DE4X5_TPD);
3293 3286
3294 netif_wake_queue(dev); 3287 netif_wake_queue(dev);
3295
3296 return;
3297} 3288}
3298 3289
3299/* 3290/*
@@ -3665,8 +3656,6 @@ de4x5_free_rx_buffs(struct net_device *dev)
3665 lp->rx_ring[i].status = 0; 3656 lp->rx_ring[i].status = 0;
3666 lp->rx_skb[i] = (struct sk_buff *)1; /* Dummy entry */ 3657 lp->rx_skb[i] = (struct sk_buff *)1; /* Dummy entry */
3667 } 3658 }
3668
3669 return;
3670} 3659}
3671 3660
3672static void 3661static void
@@ -3709,8 +3698,6 @@ de4x5_save_skbs(struct net_device *dev)
3709 lp->cache.save_cnt++; 3698 lp->cache.save_cnt++;
3710 START_DE4X5; 3699 START_DE4X5;
3711 } 3700 }
3712
3713 return;
3714} 3701}
3715 3702
3716static void 3703static void
@@ -3742,8 +3729,6 @@ de4x5_rst_desc_ring(struct net_device *dev)
3742 lp->cache.save_cnt--; 3729 lp->cache.save_cnt--;
3743 START_DE4X5; 3730 START_DE4X5;
3744 } 3731 }
3745
3746 return;
3747} 3732}
3748 3733
3749static void 3734static void
@@ -3772,8 +3757,6 @@ de4x5_cache_state(struct net_device *dev, int flag)
3772 } 3757 }
3773 break; 3758 break;
3774 } 3759 }
3775
3776 return;
3777} 3760}
3778 3761
3779static void 3762static void
@@ -3846,8 +3829,6 @@ de4x5_setup_intr(struct net_device *dev)
3846 outl(sts, DE4X5_STS); 3829 outl(sts, DE4X5_STS);
3847 ENABLE_IRQs; 3830 ENABLE_IRQs;
3848 } 3831 }
3849
3850 return;
3851} 3832}
3852 3833
3853/* 3834/*
@@ -3880,8 +3861,6 @@ reset_init_sia(struct net_device *dev, s32 csr13, s32 csr14, s32 csr15)
3880 outl(csr13, DE4X5_SICR); 3861 outl(csr13, DE4X5_SICR);
3881 3862
3882 mdelay(10); 3863 mdelay(10);
3883
3884 return;
3885} 3864}
3886 3865
3887/* 3866/*
@@ -3902,8 +3881,6 @@ create_packet(struct net_device *dev, char *frame, int len)
3902 3881
3903 *buf++ = 0; /* Packet length (2 bytes) */ 3882 *buf++ = 0; /* Packet length (2 bytes) */
3904 *buf++ = 1; 3883 *buf++ = 1;
3905
3906 return;
3907} 3884}
3908 3885
3909/* 3886/*
@@ -4007,8 +3984,6 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
4007 } 3984 }
4008 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); 3985 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
4009 } 3986 }
4010
4011 return;
4012} 3987}
4013 3988
4014/* 3989/*
@@ -4046,8 +4021,6 @@ enet_addr_rst(u_long aprom_addr)
4046 } 4021 }
4047 } 4022 }
4048 } 4023 }
4049
4050 return;
4051} 4024}
4052 4025
4053/* 4026/*
@@ -4187,8 +4160,6 @@ srom_repair(struct net_device *dev, int card)
4187 lp->useSROM = true; 4160 lp->useSROM = true;
4188 break; 4161 break;
4189 } 4162 }
4190
4191 return;
4192} 4163}
4193 4164
4194/* 4165/*
@@ -4262,8 +4233,6 @@ srom_latch(u_int command, u_long addr)
4262 sendto_srom(command, addr); 4233 sendto_srom(command, addr);
4263 sendto_srom(command | DT_CLK, addr); 4234 sendto_srom(command | DT_CLK, addr);
4264 sendto_srom(command, addr); 4235 sendto_srom(command, addr);
4265
4266 return;
4267} 4236}
4268 4237
4269static void 4238static void
@@ -4272,8 +4241,6 @@ srom_command(u_int command, u_long addr)
4272 srom_latch(command, addr); 4241 srom_latch(command, addr);
4273 srom_latch(command, addr); 4242 srom_latch(command, addr);
4274 srom_latch((command & 0x0000ff00) | DT_CS, addr); 4243 srom_latch((command & 0x0000ff00) | DT_CS, addr);
4275
4276 return;
4277} 4244}
4278 4245
4279static void 4246static void
@@ -4288,8 +4255,6 @@ srom_address(u_int command, u_long addr, u_char offset)
4288 udelay(1); 4255 udelay(1);
4289 4256
4290 i = (getfrom_srom(addr) >> 3) & 0x01; 4257 i = (getfrom_srom(addr) >> 3) & 0x01;
4291
4292 return;
4293} 4258}
4294 4259
4295static short 4260static short
@@ -4323,8 +4288,6 @@ srom_busy(u_int command, u_long addr)
4323 } 4288 }
4324 4289
4325 sendto_srom(command & 0x0000ff00, addr); 4290 sendto_srom(command & 0x0000ff00, addr);
4326
4327 return;
4328} 4291}
4329*/ 4292*/
4330 4293
@@ -4333,8 +4296,6 @@ sendto_srom(u_int command, u_long addr)
4333{ 4296{
4334 outl(command, addr); 4297 outl(command, addr);
4335 udelay(1); 4298 udelay(1);
4336
4337 return;
4338} 4299}
4339 4300
4340static int 4301static int
@@ -4433,8 +4394,6 @@ srom_init(struct net_device *dev)
4433 p += ((*p & BLOCK_LEN) + 1); 4394 p += ((*p & BLOCK_LEN) + 1);
4434 } 4395 }
4435 } 4396 }
4436
4437 return;
4438} 4397}
4439 4398
4440/* 4399/*
@@ -4463,8 +4422,6 @@ srom_exec(struct net_device *dev, u_char *p)
4463 outl(lp->cache.csr14, DE4X5_STRR); 4422 outl(lp->cache.csr14, DE4X5_STRR);
4464 outl(lp->cache.csr13, DE4X5_SICR); 4423 outl(lp->cache.csr13, DE4X5_SICR);
4465 } 4424 }
4466
4467 return;
4468} 4425}
4469 4426
4470/* 4427/*
@@ -4889,8 +4846,6 @@ mii_wr(int data, u_char phyreg, u_char phyaddr, u_long ioaddr)
4889 mii_ta(MII_STWR, ioaddr); /* Turn around time - 2 MDC */ 4846 mii_ta(MII_STWR, ioaddr); /* Turn around time - 2 MDC */
4890 data = mii_swap(data, 16); /* Swap data bit ordering */ 4847 data = mii_swap(data, 16); /* Swap data bit ordering */
4891 mii_wdata(data, 16, ioaddr); /* Write data */ 4848 mii_wdata(data, 16, ioaddr); /* Write data */
4892
4893 return;
4894} 4849}
4895 4850
4896static int 4851static int
@@ -4916,8 +4871,6 @@ mii_wdata(int data, int len, u_long ioaddr)
4916 sendto_mii(MII_MWR | MII_WR, data, ioaddr); 4871 sendto_mii(MII_MWR | MII_WR, data, ioaddr);
4917 data >>= 1; 4872 data >>= 1;
4918 } 4873 }
4919
4920 return;
4921} 4874}
4922 4875
4923static void 4876static void
@@ -4930,8 +4883,6 @@ mii_address(u_char addr, u_long ioaddr)
4930 sendto_mii(MII_MWR | MII_WR, addr, ioaddr); 4883 sendto_mii(MII_MWR | MII_WR, addr, ioaddr);
4931 addr >>= 1; 4884 addr >>= 1;
4932 } 4885 }
4933
4934 return;
4935} 4886}
4936 4887
4937static void 4888static void
@@ -4943,8 +4894,6 @@ mii_ta(u_long rw, u_long ioaddr)
4943 } else { 4894 } else {
4944 getfrom_mii(MII_MRD | MII_RD, ioaddr); /* Tri-state MDIO */ 4895 getfrom_mii(MII_MRD | MII_RD, ioaddr); /* Tri-state MDIO */
4945 } 4896 }
4946
4947 return;
4948} 4897}
4949 4898
4950static int 4899static int
@@ -4971,8 +4920,6 @@ sendto_mii(u32 command, int data, u_long ioaddr)
4971 udelay(1); 4920 udelay(1);
4972 outl(command | MII_MDC | j, ioaddr); 4921 outl(command | MII_MDC | j, ioaddr);
4973 udelay(1); 4922 udelay(1);
4974
4975 return;
4976} 4923}
4977 4924
4978static int 4925static int
@@ -5186,8 +5133,6 @@ gep_wr(s32 data, struct net_device *dev)
5186 } else if ((lp->chipset & ~0x00ff) == DC2114x) { 5133 } else if ((lp->chipset & ~0x00ff) == DC2114x) {
5187 outl((data<<16) | lp->cache.csr15, DE4X5_SIGR); 5134 outl((data<<16) | lp->cache.csr15, DE4X5_SIGR);
5188 } 5135 }
5189
5190 return;
5191} 5136}
5192 5137
5193static int 5138static int
@@ -5247,8 +5192,6 @@ yawn(struct net_device *dev, int state)
5247 break; 5192 break;
5248 } 5193 }
5249 } 5194 }
5250
5251 return;
5252} 5195}
5253 5196
5254static void 5197static void
@@ -5290,8 +5233,6 @@ de4x5_parse_params(struct net_device *dev)
5290 } 5233 }
5291 *q = t; 5234 *q = t;
5292 } 5235 }
5293
5294 return;
5295} 5236}
5296 5237
5297static void 5238static void
@@ -5341,8 +5282,6 @@ de4x5_dbg_open(struct net_device *dev)
5341 (short)lp->rxRingSize, 5282 (short)lp->rxRingSize,
5342 (short)lp->txRingSize); 5283 (short)lp->txRingSize);
5343 } 5284 }
5344
5345 return;
5346} 5285}
5347 5286
5348static void 5287static void
@@ -5369,8 +5308,6 @@ de4x5_dbg_mii(struct net_device *dev, int k)
5369 printk("MII 20: %x\n",mii_rd(0x14,lp->phy[k].addr,DE4X5_MII)); 5308 printk("MII 20: %x\n",mii_rd(0x14,lp->phy[k].addr,DE4X5_MII));
5370 } 5309 }
5371 } 5310 }
5372
5373 return;
5374} 5311}
5375 5312
5376static void 5313static void
@@ -5395,8 +5332,6 @@ de4x5_dbg_media(struct net_device *dev)
5395 } 5332 }
5396 lp->c_media = lp->media; 5333 lp->c_media = lp->media;
5397 } 5334 }
5398
5399 return;
5400} 5335}
5401 5336
5402static void 5337static void
@@ -5417,8 +5352,6 @@ de4x5_dbg_srom(struct de4x5_srom *p)
5417 printk("%3d %04x\n", i<<1, (u_short)*((u_short *)p+i)); 5352 printk("%3d %04x\n", i<<1, (u_short)*((u_short *)p+i));
5418 } 5353 }
5419 } 5354 }
5420
5421 return;
5422} 5355}
5423 5356
5424static void 5357static void
@@ -5440,8 +5373,6 @@ de4x5_dbg_rx(struct sk_buff *skb, int len)
5440 printk("\n"); 5373 printk("\n");
5441 } 5374 }
5442 } 5375 }
5443
5444 return;
5445} 5376}
5446 5377
5447/* 5378/*
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 7278ecb823cb..29e6c63d39fd 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -1118,7 +1118,6 @@ static void dmfe_ethtool_get_wol(struct net_device *dev,
1118 1118
1119 wolinfo->supported = WAKE_PHY | WAKE_MAGIC; 1119 wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
1120 wolinfo->wolopts = db->wol_mode; 1120 wolinfo->wolopts = db->wol_mode;
1121 return;
1122} 1121}
1123 1122
1124 1123
@@ -1180,11 +1179,11 @@ static void dmfe_timer(unsigned long data)
1180 1179
1181 /* TX polling kick monitor */ 1180 /* TX polling kick monitor */
1182 if ( db->tx_packet_cnt && 1181 if ( db->tx_packet_cnt &&
1183 time_after(jiffies, dev->trans_start + DMFE_TX_KICK) ) { 1182 time_after(jiffies, dev_trans_start(dev) + DMFE_TX_KICK) ) {
1184 outl(0x1, dev->base_addr + DCR1); /* Tx polling again */ 1183 outl(0x1, dev->base_addr + DCR1); /* Tx polling again */
1185 1184
1186 /* TX Timeout */ 1185 /* TX Timeout */
1187 if ( time_after(jiffies, dev->trans_start + DMFE_TX_TIMEOUT) ) { 1186 if (time_after(jiffies, dev_trans_start(dev) + DMFE_TX_TIMEOUT) ) {
1188 db->reset_TXtimeout++; 1187 db->reset_TXtimeout++;
1189 db->wait_reset = 1; 1188 db->wait_reset = 1;
1190 dev_warn(&dev->dev, "Tx timeout - resetting\n"); 1189 dev_warn(&dev->dev, "Tx timeout - resetting\n");
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index 68b170ae4d15..a0c770ee4b64 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -396,8 +396,6 @@ void tulip_select_media(struct net_device *dev, int startup)
396 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); 396 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0);
397 397
398 mdelay(1); 398 mdelay(1);
399
400 return;
401} 399}
402 400
403/* 401/*
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c
index 966efa1a27d7..a63e64b6863d 100644
--- a/drivers/net/tulip/pnic.c
+++ b/drivers/net/tulip/pnic.c
@@ -67,7 +67,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
67 */ 67 */
68 if (tulip_media_cap[dev->if_port] & MediaIsMII) 68 if (tulip_media_cap[dev->if_port] & MediaIsMII)
69 return; 69 return;
70 if (! tp->nwayset || time_after(jiffies, dev->trans_start + 1*HZ)) { 70 if (! tp->nwayset || time_after(jiffies, dev_trans_start(dev) + 1*HZ)) {
71 tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); 71 tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff);
72 iowrite32(tp->csr6, ioaddr + CSR6); 72 iowrite32(tp->csr6, ioaddr + CSR6);
73 iowrite32(0x30, ioaddr + CSR12); 73 iowrite32(0x30, ioaddr + CSR12);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 22e766e90063..254643ed945e 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -605,7 +605,7 @@ static void tulip_tx_timeout(struct net_device *dev)
605 605
606out_unlock: 606out_unlock:
607 spin_unlock_irqrestore (&tp->lock, flags); 607 spin_unlock_irqrestore (&tp->lock, flags);
608 dev->trans_start = jiffies; 608 dev->trans_start = jiffies; /* prevent tx timeout */
609 netif_wake_queue (dev); 609 netif_wake_queue (dev);
610} 610}
611 611
@@ -707,8 +707,6 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
707 707
708 spin_unlock_irqrestore(&tp->lock, flags); 708 spin_unlock_irqrestore(&tp->lock, flags);
709 709
710 dev->trans_start = jiffies;
711
712 return NETDEV_TX_OK; 710 return NETDEV_TX_OK;
713} 711}
714 712
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index c7f972852921..96de5829b940 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -1040,11 +1040,11 @@ static void uli526x_timer(unsigned long data)
1040 1040
1041 /* TX polling kick monitor */ 1041 /* TX polling kick monitor */
1042 if ( db->tx_packet_cnt && 1042 if ( db->tx_packet_cnt &&
1043 time_after(jiffies, dev->trans_start + ULI526X_TX_KICK) ) { 1043 time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_KICK) ) {
1044 outl(0x1, dev->base_addr + DCR1); // Tx polling again 1044 outl(0x1, dev->base_addr + DCR1); // Tx polling again
1045 1045
1046 // TX Timeout 1046 // TX Timeout
1047 if ( time_after(jiffies, dev->trans_start + ULI526X_TX_TIMEOUT) ) { 1047 if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) {
1048 db->reset_TXtimeout++; 1048 db->reset_TXtimeout++;
1049 db->wait_reset = 1; 1049 db->wait_reset = 1;
1050 printk( "%s: Tx timeout - resetting\n", 1050 printk( "%s: Tx timeout - resetting\n",
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 18c8cedf4cac..608b279b921b 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -626,7 +626,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
626 iowrite32(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr); 626 iowrite32(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr);
627 mdio_delay(mdio_addr); 627 mdio_delay(mdio_addr);
628 } 628 }
629 return;
630} 629}
631 630
632 631
@@ -969,9 +968,8 @@ static void tx_timeout(struct net_device *dev)
969 enable_irq(dev->irq); 968 enable_irq(dev->irq);
970 969
971 netif_wake_queue(dev); 970 netif_wake_queue(dev);
972 dev->trans_start = jiffies; 971 dev->trans_start = jiffies; /* prevent tx timeout */
973 np->stats.tx_errors++; 972 np->stats.tx_errors++;
974 return;
975} 973}
976 974
977/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ 975/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
@@ -1055,8 +1053,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1055 } 1053 }
1056 spin_unlock_irq(&np->lock); 1054 spin_unlock_irq(&np->lock);
1057 1055
1058 dev->trans_start = jiffies;
1059
1060 if (debug > 4) { 1056 if (debug > 4) {
1061 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n", 1057 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n",
1062 dev->name, np->cur_tx, entry); 1058 dev->name, np->cur_tx, entry);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6b150c072a41..01b5cfcfa870 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -396,7 +396,6 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
396 396
397 /* Enqueue packet */ 397 /* Enqueue packet */
398 skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb); 398 skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb);
399 dev->trans_start = jiffies;
400 399
401 /* Notify and wake up reader process */ 400 /* Notify and wake up reader process */
402 if (tun->flags & TUN_FASYNC) 401 if (tun->flags & TUN_FASYNC)
@@ -418,7 +417,6 @@ static void tun_net_mclist(struct net_device *dev)
418 * _rx_ path and has nothing to do with the _tx_ path. 417 * _rx_ path and has nothing to do with the _tx_ path.
419 * In rx path we always accept everything userspace gives us. 418 * In rx path we always accept everything userspace gives us.
420 */ 419 */
421 return;
422} 420}
423 421
424#define MIN_MTU 68 422#define MIN_MTU 68
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index b94c4cce93c2..22bde49262c0 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -881,8 +881,6 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
881 wmb(); 881 wmb();
882 iowrite32(txRing->lastWrite, tp->tx_ioaddr + txRing->writeRegister); 882 iowrite32(txRing->lastWrite, tp->tx_ioaddr + txRing->writeRegister);
883 883
884 dev->trans_start = jiffies;
885
886 /* If we don't have room to put the worst case packet on the 884 /* If we don't have room to put the worst case packet on the
887 * queue, then we must stop the queue. We need 2 extra 885 * queue, then we must stop the queue. We need 2 extra
888 * descriptors -- one to prevent ring wrap, and one for the 886 * descriptors -- one to prevent ring wrap, and one for the
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 081f76bff341..932602db54b3 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3148,8 +3148,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3148 /* set bd status and length */ 3148 /* set bd status and length */
3149 out_be32((u32 __iomem *)bd, bd_status); 3149 out_be32((u32 __iomem *)bd, bd_status);
3150 3150
3151 dev->trans_start = jiffies;
3152
3153 /* Move to next BD in the ring */ 3151 /* Move to next BD in the ring */
3154 if (!(bd_status & T_W)) 3152 if (!(bd_status & T_W))
3155 bd += sizeof(struct qe_bd); 3153 bd += sizeof(struct qe_bd);
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index be0cc99e881a..9964df199511 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -834,8 +834,6 @@ static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb,
834 } else { 834 } else {
835 net->stats.tx_packets++; 835 net->stats.tx_packets++;
836 net->stats.tx_bytes += skb->len; 836 net->stats.tx_bytes += skb->len;
837 /* And tell the kernel when the last transmit started. */
838 net->trans_start = jiffies;
839 } 837 }
840 dev_kfree_skb(skb); 838 dev_kfree_skb(skb);
841 /* we're done */ 839 /* we're done */
@@ -1474,7 +1472,6 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
1474 spin_unlock_irqrestore(&serial->serial_lock, flags); 1472 spin_unlock_irqrestore(&serial->serial_lock, flags);
1475 1473
1476 /* done */ 1474 /* done */
1477 return;
1478} 1475}
1479 1476
1480/* how many characters in the buffer */ 1477/* how many characters in the buffer */
@@ -1994,7 +1991,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
1994 hso_kick_transmit(serial); 1991 hso_kick_transmit(serial);
1995 1992
1996 D1(" "); 1993 D1(" ");
1997 return;
1998} 1994}
1999 1995
2000/* called for writing diag or CS serial port */ 1996/* called for writing diag or CS serial port */
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index c4c334d9770f..46890dc625dc 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -856,7 +856,6 @@ skip:
856 { 856 {
857 kaweth->stats.tx_packets++; 857 kaweth->stats.tx_packets++;
858 kaweth->stats.tx_bytes += skb->len; 858 kaweth->stats.tx_bytes += skb->len;
859 net->trans_start = jiffies;
860 } 859 }
861 860
862 spin_unlock_irq(&kaweth->device_lock); 861 spin_unlock_irq(&kaweth->device_lock);
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 41838773b568..1cd17d274a12 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -808,7 +808,7 @@ static void write_bulk_callback(struct urb *urb)
808 break; 808 break;
809 } 809 }
810 810
811 net->trans_start = jiffies; 811 net->trans_start = jiffies; /* prevent tx timeout */
812 netif_wake_queue(net); 812 netif_wake_queue(net);
813} 813}
814 814
@@ -909,7 +909,6 @@ static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
909 } else { 909 } else {
910 pegasus->stats.tx_packets++; 910 pegasus->stats.tx_packets++;
911 pegasus->stats.tx_bytes += skb->len; 911 pegasus->stats.tx_bytes += skb->len;
912 net->trans_start = jiffies;
913 } 912 }
914 dev_kfree_skb(skb); 913 dev_kfree_skb(skb);
915 914
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index dd8a4adf48ca..28d3ee175e7b 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -104,8 +104,10 @@ static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg,
104int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) 104int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
105{ 105{
106 struct cdc_state *info = (void *) &dev->data; 106 struct cdc_state *info = (void *) &dev->data;
107 struct usb_cdc_notification notification;
107 int master_ifnum; 108 int master_ifnum;
108 int retval; 109 int retval;
110 int partial;
109 unsigned count; 111 unsigned count;
110 __le32 rsp; 112 __le32 rsp;
111 u32 xid = 0, msg_len, request_id; 113 u32 xid = 0, msg_len, request_id;
@@ -133,13 +135,17 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
133 if (unlikely(retval < 0 || xid == 0)) 135 if (unlikely(retval < 0 || xid == 0))
134 return retval; 136 return retval;
135 137
136 // FIXME Seems like some devices discard responses when 138 /* Some devices don't respond on the control channel until
137 // we time out and cancel our "get response" requests... 139 * polled on the status channel, so do that first. */
138 // so, this is fragile. Probably need to poll for status. 140 retval = usb_interrupt_msg(
141 dev->udev,
142 usb_rcvintpipe(dev->udev, dev->status->desc.bEndpointAddress),
143 &notification, sizeof(notification), &partial,
144 RNDIS_CONTROL_TIMEOUT_MS);
145 if (unlikely(retval < 0))
146 return retval;
139 147
140 /* ignore status endpoint, just poll the control channel; 148 /* Poll the control channel; the request probably completed immediately */
141 * the request probably completed immediately
142 */
143 rsp = buf->msg_type | RNDIS_MSG_COMPLETION; 149 rsp = buf->msg_type | RNDIS_MSG_COMPLETION;
144 for (count = 0; count < 10; count++) { 150 for (count = 0; count < 10; count++) {
145 memset(buf, 0, CONTROL_BUFFER_SIZE); 151 memset(buf, 0, CONTROL_BUFFER_SIZE);
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f9f0730b53d5..5ec542dd5b50 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -187,7 +187,6 @@ tx_drop:
187 return NETDEV_TX_OK; 187 return NETDEV_TX_OK;
188 188
189rx_drop: 189rx_drop:
190 kfree_skb(skb);
191 rcv_stats->rx_dropped++; 190 rcv_stats->rx_dropped++;
192 return NETDEV_TX_OK; 191 return NETDEV_TX_OK;
193} 192}
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 467bcff13cd0..4930f9dbc493 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1209,7 +1209,7 @@ static void rhine_reset_task(struct work_struct *work)
1209 spin_unlock_bh(&rp->lock); 1209 spin_unlock_bh(&rp->lock);
1210 enable_irq(rp->pdev->irq); 1210 enable_irq(rp->pdev->irq);
1211 1211
1212 dev->trans_start = jiffies; 1212 dev->trans_start = jiffies; /* prevent tx timeout */
1213 dev->stats.tx_errors++; 1213 dev->stats.tx_errors++;
1214 netif_wake_queue(dev); 1214 netif_wake_queue(dev);
1215} 1215}
@@ -1294,8 +1294,6 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
1294 if (rp->cur_tx == rp->dirty_tx + TX_QUEUE_LEN) 1294 if (rp->cur_tx == rp->dirty_tx + TX_QUEUE_LEN)
1295 netif_stop_queue(dev); 1295 netif_stop_queue(dev);
1296 1296
1297 dev->trans_start = jiffies;
1298
1299 spin_unlock_irqrestore(&rp->lock, flags); 1297 spin_unlock_irqrestore(&rp->lock, flags);
1300 1298
1301 if (debug > 4) { 1299 if (debug > 4) {
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 616f8c92b745..42dffd3e5795 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2606,7 +2606,6 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
2606 td_ptr->td_buf[0].size |= TD_QUEUE; 2606 td_ptr->td_buf[0].size |= TD_QUEUE;
2607 mac_tx_queue_wake(vptr->mac_regs, qnum); 2607 mac_tx_queue_wake(vptr->mac_regs, qnum);
2608 2608
2609 dev->trans_start = jiffies;
2610 spin_unlock_irqrestore(&vptr->lock, flags); 2609 spin_unlock_irqrestore(&vptr->lock, flags);
2611out: 2610out:
2612 return NETDEV_TX_OK; 2611 return NETDEV_TX_OK;
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 90e783a09245..39462321f5fb 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -992,7 +992,6 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
992 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD, 992 VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD,
993 tq->tx_ring.next2fill); 993 tq->tx_ring.next2fill);
994 } 994 }
995 netdev->trans_start = jiffies;
996 995
997 return NETDEV_TX_OK; 996 return NETDEV_TX_OK;
998 997
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index a5fc8166c01d..297f0d202073 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -183,8 +183,6 @@ __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
183 pci_write_config_word(hldev->pdev, PCI_COMMAND, cmd); 183 pci_write_config_word(hldev->pdev, PCI_COMMAND, cmd);
184 184
185 pci_save_state(hldev->pdev); 185 pci_save_state(hldev->pdev);
186
187 return;
188} 186}
189 187
190/* 188/*
@@ -342,8 +340,6 @@ void __vxge_hw_device_id_get(struct __vxge_hw_device *hldev)
342 340
343 hldev->minor_revision = 341 hldev->minor_revision =
344 (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MINOR_REVISION(val64); 342 (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MINOR_REVISION(val64);
345
346 return;
347} 343}
348 344
349/* 345/*
@@ -428,8 +424,6 @@ void __vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev)
428 hldev->first_vp_id = i; 424 hldev->first_vp_id = i;
429 break; 425 break;
430 } 426 }
431
432 return;
433} 427}
434 428
435/* 429/*
@@ -1217,8 +1211,6 @@ __vxge_hw_ring_mempool_item_alloc(struct vxge_hw_mempool *mempoolh,
1217 /* link this RxD block with previous one */ 1211 /* link this RxD block with previous one */
1218 __vxge_hw_ring_rxdblock_link(mempoolh, ring, index - 1, index); 1212 __vxge_hw_ring_rxdblock_link(mempoolh, ring, index - 1, index);
1219 } 1213 }
1220
1221 return;
1222} 1214}
1223 1215
1224/* 1216/*
@@ -2318,8 +2310,6 @@ __vxge_hw_fifo_mempool_item_alloc(
2318 txdl_priv->first_txdp = txdp; 2310 txdl_priv->first_txdp = txdp;
2319 txdl_priv->next_txdl_priv = NULL; 2311 txdl_priv->next_txdl_priv = NULL;
2320 txdl_priv->alloc_frags = 0; 2312 txdl_priv->alloc_frags = 0;
2321
2322 return;
2323} 2313}
2324 2314
2325/* 2315/*
@@ -2576,7 +2566,6 @@ __vxge_hw_read_rts_ds(struct vxge_hw_vpath_reg __iomem *vpath_reg,
2576 writeq(dta_struct_sel, &vpath_reg->rts_access_steer_data0); 2566 writeq(dta_struct_sel, &vpath_reg->rts_access_steer_data0);
2577 writeq(0, &vpath_reg->rts_access_steer_data1); 2567 writeq(0, &vpath_reg->rts_access_steer_data1);
2578 wmb(); 2568 wmb();
2579 return;
2580} 2569}
2581 2570
2582 2571
@@ -3484,7 +3473,6 @@ __vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev, u32 vp_id)
3484 val64 &= ~VXGE_HW_PRC_CFG4_RTH_DISABLE; 3473 val64 &= ~VXGE_HW_PRC_CFG4_RTH_DISABLE;
3485 3474
3486 writeq(val64, &vp_reg->prc_cfg4); 3475 writeq(val64, &vp_reg->prc_cfg4);
3487 return;
3488} 3476}
3489 3477
3490/* 3478/*
@@ -3903,7 +3891,6 @@ vxge_hw_vpath_tti_ci_set(struct __vxge_hw_device *hldev, u32 vp_id)
3903 &vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]); 3891 &vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]);
3904 } 3892 }
3905 } 3893 }
3906 return;
3907} 3894}
3908/* 3895/*
3909 * __vxge_hw_vpath_initialize 3896 * __vxge_hw_vpath_initialize
@@ -5037,8 +5024,6 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
5037 if (status == VXGE_HW_OK) 5024 if (status == VXGE_HW_OK)
5038 __vxge_hw_blockpool_blocks_remove(blockpool); 5025 __vxge_hw_blockpool_blocks_remove(blockpool);
5039 } 5026 }
5040
5041 return;
5042} 5027}
5043 5028
5044/* 5029/*
@@ -5094,6 +5079,4 @@ __vxge_hw_blockpool_block_free(struct __vxge_hw_device *devh,
5094 } 5079 }
5095 5080
5096 __vxge_hw_blockpool_blocks_remove(blockpool); 5081 __vxge_hw_blockpool_blocks_remove(blockpool);
5097
5098 return;
5099} 5082}
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 2bab36421f71..b504bd561362 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -1764,7 +1764,6 @@ static void vxge_netpoll(struct net_device *dev)
1764 1764
1765 vxge_debug_entryexit(VXGE_TRACE, 1765 vxge_debug_entryexit(VXGE_TRACE,
1766 "%s:%d Exiting...", __func__, __LINE__); 1766 "%s:%d Exiting...", __func__, __LINE__);
1767 return;
1768} 1767}
1769#endif 1768#endif
1770 1769
@@ -2815,7 +2814,6 @@ static void vxge_napi_del_all(struct vxgedev *vdev)
2815 for (i = 0; i < vdev->no_of_vpath; i++) 2814 for (i = 0; i < vdev->no_of_vpath; i++)
2816 netif_napi_del(&vdev->vpaths[i].ring.napi); 2815 netif_napi_del(&vdev->vpaths[i].ring.napi);
2817 } 2816 }
2818 return;
2819} 2817}
2820 2818
2821int do_vxge_close(struct net_device *dev, int do_io) 2819int do_vxge_close(struct net_device *dev, int do_io)
@@ -3500,8 +3498,6 @@ static void verify_bandwidth(void)
3500 for (i = 1; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) 3498 for (i = 1; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++)
3501 bw_percentage[i] = bw_percentage[0]; 3499 bw_percentage[i] = bw_percentage[0];
3502 } 3500 }
3503
3504 return;
3505} 3501}
3506 3502
3507/* 3503/*
diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c
index f83e6aee3f6a..6cc1dd79b40b 100644
--- a/drivers/net/vxge/vxge-traffic.c
+++ b/drivers/net/vxge/vxge-traffic.c
@@ -233,8 +233,6 @@ void vxge_hw_channel_msix_mask(struct __vxge_hw_channel *channel, int msix_id)
233 __vxge_hw_pio_mem_write32_upper( 233 __vxge_hw_pio_mem_write32_upper(
234 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32), 234 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32),
235 &channel->common_reg->set_msix_mask_vect[msix_id%4]); 235 &channel->common_reg->set_msix_mask_vect[msix_id%4]);
236
237 return;
238} 236}
239 237
240/** 238/**
@@ -253,8 +251,6 @@ vxge_hw_channel_msix_unmask(struct __vxge_hw_channel *channel, int msix_id)
253 __vxge_hw_pio_mem_write32_upper( 251 __vxge_hw_pio_mem_write32_upper(
254 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32), 252 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32),
255 &channel->common_reg->clear_msix_mask_vect[msix_id%4]); 253 &channel->common_reg->clear_msix_mask_vect[msix_id%4]);
256
257 return;
258} 254}
259 255
260/** 256/**
@@ -329,8 +325,6 @@ void vxge_hw_device_intr_enable(struct __vxge_hw_device *hldev)
329 val64 = readq(&hldev->common_reg->titan_general_int_status); 325 val64 = readq(&hldev->common_reg->titan_general_int_status);
330 326
331 vxge_hw_device_unmask_all(hldev); 327 vxge_hw_device_unmask_all(hldev);
332
333 return;
334} 328}
335 329
336/** 330/**
@@ -362,8 +356,6 @@ void vxge_hw_device_intr_disable(struct __vxge_hw_device *hldev)
362 vxge_hw_vpath_intr_disable( 356 vxge_hw_vpath_intr_disable(
363 VXGE_HW_VIRTUAL_PATH_HANDLE(&hldev->virtual_paths[i])); 357 VXGE_HW_VIRTUAL_PATH_HANDLE(&hldev->virtual_paths[i]));
364 } 358 }
365
366 return;
367} 359}
368 360
369/** 361/**
@@ -383,8 +375,6 @@ void vxge_hw_device_mask_all(struct __vxge_hw_device *hldev)
383 375
384 __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32), 376 __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32),
385 &hldev->common_reg->titan_mask_all_int); 377 &hldev->common_reg->titan_mask_all_int);
386
387 return;
388} 378}
389 379
390/** 380/**
@@ -404,8 +394,6 @@ void vxge_hw_device_unmask_all(struct __vxge_hw_device *hldev)
404 394
405 __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32), 395 __vxge_hw_pio_mem_write32_upper((u32)vxge_bVALn(val64, 0, 32),
406 &hldev->common_reg->titan_mask_all_int); 396 &hldev->common_reg->titan_mask_all_int);
407
408 return;
409} 397}
410 398
411/** 399/**
@@ -647,8 +635,6 @@ void vxge_hw_device_clear_tx_rx(struct __vxge_hw_device *hldev)
647 hldev->tim_int_mask1[VXGE_HW_VPATH_INTR_RX]), 635 hldev->tim_int_mask1[VXGE_HW_VPATH_INTR_RX]),
648 &hldev->common_reg->tim_int_status1); 636 &hldev->common_reg->tim_int_status1);
649 } 637 }
650
651 return;
652} 638}
653 639
654/* 640/*
@@ -2255,8 +2241,6 @@ vxge_hw_vpath_msix_set(struct __vxge_hw_vpath_handle *vp, int *tim_msix_id,
2255 VXGE_HW_ONE_SHOT_VECT3_EN_ONE_SHOT_VECT3_EN, 2241 VXGE_HW_ONE_SHOT_VECT3_EN_ONE_SHOT_VECT3_EN,
2256 0, 32), &vp_reg->one_shot_vect3_en); 2242 0, 32), &vp_reg->one_shot_vect3_en);
2257 } 2243 }
2258
2259 return;
2260} 2244}
2261 2245
2262/** 2246/**
@@ -2278,8 +2262,6 @@ vxge_hw_vpath_msix_mask(struct __vxge_hw_vpath_handle *vp, int msix_id)
2278 __vxge_hw_pio_mem_write32_upper( 2262 __vxge_hw_pio_mem_write32_upper(
2279 (u32) vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32), 2263 (u32) vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32),
2280 &hldev->common_reg->set_msix_mask_vect[msix_id % 4]); 2264 &hldev->common_reg->set_msix_mask_vect[msix_id % 4]);
2281
2282 return;
2283} 2265}
2284 2266
2285/** 2267/**
@@ -2310,8 +2292,6 @@ vxge_hw_vpath_msix_clear(struct __vxge_hw_vpath_handle *vp, int msix_id)
2310 &hldev->common_reg-> 2292 &hldev->common_reg->
2311 clear_msix_mask_vect[msix_id%4]); 2293 clear_msix_mask_vect[msix_id%4]);
2312 } 2294 }
2313
2314 return;
2315} 2295}
2316 2296
2317/** 2297/**
@@ -2333,8 +2313,6 @@ vxge_hw_vpath_msix_unmask(struct __vxge_hw_vpath_handle *vp, int msix_id)
2333 __vxge_hw_pio_mem_write32_upper( 2313 __vxge_hw_pio_mem_write32_upper(
2334 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32), 2314 (u32)vxge_bVALn(vxge_mBIT(msix_id >> 2), 0, 32),
2335 &hldev->common_reg->clear_msix_mask_vect[msix_id%4]); 2315 &hldev->common_reg->clear_msix_mask_vect[msix_id%4]);
2336
2337 return;
2338} 2316}
2339 2317
2340/** 2318/**
@@ -2351,8 +2329,6 @@ vxge_hw_vpath_msix_mask_all(struct __vxge_hw_vpath_handle *vp)
2351 __vxge_hw_pio_mem_write32_upper( 2329 __vxge_hw_pio_mem_write32_upper(
2352 (u32)vxge_bVALn(vxge_mBIT(vp->vpath->vp_id), 0, 32), 2330 (u32)vxge_bVALn(vxge_mBIT(vp->vpath->vp_id), 0, 32),
2353 &vp->vpath->hldev->common_reg->set_msix_mask_all_vect); 2331 &vp->vpath->hldev->common_reg->set_msix_mask_all_vect);
2354
2355 return;
2356} 2332}
2357 2333
2358/** 2334/**
@@ -2391,8 +2367,6 @@ void vxge_hw_vpath_inta_mask_tx_rx(struct __vxge_hw_vpath_handle *vp)
2391 tim_int_mask1[VXGE_HW_VPATH_INTR_RX] | val64), 2367 tim_int_mask1[VXGE_HW_VPATH_INTR_RX] | val64),
2392 &hldev->common_reg->tim_int_mask1); 2368 &hldev->common_reg->tim_int_mask1);
2393 } 2369 }
2394
2395 return;
2396} 2370}
2397 2371
2398/** 2372/**
@@ -2429,8 +2403,6 @@ void vxge_hw_vpath_inta_unmask_tx_rx(struct __vxge_hw_vpath_handle *vp)
2429 tim_int_mask1[VXGE_HW_VPATH_INTR_RX])) & val64, 2403 tim_int_mask1[VXGE_HW_VPATH_INTR_RX])) & val64,
2430 &hldev->common_reg->tim_int_mask1); 2404 &hldev->common_reg->tim_int_mask1);
2431 } 2405 }
2432
2433 return;
2434} 2406}
2435 2407
2436/** 2408/**
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index a4859f7a7cc0..d45b08d1dbc9 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -1175,8 +1175,6 @@ static netdev_tx_t dscc4_start_xmit(struct sk_buff *skb,
1175 spin_unlock(&dpriv->lock); 1175 spin_unlock(&dpriv->lock);
1176#endif 1176#endif
1177 1177
1178 dev->trans_start = jiffies;
1179
1180 if (debug > 2) 1178 if (debug > 2)
1181 dscc4_tx_print(dev, dpriv, "Xmit"); 1179 dscc4_tx_print(dev, dpriv, "Xmit");
1182 /* To be cleaned(unsigned int)/optimized. Later, ok ? */ 1180 /* To be cleaned(unsigned int)/optimized. Later, ok ? */
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c
index 4dde2ea4a189..a3ea27ce04f2 100644
--- a/drivers/net/wan/hd64570.c
+++ b/drivers/net/wan/hd64570.c
@@ -658,7 +658,6 @@ static netdev_tx_t sca_xmit(struct sk_buff *skb, struct net_device *dev)
658#endif 658#endif
659 writew(len, &desc->len); 659 writew(len, &desc->len);
660 writeb(ST_TX_EOM, &desc->stat); 660 writeb(ST_TX_EOM, &desc->stat);
661 dev->trans_start = jiffies;
662 661
663 port->txin = next_desc(port, port->txin, 1); 662 port->txin = next_desc(port, port->txin, 1);
664 sca_outw(desc_offset(port, port->txin, 1), 663 sca_outw(desc_offset(port, port->txin, 1),
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c
index aad9ed45c254..ea476cbd38b5 100644
--- a/drivers/net/wan/hd64572.c
+++ b/drivers/net/wan/hd64572.c
@@ -585,7 +585,6 @@ static netdev_tx_t sca_xmit(struct sk_buff *skb, struct net_device *dev)
585 585
586 writew(len, &desc->len); 586 writew(len, &desc->len);
587 writeb(ST_TX_EOM, &desc->stat); 587 writeb(ST_TX_EOM, &desc->stat);
588 dev->trans_start = jiffies;
589 588
590 port->txin = (port->txin + 1) % card->tx_ring_buffers; 589 port->txin = (port->txin + 1) % card->tx_ring_buffers;
591 sca_outl(desc_offset(port, port->txin, 1), 590 sca_outl(desc_offset(port, port->txin, 1),
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 0c2cdde686a0..88e363033e23 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -891,7 +891,6 @@ static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev)
891 891
892 wmb(); 892 wmb();
893 queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc); 893 queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc);
894 dev->trans_start = jiffies;
895 894
896 if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ 895 if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */
897#if DEBUG_TX 896#if DEBUG_TX
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index b27850377121..e2c6f7f4f51c 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1506,8 +1506,6 @@ static netdev_tx_t lmc_start_xmit(struct sk_buff *skb,
1506 /* send now! */ 1506 /* send now! */
1507 LMC_CSR_WRITE (sc, csr_txpoll, 0); 1507 LMC_CSR_WRITE (sc, csr_txpoll, 0);
1508 1508
1509 dev->trans_start = jiffies;
1510
1511 spin_unlock_irqrestore(&sc->lmc_lock, flags); 1509 spin_unlock_irqrestore(&sc->lmc_lock, flags);
1512 1510
1513 lmc_trace(dev, "lmc_start_xmit_out"); 1511 lmc_trace(dev, "lmc_start_xmit_out");
@@ -2103,7 +2101,7 @@ static void lmc_driver_timeout(struct net_device *dev)
2103 printk("%s: Xmitter busy|\n", dev->name); 2101 printk("%s: Xmitter busy|\n", dev->name);
2104 2102
2105 sc->extra_stats.tx_tbusy_calls++; 2103 sc->extra_stats.tx_tbusy_calls++;
2106 if (jiffies - dev->trans_start < TX_TIMEOUT) 2104 if (jiffies - dev_trans_start(dev) < TX_TIMEOUT)
2107 goto bug_out; 2105 goto bug_out;
2108 2106
2109 /* 2107 /*
@@ -2135,7 +2133,7 @@ static void lmc_driver_timeout(struct net_device *dev)
2135 sc->lmc_device->stats.tx_errors++; 2133 sc->lmc_device->stats.tx_errors++;
2136 sc->extra_stats.tx_ProcTimeout++; /* -baz */ 2134 sc->extra_stats.tx_ProcTimeout++; /* -baz */
2137 2135
2138 dev->trans_start = jiffies; 2136 dev->trans_start = jiffies; /* prevent tx timeout */
2139 2137
2140bug_out: 2138bug_out:
2141 2139
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 17502d80b65a..c6aa66e5b52f 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -1790,7 +1790,7 @@ static void cpc_tx_timeout(struct net_device *dev)
1790 cpc_readb(card->hw.falcbase + card->hw.cpld_reg2) & 1790 cpc_readb(card->hw.falcbase + card->hw.cpld_reg2) &
1791 ~(CPLD_REG2_FALC_LED1 << (2 * ch))); 1791 ~(CPLD_REG2_FALC_LED1 << (2 * ch)));
1792 } 1792 }
1793 dev->trans_start = jiffies; 1793 dev->trans_start = jiffies; /* prevent tx timeout */
1794 CPC_UNLOCK(card, flags); 1794 CPC_UNLOCK(card, flags);
1795 netif_wake_queue(dev); 1795 netif_wake_queue(dev);
1796} 1796}
@@ -1849,7 +1849,6 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1849 if (d->trace_on) { 1849 if (d->trace_on) {
1850 cpc_trace(dev, skb, 'T'); 1850 cpc_trace(dev, skb, 'T');
1851 } 1851 }
1852 dev->trans_start = jiffies;
1853 1852
1854 /* Start transmission */ 1853 /* Start transmission */
1855 CPC_LOCK(card, flags); 1854 CPC_LOCK(card, flags);
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 541c700dceef..db73a7be199f 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -298,7 +298,6 @@ static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
298 desc->stat = PACKET_FULL; 298 desc->stat = PACKET_FULL;
299 writel(1 << (DOORBELL_TO_CARD_TX_0 + port->node), 299 writel(1 << (DOORBELL_TO_CARD_TX_0 + port->node),
300 port->card->plx + PLX_DOORBELL_TO_CARD); 300 port->card->plx + PLX_DOORBELL_TO_CARD);
301 dev->trans_start = jiffies;
302 301
303 port->tx_out = (port->tx_out + 1) % TX_BUFFERS; 302 port->tx_out = (port->tx_out + 1) % TX_BUFFERS;
304 303
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index d8322d2d1e29..746a5ee32f33 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -395,7 +395,6 @@ wd_reset_8390(struct net_device *dev)
395 outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5); 395 outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5);
396 396
397 if (ei_debug > 1) printk("reset done\n"); 397 if (ei_debug > 1) printk("reset done\n");
398 return;
399} 398}
400 399
401/* Grab the 8390 specific header. Similar to the block_input routine, but 400/* Grab the 8390 specific header. Similar to the block_input routine, but
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
index 0c1aa8867531..ac5e2c4e517c 100644
--- a/drivers/net/wimax/i2400m/control.c
+++ b/drivers/net/wimax/i2400m/control.c
@@ -583,7 +583,6 @@ void i2400m_msg_ack_hook(struct i2400m *i2400m,
583 } 583 }
584 break; 584 break;
585 }; 585 };
586 return;
587} 586}
588 587
589 588
@@ -1434,5 +1433,4 @@ void i2400m_dev_shutdown(struct i2400m *i2400m)
1434 1433
1435 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); 1434 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
1436 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); 1435 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
1437 return;
1438} 1436}
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 66bdb5d6cd34..9c8b78d4abd2 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -737,7 +737,6 @@ out:
737 kfree(iw); 737 kfree(iw);
738 d_fnend(3, dev, "(ws %p i2400m %p reason %s) = void\n", 738 d_fnend(3, dev, "(ws %p i2400m %p reason %s) = void\n",
739 ws, i2400m, reason); 739 ws, i2400m, reason);
740 return;
741} 740}
742 741
743 742
@@ -1087,7 +1086,6 @@ void __exit i2400m_driver_exit(void)
1087 /* for scheds i2400m_dev_reset_handle() */ 1086 /* for scheds i2400m_dev_reset_handle() */
1088 flush_scheduled_work(); 1087 flush_scheduled_work();
1089 i2400m_barker_db_exit(); 1088 i2400m_barker_db_exit();
1090 return;
1091} 1089}
1092module_exit(i2400m_driver_exit); 1090module_exit(i2400m_driver_exit);
1093 1091
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
index 7d7b5ef0531c..94742e1eafe0 100644
--- a/drivers/net/wimax/i2400m/netdev.c
+++ b/drivers/net/wimax/i2400m/netdev.c
@@ -253,7 +253,6 @@ void i2400m_net_wake_stop(struct i2400m *i2400m)
253 kfree_skb(wake_tx_skb); 253 kfree_skb(wake_tx_skb);
254 } 254 }
255 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); 255 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
256 return;
257} 256}
258 257
259 258
@@ -432,7 +431,6 @@ void i2400m_tx_timeout(struct net_device *net_dev)
432 * this, there might be data pending to be sent or not... 431 * this, there might be data pending to be sent or not...
433 */ 432 */
434 net_dev->stats.tx_errors++; 433 net_dev->stats.tx_errors++;
435 return;
436} 434}
437 435
438 436
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index c835ae8b89ce..6537593fae66 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -317,7 +317,6 @@ error_waiter_cancelled:
317 kfree_skb(ack_skb); 317 kfree_skb(ack_skb);
318error_no_waiter: 318error_no_waiter:
319 spin_unlock_irqrestore(&i2400m->rx_lock, flags); 319 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
320 return;
321} 320}
322 321
323 322
@@ -722,7 +721,6 @@ void __i2400m_roq_queue(struct i2400m *i2400m, struct i2400m_roq *roq,
722out: 721out:
723 d_fnend(4, dev, "(i2400m %p roq %p skb %p sn %u nsn %d) = void\n", 722 d_fnend(4, dev, "(i2400m %p roq %p skb %p sn %u nsn %d) = void\n",
724 i2400m, roq, skb, sn, nsn); 723 i2400m, roq, skb, sn, nsn);
725 return;
726} 724}
727 725
728 726
@@ -802,7 +800,6 @@ void i2400m_roq_reset(struct i2400m *i2400m, struct i2400m_roq *roq)
802 } 800 }
803 roq->ws = 0; 801 roq->ws = 0;
804 d_fnend(2, dev, "(i2400m %p roq %p) = void\n", i2400m, roq); 802 d_fnend(2, dev, "(i2400m %p roq %p) = void\n", i2400m, roq);
805 return;
806} 803}
807 804
808 805
@@ -841,7 +838,6 @@ void i2400m_roq_queue(struct i2400m *i2400m, struct i2400m_roq *roq,
841 } 838 }
842 d_fnend(2, dev, "(i2400m %p roq %p skb %p lbn %u) = void\n", 839 d_fnend(2, dev, "(i2400m %p roq %p skb %p lbn %u) = void\n",
843 i2400m, roq, skb, lbn); 840 i2400m, roq, skb, lbn);
844 return;
845} 841}
846 842
847 843
@@ -867,7 +863,6 @@ void i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
867 i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_WS, 863 i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_WS,
868 old_ws, len, sn, nsn, roq->ws); 864 old_ws, len, sn, nsn, roq->ws);
869 d_fnstart(2, dev, "(i2400m %p roq %p sn %u) = void\n", i2400m, roq, sn); 865 d_fnstart(2, dev, "(i2400m %p roq %p sn %u) = void\n", i2400m, roq, sn);
870 return;
871} 866}
872 867
873 868
@@ -917,7 +912,6 @@ void i2400m_roq_queue_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
917 912
918 d_fnend(2, dev, "(i2400m %p roq %p skb %p sn %u) = void\n", 913 d_fnend(2, dev, "(i2400m %p roq %p skb %p sn %u) = void\n",
919 i2400m, roq, skb, sn); 914 i2400m, roq, skb, sn);
920 return;
921} 915}
922 916
923 917
@@ -1079,7 +1073,6 @@ error_skb_clone:
1079error: 1073error:
1080 d_fnend(2, dev, "(i2400m %p skb_rx %p single %u payload %p " 1074 d_fnend(2, dev, "(i2400m %p skb_rx %p single %u payload %p "
1081 "size %zu) = void\n", i2400m, skb_rx, single_last, payload, size); 1075 "size %zu) = void\n", i2400m, skb_rx, single_last, payload, size);
1082 return;
1083} 1076}
1084 1077
1085 1078
diff --git a/drivers/net/wimax/i2400m/sdio-rx.c b/drivers/net/wimax/i2400m/sdio-rx.c
index d619da33f20b..8b809c2ead6c 100644
--- a/drivers/net/wimax/i2400m/sdio-rx.c
+++ b/drivers/net/wimax/i2400m/sdio-rx.c
@@ -197,7 +197,6 @@ error_alloc_skb:
197error_get_size: 197error_get_size:
198error_bad_size: 198error_bad_size:
199 d_fnend(7, dev, "(i2400ms %p) = %d\n", i2400ms, ret); 199 d_fnend(7, dev, "(i2400ms %p) = %d\n", i2400ms, ret);
200 return;
201} 200}
202 201
203 202
@@ -229,7 +228,6 @@ void i2400ms_irq(struct sdio_func *func)
229 i2400ms_rx(i2400ms); 228 i2400ms_rx(i2400ms);
230error_no_irq: 229error_no_irq:
231 d_fnend(6, dev, "(i2400ms %p) = void\n", i2400ms); 230 d_fnend(6, dev, "(i2400ms %p) = void\n", i2400ms);
232 return;
233} 231}
234 232
235 233
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c
index 7b6a1d98bd74..d44b545f4082 100644
--- a/drivers/net/wimax/i2400m/usb-notif.c
+++ b/drivers/net/wimax/i2400m/usb-notif.c
@@ -178,7 +178,6 @@ error_submit:
178out: 178out:
179 d_fnend(4, dev, "(urb %p status %d actual_length %d) = void\n", 179 d_fnend(4, dev, "(urb %p status %d actual_length %d) = void\n",
180 urb, urb->status, urb->actual_length); 180 urb, urb->status, urb->actual_length);
181 return;
182} 181}
183 182
184 183
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 2fbe9b4506c0..174e3442d519 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -5,6 +5,7 @@
5menuconfig WLAN 5menuconfig WLAN
6 bool "Wireless LAN" 6 bool "Wireless LAN"
7 depends on !S390 7 depends on !S390
8 depends on NET
8 select WIRELESS 9 select WIRELESS
9 default y 10 default y
10 ---help--- 11 ---help---
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 7a626d4e100f..8a2d4afc74f8 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1223,7 +1223,6 @@ static void at76_rx_callback(struct urb *urb)
1223 1223
1224 priv->rx_tasklet.data = (unsigned long)urb; 1224 priv->rx_tasklet.data = (unsigned long)urb;
1225 tasklet_schedule(&priv->rx_tasklet); 1225 tasklet_schedule(&priv->rx_tasklet);
1226 return;
1227} 1226}
1228 1227
1229static int at76_submit_rx_urb(struct at76_priv *priv) 1228static int at76_submit_rx_urb(struct at76_priv *priv)
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index dc662b76a1c8..4f845f80c098 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -109,41 +109,6 @@ struct ar9170_rxstream_mpdu_merge {
109 bool has_plcp; 109 bool has_plcp;
110}; 110};
111 111
112#define AR9170_NUM_TID 16
113#define WME_BA_BMP_SIZE 64
114#define AR9170_NUM_MAX_AGG_LEN (2 * WME_BA_BMP_SIZE)
115
116#define WME_AC_BE 2
117#define WME_AC_BK 3
118#define WME_AC_VI 1
119#define WME_AC_VO 0
120
121#define TID_TO_WME_AC(_tid) \
122 ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
123 (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
124 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
125 WME_AC_VO)
126
127#define BAW_WITHIN(_start, _bawsz, _seqno) \
128 ((((_seqno) - (_start)) & 0xfff) < (_bawsz))
129
130enum ar9170_tid_state {
131 AR9170_TID_STATE_INVALID,
132 AR9170_TID_STATE_SHUTDOWN,
133 AR9170_TID_STATE_PROGRESS,
134 AR9170_TID_STATE_COMPLETE,
135};
136
137struct ar9170_sta_tid {
138 struct list_head list;
139 struct sk_buff_head queue;
140 u8 addr[ETH_ALEN];
141 u16 ssn;
142 u16 tid;
143 enum ar9170_tid_state state;
144 bool active;
145};
146
147struct ar9170_tx_queue_stats { 112struct ar9170_tx_queue_stats {
148 unsigned int len; 113 unsigned int len;
149 unsigned int limit; 114 unsigned int limit;
@@ -152,14 +117,11 @@ struct ar9170_tx_queue_stats {
152 117
153#define AR9170_QUEUE_TIMEOUT 64 118#define AR9170_QUEUE_TIMEOUT 64
154#define AR9170_TX_TIMEOUT 8 119#define AR9170_TX_TIMEOUT 8
155#define AR9170_BA_TIMEOUT 4
156#define AR9170_JANITOR_DELAY 128 120#define AR9170_JANITOR_DELAY 128
157#define AR9170_TX_INVALID_RATE 0xffffffff 121#define AR9170_TX_INVALID_RATE 0xffffffff
158 122
159#define AR9170_NUM_TX_STATUS 128 123#define AR9170_NUM_TX_LIMIT_HARD AR9170_TXQ_DEPTH
160#define AR9170_NUM_TX_AGG_MAX 30 124#define AR9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH - 10)
161#define AR9170_NUM_TX_LIMIT_HARD AR9170_TXQ_DEPTH
162#define AR9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH - 10)
163 125
164struct ar9170 { 126struct ar9170 {
165 struct ieee80211_hw *hw; 127 struct ieee80211_hw *hw;
@@ -234,11 +196,6 @@ struct ar9170 {
234 struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; 196 struct sk_buff_head tx_pending[__AR9170_NUM_TXQ];
235 struct sk_buff_head tx_status[__AR9170_NUM_TXQ]; 197 struct sk_buff_head tx_status[__AR9170_NUM_TXQ];
236 struct delayed_work tx_janitor; 198 struct delayed_work tx_janitor;
237 /* tx ampdu */
238 struct sk_buff_head tx_status_ampdu;
239 spinlock_t tx_ampdu_list_lock;
240 struct list_head tx_ampdu_list;
241 atomic_t tx_ampdu_pending;
242 199
243 /* rxstream mpdu merge */ 200 /* rxstream mpdu merge */
244 struct ar9170_rxstream_mpdu_merge rx_mpdu; 201 struct ar9170_rxstream_mpdu_merge rx_mpdu;
@@ -250,11 +207,6 @@ struct ar9170 {
250 u8 global_ampdu_factor; 207 u8 global_ampdu_factor;
251}; 208};
252 209
253struct ar9170_sta_info {
254 struct ar9170_sta_tid agg[AR9170_NUM_TID];
255 unsigned int ampdu_max_len;
256};
257
258struct ar9170_tx_info { 210struct ar9170_tx_info {
259 unsigned long timeout; 211 unsigned long timeout;
260}; 212};
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 2e9b330f6413..2abc87578994 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -50,10 +50,6 @@ static int modparam_nohwcrypt;
50module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); 50module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
51MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 51MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
52 52
53static int modparam_ht;
54module_param_named(ht, modparam_ht, bool, S_IRUGO);
55MODULE_PARM_DESC(ht, "enable MPDU aggregation.");
56
57#define RATE(_bitrate, _hw_rate, _txpidx, _flags) { \ 53#define RATE(_bitrate, _hw_rate, _txpidx, _flags) { \
58 .bitrate = (_bitrate), \ 54 .bitrate = (_bitrate), \
59 .flags = (_flags), \ 55 .flags = (_flags), \
@@ -182,7 +178,6 @@ static struct ieee80211_supported_band ar9170_band_5GHz = {
182}; 178};
183 179
184static void ar9170_tx(struct ar9170 *ar); 180static void ar9170_tx(struct ar9170 *ar);
185static bool ar9170_tx_ampdu(struct ar9170 *ar);
186 181
187static inline u16 ar9170_get_seq_h(struct ieee80211_hdr *hdr) 182static inline u16 ar9170_get_seq_h(struct ieee80211_hdr *hdr)
188{ 183{
@@ -195,21 +190,7 @@ static inline u16 ar9170_get_seq(struct sk_buff *skb)
195 return ar9170_get_seq_h((void *) txc->frame_data); 190 return ar9170_get_seq_h((void *) txc->frame_data);
196} 191}
197 192
198static inline u16 ar9170_get_tid_h(struct ieee80211_hdr *hdr) 193#ifdef AR9170_QUEUE_DEBUG
199{
200 return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK;
201}
202
203static inline u16 ar9170_get_tid(struct sk_buff *skb)
204{
205 struct ar9170_tx_control *txc = (void *) skb->data;
206 return ar9170_get_tid_h((struct ieee80211_hdr *) txc->frame_data);
207}
208
209#define GET_NEXT_SEQ(seq) ((seq + 1) & 0x0fff)
210#define GET_NEXT_SEQ_FROM_SKB(skb) (GET_NEXT_SEQ(ar9170_get_seq(skb)))
211
212#if (defined AR9170_QUEUE_DEBUG) || (defined AR9170_TXAGG_DEBUG)
213static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb) 194static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb)
214{ 195{
215 struct ar9170_tx_control *txc = (void *) skb->data; 196 struct ar9170_tx_control *txc = (void *) skb->data;
@@ -244,7 +225,7 @@ static void __ar9170_dump_txqueue(struct ar9170 *ar,
244 "mismatch %d != %d\n", skb_queue_len(queue), i); 225 "mismatch %d != %d\n", skb_queue_len(queue), i);
245 printk(KERN_DEBUG "---[ end ]---\n"); 226 printk(KERN_DEBUG "---[ end ]---\n");
246} 227}
247#endif /* AR9170_QUEUE_DEBUG || AR9170_TXAGG_DEBUG */ 228#endif /* AR9170_QUEUE_DEBUG */
248 229
249#ifdef AR9170_QUEUE_DEBUG 230#ifdef AR9170_QUEUE_DEBUG
250static void ar9170_dump_txqueue(struct ar9170 *ar, 231static void ar9170_dump_txqueue(struct ar9170 *ar,
@@ -275,20 +256,6 @@ static void __ar9170_dump_txstats(struct ar9170 *ar)
275} 256}
276#endif /* AR9170_QUEUE_STOP_DEBUG */ 257#endif /* AR9170_QUEUE_STOP_DEBUG */
277 258
278#ifdef AR9170_TXAGG_DEBUG
279static void ar9170_dump_tx_status_ampdu(struct ar9170 *ar)
280{
281 unsigned long flags;
282
283 spin_lock_irqsave(&ar->tx_status_ampdu.lock, flags);
284 printk(KERN_DEBUG "%s: A-MPDU tx_status queue =>\n",
285 wiphy_name(ar->hw->wiphy));
286 __ar9170_dump_txqueue(ar, &ar->tx_status_ampdu);
287 spin_unlock_irqrestore(&ar->tx_status_ampdu.lock, flags);
288}
289
290#endif /* AR9170_TXAGG_DEBUG */
291
292/* caller must guarantee exclusive access for _bin_ queue. */ 259/* caller must guarantee exclusive access for _bin_ queue. */
293static void ar9170_recycle_expired(struct ar9170 *ar, 260static void ar9170_recycle_expired(struct ar9170 *ar,
294 struct sk_buff_head *queue, 261 struct sk_buff_head *queue,
@@ -360,70 +327,6 @@ static void ar9170_tx_status(struct ar9170 *ar, struct sk_buff *skb,
360 ieee80211_tx_status_irqsafe(ar->hw, skb); 327 ieee80211_tx_status_irqsafe(ar->hw, skb);
361} 328}
362 329
363static void ar9170_tx_fake_ampdu_status(struct ar9170 *ar)
364{
365 struct sk_buff_head success;
366 struct sk_buff *skb;
367 unsigned int i;
368 unsigned long queue_bitmap = 0;
369
370 skb_queue_head_init(&success);
371
372 while (skb_queue_len(&ar->tx_status_ampdu) > AR9170_NUM_TX_STATUS)
373 __skb_queue_tail(&success, skb_dequeue(&ar->tx_status_ampdu));
374
375 ar9170_recycle_expired(ar, &ar->tx_status_ampdu, &success);
376
377#ifdef AR9170_TXAGG_DEBUG
378 printk(KERN_DEBUG "%s: collected %d A-MPDU frames.\n",
379 wiphy_name(ar->hw->wiphy), skb_queue_len(&success));
380 __ar9170_dump_txqueue(ar, &success);
381#endif /* AR9170_TXAGG_DEBUG */
382
383 while ((skb = __skb_dequeue(&success))) {
384 struct ieee80211_tx_info *txinfo;
385
386 queue_bitmap |= BIT(skb_get_queue_mapping(skb));
387
388 txinfo = IEEE80211_SKB_CB(skb);
389 ieee80211_tx_info_clear_status(txinfo);
390
391 txinfo->flags |= IEEE80211_TX_STAT_ACK;
392 txinfo->status.rates[0].count = 1;
393
394 skb_pull(skb, sizeof(struct ar9170_tx_control));
395 ieee80211_tx_status_irqsafe(ar->hw, skb);
396 }
397
398 for_each_set_bit(i, &queue_bitmap, BITS_PER_BYTE) {
399#ifdef AR9170_QUEUE_STOP_DEBUG
400 printk(KERN_DEBUG "%s: wake queue %d\n",
401 wiphy_name(ar->hw->wiphy), i);
402 __ar9170_dump_txstats(ar);
403#endif /* AR9170_QUEUE_STOP_DEBUG */
404 ieee80211_wake_queue(ar->hw, i);
405 }
406
407 if (queue_bitmap)
408 ar9170_tx(ar);
409}
410
411static void ar9170_tx_ampdu_callback(struct ar9170 *ar, struct sk_buff *skb)
412{
413 struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
414 struct ar9170_tx_info *arinfo = (void *) txinfo->rate_driver_data;
415
416 arinfo->timeout = jiffies +
417 msecs_to_jiffies(AR9170_BA_TIMEOUT);
418
419 skb_queue_tail(&ar->tx_status_ampdu, skb);
420 ar9170_tx_fake_ampdu_status(ar);
421
422 if (atomic_dec_and_test(&ar->tx_ampdu_pending) &&
423 !list_empty(&ar->tx_ampdu_list))
424 ar9170_tx_ampdu(ar);
425}
426
427void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) 330void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
428{ 331{
429 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 332 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -447,14 +350,10 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
447 if (info->flags & IEEE80211_TX_CTL_NO_ACK) { 350 if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
448 ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED); 351 ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED);
449 } else { 352 } else {
450 if (info->flags & IEEE80211_TX_CTL_AMPDU) { 353 arinfo->timeout = jiffies +
451 ar9170_tx_ampdu_callback(ar, skb); 354 msecs_to_jiffies(AR9170_TX_TIMEOUT);
452 } else {
453 arinfo->timeout = jiffies +
454 msecs_to_jiffies(AR9170_TX_TIMEOUT);
455 355
456 skb_queue_tail(&ar->tx_status[queue], skb); 356 skb_queue_tail(&ar->tx_status[queue], skb);
457 }
458 } 357 }
459 358
460 if (!ar->tx_stats[queue].len && 359 if (!ar->tx_stats[queue].len &&
@@ -524,38 +423,6 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar,
524 return NULL; 423 return NULL;
525} 424}
526 425
527static void ar9170_handle_block_ack(struct ar9170 *ar, u16 count, u16 r)
528{
529 struct sk_buff *skb;
530 struct ieee80211_tx_info *txinfo;
531
532 while (count) {
533 skb = ar9170_get_queued_skb(ar, NULL, &ar->tx_status_ampdu, r);
534 if (!skb)
535 break;
536
537 txinfo = IEEE80211_SKB_CB(skb);
538 ieee80211_tx_info_clear_status(txinfo);
539
540 /* FIXME: maybe more ? */
541 txinfo->status.rates[0].count = 1;
542
543 skb_pull(skb, sizeof(struct ar9170_tx_control));
544 ieee80211_tx_status_irqsafe(ar->hw, skb);
545 count--;
546 }
547
548#ifdef AR9170_TXAGG_DEBUG
549 if (count) {
550 printk(KERN_DEBUG "%s: got %d more failed mpdus, but no more "
551 "suitable frames left in tx_status queue.\n",
552 wiphy_name(ar->hw->wiphy), count);
553
554 ar9170_dump_tx_status_ampdu(ar);
555 }
556#endif /* AR9170_TXAGG_DEBUG */
557}
558
559/* 426/*
560 * This worker tries to keeps an maintain tx_status queues. 427 * This worker tries to keeps an maintain tx_status queues.
561 * So we can guarantee that incoming tx_status reports are 428 * So we can guarantee that incoming tx_status reports are
@@ -592,8 +459,6 @@ static void ar9170_tx_janitor(struct work_struct *work)
592 resched = true; 459 resched = true;
593 } 460 }
594 461
595 ar9170_tx_fake_ampdu_status(ar);
596
597 if (!resched) 462 if (!resched)
598 return; 463 return;
599 464
@@ -673,10 +538,6 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
673 538
674 case 0xc5: 539 case 0xc5:
675 /* BlockACK events */ 540 /* BlockACK events */
676 ar9170_handle_block_ack(ar,
677 le16_to_cpu(cmd->ba_fail_cnt.failed),
678 le16_to_cpu(cmd->ba_fail_cnt.rate));
679 ar9170_tx_fake_ampdu_status(ar);
680 break; 541 break;
681 542
682 case 0xc6: 543 case 0xc6:
@@ -1247,7 +1108,6 @@ static int ar9170_op_start(struct ieee80211_hw *hw)
1247 ar->global_ampdu_density = 6; 1108 ar->global_ampdu_density = 6;
1248 ar->global_ampdu_factor = 3; 1109 ar->global_ampdu_factor = 3;
1249 1110
1250 atomic_set(&ar->tx_ampdu_pending, 0);
1251 ar->bad_hw_nagger = jiffies; 1111 ar->bad_hw_nagger = jiffies;
1252 1112
1253 err = ar->open(ar); 1113 err = ar->open(ar);
@@ -1310,40 +1170,10 @@ static void ar9170_op_stop(struct ieee80211_hw *hw)
1310 skb_queue_purge(&ar->tx_pending[i]); 1170 skb_queue_purge(&ar->tx_pending[i]);
1311 skb_queue_purge(&ar->tx_status[i]); 1171 skb_queue_purge(&ar->tx_status[i]);
1312 } 1172 }
1313 skb_queue_purge(&ar->tx_status_ampdu);
1314 1173
1315 mutex_unlock(&ar->mutex); 1174 mutex_unlock(&ar->mutex);
1316} 1175}
1317 1176
1318static void ar9170_tx_indicate_immba(struct ar9170 *ar, struct sk_buff *skb)
1319{
1320 struct ar9170_tx_control *txc = (void *) skb->data;
1321
1322 txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_IMM_AMPDU);
1323}
1324
1325static void ar9170_tx_copy_phy(struct ar9170 *ar, struct sk_buff *dst,
1326 struct sk_buff *src)
1327{
1328 struct ar9170_tx_control *dst_txc, *src_txc;
1329 struct ieee80211_tx_info *dst_info, *src_info;
1330 struct ar9170_tx_info *dst_arinfo, *src_arinfo;
1331
1332 src_txc = (void *) src->data;
1333 src_info = IEEE80211_SKB_CB(src);
1334 src_arinfo = (void *) src_info->rate_driver_data;
1335
1336 dst_txc = (void *) dst->data;
1337 dst_info = IEEE80211_SKB_CB(dst);
1338 dst_arinfo = (void *) dst_info->rate_driver_data;
1339
1340 dst_txc->phy_control = src_txc->phy_control;
1341
1342 /* same MCS for the whole aggregate */
1343 memcpy(dst_info->driver_rates, src_info->driver_rates,
1344 sizeof(dst_info->driver_rates));
1345}
1346
1347static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) 1177static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
1348{ 1178{
1349 struct ieee80211_hdr *hdr; 1179 struct ieee80211_hdr *hdr;
@@ -1420,14 +1250,7 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
1420 txc->phy_control |= 1250 txc->phy_control |=
1421 cpu_to_le32(queue << AR9170_TX_PHY_QOS_SHIFT); 1251 cpu_to_le32(queue << AR9170_TX_PHY_QOS_SHIFT);
1422 1252
1423 if (info->flags & IEEE80211_TX_CTL_AMPDU) { 1253 txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE);
1424 if (unlikely(!info->control.sta))
1425 goto err_out;
1426
1427 txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_AGGR);
1428 } else {
1429 txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE);
1430 }
1431 } 1254 }
1432 1255
1433 return 0; 1256 return 0;
@@ -1537,158 +1360,6 @@ static void ar9170_tx_prepare_phy(struct ar9170 *ar, struct sk_buff *skb)
1537 txc->phy_control |= cpu_to_le32(chains << AR9170_TX_PHY_TXCHAIN_SHIFT); 1360 txc->phy_control |= cpu_to_le32(chains << AR9170_TX_PHY_TXCHAIN_SHIFT);
1538} 1361}
1539 1362
1540static bool ar9170_tx_ampdu(struct ar9170 *ar)
1541{
1542 struct sk_buff_head agg;
1543 struct ar9170_sta_tid *tid_info = NULL, *tmp;
1544 struct sk_buff *skb, *first = NULL;
1545 unsigned long flags, f2;
1546 unsigned int i = 0;
1547 u16 seq, queue, tmpssn;
1548 bool run = false;
1549
1550 skb_queue_head_init(&agg);
1551
1552 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
1553 if (list_empty(&ar->tx_ampdu_list)) {
1554#ifdef AR9170_TXAGG_DEBUG
1555 printk(KERN_DEBUG "%s: aggregation list is empty.\n",
1556 wiphy_name(ar->hw->wiphy));
1557#endif /* AR9170_TXAGG_DEBUG */
1558 goto out_unlock;
1559 }
1560
1561 list_for_each_entry_safe(tid_info, tmp, &ar->tx_ampdu_list, list) {
1562 if (tid_info->state != AR9170_TID_STATE_COMPLETE) {
1563#ifdef AR9170_TXAGG_DEBUG
1564 printk(KERN_DEBUG "%s: dangling aggregation entry!\n",
1565 wiphy_name(ar->hw->wiphy));
1566#endif /* AR9170_TXAGG_DEBUG */
1567 continue;
1568 }
1569
1570 if (++i > 64) {
1571#ifdef AR9170_TXAGG_DEBUG
1572 printk(KERN_DEBUG "%s: enough frames aggregated.\n",
1573 wiphy_name(ar->hw->wiphy));
1574#endif /* AR9170_TXAGG_DEBUG */
1575 break;
1576 }
1577
1578 queue = TID_TO_WME_AC(tid_info->tid);
1579
1580 if (skb_queue_len(&ar->tx_pending[queue]) >=
1581 AR9170_NUM_TX_AGG_MAX) {
1582#ifdef AR9170_TXAGG_DEBUG
1583 printk(KERN_DEBUG "%s: queue %d full.\n",
1584 wiphy_name(ar->hw->wiphy), queue);
1585#endif /* AR9170_TXAGG_DEBUG */
1586 continue;
1587 }
1588
1589 list_del_init(&tid_info->list);
1590
1591 spin_lock_irqsave(&tid_info->queue.lock, f2);
1592 tmpssn = seq = tid_info->ssn;
1593 first = skb_peek(&tid_info->queue);
1594
1595 if (likely(first))
1596 tmpssn = ar9170_get_seq(first);
1597
1598 if (unlikely(tmpssn != seq)) {
1599#ifdef AR9170_TXAGG_DEBUG
1600 printk(KERN_DEBUG "%s: ssn mismatch [%d != %d]\n.",
1601 wiphy_name(ar->hw->wiphy), seq, tmpssn);
1602#endif /* AR9170_TXAGG_DEBUG */
1603 tid_info->ssn = tmpssn;
1604 }
1605
1606#ifdef AR9170_TXAGG_DEBUG
1607 printk(KERN_DEBUG "%s: generate A-MPDU for tid:%d ssn:%d with "
1608 "%d queued frames.\n", wiphy_name(ar->hw->wiphy),
1609 tid_info->tid, tid_info->ssn,
1610 skb_queue_len(&tid_info->queue));
1611 __ar9170_dump_txqueue(ar, &tid_info->queue);
1612#endif /* AR9170_TXAGG_DEBUG */
1613
1614 while ((skb = skb_peek(&tid_info->queue))) {
1615 if (unlikely(ar9170_get_seq(skb) != seq))
1616 break;
1617
1618 __skb_unlink(skb, &tid_info->queue);
1619 tid_info->ssn = seq = GET_NEXT_SEQ(seq);
1620
1621 if (unlikely(skb_get_queue_mapping(skb) != queue)) {
1622#ifdef AR9170_TXAGG_DEBUG
1623 printk(KERN_DEBUG "%s: tid:%d(q:%d) queue:%d "
1624 "!match.\n", wiphy_name(ar->hw->wiphy),
1625 tid_info->tid,
1626 TID_TO_WME_AC(tid_info->tid),
1627 skb_get_queue_mapping(skb));
1628#endif /* AR9170_TXAGG_DEBUG */
1629 dev_kfree_skb_any(skb);
1630 continue;
1631 }
1632
1633 if (unlikely(first == skb)) {
1634 ar9170_tx_prepare_phy(ar, skb);
1635 __skb_queue_tail(&agg, skb);
1636 first = skb;
1637 } else {
1638 ar9170_tx_copy_phy(ar, skb, first);
1639 __skb_queue_tail(&agg, skb);
1640 }
1641
1642 if (unlikely(skb_queue_len(&agg) ==
1643 AR9170_NUM_TX_AGG_MAX))
1644 break;
1645 }
1646
1647 if (skb_queue_empty(&tid_info->queue))
1648 tid_info->active = false;
1649 else
1650 list_add_tail(&tid_info->list,
1651 &ar->tx_ampdu_list);
1652
1653 spin_unlock_irqrestore(&tid_info->queue.lock, f2);
1654
1655 if (unlikely(skb_queue_empty(&agg))) {
1656#ifdef AR9170_TXAGG_DEBUG
1657 printk(KERN_DEBUG "%s: queued empty list!\n",
1658 wiphy_name(ar->hw->wiphy));
1659#endif /* AR9170_TXAGG_DEBUG */
1660 continue;
1661 }
1662
1663 /*
1664 * tell the FW/HW that this is the last frame,
1665 * that way it will wait for the immediate block ack.
1666 */
1667 ar9170_tx_indicate_immba(ar, skb_peek_tail(&agg));
1668
1669#ifdef AR9170_TXAGG_DEBUG
1670 printk(KERN_DEBUG "%s: generated A-MPDU looks like this:\n",
1671 wiphy_name(ar->hw->wiphy));
1672 __ar9170_dump_txqueue(ar, &agg);
1673#endif /* AR9170_TXAGG_DEBUG */
1674
1675 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
1676
1677 spin_lock_irqsave(&ar->tx_pending[queue].lock, flags);
1678 skb_queue_splice_tail_init(&agg, &ar->tx_pending[queue]);
1679 spin_unlock_irqrestore(&ar->tx_pending[queue].lock, flags);
1680 run = true;
1681
1682 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
1683 }
1684
1685out_unlock:
1686 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
1687 __skb_queue_purge(&agg);
1688
1689 return run;
1690}
1691
1692static void ar9170_tx(struct ar9170 *ar) 1363static void ar9170_tx(struct ar9170 *ar)
1693{ 1364{
1694 struct sk_buff *skb; 1365 struct sk_buff *skb;
@@ -1763,9 +1434,6 @@ static void ar9170_tx(struct ar9170 *ar)
1763 arinfo->timeout = jiffies + 1434 arinfo->timeout = jiffies +
1764 msecs_to_jiffies(AR9170_TX_TIMEOUT); 1435 msecs_to_jiffies(AR9170_TX_TIMEOUT);
1765 1436
1766 if (info->flags & IEEE80211_TX_CTL_AMPDU)
1767 atomic_inc(&ar->tx_ampdu_pending);
1768
1769#ifdef AR9170_QUEUE_DEBUG 1437#ifdef AR9170_QUEUE_DEBUG
1770 printk(KERN_DEBUG "%s: send frame q:%d =>\n", 1438 printk(KERN_DEBUG "%s: send frame q:%d =>\n",
1771 wiphy_name(ar->hw->wiphy), i); 1439 wiphy_name(ar->hw->wiphy), i);
@@ -1774,9 +1442,6 @@ static void ar9170_tx(struct ar9170 *ar)
1774 1442
1775 err = ar->tx(ar, skb); 1443 err = ar->tx(ar, skb);
1776 if (unlikely(err)) { 1444 if (unlikely(err)) {
1777 if (info->flags & IEEE80211_TX_CTL_AMPDU)
1778 atomic_dec(&ar->tx_ampdu_pending);
1779
1780 frames_failed++; 1445 frames_failed++;
1781 dev_kfree_skb_any(skb); 1446 dev_kfree_skb_any(skb);
1782 } else { 1447 } else {
@@ -1823,94 +1488,11 @@ static void ar9170_tx(struct ar9170 *ar)
1823 msecs_to_jiffies(AR9170_JANITOR_DELAY)); 1488 msecs_to_jiffies(AR9170_JANITOR_DELAY));
1824} 1489}
1825 1490
1826static bool ar9170_tx_ampdu_queue(struct ar9170 *ar, struct sk_buff *skb)
1827{
1828 struct ieee80211_tx_info *txinfo;
1829 struct ar9170_sta_info *sta_info;
1830 struct ar9170_sta_tid *agg;
1831 struct sk_buff *iter;
1832 unsigned long flags, f2;
1833 unsigned int max;
1834 u16 tid, seq, qseq;
1835 bool run = false, queue = false;
1836
1837 tid = ar9170_get_tid(skb);
1838 seq = ar9170_get_seq(skb);
1839 txinfo = IEEE80211_SKB_CB(skb);
1840 sta_info = (void *) txinfo->control.sta->drv_priv;
1841 agg = &sta_info->agg[tid];
1842 max = sta_info->ampdu_max_len;
1843
1844 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
1845
1846 if (unlikely(agg->state != AR9170_TID_STATE_COMPLETE)) {
1847#ifdef AR9170_TXAGG_DEBUG
1848 printk(KERN_DEBUG "%s: BlockACK session not fully initialized "
1849 "for ESS:%pM tid:%d state:%d.\n",
1850 wiphy_name(ar->hw->wiphy), agg->addr, agg->tid,
1851 agg->state);
1852#endif /* AR9170_TXAGG_DEBUG */
1853 goto err_unlock;
1854 }
1855
1856 if (!agg->active) {
1857 agg->active = true;
1858 agg->ssn = seq;
1859 queue = true;
1860 }
1861
1862 /* check if seq is within the BA window */
1863 if (unlikely(!BAW_WITHIN(agg->ssn, max, seq))) {
1864#ifdef AR9170_TXAGG_DEBUG
1865 printk(KERN_DEBUG "%s: frame with tid:%d seq:%d does not "
1866 "fit into BA window (%d - %d)\n",
1867 wiphy_name(ar->hw->wiphy), tid, seq, agg->ssn,
1868 (agg->ssn + max) & 0xfff);
1869#endif /* AR9170_TXAGG_DEBUG */
1870 goto err_unlock;
1871 }
1872
1873 spin_lock_irqsave(&agg->queue.lock, f2);
1874
1875 skb_queue_reverse_walk(&agg->queue, iter) {
1876 qseq = ar9170_get_seq(iter);
1877
1878 if (GET_NEXT_SEQ(qseq) == seq) {
1879 __skb_queue_after(&agg->queue, iter, skb);
1880 goto queued;
1881 }
1882 }
1883
1884 __skb_queue_head(&agg->queue, skb);
1885
1886queued:
1887 spin_unlock_irqrestore(&agg->queue.lock, f2);
1888
1889#ifdef AR9170_TXAGG_DEBUG
1890 printk(KERN_DEBUG "%s: new aggregate %p queued.\n",
1891 wiphy_name(ar->hw->wiphy), skb);
1892 __ar9170_dump_txqueue(ar, &agg->queue);
1893#endif /* AR9170_TXAGG_DEBUG */
1894
1895 if (skb_queue_len(&agg->queue) >= AR9170_NUM_TX_AGG_MAX)
1896 run = true;
1897
1898 if (queue)
1899 list_add_tail(&agg->list, &ar->tx_ampdu_list);
1900
1901 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
1902 return run;
1903
1904err_unlock:
1905 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
1906 dev_kfree_skb_irq(skb);
1907 return false;
1908}
1909
1910int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1491int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1911{ 1492{
1912 struct ar9170 *ar = hw->priv; 1493 struct ar9170 *ar = hw->priv;
1913 struct ieee80211_tx_info *info; 1494 struct ieee80211_tx_info *info;
1495 unsigned int queue;
1914 1496
1915 if (unlikely(!IS_STARTED(ar))) 1497 if (unlikely(!IS_STARTED(ar)))
1916 goto err_free; 1498 goto err_free;
@@ -1918,18 +1500,10 @@ int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1918 if (unlikely(ar9170_tx_prepare(ar, skb))) 1500 if (unlikely(ar9170_tx_prepare(ar, skb)))
1919 goto err_free; 1501 goto err_free;
1920 1502
1503 queue = skb_get_queue_mapping(skb);
1921 info = IEEE80211_SKB_CB(skb); 1504 info = IEEE80211_SKB_CB(skb);
1922 if (info->flags & IEEE80211_TX_CTL_AMPDU) { 1505 ar9170_tx_prepare_phy(ar, skb);
1923 bool run = ar9170_tx_ampdu_queue(ar, skb); 1506 skb_queue_tail(&ar->tx_pending[queue], skb);
1924
1925 if (run || !atomic_read(&ar->tx_ampdu_pending))
1926 ar9170_tx_ampdu(ar);
1927 } else {
1928 unsigned int queue = skb_get_queue_mapping(skb);
1929
1930 ar9170_tx_prepare_phy(ar, skb);
1931 skb_queue_tail(&ar->tx_pending[queue], skb);
1932 }
1933 1507
1934 ar9170_tx(ar); 1508 ar9170_tx(ar);
1935 return NETDEV_TX_OK; 1509 return NETDEV_TX_OK;
@@ -2326,57 +1900,6 @@ out:
2326 return err; 1900 return err;
2327} 1901}
2328 1902
2329static int ar9170_sta_add(struct ieee80211_hw *hw,
2330 struct ieee80211_vif *vif,
2331 struct ieee80211_sta *sta)
2332{
2333 struct ar9170 *ar = hw->priv;
2334 struct ar9170_sta_info *sta_info = (void *) sta->drv_priv;
2335 unsigned int i;
2336
2337 memset(sta_info, 0, sizeof(*sta_info));
2338
2339 if (!sta->ht_cap.ht_supported)
2340 return 0;
2341
2342 if (sta->ht_cap.ampdu_density > ar->global_ampdu_density)
2343 ar->global_ampdu_density = sta->ht_cap.ampdu_density;
2344
2345 if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor)
2346 ar->global_ampdu_factor = sta->ht_cap.ampdu_factor;
2347
2348 for (i = 0; i < AR9170_NUM_TID; i++) {
2349 sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN;
2350 sta_info->agg[i].active = false;
2351 sta_info->agg[i].ssn = 0;
2352 sta_info->agg[i].tid = i;
2353 INIT_LIST_HEAD(&sta_info->agg[i].list);
2354 skb_queue_head_init(&sta_info->agg[i].queue);
2355 }
2356
2357 sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor);
2358
2359 return 0;
2360}
2361
2362static int ar9170_sta_remove(struct ieee80211_hw *hw,
2363 struct ieee80211_vif *vif,
2364 struct ieee80211_sta *sta)
2365{
2366 struct ar9170_sta_info *sta_info = (void *) sta->drv_priv;
2367 unsigned int i;
2368
2369 if (!sta->ht_cap.ht_supported)
2370 return 0;
2371
2372 for (i = 0; i < AR9170_NUM_TID; i++) {
2373 sta_info->agg[i].state = AR9170_TID_STATE_INVALID;
2374 skb_queue_purge(&sta_info->agg[i].queue);
2375 }
2376
2377 return 0;
2378}
2379
2380static int ar9170_get_stats(struct ieee80211_hw *hw, 1903static int ar9170_get_stats(struct ieee80211_hw *hw,
2381 struct ieee80211_low_level_stats *stats) 1904 struct ieee80211_low_level_stats *stats)
2382{ 1905{
@@ -2419,55 +1942,7 @@ static int ar9170_ampdu_action(struct ieee80211_hw *hw,
2419 enum ieee80211_ampdu_mlme_action action, 1942 enum ieee80211_ampdu_mlme_action action,
2420 struct ieee80211_sta *sta, u16 tid, u16 *ssn) 1943 struct ieee80211_sta *sta, u16 tid, u16 *ssn)
2421{ 1944{
2422 struct ar9170 *ar = hw->priv;
2423 struct ar9170_sta_info *sta_info = (void *) sta->drv_priv;
2424 struct ar9170_sta_tid *tid_info = &sta_info->agg[tid];
2425 unsigned long flags;
2426
2427 if (!modparam_ht)
2428 return -EOPNOTSUPP;
2429
2430 switch (action) { 1945 switch (action) {
2431 case IEEE80211_AMPDU_TX_START:
2432 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
2433 if (tid_info->state != AR9170_TID_STATE_SHUTDOWN ||
2434 !list_empty(&tid_info->list)) {
2435 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
2436#ifdef AR9170_TXAGG_DEBUG
2437 printk(KERN_INFO "%s: A-MPDU [ESS:[%pM] tid:[%d]] "
2438 "is in a very bad state!\n",
2439 wiphy_name(hw->wiphy), sta->addr, tid);
2440#endif /* AR9170_TXAGG_DEBUG */
2441 return -EBUSY;
2442 }
2443
2444 *ssn = tid_info->ssn;
2445 tid_info->state = AR9170_TID_STATE_PROGRESS;
2446 tid_info->active = false;
2447 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
2448 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
2449 break;
2450
2451 case IEEE80211_AMPDU_TX_STOP:
2452 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
2453 tid_info->state = AR9170_TID_STATE_SHUTDOWN;
2454 list_del_init(&tid_info->list);
2455 tid_info->active = false;
2456 skb_queue_purge(&tid_info->queue);
2457 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
2458 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
2459 break;
2460
2461 case IEEE80211_AMPDU_TX_OPERATIONAL:
2462#ifdef AR9170_TXAGG_DEBUG
2463 printk(KERN_INFO "%s: A-MPDU for %pM [tid:%d] Operational.\n",
2464 wiphy_name(hw->wiphy), sta->addr, tid);
2465#endif /* AR9170_TXAGG_DEBUG */
2466 spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags);
2467 sta_info->agg[tid].state = AR9170_TID_STATE_COMPLETE;
2468 spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags);
2469 break;
2470
2471 case IEEE80211_AMPDU_RX_START: 1946 case IEEE80211_AMPDU_RX_START:
2472 case IEEE80211_AMPDU_RX_STOP: 1947 case IEEE80211_AMPDU_RX_STOP:
2473 /* Handled by firmware */ 1948 /* Handled by firmware */
@@ -2493,8 +1968,6 @@ static const struct ieee80211_ops ar9170_ops = {
2493 .bss_info_changed = ar9170_op_bss_info_changed, 1968 .bss_info_changed = ar9170_op_bss_info_changed,
2494 .get_tsf = ar9170_op_get_tsf, 1969 .get_tsf = ar9170_op_get_tsf,
2495 .set_key = ar9170_set_key, 1970 .set_key = ar9170_set_key,
2496 .sta_add = ar9170_sta_add,
2497 .sta_remove = ar9170_sta_remove,
2498 .get_stats = ar9170_get_stats, 1971 .get_stats = ar9170_get_stats,
2499 .ampdu_action = ar9170_ampdu_action, 1972 .ampdu_action = ar9170_ampdu_action,
2500}; 1973};
@@ -2527,8 +2000,6 @@ void *ar9170_alloc(size_t priv_size)
2527 mutex_init(&ar->mutex); 2000 mutex_init(&ar->mutex);
2528 spin_lock_init(&ar->cmdlock); 2001 spin_lock_init(&ar->cmdlock);
2529 spin_lock_init(&ar->tx_stats_lock); 2002 spin_lock_init(&ar->tx_stats_lock);
2530 spin_lock_init(&ar->tx_ampdu_list_lock);
2531 skb_queue_head_init(&ar->tx_status_ampdu);
2532 for (i = 0; i < __AR9170_NUM_TXQ; i++) { 2003 for (i = 0; i < __AR9170_NUM_TXQ; i++) {
2533 skb_queue_head_init(&ar->tx_status[i]); 2004 skb_queue_head_init(&ar->tx_status[i]);
2534 skb_queue_head_init(&ar->tx_pending[i]); 2005 skb_queue_head_init(&ar->tx_pending[i]);
@@ -2536,7 +2007,6 @@ void *ar9170_alloc(size_t priv_size)
2536 ar9170_rx_reset_rx_mpdu(ar); 2007 ar9170_rx_reset_rx_mpdu(ar);
2537 INIT_WORK(&ar->beacon_work, ar9170_new_beacon); 2008 INIT_WORK(&ar->beacon_work, ar9170_new_beacon);
2538 INIT_DELAYED_WORK(&ar->tx_janitor, ar9170_tx_janitor); 2009 INIT_DELAYED_WORK(&ar->tx_janitor, ar9170_tx_janitor);
2539 INIT_LIST_HEAD(&ar->tx_ampdu_list);
2540 2010
2541 /* all hw supports 2.4 GHz, so set channel to 1 by default */ 2011 /* all hw supports 2.4 GHz, so set channel to 1 by default */
2542 ar->channel = &ar9170_2ghz_chantable[0]; 2012 ar->channel = &ar9170_2ghz_chantable[0];
@@ -2549,16 +2019,8 @@ void *ar9170_alloc(size_t priv_size)
2549 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 2019 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
2550 IEEE80211_HW_SIGNAL_DBM; 2020 IEEE80211_HW_SIGNAL_DBM;
2551 2021
2552 if (modparam_ht) {
2553 ar->hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
2554 } else {
2555 ar9170_band_2GHz.ht_cap.ht_supported = false;
2556 ar9170_band_5GHz.ht_cap.ht_supported = false;
2557 }
2558
2559 ar->hw->queues = __AR9170_NUM_TXQ; 2022 ar->hw->queues = __AR9170_NUM_TXQ;
2560 ar->hw->extra_tx_headroom = 8; 2023 ar->hw->extra_tx_headroom = 8;
2561 ar->hw->sta_data_size = sizeof(struct ar9170_sta_info);
2562 2024
2563 ar->hw->max_rates = 1; 2025 ar->hw->max_rates = 1;
2564 ar->hw->max_rate_tries = 3; 2026 ar->hw->max_rate_tries = 3;
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index c1c7c427501c..8663660ea4c6 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -42,6 +42,7 @@
42#include <linux/usb.h> 42#include <linux/usb.h>
43#include <linux/firmware.h> 43#include <linux/firmware.h>
44#include <linux/etherdevice.h> 44#include <linux/etherdevice.h>
45#include <linux/device.h>
45#include <net/mac80211.h> 46#include <net/mac80211.h>
46#include "ar9170.h" 47#include "ar9170.h"
47#include "cmd.h" 48#include "cmd.h"
@@ -737,12 +738,16 @@ static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
737{ 738{
738 struct device *parent = aru->udev->dev.parent; 739 struct device *parent = aru->udev->dev.parent;
739 740
741 complete(&aru->firmware_loading_complete);
742
740 /* unbind anything failed */ 743 /* unbind anything failed */
741 if (parent) 744 if (parent)
742 down(&parent->sem); 745 device_lock(parent);
743 device_release_driver(&aru->udev->dev); 746 device_release_driver(&aru->udev->dev);
744 if (parent) 747 if (parent)
745 up(&parent->sem); 748 device_unlock(parent);
749
750 usb_put_dev(aru->udev);
746} 751}
747 752
748static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context) 753static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
@@ -771,6 +776,8 @@ static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
771 if (err) 776 if (err)
772 goto err_unrx; 777 goto err_unrx;
773 778
779 complete(&aru->firmware_loading_complete);
780 usb_put_dev(aru->udev);
774 return; 781 return;
775 782
776 err_unrx: 783 err_unrx:
@@ -868,6 +875,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
868 init_usb_anchor(&aru->tx_pending); 875 init_usb_anchor(&aru->tx_pending);
869 init_usb_anchor(&aru->tx_submitted); 876 init_usb_anchor(&aru->tx_submitted);
870 init_completion(&aru->cmd_wait); 877 init_completion(&aru->cmd_wait);
878 init_completion(&aru->firmware_loading_complete);
871 spin_lock_init(&aru->tx_urb_lock); 879 spin_lock_init(&aru->tx_urb_lock);
872 880
873 aru->tx_pending_urbs = 0; 881 aru->tx_pending_urbs = 0;
@@ -887,6 +895,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
887 if (err) 895 if (err)
888 goto err_freehw; 896 goto err_freehw;
889 897
898 usb_get_dev(aru->udev);
890 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw", 899 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
891 &aru->udev->dev, GFP_KERNEL, aru, 900 &aru->udev->dev, GFP_KERNEL, aru,
892 ar9170_usb_firmware_step2); 901 ar9170_usb_firmware_step2);
@@ -906,6 +915,9 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
906 return; 915 return;
907 916
908 aru->common.state = AR9170_IDLE; 917 aru->common.state = AR9170_IDLE;
918
919 wait_for_completion(&aru->firmware_loading_complete);
920
909 ar9170_unregister(&aru->common); 921 ar9170_unregister(&aru->common);
910 ar9170_usb_cancel_urbs(aru); 922 ar9170_usb_cancel_urbs(aru);
911 923
diff --git a/drivers/net/wireless/ath/ar9170/usb.h b/drivers/net/wireless/ath/ar9170/usb.h
index a2ce3b169ceb..919b06046eb3 100644
--- a/drivers/net/wireless/ath/ar9170/usb.h
+++ b/drivers/net/wireless/ath/ar9170/usb.h
@@ -71,6 +71,7 @@ struct ar9170_usb {
71 unsigned int tx_pending_urbs; 71 unsigned int tx_pending_urbs;
72 72
73 struct completion cmd_wait; 73 struct completion cmd_wait;
74 struct completion firmware_loading_complete;
74 int readlen; 75 int readlen;
75 u8 *readbuf; 76 u8 *readbuf;
76 77
diff --git a/drivers/net/wireless/ath/ath5k/ani.c b/drivers/net/wireless/ath/ath5k/ani.c
index 584a32859bdb..f2311ab35504 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -73,7 +73,7 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)
73 const s8 hi[] = { -14, -12 }; 73 const s8 hi[] = { -14, -12 };
74 const s8 fr[] = { -78, -80 }; 74 const s8 fr[] = { -78, -80 };
75#endif 75#endif
76 if (level < 0 || level > ARRAY_SIZE(sz)) { 76 if (level < 0 || level >= ARRAY_SIZE(sz)) {
77 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, 77 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
78 "level out of range %d", level); 78 "level out of range %d", level);
79 return; 79 return;
@@ -104,7 +104,7 @@ ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level)
104{ 104{
105 const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; 105 const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 };
106 106
107 if (level < 0 || level > ARRAY_SIZE(val) || 107 if (level < 0 || level >= ARRAY_SIZE(val) ||
108 level > ah->ah_sc->ani_state.max_spur_level) { 108 level > ah->ah_sc->ani_state.max_spur_level) {
109 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, 109 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
110 "level out of range %d", level); 110 "level out of range %d", level);
@@ -129,7 +129,7 @@ ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level)
129{ 129{
130 const int val[] = { 0, 4, 8 }; 130 const int val[] = { 0, 4, 8 };
131 131
132 if (level < 0 || level > ARRAY_SIZE(val)) { 132 if (level < 0 || level >= ARRAY_SIZE(val)) {
133 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, 133 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
134 "level out of range %d", level); 134 "level out of range %d", level);
135 return; 135 return;
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 3ce9afba1d88..1b81c4778800 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -2145,8 +2145,6 @@ ath5k_get_chan_pcal_surrounding_piers(struct ath5k_hw *ah,
2145done: 2145done:
2146 *pcinfo_l = &pcinfo[idx_l]; 2146 *pcinfo_l = &pcinfo[idx_l];
2147 *pcinfo_r = &pcinfo[idx_r]; 2147 *pcinfo_r = &pcinfo[idx_r];
2148
2149 return;
2150} 2148}
2151 2149
2152/* 2150/*
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index 44bbbf2a6edd..307f80e83f94 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -627,7 +627,6 @@ static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)
627 627
628 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1); 628 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1);
629 } 629 }
630 return;
631} 630}
632 631
633/* TODO: Half/Quarter rate */ 632/* TODO: Half/Quarter rate */
@@ -883,8 +882,6 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
883 /* Heavy clipping -disable for now */ 882 /* Heavy clipping -disable for now */
884 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1) 883 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
885 ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE); 884 ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE);
886
887 return;
888} 885}
889 886
890/* 887/*
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 5fcafb460877..56a9e5fa6d66 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -726,7 +726,6 @@ static void ar9003_hw_tx_iq_cal(struct ath_hw *ah)
726 726
727TX_IQ_CAL_FAILED: 727TX_IQ_CAL_FAILED:
728 ath_print(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); 728 ath_print(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n");
729 return;
730} 729}
731 730
732static bool ar9003_hw_init_cal(struct ath_hw *ah, 731static bool ar9003_hw_init_cal(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h
index a131cd10ef29..ef6116e13033 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h
@@ -541,7 +541,7 @@ static const u32 ar9300_2p0_mac_postamble[][5] = {
541 541
542static const u32 ar9300_2p0_soc_postamble[][5] = { 542static const u32 ar9300_2p0_soc_postamble[][5] = {
543 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 543 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
544 {0x00007010, 0x00000023, 0x00000023, 0x00000022, 0x00000022}, 544 {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023},
545}; 545};
546 546
547static const u32 ar9200_merlin_2p0_radio_core[][2] = { 547static const u32 ar9200_merlin_2p0_radio_core[][2] = {
@@ -588,12 +588,12 @@ static const u32 ar9200_merlin_2p0_radio_core[][2] = {
588 588
589static const u32 ar9300_2p0_baseband_postamble[][5] = { 589static const u32 ar9300_2p0_baseband_postamble[][5] = {
590 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 590 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
591 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, 591 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a800b},
592 {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, 592 {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e},
593 {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, 593 {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0},
594 {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, 594 {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881},
595 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, 595 {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
596 {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, 596 {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x00000b9c},
597 {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, 597 {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044},
598 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, 598 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0},
599 {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, 599 {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020},
@@ -744,7 +744,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = {
744 {0x0000a408, 0x0e79e5c6}, 744 {0x0000a408, 0x0e79e5c6},
745 {0x0000a40c, 0x00820820}, 745 {0x0000a40c, 0x00820820},
746 {0x0000a414, 0x1ce739ce}, 746 {0x0000a414, 0x1ce739ce},
747 {0x0000a418, 0x7d001dce}, 747 {0x0000a418, 0x2d001dce},
748 {0x0000a41c, 0x1ce739ce}, 748 {0x0000a41c, 0x1ce739ce},
749 {0x0000a420, 0x000001ce}, 749 {0x0000a420, 0x000001ce},
750 {0x0000a424, 0x1ce739ce}, 750 {0x0000a424, 0x1ce739ce},
@@ -756,7 +756,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = {
756 {0x0000a43c, 0x00000000}, 756 {0x0000a43c, 0x00000000},
757 {0x0000a440, 0x00000000}, 757 {0x0000a440, 0x00000000},
758 {0x0000a444, 0x00000000}, 758 {0x0000a444, 0x00000000},
759 {0x0000a448, 0x07000080}, 759 {0x0000a448, 0x04000080},
760 {0x0000a44c, 0x00000001}, 760 {0x0000a44c, 0x00000001},
761 {0x0000a450, 0x00010000}, 761 {0x0000a450, 0x00010000},
762 {0x0000a458, 0x00000000}, 762 {0x0000a458, 0x00000000},
@@ -777,7 +777,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = {
777 {0x0000a638, 0x00000000}, 777 {0x0000a638, 0x00000000},
778 {0x0000a63c, 0x00000000}, 778 {0x0000a63c, 0x00000000},
779 {0x0000a640, 0x00000000}, 779 {0x0000a640, 0x00000000},
780 {0x0000a644, 0x3ffd9d74}, 780 {0x0000a644, 0x3fad9d74},
781 {0x0000a648, 0x0048060a}, 781 {0x0000a648, 0x0048060a},
782 {0x0000a64c, 0x00000637}, 782 {0x0000a64c, 0x00000637},
783 {0x0000a670, 0x03020100}, 783 {0x0000a670, 0x03020100},
@@ -835,9 +835,9 @@ static const u32 ar9300_2p0_baseband_core[][2] = {
835 835
836static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { 836static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = {
837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 837 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
838 {0x0000a410, 0x000050db, 0x000050db, 0x000050d9, 0x000050d9}, 838 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
839 {0x0000a500, 0x00020220, 0x00020220, 0x00000000, 0x00000000}, 839 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
840 {0x0000a504, 0x06020223, 0x06020223, 0x04000002, 0x04000002}, 840 {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
841 {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, 841 {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
842 {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, 842 {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
843 {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, 843 {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
@@ -848,28 +848,28 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = {
848 {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, 848 {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
849 {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, 849 {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
850 {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, 850 {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
851 {0x0000a530, 0x34043643, 0x34043643, 0x2a000e20, 0x2a000e20}, 851 {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
852 {0x0000a534, 0x38043a44, 0x38043a44, 0x2e000e22, 0x2e000e22}, 852 {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
853 {0x0000a538, 0x3b043e45, 0x3b043e45, 0x31000e24, 0x31000e24}, 853 {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
854 {0x0000a53c, 0x40063e46, 0x40063e46, 0x34001640, 0x34001640}, 854 {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
855 {0x0000a540, 0x44083e46, 0x44083e46, 0x38001660, 0x38001660}, 855 {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
856 {0x0000a544, 0x46083e66, 0x46083e66, 0x3b001861, 0x3b001861}, 856 {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
857 {0x0000a548, 0x4b0a3e69, 0x4b0a3e69, 0x3e001a81, 0x3e001a81}, 857 {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
858 {0x0000a54c, 0x4f0a5e66, 0x4f0a5e66, 0x42001a83, 0x42001a83}, 858 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
859 {0x0000a550, 0x540a7e66, 0x540a7e66, 0x44001c84, 0x44001c84}, 859 {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
860 {0x0000a554, 0x570a7e89, 0x570a7e89, 0x48001ce3, 0x48001ce3}, 860 {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
861 {0x0000a558, 0x5c0e7e8a, 0x5c0e7e8a, 0x4c001ce5, 0x4c001ce5}, 861 {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
862 {0x0000a55c, 0x60127e8b, 0x60127e8b, 0x50001ce9, 0x50001ce9}, 862 {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
863 {0x0000a560, 0x65127ecc, 0x65127ecc, 0x54001ceb, 0x54001ceb}, 863 {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
864 {0x0000a564, 0x6b169ecd, 0x6b169ecd, 0x56001eec, 0x56001eec}, 864 {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
865 {0x0000a568, 0x70169f0e, 0x70169f0e, 0x56001eec, 0x56001eec}, 865 {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
866 {0x0000a56c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 866 {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
867 {0x0000a570, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 867 {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
868 {0x0000a574, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 868 {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
869 {0x0000a578, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 869 {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
870 {0x0000a57c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 870 {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
871 {0x0000a580, 0x00820220, 0x00820220, 0x00800000, 0x00800000}, 871 {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
872 {0x0000a584, 0x06820223, 0x06820223, 0x04800002, 0x04800002}, 872 {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
873 {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, 873 {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
874 {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, 874 {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
875 {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, 875 {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
@@ -880,42 +880,42 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = {
880 {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, 880 {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
881 {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, 881 {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
882 {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, 882 {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
883 {0x0000a5b0, 0x34843643, 0x34843643, 0x2a800e20, 0x2a800e20}, 883 {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
884 {0x0000a5b4, 0x38843a44, 0x38843a44, 0x2e800e22, 0x2e800e22}, 884 {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
885 {0x0000a5b8, 0x3b843e45, 0x3b843e45, 0x31800e24, 0x31800e24}, 885 {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
886 {0x0000a5bc, 0x40863e46, 0x40863e46, 0x34801640, 0x34801640}, 886 {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
887 {0x0000a5c0, 0x4c8a3065, 0x44883e46, 0x44883e46, 0x38801660}, 887 {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
888 {0x0000a5c4, 0x46883e66, 0x46883e66, 0x3b801861, 0x3b801861}, 888 {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
889 {0x0000a5c8, 0x4b8a3e69, 0x4b8a3e69, 0x3e801a81, 0x3e801a81}, 889 {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
890 {0x0000a5cc, 0x4f8a5e66, 0x4f8a5e66, 0x42801a83, 0x42801a83}, 890 {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
891 {0x0000a5d0, 0x548a7e66, 0x548a7e66, 0x44801c84, 0x44801c84}, 891 {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
892 {0x0000a5d4, 0x578a7e89, 0x578a7e89, 0x48801ce3, 0x48801ce3}, 892 {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
893 {0x0000a5d8, 0x5c8e7e8a, 0x5c8e7e8a, 0x4c801ce5, 0x4c801ce5}, 893 {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
894 {0x0000a5dc, 0x60927e8b, 0x60927e8b, 0x50801ce9, 0x50801ce9}, 894 {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
895 {0x0000a5e0, 0x65927ecc, 0x65927ecc, 0x54801ceb, 0x54801ceb}, 895 {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
896 {0x0000a5e4, 0x6b969ecd, 0x6b969ecd, 0x56801eec, 0x56801eec}, 896 {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
897 {0x0000a5e8, 0x70969f0e, 0x70969f0e, 0x56801eec, 0x56801eec}, 897 {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
898 {0x0000a5ec, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 898 {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
899 {0x0000a5f0, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 899 {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
900 {0x0000a5f4, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 900 {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
901 {0x0000a5f8, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 901 {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
902 {0x0000a5fc, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 902 {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
903 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, 903 {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
904 {0x00016048, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, 904 {0x00016048, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61},
905 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, 905 {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
906 {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, 906 {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
907 {0x00016448, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, 907 {0x00016448, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61},
908 {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, 908 {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
909 {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, 909 {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
910 {0x00016848, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, 910 {0x00016848, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61},
911 {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, 911 {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
912}; 912};
913 913
914static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { 914static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = {
915 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 915 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
916 {0x0000a410, 0x000050db, 0x000050db, 0x000050d9, 0x000050d9}, 916 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
917 {0x0000a500, 0x00020220, 0x00020220, 0x00000000, 0x00000000}, 917 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
918 {0x0000a504, 0x06020223, 0x06020223, 0x04000002, 0x04000002}, 918 {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
919 {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, 919 {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
920 {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, 920 {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
921 {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, 921 {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
@@ -926,28 +926,28 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = {
926 {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, 926 {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
927 {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, 927 {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
928 {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, 928 {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
929 {0x0000a530, 0x34043643, 0x34043643, 0x2a000e20, 0x2a000e20}, 929 {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
930 {0x0000a534, 0x38043a44, 0x38043a44, 0x2e000e22, 0x2e000e22}, 930 {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
931 {0x0000a538, 0x3b043e45, 0x3b043e45, 0x31000e24, 0x31000e24}, 931 {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
932 {0x0000a53c, 0x40063e46, 0x40063e46, 0x34001640, 0x34001640}, 932 {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
933 {0x0000a540, 0x44083e46, 0x44083e46, 0x38001660, 0x38001660}, 933 {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
934 {0x0000a544, 0x46083e66, 0x46083e66, 0x3b001861, 0x3b001861}, 934 {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
935 {0x0000a548, 0x4b0a3e69, 0x4b0a3e69, 0x3e001a81, 0x3e001a81}, 935 {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
936 {0x0000a54c, 0x4f0a5e66, 0x4f0a5e66, 0x42001a83, 0x42001a83}, 936 {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
937 {0x0000a550, 0x540a7e66, 0x540a7e66, 0x44001c84, 0x44001c84}, 937 {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
938 {0x0000a554, 0x570a7e89, 0x570a7e89, 0x48001ce3, 0x48001ce3}, 938 {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
939 {0x0000a558, 0x5c0e7e8a, 0x5c0e7e8a, 0x4c001ce5, 0x4c001ce5}, 939 {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
940 {0x0000a55c, 0x60127e8b, 0x60127e8b, 0x50001ce9, 0x50001ce9}, 940 {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
941 {0x0000a560, 0x65127ecc, 0x65127ecc, 0x54001ceb, 0x54001ceb}, 941 {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
942 {0x0000a564, 0x6b169ecd, 0x6b169ecd, 0x56001eec, 0x56001eec}, 942 {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
943 {0x0000a568, 0x70169f0e, 0x70169f0e, 0x56001eec, 0x56001eec}, 943 {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
944 {0x0000a56c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 944 {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
945 {0x0000a570, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 945 {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
946 {0x0000a574, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 946 {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
947 {0x0000a578, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 947 {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
948 {0x0000a57c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, 948 {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
949 {0x0000a580, 0x00820220, 0x00820220, 0x00800000, 0x00800000}, 949 {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
950 {0x0000a584, 0x06820223, 0x06820223, 0x04800002, 0x04800002}, 950 {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
951 {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, 951 {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
952 {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, 952 {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
953 {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, 953 {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
@@ -958,34 +958,34 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = {
958 {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, 958 {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
959 {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, 959 {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
960 {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, 960 {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
961 {0x0000a5b0, 0x34843643, 0x34843643, 0x2a800e20, 0x2a800e20}, 961 {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
962 {0x0000a5b4, 0x38843a44, 0x38843a44, 0x2e800e22, 0x2e800e22}, 962 {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
963 {0x0000a5b8, 0x3b843e45, 0x3b843e45, 0x31800e24, 0x31800e24}, 963 {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
964 {0x0000a5bc, 0x40863e46, 0x40863e46, 0x34801640, 0x34801640}, 964 {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
965 {0x0000a5c0, 0x44883e46, 0x44883e46, 0x38801660, 0x38801660}, 965 {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
966 {0x0000a5c4, 0x46883e66, 0x46883e66, 0x3b801861, 0x3b801861}, 966 {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
967 {0x0000a5c8, 0x4b8a3e69, 0x4b8a3e69, 0x3e801a81, 0x3e801a81}, 967 {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
968 {0x0000a5cc, 0x4f8a5e66, 0x4f8a5e66, 0x42801a83, 0x42801a83}, 968 {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
969 {0x0000a5d0, 0x548a7e66, 0x548a7e66, 0x44801c84, 0x44801c84}, 969 {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
970 {0x0000a5d4, 0x578a7e89, 0x578a7e89, 0x48801ce3, 0x48801ce3}, 970 {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
971 {0x0000a5d8, 0x5c8e7e8a, 0x5c8e7e8a, 0x4c801ce5, 0x4c801ce5}, 971 {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
972 {0x0000a5dc, 0x60927e8b, 0x60927e8b, 0x50801ce9, 0x50801ce9}, 972 {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
973 {0x0000a5e0, 0x65927ecc, 0x65927ecc, 0x54801ceb, 0x54801ceb}, 973 {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
974 {0x0000a5e4, 0x6b969ecd, 0x6b969ecd, 0x56801eec, 0x56801eec}, 974 {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
975 {0x0000a5e8, 0x70969f0e, 0x70969f0e, 0x56801eec, 0x56801eec}, 975 {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
976 {0x0000a5ec, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 976 {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
977 {0x0000a5f0, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 977 {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
978 {0x0000a5f4, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 978 {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
979 {0x0000a5f8, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 979 {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
980 {0x0000a5fc, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, 980 {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
981 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, 981 {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
982 {0x00016048, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, 982 {0x00016048, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61},
983 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 983 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
984 {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, 984 {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
985 {0x00016448, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, 985 {0x00016448, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61},
986 {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 986 {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
987 {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, 987 {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
988 {0x00016848, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, 988 {0x00016848, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61},
989 {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 989 {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
990}; 990};
991 991
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 6982577043b8..07b8fa6fb62f 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -86,7 +86,6 @@ static void ath9k_hw_update_nfcal_hist_buffer(struct ath9k_nfcal_hist *h,
86 ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer); 86 ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer);
87 } 87 }
88 } 88 }
89 return;
90} 89}
91 90
92static bool ath9k_hw_get_nf_thresh(struct ath_hw *ah, 91static bool ath9k_hw_get_nf_thresh(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index b4424a623cf5..7707341cd0d3 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -57,13 +57,19 @@ static bool ath9k_rx_accept(struct ath_common *common,
57 * rs_more indicates chained descriptors which can be used 57 * rs_more indicates chained descriptors which can be used
58 * to link buffers together for a sort of scatter-gather 58 * to link buffers together for a sort of scatter-gather
59 * operation. 59 * operation.
60 * 60 * reject the frame, we don't support scatter-gather yet and
61 * the frame is probably corrupt anyway
62 */
63 if (rx_stats->rs_more)
64 return false;
65
66 /*
61 * The rx_stats->rs_status will not be set until the end of the 67 * The rx_stats->rs_status will not be set until the end of the
62 * chained descriptors so it can be ignored if rs_more is set. The 68 * chained descriptors so it can be ignored if rs_more is set. The
63 * rs_more will be false at the last element of the chained 69 * rs_more will be false at the last element of the chained
64 * descriptors. 70 * descriptors.
65 */ 71 */
66 if (!rx_stats->rs_more && rx_stats->rs_status != 0) { 72 if (rx_stats->rs_status != 0) {
67 if (rx_stats->rs_status & ATH9K_RXERR_CRC) 73 if (rx_stats->rs_status & ATH9K_RXERR_CRC)
68 rxs->flag |= RX_FLAG_FAILED_FCS_CRC; 74 rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
69 if (rx_stats->rs_status & ATH9K_RXERR_PHY) 75 if (rx_stats->rs_status & ATH9K_RXERR_PHY)
@@ -102,11 +108,11 @@ static bool ath9k_rx_accept(struct ath_common *common,
102 return true; 108 return true;
103} 109}
104 110
105static u8 ath9k_process_rate(struct ath_common *common, 111static int ath9k_process_rate(struct ath_common *common,
106 struct ieee80211_hw *hw, 112 struct ieee80211_hw *hw,
107 struct ath_rx_status *rx_stats, 113 struct ath_rx_status *rx_stats,
108 struct ieee80211_rx_status *rxs, 114 struct ieee80211_rx_status *rxs,
109 struct sk_buff *skb) 115 struct sk_buff *skb)
110{ 116{
111 struct ieee80211_supported_band *sband; 117 struct ieee80211_supported_band *sband;
112 enum ieee80211_band band; 118 enum ieee80211_band band;
@@ -122,25 +128,32 @@ static u8 ath9k_process_rate(struct ath_common *common,
122 rxs->flag |= RX_FLAG_40MHZ; 128 rxs->flag |= RX_FLAG_40MHZ;
123 if (rx_stats->rs_flags & ATH9K_RX_GI) 129 if (rx_stats->rs_flags & ATH9K_RX_GI)
124 rxs->flag |= RX_FLAG_SHORT_GI; 130 rxs->flag |= RX_FLAG_SHORT_GI;
125 return rx_stats->rs_rate & 0x7f; 131 rxs->rate_idx = rx_stats->rs_rate & 0x7f;
132 return 0;
126 } 133 }
127 134
128 for (i = 0; i < sband->n_bitrates; i++) { 135 for (i = 0; i < sband->n_bitrates; i++) {
129 if (sband->bitrates[i].hw_value == rx_stats->rs_rate) 136 if (sband->bitrates[i].hw_value == rx_stats->rs_rate) {
130 return i; 137 rxs->rate_idx = i;
138 return 0;
139 }
131 if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { 140 if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) {
132 rxs->flag |= RX_FLAG_SHORTPRE; 141 rxs->flag |= RX_FLAG_SHORTPRE;
133 return i; 142 rxs->rate_idx = i;
143 return 0;
134 } 144 }
135 } 145 }
136 146
137 /* No valid hardware bitrate found -- we should not get here */ 147 /*
148 * No valid hardware bitrate found -- we should not get here
149 * because hardware has already validated this frame as OK.
150 */
138 ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " 151 ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected "
139 "0x%02x using 1 Mbit\n", rx_stats->rs_rate); 152 "0x%02x using 1 Mbit\n", rx_stats->rs_rate);
140 if ((common->debug_mask & ATH_DBG_XMIT)) 153 if ((common->debug_mask & ATH_DBG_XMIT))
141 print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len); 154 print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len);
142 155
143 return 0; 156 return -EINVAL;
144} 157}
145 158
146static void ath9k_process_rssi(struct ath_common *common, 159static void ath9k_process_rssi(struct ath_common *common,
@@ -202,13 +215,19 @@ int ath9k_cmn_rx_skb_preprocess(struct ath_common *common,
202 struct ath_hw *ah = common->ah; 215 struct ath_hw *ah = common->ah;
203 216
204 memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); 217 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
218
219 /*
220 * everything but the rate is checked here, the rate check is done
221 * separately to avoid doing two lookups for a rate for each frame.
222 */
205 if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) 223 if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error))
206 return -EINVAL; 224 return -EINVAL;
207 225
208 ath9k_process_rssi(common, hw, skb, rx_stats); 226 ath9k_process_rssi(common, hw, skb, rx_stats);
209 227
210 rx_status->rate_idx = ath9k_process_rate(common, hw, 228 if (ath9k_process_rate(common, hw, rx_stats, rx_status, skb))
211 rx_stats, rx_status, skb); 229 return -EINVAL;
230
212 rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); 231 rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp);
213 rx_status->band = hw->conf.channel->band; 232 rx_status->band = hw->conf.channel->band;
214 rx_status->freq = hw->conf.channel->center_freq; 233 rx_status->freq = hw->conf.channel->center_freq;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index bd9dff3293dc..ca8704a9d7ac 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -36,8 +36,6 @@ void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
36 36
37 if (ah->config.analog_shiftreg) 37 if (ah->config.analog_shiftreg)
38 udelay(100); 38 udelay(100);
39
40 return;
41} 39}
42 40
43int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 41int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index e591ad6016e5..7e1ed78d0e64 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -50,7 +50,6 @@ static void ath9k_get_txgain_index(struct ath_hw *ah,
50 i++; 50 i++;
51 51
52 *pcdacIdx = i; 52 *pcdacIdx = i;
53 return;
54} 53}
55 54
56static void ath9k_olc_get_pdadcs(struct ath_hw *ah, 55static void ath9k_olc_get_pdadcs(struct ath_hw *ah,
@@ -751,8 +750,6 @@ static void ath9k_hw_get_def_gain_boundaries_pdadcs(struct ath_hw *ah,
751 pPDADCValues[k] = pPDADCValues[k - 1]; 750 pPDADCValues[k] = pPDADCValues[k - 1];
752 k++; 751 k++;
753 } 752 }
754
755 return;
756} 753}
757 754
758static int16_t ath9k_change_gain_boundary_setting(struct ath_hw *ah, 755static int16_t ath9k_change_gain_boundary_setting(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 1ae18bbc4d9e..ad556aa8da39 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -356,7 +356,6 @@ struct ath9k_htc_priv {
356 u16 seq_no; 356 u16 seq_no;
357 u32 bmiss_cnt; 357 u32 bmiss_cnt;
358 358
359 struct sk_buff *beacon;
360 spinlock_t beacon_lock; 359 spinlock_t beacon_lock;
361 360
362 bool tx_queues_stop; 361 bool tx_queues_stop;
@@ -408,13 +407,13 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
408void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, 407void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
409 struct ieee80211_vif *vif); 408 struct ieee80211_vif *vif);
410void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending); 409void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
411void ath9k_htc_beacon_update(struct ath9k_htc_priv *priv,
412 struct ieee80211_vif *vif);
413 410
414void ath9k_htc_rxep(void *priv, struct sk_buff *skb, 411void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
415 enum htc_endpoint_id ep_id); 412 enum htc_endpoint_id ep_id);
416void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, 413void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id,
417 bool txok); 414 bool txok);
415void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
416 enum htc_endpoint_id ep_id, bool txok);
418 417
419void ath9k_htc_station_work(struct work_struct *work); 418void ath9k_htc_station_work(struct work_struct *work);
420void ath9k_htc_aggr_work(struct work_struct *work); 419void ath9k_htc_aggr_work(struct work_struct *work);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 7cb55f5b071c..c10c7d002eb7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -165,22 +165,10 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
165 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); 165 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
166} 166}
167 167
168void ath9k_htc_beacon_update(struct ath9k_htc_priv *priv, 168void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
169 struct ieee80211_vif *vif) 169 enum htc_endpoint_id ep_id, bool txok)
170{ 170{
171 struct ath_common *common = ath9k_hw_common(priv->ah); 171 dev_kfree_skb_any(skb);
172
173 spin_lock_bh(&priv->beacon_lock);
174
175 if (priv->beacon)
176 dev_kfree_skb_any(priv->beacon);
177
178 priv->beacon = ieee80211_beacon_get(priv->hw, vif);
179 if (!priv->beacon)
180 ath_print(common, ATH_DBG_BEACON,
181 "Unable to allocate beacon\n");
182
183 spin_unlock_bh(&priv->beacon_lock);
184} 172}
185 173
186void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) 174void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
@@ -189,6 +177,7 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
189 struct tx_beacon_header beacon_hdr; 177 struct tx_beacon_header beacon_hdr;
190 struct ath9k_htc_tx_ctl tx_ctl; 178 struct ath9k_htc_tx_ctl tx_ctl;
191 struct ieee80211_tx_info *info; 179 struct ieee80211_tx_info *info;
180 struct sk_buff *beacon;
192 u8 *tx_fhdr; 181 u8 *tx_fhdr;
193 182
194 memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header)); 183 memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header));
@@ -207,25 +196,17 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
207 return; 196 return;
208 } 197 }
209 198
210 if (unlikely(priv->beacon == NULL)) {
211 spin_unlock_bh(&priv->beacon_lock);
212 return;
213 }
214
215 /* Free the old SKB first */
216 dev_kfree_skb_any(priv->beacon);
217
218 /* Get a new beacon */ 199 /* Get a new beacon */
219 priv->beacon = ieee80211_beacon_get(priv->hw, priv->vif); 200 beacon = ieee80211_beacon_get(priv->hw, priv->vif);
220 if (!priv->beacon) { 201 if (!beacon) {
221 spin_unlock_bh(&priv->beacon_lock); 202 spin_unlock_bh(&priv->beacon_lock);
222 return; 203 return;
223 } 204 }
224 205
225 info = IEEE80211_SKB_CB(priv->beacon); 206 info = IEEE80211_SKB_CB(beacon);
226 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { 207 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
227 struct ieee80211_hdr *hdr = 208 struct ieee80211_hdr *hdr =
228 (struct ieee80211_hdr *) priv->beacon->data; 209 (struct ieee80211_hdr *) beacon->data;
229 priv->seq_no += 0x10; 210 priv->seq_no += 0x10;
230 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); 211 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
231 hdr->seq_ctrl |= cpu_to_le16(priv->seq_no); 212 hdr->seq_ctrl |= cpu_to_le16(priv->seq_no);
@@ -233,10 +214,10 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
233 214
234 tx_ctl.type = ATH9K_HTC_NORMAL; 215 tx_ctl.type = ATH9K_HTC_NORMAL;
235 beacon_hdr.vif_index = avp->index; 216 beacon_hdr.vif_index = avp->index;
236 tx_fhdr = skb_push(priv->beacon, sizeof(beacon_hdr)); 217 tx_fhdr = skb_push(beacon, sizeof(beacon_hdr));
237 memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr)); 218 memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr));
238 219
239 htc_send(priv->htc, priv->beacon, priv->beacon_ep, &tx_ctl); 220 htc_send(priv->htc, beacon, priv->beacon_ep, &tx_ctl);
240 221
241 spin_unlock_bh(&priv->beacon_lock); 222 spin_unlock_bh(&priv->beacon_lock);
242} 223}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 701f2ef5a440..17111fc1d2cc 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -144,7 +144,7 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv)
144 goto err; 144 goto err;
145 145
146 /* Beacon */ 146 /* Beacon */
147 ret = ath9k_htc_connect_svc(priv, WMI_BEACON_SVC, NULL, 147 ret = ath9k_htc_connect_svc(priv, WMI_BEACON_SVC, ath9k_htc_beaconep,
148 &priv->beacon_ep); 148 &priv->beacon_ep);
149 if (ret) 149 if (ret)
150 goto err; 150 goto err;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index ca7f3a78eb11..6c386dad1d40 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -461,11 +461,11 @@ static int ath9k_htc_aggr_oper(struct ath9k_htc_priv *priv,
461 struct ath_common *common = ath9k_hw_common(priv->ah); 461 struct ath_common *common = ath9k_hw_common(priv->ah);
462 struct ath9k_htc_target_aggr aggr; 462 struct ath9k_htc_target_aggr aggr;
463 struct ieee80211_sta *sta = NULL; 463 struct ieee80211_sta *sta = NULL;
464 struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv; 464 struct ath9k_htc_sta *ista;
465 int ret = 0; 465 int ret = 0;
466 u8 cmd_rsp; 466 u8 cmd_rsp;
467 467
468 if (tid > ATH9K_HTC_MAX_TID) 468 if (tid >= ATH9K_HTC_MAX_TID)
469 return -EINVAL; 469 return -EINVAL;
470 470
471 memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr)); 471 memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr));
@@ -1099,7 +1099,7 @@ fail_tx:
1099 return 0; 1099 return 0;
1100} 1100}
1101 1101
1102static int ath9k_htc_radio_enable(struct ieee80211_hw *hw) 1102static int ath9k_htc_radio_enable(struct ieee80211_hw *hw, bool led)
1103{ 1103{
1104 struct ath9k_htc_priv *priv = hw->priv; 1104 struct ath9k_htc_priv *priv = hw->priv;
1105 struct ath_hw *ah = priv->ah; 1105 struct ath_hw *ah = priv->ah;
@@ -1147,6 +1147,13 @@ static int ath9k_htc_radio_enable(struct ieee80211_hw *hw)
1147 priv->tx_queues_stop = false; 1147 priv->tx_queues_stop = false;
1148 spin_unlock_bh(&priv->tx_lock); 1148 spin_unlock_bh(&priv->tx_lock);
1149 1149
1150 if (led) {
1151 /* Enable LED */
1152 ath9k_hw_cfg_output(ah, ah->led_pin,
1153 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
1154 ath9k_hw_set_gpio(ah, ah->led_pin, 0);
1155 }
1156
1150 ieee80211_wake_queues(hw); 1157 ieee80211_wake_queues(hw);
1151 1158
1152 return ret; 1159 return ret;
@@ -1158,13 +1165,13 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
1158 int ret = 0; 1165 int ret = 0;
1159 1166
1160 mutex_lock(&priv->mutex); 1167 mutex_lock(&priv->mutex);
1161 ret = ath9k_htc_radio_enable(hw); 1168 ret = ath9k_htc_radio_enable(hw, false);
1162 mutex_unlock(&priv->mutex); 1169 mutex_unlock(&priv->mutex);
1163 1170
1164 return ret; 1171 return ret;
1165} 1172}
1166 1173
1167static void ath9k_htc_radio_disable(struct ieee80211_hw *hw) 1174static void ath9k_htc_radio_disable(struct ieee80211_hw *hw, bool led)
1168{ 1175{
1169 struct ath9k_htc_priv *priv = hw->priv; 1176 struct ath9k_htc_priv *priv = hw->priv;
1170 struct ath_hw *ah = priv->ah; 1177 struct ath_hw *ah = priv->ah;
@@ -1177,6 +1184,12 @@ static void ath9k_htc_radio_disable(struct ieee80211_hw *hw)
1177 return; 1184 return;
1178 } 1185 }
1179 1186
1187 if (led) {
1188 /* Disable LED */
1189 ath9k_hw_set_gpio(ah, ah->led_pin, 1);
1190 ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
1191 }
1192
1180 /* Cancel all the running timers/work .. */ 1193 /* Cancel all the running timers/work .. */
1181 cancel_work_sync(&priv->ps_work); 1194 cancel_work_sync(&priv->ps_work);
1182 cancel_delayed_work_sync(&priv->ath9k_ani_work); 1195 cancel_delayed_work_sync(&priv->ath9k_ani_work);
@@ -1217,7 +1230,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
1217 struct ath9k_htc_priv *priv = hw->priv; 1230 struct ath9k_htc_priv *priv = hw->priv;
1218 1231
1219 mutex_lock(&priv->mutex); 1232 mutex_lock(&priv->mutex);
1220 ath9k_htc_radio_disable(hw); 1233 ath9k_htc_radio_disable(hw, false);
1221 mutex_unlock(&priv->mutex); 1234 mutex_unlock(&priv->mutex);
1222} 1235}
1223 1236
@@ -1313,15 +1326,6 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
1313 priv->nvifs--; 1326 priv->nvifs--;
1314 1327
1315 ath9k_htc_remove_station(priv, vif, NULL); 1328 ath9k_htc_remove_station(priv, vif, NULL);
1316
1317 if (vif->type == NL80211_IFTYPE_ADHOC) {
1318 spin_lock_bh(&priv->beacon_lock);
1319 if (priv->beacon)
1320 dev_kfree_skb_any(priv->beacon);
1321 priv->beacon = NULL;
1322 spin_unlock_bh(&priv->beacon_lock);
1323 }
1324
1325 priv->vif = NULL; 1329 priv->vif = NULL;
1326 1330
1327 mutex_unlock(&priv->mutex); 1331 mutex_unlock(&priv->mutex);
@@ -1346,7 +1350,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1346 1350
1347 if (enable_radio) { 1351 if (enable_radio) {
1348 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); 1352 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
1349 ath9k_htc_radio_enable(hw); 1353 ath9k_htc_radio_enable(hw, true);
1350 ath_print(common, ATH_DBG_CONFIG, 1354 ath_print(common, ATH_DBG_CONFIG,
1351 "not-idle: enabling radio\n"); 1355 "not-idle: enabling radio\n");
1352 } 1356 }
@@ -1398,10 +1402,9 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1398 if (priv->ps_idle) { 1402 if (priv->ps_idle) {
1399 ath_print(common, ATH_DBG_CONFIG, 1403 ath_print(common, ATH_DBG_CONFIG,
1400 "idle: disabling radio\n"); 1404 "idle: disabling radio\n");
1401 ath9k_htc_radio_disable(hw); 1405 ath9k_htc_radio_disable(hw, true);
1402 } 1406 }
1403 1407
1404
1405 mutex_unlock(&priv->mutex); 1408 mutex_unlock(&priv->mutex);
1406 1409
1407 return 0; 1410 return 0;
@@ -1590,9 +1593,6 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1590 ath9k_htc_beacon_config(priv, vif); 1593 ath9k_htc_beacon_config(priv, vif);
1591 } 1594 }
1592 1595
1593 if (changed & BSS_CHANGED_BEACON)
1594 ath9k_htc_beacon_update(priv, vif);
1595
1596 if ((changed & BSS_CHANGED_BEACON_ENABLED) && 1596 if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
1597 !bss_conf->enable_beacon) { 1597 !bss_conf->enable_beacon) {
1598 priv->op_flags &= ~OP_ENABLE_BEACON; 1598 priv->op_flags &= ~OP_ENABLE_BEACON;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 28abc7d5e909..2571b443ac82 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -663,7 +663,6 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
663 return; 663 return;
664err: 664err:
665 dev_kfree_skb_any(skb); 665 dev_kfree_skb_any(skb);
666 return;
667} 666}
668 667
669/* FIXME: Locking for cleanup/init */ 668/* FIXME: Locking for cleanup/init */
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 559019262d30..c33f17dbe6f1 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -574,6 +574,26 @@ static int __ath9k_hw_init(struct ath_hw *ah)
574 574
575 ath9k_hw_init_mode_regs(ah); 575 ath9k_hw_init_mode_regs(ah);
576 576
577 /*
578 * Configire PCIE after Ini init. SERDES values now come from ini file
579 * This enables PCIe low power mode.
580 */
581 if (AR_SREV_9300_20_OR_LATER(ah)) {
582 u32 regval;
583 unsigned int i;
584
585 /* Set Bits 16 and 17 in the AR_WA register. */
586 regval = REG_READ(ah, AR_WA);
587 regval |= 0x00030000;
588 REG_WRITE(ah, AR_WA, regval);
589
590 for (i = 0; i < ah->iniPcieSerdesLowPower.ia_rows; i++) {
591 REG_WRITE(ah,
592 INI_RA(&ah->iniPcieSerdesLowPower, i, 0),
593 INI_RA(&ah->iniPcieSerdesLowPower, i, 1));
594 }
595 }
596
577 if (ah->is_pciexpress) 597 if (ah->is_pciexpress)
578 ath9k_hw_configpcipowersave(ah, 0, 0); 598 ath9k_hw_configpcipowersave(ah, 0, 0);
579 else 599 else
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 24d59883d944..3f4244f56ce5 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -333,7 +333,6 @@ static void ath_reg_apply_world_flags(struct wiphy *wiphy,
333 ath_reg_apply_active_scan_flags(wiphy, initiator); 333 ath_reg_apply_active_scan_flags(wiphy, initiator);
334 break; 334 break;
335 } 335 }
336 return;
337} 336}
338 337
339int ath_reg_notifier_apply(struct wiphy *wiphy, 338int ath_reg_notifier_apply(struct wiphy *wiphy,
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 3edbbcf0f548..c8f7090b27d3 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -865,7 +865,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
865 865
866 /* low bit of first byte of destination tells us if broadcast */ 866 /* low bit of first byte of destination tells us if broadcast */
867 tx_update_descriptor(priv, *(skb->data) & 0x01, len + 18, buff, TX_PACKET_TYPE_DATA); 867 tx_update_descriptor(priv, *(skb->data) & 0x01, len + 18, buff, TX_PACKET_TYPE_DATA);
868 dev->trans_start = jiffies;
869 dev->stats.tx_bytes += len; 868 dev->stats.tx_bytes += len;
870 869
871 spin_unlock_irqrestore(&priv->irqlock, flags); 870 spin_unlock_irqrestore(&priv->irqlock, flags);
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 2088ac029b35..a59ceb26cd83 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -3239,7 +3239,6 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
3239 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3239 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX,
3240 txq->next); 3240 txq->next);
3241 } 3241 }
3242 return;
3243} 3242}
3244 3243
3245static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) 3244static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 82de71a3aea7..3aa3bb18f615 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2607,8 +2607,6 @@ static inline void eeprom_write_reg(struct ipw_priv *p, u32 data)
2607 2607
2608 /* the eeprom requires some time to complete the operation */ 2608 /* the eeprom requires some time to complete the operation */
2609 udelay(p->eeprom_delay); 2609 udelay(p->eeprom_delay);
2610
2611 return;
2612} 2610}
2613 2611
2614/* perform a chip select operation */ 2612/* perform a chip select operation */
diff --git a/drivers/net/wireless/ipw2x00/libipw_rx.c b/drivers/net/wireless/ipw2x00/libipw_rx.c
index 39a34da52d52..0de1b1893220 100644
--- a/drivers/net/wireless/ipw2x00/libipw_rx.c
+++ b/drivers/net/wireless/ipw2x00/libipw_rx.c
@@ -918,7 +918,6 @@ void libipw_rx_any(struct libipw_device *ieee,
918drop_free: 918drop_free:
919 dev_kfree_skb_irq(skb); 919 dev_kfree_skb_irq(skb);
920 ieee->dev->stats.rx_dropped++; 920 ieee->dev->stats.rx_dropped++;
921 return;
922} 921}
923 922
924#define MGMT_FRAME_FIXED_PART_LENGTH 0x24 923#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 32eb4709acac..8e84a08ff951 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -545,8 +545,6 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
545 spin_unlock_irqrestore(&rs_sta->lock, flags); 545 spin_unlock_irqrestore(&rs_sta->lock, flags);
546 546
547 IWL_DEBUG_RATE(priv, "leave\n"); 547 IWL_DEBUG_RATE(priv, "leave\n");
548
549 return;
550} 548}
551 549
552static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, 550static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 17197a78d894..99b876a2feb9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2483,7 +2483,6 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
2483 &priv->_3945.shared_phys, GFP_KERNEL); 2483 &priv->_3945.shared_phys, GFP_KERNEL);
2484 if (!priv->_3945.shared_virt) { 2484 if (!priv->_3945.shared_virt) {
2485 IWL_ERR(priv, "failed to allocate pci memory\n"); 2485 IWL_ERR(priv, "failed to allocate pci memory\n");
2486 mutex_unlock(&priv->mutex);
2487 return -ENOMEM; 2486 return -ENOMEM;
2488 } 2487 }
2489 2488
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index bfcac5608d87..cf4a95bae4ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2337,8 +2337,6 @@ out:
2337 tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); 2337 tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
2338 i = index; 2338 i = index;
2339 lq_sta->last_txrate_idx = i; 2339 lq_sta->last_txrate_idx = i;
2340
2341 return;
2342} 2340}
2343 2341
2344/** 2342/**
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a672d3379cfd..cc15e929a987 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2494,7 +2494,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
2494 } 2494 }
2495 2495
2496 mutex_unlock(&priv->mutex); 2496 mutex_unlock(&priv->mutex);
2497 return;
2498} 2497}
2499 2498
2500static void iwl_bg_restart(struct work_struct *data) 2499static void iwl_bg_restart(struct work_struct *data)
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
index f1fd00b1a65d..7e8227773213 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
@@ -638,8 +638,6 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
638 iwl_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); 638 iwl_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
639 iwl_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); 639 iwl_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis);
640 iwl_sensitivity_write(priv); 640 iwl_sensitivity_write(priv);
641
642 return;
643} 641}
644EXPORT_SYMBOL(iwl_sensitivity_calibration); 642EXPORT_SYMBOL(iwl_sensitivity_calibration);
645 643
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 4cdf4d3a9ddb..87eb89f000f5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -769,7 +769,6 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
769 "extension channel offset 0x%x\n", 769 "extension channel offset 0x%x\n",
770 le32_to_cpu(rxon->flags), ht_conf->ht_protection, 770 le32_to_cpu(rxon->flags), ht_conf->ht_protection,
771 ht_conf->extension_chan_offset); 771 ht_conf->extension_chan_offset);
772 return;
773} 772}
774EXPORT_SYMBOL(iwl_set_rxon_ht); 773EXPORT_SYMBOL(iwl_set_rxon_ht);
775 774
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c7e1d7d09e02..1beb81c0be68 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -848,7 +848,6 @@ static void iwl3945_rx_reply_add_sta(struct iwl_priv *priv,
848#endif 848#endif
849 849
850 IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 850 IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
851 return;
852} 851}
853 852
854static void iwl3945_bg_beacon_update(struct work_struct *work) 853static void iwl3945_bg_beacon_update(struct work_struct *work)
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index 1acea37f39f8..edcb52330cf5 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -479,8 +479,6 @@ static void iwm_sdio_remove(struct sdio_func *func)
479 sdio_set_drvdata(func, NULL); 479 sdio_set_drvdata(func, NULL);
480 480
481 dev_info(dev, "IWM SDIO remove\n"); 481 dev_info(dev, "IWM SDIO remove\n");
482
483 return;
484} 482}
485 483
486static const struct sdio_device_id iwm_sdio_ids[] = { 484static const struct sdio_device_id iwm_sdio_ids[] = {
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index ce7bec402a33..9d5d3ccf08c8 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -79,6 +79,7 @@ static const u32 cipher_suites[] = {
79 79
80 80
81static int lbs_cfg_set_channel(struct wiphy *wiphy, 81static int lbs_cfg_set_channel(struct wiphy *wiphy,
82 struct net_device *netdev,
82 struct ieee80211_channel *chan, 83 struct ieee80211_channel *chan,
83 enum nl80211_channel_type channel_type) 84 enum nl80211_channel_type channel_type)
84{ 85{
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 6f5b843c1f44..de2caac11dd6 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -757,15 +757,12 @@ void lbs_debugfs_init(void)
757{ 757{
758 if (!lbs_dir) 758 if (!lbs_dir)
759 lbs_dir = debugfs_create_dir("lbs_wireless", NULL); 759 lbs_dir = debugfs_create_dir("lbs_wireless", NULL);
760
761 return;
762} 760}
763 761
764void lbs_debugfs_remove(void) 762void lbs_debugfs_remove(void)
765{ 763{
766 if (lbs_dir) 764 if (lbs_dir)
767 debugfs_remove(lbs_dir); 765 debugfs_remove(lbs_dir);
768 return;
769} 766}
770 767
771void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev) 768void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index fcea5741ba62..f41594c7ac16 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -133,8 +133,6 @@ static void if_usb_write_bulk_callback(struct urb *urb)
133 /* print the failure status number for debug */ 133 /* print the failure status number for debug */
134 lbs_pr_info("URB in failure status: %d\n", urb->status); 134 lbs_pr_info("URB in failure status: %d\n", urb->status);
135 } 135 }
136
137 return;
138} 136}
139 137
140/** 138/**
@@ -651,8 +649,6 @@ static void if_usb_receive_fwload(struct urb *urb)
651 if_usb_submit_rx_urb_fwload(cardp); 649 if_usb_submit_rx_urb_fwload(cardp);
652 650
653 kfree(syncfwheader); 651 kfree(syncfwheader);
654
655 return;
656} 652}
657 653
658#define MRVDRV_MIN_PKT_LEN 30 654#define MRVDRV_MIN_PKT_LEN 30
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 38edad6f24b8..d9b8ee130c45 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -229,7 +229,7 @@ static void lbs_tx_timeout(struct net_device *dev)
229 229
230 lbs_pr_err("tx watch dog timeout\n"); 230 lbs_pr_err("tx watch dog timeout\n");
231 231
232 dev->trans_start = jiffies; 232 dev->trans_start = jiffies; /* prevent tx timeout */
233 233
234 if (priv->currenttxskb) 234 if (priv->currenttxskb)
235 lbs_send_tx_feedback(priv, 0); 235 lbs_send_tx_feedback(priv, 0);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index e2b8d886b091..a115bfa9513a 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -90,7 +90,6 @@ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
90 priv->nextSNRNF++; 90 priv->nextSNRNF++;
91 if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) 91 if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
92 priv->nextSNRNF = 0; 92 priv->nextSNRNF = 0;
93 return;
94} 93}
95 94
96/** 95/**
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 52d244ea3d97..a9bf658659eb 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -147,8 +147,6 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
147 dev->stats.tx_packets++; 147 dev->stats.tx_packets++;
148 dev->stats.tx_bytes += skb->len; 148 dev->stats.tx_bytes += skb->len;
149 149
150 dev->trans_start = jiffies;
151
152 if (priv->monitormode) { 150 if (priv->monitormode) {
153 /* Keep the skb to echo it back once Tx feedback is 151 /* Keep the skb to echo it back once Tx feedback is
154 received from FW */ 152 received from FW */
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index 4412c279ca94..c445500ffc61 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -576,7 +576,6 @@ static void if_usb_receive_fwload(struct urb *urb)
576 kfree(syncfwheader); 576 kfree(syncfwheader);
577 577
578 lbtf_deb_leave(LBTF_DEB_USB); 578 lbtf_deb_leave(LBTF_DEB_USB);
579 return;
580} 579}
581 580
582#define MRVDRV_MIN_PKT_LEN 30 581#define MRVDRV_MIN_PKT_LEN 30
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 60787de56f3a..6a04c2157f73 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -360,7 +360,6 @@ static void lbtf_op_stop(struct ieee80211_hw *hw)
360 lbtf_set_radio_control(priv); 360 lbtf_set_radio_control(priv);
361 361
362 lbtf_deb_leave(LBTF_DEB_MACOPS); 362 lbtf_deb_leave(LBTF_DEB_MACOPS);
363 return;
364} 363}
365 364
366static int lbtf_op_add_interface(struct ieee80211_hw *hw, 365static int lbtf_op_add_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 9fd2beadb6f5..6f8cb3ee6fed 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -652,17 +652,17 @@ static void mac80211_hwsim_beacon(unsigned long arg)
652 add_timer(&data->beacon_timer); 652 add_timer(&data->beacon_timer);
653} 653}
654 654
655static const char *hwsim_chantypes[] = {
656 [NL80211_CHAN_NO_HT] = "noht",
657 [NL80211_CHAN_HT20] = "ht20",
658 [NL80211_CHAN_HT40MINUS] = "ht40-",
659 [NL80211_CHAN_HT40PLUS] = "ht40+",
660};
655 661
656static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) 662static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
657{ 663{
658 struct mac80211_hwsim_data *data = hw->priv; 664 struct mac80211_hwsim_data *data = hw->priv;
659 struct ieee80211_conf *conf = &hw->conf; 665 struct ieee80211_conf *conf = &hw->conf;
660 static const char *chantypes[4] = {
661 [NL80211_CHAN_NO_HT] = "noht",
662 [NL80211_CHAN_HT20] = "ht20",
663 [NL80211_CHAN_HT40MINUS] = "ht40-",
664 [NL80211_CHAN_HT40PLUS] = "ht40+",
665 };
666 static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { 666 static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = {
667 [IEEE80211_SMPS_AUTOMATIC] = "auto", 667 [IEEE80211_SMPS_AUTOMATIC] = "auto",
668 [IEEE80211_SMPS_OFF] = "off", 668 [IEEE80211_SMPS_OFF] = "off",
@@ -673,7 +673,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
673 printk(KERN_DEBUG "%s:%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", 673 printk(KERN_DEBUG "%s:%s (freq=%d/%s idle=%d ps=%d smps=%s)\n",
674 wiphy_name(hw->wiphy), __func__, 674 wiphy_name(hw->wiphy), __func__,
675 conf->channel->center_freq, 675 conf->channel->center_freq,
676 chantypes[conf->channel_type], 676 hwsim_chantypes[conf->channel_type],
677 !!(conf->flags & IEEE80211_CONF_IDLE), 677 !!(conf->flags & IEEE80211_CONF_IDLE),
678 !!(conf->flags & IEEE80211_CONF_PS), 678 !!(conf->flags & IEEE80211_CONF_PS),
679 smps_modes[conf->smps_mode]); 679 smps_modes[conf->smps_mode]);
@@ -761,9 +761,10 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw,
761 } 761 }
762 762
763 if (changed & BSS_CHANGED_HT) { 763 if (changed & BSS_CHANGED_HT) {
764 printk(KERN_DEBUG " %s: HT: op_mode=0x%x\n", 764 printk(KERN_DEBUG " %s: HT: op_mode=0x%x, chantype=%s\n",
765 wiphy_name(hw->wiphy), 765 wiphy_name(hw->wiphy),
766 info->ht_operation_mode); 766 info->ht_operation_mode,
767 hwsim_chantypes[info->channel_type]);
767 } 768 }
768 769
769 if (changed & BSS_CHANGED_BASIC_RATES) { 770 if (changed & BSS_CHANGED_BASIC_RATES) {
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index 81d228de9e5d..8c4169c227ae 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -159,6 +159,7 @@ static int orinoco_scan(struct wiphy *wiphy, struct net_device *dev,
159} 159}
160 160
161static int orinoco_set_channel(struct wiphy *wiphy, 161static int orinoco_set_channel(struct wiphy *wiphy,
162 struct net_device *netdev,
162 struct ieee80211_channel *chan, 163 struct ieee80211_channel *chan,
163 enum nl80211_channel_type channel_type) 164 enum nl80211_channel_type channel_type)
164{ 165{
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 1d60c7e4392a..ca71f08709bc 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -340,18 +340,109 @@ EXPORT_SYMBOL(orinoco_change_mtu);
340/* Tx path */ 340/* Tx path */
341/********************************************************************/ 341/********************************************************************/
342 342
343/* Add encapsulation and MIC to the existing SKB.
344 * The main xmit routine will then send the whole lot to the card.
345 * Need 8 bytes headroom
346 * Need 8 bytes tailroom
347 *
348 * With encapsulated ethernet II frame
349 * --------
350 * 803.3 header (14 bytes)
351 * dst[6]
352 * -------- src[6]
353 * 803.3 header (14 bytes) len[2]
354 * dst[6] 803.2 header (8 bytes)
355 * src[6] encaps[6]
356 * len[2] <- leave alone -> len[2]
357 * -------- -------- <-- 0
358 * Payload Payload
359 * ... ...
360 *
361 * -------- --------
362 * MIC (8 bytes)
363 * --------
364 *
365 * returns 0 on success, -ENOMEM on error.
366 */
367int orinoco_process_xmit_skb(struct sk_buff *skb,
368 struct net_device *dev,
369 struct orinoco_private *priv,
370 int *tx_control,
371 u8 *mic_buf)
372{
373 struct orinoco_tkip_key *key;
374 struct ethhdr *eh;
375 int do_mic;
376
377 key = (struct orinoco_tkip_key *) priv->keys[priv->tx_key].key;
378
379 do_mic = ((priv->encode_alg == ORINOCO_ALG_TKIP) &&
380 (key != NULL));
381
382 if (do_mic)
383 *tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) |
384 HERMES_TXCTRL_MIC;
385
386 eh = (struct ethhdr *)skb->data;
387
388 /* Encapsulate Ethernet-II frames */
389 if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
390 struct header_struct {
391 struct ethhdr eth; /* 802.3 header */
392 u8 encap[6]; /* 802.2 header */
393 } __attribute__ ((packed)) hdr;
394 int len = skb->len + sizeof(encaps_hdr) - (2 * ETH_ALEN);
395
396 if (skb_headroom(skb) < ENCAPS_OVERHEAD) {
397 if (net_ratelimit())
398 printk(KERN_ERR
399 "%s: Not enough headroom for 802.2 headers %d\n",
400 dev->name, skb_headroom(skb));
401 return -ENOMEM;
402 }
403
404 /* Fill in new header */
405 memcpy(&hdr.eth, eh, 2 * ETH_ALEN);
406 hdr.eth.h_proto = htons(len);
407 memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr));
408
409 /* Make room for the new header, and copy it in */
410 eh = (struct ethhdr *) skb_push(skb, ENCAPS_OVERHEAD);
411 memcpy(eh, &hdr, sizeof(hdr));
412 }
413
414 /* Calculate Michael MIC */
415 if (do_mic) {
416 size_t len = skb->len - ETH_HLEN;
417 u8 *mic = &mic_buf[0];
418
419 /* Have to write to an even address, so copy the spare
420 * byte across */
421 if (skb->len % 2) {
422 *mic = skb->data[skb->len - 1];
423 mic++;
424 }
425
426 orinoco_mic(priv->tx_tfm_mic, key->tx_mic,
427 eh->h_dest, eh->h_source, 0 /* priority */,
428 skb->data + ETH_HLEN,
429 len, mic);
430 }
431
432 return 0;
433}
434EXPORT_SYMBOL(orinoco_process_xmit_skb);
435
343static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) 436static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
344{ 437{
345 struct orinoco_private *priv = ndev_priv(dev); 438 struct orinoco_private *priv = ndev_priv(dev);
346 struct net_device_stats *stats = &priv->stats; 439 struct net_device_stats *stats = &priv->stats;
347 struct orinoco_tkip_key *key;
348 hermes_t *hw = &priv->hw; 440 hermes_t *hw = &priv->hw;
349 int err = 0; 441 int err = 0;
350 u16 txfid = priv->txfid; 442 u16 txfid = priv->txfid;
351 struct ethhdr *eh;
352 int tx_control; 443 int tx_control;
353 unsigned long flags; 444 unsigned long flags;
354 int do_mic; 445 u8 mic_buf[MICHAEL_MIC_LEN+1];
355 446
356 if (!netif_running(dev)) { 447 if (!netif_running(dev)) {
357 printk(KERN_ERR "%s: Tx on stopped device!\n", 448 printk(KERN_ERR "%s: Tx on stopped device!\n",
@@ -383,16 +474,12 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
383 if (skb->len < ETH_HLEN) 474 if (skb->len < ETH_HLEN)
384 goto drop; 475 goto drop;
385 476
386 key = (struct orinoco_tkip_key *) priv->keys[priv->tx_key].key;
387
388 do_mic = ((priv->encode_alg == ORINOCO_ALG_TKIP) &&
389 (key != NULL));
390
391 tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX; 477 tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX;
392 478
393 if (do_mic) 479 err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
394 tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) | 480 &mic_buf[0]);
395 HERMES_TXCTRL_MIC; 481 if (err)
482 goto drop;
396 483
397 if (priv->has_alt_txcntl) { 484 if (priv->has_alt_txcntl) {
398 /* WPA enabled firmwares have tx_cntl at the end of 485 /* WPA enabled firmwares have tx_cntl at the end of
@@ -435,34 +522,6 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
435 HERMES_802_3_OFFSET - HERMES_802_11_OFFSET); 522 HERMES_802_3_OFFSET - HERMES_802_11_OFFSET);
436 } 523 }
437 524
438 eh = (struct ethhdr *)skb->data;
439
440 /* Encapsulate Ethernet-II frames */
441 if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
442 struct header_struct {
443 struct ethhdr eth; /* 802.3 header */
444 u8 encap[6]; /* 802.2 header */
445 } __attribute__ ((packed)) hdr;
446
447 /* Strip destination and source from the data */
448 skb_pull(skb, 2 * ETH_ALEN);
449
450 /* And move them to a separate header */
451 memcpy(&hdr.eth, eh, 2 * ETH_ALEN);
452 hdr.eth.h_proto = htons(sizeof(encaps_hdr) + skb->len);
453 memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr));
454
455 /* Insert the SNAP header */
456 if (skb_headroom(skb) < sizeof(hdr)) {
457 printk(KERN_ERR
458 "%s: Not enough headroom for 802.2 headers %d\n",
459 dev->name, skb_headroom(skb));
460 goto drop;
461 }
462 eh = (struct ethhdr *) skb_push(skb, sizeof(hdr));
463 memcpy(eh, &hdr, sizeof(hdr));
464 }
465
466 err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, 525 err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len,
467 txfid, HERMES_802_3_OFFSET); 526 txfid, HERMES_802_3_OFFSET);
468 if (err) { 527 if (err) {
@@ -471,32 +530,16 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
471 goto busy; 530 goto busy;
472 } 531 }
473 532
474 /* Calculate Michael MIC */ 533 if (tx_control & HERMES_TXCTRL_MIC) {
475 if (do_mic) { 534 size_t offset = HERMES_802_3_OFFSET + skb->len;
476 u8 mic_buf[MICHAEL_MIC_LEN + 1]; 535 size_t len = MICHAEL_MIC_LEN;
477 u8 *mic;
478 size_t offset;
479 size_t len;
480 536
481 if (skb->len % 2) { 537 if (offset % 2) {
482 /* MIC start is on an odd boundary */ 538 offset--;
483 mic_buf[0] = skb->data[skb->len - 1]; 539 len++;
484 mic = &mic_buf[1];
485 offset = skb->len - 1;
486 len = MICHAEL_MIC_LEN + 1;
487 } else {
488 mic = &mic_buf[0];
489 offset = skb->len;
490 len = MICHAEL_MIC_LEN;
491 } 540 }
492
493 orinoco_mic(priv->tx_tfm_mic, key->tx_mic,
494 eh->h_dest, eh->h_source, 0 /* priority */,
495 skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic);
496
497 /* Write the MIC */
498 err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, 541 err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len,
499 txfid, HERMES_802_3_OFFSET + offset); 542 txfid, offset);
500 if (err) { 543 if (err) {
501 printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", 544 printk(KERN_ERR "%s: Error %d writing MIC to BAP\n",
502 dev->name, err); 545 dev->name, err);
@@ -517,7 +560,6 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
517 goto busy; 560 goto busy;
518 } 561 }
519 562
520 dev->trans_start = jiffies;
521 stats->tx_bytes += HERMES_802_3_OFFSET + skb->len; 563 stats->tx_bytes += HERMES_802_3_OFFSET + skb->len;
522 goto ok; 564 goto ok;
523 565
@@ -1576,8 +1618,6 @@ void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1576 /* We don't actually do anything about it */ 1618 /* We don't actually do anything about it */
1577 break; 1619 break;
1578 } 1620 }
1579
1580 return;
1581} 1621}
1582EXPORT_SYMBOL(__orinoco_ev_info); 1622EXPORT_SYMBOL(__orinoco_ev_info);
1583 1623
@@ -2235,7 +2275,7 @@ int orinoco_if_add(struct orinoco_private *priv,
2235 /* we use the default eth_mac_addr for setting the MAC addr */ 2275 /* we use the default eth_mac_addr for setting the MAC addr */
2236 2276
2237 /* Reserve space in skb for the SNAP header */ 2277 /* Reserve space in skb for the SNAP header */
2238 dev->hard_header_len += ENCAPS_OVERHEAD; 2278 dev->needed_headroom = ENCAPS_OVERHEAD;
2239 2279
2240 netif_carrier_off(dev); 2280 netif_carrier_off(dev);
2241 2281
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h
index e9f415a56d4d..a6da86e0a70f 100644
--- a/drivers/net/wireless/orinoco/orinoco.h
+++ b/drivers/net/wireless/orinoco/orinoco.h
@@ -200,6 +200,12 @@ extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
200extern void __orinoco_ev_info(struct net_device *dev, hermes_t *hw); 200extern void __orinoco_ev_info(struct net_device *dev, hermes_t *hw);
201extern void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw); 201extern void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw);
202 202
203int orinoco_process_xmit_skb(struct sk_buff *skb,
204 struct net_device *dev,
205 struct orinoco_private *priv,
206 int *tx_control,
207 u8 *mic);
208
203/* Common ndo functions exported for reuse by orinoco_usb */ 209/* Common ndo functions exported for reuse by orinoco_usb */
204int orinoco_open(struct net_device *dev); 210int orinoco_open(struct net_device *dev);
205int orinoco_stop(struct net_device *dev); 211int orinoco_stop(struct net_device *dev);
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c
index e22093359f3e..78f089baa8c9 100644
--- a/drivers/net/wireless/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
@@ -67,6 +67,7 @@
67#include <linux/wireless.h> 67#include <linux/wireless.h>
68#include <linux/firmware.h> 68#include <linux/firmware.h>
69 69
70#include "mic.h"
70#include "orinoco.h" 71#include "orinoco.h"
71 72
72#ifndef URB_ASYNC_UNLINK 73#ifndef URB_ASYNC_UNLINK
@@ -1198,11 +1199,9 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1198 struct orinoco_private *priv = ndev_priv(dev); 1199 struct orinoco_private *priv = ndev_priv(dev);
1199 struct net_device_stats *stats = &priv->stats; 1200 struct net_device_stats *stats = &priv->stats;
1200 struct ezusb_priv *upriv = priv->card; 1201 struct ezusb_priv *upriv = priv->card;
1202 u8 mic[MICHAEL_MIC_LEN+1];
1201 int err = 0; 1203 int err = 0;
1202 char *p; 1204 int tx_control;
1203 struct ethhdr *eh;
1204 int len, data_len, data_off;
1205 __le16 tx_control;
1206 unsigned long flags; 1205 unsigned long flags;
1207 struct request_context *ctx; 1206 struct request_context *ctx;
1208 u8 *buf; 1207 u8 *buf;
@@ -1222,7 +1221,7 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1222 1221
1223 if (orinoco_lock(priv, &flags) != 0) { 1222 if (orinoco_lock(priv, &flags) != 0) {
1224 printk(KERN_ERR 1223 printk(KERN_ERR
1225 "%s: orinoco_xmit() called while hw_unavailable\n", 1224 "%s: ezusb_xmit() called while hw_unavailable\n",
1226 dev->name); 1225 dev->name);
1227 return NETDEV_TX_BUSY; 1226 return NETDEV_TX_BUSY;
1228 } 1227 }
@@ -1232,53 +1231,46 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1232 /* Oops, the firmware hasn't established a connection, 1231 /* Oops, the firmware hasn't established a connection,
1233 silently drop the packet (this seems to be the 1232 silently drop the packet (this seems to be the
1234 safest approach). */ 1233 safest approach). */
1235 stats->tx_errors++; 1234 goto drop;
1236 orinoco_unlock(priv, &flags);
1237 dev_kfree_skb(skb);
1238 return NETDEV_TX_OK;
1239 } 1235 }
1240 1236
1237 /* Check packet length */
1238 if (skb->len < ETH_HLEN)
1239 goto drop;
1240
1241 ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); 1241 ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
1242 if (!ctx) 1242 if (!ctx)
1243 goto fail; 1243 goto busy;
1244 1244
1245 memset(ctx->buf, 0, BULK_BUF_SIZE); 1245 memset(ctx->buf, 0, BULK_BUF_SIZE);
1246 buf = ctx->buf->data; 1246 buf = ctx->buf->data;
1247 1247
1248 /* Length of the packet body */ 1248 tx_control = 0;
1249 /* FIXME: what if the skb is smaller than this? */ 1249
1250 len = max_t(int, skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN); 1250 err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
1251 1251 &mic[0]);
1252 eh = (struct ethhdr *) skb->data; 1252 if (err)
1253 1253 goto drop;
1254 tx_control = cpu_to_le16(0); 1254
1255 memcpy(buf, &tx_control, sizeof(tx_control)); 1255 {
1256 buf += sizeof(tx_control); 1256 __le16 *tx_cntl = (__le16 *)buf;
1257 /* Encapsulate Ethernet-II frames */ 1257 *tx_cntl = cpu_to_le16(tx_control);
1258 if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ 1258 buf += sizeof(*tx_cntl);
1259 struct header_struct *hdr = (void *) buf;
1260 buf += sizeof(*hdr);
1261 data_len = len;
1262 data_off = sizeof(tx_control) + sizeof(*hdr);
1263 p = skb->data + ETH_HLEN;
1264
1265 /* 802.3 header */
1266 memcpy(hdr->dest, eh->h_dest, ETH_ALEN);
1267 memcpy(hdr->src, eh->h_source, ETH_ALEN);
1268 hdr->len = htons(data_len + ENCAPS_OVERHEAD);
1269
1270 /* 802.2 header */
1271 memcpy(&hdr->dsap, &encaps_hdr, sizeof(encaps_hdr));
1272
1273 hdr->ethertype = eh->h_proto;
1274 } else { /* IEEE 802.3 frame */
1275 data_len = len + ETH_HLEN;
1276 data_off = sizeof(tx_control);
1277 p = skb->data;
1278 } 1259 }
1279 1260
1280 memcpy(buf, p, data_len); 1261 memcpy(buf, skb->data, skb->len);
1281 buf += data_len; 1262 buf += skb->len;
1263
1264 if (tx_control & HERMES_TXCTRL_MIC) {
1265 u8 *m = mic;
1266 /* Mic has been offset so it can be copied to an even
1267 * address. We're copying eveything anyway, so we
1268 * don't need to copy that first byte. */
1269 if (skb->len % 2)
1270 m++;
1271 memcpy(buf, m, MICHAEL_MIC_LEN);
1272 buf += MICHAEL_MIC_LEN;
1273 }
1282 1274
1283 /* Finally, we actually initiate the send */ 1275 /* Finally, we actually initiate the send */
1284 netif_stop_queue(dev); 1276 netif_stop_queue(dev);
@@ -1294,20 +1286,23 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1294 if (net_ratelimit()) 1286 if (net_ratelimit())
1295 printk(KERN_ERR "%s: Error %d transmitting packet\n", 1287 printk(KERN_ERR "%s: Error %d transmitting packet\n",
1296 dev->name, err); 1288 dev->name, err);
1297 stats->tx_errors++; 1289 goto busy;
1298 goto fail;
1299 } 1290 }
1300 1291
1301 dev->trans_start = jiffies; 1292 dev->trans_start = jiffies;
1302 stats->tx_bytes += data_off + data_len; 1293 stats->tx_bytes += skb->len;
1294 goto ok;
1303 1295
1304 orinoco_unlock(priv, &flags); 1296 drop:
1297 stats->tx_errors++;
1298 stats->tx_dropped++;
1305 1299
1300 ok:
1301 orinoco_unlock(priv, &flags);
1306 dev_kfree_skb(skb); 1302 dev_kfree_skb(skb);
1307
1308 return NETDEV_TX_OK; 1303 return NETDEV_TX_OK;
1309 1304
1310 fail: 1305 busy:
1311 orinoco_unlock(priv, &flags); 1306 orinoco_unlock(priv, &flags);
1312 return NETDEV_TX_BUSY; 1307 return NETDEV_TX_BUSY;
1313} 1308}
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 743a6c68b29d..d5b197b4d5bb 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -875,7 +875,6 @@ static void p54u_stop(struct ieee80211_hw *dev)
875 the hardware is still usable next time we want to start it. 875 the hardware is still usable next time we want to start it.
876 until then, we just stop listening to the hardware.. */ 876 until then, we just stop listening to the hardware.. */
877 p54u_free_urbs(dev); 877 p54u_free_urbs(dev);
878 return;
879} 878}
880 879
881static int __devinit p54u_probe(struct usb_interface *intf, 880static int __devinit p54u_probe(struct usb_interface *intf,
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index a45818ebfdfb..8d1190c0f062 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -210,8 +210,6 @@ prism54_update_stats(struct work_struct *work)
210 priv->local_iwstatistics.discard.retries = r.u; 210 priv->local_iwstatistics.discard.retries = r.u;
211 211
212 mutex_unlock(&priv->stats_lock); 212 mutex_unlock(&priv->stats_lock);
213
214 return;
215} 213}
216 214
217struct iw_statistics * 215struct iw_statistics *
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index 64585da8a96c..2fc52bc2d7dd 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -224,8 +224,6 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
224 priv->data_low_tx_full = 1; 224 priv->data_low_tx_full = 1;
225 } 225 }
226 226
227 /* set the transmission time */
228 ndev->trans_start = jiffies;
229 ndev->stats.tx_packets++; 227 ndev->stats.tx_packets++;
230 ndev->stats.tx_bytes += skb->len; 228 ndev->stats.tx_bytes += skb->len;
231 229
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index d9c45bfcee61..3886b21becd9 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -735,8 +735,6 @@ static void verify_dl_startup(u_long data)
735 start_net((u_long) local); 735 start_net((u_long) local);
736 else 736 else
737 join_net((u_long) local); 737 join_net((u_long) local);
738
739 return;
740} /* end verify_dl_startup */ 738} /* end verify_dl_startup */
741 739
742/*===========================================================================*/ 740/*===========================================================================*/
@@ -764,7 +762,6 @@ static void start_net(u_long data)
764 return; 762 return;
765 } 763 }
766 local->card_status = CARD_DOING_ACQ; 764 local->card_status = CARD_DOING_ACQ;
767 return;
768} /* end start_net */ 765} /* end start_net */
769 766
770/*===========================================================================*/ 767/*===========================================================================*/
@@ -795,7 +792,6 @@ static void join_net(u_long data)
795 return; 792 return;
796 } 793 }
797 local->card_status = CARD_DOING_ACQ; 794 local->card_status = CARD_DOING_ACQ;
798 return;
799} 795}
800 796
801/*============================================================================ 797/*============================================================================
@@ -941,7 +937,6 @@ static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
941 case XMIT_MSG_BAD: 937 case XMIT_MSG_BAD:
942 case XMIT_OK: 938 case XMIT_OK:
943 default: 939 default:
944 dev->trans_start = jiffies;
945 dev_kfree_skb(skb); 940 dev_kfree_skb(skb);
946 } 941 }
947 942
@@ -1627,7 +1622,6 @@ static int ray_dev_close(struct net_device *dev)
1627static void ray_reset(struct net_device *dev) 1622static void ray_reset(struct net_device *dev)
1628{ 1623{
1629 pr_debug("ray_reset entered\n"); 1624 pr_debug("ray_reset entered\n");
1630 return;
1631} 1625}
1632 1626
1633/*===========================================================================*/ 1627/*===========================================================================*/
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index babdcdf6d71d..2d2890878dea 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -535,7 +535,7 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev,
535 535
536static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev); 536static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev);
537 537
538static int rndis_set_channel(struct wiphy *wiphy, 538static int rndis_set_channel(struct wiphy *wiphy, struct net_device *dev,
539 struct ieee80211_channel *chan, enum nl80211_channel_type channel_type); 539 struct ieee80211_channel *chan, enum nl80211_channel_type channel_type);
540 540
541static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, 541static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev,
@@ -2291,7 +2291,7 @@ static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
2291 return deauthenticate(usbdev); 2291 return deauthenticate(usbdev);
2292} 2292}
2293 2293
2294static int rndis_set_channel(struct wiphy *wiphy, 2294static int rndis_set_channel(struct wiphy *wiphy, struct net_device *netdev,
2295 struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) 2295 struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
2296{ 2296{
2297 struct rndis_wlan_private *priv = wiphy_priv(wiphy); 2297 struct rndis_wlan_private *priv = wiphy_priv(wiphy);
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 06b92f8b7a55..6126c0ab5880 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1060,7 +1060,8 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1060/* 1060/*
1061 * TX data initialization 1061 * TX data initialization
1062 */ 1062 */
1063static void rt2400pci_write_beacon(struct queue_entry *entry) 1063static void rt2400pci_write_beacon(struct queue_entry *entry,
1064 struct txentry_desc *txdesc)
1064{ 1065{
1065 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1066 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1066 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 1067 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
@@ -1090,6 +1091,14 @@ static void rt2400pci_write_beacon(struct queue_entry *entry)
1090 rt2x00_desc_read(entry_priv->desc, 1, &word); 1091 rt2x00_desc_read(entry_priv->desc, 1, &word);
1091 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); 1092 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
1092 rt2x00_desc_write(entry_priv->desc, 1, word); 1093 rt2x00_desc_write(entry_priv->desc, 1, word);
1094
1095 /*
1096 * Enable beaconing again.
1097 */
1098 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
1099 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
1100 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
1101 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1093} 1102}
1094 1103
1095static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1104static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
@@ -1097,17 +1106,6 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1097{ 1106{
1098 u32 reg; 1107 u32 reg;
1099 1108
1100 if (queue == QID_BEACON) {
1101 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1102 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
1103 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
1104 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
1105 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
1106 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1107 }
1108 return;
1109 }
1110
1111 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1109 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1112 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); 1110 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE));
1113 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK)); 1111 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK));
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index ae8e205df269..2e4f461406ae 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1217,7 +1217,8 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1217/* 1217/*
1218 * TX data initialization 1218 * TX data initialization
1219 */ 1219 */
1220static void rt2500pci_write_beacon(struct queue_entry *entry) 1220static void rt2500pci_write_beacon(struct queue_entry *entry,
1221 struct txentry_desc *txdesc)
1221{ 1222{
1222 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1223 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1223 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 1224 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
@@ -1247,6 +1248,14 @@ static void rt2500pci_write_beacon(struct queue_entry *entry)
1247 rt2x00_desc_read(entry_priv->desc, 1, &word); 1248 rt2x00_desc_read(entry_priv->desc, 1, &word);
1248 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); 1249 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
1249 rt2x00_desc_write(entry_priv->desc, 1, word); 1250 rt2x00_desc_write(entry_priv->desc, 1, word);
1251
1252 /*
1253 * Enable beaconing again.
1254 */
1255 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
1256 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
1257 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
1258 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1250} 1259}
1251 1260
1252static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1261static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
@@ -1254,17 +1263,6 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1254{ 1263{
1255 u32 reg; 1264 u32 reg;
1256 1265
1257 if (queue == QID_BEACON) {
1258 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1259 if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
1260 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
1261 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
1262 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
1263 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1264 }
1265 return;
1266 }
1267
1268 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1266 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1269 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); 1267 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue == QID_AC_BE));
1270 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK)); 1268 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue == QID_AC_BK));
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 41d9996c80e6..e88d7033fbc9 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1083,7 +1083,8 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1083 */ 1083 */
1084static void rt2500usb_beacondone(struct urb *urb); 1084static void rt2500usb_beacondone(struct urb *urb);
1085 1085
1086static void rt2500usb_write_beacon(struct queue_entry *entry) 1086static void rt2500usb_write_beacon(struct queue_entry *entry,
1087 struct txentry_desc *txdesc)
1087{ 1088{
1088 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1089 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1089 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 1090 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
@@ -1091,7 +1092,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1091 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 1092 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1092 int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); 1093 int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint);
1093 int length; 1094 int length;
1094 u16 reg; 1095 u16 reg, reg0;
1095 1096
1096 /* 1097 /*
1097 * Add the descriptor in front of the skb. 1098 * Add the descriptor in front of the skb.
@@ -1133,6 +1134,26 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1133 * Send out the guardian byte. 1134 * Send out the guardian byte.
1134 */ 1135 */
1135 usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); 1136 usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC);
1137
1138 /*
1139 * Enable beaconing again.
1140 */
1141 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 1);
1142 rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 1);
1143 reg0 = reg;
1144 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 1);
1145 /*
1146 * Beacon generation will fail initially.
1147 * To prevent this we need to change the TXRX_CSR19
1148 * register several times (reg0 is the same as reg
1149 * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0
1150 * and 1 in reg).
1151 */
1152 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1153 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
1154 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1155 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
1156 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1136} 1157}
1137 1158
1138static int rt2500usb_get_tx_data_len(struct queue_entry *entry) 1159static int rt2500usb_get_tx_data_len(struct queue_entry *entry)
@@ -1149,37 +1170,6 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry)
1149 return length; 1170 return length;
1150} 1171}
1151 1172
1152static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1153 const enum data_queue_qid queue)
1154{
1155 u16 reg, reg0;
1156
1157 if (queue != QID_BEACON) {
1158 rt2x00usb_kick_tx_queue(rt2x00dev, queue);
1159 return;
1160 }
1161
1162 rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg);
1163 if (!rt2x00_get_field16(reg, TXRX_CSR19_BEACON_GEN)) {
1164 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 1);
1165 rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 1);
1166 reg0 = reg;
1167 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 1);
1168 /*
1169 * Beacon generation will fail initially.
1170 * To prevent this we need to change the TXRX_CSR19
1171 * register several times (reg0 is the same as reg
1172 * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0
1173 * and 1 in reg).
1174 */
1175 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1176 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
1177 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1178 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
1179 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
1180 }
1181}
1182
1183/* 1173/*
1184 * RX control handlers 1174 * RX control handlers
1185 */ 1175 */
@@ -1214,11 +1204,9 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1214 if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) 1204 if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR))
1215 rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; 1205 rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC;
1216 1206
1217 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 1207 rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER);
1218 rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); 1208 if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR))
1219 if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) 1209 rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY;
1220 rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY;
1221 }
1222 1210
1223 if (rxdesc->cipher != CIPHER_NONE) { 1211 if (rxdesc->cipher != CIPHER_NONE) {
1224 _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); 1212 _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]);
@@ -1780,7 +1768,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
1780 .write_tx_data = rt2x00usb_write_tx_data, 1768 .write_tx_data = rt2x00usb_write_tx_data,
1781 .write_beacon = rt2500usb_write_beacon, 1769 .write_beacon = rt2500usb_write_beacon,
1782 .get_tx_data_len = rt2500usb_get_tx_data_len, 1770 .get_tx_data_len = rt2500usb_get_tx_data_len,
1783 .kick_tx_queue = rt2500usb_kick_tx_queue, 1771 .kick_tx_queue = rt2x00usb_kick_tx_queue,
1784 .kill_tx_queue = rt2x00usb_kill_tx_queue, 1772 .kill_tx_queue = rt2x00usb_kill_tx_queue,
1785 .fill_rxdone = rt2500usb_fill_rxdone, 1773 .fill_rxdone = rt2500usb_fill_rxdone,
1786 .config_shared_key = rt2500usb_config_key, 1774 .config_shared_key = rt2500usb_config_key,
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index e37bbeab9233..db4250d1c8b3 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -282,6 +282,104 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
282} 282}
283EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); 283EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready);
284 284
285void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc)
286{
287 __le32 *txwi = (__le32 *)(skb->data - TXWI_DESC_SIZE);
288 u32 word;
289
290 /*
291 * Initialize TX Info descriptor
292 */
293 rt2x00_desc_read(txwi, 0, &word);
294 rt2x00_set_field32(&word, TXWI_W0_FRAG,
295 test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
296 rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0);
297 rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0);
298 rt2x00_set_field32(&word, TXWI_W0_TS,
299 test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
300 rt2x00_set_field32(&word, TXWI_W0_AMPDU,
301 test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags));
302 rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density);
303 rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop);
304 rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs);
305 rt2x00_set_field32(&word, TXWI_W0_BW,
306 test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags));
307 rt2x00_set_field32(&word, TXWI_W0_SHORT_GI,
308 test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags));
309 rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc);
310 rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode);
311 rt2x00_desc_write(txwi, 0, word);
312
313 rt2x00_desc_read(txwi, 1, &word);
314 rt2x00_set_field32(&word, TXWI_W1_ACK,
315 test_bit(ENTRY_TXD_ACK, &txdesc->flags));
316 rt2x00_set_field32(&word, TXWI_W1_NSEQ,
317 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
318 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
319 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
320 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
321 txdesc->key_idx : 0xff);
322 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
323 txdesc->length);
324 rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->queue + 1);
325 rt2x00_desc_write(txwi, 1, word);
326
327 /*
328 * Always write 0 to IV/EIV fields, hardware will insert the IV
329 * from the IVEIV register when TXD_W3_WIV is set to 0.
330 * When TXD_W3_WIV is set to 1 it will use the IV data
331 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
332 * crypto entry in the registers should be used to encrypt the frame.
333 */
334 _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
335 _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
336}
337EXPORT_SYMBOL_GPL(rt2800_write_txwi);
338
339void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *rxdesc)
340{
341 __le32 *rxwi = (__le32 *) skb->data;
342 u32 word;
343
344 rt2x00_desc_read(rxwi, 0, &word);
345
346 rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF);
347 rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
348
349 rt2x00_desc_read(rxwi, 1, &word);
350
351 if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI))
352 rxdesc->flags |= RX_FLAG_SHORT_GI;
353
354 if (rt2x00_get_field32(word, RXWI_W1_BW))
355 rxdesc->flags |= RX_FLAG_40MHZ;
356
357 /*
358 * Detect RX rate, always use MCS as signal type.
359 */
360 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS;
361 rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS);
362 rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE);
363
364 /*
365 * Mask of 0x8 bit to remove the short preamble flag.
366 */
367 if (rxdesc->rate_mode == RATE_MODE_CCK)
368 rxdesc->signal &= ~0x8;
369
370 rt2x00_desc_read(rxwi, 2, &word);
371
372 rxdesc->rssi =
373 (rt2x00_get_field32(word, RXWI_W2_RSSI0) +
374 rt2x00_get_field32(word, RXWI_W2_RSSI1)) / 2;
375
376 /*
377 * Remove RXWI descriptor from start of buffer.
378 */
379 skb_pull(skb, RXWI_DESC_SIZE);
380}
381EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
382
285#ifdef CONFIG_RT2X00_LIB_DEBUGFS 383#ifdef CONFIG_RT2X00_LIB_DEBUGFS
286const struct rt2x00debug rt2800_rt2x00debug = { 384const struct rt2x00debug rt2800_rt2x00debug = {
287 .owner = THIS_MODULE, 385 .owner = THIS_MODULE,
@@ -640,8 +738,6 @@ void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp)
640 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); 738 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg);
641 739
642 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg); 740 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg);
643 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs);
644 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs);
645 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs); 741 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs);
646 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); 742 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg);
647 743
@@ -1415,9 +1511,16 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1415 1511
1416 rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); 1512 rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca);
1417 1513
1514 /*
1515 * Usually the CCK SIFS time should be set to 10 and the OFDM SIFS
1516 * time should be set to 16. However, the original Ralink driver uses
1517 * 16 for both and indeed using a value of 10 for CCK SIFS results in
1518 * connection problems with 11g + CTS protection. Hence, use the same
1519 * defaults as the Ralink driver: 16 for both, CCK and OFDM SIFS.
1520 */
1418 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg); 1521 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg);
1419 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, 32); 1522 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, 16);
1420 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, 32); 1523 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, 16);
1421 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); 1524 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4);
1422 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, 314); 1525 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, 314);
1423 rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); 1526 rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1);
@@ -2219,7 +2322,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
2219EXPORT_SYMBOL_GPL(rt2800_init_eeprom); 2322EXPORT_SYMBOL_GPL(rt2800_init_eeprom);
2220 2323
2221/* 2324/*
2222 * RF value list for rt28x0 2325 * RF value list for rt28xx
2223 * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) 2326 * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
2224 */ 2327 */
2225static const struct rf_channel rf_vals[] = { 2328static const struct rf_channel rf_vals[] = {
@@ -2294,10 +2397,10 @@ static const struct rf_channel rf_vals[] = {
2294}; 2397};
2295 2398
2296/* 2399/*
2297 * RF value list for rt3070 2400 * RF value list for rt3xxx
2298 * Supports: 2.4 GHz 2401 * Supports: 2.4 GHz (all) & 5.2 GHz (RF3052)
2299 */ 2402 */
2300static const struct rf_channel rf_vals_302x[] = { 2403static const struct rf_channel rf_vals_3x[] = {
2301 {1, 241, 2, 2 }, 2404 {1, 241, 2, 2 },
2302 {2, 241, 2, 7 }, 2405 {2, 241, 2, 7 },
2303 {3, 242, 2, 2 }, 2406 {3, 242, 2, 2 },
@@ -2312,6 +2415,51 @@ static const struct rf_channel rf_vals_302x[] = {
2312 {12, 246, 2, 7 }, 2415 {12, 246, 2, 7 },
2313 {13, 247, 2, 2 }, 2416 {13, 247, 2, 2 },
2314 {14, 248, 2, 4 }, 2417 {14, 248, 2, 4 },
2418
2419 /* 802.11 UNI / HyperLan 2 */
2420 {36, 0x56, 0, 4},
2421 {38, 0x56, 0, 6},
2422 {40, 0x56, 0, 8},
2423 {44, 0x57, 0, 0},
2424 {46, 0x57, 0, 2},
2425 {48, 0x57, 0, 4},
2426 {52, 0x57, 0, 8},
2427 {54, 0x57, 0, 10},
2428 {56, 0x58, 0, 0},
2429 {60, 0x58, 0, 4},
2430 {62, 0x58, 0, 6},
2431 {64, 0x58, 0, 8},
2432
2433 /* 802.11 HyperLan 2 */
2434 {100, 0x5b, 0, 8},
2435 {102, 0x5b, 0, 10},
2436 {104, 0x5c, 0, 0},
2437 {108, 0x5c, 0, 4},
2438 {110, 0x5c, 0, 6},
2439 {112, 0x5c, 0, 8},
2440 {116, 0x5d, 0, 0},
2441 {118, 0x5d, 0, 2},
2442 {120, 0x5d, 0, 4},
2443 {124, 0x5d, 0, 8},
2444 {126, 0x5d, 0, 10},
2445 {128, 0x5e, 0, 0},
2446 {132, 0x5e, 0, 4},
2447 {134, 0x5e, 0, 6},
2448 {136, 0x5e, 0, 8},
2449 {140, 0x5f, 0, 0},
2450
2451 /* 802.11 UNII */
2452 {149, 0x5f, 0, 9},
2453 {151, 0x5f, 0, 11},
2454 {153, 0x60, 0, 1},
2455 {157, 0x60, 0, 5},
2456 {159, 0x60, 0, 7},
2457 {161, 0x60, 0, 9},
2458 {165, 0x61, 0, 1},
2459 {167, 0x61, 0, 3},
2460 {169, 0x61, 0, 5},
2461 {171, 0x61, 0, 7},
2462 {173, 0x61, 0, 9},
2315}; 2463};
2316 2464
2317int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) 2465int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
@@ -2352,11 +2500,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2352 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 2500 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
2353 2501
2354 if (rt2x00_rf(rt2x00dev, RF2820) || 2502 if (rt2x00_rf(rt2x00dev, RF2820) ||
2355 rt2x00_rf(rt2x00dev, RF2720) || 2503 rt2x00_rf(rt2x00dev, RF2720)) {
2356 rt2x00_rf(rt2x00dev, RF3052)) {
2357 spec->num_channels = 14; 2504 spec->num_channels = 14;
2358 spec->channels = rf_vals; 2505 spec->channels = rf_vals;
2359 } else if (rt2x00_rf(rt2x00dev, RF2850) || rt2x00_rf(rt2x00dev, RF2750)) { 2506 } else if (rt2x00_rf(rt2x00dev, RF2850) ||
2507 rt2x00_rf(rt2x00dev, RF2750)) {
2360 spec->supported_bands |= SUPPORT_BAND_5GHZ; 2508 spec->supported_bands |= SUPPORT_BAND_5GHZ;
2361 spec->num_channels = ARRAY_SIZE(rf_vals); 2509 spec->num_channels = ARRAY_SIZE(rf_vals);
2362 spec->channels = rf_vals; 2510 spec->channels = rf_vals;
@@ -2364,8 +2512,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2364 rt2x00_rf(rt2x00dev, RF2020) || 2512 rt2x00_rf(rt2x00dev, RF2020) ||
2365 rt2x00_rf(rt2x00dev, RF3021) || 2513 rt2x00_rf(rt2x00dev, RF3021) ||
2366 rt2x00_rf(rt2x00dev, RF3022)) { 2514 rt2x00_rf(rt2x00dev, RF3022)) {
2367 spec->num_channels = ARRAY_SIZE(rf_vals_302x); 2515 spec->num_channels = 14;
2368 spec->channels = rf_vals_302x; 2516 spec->channels = rf_vals_3x;
2517 } else if (rt2x00_rf(rt2x00dev, RF3052)) {
2518 spec->supported_bands |= SUPPORT_BAND_5GHZ;
2519 spec->num_channels = ARRAY_SIZE(rf_vals_3x);
2520 spec->channels = rf_vals_3x;
2369 } 2521 }
2370 2522
2371 /* 2523 /*
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index ebabeae62d1b..94de999e2290 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -111,6 +111,9 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
111 const u8 command, const u8 token, 111 const u8 command, const u8 token,
112 const u8 arg0, const u8 arg1); 112 const u8 arg0, const u8 arg1);
113 113
114void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc);
115void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *txdesc);
116
114extern const struct rt2x00debug rt2800_rt2x00debug; 117extern const struct rt2x00debug rt2800_rt2x00debug;
115 118
116int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); 119int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index f08b6a37bf2d..7d4778d66e77 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -616,67 +616,13 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,
616static int rt2800pci_write_tx_data(struct queue_entry* entry, 616static int rt2800pci_write_tx_data(struct queue_entry* entry,
617 struct txentry_desc *txdesc) 617 struct txentry_desc *txdesc)
618{ 618{
619 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
620 struct sk_buff *skb = entry->skb;
621 struct skb_frame_desc *skbdesc;
622 int ret; 619 int ret;
623 __le32 *txwi;
624 u32 word;
625 620
626 ret = rt2x00pci_write_tx_data(entry, txdesc); 621 ret = rt2x00pci_write_tx_data(entry, txdesc);
627 if (ret) 622 if (ret)
628 return ret; 623 return ret;
629 624
630 skbdesc = get_skb_frame_desc(skb); 625 rt2800_write_txwi(entry->skb, txdesc);
631 txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom);
632
633 /*
634 * Initialize TX Info descriptor
635 */
636 rt2x00_desc_read(txwi, 0, &word);
637 rt2x00_set_field32(&word, TXWI_W0_FRAG,
638 test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
639 rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0);
640 rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0);
641 rt2x00_set_field32(&word, TXWI_W0_TS,
642 test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
643 rt2x00_set_field32(&word, TXWI_W0_AMPDU,
644 test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags));
645 rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density);
646 rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs);
647 rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs);
648 rt2x00_set_field32(&word, TXWI_W0_BW,
649 test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags));
650 rt2x00_set_field32(&word, TXWI_W0_SHORT_GI,
651 test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags));
652 rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc);
653 rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode);
654 rt2x00_desc_write(txwi, 0, word);
655
656 rt2x00_desc_read(txwi, 1, &word);
657 rt2x00_set_field32(&word, TXWI_W1_ACK,
658 test_bit(ENTRY_TXD_ACK, &txdesc->flags));
659 rt2x00_set_field32(&word, TXWI_W1_NSEQ,
660 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
661 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
662 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
663 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
664 txdesc->key_idx : 0xff);
665 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
666 txdesc->length);
667 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
668 skbdesc->entry->queue->qid + 1);
669 rt2x00_desc_write(txwi, 1, word);
670
671 /*
672 * Always write 0 to IV/EIV fields, hardware will insert the IV
673 * from the IVEIV register when TXD_W3_WIV is set to 0.
674 * When TXD_W3_WIV is set to 1 it will use the IV data
675 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
676 * crypto entry in the registers should be used to encrypt the frame.
677 */
678 _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
679 _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
680 626
681 return 0; 627 return 0;
682} 628}
@@ -732,10 +678,10 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
732/* 678/*
733 * TX data initialization 679 * TX data initialization
734 */ 680 */
735static void rt2800pci_write_beacon(struct queue_entry *entry) 681static void rt2800pci_write_beacon(struct queue_entry *entry,
682 struct txentry_desc *txdesc)
736{ 683{
737 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 684 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
738 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
739 unsigned int beacon_base; 685 unsigned int beacon_base;
740 u32 reg; 686 u32 reg;
741 687
@@ -748,15 +694,25 @@ static void rt2800pci_write_beacon(struct queue_entry *entry)
748 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 694 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
749 695
750 /* 696 /*
751 * Write entire beacon with descriptor to register. 697 * Add the TXWI for the beacon to the skb.
698 */
699 rt2800_write_txwi(entry->skb, txdesc);
700 skb_push(entry->skb, TXWI_DESC_SIZE);
701
702 /*
703 * Write entire beacon with TXWI to register.
752 */ 704 */
753 beacon_base = HW_BEACON_OFFSET(entry->entry_idx); 705 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
754 rt2800_register_multiwrite(rt2x00dev, 706 rt2800_register_multiwrite(rt2x00dev, beacon_base,
755 beacon_base, 707 entry->skb->data, entry->skb->len);
756 skbdesc->desc, skbdesc->desc_len); 708
757 rt2800_register_multiwrite(rt2x00dev, 709 /*
758 beacon_base + skbdesc->desc_len, 710 * Enable beaconing again.
759 entry->skb->data, entry->skb->len); 711 */
712 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
713 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
714 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
715 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
760 716
761 /* 717 /*
762 * Clean up beacon skb. 718 * Clean up beacon skb.
@@ -770,18 +726,6 @@ static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
770{ 726{
771 struct data_queue *queue; 727 struct data_queue *queue;
772 unsigned int idx, qidx = 0; 728 unsigned int idx, qidx = 0;
773 u32 reg;
774
775 if (queue_idx == QID_BEACON) {
776 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
777 if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) {
778 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
779 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
780 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
781 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
782 }
783 return;
784 }
785 729
786 if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) 730 if (queue_idx > QID_HCCA && queue_idx != QID_MGMT)
787 return; 731 return;
@@ -824,34 +768,21 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry,
824 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 768 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
825 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 769 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
826 __le32 *rxd = entry_priv->desc; 770 __le32 *rxd = entry_priv->desc;
827 __le32 *rxwi = (__le32 *)entry->skb->data; 771 u32 word;
828 u32 rxd3; 772
829 u32 rxwi0; 773 rt2x00_desc_read(rxd, 3, &word);
830 u32 rxwi1; 774
831 u32 rxwi2; 775 if (rt2x00_get_field32(word, RXD_W3_CRC_ERROR))
832 u32 rxwi3;
833
834 rt2x00_desc_read(rxd, 3, &rxd3);
835 rt2x00_desc_read(rxwi, 0, &rxwi0);
836 rt2x00_desc_read(rxwi, 1, &rxwi1);
837 rt2x00_desc_read(rxwi, 2, &rxwi2);
838 rt2x00_desc_read(rxwi, 3, &rxwi3);
839
840 if (rt2x00_get_field32(rxd3, RXD_W3_CRC_ERROR))
841 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 776 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
842 777
843 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 778 /*
844 /* 779 * Unfortunately we don't know the cipher type used during
845 * Unfortunately we don't know the cipher type used during 780 * decryption. This prevents us from correct providing
846 * decryption. This prevents us from correct providing 781 * correct statistics through debugfs.
847 * correct statistics through debugfs. 782 */
848 */ 783 rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W3_CIPHER_ERROR);
849 rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
850 rxdesc->cipher_status =
851 rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR);
852 }
853 784
854 if (rt2x00_get_field32(rxd3, RXD_W3_DECRYPTED)) { 785 if (rt2x00_get_field32(word, RXD_W3_DECRYPTED)) {
855 /* 786 /*
856 * Hardware has stripped IV/EIV data from 802.11 frame during 787 * Hardware has stripped IV/EIV data from 802.11 frame during
857 * decryption. Unfortunately the descriptor doesn't contain 788 * decryption. Unfortunately the descriptor doesn't contain
@@ -866,47 +797,22 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry,
866 rxdesc->flags |= RX_FLAG_MMIC_ERROR; 797 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
867 } 798 }
868 799
869 if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) 800 if (rt2x00_get_field32(word, RXD_W3_MY_BSS))
870 rxdesc->dev_flags |= RXDONE_MY_BSS; 801 rxdesc->dev_flags |= RXDONE_MY_BSS;
871 802
872 if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) 803 if (rt2x00_get_field32(word, RXD_W3_L2PAD))
873 rxdesc->dev_flags |= RXDONE_L2PAD; 804 rxdesc->dev_flags |= RXDONE_L2PAD;
874 805
875 if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
876 rxdesc->flags |= RX_FLAG_SHORT_GI;
877
878 if (rt2x00_get_field32(rxwi1, RXWI_W1_BW))
879 rxdesc->flags |= RX_FLAG_40MHZ;
880
881 /*
882 * Detect RX rate, always use MCS as signal type.
883 */
884 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS;
885 rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE);
886 rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS);
887
888 /* 806 /*
889 * Mask of 0x8 bit to remove the short preamble flag. 807 * Process the RXWI structure that is at the start of the buffer.
890 */ 808 */
891 if (rxdesc->rate_mode == RATE_MODE_CCK) 809 rt2800_process_rxwi(entry->skb, rxdesc);
892 rxdesc->signal &= ~0x8;
893
894 rxdesc->rssi =
895 (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) +
896 rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2;
897
898 rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
899 810
900 /* 811 /*
901 * Set RX IDX in register to inform hardware that we have handled 812 * Set RX IDX in register to inform hardware that we have handled
902 * this entry and it is available for reuse again. 813 * this entry and it is available for reuse again.
903 */ 814 */
904 rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); 815 rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx);
905
906 /*
907 * Remove TXWI descriptor from start of buffer.
908 */
909 skb_pull(entry->skb, RXWI_DESC_SIZE);
910} 816}
911 817
912/* 818/*
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index e3f3a97db807..8ad0669a1b99 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -401,59 +401,15 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
401{ 401{
402 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 402 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
403 __le32 *txi = skbdesc->desc; 403 __le32 *txi = skbdesc->desc;
404 __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)];
405 u32 word; 404 u32 word;
406 405
407 /* 406 /*
408 * Initialize TX Info descriptor 407 * Initialize TXWI descriptor
409 */ 408 */
410 rt2x00_desc_read(txwi, 0, &word); 409 rt2800_write_txwi(skb, txdesc);
411 rt2x00_set_field32(&word, TXWI_W0_FRAG,
412 test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
413 rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0);
414 rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0);
415 rt2x00_set_field32(&word, TXWI_W0_TS,
416 test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
417 rt2x00_set_field32(&word, TXWI_W0_AMPDU,
418 test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags));
419 rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density);
420 rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs);
421 rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs);
422 rt2x00_set_field32(&word, TXWI_W0_BW,
423 test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags));
424 rt2x00_set_field32(&word, TXWI_W0_SHORT_GI,
425 test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags));
426 rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc);
427 rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode);
428 rt2x00_desc_write(txwi, 0, word);
429
430 rt2x00_desc_read(txwi, 1, &word);
431 rt2x00_set_field32(&word, TXWI_W1_ACK,
432 test_bit(ENTRY_TXD_ACK, &txdesc->flags));
433 rt2x00_set_field32(&word, TXWI_W1_NSEQ,
434 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
435 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
436 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
437 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
438 txdesc->key_idx : 0xff);
439 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
440 txdesc->length);
441 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
442 skbdesc->entry->queue->qid + 1);
443 rt2x00_desc_write(txwi, 1, word);
444 410
445 /* 411 /*
446 * Always write 0 to IV/EIV fields, hardware will insert the IV 412 * Initialize TXINFO descriptor
447 * from the IVEIV register when TXINFO_W0_WIV is set to 0.
448 * When TXINFO_W0_WIV is set to 1 it will use the IV data
449 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
450 * crypto entry in the registers should be used to encrypt the frame.
451 */
452 _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
453 _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
454
455 /*
456 * Initialize TX descriptor
457 */ 413 */
458 rt2x00_desc_read(txi, 0, &word); 414 rt2x00_desc_read(txi, 0, &word);
459 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, 415 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
@@ -471,21 +427,14 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
471/* 427/*
472 * TX data initialization 428 * TX data initialization
473 */ 429 */
474static void rt2800usb_write_beacon(struct queue_entry *entry) 430static void rt2800usb_write_beacon(struct queue_entry *entry,
431 struct txentry_desc *txdesc)
475{ 432{
476 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 433 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
477 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
478 unsigned int beacon_base; 434 unsigned int beacon_base;
479 u32 reg; 435 u32 reg;
480 436
481 /* 437 /*
482 * Add the descriptor in front of the skb.
483 */
484 skb_push(entry->skb, entry->queue->desc_size);
485 memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len);
486 skbdesc->desc = entry->skb->data;
487
488 /*
489 * Disable beaconing while we are reloading the beacon data, 438 * Disable beaconing while we are reloading the beacon data,
490 * otherwise we might be sending out invalid data. 439 * otherwise we might be sending out invalid data.
491 */ 440 */
@@ -494,6 +443,12 @@ static void rt2800usb_write_beacon(struct queue_entry *entry)
494 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 443 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
495 444
496 /* 445 /*
446 * Add the TXWI for the beacon to the skb.
447 */
448 rt2800_write_txwi(entry->skb, txdesc);
449 skb_push(entry->skb, TXWI_DESC_SIZE);
450
451 /*
497 * Write entire beacon with descriptor to register. 452 * Write entire beacon with descriptor to register.
498 */ 453 */
499 beacon_base = HW_BEACON_OFFSET(entry->entry_idx); 454 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
@@ -503,6 +458,14 @@ static void rt2800usb_write_beacon(struct queue_entry *entry)
503 REGISTER_TIMEOUT32(entry->skb->len)); 458 REGISTER_TIMEOUT32(entry->skb->len));
504 459
505 /* 460 /*
461 * Enable beaconing again.
462 */
463 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
464 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
465 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
466 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
467
468 /*
506 * Clean up the beacon skb. 469 * Clean up the beacon skb.
507 */ 470 */
508 dev_kfree_skb(entry->skb); 471 dev_kfree_skb(entry->skb);
@@ -524,84 +487,53 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
524 return length; 487 return length;
525} 488}
526 489
527static void rt2800usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
528 const enum data_queue_qid queue)
529{
530 u32 reg;
531
532 if (queue != QID_BEACON) {
533 rt2x00usb_kick_tx_queue(rt2x00dev, queue);
534 return;
535 }
536
537 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
538 if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) {
539 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
540 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
541 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
542 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
543 }
544}
545
546/* 490/*
547 * RX control handlers 491 * RX control handlers
548 */ 492 */
549static void rt2800usb_fill_rxdone(struct queue_entry *entry, 493static void rt2800usb_fill_rxdone(struct queue_entry *entry,
550 struct rxdone_entry_desc *rxdesc) 494 struct rxdone_entry_desc *rxdesc)
551{ 495{
552 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
553 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 496 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
554 __le32 *rxi = (__le32 *)entry->skb->data; 497 __le32 *rxi = (__le32 *)entry->skb->data;
555 __le32 *rxwi;
556 __le32 *rxd; 498 __le32 *rxd;
557 u32 rxi0; 499 u32 word;
558 u32 rxwi0;
559 u32 rxwi1;
560 u32 rxwi2;
561 u32 rxwi3;
562 u32 rxd0;
563 int rx_pkt_len; 500 int rx_pkt_len;
564 501
565 /* 502 /*
503 * Copy descriptor to the skbdesc->desc buffer, making it safe from
504 * moving of frame data in rt2x00usb.
505 */
506 memcpy(skbdesc->desc, rxi, skbdesc->desc_len);
507
508 /*
566 * RX frame format is : 509 * RX frame format is :
567 * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | 510 * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad |
568 * |<------------ rx_pkt_len -------------->| 511 * |<------------ rx_pkt_len -------------->|
569 */ 512 */
570 rt2x00_desc_read(rxi, 0, &rxi0); 513 rt2x00_desc_read(rxi, 0, &word);
571 rx_pkt_len = rt2x00_get_field32(rxi0, RXINFO_W0_USB_DMA_RX_PKT_LEN); 514 rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN);
572
573 rxwi = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE);
574 515
575 /* 516 /*
576 * FIXME : we need to check for rx_pkt_len validity 517 * Remove the RXINFO structure from the sbk.
577 */ 518 */
578 rxd = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE + rx_pkt_len); 519 skb_pull(entry->skb, RXINFO_DESC_SIZE);
579 520
580 /* 521 /*
581 * Copy descriptor to the skbdesc->desc buffer, making it safe from 522 * FIXME: we need to check for rx_pkt_len validity
582 * moving of frame data in rt2x00usb.
583 */ 523 */
584 memcpy(skbdesc->desc, rxi, skbdesc->desc_len); 524 rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
585 525
586 /* 526 /*
587 * It is now safe to read the descriptor on all architectures. 527 * It is now safe to read the descriptor on all architectures.
588 */ 528 */
589 rt2x00_desc_read(rxwi, 0, &rxwi0); 529 rt2x00_desc_read(rxd, 0, &word);
590 rt2x00_desc_read(rxwi, 1, &rxwi1);
591 rt2x00_desc_read(rxwi, 2, &rxwi2);
592 rt2x00_desc_read(rxwi, 3, &rxwi3);
593 rt2x00_desc_read(rxd, 0, &rxd0);
594 530
595 if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR)) 531 if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR))
596 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 532 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
597 533
598 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 534 rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR);
599 rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
600 rxdesc->cipher_status =
601 rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
602 }
603 535
604 if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) { 536 if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) {
605 /* 537 /*
606 * Hardware has stripped IV/EIV data from 802.11 frame during 538 * Hardware has stripped IV/EIV data from 802.11 frame during
607 * decryption. Unfortunately the descriptor doesn't contain 539 * decryption. Unfortunately the descriptor doesn't contain
@@ -616,41 +548,21 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
616 rxdesc->flags |= RX_FLAG_MMIC_ERROR; 548 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
617 } 549 }
618 550
619 if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS)) 551 if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
620 rxdesc->dev_flags |= RXDONE_MY_BSS; 552 rxdesc->dev_flags |= RXDONE_MY_BSS;
621 553
622 if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) 554 if (rt2x00_get_field32(word, RXD_W0_L2PAD))
623 rxdesc->dev_flags |= RXDONE_L2PAD; 555 rxdesc->dev_flags |= RXDONE_L2PAD;
624 556
625 if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
626 rxdesc->flags |= RX_FLAG_SHORT_GI;
627
628 if (rt2x00_get_field32(rxwi1, RXWI_W1_BW))
629 rxdesc->flags |= RX_FLAG_40MHZ;
630
631 /* 557 /*
632 * Detect RX rate, always use MCS as signal type. 558 * Remove RXD descriptor from end of buffer.
633 */ 559 */
634 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; 560 skb_trim(entry->skb, rx_pkt_len);
635 rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE);
636 rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS);
637
638 /*
639 * Mask of 0x8 bit to remove the short preamble flag.
640 */
641 if (rxdesc->rate_mode == RATE_MODE_CCK)
642 rxdesc->signal &= ~0x8;
643
644 rxdesc->rssi =
645 (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) +
646 rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2;
647
648 rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
649 561
650 /* 562 /*
651 * Remove RXWI descriptor from start of buffer. 563 * Process the RXWI structure.
652 */ 564 */
653 skb_pull(entry->skb, skbdesc->desc_len); 565 rt2800_process_rxwi(entry->skb, rxdesc);
654} 566}
655 567
656/* 568/*
@@ -743,7 +655,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
743 .write_tx_data = rt2x00usb_write_tx_data, 655 .write_tx_data = rt2x00usb_write_tx_data,
744 .write_beacon = rt2800usb_write_beacon, 656 .write_beacon = rt2800usb_write_beacon,
745 .get_tx_data_len = rt2800usb_get_tx_data_len, 657 .get_tx_data_len = rt2800usb_get_tx_data_len,
746 .kick_tx_queue = rt2800usb_kick_tx_queue, 658 .kick_tx_queue = rt2x00usb_kick_tx_queue,
747 .kill_tx_queue = rt2x00usb_kill_tx_queue, 659 .kill_tx_queue = rt2x00usb_kill_tx_queue,
748 .fill_rxdone = rt2800usb_fill_rxdone, 660 .fill_rxdone = rt2800usb_fill_rxdone,
749 .config_shared_key = rt2800_config_shared_key, 661 .config_shared_key = rt2800_config_shared_key,
@@ -841,7 +753,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
841 { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, 753 { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) },
842 { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, 754 { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) },
843 /* EnGenius */ 755 /* EnGenius */
844 { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, 756 { USB_DEVICE(0x1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) },
845 { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, 757 { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) },
846 /* Gigabyte */ 758 /* Gigabyte */
847 { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, 759 { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) },
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h
index d1d8ae94b4d4..2bca6a71a7f5 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.h
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
@@ -79,8 +79,6 @@
79 */ 79 */
80#define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) 80#define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) )
81#define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) 81#define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) )
82#define RXWI_DESC_SIZE ( 4 * sizeof(__le32) )
83#define RXD_DESC_SIZE ( 1 * sizeof(__le32) )
84 82
85/* 83/*
86 * TX Info structure 84 * TX Info structure
@@ -113,44 +111,6 @@
113#define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) 111#define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff)
114 112
115/* 113/*
116 * RX WI structure
117 */
118
119/*
120 * Word0
121 */
122#define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff)
123#define RXWI_W0_KEY_INDEX FIELD32(0x00000300)
124#define RXWI_W0_BSSID FIELD32(0x00001c00)
125#define RXWI_W0_UDF FIELD32(0x0000e000)
126#define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
127#define RXWI_W0_TID FIELD32(0xf0000000)
128
129/*
130 * Word1
131 */
132#define RXWI_W1_FRAG FIELD32(0x0000000f)
133#define RXWI_W1_SEQUENCE FIELD32(0x0000fff0)
134#define RXWI_W1_MCS FIELD32(0x007f0000)
135#define RXWI_W1_BW FIELD32(0x00800000)
136#define RXWI_W1_SHORT_GI FIELD32(0x01000000)
137#define RXWI_W1_STBC FIELD32(0x06000000)
138#define RXWI_W1_PHYMODE FIELD32(0xc0000000)
139
140/*
141 * Word2
142 */
143#define RXWI_W2_RSSI0 FIELD32(0x000000ff)
144#define RXWI_W2_RSSI1 FIELD32(0x0000ff00)
145#define RXWI_W2_RSSI2 FIELD32(0x00ff0000)
146
147/*
148 * Word3
149 */
150#define RXWI_W3_SNR0 FIELD32(0x000000ff)
151#define RXWI_W3_SNR1 FIELD32(0x0000ff00)
152
153/*
154 * RX descriptor format for RX Ring. 114 * RX descriptor format for RX Ring.
155 */ 115 */
156 116
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 4f9b666f7a7f..6c1ff4c15c84 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -551,7 +551,8 @@ struct rt2x00lib_ops {
551 struct txentry_desc *txdesc); 551 struct txentry_desc *txdesc);
552 int (*write_tx_data) (struct queue_entry *entry, 552 int (*write_tx_data) (struct queue_entry *entry,
553 struct txentry_desc *txdesc); 553 struct txentry_desc *txdesc);
554 void (*write_beacon) (struct queue_entry *entry); 554 void (*write_beacon) (struct queue_entry *entry,
555 struct txentry_desc *txdesc);
555 int (*get_tx_data_len) (struct queue_entry *entry); 556 int (*get_tx_data_len) (struct queue_entry *entry);
556 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 557 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
557 const enum data_queue_qid queue); 558 const enum data_queue_qid queue);
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c
index d291c7862e10..583dacd8d241 100644
--- a/drivers/net/wireless/rt2x00/rt2x00crypto.c
+++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c
@@ -128,6 +128,7 @@ void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, struct txentry_desc *txdesc)
128 128
129 /* Pull buffer to correct size */ 129 /* Pull buffer to correct size */
130 skb_pull(skb, txdesc->iv_len); 130 skb_pull(skb, txdesc->iv_len);
131 txdesc->length -= txdesc->iv_len;
131 132
132 /* IV/EIV data has officially been stripped */ 133 /* IV/EIV data has officially been stripped */
133 skbdesc->flags |= SKBDESC_IV_STRIPPED; 134 skbdesc->flags |= SKBDESC_IV_STRIPPED;
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index 9569fb4e5bc5..e2497f820d75 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -700,8 +700,6 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
700exit: 700exit:
701 rt2x00debug_deregister(rt2x00dev); 701 rt2x00debug_deregister(rt2x00dev);
702 ERROR(rt2x00dev, "Failed to register debug handler.\n"); 702 ERROR(rt2x00dev, "Failed to register debug handler.\n");
703
704 return;
705} 703}
706 704
707void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) 705void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
index 1056c92143a8..5a407602ce3e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00ht.c
+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
@@ -35,6 +35,7 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
35{ 35{
36 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 36 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
37 struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; 37 struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
38 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
38 39
39 if (tx_info->control.sta) 40 if (tx_info->control.sta)
40 txdesc->mpdu_density = 41 txdesc->mpdu_density =
@@ -66,4 +67,20 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
66 __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); 67 __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags);
67 if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) 68 if (txrate->flags & IEEE80211_TX_RC_SHORT_GI)
68 __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); 69 __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags);
70
71 /*
72 * Determine IFS values
73 * - Use TXOP_BACKOFF for management frames
74 * - Use TXOP_SIFS for fragment bursts
75 * - Use TXOP_HTTXOP for everything else
76 *
77 * Note: rt2800 devices won't use CTS protection (if used)
78 * for frames not transmitted with TXOP_HTTXOP
79 */
80 if (ieee80211_is_mgmt(hdr->frame_control))
81 txdesc->txop = TXOP_BACKOFF;
82 else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT))
83 txdesc->txop = TXOP_SIFS;
84 else
85 txdesc->txop = TXOP_HTTXOP;
69} 86}
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index e22029fcf411..089a12c7b90f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -429,20 +429,23 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
429 * it is now ready to be dumped to userspace through debugfs. 429 * it is now ready to be dumped to userspace through debugfs.
430 */ 430 */
431 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); 431 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb);
432}
433
434static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
435 struct txentry_desc *txdesc)
436{
437 struct data_queue *queue = entry->queue;
438 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
432 439
433 /* 440 /*
434 * Check if we need to kick the queue, there are however a few rules 441 * Check if we need to kick the queue, there are however a few rules
435 * 1) Don't kick beacon queue 442 * 1) Don't kick unless this is the last in frame in a burst.
436 * 2) Don't kick unless this is the last in frame in a burst.
437 * When the burst flag is set, this frame is always followed 443 * When the burst flag is set, this frame is always followed
438 * by another frame which in some way are related to eachother. 444 * by another frame which in some way are related to eachother.
439 * This is true for fragments, RTS or CTS-to-self frames. 445 * This is true for fragments, RTS or CTS-to-self frames.
440 * 3) Rule 2 can be broken when the available entries 446 * 2) Rule 1 can be broken when the available entries
441 * in the queue are less then a certain threshold. 447 * in the queue are less then a certain threshold.
442 */ 448 */
443 if (entry->queue->qid == QID_BEACON)
444 return;
445
446 if (rt2x00queue_threshold(queue) || 449 if (rt2x00queue_threshold(queue) ||
447 !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) 450 !test_bit(ENTRY_TXD_BURST, &txdesc->flags))
448 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); 451 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid);
@@ -538,6 +541,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
538 541
539 rt2x00queue_index_inc(queue, Q_INDEX); 542 rt2x00queue_index_inc(queue, Q_INDEX);
540 rt2x00queue_write_tx_descriptor(entry, &txdesc); 543 rt2x00queue_write_tx_descriptor(entry, &txdesc);
544 rt2x00queue_kick_tx_queue(entry, &txdesc);
541 545
542 return 0; 546 return 0;
543} 547}
@@ -603,12 +607,9 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
603 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); 607 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
604 608
605 /* 609 /*
606 * Send beacon to hardware. 610 * Send beacon to hardware and enable beacon genaration..
607 * Also enable beacon generation, which might have been disabled
608 * by the driver during the config_beacon() callback function.
609 */ 611 */
610 rt2x00dev->ops->lib->write_beacon(intf->beacon); 612 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc);
611 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
612 613
613 mutex_unlock(&intf->beacon_skb_mutex); 614 mutex_unlock(&intf->beacon_skb_mutex);
614 615
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 94a48c174d67..36a957adc1f9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -299,6 +299,7 @@ enum txentry_desc_flags {
299 * @retry_limit: Max number of retries. 299 * @retry_limit: Max number of retries.
300 * @aifs: AIFS value. 300 * @aifs: AIFS value.
301 * @ifs: IFS value. 301 * @ifs: IFS value.
302 * @txop: IFS value for 11n capable chips.
302 * @cw_min: cwmin value. 303 * @cw_min: cwmin value.
303 * @cw_max: cwmax value. 304 * @cw_max: cwmax value.
304 * @cipher: Cipher type used for encryption. 305 * @cipher: Cipher type used for encryption.
@@ -328,6 +329,7 @@ struct txentry_desc {
328 short retry_limit; 329 short retry_limit;
329 short aifs; 330 short aifs;
330 short ifs; 331 short ifs;
332 short txop;
331 short cw_min; 333 short cw_min;
332 short cw_max; 334 short cw_max;
333 335
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 603bfc0adaa3..b9fe94873ee0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -101,6 +101,16 @@ enum ifs {
101}; 101};
102 102
103/* 103/*
104 * IFS backoff values for HT devices
105 */
106enum txop {
107 TXOP_HTTXOP = 0,
108 TXOP_PIFS = 1,
109 TXOP_SIFS = 2,
110 TXOP_BACKOFF = 3,
111};
112
113/*
104 * Cipher types for hardware encryption 114 * Cipher types for hardware encryption
105 */ 115 */
106enum cipher { 116enum cipher {
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 26ee7911fba9..86c75b9c3f25 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1843,7 +1843,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1843/* 1843/*
1844 * TX data initialization 1844 * TX data initialization
1845 */ 1845 */
1846static void rt61pci_write_beacon(struct queue_entry *entry) 1846static void rt61pci_write_beacon(struct queue_entry *entry,
1847 struct txentry_desc *txdesc)
1847{ 1848{
1848 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1849 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1849 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 1850 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
@@ -1870,6 +1871,19 @@ static void rt61pci_write_beacon(struct queue_entry *entry)
1870 entry->skb->data, entry->skb->len); 1871 entry->skb->data, entry->skb->len);
1871 1872
1872 /* 1873 /*
1874 * Enable beaconing again.
1875 *
1876 * For Wi-Fi faily generated beacons between participating
1877 * stations. Set TBTT phase adaptive adjustment step to 8us.
1878 */
1879 rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008);
1880
1881 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
1882 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
1883 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
1884 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
1885
1886 /*
1873 * Clean up beacon skb. 1887 * Clean up beacon skb.
1874 */ 1888 */
1875 dev_kfree_skb_any(entry->skb); 1889 dev_kfree_skb_any(entry->skb);
@@ -1881,23 +1895,6 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1881{ 1895{
1882 u32 reg; 1896 u32 reg;
1883 1897
1884 if (queue == QID_BEACON) {
1885 /*
1886 * For Wi-Fi faily generated beacons between participating
1887 * stations. Set TBTT phase adaptive adjustment step to 8us.
1888 */
1889 rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008);
1890
1891 rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, &reg);
1892 if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) {
1893 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
1894 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
1895 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
1896 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
1897 }
1898 return;
1899 }
1900
1901 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg); 1898 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
1902 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); 1899 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE));
1903 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); 1900 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK));
@@ -1969,12 +1966,8 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
1969 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) 1966 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR))
1970 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 1967 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
1971 1968
1972 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 1969 rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG);
1973 rxdesc->cipher = 1970 rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR);
1974 rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG);
1975 rxdesc->cipher_status =
1976 rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR);
1977 }
1978 1971
1979 if (rxdesc->cipher != CIPHER_NONE) { 1972 if (rxdesc->cipher != CIPHER_NONE) {
1980 _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); 1973 _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 39b3c6d04af4..11c130748206 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1505,7 +1505,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1505/* 1505/*
1506 * TX data initialization 1506 * TX data initialization
1507 */ 1507 */
1508static void rt73usb_write_beacon(struct queue_entry *entry) 1508static void rt73usb_write_beacon(struct queue_entry *entry,
1509 struct txentry_desc *txdesc)
1509{ 1510{
1510 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 1511 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1511 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 1512 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
@@ -1537,6 +1538,19 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1537 REGISTER_TIMEOUT32(entry->skb->len)); 1538 REGISTER_TIMEOUT32(entry->skb->len));
1538 1539
1539 /* 1540 /*
1541 * Enable beaconing again.
1542 *
1543 * For Wi-Fi faily generated beacons between participating stations.
1544 * Set TBTT phase adaptive adjustment step to 8us (default 16us)
1545 */
1546 rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008);
1547
1548 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
1549 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
1550 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
1551 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1552
1553 /*
1540 * Clean up the beacon skb. 1554 * Clean up the beacon skb.
1541 */ 1555 */
1542 dev_kfree_skb(entry->skb); 1556 dev_kfree_skb(entry->skb);
@@ -1557,31 +1571,6 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry)
1557 return length; 1571 return length;
1558} 1572}
1559 1573
1560static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1561 const enum data_queue_qid queue)
1562{
1563 u32 reg;
1564
1565 if (queue != QID_BEACON) {
1566 rt2x00usb_kick_tx_queue(rt2x00dev, queue);
1567 return;
1568 }
1569
1570 /*
1571 * For Wi-Fi faily generated beacons between participating stations.
1572 * Set TBTT phase adaptive adjustment step to 8us (default 16us)
1573 */
1574 rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008);
1575
1576 rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
1577 if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) {
1578 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
1579 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
1580 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
1581 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1582 }
1583}
1584
1585/* 1574/*
1586 * RX control handlers 1575 * RX control handlers
1587 */ 1576 */
@@ -1645,12 +1634,8 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
1645 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) 1634 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR))
1646 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 1635 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
1647 1636
1648 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 1637 rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG);
1649 rxdesc->cipher = 1638 rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR);
1650 rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG);
1651 rxdesc->cipher_status =
1652 rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR);
1653 }
1654 1639
1655 if (rxdesc->cipher != CIPHER_NONE) { 1640 if (rxdesc->cipher != CIPHER_NONE) {
1656 _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); 1641 _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]);
@@ -2266,7 +2251,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
2266 .write_tx_data = rt2x00usb_write_tx_data, 2251 .write_tx_data = rt2x00usb_write_tx_data,
2267 .write_beacon = rt73usb_write_beacon, 2252 .write_beacon = rt73usb_write_beacon,
2268 .get_tx_data_len = rt73usb_get_tx_data_len, 2253 .get_tx_data_len = rt73usb_get_tx_data_len,
2269 .kick_tx_queue = rt73usb_kick_tx_queue, 2254 .kick_tx_queue = rt2x00usb_kick_tx_queue,
2270 .kill_tx_queue = rt2x00usb_kill_tx_queue, 2255 .kill_tx_queue = rt2x00usb_kill_tx_queue,
2271 .fill_rxdone = rt73usb_fill_rxdone, 2256 .fill_rxdone = rt73usb_fill_rxdone,
2272 .config_shared_key = rt73usb_config_shared_key, 2257 .config_shared_key = rt73usb_config_shared_key,
diff --git a/drivers/net/wireless/rtl818x/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180.h
index de3844fe06d8..4baf0cf0826f 100644
--- a/drivers/net/wireless/rtl818x/rtl8180.h
+++ b/drivers/net/wireless/rtl818x/rtl8180.h
@@ -55,6 +55,14 @@ struct rtl8180_tx_ring {
55 struct sk_buff_head queue; 55 struct sk_buff_head queue;
56}; 56};
57 57
58struct rtl8180_vif {
59 struct ieee80211_hw *dev;
60
61 /* beaconing */
62 struct delayed_work beacon_work;
63 bool enable_beacon;
64};
65
58struct rtl8180_priv { 66struct rtl8180_priv {
59 /* common between rtl818x drivers */ 67 /* common between rtl818x drivers */
60 struct rtl818x_csr __iomem *map; 68 struct rtl818x_csr __iomem *map;
@@ -78,6 +86,9 @@ struct rtl8180_priv {
78 u32 anaparam; 86 u32 anaparam;
79 u16 rfparam; 87 u16 rfparam;
80 u8 csthreshold; 88 u8 csthreshold;
89
90 /* sequence # */
91 u16 seqno;
81}; 92};
82 93
83void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); 94void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index 21307f2412b8..515817de2905 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -234,6 +234,7 @@ static irqreturn_t rtl8180_interrupt(int irq, void *dev_id)
234static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 234static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
235{ 235{
236 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 236 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
237 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
237 struct rtl8180_priv *priv = dev->priv; 238 struct rtl8180_priv *priv = dev->priv;
238 struct rtl8180_tx_ring *ring; 239 struct rtl8180_tx_ring *ring;
239 struct rtl8180_tx_desc *entry; 240 struct rtl8180_tx_desc *entry;
@@ -285,6 +286,14 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
285 } 286 }
286 287
287 spin_lock_irqsave(&priv->lock, flags); 288 spin_lock_irqsave(&priv->lock, flags);
289
290 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
291 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
292 priv->seqno += 0x10;
293 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
294 hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
295 }
296
288 idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; 297 idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
289 entry = &ring->desc[idx]; 298 entry = &ring->desc[idx];
290 299
@@ -299,6 +308,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
299 __skb_queue_tail(&ring->queue, skb); 308 __skb_queue_tail(&ring->queue, skb);
300 if (ring->entries - skb_queue_len(&ring->queue) < 2) 309 if (ring->entries - skb_queue_len(&ring->queue) < 2)
301 ieee80211_stop_queue(dev, prio); 310 ieee80211_stop_queue(dev, prio);
311
302 spin_unlock_irqrestore(&priv->lock, flags); 312 spin_unlock_irqrestore(&priv->lock, flags);
303 313
304 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); 314 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));
@@ -653,10 +663,59 @@ static void rtl8180_stop(struct ieee80211_hw *dev)
653 rtl8180_free_tx_ring(dev, i); 663 rtl8180_free_tx_ring(dev, i);
654} 664}
655 665
666static u64 rtl8180_get_tsf(struct ieee80211_hw *dev)
667{
668 struct rtl8180_priv *priv = dev->priv;
669
670 return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
671 (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
672}
673
674void rtl8180_beacon_work(struct work_struct *work)
675{
676 struct rtl8180_vif *vif_priv =
677 container_of(work, struct rtl8180_vif, beacon_work.work);
678 struct ieee80211_vif *vif =
679 container_of((void *)vif_priv, struct ieee80211_vif, drv_priv);
680 struct ieee80211_hw *dev = vif_priv->dev;
681 struct ieee80211_mgmt *mgmt;
682 struct sk_buff *skb;
683 int err = 0;
684
685 /* don't overflow the tx ring */
686 if (ieee80211_queue_stopped(dev, 0))
687 goto resched;
688
689 /* grab a fresh beacon */
690 skb = ieee80211_beacon_get(dev, vif);
691
692 /*
693 * update beacon timestamp w/ TSF value
694 * TODO: make hardware update beacon timestamp
695 */
696 mgmt = (struct ieee80211_mgmt *)skb->data;
697 mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev));
698
699 /* TODO: use actual beacon queue */
700 skb_set_queue_mapping(skb, 0);
701
702 err = rtl8180_tx(dev, skb);
703 WARN_ON(err);
704
705resched:
706 /*
707 * schedule next beacon
708 * TODO: use hardware support for beacon timing
709 */
710 schedule_delayed_work(&vif_priv->beacon_work,
711 usecs_to_jiffies(1024 * vif->bss_conf.beacon_int));
712}
713
656static int rtl8180_add_interface(struct ieee80211_hw *dev, 714static int rtl8180_add_interface(struct ieee80211_hw *dev,
657 struct ieee80211_vif *vif) 715 struct ieee80211_vif *vif)
658{ 716{
659 struct rtl8180_priv *priv = dev->priv; 717 struct rtl8180_priv *priv = dev->priv;
718 struct rtl8180_vif *vif_priv;
660 719
661 /* 720 /*
662 * We only support one active interface at a time. 721 * We only support one active interface at a time.
@@ -666,6 +725,7 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev,
666 725
667 switch (vif->type) { 726 switch (vif->type) {
668 case NL80211_IFTYPE_STATION: 727 case NL80211_IFTYPE_STATION:
728 case NL80211_IFTYPE_ADHOC:
669 break; 729 break;
670 default: 730 default:
671 return -EOPNOTSUPP; 731 return -EOPNOTSUPP;
@@ -673,6 +733,12 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev,
673 733
674 priv->vif = vif; 734 priv->vif = vif;
675 735
736 /* Initialize driver private area */
737 vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
738 vif_priv->dev = dev;
739 INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8180_beacon_work);
740 vif_priv->enable_beacon = false;
741
676 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); 742 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
677 rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], 743 rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0],
678 le32_to_cpu(*(__le32 *)vif->addr)); 744 le32_to_cpu(*(__le32 *)vif->addr));
@@ -706,8 +772,11 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
706 u32 changed) 772 u32 changed)
707{ 773{
708 struct rtl8180_priv *priv = dev->priv; 774 struct rtl8180_priv *priv = dev->priv;
775 struct rtl8180_vif *vif_priv;
709 int i; 776 int i;
710 777
778 vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
779
711 if (changed & BSS_CHANGED_BSSID) { 780 if (changed & BSS_CHANGED_BSSID) {
712 for (i = 0; i < ETH_ALEN; i++) 781 for (i = 0; i < ETH_ALEN; i++)
713 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 782 rtl818x_iowrite8(priv, &priv->map->BSSID[i],
@@ -722,7 +791,16 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
722 } 791 }
723 792
724 if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) 793 if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp)
725 priv->rf->conf_erp(dev, info); 794 priv->rf->conf_erp(dev, info);
795
796 if (changed & BSS_CHANGED_BEACON_ENABLED)
797 vif_priv->enable_beacon = info->enable_beacon;
798
799 if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) {
800 cancel_delayed_work_sync(&vif_priv->beacon_work);
801 if (vif_priv->enable_beacon)
802 schedule_work(&vif_priv->beacon_work.work);
803 }
726} 804}
727 805
728static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, 806static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev,
@@ -763,14 +841,6 @@ static void rtl8180_configure_filter(struct ieee80211_hw *dev,
763 rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); 841 rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf);
764} 842}
765 843
766static u64 rtl8180_get_tsf(struct ieee80211_hw *dev)
767{
768 struct rtl8180_priv *priv = dev->priv;
769
770 return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
771 (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
772}
773
774static const struct ieee80211_ops rtl8180_ops = { 844static const struct ieee80211_ops rtl8180_ops = {
775 .tx = rtl8180_tx, 845 .tx = rtl8180_tx,
776 .start = rtl8180_start, 846 .start = rtl8180_start,
@@ -857,8 +927,8 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
857 goto err_free_reg; 927 goto err_free_reg;
858 } 928 }
859 929
860 if ((err = pci_set_dma_mask(pdev, 0xFFFFFF00ULL)) || 930 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) ||
861 (err = pci_set_consistent_dma_mask(pdev, 0xFFFFFF00ULL))) { 931 (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
862 printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n", 932 printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n",
863 pci_name(pdev)); 933 pci_name(pdev));
864 goto err_free_reg; 934 goto err_free_reg;
@@ -907,7 +977,9 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
907 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 977 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
908 IEEE80211_HW_RX_INCLUDES_FCS | 978 IEEE80211_HW_RX_INCLUDES_FCS |
909 IEEE80211_HW_SIGNAL_UNSPEC; 979 IEEE80211_HW_SIGNAL_UNSPEC;
910 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 980 dev->vif_data_size = sizeof(struct rtl8180_vif);
981 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
982 BIT(NL80211_IFTYPE_ADHOC);
911 dev->queues = 1; 983 dev->queues = 1;
912 dev->max_signal = 65; 984 dev->max_signal = 65;
913 985
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.c b/drivers/net/wireless/wl12xx/wl1251_rx.c
index af5c67b4da95..851515836a7f 100644
--- a/drivers/net/wireless/wl12xx/wl1251_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_rx.c
@@ -183,6 +183,4 @@ void wl1251_rx(struct wl1251 *wl)
183 183
184 /* Finally, we need to ACK the RX */ 184 /* Finally, we need to ACK the RX */
185 wl1251_rx_ack(wl); 185 wl1251_rx_ack(wl);
186
187 return;
188} 186}
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 75887e74205b..6f1b6b5640c0 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -388,6 +388,8 @@ struct wl1271 {
388 size_t fw_len; 388 size_t fw_len;
389 struct wl1271_nvs_file *nvs; 389 struct wl1271_nvs_file *nvs;
390 390
391 s8 hw_pg_ver;
392
391 u8 bssid[ETH_ALEN]; 393 u8 bssid[ETH_ALEN];
392 u8 mac_addr[ETH_ALEN]; 394 u8 mac_addr[ETH_ALEN];
393 u8 bss_type; 395 u8 bss_type;
@@ -479,7 +481,7 @@ struct wl1271 {
479 struct wl1271_stats stats; 481 struct wl1271_stats stats;
480 struct wl1271_debugfs debugfs; 482 struct wl1271_debugfs debugfs;
481 483
482 u32 buffer_32; 484 __le32 buffer_32;
483 u32 buffer_cmd; 485 u32 buffer_cmd;
484 u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; 486 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
485 487
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index acb1d9e6b7d2..1a36d8a2196e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -441,11 +441,23 @@ static int wl1271_boot_write_irq_polarity(struct wl1271 *wl)
441 return 0; 441 return 0;
442} 442}
443 443
444static void wl1271_boot_hw_version(struct wl1271 *wl)
445{
446 u32 fuse;
447
448 fuse = wl1271_top_reg_read(wl, REG_FUSE_DATA_2_1);
449 fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET;
450
451 wl->hw_pg_ver = (s8)fuse;
452}
453
444int wl1271_boot(struct wl1271 *wl) 454int wl1271_boot(struct wl1271 *wl)
445{ 455{
446 int ret = 0; 456 int ret = 0;
447 u32 tmp, clk, pause; 457 u32 tmp, clk, pause;
448 458
459 wl1271_boot_hw_version(wl);
460
449 if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4) 461 if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4)
450 /* ref clk: 19.2/38.4/38.4-XTAL */ 462 /* ref clk: 19.2/38.4/38.4-XTAL */
451 clk = 0x3; 463 clk = 0x3;
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h
index 95ecc5241959..f829699d597e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.h
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.h
@@ -55,6 +55,9 @@ struct wl1271_static_data {
55#define OCP_REG_CLK_POLARITY 0x0cb2 55#define OCP_REG_CLK_POLARITY 0x0cb2
56#define OCP_REG_CLK_PULL 0x0cb4 56#define OCP_REG_CLK_PULL 0x0cb4
57 57
58#define REG_FUSE_DATA_2_1 0x050a
59#define PG_VER_MASK 0x3c
60#define PG_VER_OFFSET 2
58 61
59#define CMD_MBOX_ADDRESS 0x407B4 62#define CMD_MBOX_ADDRESS 0x407B4
60 63
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 62c11af1d8e2..19393e236e2c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -516,7 +516,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send)
516 ps_params->ps_mode = ps_mode; 516 ps_params->ps_mode = ps_mode;
517 ps_params->send_null_data = send; 517 ps_params->send_null_data = send;
518 ps_params->retries = 5; 518 ps_params->retries = 5;
519 ps_params->hang_over_period = 128; 519 ps_params->hang_over_period = 1;
520 ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */ 520 ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */
521 521
522 ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, 522 ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 00f78b7aa384..f2820b42a943 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -129,7 +129,7 @@ enum cmd_templ {
129/* unit ms */ 129/* unit ms */
130#define WL1271_COMMAND_TIMEOUT 2000 130#define WL1271_COMMAND_TIMEOUT 2000
131#define WL1271_CMD_TEMPL_MAX_SIZE 252 131#define WL1271_CMD_TEMPL_MAX_SIZE 252
132#define WL1271_EVENT_TIMEOUT 100 132#define WL1271_EVENT_TIMEOUT 750
133 133
134struct wl1271_cmd_header { 134struct wl1271_cmd_header {
135 __le16 id; 135 __le16 id;
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index d8837ef0bb40..bc806c74c63a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -74,12 +74,12 @@ static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr)
74 wl1271_raw_read(wl, addr, &wl->buffer_32, 74 wl1271_raw_read(wl, addr, &wl->buffer_32,
75 sizeof(wl->buffer_32), false); 75 sizeof(wl->buffer_32), false);
76 76
77 return wl->buffer_32; 77 return le32_to_cpu(wl->buffer_32);
78} 78}
79 79
80static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) 80static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
81{ 81{
82 wl->buffer_32 = val; 82 wl->buffer_32 = cpu_to_le32(val);
83 wl1271_raw_write(wl, addr, &wl->buffer_32, 83 wl1271_raw_write(wl, addr, &wl->buffer_32,
84 sizeof(wl->buffer_32), false); 84 sizeof(wl->buffer_32), false);
85} 85}
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 62e544041d0d..5bb9e3fff961 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1140,10 +1140,25 @@ out:
1140 return ret; 1140 return ret;
1141} 1141}
1142 1142
1143static int wl1271_join(struct wl1271 *wl) 1143static int wl1271_join(struct wl1271 *wl, bool set_assoc)
1144{ 1144{
1145 int ret; 1145 int ret;
1146 1146
1147 /*
1148 * One of the side effects of the JOIN command is that is clears
1149 * WPA/WPA2 keys from the chipset. Performing a JOIN while associated
1150 * to a WPA/WPA2 access point will therefore kill the data-path.
1151 * Currently there is no supported scenario for JOIN during
1152 * association - if it becomes a supported scenario, the WPA/WPA2 keys
1153 * must be handled somehow.
1154 *
1155 */
1156 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
1157 wl1271_info("JOIN while associated.");
1158
1159 if (set_assoc)
1160 set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags);
1161
1147 ret = wl1271_cmd_join(wl, wl->set_bss_type); 1162 ret = wl1271_cmd_join(wl, wl->set_bss_type);
1148 if (ret < 0) 1163 if (ret < 0)
1149 goto out; 1164 goto out;
@@ -1190,7 +1205,6 @@ static int wl1271_unjoin(struct wl1271 *wl)
1190 goto out; 1205 goto out;
1191 1206
1192 clear_bit(WL1271_FLAG_JOINED, &wl->flags); 1207 clear_bit(WL1271_FLAG_JOINED, &wl->flags);
1193 wl->channel = 0;
1194 memset(wl->bssid, 0, ETH_ALEN); 1208 memset(wl->bssid, 0, ETH_ALEN);
1195 1209
1196 /* stop filterting packets based on bssid */ 1210 /* stop filterting packets based on bssid */
@@ -1250,7 +1264,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
1250 goto out; 1264 goto out;
1251 1265
1252 /* if the channel changes while joined, join again */ 1266 /* if the channel changes while joined, join again */
1253 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 1267 if (changed & IEEE80211_CONF_CHANGE_CHANNEL &&
1268 ((wl->band != conf->channel->band) ||
1269 (wl->channel != channel))) {
1254 wl->band = conf->channel->band; 1270 wl->band = conf->channel->band;
1255 wl->channel = channel; 1271 wl->channel = channel;
1256 1272
@@ -1270,7 +1286,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
1270 "failed %d", ret); 1286 "failed %d", ret);
1271 1287
1272 if (test_bit(WL1271_FLAG_JOINED, &wl->flags)) { 1288 if (test_bit(WL1271_FLAG_JOINED, &wl->flags)) {
1273 ret = wl1271_join(wl); 1289 ret = wl1271_join(wl, false);
1274 if (ret < 0) 1290 if (ret < 0)
1275 wl1271_warning("cmd join to update channel " 1291 wl1271_warning("cmd join to update channel "
1276 "failed %d", ret); 1292 "failed %d", ret);
@@ -1647,6 +1663,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1647 enum wl1271_cmd_ps_mode mode; 1663 enum wl1271_cmd_ps_mode mode;
1648 struct wl1271 *wl = hw->priv; 1664 struct wl1271 *wl = hw->priv;
1649 bool do_join = false; 1665 bool do_join = false;
1666 bool set_assoc = false;
1650 int ret; 1667 int ret;
1651 1668
1652 wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed"); 1669 wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed");
@@ -1756,7 +1773,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1756 if (bss_conf->assoc) { 1773 if (bss_conf->assoc) {
1757 u32 rates; 1774 u32 rates;
1758 wl->aid = bss_conf->aid; 1775 wl->aid = bss_conf->aid;
1759 set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); 1776 set_assoc = true;
1760 1777
1761 /* 1778 /*
1762 * use basic rates from AP, and determine lowest rate 1779 * use basic rates from AP, and determine lowest rate
@@ -1856,7 +1873,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1856 } 1873 }
1857 1874
1858 if (do_join) { 1875 if (do_join) {
1859 ret = wl1271_join(wl); 1876 ret = wl1271_join(wl, set_assoc);
1860 if (ret < 0) { 1877 if (ret < 0) {
1861 wl1271_warning("cmd join failed %d", ret); 1878 wl1271_warning("cmd join failed %d", ret);
1862 goto out_sleep; 1879 goto out_sleep;
@@ -2228,6 +2245,29 @@ static DEVICE_ATTR(bt_coex_state, S_IRUGO | S_IWUSR,
2228 wl1271_sysfs_show_bt_coex_state, 2245 wl1271_sysfs_show_bt_coex_state,
2229 wl1271_sysfs_store_bt_coex_state); 2246 wl1271_sysfs_store_bt_coex_state);
2230 2247
2248static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev,
2249 struct device_attribute *attr,
2250 char *buf)
2251{
2252 struct wl1271 *wl = dev_get_drvdata(dev);
2253 ssize_t len;
2254
2255 /* FIXME: what's the maximum length of buf? page size?*/
2256 len = 500;
2257
2258 mutex_lock(&wl->mutex);
2259 if (wl->hw_pg_ver >= 0)
2260 len = snprintf(buf, len, "%d\n", wl->hw_pg_ver);
2261 else
2262 len = snprintf(buf, len, "n/a\n");
2263 mutex_unlock(&wl->mutex);
2264
2265 return len;
2266}
2267
2268static DEVICE_ATTR(hw_pg_ver, S_IRUGO | S_IWUSR,
2269 wl1271_sysfs_show_hw_pg_ver, NULL);
2270
2231int wl1271_register_hw(struct wl1271 *wl) 2271int wl1271_register_hw(struct wl1271 *wl)
2232{ 2272{
2233 int ret; 2273 int ret;
@@ -2347,6 +2387,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
2347 wl->vif = NULL; 2387 wl->vif = NULL;
2348 wl->flags = 0; 2388 wl->flags = 0;
2349 wl->sg_enabled = true; 2389 wl->sg_enabled = true;
2390 wl->hw_pg_ver = -1;
2350 2391
2351 for (i = 0; i < ACX_TX_DESCRIPTORS; i++) 2392 for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
2352 wl->tx_frames[i] = NULL; 2393 wl->tx_frames[i] = NULL;
@@ -2376,8 +2417,18 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
2376 goto err_platform; 2417 goto err_platform;
2377 } 2418 }
2378 2419
2420 /* Create sysfs file to get HW PG version */
2421 ret = device_create_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
2422 if (ret < 0) {
2423 wl1271_error("failed to create sysfs file hw_pg_ver");
2424 goto err_bt_coex_state;
2425 }
2426
2379 return hw; 2427 return hw;
2380 2428
2429err_bt_coex_state:
2430 device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
2431
2381err_platform: 2432err_platform:
2382 platform_device_unregister(wl->plat_dev); 2433 platform_device_unregister(wl->plat_dev);
2383 2434
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 65dd502eab0d..6449fe3d128f 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1307,7 +1307,7 @@ static void wl3501_tx_timeout(struct net_device *dev)
1307 printk(KERN_ERR "%s: Error %d resetting card on Tx timeout!\n", 1307 printk(KERN_ERR "%s: Error %d resetting card on Tx timeout!\n",
1308 dev->name, rc); 1308 dev->name, rc);
1309 else { 1309 else {
1310 dev->trans_start = jiffies; 1310 dev->trans_start = jiffies; /* prevent tx timeout */
1311 netif_wake_queue(dev); 1311 netif_wake_queue(dev);
1312 } 1312 }
1313} 1313}
@@ -1326,7 +1326,6 @@ static netdev_tx_t wl3501_hard_start_xmit(struct sk_buff *skb,
1326 1326
1327 spin_lock_irqsave(&this->lock, flags); 1327 spin_lock_irqsave(&this->lock, flags);
1328 enabled = wl3501_block_interrupt(this); 1328 enabled = wl3501_block_interrupt(this);
1329 dev->trans_start = jiffies;
1330 rc = wl3501_send_pkt(this, skb->data, skb->len); 1329 rc = wl3501_send_pkt(this, skb->data, skb->len);
1331 if (enabled) 1330 if (enabled)
1332 wl3501_unblock_interrupt(this); 1331 wl3501_unblock_interrupt(this);
@@ -1453,8 +1452,6 @@ static void wl3501_detach(struct pcmcia_device *link)
1453 1452
1454 if (link->priv) 1453 if (link->priv)
1455 free_netdev(link->priv); 1454 free_netdev(link->priv);
1456
1457 return;
1458} 1455}
1459 1456
1460static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info, 1457static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 1e2b684f8ed4..390d77f762c4 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -134,7 +134,6 @@ static void zd1201_usbfree(struct urb *urb)
134 134
135 kfree(urb->transfer_buffer); 135 kfree(urb->transfer_buffer);
136 usb_free_urb(urb); 136 usb_free_urb(urb);
137 return;
138} 137}
139 138
140/* cmdreq message: 139/* cmdreq message:
@@ -185,7 +184,6 @@ static void zd1201_usbtx(struct urb *urb)
185{ 184{
186 struct zd1201 *zd = urb->context; 185 struct zd1201 *zd = urb->context;
187 netif_wake_queue(zd->dev); 186 netif_wake_queue(zd->dev);
188 return;
189} 187}
190 188
191/* Incoming data */ 189/* Incoming data */
@@ -407,7 +405,6 @@ exit:
407 wake_up(&zd->rxdataq); 405 wake_up(&zd->rxdataq);
408 kfree(urb->transfer_buffer); 406 kfree(urb->transfer_buffer);
409 } 407 }
410 return;
411} 408}
412 409
413static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata, 410static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata,
@@ -827,7 +824,6 @@ static netdev_tx_t zd1201_hard_start_xmit(struct sk_buff *skb,
827 } else { 824 } else {
828 dev->stats.tx_packets++; 825 dev->stats.tx_packets++;
829 dev->stats.tx_bytes += skb->len; 826 dev->stats.tx_bytes += skb->len;
830 dev->trans_start = jiffies;
831 } 827 }
832 kfree_skb(skb); 828 kfree_skb(skb);
833 829
@@ -845,7 +841,7 @@ static void zd1201_tx_timeout(struct net_device *dev)
845 usb_unlink_urb(zd->tx_urb); 841 usb_unlink_urb(zd->tx_urb);
846 dev->stats.tx_errors++; 842 dev->stats.tx_errors++;
847 /* Restart the timeout to quiet the watchdog: */ 843 /* Restart the timeout to quiet the watchdog: */
848 dev->trans_start = jiffies; 844 dev->trans_start = jiffies; /* prevent tx timeout */
849} 845}
850 846
851static int zd1201_set_mac_address(struct net_device *dev, void *p) 847static int zd1201_set_mac_address(struct net_device *dev, void *p)
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 93828d565390..a7db68d37ee9 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -558,7 +558,7 @@ static void xemaclite_tx_timeout(struct net_device *dev)
558 } 558 }
559 559
560 /* To exclude tx timeout */ 560 /* To exclude tx timeout */
561 dev->trans_start = 0xffffffff - TX_TIMEOUT - TX_TIMEOUT; 561 dev->trans_start = jiffies; /* prevent tx timeout */
562 562
563 /* We're all ready to go. Start the queue */ 563 /* We're all ready to go. Start the queue */
564 netif_wake_queue(dev); 564 netif_wake_queue(dev);
@@ -590,7 +590,7 @@ static void xemaclite_tx_handler(struct net_device *dev)
590 dev->stats.tx_bytes += lp->deferred_skb->len; 590 dev->stats.tx_bytes += lp->deferred_skb->len;
591 dev_kfree_skb_irq(lp->deferred_skb); 591 dev_kfree_skb_irq(lp->deferred_skb);
592 lp->deferred_skb = NULL; 592 lp->deferred_skb = NULL;
593 dev->trans_start = jiffies; 593 dev->trans_start = jiffies; /* prevent tx timeout */
594 netif_wake_queue(dev); 594 netif_wake_queue(dev);
595 } 595 }
596 } 596 }
@@ -1054,7 +1054,6 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
1054 1054
1055 dev->stats.tx_bytes += len; 1055 dev->stats.tx_bytes += len;
1056 dev_kfree_skb(new_skb); 1056 dev_kfree_skb(new_skb);
1057 dev->trans_start = jiffies;
1058 1057
1059 return 0; 1058 return 0;
1060} 1059}
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index efbff76a9908..4eb67aed68dd 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -564,7 +564,6 @@ static void mdio_write(void __iomem *ioaddr, int phy_id, int location, int value
564 for (i = 10000; i >= 0; i--) 564 for (i = 10000; i >= 0; i--)
565 if ((ioread16(ioaddr + MII_Status) & 1) == 0) 565 if ((ioread16(ioaddr + MII_Status) & 1) == 0)
566 break; 566 break;
567 return;
568} 567}
569 568
570 569
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index dbfef8d70f2d..c3a329204511 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -587,7 +587,6 @@ static netdev_tx_t znet_send_packet(struct sk_buff *skb, struct net_device *dev)
587 } 587 }
588 spin_unlock_irqrestore (&znet->lock, flags); 588 spin_unlock_irqrestore (&znet->lock, flags);
589 589
590 dev->trans_start = jiffies;
591 netif_start_queue (dev); 590 netif_start_queue (dev);
592 591
593 if (znet_debug > 4) 592 if (znet_debug > 4)
@@ -802,7 +801,6 @@ static void znet_rx(struct net_device *dev)
802 /* If any worth-while packets have been received, dev_rint() 801 /* If any worth-while packets have been received, dev_rint()
803 has done a mark_bh(INET_BH) for us and will work on them 802 has done a mark_bh(INET_BH) for us and will work on them
804 when we get to the bottom-half routine. */ 803 when we get to the bottom-half routine. */
805 return;
806} 804}
807 805
808/* The inverse routine to znet_open(). */ 806/* The inverse routine to znet_open(). */
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 81c753a617ab..4f7b9d6a087b 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -430,7 +430,6 @@ static void zorro8390_block_output(struct net_device *dev, int count,
430 430
431 z_writeb(ENISR_RDC, nic_base + NE_EN0_ISR); /* Ack intr. */ 431 z_writeb(ENISR_RDC, nic_base + NE_EN0_ISR); /* Ack intr. */
432 ei_status.dmaing &= ~0x01; 432 ei_status.dmaing &= ~0x01;
433 return;
434} 433}
435 434
436static void __devexit zorro8390_remove_one(struct zorro_dev *z) 435static void __devexit zorro8390_remove_one(struct zorro_dev *z)
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 18ecae4a4375..b4748337223b 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -69,7 +69,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
69 } 69 }
70 70
71 phy = get_phy_device(mdio, be32_to_cpup(addr)); 71 phy = get_phy_device(mdio, be32_to_cpup(addr));
72 if (!phy) { 72 if (!phy || IS_ERR(phy)) {
73 dev_err(&mdio->dev, "error probing PHY at address %i\n", 73 dev_err(&mdio->dev, "error probing PHY at address %i\n",
74 *addr); 74 *addr);
75 continue; 75 continue;
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 4e3e0382c16e..083034710fa6 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/vmalloc.h>
23 24
24#include <asm/pci-bridge.h> 25#include <asm/pci-bridge.h>
25#include <linux/mutex.h> 26#include <linux/mutex.h>
@@ -430,6 +431,8 @@ int dlpar_remove_slot(char *drc_name)
430 rc = dlpar_remove_pci_slot(drc_name, dn); 431 rc = dlpar_remove_pci_slot(drc_name, dn);
431 break; 432 break;
432 } 433 }
434 vm_unmap_aliases();
435
433 printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); 436 printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name);
434exit: 437exit:
435 mutex_unlock(&rpadlpar_mutex); 438 mutex_unlock(&rpadlpar_mutex);
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 719702240780..ef7411c660b9 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -29,6 +29,7 @@
29#include <linux/pci_hotplug.h> 29#include <linux/pci_hotplug.h>
30#include <linux/smp.h> 30#include <linux/smp.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/vmalloc.h>
32#include <asm/eeh.h> /* for eeh_add_device() */ 33#include <asm/eeh.h> /* for eeh_add_device() */
33#include <asm/rtas.h> /* rtas_call */ 34#include <asm/rtas.h> /* rtas_call */
34#include <asm/pci-bridge.h> /* for pci_controller */ 35#include <asm/pci-bridge.h> /* for pci_controller */
@@ -418,6 +419,8 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
418 return -EINVAL; 419 return -EINVAL;
419 420
420 pcibios_remove_pci_devices(slot->bus); 421 pcibios_remove_pci_devices(slot->bus);
422 vm_unmap_aliases();
423
421 slot->state = NOT_CONFIGURED; 424 slot->state = NOT_CONFIGURED;
422 return 0; 425 return 0;
423} 426}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5ea587e59e48..37499127c801 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -679,7 +679,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
679 */ 679 */
680int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state) 680int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
681{ 681{
682 return state > PCI_D0 ? 682 return state >= PCI_D0 ?
683 pci_platform_power_transition(dev, state) : -EINVAL; 683 pci_platform_power_transition(dev, state) : -EINVAL;
684} 684}
685EXPORT_SYMBOL_GPL(__pci_complete_power_transition); 685EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
@@ -716,10 +716,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
716 */ 716 */
717 return 0; 717 return 0;
718 718
719 /* Check if we're already there */
720 if (dev->current_state == state)
721 return 0;
722
723 __pci_start_power_transition(dev, state); 719 __pci_start_power_transition(dev, state);
724 720
725 /* This device is quirked not to be put into D3, so 721 /* This device is quirked not to be put into D3, so
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index aa495ad9bbd4..7a711ee314b7 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -244,11 +244,17 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
244 244
245 /* Assert Secondary Bus Reset */ 245 /* Assert Secondary Bus Reset */
246 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &p2p_ctrl); 246 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &p2p_ctrl);
247 p2p_ctrl |= PCI_CB_BRIDGE_CTL_CB_RESET; 247 p2p_ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
248 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); 248 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl);
249 249
250 /*
251 * we should send hot reset message for 2ms to allow it time to
252 * propogate to all downstream ports
253 */
254 msleep(2);
255
250 /* De-assert Secondary Bus Reset */ 256 /* De-assert Secondary Bus Reset */
251 p2p_ctrl &= ~PCI_CB_BRIDGE_CTL_CB_RESET; 257 p2p_ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
252 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); 258 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl);
253 259
254 /* 260 /*
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 882bd8d29fe3..c82548afcd5c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -174,19 +174,14 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
174 pci_read_config_dword(dev, pos, &sz); 174 pci_read_config_dword(dev, pos, &sz);
175 pci_write_config_dword(dev, pos, l); 175 pci_write_config_dword(dev, pos, l);
176 176
177 if (!sz)
178 goto fail; /* BAR not implemented */
179
180 /* 177 /*
181 * All bits set in sz means the device isn't working properly. 178 * All bits set in sz means the device isn't working properly.
182 * If it's a memory BAR or a ROM, bit 0 must be clear; if it's 179 * If the BAR isn't implemented, all bits must be 0. If it's a
183 * an io BAR, bit 1 must be clear. 180 * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit
181 * 1 must be clear.
184 */ 182 */
185 if (sz == 0xffffffff) { 183 if (!sz || sz == 0xffffffff)
186 dev_err(&dev->dev, "reg %x: invalid size %#x; broken device?\n",
187 pos, sz);
188 goto fail; 184 goto fail;
189 }
190 185
191 /* 186 /*
192 * I don't know how l can have all bits set. Copied from old code. 187 * I don't know how l can have all bits set. Copied from old code.
@@ -249,17 +244,13 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
249 pos, res); 244 pos, res);
250 } 245 }
251 } else { 246 } else {
252 u32 size = pci_size(l, sz, mask); 247 sz = pci_size(l, sz, mask);
253 248
254 if (!size) { 249 if (!sz)
255 dev_err(&dev->dev, "reg %x: invalid size "
256 "(l %#x sz %#x mask %#x); broken device?",
257 pos, l, sz, mask);
258 goto fail; 250 goto fail;
259 }
260 251
261 res->start = l; 252 res->start = l;
262 res->end = l + size; 253 res->end = l + sz;
263 254
264 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); 255 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res);
265 } 256 }
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 75ed866e6953..c3383750e333 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -671,20 +671,22 @@ static int pccardd(void *__skt)
671 socket_remove(skt); 671 socket_remove(skt);
672 if (sysfs_events & PCMCIA_UEVENT_INSERT) 672 if (sysfs_events & PCMCIA_UEVENT_INSERT)
673 socket_insert(skt); 673 socket_insert(skt);
674 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
675 !(skt->state & SOCKET_CARDBUS)) {
676 ret = socket_resume(skt);
677 if (!ret && skt->callback)
678 skt->callback->resume(skt);
679 }
680 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) && 674 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
681 !(skt->state & SOCKET_CARDBUS)) { 675 !(skt->state & SOCKET_CARDBUS)) {
682 if (skt->callback) 676 if (skt->callback)
683 ret = skt->callback->suspend(skt); 677 ret = skt->callback->suspend(skt);
684 else 678 else
685 ret = 0; 679 ret = 0;
686 if (!ret) 680 if (!ret) {
687 socket_suspend(skt); 681 socket_suspend(skt);
682 msleep(100);
683 }
684 }
685 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
686 !(skt->state & SOCKET_CARDBUS)) {
687 ret = socket_resume(skt);
688 if (!ret && skt->callback)
689 skt->callback->resume(skt);
688 } 690 }
689 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) && 691 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
690 !(skt->state & SOCKET_CARDBUS)) { 692 !(skt->state & SOCKET_CARDBUS)) {
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
index 2d48196a48cd..0f4cc3f00028 100644
--- a/drivers/pcmcia/db1xxx_ss.c
+++ b/drivers/pcmcia/db1xxx_ss.c
@@ -146,7 +146,6 @@ static irqreturn_t db1200_pcmcia_cdirq(int irq, void *data)
146static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock) 146static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
147{ 147{
148 int ret; 148 int ret;
149 unsigned long flags;
150 149
151 if (sock->stschg_irq != -1) { 150 if (sock->stschg_irq != -1) {
152 ret = request_irq(sock->stschg_irq, db1000_pcmcia_stschgirq, 151 ret = request_irq(sock->stschg_irq, db1000_pcmcia_stschgirq,
@@ -162,30 +161,23 @@ static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
162 * active one disabled. 161 * active one disabled.
163 */ 162 */
164 if (sock->board_type == BOARD_TYPE_DB1200) { 163 if (sock->board_type == BOARD_TYPE_DB1200) {
165 local_irq_save(flags);
166
167 ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq, 164 ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq,
168 IRQF_DISABLED, "pcmcia_insert", sock); 165 IRQF_DISABLED, "pcmcia_insert", sock);
169 if (ret) { 166 if (ret)
170 local_irq_restore(flags);
171 goto out1; 167 goto out1;
172 }
173 168
174 ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq, 169 ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq,
175 IRQF_DISABLED, "pcmcia_eject", sock); 170 IRQF_DISABLED, "pcmcia_eject", sock);
176 if (ret) { 171 if (ret) {
177 free_irq(sock->insert_irq, sock); 172 free_irq(sock->insert_irq, sock);
178 local_irq_restore(flags);
179 goto out1; 173 goto out1;
180 } 174 }
181 175
182 /* disable the currently active one */ 176 /* enable the currently silent one */
183 if (db1200_card_inserted(sock)) 177 if (db1200_card_inserted(sock))
184 disable_irq_nosync(sock->insert_irq); 178 enable_irq(sock->eject_irq);
185 else 179 else
186 disable_irq_nosync(sock->eject_irq); 180 enable_irq(sock->insert_irq);
187
188 local_irq_restore(flags);
189 } else { 181 } else {
190 /* all other (older) Db1x00 boards use a GPIO to show 182 /* all other (older) Db1x00 boards use a GPIO to show
191 * card detection status: use both-edge triggers. 183 * card detection status: use both-edge triggers.
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4014cf8e4a26..041eee43fd8d 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -335,7 +335,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
335 335
336 mutex_lock(&s->ops_mutex); 336 mutex_lock(&s->ops_mutex);
337 list_del(&p_dev->socket_device_list); 337 list_del(&p_dev->socket_device_list);
338 p_dev->_removed = 1;
339 mutex_unlock(&s->ops_mutex); 338 mutex_unlock(&s->ops_mutex);
340 339
341 dev_dbg(&p_dev->dev, "unregistering device\n"); 340 dev_dbg(&p_dev->dev, "unregistering device\n");
@@ -654,14 +653,7 @@ static int pcmcia_requery_callback(struct device *dev, void * _data)
654 653
655static void pcmcia_requery(struct pcmcia_socket *s) 654static void pcmcia_requery(struct pcmcia_socket *s)
656{ 655{
657 int present, has_pfc; 656 int has_pfc;
658
659 mutex_lock(&s->ops_mutex);
660 present = s->pcmcia_state.present;
661 mutex_unlock(&s->ops_mutex);
662
663 if (!present)
664 return;
665 657
666 if (s->functions == 0) { 658 if (s->functions == 0) {
667 pcmcia_card_add(s); 659 pcmcia_card_add(s);
@@ -828,11 +820,12 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
828 } 820 }
829 821
830 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { 822 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
831 if (dev->device_no != did->device_no) 823 dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n");
832 return 0;
833 mutex_lock(&dev->socket->ops_mutex); 824 mutex_lock(&dev->socket->ops_mutex);
834 dev->socket->pcmcia_state.has_pfc = 1; 825 dev->socket->pcmcia_state.has_pfc = 1;
835 mutex_unlock(&dev->socket->ops_mutex); 826 mutex_unlock(&dev->socket->ops_mutex);
827 if (dev->device_no != did->device_no)
828 return 0;
836 } 829 }
837 830
838 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) { 831 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) {
@@ -843,7 +836,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
843 836
844 /* if this is a pseudo-multi-function device, 837 /* if this is a pseudo-multi-function device,
845 * we need explicit matches */ 838 * we need explicit matches */
846 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) 839 if (dev->socket->pcmcia_state.has_pfc)
847 return 0; 840 return 0;
848 if (dev->device_no) 841 if (dev->device_no)
849 return 0; 842 return 0;
@@ -1260,9 +1253,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1260 1253
1261 switch (event) { 1254 switch (event) {
1262 case CS_EVENT_CARD_REMOVAL: 1255 case CS_EVENT_CARD_REMOVAL:
1263 mutex_lock(&s->ops_mutex); 1256 atomic_set(&skt->present, 0);
1264 s->pcmcia_state.present = 0;
1265 mutex_unlock(&s->ops_mutex);
1266 pcmcia_card_remove(skt, NULL); 1257 pcmcia_card_remove(skt, NULL);
1267 handle_event(skt, event); 1258 handle_event(skt, event);
1268 mutex_lock(&s->ops_mutex); 1259 mutex_lock(&s->ops_mutex);
@@ -1271,9 +1262,9 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1271 break; 1262 break;
1272 1263
1273 case CS_EVENT_CARD_INSERTION: 1264 case CS_EVENT_CARD_INSERTION:
1265 atomic_set(&skt->present, 1);
1274 mutex_lock(&s->ops_mutex); 1266 mutex_lock(&s->ops_mutex);
1275 s->pcmcia_state.has_pfc = 0; 1267 s->pcmcia_state.has_pfc = 0;
1276 s->pcmcia_state.present = 1;
1277 destroy_cis_cache(s); /* to be on the safe side... */ 1268 destroy_cis_cache(s); /* to be on the safe side... */
1278 mutex_unlock(&s->ops_mutex); 1269 mutex_unlock(&s->ops_mutex);
1279 pcmcia_card_add(skt); 1270 pcmcia_card_add(skt);
@@ -1292,6 +1283,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1292 destroy_cis_cache(skt); 1283 destroy_cis_cache(skt);
1293 kfree(skt->fake_cis); 1284 kfree(skt->fake_cis);
1294 skt->fake_cis = NULL; 1285 skt->fake_cis = NULL;
1286 s->functions = 0;
1295 mutex_unlock(&s->ops_mutex); 1287 mutex_unlock(&s->ops_mutex);
1296 /* now, add the new card */ 1288 /* now, add the new card */
1297 ds_event(skt, CS_EVENT_CARD_INSERTION, 1289 ds_event(skt, CS_EVENT_CARD_INSERTION,
@@ -1313,7 +1305,13 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1313 return 0; 1305 return 0;
1314} /* ds_event */ 1306} /* ds_event */
1315 1307
1316 1308/*
1309 * NOTE: This is racy. There's no guarantee the card will still be
1310 * physically present, even if the call to this function returns
1311 * non-NULL. Furthermore, the device driver most likely is unbound
1312 * almost immediately, so the timeframe where pcmcia_dev_present
1313 * returns NULL is probably really really small.
1314 */
1317struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) 1315struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev)
1318{ 1316{
1319 struct pcmcia_device *p_dev; 1317 struct pcmcia_device *p_dev;
@@ -1323,22 +1321,9 @@ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev)
1323 if (!p_dev) 1321 if (!p_dev)
1324 return NULL; 1322 return NULL;
1325 1323
1326 mutex_lock(&p_dev->socket->ops_mutex); 1324 if (atomic_read(&p_dev->socket->present) != 0)
1327 if (!p_dev->socket->pcmcia_state.present) 1325 ret = p_dev;
1328 goto out;
1329
1330 if (p_dev->socket->pcmcia_state.dead)
1331 goto out;
1332 1326
1333 if (p_dev->_removed)
1334 goto out;
1335
1336 if (p_dev->suspended)
1337 goto out;
1338
1339 ret = p_dev;
1340 out:
1341 mutex_unlock(&p_dev->socket->ops_mutex);
1342 pcmcia_put_dev(p_dev); 1327 pcmcia_put_dev(p_dev);
1343 return ret; 1328 return ret;
1344} 1329}
@@ -1388,6 +1373,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1388 return ret; 1373 return ret;
1389 } 1374 }
1390 1375
1376 atomic_set(&socket->present, 0);
1377
1391 return 0; 1378 return 0;
1392} 1379}
1393 1380
@@ -1399,10 +1386,6 @@ static void pcmcia_bus_remove_socket(struct device *dev,
1399 if (!socket) 1386 if (!socket)
1400 return; 1387 return;
1401 1388
1402 mutex_lock(&socket->ops_mutex);
1403 socket->pcmcia_state.dead = 1;
1404 mutex_unlock(&socket->ops_mutex);
1405
1406 pccard_register_pcmcia(socket, NULL); 1389 pccard_register_pcmcia(socket, NULL);
1407 1390
1408 /* unregister any unbound devices */ 1391 /* unregister any unbound devices */
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 104e73d5d86c..7631faa0cadd 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -711,7 +711,7 @@ static int ds_open(struct inode *inode, struct file *file)
711 warning_printed = 1; 711 warning_printed = 1;
712 } 712 }
713 713
714 if (s->pcmcia_state.present) 714 if (atomic_read(&s->present))
715 queue_event(user, CS_EVENT_CARD_INSERTION); 715 queue_event(user, CS_EVENT_CARD_INSERTION);
716out: 716out:
717 unlock_kernel(); 717 unlock_kernel();
@@ -770,9 +770,6 @@ static ssize_t ds_read(struct file *file, char __user *buf,
770 return -EIO; 770 return -EIO;
771 771
772 s = user->socket; 772 s = user->socket;
773 if (s->pcmcia_state.dead)
774 return -EIO;
775
776 ret = wait_event_interruptible(s->queue, !queue_empty(user)); 773 ret = wait_event_interruptible(s->queue, !queue_empty(user));
777 if (ret == 0) 774 if (ret == 0)
778 ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; 775 ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4;
@@ -838,8 +835,6 @@ static int ds_ioctl(struct inode *inode, struct file *file,
838 return -EIO; 835 return -EIO;
839 836
840 s = user->socket; 837 s = user->socket;
841 if (s->pcmcia_state.dead)
842 return -EIO;
843 838
844 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 839 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
845 if (size > sizeof(ds_ioctl_arg_t)) 840 if (size > sizeof(ds_ioctl_arg_t))
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 7bec4588c268..6c3320d75055 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -390,6 +390,7 @@ config EEEPC_WMI
390 depends on ACPI_WMI 390 depends on ACPI_WMI
391 depends on INPUT 391 depends on INPUT
392 depends on EXPERIMENTAL 392 depends on EXPERIMENTAL
393 select INPUT_SPARSEKMAP
393 ---help--- 394 ---help---
394 Say Y here if you want to support WMI-based hotkeys on Eee PC laptops. 395 Say Y here if you want to support WMI-based hotkeys on Eee PC laptops.
395 396
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 52262b012abb..efe8f6388906 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -79,15 +79,15 @@ static uint wapf = 1;
79module_param(wapf, uint, 0644); 79module_param(wapf, uint, 0644);
80MODULE_PARM_DESC(wapf, "WAPF value"); 80MODULE_PARM_DESC(wapf, "WAPF value");
81 81
82static uint wlan_status = 1; 82static int wlan_status = 1;
83static uint bluetooth_status = 1; 83static int bluetooth_status = 1;
84 84
85module_param(wlan_status, uint, 0644); 85module_param(wlan_status, int, 0644);
86MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " 86MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot "
87 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 87 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
88 "default is 1"); 88 "default is 1");
89 89
90module_param(bluetooth_status, uint, 0644); 90module_param(bluetooth_status, int, 0644);
91MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " 91MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
92 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 92 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
93 "default is 1"); 93 "default is 1");
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 6ba6c30e5bb6..66f53c3c35e8 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -217,6 +217,7 @@ static void dell_wmi_notify(u32 value, void *context)
217 if (dell_new_hk_type && (buffer_entry[1] != 0x10)) { 217 if (dell_new_hk_type && (buffer_entry[1] != 0x10)) {
218 printk(KERN_INFO "dell-wmi: Received unknown WMI event" 218 printk(KERN_INFO "dell-wmi: Received unknown WMI event"
219 " (0x%x)\n", buffer_entry[1]); 219 " (0x%x)\n", buffer_entry[1]);
220 kfree(obj);
220 return; 221 return;
221 } 222 }
222 223
@@ -234,7 +235,7 @@ static void dell_wmi_notify(u32 value, void *context)
234 key->keycode == KEY_BRIGHTNESSDOWN) && acpi_video) { 235 key->keycode == KEY_BRIGHTNESSDOWN) && acpi_video) {
235 /* Don't report brightness notifications that will also 236 /* Don't report brightness notifications that will also
236 * come via ACPI */ 237 * come via ACPI */
237 return; 238 ;
238 } else { 239 } else {
239 input_report_key(dell_wmi_input_dev, key->keycode, 1); 240 input_report_key(dell_wmi_input_dev, key->keycode, 1);
240 input_sync(dell_wmi_input_dev); 241 input_sync(dell_wmi_input_dev);
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 54a015785ca8..0306174ba875 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -169,7 +169,6 @@ struct eeepc_laptop {
169 struct backlight_device *backlight_device; 169 struct backlight_device *backlight_device;
170 170
171 struct input_dev *inputdev; 171 struct input_dev *inputdev;
172 struct key_entry *keymap;
173 172
174 struct rfkill *wlan_rfkill; 173 struct rfkill *wlan_rfkill;
175 struct rfkill *bluetooth_rfkill; 174 struct rfkill *bluetooth_rfkill;
@@ -1204,8 +1203,8 @@ static int eeepc_input_init(struct eeepc_laptop *eeepc)
1204static void eeepc_input_exit(struct eeepc_laptop *eeepc) 1203static void eeepc_input_exit(struct eeepc_laptop *eeepc)
1205{ 1204{
1206 if (eeepc->inputdev) { 1205 if (eeepc->inputdev) {
1206 sparse_keymap_free(eeepc->inputdev);
1207 input_unregister_device(eeepc->inputdev); 1207 input_unregister_device(eeepc->inputdev);
1208 kfree(eeepc->keymap);
1209 } 1208 }
1210} 1209}
1211 1210
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 9f8822658fd7..b227eb469f49 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -23,6 +23,8 @@
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/kernel.h> 28#include <linux/kernel.h>
27#include <linux/module.h> 29#include <linux/module.h>
28#include <linux/init.h> 30#include <linux/init.h>
@@ -30,22 +32,34 @@
30#include <linux/slab.h> 32#include <linux/slab.h>
31#include <linux/input.h> 33#include <linux/input.h>
32#include <linux/input/sparse-keymap.h> 34#include <linux/input/sparse-keymap.h>
35#include <linux/fb.h>
36#include <linux/backlight.h>
37#include <linux/platform_device.h>
33#include <acpi/acpi_bus.h> 38#include <acpi/acpi_bus.h>
34#include <acpi/acpi_drivers.h> 39#include <acpi/acpi_drivers.h>
35 40
41#define EEEPC_WMI_FILE "eeepc-wmi"
42
36MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>"); 43MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>");
37MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver"); 44MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver");
38MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
39 46
40#define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000" 47#define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000"
48#define EEEPC_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66"
41 49
42MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID); 50MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);
51MODULE_ALIAS("wmi:"EEEPC_WMI_MGMT_GUID);
43 52
44#define NOTIFY_BRNUP_MIN 0x11 53#define NOTIFY_BRNUP_MIN 0x11
45#define NOTIFY_BRNUP_MAX 0x1f 54#define NOTIFY_BRNUP_MAX 0x1f
46#define NOTIFY_BRNDOWN_MIN 0x20 55#define NOTIFY_BRNDOWN_MIN 0x20
47#define NOTIFY_BRNDOWN_MAX 0x2e 56#define NOTIFY_BRNDOWN_MAX 0x2e
48 57
58#define EEEPC_WMI_METHODID_DEVS 0x53564544
59#define EEEPC_WMI_METHODID_DSTS 0x53544344
60
61#define EEEPC_WMI_DEVID_BACKLIGHT 0x00050012
62
49static const struct key_entry eeepc_wmi_keymap[] = { 63static const struct key_entry eeepc_wmi_keymap[] = {
50 /* Sleep already handled via generic ACPI code */ 64 /* Sleep already handled via generic ACPI code */
51 { KE_KEY, 0x5d, { KEY_WLAN } }, 65 { KE_KEY, 0x5d, { KEY_WLAN } },
@@ -58,18 +72,198 @@ static const struct key_entry eeepc_wmi_keymap[] = {
58 { KE_END, 0}, 72 { KE_END, 0},
59}; 73};
60 74
61static struct input_dev *eeepc_wmi_input_dev; 75struct bios_args {
76 u32 dev_id;
77 u32 ctrl_param;
78};
79
80struct eeepc_wmi {
81 struct input_dev *inputdev;
82 struct backlight_device *backlight_device;
83};
84
85static struct platform_device *platform_device;
86
87static int eeepc_wmi_input_init(struct eeepc_wmi *eeepc)
88{
89 int err;
90
91 eeepc->inputdev = input_allocate_device();
92 if (!eeepc->inputdev)
93 return -ENOMEM;
94
95 eeepc->inputdev->name = "Eee PC WMI hotkeys";
96 eeepc->inputdev->phys = EEEPC_WMI_FILE "/input0";
97 eeepc->inputdev->id.bustype = BUS_HOST;
98 eeepc->inputdev->dev.parent = &platform_device->dev;
99
100 err = sparse_keymap_setup(eeepc->inputdev, eeepc_wmi_keymap, NULL);
101 if (err)
102 goto err_free_dev;
103
104 err = input_register_device(eeepc->inputdev);
105 if (err)
106 goto err_free_keymap;
107
108 return 0;
109
110err_free_keymap:
111 sparse_keymap_free(eeepc->inputdev);
112err_free_dev:
113 input_free_device(eeepc->inputdev);
114 return err;
115}
116
117static void eeepc_wmi_input_exit(struct eeepc_wmi *eeepc)
118{
119 if (eeepc->inputdev) {
120 sparse_keymap_free(eeepc->inputdev);
121 input_unregister_device(eeepc->inputdev);
122 }
123
124 eeepc->inputdev = NULL;
125}
126
127static acpi_status eeepc_wmi_get_devstate(u32 dev_id, u32 *ctrl_param)
128{
129 struct acpi_buffer input = { (acpi_size)sizeof(u32), &dev_id };
130 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
131 union acpi_object *obj;
132 acpi_status status;
133 u32 tmp;
134
135 status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID,
136 1, EEEPC_WMI_METHODID_DSTS, &input, &output);
137
138 if (ACPI_FAILURE(status))
139 return status;
140
141 obj = (union acpi_object *)output.pointer;
142 if (obj && obj->type == ACPI_TYPE_INTEGER)
143 tmp = (u32)obj->integer.value;
144 else
145 tmp = 0;
146
147 if (ctrl_param)
148 *ctrl_param = tmp;
149
150 kfree(obj);
151
152 return status;
153
154}
155
156static acpi_status eeepc_wmi_set_devstate(u32 dev_id, u32 ctrl_param)
157{
158 struct bios_args args = {
159 .dev_id = dev_id,
160 .ctrl_param = ctrl_param,
161 };
162 struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
163 acpi_status status;
164
165 status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID,
166 1, EEEPC_WMI_METHODID_DEVS, &input, NULL);
167
168 return status;
169}
170
171static int read_brightness(struct backlight_device *bd)
172{
173 static u32 ctrl_param;
174 acpi_status status;
175
176 status = eeepc_wmi_get_devstate(EEEPC_WMI_DEVID_BACKLIGHT, &ctrl_param);
177
178 if (ACPI_FAILURE(status))
179 return -1;
180 else
181 return ctrl_param & 0xFF;
182}
183
184static int update_bl_status(struct backlight_device *bd)
185{
186
187 static u32 ctrl_param;
188 acpi_status status;
189
190 ctrl_param = bd->props.brightness;
191
192 status = eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_BACKLIGHT, ctrl_param);
193
194 if (ACPI_FAILURE(status))
195 return -1;
196 else
197 return 0;
198}
199
200static const struct backlight_ops eeepc_wmi_bl_ops = {
201 .get_brightness = read_brightness,
202 .update_status = update_bl_status,
203};
204
205static int eeepc_wmi_backlight_notify(struct eeepc_wmi *eeepc, int code)
206{
207 struct backlight_device *bd = eeepc->backlight_device;
208 int old = bd->props.brightness;
209 int new;
210
211 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
212 new = code - NOTIFY_BRNUP_MIN + 1;
213 else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)
214 new = code - NOTIFY_BRNDOWN_MIN;
215
216 bd->props.brightness = new;
217 backlight_update_status(bd);
218 backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY);
219
220 return old;
221}
222
223static int eeepc_wmi_backlight_init(struct eeepc_wmi *eeepc)
224{
225 struct backlight_device *bd;
226 struct backlight_properties props;
227
228 memset(&props, 0, sizeof(struct backlight_properties));
229 props.max_brightness = 15;
230 bd = backlight_device_register(EEEPC_WMI_FILE,
231 &platform_device->dev, eeepc,
232 &eeepc_wmi_bl_ops, &props);
233 if (IS_ERR(bd)) {
234 pr_err("Could not register backlight device\n");
235 return PTR_ERR(bd);
236 }
237
238 eeepc->backlight_device = bd;
239
240 bd->props.brightness = read_brightness(bd);
241 bd->props.power = FB_BLANK_UNBLANK;
242 backlight_update_status(bd);
243
244 return 0;
245}
246
247static void eeepc_wmi_backlight_exit(struct eeepc_wmi *eeepc)
248{
249 if (eeepc->backlight_device)
250 backlight_device_unregister(eeepc->backlight_device);
251
252 eeepc->backlight_device = NULL;
253}
62 254
63static void eeepc_wmi_notify(u32 value, void *context) 255static void eeepc_wmi_notify(u32 value, void *context)
64{ 256{
257 struct eeepc_wmi *eeepc = context;
65 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; 258 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
66 union acpi_object *obj; 259 union acpi_object *obj;
67 acpi_status status; 260 acpi_status status;
68 int code; 261 int code;
262 int orig_code;
69 263
70 status = wmi_get_event_data(value, &response); 264 status = wmi_get_event_data(value, &response);
71 if (status != AE_OK) { 265 if (status != AE_OK) {
72 pr_err("EEEPC WMI: bad event status 0x%x\n", status); 266 pr_err("bad event status 0x%x\n", status);
73 return; 267 return;
74 } 268 }
75 269
@@ -77,81 +271,142 @@ static void eeepc_wmi_notify(u32 value, void *context)
77 271
78 if (obj && obj->type == ACPI_TYPE_INTEGER) { 272 if (obj && obj->type == ACPI_TYPE_INTEGER) {
79 code = obj->integer.value; 273 code = obj->integer.value;
274 orig_code = code;
80 275
81 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) 276 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
82 code = NOTIFY_BRNUP_MIN; 277 code = NOTIFY_BRNUP_MIN;
83 else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX) 278 else if (code >= NOTIFY_BRNDOWN_MIN &&
279 code <= NOTIFY_BRNDOWN_MAX)
84 code = NOTIFY_BRNDOWN_MIN; 280 code = NOTIFY_BRNDOWN_MIN;
85 281
86 if (!sparse_keymap_report_event(eeepc_wmi_input_dev, 282 if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
283 if (!acpi_video_backlight_support())
284 eeepc_wmi_backlight_notify(eeepc, orig_code);
285 }
286
287 if (!sparse_keymap_report_event(eeepc->inputdev,
87 code, 1, true)) 288 code, 1, true))
88 pr_info("EEEPC WMI: Unknown key %x pressed\n", code); 289 pr_info("Unknown key %x pressed\n", code);
89 } 290 }
90 291
91 kfree(obj); 292 kfree(obj);
92} 293}
93 294
94static int eeepc_wmi_input_setup(void) 295static int __devinit eeepc_wmi_platform_probe(struct platform_device *device)
95{ 296{
297 struct eeepc_wmi *eeepc;
96 int err; 298 int err;
299 acpi_status status;
97 300
98 eeepc_wmi_input_dev = input_allocate_device(); 301 eeepc = platform_get_drvdata(device);
99 if (!eeepc_wmi_input_dev)
100 return -ENOMEM;
101
102 eeepc_wmi_input_dev->name = "Eee PC WMI hotkeys";
103 eeepc_wmi_input_dev->phys = "wmi/input0";
104 eeepc_wmi_input_dev->id.bustype = BUS_HOST;
105 302
106 err = sparse_keymap_setup(eeepc_wmi_input_dev, eeepc_wmi_keymap, NULL); 303 err = eeepc_wmi_input_init(eeepc);
107 if (err) 304 if (err)
108 goto err_free_dev; 305 goto error_input;
109 306
110 err = input_register_device(eeepc_wmi_input_dev); 307 if (!acpi_video_backlight_support()) {
111 if (err) 308 err = eeepc_wmi_backlight_init(eeepc);
112 goto err_free_keymap; 309 if (err)
310 goto error_backlight;
311 } else
312 pr_info("Backlight controlled by ACPI video driver\n");
313
314 status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID,
315 eeepc_wmi_notify, eeepc);
316 if (ACPI_FAILURE(status)) {
317 pr_err("Unable to register notify handler - %d\n",
318 status);
319 err = -ENODEV;
320 goto error_wmi;
321 }
113 322
114 return 0; 323 return 0;
115 324
116err_free_keymap: 325error_wmi:
117 sparse_keymap_free(eeepc_wmi_input_dev); 326 eeepc_wmi_backlight_exit(eeepc);
118err_free_dev: 327error_backlight:
119 input_free_device(eeepc_wmi_input_dev); 328 eeepc_wmi_input_exit(eeepc);
329error_input:
120 return err; 330 return err;
121} 331}
122 332
333static int __devexit eeepc_wmi_platform_remove(struct platform_device *device)
334{
335 struct eeepc_wmi *eeepc;
336
337 eeepc = platform_get_drvdata(device);
338 wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID);
339 eeepc_wmi_backlight_exit(eeepc);
340 eeepc_wmi_input_exit(eeepc);
341
342 return 0;
343}
344
345static struct platform_driver platform_driver = {
346 .driver = {
347 .name = EEEPC_WMI_FILE,
348 .owner = THIS_MODULE,
349 },
350 .probe = eeepc_wmi_platform_probe,
351 .remove = __devexit_p(eeepc_wmi_platform_remove),
352};
353
123static int __init eeepc_wmi_init(void) 354static int __init eeepc_wmi_init(void)
124{ 355{
356 struct eeepc_wmi *eeepc;
125 int err; 357 int err;
126 acpi_status status;
127 358
128 if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID)) { 359 if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID) ||
129 pr_warning("EEEPC WMI: No known WMI GUID found\n"); 360 !wmi_has_guid(EEEPC_WMI_MGMT_GUID)) {
361 pr_warning("No known WMI GUID found\n");
130 return -ENODEV; 362 return -ENODEV;
131 } 363 }
132 364
133 err = eeepc_wmi_input_setup(); 365 eeepc = kzalloc(sizeof(struct eeepc_wmi), GFP_KERNEL);
134 if (err) 366 if (!eeepc)
135 return err; 367 return -ENOMEM;
136 368
137 status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID, 369 platform_device = platform_device_alloc(EEEPC_WMI_FILE, -1);
138 eeepc_wmi_notify, NULL); 370 if (!platform_device) {
139 if (ACPI_FAILURE(status)) { 371 pr_warning("Unable to allocate platform device\n");
140 sparse_keymap_free(eeepc_wmi_input_dev); 372 err = -ENOMEM;
141 input_unregister_device(eeepc_wmi_input_dev); 373 goto fail_platform;
142 pr_err("EEEPC WMI: Unable to register notify handler - %d\n", 374 }
143 status); 375
144 return -ENODEV; 376 err = platform_device_add(platform_device);
377 if (err) {
378 pr_warning("Unable to add platform device\n");
379 goto put_dev;
380 }
381
382 platform_set_drvdata(platform_device, eeepc);
383
384 err = platform_driver_register(&platform_driver);
385 if (err) {
386 pr_warning("Unable to register platform driver\n");
387 goto del_dev;
145 } 388 }
146 389
147 return 0; 390 return 0;
391
392del_dev:
393 platform_device_del(platform_device);
394put_dev:
395 platform_device_put(platform_device);
396fail_platform:
397 kfree(eeepc);
398
399 return err;
148} 400}
149 401
150static void __exit eeepc_wmi_exit(void) 402static void __exit eeepc_wmi_exit(void)
151{ 403{
152 wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID); 404 struct eeepc_wmi *eeepc;
153 sparse_keymap_free(eeepc_wmi_input_dev); 405
154 input_unregister_device(eeepc_wmi_input_dev); 406 eeepc = platform_get_drvdata(platform_device);
407 platform_driver_unregister(&platform_driver);
408 platform_device_unregister(platform_device);
409 kfree(eeepc);
155} 410}
156 411
157module_init(eeepc_wmi_init); 412module_init(eeepc_wmi_init);
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 35bb44af49b3..100e4d9372f1 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -274,26 +274,6 @@ static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev,
274 pnp_add_bus_resource(dev, start, end); 274 pnp_add_bus_resource(dev, start, end);
275} 275}
276 276
277static u64 addr_space_length(struct pnp_dev *dev, u64 min, u64 max, u64 len)
278{
279 u64 max_len;
280
281 max_len = max - min + 1;
282 if (len <= max_len)
283 return len;
284
285 /*
286 * Per 6.4.3.5, _LEN cannot exceed _MAX - _MIN + 1, but some BIOSes
287 * don't do this correctly, e.g.,
288 * https://bugzilla.kernel.org/show_bug.cgi?id=15480
289 */
290 dev_info(&dev->dev,
291 "resource length %#llx doesn't fit in %#llx-%#llx, trimming\n",
292 (unsigned long long) len, (unsigned long long) min,
293 (unsigned long long) max);
294 return max_len;
295}
296
297static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, 277static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
298 struct acpi_resource *res) 278 struct acpi_resource *res)
299{ 279{
@@ -309,7 +289,8 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
309 return; 289 return;
310 } 290 }
311 291
312 len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); 292 /* Windows apparently computes length rather than using _LEN */
293 len = p->maximum - p->minimum + 1;
313 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; 294 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
314 295
315 if (p->resource_type == ACPI_MEMORY_RANGE) 296 if (p->resource_type == ACPI_MEMORY_RANGE)
@@ -330,7 +311,8 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
330 int window; 311 int window;
331 u64 len; 312 u64 len;
332 313
333 len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); 314 /* Windows apparently computes length rather than using _LEN */
315 len = p->maximum - p->minimum + 1;
334 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; 316 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
335 317
336 if (p->resource_type == ACPI_MEMORY_RANGE) 318 if (p->resource_type == ACPI_MEMORY_RANGE)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 2e54e6a23c72..e3446ab8b563 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -211,6 +211,8 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
211 if (tres->flags & IORESOURCE_IO) { 211 if (tres->flags & IORESOURCE_IO) {
212 if (cannot_compare(tres->flags)) 212 if (cannot_compare(tres->flags))
213 continue; 213 continue;
214 if (tres->flags & IORESOURCE_WINDOW)
215 continue;
214 tport = &tres->start; 216 tport = &tres->start;
215 tend = &tres->end; 217 tend = &tres->end;
216 if (ranged_conflict(port, end, tport, tend)) 218 if (ranged_conflict(port, end, tport, tend))
@@ -271,6 +273,8 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
271 if (tres->flags & IORESOURCE_MEM) { 273 if (tres->flags & IORESOURCE_MEM) {
272 if (cannot_compare(tres->flags)) 274 if (cannot_compare(tres->flags))
273 continue; 275 continue;
276 if (tres->flags & IORESOURCE_WINDOW)
277 continue;
274 taddr = &tres->start; 278 taddr = &tres->start;
275 tend = &tres->end; 279 tend = &tres->end;
276 if (ranged_conflict(addr, end, taddr, tend)) 280 if (ranged_conflict(addr, end, taddr, tend))
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index b6218f11c957..552cad85ae5a 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -109,7 +109,7 @@ static int max8925_is_enabled(struct regulator_dev *rdev)
109 struct max8925_regulator_info *info = rdev_get_drvdata(rdev); 109 struct max8925_regulator_info *info = rdev_get_drvdata(rdev);
110 int ret; 110 int ret;
111 111
112 ret = max8925_reg_read(info->i2c, info->vol_reg); 112 ret = max8925_reg_read(info->i2c, info->enable_reg);
113 if (ret < 0) 113 if (ret < 0)
114 return ret; 114 return ret;
115 115
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index a681f5e8f786..ad036dd8da13 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -618,9 +618,12 @@ static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
618 dev_get_platdata(&pdev->dev); 618 dev_get_platdata(&pdev->dev);
619 int i; 619 int i;
620 620
621 platform_set_drvdata(pdev, NULL);
622
621 for (i = 0; i < pdata->num_regulators; i++) 623 for (i = 0; i < pdata->num_regulators; i++)
622 regulator_unregister(priv->regulators[i]); 624 regulator_unregister(priv->regulators[i]);
623 625
626 kfree(priv);
624 return 0; 627 return 0;
625} 628}
626 629
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index bbea90baf98f..acf222f91f5a 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1899,7 +1899,8 @@ restart:
1899 /* Process requests that may be recovered */ 1899 /* Process requests that may be recovered */
1900 if (cqr->status == DASD_CQR_NEED_ERP) { 1900 if (cqr->status == DASD_CQR_NEED_ERP) {
1901 erp_fn = base->discipline->erp_action(cqr); 1901 erp_fn = base->discipline->erp_action(cqr);
1902 erp_fn(cqr); 1902 if (IS_ERR(erp_fn(cqr)))
1903 continue;
1903 goto restart; 1904 goto restart;
1904 } 1905 }
1905 1906
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index 6927e751ce3e..6632649dd6aa 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -2309,7 +2309,7 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
2309 cqr->retries); 2309 cqr->retries);
2310 dasd_block_set_timer(device->block, (HZ << 3)); 2310 dasd_block_set_timer(device->block, (HZ << 3));
2311 } 2311 }
2312 return cqr; 2312 return erp;
2313 } 2313 }
2314 2314
2315 ccw = cqr->cpaddr; 2315 ccw = cqr->cpaddr;
@@ -2372,6 +2372,9 @@ dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr)
2372 /* add erp and initialize with default TIC */ 2372 /* add erp and initialize with default TIC */
2373 erp = dasd_3990_erp_add_erp(cqr); 2373 erp = dasd_3990_erp_add_erp(cqr);
2374 2374
2375 if (IS_ERR(erp))
2376 return erp;
2377
2375 /* inspect sense, determine specific ERP if possible */ 2378 /* inspect sense, determine specific ERP if possible */
2376 if (erp != cqr) { 2379 if (erp != cqr) {
2377 2380
@@ -2711,6 +2714,8 @@ dasd_3990_erp_action(struct dasd_ccw_req * cqr)
2711 if (erp == NULL) { 2714 if (erp == NULL) {
2712 /* no matching erp found - set up erp */ 2715 /* no matching erp found - set up erp */
2713 erp = dasd_3990_erp_additional_erp(cqr); 2716 erp = dasd_3990_erp_additional_erp(cqr);
2717 if (IS_ERR(erp))
2718 return erp;
2714 } else { 2719 } else {
2715 /* matching erp found - set all leading erp's to DONE */ 2720 /* matching erp found - set all leading erp's to DONE */
2716 erp = dasd_3990_erp_handle_match_erp(cqr, erp); 2721 erp = dasd_3990_erp_handle_match_erp(cqr, erp);
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 18daf16aa357..7217966f7d31 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -638,11 +638,7 @@ static int __init zcore_reipl_init(void)
638 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); 638 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE);
639 else 639 else
640 rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE); 640 rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE);
641 if (rc) { 641 if (rc || csum_partial(ipl_block, ipl_block->hdr.len, 0) !=
642 free_page((unsigned long) ipl_block);
643 return rc;
644 }
645 if (csum_partial(ipl_block, ipl_block->hdr.len, 0) !=
646 ipib_info.checksum) { 642 ipib_info.checksum) {
647 TRACE("Checksum does not match\n"); 643 TRACE("Checksum does not match\n");
648 free_page((unsigned long) ipl_block); 644 free_page((unsigned long) ipl_block);
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 4038f5b4f144..ce7cb87479fe 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -29,6 +29,7 @@
29#include "chsc.h" 29#include "chsc.h"
30 30
31static void *sei_page; 31static void *sei_page;
32static DEFINE_SPINLOCK(sda_lock);
32 33
33/** 34/**
34 * chsc_error_from_response() - convert a chsc response to an error 35 * chsc_error_from_response() - convert a chsc response to an error
@@ -832,11 +833,10 @@ void __init chsc_free_sei_area(void)
832 kfree(sei_page); 833 kfree(sei_page);
833} 834}
834 835
835int __init 836int chsc_enable_facility(int operation_code)
836chsc_enable_facility(int operation_code)
837{ 837{
838 int ret; 838 int ret;
839 struct { 839 static struct {
840 struct chsc_header request; 840 struct chsc_header request;
841 u8 reserved1:4; 841 u8 reserved1:4;
842 u8 format:4; 842 u8 format:4;
@@ -849,33 +849,32 @@ chsc_enable_facility(int operation_code)
849 u32 reserved5:4; 849 u32 reserved5:4;
850 u32 format2:4; 850 u32 format2:4;
851 u32 reserved6:24; 851 u32 reserved6:24;
852 } __attribute__ ((packed)) *sda_area; 852 } __attribute__ ((packed, aligned(4096))) sda_area;
853 853
854 sda_area = (void *)get_zeroed_page(GFP_KERNEL|GFP_DMA); 854 spin_lock(&sda_lock);
855 if (!sda_area) 855 memset(&sda_area, 0, sizeof(sda_area));
856 return -ENOMEM; 856 sda_area.request.length = 0x0400;
857 sda_area->request.length = 0x0400; 857 sda_area.request.code = 0x0031;
858 sda_area->request.code = 0x0031; 858 sda_area.operation_code = operation_code;
859 sda_area->operation_code = operation_code;
860 859
861 ret = chsc(sda_area); 860 ret = chsc(&sda_area);
862 if (ret > 0) { 861 if (ret > 0) {
863 ret = (ret == 3) ? -ENODEV : -EBUSY; 862 ret = (ret == 3) ? -ENODEV : -EBUSY;
864 goto out; 863 goto out;
865 } 864 }
866 865
867 switch (sda_area->response.code) { 866 switch (sda_area.response.code) {
868 case 0x0101: 867 case 0x0101:
869 ret = -EOPNOTSUPP; 868 ret = -EOPNOTSUPP;
870 break; 869 break;
871 default: 870 default:
872 ret = chsc_error_from_response(sda_area->response.code); 871 ret = chsc_error_from_response(sda_area.response.code);
873 } 872 }
874 if (ret != 0) 873 if (ret != 0)
875 CIO_CRW_EVENT(2, "chsc: sda (oc=%x) failed (rc=%04x)\n", 874 CIO_CRW_EVENT(2, "chsc: sda (oc=%x) failed (rc=%04x)\n",
876 operation_code, sda_area->response.code); 875 operation_code, sda_area.response.code);
877 out: 876 out:
878 free_page((unsigned long)sda_area); 877 spin_unlock(&sda_lock);
879 return ret; 878 return ret;
880} 879}
881 880
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 404f630c27ca..3b6f4adc5094 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -124,7 +124,7 @@ static int chsc_subchannel_prepare(struct subchannel *sch)
124 * since we don't have a way to clear the subchannel and 124 * since we don't have a way to clear the subchannel and
125 * cannot disable it with a request running. 125 * cannot disable it with a request running.
126 */ 126 */
127 cc = stsch(sch->schid, &schib); 127 cc = stsch_err(sch->schid, &schib);
128 if (!cc && scsw_stctl(&schib.scsw)) 128 if (!cc && scsw_stctl(&schib.scsw))
129 return -EAGAIN; 129 return -EAGAIN;
130 return 0; 130 return 0;
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index f736cdcf08ad..5feea1a371e1 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -361,7 +361,7 @@ int cio_commit_config(struct subchannel *sch)
361 struct schib schib; 361 struct schib schib;
362 int ccode, retry, ret = 0; 362 int ccode, retry, ret = 0;
363 363
364 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) 364 if (stsch_err(sch->schid, &schib) || !css_sch_is_valid(&schib))
365 return -ENODEV; 365 return -ENODEV;
366 366
367 for (retry = 0; retry < 5; retry++) { 367 for (retry = 0; retry < 5; retry++) {
@@ -372,7 +372,7 @@ int cio_commit_config(struct subchannel *sch)
372 return ccode; 372 return ccode;
373 switch (ccode) { 373 switch (ccode) {
374 case 0: /* successful */ 374 case 0: /* successful */
375 if (stsch(sch->schid, &schib) || 375 if (stsch_err(sch->schid, &schib) ||
376 !css_sch_is_valid(&schib)) 376 !css_sch_is_valid(&schib))
377 return -ENODEV; 377 return -ENODEV;
378 if (cio_check_config(sch, &schib)) { 378 if (cio_check_config(sch, &schib)) {
@@ -404,7 +404,7 @@ int cio_update_schib(struct subchannel *sch)
404{ 404{
405 struct schib schib; 405 struct schib schib;
406 406
407 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) 407 if (stsch_err(sch->schid, &schib) || !css_sch_is_valid(&schib))
408 return -ENODEV; 408 return -ENODEV;
409 409
410 memcpy(&sch->schib, &schib, sizeof(schib)); 410 memcpy(&sch->schib, &schib, sizeof(schib));
@@ -771,7 +771,7 @@ cio_get_console_sch_no(void)
771 if (console_irq != -1) { 771 if (console_irq != -1) {
772 /* VM provided us with the irq number of the console. */ 772 /* VM provided us with the irq number of the console. */
773 schid.sch_no = console_irq; 773 schid.sch_no = console_irq;
774 if (stsch(schid, &console_subchannel.schib) != 0 || 774 if (stsch_err(schid, &console_subchannel.schib) != 0 ||
775 (console_subchannel.schib.pmcw.st != SUBCHANNEL_TYPE_IO) || 775 (console_subchannel.schib.pmcw.st != SUBCHANNEL_TYPE_IO) ||
776 !console_subchannel.schib.pmcw.dnv) 776 !console_subchannel.schib.pmcw.dnv)
777 return -1; 777 return -1;
@@ -863,10 +863,10 @@ __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
863 cc = 0; 863 cc = 0;
864 for (retry=0;retry<3;retry++) { 864 for (retry=0;retry<3;retry++) {
865 schib->pmcw.ena = 0; 865 schib->pmcw.ena = 0;
866 cc = msch(schid, schib); 866 cc = msch_err(schid, schib);
867 if (cc) 867 if (cc)
868 return (cc==3?-ENODEV:-EBUSY); 868 return (cc==3?-ENODEV:-EBUSY);
869 if (stsch(schid, schib) || !css_sch_is_valid(schib)) 869 if (stsch_err(schid, schib) || !css_sch_is_valid(schib))
870 return -ENODEV; 870 return -ENODEV;
871 if (!schib->pmcw.ena) 871 if (!schib->pmcw.ena)
872 return 0; 872 return 0;
@@ -913,7 +913,7 @@ static int stsch_reset(struct subchannel_id schid, struct schib *addr)
913 913
914 pgm_check_occured = 0; 914 pgm_check_occured = 0;
915 s390_base_pgm_handler_fn = cio_reset_pgm_check_handler; 915 s390_base_pgm_handler_fn = cio_reset_pgm_check_handler;
916 rc = stsch(schid, addr); 916 rc = stsch_err(schid, addr);
917 s390_base_pgm_handler_fn = NULL; 917 s390_base_pgm_handler_fn = NULL;
918 918
919 /* The program check handler could have changed pgm_check_occured. */ 919 /* The program check handler could have changed pgm_check_occured. */
@@ -950,7 +950,7 @@ static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data)
950 /* No default clear strategy */ 950 /* No default clear strategy */
951 break; 951 break;
952 } 952 }
953 stsch(schid, &schib); 953 stsch_err(schid, &schib);
954 __disable_subchannel_easy(schid, &schib); 954 __disable_subchannel_easy(schid, &schib);
955 } 955 }
956out: 956out:
@@ -1086,7 +1086,7 @@ int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo)
1086 schid = *(struct subchannel_id *)&S390_lowcore.subchannel_id; 1086 schid = *(struct subchannel_id *)&S390_lowcore.subchannel_id;
1087 if (!schid.one) 1087 if (!schid.one)
1088 return -ENODEV; 1088 return -ENODEV;
1089 if (stsch(schid, &schib)) 1089 if (stsch_err(schid, &schib))
1090 return -ENODEV; 1090 return -ENODEV;
1091 if (schib.pmcw.st != SUBCHANNEL_TYPE_IO) 1091 if (schib.pmcw.st != SUBCHANNEL_TYPE_IO)
1092 return -ENODEV; 1092 return -ENODEV;
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 2769da54f2b9..511649115bd7 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -870,15 +870,10 @@ static int __init css_bus_init(void)
870 870
871 /* Try to enable MSS. */ 871 /* Try to enable MSS. */
872 ret = chsc_enable_facility(CHSC_SDA_OC_MSS); 872 ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
873 switch (ret) { 873 if (ret)
874 case 0: /* Success. */
875 max_ssid = __MAX_SSID;
876 break;
877 case -ENOMEM:
878 goto out;
879 default:
880 max_ssid = 0; 874 max_ssid = 0;
881 } 875 else /* Success. */
876 max_ssid = __MAX_SSID;
882 877
883 ret = slow_subchannel_init(); 878 ret = slow_subchannel_init();
884 if (ret) 879 if (ret)
@@ -1048,6 +1043,11 @@ static int __init channel_subsystem_init_sync(void)
1048} 1043}
1049subsys_initcall_sync(channel_subsystem_init_sync); 1044subsys_initcall_sync(channel_subsystem_init_sync);
1050 1045
1046void channel_subsystem_reinit(void)
1047{
1048 chsc_enable_facility(CHSC_SDA_OC_MSS);
1049}
1050
1051#ifdef CONFIG_PROC_FS 1051#ifdef CONFIG_PROC_FS
1052static ssize_t cio_settle_write(struct file *file, const char __user *buf, 1052static ssize_t cio_settle_write(struct file *file, const char __user *buf,
1053 size_t count, loff_t *ppos) 1053 size_t count, loff_t *ppos)
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index c56ab94612f9..c9b852647f01 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -45,7 +45,7 @@ static void ccw_timeout_log(struct ccw_device *cdev)
45 sch = to_subchannel(cdev->dev.parent); 45 sch = to_subchannel(cdev->dev.parent);
46 private = to_io_private(sch); 46 private = to_io_private(sch);
47 orb = &private->orb; 47 orb = &private->orb;
48 cc = stsch(sch->schid, &schib); 48 cc = stsch_err(sch->schid, &schib);
49 49
50 printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, " 50 printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, "
51 "device information:\n", get_clock()); 51 "device information:\n", get_clock());
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 18564891ea61..b3b1d2f79398 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2105,7 +2105,8 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2105 blktrc.inb_usage = req->qdio_req.qdio_inb_usage; 2105 blktrc.inb_usage = req->qdio_req.qdio_inb_usage;
2106 blktrc.outb_usage = req->qdio_req.qdio_outb_usage; 2106 blktrc.outb_usage = req->qdio_req.qdio_outb_usage;
2107 2107
2108 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) { 2108 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA &&
2109 !(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
2109 blktrc.flags |= ZFCP_BLK_LAT_VALID; 2110 blktrc.flags |= ZFCP_BLK_LAT_VALID;
2110 blktrc.channel_lat = lat_in->channel_lat * ticks; 2111 blktrc.channel_lat = lat_in->channel_lat * ticks;
2111 blktrc.fabric_lat = lat_in->fabric_lat * ticks; 2112 blktrc.fabric_lat = lat_in->fabric_lat * ticks;
@@ -2157,9 +2158,8 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
2157 fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp; 2158 fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp;
2158 zfcp_fc_eval_fcp_rsp(fcp_rsp, scpnt); 2159 zfcp_fc_eval_fcp_rsp(fcp_rsp, scpnt);
2159 2160
2160 zfcp_fsf_req_trace(req, scpnt);
2161
2162skip_fsfstatus: 2161skip_fsfstatus:
2162 zfcp_fsf_req_trace(req, scpnt);
2163 zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req); 2163 zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
2164 2164
2165 scpnt->host_scribble = NULL; 2165 scpnt->host_scribble = NULL;
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9201afe65609..7f87979da22d 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -4724,6 +4724,10 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
4724 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7); 4724 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7);
4725 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf, 4725 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf,
4726 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE); 4726 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4727 if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) {
4728 warn_code = -ENOMEM;
4729 goto err_dma_map;
4730 }
4727 phy_addr = cpu_to_le32(asc_dvc->overrun_dma); 4731 phy_addr = cpu_to_le32(asc_dvc->overrun_dma);
4728 AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D, 4732 AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D,
4729 (uchar *)&phy_addr, 1); 4733 (uchar *)&phy_addr, 1);
@@ -4739,14 +4743,23 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
4739 AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR); 4743 AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
4740 if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) { 4744 if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
4741 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; 4745 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
4742 return warn_code; 4746 warn_code = UW_ERR;
4747 goto err_mcode_start;
4743 } 4748 }
4744 if (AscStartChip(iop_base) != 1) { 4749 if (AscStartChip(iop_base) != 1) {
4745 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; 4750 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
4746 return warn_code; 4751 warn_code = UW_ERR;
4752 goto err_mcode_start;
4747 } 4753 }
4748 4754
4749 return warn_code; 4755 return warn_code;
4756
4757err_mcode_start:
4758 dma_unmap_single(board->dev, asc_dvc->overrun_dma,
4759 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4760err_dma_map:
4761 asc_dvc->overrun_dma = 0;
4762 return warn_code;
4750} 4763}
4751 4764
4752static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc) 4765static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
@@ -4802,6 +4815,8 @@ static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
4802 } 4815 }
4803 release_firmware(fw); 4816 release_firmware(fw);
4804 warn_code |= AscInitMicroCodeVar(asc_dvc); 4817 warn_code |= AscInitMicroCodeVar(asc_dvc);
4818 if (!asc_dvc->overrun_dma)
4819 return warn_code;
4805 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC; 4820 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
4806 AscEnableInterrupt(iop_base); 4821 AscEnableInterrupt(iop_base);
4807 return warn_code; 4822 return warn_code;
@@ -7978,9 +7993,10 @@ static int advansys_reset(struct scsi_cmnd *scp)
7978 status = AscInitAsc1000Driver(asc_dvc); 7993 status = AscInitAsc1000Driver(asc_dvc);
7979 7994
7980 /* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */ 7995 /* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */
7981 if (asc_dvc->err_code) { 7996 if (asc_dvc->err_code || !asc_dvc->overrun_dma) {
7982 scmd_printk(KERN_INFO, scp, "SCSI bus reset error: " 7997 scmd_printk(KERN_INFO, scp, "SCSI bus reset error: "
7983 "0x%x\n", asc_dvc->err_code); 7998 "0x%x, status: 0x%x\n", asc_dvc->err_code,
7999 status);
7984 ret = FAILED; 8000 ret = FAILED;
7985 } else if (status) { 8001 } else if (status) {
7986 scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: " 8002 scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: "
@@ -12311,7 +12327,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
12311 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL); 12327 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
12312 if (!asc_dvc_varp->overrun_buf) { 12328 if (!asc_dvc_varp->overrun_buf) {
12313 ret = -ENOMEM; 12329 ret = -ENOMEM;
12314 goto err_free_wide_mem; 12330 goto err_free_irq;
12315 } 12331 }
12316 warn_code = AscInitAsc1000Driver(asc_dvc_varp); 12332 warn_code = AscInitAsc1000Driver(asc_dvc_varp);
12317 12333
@@ -12320,30 +12336,36 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
12320 "warn 0x%x, error 0x%x\n", 12336 "warn 0x%x, error 0x%x\n",
12321 asc_dvc_varp->init_state, warn_code, 12337 asc_dvc_varp->init_state, warn_code,
12322 asc_dvc_varp->err_code); 12338 asc_dvc_varp->err_code);
12323 if (asc_dvc_varp->err_code) { 12339 if (!asc_dvc_varp->overrun_dma) {
12324 ret = -ENODEV; 12340 ret = -ENODEV;
12325 kfree(asc_dvc_varp->overrun_buf); 12341 goto err_free_mem;
12326 } 12342 }
12327 } 12343 }
12328 } else { 12344 } else {
12329 if (advansys_wide_init_chip(shost)) 12345 if (advansys_wide_init_chip(shost)) {
12330 ret = -ENODEV; 12346 ret = -ENODEV;
12347 goto err_free_mem;
12348 }
12331 } 12349 }
12332 12350
12333 if (ret)
12334 goto err_free_wide_mem;
12335
12336 ASC_DBG_PRT_SCSI_HOST(2, shost); 12351 ASC_DBG_PRT_SCSI_HOST(2, shost);
12337 12352
12338 ret = scsi_add_host(shost, boardp->dev); 12353 ret = scsi_add_host(shost, boardp->dev);
12339 if (ret) 12354 if (ret)
12340 goto err_free_wide_mem; 12355 goto err_free_mem;
12341 12356
12342 scsi_scan_host(shost); 12357 scsi_scan_host(shost);
12343 return 0; 12358 return 0;
12344 12359
12345 err_free_wide_mem: 12360 err_free_mem:
12346 advansys_wide_free_mem(boardp); 12361 if (ASC_NARROW_BOARD(boardp)) {
12362 if (asc_dvc_varp->overrun_dma)
12363 dma_unmap_single(boardp->dev, asc_dvc_varp->overrun_dma,
12364 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
12365 kfree(asc_dvc_varp->overrun_buf);
12366 } else
12367 advansys_wide_free_mem(boardp);
12368 err_free_irq:
12347 free_irq(boardp->irq, shost); 12369 free_irq(boardp->irq, shost);
12348 err_free_dma: 12370 err_free_dma:
12349#ifdef CONFIG_ISA 12371#ifdef CONFIG_ISA
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 72617b650a7e..e641922f20bc 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -169,6 +169,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
169 SE_DEBUG(DBG_LVL_1, 169 SE_DEBUG(DBG_LVL_1,
170 "Failed to allocate memory for" 170 "Failed to allocate memory for"
171 "mgmt_invalidate_icds \n"); 171 "mgmt_invalidate_icds \n");
172 spin_unlock(&ctrl->mbox_lock);
172 return -1; 173 return -1;
173 } 174 }
174 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); 175 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 6cf9dc37d78b..6b624e767d3b 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -362,6 +362,7 @@ struct bnx2i_hba {
362 u32 num_ccell; 362 u32 num_ccell;
363 363
364 int ofld_conns_active; 364 int ofld_conns_active;
365 wait_queue_head_t eh_wait;
365 366
366 int max_active_conns; 367 int max_active_conns;
367 struct iscsi_cid_queue cid_que; 368 struct iscsi_cid_queue cid_que;
@@ -381,6 +382,7 @@ struct bnx2i_hba {
381 spinlock_t lock; /* protects hba structure access */ 382 spinlock_t lock; /* protects hba structure access */
382 struct mutex net_dev_lock;/* sync net device access */ 383 struct mutex net_dev_lock;/* sync net device access */
383 384
385 int hba_shutdown_tmo;
384 /* 386 /*
385 * PCI related info. 387 * PCI related info.
386 */ 388 */
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 6d8172e781cf..5d9296c599f6 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -177,11 +177,22 @@ void bnx2i_stop(void *handle)
177 struct bnx2i_hba *hba = handle; 177 struct bnx2i_hba *hba = handle;
178 178
179 /* check if cleanup happened in GOING_DOWN context */ 179 /* check if cleanup happened in GOING_DOWN context */
180 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state);
181 if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN, 180 if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN,
182 &hba->adapter_state)) 181 &hba->adapter_state))
183 iscsi_host_for_each_session(hba->shost, 182 iscsi_host_for_each_session(hba->shost,
184 bnx2i_drop_session); 183 bnx2i_drop_session);
184
185 /* Wait for all endpoints to be torn down, Chip will be reset once
186 * control returns to network driver. So it is required to cleanup and
187 * release all connection resources before returning from this routine.
188 */
189 wait_event_interruptible_timeout(hba->eh_wait,
190 (hba->ofld_conns_active == 0),
191 hba->hba_shutdown_tmo);
192 /* This flag should be cleared last so that ep_disconnect() gracefully
193 * cleans up connection context
194 */
195 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state);
185} 196}
186 197
187/** 198/**
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index f2e9b18fe76c..fa68ab34b998 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -820,6 +820,11 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
820 820
821 spin_lock_init(&hba->lock); 821 spin_lock_init(&hba->lock);
822 mutex_init(&hba->net_dev_lock); 822 mutex_init(&hba->net_dev_lock);
823 init_waitqueue_head(&hba->eh_wait);
824 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
825 hba->hba_shutdown_tmo = 240 * HZ;
826 else /* 5706/5708/5709 */
827 hba->hba_shutdown_tmo = 30 * HZ;
823 828
824 if (iscsi_host_add(shost, &hba->pcidev->dev)) 829 if (iscsi_host_add(shost, &hba->pcidev->dev))
825 goto free_dump_mem; 830 goto free_dump_mem;
@@ -1658,8 +1663,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1658 */ 1663 */
1659 hba = bnx2i_check_route(dst_addr); 1664 hba = bnx2i_check_route(dst_addr);
1660 1665
1661 if (!hba) { 1666 if (!hba || test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state)) {
1662 rc = -ENOMEM; 1667 rc = -EINVAL;
1663 goto check_busy; 1668 goto check_busy;
1664 } 1669 }
1665 1670
@@ -1804,7 +1809,7 @@ static int bnx2i_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1804 (bnx2i_ep->state == 1809 (bnx2i_ep->state ==
1805 EP_STATE_CONNECT_COMPL)), 1810 EP_STATE_CONNECT_COMPL)),
1806 msecs_to_jiffies(timeout_ms)); 1811 msecs_to_jiffies(timeout_ms));
1807 if (!rc || (bnx2i_ep->state == EP_STATE_OFLD_FAILED)) 1812 if (bnx2i_ep->state == EP_STATE_OFLD_FAILED)
1808 rc = -1; 1813 rc = -1;
1809 1814
1810 if (rc > 0) 1815 if (rc > 0)
@@ -1957,6 +1962,8 @@ return_bnx2i_ep:
1957 1962
1958 if (!hba->ofld_conns_active) 1963 if (!hba->ofld_conns_active)
1959 bnx2i_unreg_dev_all(); 1964 bnx2i_unreg_dev_all();
1965
1966 wake_up_interruptible(&hba->eh_wait);
1960} 1967}
1961 1968
1962 1969
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 496764349c41..0435d044c9da 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -188,7 +188,8 @@ MODULE_DEVICE_TABLE(pci,dptids);
188static int adpt_detect(struct scsi_host_template* sht) 188static int adpt_detect(struct scsi_host_template* sht)
189{ 189{
190 struct pci_dev *pDev = NULL; 190 struct pci_dev *pDev = NULL;
191 adpt_hba* pHba; 191 adpt_hba *pHba;
192 adpt_hba *next;
192 193
193 PINFO("Detecting Adaptec I2O RAID controllers...\n"); 194 PINFO("Detecting Adaptec I2O RAID controllers...\n");
194 195
@@ -206,7 +207,8 @@ static int adpt_detect(struct scsi_host_template* sht)
206 } 207 }
207 208
208 /* In INIT state, Activate IOPs */ 209 /* In INIT state, Activate IOPs */
209 for (pHba = hba_chain; pHba; pHba = pHba->next) { 210 for (pHba = hba_chain; pHba; pHba = next) {
211 next = pHba->next;
210 // Activate does get status , init outbound, and get hrt 212 // Activate does get status , init outbound, and get hrt
211 if (adpt_i2o_activate_hba(pHba) < 0) { 213 if (adpt_i2o_activate_hba(pHba) < 0) {
212 adpt_i2o_delete_hba(pHba); 214 adpt_i2o_delete_hba(pHba);
@@ -243,7 +245,8 @@ rebuild_sys_tab:
243 PDEBUG("HBA's in OPERATIONAL state\n"); 245 PDEBUG("HBA's in OPERATIONAL state\n");
244 246
245 printk("dpti: If you have a lot of devices this could take a few minutes.\n"); 247 printk("dpti: If you have a lot of devices this could take a few minutes.\n");
246 for (pHba = hba_chain; pHba; pHba = pHba->next) { 248 for (pHba = hba_chain; pHba; pHba = next) {
249 next = pHba->next;
247 printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name); 250 printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name);
248 if (adpt_i2o_lct_get(pHba) < 0){ 251 if (adpt_i2o_lct_get(pHba) < 0){
249 adpt_i2o_delete_hba(pHba); 252 adpt_i2o_delete_hba(pHba);
@@ -263,7 +266,8 @@ rebuild_sys_tab:
263 adpt_sysfs_class = NULL; 266 adpt_sysfs_class = NULL;
264 } 267 }
265 268
266 for (pHba = hba_chain; pHba; pHba = pHba->next) { 269 for (pHba = hba_chain; pHba; pHba = next) {
270 next = pHba->next;
267 if (adpt_scsi_host_alloc(pHba, sht) < 0){ 271 if (adpt_scsi_host_alloc(pHba, sht) < 0){
268 adpt_i2o_delete_hba(pHba); 272 adpt_i2o_delete_hba(pHba);
269 continue; 273 continue;
@@ -1229,11 +1233,10 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1229 } 1233 }
1230 } 1234 }
1231 pci_dev_put(pHba->pDev); 1235 pci_dev_put(pHba->pDev);
1232 kfree(pHba);
1233
1234 if (adpt_sysfs_class) 1236 if (adpt_sysfs_class)
1235 device_destroy(adpt_sysfs_class, 1237 device_destroy(adpt_sysfs_class,
1236 MKDEV(DPTI_I2O_MAJOR, pHba->unit)); 1238 MKDEV(DPTI_I2O_MAJOR, pHba->unit));
1239 kfree(pHba);
1237 1240
1238 if(hba_count <= 0){ 1241 if(hba_count <= 0){
1239 unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER); 1242 unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER);
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index ff5ec5ac1fb5..88bad0e81bdd 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -323,16 +323,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd,
323 srp_cmd->buf_fmt = fmt; 323 srp_cmd->buf_fmt = fmt;
324} 324}
325 325
326static void unmap_sg_list(int num_entries,
327 struct device *dev,
328 struct srp_direct_buf *md)
329{
330 int i;
331
332 for (i = 0; i < num_entries; ++i)
333 dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
334}
335
336/** 326/**
337 * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format 327 * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
338 * @cmd: srp_cmd whose additional_data member will be unmapped 328 * @cmd: srp_cmd whose additional_data member will be unmapped
@@ -350,24 +340,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
350 340
351 if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC) 341 if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
352 return; 342 return;
353 else if (out_fmt == SRP_DATA_DESC_DIRECT ||
354 in_fmt == SRP_DATA_DESC_DIRECT) {
355 struct srp_direct_buf *data =
356 (struct srp_direct_buf *) cmd->add_data;
357 dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
358 } else {
359 struct srp_indirect_buf *indirect =
360 (struct srp_indirect_buf *) cmd->add_data;
361 int num_mapped = indirect->table_desc.len /
362 sizeof(struct srp_direct_buf);
363 343
364 if (num_mapped <= MAX_INDIRECT_BUFS) { 344 if (evt_struct->cmnd)
365 unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]); 345 scsi_dma_unmap(evt_struct->cmnd);
366 return;
367 }
368
369 unmap_sg_list(num_mapped, dev, evt_struct->ext_list);
370 }
371} 346}
372 347
373static int map_sg_list(struct scsi_cmnd *cmd, int nseg, 348static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 6d5ae4474bb3..633e09036357 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -471,12 +471,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
471 471
472 WARN_ON(hdrlength >= 256); 472 WARN_ON(hdrlength >= 256);
473 hdr->hlength = hdrlength & 0xFF; 473 hdr->hlength = hdrlength & 0xFF;
474 hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
474 475
475 if (session->tt->init_task && session->tt->init_task(task)) 476 if (session->tt->init_task && session->tt->init_task(task))
476 return -EIO; 477 return -EIO;
477 478
478 task->state = ISCSI_TASK_RUNNING; 479 task->state = ISCSI_TASK_RUNNING;
479 hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
480 session->cmdsn++; 480 session->cmdsn++;
481 481
482 conn->scsicmd_pdus_cnt++; 482 conn->scsicmd_pdus_cnt++;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index b00efd19aadb..88f744672576 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -395,11 +395,15 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
395void sas_ata_task_abort(struct sas_task *task) 395void sas_ata_task_abort(struct sas_task *task)
396{ 396{
397 struct ata_queued_cmd *qc = task->uldd_task; 397 struct ata_queued_cmd *qc = task->uldd_task;
398 struct request_queue *q = qc->scsicmd->device->request_queue;
398 struct completion *waiting; 399 struct completion *waiting;
400 unsigned long flags;
399 401
400 /* Bounce SCSI-initiated commands to the SCSI EH */ 402 /* Bounce SCSI-initiated commands to the SCSI EH */
401 if (qc->scsicmd) { 403 if (qc->scsicmd) {
404 spin_lock_irqsave(q->queue_lock, flags);
402 blk_abort_request(qc->scsicmd->request); 405 blk_abort_request(qc->scsicmd->request);
406 spin_unlock_irqrestore(q->queue_lock, flags);
403 scsi_schedule_eh(qc->scsicmd->device->host); 407 scsi_schedule_eh(qc->scsicmd->device->host);
404 return; 408 return;
405 } 409 }
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 2660e1b4569a..822835055cef 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1030,6 +1030,8 @@ int __sas_task_abort(struct sas_task *task)
1030void sas_task_abort(struct sas_task *task) 1030void sas_task_abort(struct sas_task *task)
1031{ 1031{
1032 struct scsi_cmnd *sc = task->uldd_task; 1032 struct scsi_cmnd *sc = task->uldd_task;
1033 struct request_queue *q = sc->device->request_queue;
1034 unsigned long flags;
1033 1035
1034 /* Escape for libsas internal commands */ 1036 /* Escape for libsas internal commands */
1035 if (!sc) { 1037 if (!sc) {
@@ -1044,7 +1046,9 @@ void sas_task_abort(struct sas_task *task)
1044 return; 1046 return;
1045 } 1047 }
1046 1048
1049 spin_lock_irqsave(q->queue_lock, flags);
1047 blk_abort_request(sc->request); 1050 blk_abort_request(sc->request);
1051 spin_unlock_irqrestore(q->queue_lock, flags);
1048 scsi_schedule_eh(sc->device->host); 1052 scsi_schedule_eh(sc->device->host);
1049} 1053}
1050 1054
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index ec3723831e89..d62b3e467926 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -433,7 +433,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
433 dd_data = cmdiocbq->context1; 433 dd_data = cmdiocbq->context1;
434 /* normal completion and timeout crossed paths, already done */ 434 /* normal completion and timeout crossed paths, already done */
435 if (!dd_data) { 435 if (!dd_data) {
436 spin_unlock_irqrestore(&phba->hbalock, flags); 436 spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
437 return; 437 return;
438 } 438 }
439 439
@@ -1196,7 +1196,7 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
1196 dd_data = cmdiocbq->context1; 1196 dd_data = cmdiocbq->context1;
1197 /* normal completion and timeout crossed paths, already done */ 1197 /* normal completion and timeout crossed paths, already done */
1198 if (!dd_data) { 1198 if (!dd_data) {
1199 spin_unlock_irqrestore(&phba->hbalock, flags); 1199 spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
1200 return; 1200 return;
1201 } 1201 }
1202 1202
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 359e9a71a021..1c7ef55966fb 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2393,6 +2393,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
2393 return 0; 2393 return 0;
2394 2394
2395done: 2395done:
2396 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2396 if (bsg_job->request->msgcode == FC_BSG_HST_CT) 2397 if (bsg_job->request->msgcode == FC_BSG_HST_CT)
2397 kfree(sp->fcport); 2398 kfree(sp->fcport);
2398 kfree(sp->ctx); 2399 kfree(sp->ctx);
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 09d6d4b76f39..caeb7d10ae04 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -467,7 +467,7 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
467 if (conn_err_detail) 467 if (conn_err_detail)
468 *conn_err_detail = mbox_sts[5]; 468 *conn_err_detail = mbox_sts[5];
469 if (tcp_source_port_num) 469 if (tcp_source_port_num)
470 *tcp_source_port_num = (uint16_t) mbox_sts[6] >> 16; 470 *tcp_source_port_num = (uint16_t) (mbox_sts[6] >> 16);
471 if (connection_id) 471 if (connection_id)
472 *connection_id = (uint16_t) mbox_sts[6] & 0x00FF; 472 *connection_id = (uint16_t) mbox_sts[6] & 0x00FF;
473 status = QLA_SUCCESS; 473 status = QLA_SUCCESS;
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3e10c306de94..3a5bfd10b2cb 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -957,7 +957,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
957static sector_t get_sdebug_capacity(void) 957static sector_t get_sdebug_capacity(void)
958{ 958{
959 if (scsi_debug_virtual_gb > 0) 959 if (scsi_debug_virtual_gb > 0)
960 return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb; 960 return (sector_t)scsi_debug_virtual_gb *
961 (1073741824 / scsi_debug_sector_size);
961 else 962 else
962 return sdebug_store_sectors; 963 return sdebug_store_sectors;
963} 964}
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index d45c69ca5737..7ad53fa42766 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -302,7 +302,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
302 if (scmd->device->allow_restart && 302 if (scmd->device->allow_restart &&
303 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02)) 303 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
304 return FAILED; 304 return FAILED;
305 return SUCCESS; 305
306 if (blk_barrier_rq(scmd->request))
307 /*
308 * barrier requests should always retry on UA
309 * otherwise block will get a spurious error
310 */
311 return NEEDS_RETRY;
312 else
313 /*
314 * for normal (non barrier) commands, pass the
315 * UA upwards for a determination in the
316 * completion functions
317 */
318 return SUCCESS;
306 319
307 /* these three are not supported */ 320 /* these three are not supported */
308 case COPY_ABORTED: 321 case COPY_ABORTED:
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8b827f37b03e..de6c60320f6f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1040,6 +1040,7 @@ static void sd_prepare_flush(struct request_queue *q, struct request *rq)
1040{ 1040{
1041 rq->cmd_type = REQ_TYPE_BLOCK_PC; 1041 rq->cmd_type = REQ_TYPE_BLOCK_PC;
1042 rq->timeout = SD_TIMEOUT; 1042 rq->timeout = SD_TIMEOUT;
1043 rq->retries = SD_MAX_RETRIES;
1043 rq->cmd[0] = SYNCHRONIZE_CACHE; 1044 rq->cmd[0] = SYNCHRONIZE_CACHE;
1044 rq->cmd_len = 10; 1045 rq->cmd_len = 10;
1045} 1046}
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index d0b7d2ff9ac5..333580bf37c5 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1587,7 +1587,7 @@ static int wd7000_host_reset(struct scsi_cmnd *SCpnt)
1587{ 1587{
1588 Adapter *host = (Adapter *) SCpnt->device->host->hostdata; 1588 Adapter *host = (Adapter *) SCpnt->device->host->hostdata;
1589 1589
1590 spin_unlock_irq(SCpnt->device->host->host_lock); 1590 spin_lock_irq(SCpnt->device->host->host_lock);
1591 1591
1592 if (wd7000_adapter_reset(host) < 0) { 1592 if (wd7000_adapter_reset(host) < 0) {
1593 spin_unlock_irq(SCpnt->device->host->host_lock); 1593 spin_unlock_irq(SCpnt->device->host->host_lock);
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 24485cc62ff8..4822cb50cd0f 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -348,6 +348,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
348 { "FUJ02E6", 0 }, 348 { "FUJ02E6", 0 },
349 /* Fujitsu Wacom 2FGT Tablet PC device */ 349 /* Fujitsu Wacom 2FGT Tablet PC device */
350 { "FUJ02E7", 0 }, 350 { "FUJ02E7", 0 },
351 /* Fujitsu Wacom 1FGT Tablet PC device */
352 { "FUJ02E9", 0 },
351 /* 353 /*
352 * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in 354 * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
353 * disguise) 355 * disguise)
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index 7bb5fee639e3..b5aaef965f24 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -263,6 +263,7 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,
263 } 263 }
264 264
265 spin_lock_irqsave(&port->lock, flags); 265 spin_lock_irqsave(&port->lock, flags);
266 uart_update_timeout(port, termios->c_cflag, baud);
266 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); 267 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR);
267 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); 268 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR);
268 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR); 269 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR);
@@ -379,6 +380,7 @@ static irqreturn_t mcf_interrupt(int irq, void *data)
379static void mcf_config_port(struct uart_port *port, int flags) 380static void mcf_config_port(struct uart_port *port, int flags)
380{ 381{
381 port->type = PORT_MCF; 382 port->type = PORT_MCF;
383 port->fifosize = MCFUART_TXFIFOSIZE;
382 384
383 /* Clear mask, so no surprise interrupts. */ 385 /* Clear mask, so no surprise interrupts. */
384 writeb(0, port->membase + MCFUART_UIMR); 386 writeb(0, port->membase + MCFUART_UIMR);
@@ -424,7 +426,7 @@ static int mcf_verify_port(struct uart_port *port, struct serial_struct *ser)
424/* 426/*
425 * Define the basic serial functions we support. 427 * Define the basic serial functions we support.
426 */ 428 */
427static struct uart_ops mcf_uart_ops = { 429static const struct uart_ops mcf_uart_ops = {
428 .tx_empty = mcf_tx_empty, 430 .tx_empty = mcf_tx_empty,
429 .get_mctrl = mcf_get_mctrl, 431 .get_mctrl = mcf_get_mctrl,
430 .set_mctrl = mcf_set_mctrl, 432 .set_mctrl = mcf_set_mctrl,
@@ -443,7 +445,7 @@ static struct uart_ops mcf_uart_ops = {
443 .verify_port = mcf_verify_port, 445 .verify_port = mcf_verify_port,
444}; 446};
445 447
446static struct mcf_uart mcf_ports[3]; 448static struct mcf_uart mcf_ports[4];
447 449
448#define MCF_MAXPORTS ARRAY_SIZE(mcf_ports) 450#define MCF_MAXPORTS ARRAY_SIZE(mcf_ports)
449 451
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 3119fddaedb5..a176ab4bd65b 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -29,39 +29,6 @@
29 * kind, whether express or implied. 29 * kind, whether express or implied.
30 */ 30 */
31 31
32/* Platform device Usage :
33 *
34 * Since PSCs can have multiple function, the correct driver for each one
35 * is selected by calling mpc52xx_match_psc_function(...). The function
36 * handled by this driver is "uart".
37 *
38 * The driver init all necessary registers to place the PSC in uart mode without
39 * DCD. However, the pin multiplexing aren't changed and should be set either
40 * by the bootloader or in the platform init code.
41 *
42 * The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2,
43 * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
44 * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
45 * fpr the console code : without this 1:1 mapping, at early boot time, when we
46 * are parsing the kernel args console=ttyPSC?, we wouldn't know which PSC it
47 * will be mapped to.
48 */
49
50/* OF Platform device Usage :
51 *
52 * This driver is only used for PSCs configured in uart mode. The device
53 * tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible
54 * list.
55 *
56 * By default, PSC devices are enumerated in the order they are found. However
57 * a particular PSC number can be forces by adding 'device_no = <port#>'
58 * to the device node.
59 *
60 * The driver init all necessary registers to place the PSC in uart mode without
61 * DCD. However, the pin multiplexing aren't changed and should be set either
62 * by the bootloader or in the platform init code.
63 */
64
65#undef DEBUG 32#undef DEBUG
66 33
67#include <linux/device.h> 34#include <linux/device.h>
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 4eaa043ca2a8..700e10833bf9 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -752,8 +752,10 @@ static void pmz_break_ctl(struct uart_port *port, int break_state)
752 uap->curregs[R5] = new_reg; 752 uap->curregs[R5] = new_reg;
753 753
754 /* NOTE: Not subject to 'transmitter active' rule. */ 754 /* NOTE: Not subject to 'transmitter active' rule. */
755 if (ZS_IS_ASLEEP(uap)) 755 if (ZS_IS_ASLEEP(uap)) {
756 spin_unlock_irqrestore(&port->lock, flags);
756 return; 757 return;
758 }
757 write_zsreg(uap, R5, uap->curregs[R5]); 759 write_zsreg(uap, R5, uap->curregs[R5]);
758 } 760 }
759 761
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 2e71bbc04dac..b1962025b1aa 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -650,6 +650,7 @@ static struct console ks8695_console = {
650 650
651static int __init ks8695_console_init(void) 651static int __init ks8695_console_init(void)
652{ 652{
653 add_preferred_console(SERIAL_KS8695_DEVNAME, 0, NULL);
653 register_console(&ks8695_console); 654 register_console(&ks8695_console);
654 return 0; 655 return 0;
655} 656}
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index d8356af118a8..e0de0d0eedea 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -204,6 +204,7 @@ static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val)
204 204
205 cs->chconf0 = val; 205 cs->chconf0 = val;
206 mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); 206 mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val);
207 mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0);
207} 208}
208 209
209static void omap2_mcspi_set_dma_req(const struct spi_device *spi, 210static void omap2_mcspi_set_dma_req(const struct spi_device *spi,
@@ -532,7 +533,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
532 goto out; 533 goto out;
533 } 534 }
534#ifdef VERBOSE 535#ifdef VERBOSE
535 dev_dbg(&spi->dev, "write-%d %04x\n", 536 dev_dbg(&spi->dev, "write-%d %08x\n",
536 word_len, *tx); 537 word_len, *tx);
537#endif 538#endif
538 __raw_writel(*tx++, tx_reg); 539 __raw_writel(*tx++, tx_reg);
@@ -550,7 +551,7 @@ omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer)
550 mcspi_write_chconf0(spi, l); 551 mcspi_write_chconf0(spi, l);
551 *rx++ = __raw_readl(rx_reg); 552 *rx++ = __raw_readl(rx_reg);
552#ifdef VERBOSE 553#ifdef VERBOSE
553 dev_dbg(&spi->dev, "read-%d %04x\n", 554 dev_dbg(&spi->dev, "read-%d %08x\n",
554 word_len, *(rx - 1)); 555 word_len, *(rx - 1));
555#endif 556#endif
556 } 557 }
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 9ffb0fdbd6fe..b3a1f9259b62 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -41,7 +41,7 @@ static void spidev_release(struct device *dev)
41 spi->master->cleanup(spi); 41 spi->master->cleanup(spi);
42 42
43 spi_master_put(spi->master); 43 spi_master_put(spi->master);
44 kfree(dev); 44 kfree(spi);
45} 45}
46 46
47static ssize_t 47static ssize_t
@@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi)
257{ 257{
258 static DEFINE_MUTEX(spi_add_lock); 258 static DEFINE_MUTEX(spi_add_lock);
259 struct device *dev = spi->master->dev.parent; 259 struct device *dev = spi->master->dev.parent;
260 struct device *d;
260 int status; 261 int status;
261 262
262 /* Chipselects are numbered 0..max; validate. */ 263 /* Chipselects are numbered 0..max; validate. */
@@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi)
278 */ 279 */
279 mutex_lock(&spi_add_lock); 280 mutex_lock(&spi_add_lock);
280 281
281 if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) 282 d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev));
282 != NULL) { 283 if (d != NULL) {
283 dev_err(dev, "chipselect %d already in use\n", 284 dev_err(dev, "chipselect %d already in use\n",
284 spi->chip_select); 285 spi->chip_select);
286 put_device(d);
285 status = -EBUSY; 287 status = -EBUSY;
286 goto done; 288 goto done;
287 } 289 }
diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c
index a67c622869d2..7ac2c6d8e9a3 100644
--- a/drivers/staging/dt3155/dt3155_drv.c
+++ b/drivers/staging/dt3155/dt3155_drv.c
@@ -57,19 +57,8 @@ MA 02111-1307 USA
57 57
58extern void printques(int); 58extern void printques(int);
59 59
60#ifdef MODULE
61#include <linux/module.h> 60#include <linux/module.h>
62#include <linux/interrupt.h> 61#include <linux/interrupt.h>
63
64
65MODULE_LICENSE("GPL");
66
67#endif
68
69#ifndef CONFIG_PCI
70#error "DT3155 : Kernel PCI support not enabled (DT3155 drive requires PCI)"
71#endif
72
73#include <linux/pci.h> 62#include <linux/pci.h>
74#include <linux/types.h> 63#include <linux/types.h>
75#include <linux/poll.h> 64#include <linux/poll.h>
@@ -84,6 +73,9 @@ MODULE_LICENSE("GPL");
84#include "dt3155_io.h" 73#include "dt3155_io.h"
85#include "allocator.h" 74#include "allocator.h"
86 75
76
77MODULE_LICENSE("GPL");
78
87/* Error variable. Zero means no error. */ 79/* Error variable. Zero means no error. */
88int dt3155_errno = 0; 80int dt3155_errno = 0;
89 81
@@ -472,9 +464,9 @@ static void dt3155_init_isr(int minor)
472 /* 50/60 Hz should be set before this point but let's make sure it is */ 464 /* 50/60 Hz should be set before this point but let's make sure it is */
473 /* right anyway */ 465 /* right anyway */
474 466
475 ReadI2C(dt3155_lbase[ minor ], CONFIG, &i2c_csr2.reg); 467 ReadI2C(dt3155_lbase[ minor ], CSR2, &i2c_csr2.reg);
476 i2c_csr2.fld.HZ50 = FORMAT50HZ; 468 i2c_csr2.fld.HZ50 = FORMAT50HZ;
477 WriteI2C(dt3155_lbase[ minor ], CONFIG, i2c_config.reg); 469 WriteI2C(dt3155_lbase[ minor ], CSR2, i2c_csr2.reg);
478 470
479 /* enable busmaster chip, clear flags */ 471 /* enable busmaster chip, clear flags */
480 472
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
index 5d53889fb4a4..3a1112d29aeb 100644
--- a/drivers/staging/hv/Hv.c
+++ b/drivers/staging/hv/Hv.c
@@ -306,9 +306,9 @@ void HvCleanup(void)
306 DPRINT_ENTER(VMBUS); 306 DPRINT_ENTER(VMBUS);
307 307
308 if (gHvContext.SignalEventBuffer) { 308 if (gHvContext.SignalEventBuffer) {
309 kfree(gHvContext.SignalEventBuffer);
309 gHvContext.SignalEventBuffer = NULL; 310 gHvContext.SignalEventBuffer = NULL;
310 gHvContext.SignalEventParam = NULL; 311 gHvContext.SignalEventParam = NULL;
311 kfree(gHvContext.SignalEventBuffer);
312 } 312 }
313 313
314 if (gHvContext.HypercallPage) { 314 if (gHvContext.HypercallPage) {
diff --git a/drivers/staging/hv/RndisFilter.c b/drivers/staging/hv/RndisFilter.c
index cd2930de2176..6704f64c93f0 100644
--- a/drivers/staging/hv/RndisFilter.c
+++ b/drivers/staging/hv/RndisFilter.c
@@ -751,6 +751,7 @@ static int RndisFilterOpenDevice(struct rndis_device *Device)
751 751
752 ret = RndisFilterSetPacketFilter(Device, 752 ret = RndisFilterSetPacketFilter(Device,
753 NDIS_PACKET_TYPE_BROADCAST | 753 NDIS_PACKET_TYPE_BROADCAST |
754 NDIS_PACKET_TYPE_ALL_MULTICAST |
754 NDIS_PACKET_TYPE_DIRECTED); 755 NDIS_PACKET_TYPE_DIRECTED);
755 if (ret == 0) 756 if (ret == 0)
756 Device->State = RNDIS_DEV_DATAINITIALIZED; 757 Device->State = RNDIS_DEV_DATAINITIALIZED;
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 2ccb6b93fe47..ab27d9a4446d 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -403,8 +403,7 @@ static int netvsc_probe(struct device *device)
403 if (!net_drv_obj->Base.OnDeviceAdd) 403 if (!net_drv_obj->Base.OnDeviceAdd)
404 return -1; 404 return -1;
405 405
406 net = alloc_netdev(sizeof(struct net_device_context), "seth%d", 406 net = alloc_etherdev(sizeof(struct net_device_context));
407 ether_setup);
408 if (!net) 407 if (!net)
409 return -1; 408 return -1;
410 409
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index ea76902797bb..82e43588e8a5 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -618,7 +618,7 @@ static int lis3l02dq_thresh_handler_th(struct iio_dev *dev_info,
618static void lis3l02dq_thresh_handler_bh_no_check(struct work_struct *work_s) 618static void lis3l02dq_thresh_handler_bh_no_check(struct work_struct *work_s)
619{ 619{
620 struct iio_work_cont *wc 620 struct iio_work_cont *wc
621 = container_of(work_s, struct iio_work_cont, ws_nocheck); 621 = container_of(work_s, struct iio_work_cont, ws);
622 struct lis3l02dq_state *st = wc->st; 622 struct lis3l02dq_state *st = wc->st;
623 u8 t; 623 u8 t;
624 624
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 93712430e579..a4d97ea0df3d 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -493,6 +493,9 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
493 struct lis3l02dq_state *state = indio_dev->dev_data; 493 struct lis3l02dq_state *state = indio_dev->dev_data;
494 494
495 state->trig = iio_allocate_trigger(); 495 state->trig = iio_allocate_trigger();
496 if (!state->trig)
497 return -ENOMEM;
498
496 state->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL); 499 state->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL);
497 if (!state->trig->name) { 500 if (!state->trig->name) {
498 ret = -ENOMEM; 501 ret = -ENOMEM;
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 790d1cc9cdc3..773f1d1d9c6e 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -557,6 +557,7 @@ error_put_reg:
557 if (!IS_ERR(st->reg)) 557 if (!IS_ERR(st->reg))
558 regulator_put(st->reg); 558 regulator_put(st->reg);
559error_free_st: 559error_free_st:
560 i2c_set_clientdata(client, NULL);
560 kfree(st); 561 kfree(st);
561 562
562error_ret: 563error_ret:
@@ -574,6 +575,7 @@ static int max1363_remove(struct i2c_client *client)
574 regulator_disable(st->reg); 575 regulator_disable(st->reg);
575 regulator_put(st->reg); 576 regulator_put(st->reg);
576 } 577 }
578 i2c_set_clientdata(client, NULL);
577 kfree(st); 579 kfree(st);
578 580
579 return 0; 581 return 0;
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 37f58f66e491..1d77082c8531 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -537,6 +537,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
537 sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs); 537 sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
538} 538}
539 539
540/* Return a negative errno on failure */
540int iio_get_new_idr_val(struct idr *this_idr) 541int iio_get_new_idr_val(struct idr *this_idr)
541{ 542{
542 int ret; 543 int ret;
@@ -660,7 +661,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
660 for (i = 0; i < dev_info->num_interrupt_lines; i++) { 661 for (i = 0; i < dev_info->num_interrupt_lines; i++) {
661 dev_info->event_interfaces[i].owner = dev_info->driver_module; 662 dev_info->event_interfaces[i].owner = dev_info->driver_module;
662 ret = iio_get_new_idr_val(&iio_event_idr); 663 ret = iio_get_new_idr_val(&iio_event_idr);
663 if (ret) 664 if (ret < 0)
664 goto error_free_setup_ev_ints; 665 goto error_free_setup_ev_ints;
665 else 666 else
666 dev_info->event_interfaces[i].id = ret; 667 dev_info->event_interfaces[i].id = ret;
diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index 1ba4aa392f6e..8770a00e3652 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -682,6 +682,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
682fail2: 682fail2:
683 iio_device_unregister(chip->indio_dev); 683 iio_device_unregister(chip->indio_dev);
684fail1: 684fail1:
685 i2c_set_clientdata(client, NULL);
685 kfree(chip); 686 kfree(chip);
686 return err; 687 return err;
687} 688}
@@ -692,6 +693,7 @@ static int tsl2563_remove(struct i2c_client *client)
692 693
693 iio_device_unregister(chip->indio_dev); 694 iio_device_unregister(chip->indio_dev);
694 695
696 i2c_set_clientdata(client, NULL);
695 kfree(chip); 697 kfree(chip);
696 return 0; 698 return 0;
697} 699}
diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c
index b104c3d9c35e..cf22c091668c 100644
--- a/drivers/staging/iio/ring_sw.c
+++ b/drivers/staging/iio/ring_sw.c
@@ -293,7 +293,7 @@ again:
293 return -EAGAIN; 293 return -EAGAIN;
294 memcpy(data, last_written_p_copy, ring->buf.bpd); 294 memcpy(data, last_written_p_copy, ring->buf.bpd);
295 295
296 if (unlikely(ring->last_written_p >= last_written_p_copy)) 296 if (unlikely(ring->last_written_p != last_written_p_copy))
297 goto again; 297 goto again;
298 298
299 iio_unmark_sw_rb_in_use(&ring->buf); 299 iio_unmark_sw_rb_in_use(&ring->buf);
diff --git a/drivers/staging/octeon/cvmx-helper-board.c b/drivers/staging/octeon/cvmx-helper-board.c
index 3085e38a6f99..00a555b83354 100644
--- a/drivers/staging/octeon/cvmx-helper-board.c
+++ b/drivers/staging/octeon/cvmx-helper-board.c
@@ -153,6 +153,14 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
153 * through switch. 153 * through switch.
154 */ 154 */
155 return -1; 155 return -1;
156
157 case CVMX_BOARD_TYPE_CUST_WSX16:
158 if (ipd_port >= 0 && ipd_port <= 3)
159 return ipd_port;
160 else if (ipd_port >= 16 && ipd_port <= 19)
161 return ipd_port - 16 + 4;
162 else
163 return -1;
156 } 164 }
157 165
158 /* Some unknown board. Somebody forgot to update this function... */ 166 /* Some unknown board. Somebody forgot to update this function... */
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c
index 1873a79bb033..740db0c1ac01 100644
--- a/drivers/staging/rt2860/usb_main_dev.c
+++ b/drivers/staging/rt2860/usb_main_dev.c
@@ -63,6 +63,7 @@ struct usb_device_id rtusb_usb_id[] = {
63 {USB_DEVICE(0x07D1, 0x3C11)}, /* D-Link */ 63 {USB_DEVICE(0x07D1, 0x3C11)}, /* D-Link */
64 {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ 64 {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */
65 {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ 65 {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */
66 {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */
66 {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ 67 {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */
67 {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ 68 {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */
68 {USB_DEVICE(0x07AA, 0x002F)}, /* Corega */ 69 {USB_DEVICE(0x07AA, 0x002F)}, /* Corega */
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
index e16256fe595a..04d9b85f3d4c 100644
--- a/drivers/staging/rtl8192su/r8192U_core.c
+++ b/drivers/staging/rtl8192su/r8192U_core.c
@@ -113,14 +113,17 @@ u32 rt_global_debug_component = \
113 113
114static const struct usb_device_id rtl8192_usb_id_tbl[] = { 114static const struct usb_device_id rtl8192_usb_id_tbl[] = {
115 /* Realtek */ 115 /* Realtek */
116 {USB_DEVICE(0x0bda, 0x8171)},
116 {USB_DEVICE(0x0bda, 0x8192)}, 117 {USB_DEVICE(0x0bda, 0x8192)},
117 {USB_DEVICE(0x0bda, 0x8709)}, 118 {USB_DEVICE(0x0bda, 0x8709)},
118 /* Corega */ 119 /* Corega */
119 {USB_DEVICE(0x07aa, 0x0043)}, 120 {USB_DEVICE(0x07aa, 0x0043)},
120 /* Belkin */ 121 /* Belkin */
121 {USB_DEVICE(0x050d, 0x805E)}, 122 {USB_DEVICE(0x050d, 0x805E)},
123 {USB_DEVICE(0x050d, 0x815F)}, /* Belkin F5D8053 v6 */
122 /* Sitecom */ 124 /* Sitecom */
123 {USB_DEVICE(0x0df6, 0x0031)}, 125 {USB_DEVICE(0x0df6, 0x0031)},
126 {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
124 /* EnGenius */ 127 /* EnGenius */
125 {USB_DEVICE(0x1740, 0x9201)}, 128 {USB_DEVICE(0x1740, 0x9201)},
126 /* Dlink */ 129 /* Dlink */
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index 6da1021e8a65..a2566f1075d5 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -117,6 +117,9 @@ void usbip_stop_eh(struct usbip_device *ud)
117{ 117{
118 struct usbip_task *eh = &ud->eh; 118 struct usbip_task *eh = &ud->eh;
119 119
120 if (eh->thread == current)
121 return; /* do not wait for myself */
122
120 wait_for_completion(&eh->thread_done); 123 wait_for_completion(&eh->thread_done);
121 usbip_dbg_eh("usbip_eh has finished\n"); 124 usbip_dbg_eh("usbip_eh has finished\n");
122} 125}
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index 68f24425977f..783051f59f19 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -2455,9 +2455,10 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2455 dev_info(&pdev->dev, "VME Write and flush and error check is %s\n", 2455 dev_info(&pdev->dev, "VME Write and flush and error check is %s\n",
2456 err_chk ? "enabled" : "disabled"); 2456 err_chk ? "enabled" : "disabled");
2457 2457
2458 if (tsi148_crcsr_init(tsi148_bridge, pdev)) 2458 if (tsi148_crcsr_init(tsi148_bridge, pdev)) {
2459 dev_err(&pdev->dev, "CR/CSR configuration failed.\n"); 2459 dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
2460 goto err_crcsr; 2460 goto err_crcsr;
2461 }
2461 2462
2462 retval = vme_register_bridge(tsi148_bridge); 2463 retval = vme_register_bridge(tsi148_bridge);
2463 if (retval != 0) { 2464 if (retval != 0) {
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index be6331e2c276..5e1a253b08a0 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1542,6 +1542,9 @@ static const struct usb_device_id acm_ids[] = {
1542 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ 1542 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
1543 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1543 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1544 }, 1544 },
1545 { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
1546 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1547 },
1545 1548
1546 /* Nokia S60 phones expose two ACM channels. The first is 1549 /* Nokia S60 phones expose two ACM channels. The first is
1547 * a modem and is picked up by the standard AT-command 1550 * a modem and is picked up by the standard AT-command
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 97a819c23ef3..7e594449600e 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -109,7 +109,7 @@ config USB_SUSPEND
109config USB_OTG 109config USB_OTG
110 bool 110 bool
111 depends on USB && EXPERIMENTAL 111 depends on USB && EXPERIMENTAL
112 select USB_SUSPEND 112 depends on USB_SUSPEND
113 default n 113 default n
114 114
115 115
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 6a3b5cae3a6e..2f3dc4cdf79b 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -301,7 +301,7 @@ static int usb_probe_interface(struct device *dev)
301 301
302 intf->condition = USB_INTERFACE_BINDING; 302 intf->condition = USB_INTERFACE_BINDING;
303 303
304 /* Bound interfaces are initially active. They are 304 /* Probed interfaces are initially active. They are
305 * runtime-PM-enabled only if the driver has autosuspend support. 305 * runtime-PM-enabled only if the driver has autosuspend support.
306 * They are sensitive to their children's power states. 306 * They are sensitive to their children's power states.
307 */ 307 */
@@ -437,11 +437,11 @@ int usb_driver_claim_interface(struct usb_driver *driver,
437 437
438 iface->condition = USB_INTERFACE_BOUND; 438 iface->condition = USB_INTERFACE_BOUND;
439 439
440 /* Bound interfaces are initially active. They are 440 /* Claimed interfaces are initially inactive (suspended). They are
441 * runtime-PM-enabled only if the driver has autosuspend support. 441 * runtime-PM-enabled only if the driver has autosuspend support.
442 * They are sensitive to their children's power states. 442 * They are sensitive to their children's power states.
443 */ 443 */
444 pm_runtime_set_active(dev); 444 pm_runtime_set_suspended(dev);
445 pm_suspend_ignore_children(dev, false); 445 pm_suspend_ignore_children(dev, false);
446 if (driver->supports_autosuspend) 446 if (driver->supports_autosuspend)
447 pm_runtime_enable(dev); 447 pm_runtime_enable(dev);
@@ -1170,7 +1170,7 @@ done:
1170static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) 1170static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1171{ 1171{
1172 int status = 0; 1172 int status = 0;
1173 int i = 0; 1173 int i = 0, n = 0;
1174 struct usb_interface *intf; 1174 struct usb_interface *intf;
1175 1175
1176 if (udev->state == USB_STATE_NOTATTACHED || 1176 if (udev->state == USB_STATE_NOTATTACHED ||
@@ -1179,7 +1179,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1179 1179
1180 /* Suspend all the interfaces and then udev itself */ 1180 /* Suspend all the interfaces and then udev itself */
1181 if (udev->actconfig) { 1181 if (udev->actconfig) {
1182 for (; i < udev->actconfig->desc.bNumInterfaces; i++) { 1182 n = udev->actconfig->desc.bNumInterfaces;
1183 for (i = n - 1; i >= 0; --i) {
1183 intf = udev->actconfig->interface[i]; 1184 intf = udev->actconfig->interface[i];
1184 status = usb_suspend_interface(udev, intf, msg); 1185 status = usb_suspend_interface(udev, intf, msg);
1185 if (status != 0) 1186 if (status != 0)
@@ -1192,7 +1193,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1192 /* If the suspend failed, resume interfaces that did get suspended */ 1193 /* If the suspend failed, resume interfaces that did get suspended */
1193 if (status != 0) { 1194 if (status != 0) {
1194 msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME); 1195 msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME);
1195 while (--i >= 0) { 1196 while (++i < n) {
1196 intf = udev->actconfig->interface[i]; 1197 intf = udev->actconfig->interface[i];
1197 usb_resume_interface(udev, intf, msg, 0); 1198 usb_resume_interface(udev, intf, msg, 0);
1198 } 1199 }
@@ -1263,13 +1264,47 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
1263 return status; 1264 return status;
1264} 1265}
1265 1266
1267static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
1268{
1269 int w, i;
1270 struct usb_interface *intf;
1271
1272 /* Remote wakeup is needed only when we actually go to sleep.
1273 * For things like FREEZE and QUIESCE, if the device is already
1274 * autosuspended then its current wakeup setting is okay.
1275 */
1276 if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_QUIESCE) {
1277 if (udev->state != USB_STATE_SUSPENDED)
1278 udev->do_remote_wakeup = 0;
1279 return;
1280 }
1281
1282 /* If remote wakeup is permitted, see whether any interface drivers
1283 * actually want it.
1284 */
1285 w = 0;
1286 if (device_may_wakeup(&udev->dev) && udev->actconfig) {
1287 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1288 intf = udev->actconfig->interface[i];
1289 w |= intf->needs_remote_wakeup;
1290 }
1291 }
1292
1293 /* If the device is autosuspended with the wrong wakeup setting,
1294 * autoresume now so the setting can be changed.
1295 */
1296 if (udev->state == USB_STATE_SUSPENDED && w != udev->do_remote_wakeup)
1297 pm_runtime_resume(&udev->dev);
1298 udev->do_remote_wakeup = w;
1299}
1300
1266/* The device lock is held by the PM core */ 1301/* The device lock is held by the PM core */
1267int usb_suspend(struct device *dev, pm_message_t msg) 1302int usb_suspend(struct device *dev, pm_message_t msg)
1268{ 1303{
1269 struct usb_device *udev = to_usb_device(dev); 1304 struct usb_device *udev = to_usb_device(dev);
1270 1305
1271 do_unbind_rebind(udev, DO_UNBIND); 1306 do_unbind_rebind(udev, DO_UNBIND);
1272 udev->do_remote_wakeup = device_may_wakeup(&udev->dev); 1307 choose_wakeup(udev, msg);
1273 return usb_suspend_both(udev, msg); 1308 return usb_suspend_both(udev, msg);
1274} 1309}
1275 1310
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index bdf87a8414a1..2c95153c0f24 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
120 * than a vendor-specific driver. */ 120 * than a vendor-specific driver. */
121 else if (udev->descriptor.bDeviceClass != 121 else if (udev->descriptor.bDeviceClass !=
122 USB_CLASS_VENDOR_SPEC && 122 USB_CLASS_VENDOR_SPEC &&
123 (!desc || desc->bInterfaceClass != 123 (desc && desc->bInterfaceClass !=
124 USB_CLASS_VENDOR_SPEC)) { 124 USB_CLASS_VENDOR_SPEC)) {
125 best = c; 125 best = c;
126 break; 126 break;
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 97b40ce133f0..4a6366a42129 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
515 *dentry = NULL; 515 *dentry = NULL;
516 mutex_lock(&parent->d_inode->i_mutex); 516 mutex_lock(&parent->d_inode->i_mutex);
517 *dentry = lookup_one_len(name, parent, strlen(name)); 517 *dentry = lookup_one_len(name, parent, strlen(name));
518 if (!IS_ERR(dentry)) { 518 if (!IS_ERR(*dentry)) {
519 if ((mode & S_IFMT) == S_IFDIR) 519 if ((mode & S_IFMT) == S_IFDIR)
520 error = usbfs_mkdir (parent->d_inode, *dentry, mode); 520 error = usbfs_mkdir (parent->d_inode, *dentry, mode);
521 else 521 else
522 error = usbfs_create (parent->d_inode, *dentry, mode); 522 error = usbfs_create (parent->d_inode, *dentry, mode);
523 } else 523 } else
524 error = PTR_ERR(dentry); 524 error = PTR_ERR(*dentry);
525 mutex_unlock(&parent->d_inode->i_mutex); 525 mutex_unlock(&parent->d_inode->i_mutex);
526 526
527 return error; 527 return error;
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 1297e9b16a51..0561430f2ede 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -718,7 +718,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
718EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); 718EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
719 719
720/** 720/**
721 * usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP 721 * usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
722 * @dev: device the buffer will be used with 722 * @dev: device the buffer will be used with
723 * @size: requested buffer size 723 * @size: requested buffer size
724 * @mem_flags: affect whether allocation may block 724 * @mem_flags: affect whether allocation may block
@@ -737,30 +737,30 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
737 * architectures where CPU caches are not DMA-coherent. On systems without 737 * architectures where CPU caches are not DMA-coherent. On systems without
738 * bus-snooping caches, these buffers are uncached. 738 * bus-snooping caches, these buffers are uncached.
739 * 739 *
740 * When the buffer is no longer used, free it with usb_buffer_free(). 740 * When the buffer is no longer used, free it with usb_free_coherent().
741 */ 741 */
742void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, 742void *usb_alloc_coherent(struct usb_device *dev, size_t size, gfp_t mem_flags,
743 dma_addr_t *dma) 743 dma_addr_t *dma)
744{ 744{
745 if (!dev || !dev->bus) 745 if (!dev || !dev->bus)
746 return NULL; 746 return NULL;
747 return hcd_buffer_alloc(dev->bus, size, mem_flags, dma); 747 return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
748} 748}
749EXPORT_SYMBOL_GPL(usb_buffer_alloc); 749EXPORT_SYMBOL_GPL(usb_alloc_coherent);
750 750
751/** 751/**
752 * usb_buffer_free - free memory allocated with usb_buffer_alloc() 752 * usb_free_coherent - free memory allocated with usb_alloc_coherent()
753 * @dev: device the buffer was used with 753 * @dev: device the buffer was used with
754 * @size: requested buffer size 754 * @size: requested buffer size
755 * @addr: CPU address of buffer 755 * @addr: CPU address of buffer
756 * @dma: DMA address of buffer 756 * @dma: DMA address of buffer
757 * 757 *
758 * This reclaims an I/O buffer, letting it be reused. The memory must have 758 * This reclaims an I/O buffer, letting it be reused. The memory must have
759 * been allocated using usb_buffer_alloc(), and the parameters must match 759 * been allocated using usb_alloc_coherent(), and the parameters must match
760 * those provided in that allocation request. 760 * those provided in that allocation request.
761 */ 761 */
762void usb_buffer_free(struct usb_device *dev, size_t size, void *addr, 762void usb_free_coherent(struct usb_device *dev, size_t size, void *addr,
763 dma_addr_t dma) 763 dma_addr_t dma)
764{ 764{
765 if (!dev || !dev->bus) 765 if (!dev || !dev->bus)
766 return; 766 return;
@@ -768,7 +768,7 @@ void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
768 return; 768 return;
769 hcd_buffer_free(dev->bus, size, addr, dma); 769 hcd_buffer_free(dev->bus, size, addr, dma);
770} 770}
771EXPORT_SYMBOL_GPL(usb_buffer_free); 771EXPORT_SYMBOL_GPL(usb_free_coherent);
772 772
773/** 773/**
774 * usb_buffer_map - create DMA mapping(s) for an urb 774 * usb_buffer_map - create DMA mapping(s) for an urb
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 124a8ccfdcda..1f73b485732d 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2145,6 +2145,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2145 u32 epctrl; 2145 u32 epctrl;
2146 u32 mps; 2146 u32 mps;
2147 int dir_in; 2147 int dir_in;
2148 int ret = 0;
2148 2149
2149 dev_dbg(hsotg->dev, 2150 dev_dbg(hsotg->dev,
2150 "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n", 2151 "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n",
@@ -2196,7 +2197,8 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2196 switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { 2197 switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
2197 case USB_ENDPOINT_XFER_ISOC: 2198 case USB_ENDPOINT_XFER_ISOC:
2198 dev_err(hsotg->dev, "no current ISOC support\n"); 2199 dev_err(hsotg->dev, "no current ISOC support\n");
2199 return -EINVAL; 2200 ret = -EINVAL;
2201 goto out;
2200 2202
2201 case USB_ENDPOINT_XFER_BULK: 2203 case USB_ENDPOINT_XFER_BULK:
2202 epctrl |= S3C_DxEPCTL_EPType_Bulk; 2204 epctrl |= S3C_DxEPCTL_EPType_Bulk;
@@ -2235,8 +2237,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2235 /* enable the endpoint interrupt */ 2237 /* enable the endpoint interrupt */
2236 s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); 2238 s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
2237 2239
2240out:
2238 spin_unlock_irqrestore(&hs_ep->lock, flags); 2241 spin_unlock_irqrestore(&hs_ep->lock, flags);
2239 return 0; 2242 return ret;
2240} 2243}
2241 2244
2242static int s3c_hsotg_ep_disable(struct usb_ep *ep) 2245static int s3c_hsotg_ep_disable(struct usb_ep *ep)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 207e7a85aeb0..13ead00aecd5 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -543,6 +543,7 @@ static int ehci_init(struct usb_hcd *hcd)
543 */ 543 */
544 ehci->periodic_size = DEFAULT_I_TDPS; 544 ehci->periodic_size = DEFAULT_I_TDPS;
545 INIT_LIST_HEAD(&ehci->cached_itd_list); 545 INIT_LIST_HEAD(&ehci->cached_itd_list);
546 INIT_LIST_HEAD(&ehci->cached_sitd_list);
546 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) 547 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
547 return retval; 548 return retval;
548 549
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 19372673bf09..c7178bcde67a 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -801,7 +801,7 @@ static int ehci_hub_control (
801 * this bit; seems too long to spin routinely... 801 * this bit; seems too long to spin routinely...
802 */ 802 */
803 retval = handshake(ehci, status_reg, 803 retval = handshake(ehci, status_reg,
804 PORT_RESET, 0, 750); 804 PORT_RESET, 0, 1000);
805 if (retval != 0) { 805 if (retval != 0) {
806 ehci_err (ehci, "port %d reset error %d\n", 806 ehci_err (ehci, "port %d reset error %d\n",
807 wIndex + 1, retval); 807 wIndex + 1, retval);
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index aeda96e0af67..1f3f01eacaf0 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -136,7 +136,7 @@ static inline void qh_put (struct ehci_qh *qh)
136 136
137static void ehci_mem_cleanup (struct ehci_hcd *ehci) 137static void ehci_mem_cleanup (struct ehci_hcd *ehci)
138{ 138{
139 free_cached_itd_list(ehci); 139 free_cached_lists(ehci);
140 if (ehci->async) 140 if (ehci->async)
141 qh_put (ehci->async); 141 qh_put (ehci->async);
142 ehci->async = NULL; 142 ehci->async = NULL;
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index a67a0030dd57..40a858335035 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -629,11 +629,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
629 } 629 }
630 snprintf(supply, sizeof(supply), "hsusb%d", i); 630 snprintf(supply, sizeof(supply), "hsusb%d", i);
631 omap->regulator[i] = regulator_get(omap->dev, supply); 631 omap->regulator[i] = regulator_get(omap->dev, supply);
632 if (IS_ERR(omap->regulator[i])) 632 if (IS_ERR(omap->regulator[i])) {
633 omap->regulator[i] = NULL;
633 dev_dbg(&pdev->dev, 634 dev_dbg(&pdev->dev,
634 "failed to get ehci port%d regulator\n", i); 635 "failed to get ehci port%d regulator\n", i);
635 else 636 } else {
636 regulator_enable(omap->regulator[i]); 637 regulator_enable(omap->regulator[i]);
638 }
637 } 639 }
638 640
639 ret = omap_start_ehc(omap, hcd); 641 ret = omap_start_ehc(omap, hcd);
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a0aaaaff2560..805ec633a652 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -510,7 +510,7 @@ static int disable_periodic (struct ehci_hcd *ehci)
510 ehci_writel(ehci, cmd, &ehci->regs->command); 510 ehci_writel(ehci, cmd, &ehci->regs->command);
511 /* posted write ... */ 511 /* posted write ... */
512 512
513 free_cached_itd_list(ehci); 513 free_cached_lists(ehci);
514 514
515 ehci->next_uframe = -1; 515 ehci->next_uframe = -1;
516 return 0; 516 return 0;
@@ -2139,13 +2139,27 @@ sitd_complete (
2139 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); 2139 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
2140 } 2140 }
2141 iso_stream_put (ehci, stream); 2141 iso_stream_put (ehci, stream);
2142 /* OK to recycle this SITD now that its completion callback ran. */ 2142
2143done: 2143done:
2144 sitd->urb = NULL; 2144 sitd->urb = NULL;
2145 sitd->stream = NULL; 2145 if (ehci->clock_frame != sitd->frame) {
2146 list_move(&sitd->sitd_list, &stream->free_list); 2146 /* OK to recycle this SITD now. */
2147 iso_stream_put(ehci, stream); 2147 sitd->stream = NULL;
2148 2148 list_move(&sitd->sitd_list, &stream->free_list);
2149 iso_stream_put(ehci, stream);
2150 } else {
2151 /* HW might remember this SITD, so we can't recycle it yet.
2152 * Move it to a safe place until a new frame starts.
2153 */
2154 list_move(&sitd->sitd_list, &ehci->cached_sitd_list);
2155 if (stream->refcount == 2) {
2156 /* If iso_stream_put() were called here, stream
2157 * would be freed. Instead, just prevent reuse.
2158 */
2159 stream->ep->hcpriv = NULL;
2160 stream->ep = NULL;
2161 }
2162 }
2149 return retval; 2163 return retval;
2150} 2164}
2151 2165
@@ -2211,9 +2225,10 @@ done:
2211 2225
2212/*-------------------------------------------------------------------------*/ 2226/*-------------------------------------------------------------------------*/
2213 2227
2214static void free_cached_itd_list(struct ehci_hcd *ehci) 2228static void free_cached_lists(struct ehci_hcd *ehci)
2215{ 2229{
2216 struct ehci_itd *itd, *n; 2230 struct ehci_itd *itd, *n;
2231 struct ehci_sitd *sitd, *sn;
2217 2232
2218 list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) { 2233 list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
2219 struct ehci_iso_stream *stream = itd->stream; 2234 struct ehci_iso_stream *stream = itd->stream;
@@ -2221,6 +2236,13 @@ static void free_cached_itd_list(struct ehci_hcd *ehci)
2221 list_move(&itd->itd_list, &stream->free_list); 2236 list_move(&itd->itd_list, &stream->free_list);
2222 iso_stream_put(ehci, stream); 2237 iso_stream_put(ehci, stream);
2223 } 2238 }
2239
2240 list_for_each_entry_safe(sitd, sn, &ehci->cached_sitd_list, sitd_list) {
2241 struct ehci_iso_stream *stream = sitd->stream;
2242 sitd->stream = NULL;
2243 list_move(&sitd->sitd_list, &stream->free_list);
2244 iso_stream_put(ehci, stream);
2245 }
2224} 2246}
2225 2247
2226/*-------------------------------------------------------------------------*/ 2248/*-------------------------------------------------------------------------*/
@@ -2247,7 +2269,7 @@ scan_periodic (struct ehci_hcd *ehci)
2247 clock_frame = -1; 2269 clock_frame = -1;
2248 } 2270 }
2249 if (ehci->clock_frame != clock_frame) { 2271 if (ehci->clock_frame != clock_frame) {
2250 free_cached_itd_list(ehci); 2272 free_cached_lists(ehci);
2251 ehci->clock_frame = clock_frame; 2273 ehci->clock_frame = clock_frame;
2252 } 2274 }
2253 clock %= mod; 2275 clock %= mod;
@@ -2414,7 +2436,7 @@ restart:
2414 clock = now; 2436 clock = now;
2415 clock_frame = clock >> 3; 2437 clock_frame = clock >> 3;
2416 if (ehci->clock_frame != clock_frame) { 2438 if (ehci->clock_frame != clock_frame) {
2417 free_cached_itd_list(ehci); 2439 free_cached_lists(ehci);
2418 ehci->clock_frame = clock_frame; 2440 ehci->clock_frame = clock_frame;
2419 } 2441 }
2420 } else { 2442 } else {
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index b1dce96dd621..556c0b48f3ab 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -87,8 +87,9 @@ struct ehci_hcd { /* one per controller */
87 int next_uframe; /* scan periodic, start here */ 87 int next_uframe; /* scan periodic, start here */
88 unsigned periodic_sched; /* periodic activity count */ 88 unsigned periodic_sched; /* periodic activity count */
89 89
90 /* list of itds completed while clock_frame was still active */ 90 /* list of itds & sitds completed while clock_frame was still active */
91 struct list_head cached_itd_list; 91 struct list_head cached_itd_list;
92 struct list_head cached_sitd_list;
92 unsigned clock_frame; 93 unsigned clock_frame;
93 94
94 /* per root hub port */ 95 /* per root hub port */
@@ -195,7 +196,7 @@ timer_action_done (struct ehci_hcd *ehci, enum ehci_timer_action action)
195 clear_bit (action, &ehci->actions); 196 clear_bit (action, &ehci->actions);
196} 197}
197 198
198static void free_cached_itd_list(struct ehci_hcd *ehci); 199static void free_cached_lists(struct ehci_hcd *ehci);
199 200
200/*-------------------------------------------------------------------------*/ 201/*-------------------------------------------------------------------------*/
201 202
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 68b83ab70719..944291e10f97 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -331,6 +331,8 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
331 */ 331 */
332 if (at91_suspend_entering_slow_clock()) { 332 if (at91_suspend_entering_slow_clock()) {
333 ohci_usb_reset (ohci); 333 ohci_usb_reset (ohci);
334 /* flush the writes */
335 (void) ohci_readl (ohci, &ohci->regs->control);
334 at91_stop_clock(); 336 at91_stop_clock();
335 } 337 }
336 338
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 4aa08d36d077..d22fb4d577b7 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -23,7 +23,7 @@
23#error "This file is DA8xx bus glue. Define CONFIG_ARCH_DAVINCI_DA8XX." 23#error "This file is DA8xx bus glue. Define CONFIG_ARCH_DAVINCI_DA8XX."
24#endif 24#endif
25 25
26#define CFGCHIP2 DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP2_REG) 26#define CFGCHIP2 DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)
27 27
28static struct clk *usb11_clk; 28static struct clk *usb11_clk;
29static struct clk *usb20_clk; 29static struct clk *usb20_clk;
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 32bbce9718f0..65cac8cc8921 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -697,7 +697,7 @@ static int ohci_hub_control (
697 u16 wLength 697 u16 wLength
698) { 698) {
699 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 699 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
700 int ports = hcd_to_bus (hcd)->root_hub->maxchild; 700 int ports = ohci->num_ports;
701 u32 temp; 701 u32 temp;
702 int retval = 0; 702 int retval = 0;
703 703
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 50f57f468836..e62b30b3e429 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -660,13 +660,13 @@ static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
660 if (qh->dummy == NULL) { 660 if (qh->dummy == NULL) {
661 oxu_dbg(oxu, "no dummy td\n"); 661 oxu_dbg(oxu, "no dummy td\n");
662 oxu->qh_used[i] = 0; 662 oxu->qh_used[i] = 0;
663 663 qh = NULL;
664 return NULL; 664 goto unlock;
665 } 665 }
666 666
667 oxu->qh_used[i] = 1; 667 oxu->qh_used[i] = 1;
668 } 668 }
669 669unlock:
670 spin_unlock(&oxu->mem_lock); 670 spin_unlock(&oxu->mem_lock);
671 671
672 return qh; 672 return qh;
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index e11cc3aa4b82..3b867a8af7b2 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -720,10 +720,10 @@ retry:
720 /* port status seems weird until after reset, so 720 /* port status seems weird until after reset, so
721 * force the reset and make khubd clean up later. 721 * force the reset and make khubd clean up later.
722 */ 722 */
723 if (sl811->stat_insrmv & 1) 723 if (irqstat & SL11H_INTMASK_RD)
724 sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
725 else
726 sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION); 724 sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION);
725 else
726 sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
727 727
728 sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION; 728 sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION;
729 729
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index c09539bad1ee..d64f5724bfc4 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -582,6 +582,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
582 return EP_INTERVAL(interval); 582 return EP_INTERVAL(interval);
583} 583}
584 584
585/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
586 * High speed endpoint descriptors can define "the number of additional
587 * transaction opportunities per microframe", but that goes in the Max Burst
588 * endpoint context field.
589 */
590static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
591 struct usb_host_endpoint *ep)
592{
593 if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
594 return 0;
595 return ep->ss_ep_comp->desc.bmAttributes;
596}
597
585static inline u32 xhci_get_endpoint_type(struct usb_device *udev, 598static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
586 struct usb_host_endpoint *ep) 599 struct usb_host_endpoint *ep)
587{ 600{
@@ -612,6 +625,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
612 return type; 625 return type;
613} 626}
614 627
628/* Return the maximum endpoint service interval time (ESIT) payload.
629 * Basically, this is the maxpacket size, multiplied by the burst size
630 * and mult size.
631 */
632static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
633 struct usb_device *udev,
634 struct usb_host_endpoint *ep)
635{
636 int max_burst;
637 int max_packet;
638
639 /* Only applies for interrupt or isochronous endpoints */
640 if (usb_endpoint_xfer_control(&ep->desc) ||
641 usb_endpoint_xfer_bulk(&ep->desc))
642 return 0;
643
644 if (udev->speed == USB_SPEED_SUPER) {
645 if (ep->ss_ep_comp)
646 return ep->ss_ep_comp->desc.wBytesPerInterval;
647 xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
648 /* Assume no bursts, no multiple opportunities to send. */
649 return ep->desc.wMaxPacketSize;
650 }
651
652 max_packet = ep->desc.wMaxPacketSize & 0x3ff;
653 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
654 /* A 0 in max burst means 1 transfer per ESIT */
655 return max_packet * (max_burst + 1);
656}
657
615int xhci_endpoint_init(struct xhci_hcd *xhci, 658int xhci_endpoint_init(struct xhci_hcd *xhci,
616 struct xhci_virt_device *virt_dev, 659 struct xhci_virt_device *virt_dev,
617 struct usb_device *udev, 660 struct usb_device *udev,
@@ -623,6 +666,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
623 struct xhci_ring *ep_ring; 666 struct xhci_ring *ep_ring;
624 unsigned int max_packet; 667 unsigned int max_packet;
625 unsigned int max_burst; 668 unsigned int max_burst;
669 u32 max_esit_payload;
626 670
627 ep_index = xhci_get_endpoint_index(&ep->desc); 671 ep_index = xhci_get_endpoint_index(&ep->desc);
628 ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); 672 ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
@@ -644,6 +688,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
644 ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state; 688 ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state;
645 689
646 ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep); 690 ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
691 ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));
647 692
648 /* FIXME dig Mult and streams info out of ep companion desc */ 693 /* FIXME dig Mult and streams info out of ep companion desc */
649 694
@@ -689,6 +734,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
689 default: 734 default:
690 BUG(); 735 BUG();
691 } 736 }
737 max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
738 ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);
739
740 /*
741 * XXX no idea how to calculate the average TRB buffer length for bulk
742 * endpoints, as the driver gives us no clue how big each scatter gather
743 * list entry (or buffer) is going to be.
744 *
745 * For isochronous and interrupt endpoints, we set it to the max
746 * available, until we have new API in the USB core to allow drivers to
747 * declare how much bandwidth they actually need.
748 *
749 * Normally, it would be calculated by taking the total of the buffer
750 * lengths in the TD and then dividing by the number of TRBs in a TD,
751 * including link TRBs, No-op TRBs, and Event data TRBs. Since we don't
752 * use Event Data TRBs, and we don't chain in a link TRB on short
753 * transfers, we're basically dividing by 1.
754 */
755 ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);
756
692 /* FIXME Debug endpoint context */ 757 /* FIXME Debug endpoint context */
693 return 0; 758 return 0;
694} 759}
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index e5eb09b2f38e..ea389e9a4931 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -609,6 +609,10 @@ struct xhci_ep_ctx {
609#define MAX_PACKET_MASK (0xffff << 16) 609#define MAX_PACKET_MASK (0xffff << 16)
610#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) 610#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
611 611
612/* tx_info bitmasks */
613#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
614#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
615
612 616
613/** 617/**
614 * struct xhci_input_control_context 618 * struct xhci_input_control_context
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index a9555cb901a1..de8ef945b536 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -49,6 +49,7 @@ struct usb_sevsegdev {
49 u16 textlength; 49 u16 textlength;
50 50
51 u8 shadow_power; /* for PM */ 51 u8 shadow_power; /* for PM */
52 u8 has_interface_pm;
52}; 53};
53 54
54/* sysfs_streq can't replace this completely 55/* sysfs_streq can't replace this completely
@@ -68,12 +69,16 @@ static void update_display_powered(struct usb_sevsegdev *mydev)
68{ 69{
69 int rc; 70 int rc;
70 71
71 if (!mydev->shadow_power && mydev->powered) { 72 if (mydev->powered && !mydev->has_interface_pm) {
72 rc = usb_autopm_get_interface(mydev->intf); 73 rc = usb_autopm_get_interface(mydev->intf);
73 if (rc < 0) 74 if (rc < 0)
74 return; 75 return;
76 mydev->has_interface_pm = 1;
75 } 77 }
76 78
79 if (mydev->shadow_power != 1)
80 return;
81
77 rc = usb_control_msg(mydev->udev, 82 rc = usb_control_msg(mydev->udev,
78 usb_sndctrlpipe(mydev->udev, 0), 83 usb_sndctrlpipe(mydev->udev, 0),
79 0x12, 84 0x12,
@@ -86,8 +91,10 @@ static void update_display_powered(struct usb_sevsegdev *mydev)
86 if (rc < 0) 91 if (rc < 0)
87 dev_dbg(&mydev->udev->dev, "power retval = %d\n", rc); 92 dev_dbg(&mydev->udev->dev, "power retval = %d\n", rc);
88 93
89 if (mydev->shadow_power && !mydev->powered) 94 if (!mydev->powered && mydev->has_interface_pm) {
90 usb_autopm_put_interface(mydev->intf); 95 usb_autopm_put_interface(mydev->intf);
96 mydev->has_interface_pm = 0;
97 }
91} 98}
92 99
93static void update_display_mode(struct usb_sevsegdev *mydev) 100static void update_display_mode(struct usb_sevsegdev *mydev)
@@ -351,6 +358,10 @@ static int sevseg_probe(struct usb_interface *interface,
351 mydev->intf = interface; 358 mydev->intf = interface;
352 usb_set_intfdata(interface, mydev); 359 usb_set_intfdata(interface, mydev);
353 360
361 /* PM */
362 mydev->shadow_power = 1; /* currently active */
363 mydev->has_interface_pm = 0; /* have not issued autopm_get */
364
354 /*set defaults */ 365 /*set defaults */
355 mydev->textmode = 0x02; /* ascii mode */ 366 mydev->textmode = 0x02; /* ascii mode */
356 mydev->mode_msb = 0x06; /* 6 characters */ 367 mydev->mode_msb = 0x06; /* 6 characters */
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index b4c783c284ba..07fe490b44d8 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -42,7 +42,7 @@ config USB_MUSB_SOC
42 default y if (BF52x && !BF522 && !BF523) 42 default y if (BF52x && !BF522 && !BF523)
43 43
44comment "DaVinci 35x and 644x USB support" 44comment "DaVinci 35x and 644x USB support"
45 depends on USB_MUSB_HDRC && ARCH_DAVINCI 45 depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx
46 46
47comment "OMAP 243x high speed USB support" 47comment "OMAP 243x high speed USB support"
48 depends on USB_MUSB_HDRC && ARCH_OMAP2430 48 depends on USB_MUSB_HDRC && ARCH_OMAP2430
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 85710ccc1887..3a485dabebbb 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o
6 6
7obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o 7obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o
8 8
9ifeq ($(CONFIG_ARCH_DAVINCI),y) 9ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
10 musb_hdrc-objs += davinci.o 10 musb_hdrc-objs += davinci.o
11endif 11endif
12 12
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 719a22d664ef..ec8d324237f6 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -172,13 +172,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
172 172
173 spin_unlock_irqrestore(&musb->lock, flags); 173 spin_unlock_irqrestore(&musb->lock, flags);
174 174
175 /* REVISIT we sometimes get spurious IRQs on g_ep0 175 return retval;
176 * not clear why... fall in BF54x too.
177 */
178 if (retval != IRQ_HANDLED)
179 DBG(5, "spurious?\n");
180
181 return IRQ_HANDLED;
182} 176}
183 177
184static void musb_conn_timer_handler(unsigned long _musb) 178static void musb_conn_timer_handler(unsigned long _musb)
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 29bce5c0fd10..ce2e16fee0df 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -444,6 +444,8 @@ int __init musb_platform_init(struct musb *musb)
444 return 0; 444 return 0;
445 445
446fail: 446fail:
447 clk_disable(musb->clock);
448
447 usb_nop_xceiv_unregister(); 449 usb_nop_xceiv_unregister();
448 return -ENODEV; 450 return -ENODEV;
449} 451}
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0e8b8ab1d168..705cc4ad8737 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -965,10 +965,8 @@ static void musb_shutdown(struct platform_device *pdev)
965 spin_lock_irqsave(&musb->lock, flags); 965 spin_lock_irqsave(&musb->lock, flags);
966 musb_platform_disable(musb); 966 musb_platform_disable(musb);
967 musb_generic_disable(musb); 967 musb_generic_disable(musb);
968 if (musb->clock) { 968 if (musb->clock)
969 clk_put(musb->clock); 969 clk_put(musb->clock);
970 musb->clock = NULL;
971 }
972 spin_unlock_irqrestore(&musb->lock, flags); 970 spin_unlock_irqrestore(&musb->lock, flags);
973 971
974 /* FIXME power down */ 972 /* FIXME power down */
@@ -1853,15 +1851,6 @@ static void musb_free(struct musb *musb)
1853 put_device(musb->xceiv->dev); 1851 put_device(musb->xceiv->dev);
1854#endif 1852#endif
1855 1853
1856 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
1857 musb_platform_exit(musb);
1858 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
1859
1860 if (musb->clock) {
1861 clk_disable(musb->clock);
1862 clk_put(musb->clock);
1863 }
1864
1865#ifdef CONFIG_USB_MUSB_HDRC_HCD 1854#ifdef CONFIG_USB_MUSB_HDRC_HCD
1866 usb_put_hcd(musb_to_hcd(musb)); 1855 usb_put_hcd(musb_to_hcd(musb));
1867#else 1856#else
@@ -1889,8 +1878,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1889 */ 1878 */
1890 if (!plat) { 1879 if (!plat) {
1891 dev_dbg(dev, "no platform_data?\n"); 1880 dev_dbg(dev, "no platform_data?\n");
1892 return -ENODEV; 1881 status = -ENODEV;
1882 goto fail0;
1893 } 1883 }
1884
1894 switch (plat->mode) { 1885 switch (plat->mode) {
1895 case MUSB_HOST: 1886 case MUSB_HOST:
1896#ifdef CONFIG_USB_MUSB_HDRC_HCD 1887#ifdef CONFIG_USB_MUSB_HDRC_HCD
@@ -1912,13 +1903,16 @@ bad_config:
1912#endif 1903#endif
1913 default: 1904 default:
1914 dev_err(dev, "incompatible Kconfig role setting\n"); 1905 dev_err(dev, "incompatible Kconfig role setting\n");
1915 return -EINVAL; 1906 status = -EINVAL;
1907 goto fail0;
1916 } 1908 }
1917 1909
1918 /* allocate */ 1910 /* allocate */
1919 musb = allocate_instance(dev, plat->config, ctrl); 1911 musb = allocate_instance(dev, plat->config, ctrl);
1920 if (!musb) 1912 if (!musb) {
1921 return -ENOMEM; 1913 status = -ENOMEM;
1914 goto fail0;
1915 }
1922 1916
1923 spin_lock_init(&musb->lock); 1917 spin_lock_init(&musb->lock);
1924 musb->board_mode = plat->mode; 1918 musb->board_mode = plat->mode;
@@ -1936,7 +1930,7 @@ bad_config:
1936 if (IS_ERR(musb->clock)) { 1930 if (IS_ERR(musb->clock)) {
1937 status = PTR_ERR(musb->clock); 1931 status = PTR_ERR(musb->clock);
1938 musb->clock = NULL; 1932 musb->clock = NULL;
1939 goto fail; 1933 goto fail1;
1940 } 1934 }
1941 } 1935 }
1942 1936
@@ -1955,12 +1949,12 @@ bad_config:
1955 */ 1949 */
1956 musb->isr = generic_interrupt; 1950 musb->isr = generic_interrupt;
1957 status = musb_platform_init(musb); 1951 status = musb_platform_init(musb);
1958
1959 if (status < 0) 1952 if (status < 0)
1960 goto fail; 1953 goto fail2;
1954
1961 if (!musb->isr) { 1955 if (!musb->isr) {
1962 status = -ENODEV; 1956 status = -ENODEV;
1963 goto fail2; 1957 goto fail3;
1964 } 1958 }
1965 1959
1966#ifndef CONFIG_MUSB_PIO_ONLY 1960#ifndef CONFIG_MUSB_PIO_ONLY
@@ -1986,7 +1980,7 @@ bad_config:
1986 ? MUSB_CONTROLLER_MHDRC 1980 ? MUSB_CONTROLLER_MHDRC
1987 : MUSB_CONTROLLER_HDRC, musb); 1981 : MUSB_CONTROLLER_HDRC, musb);
1988 if (status < 0) 1982 if (status < 0)
1989 goto fail2; 1983 goto fail3;
1990 1984
1991#ifdef CONFIG_USB_MUSB_OTG 1985#ifdef CONFIG_USB_MUSB_OTG
1992 setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); 1986 setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);
@@ -1999,7 +1993,7 @@ bad_config:
1999 if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { 1993 if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
2000 dev_err(dev, "request_irq %d failed!\n", nIrq); 1994 dev_err(dev, "request_irq %d failed!\n", nIrq);
2001 status = -ENODEV; 1995 status = -ENODEV;
2002 goto fail2; 1996 goto fail3;
2003 } 1997 }
2004 musb->nIrq = nIrq; 1998 musb->nIrq = nIrq;
2005/* FIXME this handles wakeup irqs wrong */ 1999/* FIXME this handles wakeup irqs wrong */
@@ -2039,8 +2033,6 @@ bad_config:
2039 musb->xceiv->state = OTG_STATE_A_IDLE; 2033 musb->xceiv->state = OTG_STATE_A_IDLE;
2040 2034
2041 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 2035 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
2042 if (status)
2043 goto fail;
2044 2036
2045 DBG(1, "%s mode, status %d, devctl %02x %c\n", 2037 DBG(1, "%s mode, status %d, devctl %02x %c\n",
2046 "HOST", status, 2038 "HOST", status,
@@ -2055,8 +2047,6 @@ bad_config:
2055 musb->xceiv->state = OTG_STATE_B_IDLE; 2047 musb->xceiv->state = OTG_STATE_B_IDLE;
2056 2048
2057 status = musb_gadget_setup(musb); 2049 status = musb_gadget_setup(musb);
2058 if (status)
2059 goto fail;
2060 2050
2061 DBG(1, "%s mode, status %d, dev%02x\n", 2051 DBG(1, "%s mode, status %d, dev%02x\n",
2062 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", 2052 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
@@ -2064,12 +2054,14 @@ bad_config:
2064 musb_readb(musb->mregs, MUSB_DEVCTL)); 2054 musb_readb(musb->mregs, MUSB_DEVCTL));
2065 2055
2066 } 2056 }
2057 if (status < 0)
2058 goto fail3;
2067 2059
2068#ifdef CONFIG_SYSFS 2060#ifdef CONFIG_SYSFS
2069 status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); 2061 status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
2070#endif
2071 if (status) 2062 if (status)
2072 goto fail2; 2063 goto fail4;
2064#endif
2073 2065
2074 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", 2066 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
2075 ({char *s; 2067 ({char *s;
@@ -2085,17 +2077,29 @@ bad_config:
2085 2077
2086 return 0; 2078 return 0;
2087 2079
2088fail2: 2080fail4:
2081 if (!is_otg_enabled(musb) && is_host_enabled(musb))
2082 usb_remove_hcd(musb_to_hcd(musb));
2083 else
2084 musb_gadget_cleanup(musb);
2085
2086fail3:
2087 if (musb->irq_wake)
2088 device_init_wakeup(dev, 0);
2089 musb_platform_exit(musb); 2089 musb_platform_exit(musb);
2090fail:
2091 dev_err(musb->controller,
2092 "musb_init_controller failed with status %d\n", status);
2093 2090
2091fail2:
2094 if (musb->clock) 2092 if (musb->clock)
2095 clk_put(musb->clock); 2093 clk_put(musb->clock);
2096 device_init_wakeup(dev, 0); 2094
2095fail1:
2096 dev_err(musb->controller,
2097 "musb_init_controller failed with status %d\n", status);
2098
2097 musb_free(musb); 2099 musb_free(musb);
2098 2100
2101fail0:
2102
2099 return status; 2103 return status;
2100 2104
2101} 2105}
@@ -2132,7 +2136,6 @@ static int __init musb_probe(struct platform_device *pdev)
2132 /* clobbered by use_dma=n */ 2136 /* clobbered by use_dma=n */
2133 orig_dma_mask = dev->dma_mask; 2137 orig_dma_mask = dev->dma_mask;
2134#endif 2138#endif
2135
2136 status = musb_init_controller(dev, irq, base); 2139 status = musb_init_controller(dev, irq, base);
2137 if (status < 0) 2140 if (status < 0)
2138 iounmap(base); 2141 iounmap(base);
@@ -2155,6 +2158,10 @@ static int __exit musb_remove(struct platform_device *pdev)
2155 if (musb->board_mode == MUSB_HOST) 2158 if (musb->board_mode == MUSB_HOST)
2156 usb_remove_hcd(musb_to_hcd(musb)); 2159 usb_remove_hcd(musb_to_hcd(musb));
2157#endif 2160#endif
2161 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2162 musb_platform_exit(musb);
2163 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2164
2158 musb_free(musb); 2165 musb_free(musb);
2159 iounmap(ctrl_base); 2166 iounmap(ctrl_base);
2160 device_init_wakeup(&pdev->dev, 0); 2167 device_init_wakeup(&pdev->dev, 0);
@@ -2176,6 +2183,7 @@ void musb_save_context(struct musb *musb)
2176 if (is_host_enabled(musb)) { 2183 if (is_host_enabled(musb)) {
2177 musb_context.frame = musb_readw(musb_base, MUSB_FRAME); 2184 musb_context.frame = musb_readw(musb_base, MUSB_FRAME);
2178 musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE); 2185 musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE);
2186 musb_context.busctl = musb_read_ulpi_buscontrol(musb->mregs);
2179 } 2187 }
2180 musb_context.power = musb_readb(musb_base, MUSB_POWER); 2188 musb_context.power = musb_readb(musb_base, MUSB_POWER);
2181 musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE); 2189 musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE);
@@ -2247,6 +2255,7 @@ void musb_restore_context(struct musb *musb)
2247 if (is_host_enabled(musb)) { 2255 if (is_host_enabled(musb)) {
2248 musb_writew(musb_base, MUSB_FRAME, musb_context.frame); 2256 musb_writew(musb_base, MUSB_FRAME, musb_context.frame);
2249 musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode); 2257 musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode);
2258 musb_write_ulpi_buscontrol(musb->mregs, musb_context.busctl);
2250 } 2259 }
2251 musb_writeb(musb_base, MUSB_POWER, musb_context.power); 2260 musb_writeb(musb_base, MUSB_POWER, musb_context.power);
2252 musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe); 2261 musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index cd9f4a9a06c6..ac17b004909b 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -478,7 +478,7 @@ struct musb_context_registers {
478 u16 frame; 478 u16 frame;
479 u8 index, testmode; 479 u8 index, testmode;
480 480
481 u8 devctl, misc; 481 u8 devctl, busctl, misc;
482 482
483 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; 483 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
484}; 484};
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index dec896e888db..877d20b1dff9 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2042,6 +2042,7 @@ static int musb_urb_enqueue(
2042 * odd, rare, error prone, but legal. 2042 * odd, rare, error prone, but legal.
2043 */ 2043 */
2044 kfree(qh); 2044 kfree(qh);
2045 qh = NULL;
2045 ret = 0; 2046 ret = 0;
2046 } else 2047 } else
2047 ret = musb_schedule(musb, qh, 2048 ret = musb_schedule(musb, qh,
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 490cdf15ccb6..82592633502f 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -331,8 +331,5 @@ int musb_platform_exit(struct musb *musb)
331 331
332 musb_platform_suspend(musb); 332 musb_platform_suspend(musb);
333 333
334 clk_put(musb->clock);
335 musb->clock = NULL;
336
337 return 0; 334 return 0;
338} 335}
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index ab776a8d98ca..60d3938cafcf 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -29,6 +29,19 @@ static void tusb_source_power(struct musb *musb, int is_on);
29#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) 29#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf)
30#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) 30#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf)
31 31
32#ifdef CONFIG_PM
33/* REVISIT: These should be only needed if somebody implements off idle */
34void musb_platform_save_context(struct musb *musb,
35 struct musb_context_registers *musb_context)
36{
37}
38
39void musb_platform_restore_context(struct musb *musb,
40 struct musb_context_registers *musb_context)
41{
42}
43#endif
44
32/* 45/*
33 * Checks the revision. We need to use the DMA register as 3.0 does not 46 * Checks the revision. We need to use the DMA register as 3.0 does not
34 * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. 47 * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV.
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c
index 5afa070d7dc9..c061a88f2b0f 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -39,7 +39,7 @@ struct tusb_omap_dma_ch {
39 39
40 struct tusb_omap_dma *tusb_dma; 40 struct tusb_omap_dma *tusb_dma;
41 41
42 void __iomem *dma_addr; 42 dma_addr_t dma_addr;
43 43
44 u32 len; 44 u32 len;
45 u16 packet_sz; 45 u16 packet_sz;
@@ -126,6 +126,7 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
126 struct tusb_omap_dma_ch *chdat = to_chdat(channel); 126 struct tusb_omap_dma_ch *chdat = to_chdat(channel);
127 struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; 127 struct tusb_omap_dma *tusb_dma = chdat->tusb_dma;
128 struct musb *musb = chdat->musb; 128 struct musb *musb = chdat->musb;
129 struct device *dev = musb->controller;
129 struct musb_hw_ep *hw_ep = chdat->hw_ep; 130 struct musb_hw_ep *hw_ep = chdat->hw_ep;
130 void __iomem *ep_conf = hw_ep->conf; 131 void __iomem *ep_conf = hw_ep->conf;
131 void __iomem *mbase = musb->mregs; 132 void __iomem *mbase = musb->mregs;
@@ -173,13 +174,15 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
173 DBG(3, "Using PIO for remaining %lu bytes\n", pio); 174 DBG(3, "Using PIO for remaining %lu bytes\n", pio);
174 buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len; 175 buf = phys_to_virt((u32)chdat->dma_addr) + chdat->transfer_len;
175 if (chdat->tx) { 176 if (chdat->tx) {
176 dma_cache_maint(phys_to_virt((u32)chdat->dma_addr), 177 dma_unmap_single(dev, chdat->dma_addr,
177 chdat->transfer_len, DMA_TO_DEVICE); 178 chdat->transfer_len,
179 DMA_TO_DEVICE);
178 musb_write_fifo(hw_ep, pio, buf); 180 musb_write_fifo(hw_ep, pio, buf);
179 } else { 181 } else {
182 dma_unmap_single(dev, chdat->dma_addr,
183 chdat->transfer_len,
184 DMA_FROM_DEVICE);
180 musb_read_fifo(hw_ep, pio, buf); 185 musb_read_fifo(hw_ep, pio, buf);
181 dma_cache_maint(phys_to_virt((u32)chdat->dma_addr),
182 chdat->transfer_len, DMA_FROM_DEVICE);
183 } 186 }
184 channel->actual_len += pio; 187 channel->actual_len += pio;
185 } 188 }
@@ -224,6 +227,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
224 struct tusb_omap_dma_ch *chdat = to_chdat(channel); 227 struct tusb_omap_dma_ch *chdat = to_chdat(channel);
225 struct tusb_omap_dma *tusb_dma = chdat->tusb_dma; 228 struct tusb_omap_dma *tusb_dma = chdat->tusb_dma;
226 struct musb *musb = chdat->musb; 229 struct musb *musb = chdat->musb;
230 struct device *dev = musb->controller;
227 struct musb_hw_ep *hw_ep = chdat->hw_ep; 231 struct musb_hw_ep *hw_ep = chdat->hw_ep;
228 void __iomem *mbase = musb->mregs; 232 void __iomem *mbase = musb->mregs;
229 void __iomem *ep_conf = hw_ep->conf; 233 void __iomem *ep_conf = hw_ep->conf;
@@ -299,14 +303,16 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
299 chdat->packet_sz = packet_sz; 303 chdat->packet_sz = packet_sz;
300 chdat->len = len; 304 chdat->len = len;
301 channel->actual_len = 0; 305 channel->actual_len = 0;
302 chdat->dma_addr = (void __iomem *)dma_addr; 306 chdat->dma_addr = dma_addr;
303 channel->status = MUSB_DMA_STATUS_BUSY; 307 channel->status = MUSB_DMA_STATUS_BUSY;
304 308
305 /* Since we're recycling dma areas, we need to clean or invalidate */ 309 /* Since we're recycling dma areas, we need to clean or invalidate */
306 if (chdat->tx) 310 if (chdat->tx)
307 dma_cache_maint(phys_to_virt(dma_addr), len, DMA_TO_DEVICE); 311 dma_map_single(dev, phys_to_virt(dma_addr), len,
312 DMA_TO_DEVICE);
308 else 313 else
309 dma_cache_maint(phys_to_virt(dma_addr), len, DMA_FROM_DEVICE); 314 dma_map_single(dev, phys_to_virt(dma_addr), len,
315 DMA_FROM_DEVICE);
310 316
311 /* Use 16-bit transfer if dma_addr is not 32-bit aligned */ 317 /* Use 16-bit transfer if dma_addr is not 32-bit aligned */
312 if ((dma_addr & 0x3) == 0) { 318 if ((dma_addr & 0x3) == 0) {
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index ca9d866672aa..84d0edad8e4f 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -305,6 +305,11 @@ static int option_resume(struct usb_serial *serial);
305#define ZTE_PRODUCT_CDMA_TECH 0xfffe 305#define ZTE_PRODUCT_CDMA_TECH 0xfffe
306#define ZTE_PRODUCT_AC8710 0xfff1 306#define ZTE_PRODUCT_AC8710 0xfff1
307#define ZTE_PRODUCT_AC2726 0xfff5 307#define ZTE_PRODUCT_AC2726 0xfff5
308#define ZTE_PRODUCT_AC8710T 0xffff
309
310/* ZTE PRODUCTS -- alternate vendor ID */
311#define ZTE_VENDOR_ID2 0x1d6b
312#define ZTE_PRODUCT_MF_330 0x0002
308 313
309#define BENQ_VENDOR_ID 0x04a5 314#define BENQ_VENDOR_ID 0x04a5
310#define BENQ_PRODUCT_H10 0x4068 315#define BENQ_PRODUCT_H10 0x4068
@@ -373,6 +378,8 @@ static int option_resume(struct usb_serial *serial);
373#define HAIER_VENDOR_ID 0x201e 378#define HAIER_VENDOR_ID 0x201e
374#define HAIER_PRODUCT_CE100 0x2009 379#define HAIER_PRODUCT_CE100 0x2009
375 380
381#define CINTERION_VENDOR_ID 0x0681
382
376/* some devices interfaces need special handling due to a number of reasons */ 383/* some devices interfaces need special handling due to a number of reasons */
377enum option_blacklist_reason { 384enum option_blacklist_reason {
378 OPTION_BLACKLIST_NONE = 0, 385 OPTION_BLACKLIST_NONE = 0,
@@ -679,6 +686,8 @@ static const struct usb_device_id option_ids[] = {
679 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 686 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
680 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 687 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
681 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 688 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
689 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
690 { USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) },
682 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, 691 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
683 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, 692 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
684 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ 693 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
@@ -716,6 +725,7 @@ static const struct usb_device_id option_ids[] = {
716 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, 725 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
717 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, 726 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
718 727
728 { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
719 { } /* Terminating entry */ 729 { } /* Terminating entry */
720}; 730};
721MODULE_DEVICE_TABLE(usb, option_ids); 731MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 73d5f346d3e0..c28b1607eacc 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -59,6 +59,7 @@ static const struct usb_device_id id_table[] = {
59 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, 59 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
60 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, 60 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
61 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, 61 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
62 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
62 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 63 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
63 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 64 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
64 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 65 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
@@ -97,6 +98,7 @@ static const struct usb_device_id id_table[] = {
97 { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, 98 { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) },
98 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, 99 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
99 { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, 100 { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
101 { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
100 { } /* Terminating entry */ 102 { } /* Terminating entry */
101}; 103};
102 104
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index d640dc951568..23c09b38b9ec 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -20,6 +20,7 @@
20#define PL2303_PRODUCT_ID_ALDIGA 0x0611 20#define PL2303_PRODUCT_ID_ALDIGA 0x0611
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 24
24#define ATEN_VENDOR_ID 0x0557 25#define ATEN_VENDOR_ID 0x0557
25#define ATEN_VENDOR_ID2 0x0547 26#define ATEN_VENDOR_ID2 0x0547
@@ -134,3 +135,7 @@
134/* Sanwa KB-USB2 multimeter cable (ID: 11ad:0001) */ 135/* Sanwa KB-USB2 multimeter cable (ID: 11ad:0001) */
135#define SANWA_VENDOR_ID 0x11ad 136#define SANWA_VENDOR_ID 0x11ad
136#define SANWA_PRODUCT_ID 0x0001 137#define SANWA_PRODUCT_ID 0x0001
138
139/* ADLINK ND-6530 RS232,RS485 and RS422 adapter */
140#define ADLINK_VENDOR_ID 0x0b63
141#define ADLINK_ND6530_PRODUCT_ID 0x6530
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index 0b9362061713..7e3bea23600b 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -42,6 +42,14 @@
42#define CMOTECH_PRODUCT_CDU550 0x5553 42#define CMOTECH_PRODUCT_CDU550 0x5553
43#define CMOTECH_PRODUCT_CDX650 0x6512 43#define CMOTECH_PRODUCT_CDX650 0x6512
44 44
45/* LG devices */
46#define LG_VENDOR_ID 0x1004
47#define LG_PRODUCT_VX4400_6000 0x6000 /* VX4400/VX6000/Rumor */
48
49/* Sanyo devices */
50#define SANYO_VENDOR_ID 0x0474
51#define SANYO_PRODUCT_KATANA_LX 0x0754 /* SCP-3800 (Katana LX) */
52
45static struct usb_device_id id_table[] = { 53static struct usb_device_id id_table[] = {
46 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5740, 0xff, 0x00, 0x00) }, 54 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5740, 0xff, 0x00, 0x00) },
47 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5750, 0xff, 0x00, 0x00) }, 55 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5750, 0xff, 0x00, 0x00) },
@@ -51,6 +59,8 @@ static struct usb_device_id id_table[] = {
51 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_ALLTEL, 0xff, 0x00, 0x00) }, 59 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_ALLTEL, 0xff, 0x00, 0x00) },
52 { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU550, 0xff, 0xff, 0x00) }, 60 { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU550, 0xff, 0xff, 0x00) },
53 { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDX650, 0xff, 0xff, 0x00) }, 61 { USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDX650, 0xff, 0xff, 0x00) },
62 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
63 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
54 { }, 64 { },
55}; 65};
56MODULE_DEVICE_TABLE(usb, id_table); 66MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 9202f94505e6..ef0bdb08d788 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -230,6 +230,7 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = {
230static const struct usb_device_id id_table[] = { 230static const struct usb_device_id id_table[] = {
231 { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ 231 { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */
232 { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */ 232 { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */
233 { USB_DEVICE(0x03F0, 0x211D) }, /* HP ev2210 a.k.a MC5725 */
233 { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */ 234 { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */
234 235
235 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ 236 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 0afe5c71c17e..e1bfda33f5b9 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -172,7 +172,7 @@ static unsigned int product_5052_count;
172/* the array dimension is the number of default entries plus */ 172/* the array dimension is the number of default entries plus */
173/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ 173/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
174/* null entry */ 174/* null entry */
175static struct usb_device_id ti_id_table_3410[10+TI_EXTRA_VID_PID_COUNT+1] = { 175static struct usb_device_id ti_id_table_3410[13+TI_EXTRA_VID_PID_COUNT+1] = {
176 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 176 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
177 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 177 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
178 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 178 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -180,6 +180,9 @@ static struct usb_device_id ti_id_table_3410[10+TI_EXTRA_VID_PID_COUNT+1] = {
180 { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) }, 180 { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) },
181 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) }, 181 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) },
182 { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) }, 182 { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) },
183 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234MU_PRODUCT_ID) },
184 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234ZBA_PRODUCT_ID) },
185 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234ZBAOLD_PRODUCT_ID) },
183 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 186 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
184 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 187 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
185 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 188 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
@@ -192,7 +195,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
192 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, 195 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
193}; 196};
194 197
195static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = { 198static struct usb_device_id ti_id_table_combined[17+2*TI_EXTRA_VID_PID_COUNT+1] = {
196 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 199 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
197 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 200 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
198 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 201 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -200,6 +203,9 @@ static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1]
200 { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) }, 203 { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) },
201 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) }, 204 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) },
202 { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) }, 205 { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) },
206 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234MU_PRODUCT_ID) },
207 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234ZBA_PRODUCT_ID) },
208 { USB_DEVICE(MTS_VENDOR_ID, MTS_MT9234ZBAOLD_PRODUCT_ID) },
203 { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) }, 209 { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) },
204 { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, 210 { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
205 { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, 211 { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
@@ -287,6 +293,8 @@ MODULE_FIRMWARE("ti_5052.fw");
287MODULE_FIRMWARE("mts_cdma.fw"); 293MODULE_FIRMWARE("mts_cdma.fw");
288MODULE_FIRMWARE("mts_gsm.fw"); 294MODULE_FIRMWARE("mts_gsm.fw");
289MODULE_FIRMWARE("mts_edge.fw"); 295MODULE_FIRMWARE("mts_edge.fw");
296MODULE_FIRMWARE("mts_mt9234mu.fw");
297MODULE_FIRMWARE("mts_mt9234zba.fw");
290 298
291module_param(debug, bool, S_IRUGO | S_IWUSR); 299module_param(debug, bool, S_IRUGO | S_IWUSR);
292MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); 300MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes");
@@ -1687,6 +1695,7 @@ static int ti_download_firmware(struct ti_device *tdev)
1687 const struct firmware *fw_p; 1695 const struct firmware *fw_p;
1688 char buf[32]; 1696 char buf[32];
1689 1697
1698 dbg("%s\n", __func__);
1690 /* try ID specific firmware first, then try generic firmware */ 1699 /* try ID specific firmware first, then try generic firmware */
1691 sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, 1700 sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,
1692 dev->descriptor.idProduct); 1701 dev->descriptor.idProduct);
@@ -1703,7 +1712,15 @@ static int ti_download_firmware(struct ti_device *tdev)
1703 case MTS_EDGE_PRODUCT_ID: 1712 case MTS_EDGE_PRODUCT_ID:
1704 strcpy(buf, "mts_edge.fw"); 1713 strcpy(buf, "mts_edge.fw");
1705 break; 1714 break;
1706 } 1715 case MTS_MT9234MU_PRODUCT_ID:
1716 strcpy(buf, "mts_mt9234mu.fw");
1717 break;
1718 case MTS_MT9234ZBA_PRODUCT_ID:
1719 strcpy(buf, "mts_mt9234zba.fw");
1720 break;
1721 case MTS_MT9234ZBAOLD_PRODUCT_ID:
1722 strcpy(buf, "mts_mt9234zba.fw");
1723 break; }
1707 } 1724 }
1708 if (buf[0] == '\0') { 1725 if (buf[0] == '\0') {
1709 if (tdev->td_is_3410) 1726 if (tdev->td_is_3410)
@@ -1718,7 +1735,7 @@ static int ti_download_firmware(struct ti_device *tdev)
1718 return -ENOENT; 1735 return -ENOENT;
1719 } 1736 }
1720 if (fw_p->size > TI_FIRMWARE_BUF_SIZE) { 1737 if (fw_p->size > TI_FIRMWARE_BUF_SIZE) {
1721 dev_err(&dev->dev, "%s - firmware too large\n", __func__); 1738 dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size);
1722 return -ENOENT; 1739 return -ENOENT;
1723 } 1740 }
1724 1741
@@ -1730,6 +1747,7 @@ static int ti_download_firmware(struct ti_device *tdev)
1730 status = ti_do_download(dev, pipe, buffer, fw_p->size); 1747 status = ti_do_download(dev, pipe, buffer, fw_p->size);
1731 kfree(buffer); 1748 kfree(buffer);
1732 } else { 1749 } else {
1750 dbg("%s ENOMEM\n", __func__);
1733 status = -ENOMEM; 1751 status = -ENOMEM;
1734 } 1752 }
1735 release_firmware(fw_p); 1753 release_firmware(fw_p);
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index f323c6025858..2aac1953993b 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -45,6 +45,9 @@
45#define MTS_CDMA_PRODUCT_ID 0xF110 45#define MTS_CDMA_PRODUCT_ID 0xF110
46#define MTS_GSM_PRODUCT_ID 0xF111 46#define MTS_GSM_PRODUCT_ID 0xF111
47#define MTS_EDGE_PRODUCT_ID 0xF112 47#define MTS_EDGE_PRODUCT_ID 0xF112
48#define MTS_MT9234MU_PRODUCT_ID 0xF114
49#define MTS_MT9234ZBA_PRODUCT_ID 0xF115
50#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
48 51
49/* Commands */ 52/* Commands */
50#define TI_GET_VERSION 0x01 53#define TI_GET_VERSION 0x01
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 46e79d349498..7ec24e46b34b 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -438,7 +438,7 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
438 old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr); 438 old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr);
439 keep_alives = 0; 439 keep_alives = 0;
440 for (cnt = 0; 440 for (cnt = 0;
441 keep_alives <= WUIE_ELT_MAX && cnt < wusbhc->ports_max; 441 keep_alives < WUIE_ELT_MAX && cnt < wusbhc->ports_max;
442 cnt++) { 442 cnt++) {
443 unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout); 443 unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout);
444 444
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index 44e49c28b2a7..c2ec3dcd4e91 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -488,9 +488,9 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
488 fbinfo->fbops = &bfin_t350mcqb_fb_ops; 488 fbinfo->fbops = &bfin_t350mcqb_fb_ops;
489 fbinfo->flags = FBINFO_FLAG_DEFAULT; 489 fbinfo->flags = FBINFO_FLAG_DEFAULT;
490 490
491 info->fb_buffer = 491 info->fb_buffer = dma_alloc_coherent(NULL, fbinfo->fix.smem_len +
492 dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle, 492 ACTIVE_VIDEO_MEM_OFFSET,
493 GFP_KERNEL); 493 &info->dma_handle, GFP_KERNEL);
494 494
495 if (NULL == info->fb_buffer) { 495 if (NULL == info->fb_buffer) {
496 printk(KERN_ERR DRIVER_NAME 496 printk(KERN_ERR DRIVER_NAME
@@ -568,8 +568,8 @@ out7:
568out6: 568out6:
569 fb_dealloc_cmap(&fbinfo->cmap); 569 fb_dealloc_cmap(&fbinfo->cmap);
570out4: 570out4:
571 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 571 dma_free_coherent(NULL, fbinfo->fix.smem_len + ACTIVE_VIDEO_MEM_OFFSET,
572 info->dma_handle); 572 info->fb_buffer, info->dma_handle);
573out3: 573out3:
574 framebuffer_release(fbinfo); 574 framebuffer_release(fbinfo);
575out2: 575out2:
@@ -592,8 +592,9 @@ static int __devexit bfin_t350mcqb_remove(struct platform_device *pdev)
592 free_irq(info->irq, info); 592 free_irq(info->irq, info);
593 593
594 if (info->fb_buffer != NULL) 594 if (info->fb_buffer != NULL)
595 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 595 dma_free_coherent(NULL, fbinfo->fix.smem_len +
596 info->dma_handle); 596 ACTIVE_VIDEO_MEM_OFFSET, info->fb_buffer,
597 info->dma_handle);
597 598
598 fb_dealloc_cmap(&fbinfo->cmap); 599 fb_dealloc_cmap(&fbinfo->cmap);
599 600
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 581d2dbf675a..ecf405562f5c 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -49,6 +49,7 @@ enum {
49 M_MBP_2, /* MacBook Pro 2nd gen */ 49 M_MBP_2, /* MacBook Pro 2nd gen */
50 M_MBP_SR, /* MacBook Pro (Santa Rosa) */ 50 M_MBP_SR, /* MacBook Pro (Santa Rosa) */
51 M_MBP_4, /* MacBook Pro, 4th gen */ 51 M_MBP_4, /* MacBook Pro, 4th gen */
52 M_MBP_5_1, /* MacBook Pro, 5,1th gen */
52 M_UNKNOWN /* placeholder */ 53 M_UNKNOWN /* placeholder */
53}; 54};
54 55
@@ -70,6 +71,7 @@ static struct efifb_dmi_info {
70 [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */ 71 [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */
71 [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 }, 72 [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 },
72 [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 }, 73 [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 },
74 [M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 },
73 [M_UNKNOWN] = { NULL, 0, 0, 0, 0 } 75 [M_UNKNOWN] = { NULL, 0, 0, 0, 0 }
74}; 76};
75 77
@@ -106,6 +108,7 @@ static struct dmi_system_id __initdata dmi_system_table[] = {
106 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR), 108 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR),
107 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR), 109 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR),
108 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4), 110 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4),
111 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,1", M_MBP_5_1),
109 {}, 112 {},
110}; 113};
111 114
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e14bd0749129..e8c769944812 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -695,6 +695,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
695 * 1) Enable Runtime PM 695 * 1) Enable Runtime PM
696 * 2) Force Runtime PM Resume since hardware is accessed from probe() 696 * 2) Force Runtime PM Resume since hardware is accessed from probe()
697 */ 697 */
698 priv->dev = &pdev->dev;
698 pm_runtime_enable(priv->dev); 699 pm_runtime_enable(priv->dev);
699 pm_runtime_resume(priv->dev); 700 pm_runtime_resume(priv->dev);
700 return 0; 701 return 0;
@@ -957,25 +958,24 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
957 958
958 if (!pdev->dev.platform_data) { 959 if (!pdev->dev.platform_data) {
959 dev_err(&pdev->dev, "no platform data defined\n"); 960 dev_err(&pdev->dev, "no platform data defined\n");
960 error = -EINVAL; 961 return -EINVAL;
961 goto err0;
962 } 962 }
963 963
964 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 964 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
965 i = platform_get_irq(pdev, 0); 965 i = platform_get_irq(pdev, 0);
966 if (!res || i < 0) { 966 if (!res || i < 0) {
967 dev_err(&pdev->dev, "cannot get platform resources\n"); 967 dev_err(&pdev->dev, "cannot get platform resources\n");
968 error = -ENOENT; 968 return -ENOENT;
969 goto err0;
970 } 969 }
971 970
972 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 971 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
973 if (!priv) { 972 if (!priv) {
974 dev_err(&pdev->dev, "cannot allocate device data\n"); 973 dev_err(&pdev->dev, "cannot allocate device data\n");
975 error = -ENOMEM; 974 return -ENOMEM;
976 goto err0;
977 } 975 }
978 976
977 platform_set_drvdata(pdev, priv);
978
979 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED, 979 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
980 dev_name(&pdev->dev), priv); 980 dev_name(&pdev->dev), priv);
981 if (error) { 981 if (error) {
@@ -984,8 +984,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
984 } 984 }
985 985
986 priv->irq = i; 986 priv->irq = i;
987 priv->dev = &pdev->dev;
988 platform_set_drvdata(pdev, priv);
989 pdata = pdev->dev.platform_data; 987 pdata = pdev->dev.platform_data;
990 988
991 j = 0; 989 j = 0;
@@ -1099,9 +1097,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1099 info = ch->info; 1097 info = ch->info;
1100 1098
1101 if (info->fbdefio) { 1099 if (info->fbdefio) {
1102 priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * 1100 ch->sglist = vmalloc(sizeof(struct scatterlist) *
1103 info->fix.smem_len >> PAGE_SHIFT); 1101 info->fix.smem_len >> PAGE_SHIFT);
1104 if (!priv->ch->sglist) { 1102 if (!ch->sglist) {
1105 dev_err(&pdev->dev, "cannot allocate sglist\n"); 1103 dev_err(&pdev->dev, "cannot allocate sglist\n");
1106 goto err1; 1104 goto err1;
1107 } 1105 }
@@ -1126,9 +1124,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1126 } 1124 }
1127 1125
1128 return 0; 1126 return 0;
1129 err1: 1127err1:
1130 sh_mobile_lcdc_remove(pdev); 1128 sh_mobile_lcdc_remove(pdev);
1131 err0: 1129
1132 return error; 1130 return error;
1133} 1131}
1134 1132
@@ -1139,7 +1137,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1139 int i; 1137 int i;
1140 1138
1141 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) 1139 for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
1142 if (priv->ch[i].info->dev) 1140 if (priv->ch[i].info && priv->ch[i].info->dev)
1143 unregister_framebuffer(priv->ch[i].info); 1141 unregister_framebuffer(priv->ch[i].info);
1144 1142
1145 sh_mobile_lcdc_stop(priv); 1143 sh_mobile_lcdc_stop(priv);
@@ -1162,7 +1160,8 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1162 if (priv->dot_clk) 1160 if (priv->dot_clk)
1163 clk_put(priv->dot_clk); 1161 clk_put(priv->dot_clk);
1164 1162
1165 pm_runtime_disable(priv->dev); 1163 if (priv->dev)
1164 pm_runtime_disable(priv->dev);
1166 1165
1167 if (priv->base) 1166 if (priv->base)
1168 iounmap(priv->base); 1167 iounmap(priv->base);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 3aed38886f94..bfec7c29486d 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -103,7 +103,8 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
103 num = min(num, ARRAY_SIZE(vb->pfns)); 103 num = min(num, ARRAY_SIZE(vb->pfns));
104 104
105 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { 105 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {
106 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY); 106 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY |
107 __GFP_NOMEMALLOC | __GFP_NOWARN);
107 if (!page) { 108 if (!page) {
108 if (printk_ratelimit()) 109 if (printk_ratelimit())
109 dev_printk(KERN_INFO, &vb->vdev->dev, 110 dev_printk(KERN_INFO, &vb->vdev->dev,
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index ef36fca2eed4..3a7e9ff8a746 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -16,6 +16,7 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/sched.h>
19 20
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <mach/hardware.h> 22#include <mach/hardware.h>
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 1ed3d554e372..17726a05a0a6 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -115,9 +115,8 @@ static struct w1_therm_family_converter w1_therm_families[] = {
115 115
116static inline int w1_DS18B20_convert_temp(u8 rom[9]) 116static inline int w1_DS18B20_convert_temp(u8 rom[9])
117{ 117{
118 int t = ((s16)rom[1] << 8) | rom[0]; 118 s16 t = le16_to_cpup((__le16 *)rom);
119 t = t*1000/16; 119 return t*1000/16;
120 return t;
121} 120}
122 121
123static inline int w1_DS18S20_convert_temp(u8 rom[9]) 122static inline int w1_DS18S20_convert_temp(u8 rom[9])
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 500d38342e1e..801ead191499 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf,
121 return count; 121 return count;
122} 122}
123 123
124static const struct watchdog_info ident = { 124static struct watchdog_info ident = {
125 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 125 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
126 .identity = "PowerPC Book-E Watchdog", 126 .identity = "PowerPC Book-E Watchdog",
127}; 127};
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index 88ed54e50f74..59359c9a5e01 100644
--- a/drivers/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
@@ -244,7 +244,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
244module_param(timeout, int, 0); 244module_param(timeout, int, 0);
245MODULE_PARM_DESC(timeout, 245MODULE_PARM_DESC(timeout,
246 "Watchdog timeout in seconds. (1<=timeout<=3600, default=" 246 "Watchdog timeout in seconds. (1<=timeout<=3600, default="
247 __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 247 __MODULE_STRING(WDT_TIMEOUT) ")");
248 248
249MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," 249MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>,"
250 "Alessandro Zummo <a.zummo@towertech.it>"); 250 "Alessandro Zummo <a.zummo@towertech.it>");
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index c8eadd478175..88c83aa57303 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -67,8 +67,8 @@ static DEFINE_SPINLOCK(sbwd_lock);
67void sbwdog_set(char __iomem *wdog, unsigned long t) 67void sbwdog_set(char __iomem *wdog, unsigned long t)
68{ 68{
69 spin_lock(&sbwd_lock); 69 spin_lock(&sbwd_lock);
70 __raw_writeb(0, wdog - 0x10); 70 __raw_writeb(0, wdog);
71 __raw_writeq(t & 0x7fffffUL, wdog); 71 __raw_writeq(t & 0x7fffffUL, wdog - 0x10);
72 spin_unlock(&sbwd_lock); 72 spin_unlock(&sbwd_lock);
73} 73}
74 74
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c
index 8d44c9b6fb5b..c7d67e9a7465 100644
--- a/drivers/watchdog/sbc_fitpc2_wdt.c
+++ b/drivers/watchdog/sbc_fitpc2_wdt.c
@@ -30,7 +30,7 @@
30static int nowayout = WATCHDOG_NOWAYOUT; 30static int nowayout = WATCHDOG_NOWAYOUT;
31static unsigned int margin = 60; /* (secs) Default is 1 minute */ 31static unsigned int margin = 60; /* (secs) Default is 1 minute */
32static unsigned long wdt_status; 32static unsigned long wdt_status;
33static DEFINE_SPINLOCK(wdt_lock); 33static DEFINE_MUTEX(wdt_lock);
34 34
35#define WDT_IN_USE 0 35#define WDT_IN_USE 0
36#define WDT_OK_TO_CLOSE 1 36#define WDT_OK_TO_CLOSE 1
@@ -45,26 +45,26 @@ static DEFINE_SPINLOCK(wdt_lock);
45 45
46static void wdt_send_data(unsigned char command, unsigned char data) 46static void wdt_send_data(unsigned char command, unsigned char data)
47{ 47{
48 outb(command, COMMAND_PORT);
49 msleep(100);
50 outb(data, DATA_PORT); 48 outb(data, DATA_PORT);
51 msleep(200); 49 msleep(200);
50 outb(command, COMMAND_PORT);
51 msleep(100);
52} 52}
53 53
54static void wdt_enable(void) 54static void wdt_enable(void)
55{ 55{
56 spin_lock(&wdt_lock); 56 mutex_lock(&wdt_lock);
57 wdt_send_data(IFACE_ON_COMMAND, 1); 57 wdt_send_data(IFACE_ON_COMMAND, 1);
58 wdt_send_data(REBOOT_COMMAND, margin); 58 wdt_send_data(REBOOT_COMMAND, margin);
59 spin_unlock(&wdt_lock); 59 mutex_unlock(&wdt_lock);
60} 60}
61 61
62static void wdt_disable(void) 62static void wdt_disable(void)
63{ 63{
64 spin_lock(&wdt_lock); 64 mutex_lock(&wdt_lock);
65 wdt_send_data(IFACE_ON_COMMAND, 0); 65 wdt_send_data(IFACE_ON_COMMAND, 0);
66 wdt_send_data(REBOOT_COMMAND, 0); 66 wdt_send_data(REBOOT_COMMAND, 0);
67 spin_unlock(&wdt_lock); 67 mutex_unlock(&wdt_lock);
68} 68}
69 69
70static int fitpc2_wdt_open(struct inode *inode, struct file *file) 70static int fitpc2_wdt_open(struct inode *inode, struct file *file)