aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acorn/block/mfmhd.c2
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/osl.c2
-rw-r--r--drivers/atm/ambassador.c2
-rw-r--r--drivers/atm/eni.c2
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/atm/fore200e.c2
-rw-r--r--drivers/atm/he.c2
-rw-r--r--drivers/atm/horizon.c2
-rw-r--r--drivers/atm/idt77252.c2
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/atm/lanai.c2
-rw-r--r--drivers/atm/nicstar.c2
-rw-r--r--drivers/atm/zatm.c2
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/cpqarray.c2
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/ps2esdi.c4
-rw-r--r--drivers/block/sx8.c2
-rw-r--r--drivers/block/umem.c2
-rw-r--r--drivers/cdrom/cdu31a.c2
-rw-r--r--drivers/cdrom/mcdx.c2
-rw-r--r--drivers/cdrom/sonycd535.c2
-rw-r--r--drivers/char/amiserial.c2
-rw-r--r--drivers/char/applicom.c4
-rw-r--r--drivers/char/cyclades.c8
-rw-r--r--drivers/char/drm/drm_irq.c2
-rw-r--r--drivers/char/esp.c2
-rw-r--r--drivers/char/ftape/lowlevel/fdc-io.c2
-rw-r--r--drivers/char/hpet.c2
-rw-r--r--drivers/char/hvc_console.c2
-rw-r--r--drivers/char/hvcs.c2
-rw-r--r--drivers/char/hvsi.c2
-rw-r--r--drivers/char/ip2/ip2main.c6
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/isicom.c4
-rw-r--r--drivers/char/ite_gpio.c2
-rw-r--r--drivers/char/mbcs.c6
-rw-r--r--drivers/char/mmtimer.c2
-rw-r--r--drivers/char/mxser.c2
-rw-r--r--drivers/char/nwbutton.c2
-rw-r--r--drivers/char/qtronix.c2
-rw-r--r--drivers/char/rio/rio_linux.c2
-rw-r--r--drivers/char/riscom8.c2
-rw-r--r--drivers/char/rtc.c6
-rw-r--r--drivers/char/s3c2410-rtc.c4
-rw-r--r--drivers/char/snsc.c2
-rw-r--r--drivers/char/snsc_event.c2
-rw-r--r--drivers/char/sonypi.c2
-rw-r--r--drivers/char/specialix.c4
-rw-r--r--drivers/char/stallion.c4
-rw-r--r--drivers/char/sx.c4
-rw-r--r--drivers/char/synclink.c2
-rw-r--r--drivers/char/synclink_gt.c2
-rw-r--r--drivers/char/synclinkmp.c2
-rw-r--r--drivers/char/tlclk.c2
-rw-r--r--drivers/char/tpm/tpm_tis.c4
-rw-r--r--drivers/char/vme_scc.c48
-rw-r--r--drivers/char/watchdog/eurotechwdt.c2
-rw-r--r--drivers/char/watchdog/mpcore_wdt.c2
-rw-r--r--drivers/char/watchdog/wdt.c2
-rw-r--r--drivers/char/watchdog/wdt_pci.c2
-rw-r--r--drivers/dma/ioatdma.c2
-rw-r--r--drivers/edac/amd76x_edac.c4
-rw-r--r--drivers/edac/e752x_edac.c3
-rw-r--r--drivers/edac/e7xxx_edac.c3
-rw-r--r--drivers/edac/edac_mc.h4
-rw-r--r--drivers/edac/i82860_edac.c3
-rw-r--r--drivers/edac/i82875p_edac.c3
-rw-r--r--drivers/edac/r82600_edac.c3
-rw-r--r--drivers/fc4/soc.c2
-rw-r--r--drivers/fc4/socal.c2
-rw-r--r--drivers/i2c/busses/i2c-mpc.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c2
-rw-r--r--drivers/i2c/chips/isp1301_omap.c4
-rw-r--r--drivers/i2c/chips/tps65010.c8
-rw-r--r--drivers/ide/ide-probe.c10
-rw-r--r--drivers/ide/legacy/hd.c4
-rw-r--r--drivers/ide/pci/it821x.c2
-rw-r--r--drivers/ieee1394/ohci1394.c4
-rw-r--r--drivers/ieee1394/pcilynx.c2
-rw-r--r--drivers/infiniband/hw/ipath/Kconfig8
-rw-r--r--drivers/infiniband/hw/ipath/Makefile2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_common.h158
-rw-r--r--drivers/infiniband/hw/ipath/ipath_cq.c16
-rw-r--r--drivers/infiniband/hw/ipath/ipath_debug.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c98
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c396
-rw-r--r--drivers/infiniband/hw/ipath/ipath_eeprom.c28
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c400
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ht400.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c68
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c254
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h66
-rw-r--r--drivers/infiniband/hw/ipath/ipath_keys.c51
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.c62
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.h11
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c127
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mr.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_pe800.c5
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c108
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c899
-rw-r--r--drivers/infiniband/hw/ipath/ipath_registers.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c283
-rw-r--r--drivers/infiniband/hw/ipath/ipath_srq.c48
-rw-r--r--drivers/infiniband/hw/ipath/ipath_stats.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c115
-rw-r--r--drivers/infiniband/hw/ipath/ipath_uc.c165
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c41
-rw-r--r--drivers/infiniband/hw/ipath/ipath_user_pages.c12
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c183
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h82
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs_mcast.c39
-rw-r--r--drivers/infiniband/hw/ipath/ipath_wc_x86_64.c1
-rw-r--r--drivers/infiniband/hw/ipath/ips_common.h263
-rw-r--r--drivers/infiniband/hw/ipath/verbs_debug.h1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c2
-rw-r--r--drivers/input/keyboard/corgikbd.c2
-rw-r--r--drivers/input/keyboard/spitzkbd.c12
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c2
-rw-r--r--drivers/input/mouse/rpcmouse.c2
-rw-r--r--drivers/input/serio/gscps2.c2
-rw-r--r--drivers/input/serio/i8042.c4
-rw-r--r--drivers/input/serio/pcips2.c2
-rw-r--r--drivers/input/touchscreen/ads7846.c2
-rw-r--r--drivers/input/touchscreen/corgi_ts.c2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c4
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c2
-rw-r--r--drivers/isdn/hardware/avm/b1pci.c4
-rw-r--r--drivers/isdn/hardware/avm/b1pcmcia.c2
-rw-r--r--drivers/isdn/hardware/avm/c4.c2
-rw-r--r--drivers/isdn/hardware/avm/t1pci.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c2
-rw-r--r--drivers/isdn/hisax/avm_a1p.c2
-rw-r--r--drivers/isdn/hisax/avm_pci.c2
-rw-r--r--drivers/isdn/hisax/bkm_a4t.c2
-rw-r--r--drivers/isdn/hisax/bkm_a8.c2
-rw-r--r--drivers/isdn/hisax/diva.c2
-rw-r--r--drivers/isdn/hisax/elsa.c22
-rw-r--r--drivers/isdn/hisax/enternow_pci.c2
-rw-r--r--drivers/isdn/hisax/gazel.c2
-rw-r--r--drivers/isdn/hisax/hfc4s8s_l1.c2
-rw-r--r--drivers/isdn/hisax/hfc_pci.c2
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c4
-rw-r--r--drivers/isdn/hisax/niccy.c2
-rw-r--r--drivers/isdn/hisax/nj_s.c2
-rw-r--r--drivers/isdn/hisax/nj_u.c2
-rw-r--r--drivers/isdn/hisax/sedlbauer.c4
-rw-r--r--drivers/isdn/hisax/teles3.c2
-rw-r--r--drivers/isdn/hisax/telespci.c2
-rw-r--r--drivers/isdn/hisax/w6692.c2
-rw-r--r--drivers/isdn/hysdn/boardergo.c2
-rw-r--r--drivers/isdn/sc/init.c2
-rw-r--r--drivers/macintosh/macio_asic.c4
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/media/common/saa7146_core.c2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-pci.c2
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c2
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c2
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c2
-rw-r--r--drivers/media/video/meye.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c2
-rw-r--r--drivers/media/video/stradis.c2
-rw-r--r--drivers/media/video/zoran_card.c2
-rw-r--r--drivers/media/video/zr36120.c2
-rw-r--r--drivers/message/fusion/mptbase.c2
-rw-r--r--drivers/message/i2o/pci.c2
-rw-r--r--drivers/mfd/ucb1x00-core.c2
-rw-r--r--drivers/misc/ibmasm/module.c2
-rw-r--r--drivers/mmc/at91_mci.c2
-rw-r--r--drivers/mmc/au1xmmc.c2
-rw-r--r--drivers/mmc/mmci.c4
-rw-r--r--drivers/mmc/omap.c45
-rw-r--r--drivers/mmc/sdhci.c543
-rw-r--r--drivers/mmc/sdhci.h34
-rw-r--r--drivers/mmc/wbsd.c2
-rw-r--r--drivers/net/3c515.c2
-rw-r--r--drivers/net/3c523.c2
-rw-r--r--drivers/net/3c527.c2
-rw-r--r--drivers/net/3c59x.c4
-rw-r--r--drivers/net/8139cp.c2
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/a2065.c2
-rw-r--r--drivers/net/acenic.c2
-rw-r--r--drivers/net/amd8111e.c2
-rw-r--r--drivers/net/apne.c2
-rw-r--r--drivers/net/arcnet/com20020-pci.c2
-rw-r--r--drivers/net/ariadne.c2
-rw-r--r--drivers/net/b44.c4
-rw-r--r--drivers/net/bnx2.c6
-rw-r--r--drivers/net/cassini.c2
-rw-r--r--drivers/net/chelsio/cxgb2.c2
-rw-r--r--drivers/net/cris/eth_v10.c2
-rw-r--r--drivers/net/defxx.c2
-rw-r--r--drivers/net/dgrs.c2
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/dm9000.c2
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000/e1000_ethtool.c6
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/eepro.c2
-rw-r--r--drivers/net/eepro100.c2
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/fealnx.c2
-rw-r--r--drivers/net/forcedeth.c18
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c2
-rw-r--r--drivers/net/gt96100eth.c2
-rw-r--r--drivers/net/hamachi.c2
-rw-r--r--drivers/net/hamradio/baycom_ser_fdx.c2
-rw-r--r--drivers/net/hamradio/baycom_ser_hdx.c2
-rw-r--r--drivers/net/hamradio/scc.c2
-rw-r--r--drivers/net/hamradio/yam.c2
-rw-r--r--drivers/net/hp100.c2
-rw-r--r--drivers/net/hydra.c2
-rw-r--r--drivers/net/ibmlana.c2
-rw-r--r--drivers/net/ioc3-eth.c2
-rw-r--r--drivers/net/irda/donauboe.c4
-rw-r--r--drivers/net/irda/vlsi_ir.c2
-rw-r--r--drivers/net/ixgb/ixgb_main.c2
-rw-r--r--drivers/net/ixp2000/ixpdev.c2
-rw-r--r--drivers/net/jazzsonic.c2
-rw-r--r--drivers/net/lp486e.c2
-rw-r--r--drivers/net/mipsnet.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/myri_sbus.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/netx-eth.c2
-rw-r--r--drivers/net/ns83820.c2
-rw-r--r--drivers/net/pci-skeleton.c2
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/pcnet32.c2
-rw-r--r--drivers/net/phy/phy.c2
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/rrunner.c2
-rw-r--r--drivers/net/s2io.c4
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sis190.c2
-rw-r--r--drivers/net/sis900.c2
-rw-r--r--drivers/net/sk98lin/skge.c8
-rw-r--r--drivers/net/sk_mca.c2
-rw-r--r--drivers/net/skfp/skfddi.c2
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c4
-rw-r--r--drivers/net/smc-ultra32.c2
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/smc91x.h4
-rw-r--r--drivers/net/spider_net.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sun3lance.c2
-rw-r--r--drivers/net/sunbmac.c2
-rw-r--r--drivers/net/sundance.c2
-rw-r--r--drivers/net/sungem.c2
-rw-r--r--drivers/net/sunhme.c4
-rw-r--r--drivers/net/sunlance.c2
-rw-r--r--drivers/net/sunqe.c2
-rw-r--r--drivers/net/tc35815.c2
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/net/tlan.c2
-rw-r--r--drivers/net/tokenring/3c359.c2
-rw-r--r--drivers/net/tokenring/abyss.c2
-rw-r--r--drivers/net/tokenring/lanstreamer.c2
-rw-r--r--drivers/net/tokenring/madgemc.c2
-rw-r--r--drivers/net/tokenring/olympic.c2
-rw-r--r--drivers/net/tokenring/smctr.c4
-rw-r--r--drivers/net/tokenring/tmspci.c2
-rw-r--r--drivers/net/tulip/de2104x.c2
-rw-r--r--drivers/net/tulip/de4x5.c8
-rw-r--r--drivers/net/tulip/dmfe.c2
-rw-r--r--drivers/net/tulip/tulip_core.c4
-rw-r--r--drivers/net/tulip/uli526x.c2
-rw-r--r--drivers/net/tulip/winbond-840.c2
-rw-r--r--drivers/net/tulip/xircom_cb.c2
-rw-r--r--drivers/net/tulip/xircom_tulip_cb.c2
-rw-r--r--drivers/net/typhoon.c2
-rw-r--r--drivers/net/via-rhine.c4
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wan/dscc4.c2
-rw-r--r--drivers/net/wan/farsync.c2
-rw-r--r--drivers/net/wan/hostess_sv11.c2
-rw-r--r--drivers/net/wan/lmc/lmc_main.c2
-rw-r--r--drivers/net/wan/pc300_drv.c2
-rw-r--r--drivers/net/wan/pci200syn.c2
-rw-r--r--drivers/net/wan/sbni.c2
-rw-r--r--drivers/net/wan/sealevel.c2
-rw-r--r--drivers/net/wan/wanxl.c2
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c2
-rw-r--r--drivers/net/wireless/ipw2100.c2
-rw-r--r--drivers/net/wireless/ipw2200.c2
-rw-r--r--drivers/net/wireless/orinoco_nortel.c2
-rw-r--r--drivers/net/wireless/orinoco_pci.c2
-rw-r--r--drivers/net/wireless/orinoco_pci.h2
-rw-r--r--drivers/net/wireless/orinoco_plx.c2
-rw-r--r--drivers/net/wireless/orinoco_tmd.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_hotplug.c2
-rw-r--r--drivers/net/yellowfin.c2
-rw-r--r--drivers/net/zorro8390.c2
-rw-r--r--drivers/parisc/eisa.c2
-rw-r--r--drivers/parisc/superio.c2
-rw-r--r--drivers/parport/parport_ax88796.c2
-rw-r--r--drivers/parport/parport_mfc3.c2
-rw-r--r--drivers/parport/parport_sunbpp.c2
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c2
-rw-r--r--drivers/pci/hotplug/cpcihp_zt5550.c5
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c2
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c2
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c2
-rw-r--r--drivers/pcmcia/at91_cf.c4
-rw-r--r--drivers/pcmcia/hd64465_ss.c2
-rw-r--r--drivers/pcmcia/i82092.c2
-rw-r--r--drivers/pcmcia/i82365.c6
-rw-r--r--drivers/pcmcia/omap_cf.c2
-rw-r--r--drivers/pcmcia/pcmcia_resource.c8
-rw-r--r--drivers/pcmcia/pd6729.c2
-rw-r--r--drivers/pcmcia/soc_common.c2
-rw-r--r--drivers/pcmcia/vrc4171_card.c2
-rw-r--r--drivers/pcmcia/vrc4173_cardu.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c4
-rw-r--r--drivers/pnp/resource.c3
-rw-r--r--drivers/rtc/Kconfig16
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-at91.c2
-rw-r--r--drivers/rtc/rtc-ds1553.c2
-rw-r--r--drivers/rtc/rtc-pl031.c2
-rw-r--r--drivers/rtc/rtc-s3c.c607
-rw-r--r--drivers/rtc/rtc-sa1100.c6
-rw-r--r--drivers/rtc/rtc-vr41xx.c4
-rw-r--r--drivers/sbus/char/aurora.c12
-rw-r--r--drivers/sbus/char/bbc_i2c.c2
-rw-r--r--drivers/sbus/char/cpwatchdog.c2
-rw-r--r--drivers/scsi/3w-9xxx.c2
-rw-r--r--drivers/scsi/3w-xxxx.c2
-rw-r--r--drivers/scsi/53c7xx.c4
-rw-r--r--drivers/scsi/BusLogic.c2
-rw-r--r--drivers/scsi/NCR5380.c2
-rw-r--r--drivers/scsi/NCR_D700.c2
-rw-r--r--drivers/scsi/NCR_Q720.c2
-rw-r--r--drivers/scsi/a100u2w.c2
-rw-r--r--drivers/scsi/a2091.c2
-rw-r--r--drivers/scsi/a3000.c2
-rw-r--r--drivers/scsi/aacraid/rkt.c2
-rw-r--r--drivers/scsi/aacraid/rx.c2
-rw-r--r--drivers/scsi/aacraid/sa.c2
-rw-r--r--drivers/scsi/advansys.c18
-rw-r--r--drivers/scsi/aha152x.c4
-rw-r--r--drivers/scsi/aha1740.c2
-rw-r--r--drivers/scsi/ahci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c2
-rw-r--r--drivers/scsi/aic7xxx_old.c4
-rw-r--r--drivers/scsi/arm/acornscsi.c2
-rw-r--r--drivers/scsi/arm/cumana_1.c2
-rw-r--r--drivers/scsi/arm/cumana_2.c2
-rw-r--r--drivers/scsi/arm/powertec.c2
-rw-r--r--drivers/scsi/atp870u.c6
-rw-r--r--drivers/scsi/blz1230.c2
-rw-r--r--drivers/scsi/blz2060.c2
-rw-r--r--drivers/scsi/cyberstorm.c2
-rw-r--r--drivers/scsi/cyberstormII.c2
-rw-r--r--drivers/scsi/dc395x.c2
-rw-r--r--drivers/scsi/dec_esp.c10
-rw-r--r--drivers/scsi/dmx3191d.c2
-rw-r--r--drivers/scsi/dpt_i2o.c2
-rw-r--r--drivers/scsi/dtc.c2
-rw-r--r--drivers/scsi/eata.c2
-rw-r--r--drivers/scsi/eata_pio.c4
-rw-r--r--drivers/scsi/esp.c2
-rw-r--r--drivers/scsi/fastlane.c2
-rw-r--r--drivers/scsi/fd_mcs.c2
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/scsi/g_NCR5380.c2
-rw-r--r--drivers/scsi/gdth.c6
-rw-r--r--drivers/scsi/gvp11.c2
-rw-r--r--drivers/scsi/hptiop.c2
-rw-r--r--drivers/scsi/ibmmca.c6
-rw-r--r--drivers/scsi/in2000.c2
-rw-r--r--drivers/scsi/initio.c2
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/ips.c4
-rw-r--r--drivers/scsi/jazz_esp.c2
-rw-r--r--drivers/scsi/lasi700.c2
-rw-r--r--drivers/scsi/libata-bmdma.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c2
-rw-r--r--drivers/scsi/nsp32.c2
-rw-r--r--drivers/scsi/oktagon_esp.c2
-rw-r--r--drivers/scsi/pas16.c2
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c2
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c2
-rw-r--r--drivers/scsi/pdc_adma.c2
-rw-r--r--drivers/scsi/qla1280.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qlogicpti.c2
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_promise.c2
-rw-r--r--drivers/scsi/sata_qstor.c2
-rw-r--r--drivers/scsi/sata_sil.c2
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--drivers/scsi/sata_svw.c2
-rw-r--r--drivers/scsi/sata_sx4.c2
-rw-r--r--drivers/scsi/sata_via.c2
-rw-r--r--drivers/scsi/sata_vsc.c2
-rw-r--r--drivers/scsi/seagate.c2
-rw-r--r--drivers/scsi/sim710.c2
-rw-r--r--drivers/scsi/sun3x_esp.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c2
-rw-r--r--drivers/scsi/t128.c2
-rw-r--r--drivers/scsi/tmscsim.c2
-rw-r--r--drivers/scsi/u14-34f.c2
-rw-r--r--drivers/scsi/wd7000.c2
-rw-r--r--drivers/scsi/zalon.c2
-rw-r--r--drivers/serial/8250.c4
-rw-r--r--drivers/serial/at91_serial.c2
-rw-r--r--drivers/serial/crisv10.c22
-rw-r--r--drivers/serial/dz.c2
-rw-r--r--drivers/serial/icom.c2
-rw-r--r--drivers/serial/imx.c2
-rw-r--r--drivers/serial/ioc4_serial.c2
-rw-r--r--drivers/serial/jsm/jsm_driver.c2
-rw-r--r--drivers/serial/m32r_sio.c2
-rw-r--r--drivers/serial/mcfserial.c2
-rw-r--r--drivers/serial/mpc52xx_uart.c2
-rw-r--r--drivers/serial/mpsc.c2
-rw-r--r--drivers/serial/pmac_zilog.c2
-rw-r--r--drivers/serial/serial_txx9.c2
-rw-r--r--drivers/serial/sh-sci.c4
-rw-r--r--drivers/serial/sn_console.c2
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/serial/sunsu.c4
-rw-r--r--drivers/serial/sunzilog.c2
-rw-r--r--drivers/serial/v850e_uart.c4
-rw-r--r--drivers/sn/ioc3.c6
-rw-r--r--drivers/tc/zs.c2
-rw-r--r--drivers/usb/core/hcd-pci.c2
-rw-r--r--drivers/usb/gadget/at91_udc.c4
-rw-r--r--drivers/usb/gadget/goku_udc.c2
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c2
-rw-r--r--drivers/usb/gadget/net2280.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c8
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c6
-rw-r--r--drivers/usb/host/ehci-au1xxx.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c2
-rw-r--r--drivers/usb/host/ohci-at91.c2
-rw-r--r--drivers/usb/host/ohci-au1xxx.c2
-rw-r--r--drivers/usb/host/ohci-lh7a404.c2
-rw-r--r--drivers/usb/host/ohci-omap.c4
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c2
-rw-r--r--drivers/usb/host/ohci-pxa27x.c2
-rw-r--r--drivers/usb/host/ohci-s3c2410.c2
-rw-r--r--drivers/usb/host/ohci-sa1111.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/video/arcfb.c2
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/au1200fb.c2
-rw-r--r--drivers/video/matrox/matroxfb_base.c2
-rw-r--r--drivers/video/pxafb.c2
-rw-r--r--drivers/video/s3c2410fb.c2
-rw-r--r--drivers/video/sa1100fb.c2
476 files changed, 3614 insertions, 2850 deletions
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
index d9c9a35961b3..3dd6b7bb5d35 100644
--- a/drivers/acorn/block/mfmhd.c
+++ b/drivers/acorn/block/mfmhd.c
@@ -1278,7 +1278,7 @@ static int mfm_do_init(unsigned char irqmask)
1278 1278
1279 printk("mfm: detected %d hard drive%s\n", mfm_drives, 1279 printk("mfm: detected %d hard drive%s\n", mfm_drives,
1280 mfm_drives == 1 ? "" : "s"); 1280 mfm_drives == 1 ? "" : "s");
1281 ret = request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL); 1281 ret = request_irq(mfm_irq, mfm_interrupt_handler, IRQF_DISABLED, "MFM harddisk", NULL);
1282 if (ret) { 1282 if (ret) {
1283 printk("mfm: unable to get IRQ%d\n", mfm_irq); 1283 printk("mfm: unable to get IRQ%d\n", mfm_irq);
1284 goto out4; 1284 goto out4;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index dec044c04273..ea5a0496a4fd 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -192,7 +192,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
192 /* Make sure this is a valid target state */ 192 /* Make sure this is a valid target state */
193 193
194 if (!device->flags.power_manageable) { 194 if (!device->flags.power_manageable) {
195 printk(KERN_DEBUG "Device `[%s]is not power manageable", 195 printk(KERN_DEBUG "Device `[%s]' is not power manageable",
196 device->kobj.name); 196 device->kobj.name);
197 return -ENODEV; 197 return -ENODEV;
198 } 198 }
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5dd2ed11a387..5a468e2779ae 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -280,7 +280,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
280 280
281 acpi_irq_handler = handler; 281 acpi_irq_handler = handler;
282 acpi_irq_context = context; 282 acpi_irq_context = context;
283 if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) { 283 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
284 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); 284 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
285 return AE_NOT_ACQUIRED; 285 return AE_NOT_ACQUIRED;
286 } 286 }
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 4048681f36d5..d3b426313a41 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -2286,7 +2286,7 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_
2286 setup_pci_dev(pci_dev); 2286 setup_pci_dev(pci_dev);
2287 2287
2288 // grab (but share) IRQ and install handler 2288 // grab (but share) IRQ and install handler
2289 err = request_irq(irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev); 2289 err = request_irq(irq, interrupt_handler, IRQF_SHARED, DEV_LABEL, dev);
2290 if (err < 0) { 2290 if (err < 0) {
2291 PRINTK (KERN_ERR, "request IRQ failed!"); 2291 PRINTK (KERN_ERR, "request IRQ failed!");
2292 goto out_reset; 2292 goto out_reset;
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 976ced1f019e..df359a6c14f6 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1797,7 +1797,7 @@ static int __devinit eni_start(struct atm_dev *dev)
1797 1797
1798 DPRINTK(">eni_start\n"); 1798 DPRINTK(">eni_start\n");
1799 eni_dev = ENI_DEV(dev); 1799 eni_dev = ENI_DEV(dev);
1800 if (request_irq(eni_dev->irq,&eni_int,SA_SHIRQ,DEV_LABEL,dev)) { 1800 if (request_irq(eni_dev->irq,&eni_int,IRQF_SHARED,DEV_LABEL,dev)) {
1801 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", 1801 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
1802 dev->number,eni_dev->irq); 1802 dev->number,eni_dev->irq);
1803 error = -EAGAIN; 1803 error = -EAGAIN;
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index d40605c1af73..38fc054bd671 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1829,7 +1829,7 @@ static int __devinit fs_init (struct fs_dev *dev)
1829 init_q (dev, &dev->rx_rq[i], RXB_RQ(i), RXRQ_NENTRIES, 1); 1829 init_q (dev, &dev->rx_rq[i], RXB_RQ(i), RXRQ_NENTRIES, 1);
1830 1830
1831 dev->irq = pci_dev->irq; 1831 dev->irq = pci_dev->irq;
1832 if (request_irq (dev->irq, fs_irq, SA_SHIRQ, "firestream", dev)) { 1832 if (request_irq (dev->irq, fs_irq, IRQF_SHARED, "firestream", dev)) {
1833 printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq); 1833 printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq);
1834 /* XXX undo all previous stuff... */ 1834 /* XXX undo all previous stuff... */
1835 return 1; 1835 return 1;
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 9be9a4055199..98622130de5b 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2123,7 +2123,7 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags)
2123static int __devinit 2123static int __devinit
2124fore200e_irq_request(struct fore200e* fore200e) 2124fore200e_irq_request(struct fore200e* fore200e)
2125{ 2125{
2126 if (request_irq(fore200e->irq, fore200e_interrupt, SA_SHIRQ, fore200e->name, fore200e->atm_dev) < 0) { 2126 if (request_irq(fore200e->irq, fore200e_interrupt, IRQF_SHARED, fore200e->name, fore200e->atm_dev) < 0) {
2127 2127
2128 printk(FORE200E "unable to reserve IRQ %s for device %s\n", 2128 printk(FORE200E "unable to reserve IRQ %s for device %s\n",
2129 fore200e_irq_itoa(fore200e->irq), fore200e->name); 2129 fore200e_irq_itoa(fore200e->irq), fore200e->name);
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index a5cbd3d6e50f..d369130f4235 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1007,7 +1007,7 @@ he_init_irq(struct he_dev *he_dev)
1007 he_writel(he_dev, 0x0, GRP_54_MAP); 1007 he_writel(he_dev, 0x0, GRP_54_MAP);
1008 he_writel(he_dev, 0x0, GRP_76_MAP); 1008 he_writel(he_dev, 0x0, GRP_76_MAP);
1009 1009
1010 if (request_irq(he_dev->pci_dev->irq, he_irq_handler, SA_INTERRUPT|SA_SHIRQ, DEV_LABEL, he_dev)) { 1010 if (request_irq(he_dev->pci_dev->irq, he_irq_handler, IRQF_DISABLED|IRQF_SHARED, DEV_LABEL, he_dev)) {
1011 hprintk("irq %d already in use\n", he_dev->pci_dev->irq); 1011 hprintk("irq %d already in use\n", he_dev->pci_dev->irq);
1012 return -EINVAL; 1012 return -EINVAL;
1013 } 1013 }
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 821c81e8cd38..d1113e845f95 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2735,7 +2735,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
2735 irq = pci_dev->irq; 2735 irq = pci_dev->irq;
2736 if (request_irq(irq, 2736 if (request_irq(irq,
2737 interrupt_handler, 2737 interrupt_handler,
2738 SA_SHIRQ, /* irqflags guess */ 2738 IRQF_SHARED, /* irqflags guess */
2739 DEV_LABEL, /* name guess */ 2739 DEV_LABEL, /* name guess */
2740 dev)) { 2740 dev)) {
2741 PRINTD(DBG_WARN, "request IRQ failed!"); 2741 PRINTD(DBG_WARN, "request IRQ failed!");
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 8fdb30116f99..5d1c6c95262c 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3386,7 +3386,7 @@ init_card(struct atm_dev *dev)
3386 writel(SAR_STAT_TMROF, SAR_REG_STAT); 3386 writel(SAR_STAT_TMROF, SAR_REG_STAT);
3387 } 3387 }
3388 IPRINTK("%s: Request IRQ ... ", card->name); 3388 IPRINTK("%s: Request IRQ ... ", card->name);
3389 if (request_irq(pcidev->irq, idt77252_interrupt, SA_INTERRUPT|SA_SHIRQ, 3389 if (request_irq(pcidev->irq, idt77252_interrupt, IRQF_DISABLED|IRQF_SHARED,
3390 card->name, card) != 0) { 3390 card->name, card) != 0) {
3391 printk("%s: can't allocate IRQ.\n", card->name); 3391 printk("%s: can't allocate IRQ.\n", card->name);
3392 deinit_card(card); 3392 deinit_card(card);
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 333a7bc609d2..f20b0b2c06c6 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2488,7 +2488,7 @@ static int __devinit ia_start(struct atm_dev *dev)
2488 u32 ctrl_reg; 2488 u32 ctrl_reg;
2489 IF_EVENT(printk(">ia_start\n");) 2489 IF_EVENT(printk(">ia_start\n");)
2490 iadev = INPH_IA_DEV(dev); 2490 iadev = INPH_IA_DEV(dev);
2491 if (request_irq(iadev->irq, &ia_int, SA_SHIRQ, DEV_LABEL, dev)) { 2491 if (request_irq(iadev->irq, &ia_int, IRQF_SHARED, DEV_LABEL, dev)) {
2492 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", 2492 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
2493 dev->number, iadev->irq); 2493 dev->number, iadev->irq);
2494 error = -EAGAIN; 2494 error = -EAGAIN;
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index cac09e353be8..fe60a59b7fc0 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -2240,7 +2240,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev)
2240 conf2_write(lanai); 2240 conf2_write(lanai);
2241 reg_write(lanai, TX_FIFO_DEPTH, TxDepth_Reg); 2241 reg_write(lanai, TX_FIFO_DEPTH, TxDepth_Reg);
2242 reg_write(lanai, 0, CBR_ICG_Reg); /* CBR defaults to no limit */ 2242 reg_write(lanai, 0, CBR_ICG_Reg); /* CBR defaults to no limit */
2243 if ((result = request_irq(lanai->pci->irq, lanai_int, SA_SHIRQ, 2243 if ((result = request_irq(lanai->pci->irq, lanai_int, IRQF_SHARED,
2244 DEV_LABEL, lanai)) != 0) { 2244 DEV_LABEL, lanai)) != 0) {
2245 printk(KERN_ERR DEV_LABEL ": can't allocate interrupt\n"); 2245 printk(KERN_ERR DEV_LABEL ": can't allocate interrupt\n");
2246 goto error_vcctable; 2246 goto error_vcctable;
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index b78612d3fa46..b8036899e56f 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -625,7 +625,7 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
625 if (mac[i] == NULL) 625 if (mac[i] == NULL)
626 nicstar_init_eprom(card->membase); 626 nicstar_init_eprom(card->membase);
627 627
628 if (request_irq(pcidev->irq, &ns_irq_handler, SA_INTERRUPT | SA_SHIRQ, "nicstar", card) != 0) 628 if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
629 { 629 {
630 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq); 630 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
631 error = 9; 631 error = 9;
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 1699c934bad0..2c65e82f0d6b 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1270,7 +1270,7 @@ static int __init zatm_start(struct atm_dev *dev)
1270 zatm_dev->rx_map = zatm_dev->tx_map = NULL; 1270 zatm_dev->rx_map = zatm_dev->tx_map = NULL;
1271 for (i = 0; i < NR_MBX; i++) 1271 for (i = 0; i < NR_MBX; i++)
1272 zatm_dev->mbx_start[i] = 0; 1272 zatm_dev->mbx_start[i] = 0;
1273 error = request_irq(zatm_dev->irq, zatm_int, SA_SHIRQ, DEV_LABEL, dev); 1273 error = request_irq(zatm_dev->irq, zatm_int, IRQF_SHARED, DEV_LABEL, dev);
1274 if (error < 0) { 1274 if (error < 0) {
1275 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", 1275 printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
1276 dev->number,zatm_dev->irq); 1276 dev->number,zatm_dev->irq);
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 50ca1aa4ee3b..4cd23c3eab41 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -3014,7 +3014,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
3014 Acquire shared access to the IRQ Channel. 3014 Acquire shared access to the IRQ Channel.
3015 */ 3015 */
3016 IRQ_Channel = PCI_Device->irq; 3016 IRQ_Channel = PCI_Device->irq;
3017 if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ, 3017 if (request_irq(IRQ_Channel, InterruptHandler, IRQF_SHARED,
3018 Controller->FullModelName, Controller) < 0) 3018 Controller->FullModelName, Controller) < 0)
3019 { 3019 {
3020 DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n", 3020 DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 05fb08312c01..1c4df22dfd2a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3159,7 +3159,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3159 /* make sure the board interrupts are off */ 3159 /* make sure the board interrupts are off */
3160 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_OFF); 3160 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_OFF);
3161 if (request_irq(hba[i]->intr[SIMPLE_MODE_INT], do_cciss_intr, 3161 if (request_irq(hba[i]->intr[SIMPLE_MODE_INT], do_cciss_intr,
3162 SA_INTERRUPT | SA_SHIRQ, hba[i]->devname, hba[i])) { 3162 IRQF_DISABLED | IRQF_SHARED, hba[i]->devname, hba[i])) {
3163 printk(KERN_ERR "cciss: Unable to get irq %d for %s\n", 3163 printk(KERN_ERR "cciss: Unable to get irq %d for %s\n",
3164 hba[i]->intr[SIMPLE_MODE_INT], hba[i]->devname); 3164 hba[i]->intr[SIMPLE_MODE_INT], hba[i]->devname);
3165 goto clean2; 3165 goto clean2;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index bfd245df0a8c..757f42dd8e86 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -408,7 +408,7 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
408 } 408 }
409 hba[i]->access.set_intr_mask(hba[i], 0); 409 hba[i]->access.set_intr_mask(hba[i], 0);
410 if (request_irq(hba[i]->intr, do_ida_intr, 410 if (request_irq(hba[i]->intr, do_ida_intr,
411 SA_INTERRUPT|SA_SHIRQ, hba[i]->devname, hba[i])) 411 IRQF_DISABLED|IRQF_SHARED, hba[i]->devname, hba[i]))
412 { 412 {
413 printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n", 413 printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n",
414 hba[i]->intr, hba[i]->devname); 414 hba[i]->intr, hba[i]->devname);
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 39662f0c9cce..0a1b1ea36ddc 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -50,9 +50,9 @@
50#define DBG_RX 0x0200 50#define DBG_RX 0x0200
51#define DBG_TX 0x0400 51#define DBG_TX 0x0400
52static unsigned int debugflags; 52static unsigned int debugflags;
53static unsigned int nbds_max = 16;
54#endif /* NDEBUG */ 53#endif /* NDEBUG */
55 54
55static unsigned int nbds_max = 16;
56static struct nbd_device nbd_dev[MAX_NBD]; 56static struct nbd_device nbd_dev[MAX_NBD];
57 57
58/* 58/*
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index aef5a0ccabc9..5537974fb242 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -340,9 +340,9 @@ static int __init ps2esdi_geninit(void)
340 /* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can 340 /* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can
341 share with the SCSI driver */ 341 share with the SCSI driver */
342 if (request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, 342 if (request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler,
343 SA_INTERRUPT | SA_SHIRQ, "PS/2 ESDI", &ps2esdi_gendisk) 343 IRQF_DISABLED | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk)
344 && request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, 344 && request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler,
345 SA_SHIRQ, "PS/2 ESDI", &ps2esdi_gendisk) 345 IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk)
346 ) { 346 ) {
347 printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ); 347 printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ);
348 error = -EBUSY; 348 error = -EBUSY;
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 10a4aa5fb54d..c6beee18a07c 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -1676,7 +1676,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1676 1676
1677 pci_set_master(pdev); 1677 pci_set_master(pdev);
1678 1678
1679 rc = request_irq(pdev->irq, carm_interrupt, SA_SHIRQ, DRV_NAME, host); 1679 rc = request_irq(pdev->irq, carm_interrupt, IRQF_SHARED, DRV_NAME, host);
1680 if (rc) { 1680 if (rc) {
1681 printk(KERN_ERR DRV_NAME "(%s): irq alloc failure\n", 1681 printk(KERN_ERR DRV_NAME "(%s): irq alloc failure\n",
1682 pci_name(pdev)); 1682 pci_name(pdev));
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index f675f97f2a78..5d8925bd9045 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -1040,7 +1040,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1040 card->win_size = data; 1040 card->win_size = data;
1041 1041
1042 1042
1043 if (request_irq(dev->irq, mm_interrupt, SA_SHIRQ, "pci-umem", card)) { 1043 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, "pci-umem", card)) {
1044 printk(KERN_ERR "MM%d: Unable to allocate IRQ\n", card->card_number); 1044 printk(KERN_ERR "MM%d: Unable to allocate IRQ\n", card->card_number);
1045 ret = -ENODEV; 1045 ret = -ENODEV;
1046 1046
diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
index 5f0f2027f29e..37bdb0163f0d 100644
--- a/drivers/cdrom/cdu31a.c
+++ b/drivers/cdrom/cdu31a.c
@@ -3141,7 +3141,7 @@ int __init cdu31a_init(void)
3141 3141
3142 if (cdu31a_irq > 0) { 3142 if (cdu31a_irq > 0) {
3143 if (request_irq 3143 if (request_irq
3144 (cdu31a_irq, cdu31a_interrupt, SA_INTERRUPT, 3144 (cdu31a_irq, cdu31a_interrupt, IRQF_DISABLED,
3145 "cdu31a", NULL)) { 3145 "cdu31a", NULL)) {
3146 printk(KERN_WARNING PFX "Unable to grab IRQ%d for " 3146 printk(KERN_WARNING PFX "Unable to grab IRQ%d for "
3147 "the CDU31A driver\n", cdu31a_irq); 3147 "the CDU31A driver\n", cdu31a_irq);
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index 788c7a0b2fe3..dcd1ab684f3e 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -1193,7 +1193,7 @@ static int __init mcdx_init_drive(int drive)
1193 } 1193 }
1194 1194
1195 xtrace(INIT, "init() subscribe irq and i/o\n"); 1195 xtrace(INIT, "init() subscribe irq and i/o\n");
1196 if (request_irq(stuffp->irq, mcdx_intr, SA_INTERRUPT, "mcdx", stuffp)) { 1196 if (request_irq(stuffp->irq, mcdx_intr, IRQF_DISABLED, "mcdx", stuffp)) {
1197 release_region(stuffp->wreg_data, MCDX_IO_SIZE); 1197 release_region(stuffp->wreg_data, MCDX_IO_SIZE);
1198 xwarn("%s=0x%03x,%d: Init failed. Can't get irq (%d).\n", 1198 xwarn("%s=0x%03x,%d: Init failed. Can't get irq (%d).\n",
1199 MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq); 1199 MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq);
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index 8f7cc452af8d..30ab56258a92 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1527,7 +1527,7 @@ static int __init sony535_init(void)
1527 } 1527 }
1528 if (sony535_irq_used > 0) { 1528 if (sony535_irq_used > 0) {
1529 if (request_irq(sony535_irq_used, cdu535_interrupt, 1529 if (request_irq(sony535_irq_used, cdu535_interrupt,
1530 SA_INTERRUPT, CDU535_HANDLE, NULL)) { 1530 IRQF_DISABLED, CDU535_HANDLE, NULL)) {
1531 printk("Unable to grab IRQ%d for the " CDU535_MESSAGE_NAME 1531 printk("Unable to grab IRQ%d for the " CDU535_MESSAGE_NAME
1532 " driver; polling instead.\n", sony535_irq_used); 1532 " driver; polling instead.\n", sony535_irq_used);
1533 sony535_irq_used = 0; 1533 sony535_irq_used = 0;
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 3e7dc7cbd740..9d6713a93ed7 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -2051,7 +2051,7 @@ static int __init rs_init(void)
2051 2051
2052 /* set ISRs, and then disable the rx interrupts */ 2052 /* set ISRs, and then disable the rx interrupts */
2053 request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); 2053 request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state);
2054 request_irq(IRQ_AMIGA_RBF, ser_rx_int, SA_INTERRUPT, "serial RX", state); 2054 request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED, "serial RX", state);
2055 2055
2056 /* turn off Rx and Tx interrupts */ 2056 /* turn off Rx and Tx interrupts */
2057 custom.intena = IF_RBF | IF_TBE; 2057 custom.intena = IF_RBF | IF_TBE;
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 72fb60765c45..bcc4668835b5 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -229,7 +229,7 @@ static int __init applicom_init(void)
229 continue; 229 continue;
230 } 230 }
231 231
232 if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) { 232 if (request_irq(dev->irq, &ac_interrupt, IRQF_SHARED, "Applicom PCI", &dummy)) {
233 printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); 233 printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
234 iounmap(RamIO); 234 iounmap(RamIO);
235 pci_disable_device(dev); 235 pci_disable_device(dev);
@@ -276,7 +276,7 @@ static int __init applicom_init(void)
276 printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq); 276 printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq);
277 277
278 if (!numisa) { 278 if (!numisa) {
279 if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) { 279 if (request_irq(irq, &ac_interrupt, IRQF_SHARED, "Applicom ISA", &dummy)) {
280 printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); 280 printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq);
281 iounmap(RamIO); 281 iounmap(RamIO);
282 apbs[boardno - 1].RamIO = NULL; 282 apbs[boardno - 1].RamIO = NULL;
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 1f61a6744a26..c1c67281750d 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4612,7 +4612,7 @@ cy_detect_isa(void)
4612 4612
4613 /* allocate IRQ */ 4613 /* allocate IRQ */
4614 if(request_irq(cy_isa_irq, cyy_interrupt, 4614 if(request_irq(cy_isa_irq, cyy_interrupt,
4615 SA_INTERRUPT, "Cyclom-Y", &cy_card[j])) 4615 IRQF_DISABLED, "Cyclom-Y", &cy_card[j]))
4616 { 4616 {
4617 printk("Cyclom-Y/ISA found at 0x%lx ", 4617 printk("Cyclom-Y/ISA found at 0x%lx ",
4618 (unsigned long) cy_isa_address); 4618 (unsigned long) cy_isa_address);
@@ -4785,7 +4785,7 @@ cy_detect_pci(void)
4785 4785
4786 /* allocate IRQ */ 4786 /* allocate IRQ */
4787 if(request_irq(cy_pci_irq, cyy_interrupt, 4787 if(request_irq(cy_pci_irq, cyy_interrupt,
4788 SA_SHIRQ, "Cyclom-Y", &cy_card[j])) 4788 IRQF_SHARED, "Cyclom-Y", &cy_card[j]))
4789 { 4789 {
4790 printk("Cyclom-Y/PCI found at 0x%lx ", 4790 printk("Cyclom-Y/PCI found at 0x%lx ",
4791 (ulong) cy_pci_phys2); 4791 (ulong) cy_pci_phys2);
@@ -4965,7 +4965,7 @@ cy_detect_pci(void)
4965 /* allocate IRQ only if board has an IRQ */ 4965 /* allocate IRQ only if board has an IRQ */
4966 if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { 4966 if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
4967 if(request_irq(cy_pci_irq, cyz_interrupt, 4967 if(request_irq(cy_pci_irq, cyz_interrupt,
4968 SA_SHIRQ, "Cyclades-Z", &cy_card[j])) 4968 IRQF_SHARED, "Cyclades-Z", &cy_card[j]))
4969 { 4969 {
4970 printk("Cyclom-8Zo/PCI found at 0x%lx ", 4970 printk("Cyclom-8Zo/PCI found at 0x%lx ",
4971 (ulong) cy_pci_phys2); 4971 (ulong) cy_pci_phys2);
@@ -5059,7 +5059,7 @@ cy_detect_pci(void)
5059 /* allocate IRQ only if board has an IRQ */ 5059 /* allocate IRQ only if board has an IRQ */
5060 if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { 5060 if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
5061 if(request_irq(cy_pci_irq, cyz_interrupt, 5061 if(request_irq(cy_pci_irq, cyz_interrupt,
5062 SA_SHIRQ, "Cyclades-Z", &cy_card[j])) 5062 IRQF_SHARED, "Cyclades-Z", &cy_card[j]))
5063 { 5063 {
5064 printk("Cyclom-Ze/PCI found at 0x%lx ", 5064 printk("Cyclom-Ze/PCI found at 0x%lx ",
5065 (ulong) cy_pci_phys2); 5065 (ulong) cy_pci_phys2);
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 611a1173091d..ebdb7182c4fd 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -130,7 +130,7 @@ static int drm_irq_install(drm_device_t * dev)
130 130
131 /* Install handler */ 131 /* Install handler */
132 if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) 132 if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
133 sh_flags = SA_SHIRQ; 133 sh_flags = IRQF_SHARED;
134 134
135 ret = request_irq(dev->irq, dev->driver->irq_handler, 135 ret = request_irq(dev->irq, dev->driver->irq_handler,
136 sh_flags, dev->devname, dev); 136 sh_flags, dev->devname, dev);
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 9827d170ca17..afcd83d9984b 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -883,7 +883,7 @@ static int startup(struct esp_struct * info)
883 * Allocate the IRQ 883 * Allocate the IRQ
884 */ 884 */
885 885
886 retval = request_irq(info->irq, rs_interrupt_single, SA_SHIRQ, 886 retval = request_irq(info->irq, rs_interrupt_single, IRQF_SHARED,
887 "esp serial", info); 887 "esp serial", info);
888 888
889 if (retval) { 889 if (retval) {
diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c
index 093fdf98b19a..65c9d2ec60bd 100644
--- a/drivers/char/ftape/lowlevel/fdc-io.c
+++ b/drivers/char/ftape/lowlevel/fdc-io.c
@@ -1268,7 +1268,7 @@ static int fdc_grab_irq_and_dma(void)
1268 /* Get fast interrupt handler. 1268 /* Get fast interrupt handler.
1269 */ 1269 */
1270 if (request_irq(fdc.irq, ftape_interrupt, 1270 if (request_irq(fdc.irq, ftape_interrupt,
1271 SA_INTERRUPT, "ft", ftape_id)) { 1271 IRQF_DISABLED, "ft", ftape_id)) {
1272 TRACE_ABORT(-EIO, ft_t_bug, 1272 TRACE_ABORT(-EIO, ft_t_bug,
1273 "Unable to grab IRQ%d for ftape driver", 1273 "Unable to grab IRQ%d for ftape driver",
1274 fdc.irq); 1274 fdc.irq);
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 8b6c76f8ef0e..e5643f3aa73f 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -395,7 +395,7 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp)
395 395
396 sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); 396 sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev));
397 irq_flags = devp->hd_flags & HPET_SHARED_IRQ 397 irq_flags = devp->hd_flags & HPET_SHARED_IRQ
398 ? SA_SHIRQ : SA_INTERRUPT; 398 ? IRQF_SHARED : IRQF_DISABLED;
399 if (request_irq(irq, hpet_interrupt, irq_flags, 399 if (request_irq(irq, hpet_interrupt, irq_flags,
400 devp->hd_name, (void *)devp)) { 400 devp->hd_name, (void *)devp)) {
401 printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); 401 printk(KERN_ERR "hpet: IRQ %d is not free\n", irq);
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 859e5005c785..ca2f538e549e 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -346,7 +346,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
346 spin_unlock_irqrestore(&hp->lock, flags); 346 spin_unlock_irqrestore(&hp->lock, flags);
347 /* check error, fallback to non-irq */ 347 /* check error, fallback to non-irq */
348 if (irq != NO_IRQ) 348 if (irq != NO_IRQ)
349 rc = request_irq(irq, hvc_handle_interrupt, SA_INTERRUPT, "hvc_console", hp); 349 rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp);
350 350
351 /* 351 /*
352 * If the request_irq() fails and we return an error. The tty layer 352 * If the request_irq() fails and we return an error. The tty layer
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c
index 130dedc37568..4589ff302b07 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -899,7 +899,7 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address,
899 * the conn was registered and now. 899 * the conn was registered and now.
900 */ 900 */
901 if (!(rc = request_irq(irq, &hvcs_handle_interrupt, 901 if (!(rc = request_irq(irq, &hvcs_handle_interrupt,
902 SA_INTERRUPT, "ibmhvcs", hvcsd))) { 902 IRQF_DISABLED, "ibmhvcs", hvcsd))) {
903 /* 903 /*
904 * It is possible the vty-server was removed after the irq was 904 * It is possible the vty-server was removed after the irq was
905 * requested but before we have time to enable interrupts. 905 * requested but before we have time to enable interrupts.
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 7b04eb153205..8dc205b275e3 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1168,7 +1168,7 @@ static int __init hvsi_init(void)
1168 struct hvsi_struct *hp = &hvsi_ports[i]; 1168 struct hvsi_struct *hp = &hvsi_ports[i];
1169 int ret = 1; 1169 int ret = 1;
1170 1170
1171 ret = request_irq(hp->virq, hvsi_interrupt, SA_INTERRUPT, "hvsi", hp); 1171 ret = request_irq(hp->virq, hvsi_interrupt, IRQF_DISABLED, "hvsi", hp);
1172 if (ret) 1172 if (ret)
1173 printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n", 1173 printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n",
1174 hp->virq, ret); 1174 hp->virq, ret);
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index f9aa53c76f99..a4200a2b0811 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -491,8 +491,8 @@ static struct tty_operations ip2_ops = {
491/* initialisation of the devices and driver structures, and registers itself */ 491/* initialisation of the devices and driver structures, and registers itself */
492/* with the relevant kernel modules. */ 492/* with the relevant kernel modules. */
493/******************************************************************************/ 493/******************************************************************************/
494/* SA_INTERRUPT- if set blocks all interrupts else only this line */ 494/* IRQF_DISABLED - if set blocks all interrupts else only this line */
495/* SA_SHIRQ - for shared irq PCI or maybe EISA only */ 495/* IRQF_SHARED - for shared irq PCI or maybe EISA only */
496/* SA_RANDOM - can be source for cert. random number generators */ 496/* SA_RANDOM - can be source for cert. random number generators */
497#define IP2_SA_FLAGS 0 497#define IP2_SA_FLAGS 0
498 498
@@ -753,7 +753,7 @@ retry:
753 if (have_requested_irq(ip2config.irq[i])) 753 if (have_requested_irq(ip2config.irq[i]))
754 continue; 754 continue;
755 rc = request_irq( ip2config.irq[i], ip2_interrupt, 755 rc = request_irq( ip2config.irq[i], ip2_interrupt,
756 IP2_SA_FLAGS | (ip2config.type[i] == PCI ? SA_SHIRQ : 0), 756 IP2_SA_FLAGS | (ip2config.type[i] == PCI ? IRQF_SHARED : 0),
757 pcName, (void *)&pcName); 757 pcName, (void *)&pcName);
758 if (rc) { 758 if (rc) {
759 printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); 759 printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index c7f3e5c80666..f57eba0bf253 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1041,7 +1041,7 @@ static int std_irq_setup(struct smi_info *info)
1041 if (info->si_type == SI_BT) { 1041 if (info->si_type == SI_BT) {
1042 rv = request_irq(info->irq, 1042 rv = request_irq(info->irq,
1043 si_bt_irq_handler, 1043 si_bt_irq_handler,
1044 SA_INTERRUPT, 1044 IRQF_DISABLED,
1045 DEVICE_NAME, 1045 DEVICE_NAME,
1046 info); 1046 info);
1047 if (!rv) 1047 if (!rv)
@@ -1051,7 +1051,7 @@ static int std_irq_setup(struct smi_info *info)
1051 } else 1051 } else
1052 rv = request_irq(info->irq, 1052 rv = request_irq(info->irq,
1053 si_irq_handler, 1053 si_irq_handler,
1054 SA_INTERRUPT, 1054 IRQF_DISABLED,
1055 DEVICE_NAME, 1055 DEVICE_NAME,
1056 info); 1056 info);
1057 if (rv) { 1057 if (rv) {
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index c105b9540ad8..913be23e0a24 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1614,14 +1614,14 @@ static int __devinit isicom_register_isr(struct pci_dev *pdev,
1614 const unsigned int index) 1614 const unsigned int index)
1615{ 1615{
1616 struct isi_board *board = pci_get_drvdata(pdev); 1616 struct isi_board *board = pci_get_drvdata(pdev);
1617 unsigned long irqflags = SA_INTERRUPT; 1617 unsigned long irqflags = IRQF_DISABLED;
1618 int retval = -EINVAL; 1618 int retval = -EINVAL;
1619 1619
1620 if (!board->base) 1620 if (!board->base)
1621 goto end; 1621 goto end;
1622 1622
1623 if (board->isa == NO) 1623 if (board->isa == NO)
1624 irqflags |= SA_SHIRQ; 1624 irqflags |= IRQF_SHARED;
1625 1625
1626 retval = request_irq(board->irq, isicom_interrupt, irqflags, 1626 retval = request_irq(board->irq, isicom_interrupt, irqflags,
1627 ISICOM_NAME, board); 1627 ISICOM_NAME, board);
diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
index d1ed6ac950d1..747ba45e50e5 100644
--- a/drivers/char/ite_gpio.c
+++ b/drivers/char/ite_gpio.c
@@ -397,7 +397,7 @@ int __init ite_gpio_init(void)
397 init_waitqueue_head(&ite_gpio_wait[i]); 397 init_waitqueue_head(&ite_gpio_wait[i]);
398 } 398 }
399 399
400 if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0) { 400 if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, IRQF_SHARED, "gpio", 0) < 0) {
401 misc_deregister(&ite_gpio_miscdev); 401 misc_deregister(&ite_gpio_miscdev);
402 release_region(ite_gpio_base, 0x1c); 402 release_region(ite_gpio_base, 0x1c);
403 return 0; 403 return 0;
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c
index bb07c2766b27..0385650f6077 100644
--- a/drivers/char/mbcs.c
+++ b/drivers/char/mbcs.c
@@ -592,7 +592,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev)
592 getdma->intrHostDest = sn_irq->irq_xtalkaddr; 592 getdma->intrHostDest = sn_irq->irq_xtalkaddr;
593 getdma->intrVector = sn_irq->irq_irq; 593 getdma->intrVector = sn_irq->irq_irq;
594 if (request_irq(sn_irq->irq_irq, 594 if (request_irq(sn_irq->irq_irq,
595 (void *)mbcs_completion_intr_handler, SA_SHIRQ, 595 (void *)mbcs_completion_intr_handler, IRQF_SHARED,
596 "MBCS get intr", (void *)soft)) { 596 "MBCS get intr", (void *)soft)) {
597 tiocx_irq_free(soft->get_sn_irq); 597 tiocx_irq_free(soft->get_sn_irq);
598 return -EAGAIN; 598 return -EAGAIN;
@@ -608,7 +608,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev)
608 putdma->intrHostDest = sn_irq->irq_xtalkaddr; 608 putdma->intrHostDest = sn_irq->irq_xtalkaddr;
609 putdma->intrVector = sn_irq->irq_irq; 609 putdma->intrVector = sn_irq->irq_irq;
610 if (request_irq(sn_irq->irq_irq, 610 if (request_irq(sn_irq->irq_irq,
611 (void *)mbcs_completion_intr_handler, SA_SHIRQ, 611 (void *)mbcs_completion_intr_handler, IRQF_SHARED,
612 "MBCS put intr", (void *)soft)) { 612 "MBCS put intr", (void *)soft)) {
613 tiocx_irq_free(soft->put_sn_irq); 613 tiocx_irq_free(soft->put_sn_irq);
614 free_irq(soft->get_sn_irq->irq_irq, soft); 614 free_irq(soft->get_sn_irq->irq_irq, soft);
@@ -628,7 +628,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev)
628 algo->intrHostDest = sn_irq->irq_xtalkaddr; 628 algo->intrHostDest = sn_irq->irq_xtalkaddr;
629 algo->intrVector = sn_irq->irq_irq; 629 algo->intrVector = sn_irq->irq_irq;
630 if (request_irq(sn_irq->irq_irq, 630 if (request_irq(sn_irq->irq_irq,
631 (void *)mbcs_completion_intr_handler, SA_SHIRQ, 631 (void *)mbcs_completion_intr_handler, IRQF_SHARED,
632 "MBCS algo intr", (void *)soft)) { 632 "MBCS algo intr", (void *)soft)) {
633 tiocx_irq_free(soft->algo_sn_irq); 633 tiocx_irq_free(soft->algo_sn_irq);
634 free_irq(soft->put_sn_irq->irq_irq, soft); 634 free_irq(soft->put_sn_irq->irq_irq, soft);
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 95e8122b8068..70b774ff5aa4 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -687,7 +687,7 @@ static int __init mmtimer_init(void)
687 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 687 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second /
688 2) / sn_rtc_cycles_per_second; 688 2) / sn_rtc_cycles_per_second;
689 689
690 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) { 690 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) {
691 printk(KERN_WARNING "%s: unable to allocate interrupt.", 691 printk(KERN_WARNING "%s: unable to allocate interrupt.",
692 MMTIMER_NAME); 692 MMTIMER_NAME);
693 return -1; 693 return -1;
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index eb1559fcb81a..556abd3e0d07 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -94,7 +94,7 @@
94#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|\ 94#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|\
95 IXON|IXOFF)) 95 IXON|IXOFF))
96 96
97#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) 97#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED)
98 98
99#define C168_ASIC_ID 1 99#define C168_ASIC_ID 1
100#define C104_ASIC_ID 2 100#define C104_ASIC_ID 2
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index 94845dd12ca9..f240a104d250 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -223,7 +223,7 @@ static int __init nwbutton_init(void)
223 return -EBUSY; 223 return -EBUSY;
224 } 224 }
225 225
226 if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, SA_INTERRUPT, 226 if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, IRQF_DISABLED,
227 "nwbutton", NULL)) { 227 "nwbutton", NULL)) {
228 printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", 228 printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n",
229 IRQ_NETWINDER_BUTTON); 229 IRQ_NETWINDER_BUTTON);
diff --git a/drivers/char/qtronix.c b/drivers/char/qtronix.c
index 1087530e5854..9d134e98d2a0 100644
--- a/drivers/char/qtronix.c
+++ b/drivers/char/qtronix.c
@@ -144,7 +144,7 @@ void __init init_qtronix_990P_kbd(void)
144 cir_port_init(cir); 144 cir_port_init(cir);
145 145
146 retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler, 146 retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler,
147 (unsigned long )(SA_INTERRUPT|SA_SHIRQ), 147 (unsigned long )(IRQF_DISABLED|IRQF_SHARED),
148 (const char *)"Qtronix IR Keyboard", (void *)cir); 148 (const char *)"Qtronix IR Keyboard", (void *)cir);
149 149
150 if (retval) { 150 if (retval) {
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 5332d1d4b0e4..3afc6a47ebbc 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -1119,7 +1119,7 @@ static int __init rio_init(void)
1119 for (i = 0; i < p->RIONumHosts; i++) { 1119 for (i = 0; i < p->RIONumHosts; i++) {
1120 hp = &p->RIOHosts[i]; 1120 hp = &p->RIOHosts[i];
1121 if (hp->Ivec) { 1121 if (hp->Ivec) {
1122 int mode = SA_SHIRQ; 1122 int mode = IRQF_SHARED;
1123 if (hp->Ivec & 0x8000) { 1123 if (hp->Ivec & 0x8000) {
1124 mode = 0; 1124 mode = 0;
1125 hp->Ivec &= 0x7fff; 1125 hp->Ivec &= 0x7fff;
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index c84c3c3f10c3..f1c94f771af5 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -625,7 +625,7 @@ static inline int rc_setup_board(struct riscom_board * bp)
625 if (bp->flags & RC_BOARD_ACTIVE) 625 if (bp->flags & RC_BOARD_ACTIVE)
626 return 0; 626 return 0;
627 627
628 error = request_irq(bp->irq, rc_interrupt, SA_INTERRUPT, 628 error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED,
629 "RISCom/8", NULL); 629 "RISCom/8", NULL);
630 if (error) 630 if (error)
631 return error; 631 return error;
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 37dc2edd8d75..aefac4ac0bf5 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -220,7 +220,7 @@ static inline unsigned char rtc_is_updating(void)
220 220
221#ifdef RTC_IRQ 221#ifdef RTC_IRQ
222/* 222/*
223 * A very tiny interrupt handler. It runs with SA_INTERRUPT set, 223 * A very tiny interrupt handler. It runs with IRQF_DISABLED set,
224 * but there is possibility of conflicting with the set_rtc_mmss() 224 * but there is possibility of conflicting with the set_rtc_mmss()
225 * call (the rtc irq and the timer irq can easily run at the same 225 * call (the rtc irq and the timer irq can easily run at the same
226 * time in two different CPUs). So we need to serialize 226 * time in two different CPUs). So we need to serialize
@@ -958,7 +958,7 @@ found:
958 * XXX Interrupt pin #7 in Espresso is shared between RTC and 958 * XXX Interrupt pin #7 in Espresso is shared between RTC and
959 * PCI Slot 2 INTA# (and some INTx# in Slot 1). 959 * PCI Slot 2 INTA# (and some INTx# in Slot 1).
960 */ 960 */
961 if (request_irq(rtc_irq, rtc_interrupt, SA_SHIRQ, "rtc", (void *)&rtc_port)) { 961 if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) {
962 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); 962 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq);
963 return -EIO; 963 return -EIO;
964 } 964 }
@@ -976,7 +976,7 @@ no_irq:
976 rtc_int_handler_ptr = rtc_interrupt; 976 rtc_int_handler_ptr = rtc_interrupt;
977 } 977 }
978 978
979 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) { 979 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) {
980 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 980 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
981 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 981 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
982 release_region(RTC_PORT(0), RTC_IO_EXTENT); 982 release_region(RTC_PORT(0), RTC_IO_EXTENT);
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index b0038b19b505..5458ef1634e5 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -341,13 +341,13 @@ static int s3c2410_rtc_open(void)
341 int ret; 341 int ret;
342 342
343 ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq, 343 ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq,
344 SA_INTERRUPT, "s3c2410-rtc alarm", NULL); 344 IRQF_DISABLED, "s3c2410-rtc alarm", NULL);
345 345
346 if (ret) 346 if (ret)
347 printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno); 347 printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno);
348 348
349 ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq, 349 ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq,
350 SA_INTERRUPT, "s3c2410-rtc tick", NULL); 350 IRQF_DISABLED, "s3c2410-rtc tick", NULL);
351 351
352 if (ret) { 352 if (ret) {
353 printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno); 353 printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno);
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 56c8243cdb73..203240b6c08f 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -105,7 +105,7 @@ scdrv_open(struct inode *inode, struct file *file)
105 105
106 /* hook this subchannel up to the system controller interrupt */ 106 /* hook this subchannel up to the system controller interrupt */
107 rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, 107 rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt,
108 SA_SHIRQ | SA_INTERRUPT, 108 IRQF_SHARED | IRQF_DISABLED,
109 SYSCTL_BASENAME, sd); 109 SYSCTL_BASENAME, sd);
110 if (rv) { 110 if (rv) {
111 ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); 111 ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch);
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c
index e234d50e142a..8b2210b633df 100644
--- a/drivers/char/snsc_event.c
+++ b/drivers/char/snsc_event.c
@@ -310,7 +310,7 @@ scdrv_event_init(struct sysctl_data_s *scd)
310 310
311 /* hook event subchannel up to the system controller interrupt */ 311 /* hook event subchannel up to the system controller interrupt */
312 rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, 312 rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt,
313 SA_SHIRQ | SA_INTERRUPT, 313 IRQF_SHARED | IRQF_DISABLED,
314 "system controller events", event_sd); 314 "system controller events", event_sd);
315 if (rv) { 315 if (rv) {
316 printk(KERN_WARNING "%s: irq request failed (%d)\n", 316 printk(KERN_WARNING "%s: irq request failed (%d)\n",
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index e19d4856e9fc..45508a039508 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1282,7 +1282,7 @@ static int __devinit sonypi_setup_irq(struct sonypi_device *dev,
1282 while (irq_list->irq) { 1282 while (irq_list->irq) {
1283 1283
1284 if (!request_irq(irq_list->irq, sonypi_irq, 1284 if (!request_irq(irq_list->irq, sonypi_irq,
1285 SA_SHIRQ, "sonypi", sonypi_irq)) { 1285 IRQF_SHARED, "sonypi", sonypi_irq)) {
1286 dev->irq = irq_list->irq; 1286 dev->irq = irq_list->irq;
1287 dev->bits = irq_list->bits; 1287 dev->bits = irq_list->bits;
1288 return 0; 1288 return 0;
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index d4243fb80815..cb2859249d49 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -1015,9 +1015,9 @@ static inline int sx_setup_board(struct specialix_board * bp)
1015 return 0; 1015 return 0;
1016 1016
1017 if (bp->flags & SX_BOARD_IS_PCI) 1017 if (bp->flags & SX_BOARD_IS_PCI)
1018 error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT | SA_SHIRQ, "specialix IO8+", bp); 1018 error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED | IRQF_SHARED, "specialix IO8+", bp);
1019 else 1019 else
1020 error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT, "specialix IO8+", bp); 1020 error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED, "specialix IO8+", bp);
1021 1021
1022 if (error) 1022 if (error)
1023 return error; 1023 return error;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index f15df0e423e0..ed7b8eaf0367 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -2302,7 +2302,7 @@ static inline int stl_initeio(stlbrd_t *brdp)
2302 brdp->nrpanels = 1; 2302 brdp->nrpanels = 1;
2303 brdp->state |= BRD_FOUND; 2303 brdp->state |= BRD_FOUND;
2304 brdp->hwid = status; 2304 brdp->hwid = status;
2305 if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { 2305 if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) {
2306 printk("STALLION: failed to register interrupt " 2306 printk("STALLION: failed to register interrupt "
2307 "routine for %s irq=%d\n", name, brdp->irq); 2307 "routine for %s irq=%d\n", name, brdp->irq);
2308 rc = -ENODEV; 2308 rc = -ENODEV;
@@ -2512,7 +2512,7 @@ static inline int stl_initech(stlbrd_t *brdp)
2512 outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl); 2512 outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl);
2513 2513
2514 brdp->state |= BRD_FOUND; 2514 brdp->state |= BRD_FOUND;
2515 if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { 2515 if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) {
2516 printk("STALLION: failed to register interrupt " 2516 printk("STALLION: failed to register interrupt "
2517 "routine for %s irq=%d\n", name, brdp->irq); 2517 "routine for %s irq=%d\n", name, brdp->irq);
2518 i = -ENODEV; 2518 i = -ENODEV;
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 76b9107f7f81..45c193aa11db 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1993,7 +1993,7 @@ static int sx_init_board (struct sx_board *board)
1993 if(board->irq > 0) { 1993 if(board->irq > 0) {
1994 /* fixed irq, probably PCI */ 1994 /* fixed irq, probably PCI */
1995 if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ 1995 if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */
1996 if(request_irq(board->irq, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) { 1996 if(request_irq(board->irq, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) {
1997 printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq); 1997 printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq);
1998 board->irq = 0; 1998 board->irq = 0;
1999 } 1999 }
@@ -2005,7 +2005,7 @@ static int sx_init_board (struct sx_board *board)
2005 int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); 2005 int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK);
2006 for(irqnr = 15; irqnr > 0; irqnr--) 2006 for(irqnr = 15; irqnr > 0; irqnr--)
2007 if(irqmask & (1 << irqnr)) 2007 if(irqmask & (1 << irqnr))
2008 if(! request_irq(irqnr, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) 2008 if(! request_irq(irqnr, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board))
2009 break; 2009 break;
2010 if(! irqnr) 2010 if(! irqnr)
2011 printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); 2011 printk(KERN_ERR "sx: Cannot allocate IRQ.\n");
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index fee2aca3f6a5..df782dd1098c 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -8150,7 +8150,7 @@ static int __devinit synclink_init_one (struct pci_dev *dev,
8150 8150
8151 info->bus_type = MGSL_BUS_TYPE_PCI; 8151 info->bus_type = MGSL_BUS_TYPE_PCI;
8152 info->io_addr_size = 8; 8152 info->io_addr_size = 8;
8153 info->irq_flags = SA_SHIRQ; 8153 info->irq_flags = IRQF_SHARED;
8154 8154
8155 if (dev->device == 0x0210) { 8155 if (dev->device == 0x0210) {
8156 /* Version 1 PCI9030 based universal PCI adapter */ 8156 /* Version 1 PCI9030 based universal PCI adapter */
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 03edccc8a823..e829594195c1 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -3343,7 +3343,7 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
3343 info->phys_reg_addr = pci_resource_start(pdev,0); 3343 info->phys_reg_addr = pci_resource_start(pdev,0);
3344 3344
3345 info->bus_type = MGSL_BUS_TYPE_PCI; 3345 info->bus_type = MGSL_BUS_TYPE_PCI;
3346 info->irq_flags = SA_SHIRQ; 3346 info->irq_flags = IRQF_SHARED;
3347 3347
3348 info->init_error = -1; /* assume error, set to 0 on successful init */ 3348 info->init_error = -1; /* assume error, set to 0 on successful init */
3349 } 3349 }
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index ba54df3cf60a..1e443a233f51 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -3835,7 +3835,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3835 info->phys_statctrl_base &= ~(PAGE_SIZE-1); 3835 info->phys_statctrl_base &= ~(PAGE_SIZE-1);
3836 3836
3837 info->bus_type = MGSL_BUS_TYPE_PCI; 3837 info->bus_type = MGSL_BUS_TYPE_PCI;
3838 info->irq_flags = SA_SHIRQ; 3838 info->irq_flags = IRQF_SHARED;
3839 3839
3840 init_timer(&info->tx_timer); 3840 init_timer(&info->tx_timer);
3841 info->tx_timer.data = (unsigned long)info; 3841 info->tx_timer.data = (unsigned long)info;
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index dfc4437afefb..952b829e2cb4 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -208,7 +208,7 @@ static int tlclk_open(struct inode *inode, struct file *filp)
208 /* This device is wired through the FPGA IO space of the ATCA blade 208 /* This device is wired through the FPGA IO space of the ATCA blade
209 * we can't share this IRQ */ 209 * we can't share this IRQ */
210 result = request_irq(telclk_interrupt, &tlclk_interrupt, 210 result = request_irq(telclk_interrupt, &tlclk_interrupt,
211 SA_INTERRUPT, "telco_clock", tlclk_interrupt); 211 IRQF_DISABLED, "telco_clock", tlclk_interrupt);
212 if (result == -EBUSY) { 212 if (result == -EBUSY) {
213 printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); 213 printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n");
214 return -EBUSY; 214 return -EBUSY;
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 8ea70625f7ea..abb0f2aeae66 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -522,7 +522,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
522 iowrite8(i, chip->vendor.iobase + 522 iowrite8(i, chip->vendor.iobase +
523 TPM_INT_VECTOR(chip->vendor.locality)); 523 TPM_INT_VECTOR(chip->vendor.locality));
524 if (request_irq 524 if (request_irq
525 (i, tis_int_probe, SA_SHIRQ, 525 (i, tis_int_probe, IRQF_SHARED,
526 chip->vendor.miscdev.name, chip) != 0) { 526 chip->vendor.miscdev.name, chip) != 0) {
527 dev_info(chip->dev, 527 dev_info(chip->dev,
528 "Unable to request irq: %d for probe\n", 528 "Unable to request irq: %d for probe\n",
@@ -557,7 +557,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
557 chip->vendor.iobase + 557 chip->vendor.iobase +
558 TPM_INT_VECTOR(chip->vendor.locality)); 558 TPM_INT_VECTOR(chip->vendor.locality));
559 if (request_irq 559 if (request_irq
560 (chip->vendor.irq, tis_int_handler, SA_SHIRQ, 560 (chip->vendor.irq, tis_int_handler, IRQF_SHARED,
561 chip->vendor.miscdev.name, chip) != 0) { 561 chip->vendor.miscdev.name, chip) != 0) {
562 dev_info(chip->dev, 562 dev_info(chip->dev,
563 "Unable to request irq: %d for use\n", 563 "Unable to request irq: %d for use\n",
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index b17a6e2bbca8..bfe5ea948f6a 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -203,13 +203,13 @@ static int mvme147_scc_init(void)
203 port->datap = port->ctrlp + 1; 203 port->datap = port->ctrlp + 1;
204 port->port_a = &scc_ports[0]; 204 port->port_a = &scc_ports[0];
205 port->port_b = &scc_ports[1]; 205 port->port_b = &scc_ports[1];
206 request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, 206 request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
207 "SCC-A TX", port); 207 "SCC-A TX", port);
208 request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, 208 request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
209 "SCC-A status", port); 209 "SCC-A status", port);
210 request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, 210 request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
211 "SCC-A RX", port); 211 "SCC-A RX", port);
212 request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, 212 request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
213 "SCC-A special cond", port); 213 "SCC-A special cond", port);
214 { 214 {
215 SCC_ACCESS_INIT(port); 215 SCC_ACCESS_INIT(port);
@@ -230,13 +230,13 @@ static int mvme147_scc_init(void)
230 port->datap = port->ctrlp + 1; 230 port->datap = port->ctrlp + 1;
231 port->port_a = &scc_ports[0]; 231 port->port_a = &scc_ports[0];
232 port->port_b = &scc_ports[1]; 232 port->port_b = &scc_ports[1];
233 request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, 233 request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
234 "SCC-B TX", port); 234 "SCC-B TX", port);
235 request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, 235 request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
236 "SCC-B status", port); 236 "SCC-B status", port);
237 request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, 237 request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
238 "SCC-B RX", port); 238 "SCC-B RX", port);
239 request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, 239 request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
240 "SCC-B special cond", port); 240 "SCC-B special cond", port);
241 { 241 {
242 SCC_ACCESS_INIT(port); 242 SCC_ACCESS_INIT(port);
@@ -273,13 +273,13 @@ static int mvme162_scc_init(void)
273 port->datap = port->ctrlp + 2; 273 port->datap = port->ctrlp + 2;
274 port->port_a = &scc_ports[0]; 274 port->port_a = &scc_ports[0];
275 port->port_b = &scc_ports[1]; 275 port->port_b = &scc_ports[1];
276 request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, 276 request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
277 "SCC-A TX", port); 277 "SCC-A TX", port);
278 request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, 278 request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
279 "SCC-A status", port); 279 "SCC-A status", port);
280 request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, 280 request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
281 "SCC-A RX", port); 281 "SCC-A RX", port);
282 request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, 282 request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
283 "SCC-A special cond", port); 283 "SCC-A special cond", port);
284 { 284 {
285 SCC_ACCESS_INIT(port); 285 SCC_ACCESS_INIT(port);
@@ -300,13 +300,13 @@ static int mvme162_scc_init(void)
300 port->datap = port->ctrlp + 2; 300 port->datap = port->ctrlp + 2;
301 port->port_a = &scc_ports[0]; 301 port->port_a = &scc_ports[0];
302 port->port_b = &scc_ports[1]; 302 port->port_b = &scc_ports[1];
303 request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, 303 request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
304 "SCC-B TX", port); 304 "SCC-B TX", port);
305 request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, 305 request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
306 "SCC-B status", port); 306 "SCC-B status", port);
307 request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, 307 request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
308 "SCC-B RX", port); 308 "SCC-B RX", port);
309 request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, 309 request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
310 "SCC-B special cond", port); 310 "SCC-B special cond", port);
311 311
312 { 312 {
@@ -341,13 +341,13 @@ static int bvme6000_scc_init(void)
341 port->datap = port->ctrlp + 4; 341 port->datap = port->ctrlp + 4;
342 port->port_a = &scc_ports[0]; 342 port->port_a = &scc_ports[0];
343 port->port_b = &scc_ports[1]; 343 port->port_b = &scc_ports[1];
344 request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, 344 request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
345 "SCC-A TX", port); 345 "SCC-A TX", port);
346 request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, 346 request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
347 "SCC-A status", port); 347 "SCC-A status", port);
348 request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, 348 request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
349 "SCC-A RX", port); 349 "SCC-A RX", port);
350 request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, 350 request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED,
351 "SCC-A special cond", port); 351 "SCC-A special cond", port);
352 { 352 {
353 SCC_ACCESS_INIT(port); 353 SCC_ACCESS_INIT(port);
@@ -368,13 +368,13 @@ static int bvme6000_scc_init(void)
368 port->datap = port->ctrlp + 4; 368 port->datap = port->ctrlp + 4;
369 port->port_a = &scc_ports[0]; 369 port->port_a = &scc_ports[0];
370 port->port_b = &scc_ports[1]; 370 port->port_b = &scc_ports[1];
371 request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, 371 request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
372 "SCC-B TX", port); 372 "SCC-B TX", port);
373 request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, 373 request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
374 "SCC-B status", port); 374 "SCC-B status", port);
375 request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, 375 request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
376 "SCC-B RX", port); 376 "SCC-B RX", port);
377 request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, 377 request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED,
378 "SCC-B special cond", port); 378 "SCC-B special cond", port);
379 379
380 { 380 {
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c
index e89cda010b49..ea670de4fab7 100644
--- a/drivers/char/watchdog/eurotechwdt.c
+++ b/drivers/char/watchdog/eurotechwdt.c
@@ -420,7 +420,7 @@ static int __init eurwdt_init(void)
420 goto out; 420 goto out;
421 } 421 }
422 422
423 ret = request_irq(irq, eurwdt_interrupt, SA_INTERRUPT, "eurwdt", NULL); 423 ret = request_irq(irq, eurwdt_interrupt, IRQF_DISABLED, "eurwdt", NULL);
424 if(ret) { 424 if(ret) {
425 printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); 425 printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq);
426 goto outmisc; 426 goto outmisc;
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c
index 9c11d920add5..c2d492c852fc 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/char/watchdog/mpcore_wdt.c
@@ -355,7 +355,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
355 goto err_misc; 355 goto err_misc;
356 } 356 }
357 357
358 ret = request_irq(wdt->irq, mpcore_wdt_fire, SA_INTERRUPT, "mpcore_wdt", wdt); 358 ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED, "mpcore_wdt", wdt);
359 if (ret) { 359 if (ret) {
360 dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq); 360 dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq);
361 goto err_irq; 361 goto err_irq;
diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c
index 2586e9e858e2..a1d972c8f44c 100644
--- a/drivers/char/watchdog/wdt.c
+++ b/drivers/char/watchdog/wdt.c
@@ -580,7 +580,7 @@ static int __init wdt_init(void)
580 goto out; 580 goto out;
581 } 581 }
582 582
583 ret = request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL); 583 ret = request_irq(irq, wdt_interrupt, IRQF_DISABLED, "wdt501p", NULL);
584 if(ret) { 584 if(ret) {
585 printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); 585 printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq);
586 goto outreg; 586 goto outreg;
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
index c79cc9543d96..7529ecdbabae 100644
--- a/drivers/char/watchdog/wdt_pci.c
+++ b/drivers/char/watchdog/wdt_pci.c
@@ -617,7 +617,7 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev,
617 goto out_pci; 617 goto out_pci;
618 } 618 }
619 619
620 if (request_irq (irq, wdtpci_interrupt, SA_INTERRUPT | SA_SHIRQ, 620 if (request_irq (irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED,
621 "wdt_pci", &wdtpci_miscdev)) { 621 "wdt_pci", &wdtpci_miscdev)) {
622 printk (KERN_ERR PFX "IRQ %d is not free\n", irq); 622 printk (KERN_ERR PFX "IRQ %d is not free\n", irq);
623 goto out_reg; 623 goto out_reg;
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
index 2801d14a5e42..ecad8f65d2d4 100644
--- a/drivers/dma/ioatdma.c
+++ b/drivers/dma/ioatdma.c
@@ -739,7 +739,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev,
739 device->msi = 0; 739 device->msi = 0;
740 } 740 }
741#endif 741#endif
742 err = request_irq(pdev->irq, &ioat_do_interrupt, SA_SHIRQ, "ioat", 742 err = request_irq(pdev->irq, &ioat_do_interrupt, IRQF_SHARED, "ioat",
743 device); 743 device);
744 if (err) 744 if (err)
745 goto err_irq; 745 goto err_irq;
diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c
index d75864e35fef..f79f6b587bfa 100644
--- a/drivers/edac/amd76x_edac.c
+++ b/drivers/edac/amd76x_edac.c
@@ -19,8 +19,8 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "edac_mc.h" 20#include "edac_mc.h"
21 21
22#define AMD76X_REVISION " Ver: 2.0.0 " __DATE__ 22#define AMD76X_REVISION " Ver: 2.0.1 " __DATE__
23 23#define EDAC_MOD_STR "amd76x_edac"
24 24
25#define amd76x_printk(level, fmt, arg...) \ 25#define amd76x_printk(level, fmt, arg...) \
26 edac_printk(level, "amd76x", fmt, ##arg) 26 edac_printk(level, "amd76x", fmt, ##arg)
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index 815c3eb783de..c82bc0ed7f14 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -24,7 +24,8 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include "edac_mc.h" 25#include "edac_mc.h"
26 26
27#define E752X_REVISION " Ver: 2.0.0 " __DATE__ 27#define E752X_REVISION " Ver: 2.0.1 " __DATE__
28#define EDAC_MOD_STR "e752x_edac"
28 29
29static int force_function_unhide; 30static int force_function_unhide;
30 31
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c
index 5a5ecd5a0409..310d91b41c96 100644
--- a/drivers/edac/e7xxx_edac.c
+++ b/drivers/edac/e7xxx_edac.c
@@ -29,7 +29,8 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include "edac_mc.h" 30#include "edac_mc.h"
31 31
32#define E7XXX_REVISION " Ver: 2.0.0 " __DATE__ 32#define E7XXX_REVISION " Ver: 2.0.1 " __DATE__
33#define EDAC_MOD_STR "e7xxx_edac"
33 34
34#define e7xxx_printk(level, fmt, arg...) \ 35#define e7xxx_printk(level, fmt, arg...) \
35 edac_printk(level, "e7xxx", fmt, ##arg) 36 edac_printk(level, "e7xxx", fmt, ##arg)
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index 1be4947e28af..bf6ab8a8d5ed 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -78,10 +78,6 @@ extern int edac_debug_level;
78 78
79#endif /* !CONFIG_EDAC_DEBUG */ 79#endif /* !CONFIG_EDAC_DEBUG */
80 80
81#define edac_xstr(s) edac_str(s)
82#define edac_str(s) #s
83#define EDAC_MOD_STR edac_xstr(KBUILD_BASENAME)
84
85#define BIT(x) (1 << (x)) 81#define BIT(x) (1 << (x))
86 82
87#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ 83#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c
index e30a4a2eaf38..e4bb298e613f 100644
--- a/drivers/edac/i82860_edac.c
+++ b/drivers/edac/i82860_edac.c
@@ -16,7 +16,8 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include "edac_mc.h" 17#include "edac_mc.h"
18 18
19#define I82860_REVISION " Ver: 2.0.0 " __DATE__ 19#define I82860_REVISION " Ver: 2.0.1 " __DATE__
20#define EDAC_MOD_STR "i82860_edac"
20 21
21#define i82860_printk(level, fmt, arg...) \ 22#define i82860_printk(level, fmt, arg...) \
22 edac_printk(level, "i82860", fmt, ##arg) 23 edac_printk(level, "i82860", fmt, ##arg)
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 9423ee5e7edd..161fe09a6d38 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -20,7 +20,8 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include "edac_mc.h" 21#include "edac_mc.h"
22 22
23#define I82875P_REVISION " Ver: 2.0.0 " __DATE__ 23#define I82875P_REVISION " Ver: 2.0.1 " __DATE__
24#define EDAC_MOD_STR "i82875p_edac"
24 25
25#define i82875p_printk(level, fmt, arg...) \ 26#define i82875p_printk(level, fmt, arg...) \
26 edac_printk(level, "i82875p", fmt, ##arg) 27 edac_printk(level, "i82875p", fmt, ##arg)
diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c
index a0e248d11ed9..a49cf0a39398 100644
--- a/drivers/edac/r82600_edac.c
+++ b/drivers/edac/r82600_edac.c
@@ -22,7 +22,8 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include "edac_mc.h" 23#include "edac_mc.h"
24 24
25#define R82600_REVISION " Ver: 2.0.0 " __DATE__ 25#define R82600_REVISION " Ver: 2.0.1 " __DATE__
26#define EDAC_MOD_STR "r82600_edac"
26 27
27#define r82600_printk(level, fmt, arg...) \ 28#define r82600_printk(level, fmt, arg...) \
28 edac_printk(level, "r82600", fmt, ##arg) 29 edac_printk(level, "r82600", fmt, ##arg)
diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c
index cf8768b8d1f1..3b07e0ca81cd 100644
--- a/drivers/fc4/soc.c
+++ b/drivers/fc4/soc.c
@@ -637,7 +637,7 @@ static inline void soc_init(struct sbus_dev *sdev, int no)
637 637
638 irq = sdev->irqs[0]; 638 irq = sdev->irqs[0];
639 639
640 if (request_irq (irq, soc_intr, SA_SHIRQ, "SOC", (void *)s)) { 640 if (request_irq (irq, soc_intr, IRQF_SHARED, "SOC", (void *)s)) {
641 soc_printk ("Cannot order irq %d to go\n", irq); 641 soc_printk ("Cannot order irq %d to go\n", irq);
642 socs = s->next; 642 socs = s->next;
643 return; 643 return;
diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c
index f52d1e5bd5a5..2b75edc5859d 100644
--- a/drivers/fc4/socal.c
+++ b/drivers/fc4/socal.c
@@ -761,7 +761,7 @@ static inline void socal_init(struct sbus_dev *sdev, int no)
761 761
762 irq = sdev->irqs[0]; 762 irq = sdev->irqs[0];
763 763
764 if (request_irq (irq, socal_intr, SA_SHIRQ, "SOCAL", (void *)s)) { 764 if (request_irq (irq, socal_intr, IRQF_SHARED, "SOCAL", (void *)s)) {
765 socal_printk ("Cannot order irq %d to go\n", irq); 765 socal_printk ("Cannot order irq %d to go\n", irq);
766 socals = s->next; 766 socals = s->next;
767 return; 767 return;
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index de93601de178..377ab40944b8 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -318,7 +318,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
318 318
319 if (i2c->irq != 0) 319 if (i2c->irq != 0)
320 if ((result = request_irq(i2c->irq, mpc_i2c_isr, 320 if ((result = request_irq(i2c->irq, mpc_i2c_isr,
321 SA_SHIRQ, "i2c-mpc", i2c)) < 0) { 321 IRQF_SHARED, "i2c-mpc", i2c)) < 0) {
322 printk(KERN_ERR 322 printk(KERN_ERR
323 "i2c-mpc - failed to attach interrupt\n"); 323 "i2c-mpc - failed to attach interrupt\n");
324 goto fail_irq; 324 goto fail_irq;
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 5155010b455e..ee114b48face 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
968#endif 968#endif
969 969
970 pxa_set_cken(CKEN14_I2C, 1); 970 pxa_set_cken(CKEN14_I2C, 1);
971 ret = request_irq(IRQ_I2C, i2c_pxa_handler, SA_INTERRUPT, 971 ret = request_irq(IRQ_I2C, i2c_pxa_handler, IRQF_DISABLED,
972 "pxa2xx-i2c", i2c); 972 "pxa2xx-i2c", i2c);
973 if (ret) 973 if (ret)
974 goto out; 974 goto out;
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 512b8791c328..5d2950e91fc5 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -828,7 +828,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
828 goto out; 828 goto out;
829 } 829 }
830 830
831 ret = request_irq(res->start, s3c24xx_i2c_irq, SA_INTERRUPT, 831 ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED,
832 pdev->name, i2c); 832 pdev->name, i2c);
833 833
834 if (ret != 0) { 834 if (ret != 0) {
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index b638ac6e59f4..f92505b94c61 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -908,7 +908,7 @@ static int otg_bind(struct isp1301 *isp)
908 908
909 if (otg_dev) 909 if (otg_dev)
910 status = request_irq(otg_dev->resource[1].start, omap_otg_irq, 910 status = request_irq(otg_dev->resource[1].start, omap_otg_irq,
911 SA_INTERRUPT, DRIVER_NAME, isp); 911 IRQF_DISABLED, DRIVER_NAME, isp);
912 else 912 else
913 status = -ENODEV; 913 status = -ENODEV;
914 914
@@ -1578,7 +1578,7 @@ fail1:
1578 } 1578 }
1579 1579
1580 status = request_irq(isp->irq, isp1301_irq, 1580 status = request_irq(isp->irq, isp1301_irq,
1581 SA_SAMPLE_RANDOM, DRIVER_NAME, isp); 1581 IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp);
1582 if (status < 0) { 1582 if (status < 0) {
1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", 1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
1584 isp->irq, status); 1584 isp->irq, status);
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index e27ee12245d3..e7e27049fbfa 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -521,14 +521,14 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
521 } 521 }
522 522
523#ifdef CONFIG_ARM 523#ifdef CONFIG_ARM
524 irqflags = SA_SAMPLE_RANDOM | SA_TRIGGER_LOW; 524 irqflags = IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_LOW;
525 if (machine_is_omap_h2()) { 525 if (machine_is_omap_h2()) {
526 tps->model = TPS65010; 526 tps->model = TPS65010;
527 omap_cfg_reg(W4_GPIO58); 527 omap_cfg_reg(W4_GPIO58);
528 tps->irq = OMAP_GPIO_IRQ(58); 528 tps->irq = OMAP_GPIO_IRQ(58);
529 omap_request_gpio(58); 529 omap_request_gpio(58);
530 omap_set_gpio_direction(58, 1); 530 omap_set_gpio_direction(58, 1);
531 irqflags |= SA_TRIGGER_FALLING; 531 irqflags |= IRQF_TRIGGER_FALLING;
532 } 532 }
533 if (machine_is_omap_osk()) { 533 if (machine_is_omap_osk()) {
534 tps->model = TPS65010; 534 tps->model = TPS65010;
@@ -536,7 +536,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
536 tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)); 536 tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
537 omap_request_gpio(OMAP_MPUIO(1)); 537 omap_request_gpio(OMAP_MPUIO(1));
538 omap_set_gpio_direction(OMAP_MPUIO(1), 1); 538 omap_set_gpio_direction(OMAP_MPUIO(1), 1);
539 irqflags |= SA_TRIGGER_FALLING; 539 irqflags |= IRQF_TRIGGER_FALLING;
540 } 540 }
541 if (machine_is_omap_h3()) { 541 if (machine_is_omap_h3()) {
542 tps->model = TPS65013; 542 tps->model = TPS65013;
@@ -544,7 +544,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
544 // FIXME set up this board's IRQ ... 544 // FIXME set up this board's IRQ ...
545 } 545 }
546#else 546#else
547 irqflags = SA_SAMPLE_RANDOM; 547 irqflags = IRQF_SAMPLE_RANDOM;
548#endif 548#endif
549 549
550 if (tps->irq > 0) { 550 if (tps->irq > 0) {
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c5f71ac28d14..9cadf0106c6c 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1004,7 +1004,7 @@ static int ide_init_queue(ide_drive_t *drive)
1004 * and irq serialization situations. This is somewhat complex because 1004 * and irq serialization situations. This is somewhat complex because
1005 * it handles static as well as dynamic (PCMCIA) IDE interfaces. 1005 * it handles static as well as dynamic (PCMCIA) IDE interfaces.
1006 * 1006 *
1007 * The SA_INTERRUPT in sa_flags means ide_intr() is always entered with 1007 * The IRQF_DISABLED in sa_flags means ide_intr() is always entered with
1008 * interrupts completely disabled. This can be bad for interrupt latency, 1008 * interrupts completely disabled. This can be bad for interrupt latency,
1009 * but anything else has led to problems on some machines. We re-enable 1009 * but anything else has led to problems on some machines. We re-enable
1010 * interrupts as much as we can safely do in most places. 1010 * interrupts as much as we can safely do in most places.
@@ -1090,15 +1090,15 @@ static int init_irq (ide_hwif_t *hwif)
1090 * Allocate the irq, if not already obtained for another hwif 1090 * Allocate the irq, if not already obtained for another hwif
1091 */ 1091 */
1092 if (!match || match->irq != hwif->irq) { 1092 if (!match || match->irq != hwif->irq) {
1093 int sa = SA_INTERRUPT; 1093 int sa = IRQF_DISABLED;
1094#if defined(__mc68000__) || defined(CONFIG_APUS) 1094#if defined(__mc68000__) || defined(CONFIG_APUS)
1095 sa = SA_SHIRQ; 1095 sa = IRQF_SHARED;
1096#endif /* __mc68000__ || CONFIG_APUS */ 1096#endif /* __mc68000__ || CONFIG_APUS */
1097 1097
1098 if (IDE_CHIPSET_IS_PCI(hwif->chipset)) { 1098 if (IDE_CHIPSET_IS_PCI(hwif->chipset)) {
1099 sa = SA_SHIRQ; 1099 sa = IRQF_SHARED;
1100#ifndef CONFIG_IDEPCI_SHARE_IRQ 1100#ifndef CONFIG_IDEPCI_SHARE_IRQ
1101 sa |= SA_INTERRUPT; 1101 sa |= IRQF_DISABLED;
1102#endif /* CONFIG_IDEPCI_SHARE_IRQ */ 1102#endif /* CONFIG_IDEPCI_SHARE_IRQ */
1103 } 1103 }
1104 1104
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index 6439dec66881..aebecd8f51cc 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -691,7 +691,7 @@ static struct block_device_operations hd_fops = {
691}; 691};
692 692
693/* 693/*
694 * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags 694 * This is the hard disk IRQ description. The IRQF_DISABLED in sa_flags
695 * means we run the IRQ-handler with interrupts disabled: this is bad for 695 * means we run the IRQ-handler with interrupts disabled: this is bad for
696 * interrupt latency, but anything else has led to problems on some 696 * interrupt latency, but anything else has led to problems on some
697 * machines. 697 * machines.
@@ -806,7 +806,7 @@ static int __init hd_init(void)
806 p->cyl, p->head, p->sect); 806 p->cyl, p->head, p->sect);
807 } 807 }
808 808
809 if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) { 809 if (request_irq(HD_IRQ, hd_interrupt, IRQF_DISABLED, "hd", NULL)) {
810 printk("hd: unable to get IRQ%d for the hard disk driver\n", 810 printk("hd: unable to get IRQ%d for the hard disk driver\n",
811 HD_IRQ); 811 HD_IRQ);
812 goto out1; 812 goto out1;
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 7fb3635683dc..3cb04424d351 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -650,6 +650,8 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
650 } 650 }
651 ide_set_hwifdata(hwif, idev); 651 ide_set_hwifdata(hwif, idev);
652 652
653 hwif->atapi_dma = 1;
654
653 pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 655 pci_read_config_byte(hwif->pci_dev, 0x50, &conf);
654 if(conf & 1) { 656 if(conf & 1) {
655 idev->smart = 1; 657 idev->smart = 1;
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 8de81ecd3ba6..d4bad6704bbe 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -3392,12 +3392,12 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3392 spin_lock_init(&ohci->event_lock); 3392 spin_lock_init(&ohci->event_lock);
3393 3393
3394 /* 3394 /*
3395 * interrupts are disabled, all right, but... due to SA_SHIRQ we 3395 * interrupts are disabled, all right, but... due to IRQF_SHARED we
3396 * might get called anyway. We'll see no event, of course, but 3396 * might get called anyway. We'll see no event, of course, but
3397 * we need to get to that "no event", so enough should be initialized 3397 * we need to get to that "no event", so enough should be initialized
3398 * by that point. 3398 * by that point.
3399 */ 3399 */
3400 if (request_irq(dev->irq, ohci_irq_handler, SA_SHIRQ, 3400 if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED,
3401 OHCI1394_DRIVER_NAME, ohci)) 3401 OHCI1394_DRIVER_NAME, ohci))
3402 FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq); 3402 FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq);
3403 3403
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
index 5b48f6ac5c7f..e6f41238f5e8 100644
--- a/drivers/ieee1394/pcilynx.c
+++ b/drivers/ieee1394/pcilynx.c
@@ -1253,7 +1253,7 @@ static int __devinit add_card(struct pci_dev *dev,
1253 1253
1254 sprintf (irq_buf, "%d", dev->irq); 1254 sprintf (irq_buf, "%d", dev->irq);
1255 1255
1256 if (!request_irq(dev->irq, lynx_irq_handler, SA_SHIRQ, 1256 if (!request_irq(dev->irq, lynx_irq_handler, IRQF_SHARED,
1257 PCILYNX_DRIVER_NAME, lynx)) { 1257 PCILYNX_DRIVER_NAME, lynx)) {
1258 PRINT(KERN_INFO, lynx->id, "allocated interrupt %s", irq_buf); 1258 PRINT(KERN_INFO, lynx->id, "allocated interrupt %s", irq_buf);
1259 lynx->state = have_intr; 1259 lynx->state = have_intr;
diff --git a/drivers/infiniband/hw/ipath/Kconfig b/drivers/infiniband/hw/ipath/Kconfig
index 9ea67c409b6d..1db9489f1e82 100644
--- a/drivers/infiniband/hw/ipath/Kconfig
+++ b/drivers/infiniband/hw/ipath/Kconfig
@@ -1,16 +1,16 @@
1config IPATH_CORE 1config IPATH_CORE
2 tristate "PathScale InfiniPath Driver" 2 tristate "QLogic InfiniPath Driver"
3 depends on 64BIT && PCI_MSI && NET 3 depends on 64BIT && PCI_MSI && NET
4 ---help--- 4 ---help---
5 This is a low-level driver for PathScale InfiniPath host channel 5 This is a low-level driver for QLogic InfiniPath host channel
6 adapters (HCAs) based on the HT-400 and PE-800 chips. 6 adapters (HCAs) based on the HT-400 and PE-800 chips.
7 7
8config INFINIBAND_IPATH 8config INFINIBAND_IPATH
9 tristate "PathScale InfiniPath Verbs Driver" 9 tristate "QLogic InfiniPath Verbs Driver"
10 depends on IPATH_CORE && INFINIBAND 10 depends on IPATH_CORE && INFINIBAND
11 ---help--- 11 ---help---
12 This is a driver that provides InfiniBand verbs support for 12 This is a driver that provides InfiniBand verbs support for
13 PathScale InfiniPath host channel adapters (HCAs). This 13 QLogic InfiniPath host channel adapters (HCAs). This
14 allows these devices to be used with both kernel upper level 14 allows these devices to be used with both kernel upper level
15 protocols such as IP-over-InfiniBand as well as with userspace 15 protocols such as IP-over-InfiniBand as well as with userspace
16 applications (in conjunction with InfiniBand userspace access). 16 applications (in conjunction with InfiniBand userspace access).
diff --git a/drivers/infiniband/hw/ipath/Makefile b/drivers/infiniband/hw/ipath/Makefile
index b4d084abfd22..b0bf72864130 100644
--- a/drivers/infiniband/hw/ipath/Makefile
+++ b/drivers/infiniband/hw/ipath/Makefile
@@ -1,4 +1,4 @@
1EXTRA_CFLAGS += -DIPATH_IDSTR='"PathScale kernel.org driver"' \ 1EXTRA_CFLAGS += -DIPATH_IDSTR='"QLogic kernel.org driver"' \
2 -DIPATH_KERN_TYPE=0 2 -DIPATH_KERN_TYPE=0
3 3
4obj-$(CONFIG_IPATH_CORE) += ipath_core.o 4obj-$(CONFIG_IPATH_CORE) += ipath_core.o
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h
index 48a55247b832..062bd392e7e5 100644
--- a/drivers/infiniband/hw/ipath/ipath_common.h
+++ b/drivers/infiniband/hw/ipath/ipath_common.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -38,7 +39,8 @@
38 * to communicate between kernel and user code. 39 * to communicate between kernel and user code.
39 */ 40 */
40 41
41/* This is the IEEE-assigned OUI for PathScale, Inc. */ 42
43/* This is the IEEE-assigned OUI for QLogic Inc. InfiniPath */
42#define IPATH_SRC_OUI_1 0x00 44#define IPATH_SRC_OUI_1 0x00
43#define IPATH_SRC_OUI_2 0x11 45#define IPATH_SRC_OUI_2 0x11
44#define IPATH_SRC_OUI_3 0x75 46#define IPATH_SRC_OUI_3 0x75
@@ -96,8 +98,8 @@ struct infinipath_stats {
96 __u64 sps_hwerrs; 98 __u64 sps_hwerrs;
97 /* number of times IB link changed state unexpectedly */ 99 /* number of times IB link changed state unexpectedly */
98 __u64 sps_iblink; 100 __u64 sps_iblink;
99 /* no longer used; left for compatibility */ 101 /* kernel receive interrupts that didn't read intstat */
100 __u64 sps_unused3; 102 __u64 sps_fastrcvint;
101 /* number of kernel (port0) packets received */ 103 /* number of kernel (port0) packets received */
102 __u64 sps_port0pkts; 104 __u64 sps_port0pkts;
103 /* number of "ethernet" packets sent by driver */ 105 /* number of "ethernet" packets sent by driver */
@@ -121,8 +123,7 @@ struct infinipath_stats {
121 __u64 sps_ports; 123 __u64 sps_ports;
122 /* list of pkeys (other than default) accepted (0 means not set) */ 124 /* list of pkeys (other than default) accepted (0 means not set) */
123 __u16 sps_pkeys[4]; 125 __u16 sps_pkeys[4];
124 /* lids for up to 4 infinipaths, indexed by infinipath # */ 126 __u16 sps_unused16[4]; /* available; maintaining compatible layout */
125 __u16 sps_lid[4];
126 /* number of user ports per chip (not IB ports) */ 127 /* number of user ports per chip (not IB ports) */
127 __u32 sps_nports; 128 __u32 sps_nports;
128 /* not our interrupt, or already handled */ 129 /* not our interrupt, or already handled */
@@ -140,10 +141,8 @@ struct infinipath_stats {
140 * packets if ipath not configured, sma/mad, etc.) 141 * packets if ipath not configured, sma/mad, etc.)
141 */ 142 */
142 __u64 sps_krdrops; 143 __u64 sps_krdrops;
143 /* mlids for up to 4 infinipaths, indexed by infinipath # */
144 __u16 sps_mlid[4];
145 /* pad for future growth */ 144 /* pad for future growth */
146 __u64 __sps_pad[45]; 145 __u64 __sps_pad[46];
147}; 146};
148 147
149/* 148/*
@@ -310,6 +309,9 @@ struct ipath_base_info {
310 __u32 spi_rcv_egrchunksize; 309 __u32 spi_rcv_egrchunksize;
311 /* total size of mmap to cover full rcvegrbuffers */ 310 /* total size of mmap to cover full rcvegrbuffers */
312 __u32 spi_rcv_egrbuftotlen; 311 __u32 spi_rcv_egrbuftotlen;
312 __u32 spi_filler_for_align;
313 /* address of readonly memory copy of the rcvhdrq tail register. */
314 __u64 spi_rcvhdr_tailaddr;
313} __attribute__ ((aligned(8))); 315} __attribute__ ((aligned(8)));
314 316
315 317
@@ -342,9 +344,9 @@ struct ipath_base_info {
342/* 344/*
343 * Similarly, this is the kernel version going back to the user. It's 345 * Similarly, this is the kernel version going back to the user. It's
344 * slightly different, in that we want to tell if the driver was built as 346 * slightly different, in that we want to tell if the driver was built as
345 * part of a PathScale release, or from the driver from OpenIB, kernel.org, 347 * part of a QLogic release, or from the driver from openfabrics.org,
346 * or a standard distribution, for support reasons. The high bit is 0 for 348 * kernel.org, or a standard distribution, for support reasons.
347 * non-PathScale, and 1 for PathScale-built/supplied. 349 * The high bit is 0 for non-QLogic and 1 for QLogic-built/supplied.
348 * 350 *
349 * It's returned by the driver to the user code during initialization in the 351 * It's returned by the driver to the user code during initialization in the
350 * spi_sw_version field of ipath_base_info, so the user code can in turn 352 * spi_sw_version field of ipath_base_info, so the user code can in turn
@@ -379,13 +381,7 @@ struct ipath_user_info {
379 */ 381 */
380 __u32 spu_rcvhdrsize; 382 __u32 spu_rcvhdrsize;
381 383
382 /* 384 __u64 spu_unused; /* kept for compatible layout */
383 * cache line aligned (64 byte) user address to
384 * which the rcvhdrtail register will be written by infinipath
385 * whenever it changes, so that no chip registers are read in
386 * the performance path.
387 */
388 __u64 spu_rcvhdraddr;
389 385
390 /* 386 /*
391 * address of struct base_info to write to 387 * address of struct base_info to write to
@@ -481,7 +477,7 @@ struct ipath_sma_pkt
481 * Data layout in I2C flash (for GUID, etc.) 477 * Data layout in I2C flash (for GUID, etc.)
482 * All fields are little-endian binary unless otherwise stated 478 * All fields are little-endian binary unless otherwise stated
483 */ 479 */
484#define IPATH_FLASH_VERSION 1 480#define IPATH_FLASH_VERSION 2
485struct ipath_flash { 481struct ipath_flash {
486 /* flash layout version (IPATH_FLASH_VERSION) */ 482 /* flash layout version (IPATH_FLASH_VERSION) */
487 __u8 if_fversion; 483 __u8 if_fversion;
@@ -489,14 +485,14 @@ struct ipath_flash {
489 __u8 if_csum; 485 __u8 if_csum;
490 /* 486 /*
491 * valid length (in use, protected by if_csum), including 487 * valid length (in use, protected by if_csum), including
492 * if_fversion and if_sum themselves) 488 * if_fversion and if_csum themselves)
493 */ 489 */
494 __u8 if_length; 490 __u8 if_length;
495 /* the GUID, in network order */ 491 /* the GUID, in network order */
496 __u8 if_guid[8]; 492 __u8 if_guid[8];
497 /* number of GUIDs to use, starting from if_guid */ 493 /* number of GUIDs to use, starting from if_guid */
498 __u8 if_numguid; 494 __u8 if_numguid;
499 /* the board serial number, in ASCII */ 495 /* the (last 10 characters of) board serial number, in ASCII */
500 char if_serial[12]; 496 char if_serial[12];
501 /* board mfg date (YYYYMMDD ASCII) */ 497 /* board mfg date (YYYYMMDD ASCII) */
502 char if_mfgdate[8]; 498 char if_mfgdate[8];
@@ -508,8 +504,10 @@ struct ipath_flash {
508 __u8 if_powerhour[2]; 504 __u8 if_powerhour[2];
509 /* ASCII free-form comment field */ 505 /* ASCII free-form comment field */
510 char if_comment[32]; 506 char if_comment[32];
511 /* 78 bytes used, min flash size is 128 bytes */ 507 /* Backwards compatible prefix for longer QLogic Serial Numbers */
512 __u8 if_future[50]; 508 char if_sprefix[4];
509 /* 82 bytes used, min flash size is 128 bytes */
510 __u8 if_future[46];
513}; 511};
514 512
515/* 513/*
@@ -603,14 +601,118 @@ struct infinipath_counters {
603#define INFINIPATH_KPF_INTR 0x1 601#define INFINIPATH_KPF_INTR 0x1
604 602
605/* SendPIO per-buffer control */ 603/* SendPIO per-buffer control */
606#define INFINIPATH_SP_LENGTHP1_MASK 0x3FF 604#define INFINIPATH_SP_TEST 0x40
607#define INFINIPATH_SP_LENGTHP1_SHIFT 0 605#define INFINIPATH_SP_TESTEBP 0x20
608#define INFINIPATH_SP_INTR 0x80000000
609#define INFINIPATH_SP_TEST 0x40000000
610#define INFINIPATH_SP_TESTEBP 0x20000000
611 606
612/* SendPIOAvail bits */ 607/* SendPIOAvail bits */
613#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1 608#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1
614#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0 609#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0
615 610
611/* infinipath header format */
612struct ipath_header {
613 /*
614 * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset -
615 * 14 bits before ECO change ~28 Dec 03. After that, Vers 4,
616 * Port 3, TID 11, offset 14.
617 */
618 __le32 ver_port_tid_offset;
619 __le16 chksum;
620 __le16 pkt_flags;
621};
622
623/* infinipath user message header format.
624 * This structure contains the first 4 fields common to all protocols
625 * that employ infinipath.
626 */
627struct ipath_message_header {
628 __be16 lrh[4];
629 __be32 bth[3];
630 /* fields below this point are in host byte order */
631 struct ipath_header iph;
632 __u8 sub_opcode;
633};
634
635/* infinipath ethernet header format */
636struct ether_header {
637 __be16 lrh[4];
638 __be32 bth[3];
639 struct ipath_header iph;
640 __u8 sub_opcode;
641 __u8 cmd;
642 __be16 lid;
643 __u16 mac[3];
644 __u8 frag_num;
645 __u8 seq_num;
646 __le32 len;
647 /* MUST be of word size due to PIO write requirements */
648 __le32 csum;
649 __le16 csum_offset;
650 __le16 flags;
651 __u16 first_2_bytes;
652 __u8 unused[2]; /* currently unused */
653};
654
655
656/* IB - LRH header consts */
657#define IPATH_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */
658#define IPATH_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */
659
660/* misc. */
661#define SIZE_OF_CRC 1
662
663#define IPATH_DEFAULT_P_KEY 0xFFFF
664#define IPATH_PERMISSIVE_LID 0xFFFF
665#define IPATH_AETH_CREDIT_SHIFT 24
666#define IPATH_AETH_CREDIT_MASK 0x1F
667#define IPATH_AETH_CREDIT_INVAL 0x1F
668#define IPATH_PSN_MASK 0xFFFFFF
669#define IPATH_MSN_MASK 0xFFFFFF
670#define IPATH_QPN_MASK 0xFFFFFF
671#define IPATH_MULTICAST_LID_BASE 0xC000
672#define IPATH_MULTICAST_QPN 0xFFFFFF
673
674/* Receive Header Queue: receive type (from infinipath) */
675#define RCVHQ_RCV_TYPE_EXPECTED 0
676#define RCVHQ_RCV_TYPE_EAGER 1
677#define RCVHQ_RCV_TYPE_NON_KD 2
678#define RCVHQ_RCV_TYPE_ERROR 3
679
680
681/* sub OpCodes - ith4x */
682#define IPATH_ITH4X_OPCODE_ENCAP 0x81
683#define IPATH_ITH4X_OPCODE_LID_ARP 0x82
684
685#define IPATH_HEADER_QUEUE_WORDS 9
686
687/* functions for extracting fields from rcvhdrq entries for the driver.
688 */
689static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf)
690{
691 return __le32_to_cpu(rbuf[1]);
692}
693
694static inline __u32 ipath_hdrget_rcv_type(const __le32 * rbuf)
695{
696 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT)
697 & INFINIPATH_RHF_RCVTYPE_MASK;
698}
699
700static inline __u32 ipath_hdrget_length_in_bytes(const __le32 * rbuf)
701{
702 return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT)
703 & INFINIPATH_RHF_LENGTH_MASK) << 2;
704}
705
706static inline __u32 ipath_hdrget_index(const __le32 * rbuf)
707{
708 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT)
709 & INFINIPATH_RHF_EGRINDEX_MASK;
710}
711
712static inline __u32 ipath_hdrget_ipath_ver(__le32 hdrword)
713{
714 return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT)
715 & INFINIPATH_I_VERS_MASK;
716}
717
616#endif /* _IPATH_COMMON_H */ 718#endif /* _IPATH_COMMON_H */
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c
index 7ece1135ddfe..3efee341c9bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -157,10 +158,21 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
157 struct ib_ucontext *context, 158 struct ib_ucontext *context,
158 struct ib_udata *udata) 159 struct ib_udata *udata)
159{ 160{
161 struct ipath_ibdev *dev = to_idev(ibdev);
160 struct ipath_cq *cq; 162 struct ipath_cq *cq;
161 struct ib_wc *wc; 163 struct ib_wc *wc;
162 struct ib_cq *ret; 164 struct ib_cq *ret;
163 165
166 if (entries > ib_ipath_max_cqes) {
167 ret = ERR_PTR(-EINVAL);
168 goto bail;
169 }
170
171 if (dev->n_cqs_allocated == ib_ipath_max_cqs) {
172 ret = ERR_PTR(-ENOMEM);
173 goto bail;
174 }
175
164 /* 176 /*
165 * Need to use vmalloc() if we want to support large #s of 177 * Need to use vmalloc() if we want to support large #s of
166 * entries. 178 * entries.
@@ -196,6 +208,8 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
196 208
197 ret = &cq->ibcq; 209 ret = &cq->ibcq;
198 210
211 dev->n_cqs_allocated++;
212
199bail: 213bail:
200 return ret; 214 return ret;
201} 215}
@@ -210,9 +224,11 @@ bail:
210 */ 224 */
211int ipath_destroy_cq(struct ib_cq *ibcq) 225int ipath_destroy_cq(struct ib_cq *ibcq)
212{ 226{
227 struct ipath_ibdev *dev = to_idev(ibcq->device);
213 struct ipath_cq *cq = to_icq(ibcq); 228 struct ipath_cq *cq = to_icq(ibcq);
214 229
215 tasklet_kill(&cq->comptask); 230 tasklet_kill(&cq->comptask);
231 dev->n_cqs_allocated--;
216 vfree(cq->queue); 232 vfree(cq->queue);
217 kfree(cq); 233 kfree(cq);
218 234
diff --git a/drivers/infiniband/hw/ipath/ipath_debug.h b/drivers/infiniband/hw/ipath/ipath_debug.h
index 46762387f5f8..f415beda0d32 100644
--- a/drivers/infiniband/hw/ipath/ipath_debug.h
+++ b/drivers/infiniband/hw/ipath/ipath_debug.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index 28ddceb260e8..147dd89e21c9 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -43,10 +44,9 @@
43#include <linux/pci.h> 44#include <linux/pci.h>
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
45 46
46#include "ipath_common.h"
47#include "ipath_kernel.h" 47#include "ipath_kernel.h"
48#include "ips_common.h"
49#include "ipath_layer.h" 48#include "ipath_layer.h"
49#include "ipath_common.h"
50 50
51int ipath_diag_inuse; 51int ipath_diag_inuse;
52static int diag_set_link; 52static int diag_set_link;
@@ -66,18 +66,20 @@ static struct file_operations diag_file_ops = {
66 .release = ipath_diag_release 66 .release = ipath_diag_release
67}; 67};
68 68
69static struct cdev *diag_cdev; 69int ipath_diag_add(struct ipath_devdata *dd)
70static struct class_device *diag_class_dev;
71
72int ipath_diag_init(void)
73{ 70{
74 return ipath_cdev_init(IPATH_DIAG_MINOR, "ipath_diag", 71 char name[16];
75 &diag_file_ops, &diag_cdev, &diag_class_dev); 72
73 snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit);
74
75 return ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name,
76 &diag_file_ops, &dd->diag_cdev,
77 &dd->diag_class_dev);
76} 78}
77 79
78void ipath_diag_cleanup(void) 80void ipath_diag_remove(struct ipath_devdata *dd)
79{ 81{
80 ipath_cdev_cleanup(&diag_cdev, &diag_class_dev); 82 ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev);
81} 83}
82 84
83/** 85/**
@@ -101,8 +103,7 @@ static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr,
101 int ret; 103 int ret;
102 104
103 /* not very efficient, but it works for now */ 105 /* not very efficient, but it works for now */
104 if (reg_addr < dd->ipath_kregbase || 106 if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) {
105 reg_end > dd->ipath_kregend) {
106 ret = -EINVAL; 107 ret = -EINVAL;
107 goto bail; 108 goto bail;
108 } 109 }
@@ -113,7 +114,7 @@ static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr,
113 goto bail; 114 goto bail;
114 } 115 }
115 reg_addr++; 116 reg_addr++;
116 uaddr++; 117 uaddr += sizeof(u64);
117 } 118 }
118 ret = 0; 119 ret = 0;
119bail: 120bail:
@@ -139,8 +140,7 @@ static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr,
139 int ret; 140 int ret;
140 141
141 /* not very efficient, but it works for now */ 142 /* not very efficient, but it works for now */
142 if (reg_addr < dd->ipath_kregbase || 143 if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) {
143 reg_end > dd->ipath_kregend) {
144 ret = -EINVAL; 144 ret = -EINVAL;
145 goto bail; 145 goto bail;
146 } 146 }
@@ -153,7 +153,7 @@ static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr,
153 writeq(data, reg_addr); 153 writeq(data, reg_addr);
154 154
155 reg_addr++; 155 reg_addr++;
156 uaddr++; 156 uaddr += sizeof(u64);
157 } 157 }
158 ret = 0; 158 ret = 0;
159bail: 159bail:
@@ -191,7 +191,8 @@ static int ipath_read_umem32(struct ipath_devdata *dd, void __user *uaddr,
191 } 191 }
192 192
193 reg_addr++; 193 reg_addr++;
194 uaddr++; 194 uaddr += sizeof(u32);
195
195 } 196 }
196 ret = 0; 197 ret = 0;
197bail: 198bail:
@@ -230,7 +231,7 @@ static int ipath_write_umem32(struct ipath_devdata *dd, void __iomem *caddr,
230 writel(data, reg_addr); 231 writel(data, reg_addr);
231 232
232 reg_addr++; 233 reg_addr++;
233 uaddr++; 234 uaddr += sizeof(u32);
234 } 235 }
235 ret = 0; 236 ret = 0;
236bail: 237bail:
@@ -239,59 +240,45 @@ bail:
239 240
240static int ipath_diag_open(struct inode *in, struct file *fp) 241static int ipath_diag_open(struct inode *in, struct file *fp)
241{ 242{
243 int unit = iminor(in) - IPATH_DIAG_MINOR_BASE;
242 struct ipath_devdata *dd; 244 struct ipath_devdata *dd;
243 int unit = 0; /* XXX this is bogus */
244 unsigned long flags;
245 int ret; 245 int ret;
246 246
247 dd = ipath_lookup(unit);
248
249 mutex_lock(&ipath_mutex); 247 mutex_lock(&ipath_mutex);
250 spin_lock_irqsave(&ipath_devs_lock, flags);
251 248
252 if (ipath_diag_inuse) { 249 if (ipath_diag_inuse) {
253 ret = -EBUSY; 250 ret = -EBUSY;
254 goto bail; 251 goto bail;
255 } 252 }
256 253
257 list_for_each_entry(dd, &ipath_dev_list, ipath_list) { 254 dd = ipath_lookup(unit);
258 /* 255
259 * we need at least one infinipath device to be present 256 if (dd == NULL || !(dd->ipath_flags & IPATH_PRESENT) ||
260 * (don't use INITTED, because we want to be able to open 257 !dd->ipath_kregbase) {
261 * even if device is in freeze mode, which cleared INITTED). 258 ret = -ENODEV;
262 * There is a small amount of risk to this, which is why we
263 * also verify kregbase is set.
264 */
265
266 if (!(dd->ipath_flags & IPATH_PRESENT) ||
267 !dd->ipath_kregbase)
268 continue;
269
270 ipath_diag_inuse = 1;
271 diag_set_link = 0;
272 ret = 0;
273 goto bail; 259 goto bail;
274 } 260 }
275 261
276 ret = -ENODEV; 262 fp->private_data = dd;
277 263 ipath_diag_inuse = 1;
278bail: 264 diag_set_link = 0;
279 spin_unlock_irqrestore(&ipath_devs_lock, flags); 265 ret = 0;
280 266
281 /* Only expose a way to reset the device if we 267 /* Only expose a way to reset the device if we
282 make it into diag mode. */ 268 make it into diag mode. */
283 if (ret == 0) 269 ipath_expose_reset(&dd->pcidev->dev);
284 ipath_expose_reset(&dd->pcidev->dev);
285 270
271bail:
286 mutex_unlock(&ipath_mutex); 272 mutex_unlock(&ipath_mutex);
287 273
288 return ret; 274 return ret;
289} 275}
290 276
291static int ipath_diag_release(struct inode *i, struct file *f) 277static int ipath_diag_release(struct inode *in, struct file *fp)
292{ 278{
293 mutex_lock(&ipath_mutex); 279 mutex_lock(&ipath_mutex);
294 ipath_diag_inuse = 0; 280 ipath_diag_inuse = 0;
281 fp->private_data = NULL;
295 mutex_unlock(&ipath_mutex); 282 mutex_unlock(&ipath_mutex);
296 return 0; 283 return 0;
297} 284}
@@ -299,17 +286,10 @@ static int ipath_diag_release(struct inode *i, struct file *f)
299static ssize_t ipath_diag_read(struct file *fp, char __user *data, 286static ssize_t ipath_diag_read(struct file *fp, char __user *data,
300 size_t count, loff_t *off) 287 size_t count, loff_t *off)
301{ 288{
302 int unit = 0; /* XXX provide for reads on other units some day */ 289 struct ipath_devdata *dd = fp->private_data;
303 struct ipath_devdata *dd;
304 void __iomem *kreg_base; 290 void __iomem *kreg_base;
305 ssize_t ret; 291 ssize_t ret;
306 292
307 dd = ipath_lookup(unit);
308 if (!dd) {
309 ret = -ENODEV;
310 goto bail;
311 }
312
313 kreg_base = dd->ipath_kregbase; 293 kreg_base = dd->ipath_kregbase;
314 294
315 if (count == 0) 295 if (count == 0)
@@ -328,23 +308,16 @@ static ssize_t ipath_diag_read(struct file *fp, char __user *data,
328 ret = count; 308 ret = count;
329 } 309 }
330 310
331bail:
332 return ret; 311 return ret;
333} 312}
334 313
335static ssize_t ipath_diag_write(struct file *fp, const char __user *data, 314static ssize_t ipath_diag_write(struct file *fp, const char __user *data,
336 size_t count, loff_t *off) 315 size_t count, loff_t *off)
337{ 316{
338 int unit = 0; /* XXX this is bogus */ 317 struct ipath_devdata *dd = fp->private_data;
339 struct ipath_devdata *dd;
340 void __iomem *kreg_base; 318 void __iomem *kreg_base;
341 ssize_t ret; 319 ssize_t ret;
342 320
343 dd = ipath_lookup(unit);
344 if (!dd) {
345 ret = -ENODEV;
346 goto bail;
347 }
348 kreg_base = dd->ipath_kregbase; 321 kreg_base = dd->ipath_kregbase;
349 322
350 if (count == 0) 323 if (count == 0)
@@ -363,6 +336,5 @@ static ssize_t ipath_diag_write(struct file *fp, const char __user *data,
363 ret = count; 336 ret = count;
364 } 337 }
365 338
366bail:
367 return ret; 339 return ret;
368} 340}
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index e4b897fa569a..823131d58b34 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -38,8 +39,8 @@
38#include <linux/vmalloc.h> 39#include <linux/vmalloc.h>
39 40
40#include "ipath_kernel.h" 41#include "ipath_kernel.h"
41#include "ips_common.h"
42#include "ipath_layer.h" 42#include "ipath_layer.h"
43#include "ipath_common.h"
43 44
44static void ipath_update_pio_bufs(struct ipath_devdata *); 45static void ipath_update_pio_bufs(struct ipath_devdata *);
45 46
@@ -52,7 +53,7 @@ const char *ipath_get_unit_name(int unit)
52 53
53EXPORT_SYMBOL_GPL(ipath_get_unit_name); 54EXPORT_SYMBOL_GPL(ipath_get_unit_name);
54 55
55#define DRIVER_LOAD_MSG "PathScale " IPATH_DRV_NAME " loaded: " 56#define DRIVER_LOAD_MSG "QLogic " IPATH_DRV_NAME " loaded: "
56#define PFX IPATH_DRV_NAME ": " 57#define PFX IPATH_DRV_NAME ": "
57 58
58/* 59/*
@@ -74,8 +75,8 @@ MODULE_PARM_DESC(debug, "mask for debug prints");
74EXPORT_SYMBOL_GPL(ipath_debug); 75EXPORT_SYMBOL_GPL(ipath_debug);
75 76
76MODULE_LICENSE("GPL"); 77MODULE_LICENSE("GPL");
77MODULE_AUTHOR("PathScale <support@pathscale.com>"); 78MODULE_AUTHOR("QLogic <support@pathscale.com>");
78MODULE_DESCRIPTION("Pathscale InfiniPath driver"); 79MODULE_DESCRIPTION("QLogic InfiniPath driver");
79 80
80const char *ipath_ibcstatus_str[] = { 81const char *ipath_ibcstatus_str[] = {
81 "Disabled", 82 "Disabled",
@@ -130,14 +131,6 @@ static struct pci_driver ipath_driver = {
130 .id_table = ipath_pci_tbl, 131 .id_table = ipath_pci_tbl,
131}; 132};
132 133
133/*
134 * This is where port 0's rcvhdrtail register is written back; we also
135 * want nothing else sharing the cache line, so make it a cache line
136 * in size. Used for all units.
137 */
138volatile __le64 *ipath_port0_rcvhdrtail;
139dma_addr_t ipath_port0_rcvhdrtail_dma;
140static int port0_rcvhdrtail_refs;
141 134
142static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev, 135static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev,
143 u32 *bar0, u32 *bar1) 136 u32 *bar0, u32 *bar1)
@@ -170,14 +163,13 @@ static void ipath_free_devdata(struct pci_dev *pdev,
170 list_del(&dd->ipath_list); 163 list_del(&dd->ipath_list);
171 spin_unlock_irqrestore(&ipath_devs_lock, flags); 164 spin_unlock_irqrestore(&ipath_devs_lock, flags);
172 } 165 }
173 dma_free_coherent(&pdev->dev, sizeof(*dd), dd, dd->ipath_dma_addr); 166 vfree(dd);
174} 167}
175 168
176static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) 169static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
177{ 170{
178 unsigned long flags; 171 unsigned long flags;
179 struct ipath_devdata *dd; 172 struct ipath_devdata *dd;
180 dma_addr_t dma_addr;
181 int ret; 173 int ret;
182 174
183 if (!idr_pre_get(&unit_table, GFP_KERNEL)) { 175 if (!idr_pre_get(&unit_table, GFP_KERNEL)) {
@@ -185,15 +177,12 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
185 goto bail; 177 goto bail;
186 } 178 }
187 179
188 dd = dma_alloc_coherent(&pdev->dev, sizeof(*dd), &dma_addr, 180 dd = vmalloc(sizeof(*dd));
189 GFP_KERNEL);
190
191 if (!dd) { 181 if (!dd) {
192 dd = ERR_PTR(-ENOMEM); 182 dd = ERR_PTR(-ENOMEM);
193 goto bail; 183 goto bail;
194 } 184 }
195 185 memset(dd, 0, sizeof(*dd));
196 dd->ipath_dma_addr = dma_addr;
197 dd->ipath_unit = -1; 186 dd->ipath_unit = -1;
198 187
199 spin_lock_irqsave(&ipath_devs_lock, flags); 188 spin_lock_irqsave(&ipath_devs_lock, flags);
@@ -271,47 +260,6 @@ int ipath_count_units(int *npresentp, int *nupp, u32 *maxportsp)
271 return nunits; 260 return nunits;
272} 261}
273 262
274static int init_port0_rcvhdrtail(struct pci_dev *pdev)
275{
276 int ret;
277
278 mutex_lock(&ipath_mutex);
279
280 if (!ipath_port0_rcvhdrtail) {
281 ipath_port0_rcvhdrtail =
282 dma_alloc_coherent(&pdev->dev,
283 IPATH_PORT0_RCVHDRTAIL_SIZE,
284 &ipath_port0_rcvhdrtail_dma,
285 GFP_KERNEL);
286
287 if (!ipath_port0_rcvhdrtail) {
288 ret = -ENOMEM;
289 goto bail;
290 }
291 }
292 port0_rcvhdrtail_refs++;
293 ret = 0;
294
295bail:
296 mutex_unlock(&ipath_mutex);
297
298 return ret;
299}
300
301static void cleanup_port0_rcvhdrtail(struct pci_dev *pdev)
302{
303 mutex_lock(&ipath_mutex);
304
305 if (!--port0_rcvhdrtail_refs) {
306 dma_free_coherent(&pdev->dev, IPATH_PORT0_RCVHDRTAIL_SIZE,
307 (void *) ipath_port0_rcvhdrtail,
308 ipath_port0_rcvhdrtail_dma);
309 ipath_port0_rcvhdrtail = NULL;
310 }
311
312 mutex_unlock(&ipath_mutex);
313}
314
315/* 263/*
316 * These next two routines are placeholders in case we don't have per-arch 264 * These next two routines are placeholders in case we don't have per-arch
317 * code for controlling write combining. If explicit control of write 265 * code for controlling write combining. If explicit control of write
@@ -336,20 +284,12 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
336 u32 bar0 = 0, bar1 = 0; 284 u32 bar0 = 0, bar1 = 0;
337 u8 rev; 285 u8 rev;
338 286
339 ret = init_port0_rcvhdrtail(pdev);
340 if (ret < 0) {
341 printk(KERN_ERR IPATH_DRV_NAME
342 ": Could not allocate port0_rcvhdrtail: error %d\n",
343 -ret);
344 goto bail;
345 }
346
347 dd = ipath_alloc_devdata(pdev); 287 dd = ipath_alloc_devdata(pdev);
348 if (IS_ERR(dd)) { 288 if (IS_ERR(dd)) {
349 ret = PTR_ERR(dd); 289 ret = PTR_ERR(dd);
350 printk(KERN_ERR IPATH_DRV_NAME 290 printk(KERN_ERR IPATH_DRV_NAME
351 ": Could not allocate devdata: error %d\n", -ret); 291 ": Could not allocate devdata: error %d\n", -ret);
352 goto bail_rcvhdrtail; 292 goto bail;
353 } 293 }
354 294
355 ipath_cdbg(VERBOSE, "initializing unit #%u\n", dd->ipath_unit); 295 ipath_cdbg(VERBOSE, "initializing unit #%u\n", dd->ipath_unit);
@@ -424,12 +364,29 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
424 */ 364 */
425 ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 365 ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
426 if (ret) { 366 if (ret) {
427 dev_info(&pdev->dev, "pci_set_dma_mask unit %u " 367 dev_info(&pdev->dev,
428 "fails: %d\n", dd->ipath_unit, ret); 368 "Unable to set DMA mask for unit %u: %d\n",
369 dd->ipath_unit, ret);
429 goto bail_regions; 370 goto bail_regions;
430 } 371 }
431 else 372 else {
432 ipath_dbg("No 64bit DMA mask, used 32 bit mask\n"); 373 ipath_dbg("No 64bit DMA mask, used 32 bit mask\n");
374 ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
375 if (ret)
376 dev_info(&pdev->dev,
377 "Unable to set DMA consistent mask "
378 "for unit %u: %d\n",
379 dd->ipath_unit, ret);
380
381 }
382 }
383 else {
384 ret = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
385 if (ret)
386 dev_info(&pdev->dev,
387 "Unable to set DMA consistent mask "
388 "for unit %u: %d\n",
389 dd->ipath_unit, ret);
433 } 390 }
434 391
435 pci_set_master(pdev); 392 pci_set_master(pdev);
@@ -452,7 +409,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
452 ipath_init_pe800_funcs(dd); 409 ipath_init_pe800_funcs(dd);
453 break; 410 break;
454 default: 411 default:
455 ipath_dev_err(dd, "Found unknown PathScale deviceid 0x%x, " 412 ipath_dev_err(dd, "Found unknown QLogic deviceid 0x%x, "
456 "failing\n", ent->device); 413 "failing\n", ent->device);
457 return -ENODEV; 414 return -ENODEV;
458 } 415 }
@@ -495,23 +452,23 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
495 ((void __iomem *)dd->ipath_kregbase + len); 452 ((void __iomem *)dd->ipath_kregbase + len);
496 dd->ipath_physaddr = addr; /* used for io_remap, etc. */ 453 dd->ipath_physaddr = addr; /* used for io_remap, etc. */
497 /* for user mmap */ 454 /* for user mmap */
498 dd->ipath_kregvirt = (u64 __iomem *) phys_to_virt(addr); 455 ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p\n",
499 ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p " 456 addr, dd->ipath_kregbase);
500 "kregvirt %p\n", addr, dd->ipath_kregbase,
501 dd->ipath_kregvirt);
502 457
503 /* 458 /*
504 * clear ipath_flags here instead of in ipath_init_chip as it is set 459 * clear ipath_flags here instead of in ipath_init_chip as it is set
505 * by ipath_setup_htconfig. 460 * by ipath_setup_htconfig.
506 */ 461 */
507 dd->ipath_flags = 0; 462 dd->ipath_flags = 0;
463 dd->ipath_lli_counter = 0;
464 dd->ipath_lli_errors = 0;
508 465
509 if (dd->ipath_f_bus(dd, pdev)) 466 if (dd->ipath_f_bus(dd, pdev))
510 ipath_dev_err(dd, "Failed to setup config space; " 467 ipath_dev_err(dd, "Failed to setup config space; "
511 "continuing anyway\n"); 468 "continuing anyway\n");
512 469
513 /* 470 /*
514 * set up our interrupt handler; SA_SHIRQ probably not needed, 471 * set up our interrupt handler; IRQF_SHARED probably not needed,
515 * since MSI interrupts shouldn't be shared but won't hurt for now. 472 * since MSI interrupts shouldn't be shared but won't hurt for now.
516 * check 0 irq after we return from chip-specific bus setup, since 473 * check 0 irq after we return from chip-specific bus setup, since
517 * that can affect this due to setup 474 * that can affect this due to setup
@@ -520,7 +477,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
520 ipath_dev_err(dd, "irq is 0, BIOS error? Interrupts won't " 477 ipath_dev_err(dd, "irq is 0, BIOS error? Interrupts won't "
521 "work\n"); 478 "work\n");
522 else { 479 else {
523 ret = request_irq(pdev->irq, ipath_intr, SA_SHIRQ, 480 ret = request_irq(pdev->irq, ipath_intr, IRQF_SHARED,
524 IPATH_DRV_NAME, dd); 481 IPATH_DRV_NAME, dd);
525 if (ret) { 482 if (ret) {
526 ipath_dev_err(dd, "Couldn't setup irq handler, " 483 ipath_dev_err(dd, "Couldn't setup irq handler, "
@@ -545,6 +502,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
545 ipath_device_create_group(&pdev->dev, dd); 502 ipath_device_create_group(&pdev->dev, dd);
546 ipathfs_add_device(dd); 503 ipathfs_add_device(dd);
547 ipath_user_add(dd); 504 ipath_user_add(dd);
505 ipath_diag_add(dd);
548 ipath_layer_add(dd); 506 ipath_layer_add(dd);
549 507
550 goto bail; 508 goto bail;
@@ -561,9 +519,6 @@ bail_disable:
561bail_devdata: 519bail_devdata:
562 ipath_free_devdata(pdev, dd); 520 ipath_free_devdata(pdev, dd);
563 521
564bail_rcvhdrtail:
565 cleanup_port0_rcvhdrtail(pdev);
566
567bail: 522bail:
568 return ret; 523 return ret;
569} 524}
@@ -577,8 +532,9 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev)
577 return; 532 return;
578 533
579 dd = pci_get_drvdata(pdev); 534 dd = pci_get_drvdata(pdev);
580 ipath_layer_del(dd); 535 ipath_layer_remove(dd);
581 ipath_user_del(dd); 536 ipath_diag_remove(dd);
537 ipath_user_remove(dd);
582 ipathfs_remove_device(dd); 538 ipathfs_remove_device(dd);
583 ipath_device_remove_group(&pdev->dev, dd); 539 ipath_device_remove_group(&pdev->dev, dd);
584 ipath_cdbg(VERBOSE, "Releasing pci memory regions, dd %p, " 540 ipath_cdbg(VERBOSE, "Releasing pci memory regions, dd %p, "
@@ -594,7 +550,6 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev)
594 pci_disable_device(pdev); 550 pci_disable_device(pdev);
595 551
596 ipath_free_devdata(pdev, dd); 552 ipath_free_devdata(pdev, dd);
597 cleanup_port0_rcvhdrtail(pdev);
598} 553}
599 554
600/* general driver use */ 555/* general driver use */
@@ -868,7 +823,8 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
868 u8 pad, *bthbytes; 823 u8 pad, *bthbytes;
869 struct sk_buff *skb, *nskb; 824 struct sk_buff *skb, *nskb;
870 825
871 if (dd->ipath_port0_skbs && hdr->sub_opcode == OPCODE_ENCAP) { 826 if (dd->ipath_port0_skbs &&
827 hdr->sub_opcode == IPATH_ITH4X_OPCODE_ENCAP) {
872 /* 828 /*
873 * Allocate a new sk_buff to replace the one we give 829 * Allocate a new sk_buff to replace the one we give
874 * to the network stack. 830 * to the network stack.
@@ -899,7 +855,7 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
899 /* another ether packet received */ 855 /* another ether packet received */
900 ipath_stats.sps_ether_rpkts++; 856 ipath_stats.sps_ether_rpkts++;
901 } 857 }
902 else if (hdr->sub_opcode == OPCODE_LID_ARP) 858 else if (hdr->sub_opcode == IPATH_ITH4X_OPCODE_LID_ARP)
903 __ipath_layer_rcv_lid(dd, hdr); 859 __ipath_layer_rcv_lid(dd, hdr);
904} 860}
905 861
@@ -916,8 +872,8 @@ void ipath_kreceive(struct ipath_devdata *dd)
916 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */ 872 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */
917 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */ 873 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */
918 u32 etail = -1, l, hdrqtail; 874 u32 etail = -1, l, hdrqtail;
919 struct ips_message_header *hdr; 875 struct ipath_message_header *hdr;
920 u32 eflags, i, etype, tlen, pkttot = 0; 876 u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0;
921 static u64 totcalls; /* stats, may eventually remove */ 877 static u64 totcalls; /* stats, may eventually remove */
922 char emsg[128]; 878 char emsg[128];
923 879
@@ -931,24 +887,18 @@ void ipath_kreceive(struct ipath_devdata *dd)
931 if (test_and_set_bit(0, &dd->ipath_rcv_pending)) 887 if (test_and_set_bit(0, &dd->ipath_rcv_pending))
932 goto bail; 888 goto bail;
933 889
934 if (dd->ipath_port0head == 890 l = dd->ipath_port0head;
935 (u32)le64_to_cpu(*dd->ipath_hdrqtailptr)) 891 hdrqtail = (u32) le64_to_cpu(*dd->ipath_hdrqtailptr);
892 if (l == hdrqtail)
936 goto done; 893 goto done;
937 894
938gotmore: 895reloop:
939 /* 896 for (i = 0; l != hdrqtail; i++) {
940 * read only once at start. If in flood situation, this helps
941 * performance slightly. If more arrive while we are processing,
942 * we'll come back here and do them
943 */
944 hdrqtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
945
946 for (i = 0, l = dd->ipath_port0head; l != hdrqtail; i++) {
947 u32 qp; 897 u32 qp;
948 u8 *bthbytes; 898 u8 *bthbytes;
949 899
950 rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2)); 900 rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2));
951 hdr = (struct ips_message_header *)&rc[1]; 901 hdr = (struct ipath_message_header *)&rc[1];
952 /* 902 /*
953 * could make a network order version of IPATH_KD_QP, and 903 * could make a network order version of IPATH_KD_QP, and
954 * do the obvious shift before masking to speed this up. 904 * do the obvious shift before masking to speed this up.
@@ -956,10 +906,10 @@ gotmore:
956 qp = ntohl(hdr->bth[1]) & 0xffffff; 906 qp = ntohl(hdr->bth[1]) & 0xffffff;
957 bthbytes = (u8 *) hdr->bth; 907 bthbytes = (u8 *) hdr->bth;
958 908
959 eflags = ips_get_hdr_err_flags((__le32 *) rc); 909 eflags = ipath_hdrget_err_flags((__le32 *) rc);
960 etype = ips_get_rcv_type((__le32 *) rc); 910 etype = ipath_hdrget_rcv_type((__le32 *) rc);
961 /* total length */ 911 /* total length */
962 tlen = ips_get_length_in_bytes((__le32 *) rc); 912 tlen = ipath_hdrget_length_in_bytes((__le32 *) rc);
963 ebuf = NULL; 913 ebuf = NULL;
964 if (etype != RCVHQ_RCV_TYPE_EXPECTED) { 914 if (etype != RCVHQ_RCV_TYPE_EXPECTED) {
965 /* 915 /*
@@ -969,7 +919,7 @@ gotmore:
969 * set ebuf (so we try to copy data) unless the 919 * set ebuf (so we try to copy data) unless the
970 * length requires it. 920 * length requires it.
971 */ 921 */
972 etail = ips_get_index((__le32 *) rc); 922 etail = ipath_hdrget_index((__le32 *) rc);
973 if (tlen > sizeof(*hdr) || 923 if (tlen > sizeof(*hdr) ||
974 etype == RCVHQ_RCV_TYPE_NON_KD) 924 etype == RCVHQ_RCV_TYPE_NON_KD)
975 ebuf = ipath_get_egrbuf(dd, etail, 0); 925 ebuf = ipath_get_egrbuf(dd, etail, 0);
@@ -981,7 +931,7 @@ gotmore:
981 */ 931 */
982 932
983 if (etype != RCVHQ_RCV_TYPE_NON_KD && etype != 933 if (etype != RCVHQ_RCV_TYPE_NON_KD && etype !=
984 RCVHQ_RCV_TYPE_ERROR && ips_get_ipath_ver( 934 RCVHQ_RCV_TYPE_ERROR && ipath_hdrget_ipath_ver(
985 hdr->iph.ver_port_tid_offset) != 935 hdr->iph.ver_port_tid_offset) !=
986 IPS_PROTO_VERSION) { 936 IPS_PROTO_VERSION) {
987 ipath_cdbg(PKT, "Bad InfiniPath protocol version " 937 ipath_cdbg(PKT, "Bad InfiniPath protocol version "
@@ -994,7 +944,19 @@ gotmore:
994 ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u " 944 ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u "
995 "tlen=%x opcode=%x egridx=%x: %s\n", 945 "tlen=%x opcode=%x egridx=%x: %s\n",
996 eflags, l, etype, tlen, bthbytes[0], 946 eflags, l, etype, tlen, bthbytes[0],
997 ips_get_index((__le32 *) rc), emsg); 947 ipath_hdrget_index((__le32 *) rc), emsg);
948 /* Count local link integrity errors. */
949 if (eflags & (INFINIPATH_RHF_H_ICRCERR |
950 INFINIPATH_RHF_H_VCRCERR)) {
951 u8 n = (dd->ipath_ibcctrl >>
952 INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT) &
953 INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK;
954
955 if (++dd->ipath_lli_counter > n) {
956 dd->ipath_lli_counter = 0;
957 dd->ipath_lli_errors++;
958 }
959 }
998 } else if (etype == RCVHQ_RCV_TYPE_NON_KD) { 960 } else if (etype == RCVHQ_RCV_TYPE_NON_KD) {
999 int ret = __ipath_verbs_rcv(dd, rc + 1, 961 int ret = __ipath_verbs_rcv(dd, rc + 1,
1000 ebuf, tlen); 962 ebuf, tlen);
@@ -1002,6 +964,9 @@ gotmore:
1002 ipath_cdbg(VERBOSE, 964 ipath_cdbg(VERBOSE,
1003 "received IB packet, " 965 "received IB packet, "
1004 "not SMA (QP=%x)\n", qp); 966 "not SMA (QP=%x)\n", qp);
967 if (dd->ipath_lli_counter)
968 dd->ipath_lli_counter--;
969
1005 } else if (etype == RCVHQ_RCV_TYPE_EAGER) { 970 } else if (etype == RCVHQ_RCV_TYPE_EAGER) {
1006 if (qp == IPATH_KD_QP && 971 if (qp == IPATH_KD_QP &&
1007 bthbytes[0] == ipath_layer_rcv_opcode && 972 bthbytes[0] == ipath_layer_rcv_opcode &&
@@ -1054,25 +1019,49 @@ gotmore:
1054 l += rsize; 1019 l += rsize;
1055 if (l >= maxcnt) 1020 if (l >= maxcnt)
1056 l = 0; 1021 l = 0;
1022 if (etype != RCVHQ_RCV_TYPE_EXPECTED)
1023 updegr = 1;
1057 /* 1024 /*
1058 * update for each packet, to help prevent overflows if we 1025 * update head regs on last packet, and every 16 packets.
1059 * have lots of packets. 1026 * Reduce bus traffic, while still trying to prevent
1027 * rcvhdrq overflows, for when the queue is nearly full
1060 */ 1028 */
1061 (void)ipath_write_ureg(dd, ur_rcvhdrhead, 1029 if (l == hdrqtail || (i && !(i&0xf))) {
1062 dd->ipath_rhdrhead_intr_off | l, 0); 1030 u64 lval;
1063 if (etype != RCVHQ_RCV_TYPE_EXPECTED) 1031 if (l == hdrqtail) /* PE-800 interrupt only on last */
1064 (void)ipath_write_ureg(dd, ur_rcvegrindexhead, 1032 lval = dd->ipath_rhdrhead_intr_off | l;
1065 etail, 0); 1033 else
1034 lval = l;
1035 (void)ipath_write_ureg(dd, ur_rcvhdrhead, lval, 0);
1036 if (updegr) {
1037 (void)ipath_write_ureg(dd, ur_rcvegrindexhead,
1038 etail, 0);
1039 updegr = 0;
1040 }
1041 }
1042 }
1043
1044 if (!dd->ipath_rhdrhead_intr_off && !reloop) {
1045 /* HT-400 workaround; we can have a race clearing chip
1046 * interrupt with another interrupt about to be delivered,
1047 * and can clear it before it is delivered on the GPIO
1048 * workaround. By doing the extra check here for the
1049 * in-memory tail register updating while we were doing
1050 * earlier packets, we "almost" guarantee we have covered
1051 * that case.
1052 */
1053 u32 hqtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
1054 if (hqtail != hdrqtail) {
1055 hdrqtail = hqtail;
1056 reloop = 1; /* loop 1 extra time at most */
1057 goto reloop;
1058 }
1066 } 1059 }
1067 1060
1068 pkttot += i; 1061 pkttot += i;
1069 1062
1070 dd->ipath_port0head = l; 1063 dd->ipath_port0head = l;
1071 1064
1072 if (hdrqtail != (u32)le64_to_cpu(*dd->ipath_hdrqtailptr))
1073 /* more arrived while we handled first batch */
1074 goto gotmore;
1075
1076 if (pkttot > ipath_stats.sps_maxpkts_call) 1065 if (pkttot > ipath_stats.sps_maxpkts_call)
1077 ipath_stats.sps_maxpkts_call = pkttot; 1066 ipath_stats.sps_maxpkts_call = pkttot;
1078 ipath_stats.sps_port0pkts += pkttot; 1067 ipath_stats.sps_port0pkts += pkttot;
@@ -1369,26 +1358,20 @@ bail:
1369 * @dd: the infinipath device 1358 * @dd: the infinipath device
1370 * @pd: the port data 1359 * @pd: the port data
1371 * 1360 *
1372 * this *must* be physically contiguous memory, and for now, 1361 * this must be contiguous memory (from an i/o perspective), and must be
1373 * that limits it to what kmalloc can do. 1362 * DMA'able (which means for some systems, it will go through an IOMMU,
1363 * or be forced into a low address range).
1374 */ 1364 */
1375int ipath_create_rcvhdrq(struct ipath_devdata *dd, 1365int ipath_create_rcvhdrq(struct ipath_devdata *dd,
1376 struct ipath_portdata *pd) 1366 struct ipath_portdata *pd)
1377{ 1367{
1378 int ret = 0, amt; 1368 int ret = 0;
1379 1369
1380 amt = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *
1381 sizeof(u32), PAGE_SIZE);
1382 if (!pd->port_rcvhdrq) { 1370 if (!pd->port_rcvhdrq) {
1383 /* 1371 dma_addr_t phys_hdrqtail;
1384 * not using REPEAT isn't viable; at 128KB, we can easily
1385 * fail this. The problem with REPEAT is we can block here
1386 * "forever". There isn't an inbetween, unfortunately. We
1387 * could reduce the risk by never freeing the rcvhdrq except
1388 * at unload, but even then, the first time a port is used,
1389 * we could delay for some time...
1390 */
1391 gfp_t gfp_flags = GFP_USER | __GFP_COMP; 1372 gfp_t gfp_flags = GFP_USER | __GFP_COMP;
1373 int amt = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *
1374 sizeof(u32), PAGE_SIZE);
1392 1375
1393 pd->port_rcvhdrq = dma_alloc_coherent( 1376 pd->port_rcvhdrq = dma_alloc_coherent(
1394 &dd->pcidev->dev, amt, &pd->port_rcvhdrq_phys, 1377 &dd->pcidev->dev, amt, &pd->port_rcvhdrq_phys,
@@ -1401,6 +1384,16 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd,
1401 ret = -ENOMEM; 1384 ret = -ENOMEM;
1402 goto bail; 1385 goto bail;
1403 } 1386 }
1387 pd->port_rcvhdrtail_kvaddr = dma_alloc_coherent(
1388 &dd->pcidev->dev, PAGE_SIZE, &phys_hdrqtail, GFP_KERNEL);
1389 if (!pd->port_rcvhdrtail_kvaddr) {
1390 ipath_dev_err(dd, "attempt to allocate 1 page "
1391 "for port %u rcvhdrqtailaddr failed\n",
1392 pd->port_port);
1393 ret = -ENOMEM;
1394 goto bail;
1395 }
1396 pd->port_rcvhdrqtailaddr_phys = phys_hdrqtail;
1404 1397
1405 pd->port_rcvhdrq_size = amt; 1398 pd->port_rcvhdrq_size = amt;
1406 1399
@@ -1410,20 +1403,28 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd,
1410 (unsigned long) pd->port_rcvhdrq_phys, 1403 (unsigned long) pd->port_rcvhdrq_phys,
1411 (unsigned long) pd->port_rcvhdrq_size, 1404 (unsigned long) pd->port_rcvhdrq_size,
1412 pd->port_port); 1405 pd->port_port);
1413 } else { 1406
1414 /* 1407 ipath_cdbg(VERBOSE, "port %d hdrtailaddr, %llx physical\n",
1415 * clear for security, sanity, and/or debugging, each 1408 pd->port_port,
1416 * time we reuse 1409 (unsigned long long) phys_hdrqtail);
1417 */
1418 memset(pd->port_rcvhdrq, 0, amt);
1419 } 1410 }
1411 else
1412 ipath_cdbg(VERBOSE, "reuse port %d rcvhdrq @%p %llx phys; "
1413 "hdrtailaddr@%p %llx physical\n",
1414 pd->port_port, pd->port_rcvhdrq,
1415 pd->port_rcvhdrq_phys, pd->port_rcvhdrtail_kvaddr,
1416 (unsigned long long)pd->port_rcvhdrqtailaddr_phys);
1417
1418 /* clear for security and sanity on each use */
1419 memset(pd->port_rcvhdrq, 0, pd->port_rcvhdrq_size);
1420 memset((void *)pd->port_rcvhdrtail_kvaddr, 0, PAGE_SIZE);
1420 1421
1421 /* 1422 /*
1422 * tell chip each time we init it, even if we are re-using previous 1423 * tell chip each time we init it, even if we are re-using previous
1423 * memory (we zero it at process close) 1424 * memory (we zero the register at process close)
1424 */ 1425 */
1425 ipath_cdbg(VERBOSE, "writing port %d rcvhdraddr as %lx\n", 1426 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr,
1426 pd->port_port, (unsigned long) pd->port_rcvhdrq_phys); 1427 pd->port_port, pd->port_rcvhdrqtailaddr_phys);
1427 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr, 1428 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr,
1428 pd->port_port, pd->port_rcvhdrq_phys); 1429 pd->port_port, pd->port_rcvhdrq_phys);
1429 1430
@@ -1511,15 +1512,27 @@ void ipath_set_ib_lstate(struct ipath_devdata *dd, int which)
1511 [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", 1512 [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED",
1512 [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" 1513 [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE"
1513 }; 1514 };
1515 int linkcmd = (which >> INFINIPATH_IBCC_LINKCMD_SHIFT) &
1516 INFINIPATH_IBCC_LINKCMD_MASK;
1517
1514 ipath_cdbg(SMA, "Trying to move unit %u to %s, current ltstate " 1518 ipath_cdbg(SMA, "Trying to move unit %u to %s, current ltstate "
1515 "is %s\n", dd->ipath_unit, 1519 "is %s\n", dd->ipath_unit,
1516 what[(which >> INFINIPATH_IBCC_LINKCMD_SHIFT) & 1520 what[linkcmd],
1517 INFINIPATH_IBCC_LINKCMD_MASK],
1518 ipath_ibcstatus_str[ 1521 ipath_ibcstatus_str[
1519 (ipath_read_kreg64 1522 (ipath_read_kreg64
1520 (dd, dd->ipath_kregs->kr_ibcstatus) >> 1523 (dd, dd->ipath_kregs->kr_ibcstatus) >>
1521 INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & 1524 INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) &
1522 INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); 1525 INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]);
1526 /* flush all queued sends when going to DOWN or INIT, to be sure that
1527 * they don't block SMA and other MAD packets */
1528 if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) {
1529 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
1530 INFINIPATH_S_ABORT);
1531 ipath_disarm_piobufs(dd, dd->ipath_lastport_piobuf,
1532 (unsigned)(dd->ipath_piobcnt2k +
1533 dd->ipath_piobcnt4k) -
1534 dd->ipath_lastport_piobuf);
1535 }
1523 1536
1524 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, 1537 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
1525 dd->ipath_ibcctrl | which); 1538 dd->ipath_ibcctrl | which);
@@ -1638,7 +1651,7 @@ void ipath_shutdown_device(struct ipath_devdata *dd)
1638 /* disable IBC */ 1651 /* disable IBC */
1639 dd->ipath_control &= ~INFINIPATH_C_LINKENABLE; 1652 dd->ipath_control &= ~INFINIPATH_C_LINKENABLE;
1640 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 1653 ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
1641 dd->ipath_control); 1654 dd->ipath_control | INFINIPATH_C_FREEZEMODE);
1642 1655
1643 /* 1656 /*
1644 * clear SerdesEnable and turn the leds off; do this here because 1657 * clear SerdesEnable and turn the leds off; do this here because
@@ -1667,60 +1680,54 @@ void ipath_shutdown_device(struct ipath_devdata *dd)
1667/** 1680/**
1668 * ipath_free_pddata - free a port's allocated data 1681 * ipath_free_pddata - free a port's allocated data
1669 * @dd: the infinipath device 1682 * @dd: the infinipath device
1670 * @port: the port 1683 * @pd: the portdata structure
1671 * @freehdrq: free the port data structure if true
1672 * 1684 *
1673 * when closing, free up any allocated data for a port, if the 1685 * free up any allocated data for a port
1674 * reference count goes to zero 1686 * This should not touch anything that would affect a simultaneous
1675 * Note: this also optionally frees the portdata itself! 1687 * re-allocation of port data, because it is called after ipath_mutex
1676 * Any changes here have to be matched up with the reinit case 1688 * is released (and can be called from reinit as well).
1677 * of ipath_init_chip(), which calls this routine on reinit after reset. 1689 * It should never change any chip state, or global driver state.
1690 * (The only exception to global state is freeing the port0 port0_skbs.)
1678 */ 1691 */
1679void ipath_free_pddata(struct ipath_devdata *dd, u32 port, int freehdrq) 1692void ipath_free_pddata(struct ipath_devdata *dd, struct ipath_portdata *pd)
1680{ 1693{
1681 struct ipath_portdata *pd = dd->ipath_pd[port];
1682
1683 if (!pd) 1694 if (!pd)
1684 return; 1695 return;
1685 if (freehdrq) 1696
1686 /* 1697 if (pd->port_rcvhdrq) {
1687 * only clear and free portdata if we are going to also
1688 * release the hdrq, otherwise we leak the hdrq on each
1689 * open/close cycle
1690 */
1691 dd->ipath_pd[port] = NULL;
1692 if (freehdrq && pd->port_rcvhdrq) {
1693 ipath_cdbg(VERBOSE, "free closed port %d rcvhdrq @ %p " 1698 ipath_cdbg(VERBOSE, "free closed port %d rcvhdrq @ %p "
1694 "(size=%lu)\n", pd->port_port, pd->port_rcvhdrq, 1699 "(size=%lu)\n", pd->port_port, pd->port_rcvhdrq,
1695 (unsigned long) pd->port_rcvhdrq_size); 1700 (unsigned long) pd->port_rcvhdrq_size);
1696 dma_free_coherent(&dd->pcidev->dev, pd->port_rcvhdrq_size, 1701 dma_free_coherent(&dd->pcidev->dev, pd->port_rcvhdrq_size,
1697 pd->port_rcvhdrq, pd->port_rcvhdrq_phys); 1702 pd->port_rcvhdrq, pd->port_rcvhdrq_phys);
1698 pd->port_rcvhdrq = NULL; 1703 pd->port_rcvhdrq = NULL;
1704 if (pd->port_rcvhdrtail_kvaddr) {
1705 dma_free_coherent(&dd->pcidev->dev, PAGE_SIZE,
1706 (void *)pd->port_rcvhdrtail_kvaddr,
1707 pd->port_rcvhdrqtailaddr_phys);
1708 pd->port_rcvhdrtail_kvaddr = NULL;
1709 }
1699 } 1710 }
1700 if (port && pd->port_rcvegrbuf) { 1711 if (pd->port_port && pd->port_rcvegrbuf) {
1701 /* always free this */ 1712 unsigned e;
1702 if (pd->port_rcvegrbuf) { 1713
1703 unsigned e; 1714 for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) {
1704 1715 void *base = pd->port_rcvegrbuf[e];
1705 for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { 1716 size_t size = pd->port_rcvegrbuf_size;
1706 void *base = pd->port_rcvegrbuf[e]; 1717
1707 size_t size = pd->port_rcvegrbuf_size; 1718 ipath_cdbg(VERBOSE, "egrbuf free(%p, %lu), "
1708 1719 "chunk %u/%u\n", base,
1709 ipath_cdbg(VERBOSE, "egrbuf free(%p, %lu), " 1720 (unsigned long) size,
1710 "chunk %u/%u\n", base, 1721 e, pd->port_rcvegrbuf_chunks);
1711 (unsigned long) size, 1722 dma_free_coherent(&dd->pcidev->dev, size,
1712 e, pd->port_rcvegrbuf_chunks); 1723 base, pd->port_rcvegrbuf_phys[e]);
1713 dma_free_coherent(
1714 &dd->pcidev->dev, size, base,
1715 pd->port_rcvegrbuf_phys[e]);
1716 }
1717 vfree(pd->port_rcvegrbuf);
1718 pd->port_rcvegrbuf = NULL;
1719 vfree(pd->port_rcvegrbuf_phys);
1720 pd->port_rcvegrbuf_phys = NULL;
1721 } 1724 }
1725 vfree(pd->port_rcvegrbuf);
1726 pd->port_rcvegrbuf = NULL;
1727 vfree(pd->port_rcvegrbuf_phys);
1728 pd->port_rcvegrbuf_phys = NULL;
1722 pd->port_rcvegrbuf_chunks = 0; 1729 pd->port_rcvegrbuf_chunks = 0;
1723 } else if (port == 0 && dd->ipath_port0_skbs) { 1730 } else if (pd->port_port == 0 && dd->ipath_port0_skbs) {
1724 unsigned e; 1731 unsigned e;
1725 struct sk_buff **skbs = dd->ipath_port0_skbs; 1732 struct sk_buff **skbs = dd->ipath_port0_skbs;
1726 1733
@@ -1732,10 +1739,8 @@ void ipath_free_pddata(struct ipath_devdata *dd, u32 port, int freehdrq)
1732 dev_kfree_skb(skbs[e]); 1739 dev_kfree_skb(skbs[e]);
1733 vfree(skbs); 1740 vfree(skbs);
1734 } 1741 }
1735 if (freehdrq) { 1742 kfree(pd->port_tid_pg_list);
1736 kfree(pd->port_tid_pg_list); 1743 kfree(pd);
1737 kfree(pd);
1738 }
1739} 1744}
1740 1745
1741static int __init infinipath_init(void) 1746static int __init infinipath_init(void)
@@ -1806,7 +1811,6 @@ static void cleanup_device(struct ipath_devdata *dd)
1806 * re-init 1811 * re-init
1807 */ 1812 */
1808 dd->ipath_kregbase = NULL; 1813 dd->ipath_kregbase = NULL;
1809 dd->ipath_kregvirt = NULL;
1810 dd->ipath_uregbase = 0; 1814 dd->ipath_uregbase = 0;
1811 dd->ipath_sregbase = 0; 1815 dd->ipath_sregbase = 0;
1812 dd->ipath_cregbase = 0; 1816 dd->ipath_cregbase = 0;
@@ -1821,6 +1825,12 @@ static void cleanup_device(struct ipath_devdata *dd)
1821 dd->ipath_pioavailregs_phys); 1825 dd->ipath_pioavailregs_phys);
1822 dd->ipath_pioavailregs_dma = NULL; 1826 dd->ipath_pioavailregs_dma = NULL;
1823 } 1827 }
1828 if (dd->ipath_dummy_hdrq) {
1829 dma_free_coherent(&dd->pcidev->dev,
1830 dd->ipath_pd[0]->port_rcvhdrq_size,
1831 dd->ipath_dummy_hdrq, dd->ipath_dummy_hdrq_phys);
1832 dd->ipath_dummy_hdrq = NULL;
1833 }
1824 1834
1825 if (dd->ipath_pageshadow) { 1835 if (dd->ipath_pageshadow) {
1826 struct page **tmpp = dd->ipath_pageshadow; 1836 struct page **tmpp = dd->ipath_pageshadow;
@@ -1861,10 +1871,14 @@ static void cleanup_device(struct ipath_devdata *dd)
1861 1871
1862 /* 1872 /*
1863 * free any resources still in use (usually just kernel ports) 1873 * free any resources still in use (usually just kernel ports)
1864 * at unload 1874 * at unload; we do for portcnt, not cfgports, because cfgports
1875 * could have changed while we were loaded.
1865 */ 1876 */
1866 for (port = 0; port < dd->ipath_cfgports; port++) 1877 for (port = 0; port < dd->ipath_portcnt; port++) {
1867 ipath_free_pddata(dd, port, 1); 1878 struct ipath_portdata *pd = dd->ipath_pd[port];
1879 dd->ipath_pd[port] = NULL;
1880 ipath_free_pddata(dd, pd);
1881 }
1868 kfree(dd->ipath_pd); 1882 kfree(dd->ipath_pd);
1869 /* 1883 /*
1870 * debuggability, in case some cleanup path tries to use it 1884 * debuggability, in case some cleanup path tries to use it
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c
index a2f1ceafcca9..3313356ab93a 100644
--- a/drivers/infiniband/hw/ipath/ipath_eeprom.c
+++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -600,8 +601,31 @@ void ipath_get_eeprom_info(struct ipath_devdata *dd)
600 guid = *(__be64 *) ifp->if_guid; 601 guid = *(__be64 *) ifp->if_guid;
601 dd->ipath_guid = guid; 602 dd->ipath_guid = guid;
602 dd->ipath_nguid = ifp->if_numguid; 603 dd->ipath_nguid = ifp->if_numguid;
603 memcpy(dd->ipath_serial, ifp->if_serial, 604 /*
604 sizeof(ifp->if_serial)); 605 * Things are slightly complicated by the desire to transparently
606 * support both the Pathscale 10-digit serial number and the QLogic
607 * 13-character version.
608 */
609 if ((ifp->if_fversion > 1) && ifp->if_sprefix[0]
610 && ((u8 *)ifp->if_sprefix)[0] != 0xFF) {
611 /* This board has a Serial-prefix, which is stored
612 * elsewhere for backward-compatibility.
613 */
614 char *snp = dd->ipath_serial;
615 int len;
616 memcpy(snp, ifp->if_sprefix, sizeof ifp->if_sprefix);
617 snp[sizeof ifp->if_sprefix] = '\0';
618 len = strlen(snp);
619 snp += len;
620 len = (sizeof dd->ipath_serial) - len;
621 if (len > sizeof ifp->if_serial) {
622 len = sizeof ifp->if_serial;
623 }
624 memcpy(snp, ifp->if_serial, len);
625 } else
626 memcpy(dd->ipath_serial, ifp->if_serial,
627 sizeof ifp->if_serial);
628
605 ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n", 629 ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n",
606 (unsigned long long) be64_to_cpu(dd->ipath_guid)); 630 (unsigned long long) be64_to_cpu(dd->ipath_guid));
607 631
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index ada267e41f6c..bbaa70e57db1 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -38,8 +39,8 @@
38#include <asm/pgtable.h> 39#include <asm/pgtable.h>
39 40
40#include "ipath_kernel.h" 41#include "ipath_kernel.h"
41#include "ips_common.h"
42#include "ipath_layer.h" 42#include "ipath_layer.h"
43#include "ipath_common.h"
43 44
44static int ipath_open(struct inode *, struct file *); 45static int ipath_open(struct inode *, struct file *);
45static int ipath_close(struct inode *, struct file *); 46static int ipath_close(struct inode *, struct file *);
@@ -122,6 +123,7 @@ static int ipath_get_base_info(struct ipath_portdata *pd,
122 * on to yet another method of dealing with this 123 * on to yet another method of dealing with this
123 */ 124 */
124 kinfo->spi_rcvhdr_base = (u64) pd->port_rcvhdrq_phys; 125 kinfo->spi_rcvhdr_base = (u64) pd->port_rcvhdrq_phys;
126 kinfo->spi_rcvhdr_tailaddr = (u64)pd->port_rcvhdrqtailaddr_phys;
125 kinfo->spi_rcv_egrbufs = (u64) pd->port_rcvegr_phys; 127 kinfo->spi_rcv_egrbufs = (u64) pd->port_rcvegr_phys;
126 kinfo->spi_pioavailaddr = (u64) dd->ipath_pioavailregs_phys; 128 kinfo->spi_pioavailaddr = (u64) dd->ipath_pioavailregs_phys;
127 kinfo->spi_status = (u64) kinfo->spi_pioavailaddr + 129 kinfo->spi_status = (u64) kinfo->spi_pioavailaddr +
@@ -456,7 +458,7 @@ static int ipath_set_part_key(struct ipath_portdata *pd, u16 key)
456 u16 lkey = key & 0x7FFF; 458 u16 lkey = key & 0x7FFF;
457 int ret; 459 int ret;
458 460
459 if (lkey == (IPS_DEFAULT_P_KEY & 0x7FFF)) { 461 if (lkey == (IPATH_DEFAULT_P_KEY & 0x7FFF)) {
460 /* nothing to do; this key always valid */ 462 /* nothing to do; this key always valid */
461 ret = 0; 463 ret = 0;
462 goto bail; 464 goto bail;
@@ -704,6 +706,15 @@ static int ipath_create_user_egr(struct ipath_portdata *pd)
704 unsigned e, egrcnt, alloced, egrperchunk, chunk, egrsize, egroff; 706 unsigned e, egrcnt, alloced, egrperchunk, chunk, egrsize, egroff;
705 size_t size; 707 size_t size;
706 int ret; 708 int ret;
709 gfp_t gfp_flags;
710
711 /*
712 * GFP_USER, but without GFP_FS, so buffer cache can be
713 * coalesced (we hope); otherwise, even at order 4,
714 * heavy filesystem activity makes these fail, and we can
715 * use compound pages.
716 */
717 gfp_flags = __GFP_WAIT | __GFP_IO | __GFP_COMP;
707 718
708 egrcnt = dd->ipath_rcvegrcnt; 719 egrcnt = dd->ipath_rcvegrcnt;
709 /* TID number offset for this port */ 720 /* TID number offset for this port */
@@ -720,10 +731,8 @@ static int ipath_create_user_egr(struct ipath_portdata *pd)
720 * memory pressure (creating large files and then copying them over 731 * memory pressure (creating large files and then copying them over
721 * NFS while doing lots of MPI jobs), we hit some allocation 732 * NFS while doing lots of MPI jobs), we hit some allocation
722 * failures, even though we can sleep... (2.6.10) Still get 733 * failures, even though we can sleep... (2.6.10) Still get
723 * failures at 64K. 32K is the lowest we can go without waiting 734 * failures at 64K. 32K is the lowest we can go without wasting
724 * more memory again. It seems likely that the coalescing in 735 * additional memory.
725 * free_pages, etc. still has issues (as it has had previously
726 * during 2.6.x development).
727 */ 736 */
728 size = 0x8000; 737 size = 0x8000;
729 alloced = ALIGN(egrsize * egrcnt, size); 738 alloced = ALIGN(egrsize * egrcnt, size);
@@ -744,12 +753,6 @@ static int ipath_create_user_egr(struct ipath_portdata *pd)
744 goto bail_rcvegrbuf; 753 goto bail_rcvegrbuf;
745 } 754 }
746 for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { 755 for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) {
747 /*
748 * GFP_USER, but without GFP_FS, so buffer cache can be
749 * coalesced (we hope); otherwise, even at order 4,
750 * heavy filesystem activity makes these fail
751 */
752 gfp_t gfp_flags = __GFP_WAIT | __GFP_IO | __GFP_COMP;
753 756
754 pd->port_rcvegrbuf[e] = dma_alloc_coherent( 757 pd->port_rcvegrbuf[e] = dma_alloc_coherent(
755 &dd->pcidev->dev, size, &pd->port_rcvegrbuf_phys[e], 758 &dd->pcidev->dev, size, &pd->port_rcvegrbuf_phys[e],
@@ -783,11 +786,12 @@ static int ipath_create_user_egr(struct ipath_portdata *pd)
783 786
784bail_rcvegrbuf_phys: 787bail_rcvegrbuf_phys:
785 for (e = 0; e < pd->port_rcvegrbuf_chunks && 788 for (e = 0; e < pd->port_rcvegrbuf_chunks &&
786 pd->port_rcvegrbuf[e]; e++) 789 pd->port_rcvegrbuf[e]; e++) {
787 dma_free_coherent(&dd->pcidev->dev, size, 790 dma_free_coherent(&dd->pcidev->dev, size,
788 pd->port_rcvegrbuf[e], 791 pd->port_rcvegrbuf[e],
789 pd->port_rcvegrbuf_phys[e]); 792 pd->port_rcvegrbuf_phys[e]);
790 793
794 }
791 vfree(pd->port_rcvegrbuf_phys); 795 vfree(pd->port_rcvegrbuf_phys);
792 pd->port_rcvegrbuf_phys = NULL; 796 pd->port_rcvegrbuf_phys = NULL;
793bail_rcvegrbuf: 797bail_rcvegrbuf:
@@ -802,10 +806,7 @@ static int ipath_do_user_init(struct ipath_portdata *pd,
802{ 806{
803 int ret = 0; 807 int ret = 0;
804 struct ipath_devdata *dd = pd->port_dd; 808 struct ipath_devdata *dd = pd->port_dd;
805 u64 physaddr, uaddr, off, atmp;
806 struct page *pagep;
807 u32 head32; 809 u32 head32;
808 u64 head;
809 810
810 /* for now, if major version is different, bail */ 811 /* for now, if major version is different, bail */
811 if ((uinfo->spu_userversion >> 16) != IPATH_USER_SWMAJOR) { 812 if ((uinfo->spu_userversion >> 16) != IPATH_USER_SWMAJOR) {
@@ -830,54 +831,6 @@ static int ipath_do_user_init(struct ipath_portdata *pd,
830 831
831 /* for now we do nothing with rcvhdrcnt: uinfo->spu_rcvhdrcnt */ 832 /* for now we do nothing with rcvhdrcnt: uinfo->spu_rcvhdrcnt */
832 833
833 /* set up for the rcvhdr Q tail register writeback to user memory */
834 if (!uinfo->spu_rcvhdraddr ||
835 !access_ok(VERIFY_WRITE, (u64 __user *) (unsigned long)
836 uinfo->spu_rcvhdraddr, sizeof(u64))) {
837 ipath_dbg("Port %d rcvhdrtail addr %llx not valid\n",
838 pd->port_port,
839 (unsigned long long) uinfo->spu_rcvhdraddr);
840 ret = -EINVAL;
841 goto done;
842 }
843
844 off = offset_in_page(uinfo->spu_rcvhdraddr);
845 uaddr = PAGE_MASK & (unsigned long) uinfo->spu_rcvhdraddr;
846 ret = ipath_get_user_pages_nocopy(uaddr, &pagep);
847 if (ret) {
848 dev_info(&dd->pcidev->dev, "Failed to lookup and lock "
849 "address %llx for rcvhdrtail: errno %d\n",
850 (unsigned long long) uinfo->spu_rcvhdraddr, -ret);
851 goto done;
852 }
853 ipath_stats.sps_pagelocks++;
854 pd->port_rcvhdrtail_uaddr = uaddr;
855 pd->port_rcvhdrtail_pagep = pagep;
856 pd->port_rcvhdrtail_kvaddr =
857 page_address(pagep);
858 pd->port_rcvhdrtail_kvaddr += off;
859 physaddr = page_to_phys(pagep) + off;
860 ipath_cdbg(VERBOSE, "port %d user addr %llx hdrtailaddr, %llx "
861 "physical (off=%llx)\n",
862 pd->port_port,
863 (unsigned long long) uinfo->spu_rcvhdraddr,
864 (unsigned long long) physaddr, (unsigned long long) off);
865 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr,
866 pd->port_port, physaddr);
867 atmp = ipath_read_kreg64_port(dd,
868 dd->ipath_kregs->kr_rcvhdrtailaddr,
869 pd->port_port);
870 if (physaddr != atmp) {
871 ipath_dev_err(dd,
872 "Catastrophic software error, "
873 "RcvHdrTailAddr%u written as %llx, "
874 "read back as %llx\n", pd->port_port,
875 (unsigned long long) physaddr,
876 (unsigned long long) atmp);
877 ret = -EINVAL;
878 goto done;
879 }
880
881 /* for right now, kernel piobufs are at end, so port 1 is at 0 */ 834 /* for right now, kernel piobufs are at end, so port 1 is at 0 */
882 pd->port_piobufs = dd->ipath_piobufbase + 835 pd->port_piobufs = dd->ipath_piobufbase +
883 dd->ipath_pbufsport * (pd->port_port - 836 dd->ipath_pbufsport * (pd->port_port -
@@ -896,26 +849,18 @@ static int ipath_do_user_init(struct ipath_portdata *pd,
896 ret = ipath_create_user_egr(pd); 849 ret = ipath_create_user_egr(pd);
897 if (ret) 850 if (ret)
898 goto done; 851 goto done;
899 /* enable receives now */
900 /* atomically set enable bit for this port */
901 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port,
902 &dd->ipath_rcvctrl);
903 852
904 /* 853 /*
905 * set the head registers for this port to the current values 854 * set the eager head register for this port to the current values
906 * of the tail pointers, since we don't know if they were 855 * of the tail pointers, since we don't know if they were
907 * updated on last use of the port. 856 * updated on last use of the port.
908 */ 857 */
909 head32 = ipath_read_ureg32(dd, ur_rcvhdrtail, pd->port_port);
910 head = (u64) head32;
911 ipath_write_ureg(dd, ur_rcvhdrhead, head, pd->port_port);
912 head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port); 858 head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port);
913 ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port); 859 ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port);
914 dd->ipath_lastegrheads[pd->port_port] = -1; 860 dd->ipath_lastegrheads[pd->port_port] = -1;
915 dd->ipath_lastrcvhdrqtails[pd->port_port] = -1; 861 dd->ipath_lastrcvhdrqtails[pd->port_port] = -1;
916 ipath_cdbg(VERBOSE, "Wrote port%d head %llx, egrhead %x from " 862 ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n",
917 "tail regs\n", pd->port_port, 863 pd->port_port, head32);
918 (unsigned long long) head, head32);
919 pd->port_tidcursor = 0; /* start at beginning after open */ 864 pd->port_tidcursor = 0; /* start at beginning after open */
920 /* 865 /*
921 * now enable the port; the tail registers will be written to memory 866 * now enable the port; the tail registers will be written to memory
@@ -924,24 +869,76 @@ static int ipath_do_user_init(struct ipath_portdata *pd,
924 * transition from 0 to 1, so clear it first, then set it as part of 869 * transition from 0 to 1, so clear it first, then set it as part of
925 * enabling the port. This will (very briefly) affect any other 870 * enabling the port. This will (very briefly) affect any other
926 * open ports, but it shouldn't be long enough to be an issue. 871 * open ports, but it shouldn't be long enough to be an issue.
872 * We explictly set the in-memory copy to 0 beforehand, so we don't
873 * have to wait to be sure the DMA update has happened.
927 */ 874 */
875 *pd->port_rcvhdrtail_kvaddr = 0ULL;
876 set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port,
877 &dd->ipath_rcvctrl);
928 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, 878 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
929 dd->ipath_rcvctrl & ~INFINIPATH_R_TAILUPD); 879 dd->ipath_rcvctrl & ~INFINIPATH_R_TAILUPD);
930 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, 880 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
931 dd->ipath_rcvctrl); 881 dd->ipath_rcvctrl);
932
933done: 882done:
934 return ret; 883 return ret;
935} 884}
936 885
886
887/* common code for the mappings on dma_alloc_coherent mem */
888static int ipath_mmap_mem(struct vm_area_struct *vma,
889 struct ipath_portdata *pd, unsigned len,
890 int write_ok, dma_addr_t addr, char *what)
891{
892 struct ipath_devdata *dd = pd->port_dd;
893 unsigned pfn = (unsigned long)addr >> PAGE_SHIFT;
894 int ret;
895
896 if ((vma->vm_end - vma->vm_start) > len) {
897 dev_info(&dd->pcidev->dev,
898 "FAIL on %s: len %lx > %x\n", what,
899 vma->vm_end - vma->vm_start, len);
900 ret = -EFAULT;
901 goto bail;
902 }
903
904 if (!write_ok) {
905 if (vma->vm_flags & VM_WRITE) {
906 dev_info(&dd->pcidev->dev,
907 "%s must be mapped readonly\n", what);
908 ret = -EPERM;
909 goto bail;
910 }
911
912 /* don't allow them to later change with mprotect */
913 vma->vm_flags &= ~VM_MAYWRITE;
914 }
915
916 ret = remap_pfn_range(vma, vma->vm_start, pfn,
917 len, vma->vm_page_prot);
918 if (ret)
919 dev_info(&dd->pcidev->dev,
920 "%s port%u mmap of %lx, %x bytes r%c failed: %d\n",
921 what, pd->port_port, (unsigned long)addr, len,
922 write_ok?'w':'o', ret);
923 else
924 ipath_cdbg(VERBOSE, "%s port%u mmaped %lx, %x bytes r%c\n",
925 what, pd->port_port, (unsigned long)addr, len,
926 write_ok?'w':'o');
927bail:
928 return ret;
929}
930
937static int mmap_ureg(struct vm_area_struct *vma, struct ipath_devdata *dd, 931static int mmap_ureg(struct vm_area_struct *vma, struct ipath_devdata *dd,
938 u64 ureg) 932 u64 ureg)
939{ 933{
940 unsigned long phys; 934 unsigned long phys;
941 int ret; 935 int ret;
942 936
943 /* it's the real hardware, so io_remap works */ 937 /*
944 938 * This is real hardware, so use io_remap. This is the mechanism
939 * for the user process to update the head registers for their port
940 * in the chip.
941 */
945 if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) { 942 if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) {
946 dev_info(&dd->pcidev->dev, "FAIL mmap userreg: reqlen " 943 dev_info(&dd->pcidev->dev, "FAIL mmap userreg: reqlen "
947 "%lx > PAGE\n", vma->vm_end - vma->vm_start); 944 "%lx > PAGE\n", vma->vm_end - vma->vm_start);
@@ -967,10 +964,11 @@ static int mmap_piobufs(struct vm_area_struct *vma,
967 int ret; 964 int ret;
968 965
969 /* 966 /*
970 * When we map the PIO buffers, we want to map them as writeonly, no 967 * When we map the PIO buffers in the chip, we want to map them as
971 * read possible. 968 * writeonly, no read possible. This prevents access to previous
969 * process data, and catches users who might try to read the i/o
970 * space due to a bug.
972 */ 971 */
973
974 if ((vma->vm_end - vma->vm_start) > 972 if ((vma->vm_end - vma->vm_start) >
975 (dd->ipath_pbufsport * dd->ipath_palign)) { 973 (dd->ipath_pbufsport * dd->ipath_palign)) {
976 dev_info(&dd->pcidev->dev, "FAIL mmap piobufs: " 974 dev_info(&dd->pcidev->dev, "FAIL mmap piobufs: "
@@ -981,11 +979,10 @@ static int mmap_piobufs(struct vm_area_struct *vma,
981 } 979 }
982 980
983 phys = dd->ipath_physaddr + pd->port_piobufs; 981 phys = dd->ipath_physaddr + pd->port_piobufs;
982
984 /* 983 /*
985 * Do *NOT* mark this as non-cached (PWT bit), or we don't get the 984 * Don't mark this as non-cached, or we don't get the
986 * write combining behavior we want on the PIO buffers! 985 * write combining behavior we want on the PIO buffers!
987 * vma->vm_page_prot =
988 * pgprot_noncached(vma->vm_page_prot);
989 */ 986 */
990 987
991 if (vma->vm_flags & VM_READ) { 988 if (vma->vm_flags & VM_READ) {
@@ -997,8 +994,7 @@ static int mmap_piobufs(struct vm_area_struct *vma,
997 } 994 }
998 995
999 /* don't allow them to later change to readable with mprotect */ 996 /* don't allow them to later change to readable with mprotect */
1000 997 vma->vm_flags &= ~VM_MAYREAD;
1001 vma->vm_flags &= ~VM_MAYWRITE;
1002 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; 998 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND;
1003 999
1004 ret = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT, 1000 ret = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT,
@@ -1017,11 +1013,6 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
1017 dma_addr_t *phys; 1013 dma_addr_t *phys;
1018 int ret; 1014 int ret;
1019 1015
1020 if (!pd->port_rcvegrbuf) {
1021 ret = -EFAULT;
1022 goto bail;
1023 }
1024
1025 size = pd->port_rcvegrbuf_size; 1016 size = pd->port_rcvegrbuf_size;
1026 total_size = pd->port_rcvegrbuf_chunks * size; 1017 total_size = pd->port_rcvegrbuf_chunks * size;
1027 if ((vma->vm_end - vma->vm_start) > total_size) { 1018 if ((vma->vm_end - vma->vm_start) > total_size) {
@@ -1039,13 +1030,12 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
1039 ret = -EPERM; 1030 ret = -EPERM;
1040 goto bail; 1031 goto bail;
1041 } 1032 }
1033 /* don't allow them to later change to writeable with mprotect */
1034 vma->vm_flags &= ~VM_MAYWRITE;
1042 1035
1043 start = vma->vm_start; 1036 start = vma->vm_start;
1044 phys = pd->port_rcvegrbuf_phys; 1037 phys = pd->port_rcvegrbuf_phys;
1045 1038
1046 /* don't allow them to later change to writeable with mprotect */
1047 vma->vm_flags &= ~VM_MAYWRITE;
1048
1049 for (i = 0; i < pd->port_rcvegrbuf_chunks; i++, start += size) { 1039 for (i = 0; i < pd->port_rcvegrbuf_chunks; i++, start += size) {
1050 ret = remap_pfn_range(vma, start, phys[i] >> PAGE_SHIFT, 1040 ret = remap_pfn_range(vma, start, phys[i] >> PAGE_SHIFT,
1051 size, vma->vm_page_prot); 1041 size, vma->vm_page_prot);
@@ -1058,78 +1048,6 @@ bail:
1058 return ret; 1048 return ret;
1059} 1049}
1060 1050
1061static int mmap_rcvhdrq(struct vm_area_struct *vma,
1062 struct ipath_portdata *pd)
1063{
1064 struct ipath_devdata *dd = pd->port_dd;
1065 size_t total_size;
1066 int ret;
1067
1068 /*
1069 * kmalloc'ed memory, physically contiguous; this is from
1070 * spi_rcvhdr_base; we allow user to map read-write so they can
1071 * write hdrq entries to allow protocol code to directly poll
1072 * whether a hdrq entry has been written.
1073 */
1074 total_size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *
1075 sizeof(u32), PAGE_SIZE);
1076 if ((vma->vm_end - vma->vm_start) > total_size) {
1077 dev_info(&dd->pcidev->dev,
1078 "FAIL on rcvhdrq: reqlen %lx > actual %lx\n",
1079 vma->vm_end - vma->vm_start,
1080 (unsigned long) total_size);
1081 ret = -EFAULT;
1082 goto bail;
1083 }
1084
1085 ret = remap_pfn_range(vma, vma->vm_start,
1086 pd->port_rcvhdrq_phys >> PAGE_SHIFT,
1087 vma->vm_end - vma->vm_start,
1088 vma->vm_page_prot);
1089bail:
1090 return ret;
1091}
1092
1093static int mmap_pioavailregs(struct vm_area_struct *vma,
1094 struct ipath_portdata *pd)
1095{
1096 struct ipath_devdata *dd = pd->port_dd;
1097 int ret;
1098
1099 /*
1100 * when we map the PIO bufferavail registers, we want to map them as
1101 * readonly, no write possible.
1102 *
1103 * kmalloc'ed memory, physically contiguous, one page only, readonly
1104 */
1105
1106 if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) {
1107 dev_info(&dd->pcidev->dev, "FAIL on pioavailregs_dma: "
1108 "reqlen %lx > actual %lx\n",
1109 vma->vm_end - vma->vm_start,
1110 (unsigned long) PAGE_SIZE);
1111 ret = -EFAULT;
1112 goto bail;
1113 }
1114
1115 if (vma->vm_flags & VM_WRITE) {
1116 dev_info(&dd->pcidev->dev,
1117 "Can't map pioavailregs as writable (flags=%lx)\n",
1118 vma->vm_flags);
1119 ret = -EPERM;
1120 goto bail;
1121 }
1122
1123 /* don't allow them to later change with mprotect */
1124 vma->vm_flags &= ~VM_MAYWRITE;
1125
1126 ret = remap_pfn_range(vma, vma->vm_start,
1127 dd->ipath_pioavailregs_phys >> PAGE_SHIFT,
1128 PAGE_SIZE, vma->vm_page_prot);
1129bail:
1130 return ret;
1131}
1132
1133/** 1051/**
1134 * ipath_mmap - mmap various structures into user space 1052 * ipath_mmap - mmap various structures into user space
1135 * @fp: the file pointer 1053 * @fp: the file pointer
@@ -1149,6 +1067,7 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma)
1149 1067
1150 pd = port_fp(fp); 1068 pd = port_fp(fp);
1151 dd = pd->port_dd; 1069 dd = pd->port_dd;
1070
1152 /* 1071 /*
1153 * This is the ipath_do_user_init() code, mapping the shared buffers 1072 * This is the ipath_do_user_init() code, mapping the shared buffers
1154 * into the user process. The address referred to by vm_pgoff is the 1073 * into the user process. The address referred to by vm_pgoff is the
@@ -1158,28 +1077,59 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma)
1158 pgaddr = vma->vm_pgoff << PAGE_SHIFT; 1077 pgaddr = vma->vm_pgoff << PAGE_SHIFT;
1159 1078
1160 /* 1079 /*
1161 * note that ureg does *NOT* have the kregvirt as part of it, to be 1080 * Must fit in 40 bits for our hardware; some checked elsewhere,
1162 * sure that for 32 bit programs, we don't end up trying to map a > 1081 * but we'll be paranoid. Check for 0 is mostly in case one of the
1163 * 44 address. Has to match ipath_get_base_info() code that sets 1082 * allocations failed, but user called mmap anyway. We want to catch
1164 * __spi_uregbase 1083 * that before it can match.
1165 */ 1084 */
1085 if (!pgaddr || pgaddr >= (1ULL<<40)) {
1086 ipath_dev_err(dd, "Bad phys addr %llx, start %lx, end %lx\n",
1087 (unsigned long long)pgaddr, vma->vm_start, vma->vm_end);
1088 return -EINVAL;
1089 }
1166 1090
1091 /* just the offset of the port user registers, not physical addr */
1167 ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; 1092 ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port;
1168 1093
1169 ipath_cdbg(MM, "ushare: pgaddr %llx vm_start=%lx, vmlen %lx\n", 1094 ipath_cdbg(MM, "ushare: pgaddr %llx vm_start=%lx, vmlen %lx\n",
1170 (unsigned long long) pgaddr, vma->vm_start, 1095 (unsigned long long) pgaddr, vma->vm_start,
1171 vma->vm_end - vma->vm_start); 1096 vma->vm_end - vma->vm_start);
1172 1097
1173 if (pgaddr == ureg) 1098 if (vma->vm_start & (PAGE_SIZE-1)) {
1099 ipath_dev_err(dd,
1100 "vm_start not aligned: %lx, end=%lx phys %lx\n",
1101 vma->vm_start, vma->vm_end, (unsigned long)pgaddr);
1102 ret = -EINVAL;
1103 }
1104 else if (pgaddr == ureg)
1174 ret = mmap_ureg(vma, dd, ureg); 1105 ret = mmap_ureg(vma, dd, ureg);
1175 else if (pgaddr == pd->port_piobufs) 1106 else if (pgaddr == pd->port_piobufs)
1176 ret = mmap_piobufs(vma, dd, pd); 1107 ret = mmap_piobufs(vma, dd, pd);
1177 else if (pgaddr == (u64) pd->port_rcvegr_phys) 1108 else if (pgaddr == (u64) pd->port_rcvegr_phys)
1178 ret = mmap_rcvegrbufs(vma, pd); 1109 ret = mmap_rcvegrbufs(vma, pd);
1179 else if (pgaddr == (u64) pd->port_rcvhdrq_phys) 1110 else if (pgaddr == (u64) pd->port_rcvhdrq_phys) {
1180 ret = mmap_rcvhdrq(vma, pd); 1111 /*
1112 * The rcvhdrq itself; readonly except on HT-400 (so have
1113 * to allow writable mapping), multiple pages, contiguous
1114 * from an i/o perspective.
1115 */
1116 unsigned total_size =
1117 ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize
1118 * sizeof(u32), PAGE_SIZE);
1119 ret = ipath_mmap_mem(vma, pd, total_size, 1,
1120 pd->port_rcvhdrq_phys,
1121 "rcvhdrq");
1122 }
1123 else if (pgaddr == (u64)pd->port_rcvhdrqtailaddr_phys)
1124 /* in-memory copy of rcvhdrq tail register */
1125 ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0,
1126 pd->port_rcvhdrqtailaddr_phys,
1127 "rcvhdrq tail");
1181 else if (pgaddr == dd->ipath_pioavailregs_phys) 1128 else if (pgaddr == dd->ipath_pioavailregs_phys)
1182 ret = mmap_pioavailregs(vma, pd); 1129 /* in-memory copy of pioavail registers */
1130 ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0,
1131 dd->ipath_pioavailregs_phys,
1132 "pioavail registers");
1183 else 1133 else
1184 ret = -EINVAL; 1134 ret = -EINVAL;
1185 1135
@@ -1442,16 +1392,16 @@ done:
1442 1392
1443static int ipath_open(struct inode *in, struct file *fp) 1393static int ipath_open(struct inode *in, struct file *fp)
1444{ 1394{
1445 int ret, minor; 1395 int ret, user_minor;
1446 1396
1447 mutex_lock(&ipath_mutex); 1397 mutex_lock(&ipath_mutex);
1448 1398
1449 minor = iminor(in); 1399 user_minor = iminor(in) - IPATH_USER_MINOR_BASE;
1450 ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n", 1400 ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n",
1451 (long)in->i_rdev, minor); 1401 (long)in->i_rdev, user_minor);
1452 1402
1453 if (minor) 1403 if (user_minor)
1454 ret = find_free_port(minor - 1, fp); 1404 ret = find_free_port(user_minor - 1, fp);
1455 else 1405 else
1456 ret = find_best_unit(fp); 1406 ret = find_best_unit(fp);
1457 1407
@@ -1536,53 +1486,54 @@ static int ipath_close(struct inode *in, struct file *fp)
1536 } 1486 }
1537 1487
1538 if (dd->ipath_kregbase) { 1488 if (dd->ipath_kregbase) {
1539 if (pd->port_rcvhdrtail_uaddr) { 1489 int i;
1540 pd->port_rcvhdrtail_uaddr = 0; 1490 /* atomically clear receive enable port. */
1541 pd->port_rcvhdrtail_kvaddr = NULL; 1491 clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port,
1542 ipath_release_user_pages_on_close( 1492 &dd->ipath_rcvctrl);
1543 &pd->port_rcvhdrtail_pagep, 1); 1493 ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl,
1544 pd->port_rcvhdrtail_pagep = NULL; 1494 dd->ipath_rcvctrl);
1545 ipath_stats.sps_pageunlocks++; 1495 /* and read back from chip to be sure that nothing
1546 } 1496 * else is in flight when we do the rest */
1547 ipath_write_kreg_port( 1497 (void)ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
1548 dd, dd->ipath_kregs->kr_rcvhdrtailaddr,
1549 port, 0ULL);
1550 ipath_write_kreg_port(
1551 dd, dd->ipath_kregs->kr_rcvhdraddr,
1552 pd->port_port, 0);
1553 1498
1554 /* clean up the pkeys for this port user */ 1499 /* clean up the pkeys for this port user */
1555 ipath_clean_part_key(pd, dd); 1500 ipath_clean_part_key(pd, dd);
1556 1501
1557 if (port < dd->ipath_cfgports) {
1558 int i = dd->ipath_pbufsport * (port - 1);
1559 ipath_disarm_piobufs(dd, i, dd->ipath_pbufsport);
1560 1502
1561 /* atomically clear receive enable port. */ 1503 /*
1562 clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port, 1504 * be paranoid, and never write 0's to these, just use an
1563 &dd->ipath_rcvctrl); 1505 * unused part of the port 0 tail page. Of course,
1564 ipath_write_kreg( 1506 * rcvhdraddr points to a large chunk of memory, so this
1565 dd, 1507 * could still trash things, but at least it won't trash
1566 dd->ipath_kregs->kr_rcvctrl, 1508 * page 0, and by disabling the port, it should stop "soon",
1567 dd->ipath_rcvctrl); 1509 * even if a packet or two is in already in flight after we
1568 1510 * disabled the port.
1569 if (dd->ipath_pageshadow) 1511 */
1570 unlock_expected_tids(pd); 1512 ipath_write_kreg_port(dd,
1571 ipath_stats.sps_ports--; 1513 dd->ipath_kregs->kr_rcvhdrtailaddr, port,
1572 ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n", 1514 dd->ipath_dummy_hdrq_phys);
1573 pd->port_comm, pd->port_pid, 1515 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr,
1574 dd->ipath_unit, port); 1516 pd->port_port, dd->ipath_dummy_hdrq_phys);
1575 } 1517
1518 i = dd->ipath_pbufsport * (port - 1);
1519 ipath_disarm_piobufs(dd, i, dd->ipath_pbufsport);
1520
1521 if (dd->ipath_pageshadow)
1522 unlock_expected_tids(pd);
1523 ipath_stats.sps_ports--;
1524 ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n",
1525 pd->port_comm, pd->port_pid,
1526 dd->ipath_unit, port);
1527
1528 dd->ipath_f_clear_tids(dd, pd->port_port);
1576 } 1529 }
1577 1530
1578 pd->port_cnt = 0; 1531 pd->port_cnt = 0;
1579 pd->port_pid = 0; 1532 pd->port_pid = 0;
1580 1533
1581 dd->ipath_f_clear_tids(dd, pd->port_port); 1534 dd->ipath_pd[pd->port_port] = NULL; /* before releasing mutex */
1582
1583 ipath_free_pddata(dd, pd->port_port, 0);
1584
1585 mutex_unlock(&ipath_mutex); 1535 mutex_unlock(&ipath_mutex);
1536 ipath_free_pddata(dd, pd); /* after releasing the mutex */
1586 1537
1587 return ret; 1538 return ret;
1588} 1539}
@@ -1859,19 +1810,12 @@ int ipath_user_add(struct ipath_devdata *dd)
1859 "error %d\n", -ret); 1810 "error %d\n", -ret);
1860 goto bail; 1811 goto bail;
1861 } 1812 }
1862 ret = ipath_diag_init();
1863 if (ret < 0) {
1864 ipath_dev_err(dd, "Unable to set up diag support: "
1865 "error %d\n", -ret);
1866 goto bail_sma;
1867 }
1868
1869 ret = init_cdev(0, "ipath", &ipath_file_ops, &wildcard_cdev, 1813 ret = init_cdev(0, "ipath", &ipath_file_ops, &wildcard_cdev,
1870 &wildcard_class_dev); 1814 &wildcard_class_dev);
1871 if (ret < 0) { 1815 if (ret < 0) {
1872 ipath_dev_err(dd, "Could not create wildcard " 1816 ipath_dev_err(dd, "Could not create wildcard "
1873 "minor: error %d\n", -ret); 1817 "minor: error %d\n", -ret);
1874 goto bail_diag; 1818 goto bail_sma;
1875 } 1819 }
1876 1820
1877 atomic_set(&user_setup, 1); 1821 atomic_set(&user_setup, 1);
@@ -1880,31 +1824,28 @@ int ipath_user_add(struct ipath_devdata *dd)
1880 snprintf(name, sizeof(name), "ipath%d", dd->ipath_unit); 1824 snprintf(name, sizeof(name), "ipath%d", dd->ipath_unit);
1881 1825
1882 ret = init_cdev(dd->ipath_unit + 1, name, &ipath_file_ops, 1826 ret = init_cdev(dd->ipath_unit + 1, name, &ipath_file_ops,
1883 &dd->cdev, &dd->class_dev); 1827 &dd->user_cdev, &dd->user_class_dev);
1884 if (ret < 0) 1828 if (ret < 0)
1885 ipath_dev_err(dd, "Could not create user minor %d, %s\n", 1829 ipath_dev_err(dd, "Could not create user minor %d, %s\n",
1886 dd->ipath_unit + 1, name); 1830 dd->ipath_unit + 1, name);
1887 1831
1888 goto bail; 1832 goto bail;
1889 1833
1890bail_diag:
1891 ipath_diag_cleanup();
1892bail_sma: 1834bail_sma:
1893 user_cleanup(); 1835 user_cleanup();
1894bail: 1836bail:
1895 return ret; 1837 return ret;
1896} 1838}
1897 1839
1898void ipath_user_del(struct ipath_devdata *dd) 1840void ipath_user_remove(struct ipath_devdata *dd)
1899{ 1841{
1900 cleanup_cdev(&dd->cdev, &dd->class_dev); 1842 cleanup_cdev(&dd->user_cdev, &dd->user_class_dev);
1901 1843
1902 if (atomic_dec_return(&user_count) == 0) { 1844 if (atomic_dec_return(&user_count) == 0) {
1903 if (atomic_read(&user_setup) == 0) 1845 if (atomic_read(&user_setup) == 0)
1904 goto bail; 1846 goto bail;
1905 1847
1906 cleanup_cdev(&wildcard_cdev, &wildcard_class_dev); 1848 cleanup_cdev(&wildcard_cdev, &wildcard_class_dev);
1907 ipath_diag_cleanup();
1908 user_cleanup(); 1849 user_cleanup();
1909 1850
1910 atomic_set(&user_setup, 0); 1851 atomic_set(&user_setup, 0);
@@ -1912,3 +1853,4 @@ void ipath_user_del(struct ipath_devdata *dd)
1912bail: 1853bail:
1913 return; 1854 return;
1914} 1855}
1856
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 97f142c5be13..0936d8e8d704 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
diff --git a/drivers/infiniband/hw/ipath/ipath_ht400.c b/drivers/infiniband/hw/ipath/ipath_ht400.c
index fac0a2b74de2..3db015da6e77 100644
--- a/drivers/infiniband/hw/ipath/ipath_ht400.c
+++ b/drivers/infiniband/hw/ipath/ipath_ht400.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -1572,7 +1573,6 @@ void ipath_init_ht400_funcs(struct ipath_devdata *dd)
1572 dd->ipath_f_reset = ipath_setup_ht_reset; 1573 dd->ipath_f_reset = ipath_setup_ht_reset;
1573 dd->ipath_f_get_boardname = ipath_ht_boardname; 1574 dd->ipath_f_get_boardname = ipath_ht_boardname;
1574 dd->ipath_f_init_hwerrors = ipath_ht_init_hwerrors; 1575 dd->ipath_f_init_hwerrors = ipath_ht_init_hwerrors;
1575 dd->ipath_f_init_hwerrors = ipath_ht_init_hwerrors;
1576 dd->ipath_f_early_init = ipath_ht_early_init; 1576 dd->ipath_f_early_init = ipath_ht_early_init;
1577 dd->ipath_f_handle_hwerrors = ipath_ht_handle_hwerrors; 1577 dd->ipath_f_handle_hwerrors = ipath_ht_handle_hwerrors;
1578 dd->ipath_f_quiet_serdes = ipath_ht_quiet_serdes; 1578 dd->ipath_f_quiet_serdes = ipath_ht_quiet_serdes;
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index dc83250d26a6..414cdd1d80a6 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -35,7 +36,7 @@
35#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
36 37
37#include "ipath_kernel.h" 38#include "ipath_kernel.h"
38#include "ips_common.h" 39#include "ipath_common.h"
39 40
40/* 41/*
41 * min buffers we want to have per port, after driver 42 * min buffers we want to have per port, after driver
@@ -114,6 +115,7 @@ static int create_port0_egr(struct ipath_devdata *dd)
114 "eager TID %u\n", e); 115 "eager TID %u\n", e);
115 while (e != 0) 116 while (e != 0)
116 dev_kfree_skb(skbs[--e]); 117 dev_kfree_skb(skbs[--e]);
118 vfree(skbs);
117 ret = -ENOMEM; 119 ret = -ENOMEM;
118 goto bail; 120 goto bail;
119 } 121 }
@@ -275,7 +277,7 @@ static int init_chip_first(struct ipath_devdata *dd,
275 pd->port_port = 0; 277 pd->port_port = 0;
276 pd->port_cnt = 1; 278 pd->port_cnt = 1;
277 /* The port 0 pkey table is used by the layer interface. */ 279 /* The port 0 pkey table is used by the layer interface. */
278 pd->port_pkeys[0] = IPS_DEFAULT_P_KEY; 280 pd->port_pkeys[0] = IPATH_DEFAULT_P_KEY;
279 dd->ipath_rcvtidcnt = 281 dd->ipath_rcvtidcnt =
280 ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt); 282 ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt);
281 dd->ipath_rcvtidbase = 283 dd->ipath_rcvtidbase =
@@ -409,17 +411,8 @@ static int init_pioavailregs(struct ipath_devdata *dd)
409 /* and its length */ 411 /* and its length */
410 dd->ipath_freezelen = L1_CACHE_BYTES - sizeof(dd->ipath_statusp[0]); 412 dd->ipath_freezelen = L1_CACHE_BYTES - sizeof(dd->ipath_statusp[0]);
411 413
412 if (dd->ipath_unit * 64 > (IPATH_PORT0_RCVHDRTAIL_SIZE - 64)) { 414 ret = 0;
413 ipath_dev_err(dd, "unit %u too large for port 0 "
414 "rcvhdrtail buffer size\n", dd->ipath_unit);
415 ret = -ENODEV;
416 }
417 else
418 ret = 0;
419 415
420 /* so we can get current tail in ipath_kreceive(), per chip */
421 dd->ipath_hdrqtailptr = &ipath_port0_rcvhdrtail[
422 dd->ipath_unit * (64 / sizeof(*ipath_port0_rcvhdrtail))];
423done: 416done:
424 return ret; 417 return ret;
425} 418}
@@ -652,8 +645,9 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
652{ 645{
653 int ret = 0, i; 646 int ret = 0, i;
654 u32 val32, kpiobufs; 647 u32 val32, kpiobufs;
655 u64 val, atmp; 648 u64 val;
656 struct ipath_portdata *pd = NULL; /* keep gcc4 happy */ 649 struct ipath_portdata *pd = NULL; /* keep gcc4 happy */
650 gfp_t gfp_flags = GFP_USER | __GFP_COMP;
657 651
658 ret = init_housekeeping(dd, &pd, reinit); 652 ret = init_housekeeping(dd, &pd, reinit);
659 if (ret) 653 if (ret)
@@ -775,24 +769,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
775 goto done; 769 goto done;
776 } 770 }
777 771
778 val = ipath_port0_rcvhdrtail_dma + dd->ipath_unit * 64;
779
780 /* verify that the alignment requirement was met */
781 ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr,
782 0, val);
783 atmp = ipath_read_kreg64_port(
784 dd, dd->ipath_kregs->kr_rcvhdrtailaddr, 0);
785 if (val != atmp) {
786 ipath_dev_err(dd, "Catastrophic software error, "
787 "RcvHdrTailAddr0 written as %llx, "
788 "read back as %llx from %x\n",
789 (unsigned long long) val,
790 (unsigned long long) atmp,
791 dd->ipath_kregs->kr_rcvhdrtailaddr);
792 ret = -EINVAL;
793 goto done;
794 }
795
796 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvbthqp, IPATH_KD_QP); 772 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvbthqp, IPATH_KD_QP);
797 773
798 /* 774 /*
@@ -836,25 +812,45 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
836 /* clear any interrups up to this point (ints still not enabled) */ 812 /* clear any interrups up to this point (ints still not enabled) */
837 ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL); 813 ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL);
838 814
839 ipath_stats.sps_lid[dd->ipath_unit] = dd->ipath_lid;
840
841 /* 815 /*
842 * Set up the port 0 (kernel) rcvhdr q and egr TIDs. If doing 816 * Set up the port 0 (kernel) rcvhdr q and egr TIDs. If doing
843 * re-init, the simplest way to handle this is to free 817 * re-init, the simplest way to handle this is to free
844 * existing, and re-allocate. 818 * existing, and re-allocate.
845 */ 819 */
846 if (reinit) 820 if (reinit) {
847 ipath_free_pddata(dd, 0, 0); 821 struct ipath_portdata *pd = dd->ipath_pd[0];
822 dd->ipath_pd[0] = NULL;
823 ipath_free_pddata(dd, pd);
824 }
848 dd->ipath_f_tidtemplate(dd); 825 dd->ipath_f_tidtemplate(dd);
849 ret = ipath_create_rcvhdrq(dd, pd); 826 ret = ipath_create_rcvhdrq(dd, pd);
850 if (!ret) 827 if (!ret) {
828 dd->ipath_hdrqtailptr =
829 (volatile __le64 *)pd->port_rcvhdrtail_kvaddr;
851 ret = create_port0_egr(dd); 830 ret = create_port0_egr(dd);
831 }
852 if (ret) 832 if (ret)
853 ipath_dev_err(dd, "failed to allocate port 0 (kernel) " 833 ipath_dev_err(dd, "failed to allocate port 0 (kernel) "
854 "rcvhdrq and/or egr bufs\n"); 834 "rcvhdrq and/or egr bufs\n");
855 else 835 else
856 enable_chip(dd, pd, reinit); 836 enable_chip(dd, pd, reinit);
857 837
838
839 if (!ret && !reinit) {
840 /* used when we close a port, for DMA already in flight at close */
841 dd->ipath_dummy_hdrq = dma_alloc_coherent(
842 &dd->pcidev->dev, pd->port_rcvhdrq_size,
843 &dd->ipath_dummy_hdrq_phys,
844 gfp_flags);
845 if (!dd->ipath_dummy_hdrq ) {
846 dev_info(&dd->pcidev->dev,
847 "Couldn't allocate 0x%lx bytes for dummy hdrq\n",
848 pd->port_rcvhdrq_size);
849 /* fallback to just 0'ing */
850 dd->ipath_dummy_hdrq_phys = 0UL;
851 }
852 }
853
858 /* 854 /*
859 * cause retrigger of pending interrupts ignored during init, 855 * cause retrigger of pending interrupts ignored during init,
860 * even if we had errors 856 * even if we had errors
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 5e31d0de849b..280e732660a1 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -33,9 +34,10 @@
33#include <linux/pci.h> 34#include <linux/pci.h>
34 35
35#include "ipath_kernel.h" 36#include "ipath_kernel.h"
36#include "ips_common.h"
37#include "ipath_layer.h" 37#include "ipath_layer.h"
38#include "ipath_common.h"
38 39
40/* These are all rcv-related errors which we want to count for stats */
39#define E_SUM_PKTERRS \ 41#define E_SUM_PKTERRS \
40 (INFINIPATH_E_RHDRLEN | INFINIPATH_E_RBADTID | \ 42 (INFINIPATH_E_RHDRLEN | INFINIPATH_E_RBADTID | \
41 INFINIPATH_E_RBADVERSION | INFINIPATH_E_RHDR | \ 43 INFINIPATH_E_RBADVERSION | INFINIPATH_E_RHDR | \
@@ -44,6 +46,7 @@
44 INFINIPATH_E_RFORMATERR | INFINIPATH_E_RUNSUPVL | \ 46 INFINIPATH_E_RFORMATERR | INFINIPATH_E_RUNSUPVL | \
45 INFINIPATH_E_RUNEXPCHAR | INFINIPATH_E_REBP) 47 INFINIPATH_E_RUNEXPCHAR | INFINIPATH_E_REBP)
46 48
49/* These are all send-related errors which we want to count for stats */
47#define E_SUM_ERRS \ 50#define E_SUM_ERRS \
48 (INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM | \ 51 (INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM | \
49 INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \ 52 INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
@@ -51,6 +54,18 @@
51 INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \ 54 INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
52 INFINIPATH_E_INVALIDADDR) 55 INFINIPATH_E_INVALIDADDR)
53 56
57/*
58 * these are errors that can occur when the link changes state while
59 * a packet is being sent or received. This doesn't cover things
60 * like EBP or VCRC that can be the result of a sending having the
61 * link change state, so we receive a "known bad" packet.
62 */
63#define E_SUM_LINK_PKTERRS \
64 (INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
65 INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
66 INFINIPATH_E_RSHORTPKTLEN | INFINIPATH_E_RMINPKTLEN | \
67 INFINIPATH_E_RUNEXPCHAR)
68
54static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs) 69static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs)
55{ 70{
56 unsigned long sbuf[4]; 71 unsigned long sbuf[4];
@@ -100,9 +115,7 @@ static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs)
100 if (ipath_debug & __IPATH_PKTDBG) 115 if (ipath_debug & __IPATH_PKTDBG)
101 printk("\n"); 116 printk("\n");
102 } 117 }
103 if ((errs & (INFINIPATH_E_SDROPPEDDATAPKT | 118 if ((errs & E_SUM_LINK_PKTERRS) &&
104 INFINIPATH_E_SDROPPEDSMPPKT |
105 INFINIPATH_E_SMINPKTLEN)) &&
106 !(dd->ipath_flags & IPATH_LINKACTIVE)) { 119 !(dd->ipath_flags & IPATH_LINKACTIVE)) {
107 /* 120 /*
108 * This can happen when SMA is trying to bring the link 121 * This can happen when SMA is trying to bring the link
@@ -111,11 +124,9 @@ static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs)
111 * valid. We don't want to confuse people, so we just 124 * valid. We don't want to confuse people, so we just
112 * don't print them, except at debug 125 * don't print them, except at debug
113 */ 126 */
114 ipath_dbg("Ignoring pktsend errors %llx, because not " 127 ipath_dbg("Ignoring packet errors %llx, because link not "
115 "yet active\n", (unsigned long long) errs); 128 "ACTIVE\n", (unsigned long long) errs);
116 ignore_this_time = INFINIPATH_E_SDROPPEDDATAPKT | 129 ignore_this_time = errs & E_SUM_LINK_PKTERRS;
117 INFINIPATH_E_SDROPPEDSMPPKT |
118 INFINIPATH_E_SMINPKTLEN;
119 } 130 }
120 131
121 return ignore_this_time; 132 return ignore_this_time;
@@ -156,7 +167,29 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
156 */ 167 */
157 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_ibcstatus); 168 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_ibcstatus);
158 lstate = val & IPATH_IBSTATE_MASK; 169 lstate = val & IPATH_IBSTATE_MASK;
159 if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || 170
171 /*
172 * this is confusing enough when it happens that I want to always put it
173 * on the console and in the logs. If it was a requested state change,
174 * we'll have already cleared the flags, so we won't print this warning
175 */
176 if ((lstate != IPATH_IBSTATE_ARM && lstate != IPATH_IBSTATE_ACTIVE)
177 && (dd->ipath_flags & (IPATH_LINKARMED | IPATH_LINKACTIVE))) {
178 dev_info(&dd->pcidev->dev, "Link state changed from %s to %s\n",
179 (dd->ipath_flags & IPATH_LINKARMED) ? "ARM" : "ACTIVE",
180 ib_linkstate(lstate));
181 /*
182 * Flush all queued sends when link went to DOWN or INIT,
183 * to be sure that they don't block SMA and other MAD packets
184 */
185 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
186 INFINIPATH_S_ABORT);
187 ipath_disarm_piobufs(dd, dd->ipath_lastport_piobuf,
188 (unsigned)(dd->ipath_piobcnt2k +
189 dd->ipath_piobcnt4k) -
190 dd->ipath_lastport_piobuf);
191 }
192 else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM ||
160 lstate == IPATH_IBSTATE_ACTIVE) { 193 lstate == IPATH_IBSTATE_ACTIVE) {
161 /* 194 /*
162 * only print at SMA if there is a change, debug if not 195 * only print at SMA if there is a change, debug if not
@@ -229,6 +262,7 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
229 | IPATH_LINKACTIVE | 262 | IPATH_LINKACTIVE |
230 IPATH_LINKARMED); 263 IPATH_LINKARMED);
231 *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY; 264 *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
265 dd->ipath_lli_counter = 0;
232 if (!noprint) { 266 if (!noprint) {
233 if (((dd->ipath_lastibcstat >> 267 if (((dd->ipath_lastibcstat >>
234 INFINIPATH_IBCS_LINKSTATE_SHIFT) & 268 INFINIPATH_IBCS_LINKSTATE_SHIFT) &
@@ -350,7 +384,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd,
350 return supp_msgs; 384 return supp_msgs;
351} 385}
352 386
353static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) 387static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
354{ 388{
355 char msg[512]; 389 char msg[512];
356 u64 ignore_this_time = 0; 390 u64 ignore_this_time = 0;
@@ -379,6 +413,19 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
379 413
380 if (errs & E_SUM_ERRS) 414 if (errs & E_SUM_ERRS)
381 ignore_this_time = handle_e_sum_errs(dd, errs); 415 ignore_this_time = handle_e_sum_errs(dd, errs);
416 else if ((errs & E_SUM_LINK_PKTERRS) &&
417 !(dd->ipath_flags & IPATH_LINKACTIVE)) {
418 /*
419 * This can happen when SMA is trying to bring the link
420 * up, but the IB link changes state at the "wrong" time.
421 * The IB logic then complains that the packet isn't
422 * valid. We don't want to confuse people, so we just
423 * don't print them, except at debug
424 */
425 ipath_dbg("Ignoring packet errors %llx, because link not "
426 "ACTIVE\n", (unsigned long long) errs);
427 ignore_this_time = errs & E_SUM_LINK_PKTERRS;
428 }
382 429
383 if (supp_msgs == 250000) { 430 if (supp_msgs == 250000) {
384 /* 431 /*
@@ -434,7 +481,7 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
434 INFINIPATH_E_IBSTATUSCHANGED); 481 INFINIPATH_E_IBSTATUSCHANGED);
435 } 482 }
436 if (!errs) 483 if (!errs)
437 return; 484 return 0;
438 485
439 if (!noprint) 486 if (!noprint)
440 /* 487 /*
@@ -493,10 +540,10 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
493 continue; 540 continue;
494 if (hd == (tl + 1) || 541 if (hd == (tl + 1) ||
495 (!hd && tl == dd->ipath_hdrqlast)) { 542 (!hd && tl == dd->ipath_hdrqlast)) {
496 dd->ipath_lastrcvhdrqtails[i] = tl;
497 pd->port_hdrqfull++;
498 if (i == 0) 543 if (i == 0)
499 chkerrpkts = 1; 544 chkerrpkts = 1;
545 dd->ipath_lastrcvhdrqtails[i] = tl;
546 pd->port_hdrqfull++;
500 } 547 }
501 } 548 }
502 } 549 }
@@ -558,9 +605,7 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
558 wake_up_interruptible(&ipath_sma_state_wait); 605 wake_up_interruptible(&ipath_sma_state_wait);
559 } 606 }
560 607
561 if (chkerrpkts) 608 return chkerrpkts;
562 /* process possible error packets in hdrq */
563 ipath_kreceive(dd);
564} 609}
565 610
566/* this is separate to allow for better optimization of ipath_intr() */ 611/* this is separate to allow for better optimization of ipath_intr() */
@@ -678,7 +723,12 @@ set:
678 dd->ipath_sendctrl); 723 dd->ipath_sendctrl);
679} 724}
680 725
681static void handle_rcv(struct ipath_devdata *dd, u32 istat) 726/*
727 * Handle receive interrupts for user ports; this means a user
728 * process was waiting for a packet to arrive, and didn't want
729 * to poll
730 */
731static void handle_urcv(struct ipath_devdata *dd, u32 istat)
682{ 732{
683 u64 portr; 733 u64 portr;
684 int i; 734 int i;
@@ -688,22 +738,17 @@ static void handle_rcv(struct ipath_devdata *dd, u32 istat)
688 infinipath_i_rcvavail_mask) 738 infinipath_i_rcvavail_mask)
689 | ((istat >> INFINIPATH_I_RCVURG_SHIFT) & 739 | ((istat >> INFINIPATH_I_RCVURG_SHIFT) &
690 infinipath_i_rcvurg_mask); 740 infinipath_i_rcvurg_mask);
691 for (i = 0; i < dd->ipath_cfgports; i++) { 741 for (i = 1; i < dd->ipath_cfgports; i++) {
692 struct ipath_portdata *pd = dd->ipath_pd[i]; 742 struct ipath_portdata *pd = dd->ipath_pd[i];
693 if (portr & (1 << i) && pd && 743 if (portr & (1 << i) && pd && pd->port_cnt &&
694 pd->port_cnt) { 744 test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) {
695 if (i == 0) 745 int rcbit;
696 ipath_kreceive(dd); 746 clear_bit(IPATH_PORT_WAITING_RCV,
697 else if (test_bit(IPATH_PORT_WAITING_RCV, 747 &pd->port_flag);
698 &pd->port_flag)) { 748 rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT;
699 int rcbit; 749 clear_bit(1UL << rcbit, &dd->ipath_rcvctrl);
700 clear_bit(IPATH_PORT_WAITING_RCV, 750 wake_up_interruptible(&pd->port_wait);
701 &pd->port_flag); 751 rcvdint = 1;
702 rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT;
703 clear_bit(1UL << rcbit, &dd->ipath_rcvctrl);
704 wake_up_interruptible(&pd->port_wait);
705 rcvdint = 1;
706 }
707 } 752 }
708 } 753 }
709 if (rcvdint) { 754 if (rcvdint) {
@@ -719,16 +764,19 @@ static void handle_rcv(struct ipath_devdata *dd, u32 istat)
719irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) 764irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
720{ 765{
721 struct ipath_devdata *dd = data; 766 struct ipath_devdata *dd = data;
722 u32 istat; 767 u32 istat, chk0rcv = 0;
723 ipath_err_t estat = 0; 768 ipath_err_t estat = 0;
724 static unsigned unexpected = 0;
725 irqreturn_t ret; 769 irqreturn_t ret;
770 u32 oldhead, curtail;
771 static unsigned unexpected = 0;
772 static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) |
773 (1U<<INFINIPATH_I_RCVURG_SHIFT);
774
775 ipath_stats.sps_ints++;
726 776
727 if(!(dd->ipath_flags & IPATH_PRESENT)) { 777 if (!(dd->ipath_flags & IPATH_PRESENT)) {
728 /* this is mostly so we don't try to touch the chip while
729 * it is being reset */
730 /* 778 /*
731 * This return value is perhaps odd, but we do not want the 779 * This return value is not great, but we do not want the
732 * interrupt core code to remove our interrupt handler 780 * interrupt core code to remove our interrupt handler
733 * because we don't appear to be handling an interrupt 781 * because we don't appear to be handling an interrupt
734 * during a chip reset. 782 * during a chip reset.
@@ -736,7 +784,51 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
736 return IRQ_HANDLED; 784 return IRQ_HANDLED;
737 } 785 }
738 786
787 /*
788 * this needs to be flags&initted, not statusp, so we keep
789 * taking interrupts even after link goes down, etc.
790 * Also, we *must* clear the interrupt at some point, or we won't
791 * take it again, which can be real bad for errors, etc...
792 */
793
794 if (!(dd->ipath_flags & IPATH_INITTED)) {
795 ipath_bad_intr(dd, &unexpected);
796 ret = IRQ_NONE;
797 goto bail;
798 }
799
800 /*
801 * We try to avoid reading the interrupt status register, since
802 * that's a PIO read, and stalls the processor for up to about
803 * ~0.25 usec. The idea is that if we processed a port0 packet,
804 * we blindly clear the port 0 receive interrupt bits, and nothing
805 * else, then return. If other interrupts are pending, the chip
806 * will re-interrupt us as soon as we write the intclear register.
807 * We then won't process any more kernel packets (if not the 2nd
808 * time, then the 3rd or 4th) and we'll then handle the other
809 * interrupts. We clear the interrupts first so that we don't
810 * lose intr for later packets that arrive while we are processing.
811 */
812 oldhead = dd->ipath_port0head;
813 curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
814 if (oldhead != curtail) {
815 if (dd->ipath_flags & IPATH_GPIO_INTR) {
816 ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
817 (u64) (1 << 2));
818 istat = port0rbits | INFINIPATH_I_GPIO;
819 }
820 else
821 istat = port0rbits;
822 ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
823 ipath_kreceive(dd);
824 if (oldhead != dd->ipath_port0head) {
825 ipath_stats.sps_fastrcvint++;
826 goto done;
827 }
828 }
829
739 istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus); 830 istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus);
831
740 if (unlikely(!istat)) { 832 if (unlikely(!istat)) {
741 ipath_stats.sps_nullintr++; 833 ipath_stats.sps_nullintr++;
742 ret = IRQ_NONE; /* not our interrupt, or already handled */ 834 ret = IRQ_NONE; /* not our interrupt, or already handled */
@@ -749,31 +841,17 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
749 goto bail; 841 goto bail;
750 } 842 }
751 843
752 ipath_stats.sps_ints++;
753
754 /*
755 * this needs to be flags&initted, not statusp, so we keep
756 * taking interrupts even after link goes down, etc.
757 * Also, we *must* clear the interrupt at some point, or we won't
758 * take it again, which can be real bad for errors, etc...
759 */
760
761 if (!(dd->ipath_flags & IPATH_INITTED)) {
762 ipath_bad_intr(dd, &unexpected);
763 ret = IRQ_NONE;
764 goto bail;
765 }
766 if (unexpected) 844 if (unexpected)
767 unexpected = 0; 845 unexpected = 0;
768 846
769 ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat); 847 if (unlikely(istat & ~infinipath_i_bitsextant))
770
771 if (istat & ~infinipath_i_bitsextant)
772 ipath_dev_err(dd, 848 ipath_dev_err(dd,
773 "interrupt with unknown interrupts %x set\n", 849 "interrupt with unknown interrupts %x set\n",
774 istat & (u32) ~ infinipath_i_bitsextant); 850 istat & (u32) ~ infinipath_i_bitsextant);
851 else
852 ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat);
775 853
776 if (istat & INFINIPATH_I_ERROR) { 854 if (unlikely(istat & INFINIPATH_I_ERROR)) {
777 ipath_stats.sps_errints++; 855 ipath_stats.sps_errints++;
778 estat = ipath_read_kreg64(dd, 856 estat = ipath_read_kreg64(dd,
779 dd->ipath_kregs->kr_errorstatus); 857 dd->ipath_kregs->kr_errorstatus);
@@ -788,10 +866,18 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
788 ipath_dev_err(dd, "Read of error status failed " 866 ipath_dev_err(dd, "Read of error status failed "
789 "(all bits set); ignoring\n"); 867 "(all bits set); ignoring\n");
790 else 868 else
791 handle_errors(dd, estat); 869 if (handle_errors(dd, estat))
870 /* force calling ipath_kreceive() */
871 chk0rcv = 1;
792 } 872 }
793 873
794 if (istat & INFINIPATH_I_GPIO) { 874 if (istat & INFINIPATH_I_GPIO) {
875 /*
876 * Packets are available in the port 0 rcv queue.
877 * Eventually this needs to be generalized to check
878 * IPATH_GPIO_INTR, and the specific GPIO bit, if
879 * GPIO interrupts are used for anything else.
880 */
795 if (unlikely(!(dd->ipath_flags & IPATH_GPIO_INTR))) { 881 if (unlikely(!(dd->ipath_flags & IPATH_GPIO_INTR))) {
796 u32 gpiostatus; 882 u32 gpiostatus;
797 gpiostatus = ipath_read_kreg32( 883 gpiostatus = ipath_read_kreg32(
@@ -804,27 +890,39 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
804 else { 890 else {
805 /* Clear GPIO status bit 2 */ 891 /* Clear GPIO status bit 2 */
806 ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear, 892 ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
807 (u64) (1 << 2)); 893 (u64) (1 << 2));
808 894 chk0rcv = 1;
809 /*
810 * Packets are available in the port 0 rcv queue.
811 * Eventually this needs to be generalized to check
812 * IPATH_GPIO_INTR, and the specific GPIO bit, if
813 * GPIO interrupts are used for anything else.
814 */
815 ipath_kreceive(dd);
816 } 895 }
817 } 896 }
897 chk0rcv |= istat & port0rbits;
818 898
819 /* 899 /*
820 * clear the ones we will deal with on this round 900 * Clear the interrupt bits we found set, unless they are receive
821 * We clear it early, mostly for receive interrupts, so we 901 * related, in which case we already cleared them above, and don't
822 * know the chip will have seen this by the time we process 902 * want to clear them again, because we might lose an interrupt.
823 * the queue, and will re-interrupt if necessary. The processor 903 * Clear it early, so we "know" know the chip will have seen this by
824 * itself won't take the interrupt again until we return. 904 * the time we process the queue, and will re-interrupt if necessary.
905 * The processor itself won't take the interrupt again until we return.
825 */ 906 */
826 ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat); 907 ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
827 908
909 /*
910 * handle port0 receive before checking for pio buffers available,
911 * since receives can overflow; piobuf waiters can afford a few
912 * extra cycles, since they were waiting anyway, and user's waiting
913 * for receive are at the bottom.
914 */
915 if (chk0rcv) {
916 ipath_kreceive(dd);
917 istat &= ~port0rbits;
918 }
919
920 if (istat & ((infinipath_i_rcvavail_mask <<
921 INFINIPATH_I_RCVAVAIL_SHIFT)
922 | (infinipath_i_rcvurg_mask <<
923 INFINIPATH_I_RCVURG_SHIFT)))
924 handle_urcv(dd, istat);
925
828 if (istat & INFINIPATH_I_SPIOBUFAVAIL) { 926 if (istat & INFINIPATH_I_SPIOBUFAVAIL) {
829 clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl); 927 clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl);
830 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 928 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
@@ -836,17 +934,7 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
836 handle_layer_pioavail(dd); 934 handle_layer_pioavail(dd);
837 } 935 }
838 936
839 /* 937done:
840 * we check for both transition from empty to non-empty, and urgent
841 * packets (those with the interrupt bit set in the header)
842 */
843
844 if (istat & ((infinipath_i_rcvavail_mask <<
845 INFINIPATH_I_RCVAVAIL_SHIFT)
846 | (infinipath_i_rcvurg_mask <<
847 INFINIPATH_I_RCVURG_SHIFT)))
848 handle_rcv(dd, istat);
849
850 ret = IRQ_HANDLED; 938 ret = IRQ_HANDLED;
851 939
852bail: 940bail:
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 5d92d57b6f54..e9f374fb641e 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -1,6 +1,7 @@
1#ifndef _IPATH_KERNEL_H 1#ifndef _IPATH_KERNEL_H
2#define _IPATH_KERNEL_H 2#define _IPATH_KERNEL_H
3/* 3/*
4 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
4 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 5 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
5 * 6 *
6 * This software is available to you under a choice of one of two 7 * This software is available to you under a choice of one of two
@@ -61,9 +62,7 @@ struct ipath_portdata {
61 /* rcvhdrq base, needs mmap before useful */ 62 /* rcvhdrq base, needs mmap before useful */
62 void *port_rcvhdrq; 63 void *port_rcvhdrq;
63 /* kernel virtual address where hdrqtail is updated */ 64 /* kernel virtual address where hdrqtail is updated */
64 u64 *port_rcvhdrtail_kvaddr; 65 volatile __le64 *port_rcvhdrtail_kvaddr;
65 /* page * used for uaddr */
66 struct page *port_rcvhdrtail_pagep;
67 /* 66 /*
68 * temp buffer for expected send setup, allocated at open, instead 67 * temp buffer for expected send setup, allocated at open, instead
69 * of each setup call 68 * of each setup call
@@ -78,11 +77,7 @@ struct ipath_portdata {
78 dma_addr_t port_rcvegr_phys; 77 dma_addr_t port_rcvegr_phys;
79 /* mmap of hdrq, must fit in 44 bits */ 78 /* mmap of hdrq, must fit in 44 bits */
80 dma_addr_t port_rcvhdrq_phys; 79 dma_addr_t port_rcvhdrq_phys;
81 /* 80 dma_addr_t port_rcvhdrqtailaddr_phys;
82 * the actual user address that we ipath_mlock'ed, so we can
83 * ipath_munlock it at close
84 */
85 unsigned long port_rcvhdrtail_uaddr;
86 /* 81 /*
87 * number of opens on this instance (0 or 1; ignoring forks, dup, 82 * number of opens on this instance (0 or 1; ignoring forks, dup,
88 * etc. for now) 83 * etc. for now)
@@ -158,16 +153,10 @@ struct ipath_devdata {
158 /* base of memory alloced for ipath_kregbase, for free */ 153 /* base of memory alloced for ipath_kregbase, for free */
159 u64 *ipath_kregalloc; 154 u64 *ipath_kregalloc;
160 /* 155 /*
161 * version of kregbase that doesn't have high bits set (for 32 bit
162 * programs, so mmap64 44 bit works)
163 */
164 u64 __iomem *ipath_kregvirt;
165 /*
166 * virtual address where port0 rcvhdrqtail updated for this unit. 156 * virtual address where port0 rcvhdrqtail updated for this unit.
167 * only written to by the chip, not the driver. 157 * only written to by the chip, not the driver.
168 */ 158 */
169 volatile __le64 *ipath_hdrqtailptr; 159 volatile __le64 *ipath_hdrqtailptr;
170 dma_addr_t ipath_dma_addr;
171 /* ipath_cfgports pointers */ 160 /* ipath_cfgports pointers */
172 struct ipath_portdata **ipath_pd; 161 struct ipath_portdata **ipath_pd;
173 /* sk_buffs used by port 0 eager receive queue */ 162 /* sk_buffs used by port 0 eager receive queue */
@@ -354,13 +343,17 @@ struct ipath_devdata {
354 char *ipath_freezemsg; 343 char *ipath_freezemsg;
355 /* pci access data structure */ 344 /* pci access data structure */
356 struct pci_dev *pcidev; 345 struct pci_dev *pcidev;
357 struct cdev *cdev; 346 struct cdev *user_cdev;
358 struct class_device *class_dev; 347 struct cdev *diag_cdev;
348 struct class_device *user_class_dev;
349 struct class_device *diag_class_dev;
359 /* timer used to prevent stats overflow, error throttling, etc. */ 350 /* timer used to prevent stats overflow, error throttling, etc. */
360 struct timer_list ipath_stats_timer; 351 struct timer_list ipath_stats_timer;
361 /* check for stale messages in rcv queue */ 352 /* check for stale messages in rcv queue */
362 /* only allow one intr at a time. */ 353 /* only allow one intr at a time. */
363 unsigned long ipath_rcv_pending; 354 unsigned long ipath_rcv_pending;
355 void *ipath_dummy_hdrq; /* used after port close */
356 dma_addr_t ipath_dummy_hdrq_phys;
364 357
365 /* 358 /*
366 * Shadow copies of registers; size indicates read access size. 359 * Shadow copies of registers; size indicates read access size.
@@ -500,8 +493,11 @@ struct ipath_devdata {
500 u16 ipath_lid; 493 u16 ipath_lid;
501 /* list of pkeys programmed; 0 if not set */ 494 /* list of pkeys programmed; 0 if not set */
502 u16 ipath_pkeys[4]; 495 u16 ipath_pkeys[4];
503 /* ASCII serial number, from flash */ 496 /*
504 u8 ipath_serial[12]; 497 * ASCII serial number, from flash, large enough for original
498 * all digit strings, and longer QLogic serial number format
499 */
500 u8 ipath_serial[16];
505 /* human readable board version */ 501 /* human readable board version */
506 u8 ipath_boardversion[80]; 502 u8 ipath_boardversion[80];
507 /* chip major rev, from ipath_revision */ 503 /* chip major rev, from ipath_revision */
@@ -516,12 +512,12 @@ struct ipath_devdata {
516 u8 ipath_pci_cacheline; 512 u8 ipath_pci_cacheline;
517 /* LID mask control */ 513 /* LID mask control */
518 u8 ipath_lmc; 514 u8 ipath_lmc;
519};
520
521extern volatile __le64 *ipath_port0_rcvhdrtail;
522extern dma_addr_t ipath_port0_rcvhdrtail_dma;
523 515
524#define IPATH_PORT0_RCVHDRTAIL_SIZE PAGE_SIZE 516 /* local link integrity counter */
517 u32 ipath_lli_counter;
518 /* local link integrity errors */
519 u32 ipath_lli_errors;
520};
525 521
526extern struct list_head ipath_dev_list; 522extern struct list_head ipath_dev_list;
527extern spinlock_t ipath_devs_lock; 523extern spinlock_t ipath_devs_lock;
@@ -537,7 +533,7 @@ extern int __ipath_verbs_piobufavail(struct ipath_devdata *);
537extern int __ipath_verbs_rcv(struct ipath_devdata *, void *, void *, u32); 533extern int __ipath_verbs_rcv(struct ipath_devdata *, void *, void *, u32);
538 534
539void ipath_layer_add(struct ipath_devdata *); 535void ipath_layer_add(struct ipath_devdata *);
540void ipath_layer_del(struct ipath_devdata *); 536void ipath_layer_remove(struct ipath_devdata *);
541 537
542int ipath_init_chip(struct ipath_devdata *, int); 538int ipath_init_chip(struct ipath_devdata *, int);
543int ipath_enable_wc(struct ipath_devdata *dd); 539int ipath_enable_wc(struct ipath_devdata *dd);
@@ -551,14 +547,14 @@ int ipath_cdev_init(int minor, char *name, struct file_operations *fops,
551void ipath_cdev_cleanup(struct cdev **cdevp, 547void ipath_cdev_cleanup(struct cdev **cdevp,
552 struct class_device **class_devp); 548 struct class_device **class_devp);
553 549
554int ipath_diag_init(void); 550int ipath_diag_add(struct ipath_devdata *);
555void ipath_diag_cleanup(void); 551void ipath_diag_remove(struct ipath_devdata *);
556void ipath_diag_bringup_link(struct ipath_devdata *); 552void ipath_diag_bringup_link(struct ipath_devdata *);
557 553
558extern wait_queue_head_t ipath_sma_state_wait; 554extern wait_queue_head_t ipath_sma_state_wait;
559 555
560int ipath_user_add(struct ipath_devdata *dd); 556int ipath_user_add(struct ipath_devdata *dd);
561void ipath_user_del(struct ipath_devdata *dd); 557void ipath_user_remove(struct ipath_devdata *dd);
562 558
563struct sk_buff *ipath_alloc_skb(struct ipath_devdata *dd, gfp_t); 559struct sk_buff *ipath_alloc_skb(struct ipath_devdata *dd, gfp_t);
564 560
@@ -582,7 +578,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first,
582 unsigned cnt); 578 unsigned cnt);
583 579
584int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *); 580int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *);
585void ipath_free_pddata(struct ipath_devdata *, u32, int); 581void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *);
586 582
587int ipath_parse_ushort(const char *str, unsigned short *valp); 583int ipath_parse_ushort(const char *str, unsigned short *valp);
588 584
@@ -720,13 +716,8 @@ u64 ipath_read_kreg64_port(const struct ipath_devdata *, ipath_kreg,
720 * @port: port number 716 * @port: port number
721 * 717 *
722 * Return the contents of a register that is virtualized to be per port. 718 * Return the contents of a register that is virtualized to be per port.
723 * Prints a debug message and returns -1 on errors (not distinguishable from 719 * Returns -1 on errors (not distinguishable from valid contents at
724 * valid contents at runtime; we may add a separate error variable at some 720 * runtime; we may add a separate error variable at some point).
725 * point).
726 *
727 * This is normally not used by the kernel, but may be for debugging, and
728 * has a different implementation than user mode, which is why it's not in
729 * _common.h.
730 */ 721 */
731static inline u32 ipath_read_ureg32(const struct ipath_devdata *dd, 722static inline u32 ipath_read_ureg32(const struct ipath_devdata *dd,
732 ipath_ureg regno, int port) 723 ipath_ureg regno, int port)
@@ -842,9 +833,10 @@ extern struct mutex ipath_mutex;
842 833
843#define IPATH_DRV_NAME "ipath_core" 834#define IPATH_DRV_NAME "ipath_core"
844#define IPATH_MAJOR 233 835#define IPATH_MAJOR 233
836#define IPATH_USER_MINOR_BASE 0
845#define IPATH_SMA_MINOR 128 837#define IPATH_SMA_MINOR 128
846#define IPATH_DIAG_MINOR 129 838#define IPATH_DIAG_MINOR_BASE 129
847#define IPATH_NMINORS 130 839#define IPATH_NMINORS 255
848 840
849#define ipath_dev_err(dd,fmt,...) \ 841#define ipath_dev_err(dd,fmt,...) \
850 do { \ 842 do { \
diff --git a/drivers/infiniband/hw/ipath/ipath_keys.c b/drivers/infiniband/hw/ipath/ipath_keys.c
index 5ae8761f9dd2..46773c673a1a 100644
--- a/drivers/infiniband/hw/ipath/ipath_keys.c
+++ b/drivers/infiniband/hw/ipath/ipath_keys.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -120,6 +121,7 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge,
120 struct ib_sge *sge, int acc) 121 struct ib_sge *sge, int acc)
121{ 122{
122 struct ipath_mregion *mr; 123 struct ipath_mregion *mr;
124 unsigned n, m;
123 size_t off; 125 size_t off;
124 int ret; 126 int ret;
125 127
@@ -151,20 +153,22 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge,
151 } 153 }
152 154
153 off += mr->offset; 155 off += mr->offset;
154 isge->mr = mr; 156 m = 0;
155 isge->m = 0; 157 n = 0;
156 isge->n = 0; 158 while (off >= mr->map[m]->segs[n].length) {
157 while (off >= mr->map[isge->m]->segs[isge->n].length) { 159 off -= mr->map[m]->segs[n].length;
158 off -= mr->map[isge->m]->segs[isge->n].length; 160 n++;
159 isge->n++; 161 if (n >= IPATH_SEGSZ) {
160 if (isge->n >= IPATH_SEGSZ) { 162 m++;
161 isge->m++; 163 n = 0;
162 isge->n = 0;
163 } 164 }
164 } 165 }
165 isge->vaddr = mr->map[isge->m]->segs[isge->n].vaddr + off; 166 isge->mr = mr;
166 isge->length = mr->map[isge->m]->segs[isge->n].length - off; 167 isge->vaddr = mr->map[m]->segs[n].vaddr + off;
168 isge->length = mr->map[m]->segs[n].length - off;
167 isge->sge_length = sge->length; 169 isge->sge_length = sge->length;
170 isge->m = m;
171 isge->n = n;
168 172
169 ret = 1; 173 ret = 1;
170 174
@@ -189,6 +193,7 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
189 struct ipath_lkey_table *rkt = &dev->lk_table; 193 struct ipath_lkey_table *rkt = &dev->lk_table;
190 struct ipath_sge *sge = &ss->sge; 194 struct ipath_sge *sge = &ss->sge;
191 struct ipath_mregion *mr; 195 struct ipath_mregion *mr;
196 unsigned n, m;
192 size_t off; 197 size_t off;
193 int ret; 198 int ret;
194 199
@@ -206,20 +211,22 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
206 } 211 }
207 212
208 off += mr->offset; 213 off += mr->offset;
209 sge->mr = mr; 214 m = 0;
210 sge->m = 0; 215 n = 0;
211 sge->n = 0; 216 while (off >= mr->map[m]->segs[n].length) {
212 while (off >= mr->map[sge->m]->segs[sge->n].length) { 217 off -= mr->map[m]->segs[n].length;
213 off -= mr->map[sge->m]->segs[sge->n].length; 218 n++;
214 sge->n++; 219 if (n >= IPATH_SEGSZ) {
215 if (sge->n >= IPATH_SEGSZ) { 220 m++;
216 sge->m++; 221 n = 0;
217 sge->n = 0;
218 } 222 }
219 } 223 }
220 sge->vaddr = mr->map[sge->m]->segs[sge->n].vaddr + off; 224 sge->mr = mr;
221 sge->length = mr->map[sge->m]->segs[sge->n].length - off; 225 sge->vaddr = mr->map[m]->segs[n].vaddr + off;
226 sge->length = mr->map[m]->segs[n].length - off;
222 sge->sge_length = len; 227 sge->sge_length = len;
228 sge->m = m;
229 sge->n = n;
223 ss->sg_list = NULL; 230 ss->sg_list = NULL;
224 ss->num_sge = 1; 231 ss->num_sge = 1;
225 232
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c
index 9ec4ac77b87f..b28c6f81c731 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.c
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -40,8 +41,8 @@
40#include <asm/byteorder.h> 41#include <asm/byteorder.h>
41 42
42#include "ipath_kernel.h" 43#include "ipath_kernel.h"
43#include "ips_common.h"
44#include "ipath_layer.h" 44#include "ipath_layer.h"
45#include "ipath_common.h"
45 46
46/* Acquire before ipath_devs_lock. */ 47/* Acquire before ipath_devs_lock. */
47static DEFINE_MUTEX(ipath_layer_mutex); 48static DEFINE_MUTEX(ipath_layer_mutex);
@@ -299,9 +300,8 @@ bail:
299 300
300EXPORT_SYMBOL_GPL(ipath_layer_set_mtu); 301EXPORT_SYMBOL_GPL(ipath_layer_set_mtu);
301 302
302int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc) 303int ipath_set_lid(struct ipath_devdata *dd, u32 arg, u8 lmc)
303{ 304{
304 ipath_stats.sps_lid[dd->ipath_unit] = arg;
305 dd->ipath_lid = arg; 305 dd->ipath_lid = arg;
306 dd->ipath_lmc = lmc; 306 dd->ipath_lmc = lmc;
307 307
@@ -315,7 +315,7 @@ int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc)
315 return 0; 315 return 0;
316} 316}
317 317
318EXPORT_SYMBOL_GPL(ipath_set_sps_lid); 318EXPORT_SYMBOL_GPL(ipath_set_lid);
319 319
320int ipath_layer_set_guid(struct ipath_devdata *dd, __be64 guid) 320int ipath_layer_set_guid(struct ipath_devdata *dd, __be64 guid)
321{ 321{
@@ -340,18 +340,26 @@ u32 ipath_layer_get_nguid(struct ipath_devdata *dd)
340 340
341EXPORT_SYMBOL_GPL(ipath_layer_get_nguid); 341EXPORT_SYMBOL_GPL(ipath_layer_get_nguid);
342 342
343int ipath_layer_query_device(struct ipath_devdata *dd, u32 * vendor, 343u32 ipath_layer_get_majrev(struct ipath_devdata *dd)
344 u32 * boardrev, u32 * majrev, u32 * minrev)
345{ 344{
346 *vendor = dd->ipath_vendorid; 345 return dd->ipath_majrev;
347 *boardrev = dd->ipath_boardrev; 346}
348 *majrev = dd->ipath_majrev;
349 *minrev = dd->ipath_minrev;
350 347
351 return 0; 348EXPORT_SYMBOL_GPL(ipath_layer_get_majrev);
349
350u32 ipath_layer_get_minrev(struct ipath_devdata *dd)
351{
352 return dd->ipath_minrev;
353}
354
355EXPORT_SYMBOL_GPL(ipath_layer_get_minrev);
356
357u32 ipath_layer_get_pcirev(struct ipath_devdata *dd)
358{
359 return dd->ipath_pcirev;
352} 360}
353 361
354EXPORT_SYMBOL_GPL(ipath_layer_query_device); 362EXPORT_SYMBOL_GPL(ipath_layer_get_pcirev);
355 363
356u32 ipath_layer_get_flags(struct ipath_devdata *dd) 364u32 ipath_layer_get_flags(struct ipath_devdata *dd)
357{ 365{
@@ -374,6 +382,13 @@ u16 ipath_layer_get_deviceid(struct ipath_devdata *dd)
374 382
375EXPORT_SYMBOL_GPL(ipath_layer_get_deviceid); 383EXPORT_SYMBOL_GPL(ipath_layer_get_deviceid);
376 384
385u32 ipath_layer_get_vendorid(struct ipath_devdata *dd)
386{
387 return dd->ipath_vendorid;
388}
389
390EXPORT_SYMBOL_GPL(ipath_layer_get_vendorid);
391
377u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd) 392u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd)
378{ 393{
379 return dd->ipath_lastibcstat; 394 return dd->ipath_lastibcstat;
@@ -403,7 +418,7 @@ void ipath_layer_add(struct ipath_devdata *dd)
403 mutex_unlock(&ipath_layer_mutex); 418 mutex_unlock(&ipath_layer_mutex);
404} 419}
405 420
406void ipath_layer_del(struct ipath_devdata *dd) 421void ipath_layer_remove(struct ipath_devdata *dd)
407{ 422{
408 mutex_lock(&ipath_layer_mutex); 423 mutex_lock(&ipath_layer_mutex);
409 424
@@ -607,7 +622,7 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax)
607 goto bail; 622 goto bail;
608 } 623 }
609 624
610 ret = ipath_setrcvhdrsize(dd, NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE); 625 ret = ipath_setrcvhdrsize(dd, IPATH_HEADER_QUEUE_WORDS);
611 626
612 if (ret < 0) 627 if (ret < 0)
613 goto bail; 628 goto bail;
@@ -616,9 +631,9 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax)
616 631
617 if (*dd->ipath_statusp & IPATH_STATUS_IB_READY) 632 if (*dd->ipath_statusp & IPATH_STATUS_IB_READY)
618 intval |= IPATH_LAYER_INT_IF_UP; 633 intval |= IPATH_LAYER_INT_IF_UP;
619 if (ipath_stats.sps_lid[dd->ipath_unit]) 634 if (dd->ipath_lid)
620 intval |= IPATH_LAYER_INT_LID; 635 intval |= IPATH_LAYER_INT_LID;
621 if (ipath_stats.sps_mlid[dd->ipath_unit]) 636 if (dd->ipath_mlid)
622 intval |= IPATH_LAYER_INT_BCAST; 637 intval |= IPATH_LAYER_INT_BCAST;
623 /* 638 /*
624 * do this on open, in case low level is already up and 639 * do this on open, in case low level is already up and
@@ -884,7 +899,7 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss,
884/** 899/**
885 * ipath_verbs_send - send a packet from the verbs layer 900 * ipath_verbs_send - send a packet from the verbs layer
886 * @dd: the infinipath device 901 * @dd: the infinipath device
887 * @hdrwords: the number of works in the header 902 * @hdrwords: the number of words in the header
888 * @hdr: the packet header 903 * @hdr: the packet header
889 * @len: the length of the packet in bytes 904 * @len: the length of the packet in bytes
890 * @ss: the SGE to send 905 * @ss: the SGE to send
@@ -1016,19 +1031,22 @@ int ipath_layer_get_counters(struct ipath_devdata *dd,
1016 ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt); 1031 ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt);
1017 cntrs->link_error_recovery_counter = 1032 cntrs->link_error_recovery_counter =
1018 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt); 1033 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt);
1034 /*
1035 * The link downed counter counts when the other side downs the
1036 * connection. We add in the number of times we downed the link
1037 * due to local link integrity errors to compensate.
1038 */
1019 cntrs->link_downed_counter = 1039 cntrs->link_downed_counter =
1020 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt); 1040 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt);
1021 cntrs->port_rcv_errors = 1041 cntrs->port_rcv_errors =
1022 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rxdroppktcnt) + 1042 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rxdroppktcnt) +
1023 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvovflcnt) + 1043 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvovflcnt) +
1024 ipath_snap_cntr(dd, dd->ipath_cregs->cr_portovflcnt) + 1044 ipath_snap_cntr(dd, dd->ipath_cregs->cr_portovflcnt) +
1025 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errrcvflowctrlcnt) +
1026 ipath_snap_cntr(dd, dd->ipath_cregs->cr_err_rlencnt) + 1045 ipath_snap_cntr(dd, dd->ipath_cregs->cr_err_rlencnt) +
1027 ipath_snap_cntr(dd, dd->ipath_cregs->cr_invalidrlencnt) + 1046 ipath_snap_cntr(dd, dd->ipath_cregs->cr_invalidrlencnt) +
1028 ipath_snap_cntr(dd, dd->ipath_cregs->cr_erricrccnt) + 1047 ipath_snap_cntr(dd, dd->ipath_cregs->cr_erricrccnt) +
1029 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errvcrccnt) + 1048 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errvcrccnt) +
1030 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlpcrccnt) + 1049 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlpcrccnt) +
1031 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlinkcnt) +
1032 ipath_snap_cntr(dd, dd->ipath_cregs->cr_badformatcnt); 1050 ipath_snap_cntr(dd, dd->ipath_cregs->cr_badformatcnt);
1033 cntrs->port_rcv_remphys_errors = 1051 cntrs->port_rcv_remphys_errors =
1034 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvebpcnt); 1052 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvebpcnt);
@@ -1042,6 +1060,8 @@ int ipath_layer_get_counters(struct ipath_devdata *dd,
1042 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt); 1060 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt);
1043 cntrs->port_rcv_packets = 1061 cntrs->port_rcv_packets =
1044 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt); 1062 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt);
1063 cntrs->local_link_integrity_errors = dd->ipath_lli_errors;
1064 cntrs->excessive_buffer_overrun_errors = 0; /* XXX */
1045 1065
1046 ret = 0; 1066 ret = 0;
1047 1067
@@ -1086,10 +1106,10 @@ int ipath_layer_send_hdr(struct ipath_devdata *dd, struct ether_header *hdr)
1086 } 1106 }
1087 1107
1088 vlsllnh = *((__be16 *) hdr); 1108 vlsllnh = *((__be16 *) hdr);
1089 if (vlsllnh != htons(IPS_LRH_BTH)) { 1109 if (vlsllnh != htons(IPATH_LRH_BTH)) {
1090 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); " 1110 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); "
1091 "not sending\n", be16_to_cpu(vlsllnh), 1111 "not sending\n", be16_to_cpu(vlsllnh),
1092 IPS_LRH_BTH); 1112 IPATH_LRH_BTH);
1093 ret = -EINVAL; 1113 ret = -EINVAL;
1094 } 1114 }
1095 if (ret) 1115 if (ret)
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.h b/drivers/infiniband/hw/ipath/ipath_layer.h
index 6fefd15bd2da..71485096fcac 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.h
+++ b/drivers/infiniband/hw/ipath/ipath_layer.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -54,6 +55,8 @@ struct ipath_layer_counters {
54 u64 port_rcv_data; 55 u64 port_rcv_data;
55 u64 port_xmit_packets; 56 u64 port_xmit_packets;
56 u64 port_rcv_packets; 57 u64 port_rcv_packets;
58 u32 local_link_integrity_errors;
59 u32 excessive_buffer_overrun_errors;
57}; 60};
58 61
59/* 62/*
@@ -126,7 +129,7 @@ u16 ipath_layer_get_bcast(struct ipath_devdata *dd);
126u32 ipath_layer_get_cr_errpkey(struct ipath_devdata *dd); 129u32 ipath_layer_get_cr_errpkey(struct ipath_devdata *dd);
127int ipath_layer_set_linkstate(struct ipath_devdata *dd, u8 state); 130int ipath_layer_set_linkstate(struct ipath_devdata *dd, u8 state);
128int ipath_layer_set_mtu(struct ipath_devdata *, u16); 131int ipath_layer_set_mtu(struct ipath_devdata *, u16);
129int ipath_set_sps_lid(struct ipath_devdata *, u32, u8); 132int ipath_set_lid(struct ipath_devdata *, u32, u8);
130int ipath_layer_send_hdr(struct ipath_devdata *dd, 133int ipath_layer_send_hdr(struct ipath_devdata *dd,
131 struct ether_header *hdr); 134 struct ether_header *hdr);
132int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords, 135int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords,
@@ -143,11 +146,13 @@ int ipath_layer_want_buffer(struct ipath_devdata *dd);
143int ipath_layer_set_guid(struct ipath_devdata *, __be64 guid); 146int ipath_layer_set_guid(struct ipath_devdata *, __be64 guid);
144__be64 ipath_layer_get_guid(struct ipath_devdata *); 147__be64 ipath_layer_get_guid(struct ipath_devdata *);
145u32 ipath_layer_get_nguid(struct ipath_devdata *); 148u32 ipath_layer_get_nguid(struct ipath_devdata *);
146int ipath_layer_query_device(struct ipath_devdata *, u32 * vendor, 149u32 ipath_layer_get_majrev(struct ipath_devdata *);
147 u32 * boardrev, u32 * majrev, u32 * minrev); 150u32 ipath_layer_get_minrev(struct ipath_devdata *);
151u32 ipath_layer_get_pcirev(struct ipath_devdata *);
148u32 ipath_layer_get_flags(struct ipath_devdata *dd); 152u32 ipath_layer_get_flags(struct ipath_devdata *dd);
149struct device *ipath_layer_get_device(struct ipath_devdata *dd); 153struct device *ipath_layer_get_device(struct ipath_devdata *dd);
150u16 ipath_layer_get_deviceid(struct ipath_devdata *dd); 154u16 ipath_layer_get_deviceid(struct ipath_devdata *dd);
155u32 ipath_layer_get_vendorid(struct ipath_devdata *);
151u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd); 156u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd);
152u32 ipath_layer_get_ibmtu(struct ipath_devdata *dd); 157u32 ipath_layer_get_ibmtu(struct ipath_devdata *dd);
153int ipath_layer_enable_timer(struct ipath_devdata *dd); 158int ipath_layer_enable_timer(struct ipath_devdata *dd);
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index 1a9d0a2c33c3..d3402341b7d0 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -34,7 +35,7 @@
34 35
35#include "ipath_kernel.h" 36#include "ipath_kernel.h"
36#include "ipath_verbs.h" 37#include "ipath_verbs.h"
37#include "ips_common.h" 38#include "ipath_common.h"
38 39
39#define IB_SMP_UNSUP_VERSION __constant_htons(0x0004) 40#define IB_SMP_UNSUP_VERSION __constant_htons(0x0004)
40#define IB_SMP_UNSUP_METHOD __constant_htons(0x0008) 41#define IB_SMP_UNSUP_METHOD __constant_htons(0x0008)
@@ -84,7 +85,7 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp,
84{ 85{
85 struct nodeinfo *nip = (struct nodeinfo *)&smp->data; 86 struct nodeinfo *nip = (struct nodeinfo *)&smp->data;
86 struct ipath_devdata *dd = to_idev(ibdev)->dd; 87 struct ipath_devdata *dd = to_idev(ibdev)->dd;
87 u32 vendor, boardid, majrev, minrev; 88 u32 vendor, majrev, minrev;
88 89
89 if (smp->attr_mod) 90 if (smp->attr_mod)
90 smp->status |= IB_SMP_INVALID_FIELD; 91 smp->status |= IB_SMP_INVALID_FIELD;
@@ -104,9 +105,11 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp,
104 nip->port_guid = nip->sys_guid; 105 nip->port_guid = nip->sys_guid;
105 nip->partition_cap = cpu_to_be16(ipath_layer_get_npkeys(dd)); 106 nip->partition_cap = cpu_to_be16(ipath_layer_get_npkeys(dd));
106 nip->device_id = cpu_to_be16(ipath_layer_get_deviceid(dd)); 107 nip->device_id = cpu_to_be16(ipath_layer_get_deviceid(dd));
107 ipath_layer_query_device(dd, &vendor, &boardid, &majrev, &minrev); 108 majrev = ipath_layer_get_majrev(dd);
109 minrev = ipath_layer_get_minrev(dd);
108 nip->revision = cpu_to_be32((majrev << 16) | minrev); 110 nip->revision = cpu_to_be32((majrev << 16) | minrev);
109 nip->local_port_num = port; 111 nip->local_port_num = port;
112 vendor = ipath_layer_get_vendorid(dd);
110 nip->vendor_id[0] = 0; 113 nip->vendor_id[0] = 0;
111 nip->vendor_id[1] = vendor >> 8; 114 nip->vendor_id[1] = vendor >> 8;
112 nip->vendor_id[2] = vendor; 115 nip->vendor_id[2] = vendor;
@@ -215,7 +218,7 @@ static int recv_subn_get_portinfo(struct ib_smp *smp,
215 /* P_KeyViolations are counted by hardware. */ 218 /* P_KeyViolations are counted by hardware. */
216 pip->pkey_violations = 219 pip->pkey_violations =
217 cpu_to_be16((ipath_layer_get_cr_errpkey(dev->dd) - 220 cpu_to_be16((ipath_layer_get_cr_errpkey(dev->dd) -
218 dev->n_pkey_violations) & 0xFFFF); 221 dev->z_pkey_violations) & 0xFFFF);
219 pip->qkey_violations = cpu_to_be16(dev->qkey_violations); 222 pip->qkey_violations = cpu_to_be16(dev->qkey_violations);
220 /* Only the hardware GUID is supported for now */ 223 /* Only the hardware GUID is supported for now */
221 pip->guid_cap = 1; 224 pip->guid_cap = 1;
@@ -303,9 +306,9 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
303 lid = be16_to_cpu(pip->lid); 306 lid = be16_to_cpu(pip->lid);
304 if (lid != ipath_layer_get_lid(dev->dd)) { 307 if (lid != ipath_layer_get_lid(dev->dd)) {
305 /* Must be a valid unicast LID address. */ 308 /* Must be a valid unicast LID address. */
306 if (lid == 0 || lid >= IPS_MULTICAST_LID_BASE) 309 if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE)
307 goto err; 310 goto err;
308 ipath_set_sps_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7); 311 ipath_set_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7);
309 event.event = IB_EVENT_LID_CHANGE; 312 event.event = IB_EVENT_LID_CHANGE;
310 ib_dispatch_event(&event); 313 ib_dispatch_event(&event);
311 } 314 }
@@ -313,7 +316,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
313 smlid = be16_to_cpu(pip->sm_lid); 316 smlid = be16_to_cpu(pip->sm_lid);
314 if (smlid != dev->sm_lid) { 317 if (smlid != dev->sm_lid) {
315 /* Must be a valid unicast LID address. */ 318 /* Must be a valid unicast LID address. */
316 if (smlid == 0 || smlid >= IPS_MULTICAST_LID_BASE) 319 if (smlid == 0 || smlid >= IPATH_MULTICAST_LID_BASE)
317 goto err; 320 goto err;
318 dev->sm_lid = smlid; 321 dev->sm_lid = smlid;
319 event.event = IB_EVENT_SM_CHANGE; 322 event.event = IB_EVENT_SM_CHANGE;
@@ -389,7 +392,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
389 * later. 392 * later.
390 */ 393 */
391 if (pip->pkey_violations == 0) 394 if (pip->pkey_violations == 0)
392 dev->n_pkey_violations = 395 dev->z_pkey_violations =
393 ipath_layer_get_cr_errpkey(dev->dd); 396 ipath_layer_get_cr_errpkey(dev->dd);
394 397
395 if (pip->qkey_violations == 0) 398 if (pip->qkey_violations == 0)
@@ -610,6 +613,9 @@ struct ib_pma_portcounters {
610#define IB_PMA_SEL_PORT_RCV_ERRORS __constant_htons(0x0008) 613#define IB_PMA_SEL_PORT_RCV_ERRORS __constant_htons(0x0008)
611#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS __constant_htons(0x0010) 614#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS __constant_htons(0x0010)
612#define IB_PMA_SEL_PORT_XMIT_DISCARDS __constant_htons(0x0040) 615#define IB_PMA_SEL_PORT_XMIT_DISCARDS __constant_htons(0x0040)
616#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS __constant_htons(0x0200)
617#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS __constant_htons(0x0400)
618#define IB_PMA_SEL_PORT_VL15_DROPPED __constant_htons(0x0800)
613#define IB_PMA_SEL_PORT_XMIT_DATA __constant_htons(0x1000) 619#define IB_PMA_SEL_PORT_XMIT_DATA __constant_htons(0x1000)
614#define IB_PMA_SEL_PORT_RCV_DATA __constant_htons(0x2000) 620#define IB_PMA_SEL_PORT_RCV_DATA __constant_htons(0x2000)
615#define IB_PMA_SEL_PORT_XMIT_PACKETS __constant_htons(0x4000) 621#define IB_PMA_SEL_PORT_XMIT_PACKETS __constant_htons(0x4000)
@@ -844,18 +850,22 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
844 ipath_layer_get_counters(dev->dd, &cntrs); 850 ipath_layer_get_counters(dev->dd, &cntrs);
845 851
846 /* Adjust counters for any resets done. */ 852 /* Adjust counters for any resets done. */
847 cntrs.symbol_error_counter -= dev->n_symbol_error_counter; 853 cntrs.symbol_error_counter -= dev->z_symbol_error_counter;
848 cntrs.link_error_recovery_counter -= 854 cntrs.link_error_recovery_counter -=
849 dev->n_link_error_recovery_counter; 855 dev->z_link_error_recovery_counter;
850 cntrs.link_downed_counter -= dev->n_link_downed_counter; 856 cntrs.link_downed_counter -= dev->z_link_downed_counter;
851 cntrs.port_rcv_errors += dev->rcv_errors; 857 cntrs.port_rcv_errors += dev->rcv_errors;
852 cntrs.port_rcv_errors -= dev->n_port_rcv_errors; 858 cntrs.port_rcv_errors -= dev->z_port_rcv_errors;
853 cntrs.port_rcv_remphys_errors -= dev->n_port_rcv_remphys_errors; 859 cntrs.port_rcv_remphys_errors -= dev->z_port_rcv_remphys_errors;
854 cntrs.port_xmit_discards -= dev->n_port_xmit_discards; 860 cntrs.port_xmit_discards -= dev->z_port_xmit_discards;
855 cntrs.port_xmit_data -= dev->n_port_xmit_data; 861 cntrs.port_xmit_data -= dev->z_port_xmit_data;
856 cntrs.port_rcv_data -= dev->n_port_rcv_data; 862 cntrs.port_rcv_data -= dev->z_port_rcv_data;
857 cntrs.port_xmit_packets -= dev->n_port_xmit_packets; 863 cntrs.port_xmit_packets -= dev->z_port_xmit_packets;
858 cntrs.port_rcv_packets -= dev->n_port_rcv_packets; 864 cntrs.port_rcv_packets -= dev->z_port_rcv_packets;
865 cntrs.local_link_integrity_errors -=
866 dev->z_local_link_integrity_errors;
867 cntrs.excessive_buffer_overrun_errors -=
868 dev->z_excessive_buffer_overrun_errors;
859 869
860 memset(pmp->data, 0, sizeof(pmp->data)); 870 memset(pmp->data, 0, sizeof(pmp->data));
861 871
@@ -893,6 +903,16 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
893 else 903 else
894 p->port_xmit_discards = 904 p->port_xmit_discards =
895 cpu_to_be16((u16)cntrs.port_xmit_discards); 905 cpu_to_be16((u16)cntrs.port_xmit_discards);
906 if (cntrs.local_link_integrity_errors > 0xFUL)
907 cntrs.local_link_integrity_errors = 0xFUL;
908 if (cntrs.excessive_buffer_overrun_errors > 0xFUL)
909 cntrs.excessive_buffer_overrun_errors = 0xFUL;
910 p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) |
911 cntrs.excessive_buffer_overrun_errors;
912 if (dev->n_vl15_dropped > 0xFFFFUL)
913 p->vl15_dropped = __constant_cpu_to_be16(0xFFFF);
914 else
915 p->vl15_dropped = cpu_to_be16((u16)dev->n_vl15_dropped);
896 if (cntrs.port_xmit_data > 0xFFFFFFFFUL) 916 if (cntrs.port_xmit_data > 0xFFFFFFFFUL)
897 p->port_xmit_data = __constant_cpu_to_be32(0xFFFFFFFF); 917 p->port_xmit_data = __constant_cpu_to_be32(0xFFFFFFFF);
898 else 918 else
@@ -928,10 +948,10 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
928 &rpkts, &xwait); 948 &rpkts, &xwait);
929 949
930 /* Adjust counters for any resets done. */ 950 /* Adjust counters for any resets done. */
931 swords -= dev->n_port_xmit_data; 951 swords -= dev->z_port_xmit_data;
932 rwords -= dev->n_port_rcv_data; 952 rwords -= dev->z_port_rcv_data;
933 spkts -= dev->n_port_xmit_packets; 953 spkts -= dev->z_port_xmit_packets;
934 rpkts -= dev->n_port_rcv_packets; 954 rpkts -= dev->z_port_rcv_packets;
935 955
936 memset(pmp->data, 0, sizeof(pmp->data)); 956 memset(pmp->data, 0, sizeof(pmp->data));
937 957
@@ -967,37 +987,48 @@ static int recv_pma_set_portcounters(struct ib_perf *pmp,
967 ipath_layer_get_counters(dev->dd, &cntrs); 987 ipath_layer_get_counters(dev->dd, &cntrs);
968 988
969 if (p->counter_select & IB_PMA_SEL_SYMBOL_ERROR) 989 if (p->counter_select & IB_PMA_SEL_SYMBOL_ERROR)
970 dev->n_symbol_error_counter = cntrs.symbol_error_counter; 990 dev->z_symbol_error_counter = cntrs.symbol_error_counter;
971 991
972 if (p->counter_select & IB_PMA_SEL_LINK_ERROR_RECOVERY) 992 if (p->counter_select & IB_PMA_SEL_LINK_ERROR_RECOVERY)
973 dev->n_link_error_recovery_counter = 993 dev->z_link_error_recovery_counter =
974 cntrs.link_error_recovery_counter; 994 cntrs.link_error_recovery_counter;
975 995
976 if (p->counter_select & IB_PMA_SEL_LINK_DOWNED) 996 if (p->counter_select & IB_PMA_SEL_LINK_DOWNED)
977 dev->n_link_downed_counter = cntrs.link_downed_counter; 997 dev->z_link_downed_counter = cntrs.link_downed_counter;
978 998
979 if (p->counter_select & IB_PMA_SEL_PORT_RCV_ERRORS) 999 if (p->counter_select & IB_PMA_SEL_PORT_RCV_ERRORS)
980 dev->n_port_rcv_errors = 1000 dev->z_port_rcv_errors =
981 cntrs.port_rcv_errors + dev->rcv_errors; 1001 cntrs.port_rcv_errors + dev->rcv_errors;
982 1002
983 if (p->counter_select & IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS) 1003 if (p->counter_select & IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS)
984 dev->n_port_rcv_remphys_errors = 1004 dev->z_port_rcv_remphys_errors =
985 cntrs.port_rcv_remphys_errors; 1005 cntrs.port_rcv_remphys_errors;
986 1006
987 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS) 1007 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS)
988 dev->n_port_xmit_discards = cntrs.port_xmit_discards; 1008 dev->z_port_xmit_discards = cntrs.port_xmit_discards;
1009
1010 if (p->counter_select & IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS)
1011 dev->z_local_link_integrity_errors =
1012 cntrs.local_link_integrity_errors;
1013
1014 if (p->counter_select & IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS)
1015 dev->z_excessive_buffer_overrun_errors =
1016 cntrs.excessive_buffer_overrun_errors;
1017
1018 if (p->counter_select & IB_PMA_SEL_PORT_VL15_DROPPED)
1019 dev->n_vl15_dropped = 0;
989 1020
990 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DATA) 1021 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DATA)
991 dev->n_port_xmit_data = cntrs.port_xmit_data; 1022 dev->z_port_xmit_data = cntrs.port_xmit_data;
992 1023
993 if (p->counter_select & IB_PMA_SEL_PORT_RCV_DATA) 1024 if (p->counter_select & IB_PMA_SEL_PORT_RCV_DATA)
994 dev->n_port_rcv_data = cntrs.port_rcv_data; 1025 dev->z_port_rcv_data = cntrs.port_rcv_data;
995 1026
996 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_PACKETS) 1027 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_PACKETS)
997 dev->n_port_xmit_packets = cntrs.port_xmit_packets; 1028 dev->z_port_xmit_packets = cntrs.port_xmit_packets;
998 1029
999 if (p->counter_select & IB_PMA_SEL_PORT_RCV_PACKETS) 1030 if (p->counter_select & IB_PMA_SEL_PORT_RCV_PACKETS)
1000 dev->n_port_rcv_packets = cntrs.port_rcv_packets; 1031 dev->z_port_rcv_packets = cntrs.port_rcv_packets;
1001 1032
1002 return recv_pma_get_portcounters(pmp, ibdev, port); 1033 return recv_pma_get_portcounters(pmp, ibdev, port);
1003} 1034}
@@ -1014,16 +1045,16 @@ static int recv_pma_set_portcounters_ext(struct ib_perf *pmp,
1014 &rpkts, &xwait); 1045 &rpkts, &xwait);
1015 1046
1016 if (p->counter_select & IB_PMA_SELX_PORT_XMIT_DATA) 1047 if (p->counter_select & IB_PMA_SELX_PORT_XMIT_DATA)
1017 dev->n_port_xmit_data = swords; 1048 dev->z_port_xmit_data = swords;
1018 1049
1019 if (p->counter_select & IB_PMA_SELX_PORT_RCV_DATA) 1050 if (p->counter_select & IB_PMA_SELX_PORT_RCV_DATA)
1020 dev->n_port_rcv_data = rwords; 1051 dev->z_port_rcv_data = rwords;
1021 1052
1022 if (p->counter_select & IB_PMA_SELX_PORT_XMIT_PACKETS) 1053 if (p->counter_select & IB_PMA_SELX_PORT_XMIT_PACKETS)
1023 dev->n_port_xmit_packets = spkts; 1054 dev->z_port_xmit_packets = spkts;
1024 1055
1025 if (p->counter_select & IB_PMA_SELX_PORT_RCV_PACKETS) 1056 if (p->counter_select & IB_PMA_SELX_PORT_RCV_PACKETS)
1026 dev->n_port_rcv_packets = rpkts; 1057 dev->z_port_rcv_packets = rpkts;
1027 1058
1028 if (p->counter_select & IB_PMA_SELX_PORT_UNI_XMIT_PACKETS) 1059 if (p->counter_select & IB_PMA_SELX_PORT_UNI_XMIT_PACKETS)
1029 dev->n_unicast_xmit = 0; 1060 dev->n_unicast_xmit = 0;
@@ -1272,32 +1303,8 @@ int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1272 struct ib_wc *in_wc, struct ib_grh *in_grh, 1303 struct ib_wc *in_wc, struct ib_grh *in_grh,
1273 struct ib_mad *in_mad, struct ib_mad *out_mad) 1304 struct ib_mad *in_mad, struct ib_mad *out_mad)
1274{ 1305{
1275 struct ipath_ibdev *dev = to_idev(ibdev);
1276 int ret; 1306 int ret;
1277 1307
1278 /*
1279 * Snapshot current HW counters to "clear" them.
1280 * This should be done when the driver is loaded except that for
1281 * some reason we get a zillion errors when brining up the link.
1282 */
1283 if (dev->rcv_errors == 0) {
1284 struct ipath_layer_counters cntrs;
1285
1286 ipath_layer_get_counters(to_idev(ibdev)->dd, &cntrs);
1287 dev->rcv_errors++;
1288 dev->n_symbol_error_counter = cntrs.symbol_error_counter;
1289 dev->n_link_error_recovery_counter =
1290 cntrs.link_error_recovery_counter;
1291 dev->n_link_downed_counter = cntrs.link_downed_counter;
1292 dev->n_port_rcv_errors = cntrs.port_rcv_errors + 1;
1293 dev->n_port_rcv_remphys_errors =
1294 cntrs.port_rcv_remphys_errors;
1295 dev->n_port_xmit_discards = cntrs.port_xmit_discards;
1296 dev->n_port_xmit_data = cntrs.port_xmit_data;
1297 dev->n_port_rcv_data = cntrs.port_rcv_data;
1298 dev->n_port_xmit_packets = cntrs.port_xmit_packets;
1299 dev->n_port_rcv_packets = cntrs.port_rcv_packets;
1300 }
1301 switch (in_mad->mad_hdr.mgmt_class) { 1308 switch (in_mad->mad_hdr.mgmt_class) {
1302 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: 1309 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
1303 case IB_MGMT_CLASS_SUBN_LID_ROUTED: 1310 case IB_MGMT_CLASS_SUBN_LID_ROUTED:
diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c b/drivers/infiniband/hw/ipath/ipath_mr.c
index 69ffec66d45d..4ac31a5da330 100644
--- a/drivers/infiniband/hw/ipath/ipath_mr.c
+++ b/drivers/infiniband/hw/ipath/ipath_mr.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -169,6 +170,11 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
169 int n, m, i; 170 int n, m, i;
170 struct ib_mr *ret; 171 struct ib_mr *ret;
171 172
173 if (region->length == 0) {
174 ret = ERR_PTR(-EINVAL);
175 goto bail;
176 }
177
172 n = 0; 178 n = 0;
173 list_for_each_entry(chunk, &region->chunk_list, list) 179 list_for_each_entry(chunk, &region->chunk_list, list)
174 n += chunk->nents; 180 n += chunk->nents;
diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c
index 02e8c75b24f6..b83f66d8262c 100644
--- a/drivers/infiniband/hw/ipath/ipath_pe800.c
+++ b/drivers/infiniband/hw/ipath/ipath_pe800.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -44,7 +45,7 @@
44 45
45/* 46/*
46 * This file contains all the chip-specific register information and 47 * This file contains all the chip-specific register information and
47 * access functions for the PathScale PE800, the PCI-Express chip. 48 * access functions for the QLogic InfiniPath PE800, the PCI-Express chip.
48 * 49 *
49 * This lists the InfiniPath PE800 registers, in the actual chip layout. 50 * This lists the InfiniPath PE800 registers, in the actual chip layout.
50 * This structure should never be directly accessed. 51 * This structure should never be directly accessed.
@@ -532,7 +533,7 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
532 if (n) 533 if (n)
533 snprintf(name, namelen, "%s", n); 534 snprintf(name, namelen, "%s", n);
534 535
535 if (dd->ipath_majrev != 4 || dd->ipath_minrev != 1) { 536 if (dd->ipath_majrev != 4 || !dd->ipath_minrev || dd->ipath_minrev>2) {
536 ipath_dev_err(dd, "Unsupported PE-800 revision %u.%u!\n", 537 ipath_dev_err(dd, "Unsupported PE-800 revision %u.%u!\n",
537 dd->ipath_majrev, dd->ipath_minrev); 538 dd->ipath_majrev, dd->ipath_minrev);
538 ret = 1; 539 ret = 1;
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 9f8855d970c8..83e557be591e 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -34,7 +35,7 @@
34#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
35 36
36#include "ipath_verbs.h" 37#include "ipath_verbs.h"
37#include "ips_common.h" 38#include "ipath_common.h"
38 39
39#define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE) 40#define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE)
40#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) 41#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
@@ -332,10 +333,11 @@ static void ipath_reset_qp(struct ipath_qp *qp)
332 qp->remote_qpn = 0; 333 qp->remote_qpn = 0;
333 qp->qkey = 0; 334 qp->qkey = 0;
334 qp->qp_access_flags = 0; 335 qp->qp_access_flags = 0;
336 clear_bit(IPATH_S_BUSY, &qp->s_flags);
335 qp->s_hdrwords = 0; 337 qp->s_hdrwords = 0;
336 qp->s_psn = 0; 338 qp->s_psn = 0;
337 qp->r_psn = 0; 339 qp->r_psn = 0;
338 atomic_set(&qp->msn, 0); 340 qp->r_msn = 0;
339 if (qp->ibqp.qp_type == IB_QPT_RC) { 341 if (qp->ibqp.qp_type == IB_QPT_RC) {
340 qp->s_state = IB_OPCODE_RC_SEND_LAST; 342 qp->s_state = IB_OPCODE_RC_SEND_LAST;
341 qp->r_state = IB_OPCODE_RC_SEND_LAST; 343 qp->r_state = IB_OPCODE_RC_SEND_LAST;
@@ -344,7 +346,8 @@ static void ipath_reset_qp(struct ipath_qp *qp)
344 qp->r_state = IB_OPCODE_UC_SEND_LAST; 346 qp->r_state = IB_OPCODE_UC_SEND_LAST;
345 } 347 }
346 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; 348 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
347 qp->s_nak_state = 0; 349 qp->r_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
350 qp->r_nak_state = 0;
348 qp->s_rnr_timeout = 0; 351 qp->s_rnr_timeout = 0;
349 qp->s_head = 0; 352 qp->s_head = 0;
350 qp->s_tail = 0; 353 qp->s_tail = 0;
@@ -362,10 +365,10 @@ static void ipath_reset_qp(struct ipath_qp *qp)
362 * @qp: the QP to put into an error state 365 * @qp: the QP to put into an error state
363 * 366 *
364 * Flushes both send and receive work queues. 367 * Flushes both send and receive work queues.
365 * QP r_rq.lock and s_lock should be held. 368 * QP s_lock should be held and interrupts disabled.
366 */ 369 */
367 370
368static void ipath_error_qp(struct ipath_qp *qp) 371void ipath_error_qp(struct ipath_qp *qp)
369{ 372{
370 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 373 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
371 struct ib_wc wc; 374 struct ib_wc wc;
@@ -408,12 +411,14 @@ static void ipath_error_qp(struct ipath_qp *qp)
408 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; 411 qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
409 412
410 wc.opcode = IB_WC_RECV; 413 wc.opcode = IB_WC_RECV;
414 spin_lock(&qp->r_rq.lock);
411 while (qp->r_rq.tail != qp->r_rq.head) { 415 while (qp->r_rq.tail != qp->r_rq.head) {
412 wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id; 416 wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id;
413 if (++qp->r_rq.tail >= qp->r_rq.size) 417 if (++qp->r_rq.tail >= qp->r_rq.size)
414 qp->r_rq.tail = 0; 418 qp->r_rq.tail = 0;
415 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); 419 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
416 } 420 }
421 spin_unlock(&qp->r_rq.lock);
417} 422}
418 423
419/** 424/**
@@ -433,8 +438,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
433 unsigned long flags; 438 unsigned long flags;
434 int ret; 439 int ret;
435 440
436 spin_lock_irqsave(&qp->r_rq.lock, flags); 441 spin_lock_irqsave(&qp->s_lock, flags);
437 spin_lock(&qp->s_lock);
438 442
439 cur_state = attr_mask & IB_QP_CUR_STATE ? 443 cur_state = attr_mask & IB_QP_CUR_STATE ?
440 attr->cur_qp_state : qp->state; 444 attr->cur_qp_state : qp->state;
@@ -446,7 +450,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
446 450
447 if (attr_mask & IB_QP_AV) 451 if (attr_mask & IB_QP_AV)
448 if (attr->ah_attr.dlid == 0 || 452 if (attr->ah_attr.dlid == 0 ||
449 attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) 453 attr->ah_attr.dlid >= IPATH_MULTICAST_LID_BASE)
450 goto inval; 454 goto inval;
451 455
452 if (attr_mask & IB_QP_PKEY_INDEX) 456 if (attr_mask & IB_QP_PKEY_INDEX)
@@ -505,34 +509,19 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
505 } 509 }
506 510
507 if (attr_mask & IB_QP_MIN_RNR_TIMER) 511 if (attr_mask & IB_QP_MIN_RNR_TIMER)
508 qp->s_min_rnr_timer = attr->min_rnr_timer; 512 qp->r_min_rnr_timer = attr->min_rnr_timer;
509 513
510 if (attr_mask & IB_QP_QKEY) 514 if (attr_mask & IB_QP_QKEY)
511 qp->qkey = attr->qkey; 515 qp->qkey = attr->qkey;
512 516
513 if (attr_mask & IB_QP_PKEY_INDEX)
514 qp->s_pkey_index = attr->pkey_index;
515
516 qp->state = new_state; 517 qp->state = new_state;
517 spin_unlock(&qp->s_lock); 518 spin_unlock_irqrestore(&qp->s_lock, flags);
518 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
519
520 /*
521 * If QP1 changed to the RTS state, try to move to the link to INIT
522 * even if it was ACTIVE so the SM will reinitialize the SMA's
523 * state.
524 */
525 if (qp->ibqp.qp_num == 1 && new_state == IB_QPS_RTS) {
526 struct ipath_ibdev *dev = to_idev(ibqp->device);
527 519
528 ipath_layer_set_linkstate(dev->dd, IPATH_IB_LINKDOWN);
529 }
530 ret = 0; 520 ret = 0;
531 goto bail; 521 goto bail;
532 522
533inval: 523inval:
534 spin_unlock(&qp->s_lock); 524 spin_unlock_irqrestore(&qp->s_lock, flags);
535 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
536 ret = -EINVAL; 525 ret = -EINVAL;
537 526
538bail: 527bail:
@@ -566,7 +555,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
566 attr->sq_draining = 0; 555 attr->sq_draining = 0;
567 attr->max_rd_atomic = 1; 556 attr->max_rd_atomic = 1;
568 attr->max_dest_rd_atomic = 1; 557 attr->max_dest_rd_atomic = 1;
569 attr->min_rnr_timer = qp->s_min_rnr_timer; 558 attr->min_rnr_timer = qp->r_min_rnr_timer;
570 attr->port_num = 1; 559 attr->port_num = 1;
571 attr->timeout = 0; 560 attr->timeout = 0;
572 attr->retry_cnt = qp->s_retry_cnt; 561 attr->retry_cnt = qp->s_retry_cnt;
@@ -593,21 +582,17 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
593 * @qp: the queue pair to compute the AETH for 582 * @qp: the queue pair to compute the AETH for
594 * 583 *
595 * Returns the AETH. 584 * Returns the AETH.
596 *
597 * The QP s_lock should be held.
598 */ 585 */
599__be32 ipath_compute_aeth(struct ipath_qp *qp) 586__be32 ipath_compute_aeth(struct ipath_qp *qp)
600{ 587{
601 u32 aeth = atomic_read(&qp->msn) & IPS_MSN_MASK; 588 u32 aeth = qp->r_msn & IPATH_MSN_MASK;
602 589
603 if (qp->s_nak_state) { 590 if (qp->ibqp.srq) {
604 aeth |= qp->s_nak_state << IPS_AETH_CREDIT_SHIFT;
605 } else if (qp->ibqp.srq) {
606 /* 591 /*
607 * Shared receive queues don't generate credits. 592 * Shared receive queues don't generate credits.
608 * Set the credit field to the invalid value. 593 * Set the credit field to the invalid value.
609 */ 594 */
610 aeth |= IPS_AETH_CREDIT_INVAL << IPS_AETH_CREDIT_SHIFT; 595 aeth |= IPATH_AETH_CREDIT_INVAL << IPATH_AETH_CREDIT_SHIFT;
611 } else { 596 } else {
612 u32 min, max, x; 597 u32 min, max, x;
613 u32 credits; 598 u32 credits;
@@ -637,7 +622,7 @@ __be32 ipath_compute_aeth(struct ipath_qp *qp)
637 else 622 else
638 min = x; 623 min = x;
639 } 624 }
640 aeth |= x << IPS_AETH_CREDIT_SHIFT; 625 aeth |= x << IPATH_AETH_CREDIT_SHIFT;
641 } 626 }
642 return cpu_to_be32(aeth); 627 return cpu_to_be32(aeth);
643} 628}
@@ -663,12 +648,22 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
663 size_t sz; 648 size_t sz;
664 struct ib_qp *ret; 649 struct ib_qp *ret;
665 650
666 if (init_attr->cap.max_send_sge > 255 || 651 if (init_attr->cap.max_send_sge > ib_ipath_max_sges ||
667 init_attr->cap.max_recv_sge > 255) { 652 init_attr->cap.max_recv_sge > ib_ipath_max_sges ||
653 init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs ||
654 init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) {
668 ret = ERR_PTR(-ENOMEM); 655 ret = ERR_PTR(-ENOMEM);
669 goto bail; 656 goto bail;
670 } 657 }
671 658
659 if (init_attr->cap.max_send_sge +
660 init_attr->cap.max_recv_sge +
661 init_attr->cap.max_send_wr +
662 init_attr->cap.max_recv_wr == 0) {
663 ret = ERR_PTR(-EINVAL);
664 goto bail;
665 }
666
672 switch (init_attr->qp_type) { 667 switch (init_attr->qp_type) {
673 case IB_QPT_UC: 668 case IB_QPT_UC:
674 case IB_QPT_RC: 669 case IB_QPT_RC:
@@ -686,18 +681,26 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
686 case IB_QPT_GSI: 681 case IB_QPT_GSI:
687 qp = kmalloc(sizeof(*qp), GFP_KERNEL); 682 qp = kmalloc(sizeof(*qp), GFP_KERNEL);
688 if (!qp) { 683 if (!qp) {
684 vfree(swq);
689 ret = ERR_PTR(-ENOMEM); 685 ret = ERR_PTR(-ENOMEM);
690 goto bail; 686 goto bail;
691 } 687 }
692 qp->r_rq.size = init_attr->cap.max_recv_wr + 1; 688 if (init_attr->srq) {
693 sz = sizeof(struct ipath_sge) * 689 qp->r_rq.size = 0;
694 init_attr->cap.max_recv_sge + 690 qp->r_rq.max_sge = 0;
695 sizeof(struct ipath_rwqe); 691 qp->r_rq.wq = NULL;
696 qp->r_rq.wq = vmalloc(qp->r_rq.size * sz); 692 } else {
697 if (!qp->r_rq.wq) { 693 qp->r_rq.size = init_attr->cap.max_recv_wr + 1;
698 kfree(qp); 694 qp->r_rq.max_sge = init_attr->cap.max_recv_sge;
699 ret = ERR_PTR(-ENOMEM); 695 sz = (sizeof(struct ipath_sge) * qp->r_rq.max_sge) +
700 goto bail; 696 sizeof(struct ipath_rwqe);
697 qp->r_rq.wq = vmalloc(qp->r_rq.size * sz);
698 if (!qp->r_rq.wq) {
699 kfree(qp);
700 vfree(swq);
701 ret = ERR_PTR(-ENOMEM);
702 goto bail;
703 }
701 } 704 }
702 705
703 /* 706 /*
@@ -708,9 +711,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
708 spin_lock_init(&qp->r_rq.lock); 711 spin_lock_init(&qp->r_rq.lock);
709 atomic_set(&qp->refcount, 0); 712 atomic_set(&qp->refcount, 0);
710 init_waitqueue_head(&qp->wait); 713 init_waitqueue_head(&qp->wait);
711 tasklet_init(&qp->s_task, 714 tasklet_init(&qp->s_task, ipath_do_ruc_send,
712 init_attr->qp_type == IB_QPT_RC ?
713 ipath_do_rc_send : ipath_do_uc_send,
714 (unsigned long)qp); 715 (unsigned long)qp);
715 INIT_LIST_HEAD(&qp->piowait); 716 INIT_LIST_HEAD(&qp->piowait);
716 INIT_LIST_HEAD(&qp->timerwait); 717 INIT_LIST_HEAD(&qp->timerwait);
@@ -718,7 +719,6 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
718 qp->s_wq = swq; 719 qp->s_wq = swq;
719 qp->s_size = init_attr->cap.max_send_wr + 1; 720 qp->s_size = init_attr->cap.max_send_wr + 1;
720 qp->s_max_sge = init_attr->cap.max_send_sge; 721 qp->s_max_sge = init_attr->cap.max_send_sge;
721 qp->r_rq.max_sge = init_attr->cap.max_recv_sge;
722 qp->s_flags = init_attr->sq_sig_type == IB_SIGNAL_REQ_WR ? 722 qp->s_flags = init_attr->sq_sig_type == IB_SIGNAL_REQ_WR ?
723 1 << IPATH_S_SIGNAL_REQ_WR : 0; 723 1 << IPATH_S_SIGNAL_REQ_WR : 0;
724 dev = to_idev(ibpd->device); 724 dev = to_idev(ibpd->device);
@@ -888,18 +888,18 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
888 */ 888 */
889void ipath_get_credit(struct ipath_qp *qp, u32 aeth) 889void ipath_get_credit(struct ipath_qp *qp, u32 aeth)
890{ 890{
891 u32 credit = (aeth >> IPS_AETH_CREDIT_SHIFT) & IPS_AETH_CREDIT_MASK; 891 u32 credit = (aeth >> IPATH_AETH_CREDIT_SHIFT) & IPATH_AETH_CREDIT_MASK;
892 892
893 /* 893 /*
894 * If the credit is invalid, we can send 894 * If the credit is invalid, we can send
895 * as many packets as we like. Otherwise, we have to 895 * as many packets as we like. Otherwise, we have to
896 * honor the credit field. 896 * honor the credit field.
897 */ 897 */
898 if (credit == IPS_AETH_CREDIT_INVAL) { 898 if (credit == IPATH_AETH_CREDIT_INVAL)
899 qp->s_lsn = (u32) -1; 899 qp->s_lsn = (u32) -1;
900 } else if (qp->s_lsn != (u32) -1) { 900 else if (qp->s_lsn != (u32) -1) {
901 /* Compute new LSN (i.e., MSN + credit) */ 901 /* Compute new LSN (i.e., MSN + credit) */
902 credit = (aeth + credit_table[credit]) & IPS_MSN_MASK; 902 credit = (aeth + credit_table[credit]) & IPATH_MSN_MASK;
903 if (ipath_cmp24(credit, qp->s_lsn) > 0) 903 if (ipath_cmp24(credit, qp->s_lsn) > 0)
904 qp->s_lsn = credit; 904 qp->s_lsn = credit;
905 } 905 }
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 493b1821a934..774d1615ce2f 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -31,7 +32,7 @@
31 */ 32 */
32 33
33#include "ipath_verbs.h" 34#include "ipath_verbs.h"
34#include "ips_common.h" 35#include "ipath_common.h"
35 36
36/* cut down ridiculously long IB macro names */ 37/* cut down ridiculously long IB macro names */
37#define OP(x) IB_OPCODE_RC_##x 38#define OP(x) IB_OPCODE_RC_##x
@@ -41,14 +42,14 @@
41 * @qp: the QP who's SGE we're restarting 42 * @qp: the QP who's SGE we're restarting
42 * @wqe: the work queue to initialize the QP's SGE from 43 * @wqe: the work queue to initialize the QP's SGE from
43 * 44 *
44 * The QP s_lock should be held. 45 * The QP s_lock should be held and interrupts disabled.
45 */ 46 */
46static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) 47static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
47{ 48{
48 struct ipath_ibdev *dev; 49 struct ipath_ibdev *dev;
49 u32 len; 50 u32 len;
50 51
51 len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * 52 len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) *
52 ib_mtu_enum_to_int(qp->path_mtu); 53 ib_mtu_enum_to_int(qp->path_mtu);
53 qp->s_sge.sge = wqe->sg_list[0]; 54 qp->s_sge.sge = wqe->sg_list[0];
54 qp->s_sge.sg_list = wqe->sg_list + 1; 55 qp->s_sge.sg_list = wqe->sg_list + 1;
@@ -72,11 +73,10 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
72 * Return bth0 if constructed; otherwise, return 0. 73 * Return bth0 if constructed; otherwise, return 0.
73 * Note the QP s_lock must be held. 74 * Note the QP s_lock must be held.
74 */ 75 */
75static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, 76u32 ipath_make_rc_ack(struct ipath_qp *qp,
76 struct ipath_other_headers *ohdr, 77 struct ipath_other_headers *ohdr,
77 u32 pmtu) 78 u32 pmtu)
78{ 79{
79 struct ipath_sge_state *ss;
80 u32 hwords; 80 u32 hwords;
81 u32 len; 81 u32 len;
82 u32 bth0; 82 u32 bth0;
@@ -90,13 +90,12 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp,
90 */ 90 */
91 switch (qp->s_ack_state) { 91 switch (qp->s_ack_state) {
92 case OP(RDMA_READ_REQUEST): 92 case OP(RDMA_READ_REQUEST):
93 ss = &qp->s_rdma_sge; 93 qp->s_cur_sge = &qp->s_rdma_sge;
94 len = qp->s_rdma_len; 94 len = qp->s_rdma_len;
95 if (len > pmtu) { 95 if (len > pmtu) {
96 len = pmtu; 96 len = pmtu;
97 qp->s_ack_state = OP(RDMA_READ_RESPONSE_FIRST); 97 qp->s_ack_state = OP(RDMA_READ_RESPONSE_FIRST);
98 } 98 } else
99 else
100 qp->s_ack_state = OP(RDMA_READ_RESPONSE_ONLY); 99 qp->s_ack_state = OP(RDMA_READ_RESPONSE_ONLY);
101 qp->s_rdma_len -= len; 100 qp->s_rdma_len -= len;
102 bth0 = qp->s_ack_state << 24; 101 bth0 = qp->s_ack_state << 24;
@@ -108,7 +107,7 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp,
108 qp->s_ack_state = OP(RDMA_READ_RESPONSE_MIDDLE); 107 qp->s_ack_state = OP(RDMA_READ_RESPONSE_MIDDLE);
109 /* FALLTHROUGH */ 108 /* FALLTHROUGH */
110 case OP(RDMA_READ_RESPONSE_MIDDLE): 109 case OP(RDMA_READ_RESPONSE_MIDDLE):
111 ss = &qp->s_rdma_sge; 110 qp->s_cur_sge = &qp->s_rdma_sge;
112 len = qp->s_rdma_len; 111 len = qp->s_rdma_len;
113 if (len > pmtu) 112 if (len > pmtu)
114 len = pmtu; 113 len = pmtu;
@@ -127,41 +126,50 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp,
127 * We have to prevent new requests from changing 126 * We have to prevent new requests from changing
128 * the r_sge state while a ipath_verbs_send() 127 * the r_sge state while a ipath_verbs_send()
129 * is in progress. 128 * is in progress.
130 * Changing r_state allows the receiver
131 * to continue processing new packets.
132 * We do it here now instead of above so
133 * that we are sure the packet was sent before
134 * changing the state.
135 */ 129 */
136 qp->r_state = OP(RDMA_READ_RESPONSE_LAST);
137 qp->s_ack_state = OP(ACKNOWLEDGE); 130 qp->s_ack_state = OP(ACKNOWLEDGE);
138 return 0; 131 bth0 = 0;
132 goto bail;
139 133
140 case OP(COMPARE_SWAP): 134 case OP(COMPARE_SWAP):
141 case OP(FETCH_ADD): 135 case OP(FETCH_ADD):
142 ss = NULL; 136 qp->s_cur_sge = NULL;
143 len = 0; 137 len = 0;
144 qp->r_state = OP(SEND_LAST); 138 /*
145 qp->s_ack_state = OP(ACKNOWLEDGE); 139 * Set the s_ack_state so the receive interrupt handler
146 bth0 = IB_OPCODE_ATOMIC_ACKNOWLEDGE << 24; 140 * won't try to send an ACK (out of order) until this one
141 * is actually sent.
142 */
143 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST);
144 bth0 = OP(ATOMIC_ACKNOWLEDGE) << 24;
147 ohdr->u.at.aeth = ipath_compute_aeth(qp); 145 ohdr->u.at.aeth = ipath_compute_aeth(qp);
148 ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->s_ack_atomic); 146 ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->r_atomic_data);
149 hwords += sizeof(ohdr->u.at) / 4; 147 hwords += sizeof(ohdr->u.at) / 4;
150 break; 148 break;
151 149
152 default: 150 default:
153 /* Send a regular ACK. */ 151 /* Send a regular ACK. */
154 ss = NULL; 152 qp->s_cur_sge = NULL;
155 len = 0; 153 len = 0;
156 qp->s_ack_state = OP(ACKNOWLEDGE); 154 /*
157 bth0 = qp->s_ack_state << 24; 155 * Set the s_ack_state so the receive interrupt handler
158 ohdr->u.aeth = ipath_compute_aeth(qp); 156 * won't try to send an ACK (out of order) until this one
157 * is actually sent.
158 */
159 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST);
160 bth0 = OP(ACKNOWLEDGE) << 24;
161 if (qp->s_nak_state)
162 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) |
163 (qp->s_nak_state <<
164 IPATH_AETH_CREDIT_SHIFT));
165 else
166 ohdr->u.aeth = ipath_compute_aeth(qp);
159 hwords++; 167 hwords++;
160 } 168 }
161 qp->s_hdrwords = hwords; 169 qp->s_hdrwords = hwords;
162 qp->s_cur_sge = ss;
163 qp->s_cur_size = len; 170 qp->s_cur_size = len;
164 171
172bail:
165 return bth0; 173 return bth0;
166} 174}
167 175
@@ -174,11 +182,11 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp,
174 * @bth2p: pointer to the BTH PSN word 182 * @bth2p: pointer to the BTH PSN word
175 * 183 *
176 * Return 1 if constructed; otherwise, return 0. 184 * Return 1 if constructed; otherwise, return 0.
177 * Note the QP s_lock must be held. 185 * Note the QP s_lock must be held and interrupts disabled.
178 */ 186 */
179static inline int ipath_make_rc_req(struct ipath_qp *qp, 187int ipath_make_rc_req(struct ipath_qp *qp,
180 struct ipath_other_headers *ohdr, 188 struct ipath_other_headers *ohdr,
181 u32 pmtu, u32 *bth0p, u32 *bth2p) 189 u32 pmtu, u32 *bth0p, u32 *bth2p)
182{ 190{
183 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 191 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
184 struct ipath_sge_state *ss; 192 struct ipath_sge_state *ss;
@@ -257,7 +265,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
257 break; 265 break;
258 266
259 case IB_WR_RDMA_WRITE: 267 case IB_WR_RDMA_WRITE:
260 if (newreq) 268 if (newreq && qp->s_lsn != (u32) -1)
261 qp->s_lsn++; 269 qp->s_lsn++;
262 /* FALLTHROUGH */ 270 /* FALLTHROUGH */
263 case IB_WR_RDMA_WRITE_WITH_IMM: 271 case IB_WR_RDMA_WRITE_WITH_IMM:
@@ -283,8 +291,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
283 else { 291 else {
284 qp->s_state = 292 qp->s_state =
285 OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE); 293 OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE);
286 /* Immediate data comes 294 /* Immediate data comes after RETH */
287 * after RETH */
288 ohdr->u.rc.imm_data = wqe->wr.imm_data; 295 ohdr->u.rc.imm_data = wqe->wr.imm_data;
289 hwords += 1; 296 hwords += 1;
290 if (wqe->wr.send_flags & IB_SEND_SOLICITED) 297 if (wqe->wr.send_flags & IB_SEND_SOLICITED)
@@ -304,7 +311,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
304 qp->s_state = OP(RDMA_READ_REQUEST); 311 qp->s_state = OP(RDMA_READ_REQUEST);
305 hwords += sizeof(ohdr->u.rc.reth) / 4; 312 hwords += sizeof(ohdr->u.rc.reth) / 4;
306 if (newreq) { 313 if (newreq) {
307 qp->s_lsn++; 314 if (qp->s_lsn != (u32) -1)
315 qp->s_lsn++;
308 /* 316 /*
309 * Adjust s_next_psn to count the 317 * Adjust s_next_psn to count the
310 * expected number of responses. 318 * expected number of responses.
@@ -335,7 +343,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
335 wqe->wr.wr.atomic.compare_add); 343 wqe->wr.wr.atomic.compare_add);
336 hwords += sizeof(struct ib_atomic_eth) / 4; 344 hwords += sizeof(struct ib_atomic_eth) / 4;
337 if (newreq) { 345 if (newreq) {
338 qp->s_lsn++; 346 if (qp->s_lsn != (u32) -1)
347 qp->s_lsn++;
339 wqe->lpsn = wqe->psn; 348 wqe->lpsn = wqe->psn;
340 } 349 }
341 if (++qp->s_cur == qp->s_size) 350 if (++qp->s_cur == qp->s_size)
@@ -352,9 +361,14 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
352 if (qp->s_tail >= qp->s_size) 361 if (qp->s_tail >= qp->s_size)
353 qp->s_tail = 0; 362 qp->s_tail = 0;
354 } 363 }
355 bth2 |= qp->s_psn++ & IPS_PSN_MASK; 364 bth2 |= qp->s_psn++ & IPATH_PSN_MASK;
356 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 365 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
357 qp->s_next_psn = qp->s_psn; 366 qp->s_next_psn = qp->s_psn;
367 /*
368 * Put the QP on the pending list so lost ACKs will cause
369 * a retry. More than one request can be pending so the
370 * QP may already be on the dev->pending list.
371 */
358 spin_lock(&dev->pending_lock); 372 spin_lock(&dev->pending_lock);
359 if (list_empty(&qp->timerwait)) 373 if (list_empty(&qp->timerwait))
360 list_add_tail(&qp->timerwait, 374 list_add_tail(&qp->timerwait,
@@ -364,8 +378,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
364 378
365 case OP(RDMA_READ_RESPONSE_FIRST): 379 case OP(RDMA_READ_RESPONSE_FIRST):
366 /* 380 /*
367 * This case can only happen if a send is restarted. See 381 * This case can only happen if a send is restarted.
368 * ipath_restart_rc(). 382 * See ipath_restart_rc().
369 */ 383 */
370 ipath_init_restart(qp, wqe); 384 ipath_init_restart(qp, wqe);
371 /* FALLTHROUGH */ 385 /* FALLTHROUGH */
@@ -373,7 +387,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
373 qp->s_state = OP(SEND_MIDDLE); 387 qp->s_state = OP(SEND_MIDDLE);
374 /* FALLTHROUGH */ 388 /* FALLTHROUGH */
375 case OP(SEND_MIDDLE): 389 case OP(SEND_MIDDLE):
376 bth2 = qp->s_psn++ & IPS_PSN_MASK; 390 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
377 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 391 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
378 qp->s_next_psn = qp->s_psn; 392 qp->s_next_psn = qp->s_psn;
379 ss = &qp->s_sge; 393 ss = &qp->s_sge;
@@ -415,7 +429,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
415 qp->s_state = OP(RDMA_WRITE_MIDDLE); 429 qp->s_state = OP(RDMA_WRITE_MIDDLE);
416 /* FALLTHROUGH */ 430 /* FALLTHROUGH */
417 case OP(RDMA_WRITE_MIDDLE): 431 case OP(RDMA_WRITE_MIDDLE):
418 bth2 = qp->s_psn++ & IPS_PSN_MASK; 432 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
419 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 433 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
420 qp->s_next_psn = qp->s_psn; 434 qp->s_next_psn = qp->s_psn;
421 ss = &qp->s_sge; 435 ss = &qp->s_sge;
@@ -452,7 +466,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
452 * See ipath_restart_rc(). 466 * See ipath_restart_rc().
453 */ 467 */
454 ipath_init_restart(qp, wqe); 468 ipath_init_restart(qp, wqe);
455 len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * pmtu; 469 len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) * pmtu;
456 ohdr->u.rc.reth.vaddr = 470 ohdr->u.rc.reth.vaddr =
457 cpu_to_be64(wqe->wr.wr.rdma.remote_addr + len); 471 cpu_to_be64(wqe->wr.wr.rdma.remote_addr + len);
458 ohdr->u.rc.reth.rkey = 472 ohdr->u.rc.reth.rkey =
@@ -460,7 +474,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
460 ohdr->u.rc.reth.length = cpu_to_be32(qp->s_len); 474 ohdr->u.rc.reth.length = cpu_to_be32(qp->s_len);
461 qp->s_state = OP(RDMA_READ_REQUEST); 475 qp->s_state = OP(RDMA_READ_REQUEST);
462 hwords += sizeof(ohdr->u.rc.reth) / 4; 476 hwords += sizeof(ohdr->u.rc.reth) / 4;
463 bth2 = qp->s_psn++ & IPS_PSN_MASK; 477 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
464 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 478 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
465 qp->s_next_psn = qp->s_psn; 479 qp->s_next_psn = qp->s_psn;
466 ss = NULL; 480 ss = NULL;
@@ -496,189 +510,169 @@ done:
496 return 0; 510 return 0;
497} 511}
498 512
499static inline void ipath_make_rc_grh(struct ipath_qp *qp,
500 struct ib_global_route *grh,
501 u32 nwords)
502{
503 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
504
505 /* GRH header size in 32-bit words. */
506 qp->s_hdrwords += 10;
507 qp->s_hdr.u.l.grh.version_tclass_flow =
508 cpu_to_be32((6 << 28) |
509 (grh->traffic_class << 20) |
510 grh->flow_label);
511 qp->s_hdr.u.l.grh.paylen =
512 cpu_to_be16(((qp->s_hdrwords - 12) + nwords +
513 SIZE_OF_CRC) << 2);
514 /* next_hdr is defined by C8-7 in ch. 8.4.1 */
515 qp->s_hdr.u.l.grh.next_hdr = 0x1B;
516 qp->s_hdr.u.l.grh.hop_limit = grh->hop_limit;
517 /* The SGID is 32-bit aligned. */
518 qp->s_hdr.u.l.grh.sgid.global.subnet_prefix = dev->gid_prefix;
519 qp->s_hdr.u.l.grh.sgid.global.interface_id =
520 ipath_layer_get_guid(dev->dd);
521 qp->s_hdr.u.l.grh.dgid = grh->dgid;
522}
523
524/** 513/**
525 * ipath_do_rc_send - perform a send on an RC QP 514 * send_rc_ack - Construct an ACK packet and send it
526 * @data: contains a pointer to the QP 515 * @qp: a pointer to the QP
527 * 516 *
528 * Process entries in the send work queue until credit or queue is 517 * This is called from ipath_rc_rcv() and only uses the receive
529 * exhausted. Only allow one CPU to send a packet per QP (tasklet). 518 * side QP state.
530 * Otherwise, after we drop the QP s_lock, two threads could send 519 * Note that RDMA reads are handled in the send side QP state and tasklet.
531 * packets out of order.
532 */ 520 */
533void ipath_do_rc_send(unsigned long data) 521static void send_rc_ack(struct ipath_qp *qp)
534{ 522{
535 struct ipath_qp *qp = (struct ipath_qp *)data;
536 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 523 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
537 unsigned long flags;
538 u16 lrh0; 524 u16 lrh0;
539 u32 nwords;
540 u32 extra_bytes;
541 u32 bth0; 525 u32 bth0;
542 u32 bth2; 526 u32 hwords;
543 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); 527 struct ipath_ib_header hdr;
544 struct ipath_other_headers *ohdr; 528 struct ipath_other_headers *ohdr;
545 529
546 if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags))
547 goto bail;
548
549 if (unlikely(qp->remote_ah_attr.dlid ==
550 ipath_layer_get_lid(dev->dd))) {
551 struct ib_wc wc;
552
553 /*
554 * Pass in an uninitialized ib_wc to be consistent with
555 * other places where ipath_ruc_loopback() is called.
556 */
557 ipath_ruc_loopback(qp, &wc);
558 goto clear;
559 }
560
561 ohdr = &qp->s_hdr.u.oth;
562 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH)
563 ohdr = &qp->s_hdr.u.l.oth;
564
565again:
566 /* Check for a constructed packet to be sent. */
567 if (qp->s_hdrwords != 0) {
568 /*
569 * If no PIO bufs are available, return. An interrupt will
570 * call ipath_ib_piobufavail() when one is available.
571 */
572 _VERBS_INFO("h %u %p\n", qp->s_hdrwords, &qp->s_hdr);
573 _VERBS_INFO("d %u %p %u %p %u %u %u %u\n", qp->s_cur_size,
574 qp->s_cur_sge->sg_list,
575 qp->s_cur_sge->num_sge,
576 qp->s_cur_sge->sge.vaddr,
577 qp->s_cur_sge->sge.sge_length,
578 qp->s_cur_sge->sge.length,
579 qp->s_cur_sge->sge.m,
580 qp->s_cur_sge->sge.n);
581 if (ipath_verbs_send(dev->dd, qp->s_hdrwords,
582 (u32 *) &qp->s_hdr, qp->s_cur_size,
583 qp->s_cur_sge)) {
584 ipath_no_bufs_available(qp, dev);
585 goto bail;
586 }
587 dev->n_unicast_xmit++;
588 /* Record that we sent the packet and s_hdr is empty. */
589 qp->s_hdrwords = 0;
590 }
591
592 /*
593 * The lock is needed to synchronize between setting
594 * qp->s_ack_state, resend timer, and post_send().
595 */
596 spin_lock_irqsave(&qp->s_lock, flags);
597
598 /* Sending responses has higher priority over sending requests. */
599 if (qp->s_ack_state != OP(ACKNOWLEDGE) &&
600 (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0)
601 bth2 = qp->s_ack_psn++ & IPS_PSN_MASK;
602 else if (!ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2))
603 goto done;
604
605 spin_unlock_irqrestore(&qp->s_lock, flags);
606
607 /* Construct the header. */ 530 /* Construct the header. */
608 extra_bytes = (4 - qp->s_cur_size) & 3; 531 ohdr = &hdr.u.oth;
609 nwords = (qp->s_cur_size + extra_bytes) >> 2; 532 lrh0 = IPATH_LRH_BTH;
610 lrh0 = IPS_LRH_BTH; 533 /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */
534 hwords = 6;
611 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { 535 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) {
612 ipath_make_rc_grh(qp, &qp->remote_ah_attr.grh, nwords); 536 hwords += ipath_make_grh(dev, &hdr.u.l.grh,
613 lrh0 = IPS_LRH_GRH; 537 &qp->remote_ah_attr.grh,
538 hwords, 0);
539 ohdr = &hdr.u.l.oth;
540 lrh0 = IPATH_LRH_GRH;
614 } 541 }
542 /* read pkey_index w/o lock (its atomic) */
543 bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
544 if (qp->r_nak_state)
545 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) |
546 (qp->r_nak_state <<
547 IPATH_AETH_CREDIT_SHIFT));
548 else
549 ohdr->u.aeth = ipath_compute_aeth(qp);
550 if (qp->r_ack_state >= OP(COMPARE_SWAP)) {
551 bth0 |= OP(ATOMIC_ACKNOWLEDGE) << 24;
552 ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->r_atomic_data);
553 hwords += sizeof(ohdr->u.at.atomic_ack_eth) / 4;
554 } else
555 bth0 |= OP(ACKNOWLEDGE) << 24;
615 lrh0 |= qp->remote_ah_attr.sl << 4; 556 lrh0 |= qp->remote_ah_attr.sl << 4;
616 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); 557 hdr.lrh[0] = cpu_to_be16(lrh0);
617 qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); 558 hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid);
618 qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords + 559 hdr.lrh[2] = cpu_to_be16(hwords + SIZE_OF_CRC);
619 SIZE_OF_CRC); 560 hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
620 qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
621 bth0 |= ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
622 bth0 |= extra_bytes << 20;
623 ohdr->bth[0] = cpu_to_be32(bth0); 561 ohdr->bth[0] = cpu_to_be32(bth0);
624 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); 562 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
625 ohdr->bth[2] = cpu_to_be32(bth2); 563 ohdr->bth[2] = cpu_to_be32(qp->r_ack_psn & IPATH_PSN_MASK);
626 564
627 /* Check for more work to do. */ 565 /*
628 goto again; 566 * If we can send the ACK, clear the ACK state.
567 */
568 if (ipath_verbs_send(dev->dd, hwords, (u32 *) &hdr, 0, NULL) == 0) {
569 qp->r_ack_state = OP(ACKNOWLEDGE);
570 dev->n_unicast_xmit++;
571 } else {
572 /*
573 * We are out of PIO buffers at the moment.
574 * Pass responsibility for sending the ACK to the
575 * send tasklet so that when a PIO buffer becomes
576 * available, the ACK is sent ahead of other outgoing
577 * packets.
578 */
579 dev->n_rc_qacks++;
580 spin_lock_irq(&qp->s_lock);
581 /* Don't coalesce if a RDMA read or atomic is pending. */
582 if (qp->s_ack_state == OP(ACKNOWLEDGE) ||
583 qp->s_ack_state < OP(RDMA_READ_REQUEST)) {
584 qp->s_ack_state = qp->r_ack_state;
585 qp->s_nak_state = qp->r_nak_state;
586 qp->s_ack_psn = qp->r_ack_psn;
587 qp->r_ack_state = OP(ACKNOWLEDGE);
588 }
589 spin_unlock_irq(&qp->s_lock);
629 590
630done: 591 /* Call ipath_do_rc_send() in another thread. */
631 spin_unlock_irqrestore(&qp->s_lock, flags); 592 tasklet_hi_schedule(&qp->s_task);
632clear: 593 }
633 clear_bit(IPATH_S_BUSY, &qp->s_flags);
634bail:
635 return;
636} 594}
637 595
638static void send_rc_ack(struct ipath_qp *qp) 596/**
597 * reset_psn - reset the QP state to send starting from PSN
598 * @qp: the QP
599 * @psn: the packet sequence number to restart at
600 *
601 * This is called from ipath_rc_rcv() to process an incoming RC ACK
602 * for the given QP.
603 * Called at interrupt level with the QP s_lock held.
604 */
605static void reset_psn(struct ipath_qp *qp, u32 psn)
639{ 606{
640 struct ipath_ibdev *dev = to_idev(qp->ibqp.device); 607 u32 n = qp->s_last;
641 u16 lrh0; 608 struct ipath_swqe *wqe = get_swqe_ptr(qp, n);
642 u32 bth0; 609 u32 opcode;
643 struct ipath_other_headers *ohdr;
644 610
645 /* Construct the header. */ 611 qp->s_cur = n;
646 ohdr = &qp->s_hdr.u.oth; 612
647 lrh0 = IPS_LRH_BTH; 613 /*
648 /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */ 614 * If we are starting the request from the beginning,
649 qp->s_hdrwords = 6; 615 * let the normal send code handle initialization.
650 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { 616 */
651 ipath_make_rc_grh(qp, &qp->remote_ah_attr.grh, 0); 617 if (ipath_cmp24(psn, wqe->psn) <= 0) {
652 ohdr = &qp->s_hdr.u.l.oth; 618 qp->s_state = OP(SEND_LAST);
653 lrh0 = IPS_LRH_GRH; 619 goto done;
654 } 620 }
655 bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); 621
656 ohdr->u.aeth = ipath_compute_aeth(qp); 622 /* Find the work request opcode corresponding to the given PSN. */
657 if (qp->s_ack_state >= OP(COMPARE_SWAP)) { 623 opcode = wqe->wr.opcode;
658 bth0 |= IB_OPCODE_ATOMIC_ACKNOWLEDGE << 24; 624 for (;;) {
659 ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->s_ack_atomic); 625 int diff;
660 qp->s_hdrwords += sizeof(ohdr->u.at.atomic_ack_eth) / 4; 626
627 if (++n == qp->s_size)
628 n = 0;
629 if (n == qp->s_tail)
630 break;
631 wqe = get_swqe_ptr(qp, n);
632 diff = ipath_cmp24(psn, wqe->psn);
633 if (diff < 0)
634 break;
635 qp->s_cur = n;
636 /*
637 * If we are starting the request from the beginning,
638 * let the normal send code handle initialization.
639 */
640 if (diff == 0) {
641 qp->s_state = OP(SEND_LAST);
642 goto done;
643 }
644 opcode = wqe->wr.opcode;
661 } 645 }
662 else
663 bth0 |= OP(ACKNOWLEDGE) << 24;
664 lrh0 |= qp->remote_ah_attr.sl << 4;
665 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0);
666 qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid);
667 qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + SIZE_OF_CRC);
668 qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
669 ohdr->bth[0] = cpu_to_be32(bth0);
670 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
671 ohdr->bth[2] = cpu_to_be32(qp->s_ack_psn & IPS_PSN_MASK);
672 646
673 /* 647 /*
674 * If we can send the ACK, clear the ACK state. 648 * Set the state to restart in the middle of a request.
649 * Don't change the s_sge, s_cur_sge, or s_cur_size.
650 * See ipath_do_rc_send().
675 */ 651 */
676 if (ipath_verbs_send(dev->dd, qp->s_hdrwords, (u32 *) &qp->s_hdr, 652 switch (opcode) {
677 0, NULL) == 0) { 653 case IB_WR_SEND:
678 qp->s_ack_state = OP(ACKNOWLEDGE); 654 case IB_WR_SEND_WITH_IMM:
679 dev->n_rc_qacks++; 655 qp->s_state = OP(RDMA_READ_RESPONSE_FIRST);
680 dev->n_unicast_xmit++; 656 break;
657
658 case IB_WR_RDMA_WRITE:
659 case IB_WR_RDMA_WRITE_WITH_IMM:
660 qp->s_state = OP(RDMA_READ_RESPONSE_LAST);
661 break;
662
663 case IB_WR_RDMA_READ:
664 qp->s_state = OP(RDMA_READ_RESPONSE_MIDDLE);
665 break;
666
667 default:
668 /*
669 * This case shouldn't happen since its only
670 * one PSN per req.
671 */
672 qp->s_state = OP(SEND_LAST);
681 } 673 }
674done:
675 qp->s_psn = psn;
682} 676}
683 677
684/** 678/**
@@ -687,13 +681,12 @@ static void send_rc_ack(struct ipath_qp *qp)
687 * @psn: packet sequence number for the request 681 * @psn: packet sequence number for the request
688 * @wc: the work completion request 682 * @wc: the work completion request
689 * 683 *
690 * The QP s_lock should be held. 684 * The QP s_lock should be held and interrupts disabled.
691 */ 685 */
692void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) 686void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
693{ 687{
694 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); 688 struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
695 struct ipath_ibdev *dev; 689 struct ipath_ibdev *dev;
696 u32 n;
697 690
698 /* 691 /*
699 * If there are no requests pending, we are done. 692 * If there are no requests pending, we are done.
@@ -735,62 +728,7 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
735 else 728 else
736 dev->n_rc_resends += (int)qp->s_psn - (int)psn; 729 dev->n_rc_resends += (int)qp->s_psn - (int)psn;
737 730
738 /* 731 reset_psn(qp, psn);
739 * If we are starting the request from the beginning, let the normal
740 * send code handle initialization.
741 */
742 qp->s_cur = qp->s_last;
743 if (ipath_cmp24(psn, wqe->psn) <= 0) {
744 qp->s_state = OP(SEND_LAST);
745 qp->s_psn = wqe->psn;
746 } else {
747 n = qp->s_cur;
748 for (;;) {
749 if (++n == qp->s_size)
750 n = 0;
751 if (n == qp->s_tail) {
752 if (ipath_cmp24(psn, qp->s_next_psn) >= 0) {
753 qp->s_cur = n;
754 wqe = get_swqe_ptr(qp, n);
755 }
756 break;
757 }
758 wqe = get_swqe_ptr(qp, n);
759 if (ipath_cmp24(psn, wqe->psn) < 0)
760 break;
761 qp->s_cur = n;
762 }
763 qp->s_psn = psn;
764
765 /*
766 * Reset the state to restart in the middle of a request.
767 * Don't change the s_sge, s_cur_sge, or s_cur_size.
768 * See ipath_do_rc_send().
769 */
770 switch (wqe->wr.opcode) {
771 case IB_WR_SEND:
772 case IB_WR_SEND_WITH_IMM:
773 qp->s_state = OP(RDMA_READ_RESPONSE_FIRST);
774 break;
775
776 case IB_WR_RDMA_WRITE:
777 case IB_WR_RDMA_WRITE_WITH_IMM:
778 qp->s_state = OP(RDMA_READ_RESPONSE_LAST);
779 break;
780
781 case IB_WR_RDMA_READ:
782 qp->s_state =
783 OP(RDMA_READ_RESPONSE_MIDDLE);
784 break;
785
786 default:
787 /*
788 * This case shouldn't happen since its only
789 * one PSN per req.
790 */
791 qp->s_state = OP(SEND_LAST);
792 }
793 }
794 732
795done: 733done:
796 tasklet_hi_schedule(&qp->s_task); 734 tasklet_hi_schedule(&qp->s_task);
@@ -800,76 +738,14 @@ bail:
800} 738}
801 739
802/** 740/**
803 * reset_psn - reset the QP state to send starting from PSN
804 * @qp: the QP
805 * @psn: the packet sequence number to restart at
806 *
807 * This is called from ipath_rc_rcv() to process an incoming RC ACK
808 * for the given QP.
809 * Called at interrupt level with the QP s_lock held.
810 */
811static void reset_psn(struct ipath_qp *qp, u32 psn)
812{
813 struct ipath_swqe *wqe;
814 u32 n;
815
816 n = qp->s_cur;
817 wqe = get_swqe_ptr(qp, n);
818 for (;;) {
819 if (++n == qp->s_size)
820 n = 0;
821 if (n == qp->s_tail) {
822 if (ipath_cmp24(psn, qp->s_next_psn) >= 0) {
823 qp->s_cur = n;
824 wqe = get_swqe_ptr(qp, n);
825 }
826 break;
827 }
828 wqe = get_swqe_ptr(qp, n);
829 if (ipath_cmp24(psn, wqe->psn) < 0)
830 break;
831 qp->s_cur = n;
832 }
833 qp->s_psn = psn;
834
835 /*
836 * Set the state to restart in the middle of a
837 * request. Don't change the s_sge, s_cur_sge, or
838 * s_cur_size. See ipath_do_rc_send().
839 */
840 switch (wqe->wr.opcode) {
841 case IB_WR_SEND:
842 case IB_WR_SEND_WITH_IMM:
843 qp->s_state = OP(RDMA_READ_RESPONSE_FIRST);
844 break;
845
846 case IB_WR_RDMA_WRITE:
847 case IB_WR_RDMA_WRITE_WITH_IMM:
848 qp->s_state = OP(RDMA_READ_RESPONSE_LAST);
849 break;
850
851 case IB_WR_RDMA_READ:
852 qp->s_state = OP(RDMA_READ_RESPONSE_MIDDLE);
853 break;
854
855 default:
856 /*
857 * This case shouldn't happen since its only
858 * one PSN per req.
859 */
860 qp->s_state = OP(SEND_LAST);
861 }
862}
863
864/**
865 * do_rc_ack - process an incoming RC ACK 741 * do_rc_ack - process an incoming RC ACK
866 * @qp: the QP the ACK came in on 742 * @qp: the QP the ACK came in on
867 * @psn: the packet sequence number of the ACK 743 * @psn: the packet sequence number of the ACK
868 * @opcode: the opcode of the request that resulted in the ACK 744 * @opcode: the opcode of the request that resulted in the ACK
869 * 745 *
870 * This is called from ipath_rc_rcv() to process an incoming RC ACK 746 * This is called from ipath_rc_rcv_resp() to process an incoming RC ACK
871 * for the given QP. 747 * for the given QP.
872 * Called at interrupt level with the QP s_lock held. 748 * Called at interrupt level with the QP s_lock held and interrupts disabled.
873 * Returns 1 if OK, 0 if current operation should be aborted (NAK). 749 * Returns 1 if OK, 0 if current operation should be aborted (NAK).
874 */ 750 */
875static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) 751static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
@@ -1006,26 +882,16 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
1006 if (qp->s_last == qp->s_tail) 882 if (qp->s_last == qp->s_tail)
1007 goto bail; 883 goto bail;
1008 884
1009 /* The last valid PSN seen is the previous request's. */ 885 /* The last valid PSN is the previous PSN. */
1010 qp->s_last_psn = wqe->psn - 1; 886 qp->s_last_psn = psn - 1;
1011 887
1012 dev->n_rc_resends += (int)qp->s_psn - (int)psn; 888 dev->n_rc_resends += (int)qp->s_psn - (int)psn;
1013 889
1014 /* 890 reset_psn(qp, psn);
1015 * If we are starting the request from the beginning, let
1016 * the normal send code handle initialization.
1017 */
1018 qp->s_cur = qp->s_last;
1019 wqe = get_swqe_ptr(qp, qp->s_cur);
1020 if (ipath_cmp24(psn, wqe->psn) <= 0) {
1021 qp->s_state = OP(SEND_LAST);
1022 qp->s_psn = wqe->psn;
1023 } else
1024 reset_psn(qp, psn);
1025 891
1026 qp->s_rnr_timeout = 892 qp->s_rnr_timeout =
1027 ib_ipath_rnr_table[(aeth >> IPS_AETH_CREDIT_SHIFT) & 893 ib_ipath_rnr_table[(aeth >> IPATH_AETH_CREDIT_SHIFT) &
1028 IPS_AETH_CREDIT_MASK]; 894 IPATH_AETH_CREDIT_MASK];
1029 ipath_insert_rnr_queue(qp); 895 ipath_insert_rnr_queue(qp);
1030 goto bail; 896 goto bail;
1031 897
@@ -1033,8 +899,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
1033 /* The last valid PSN seen is the previous request's. */ 899 /* The last valid PSN seen is the previous request's. */
1034 if (qp->s_last != qp->s_tail) 900 if (qp->s_last != qp->s_tail)
1035 qp->s_last_psn = wqe->psn - 1; 901 qp->s_last_psn = wqe->psn - 1;
1036 switch ((aeth >> IPS_AETH_CREDIT_SHIFT) & 902 switch ((aeth >> IPATH_AETH_CREDIT_SHIFT) &
1037 IPS_AETH_CREDIT_MASK) { 903 IPATH_AETH_CREDIT_MASK) {
1038 case 0: /* PSN sequence error */ 904 case 0: /* PSN sequence error */
1039 dev->n_seq_naks++; 905 dev->n_seq_naks++;
1040 /* 906 /*
@@ -1182,32 +1048,33 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1182 goto ack_done; 1048 goto ack_done;
1183 } 1049 }
1184 rdma_read: 1050 rdma_read:
1185 if (unlikely(qp->s_state != OP(RDMA_READ_REQUEST))) 1051 if (unlikely(qp->s_state != OP(RDMA_READ_REQUEST)))
1186 goto ack_done; 1052 goto ack_done;
1187 if (unlikely(tlen != (hdrsize + pmtu + 4))) 1053 if (unlikely(tlen != (hdrsize + pmtu + 4)))
1188 goto ack_done; 1054 goto ack_done;
1189 if (unlikely(pmtu >= qp->s_len)) 1055 if (unlikely(pmtu >= qp->s_len))
1190 goto ack_done; 1056 goto ack_done;
1191 /* We got a response so update the timeout. */ 1057 /* We got a response so update the timeout. */
1192 if (unlikely(qp->s_last == qp->s_tail || 1058 if (unlikely(qp->s_last == qp->s_tail ||
1193 get_swqe_ptr(qp, qp->s_last)->wr.opcode != 1059 get_swqe_ptr(qp, qp->s_last)->wr.opcode !=
1194 IB_WR_RDMA_READ)) 1060 IB_WR_RDMA_READ))
1195 goto ack_done; 1061 goto ack_done;
1196 spin_lock(&dev->pending_lock); 1062 spin_lock(&dev->pending_lock);
1197 if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait)) 1063 if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait))
1198 list_move_tail(&qp->timerwait, 1064 list_move_tail(&qp->timerwait,
1199 &dev->pending[dev->pending_index]); 1065 &dev->pending[dev->pending_index]);
1200 spin_unlock(&dev->pending_lock); 1066 spin_unlock(&dev->pending_lock);
1201 /* 1067 /*
1202 * Update the RDMA receive state but do the copy w/o holding the 1068 * Update the RDMA receive state but do the copy w/o
1203 * locks and blocking interrupts. XXX Yet another place that 1069 * holding the locks and blocking interrupts.
1204 * affects relaxed RDMA order since we don't want s_sge modified. 1070 * XXX Yet another place that affects relaxed RDMA order
1205 */ 1071 * since we don't want s_sge modified.
1206 qp->s_len -= pmtu; 1072 */
1207 qp->s_last_psn = psn; 1073 qp->s_len -= pmtu;
1208 spin_unlock_irqrestore(&qp->s_lock, flags); 1074 qp->s_last_psn = psn;
1209 ipath_copy_sge(&qp->s_sge, data, pmtu); 1075 spin_unlock_irqrestore(&qp->s_lock, flags);
1210 goto bail; 1076 ipath_copy_sge(&qp->s_sge, data, pmtu);
1077 goto bail;
1211 1078
1212 case OP(RDMA_READ_RESPONSE_LAST): 1079 case OP(RDMA_READ_RESPONSE_LAST):
1213 /* ACKs READ req. */ 1080 /* ACKs READ req. */
@@ -1230,18 +1097,12 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1230 * ICRC (4). 1097 * ICRC (4).
1231 */ 1098 */
1232 if (unlikely(tlen <= (hdrsize + pad + 8))) { 1099 if (unlikely(tlen <= (hdrsize + pad + 8))) {
1233 /* 1100 /* XXX Need to generate an error CQ entry. */
1234 * XXX Need to generate an error CQ
1235 * entry.
1236 */
1237 goto ack_done; 1101 goto ack_done;
1238 } 1102 }
1239 tlen -= hdrsize + pad + 8; 1103 tlen -= hdrsize + pad + 8;
1240 if (unlikely(tlen != qp->s_len)) { 1104 if (unlikely(tlen != qp->s_len)) {
1241 /* 1105 /* XXX Need to generate an error CQ entry. */
1242 * XXX Need to generate an error CQ
1243 * entry.
1244 */
1245 goto ack_done; 1106 goto ack_done;
1246 } 1107 }
1247 if (!header_in_data) 1108 if (!header_in_data)
@@ -1254,9 +1115,12 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1254 if (do_rc_ack(qp, aeth, psn, OP(RDMA_READ_RESPONSE_LAST))) { 1115 if (do_rc_ack(qp, aeth, psn, OP(RDMA_READ_RESPONSE_LAST))) {
1255 /* 1116 /*
1256 * Change the state so we contimue 1117 * Change the state so we contimue
1257 * processing new requests. 1118 * processing new requests and wake up the
1119 * tasklet if there are posted sends.
1258 */ 1120 */
1259 qp->s_state = OP(SEND_LAST); 1121 qp->s_state = OP(SEND_LAST);
1122 if (qp->s_tail != qp->s_head)
1123 tasklet_hi_schedule(&qp->s_task);
1260 } 1124 }
1261 goto ack_done; 1125 goto ack_done;
1262 } 1126 }
@@ -1302,18 +1166,16 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1302 * Don't queue the NAK if a RDMA read, atomic, or 1166 * Don't queue the NAK if a RDMA read, atomic, or
1303 * NAK is pending though. 1167 * NAK is pending though.
1304 */ 1168 */
1305 spin_lock(&qp->s_lock); 1169 if (qp->s_ack_state != OP(ACKNOWLEDGE) ||
1306 if ((qp->s_ack_state >= OP(RDMA_READ_REQUEST) && 1170 qp->r_nak_state != 0)
1307 qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) ||
1308 qp->s_nak_state != 0) {
1309 spin_unlock(&qp->s_lock);
1310 goto done; 1171 goto done;
1172 if (qp->r_ack_state < OP(COMPARE_SWAP)) {
1173 qp->r_ack_state = OP(SEND_ONLY);
1174 qp->r_nak_state = IB_NAK_PSN_ERROR;
1175 /* Use the expected PSN. */
1176 qp->r_ack_psn = qp->r_psn;
1311 } 1177 }
1312 qp->s_ack_state = OP(SEND_ONLY); 1178 goto send_ack;
1313 qp->s_nak_state = IB_NAK_PSN_ERROR;
1314 /* Use the expected PSN. */
1315 qp->s_ack_psn = qp->r_psn;
1316 goto resched;
1317 } 1179 }
1318 1180
1319 /* 1181 /*
@@ -1327,27 +1189,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1327 * send the earliest so that RDMA reads can be restarted at 1189 * send the earliest so that RDMA reads can be restarted at
1328 * the requester's expected PSN. 1190 * the requester's expected PSN.
1329 */ 1191 */
1330 spin_lock(&qp->s_lock); 1192 if (opcode == OP(RDMA_READ_REQUEST)) {
1331 if (qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE &&
1332 ipath_cmp24(psn, qp->s_ack_psn) >= 0) {
1333 if (qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST)
1334 qp->s_ack_psn = psn;
1335 spin_unlock(&qp->s_lock);
1336 goto done;
1337 }
1338 switch (opcode) {
1339 case OP(RDMA_READ_REQUEST):
1340 /*
1341 * We have to be careful to not change s_rdma_sge
1342 * while ipath_do_rc_send() is using it and not
1343 * holding the s_lock.
1344 */
1345 if (qp->s_ack_state != OP(ACKNOWLEDGE) &&
1346 qp->s_ack_state >= IB_OPCODE_RDMA_READ_REQUEST) {
1347 spin_unlock(&qp->s_lock);
1348 dev->n_rdma_dup_busy++;
1349 goto done;
1350 }
1351 /* RETH comes after BTH */ 1193 /* RETH comes after BTH */
1352 if (!header_in_data) 1194 if (!header_in_data)
1353 reth = &ohdr->u.rc.reth; 1195 reth = &ohdr->u.rc.reth;
@@ -1355,6 +1197,22 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1355 reth = (struct ib_reth *)data; 1197 reth = (struct ib_reth *)data;
1356 data += sizeof(*reth); 1198 data += sizeof(*reth);
1357 } 1199 }
1200 /*
1201 * If we receive a duplicate RDMA request, it means the
1202 * requester saw a sequence error and needs to restart
1203 * from an earlier point. We can abort the current
1204 * RDMA read send in that case.
1205 */
1206 spin_lock_irq(&qp->s_lock);
1207 if (qp->s_ack_state != OP(ACKNOWLEDGE) &&
1208 (qp->s_hdrwords || ipath_cmp24(psn, qp->s_ack_psn) >= 0)) {
1209 /*
1210 * We are already sending earlier requested data.
1211 * Don't abort it to send later out of sequence data.
1212 */
1213 spin_unlock_irq(&qp->s_lock);
1214 goto done;
1215 }
1358 qp->s_rdma_len = be32_to_cpu(reth->length); 1216 qp->s_rdma_len = be32_to_cpu(reth->length);
1359 if (qp->s_rdma_len != 0) { 1217 if (qp->s_rdma_len != 0) {
1360 u32 rkey = be32_to_cpu(reth->rkey); 1218 u32 rkey = be32_to_cpu(reth->rkey);
@@ -1368,8 +1226,10 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1368 ok = ipath_rkey_ok(dev, &qp->s_rdma_sge, 1226 ok = ipath_rkey_ok(dev, &qp->s_rdma_sge,
1369 qp->s_rdma_len, vaddr, rkey, 1227 qp->s_rdma_len, vaddr, rkey,
1370 IB_ACCESS_REMOTE_READ); 1228 IB_ACCESS_REMOTE_READ);
1371 if (unlikely(!ok)) 1229 if (unlikely(!ok)) {
1230 spin_unlock_irq(&qp->s_lock);
1372 goto done; 1231 goto done;
1232 }
1373 } else { 1233 } else {
1374 qp->s_rdma_sge.sg_list = NULL; 1234 qp->s_rdma_sge.sg_list = NULL;
1375 qp->s_rdma_sge.num_sge = 0; 1235 qp->s_rdma_sge.num_sge = 0;
@@ -1378,25 +1238,44 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1378 qp->s_rdma_sge.sge.length = 0; 1238 qp->s_rdma_sge.sge.length = 0;
1379 qp->s_rdma_sge.sge.sge_length = 0; 1239 qp->s_rdma_sge.sge.sge_length = 0;
1380 } 1240 }
1381 break; 1241 qp->s_ack_state = opcode;
1242 qp->s_ack_psn = psn;
1243 spin_unlock_irq(&qp->s_lock);
1244 tasklet_hi_schedule(&qp->s_task);
1245 goto send_ack;
1246 }
1247
1248 /*
1249 * A pending RDMA read will ACK anything before it so
1250 * ignore earlier duplicate requests.
1251 */
1252 if (qp->s_ack_state != OP(ACKNOWLEDGE))
1253 goto done;
1382 1254
1255 /*
1256 * If an ACK is pending, don't replace the pending ACK
1257 * with an earlier one since the later one will ACK the earlier.
1258 * Also, if we already have a pending atomic, send it.
1259 */
1260 if (qp->r_ack_state != OP(ACKNOWLEDGE) &&
1261 (ipath_cmp24(psn, qp->r_ack_psn) <= 0 ||
1262 qp->r_ack_state >= OP(COMPARE_SWAP)))
1263 goto send_ack;
1264 switch (opcode) {
1383 case OP(COMPARE_SWAP): 1265 case OP(COMPARE_SWAP):
1384 case OP(FETCH_ADD): 1266 case OP(FETCH_ADD):
1385 /* 1267 /*
1386 * Check for the PSN of the last atomic operations 1268 * Check for the PSN of the last atomic operation
1387 * performed and resend the result if found. 1269 * performed and resend the result if found.
1388 */ 1270 */
1389 if ((psn & IPS_PSN_MASK) != qp->r_atomic_psn) { 1271 if ((psn & IPATH_PSN_MASK) != qp->r_atomic_psn)
1390 spin_unlock(&qp->s_lock);
1391 goto done; 1272 goto done;
1392 }
1393 qp->s_ack_atomic = qp->r_atomic_data;
1394 break; 1273 break;
1395 } 1274 }
1396 qp->s_ack_state = opcode; 1275 qp->r_ack_state = opcode;
1397 qp->s_nak_state = 0; 1276 qp->r_nak_state = 0;
1398 qp->s_ack_psn = psn; 1277 qp->r_ack_psn = psn;
1399resched: 1278send_ack:
1400 return 0; 1279 return 0;
1401 1280
1402done: 1281done:
@@ -1424,7 +1303,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1424 u32 hdrsize; 1303 u32 hdrsize;
1425 u32 psn; 1304 u32 psn;
1426 u32 pad; 1305 u32 pad;
1427 unsigned long flags;
1428 struct ib_wc wc; 1306 struct ib_wc wc;
1429 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); 1307 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu);
1430 int diff; 1308 int diff;
@@ -1453,11 +1331,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1453 } else 1331 } else
1454 psn = be32_to_cpu(ohdr->bth[2]); 1332 psn = be32_to_cpu(ohdr->bth[2]);
1455 } 1333 }
1456 /*
1457 * The opcode is in the low byte when its in network order
1458 * (top byte when in host order).
1459 */
1460 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
1461 1334
1462 /* 1335 /*
1463 * Process responses (ACKs) before anything else. Note that the 1336 * Process responses (ACKs) before anything else. Note that the
@@ -1465,22 +1338,21 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1465 * queue rather than the expected receive packet sequence number. 1338 * queue rather than the expected receive packet sequence number.
1466 * In other words, this QP is the requester. 1339 * In other words, this QP is the requester.
1467 */ 1340 */
1341 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
1468 if (opcode >= OP(RDMA_READ_RESPONSE_FIRST) && 1342 if (opcode >= OP(RDMA_READ_RESPONSE_FIRST) &&
1469 opcode <= OP(ATOMIC_ACKNOWLEDGE)) { 1343 opcode <= OP(ATOMIC_ACKNOWLEDGE)) {
1470 ipath_rc_rcv_resp(dev, ohdr, data, tlen, qp, opcode, psn, 1344 ipath_rc_rcv_resp(dev, ohdr, data, tlen, qp, opcode, psn,
1471 hdrsize, pmtu, header_in_data); 1345 hdrsize, pmtu, header_in_data);
1472 goto bail; 1346 goto done;
1473 } 1347 }
1474 1348
1475 spin_lock_irqsave(&qp->r_rq.lock, flags);
1476
1477 /* Compute 24 bits worth of difference. */ 1349 /* Compute 24 bits worth of difference. */
1478 diff = ipath_cmp24(psn, qp->r_psn); 1350 diff = ipath_cmp24(psn, qp->r_psn);
1479 if (unlikely(diff)) { 1351 if (unlikely(diff)) {
1480 if (ipath_rc_rcv_error(dev, ohdr, data, qp, opcode, 1352 if (ipath_rc_rcv_error(dev, ohdr, data, qp, opcode,
1481 psn, diff, header_in_data)) 1353 psn, diff, header_in_data))
1482 goto done; 1354 goto done;
1483 goto resched; 1355 goto send_ack;
1484 } 1356 }
1485 1357
1486 /* Check for opcode sequence errors. */ 1358 /* Check for opcode sequence errors. */
@@ -1492,22 +1364,19 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1492 opcode == OP(SEND_LAST_WITH_IMMEDIATE)) 1364 opcode == OP(SEND_LAST_WITH_IMMEDIATE))
1493 break; 1365 break;
1494 nack_inv: 1366 nack_inv:
1495 /* 1367 /*
1496 * A NAK will ACK earlier sends and RDMA writes. Don't queue the 1368 * A NAK will ACK earlier sends and RDMA writes.
1497 * NAK if a RDMA read, atomic, or NAK is pending though. 1369 * Don't queue the NAK if a RDMA read, atomic, or NAK
1498 */ 1370 * is pending though.
1499 spin_lock(&qp->s_lock); 1371 */
1500 if (qp->s_ack_state >= OP(RDMA_READ_REQUEST) && 1372 if (qp->r_ack_state >= OP(COMPARE_SWAP))
1501 qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) { 1373 goto send_ack;
1502 spin_unlock(&qp->s_lock); 1374 /* XXX Flush WQEs */
1503 goto done; 1375 qp->state = IB_QPS_ERR;
1504 } 1376 qp->r_ack_state = OP(SEND_ONLY);
1505 /* XXX Flush WQEs */ 1377 qp->r_nak_state = IB_NAK_INVALID_REQUEST;
1506 qp->state = IB_QPS_ERR; 1378 qp->r_ack_psn = qp->r_psn;
1507 qp->s_ack_state = OP(SEND_ONLY); 1379 goto send_ack;
1508 qp->s_nak_state = IB_NAK_INVALID_REQUEST;
1509 qp->s_ack_psn = qp->r_psn;
1510 goto resched;
1511 1380
1512 case OP(RDMA_WRITE_FIRST): 1381 case OP(RDMA_WRITE_FIRST):
1513 case OP(RDMA_WRITE_MIDDLE): 1382 case OP(RDMA_WRITE_MIDDLE):
@@ -1517,20 +1386,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1517 break; 1386 break;
1518 goto nack_inv; 1387 goto nack_inv;
1519 1388
1520 case OP(RDMA_READ_REQUEST):
1521 case OP(COMPARE_SWAP):
1522 case OP(FETCH_ADD):
1523 /*
1524 * Drop all new requests until a response has been sent. A
1525 * new request then ACKs the RDMA response we sent. Relaxed
1526 * ordering would allow new requests to be processed but we
1527 * would need to keep a queue of rwqe's for all that are in
1528 * progress. Note that we can't RNR NAK this request since
1529 * the RDMA READ or atomic response is already queued to be
1530 * sent (unless we implement a response send queue).
1531 */
1532 goto done;
1533
1534 default: 1389 default:
1535 if (opcode == OP(SEND_MIDDLE) || 1390 if (opcode == OP(SEND_MIDDLE) ||
1536 opcode == OP(SEND_LAST) || 1391 opcode == OP(SEND_LAST) ||
@@ -1539,6 +1394,11 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1539 opcode == OP(RDMA_WRITE_LAST) || 1394 opcode == OP(RDMA_WRITE_LAST) ||
1540 opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE)) 1395 opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE))
1541 goto nack_inv; 1396 goto nack_inv;
1397 /*
1398 * Note that it is up to the requester to not send a new
1399 * RDMA read or atomic operation before receiving an ACK
1400 * for the previous operation.
1401 */
1542 break; 1402 break;
1543 } 1403 }
1544 1404
@@ -1555,17 +1415,12 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1555 * Don't queue the NAK if a RDMA read or atomic 1415 * Don't queue the NAK if a RDMA read or atomic
1556 * is pending though. 1416 * is pending though.
1557 */ 1417 */
1558 spin_lock(&qp->s_lock); 1418 if (qp->r_ack_state >= OP(COMPARE_SWAP))
1559 if (qp->s_ack_state >= 1419 goto send_ack;
1560 OP(RDMA_READ_REQUEST) && 1420 qp->r_ack_state = OP(SEND_ONLY);
1561 qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) { 1421 qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer;
1562 spin_unlock(&qp->s_lock); 1422 qp->r_ack_psn = qp->r_psn;
1563 goto done; 1423 goto send_ack;
1564 }
1565 qp->s_ack_state = OP(SEND_ONLY);
1566 qp->s_nak_state = IB_RNR_NAK | qp->s_min_rnr_timer;
1567 qp->s_ack_psn = qp->r_psn;
1568 goto resched;
1569 } 1424 }
1570 qp->r_rcv_len = 0; 1425 qp->r_rcv_len = 0;
1571 /* FALLTHROUGH */ 1426 /* FALLTHROUGH */
@@ -1622,7 +1477,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1622 if (unlikely(wc.byte_len > qp->r_len)) 1477 if (unlikely(wc.byte_len > qp->r_len))
1623 goto nack_inv; 1478 goto nack_inv;
1624 ipath_copy_sge(&qp->r_sge, data, tlen); 1479 ipath_copy_sge(&qp->r_sge, data, tlen);
1625 atomic_inc(&qp->msn); 1480 qp->r_msn++;
1626 if (opcode == OP(RDMA_WRITE_LAST) || 1481 if (opcode == OP(RDMA_WRITE_LAST) ||
1627 opcode == OP(RDMA_WRITE_ONLY)) 1482 opcode == OP(RDMA_WRITE_ONLY))
1628 break; 1483 break;
@@ -1666,29 +1521,8 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1666 ok = ipath_rkey_ok(dev, &qp->r_sge, 1521 ok = ipath_rkey_ok(dev, &qp->r_sge,
1667 qp->r_len, vaddr, rkey, 1522 qp->r_len, vaddr, rkey,
1668 IB_ACCESS_REMOTE_WRITE); 1523 IB_ACCESS_REMOTE_WRITE);
1669 if (unlikely(!ok)) { 1524 if (unlikely(!ok))
1670 nack_acc: 1525 goto nack_acc;
1671 /*
1672 * A NAK will ACK earlier sends and RDMA
1673 * writes. Don't queue the NAK if a RDMA
1674 * read, atomic, or NAK is pending though.
1675 */
1676 spin_lock(&qp->s_lock);
1677 if (qp->s_ack_state >=
1678 OP(RDMA_READ_REQUEST) &&
1679 qp->s_ack_state !=
1680 IB_OPCODE_ACKNOWLEDGE) {
1681 spin_unlock(&qp->s_lock);
1682 goto done;
1683 }
1684 /* XXX Flush WQEs */
1685 qp->state = IB_QPS_ERR;
1686 qp->s_ack_state = OP(RDMA_WRITE_ONLY);
1687 qp->s_nak_state =
1688 IB_NAK_REMOTE_ACCESS_ERROR;
1689 qp->s_ack_psn = qp->r_psn;
1690 goto resched;
1691 }
1692 } else { 1526 } else {
1693 qp->r_sge.sg_list = NULL; 1527 qp->r_sge.sg_list = NULL;
1694 qp->r_sge.sge.mr = NULL; 1528 qp->r_sge.sge.mr = NULL;
@@ -1715,12 +1549,10 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1715 reth = (struct ib_reth *)data; 1549 reth = (struct ib_reth *)data;
1716 data += sizeof(*reth); 1550 data += sizeof(*reth);
1717 } 1551 }
1718 spin_lock(&qp->s_lock); 1552 if (unlikely(!(qp->qp_access_flags &
1719 if (qp->s_ack_state != OP(ACKNOWLEDGE) && 1553 IB_ACCESS_REMOTE_READ)))
1720 qp->s_ack_state >= IB_OPCODE_RDMA_READ_REQUEST) { 1554 goto nack_acc;
1721 spin_unlock(&qp->s_lock); 1555 spin_lock_irq(&qp->s_lock);
1722 goto done;
1723 }
1724 qp->s_rdma_len = be32_to_cpu(reth->length); 1556 qp->s_rdma_len = be32_to_cpu(reth->length);
1725 if (qp->s_rdma_len != 0) { 1557 if (qp->s_rdma_len != 0) {
1726 u32 rkey = be32_to_cpu(reth->rkey); 1558 u32 rkey = be32_to_cpu(reth->rkey);
@@ -1732,7 +1564,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1732 qp->s_rdma_len, vaddr, rkey, 1564 qp->s_rdma_len, vaddr, rkey,
1733 IB_ACCESS_REMOTE_READ); 1565 IB_ACCESS_REMOTE_READ);
1734 if (unlikely(!ok)) { 1566 if (unlikely(!ok)) {
1735 spin_unlock(&qp->s_lock); 1567 spin_unlock_irq(&qp->s_lock);
1736 goto nack_acc; 1568 goto nack_acc;
1737 } 1569 }
1738 /* 1570 /*
@@ -1749,21 +1581,25 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1749 qp->s_rdma_sge.sge.length = 0; 1581 qp->s_rdma_sge.sge.length = 0;
1750 qp->s_rdma_sge.sge.sge_length = 0; 1582 qp->s_rdma_sge.sge.sge_length = 0;
1751 } 1583 }
1752 if (unlikely(!(qp->qp_access_flags &
1753 IB_ACCESS_REMOTE_READ)))
1754 goto nack_acc;
1755 /* 1584 /*
1756 * We need to increment the MSN here instead of when we 1585 * We need to increment the MSN here instead of when we
1757 * finish sending the result since a duplicate request would 1586 * finish sending the result since a duplicate request would
1758 * increment it more than once. 1587 * increment it more than once.
1759 */ 1588 */
1760 atomic_inc(&qp->msn); 1589 qp->r_msn++;
1590
1761 qp->s_ack_state = opcode; 1591 qp->s_ack_state = opcode;
1762 qp->s_nak_state = 0;
1763 qp->s_ack_psn = psn; 1592 qp->s_ack_psn = psn;
1593 spin_unlock_irq(&qp->s_lock);
1594
1764 qp->r_psn++; 1595 qp->r_psn++;
1765 qp->r_state = opcode; 1596 qp->r_state = opcode;
1766 goto rdmadone; 1597 qp->r_nak_state = 0;
1598
1599 /* Call ipath_do_rc_send() in another thread. */
1600 tasklet_hi_schedule(&qp->s_task);
1601
1602 goto done;
1767 1603
1768 case OP(COMPARE_SWAP): 1604 case OP(COMPARE_SWAP):
1769 case OP(FETCH_ADD): { 1605 case OP(FETCH_ADD): {
@@ -1792,7 +1628,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1792 goto nack_acc; 1628 goto nack_acc;
1793 /* Perform atomic OP and save result. */ 1629 /* Perform atomic OP and save result. */
1794 sdata = be64_to_cpu(ateth->swap_data); 1630 sdata = be64_to_cpu(ateth->swap_data);
1795 spin_lock(&dev->pending_lock); 1631 spin_lock_irq(&dev->pending_lock);
1796 qp->r_atomic_data = *(u64 *) qp->r_sge.sge.vaddr; 1632 qp->r_atomic_data = *(u64 *) qp->r_sge.sge.vaddr;
1797 if (opcode == OP(FETCH_ADD)) 1633 if (opcode == OP(FETCH_ADD))
1798 *(u64 *) qp->r_sge.sge.vaddr = 1634 *(u64 *) qp->r_sge.sge.vaddr =
@@ -1800,9 +1636,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1800 else if (qp->r_atomic_data == 1636 else if (qp->r_atomic_data ==
1801 be64_to_cpu(ateth->compare_data)) 1637 be64_to_cpu(ateth->compare_data))
1802 *(u64 *) qp->r_sge.sge.vaddr = sdata; 1638 *(u64 *) qp->r_sge.sge.vaddr = sdata;
1803 spin_unlock(&dev->pending_lock); 1639 spin_unlock_irq(&dev->pending_lock);
1804 atomic_inc(&qp->msn); 1640 qp->r_msn++;
1805 qp->r_atomic_psn = psn & IPS_PSN_MASK; 1641 qp->r_atomic_psn = psn & IPATH_PSN_MASK;
1806 psn |= 1 << 31; 1642 psn |= 1 << 31;
1807 break; 1643 break;
1808 } 1644 }
@@ -1813,44 +1649,39 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1813 } 1649 }
1814 qp->r_psn++; 1650 qp->r_psn++;
1815 qp->r_state = opcode; 1651 qp->r_state = opcode;
1652 qp->r_nak_state = 0;
1816 /* Send an ACK if requested or required. */ 1653 /* Send an ACK if requested or required. */
1817 if (psn & (1 << 31)) { 1654 if (psn & (1 << 31)) {
1818 /* 1655 /*
1819 * Coalesce ACKs unless there is a RDMA READ or 1656 * Coalesce ACKs unless there is a RDMA READ or
1820 * ATOMIC pending. 1657 * ATOMIC pending.
1821 */ 1658 */
1822 spin_lock(&qp->s_lock); 1659 if (qp->r_ack_state < OP(COMPARE_SWAP)) {
1823 if (qp->s_ack_state == OP(ACKNOWLEDGE) || 1660 qp->r_ack_state = opcode;
1824 qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST) { 1661 qp->r_ack_psn = psn;
1825 qp->s_ack_state = opcode;
1826 qp->s_nak_state = 0;
1827 qp->s_ack_psn = psn;
1828 qp->s_ack_atomic = qp->r_atomic_data;
1829 goto resched;
1830 } 1662 }
1831 spin_unlock(&qp->s_lock); 1663 goto send_ack;
1832 } 1664 }
1833done: 1665 goto done;
1834 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
1835 goto bail;
1836 1666
1837resched: 1667nack_acc:
1838 /* 1668 /*
1839 * Try to send ACK right away but not if ipath_do_rc_send() is 1669 * A NAK will ACK earlier sends and RDMA writes.
1840 * active. 1670 * Don't queue the NAK if a RDMA read, atomic, or NAK
1671 * is pending though.
1841 */ 1672 */
1842 if (qp->s_hdrwords == 0 && 1673 if (qp->r_ack_state < OP(COMPARE_SWAP)) {
1843 (qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST || 1674 /* XXX Flush WQEs */
1844 qp->s_ack_state >= IB_OPCODE_COMPARE_SWAP)) 1675 qp->state = IB_QPS_ERR;
1676 qp->r_ack_state = OP(RDMA_WRITE_ONLY);
1677 qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR;
1678 qp->r_ack_psn = qp->r_psn;
1679 }
1680send_ack:
1681 /* Send ACK right away unless the send tasklet has a pending ACK. */
1682 if (qp->s_ack_state == OP(ACKNOWLEDGE))
1845 send_rc_ack(qp); 1683 send_rc_ack(qp);
1846 1684
1847rdmadone: 1685done:
1848 spin_unlock(&qp->s_lock);
1849 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
1850
1851 /* Call ipath_do_rc_send() in another thread. */
1852 tasklet_hi_schedule(&qp->s_task);
1853
1854bail:
1855 return; 1686 return;
1856} 1687}
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h
index 402126eb79c9..89df8f5ea998 100644
--- a/drivers/infiniband/hw/ipath/ipath_registers.h
+++ b/drivers/infiniband/hw/ipath/ipath_registers.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index d38f4f3cfd1d..772bc59fb85c 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -31,6 +32,7 @@
31 */ 32 */
32 33
33#include "ipath_verbs.h" 34#include "ipath_verbs.h"
35#include "ipath_common.h"
34 36
35/* 37/*
36 * Convert the AETH RNR timeout code into the number of milliseconds. 38 * Convert the AETH RNR timeout code into the number of milliseconds.
@@ -111,20 +113,23 @@ void ipath_insert_rnr_queue(struct ipath_qp *qp)
111 * 113 *
112 * Return 0 if no RWQE is available, otherwise return 1. 114 * Return 0 if no RWQE is available, otherwise return 1.
113 * 115 *
114 * Called at interrupt level with the QP r_rq.lock held. 116 * Can be called from interrupt level.
115 */ 117 */
116int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) 118int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
117{ 119{
120 unsigned long flags;
118 struct ipath_rq *rq; 121 struct ipath_rq *rq;
119 struct ipath_srq *srq; 122 struct ipath_srq *srq;
120 struct ipath_rwqe *wqe; 123 struct ipath_rwqe *wqe;
121 int ret; 124 int ret = 1;
122 125
123 if (!qp->ibqp.srq) { 126 if (!qp->ibqp.srq) {
124 rq = &qp->r_rq; 127 rq = &qp->r_rq;
128 spin_lock_irqsave(&rq->lock, flags);
129
125 if (unlikely(rq->tail == rq->head)) { 130 if (unlikely(rq->tail == rq->head)) {
126 ret = 0; 131 ret = 0;
127 goto bail; 132 goto done;
128 } 133 }
129 wqe = get_rwqe_ptr(rq, rq->tail); 134 wqe = get_rwqe_ptr(rq, rq->tail);
130 qp->r_wr_id = wqe->wr_id; 135 qp->r_wr_id = wqe->wr_id;
@@ -136,17 +141,16 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
136 } 141 }
137 if (++rq->tail >= rq->size) 142 if (++rq->tail >= rq->size)
138 rq->tail = 0; 143 rq->tail = 0;
139 ret = 1; 144 goto done;
140 goto bail;
141 } 145 }
142 146
143 srq = to_isrq(qp->ibqp.srq); 147 srq = to_isrq(qp->ibqp.srq);
144 rq = &srq->rq; 148 rq = &srq->rq;
145 spin_lock(&rq->lock); 149 spin_lock_irqsave(&rq->lock, flags);
150
146 if (unlikely(rq->tail == rq->head)) { 151 if (unlikely(rq->tail == rq->head)) {
147 spin_unlock(&rq->lock);
148 ret = 0; 152 ret = 0;
149 goto bail; 153 goto done;
150 } 154 }
151 wqe = get_rwqe_ptr(rq, rq->tail); 155 wqe = get_rwqe_ptr(rq, rq->tail);
152 qp->r_wr_id = wqe->wr_id; 156 qp->r_wr_id = wqe->wr_id;
@@ -168,18 +172,18 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
168 n = rq->head - rq->tail; 172 n = rq->head - rq->tail;
169 if (n < srq->limit) { 173 if (n < srq->limit) {
170 srq->limit = 0; 174 srq->limit = 0;
171 spin_unlock(&rq->lock); 175 spin_unlock_irqrestore(&rq->lock, flags);
172 ev.device = qp->ibqp.device; 176 ev.device = qp->ibqp.device;
173 ev.element.srq = qp->ibqp.srq; 177 ev.element.srq = qp->ibqp.srq;
174 ev.event = IB_EVENT_SRQ_LIMIT_REACHED; 178 ev.event = IB_EVENT_SRQ_LIMIT_REACHED;
175 srq->ibsrq.event_handler(&ev, 179 srq->ibsrq.event_handler(&ev,
176 srq->ibsrq.srq_context); 180 srq->ibsrq.srq_context);
177 } else 181 goto bail;
178 spin_unlock(&rq->lock); 182 }
179 } else 183 }
180 spin_unlock(&rq->lock);
181 ret = 1;
182 184
185done:
186 spin_unlock_irqrestore(&rq->lock, flags);
183bail: 187bail:
184 return ret; 188 return ret;
185} 189}
@@ -187,7 +191,6 @@ bail:
187/** 191/**
188 * ipath_ruc_loopback - handle UC and RC lookback requests 192 * ipath_ruc_loopback - handle UC and RC lookback requests
189 * @sqp: the loopback QP 193 * @sqp: the loopback QP
190 * @wc: the work completion entry
191 * 194 *
192 * This is called from ipath_do_uc_send() or ipath_do_rc_send() to 195 * This is called from ipath_do_uc_send() or ipath_do_rc_send() to
193 * forward a WQE addressed to the same HCA. 196 * forward a WQE addressed to the same HCA.
@@ -196,13 +199,14 @@ bail:
196 * receive interrupts since this is a connected protocol and all packets 199 * receive interrupts since this is a connected protocol and all packets
197 * will pass through here. 200 * will pass through here.
198 */ 201 */
199void ipath_ruc_loopback(struct ipath_qp *sqp, struct ib_wc *wc) 202static void ipath_ruc_loopback(struct ipath_qp *sqp)
200{ 203{
201 struct ipath_ibdev *dev = to_idev(sqp->ibqp.device); 204 struct ipath_ibdev *dev = to_idev(sqp->ibqp.device);
202 struct ipath_qp *qp; 205 struct ipath_qp *qp;
203 struct ipath_swqe *wqe; 206 struct ipath_swqe *wqe;
204 struct ipath_sge *sge; 207 struct ipath_sge *sge;
205 unsigned long flags; 208 unsigned long flags;
209 struct ib_wc wc;
206 u64 sdata; 210 u64 sdata;
207 211
208 qp = ipath_lookup_qpn(&dev->qp_table, sqp->remote_qpn); 212 qp = ipath_lookup_qpn(&dev->qp_table, sqp->remote_qpn);
@@ -233,8 +237,8 @@ again:
233 wqe = get_swqe_ptr(sqp, sqp->s_last); 237 wqe = get_swqe_ptr(sqp, sqp->s_last);
234 spin_unlock_irqrestore(&sqp->s_lock, flags); 238 spin_unlock_irqrestore(&sqp->s_lock, flags);
235 239
236 wc->wc_flags = 0; 240 wc.wc_flags = 0;
237 wc->imm_data = 0; 241 wc.imm_data = 0;
238 242
239 sqp->s_sge.sge = wqe->sg_list[0]; 243 sqp->s_sge.sge = wqe->sg_list[0];
240 sqp->s_sge.sg_list = wqe->sg_list + 1; 244 sqp->s_sge.sg_list = wqe->sg_list + 1;
@@ -242,39 +246,34 @@ again:
242 sqp->s_len = wqe->length; 246 sqp->s_len = wqe->length;
243 switch (wqe->wr.opcode) { 247 switch (wqe->wr.opcode) {
244 case IB_WR_SEND_WITH_IMM: 248 case IB_WR_SEND_WITH_IMM:
245 wc->wc_flags = IB_WC_WITH_IMM; 249 wc.wc_flags = IB_WC_WITH_IMM;
246 wc->imm_data = wqe->wr.imm_data; 250 wc.imm_data = wqe->wr.imm_data;
247 /* FALLTHROUGH */ 251 /* FALLTHROUGH */
248 case IB_WR_SEND: 252 case IB_WR_SEND:
249 spin_lock_irqsave(&qp->r_rq.lock, flags);
250 if (!ipath_get_rwqe(qp, 0)) { 253 if (!ipath_get_rwqe(qp, 0)) {
251 rnr_nak: 254 rnr_nak:
252 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
253 /* Handle RNR NAK */ 255 /* Handle RNR NAK */
254 if (qp->ibqp.qp_type == IB_QPT_UC) 256 if (qp->ibqp.qp_type == IB_QPT_UC)
255 goto send_comp; 257 goto send_comp;
256 if (sqp->s_rnr_retry == 0) { 258 if (sqp->s_rnr_retry == 0) {
257 wc->status = IB_WC_RNR_RETRY_EXC_ERR; 259 wc.status = IB_WC_RNR_RETRY_EXC_ERR;
258 goto err; 260 goto err;
259 } 261 }
260 if (sqp->s_rnr_retry_cnt < 7) 262 if (sqp->s_rnr_retry_cnt < 7)
261 sqp->s_rnr_retry--; 263 sqp->s_rnr_retry--;
262 dev->n_rnr_naks++; 264 dev->n_rnr_naks++;
263 sqp->s_rnr_timeout = 265 sqp->s_rnr_timeout =
264 ib_ipath_rnr_table[sqp->s_min_rnr_timer]; 266 ib_ipath_rnr_table[sqp->r_min_rnr_timer];
265 ipath_insert_rnr_queue(sqp); 267 ipath_insert_rnr_queue(sqp);
266 goto done; 268 goto done;
267 } 269 }
268 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
269 break; 270 break;
270 271
271 case IB_WR_RDMA_WRITE_WITH_IMM: 272 case IB_WR_RDMA_WRITE_WITH_IMM:
272 wc->wc_flags = IB_WC_WITH_IMM; 273 wc.wc_flags = IB_WC_WITH_IMM;
273 wc->imm_data = wqe->wr.imm_data; 274 wc.imm_data = wqe->wr.imm_data;
274 spin_lock_irqsave(&qp->r_rq.lock, flags);
275 if (!ipath_get_rwqe(qp, 1)) 275 if (!ipath_get_rwqe(qp, 1))
276 goto rnr_nak; 276 goto rnr_nak;
277 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
278 /* FALLTHROUGH */ 277 /* FALLTHROUGH */
279 case IB_WR_RDMA_WRITE: 278 case IB_WR_RDMA_WRITE:
280 if (wqe->length == 0) 279 if (wqe->length == 0)
@@ -284,20 +283,20 @@ again:
284 wqe->wr.wr.rdma.rkey, 283 wqe->wr.wr.rdma.rkey,
285 IB_ACCESS_REMOTE_WRITE))) { 284 IB_ACCESS_REMOTE_WRITE))) {
286 acc_err: 285 acc_err:
287 wc->status = IB_WC_REM_ACCESS_ERR; 286 wc.status = IB_WC_REM_ACCESS_ERR;
288 err: 287 err:
289 wc->wr_id = wqe->wr.wr_id; 288 wc.wr_id = wqe->wr.wr_id;
290 wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 289 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
291 wc->vendor_err = 0; 290 wc.vendor_err = 0;
292 wc->byte_len = 0; 291 wc.byte_len = 0;
293 wc->qp_num = sqp->ibqp.qp_num; 292 wc.qp_num = sqp->ibqp.qp_num;
294 wc->src_qp = sqp->remote_qpn; 293 wc.src_qp = sqp->remote_qpn;
295 wc->pkey_index = 0; 294 wc.pkey_index = 0;
296 wc->slid = sqp->remote_ah_attr.dlid; 295 wc.slid = sqp->remote_ah_attr.dlid;
297 wc->sl = sqp->remote_ah_attr.sl; 296 wc.sl = sqp->remote_ah_attr.sl;
298 wc->dlid_path_bits = 0; 297 wc.dlid_path_bits = 0;
299 wc->port_num = 0; 298 wc.port_num = 0;
300 ipath_sqerror_qp(sqp, wc); 299 ipath_sqerror_qp(sqp, &wc);
301 goto done; 300 goto done;
302 } 301 }
303 break; 302 break;
@@ -373,22 +372,22 @@ again:
373 goto send_comp; 372 goto send_comp;
374 373
375 if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM) 374 if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM)
376 wc->opcode = IB_WC_RECV_RDMA_WITH_IMM; 375 wc.opcode = IB_WC_RECV_RDMA_WITH_IMM;
377 else 376 else
378 wc->opcode = IB_WC_RECV; 377 wc.opcode = IB_WC_RECV;
379 wc->wr_id = qp->r_wr_id; 378 wc.wr_id = qp->r_wr_id;
380 wc->status = IB_WC_SUCCESS; 379 wc.status = IB_WC_SUCCESS;
381 wc->vendor_err = 0; 380 wc.vendor_err = 0;
382 wc->byte_len = wqe->length; 381 wc.byte_len = wqe->length;
383 wc->qp_num = qp->ibqp.qp_num; 382 wc.qp_num = qp->ibqp.qp_num;
384 wc->src_qp = qp->remote_qpn; 383 wc.src_qp = qp->remote_qpn;
385 /* XXX do we know which pkey matched? Only needed for GSI. */ 384 /* XXX do we know which pkey matched? Only needed for GSI. */
386 wc->pkey_index = 0; 385 wc.pkey_index = 0;
387 wc->slid = qp->remote_ah_attr.dlid; 386 wc.slid = qp->remote_ah_attr.dlid;
388 wc->sl = qp->remote_ah_attr.sl; 387 wc.sl = qp->remote_ah_attr.sl;
389 wc->dlid_path_bits = 0; 388 wc.dlid_path_bits = 0;
390 /* Signal completion event if the solicited bit is set. */ 389 /* Signal completion event if the solicited bit is set. */
391 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), wc, 390 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
392 wqe->wr.send_flags & IB_SEND_SOLICITED); 391 wqe->wr.send_flags & IB_SEND_SOLICITED);
393 392
394send_comp: 393send_comp:
@@ -396,19 +395,19 @@ send_comp:
396 395
397 if (!test_bit(IPATH_S_SIGNAL_REQ_WR, &sqp->s_flags) || 396 if (!test_bit(IPATH_S_SIGNAL_REQ_WR, &sqp->s_flags) ||
398 (wqe->wr.send_flags & IB_SEND_SIGNALED)) { 397 (wqe->wr.send_flags & IB_SEND_SIGNALED)) {
399 wc->wr_id = wqe->wr.wr_id; 398 wc.wr_id = wqe->wr.wr_id;
400 wc->status = IB_WC_SUCCESS; 399 wc.status = IB_WC_SUCCESS;
401 wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; 400 wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode];
402 wc->vendor_err = 0; 401 wc.vendor_err = 0;
403 wc->byte_len = wqe->length; 402 wc.byte_len = wqe->length;
404 wc->qp_num = sqp->ibqp.qp_num; 403 wc.qp_num = sqp->ibqp.qp_num;
405 wc->src_qp = 0; 404 wc.src_qp = 0;
406 wc->pkey_index = 0; 405 wc.pkey_index = 0;
407 wc->slid = 0; 406 wc.slid = 0;
408 wc->sl = 0; 407 wc.sl = 0;
409 wc->dlid_path_bits = 0; 408 wc.dlid_path_bits = 0;
410 wc->port_num = 0; 409 wc.port_num = 0;
411 ipath_cq_enter(to_icq(sqp->ibqp.send_cq), wc, 0); 410 ipath_cq_enter(to_icq(sqp->ibqp.send_cq), &wc, 0);
412 } 411 }
413 412
414 /* Update s_last now that we are finished with the SWQE */ 413 /* Update s_last now that we are finished with the SWQE */
@@ -454,11 +453,11 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev)
454} 453}
455 454
456/** 455/**
457 * ipath_post_rc_send - post RC and UC sends 456 * ipath_post_ruc_send - post RC and UC sends
458 * @qp: the QP to post on 457 * @qp: the QP to post on
459 * @wr: the work request to send 458 * @wr: the work request to send
460 */ 459 */
461int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr) 460int ipath_post_ruc_send(struct ipath_qp *qp, struct ib_send_wr *wr)
462{ 461{
463 struct ipath_swqe *wqe; 462 struct ipath_swqe *wqe;
464 unsigned long flags; 463 unsigned long flags;
@@ -533,13 +532,149 @@ int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr)
533 qp->s_head = next; 532 qp->s_head = next;
534 spin_unlock_irqrestore(&qp->s_lock, flags); 533 spin_unlock_irqrestore(&qp->s_lock, flags);
535 534
536 if (qp->ibqp.qp_type == IB_QPT_UC) 535 ipath_do_ruc_send((unsigned long) qp);
537 ipath_do_uc_send((unsigned long) qp);
538 else
539 ipath_do_rc_send((unsigned long) qp);
540 536
541 ret = 0; 537 ret = 0;
542 538
543bail: 539bail:
544 return ret; 540 return ret;
545} 541}
542
543/**
544 * ipath_make_grh - construct a GRH header
545 * @dev: a pointer to the ipath device
546 * @hdr: a pointer to the GRH header being constructed
547 * @grh: the global route address to send to
548 * @hwords: the number of 32 bit words of header being sent
549 * @nwords: the number of 32 bit words of data being sent
550 *
551 * Return the size of the header in 32 bit words.
552 */
553u32 ipath_make_grh(struct ipath_ibdev *dev, struct ib_grh *hdr,
554 struct ib_global_route *grh, u32 hwords, u32 nwords)
555{
556 hdr->version_tclass_flow =
557 cpu_to_be32((6 << 28) |
558 (grh->traffic_class << 20) |
559 grh->flow_label);
560 hdr->paylen = cpu_to_be16((hwords - 2 + nwords + SIZE_OF_CRC) << 2);
561 /* next_hdr is defined by C8-7 in ch. 8.4.1 */
562 hdr->next_hdr = 0x1B;
563 hdr->hop_limit = grh->hop_limit;
564 /* The SGID is 32-bit aligned. */
565 hdr->sgid.global.subnet_prefix = dev->gid_prefix;
566 hdr->sgid.global.interface_id = ipath_layer_get_guid(dev->dd);
567 hdr->dgid = grh->dgid;
568
569 /* GRH header size in 32-bit words. */
570 return sizeof(struct ib_grh) / sizeof(u32);
571}
572
573/**
574 * ipath_do_ruc_send - perform a send on an RC or UC QP
575 * @data: contains a pointer to the QP
576 *
577 * Process entries in the send work queue until credit or queue is
578 * exhausted. Only allow one CPU to send a packet per QP (tasklet).
579 * Otherwise, after we drop the QP s_lock, two threads could send
580 * packets out of order.
581 */
582void ipath_do_ruc_send(unsigned long data)
583{
584 struct ipath_qp *qp = (struct ipath_qp *)data;
585 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
586 unsigned long flags;
587 u16 lrh0;
588 u32 nwords;
589 u32 extra_bytes;
590 u32 bth0;
591 u32 bth2;
592 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu);
593 struct ipath_other_headers *ohdr;
594
595 if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags))
596 goto bail;
597
598 if (unlikely(qp->remote_ah_attr.dlid ==
599 ipath_layer_get_lid(dev->dd))) {
600 ipath_ruc_loopback(qp);
601 goto clear;
602 }
603
604 ohdr = &qp->s_hdr.u.oth;
605 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH)
606 ohdr = &qp->s_hdr.u.l.oth;
607
608again:
609 /* Check for a constructed packet to be sent. */
610 if (qp->s_hdrwords != 0) {
611 /*
612 * If no PIO bufs are available, return. An interrupt will
613 * call ipath_ib_piobufavail() when one is available.
614 */
615 if (ipath_verbs_send(dev->dd, qp->s_hdrwords,
616 (u32 *) &qp->s_hdr, qp->s_cur_size,
617 qp->s_cur_sge)) {
618 ipath_no_bufs_available(qp, dev);
619 goto bail;
620 }
621 dev->n_unicast_xmit++;
622 /* Record that we sent the packet and s_hdr is empty. */
623 qp->s_hdrwords = 0;
624 }
625
626 /*
627 * The lock is needed to synchronize between setting
628 * qp->s_ack_state, resend timer, and post_send().
629 */
630 spin_lock_irqsave(&qp->s_lock, flags);
631
632 /* Sending responses has higher priority over sending requests. */
633 if (qp->s_ack_state != IB_OPCODE_RC_ACKNOWLEDGE &&
634 (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0)
635 bth2 = qp->s_ack_psn++ & IPATH_PSN_MASK;
636 else if (!((qp->ibqp.qp_type == IB_QPT_RC) ?
637 ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2) :
638 ipath_make_uc_req(qp, ohdr, pmtu, &bth0, &bth2))) {
639 /*
640 * Clear the busy bit before unlocking to avoid races with
641 * adding new work queue items and then failing to process
642 * them.
643 */
644 clear_bit(IPATH_S_BUSY, &qp->s_flags);
645 spin_unlock_irqrestore(&qp->s_lock, flags);
646 goto bail;
647 }
648
649 spin_unlock_irqrestore(&qp->s_lock, flags);
650
651 /* Construct the header. */
652 extra_bytes = (4 - qp->s_cur_size) & 3;
653 nwords = (qp->s_cur_size + extra_bytes) >> 2;
654 lrh0 = IPATH_LRH_BTH;
655 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) {
656 qp->s_hdrwords += ipath_make_grh(dev, &qp->s_hdr.u.l.grh,
657 &qp->remote_ah_attr.grh,
658 qp->s_hdrwords, nwords);
659 lrh0 = IPATH_LRH_GRH;
660 }
661 lrh0 |= qp->remote_ah_attr.sl << 4;
662 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0);
663 qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid);
664 qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords +
665 SIZE_OF_CRC);
666 qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
667 bth0 |= ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
668 bth0 |= extra_bytes << 20;
669 ohdr->bth[0] = cpu_to_be32(bth0);
670 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
671 ohdr->bth[2] = cpu_to_be32(bth2);
672
673 /* Check for more work to do. */
674 goto again;
675
676clear:
677 clear_bit(IPATH_S_BUSY, &qp->s_flags);
678bail:
679 return;
680}
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c
index 01c4c6c56118..f760434660bd 100644
--- a/drivers/infiniband/hw/ipath/ipath_srq.c
+++ b/drivers/infiniband/hw/ipath/ipath_srq.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -125,11 +126,23 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
125 struct ib_srq_init_attr *srq_init_attr, 126 struct ib_srq_init_attr *srq_init_attr,
126 struct ib_udata *udata) 127 struct ib_udata *udata)
127{ 128{
129 struct ipath_ibdev *dev = to_idev(ibpd->device);
128 struct ipath_srq *srq; 130 struct ipath_srq *srq;
129 u32 sz; 131 u32 sz;
130 struct ib_srq *ret; 132 struct ib_srq *ret;
131 133
132 if (srq_init_attr->attr.max_sge < 1) { 134 if (dev->n_srqs_allocated == ib_ipath_max_srqs) {
135 ret = ERR_PTR(-ENOMEM);
136 goto bail;
137 }
138
139 if (srq_init_attr->attr.max_wr == 0) {
140 ret = ERR_PTR(-EINVAL);
141 goto bail;
142 }
143
144 if ((srq_init_attr->attr.max_sge > ib_ipath_max_srq_sges) ||
145 (srq_init_attr->attr.max_wr > ib_ipath_max_srq_wrs)) {
133 ret = ERR_PTR(-EINVAL); 146 ret = ERR_PTR(-EINVAL);
134 goto bail; 147 goto bail;
135 } 148 }
@@ -164,6 +177,8 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
164 177
165 ret = &srq->ibsrq; 178 ret = &srq->ibsrq;
166 179
180 dev->n_srqs_allocated++;
181
167bail: 182bail:
168 return ret; 183 return ret;
169} 184}
@@ -181,24 +196,26 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
181 unsigned long flags; 196 unsigned long flags;
182 int ret; 197 int ret;
183 198
184 if (attr_mask & IB_SRQ_LIMIT) { 199 if (attr_mask & IB_SRQ_MAX_WR)
185 spin_lock_irqsave(&srq->rq.lock, flags); 200 if ((attr->max_wr > ib_ipath_max_srq_wrs) ||
186 srq->limit = attr->srq_limit; 201 (attr->max_sge > srq->rq.max_sge)) {
187 spin_unlock_irqrestore(&srq->rq.lock, flags); 202 ret = -EINVAL;
188 } 203 goto bail;
189 if (attr_mask & IB_SRQ_MAX_WR) { 204 }
190 u32 size = attr->max_wr + 1;
191 struct ipath_rwqe *wq, *p;
192 u32 n;
193 u32 sz;
194 205
195 if (attr->max_sge < srq->rq.max_sge) { 206 if (attr_mask & IB_SRQ_LIMIT)
207 if (attr->srq_limit >= srq->rq.size) {
196 ret = -EINVAL; 208 ret = -EINVAL;
197 goto bail; 209 goto bail;
198 } 210 }
199 211
212 if (attr_mask & IB_SRQ_MAX_WR) {
213 struct ipath_rwqe *wq, *p;
214 u32 sz, size, n;
215
200 sz = sizeof(struct ipath_rwqe) + 216 sz = sizeof(struct ipath_rwqe) +
201 attr->max_sge * sizeof(struct ipath_sge); 217 attr->max_sge * sizeof(struct ipath_sge);
218 size = attr->max_wr + 1;
202 wq = vmalloc(size * sz); 219 wq = vmalloc(size * sz);
203 if (!wq) { 220 if (!wq) {
204 ret = -ENOMEM; 221 ret = -ENOMEM;
@@ -242,6 +259,11 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
242 spin_unlock_irqrestore(&srq->rq.lock, flags); 259 spin_unlock_irqrestore(&srq->rq.lock, flags);
243 } 260 }
244 261
262 if (attr_mask & IB_SRQ_LIMIT) {
263 spin_lock_irqsave(&srq->rq.lock, flags);
264 srq->limit = attr->srq_limit;
265 spin_unlock_irqrestore(&srq->rq.lock, flags);
266 }
245 ret = 0; 267 ret = 0;
246 268
247bail: 269bail:
@@ -265,7 +287,9 @@ int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
265int ipath_destroy_srq(struct ib_srq *ibsrq) 287int ipath_destroy_srq(struct ib_srq *ibsrq)
266{ 288{
267 struct ipath_srq *srq = to_isrq(ibsrq); 289 struct ipath_srq *srq = to_isrq(ibsrq);
290 struct ipath_ibdev *dev = to_idev(ibsrq->device);
268 291
292 dev->n_srqs_allocated--;
269 vfree(srq->rq.wq); 293 vfree(srq->rq.wq);
270 kfree(srq); 294 kfree(srq);
271 295
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c
index fe209137ee74..70351b7e35c0 100644
--- a/drivers/infiniband/hw/ipath/ipath_stats.c
+++ b/drivers/infiniband/hw/ipath/ipath_stats.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -185,7 +186,6 @@ static void ipath_qcheck(struct ipath_devdata *dd)
185 dd->ipath_port0head, 186 dd->ipath_port0head,
186 (unsigned long long) 187 (unsigned long long)
187 ipath_stats.sps_port0pkts); 188 ipath_stats.sps_port0pkts);
188 ipath_kreceive(dd);
189 } 189 }
190 dd->ipath_lastport0rcv_cnt = ipath_stats.sps_port0pkts; 190 dd->ipath_lastport0rcv_cnt = ipath_stats.sps_port0pkts;
191 } 191 }
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index f323791cc495..b98821d7801d 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -34,8 +35,8 @@
34#include <linux/pci.h> 35#include <linux/pci.h>
35 36
36#include "ipath_kernel.h" 37#include "ipath_kernel.h"
37#include "ips_common.h"
38#include "ipath_layer.h" 38#include "ipath_layer.h"
39#include "ipath_common.h"
39 40
40/** 41/**
41 * ipath_parse_ushort - parse an unsigned short value in an arbitrary base 42 * ipath_parse_ushort - parse an unsigned short value in an arbitrary base
@@ -84,99 +85,6 @@ static ssize_t show_num_units(struct device_driver *dev, char *buf)
84 ipath_count_units(NULL, NULL, NULL)); 85 ipath_count_units(NULL, NULL, NULL));
85} 86}
86 87
87#define DRIVER_STAT(name, attr) \
88 static ssize_t show_stat_##name(struct device_driver *dev, \
89 char *buf) \
90 { \
91 return scnprintf( \
92 buf, PAGE_SIZE, "%llu\n", \
93 (unsigned long long) ipath_stats.sps_ ##attr); \
94 } \
95 static DRIVER_ATTR(name, S_IRUGO, show_stat_##name, NULL)
96
97DRIVER_STAT(intrs, ints);
98DRIVER_STAT(err_intrs, errints);
99DRIVER_STAT(errs, errs);
100DRIVER_STAT(pkt_errs, pkterrs);
101DRIVER_STAT(crc_errs, crcerrs);
102DRIVER_STAT(hw_errs, hwerrs);
103DRIVER_STAT(ib_link, iblink);
104DRIVER_STAT(port0_pkts, port0pkts);
105DRIVER_STAT(ether_spkts, ether_spkts);
106DRIVER_STAT(ether_rpkts, ether_rpkts);
107DRIVER_STAT(sma_spkts, sma_spkts);
108DRIVER_STAT(sma_rpkts, sma_rpkts);
109DRIVER_STAT(hdrq_full, hdrqfull);
110DRIVER_STAT(etid_full, etidfull);
111DRIVER_STAT(no_piobufs, nopiobufs);
112DRIVER_STAT(ports, ports);
113DRIVER_STAT(pkey0, pkeys[0]);
114DRIVER_STAT(pkey1, pkeys[1]);
115DRIVER_STAT(pkey2, pkeys[2]);
116DRIVER_STAT(pkey3, pkeys[3]);
117/* XXX fix the following when dynamic table of devices used */
118DRIVER_STAT(lid0, lid[0]);
119DRIVER_STAT(lid1, lid[1]);
120DRIVER_STAT(lid2, lid[2]);
121DRIVER_STAT(lid3, lid[3]);
122
123DRIVER_STAT(nports, nports);
124DRIVER_STAT(null_intr, nullintr);
125DRIVER_STAT(max_pkts_call, maxpkts_call);
126DRIVER_STAT(avg_pkts_call, avgpkts_call);
127DRIVER_STAT(page_locks, pagelocks);
128DRIVER_STAT(page_unlocks, pageunlocks);
129DRIVER_STAT(krdrops, krdrops);
130/* XXX fix the following when dynamic table of devices used */
131DRIVER_STAT(mlid0, mlid[0]);
132DRIVER_STAT(mlid1, mlid[1]);
133DRIVER_STAT(mlid2, mlid[2]);
134DRIVER_STAT(mlid3, mlid[3]);
135
136static struct attribute *driver_stat_attributes[] = {
137 &driver_attr_intrs.attr,
138 &driver_attr_err_intrs.attr,
139 &driver_attr_errs.attr,
140 &driver_attr_pkt_errs.attr,
141 &driver_attr_crc_errs.attr,
142 &driver_attr_hw_errs.attr,
143 &driver_attr_ib_link.attr,
144 &driver_attr_port0_pkts.attr,
145 &driver_attr_ether_spkts.attr,
146 &driver_attr_ether_rpkts.attr,
147 &driver_attr_sma_spkts.attr,
148 &driver_attr_sma_rpkts.attr,
149 &driver_attr_hdrq_full.attr,
150 &driver_attr_etid_full.attr,
151 &driver_attr_no_piobufs.attr,
152 &driver_attr_ports.attr,
153 &driver_attr_pkey0.attr,
154 &driver_attr_pkey1.attr,
155 &driver_attr_pkey2.attr,
156 &driver_attr_pkey3.attr,
157 &driver_attr_lid0.attr,
158 &driver_attr_lid1.attr,
159 &driver_attr_lid2.attr,
160 &driver_attr_lid3.attr,
161 &driver_attr_nports.attr,
162 &driver_attr_null_intr.attr,
163 &driver_attr_max_pkts_call.attr,
164 &driver_attr_avg_pkts_call.attr,
165 &driver_attr_page_locks.attr,
166 &driver_attr_page_unlocks.attr,
167 &driver_attr_krdrops.attr,
168 &driver_attr_mlid0.attr,
169 &driver_attr_mlid1.attr,
170 &driver_attr_mlid2.attr,
171 &driver_attr_mlid3.attr,
172 NULL
173};
174
175static struct attribute_group driver_stat_attr_group = {
176 .name = "stats",
177 .attrs = driver_stat_attributes
178};
179
180static ssize_t show_status(struct device *dev, 88static ssize_t show_status(struct device *dev,
181 struct device_attribute *attr, 89 struct device_attribute *attr,
182 char *buf) 90 char *buf)
@@ -272,23 +180,23 @@ static ssize_t store_lid(struct device *dev,
272 size_t count) 180 size_t count)
273{ 181{
274 struct ipath_devdata *dd = dev_get_drvdata(dev); 182 struct ipath_devdata *dd = dev_get_drvdata(dev);
275 u16 lid; 183 u16 lid = 0;
276 int ret; 184 int ret;
277 185
278 ret = ipath_parse_ushort(buf, &lid); 186 ret = ipath_parse_ushort(buf, &lid);
279 if (ret < 0) 187 if (ret < 0)
280 goto invalid; 188 goto invalid;
281 189
282 if (lid == 0 || lid >= 0xc000) { 190 if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) {
283 ret = -EINVAL; 191 ret = -EINVAL;
284 goto invalid; 192 goto invalid;
285 } 193 }
286 194
287 ipath_set_sps_lid(dd, lid, 0); 195 ipath_set_lid(dd, lid, 0);
288 196
289 goto bail; 197 goto bail;
290invalid: 198invalid:
291 ipath_dev_err(dd, "attempt to set invalid LID\n"); 199 ipath_dev_err(dd, "attempt to set invalid LID 0x%x\n", lid);
292bail: 200bail:
293 return ret; 201 return ret;
294} 202}
@@ -313,13 +221,12 @@ static ssize_t store_mlid(struct device *dev,
313 int ret; 221 int ret;
314 222
315 ret = ipath_parse_ushort(buf, &mlid); 223 ret = ipath_parse_ushort(buf, &mlid);
316 if (ret < 0) 224 if (ret < 0 || mlid < IPATH_MULTICAST_LID_BASE)
317 goto invalid; 225 goto invalid;
318 226
319 unit = dd->ipath_unit; 227 unit = dd->ipath_unit;
320 228
321 dd->ipath_mlid = mlid; 229 dd->ipath_mlid = mlid;
322 ipath_stats.sps_mlid[unit] = mlid;
323 ipath_layer_intr(dd, IPATH_LAYER_INT_BCAST); 230 ipath_layer_intr(dd, IPATH_LAYER_INT_BCAST);
324 231
325 goto bail; 232 goto bail;
@@ -734,20 +641,12 @@ int ipath_driver_create_group(struct device_driver *drv)
734 int ret; 641 int ret;
735 642
736 ret = sysfs_create_group(&drv->kobj, &driver_attr_group); 643 ret = sysfs_create_group(&drv->kobj, &driver_attr_group);
737 if (ret)
738 goto bail;
739 644
740 ret = sysfs_create_group(&drv->kobj, &driver_stat_attr_group);
741 if (ret)
742 sysfs_remove_group(&drv->kobj, &driver_attr_group);
743
744bail:
745 return ret; 645 return ret;
746} 646}
747 647
748void ipath_driver_remove_group(struct device_driver *drv) 648void ipath_driver_remove_group(struct device_driver *drv)
749{ 649{
750 sysfs_remove_group(&drv->kobj, &driver_stat_attr_group);
751 sysfs_remove_group(&drv->kobj, &driver_attr_group); 650 sysfs_remove_group(&drv->kobj, &driver_attr_group);
752} 651}
753 652
diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c
index 0d6dbc0a541e..c33abea2d5a7 100644
--- a/drivers/infiniband/hw/ipath/ipath_uc.c
+++ b/drivers/infiniband/hw/ipath/ipath_uc.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -31,7 +32,7 @@
31 */ 32 */
32 33
33#include "ipath_verbs.h" 34#include "ipath_verbs.h"
34#include "ips_common.h" 35#include "ipath_common.h"
35 36
36/* cut down ridiculously long IB macro names */ 37/* cut down ridiculously long IB macro names */
37#define OP(x) IB_OPCODE_UC_##x 38#define OP(x) IB_OPCODE_UC_##x
@@ -61,90 +62,40 @@ static void complete_last_send(struct ipath_qp *qp, struct ipath_swqe *wqe,
61} 62}
62 63
63/** 64/**
64 * ipath_do_uc_send - do a send on a UC queue 65 * ipath_make_uc_req - construct a request packet (SEND, RDMA write)
65 * @data: contains a pointer to the QP to send on 66 * @qp: a pointer to the QP
67 * @ohdr: a pointer to the IB header being constructed
68 * @pmtu: the path MTU
69 * @bth0p: pointer to the BTH opcode word
70 * @bth2p: pointer to the BTH PSN word
66 * 71 *
67 * Process entries in the send work queue until the queue is exhausted. 72 * Return 1 if constructed; otherwise, return 0.
68 * Only allow one CPU to send a packet per QP (tasklet). 73 * Note the QP s_lock must be held and interrupts disabled.
69 * Otherwise, after we drop the QP lock, two threads could send
70 * packets out of order.
71 * This is similar to ipath_do_rc_send() below except we don't have
72 * timeouts or resends.
73 */ 74 */
74void ipath_do_uc_send(unsigned long data) 75int ipath_make_uc_req(struct ipath_qp *qp,
76 struct ipath_other_headers *ohdr,
77 u32 pmtu, u32 *bth0p, u32 *bth2p)
75{ 78{
76 struct ipath_qp *qp = (struct ipath_qp *)data;
77 struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
78 struct ipath_swqe *wqe; 79 struct ipath_swqe *wqe;
79 unsigned long flags;
80 u16 lrh0;
81 u32 hwords; 80 u32 hwords;
82 u32 nwords;
83 u32 extra_bytes;
84 u32 bth0; 81 u32 bth0;
85 u32 bth2;
86 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu);
87 u32 len; 82 u32 len;
88 struct ipath_other_headers *ohdr;
89 struct ib_wc wc; 83 struct ib_wc wc;
90 84
91 if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags))
92 goto bail;
93
94 if (unlikely(qp->remote_ah_attr.dlid ==
95 ipath_layer_get_lid(dev->dd))) {
96 /* Pass in an uninitialized ib_wc to save stack space. */
97 ipath_ruc_loopback(qp, &wc);
98 clear_bit(IPATH_S_BUSY, &qp->s_flags);
99 goto bail;
100 }
101
102 ohdr = &qp->s_hdr.u.oth;
103 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH)
104 ohdr = &qp->s_hdr.u.l.oth;
105
106again:
107 /* Check for a constructed packet to be sent. */
108 if (qp->s_hdrwords != 0) {
109 /*
110 * If no PIO bufs are available, return.
111 * An interrupt will call ipath_ib_piobufavail()
112 * when one is available.
113 */
114 if (ipath_verbs_send(dev->dd, qp->s_hdrwords,
115 (u32 *) &qp->s_hdr,
116 qp->s_cur_size,
117 qp->s_cur_sge)) {
118 ipath_no_bufs_available(qp, dev);
119 goto bail;
120 }
121 dev->n_unicast_xmit++;
122 /* Record that we sent the packet and s_hdr is empty. */
123 qp->s_hdrwords = 0;
124 }
125
126 lrh0 = IPS_LRH_BTH;
127 /* header size in 32-bit words LRH+BTH = (8+12)/4. */
128 hwords = 5;
129
130 /*
131 * The lock is needed to synchronize between
132 * setting qp->s_ack_state and post_send().
133 */
134 spin_lock_irqsave(&qp->s_lock, flags);
135
136 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) 85 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK))
137 goto done; 86 goto done;
138 87
139 bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); 88 /* header size in 32-bit words LRH+BTH = (8+12)/4. */
89 hwords = 5;
90 bth0 = 0;
140 91
141 /* Send a request. */ 92 /* Get the next send request. */
142 wqe = get_swqe_ptr(qp, qp->s_last); 93 wqe = get_swqe_ptr(qp, qp->s_last);
143 switch (qp->s_state) { 94 switch (qp->s_state) {
144 default: 95 default:
145 /* 96 /*
146 * Signal the completion of the last send (if there is 97 * Signal the completion of the last send
147 * one). 98 * (if there is one).
148 */ 99 */
149 if (qp->s_last != qp->s_tail) 100 if (qp->s_last != qp->s_tail)
150 complete_last_send(qp, wqe, &wc); 101 complete_last_send(qp, wqe, &wc);
@@ -257,61 +208,16 @@ again:
257 } 208 }
258 break; 209 break;
259 } 210 }
260 bth2 = qp->s_next_psn++ & IPS_PSN_MASK;
261 qp->s_len -= len; 211 qp->s_len -= len;
262 bth0 |= qp->s_state << 24;
263
264 spin_unlock_irqrestore(&qp->s_lock, flags);
265
266 /* Construct the header. */
267 extra_bytes = (4 - len) & 3;
268 nwords = (len + extra_bytes) >> 2;
269 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) {
270 /* Header size in 32-bit words. */
271 hwords += 10;
272 lrh0 = IPS_LRH_GRH;
273 qp->s_hdr.u.l.grh.version_tclass_flow =
274 cpu_to_be32((6 << 28) |
275 (qp->remote_ah_attr.grh.traffic_class
276 << 20) |
277 qp->remote_ah_attr.grh.flow_label);
278 qp->s_hdr.u.l.grh.paylen =
279 cpu_to_be16(((hwords - 12) + nwords +
280 SIZE_OF_CRC) << 2);
281 /* next_hdr is defined by C8-7 in ch. 8.4.1 */
282 qp->s_hdr.u.l.grh.next_hdr = 0x1B;
283 qp->s_hdr.u.l.grh.hop_limit =
284 qp->remote_ah_attr.grh.hop_limit;
285 /* The SGID is 32-bit aligned. */
286 qp->s_hdr.u.l.grh.sgid.global.subnet_prefix =
287 dev->gid_prefix;
288 qp->s_hdr.u.l.grh.sgid.global.interface_id =
289 ipath_layer_get_guid(dev->dd);
290 qp->s_hdr.u.l.grh.dgid = qp->remote_ah_attr.grh.dgid;
291 }
292 qp->s_hdrwords = hwords; 212 qp->s_hdrwords = hwords;
293 qp->s_cur_sge = &qp->s_sge; 213 qp->s_cur_sge = &qp->s_sge;
294 qp->s_cur_size = len; 214 qp->s_cur_size = len;
295 lrh0 |= qp->remote_ah_attr.sl << 4; 215 *bth0p = bth0 | (qp->s_state << 24);
296 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); 216 *bth2p = qp->s_next_psn++ & IPATH_PSN_MASK;
297 /* DEST LID */ 217 return 1;
298 qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid);
299 qp->s_hdr.lrh[2] = cpu_to_be16(hwords + nwords + SIZE_OF_CRC);
300 qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
301 bth0 |= extra_bytes << 20;
302 ohdr->bth[0] = cpu_to_be32(bth0);
303 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
304 ohdr->bth[2] = cpu_to_be32(bth2);
305
306 /* Check for more work to do. */
307 goto again;
308 218
309done: 219done:
310 spin_unlock_irqrestore(&qp->s_lock, flags); 220 return 0;
311 clear_bit(IPATH_S_BUSY, &qp->s_flags);
312
313bail:
314 return;
315} 221}
316 222
317/** 223/**
@@ -335,7 +241,6 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
335 u32 hdrsize; 241 u32 hdrsize;
336 u32 psn; 242 u32 psn;
337 u32 pad; 243 u32 pad;
338 unsigned long flags;
339 struct ib_wc wc; 244 struct ib_wc wc;
340 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); 245 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu);
341 struct ib_reth *reth; 246 struct ib_reth *reth;
@@ -373,8 +278,6 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
373 wc.imm_data = 0; 278 wc.imm_data = 0;
374 wc.wc_flags = 0; 279 wc.wc_flags = 0;
375 280
376 spin_lock_irqsave(&qp->r_rq.lock, flags);
377
378 /* Compare the PSN verses the expected PSN. */ 281 /* Compare the PSN verses the expected PSN. */
379 if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) { 282 if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) {
380 /* 283 /*
@@ -535,12 +438,13 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
535 if (qp->r_len != 0) { 438 if (qp->r_len != 0) {
536 u32 rkey = be32_to_cpu(reth->rkey); 439 u32 rkey = be32_to_cpu(reth->rkey);
537 u64 vaddr = be64_to_cpu(reth->vaddr); 440 u64 vaddr = be64_to_cpu(reth->vaddr);
441 int ok;
538 442
539 /* Check rkey */ 443 /* Check rkey */
540 if (unlikely(!ipath_rkey_ok( 444 ok = ipath_rkey_ok(dev, &qp->r_sge, qp->r_len,
541 dev, &qp->r_sge, qp->r_len, 445 vaddr, rkey,
542 vaddr, rkey, 446 IB_ACCESS_REMOTE_WRITE);
543 IB_ACCESS_REMOTE_WRITE))) { 447 if (unlikely(!ok)) {
544 dev->n_pkt_drops++; 448 dev->n_pkt_drops++;
545 goto done; 449 goto done;
546 } 450 }
@@ -558,8 +462,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
558 } 462 }
559 if (opcode == OP(RDMA_WRITE_ONLY)) 463 if (opcode == OP(RDMA_WRITE_ONLY))
560 goto rdma_last; 464 goto rdma_last;
561 else if (opcode == 465 else if (opcode == OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE))
562 OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE))
563 goto rdma_last_imm; 466 goto rdma_last_imm;
564 /* FALLTHROUGH */ 467 /* FALLTHROUGH */
565 case OP(RDMA_WRITE_MIDDLE): 468 case OP(RDMA_WRITE_MIDDLE):
@@ -592,9 +495,9 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
592 dev->n_pkt_drops++; 495 dev->n_pkt_drops++;
593 goto done; 496 goto done;
594 } 497 }
595 if (qp->r_reuse_sge) { 498 if (qp->r_reuse_sge)
596 qp->r_reuse_sge = 0; 499 qp->r_reuse_sge = 0;
597 } else if (!ipath_get_rwqe(qp, 1)) { 500 else if (!ipath_get_rwqe(qp, 1)) {
598 dev->n_pkt_drops++; 501 dev->n_pkt_drops++;
599 goto done; 502 goto done;
600 } 503 }
@@ -631,15 +534,11 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
631 534
632 default: 535 default:
633 /* Drop packet for unknown opcodes. */ 536 /* Drop packet for unknown opcodes. */
634 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
635 dev->n_pkt_drops++; 537 dev->n_pkt_drops++;
636 goto bail; 538 goto done;
637 } 539 }
638 qp->r_psn++; 540 qp->r_psn++;
639 qp->r_state = opcode; 541 qp->r_state = opcode;
640done: 542done:
641 spin_unlock_irqrestore(&qp->r_rq.lock, flags);
642
643bail:
644 return; 543 return;
645} 544}
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index e606daf83210..3466129af804 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -33,7 +34,7 @@
33#include <rdma/ib_smi.h> 34#include <rdma/ib_smi.h>
34 35
35#include "ipath_verbs.h" 36#include "ipath_verbs.h"
36#include "ips_common.h" 37#include "ipath_common.h"
37 38
38/** 39/**
39 * ipath_ud_loopback - handle send on loopback QPs 40 * ipath_ud_loopback - handle send on loopback QPs
@@ -274,6 +275,11 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
274 len += wr->sg_list[i].length; 275 len += wr->sg_list[i].length;
275 ss.num_sge++; 276 ss.num_sge++;
276 } 277 }
278 /* Check for invalid packet size. */
279 if (len > ipath_layer_get_ibmtu(dev->dd)) {
280 ret = -EINVAL;
281 goto bail;
282 }
277 extra_bytes = (4 - len) & 3; 283 extra_bytes = (4 - len) & 3;
278 nwords = (len + extra_bytes) >> 2; 284 nwords = (len + extra_bytes) >> 2;
279 285
@@ -283,8 +289,8 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
283 ret = -EINVAL; 289 ret = -EINVAL;
284 goto bail; 290 goto bail;
285 } 291 }
286 if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE) { 292 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE) {
287 if (ah_attr->dlid != IPS_PERMISSIVE_LID) 293 if (ah_attr->dlid != IPATH_PERMISSIVE_LID)
288 dev->n_multicast_xmit++; 294 dev->n_multicast_xmit++;
289 else 295 else
290 dev->n_unicast_xmit++; 296 dev->n_unicast_xmit++;
@@ -304,7 +310,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
304 if (ah_attr->ah_flags & IB_AH_GRH) { 310 if (ah_attr->ah_flags & IB_AH_GRH) {
305 /* Header size in 32-bit words. */ 311 /* Header size in 32-bit words. */
306 hwords = 17; 312 hwords = 17;
307 lrh0 = IPS_LRH_GRH; 313 lrh0 = IPATH_LRH_GRH;
308 ohdr = &qp->s_hdr.u.l.oth; 314 ohdr = &qp->s_hdr.u.l.oth;
309 qp->s_hdr.u.l.grh.version_tclass_flow = 315 qp->s_hdr.u.l.grh.version_tclass_flow =
310 cpu_to_be32((6 << 28) | 316 cpu_to_be32((6 << 28) |
@@ -330,7 +336,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
330 } else { 336 } else {
331 /* Header size in 32-bit words. */ 337 /* Header size in 32-bit words. */
332 hwords = 7; 338 hwords = 7;
333 lrh0 = IPS_LRH_BTH; 339 lrh0 = IPATH_LRH_BTH;
334 ohdr = &qp->s_hdr.u.oth; 340 ohdr = &qp->s_hdr.u.oth;
335 } 341 }
336 if (wr->opcode == IB_WR_SEND_WITH_IMM) { 342 if (wr->opcode == IB_WR_SEND_WITH_IMM) {
@@ -361,18 +367,18 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
361 if (wr->send_flags & IB_SEND_SOLICITED) 367 if (wr->send_flags & IB_SEND_SOLICITED)
362 bth0 |= 1 << 23; 368 bth0 |= 1 << 23;
363 bth0 |= extra_bytes << 20; 369 bth0 |= extra_bytes << 20;
364 bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPS_DEFAULT_P_KEY : 370 bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPATH_DEFAULT_P_KEY :
365 ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); 371 ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
366 ohdr->bth[0] = cpu_to_be32(bth0); 372 ohdr->bth[0] = cpu_to_be32(bth0);
367 /* 373 /*
368 * Use the multicast QP if the destination LID is a multicast LID. 374 * Use the multicast QP if the destination LID is a multicast LID.
369 */ 375 */
370 ohdr->bth[1] = ah_attr->dlid >= IPS_MULTICAST_LID_BASE && 376 ohdr->bth[1] = ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
371 ah_attr->dlid != IPS_PERMISSIVE_LID ? 377 ah_attr->dlid != IPATH_PERMISSIVE_LID ?
372 __constant_cpu_to_be32(IPS_MULTICAST_QPN) : 378 __constant_cpu_to_be32(IPATH_MULTICAST_QPN) :
373 cpu_to_be32(wr->wr.ud.remote_qpn); 379 cpu_to_be32(wr->wr.ud.remote_qpn);
374 /* XXX Could lose a PSN count but not worth locking */ 380 /* XXX Could lose a PSN count but not worth locking */
375 ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPS_PSN_MASK); 381 ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPATH_PSN_MASK);
376 /* 382 /*
377 * Qkeys with the high order bit set mean use the 383 * Qkeys with the high order bit set mean use the
378 * qkey from the QP context instead of the WR (see 10.2.5). 384 * qkey from the QP context instead of the WR (see 10.2.5).
@@ -463,7 +469,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
463 src_qp = be32_to_cpu(ohdr->u.ud.deth[1]); 469 src_qp = be32_to_cpu(ohdr->u.ud.deth[1]);
464 } 470 }
465 } 471 }
466 src_qp &= IPS_QPN_MASK; 472 src_qp &= IPATH_QPN_MASK;
467 473
468 /* 474 /*
469 * Check that the permissive LID is only used on QP0 475 * Check that the permissive LID is only used on QP0
@@ -554,7 +560,16 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
554 spin_lock_irqsave(&rq->lock, flags); 560 spin_lock_irqsave(&rq->lock, flags);
555 if (rq->tail == rq->head) { 561 if (rq->tail == rq->head) {
556 spin_unlock_irqrestore(&rq->lock, flags); 562 spin_unlock_irqrestore(&rq->lock, flags);
557 dev->n_pkt_drops++; 563 /*
564 * Count VL15 packets dropped due to no receive buffer.
565 * Otherwise, count them as buffer overruns since usually,
566 * the HW will be able to receive packets even if there are
567 * no QPs with posted receive buffers.
568 */
569 if (qp->ibqp.qp_num == 0)
570 dev->n_vl15_dropped++;
571 else
572 dev->rcv_errors++;
558 goto bail; 573 goto bail;
559 } 574 }
560 /* Silently drop packets which are too big. */ 575 /* Silently drop packets which are too big. */
@@ -612,7 +627,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
612 /* 627 /*
613 * Save the LMC lower bits if the destination LID is a unicast LID. 628 * Save the LMC lower bits if the destination LID is a unicast LID.
614 */ 629 */
615 wc.dlid_path_bits = dlid >= IPS_MULTICAST_LID_BASE ? 0 : 630 wc.dlid_path_bits = dlid >= IPATH_MULTICAST_LID_BASE ? 0 :
616 dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); 631 dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1);
617 /* Signal completion event if the solicited bit is set. */ 632 /* Signal completion event if the solicited bit is set. */
618 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 633 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c
index 2bb08afc86d0..e32fca9faf80 100644
--- a/drivers/infiniband/hw/ipath/ipath_user_pages.c
+++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -57,17 +58,6 @@ static int __get_user_pages(unsigned long start_page, size_t num_pages,
57 size_t got; 58 size_t got;
58 int ret; 59 int ret;
59 60
60#if 0
61 /*
62 * XXX - causes MPI programs to fail, haven't had time to check
63 * yet
64 */
65 if (!capable(CAP_IPC_LOCK)) {
66 ret = -EPERM;
67 goto bail;
68 }
69#endif
70
71 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> 61 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >>
72 PAGE_SHIFT; 62 PAGE_SHIFT;
73 63
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 28fdbdaa789d..56ac336dd1ec 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -36,7 +37,7 @@
36 37
37#include "ipath_kernel.h" 38#include "ipath_kernel.h"
38#include "ipath_verbs.h" 39#include "ipath_verbs.h"
39#include "ips_common.h" 40#include "ipath_common.h"
40 41
41/* Not static, because we don't want the compiler removing it */ 42/* Not static, because we don't want the compiler removing it */
42const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR; 43const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR;
@@ -55,9 +56,62 @@ unsigned int ib_ipath_debug; /* debug mask */
55module_param_named(debug, ib_ipath_debug, uint, S_IWUSR | S_IRUGO); 56module_param_named(debug, ib_ipath_debug, uint, S_IWUSR | S_IRUGO);
56MODULE_PARM_DESC(debug, "Verbs debug mask"); 57MODULE_PARM_DESC(debug, "Verbs debug mask");
57 58
59static unsigned int ib_ipath_max_pds = 0xFFFF;
60module_param_named(max_pds, ib_ipath_max_pds, uint, S_IWUSR | S_IRUGO);
61MODULE_PARM_DESC(max_pds,
62 "Maximum number of protection domains to support");
63
64static unsigned int ib_ipath_max_ahs = 0xFFFF;
65module_param_named(max_ahs, ib_ipath_max_ahs, uint, S_IWUSR | S_IRUGO);
66MODULE_PARM_DESC(max_ahs, "Maximum number of address handles to support");
67
68unsigned int ib_ipath_max_cqes = 0x2FFFF;
69module_param_named(max_cqes, ib_ipath_max_cqes, uint, S_IWUSR | S_IRUGO);
70MODULE_PARM_DESC(max_cqes,
71 "Maximum number of completion queue entries to support");
72
73unsigned int ib_ipath_max_cqs = 0x1FFFF;
74module_param_named(max_cqs, ib_ipath_max_cqs, uint, S_IWUSR | S_IRUGO);
75MODULE_PARM_DESC(max_cqs, "Maximum number of completion queues to support");
76
77unsigned int ib_ipath_max_qp_wrs = 0x3FFF;
78module_param_named(max_qp_wrs, ib_ipath_max_qp_wrs, uint,
79 S_IWUSR | S_IRUGO);
80MODULE_PARM_DESC(max_qp_wrs, "Maximum number of QP WRs to support");
81
82unsigned int ib_ipath_max_sges = 0x60;
83module_param_named(max_sges, ib_ipath_max_sges, uint, S_IWUSR | S_IRUGO);
84MODULE_PARM_DESC(max_sges, "Maximum number of SGEs to support");
85
86unsigned int ib_ipath_max_mcast_grps = 16384;
87module_param_named(max_mcast_grps, ib_ipath_max_mcast_grps, uint,
88 S_IWUSR | S_IRUGO);
89MODULE_PARM_DESC(max_mcast_grps,
90 "Maximum number of multicast groups to support");
91
92unsigned int ib_ipath_max_mcast_qp_attached = 16;
93module_param_named(max_mcast_qp_attached, ib_ipath_max_mcast_qp_attached,
94 uint, S_IWUSR | S_IRUGO);
95MODULE_PARM_DESC(max_mcast_qp_attached,
96 "Maximum number of attached QPs to support");
97
98unsigned int ib_ipath_max_srqs = 1024;
99module_param_named(max_srqs, ib_ipath_max_srqs, uint, S_IWUSR | S_IRUGO);
100MODULE_PARM_DESC(max_srqs, "Maximum number of SRQs to support");
101
102unsigned int ib_ipath_max_srq_sges = 128;
103module_param_named(max_srq_sges, ib_ipath_max_srq_sges,
104 uint, S_IWUSR | S_IRUGO);
105MODULE_PARM_DESC(max_srq_sges, "Maximum number of SRQ SGEs to support");
106
107unsigned int ib_ipath_max_srq_wrs = 0x1FFFF;
108module_param_named(max_srq_wrs, ib_ipath_max_srq_wrs,
109 uint, S_IWUSR | S_IRUGO);
110MODULE_PARM_DESC(max_srq_wrs, "Maximum number of SRQ WRs support");
111
58MODULE_LICENSE("GPL"); 112MODULE_LICENSE("GPL");
59MODULE_AUTHOR("PathScale <support@pathscale.com>"); 113MODULE_AUTHOR("QLogic <support@pathscale.com>");
60MODULE_DESCRIPTION("Pathscale InfiniPath driver"); 114MODULE_DESCRIPTION("QLogic InfiniPath driver");
61 115
62const int ib_ipath_state_ops[IB_QPS_ERR + 1] = { 116const int ib_ipath_state_ops[IB_QPS_ERR + 1] = {
63 [IB_QPS_RESET] = 0, 117 [IB_QPS_RESET] = 0,
@@ -193,7 +247,7 @@ static int ipath_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
193 switch (qp->ibqp.qp_type) { 247 switch (qp->ibqp.qp_type) {
194 case IB_QPT_UC: 248 case IB_QPT_UC:
195 case IB_QPT_RC: 249 case IB_QPT_RC:
196 err = ipath_post_rc_send(qp, wr); 250 err = ipath_post_ruc_send(qp, wr);
197 break; 251 break;
198 252
199 case IB_QPT_SMI: 253 case IB_QPT_SMI:
@@ -375,7 +429,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
375 429
376 /* Check for a valid destination LID (see ch. 7.11.1). */ 430 /* Check for a valid destination LID (see ch. 7.11.1). */
377 lid = be16_to_cpu(hdr->lrh[1]); 431 lid = be16_to_cpu(hdr->lrh[1]);
378 if (lid < IPS_MULTICAST_LID_BASE) { 432 if (lid < IPATH_MULTICAST_LID_BASE) {
379 lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); 433 lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1);
380 if (unlikely(lid != ipath_layer_get_lid(dev->dd))) { 434 if (unlikely(lid != ipath_layer_get_lid(dev->dd))) {
381 dev->rcv_errors++; 435 dev->rcv_errors++;
@@ -385,9 +439,9 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
385 439
386 /* Check for GRH */ 440 /* Check for GRH */
387 lnh = be16_to_cpu(hdr->lrh[0]) & 3; 441 lnh = be16_to_cpu(hdr->lrh[0]) & 3;
388 if (lnh == IPS_LRH_BTH) 442 if (lnh == IPATH_LRH_BTH)
389 ohdr = &hdr->u.oth; 443 ohdr = &hdr->u.oth;
390 else if (lnh == IPS_LRH_GRH) 444 else if (lnh == IPATH_LRH_GRH)
391 ohdr = &hdr->u.l.oth; 445 ohdr = &hdr->u.l.oth;
392 else { 446 else {
393 dev->rcv_errors++; 447 dev->rcv_errors++;
@@ -399,8 +453,8 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
399 dev->opstats[opcode].n_packets++; 453 dev->opstats[opcode].n_packets++;
400 454
401 /* Get the destination QP number. */ 455 /* Get the destination QP number. */
402 qp_num = be32_to_cpu(ohdr->bth[1]) & IPS_QPN_MASK; 456 qp_num = be32_to_cpu(ohdr->bth[1]) & IPATH_QPN_MASK;
403 if (qp_num == IPS_MULTICAST_QPN) { 457 if (qp_num == IPATH_MULTICAST_QPN) {
404 struct ipath_mcast *mcast; 458 struct ipath_mcast *mcast;
405 struct ipath_mcast_qp *p; 459 struct ipath_mcast_qp *p;
406 460
@@ -411,7 +465,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
411 } 465 }
412 dev->n_multicast_rcv++; 466 dev->n_multicast_rcv++;
413 list_for_each_entry_rcu(p, &mcast->qp_list, list) 467 list_for_each_entry_rcu(p, &mcast->qp_list, list)
414 ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, 468 ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data,
415 tlen, p->qp); 469 tlen, p->qp);
416 /* 470 /*
417 * Notify ipath_multicast_detach() if it is waiting for us 471 * Notify ipath_multicast_detach() if it is waiting for us
@@ -423,7 +477,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
423 qp = ipath_lookup_qpn(&dev->qp_table, qp_num); 477 qp = ipath_lookup_qpn(&dev->qp_table, qp_num);
424 if (qp) { 478 if (qp) {
425 dev->n_unicast_rcv++; 479 dev->n_unicast_rcv++;
426 ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, 480 ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data,
427 tlen, qp); 481 tlen, qp);
428 /* 482 /*
429 * Notify ipath_destroy_qp() if it is waiting 483 * Notify ipath_destroy_qp() if it is waiting
@@ -567,40 +621,38 @@ static int ipath_query_device(struct ib_device *ibdev,
567 struct ib_device_attr *props) 621 struct ib_device_attr *props)
568{ 622{
569 struct ipath_ibdev *dev = to_idev(ibdev); 623 struct ipath_ibdev *dev = to_idev(ibdev);
570 u32 vendor, boardrev, majrev, minrev;
571 624
572 memset(props, 0, sizeof(*props)); 625 memset(props, 0, sizeof(*props));
573 626
574 props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR | 627 props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
575 IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT | 628 IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT |
576 IB_DEVICE_SYS_IMAGE_GUID; 629 IB_DEVICE_SYS_IMAGE_GUID;
577 ipath_layer_query_device(dev->dd, &vendor, &boardrev, 630 props->vendor_id = ipath_layer_get_vendorid(dev->dd);
578 &majrev, &minrev); 631 props->vendor_part_id = ipath_layer_get_deviceid(dev->dd);
579 props->vendor_id = vendor; 632 props->hw_ver = ipath_layer_get_pcirev(dev->dd);
580 props->vendor_part_id = boardrev;
581 props->hw_ver = boardrev << 16 | majrev << 8 | minrev;
582 633
583 props->sys_image_guid = dev->sys_image_guid; 634 props->sys_image_guid = dev->sys_image_guid;
584 635
585 props->max_mr_size = ~0ull; 636 props->max_mr_size = ~0ull;
586 props->max_qp = 0xffff; 637 props->max_qp = dev->qp_table.max;
587 props->max_qp_wr = 0xffff; 638 props->max_qp_wr = ib_ipath_max_qp_wrs;
588 props->max_sge = 255; 639 props->max_sge = ib_ipath_max_sges;
589 props->max_cq = 0xffff; 640 props->max_cq = ib_ipath_max_cqs;
590 props->max_cqe = 0xffff; 641 props->max_ah = ib_ipath_max_ahs;
591 props->max_mr = 0xffff; 642 props->max_cqe = ib_ipath_max_cqes;
592 props->max_pd = 0xffff; 643 props->max_mr = dev->lk_table.max;
644 props->max_pd = ib_ipath_max_pds;
593 props->max_qp_rd_atom = 1; 645 props->max_qp_rd_atom = 1;
594 props->max_qp_init_rd_atom = 1; 646 props->max_qp_init_rd_atom = 1;
595 /* props->max_res_rd_atom */ 647 /* props->max_res_rd_atom */
596 props->max_srq = 0xffff; 648 props->max_srq = ib_ipath_max_srqs;
597 props->max_srq_wr = 0xffff; 649 props->max_srq_wr = ib_ipath_max_srq_wrs;
598 props->max_srq_sge = 255; 650 props->max_srq_sge = ib_ipath_max_srq_sges;
599 /* props->local_ca_ack_delay */ 651 /* props->local_ca_ack_delay */
600 props->atomic_cap = IB_ATOMIC_HCA; 652 props->atomic_cap = IB_ATOMIC_HCA;
601 props->max_pkeys = ipath_layer_get_npkeys(dev->dd); 653 props->max_pkeys = ipath_layer_get_npkeys(dev->dd);
602 props->max_mcast_grp = 0xffff; 654 props->max_mcast_grp = ib_ipath_max_mcast_grps;
603 props->max_mcast_qp_attach = 0xffff; 655 props->max_mcast_qp_attach = ib_ipath_max_mcast_qp_attached;
604 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * 656 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
605 props->max_mcast_grp; 657 props->max_mcast_grp;
606 658
@@ -643,10 +695,10 @@ static int ipath_query_port(struct ib_device *ibdev,
643 ipath_layer_get_lastibcstat(dev->dd) & 0xf]; 695 ipath_layer_get_lastibcstat(dev->dd) & 0xf];
644 props->port_cap_flags = dev->port_cap_flags; 696 props->port_cap_flags = dev->port_cap_flags;
645 props->gid_tbl_len = 1; 697 props->gid_tbl_len = 1;
646 props->max_msg_sz = 4096; 698 props->max_msg_sz = 0x80000000;
647 props->pkey_tbl_len = ipath_layer_get_npkeys(dev->dd); 699 props->pkey_tbl_len = ipath_layer_get_npkeys(dev->dd);
648 props->bad_pkey_cntr = ipath_layer_get_cr_errpkey(dev->dd) - 700 props->bad_pkey_cntr = ipath_layer_get_cr_errpkey(dev->dd) -
649 dev->n_pkey_violations; 701 dev->z_pkey_violations;
650 props->qkey_viol_cntr = dev->qkey_violations; 702 props->qkey_viol_cntr = dev->qkey_violations;
651 props->active_width = IB_WIDTH_4X; 703 props->active_width = IB_WIDTH_4X;
652 /* See rate_show() */ 704 /* See rate_show() */
@@ -743,15 +795,30 @@ static struct ib_pd *ipath_alloc_pd(struct ib_device *ibdev,
743 struct ib_ucontext *context, 795 struct ib_ucontext *context,
744 struct ib_udata *udata) 796 struct ib_udata *udata)
745{ 797{
798 struct ipath_ibdev *dev = to_idev(ibdev);
746 struct ipath_pd *pd; 799 struct ipath_pd *pd;
747 struct ib_pd *ret; 800 struct ib_pd *ret;
748 801
802 /*
803 * This is actually totally arbitrary. Some correctness tests
804 * assume there's a maximum number of PDs that can be allocated.
805 * We don't actually have this limit, but we fail the test if
806 * we allow allocations of more than we report for this value.
807 */
808
809 if (dev->n_pds_allocated == ib_ipath_max_pds) {
810 ret = ERR_PTR(-ENOMEM);
811 goto bail;
812 }
813
749 pd = kmalloc(sizeof *pd, GFP_KERNEL); 814 pd = kmalloc(sizeof *pd, GFP_KERNEL);
750 if (!pd) { 815 if (!pd) {
751 ret = ERR_PTR(-ENOMEM); 816 ret = ERR_PTR(-ENOMEM);
752 goto bail; 817 goto bail;
753 } 818 }
754 819
820 dev->n_pds_allocated++;
821
755 /* ib_alloc_pd() will initialize pd->ibpd. */ 822 /* ib_alloc_pd() will initialize pd->ibpd. */
756 pd->user = udata != NULL; 823 pd->user = udata != NULL;
757 824
@@ -764,6 +831,9 @@ bail:
764static int ipath_dealloc_pd(struct ib_pd *ibpd) 831static int ipath_dealloc_pd(struct ib_pd *ibpd)
765{ 832{
766 struct ipath_pd *pd = to_ipd(ibpd); 833 struct ipath_pd *pd = to_ipd(ibpd);
834 struct ipath_ibdev *dev = to_idev(ibpd->device);
835
836 dev->n_pds_allocated--;
767 837
768 kfree(pd); 838 kfree(pd);
769 839
@@ -782,21 +852,40 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
782{ 852{
783 struct ipath_ah *ah; 853 struct ipath_ah *ah;
784 struct ib_ah *ret; 854 struct ib_ah *ret;
855 struct ipath_ibdev *dev = to_idev(pd->device);
856
857 if (dev->n_ahs_allocated == ib_ipath_max_ahs) {
858 ret = ERR_PTR(-ENOMEM);
859 goto bail;
860 }
785 861
786 /* A multicast address requires a GRH (see ch. 8.4.1). */ 862 /* A multicast address requires a GRH (see ch. 8.4.1). */
787 if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE && 863 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
788 ah_attr->dlid != IPS_PERMISSIVE_LID && 864 ah_attr->dlid != IPATH_PERMISSIVE_LID &&
789 !(ah_attr->ah_flags & IB_AH_GRH)) { 865 !(ah_attr->ah_flags & IB_AH_GRH)) {
790 ret = ERR_PTR(-EINVAL); 866 ret = ERR_PTR(-EINVAL);
791 goto bail; 867 goto bail;
792 } 868 }
793 869
870 if (ah_attr->dlid == 0) {
871 ret = ERR_PTR(-EINVAL);
872 goto bail;
873 }
874
875 if (ah_attr->port_num < 1 ||
876 ah_attr->port_num > pd->device->phys_port_cnt) {
877 ret = ERR_PTR(-EINVAL);
878 goto bail;
879 }
880
794 ah = kmalloc(sizeof *ah, GFP_ATOMIC); 881 ah = kmalloc(sizeof *ah, GFP_ATOMIC);
795 if (!ah) { 882 if (!ah) {
796 ret = ERR_PTR(-ENOMEM); 883 ret = ERR_PTR(-ENOMEM);
797 goto bail; 884 goto bail;
798 } 885 }
799 886
887 dev->n_ahs_allocated++;
888
800 /* ib_create_ah() will initialize ah->ibah. */ 889 /* ib_create_ah() will initialize ah->ibah. */
801 ah->attr = *ah_attr; 890 ah->attr = *ah_attr;
802 891
@@ -814,8 +903,11 @@ bail:
814 */ 903 */
815static int ipath_destroy_ah(struct ib_ah *ibah) 904static int ipath_destroy_ah(struct ib_ah *ibah)
816{ 905{
906 struct ipath_ibdev *dev = to_idev(ibah->device);
817 struct ipath_ah *ah = to_iah(ibah); 907 struct ipath_ah *ah = to_iah(ibah);
818 908
909 dev->n_ahs_allocated--;
910
819 kfree(ah); 911 kfree(ah);
820 912
821 return 0; 913 return 0;
@@ -889,6 +981,7 @@ static int ipath_verbs_register_sysfs(struct ib_device *dev);
889 */ 981 */
890static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd) 982static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd)
891{ 983{
984 struct ipath_layer_counters cntrs;
892 struct ipath_ibdev *idev; 985 struct ipath_ibdev *idev;
893 struct ib_device *dev; 986 struct ib_device *dev;
894 int ret; 987 int ret;
@@ -939,6 +1032,25 @@ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd)
939 idev->pma_counter_select[5] = IB_PMA_PORT_XMIT_WAIT; 1032 idev->pma_counter_select[5] = IB_PMA_PORT_XMIT_WAIT;
940 idev->link_width_enabled = 3; /* 1x or 4x */ 1033 idev->link_width_enabled = 3; /* 1x or 4x */
941 1034
1035 /* Snapshot current HW counters to "clear" them. */
1036 ipath_layer_get_counters(dd, &cntrs);
1037 idev->z_symbol_error_counter = cntrs.symbol_error_counter;
1038 idev->z_link_error_recovery_counter =
1039 cntrs.link_error_recovery_counter;
1040 idev->z_link_downed_counter = cntrs.link_downed_counter;
1041 idev->z_port_rcv_errors = cntrs.port_rcv_errors;
1042 idev->z_port_rcv_remphys_errors =
1043 cntrs.port_rcv_remphys_errors;
1044 idev->z_port_xmit_discards = cntrs.port_xmit_discards;
1045 idev->z_port_xmit_data = cntrs.port_xmit_data;
1046 idev->z_port_rcv_data = cntrs.port_rcv_data;
1047 idev->z_port_xmit_packets = cntrs.port_xmit_packets;
1048 idev->z_port_rcv_packets = cntrs.port_rcv_packets;
1049 idev->z_local_link_integrity_errors =
1050 cntrs.local_link_integrity_errors;
1051 idev->z_excessive_buffer_overrun_errors =
1052 cntrs.excessive_buffer_overrun_errors;
1053
942 /* 1054 /*
943 * The system image GUID is supposed to be the same for all 1055 * The system image GUID is supposed to be the same for all
944 * IB HCAs in a single system but since there can be other 1056 * IB HCAs in a single system but since there can be other
@@ -1109,11 +1221,8 @@ static ssize_t show_rev(struct class_device *cdev, char *buf)
1109{ 1221{
1110 struct ipath_ibdev *dev = 1222 struct ipath_ibdev *dev =
1111 container_of(cdev, struct ipath_ibdev, ibdev.class_dev); 1223 container_of(cdev, struct ipath_ibdev, ibdev.class_dev);
1112 int vendor, boardrev, majrev, minrev;
1113 1224
1114 ipath_layer_query_device(dev->dd, &vendor, &boardrev, 1225 return sprintf(buf, "%x\n", ipath_layer_get_pcirev(dev->dd));
1115 &majrev, &minrev);
1116 return sprintf(buf, "%d.%d\n", majrev, minrev);
1117} 1226}
1118 1227
1119static ssize_t show_hca(struct class_device *cdev, char *buf) 1228static ssize_t show_hca(struct class_device *cdev, char *buf)
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 4f8d59300e9b..2df684727dc1 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -148,6 +149,7 @@ struct ipath_mcast {
148 struct list_head qp_list; 149 struct list_head qp_list;
149 wait_queue_head_t wait; 150 wait_queue_head_t wait;
150 atomic_t refcount; 151 atomic_t refcount;
152 int n_attached;
151}; 153};
152 154
153/* Memory region */ 155/* Memory region */
@@ -305,32 +307,34 @@ struct ipath_qp {
305 u32 s_next_psn; /* PSN for next request */ 307 u32 s_next_psn; /* PSN for next request */
306 u32 s_last_psn; /* last response PSN processed */ 308 u32 s_last_psn; /* last response PSN processed */
307 u32 s_psn; /* current packet sequence number */ 309 u32 s_psn; /* current packet sequence number */
310 u32 s_ack_psn; /* PSN for RDMA_READ */
308 u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */ 311 u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */
309 u32 s_ack_psn; /* PSN for next ACK or RDMA_READ */ 312 u32 r_ack_psn; /* PSN for next ACK or atomic ACK */
310 u64 s_ack_atomic; /* data for atomic ACK */
311 u64 r_wr_id; /* ID for current receive WQE */ 313 u64 r_wr_id; /* ID for current receive WQE */
312 u64 r_atomic_data; /* data for last atomic op */ 314 u64 r_atomic_data; /* data for last atomic op */
313 u32 r_atomic_psn; /* PSN of last atomic op */ 315 u32 r_atomic_psn; /* PSN of last atomic op */
314 u32 r_len; /* total length of r_sge */ 316 u32 r_len; /* total length of r_sge */
315 u32 r_rcv_len; /* receive data len processed */ 317 u32 r_rcv_len; /* receive data len processed */
316 u32 r_psn; /* expected rcv packet sequence number */ 318 u32 r_psn; /* expected rcv packet sequence number */
319 u32 r_msn; /* message sequence number */
317 u8 state; /* QP state */ 320 u8 state; /* QP state */
318 u8 s_state; /* opcode of last packet sent */ 321 u8 s_state; /* opcode of last packet sent */
319 u8 s_ack_state; /* opcode of packet to ACK */ 322 u8 s_ack_state; /* opcode of packet to ACK */
320 u8 s_nak_state; /* non-zero if NAK is pending */ 323 u8 s_nak_state; /* non-zero if NAK is pending */
321 u8 r_state; /* opcode of last packet received */ 324 u8 r_state; /* opcode of last packet received */
325 u8 r_ack_state; /* opcode of packet to ACK */
326 u8 r_nak_state; /* non-zero if NAK is pending */
327 u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */
322 u8 r_reuse_sge; /* for UC receive errors */ 328 u8 r_reuse_sge; /* for UC receive errors */
323 u8 r_sge_inx; /* current index into sg_list */ 329 u8 r_sge_inx; /* current index into sg_list */
324 u8 s_max_sge; /* size of s_wq->sg_list */
325 u8 qp_access_flags; 330 u8 qp_access_flags;
331 u8 s_max_sge; /* size of s_wq->sg_list */
326 u8 s_retry_cnt; /* number of times to retry */ 332 u8 s_retry_cnt; /* number of times to retry */
327 u8 s_rnr_retry_cnt; 333 u8 s_rnr_retry_cnt;
328 u8 s_min_rnr_timer;
329 u8 s_retry; /* requester retry counter */ 334 u8 s_retry; /* requester retry counter */
330 u8 s_rnr_retry; /* requester RNR retry counter */ 335 u8 s_rnr_retry; /* requester RNR retry counter */
331 u8 s_pkey_index; /* PKEY index to use */ 336 u8 s_pkey_index; /* PKEY index to use */
332 enum ib_mtu path_mtu; 337 enum ib_mtu path_mtu;
333 atomic_t msn; /* message sequence number */
334 u32 remote_qpn; 338 u32 remote_qpn;
335 u32 qkey; /* QKEY for this QP (for UD or RD) */ 339 u32 qkey; /* QKEY for this QP (for UD or RD) */
336 u32 s_size; /* send work queue size */ 340 u32 s_size; /* send work queue size */
@@ -431,6 +435,11 @@ struct ipath_ibdev {
431 __be64 sys_image_guid; /* in network order */ 435 __be64 sys_image_guid; /* in network order */
432 __be64 gid_prefix; /* in network order */ 436 __be64 gid_prefix; /* in network order */
433 __be64 mkey; 437 __be64 mkey;
438 u32 n_pds_allocated; /* number of PDs allocated for device */
439 u32 n_ahs_allocated; /* number of AHs allocated for device */
440 u32 n_cqs_allocated; /* number of CQs allocated for device */
441 u32 n_srqs_allocated; /* number of SRQs allocated for device */
442 u32 n_mcast_grps_allocated; /* number of mcast groups allocated */
434 u64 ipath_sword; /* total dwords sent (sample result) */ 443 u64 ipath_sword; /* total dwords sent (sample result) */
435 u64 ipath_rword; /* total dwords received (sample result) */ 444 u64 ipath_rword; /* total dwords received (sample result) */
436 u64 ipath_spkts; /* total packets sent (sample result) */ 445 u64 ipath_spkts; /* total packets sent (sample result) */
@@ -442,17 +451,19 @@ struct ipath_ibdev {
442 u64 n_unicast_rcv; /* total unicast packets received */ 451 u64 n_unicast_rcv; /* total unicast packets received */
443 u64 n_multicast_xmit; /* total multicast packets sent */ 452 u64 n_multicast_xmit; /* total multicast packets sent */
444 u64 n_multicast_rcv; /* total multicast packets received */ 453 u64 n_multicast_rcv; /* total multicast packets received */
445 u64 n_symbol_error_counter; /* starting count for PMA */ 454 u64 z_symbol_error_counter; /* starting count for PMA */
446 u64 n_link_error_recovery_counter; /* starting count for PMA */ 455 u64 z_link_error_recovery_counter; /* starting count for PMA */
447 u64 n_link_downed_counter; /* starting count for PMA */ 456 u64 z_link_downed_counter; /* starting count for PMA */
448 u64 n_port_rcv_errors; /* starting count for PMA */ 457 u64 z_port_rcv_errors; /* starting count for PMA */
449 u64 n_port_rcv_remphys_errors; /* starting count for PMA */ 458 u64 z_port_rcv_remphys_errors; /* starting count for PMA */
450 u64 n_port_xmit_discards; /* starting count for PMA */ 459 u64 z_port_xmit_discards; /* starting count for PMA */
451 u64 n_port_xmit_data; /* starting count for PMA */ 460 u64 z_port_xmit_data; /* starting count for PMA */
452 u64 n_port_rcv_data; /* starting count for PMA */ 461 u64 z_port_rcv_data; /* starting count for PMA */
453 u64 n_port_xmit_packets; /* starting count for PMA */ 462 u64 z_port_xmit_packets; /* starting count for PMA */
454 u64 n_port_rcv_packets; /* starting count for PMA */ 463 u64 z_port_rcv_packets; /* starting count for PMA */
455 u32 n_pkey_violations; /* starting count for PMA */ 464 u32 z_pkey_violations; /* starting count for PMA */
465 u32 z_local_link_integrity_errors; /* starting count for PMA */
466 u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */
456 u32 n_rc_resends; 467 u32 n_rc_resends;
457 u32 n_rc_acks; 468 u32 n_rc_acks;
458 u32 n_rc_qacks; 469 u32 n_rc_qacks;
@@ -462,6 +473,7 @@ struct ipath_ibdev {
462 u32 n_other_naks; 473 u32 n_other_naks;
463 u32 n_timeouts; 474 u32 n_timeouts;
464 u32 n_pkt_drops; 475 u32 n_pkt_drops;
476 u32 n_vl15_dropped;
465 u32 n_wqe_errs; 477 u32 n_wqe_errs;
466 u32 n_rdma_dup_busy; 478 u32 n_rdma_dup_busy;
467 u32 n_piowait; 479 u32 n_piowait;
@@ -580,10 +592,6 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);
580 592
581void ipath_get_credit(struct ipath_qp *qp, u32 aeth); 593void ipath_get_credit(struct ipath_qp *qp, u32 aeth);
582 594
583void ipath_do_rc_send(unsigned long data);
584
585void ipath_do_uc_send(unsigned long data);
586
587void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig); 595void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);
588 596
589int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, 597int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
@@ -596,7 +604,7 @@ void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length);
596 604
597void ipath_skip_sge(struct ipath_sge_state *ss, u32 length); 605void ipath_skip_sge(struct ipath_sge_state *ss, u32 length);
598 606
599int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr); 607int ipath_post_ruc_send(struct ipath_qp *qp, struct ib_send_wr *wr);
600 608
601void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, 609void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
602 int has_grh, void *data, u32 tlen, struct ipath_qp *qp); 610 int has_grh, void *data, u32 tlen, struct ipath_qp *qp);
@@ -678,7 +686,19 @@ void ipath_insert_rnr_queue(struct ipath_qp *qp);
678 686
679int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only); 687int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only);
680 688
681void ipath_ruc_loopback(struct ipath_qp *sqp, struct ib_wc *wc); 689u32 ipath_make_grh(struct ipath_ibdev *dev, struct ib_grh *hdr,
690 struct ib_global_route *grh, u32 hwords, u32 nwords);
691
692void ipath_do_ruc_send(unsigned long data);
693
694u32 ipath_make_rc_ack(struct ipath_qp *qp, struct ipath_other_headers *ohdr,
695 u32 pmtu);
696
697int ipath_make_rc_req(struct ipath_qp *qp, struct ipath_other_headers *ohdr,
698 u32 pmtu, u32 *bth0p, u32 *bth2p);
699
700int ipath_make_uc_req(struct ipath_qp *qp, struct ipath_other_headers *ohdr,
701 u32 pmtu, u32 *bth0p, u32 *bth2p);
682 702
683extern const enum ib_wc_opcode ib_ipath_wc_opcode[]; 703extern const enum ib_wc_opcode ib_ipath_wc_opcode[];
684 704
@@ -688,6 +708,24 @@ extern const int ib_ipath_state_ops[];
688 708
689extern unsigned int ib_ipath_lkey_table_size; 709extern unsigned int ib_ipath_lkey_table_size;
690 710
711extern unsigned int ib_ipath_max_cqes;
712
713extern unsigned int ib_ipath_max_cqs;
714
715extern unsigned int ib_ipath_max_qp_wrs;
716
717extern unsigned int ib_ipath_max_sges;
718
719extern unsigned int ib_ipath_max_mcast_grps;
720
721extern unsigned int ib_ipath_max_mcast_qp_attached;
722
723extern unsigned int ib_ipath_max_srqs;
724
725extern unsigned int ib_ipath_max_srq_sges;
726
727extern unsigned int ib_ipath_max_srq_wrs;
728
691extern const u32 ib_ipath_rnr_table[]; 729extern const u32 ib_ipath_rnr_table[];
692 730
693#endif /* IPATH_VERBS_H */ 731#endif /* IPATH_VERBS_H */
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c
index 10b31d2c4f20..ee0e1d96d723 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -92,6 +93,7 @@ static struct ipath_mcast *ipath_mcast_alloc(union ib_gid *mgid)
92 INIT_LIST_HEAD(&mcast->qp_list); 93 INIT_LIST_HEAD(&mcast->qp_list);
93 init_waitqueue_head(&mcast->wait); 94 init_waitqueue_head(&mcast->wait);
94 atomic_set(&mcast->refcount, 0); 95 atomic_set(&mcast->refcount, 0);
96 mcast->n_attached = 0;
95 97
96bail: 98bail:
97 return mcast; 99 return mcast;
@@ -157,7 +159,8 @@ bail:
157 * the table but the QP was added. Return ESRCH if the QP was already 159 * the table but the QP was added. Return ESRCH if the QP was already
158 * attached and neither structure was added. 160 * attached and neither structure was added.
159 */ 161 */
160static int ipath_mcast_add(struct ipath_mcast *mcast, 162static int ipath_mcast_add(struct ipath_ibdev *dev,
163 struct ipath_mcast *mcast,
161 struct ipath_mcast_qp *mqp) 164 struct ipath_mcast_qp *mqp)
162{ 165{
163 struct rb_node **n = &mcast_tree.rb_node; 166 struct rb_node **n = &mcast_tree.rb_node;
@@ -188,34 +191,47 @@ static int ipath_mcast_add(struct ipath_mcast *mcast,
188 /* Search the QP list to see if this is already there. */ 191 /* Search the QP list to see if this is already there. */
189 list_for_each_entry_rcu(p, &tmcast->qp_list, list) { 192 list_for_each_entry_rcu(p, &tmcast->qp_list, list) {
190 if (p->qp == mqp->qp) { 193 if (p->qp == mqp->qp) {
191 spin_unlock_irqrestore(&mcast_lock, flags);
192 ret = ESRCH; 194 ret = ESRCH;
193 goto bail; 195 goto bail;
194 } 196 }
195 } 197 }
198 if (tmcast->n_attached == ib_ipath_max_mcast_qp_attached) {
199 ret = ENOMEM;
200 goto bail;
201 }
202
203 tmcast->n_attached++;
204
196 list_add_tail_rcu(&mqp->list, &tmcast->qp_list); 205 list_add_tail_rcu(&mqp->list, &tmcast->qp_list);
197 spin_unlock_irqrestore(&mcast_lock, flags);
198 ret = EEXIST; 206 ret = EEXIST;
199 goto bail; 207 goto bail;
200 } 208 }
201 209
210 if (dev->n_mcast_grps_allocated == ib_ipath_max_mcast_grps) {
211 ret = ENOMEM;
212 goto bail;
213 }
214
215 dev->n_mcast_grps_allocated++;
216
202 list_add_tail_rcu(&mqp->list, &mcast->qp_list); 217 list_add_tail_rcu(&mqp->list, &mcast->qp_list);
203 218
204 atomic_inc(&mcast->refcount); 219 atomic_inc(&mcast->refcount);
205 rb_link_node(&mcast->rb_node, pn, n); 220 rb_link_node(&mcast->rb_node, pn, n);
206 rb_insert_color(&mcast->rb_node, &mcast_tree); 221 rb_insert_color(&mcast->rb_node, &mcast_tree);
207 222
208 spin_unlock_irqrestore(&mcast_lock, flags);
209
210 ret = 0; 223 ret = 0;
211 224
212bail: 225bail:
226 spin_unlock_irqrestore(&mcast_lock, flags);
227
213 return ret; 228 return ret;
214} 229}
215 230
216int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) 231int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
217{ 232{
218 struct ipath_qp *qp = to_iqp(ibqp); 233 struct ipath_qp *qp = to_iqp(ibqp);
234 struct ipath_ibdev *dev = to_idev(ibqp->device);
219 struct ipath_mcast *mcast; 235 struct ipath_mcast *mcast;
220 struct ipath_mcast_qp *mqp; 236 struct ipath_mcast_qp *mqp;
221 int ret; 237 int ret;
@@ -235,7 +251,7 @@ int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
235 ret = -ENOMEM; 251 ret = -ENOMEM;
236 goto bail; 252 goto bail;
237 } 253 }
238 switch (ipath_mcast_add(mcast, mqp)) { 254 switch (ipath_mcast_add(dev, mcast, mqp)) {
239 case ESRCH: 255 case ESRCH:
240 /* Neither was used: can't attach the same QP twice. */ 256 /* Neither was used: can't attach the same QP twice. */
241 ipath_mcast_qp_free(mqp); 257 ipath_mcast_qp_free(mqp);
@@ -245,6 +261,12 @@ int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
245 case EEXIST: /* The mcast wasn't used */ 261 case EEXIST: /* The mcast wasn't used */
246 ipath_mcast_free(mcast); 262 ipath_mcast_free(mcast);
247 break; 263 break;
264 case ENOMEM:
265 /* Exceeded the maximum number of mcast groups. */
266 ipath_mcast_qp_free(mqp);
267 ipath_mcast_free(mcast);
268 ret = -ENOMEM;
269 goto bail;
248 default: 270 default:
249 break; 271 break;
250 } 272 }
@@ -258,6 +280,7 @@ bail:
258int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) 280int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
259{ 281{
260 struct ipath_qp *qp = to_iqp(ibqp); 282 struct ipath_qp *qp = to_iqp(ibqp);
283 struct ipath_ibdev *dev = to_idev(ibqp->device);
261 struct ipath_mcast *mcast = NULL; 284 struct ipath_mcast *mcast = NULL;
262 struct ipath_mcast_qp *p, *tmp; 285 struct ipath_mcast_qp *p, *tmp;
263 struct rb_node *n; 286 struct rb_node *n;
@@ -272,7 +295,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
272 while (1) { 295 while (1) {
273 if (n == NULL) { 296 if (n == NULL) {
274 spin_unlock_irqrestore(&mcast_lock, flags); 297 spin_unlock_irqrestore(&mcast_lock, flags);
275 ret = 0; 298 ret = -EINVAL;
276 goto bail; 299 goto bail;
277 } 300 }
278 301
@@ -296,6 +319,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
296 * link until we are sure there are no list walkers. 319 * link until we are sure there are no list walkers.
297 */ 320 */
298 list_del_rcu(&p->list); 321 list_del_rcu(&p->list);
322 mcast->n_attached--;
299 323
300 /* If this was the last attached QP, remove the GID too. */ 324 /* If this was the last attached QP, remove the GID too. */
301 if (list_empty(&mcast->qp_list)) { 325 if (list_empty(&mcast->qp_list)) {
@@ -319,6 +343,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
319 atomic_dec(&mcast->refcount); 343 atomic_dec(&mcast->refcount);
320 wait_event(mcast->wait, !atomic_read(&mcast->refcount)); 344 wait_event(mcast->wait, !atomic_read(&mcast->refcount));
321 ipath_mcast_free(mcast); 345 ipath_mcast_free(mcast);
346 dev->n_mcast_grps_allocated--;
322 } 347 }
323 348
324 ret = 0; 349 ret = 0;
diff --git a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c
index adc5322f15c1..f8f9e2e8cbdd 100644
--- a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c
+++ b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
diff --git a/drivers/infiniband/hw/ipath/ips_common.h b/drivers/infiniband/hw/ipath/ips_common.h
deleted file mode 100644
index ab7cbbbfd03a..000000000000
--- a/drivers/infiniband/hw/ipath/ips_common.h
+++ /dev/null
@@ -1,263 +0,0 @@
1#ifndef IPS_COMMON_H
2#define IPS_COMMON_H
3/*
4 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 */
34
35#include "ipath_common.h"
36
37struct ipath_header {
38 /*
39 * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset -
40 * 14 bits before ECO change ~28 Dec 03. After that, Vers 4,
41 * Port 3, TID 11, offset 14.
42 */
43 __le32 ver_port_tid_offset;
44 __le16 chksum;
45 __le16 pkt_flags;
46};
47
48struct ips_message_header {
49 __be16 lrh[4];
50 __be32 bth[3];
51 /* fields below this point are in host byte order */
52 struct ipath_header iph;
53 __u8 sub_opcode;
54 __u8 flags;
55 __u16 src_rank;
56 /* 24 bits. The upper 8 bit is available for other use */
57 union {
58 struct {
59 unsigned ack_seq_num:24;
60 unsigned port:4;
61 unsigned unused:4;
62 };
63 __u32 ack_seq_num_org;
64 };
65 __u8 expected_tid_session_id;
66 __u8 tinylen; /* to aid MPI */
67 union {
68 __u16 tag; /* to aid MPI */
69 __u16 mqhdr; /* for PSM MQ */
70 };
71 union {
72 __u32 mpi[4]; /* to aid MPI */
73 __u32 data[4];
74 __u64 mq[2]; /* for PSM MQ */
75 struct {
76 __u16 mtu;
77 __u8 major_ver;
78 __u8 minor_ver;
79 __u32 not_used; //free
80 __u32 run_id;
81 __u32 client_ver;
82 };
83 };
84};
85
86struct ether_header {
87 __be16 lrh[4];
88 __be32 bth[3];
89 struct ipath_header iph;
90 __u8 sub_opcode;
91 __u8 cmd;
92 __be16 lid;
93 __u16 mac[3];
94 __u8 frag_num;
95 __u8 seq_num;
96 __le32 len;
97 /* MUST be of word size due to PIO write requirements */
98 __le32 csum;
99 __le16 csum_offset;
100 __le16 flags;
101 __u16 first_2_bytes;
102 __u8 unused[2]; /* currently unused */
103};
104
105/*
106 * The PIO buffer used for sending infinipath messages must only be written
107 * in 32-bit words, all the data must be written, and no writes can occur
108 * after the last word is written (which transfers "ownership" of the buffer
109 * to the chip and triggers the message to be sent).
110 * Since the Linux sk_buff structure can be recursive, non-aligned, and
111 * any number of bytes in each segment, we use the following structure
112 * to keep information about the overall state of the copy operation.
113 * This is used to save the information needed to store the checksum
114 * in the right place before sending the last word to the hardware and
115 * to buffer the last 0-3 bytes of non-word sized segments.
116 */
117struct copy_data_s {
118 struct ether_header *hdr;
119 /* addr of PIO buf to write csum to */
120 __u32 __iomem *csum_pio;
121 __u32 __iomem *to; /* addr of PIO buf to write data to */
122 __u32 device; /* which device to allocate PIO bufs from */
123 __s32 error; /* set if there is an error. */
124 __s32 extra; /* amount of data saved in u.buf below */
125 __u32 len; /* total length to send in bytes */
126 __u32 flen; /* frament length in words */
127 __u32 csum; /* partial IP checksum */
128 __u32 pos; /* position for partial checksum */
129 __u32 offset; /* offset to where data currently starts */
130 __s32 checksum_calc; /* set to 1 when csum has been calculated */
131 struct sk_buff *skb;
132 union {
133 __u32 w;
134 __u8 buf[4];
135 } u;
136};
137
138/* IB - LRH header consts */
139#define IPS_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */
140#define IPS_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */
141
142#define IPS_OFFSET 0
143
144/*
145 * defines the cut-off point between the header queue and eager/expected
146 * TID queue
147 */
148#define NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE \
149 ((sizeof(struct ips_message_header) - \
150 offsetof(struct ips_message_header, iph)) >> 2)
151
152/* OpCodes */
153#define OPCODE_IPS 0xC0
154#define OPCODE_ITH4X 0xC1
155
156/* OpCode 30 is use by stand-alone test programs */
157#define OPCODE_RAW_DATA 0xDE
158/* last OpCode (31) is reserved for test */
159#define OPCODE_TEST 0xDF
160
161/* sub OpCodes - ips */
162#define OPCODE_SEQ_DATA 0x01
163#define OPCODE_SEQ_CTRL 0x02
164
165#define OPCODE_SEQ_MQ_DATA 0x03
166#define OPCODE_SEQ_MQ_CTRL 0x04
167
168#define OPCODE_ACK 0x10
169#define OPCODE_NAK 0x11
170
171#define OPCODE_ERR_CHK 0x20
172#define OPCODE_ERR_CHK_PLS 0x21
173
174#define OPCODE_STARTUP 0x30
175#define OPCODE_STARTUP_ACK 0x31
176#define OPCODE_STARTUP_NAK 0x32
177
178#define OPCODE_STARTUP_EXT 0x34
179#define OPCODE_STARTUP_ACK_EXT 0x35
180#define OPCODE_STARTUP_NAK_EXT 0x36
181
182#define OPCODE_TIDS_RELEASE 0x40
183#define OPCODE_TIDS_RELEASE_CONFIRM 0x41
184
185#define OPCODE_CLOSE 0x50
186#define OPCODE_CLOSE_ACK 0x51
187/*
188 * like OPCODE_CLOSE, but no complaint if other side has already closed.
189 * Used when doing abort(), MPI_Abort(), etc.
190 */
191#define OPCODE_ABORT 0x52
192
193/* sub OpCodes - ith4x */
194#define OPCODE_ENCAP 0x81
195#define OPCODE_LID_ARP 0x82
196
197/* Receive Header Queue: receive type (from infinipath) */
198#define RCVHQ_RCV_TYPE_EXPECTED 0
199#define RCVHQ_RCV_TYPE_EAGER 1
200#define RCVHQ_RCV_TYPE_NON_KD 2
201#define RCVHQ_RCV_TYPE_ERROR 3
202
203/* misc. */
204#define SIZE_OF_CRC 1
205
206#define EAGER_TID_ID INFINIPATH_I_TID_MASK
207
208#define IPS_DEFAULT_P_KEY 0xFFFF
209
210#define IPS_PERMISSIVE_LID 0xFFFF
211#define IPS_MULTICAST_LID_BASE 0xC000
212
213#define IPS_AETH_CREDIT_SHIFT 24
214#define IPS_AETH_CREDIT_MASK 0x1F
215#define IPS_AETH_CREDIT_INVAL 0x1F
216
217#define IPS_PSN_MASK 0xFFFFFF
218#define IPS_MSN_MASK 0xFFFFFF
219#define IPS_QPN_MASK 0xFFFFFF
220#define IPS_MULTICAST_QPN 0xFFFFFF
221
222/* functions for extracting fields from rcvhdrq entries */
223static inline __u32 ips_get_hdr_err_flags(const __le32 * rbuf)
224{
225 return __le32_to_cpu(rbuf[1]);
226}
227
228static inline __u32 ips_get_index(const __le32 * rbuf)
229{
230 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT)
231 & INFINIPATH_RHF_EGRINDEX_MASK;
232}
233
234static inline __u32 ips_get_rcv_type(const __le32 * rbuf)
235{
236 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT)
237 & INFINIPATH_RHF_RCVTYPE_MASK;
238}
239
240static inline __u32 ips_get_length_in_bytes(const __le32 * rbuf)
241{
242 return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT)
243 & INFINIPATH_RHF_LENGTH_MASK) << 2;
244}
245
246static inline void *ips_get_first_protocol_header(const __u32 * rbuf)
247{
248 return (void *)&rbuf[2];
249}
250
251static inline struct ips_message_header *ips_get_ips_header(const __u32 *
252 rbuf)
253{
254 return (struct ips_message_header *)&rbuf[2];
255}
256
257static inline __u32 ips_get_ipath_ver(__le32 hdrword)
258{
259 return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT)
260 & INFINIPATH_I_VERS_MASK;
261}
262
263#endif /* IPS_COMMON_H */
diff --git a/drivers/infiniband/hw/ipath/verbs_debug.h b/drivers/infiniband/hw/ipath/verbs_debug.h
index 40d693cf3f94..6186676f2a16 100644
--- a/drivers/infiniband/hw/ipath/verbs_debug.h
+++ b/drivers/infiniband/hw/ipath/verbs_debug.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index d536217e700e..a29b1b6d82b1 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -900,7 +900,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev)
900 mthca_is_memfree(dev) ? 900 mthca_is_memfree(dev) ?
901 mthca_arbel_interrupt : 901 mthca_arbel_interrupt :
902 mthca_tavor_interrupt, 902 mthca_tavor_interrupt,
903 SA_SHIRQ, DRV_NAME, dev); 903 IRQF_SHARED, DRV_NAME, dev);
904 if (err) 904 if (err)
905 goto err_out_cmd; 905 goto err_out_cmd;
906 dev->eq_table.have_irq = 1; 906 dev->eq_table.have_irq = 1;
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 1f0e720267d7..1e03153b9bca 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -352,7 +352,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
352 for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { 352 for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) {
353 pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN); 353 pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN);
354 if (request_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd_interrupt, 354 if (request_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd_interrupt,
355 SA_INTERRUPT | SA_TRIGGER_RISING, 355 IRQF_DISABLED | IRQF_TRIGGER_RISING,
356 "corgikbd", corgikbd)) 356 "corgikbd", corgikbd))
357 printk(KERN_WARNING "corgikbd: Can't get IRQ: %d!\n", i); 357 printk(KERN_WARNING "corgikbd: Can't get IRQ: %d!\n", i);
358 } 358 }
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index c5d03fb77bcb..e385710233f4 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -410,7 +410,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
410 for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) { 410 for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) {
411 pxa_gpio_mode(spitz_senses[i] | GPIO_IN); 411 pxa_gpio_mode(spitz_senses[i] | GPIO_IN);
412 if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt, 412 if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt,
413 SA_INTERRUPT|SA_TRIGGER_RISING, 413 IRQF_DISABLED|IRQF_TRIGGER_RISING,
414 "Spitzkbd Sense", spitzkbd)) 414 "Spitzkbd Sense", spitzkbd))
415 printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i); 415 printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i);
416 } 416 }
@@ -425,19 +425,19 @@ static int __init spitzkbd_probe(struct platform_device *dev)
425 pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN); 425 pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN);
426 426
427 request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt, 427 request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt,
428 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, 428 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
429 "Spitzkbd Sync", spitzkbd); 429 "Spitzkbd Sync", spitzkbd);
430 request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt, 430 request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt,
431 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, 431 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
432 "Spitzkbd PwrOn", spitzkbd); 432 "Spitzkbd PwrOn", spitzkbd);
433 request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr, 433 request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr,
434 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, 434 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
435 "Spitzkbd SWA", spitzkbd); 435 "Spitzkbd SWA", spitzkbd);
436 request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, 436 request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr,
437 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, 437 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
438 "Spitzkbd SWB", spitzkbd); 438 "Spitzkbd SWB", spitzkbd);
439 request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr, 439 request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr,
440 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, 440 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
441 "Spitzkbd HP", spitzkbd); 441 "Spitzkbd HP", spitzkbd);
442 442
443 printk(KERN_INFO "input: Spitz Keyboard Registered\n"); 443 printk(KERN_INFO "input: Spitz Keyboard Registered\n");
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 3a6ae85cd69c..805b636e73d9 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -113,7 +113,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
113 input_dev->event = ixp4xx_spkr_event; 113 input_dev->event = ixp4xx_spkr_event;
114 114
115 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, 115 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
116 SA_INTERRUPT | SA_TIMER, "ixp4xx-beeper", (void *) dev->id); 116 IRQF_DISABLED | IRQF_TIMER, "ixp4xx-beeper", (void *) dev->id);
117 if (err) 117 if (err)
118 goto err_free_device; 118 goto err_free_device;
119 119
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c
index 09b6ffdb7582..872b30bf7aad 100644
--- a/drivers/input/mouse/rpcmouse.c
+++ b/drivers/input/mouse/rpcmouse.c
@@ -85,7 +85,7 @@ static int __init rpcmouse_init(void)
85 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX); 85 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX);
86 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY); 86 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY);
87 87
88 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, SA_SHIRQ, "rpcmouse", rpcmouse_dev)) { 88 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) {
89 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); 89 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n");
90 input_free_device(rpcmouse_dev); 90 input_free_device(rpcmouse_dev);
91 return -EBUSY; 91 return -EBUSY;
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index 22d02d53eb16..cde036a92168 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -370,7 +370,7 @@ static int __init gscps2_probe(struct parisc_device *dev)
370 serio->dev.parent = &dev->dev; 370 serio->dev.parent = &dev->dev;
371 371
372 ret = -EBUSY; 372 ret = -EBUSY;
373 if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port)) 373 if (request_irq(dev->irq, gscps2_interrupt, IRQF_SHARED, ps2port->port->name, ps2port))
374 goto fail_miserably; 374 goto fail_miserably;
375 375
376 if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) { 376 if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) {
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 7fa4bc222583..06a3f25657dd 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -328,7 +328,7 @@ static int i8042_open(struct serio *serio)
328 return 0; 328 return 0;
329 329
330 if (request_irq(port->irq, i8042_interrupt, 330 if (request_irq(port->irq, i8042_interrupt,
331 SA_SHIRQ, "i8042", i8042_request_irq_cookie)) { 331 IRQF_SHARED, "i8042", i8042_request_irq_cookie)) {
332 printk(KERN_ERR "i8042.c: Can't get irq %d for %s, unregistering the port.\n", port->irq, port->name); 332 printk(KERN_ERR "i8042.c: Can't get irq %d for %s, unregistering the port.\n", port->irq, port->name);
333 goto irq_fail; 333 goto irq_fail;
334 } 334 }
@@ -610,7 +610,7 @@ static int __devinit i8042_check_aux(void)
610 */ 610 */
611 611
612 if (request_irq(i8042_ports[I8042_AUX_PORT_NO].irq, i8042_interrupt, 612 if (request_irq(i8042_ports[I8042_AUX_PORT_NO].irq, i8042_interrupt,
613 SA_SHIRQ, "i8042", &i8042_check_aux_cookie)) 613 IRQF_SHARED, "i8042", &i8042_check_aux_cookie))
614 return -1; 614 return -1;
615 free_irq(i8042_ports[I8042_AUX_PORT_NO].irq, &i8042_check_aux_cookie); 615 free_irq(i8042_ports[I8042_AUX_PORT_NO].irq, &i8042_check_aux_cookie);
616 616
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c
index 1e139c5e59de..fb727c665253 100644
--- a/drivers/input/serio/pcips2.c
+++ b/drivers/input/serio/pcips2.c
@@ -107,7 +107,7 @@ static int pcips2_open(struct serio *io)
107 outb(PS2_CTRL_ENABLE, ps2if->base); 107 outb(PS2_CTRL_ENABLE, ps2if->base);
108 pcips2_flush_input(ps2if); 108 pcips2_flush_input(ps2if);
109 109
110 ret = request_irq(ps2if->dev->irq, pcips2_interrupt, SA_SHIRQ, 110 ret = request_irq(ps2if->dev->irq, pcips2_interrupt, IRQF_SHARED,
111 "pcips2", ps2if); 111 "pcips2", ps2if);
112 if (ret == 0) 112 if (ret == 0)
113 val = PS2_CTRL_ENABLE | PS2_CTRL_RXIRQ; 113 val = PS2_CTRL_ENABLE | PS2_CTRL_RXIRQ;
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 386023c594d7..66e411badf70 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -773,7 +773,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
773 773
774 ts->last_msg = m; 774 ts->last_msg = m;
775 775
776 if (request_irq(spi->irq, ads7846_irq, SA_TRIGGER_FALLING, 776 if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
777 spi->dev.driver->name, ts)) { 777 spi->dev.driver->name, ts)) {
778 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 778 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
779 err = -EBUSY; 779 err = -EBUSY;
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index b3eaf23b17c8..9b66271d3ba8 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -318,7 +318,7 @@ static int __init corgits_probe(struct platform_device *pdev)
318 corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS); 318 corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
319 mdelay(5); 319 mdelay(5);
320 320
321 if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) { 321 if (request_irq(corgi_ts->irq_gpio, ts_interrupt, IRQF_DISABLED, "ts", corgi_ts)) {
322 err = -EBUSY; 322 err = -EBUSY;
323 goto fail; 323 goto fail;
324 } 324 }
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index 2de2139f2fed..e2b910018773 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -399,14 +399,14 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
399 set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); 399 set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE);
400 400
401 if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, 401 if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler,
402 SA_SHIRQ | SA_INTERRUPT, "h3600_action", &ts->dev)) { 402 IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) {
403 printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); 403 printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
404 err = -EBUSY; 404 err = -EBUSY;
405 goto fail2; 405 goto fail2;
406 } 406 }
407 407
408 if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, 408 if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
409 SA_SHIRQ | SA_INTERRUPT, "h3600_suspend", &ts->dev)) { 409 IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) {
410 printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); 410 printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
411 err = -EBUSY; 411 err = -EBUSY;
412 goto fail3; 412 goto fail3;
diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c
index 957dd5a1b15e..fa97e0f79e7e 100644
--- a/drivers/input/touchscreen/hp680_ts_input.c
+++ b/drivers/input/touchscreen/hp680_ts_input.c
@@ -109,7 +109,7 @@ static int __init hp680_ts_init(void)
109 input_register_device(hp680_ts_dev); 109 input_register_device(hp680_ts_dev);
110 110
111 if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt, 111 if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt,
112 SA_INTERRUPT, MODNAME, 0) < 0) { 112 IRQF_DISABLED, MODNAME, 0) < 0) {
113 printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n", 113 printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n",
114 HP680_TS_IRQ); 114 HP680_TS_IRQ);
115 input_unregister_device(hp680_ts_dev); 115 input_unregister_device(hp680_ts_dev);
diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c
index 7edf19b32299..90e2e6643d19 100644
--- a/drivers/isdn/hardware/avm/b1pci.c
+++ b/drivers/isdn/hardware/avm/b1pci.c
@@ -97,7 +97,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
97 b1_reset(card->port); 97 b1_reset(card->port);
98 b1_getrevision(card); 98 b1_getrevision(card);
99 99
100 retval = request_irq(card->irq, b1_interrupt, SA_SHIRQ, card->name, card); 100 retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card);
101 if (retval) { 101 if (retval) {
102 printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); 102 printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq);
103 retval = -EBUSY; 103 retval = -EBUSY;
@@ -234,7 +234,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev)
234 b1dma_reset(card); 234 b1dma_reset(card);
235 b1_getrevision(card); 235 b1_getrevision(card);
236 236
237 retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); 237 retval = request_irq(card->irq, b1dma_interrupt, IRQF_SHARED, card->name, card);
238 if (retval) { 238 if (retval) {
239 printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", 239 printk(KERN_ERR "b1pci: unable to get IRQ %d.\n",
240 card->irq); 240 card->irq);
diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c
index ad5025155b4e..e479c0aef38d 100644
--- a/drivers/isdn/hardware/avm/b1pcmcia.c
+++ b/drivers/isdn/hardware/avm/b1pcmcia.c
@@ -82,7 +82,7 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq,
82 card->irq = irq; 82 card->irq = irq;
83 card->cardtype = cardtype; 83 card->cardtype = cardtype;
84 84
85 retval = request_irq(card->irq, b1_interrupt, SA_SHIRQ, card->name, card); 85 retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card);
86 if (retval) { 86 if (retval) {
87 printk(KERN_ERR "b1pcmcia: unable to get IRQ %d.\n", 87 printk(KERN_ERR "b1pcmcia: unable to get IRQ %d.\n",
88 card->irq); 88 card->irq);
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index e7924a545d49..6c3d5f5f1f4b 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -1172,7 +1172,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
1172 } 1172 }
1173 c4_reset(card); 1173 c4_reset(card);
1174 1174
1175 retval = request_irq(card->irq, c4_interrupt, SA_SHIRQ, card->name, card); 1175 retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card);
1176 if (retval) { 1176 if (retval) {
1177 printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq); 1177 printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq);
1178 retval = -EBUSY; 1178 retval = -EBUSY;
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c
index af85511600d0..d1e253c94db4 100644
--- a/drivers/isdn/hardware/avm/t1pci.c
+++ b/drivers/isdn/hardware/avm/t1pci.c
@@ -103,7 +103,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev)
103 } 103 }
104 b1dma_reset(card); 104 b1dma_reset(card);
105 105
106 retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); 106 retval = request_irq(card->irq, b1dma_interrupt, IRQF_SHARED, card->name, card);
107 if (retval) { 107 if (retval) {
108 printk(KERN_ERR "t1pci: unable to get IRQ %d.\n", card->irq); 108 printk(KERN_ERR "t1pci: unable to get IRQ %d.\n", card->irq);
109 retval = -EBUSY; 109 retval = -EBUSY;
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index b05e35f7ccb1..b7dadba13e82 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -486,7 +486,7 @@ void __inline__ outpp(void __iomem *addr, word p)
486int diva_os_register_irq(void *context, byte irq, const char *name) 486int diva_os_register_irq(void *context, byte irq, const char *name)
487{ 487{
488 int result = request_irq(irq, diva_os_irq_wrapper, 488 int result = request_irq(irq, diva_os_irq_wrapper,
489 SA_INTERRUPT | SA_SHIRQ, name, context); 489 IRQF_DISABLED | IRQF_SHARED, name, context);
490 return (result); 490 return (result);
491} 491}
492 492
diff --git a/drivers/isdn/hisax/avm_a1p.c b/drivers/isdn/hisax/avm_a1p.c
index d643bb32ad09..574e252dfa43 100644
--- a/drivers/isdn/hisax/avm_a1p.c
+++ b/drivers/isdn/hisax/avm_a1p.c
@@ -255,7 +255,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
255 cs->BC_Write_Reg = &WriteHSCX; 255 cs->BC_Write_Reg = &WriteHSCX;
256 cs->BC_Send_Data = &hscx_fill_fifo; 256 cs->BC_Send_Data = &hscx_fill_fifo;
257 cs->cardmsg = &AVM_card_msg; 257 cs->cardmsg = &AVM_card_msg;
258 cs->irq_flags = SA_SHIRQ; 258 cs->irq_flags = IRQF_SHARED;
259 cs->irq_func = &avm_a1p_interrupt; 259 cs->irq_func = &avm_a1p_interrupt;
260 260
261 ISACVersion(cs, "AVM A1 PCMCIA:"); 261 ISACVersion(cs, "AVM A1 PCMCIA:");
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index 93f3a5343a74..04f5917bf5a1 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -808,7 +808,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
808 printk(KERN_WARNING "FritzPCI: No PCI card found\n"); 808 printk(KERN_WARNING "FritzPCI: No PCI card found\n");
809 return(0); 809 return(0);
810 } 810 }
811 cs->irq_flags |= SA_SHIRQ; 811 cs->irq_flags |= IRQF_SHARED;
812#else 812#else
813 printk(KERN_WARNING "FritzPCI: NO_PCI_BIOS\n"); 813 printk(KERN_WARNING "FritzPCI: NO_PCI_BIOS\n");
814 return (0); 814 return (0);
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index de28cb54817d..3cf1f2421789 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -335,7 +335,7 @@ setup_bkm_a4t(struct IsdnCard *card)
335 cs->BC_Send_Data = &jade_fill_fifo; 335 cs->BC_Send_Data = &jade_fill_fifo;
336 cs->cardmsg = &BKM_card_msg; 336 cs->cardmsg = &BKM_card_msg;
337 cs->irq_func = &bkm_interrupt; 337 cs->irq_func = &bkm_interrupt;
338 cs->irq_flags |= SA_SHIRQ; 338 cs->irq_flags |= IRQF_SHARED;
339 ISACVersion(cs, "Telekom A4T:"); 339 ISACVersion(cs, "Telekom A4T:");
340 /* Jade version */ 340 /* Jade version */
341 JadeVersion(cs, "Telekom A4T:"); 341 JadeVersion(cs, "Telekom A4T:");
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index 9d1abfb93dde..15681f3e73b8 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -374,7 +374,7 @@ setup_sct_quadro(struct IsdnCard *card)
374 pci_ioaddr5 &= PCI_BASE_ADDRESS_IO_MASK; 374 pci_ioaddr5 &= PCI_BASE_ADDRESS_IO_MASK;
375 /* Take over */ 375 /* Take over */
376 cs->irq = pci_irq; 376 cs->irq = pci_irq;
377 cs->irq_flags |= SA_SHIRQ; 377 cs->irq_flags |= IRQF_SHARED;
378 /* pci_ioaddr1 is unique to all subdevices */ 378 /* pci_ioaddr1 is unique to all subdevices */
379 /* pci_ioaddr2 is for the fourth subdevice only */ 379 /* pci_ioaddr2 is for the fourth subdevice only */
380 /* pci_ioaddr3 is for the third subdevice only */ 380 /* pci_ioaddr3 is for the third subdevice only */
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index fbb9d02e3e29..323a02ef3844 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -1076,7 +1076,7 @@ setup_diva(struct IsdnCard *card)
1076 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); 1076 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
1077 return(0); 1077 return(0);
1078 } 1078 }
1079 cs->irq_flags |= SA_SHIRQ; 1079 cs->irq_flags |= IRQF_SHARED;
1080#else 1080#else
1081 printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n"); 1081 printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n");
1082 printk(KERN_WARNING "Diva: unable to config DIVA PCI\n"); 1082 printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 7a5cdb1dee1e..3b3e318f6076 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -85,8 +85,8 @@ static const char *ITACVer[] =
85 *** ***/ 85 *** ***/
86 86
87/* Config-Register (Read) */ 87/* Config-Register (Read) */
88#define ELSA_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */ 88#define ELIRQF_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */
89#define ELSA_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */ 89#define ELIRQF_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */
90#define ELSA_IRQ_IDX 0x38 /* Bit 3,4,5 des Config-Reg */ 90#define ELSA_IRQ_IDX 0x38 /* Bit 3,4,5 des Config-Reg */
91#define ELSA_IRQ_IDX_PCC8 0x30 /* Bit 4,5 des Config-Reg */ 91#define ELSA_IRQ_IDX_PCC8 0x30 /* Bit 4,5 des Config-Reg */
92#define ELSA_IRQ_IDX_PC 0x0c /* Bit 2,3 des Config-Reg */ 92#define ELSA_IRQ_IDX_PC 0x0c /* Bit 2,3 des Config-Reg */
@@ -102,7 +102,7 @@ static const char *ITACVer[] =
102#define ELSA_S0_POWER_BAD 0x08 /* Bit 3 S0-Bus Spannung fehlt */ 102#define ELSA_S0_POWER_BAD 0x08 /* Bit 3 S0-Bus Spannung fehlt */
103 103
104/* Status Flags */ 104/* Status Flags */
105#define ELSA_TIMER_AKTIV 1 105#define ELIRQF_TIMER_AKTIV 1
106#define ELSA_BAD_PWR 2 106#define ELSA_BAD_PWR 2
107#define ELSA_ASSIGN 4 107#define ELSA_ASSIGN 4
108 108
@@ -259,10 +259,10 @@ TimerRun(struct IsdnCardState *cs)
259 259
260 v = bytein(cs->hw.elsa.cfg); 260 v = bytein(cs->hw.elsa.cfg);
261 if ((cs->subtyp == ELSA_QS1000) || (cs->subtyp == ELSA_QS3000)) 261 if ((cs->subtyp == ELSA_QS1000) || (cs->subtyp == ELSA_QS3000))
262 return (0 == (v & ELSA_TIMER_RUN)); 262 return (0 == (v & ELIRQF_TIMER_RUN));
263 else if (cs->subtyp == ELSA_PCC8) 263 else if (cs->subtyp == ELSA_PCC8)
264 return (v & ELSA_TIMER_RUN_PCC8); 264 return (v & ELIRQF_TIMER_RUN_PCC8);
265 return (v & ELSA_TIMER_RUN); 265 return (v & ELIRQF_TIMER_RUN);
266} 266}
267/* 267/*
268 * fast interrupt HSCX stuff goes here 268 * fast interrupt HSCX stuff goes here
@@ -334,7 +334,7 @@ elsa_interrupt(int intno, void *dev_id, struct pt_regs *regs)
334 writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK, 0xFF); 334 writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK, 0xFF);
335 writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK + 0x40, 0xFF); 335 writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK + 0x40, 0xFF);
336 writereg(cs->hw.elsa.ale, cs->hw.elsa.isac, ISAC_MASK, 0xFF); 336 writereg(cs->hw.elsa.ale, cs->hw.elsa.isac, ISAC_MASK, 0xFF);
337 if (cs->hw.elsa.status & ELSA_TIMER_AKTIV) { 337 if (cs->hw.elsa.status & ELIRQF_TIMER_AKTIV) {
338 if (!TimerRun(cs)) { 338 if (!TimerRun(cs)) {
339 /* Timer Restart */ 339 /* Timer Restart */
340 byteout(cs->hw.elsa.timer, 0); 340 byteout(cs->hw.elsa.timer, 0);
@@ -685,7 +685,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
685 spin_lock_irqsave(&cs->lock, flags); 685 spin_lock_irqsave(&cs->lock, flags);
686 cs->hw.elsa.counter = 0; 686 cs->hw.elsa.counter = 0;
687 cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT; 687 cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT;
688 cs->hw.elsa.status |= ELSA_TIMER_AKTIV; 688 cs->hw.elsa.status |= ELIRQF_TIMER_AKTIV;
689 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); 689 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
690 byteout(cs->hw.elsa.timer, 0); 690 byteout(cs->hw.elsa.timer, 0);
691 spin_unlock_irqrestore(&cs->lock, flags); 691 spin_unlock_irqrestore(&cs->lock, flags);
@@ -693,7 +693,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
693 spin_lock_irqsave(&cs->lock, flags); 693 spin_lock_irqsave(&cs->lock, flags);
694 cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT; 694 cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
695 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); 695 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
696 cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV; 696 cs->hw.elsa.status &= ~ELIRQF_TIMER_AKTIV;
697 spin_unlock_irqrestore(&cs->lock, flags); 697 spin_unlock_irqrestore(&cs->lock, flags);
698 printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n", 698 printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n",
699 cs->hw.elsa.counter); 699 cs->hw.elsa.counter);
@@ -1012,7 +1012,7 @@ setup_elsa(struct IsdnCard *card)
1012 cs->hw.elsa.timer = 0; 1012 cs->hw.elsa.timer = 0;
1013 cs->hw.elsa.trig = 0; 1013 cs->hw.elsa.trig = 0;
1014 cs->hw.elsa.ctrl = 0; 1014 cs->hw.elsa.ctrl = 0;
1015 cs->irq_flags |= SA_SHIRQ; 1015 cs->irq_flags |= IRQF_SHARED;
1016 printk(KERN_INFO 1016 printk(KERN_INFO
1017 "Elsa: %s defined at %#lx IRQ %d\n", 1017 "Elsa: %s defined at %#lx IRQ %d\n",
1018 Elsa_Types[cs->subtyp], 1018 Elsa_Types[cs->subtyp],
@@ -1061,7 +1061,7 @@ setup_elsa(struct IsdnCard *card)
1061 test_and_set_bit(HW_IPAC, &cs->HW_Flags); 1061 test_and_set_bit(HW_IPAC, &cs->HW_Flags);
1062 cs->hw.elsa.timer = 0; 1062 cs->hw.elsa.timer = 0;
1063 cs->hw.elsa.trig = 0; 1063 cs->hw.elsa.trig = 0;
1064 cs->irq_flags |= SA_SHIRQ; 1064 cs->irq_flags |= IRQF_SHARED;
1065 printk(KERN_INFO 1065 printk(KERN_INFO
1066 "Elsa: %s defined at %#lx/0x%x IRQ %d\n", 1066 "Elsa: %s defined at %#lx/0x%x IRQ %d\n",
1067 Elsa_Types[cs->subtyp], 1067 Elsa_Types[cs->subtyp],
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index 5f4876184691..8fcbe2e7d765 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -405,7 +405,7 @@ setup_enternow_pci(struct IsdnCard *card)
405 cs->BC_Send_Data = &netjet_fill_dma; 405 cs->BC_Send_Data = &netjet_fill_dma;
406 cs->cardmsg = &enpci_card_msg; 406 cs->cardmsg = &enpci_card_msg;
407 cs->irq_func = &enpci_interrupt; 407 cs->irq_func = &enpci_interrupt;
408 cs->irq_flags |= SA_SHIRQ; 408 cs->irq_flags |= IRQF_SHARED;
409 409
410 return (1); 410 return (1);
411} 411}
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 82a1d2e86cee..3e7d92303582 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -592,7 +592,7 @@ setup_gazelpci(struct IsdnCardState *cs)
592 cs->hw.gazel.hscxfifo[0] = cs->hw.gazel.hscx[0]; 592 cs->hw.gazel.hscxfifo[0] = cs->hw.gazel.hscx[0];
593 cs->hw.gazel.hscxfifo[1] = cs->hw.gazel.hscx[1]; 593 cs->hw.gazel.hscxfifo[1] = cs->hw.gazel.hscx[1];
594 cs->irq = pci_irq; 594 cs->irq = pci_irq;
595 cs->irq_flags |= SA_SHIRQ; 595 cs->irq_flags |= IRQF_SHARED;
596 596
597 switch (seekcard) { 597 switch (seekcard) {
598 case PCI_DEVICE_ID_PLX_R685: 598 case PCI_DEVICE_ID_PLX_R685:
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 913fd27a1f55..0f967b3df79d 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1552,7 +1552,7 @@ setup_instance(hfc4s8s_hw * hw)
1552 INIT_WORK(&hw->tqueue, (void *) (void *) hfc4s8s_bh, hw); 1552 INIT_WORK(&hw->tqueue, (void *) (void *) hfc4s8s_bh, hw);
1553 1553
1554 if (request_irq 1554 if (request_irq
1555 (hw->irq, hfc4s8s_interrupt, SA_SHIRQ, hw->card_name, hw)) { 1555 (hw->irq, hfc4s8s_interrupt, IRQF_SHARED, hw->card_name, hw)) {
1556 printk(KERN_INFO 1556 printk(KERN_INFO
1557 "HFC-4S/8S: unable to alloc irq %d, card ignored\n", 1557 "HFC-4S/8S: unable to alloc irq %d, card ignored\n",
1558 hw->irq); 1558 hw->irq);
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index fa9615747e26..7241e73879ba 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -1732,7 +1732,7 @@ setup_hfcpci(struct IsdnCard *card)
1732 cs->BC_Read_Reg = NULL; 1732 cs->BC_Read_Reg = NULL;
1733 cs->BC_Write_Reg = NULL; 1733 cs->BC_Write_Reg = NULL;
1734 cs->irq_func = &hfcpci_interrupt; 1734 cs->irq_func = &hfcpci_interrupt;
1735 cs->irq_flags |= SA_SHIRQ; 1735 cs->irq_flags |= IRQF_SHARED;
1736 cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer; 1736 cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer;
1737 cs->hw.hfcpci.timer.data = (long) cs; 1737 cs->hw.hfcpci.timer.data = (long) cs;
1738 init_timer(&cs->hw.hfcpci.timer); 1738 init_timer(&cs->hw.hfcpci.timer);
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index dbcca287ee2c..1d7cf3bd6aa3 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -725,11 +725,11 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
725 725
726 switch (adapter->type) { 726 switch (adapter->type) {
727 case AVM_FRITZ_PCIV2: 727 case AVM_FRITZ_PCIV2:
728 retval = request_irq(adapter->irq, fcpci2_irq, SA_SHIRQ, 728 retval = request_irq(adapter->irq, fcpci2_irq, IRQF_SHARED,
729 "fcpcipnp", adapter); 729 "fcpcipnp", adapter);
730 break; 730 break;
731 case AVM_FRITZ_PCI: 731 case AVM_FRITZ_PCI:
732 retval = request_irq(adapter->irq, fcpci_irq, SA_SHIRQ, 732 retval = request_irq(adapter->irq, fcpci_irq, IRQF_SHARED,
733 "fcpcipnp", adapter); 733 "fcpcipnp", adapter);
734 break; 734 break;
735 case AVM_FRITZ_PNP: 735 case AVM_FRITZ_PNP:
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index 868762cf76c6..79a97b1c3812 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -336,7 +336,7 @@ setup_niccy(struct IsdnCard *card)
336 printk(KERN_WARNING "Niccy: No PCI card found\n"); 336 printk(KERN_WARNING "Niccy: No PCI card found\n");
337 return(0); 337 return(0);
338 } 338 }
339 cs->irq_flags |= SA_SHIRQ; 339 cs->irq_flags |= IRQF_SHARED;
340 cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA; 340 cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
341 cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR; 341 cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
342 cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA; 342 cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index 1b3ac46df52c..e5b900a6fa0b 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -271,7 +271,7 @@ setup_netjet_s(struct IsdnCard *card)
271 setup_isac(cs); 271 setup_isac(cs);
272 cs->cardmsg = &NETjet_S_card_msg; 272 cs->cardmsg = &NETjet_S_card_msg;
273 cs->irq_func = &netjet_s_interrupt; 273 cs->irq_func = &netjet_s_interrupt;
274 cs->irq_flags |= SA_SHIRQ; 274 cs->irq_flags |= IRQF_SHARED;
275 ISACVersion(cs, "NETjet-S:"); 275 ISACVersion(cs, "NETjet-S:");
276 return (1); 276 return (1);
277} 277}
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index 7a6010eac60d..7002b09936d4 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -237,7 +237,7 @@ setup_netjet_u(struct IsdnCard *card)
237 cs->BC_Send_Data = &netjet_fill_dma; 237 cs->BC_Send_Data = &netjet_fill_dma;
238 cs->cardmsg = &NETjet_U_card_msg; 238 cs->cardmsg = &NETjet_U_card_msg;
239 cs->irq_func = &netjet_u_interrupt; 239 cs->irq_func = &netjet_u_interrupt;
240 cs->irq_flags |= SA_SHIRQ; 240 cs->irq_flags |= IRQF_SHARED;
241 ICCVersion(cs, "NETspider-U:"); 241 ICCVersion(cs, "NETspider-U:");
242 return (1); 242 return (1);
243} 243}
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index 11ea456626b6..8d8e8a299892 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -632,7 +632,7 @@ setup_sedlbauer(struct IsdnCard *card)
632 printk(KERN_WARNING "Sedlbauer: No PCI card found\n"); 632 printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
633 return(0); 633 return(0);
634 } 634 }
635 cs->irq_flags |= SA_SHIRQ; 635 cs->irq_flags |= IRQF_SHARED;
636 cs->hw.sedl.bus = SEDL_BUS_PCI; 636 cs->hw.sedl.bus = SEDL_BUS_PCI;
637 sub_vendor_id = dev_sedl->subsystem_vendor; 637 sub_vendor_id = dev_sedl->subsystem_vendor;
638 sub_id = dev_sedl->subsystem_device; 638 sub_id = dev_sedl->subsystem_device;
@@ -809,7 +809,7 @@ ready:
809 cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_HSCX; 809 cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_HSCX;
810 cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET; 810 cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
811 cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET; 811 cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
812 cs->irq_flags |= SA_SHIRQ; 812 cs->irq_flags |= IRQF_SHARED;
813 } else { 813 } else {
814 cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ADR; 814 cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ADR;
815 cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ISAC; 815 cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ISAC;
diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c
index 090abd16b4bc..5cb712437da4 100644
--- a/drivers/isdn/hisax/teles3.c
+++ b/drivers/isdn/hisax/teles3.c
@@ -369,7 +369,7 @@ setup_teles3(struct IsdnCard *card)
369 cs->hw.teles3.hscx[1] + 96); 369 cs->hw.teles3.hscx[1] + 96);
370 return (0); 370 return (0);
371 } 371 }
372 cs->irq_flags |= SA_SHIRQ; /* cardbus can share */ 372 cs->irq_flags |= IRQF_SHARED; /* cardbus can share */
373 } else { 373 } else {
374 if (cs->hw.teles3.cfg_reg) { 374 if (cs->hw.teles3.cfg_reg) {
375 if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) { 375 if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index a1bb73e28841..9382cdf04d8d 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -347,7 +347,7 @@ setup_telespci(struct IsdnCard *card)
347 cs->BC_Send_Data = &hscx_fill_fifo; 347 cs->BC_Send_Data = &hscx_fill_fifo;
348 cs->cardmsg = &TelesPCI_card_msg; 348 cs->cardmsg = &TelesPCI_card_msg;
349 cs->irq_func = &telespci_interrupt; 349 cs->irq_func = &telespci_interrupt;
350 cs->irq_flags |= SA_SHIRQ; 350 cs->irq_flags |= IRQF_SHARED;
351 ISACVersion(cs, "TelesPCI:"); 351 ISACVersion(cs, "TelesPCI:");
352 if (HscxVersion(cs, "TelesPCI:")) { 352 if (HscxVersion(cs, "TelesPCI:")) {
353 printk(KERN_WARNING 353 printk(KERN_WARNING
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index 00e4fa2aef51..6c68419c05ff 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -1080,7 +1080,7 @@ setup_w6692(struct IsdnCard *card)
1080 cs->BC_Send_Data = &W6692B_fill_fifo; 1080 cs->BC_Send_Data = &W6692B_fill_fifo;
1081 cs->cardmsg = &w6692_card_msg; 1081 cs->cardmsg = &w6692_card_msg;
1082 cs->irq_func = &W6692_interrupt; 1082 cs->irq_func = &W6692_interrupt;
1083 cs->irq_flags |= SA_SHIRQ; 1083 cs->irq_flags |= IRQF_SHARED;
1084 W6692Version(cs, "W6692:"); 1084 W6692Version(cs, "W6692:");
1085 printk(KERN_INFO "W6692 ISTA=0x%X\n", ReadW6692(cs, W_ISTA)); 1085 printk(KERN_INFO "W6692 ISTA=0x%X\n", ReadW6692(cs, W_ISTA));
1086 printk(KERN_INFO "W6692 IMASK=0x%X\n", ReadW6692(cs, W_IMASK)); 1086 printk(KERN_INFO "W6692 IMASK=0x%X\n", ReadW6692(cs, W_IMASK));
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 89fd531fbce6..73afebdf80bd 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -435,7 +435,7 @@ ergo_inithardware(hysdn_card * card)
435 } 435 }
436 436
437 ergo_stopcard(card); /* disable interrupts */ 437 ergo_stopcard(card); /* disable interrupts */
438 if (request_irq(card->irq, ergo_interrupt, SA_SHIRQ, "HYSDN", card)) { 438 if (request_irq(card->irq, ergo_interrupt, IRQF_SHARED, "HYSDN", card)) {
439 ergo_releasehardware(card); /* return the acquired hardware */ 439 ergo_releasehardware(card); /* return the acquired hardware */
440 return (-1); 440 return (-1);
441 } 441 }
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c
index 62b7acfad8a4..a627e68023f6 100644
--- a/drivers/isdn/sc/init.c
+++ b/drivers/isdn/sc/init.c
@@ -342,7 +342,7 @@ static int __init sc_init(void)
342 */ 342 */
343 sc_adapter[cinst]->interrupt = irq[b]; 343 sc_adapter[cinst]->interrupt = irq[b];
344 if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, 344 if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler,
345 SA_INTERRUPT, interface->id, NULL)) 345 IRQF_DISABLED, interface->id, NULL))
346 { 346 {
347 kfree(sc_adapter[cinst]->channel); 347 kfree(sc_adapter[cinst]->channel);
348 indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ 348 indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index d832e109b1b1..40ae7b6a939d 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -427,10 +427,10 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
427 427
428 /* MacIO itself has a different reg, we use it's PCI base */ 428 /* MacIO itself has a different reg, we use it's PCI base */
429 if (np == chip->of_node) { 429 if (np == chip->of_node) {
430 sprintf(dev->ofdev.dev.bus_id, "%1d.%016llx:%.*s", 430 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
431 chip->lbus.index, 431 chip->lbus.index,
432#ifdef CONFIG_PCI 432#ifdef CONFIG_PCI
433 (unsigned long long)pci_resource_start(chip->lbus.pdev, 0), 433 (unsigned int)pci_resource_start(chip->lbus.pdev, 0),
434#else 434#else
435 0, /* NuBus may want to do something better here */ 435 0, /* NuBus may want to do something better here */
436#endif 436#endif
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 030130570e0a..ff6d9bfdc3d2 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -555,7 +555,7 @@ static int smu_late_init(void)
555 555
556 if (smu->db_irq != NO_IRQ) { 556 if (smu->db_irq != NO_IRQ) {
557 if (request_irq(smu->db_irq, smu_db_intr, 557 if (request_irq(smu->db_irq, smu_db_intr,
558 SA_SHIRQ, "SMU doorbell", smu) < 0) { 558 IRQF_SHARED, "SMU doorbell", smu) < 0) {
559 printk(KERN_WARNING "SMU: can't " 559 printk(KERN_WARNING "SMU: can't "
560 "request interrupt %d\n", 560 "request interrupt %d\n",
561 smu->db_irq); 561 smu->db_irq);
@@ -565,7 +565,7 @@ static int smu_late_init(void)
565 565
566 if (smu->msg_irq != NO_IRQ) { 566 if (smu->msg_irq != NO_IRQ) {
567 if (request_irq(smu->msg_irq, smu_msg_intr, 567 if (request_irq(smu->msg_irq, smu_msg_intr,
568 SA_SHIRQ, "SMU message", smu) < 0) { 568 IRQF_SHARED, "SMU message", smu) < 0) {
569 printk(KERN_WARNING "SMU: can't " 569 printk(KERN_WARNING "SMU: can't "
570 "request interrupt %d\n", 570 "request interrupt %d\n",
571 smu->msg_irq); 571 smu->msg_irq);
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 8cdd4d265ffa..b88451e33c09 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -363,7 +363,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
363 saa7146_write(dev, MC2, 0xf8000000); 363 saa7146_write(dev, MC2, 0xf8000000);
364 364
365 /* request an interrupt for the saa7146 */ 365 /* request an interrupt for the saa7146 */
366 err = request_irq(pci->irq, interrupt_hw, SA_SHIRQ | SA_INTERRUPT, 366 err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED,
367 dev->name, dev); 367 dev->name, dev);
368 if (err < 0) { 368 if (err < 0) {
369 ERR(("request_irq() failed.\n")); 369 ERR(("request_irq() failed.\n"));
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
index f04041702191..eb2e6432c8c2 100644
--- a/drivers/media/dvb/b2c2/flexcop-pci.c
+++ b/drivers/media/dvb/b2c2/flexcop-pci.c
@@ -294,7 +294,7 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci)
294 pci_set_drvdata(fc_pci->pdev, fc_pci); 294 pci_set_drvdata(fc_pci->pdev, fc_pci);
295 295
296 if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr, 296 if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr,
297 SA_SHIRQ, DRIVER_NAME, fc_pci)) != 0) 297 IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0)
298 goto err_pci_iounmap; 298 goto err_pci_iounmap;
299 299
300 spin_lock_init(&fc_pci->irq_lock); 300 spin_lock_init(&fc_pci->irq_lock);
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index 761fa6e7d762..755822ee6e9b 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -488,7 +488,7 @@ static int __devinit bt878_probe(struct pci_dev *dev,
488 btwrite(0, BT848_INT_MASK); 488 btwrite(0, BT848_INT_MASK);
489 489
490 result = request_irq(bt->irq, bt878_irq, 490 result = request_irq(bt->irq, bt878_irq,
491 SA_SHIRQ | SA_INTERRUPT, "bt878", 491 IRQF_SHARED | IRQF_DISABLED, "bt878",
492 (void *) bt); 492 (void *) bt);
493 if (result == -EINVAL) { 493 if (result == -EINVAL) {
494 printk(KERN_ERR "bt878(%d): Bad irq number or handler\n", 494 printk(KERN_ERR "bt878(%d): Bad irq number or handler\n",
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index acabea0793b6..2310b2bfed4e 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -616,7 +616,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
616 616
617 pci_set_drvdata(pdev, pluto); 617 pci_set_drvdata(pdev, pluto);
618 618
619 ret = request_irq(pdev->irq, pluto_irq, SA_SHIRQ, DRIVER_NAME, pluto); 619 ret = request_irq(pdev->irq, pluto_irq, IRQF_SHARED, DRIVER_NAME, pluto);
620 if (ret < 0) 620 if (ret < 0)
621 goto err_pci_iounmap; 621 goto err_pci_iounmap;
622 622
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index aa3203ae670c..5764a89d3562 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -4050,7 +4050,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
4050 /* disable irqs, register irq handler */ 4050 /* disable irqs, register irq handler */
4051 btwrite(0, BT848_INT_MASK); 4051 btwrite(0, BT848_INT_MASK);
4052 result = request_irq(btv->c.pci->irq, bttv_irq, 4052 result = request_irq(btv->c.pci->irq, bttv_irq,
4053 SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); 4053 IRQF_SHARED | IRQF_DISABLED,btv->c.name,(void *)btv);
4054 if (result < 0) { 4054 if (result < 0) {
4055 printk(KERN_ERR "bttv%d: can't get IRQ %d\n", 4055 printk(KERN_ERR "bttv%d: can't get IRQ %d\n",
4056 bttv_num,btv->c.pci->irq); 4056 bttv_num,btv->c.pci->irq);
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 292a5e81eb75..f0340662e078 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -700,7 +700,7 @@ static int __devinit snd_cx88_create(struct snd_card *card,
700 700
701 /* get irq */ 701 /* get irq */
702 err = request_irq(chip->pci->irq, cx8801_irq, 702 err = request_irq(chip->pci->irq, cx8801_irq,
703 SA_SHIRQ | SA_INTERRUPT, chip->core->name, chip); 703 IRQF_SHARED | IRQF_DISABLED, chip->core->name, chip);
704 if (err < 0) { 704 if (err < 0) {
705 dprintk(0, "%s: can't get IRQ %d\n", 705 dprintk(0, "%s: can't get IRQ %d\n",
706 chip->core->name, chip->pci->irq); 706 chip->core->name, chip->pci->irq);
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 2c12aca1b6a3..138a4f692501 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -438,7 +438,7 @@ int cx8802_init_common(struct cx8802_dev *dev)
438 438
439 /* get irq */ 439 /* get irq */
440 err = request_irq(dev->pci->irq, cx8802_irq, 440 err = request_irq(dev->pci->irq, cx8802_irq,
441 SA_SHIRQ | SA_INTERRUPT, dev->core->name, dev); 441 IRQF_SHARED | IRQF_DISABLED, dev->core->name, dev);
442 if (err < 0) { 442 if (err < 0) {
443 printk(KERN_ERR "%s: can't get IRQ %d\n", 443 printk(KERN_ERR "%s: can't get IRQ %d\n",
444 dev->core->name, dev->pci->irq); 444 dev->core->name, dev->pci->irq);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index c538d99ec9f6..2225d4b94140 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1915,7 +1915,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1915 1915
1916 /* get irq */ 1916 /* get irq */
1917 err = request_irq(pci_dev->irq, cx8800_irq, 1917 err = request_irq(pci_dev->irq, cx8800_irq,
1918 SA_SHIRQ | SA_INTERRUPT, core->name, dev); 1918 IRQF_SHARED | IRQF_DISABLED, core->name, dev);
1919 if (err < 0) { 1919 if (err < 0) {
1920 printk(KERN_ERR "%s: can't get IRQ %d\n", 1920 printk(KERN_ERR "%s: can't get IRQ %d\n",
1921 core->name,pci_dev->irq); 1921 core->name,pci_dev->irq);
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index ddd62214bee5..e278753f8f25 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1881,7 +1881,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1881 1881
1882 meye.mchip_irq = pcidev->irq; 1882 meye.mchip_irq = pcidev->irq;
1883 if (request_irq(meye.mchip_irq, meye_irq, 1883 if (request_irq(meye.mchip_irq, meye_irq,
1884 SA_INTERRUPT | SA_SHIRQ, "meye", meye_irq)) { 1884 IRQF_DISABLED | IRQF_SHARED, "meye", meye_irq)) {
1885 printk(KERN_ERR "meye: request_irq failed\n"); 1885 printk(KERN_ERR "meye: request_irq failed\n");
1886 goto outreqirq; 1886 goto outreqirq;
1887 } 1887 }
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index d77e6a8d9432..f1fd69e7f119 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -929,7 +929,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
929 929
930 930
931 err = request_irq(dev->pci->irq, saa7134_alsa_irq, 931 err = request_irq(dev->pci->irq, saa7134_alsa_irq,
932 SA_SHIRQ | SA_INTERRUPT, dev->name, 932 IRQF_SHARED | IRQF_DISABLED, dev->name,
933 (void*) &dev->dmasound); 933 (void*) &dev->dmasound);
934 934
935 if (err < 0) { 935 if (err < 0) {
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 535172f643b9..6e97cc84ba89 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -923,7 +923,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
923 923
924 /* get irq */ 924 /* get irq */
925 err = request_irq(pci_dev->irq, saa7134_irq, 925 err = request_irq(pci_dev->irq, saa7134_irq,
926 SA_SHIRQ | SA_INTERRUPT, dev->name, dev); 926 IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
927 if (err < 0) { 927 if (err < 0) {
928 printk(KERN_ERR "%s: can't get IRQ %d\n", 928 printk(KERN_ERR "%s: can't get IRQ %d\n",
929 dev->name,pci_dev->irq); 929 dev->name,pci_dev->irq);
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 7aa02b34e012..3895d05804ae 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -845,7 +845,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev)
845{ 845{
846 846
847 if ((request_irq(dev->pci->irq, saa7134_oss_irq, 847 if ((request_irq(dev->pci->irq, saa7134_oss_irq,
848 SA_SHIRQ | SA_INTERRUPT, dev->name, 848 IRQF_SHARED | IRQF_DISABLED, dev->name,
849 (void*) &dev->dmasound)) < 0) 849 (void*) &dev->dmasound)) < 0)
850 return -1; 850 return -1;
851 851
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index c18b31d9928c..b36ba9fa3a28 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -1983,7 +1983,7 @@ static int __devinit configure_saa7146(struct pci_dev *pdev, int num)
1983 memcpy(&saa->video_dev, &saa_template, sizeof(saa_template)); 1983 memcpy(&saa->video_dev, &saa_template, sizeof(saa_template));
1984 saawrite(0, SAA7146_IER); /* turn off all interrupts */ 1984 saawrite(0, SAA7146_IER); /* turn off all interrupts */
1985 1985
1986 retval = request_irq(saa->irq, saa7146_irq, SA_SHIRQ | SA_INTERRUPT, 1986 retval = request_irq(saa->irq, saa7146_irq, IRQF_SHARED | IRQF_DISABLED,
1987 "stradis", saa); 1987 "stradis", saa);
1988 if (retval == -EINVAL) 1988 if (retval == -EINVAL)
1989 dev_err(&pdev->dev, "%d: Bad irq number or handler\n", num); 1989 dev_err(&pdev->dev, "%d: Bad irq number or handler\n", num);
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 33b32f3cf84e..f2249ed25273 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -1380,7 +1380,7 @@ find_zr36057 (void)
1380 1380
1381 result = request_irq(zr->pci_dev->irq, 1381 result = request_irq(zr->pci_dev->irq,
1382 zoran_irq, 1382 zoran_irq,
1383 SA_SHIRQ | SA_INTERRUPT, 1383 IRQF_SHARED | IRQF_DISABLED,
1384 ZR_DEVNAME(zr), 1384 ZR_DEVNAME(zr),
1385 (void *) zr); 1385 (void *) zr);
1386 if (result < 0) { 1386 if (result < 0) {
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index 6ac3b6740089..50437383ed62 100644
--- a/drivers/media/video/zr36120.c
+++ b/drivers/media/video/zr36120.c
@@ -1858,7 +1858,7 @@ int __init find_zoran(void)
1858 DEBUG(printk(KERN_DEBUG "zoran: mapped-memory at 0x%p\n",ztv->zoran_mem)); 1858 DEBUG(printk(KERN_DEBUG "zoran: mapped-memory at 0x%p\n",ztv->zoran_mem));
1859 1859
1860 result = request_irq(dev->irq, zoran_irq, 1860 result = request_irq(dev->irq, zoran_irq,
1861 SA_SHIRQ|SA_INTERRUPT,"zoran", ztv); 1861 IRQF_SHARED|IRQF_DISABLED,"zoran", ztv);
1862 if (result==-EINVAL) 1862 if (result==-EINVAL)
1863 { 1863 {
1864 iounmap(ztv->zoran_mem); 1864 iounmap(ztv->zoran_mem);
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 2544fc7af0f6..57543603d6c8 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1705,7 +1705,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1705 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", 1705 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n",
1706 ioc->name); 1706 ioc->name);
1707 rc = request_irq(ioc->pcidev->irq, mpt_interrupt, 1707 rc = request_irq(ioc->pcidev->irq, mpt_interrupt,
1708 SA_SHIRQ, ioc->name, ioc); 1708 IRQF_SHARED, ioc->name, ioc);
1709 if (rc < 0) { 1709 if (rc < 0) {
1710 printk(MYIOC_s_ERR_FMT "Unable to allocate " 1710 printk(MYIOC_s_ERR_FMT "Unable to allocate "
1711 "interrupt %d!\n", ioc->name, 1711 "interrupt %d!\n", ioc->name,
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 4f1515cae5dc..1b58444d5aaf 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -274,7 +274,7 @@ static int i2o_pci_irq_enable(struct i2o_controller *c)
274 writel(0xffffffff, c->irq_mask); 274 writel(0xffffffff, c->irq_mask);
275 275
276 if (pdev->irq) { 276 if (pdev->irq) {
277 rc = request_irq(pdev->irq, i2o_pci_interrupt, SA_SHIRQ, 277 rc = request_irq(pdev->irq, i2o_pci_interrupt, IRQF_SHARED,
278 c->name, c); 278 c->name, c);
279 if (rc < 0) { 279 if (rc < 0) {
280 printk(KERN_ERR "%s: unable to allocate interrupt %d." 280 printk(KERN_ERR "%s: unable to allocate interrupt %d."
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 6fe2ff5a63db..632bc218c86a 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -508,7 +508,7 @@ static int ucb1x00_probe(struct mcp *mcp)
508 goto err_free; 508 goto err_free;
509 } 509 }
510 510
511 ret = request_irq(ucb->irq, ucb1x00_irq, SA_TRIGGER_RISING, 511 ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING,
512 "UCB1x00", ucb); 512 "UCB1x00", ucb);
513 if (ret) { 513 if (ret) {
514 printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n", 514 printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n",
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index 9706cc19134a..2f3bddfab937 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -113,7 +113,7 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
113 goto error_ioremap; 113 goto error_ioremap;
114 } 114 }
115 115
116 result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp); 116 result = request_irq(sp->irq, ibmasm_interrupt_handler, IRQF_SHARED, sp->devname, (void*)sp);
117 if (result) { 117 if (result) {
118 dev_err(sp->dev, "Failed to register interrupt handler\n"); 118 dev_err(sp->dev, "Failed to register interrupt handler\n");
119 goto error_request_irq; 119 goto error_request_irq;
diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/at91_mci.c
index 075a2a07924e..6b7638b84290 100644
--- a/drivers/mmc/at91_mci.c
+++ b/drivers/mmc/at91_mci.c
@@ -850,7 +850,7 @@ static int at91_mci_probe(struct platform_device *pdev)
850 /* 850 /*
851 * Allocate the MCI interrupt 851 * Allocate the MCI interrupt
852 */ 852 */
853 ret = request_irq(AT91_ID_MCI, at91_mci_irq, SA_SHIRQ, DRIVER_NAME, host); 853 ret = request_irq(AT91_ID_MCI, at91_mci_irq, IRQF_SHARED, DRIVER_NAME, host);
854 if (ret) { 854 if (ret) {
855 printk(KERN_ERR "Failed to request MCI interrupt\n"); 855 printk(KERN_ERR "Failed to request MCI interrupt\n");
856 clk_disable(mci_clk); 856 clk_disable(mci_clk);
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index 41069908f4a7..fb606165af3b 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -886,7 +886,7 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
886 int i, ret = 0; 886 int i, ret = 0;
887 887
888 /* THe interrupt is shared among all controllers */ 888 /* THe interrupt is shared among all controllers */
889 ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, SA_INTERRUPT, "MMC", 0); 889 ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, IRQF_DISABLED, "MMC", 0);
890 890
891 if (ret) { 891 if (ret) {
892 printk(DRIVER_NAME "ERROR: Couldn't get int %d: %d\n", 892 printk(DRIVER_NAME "ERROR: Couldn't get int %d: %d\n",
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 9dfb34a857e3..1886562abdd4 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -531,11 +531,11 @@ static int mmci_probe(struct amba_device *dev, void *id)
531 writel(0, host->base + MMCIMASK1); 531 writel(0, host->base + MMCIMASK1);
532 writel(0xfff, host->base + MMCICLEAR); 532 writel(0xfff, host->base + MMCICLEAR);
533 533
534 ret = request_irq(dev->irq[0], mmci_irq, SA_SHIRQ, DRIVER_NAME " (cmd)", host); 534 ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host);
535 if (ret) 535 if (ret)
536 goto unmap; 536 goto unmap;
537 537
538 ret = request_irq(dev->irq[1], mmci_pio_irq, SA_SHIRQ, DRIVER_NAME " (pio)", host); 538 ret = request_irq(dev->irq[1], mmci_pio_irq, IRQF_SHARED, DRIVER_NAME " (pio)", host);
539 if (ret) 539 if (ret)
540 goto irq0_free; 540 goto irq0_free;
541 541
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c
index 7a4840ec53b7..ddf06b32c159 100644
--- a/drivers/mmc/omap.c
+++ b/drivers/mmc/omap.c
@@ -60,6 +60,7 @@ struct mmc_omap_host {
60 unsigned char id; /* 16xx chips have 2 MMC blocks */ 60 unsigned char id; /* 16xx chips have 2 MMC blocks */
61 struct clk * iclk; 61 struct clk * iclk;
62 struct clk * fclk; 62 struct clk * fclk;
63 struct resource *res;
63 void __iomem *base; 64 void __iomem *base;
64 int irq; 65 int irq;
65 unsigned char bus_mode; 66 unsigned char bus_mode;
@@ -339,8 +340,6 @@ static void
339mmc_omap_xfer_data(struct mmc_omap_host *host, int write) 340mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
340{ 341{
341 int n; 342 int n;
342 void __iomem *reg;
343 u16 *p;
344 343
345 if (host->buffer_bytes_left == 0) { 344 if (host->buffer_bytes_left == 0) {
346 host->sg_idx++; 345 host->sg_idx++;
@@ -657,12 +656,12 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
657 struct mmc_data *mmcdat = host->data; 656 struct mmc_data *mmcdat = host->data;
658 657
659 if (unlikely(host->dma_ch < 0)) { 658 if (unlikely(host->dma_ch < 0)) {
660 dev_err(mmc_dev(host->mmc), "DMA callback while DMA not 659 dev_err(mmc_dev(host->mmc),
661 enabled\n"); 660 "DMA callback while DMA not enabled\n");
662 return; 661 return;
663 } 662 }
664 /* FIXME: We really should do something to _handle_ the errors */ 663 /* FIXME: We really should do something to _handle_ the errors */
665 if (ch_status & OMAP_DMA_TOUT_IRQ) { 664 if (ch_status & OMAP1_DMA_TOUT_IRQ) {
666 dev_err(mmc_dev(host->mmc),"DMA timeout\n"); 665 dev_err(mmc_dev(host->mmc),"DMA timeout\n");
667 return; 666 return;
668 } 667 }
@@ -972,20 +971,20 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
972 struct omap_mmc_conf *minfo = pdev->dev.platform_data; 971 struct omap_mmc_conf *minfo = pdev->dev.platform_data;
973 struct mmc_host *mmc; 972 struct mmc_host *mmc;
974 struct mmc_omap_host *host = NULL; 973 struct mmc_omap_host *host = NULL;
974 struct resource *r;
975 int ret = 0; 975 int ret = 0;
976 int irq;
976 977
977 if (platform_get_resource(pdev, IORESOURCE_MEM, 0) || 978 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
978 platform_get_irq(pdev, IORESOURCE_IRQ, 0)) { 979 irq = platform_get_irq(pdev, 0);
979 dev_err(&pdev->dev, "mmc_omap_probe: invalid resource type\n"); 980 if (!r || irq < 0)
980 return -ENODEV; 981 return -ENXIO;
981 }
982 982
983 if (!request_mem_region(pdev->resource[0].start, 983 r = request_mem_region(pdev->resource[0].start,
984 pdev->resource[0].end - pdev->resource[0].start + 1, 984 pdev->resource[0].end - pdev->resource[0].start + 1,
985 pdev->name)) { 985 pdev->name);
986 dev_dbg(&pdev->dev, "request_mem_region failed\n"); 986 if (!r)
987 return -EBUSY; 987 return -EBUSY;
988 }
989 988
990 mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev); 989 mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev);
991 if (!mmc) { 990 if (!mmc) {
@@ -1002,6 +1001,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1002 host->dma_timer.data = (unsigned long) host; 1001 host->dma_timer.data = (unsigned long) host;
1003 1002
1004 host->id = pdev->id; 1003 host->id = pdev->id;
1004 host->res = r;
1005 host->irq = irq;
1005 1006
1006 if (cpu_is_omap24xx()) { 1007 if (cpu_is_omap24xx()) {
1007 host->iclk = clk_get(&pdev->dev, "mmc_ick"); 1008 host->iclk = clk_get(&pdev->dev, "mmc_ick");
@@ -1031,13 +1032,9 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1031 host->dma_ch = -1; 1032 host->dma_ch = -1;
1032 1033
1033 host->irq = pdev->resource[1].start; 1034 host->irq = pdev->resource[1].start;
1034 host->base = ioremap(pdev->res.start, SZ_4K); 1035 host->base = (void __iomem*)IO_ADDRESS(r->start);
1035 if (!host->base) {
1036 ret = -ENOMEM;
1037 goto out;
1038 }
1039 1036
1040 if (minfo->wire4) 1037 if (minfo->wire4)
1041 mmc->caps |= MMC_CAP_4_BIT_DATA; 1038 mmc->caps |= MMC_CAP_4_BIT_DATA;
1042 1039
1043 mmc->ops = &mmc_omap_ops; 1040 mmc->ops = &mmc_omap_ops;
@@ -1056,8 +1053,8 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1056 1053
1057 if (host->power_pin >= 0) { 1054 if (host->power_pin >= 0) {
1058 if ((ret = omap_request_gpio(host->power_pin)) != 0) { 1055 if ((ret = omap_request_gpio(host->power_pin)) != 0) {
1059 dev_err(mmc_dev(host->mmc), "Unable to get GPIO 1056 dev_err(mmc_dev(host->mmc),
1060 pin for MMC power\n"); 1057 "Unable to get GPIO pin for MMC power\n");
1061 goto out; 1058 goto out;
1062 } 1059 }
1063 omap_set_gpio_direction(host->power_pin, 0); 1060 omap_set_gpio_direction(host->power_pin, 0);
@@ -1085,7 +1082,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1085 1082
1086 omap_set_gpio_direction(host->switch_pin, 1); 1083 omap_set_gpio_direction(host->switch_pin, 1);
1087 ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin), 1084 ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin),
1088 mmc_omap_switch_irq, SA_TRIGGER_RISING, DRIVER_NAME, host); 1085 mmc_omap_switch_irq, IRQF_TRIGGER_RISING, DRIVER_NAME, host);
1089 if (ret) { 1086 if (ret) {
1090 dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n"); 1087 dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n");
1091 omap_free_gpio(host->switch_pin); 1088 omap_free_gpio(host->switch_pin);
@@ -1099,7 +1096,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1099 device_remove_file(&pdev->dev, &dev_attr_cover_switch); 1096 device_remove_file(&pdev->dev, &dev_attr_cover_switch);
1100 } 1097 }
1101 if (ret) { 1098 if (ret) {
1102 dev_wan(mmc_dev(host->mmc), "Unable to create sysfs attributes\n"); 1099 dev_warn(mmc_dev(host->mmc), "Unable to create sysfs attributes\n");
1103 free_irq(OMAP_GPIO_IRQ(host->switch_pin), host); 1100 free_irq(OMAP_GPIO_IRQ(host->switch_pin), host);
1104 omap_free_gpio(host->switch_pin); 1101 omap_free_gpio(host->switch_pin);
1105 host->switch_pin = -1; 1102 host->switch_pin = -1;
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 8e9100bd57ef..74134699ccee 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -8,12 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11 /*
12 * Note that PIO transfer is rather crappy atm. The buffer full/empty
13 * interrupts aren't reliable so we currently transfer the entire buffer
14 * directly. Patches to solve the problem are welcome.
15 */
16
17#include <linux/delay.h> 11#include <linux/delay.h>
18#include <linux/highmem.h> 12#include <linux/highmem.h>
19#include <linux/pci.h> 13#include <linux/pci.h>
@@ -27,13 +21,17 @@
27#include "sdhci.h" 21#include "sdhci.h"
28 22
29#define DRIVER_NAME "sdhci" 23#define DRIVER_NAME "sdhci"
30#define DRIVER_VERSION "0.11" 24#define DRIVER_VERSION "0.12"
31 25
32#define BUGMAIL "<sdhci-devel@list.drzeus.cx>" 26#define BUGMAIL "<sdhci-devel@list.drzeus.cx>"
33 27
34#define DBG(f, x...) \ 28#define DBG(f, x...) \
35 pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) 29 pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
36 30
31static unsigned int debug_nodma = 0;
32static unsigned int debug_forcedma = 0;
33static unsigned int debug_quirks = 0;
34
37static const struct pci_device_id pci_ids[] __devinitdata = { 35static const struct pci_device_id pci_ids[] __devinitdata = {
38 /* handle any SD host controller */ 36 /* handle any SD host controller */
39 {PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)}, 37 {PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)},
@@ -94,12 +92,27 @@ static void sdhci_dumpregs(struct sdhci_host *host)
94 92
95static void sdhci_reset(struct sdhci_host *host, u8 mask) 93static void sdhci_reset(struct sdhci_host *host, u8 mask)
96{ 94{
95 unsigned long timeout;
96
97 writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); 97 writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET);
98 98
99 if (mask & SDHCI_RESET_ALL) { 99 if (mask & SDHCI_RESET_ALL)
100 host->clock = 0; 100 host->clock = 0;
101 101
102 mdelay(50); 102 /* Wait max 100 ms */
103 timeout = 100;
104
105 /* hw clears the bit when it's done */
106 while (readb(host->ioaddr + SDHCI_SOFTWARE_RESET) & mask) {
107 if (timeout == 0) {
108 printk(KERN_ERR "%s: Reset 0x%x never completed. "
109 "Please report this to " BUGMAIL ".\n",
110 mmc_hostname(host->mmc), (int)mask);
111 sdhci_dumpregs(host);
112 return;
113 }
114 timeout--;
115 mdelay(1);
103 } 116 }
104} 117}
105 118
@@ -109,13 +122,15 @@ static void sdhci_init(struct sdhci_host *host)
109 122
110 sdhci_reset(host, SDHCI_RESET_ALL); 123 sdhci_reset(host, SDHCI_RESET_ALL);
111 124
112 intmask = ~(SDHCI_INT_CARD_INT | SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL); 125 intmask = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
126 SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX |
127 SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT |
128 SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT |
129 SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL |
130 SDHCI_INT_DMA_END | SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE;
113 131
114 writel(intmask, host->ioaddr + SDHCI_INT_ENABLE); 132 writel(intmask, host->ioaddr + SDHCI_INT_ENABLE);
115 writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE); 133 writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE);
116
117 /* This is unknown magic. */
118 writeb(0xE, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
119} 134}
120 135
121static void sdhci_activate_led(struct sdhci_host *host) 136static void sdhci_activate_led(struct sdhci_host *host)
@@ -172,79 +187,96 @@ static inline int sdhci_next_sg(struct sdhci_host* host)
172 return host->num_sg; 187 return host->num_sg;
173} 188}
174 189
175static void sdhci_transfer_pio(struct sdhci_host *host) 190static void sdhci_read_block_pio(struct sdhci_host *host)
176{ 191{
192 int blksize, chunk_remain;
193 u32 data;
177 char *buffer; 194 char *buffer;
178 u32 mask; 195 int size;
179 int bytes, size;
180 unsigned long max_jiffies;
181
182 BUG_ON(!host->data);
183 196
184 if (host->num_sg == 0) 197 DBG("PIO reading\n");
185 return;
186 198
187 bytes = 0; 199 blksize = host->data->blksz;
188 if (host->data->flags & MMC_DATA_READ) 200 chunk_remain = 0;
189 mask = SDHCI_DATA_AVAILABLE; 201 data = 0;
190 else
191 mask = SDHCI_SPACE_AVAILABLE;
192 202
193 buffer = sdhci_kmap_sg(host) + host->offset; 203 buffer = sdhci_kmap_sg(host) + host->offset;
194 204
195 /* Transfer shouldn't take more than 5 s */ 205 while (blksize) {
196 max_jiffies = jiffies + HZ * 5; 206 if (chunk_remain == 0) {
207 data = readl(host->ioaddr + SDHCI_BUFFER);
208 chunk_remain = min(blksize, 4);
209 }
197 210
198 while (host->size > 0) { 211 size = min(host->size, host->remain);
199 if (time_after(jiffies, max_jiffies)) { 212 size = min(size, chunk_remain);
200 printk(KERN_ERR "%s: PIO transfer stalled. "
201 "Please report this to "
202 BUGMAIL ".\n", mmc_hostname(host->mmc));
203 sdhci_dumpregs(host);
204 213
205 sdhci_kunmap_sg(host); 214 chunk_remain -= size;
215 blksize -= size;
216 host->offset += size;
217 host->remain -= size;
218 host->size -= size;
219 while (size) {
220 *buffer = data & 0xFF;
221 buffer++;
222 data >>= 8;
223 size--;
224 }
206 225
207 host->data->error = MMC_ERR_FAILED; 226 if (host->remain == 0) {
208 sdhci_finish_data(host); 227 sdhci_kunmap_sg(host);
209 return; 228 if (sdhci_next_sg(host) == 0) {
229 BUG_ON(blksize != 0);
230 return;
231 }
232 buffer = sdhci_kmap_sg(host);
210 } 233 }
234 }
211 235
212 if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask)) 236 sdhci_kunmap_sg(host);
213 continue; 237}
214 238
215 size = min(host->size, host->remain); 239static void sdhci_write_block_pio(struct sdhci_host *host)
240{
241 int blksize, chunk_remain;
242 u32 data;
243 char *buffer;
244 int bytes, size;
216 245
217 if (size >= 4) { 246 DBG("PIO writing\n");
218 if (host->data->flags & MMC_DATA_READ) 247
219 *(u32*)buffer = readl(host->ioaddr + SDHCI_BUFFER); 248 blksize = host->data->blksz;
220 else 249 chunk_remain = 4;
221 writel(*(u32*)buffer, host->ioaddr + SDHCI_BUFFER); 250 data = 0;
222 size = 4;
223 } else if (size >= 2) {
224 if (host->data->flags & MMC_DATA_READ)
225 *(u16*)buffer = readw(host->ioaddr + SDHCI_BUFFER);
226 else
227 writew(*(u16*)buffer, host->ioaddr + SDHCI_BUFFER);
228 size = 2;
229 } else {
230 if (host->data->flags & MMC_DATA_READ)
231 *(u8*)buffer = readb(host->ioaddr + SDHCI_BUFFER);
232 else
233 writeb(*(u8*)buffer, host->ioaddr + SDHCI_BUFFER);
234 size = 1;
235 }
236 251
237 buffer += size; 252 bytes = 0;
253 buffer = sdhci_kmap_sg(host) + host->offset;
254
255 while (blksize) {
256 size = min(host->size, host->remain);
257 size = min(size, chunk_remain);
258
259 chunk_remain -= size;
260 blksize -= size;
238 host->offset += size; 261 host->offset += size;
239 host->remain -= size; 262 host->remain -= size;
240
241 bytes += size;
242 host->size -= size; 263 host->size -= size;
264 while (size) {
265 data >>= 8;
266 data |= (u32)*buffer << 24;
267 buffer++;
268 size--;
269 }
270
271 if (chunk_remain == 0) {
272 writel(data, host->ioaddr + SDHCI_BUFFER);
273 chunk_remain = min(blksize, 4);
274 }
243 275
244 if (host->remain == 0) { 276 if (host->remain == 0) {
245 sdhci_kunmap_sg(host); 277 sdhci_kunmap_sg(host);
246 if (sdhci_next_sg(host) == 0) { 278 if (sdhci_next_sg(host) == 0) {
247 DBG("PIO transfer: %d bytes\n", bytes); 279 BUG_ON(blksize != 0);
248 return; 280 return;
249 } 281 }
250 buffer = sdhci_kmap_sg(host); 282 buffer = sdhci_kmap_sg(host);
@@ -252,38 +284,87 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
252 } 284 }
253 285
254 sdhci_kunmap_sg(host); 286 sdhci_kunmap_sg(host);
287}
288
289static void sdhci_transfer_pio(struct sdhci_host *host)
290{
291 u32 mask;
292
293 BUG_ON(!host->data);
294
295 if (host->size == 0)
296 return;
297
298 if (host->data->flags & MMC_DATA_READ)
299 mask = SDHCI_DATA_AVAILABLE;
300 else
301 mask = SDHCI_SPACE_AVAILABLE;
302
303 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
304 if (host->data->flags & MMC_DATA_READ)
305 sdhci_read_block_pio(host);
306 else
307 sdhci_write_block_pio(host);
255 308
256 DBG("PIO transfer: %d bytes\n", bytes); 309 if (host->size == 0)
310 break;
311
312 BUG_ON(host->num_sg == 0);
313 }
314
315 DBG("PIO transfer complete.\n");
257} 316}
258 317
259static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) 318static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
260{ 319{
261 u16 mode; 320 u8 count;
321 unsigned target_timeout, current_timeout;
262 322
263 WARN_ON(host->data); 323 WARN_ON(host->data);
264 324
265 if (data == NULL) { 325 if (data == NULL)
266 writew(0, host->ioaddr + SDHCI_TRANSFER_MODE);
267 return; 326 return;
268 }
269 327
270 DBG("blksz %04x blks %04x flags %08x\n", 328 DBG("blksz %04x blks %04x flags %08x\n",
271 data->blksz, data->blocks, data->flags); 329 data->blksz, data->blocks, data->flags);
272 DBG("tsac %d ms nsac %d clk\n", 330 DBG("tsac %d ms nsac %d clk\n",
273 data->timeout_ns / 1000000, data->timeout_clks); 331 data->timeout_ns / 1000000, data->timeout_clks);
274 332
275 mode = SDHCI_TRNS_BLK_CNT_EN; 333 /* Sanity checks */
276 if (data->blocks > 1) 334 BUG_ON(data->blksz * data->blocks > 524288);
277 mode |= SDHCI_TRNS_MULTI; 335 BUG_ON(data->blksz > host->max_block);
278 if (data->flags & MMC_DATA_READ) 336 BUG_ON(data->blocks > 65535);
279 mode |= SDHCI_TRNS_READ;
280 if (host->flags & SDHCI_USE_DMA)
281 mode |= SDHCI_TRNS_DMA;
282 337
283 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); 338 /* timeout in us */
339 target_timeout = data->timeout_ns / 1000 +
340 data->timeout_clks / host->clock;
284 341
285 writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE); 342 /*
286 writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT); 343 * Figure out needed cycles.
344 * We do this in steps in order to fit inside a 32 bit int.
345 * The first step is the minimum timeout, which will have a
346 * minimum resolution of 6 bits:
347 * (1) 2^13*1000 > 2^22,
348 * (2) host->timeout_clk < 2^16
349 * =>
350 * (1) / (2) > 2^6
351 */
352 count = 0;
353 current_timeout = (1 << 13) * 1000 / host->timeout_clk;
354 while (current_timeout < target_timeout) {
355 count++;
356 current_timeout <<= 1;
357 if (count >= 0xF)
358 break;
359 }
360
361 if (count >= 0xF) {
362 printk(KERN_WARNING "%s: Too large timeout requested!\n",
363 mmc_hostname(host->mmc));
364 count = 0xE;
365 }
366
367 writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
287 368
288 if (host->flags & SDHCI_USE_DMA) { 369 if (host->flags & SDHCI_USE_DMA) {
289 int count; 370 int count;
@@ -302,12 +383,37 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
302 host->offset = 0; 383 host->offset = 0;
303 host->remain = host->cur_sg->length; 384 host->remain = host->cur_sg->length;
304 } 385 }
386
387 /* We do not handle DMA boundaries, so set it to max (512 KiB) */
388 writew(SDHCI_MAKE_BLKSZ(7, data->blksz),
389 host->ioaddr + SDHCI_BLOCK_SIZE);
390 writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT);
391}
392
393static void sdhci_set_transfer_mode(struct sdhci_host *host,
394 struct mmc_data *data)
395{
396 u16 mode;
397
398 WARN_ON(host->data);
399
400 if (data == NULL)
401 return;
402
403 mode = SDHCI_TRNS_BLK_CNT_EN;
404 if (data->blocks > 1)
405 mode |= SDHCI_TRNS_MULTI;
406 if (data->flags & MMC_DATA_READ)
407 mode |= SDHCI_TRNS_READ;
408 if (host->flags & SDHCI_USE_DMA)
409 mode |= SDHCI_TRNS_DMA;
410
411 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
305} 412}
306 413
307static void sdhci_finish_data(struct sdhci_host *host) 414static void sdhci_finish_data(struct sdhci_host *host)
308{ 415{
309 struct mmc_data *data; 416 struct mmc_data *data;
310 u32 intmask;
311 u16 blocks; 417 u16 blocks;
312 418
313 BUG_ON(!host->data); 419 BUG_ON(!host->data);
@@ -318,14 +424,6 @@ static void sdhci_finish_data(struct sdhci_host *host)
318 if (host->flags & SDHCI_USE_DMA) { 424 if (host->flags & SDHCI_USE_DMA) {
319 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len, 425 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len,
320 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE); 426 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE);
321 } else {
322 intmask = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE);
323 intmask &= ~(SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL);
324 writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE);
325
326 intmask = readl(host->ioaddr + SDHCI_INT_ENABLE);
327 intmask &= ~(SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL);
328 writel(intmask, host->ioaddr + SDHCI_INT_ENABLE);
329 } 427 }
330 428
331 /* 429 /*
@@ -371,27 +469,38 @@ static void sdhci_finish_data(struct sdhci_host *host)
371static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) 469static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
372{ 470{
373 int flags; 471 int flags;
374 u32 present; 472 u32 mask;
375 unsigned long max_jiffies; 473 unsigned long timeout;
376 474
377 WARN_ON(host->cmd); 475 WARN_ON(host->cmd);
378 476
379 DBG("Sending cmd (%x)\n", cmd->opcode); 477 DBG("Sending cmd (%x)\n", cmd->opcode);
380 478
381 /* Wait max 10 ms */ 479 /* Wait max 10 ms */
382 max_jiffies = jiffies + (HZ + 99)/100; 480 timeout = 10;
383 do { 481
384 if (time_after(jiffies, max_jiffies)) { 482 mask = SDHCI_CMD_INHIBIT;
483 if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY))
484 mask |= SDHCI_DATA_INHIBIT;
485
486 /* We shouldn't wait for data inihibit for stop commands, even
487 though they might use busy signaling */
488 if (host->mrq->data && (cmd == host->mrq->data->stop))
489 mask &= ~SDHCI_DATA_INHIBIT;
490
491 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
492 if (timeout == 0) {
385 printk(KERN_ERR "%s: Controller never released " 493 printk(KERN_ERR "%s: Controller never released "
386 "inhibit bits. Please report this to " 494 "inhibit bit(s). Please report this to "
387 BUGMAIL ".\n", mmc_hostname(host->mmc)); 495 BUGMAIL ".\n", mmc_hostname(host->mmc));
388 sdhci_dumpregs(host); 496 sdhci_dumpregs(host);
389 cmd->error = MMC_ERR_FAILED; 497 cmd->error = MMC_ERR_FAILED;
390 tasklet_schedule(&host->finish_tasklet); 498 tasklet_schedule(&host->finish_tasklet);
391 return; 499 return;
392 } 500 }
393 present = readl(host->ioaddr + SDHCI_PRESENT_STATE); 501 timeout--;
394 } while (present & (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)); 502 mdelay(1);
503 }
395 504
396 mod_timer(&host->timer, jiffies + 10 * HZ); 505 mod_timer(&host->timer, jiffies + 10 * HZ);
397 506
@@ -401,6 +510,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
401 510
402 writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT); 511 writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT);
403 512
513 sdhci_set_transfer_mode(host, cmd->data);
514
404 if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { 515 if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
405 printk(KERN_ERR "%s: Unsupported response type! " 516 printk(KERN_ERR "%s: Unsupported response type! "
406 "Please report this to " BUGMAIL ".\n", 517 "Please report this to " BUGMAIL ".\n",
@@ -456,31 +567,9 @@ static void sdhci_finish_command(struct sdhci_host *host)
456 567
457 DBG("Ending cmd (%x)\n", host->cmd->opcode); 568 DBG("Ending cmd (%x)\n", host->cmd->opcode);
458 569
459 if (host->cmd->data) { 570 if (host->cmd->data)
460 u32 intmask;
461
462 host->data = host->cmd->data; 571 host->data = host->cmd->data;
463 572 else
464 if (!(host->flags & SDHCI_USE_DMA)) {
465 /*
466 * Don't enable the interrupts until now to make sure we
467 * get stable handling of the FIFO.
468 */
469 intmask = readl(host->ioaddr + SDHCI_INT_ENABLE);
470 intmask |= SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL;
471 writel(intmask, host->ioaddr + SDHCI_INT_ENABLE);
472
473 intmask = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE);
474 intmask |= SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL;
475 writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE);
476
477 /*
478 * The buffer interrupts are to unreliable so we
479 * start the transfer immediatly.
480 */
481 sdhci_transfer_pio(host);
482 }
483 } else
484 tasklet_schedule(&host->finish_tasklet); 573 tasklet_schedule(&host->finish_tasklet);
485 574
486 host->cmd = NULL; 575 host->cmd = NULL;
@@ -490,7 +579,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
490{ 579{
491 int div; 580 int div;
492 u16 clk; 581 u16 clk;
493 unsigned long max_jiffies; 582 unsigned long timeout;
494 583
495 if (clock == host->clock) 584 if (clock == host->clock)
496 return; 585 return;
@@ -511,17 +600,19 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
511 writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL); 600 writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL);
512 601
513 /* Wait max 10 ms */ 602 /* Wait max 10 ms */
514 max_jiffies = jiffies + (HZ + 99)/100; 603 timeout = 10;
515 do { 604 while (!((clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL))
516 if (time_after(jiffies, max_jiffies)) { 605 & SDHCI_CLOCK_INT_STABLE)) {
606 if (timeout == 0) {
517 printk(KERN_ERR "%s: Internal clock never stabilised. " 607 printk(KERN_ERR "%s: Internal clock never stabilised. "
518 "Please report this to " BUGMAIL ".\n", 608 "Please report this to " BUGMAIL ".\n",
519 mmc_hostname(host->mmc)); 609 mmc_hostname(host->mmc));
520 sdhci_dumpregs(host); 610 sdhci_dumpregs(host);
521 return; 611 return;
522 } 612 }
523 clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL); 613 timeout--;
524 } while (!(clk & SDHCI_CLOCK_INT_STABLE)); 614 mdelay(1);
615 }
525 616
526 clk |= SDHCI_CLOCK_CARD_EN; 617 clk |= SDHCI_CLOCK_CARD_EN;
527 writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL); 618 writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL);
@@ -530,6 +621,46 @@ out:
530 host->clock = clock; 621 host->clock = clock;
531} 622}
532 623
624static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
625{
626 u8 pwr;
627
628 if (host->power == power)
629 return;
630
631 writeb(0, host->ioaddr + SDHCI_POWER_CONTROL);
632
633 if (power == (unsigned short)-1)
634 goto out;
635
636 pwr = SDHCI_POWER_ON;
637
638 switch (power) {
639 case MMC_VDD_170:
640 case MMC_VDD_180:
641 case MMC_VDD_190:
642 pwr |= SDHCI_POWER_180;
643 break;
644 case MMC_VDD_290:
645 case MMC_VDD_300:
646 case MMC_VDD_310:
647 pwr |= SDHCI_POWER_300;
648 break;
649 case MMC_VDD_320:
650 case MMC_VDD_330:
651 case MMC_VDD_340:
652 pwr |= SDHCI_POWER_330;
653 break;
654 default:
655 BUG();
656 }
657
658 writeb(pwr, host->ioaddr + SDHCI_POWER_CONTROL);
659
660out:
661 host->power = power;
662}
663
533/*****************************************************************************\ 664/*****************************************************************************\
534 * * 665 * *
535 * MMC callbacks * 666 * MMC callbacks *
@@ -576,17 +707,15 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
576 */ 707 */
577 if (ios->power_mode == MMC_POWER_OFF) { 708 if (ios->power_mode == MMC_POWER_OFF) {
578 writel(0, host->ioaddr + SDHCI_SIGNAL_ENABLE); 709 writel(0, host->ioaddr + SDHCI_SIGNAL_ENABLE);
579 spin_unlock_irqrestore(&host->lock, flags);
580 sdhci_init(host); 710 sdhci_init(host);
581 spin_lock_irqsave(&host->lock, flags);
582 } 711 }
583 712
584 sdhci_set_clock(host, ios->clock); 713 sdhci_set_clock(host, ios->clock);
585 714
586 if (ios->power_mode == MMC_POWER_OFF) 715 if (ios->power_mode == MMC_POWER_OFF)
587 writeb(0, host->ioaddr + SDHCI_POWER_CONTROL); 716 sdhci_set_power(host, -1);
588 else 717 else
589 writeb(0xFF, host->ioaddr + SDHCI_POWER_CONTROL); 718 sdhci_set_power(host, ios->vdd);
590 719
591 ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); 720 ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
592 if (ios->bus_width == MMC_BUS_WIDTH_4) 721 if (ios->bus_width == MMC_BUS_WIDTH_4)
@@ -793,7 +922,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
793 if (host->data->error != MMC_ERR_NONE) 922 if (host->data->error != MMC_ERR_NONE)
794 sdhci_finish_data(host); 923 sdhci_finish_data(host);
795 else { 924 else {
796 if (intmask & (SDHCI_INT_BUF_FULL | SDHCI_INT_BUF_EMPTY)) 925 if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
797 sdhci_transfer_pio(host); 926 sdhci_transfer_pio(host);
798 927
799 if (intmask & SDHCI_INT_DATA_END) 928 if (intmask & SDHCI_INT_DATA_END)
@@ -818,50 +947,44 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs)
818 947
819 DBG("*** %s got interrupt: 0x%08x\n", host->slot_descr, intmask); 948 DBG("*** %s got interrupt: 0x%08x\n", host->slot_descr, intmask);
820 949
821 if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) 950 if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
951 writel(intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE),
952 host->ioaddr + SDHCI_INT_STATUS);
822 tasklet_schedule(&host->card_tasklet); 953 tasklet_schedule(&host->card_tasklet);
954 }
823 955
824 if (intmask & SDHCI_INT_CMD_MASK) { 956 intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
825 sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK);
826 957
958 if (intmask & SDHCI_INT_CMD_MASK) {
827 writel(intmask & SDHCI_INT_CMD_MASK, 959 writel(intmask & SDHCI_INT_CMD_MASK,
828 host->ioaddr + SDHCI_INT_STATUS); 960 host->ioaddr + SDHCI_INT_STATUS);
961 sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK);
829 } 962 }
830 963
831 if (intmask & SDHCI_INT_DATA_MASK) { 964 if (intmask & SDHCI_INT_DATA_MASK) {
832 sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK);
833
834 writel(intmask & SDHCI_INT_DATA_MASK, 965 writel(intmask & SDHCI_INT_DATA_MASK,
835 host->ioaddr + SDHCI_INT_STATUS); 966 host->ioaddr + SDHCI_INT_STATUS);
967 sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK);
836 } 968 }
837 969
838 intmask &= ~(SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK); 970 intmask &= ~(SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK);
839 971
840 if (intmask & SDHCI_INT_CARD_INT) {
841 printk(KERN_ERR "%s: Unexpected card interrupt. Please "
842 "report this to " BUGMAIL ".\n",
843 mmc_hostname(host->mmc));
844 sdhci_dumpregs(host);
845 }
846
847 if (intmask & SDHCI_INT_BUS_POWER) { 972 if (intmask & SDHCI_INT_BUS_POWER) {
848 printk(KERN_ERR "%s: Unexpected bus power interrupt. Please " 973 printk(KERN_ERR "%s: Card is consuming too much power!\n",
849 "report this to " BUGMAIL ".\n",
850 mmc_hostname(host->mmc)); 974 mmc_hostname(host->mmc));
851 sdhci_dumpregs(host); 975 writel(SDHCI_INT_BUS_POWER, host->ioaddr + SDHCI_INT_STATUS);
852 } 976 }
853 977
854 if (intmask & SDHCI_INT_ACMD12ERR) { 978 intmask &= SDHCI_INT_BUS_POWER;
855 printk(KERN_ERR "%s: Unexpected auto CMD12 error. Please " 979
980 if (intmask) {
981 printk(KERN_ERR "%s: Unexpected interrupt 0x%08x. Please "
856 "report this to " BUGMAIL ".\n", 982 "report this to " BUGMAIL ".\n",
857 mmc_hostname(host->mmc)); 983 mmc_hostname(host->mmc), intmask);
858 sdhci_dumpregs(host); 984 sdhci_dumpregs(host);
859 985
860 writew(~0, host->ioaddr + SDHCI_ACMD12_ERR);
861 }
862
863 if (intmask)
864 writel(intmask, host->ioaddr + SDHCI_INT_STATUS); 986 writel(intmask, host->ioaddr + SDHCI_INT_STATUS);
987 }
865 988
866 result = IRQ_HANDLED; 989 result = IRQ_HANDLED;
867 990
@@ -954,6 +1077,7 @@ static int sdhci_resume (struct pci_dev *pdev)
954static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) 1077static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
955{ 1078{
956 int ret; 1079 int ret;
1080 unsigned int version;
957 struct sdhci_chip *chip; 1081 struct sdhci_chip *chip;
958 struct mmc_host *mmc; 1082 struct mmc_host *mmc;
959 struct sdhci_host *host; 1083 struct sdhci_host *host;
@@ -985,6 +1109,16 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
985 return -ENODEV; 1109 return -ENODEV;
986 } 1110 }
987 1111
1112 if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
1113 printk(KERN_ERR DRIVER_NAME ": Vendor specific interface. Aborting.\n");
1114 return -ENODEV;
1115 }
1116
1117 if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) {
1118 printk(KERN_ERR DRIVER_NAME ": Unknown interface. Aborting.\n");
1119 return -ENODEV;
1120 }
1121
988 mmc = mmc_alloc_host(sizeof(struct sdhci_host), &pdev->dev); 1122 mmc = mmc_alloc_host(sizeof(struct sdhci_host), &pdev->dev);
989 if (!mmc) 1123 if (!mmc)
990 return -ENOMEM; 1124 return -ENOMEM;
@@ -1012,9 +1146,30 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1012 goto release; 1146 goto release;
1013 } 1147 }
1014 1148
1149 sdhci_reset(host, SDHCI_RESET_ALL);
1150
1151 version = readw(host->ioaddr + SDHCI_HOST_VERSION);
1152 version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
1153 if (version != 0) {
1154 printk(KERN_ERR "%s: Unknown controller version (%d). "
1155 "Cowardly refusing to continue.\n", host->slot_descr,
1156 version);
1157 ret = -ENODEV;
1158 goto unmap;
1159 }
1160
1015 caps = readl(host->ioaddr + SDHCI_CAPABILITIES); 1161 caps = readl(host->ioaddr + SDHCI_CAPABILITIES);
1016 1162
1017 if ((caps & SDHCI_CAN_DO_DMA) && ((pdev->class & 0x0000FF) == 0x01)) 1163 if (debug_nodma)
1164 DBG("DMA forced off\n");
1165 else if (debug_forcedma) {
1166 DBG("DMA forced on\n");
1167 host->flags |= SDHCI_USE_DMA;
1168 } else if ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA)
1169 DBG("Controller doesn't have DMA interface\n");
1170 else if (!(caps & SDHCI_CAN_DO_DMA))
1171 DBG("Controller doesn't have DMA capability\n");
1172 else
1018 host->flags |= SDHCI_USE_DMA; 1173 host->flags |= SDHCI_USE_DMA;
1019 1174
1020 if (host->flags & SDHCI_USE_DMA) { 1175 if (host->flags & SDHCI_USE_DMA) {
@@ -1030,18 +1185,59 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1030 else /* XXX: Hack to get MMC layer to avoid highmem */ 1185 else /* XXX: Hack to get MMC layer to avoid highmem */
1031 pdev->dma_mask = 0; 1186 pdev->dma_mask = 0;
1032 1187
1033 host->max_clk = (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; 1188 host->max_clk =
1189 (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
1190 if (host->max_clk == 0) {
1191 printk(KERN_ERR "%s: Hardware doesn't specify base clock "
1192 "frequency.\n", host->slot_descr);
1193 ret = -ENODEV;
1194 goto unmap;
1195 }
1034 host->max_clk *= 1000000; 1196 host->max_clk *= 1000000;
1035 1197
1198 host->timeout_clk =
1199 (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
1200 if (host->timeout_clk == 0) {
1201 printk(KERN_ERR "%s: Hardware doesn't specify timeout clock "
1202 "frequency.\n", host->slot_descr);
1203 ret = -ENODEV;
1204 goto unmap;
1205 }
1206 if (caps & SDHCI_TIMEOUT_CLK_UNIT)
1207 host->timeout_clk *= 1000;
1208
1209 host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
1210 if (host->max_block >= 3) {
1211 printk(KERN_ERR "%s: Invalid maximum block size.\n",
1212 host->slot_descr);
1213 ret = -ENODEV;
1214 goto unmap;
1215 }
1216 host->max_block = 512 << host->max_block;
1217
1036 /* 1218 /*
1037 * Set host parameters. 1219 * Set host parameters.
1038 */ 1220 */
1039 mmc->ops = &sdhci_ops; 1221 mmc->ops = &sdhci_ops;
1040 mmc->f_min = host->max_clk / 256; 1222 mmc->f_min = host->max_clk / 256;
1041 mmc->f_max = host->max_clk; 1223 mmc->f_max = host->max_clk;
1042 mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
1043 mmc->caps = MMC_CAP_4_BIT_DATA; 1224 mmc->caps = MMC_CAP_4_BIT_DATA;
1044 1225
1226 mmc->ocr_avail = 0;
1227 if (caps & SDHCI_CAN_VDD_330)
1228 mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34;
1229 else if (caps & SDHCI_CAN_VDD_300)
1230 mmc->ocr_avail |= MMC_VDD_29_30|MMC_VDD_30_31;
1231 else if (caps & SDHCI_CAN_VDD_180)
1232 mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19;
1233
1234 if (mmc->ocr_avail == 0) {
1235 printk(KERN_ERR "%s: Hardware doesn't report any "
1236 "support voltages.\n", host->slot_descr);
1237 ret = -ENODEV;
1238 goto unmap;
1239 }
1240
1045 spin_lock_init(&host->lock); 1241 spin_lock_init(&host->lock);
1046 1242
1047 /* 1243 /*
@@ -1054,10 +1250,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1054 mmc->max_phys_segs = 16; 1250 mmc->max_phys_segs = 16;
1055 1251
1056 /* 1252 /*
1057 * Maximum number of sectors in one transfer. Limited by sector 1253 * Maximum number of sectors in one transfer. Limited by DMA boundary
1058 * count register. 1254 * size (512KiB), which means (512 KiB/512=) 1024 entries.
1059 */ 1255 */
1060 mmc->max_sectors = 0x3FFF; 1256 mmc->max_sectors = 1024;
1061 1257
1062 /* 1258 /*
1063 * Maximum segment size. Could be one segment with the maximum number 1259 * Maximum segment size. Could be one segment with the maximum number
@@ -1075,10 +1271,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1075 1271
1076 setup_timer(&host->timer, sdhci_timeout_timer, (long)host); 1272 setup_timer(&host->timer, sdhci_timeout_timer, (long)host);
1077 1273
1078 ret = request_irq(host->irq, sdhci_irq, SA_SHIRQ, 1274 ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED,
1079 host->slot_descr, host); 1275 host->slot_descr, host);
1080 if (ret) 1276 if (ret)
1081 goto unmap; 1277 goto untasklet;
1082 1278
1083 sdhci_init(host); 1279 sdhci_init(host);
1084 1280
@@ -1097,10 +1293,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1097 1293
1098 return 0; 1294 return 0;
1099 1295
1100unmap: 1296untasklet:
1101 tasklet_kill(&host->card_tasklet); 1297 tasklet_kill(&host->card_tasklet);
1102 tasklet_kill(&host->finish_tasklet); 1298 tasklet_kill(&host->finish_tasklet);
1103 1299unmap:
1104 iounmap(host->ioaddr); 1300 iounmap(host->ioaddr);
1105release: 1301release:
1106 pci_release_region(pdev, host->bar); 1302 pci_release_region(pdev, host->bar);
@@ -1144,13 +1340,18 @@ static int __devinit sdhci_probe(struct pci_dev *pdev,
1144 const struct pci_device_id *ent) 1340 const struct pci_device_id *ent)
1145{ 1341{
1146 int ret, i; 1342 int ret, i;
1147 u8 slots; 1343 u8 slots, rev;
1148 struct sdhci_chip *chip; 1344 struct sdhci_chip *chip;
1149 1345
1150 BUG_ON(pdev == NULL); 1346 BUG_ON(pdev == NULL);
1151 BUG_ON(ent == NULL); 1347 BUG_ON(ent == NULL);
1152 1348
1153 DBG("found at %s\n", pci_name(pdev)); 1349 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &rev);
1350
1351 printk(KERN_INFO DRIVER_NAME
1352 ": SDHCI controller found at %s [%04x:%04x] (rev %x)\n",
1353 pci_name(pdev), (int)pdev->vendor, (int)pdev->device,
1354 (int)rev);
1154 1355
1155 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots); 1356 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
1156 if (ret) 1357 if (ret)
@@ -1173,6 +1374,10 @@ static int __devinit sdhci_probe(struct pci_dev *pdev,
1173 } 1374 }
1174 1375
1175 chip->pdev = pdev; 1376 chip->pdev = pdev;
1377 chip->quirks = ent->driver_data;
1378
1379 if (debug_quirks)
1380 chip->quirks = debug_quirks;
1176 1381
1177 chip->num_slots = slots; 1382 chip->num_slots = slots;
1178 pci_set_drvdata(pdev, chip); 1383 pci_set_drvdata(pdev, chip);
@@ -1251,7 +1456,15 @@ static void __exit sdhci_drv_exit(void)
1251module_init(sdhci_drv_init); 1456module_init(sdhci_drv_init);
1252module_exit(sdhci_drv_exit); 1457module_exit(sdhci_drv_exit);
1253 1458
1459module_param(debug_nodma, uint, 0444);
1460module_param(debug_forcedma, uint, 0444);
1461module_param(debug_quirks, uint, 0444);
1462
1254MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); 1463MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>");
1255MODULE_DESCRIPTION("Secure Digital Host Controller Interface driver"); 1464MODULE_DESCRIPTION("Secure Digital Host Controller Interface driver");
1256MODULE_VERSION(DRIVER_VERSION); 1465MODULE_VERSION(DRIVER_VERSION);
1257MODULE_LICENSE("GPL"); 1466MODULE_LICENSE("GPL");
1467
1468MODULE_PARM_DESC(debug_nodma, "Forcefully disable DMA transfers. (default 0)");
1469MODULE_PARM_DESC(debug_forcedma, "Forcefully enable DMA transfers. (default 0)");
1470MODULE_PARM_DESC(debug_quirks, "Force certain quirks.");
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h
index 3b270ef486b4..f2453343f783 100644
--- a/drivers/mmc/sdhci.h
+++ b/drivers/mmc/sdhci.h
@@ -12,6 +12,10 @@
12 * PCI registers 12 * PCI registers
13 */ 13 */
14 14
15#define PCI_SDHCI_IFPIO 0x00
16#define PCI_SDHCI_IFDMA 0x01
17#define PCI_SDHCI_IFVENDOR 0x02
18
15#define PCI_SLOT_INFO 0x40 /* 8 bits */ 19#define PCI_SLOT_INFO 0x40 /* 8 bits */
16#define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7) 20#define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7)
17#define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07 21#define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07
@@ -23,6 +27,7 @@
23#define SDHCI_DMA_ADDRESS 0x00 27#define SDHCI_DMA_ADDRESS 0x00
24 28
25#define SDHCI_BLOCK_SIZE 0x04 29#define SDHCI_BLOCK_SIZE 0x04
30#define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))
26 31
27#define SDHCI_BLOCK_COUNT 0x06 32#define SDHCI_BLOCK_COUNT 0x06
28 33
@@ -67,6 +72,10 @@
67#define SDHCI_CTRL_4BITBUS 0x02 72#define SDHCI_CTRL_4BITBUS 0x02
68 73
69#define SDHCI_POWER_CONTROL 0x29 74#define SDHCI_POWER_CONTROL 0x29
75#define SDHCI_POWER_ON 0x01
76#define SDHCI_POWER_180 0x0A
77#define SDHCI_POWER_300 0x0C
78#define SDHCI_POWER_330 0x0E
70 79
71#define SDHCI_BLOCK_GAP_CONTROL 0x2A 80#define SDHCI_BLOCK_GAP_CONTROL 0x2A
72 81
@@ -91,8 +100,8 @@
91#define SDHCI_INT_RESPONSE 0x00000001 100#define SDHCI_INT_RESPONSE 0x00000001
92#define SDHCI_INT_DATA_END 0x00000002 101#define SDHCI_INT_DATA_END 0x00000002
93#define SDHCI_INT_DMA_END 0x00000008 102#define SDHCI_INT_DMA_END 0x00000008
94#define SDHCI_INT_BUF_EMPTY 0x00000010 103#define SDHCI_INT_SPACE_AVAIL 0x00000010
95#define SDHCI_INT_BUF_FULL 0x00000020 104#define SDHCI_INT_DATA_AVAIL 0x00000020
96#define SDHCI_INT_CARD_INSERT 0x00000040 105#define SDHCI_INT_CARD_INSERT 0x00000040
97#define SDHCI_INT_CARD_REMOVE 0x00000080 106#define SDHCI_INT_CARD_REMOVE 0x00000080
98#define SDHCI_INT_CARD_INT 0x00000100 107#define SDHCI_INT_CARD_INT 0x00000100
@@ -112,7 +121,7 @@
112#define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_TIMEOUT | \ 121#define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_TIMEOUT | \
113 SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX) 122 SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX)
114#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \ 123#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \
115 SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL | \ 124 SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \
116 SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \ 125 SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \
117 SDHCI_INT_DATA_END_BIT) 126 SDHCI_INT_DATA_END_BIT)
118 127
@@ -121,9 +130,17 @@
121/* 3E-3F reserved */ 130/* 3E-3F reserved */
122 131
123#define SDHCI_CAPABILITIES 0x40 132#define SDHCI_CAPABILITIES 0x40
124#define SDHCI_CAN_DO_DMA 0x00400000 133#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F
134#define SDHCI_TIMEOUT_CLK_SHIFT 0
135#define SDHCI_TIMEOUT_CLK_UNIT 0x00000080
125#define SDHCI_CLOCK_BASE_MASK 0x00003F00 136#define SDHCI_CLOCK_BASE_MASK 0x00003F00
126#define SDHCI_CLOCK_BASE_SHIFT 8 137#define SDHCI_CLOCK_BASE_SHIFT 8
138#define SDHCI_MAX_BLOCK_MASK 0x00030000
139#define SDHCI_MAX_BLOCK_SHIFT 16
140#define SDHCI_CAN_DO_DMA 0x00400000
141#define SDHCI_CAN_VDD_330 0x01000000
142#define SDHCI_CAN_VDD_300 0x02000000
143#define SDHCI_CAN_VDD_180 0x04000000
127 144
128/* 44-47 reserved for more caps */ 145/* 44-47 reserved for more caps */
129 146
@@ -136,6 +153,10 @@
136#define SDHCI_SLOT_INT_STATUS 0xFC 153#define SDHCI_SLOT_INT_STATUS 0xFC
137 154
138#define SDHCI_HOST_VERSION 0xFE 155#define SDHCI_HOST_VERSION 0xFE
156#define SDHCI_VENDOR_VER_MASK 0xFF00
157#define SDHCI_VENDOR_VER_SHIFT 8
158#define SDHCI_SPEC_VER_MASK 0x00FF
159#define SDHCI_SPEC_VER_SHIFT 0
139 160
140struct sdhci_chip; 161struct sdhci_chip;
141 162
@@ -149,8 +170,11 @@ struct sdhci_host {
149#define SDHCI_USE_DMA (1<<0) 170#define SDHCI_USE_DMA (1<<0)
150 171
151 unsigned int max_clk; /* Max possible freq (MHz) */ 172 unsigned int max_clk; /* Max possible freq (MHz) */
173 unsigned int timeout_clk; /* Timeout freq (KHz) */
174 unsigned int max_block; /* Max block size (bytes) */
152 175
153 unsigned int clock; /* Current clock (MHz) */ 176 unsigned int clock; /* Current clock (MHz) */
177 unsigned short power; /* Current voltage */
154 178
155 struct mmc_request *mrq; /* Current request */ 179 struct mmc_request *mrq; /* Current request */
156 struct mmc_command *cmd; /* Current command */ 180 struct mmc_command *cmd; /* Current command */
@@ -180,6 +204,8 @@ struct sdhci_host {
180struct sdhci_chip { 204struct sdhci_chip {
181 struct pci_dev *pdev; 205 struct pci_dev *pdev;
182 206
207 unsigned long quirks;
208
183 int num_slots; /* Slots on controller */ 209 int num_slots; /* Slots on controller */
184 struct sdhci_host *hosts[0]; /* Pointers to hosts */ 210 struct sdhci_host *hosts[0]; /* Pointers to hosts */
185}; 211};
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 3fcd86c08ebd..8a30ef3ae419 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -1553,7 +1553,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1553 * Allocate interrupt. 1553 * Allocate interrupt.
1554 */ 1554 */
1555 1555
1556 ret = request_irq(irq, wbsd_irq, SA_SHIRQ, DRIVER_NAME, host); 1556 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host);
1557 if (ret) 1557 if (ret)
1558 return ret; 1558 return ret;
1559 1559
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index ac60f3f62db8..4532b17e40ea 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -760,7 +760,7 @@ static int corkscrew_open(struct net_device *dev)
760 vp->product_name, dev)) return -EAGAIN; 760 vp->product_name, dev)) return -EAGAIN;
761 enable_dma(dev->dma); 761 enable_dma(dev->dma);
762 set_dma_mode(dev->dma, DMA_MODE_CASCADE); 762 set_dma_mode(dev->dma, DMA_MODE_CASCADE);
763 } else if (request_irq(dev->irq, &corkscrew_interrupt, SA_SHIRQ, 763 } else if (request_irq(dev->irq, &corkscrew_interrupt, IRQF_SHARED,
764 vp->product_name, dev)) { 764 vp->product_name, dev)) {
765 return -EAGAIN; 765 return -EAGAIN;
766 } 766 }
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 4bf8510655c5..5dfd97f0ba9e 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -289,7 +289,7 @@ static int elmc_open(struct net_device *dev)
289 289
290 elmc_id_attn586(); /* disable interrupts */ 290 elmc_id_attn586(); /* disable interrupts */
291 291
292 ret = request_irq(dev->irq, &elmc_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, 292 ret = request_irq(dev->irq, &elmc_interrupt, IRQF_SHARED | IRQF_SAMPLE_RANDOM,
293 dev->name, dev); 293 dev->name, dev);
294 if (ret) { 294 if (ret) {
295 printk(KERN_ERR "%s: couldn't get irq %d\n", dev->name, dev->irq); 295 printk(KERN_ERR "%s: couldn't get irq %d\n", dev->name, dev->irq);
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 157eda573925..03c0f7176fc9 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -435,7 +435,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
435 * Grab the IRQ 435 * Grab the IRQ
436 */ 436 */
437 437
438 err = request_irq(dev->irq, &mc32_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, DRV_NAME, dev); 438 err = request_irq(dev->irq, &mc32_interrupt, IRQF_SHARED | IRQF_SAMPLE_RANDOM, DRV_NAME, dev);
439 if (err) { 439 if (err) {
440 release_region(dev->base_addr, MC32_IO_EXTENT); 440 release_region(dev->base_addr, MC32_IO_EXTENT);
441 printk(KERN_ERR "%s: unable to get IRQ %d.\n", DRV_NAME, dev->irq); 441 printk(KERN_ERR "%s: unable to get IRQ %d.\n", DRV_NAME, dev->irq);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 45125db44177..8ab03b4a885e 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -996,7 +996,7 @@ static int vortex_resume(struct pci_dev *pdev)
996 pci_enable_device(pdev); 996 pci_enable_device(pdev);
997 pci_set_master(pdev); 997 pci_set_master(pdev);
998 if (request_irq(dev->irq, vp->full_bus_master_rx ? 998 if (request_irq(dev->irq, vp->full_bus_master_rx ?
999 &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev)) { 999 &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev)) {
1000 printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq); 1000 printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
1001 pci_disable_device(pdev); 1001 pci_disable_device(pdev);
1002 return -EBUSY; 1002 return -EBUSY;
@@ -1833,7 +1833,7 @@ vortex_open(struct net_device *dev)
1833 1833
1834 /* Use the now-standard shared IRQ implementation. */ 1834 /* Use the now-standard shared IRQ implementation. */
1835 if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ? 1835 if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?
1836 &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev))) { 1836 &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev))) {
1837 printk(KERN_ERR "%s: Could not reserve IRQ %d\n", dev->name, dev->irq); 1837 printk(KERN_ERR "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
1838 goto out; 1838 goto out;
1839 } 1839 }
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 1d7af760c2b1..1959654cbec8 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1203,7 +1203,7 @@ static int cp_open (struct net_device *dev)
1203 1203
1204 cp_init_hw(cp); 1204 cp_init_hw(cp);
1205 1205
1206 rc = request_irq(dev->irq, cp_interrupt, SA_SHIRQ, dev->name, dev); 1206 rc = request_irq(dev->irq, cp_interrupt, IRQF_SHARED, dev->name, dev);
1207 if (rc) 1207 if (rc)
1208 goto err_out_hw; 1208 goto err_out_hw;
1209 1209
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index d21e98f5adbc..717506b2b13a 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1310,7 +1310,7 @@ static int rtl8139_open (struct net_device *dev)
1310 int retval; 1310 int retval;
1311 void __iomem *ioaddr = tp->mmio_addr; 1311 void __iomem *ioaddr = tp->mmio_addr;
1312 1312
1313 retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev); 1313 retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);
1314 if (retval) 1314 if (retval)
1315 return retval; 1315 return retval;
1316 1316
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 519390c033c3..f4ea62641acd 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -495,7 +495,7 @@ static int lance_open (struct net_device *dev)
495 ll->rdp = LE_C0_STOP; 495 ll->rdp = LE_C0_STOP;
496 496
497 /* Install the Interrupt handler */ 497 /* Install the Interrupt handler */
498 ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, SA_SHIRQ, 498 ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, IRQF_SHARED,
499 dev->name, dev); 499 dev->name, dev);
500 if (ret) return ret; 500 if (ret) return ret;
501 501
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index c290b5ae63b2..1c01e9b3d07c 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -1194,7 +1194,7 @@ static int __devinit ace_init(struct net_device *dev)
1194 goto init_error; 1194 goto init_error;
1195 } 1195 }
1196 1196
1197 ecode = request_irq(pdev->irq, ace_interrupt, SA_SHIRQ, 1197 ecode = request_irq(pdev->irq, ace_interrupt, IRQF_SHARED,
1198 DRV_NAME, dev); 1198 DRV_NAME, dev);
1199 if (ecode) { 1199 if (ecode) {
1200 printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", 1200 printk(KERN_WARNING "%s: Requested IRQ %d is busy\n",
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index c017c4f6b3b5..ed322a76980d 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1376,7 +1376,7 @@ static int amd8111e_open(struct net_device * dev )
1376{ 1376{
1377 struct amd8111e_priv *lp = netdev_priv(dev); 1377 struct amd8111e_priv *lp = netdev_priv(dev);
1378 1378
1379 if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, SA_SHIRQ, 1379 if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, IRQF_SHARED,
1380 dev->name, dev)) 1380 dev->name, dev))
1381 return -EAGAIN; 1381 return -EAGAIN;
1382 1382
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index b9820b86cdcc..9cc13a0250d6 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -313,7 +313,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
313 dev->base_addr = ioaddr; 313 dev->base_addr = ioaddr;
314 314
315 /* Install the Interrupt handler */ 315 /* Install the Interrupt handler */
316 i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, DRV_NAME, dev); 316 i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, IRQF_SHARED, DRV_NAME, dev);
317 if (i) return i; 317 if (i) return i;
318 318
319 for(i = 0; i < ETHER_ADDR_LEN; i++) { 319 for(i = 0; i < ETHER_ADDR_LEN; i++) {
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 96636ca8754e..979a33df0a8c 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -120,7 +120,7 @@ static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_de
120 goto out_port; 120 goto out_port;
121 } 121 }
122 122
123 if ((err = com20020_found(dev, SA_SHIRQ)) != 0) 123 if ((err = com20020_found(dev, IRQF_SHARED)) != 0)
124 goto out_port; 124 goto out_port;
125 125
126 return 0; 126 return 0;
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index a9bb7a4aff98..cc721addd576 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -320,7 +320,7 @@ static int ariadne_open(struct net_device *dev)
320 320
321 netif_start_queue(dev); 321 netif_start_queue(dev);
322 322
323 i = request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, SA_SHIRQ, 323 i = request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, IRQF_SHARED,
324 dev->name, dev); 324 dev->name, dev);
325 if (i) return i; 325 if (i) return i;
326 326
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index a7e4ba5a580f..cd98d31dee8c 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1421,7 +1421,7 @@ static int b44_open(struct net_device *dev)
1421 1421
1422 b44_check_phy(bp); 1422 b44_check_phy(bp);
1423 1423
1424 err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); 1424 err = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev);
1425 if (unlikely(err < 0)) { 1425 if (unlikely(err < 0)) {
1426 b44_chip_reset(bp); 1426 b44_chip_reset(bp);
1427 b44_free_rings(bp); 1427 b44_free_rings(bp);
@@ -2322,7 +2322,7 @@ static int b44_resume(struct pci_dev *pdev)
2322 if (!netif_running(dev)) 2322 if (!netif_running(dev))
2323 return 0; 2323 return 0;
2324 2324
2325 if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev)) 2325 if (request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev))
2326 printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name); 2326 printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
2327 2327
2328 spin_lock_irq(&bp->lock); 2328 spin_lock_irq(&bp->lock);
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 7e32d4ea71e2..4f4db5ae503b 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4260,11 +4260,11 @@ bnx2_open(struct net_device *dev)
4260 } 4260 }
4261 else { 4261 else {
4262 rc = request_irq(bp->pdev->irq, bnx2_interrupt, 4262 rc = request_irq(bp->pdev->irq, bnx2_interrupt,
4263 SA_SHIRQ, dev->name, dev); 4263 IRQF_SHARED, dev->name, dev);
4264 } 4264 }
4265 } 4265 }
4266 else { 4266 else {
4267 rc = request_irq(bp->pdev->irq, bnx2_interrupt, SA_SHIRQ, 4267 rc = request_irq(bp->pdev->irq, bnx2_interrupt, IRQF_SHARED,
4268 dev->name, dev); 4268 dev->name, dev);
4269 } 4269 }
4270 if (rc) { 4270 if (rc) {
@@ -4311,7 +4311,7 @@ bnx2_open(struct net_device *dev)
4311 4311
4312 if (!rc) { 4312 if (!rc) {
4313 rc = request_irq(bp->pdev->irq, bnx2_interrupt, 4313 rc = request_irq(bp->pdev->irq, bnx2_interrupt,
4314 SA_SHIRQ, dev->name, dev); 4314 IRQF_SHARED, dev->name, dev);
4315 } 4315 }
4316 if (rc) { 4316 if (rc) {
4317 bnx2_free_skbs(bp); 4317 bnx2_free_skbs(bp);
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index b89c7bb2c591..d33130f64700 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4349,7 +4349,7 @@ static int cas_open(struct net_device *dev)
4349 * mapping to expose them 4349 * mapping to expose them
4350 */ 4350 */
4351 if (request_irq(cp->pdev->irq, cas_interrupt, 4351 if (request_irq(cp->pdev->irq, cas_interrupt,
4352 SA_SHIRQ, dev->name, (void *) dev)) { 4352 IRQF_SHARED, dev->name, (void *) dev)) {
4353 printk(KERN_ERR "%s: failed to request irq !\n", 4353 printk(KERN_ERR "%s: failed to request irq !\n",
4354 cp->dev->name); 4354 cp->dev->name);
4355 err = -EAGAIN; 4355 err = -EAGAIN;
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index c490a862e79c..e67872433e92 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -218,7 +218,7 @@ static int cxgb_up(struct adapter *adapter)
218 218
219 t1_interrupts_clear(adapter); 219 t1_interrupts_clear(adapter);
220 if ((err = request_irq(adapter->pdev->irq, 220 if ((err = request_irq(adapter->pdev->irq,
221 t1_select_intr_handler(adapter), SA_SHIRQ, 221 t1_select_intr_handler(adapter), IRQF_SHARED,
222 adapter->name, adapter))) { 222 adapter->name, adapter))) {
223 goto out_err; 223 goto out_err;
224 } 224 }
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index d3654fd71604..0eb1f8787ed7 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -671,7 +671,7 @@ e100_open(struct net_device *dev)
671 /* allocate the irq corresponding to the receiving DMA */ 671 /* allocate the irq corresponding to the receiving DMA */
672 672
673 if (request_irq(NETWORK_DMA_RX_IRQ_NBR, e100rxtx_interrupt, 673 if (request_irq(NETWORK_DMA_RX_IRQ_NBR, e100rxtx_interrupt,
674 SA_SAMPLE_RANDOM, cardname, (void *)dev)) { 674 IRQF_SAMPLE_RANDOM, cardname, (void *)dev)) {
675 goto grace_exit0; 675 goto grace_exit0;
676 } 676 }
677 677
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index 5acd35c312ac..91cc8cbdd440 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -1228,7 +1228,7 @@ static int dfx_open(struct net_device *dev)
1228 1228
1229 /* Register IRQ - support shared interrupts by passing device ptr */ 1229 /* Register IRQ - support shared interrupts by passing device ptr */
1230 1230
1231 ret = request_irq(dev->irq, dfx_interrupt, SA_SHIRQ, dev->name, dev); 1231 ret = request_irq(dev->irq, dfx_interrupt, IRQF_SHARED, dev->name, dev);
1232 if (ret) { 1232 if (ret) {
1233 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); 1233 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq);
1234 return ret; 1234 return ret;
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c
index e175d4876682..fa4f09432975 100644
--- a/drivers/net/dgrs.c
+++ b/drivers/net/dgrs.c
@@ -1191,7 +1191,7 @@ dgrs_probe1(struct net_device *dev)
1191 if (priv->plxreg) 1191 if (priv->plxreg)
1192 OUTL(dev->base_addr + PLX_LCL2PCI_DOORBELL, 1); 1192 OUTL(dev->base_addr + PLX_LCL2PCI_DOORBELL, 1);
1193 1193
1194 rc = request_irq(dev->irq, &dgrs_intr, SA_SHIRQ, "RightSwitch", dev); 1194 rc = request_irq(dev->irq, &dgrs_intr, IRQF_SHARED, "RightSwitch", dev);
1195 if (rc) 1195 if (rc)
1196 goto err_out; 1196 goto err_out;
1197 1197
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 29778055223b..4b6ddb70f921 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -440,7 +440,7 @@ rio_open (struct net_device *dev)
440 int i; 440 int i;
441 u16 macctrl; 441 u16 macctrl;
442 442
443 i = request_irq (dev->irq, &rio_interrupt, SA_SHIRQ, dev->name, dev); 443 i = request_irq (dev->irq, &rio_interrupt, IRQF_SHARED, dev->name, dev);
444 if (i) 444 if (i)
445 return i; 445 return i;
446 446
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 7965a9b08e79..1b758b707134 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -603,7 +603,7 @@ dm9000_open(struct net_device *dev)
603 603
604 PRINTK2("entering dm9000_open\n"); 604 PRINTK2("entering dm9000_open\n");
605 605
606 if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ, dev->name, dev)) 606 if (request_irq(dev->irq, &dm9000_interrupt, IRQF_SHARED, dev->name, dev))
607 return -EAGAIN; 607 return -EAGAIN;
608 608
609 /* Initialize DM9000 board */ 609 /* Initialize DM9000 board */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index a1d676a0df7c..91ef5f2fd768 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2063,7 +2063,7 @@ static int e100_up(struct nic *nic)
2063 e100_set_multicast_list(nic->netdev); 2063 e100_set_multicast_list(nic->netdev);
2064 e100_start_receiver(nic, NULL); 2064 e100_start_receiver(nic, NULL);
2065 mod_timer(&nic->watchdog, jiffies); 2065 mod_timer(&nic->watchdog, jiffies);
2066 if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, 2066 if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
2067 nic->netdev->name, nic->netdev))) 2067 nic->netdev->name, nic->netdev)))
2068 goto err_no_irq; 2068 goto err_no_irq;
2069 netif_wake_queue(nic->netdev); 2069 netif_wake_queue(nic->netdev);
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 6ed7f599eba3..d19664891768 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -871,10 +871,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
871 *data = 0; 871 *data = 0;
872 872
873 /* Hook up test interrupt handler just for this test */ 873 /* Hook up test interrupt handler just for this test */
874 if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name, 874 if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED,
875 netdev)) { 875 netdev->name, netdev)) {
876 shared_int = FALSE; 876 shared_int = FALSE;
877 } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, 877 } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED,
878 netdev->name, netdev)){ 878 netdev->name, netdev)){
879 *data = 1; 879 *data = 1;
880 return -1; 880 return -1;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 32b7d444b374..f77624f5f17b 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -426,7 +426,7 @@ e1000_up(struct e1000_adapter *adapter)
426 } 426 }
427#endif 427#endif
428 if ((err = request_irq(adapter->pdev->irq, &e1000_intr, 428 if ((err = request_irq(adapter->pdev->irq, &e1000_intr,
429 SA_SHIRQ | SA_SAMPLE_RANDOM, 429 IRQF_SHARED | IRQF_SAMPLE_RANDOM,
430 netdev->name, netdev))) { 430 netdev->name, netdev))) {
431 DPRINTK(PROBE, ERR, 431 DPRINTK(PROBE, ERR,
432 "Unable to allocate interrupt Error: %d\n", err); 432 "Unable to allocate interrupt Error: %d\n", err);
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index e70f172699db..20d31430c74f 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -920,7 +920,7 @@ static int eepro_grab_irq(struct net_device *dev)
920 920
921 eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */ 921 eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */
922 922
923 if (request_irq (*irqp, NULL, SA_SHIRQ, "bogus", dev) != EBUSY) { 923 if (request_irq (*irqp, NULL, IRQF_SHARED, "bogus", dev) != EBUSY) {
924 unsigned long irq_mask; 924 unsigned long irq_mask;
925 /* Twinkle the interrupt, and check if it's seen */ 925 /* Twinkle the interrupt, and check if it's seen */
926 irq_mask = probe_irq_on(); 926 irq_mask = probe_irq_on();
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 1e2fbbbb966e..2ad327542927 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -977,7 +977,7 @@ speedo_open(struct net_device *dev)
977 sp->in_interrupt = 0; 977 sp->in_interrupt = 0;
978 978
979 /* .. we can safely take handler calls during init. */ 979 /* .. we can safely take handler calls during init. */
980 retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ, dev->name, dev); 980 retval = request_irq(dev->irq, &speedo_interrupt, IRQF_SHARED, dev->name, dev);
981 if (retval) { 981 if (retval) {
982 return retval; 982 return retval;
983 } 983 }
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index b160abed8dd7..9f3e09a3d88c 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -713,7 +713,7 @@ static int epic_open(struct net_device *dev)
713 /* Soft reset the chip. */ 713 /* Soft reset the chip. */
714 outl(0x4001, ioaddr + GENCTL); 714 outl(0x4001, ioaddr + GENCTL);
715 715
716 if ((retval = request_irq(dev->irq, &epic_interrupt, SA_SHIRQ, dev->name, dev))) 716 if ((retval = request_irq(dev->irq, &epic_interrupt, IRQF_SHARED, dev->name, dev)))
717 return retval; 717 return retval;
718 718
719 epic_init_ring(dev); 719 epic_init_ring(dev);
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 13eca7ede2af..c701951dcd6f 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -834,7 +834,7 @@ static int netdev_open(struct net_device *dev)
834 834
835 iowrite32(0x00000001, ioaddr + BCR); /* Reset */ 835 iowrite32(0x00000001, ioaddr + BCR); /* Reset */
836 836
837 if (request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev)) 837 if (request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev))
838 return -EAGAIN; 838 return -EAGAIN;
839 839
840 for (i = 0; i < 3; i++) 840 for (i = 0; i < 3; i++)
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 21be4fa071b5..3c90003f4230 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2622,21 +2622,21 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
2622 np->msi_flags |= NV_MSI_X_ENABLED; 2622 np->msi_flags |= NV_MSI_X_ENABLED;
2623 if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) { 2623 if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) {
2624 /* Request irq for rx handling */ 2624 /* Request irq for rx handling */
2625 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { 2625 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, IRQF_SHARED, dev->name, dev) != 0) {
2626 printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); 2626 printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);
2627 pci_disable_msix(np->pci_dev); 2627 pci_disable_msix(np->pci_dev);
2628 np->msi_flags &= ~NV_MSI_X_ENABLED; 2628 np->msi_flags &= ~NV_MSI_X_ENABLED;
2629 goto out_err; 2629 goto out_err;
2630 } 2630 }
2631 /* Request irq for tx handling */ 2631 /* Request irq for tx handling */
2632 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { 2632 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, IRQF_SHARED, dev->name, dev) != 0) {
2633 printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); 2633 printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);
2634 pci_disable_msix(np->pci_dev); 2634 pci_disable_msix(np->pci_dev);
2635 np->msi_flags &= ~NV_MSI_X_ENABLED; 2635 np->msi_flags &= ~NV_MSI_X_ENABLED;
2636 goto out_free_rx; 2636 goto out_free_rx;
2637 } 2637 }
2638 /* Request irq for link and timer handling */ 2638 /* Request irq for link and timer handling */
2639 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { 2639 if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, IRQF_SHARED, dev->name, dev) != 0) {
2640 printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); 2640 printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);
2641 pci_disable_msix(np->pci_dev); 2641 pci_disable_msix(np->pci_dev);
2642 np->msi_flags &= ~NV_MSI_X_ENABLED; 2642 np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -2651,9 +2651,9 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
2651 } else { 2651 } else {
2652 /* Request irq for all interrupts */ 2652 /* Request irq for all interrupts */
2653 if ((!intr_test && 2653 if ((!intr_test &&
2654 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || 2654 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) ||
2655 (intr_test && 2655 (intr_test &&
2656 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) { 2656 request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) {
2657 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); 2657 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
2658 pci_disable_msix(np->pci_dev); 2658 pci_disable_msix(np->pci_dev);
2659 np->msi_flags &= ~NV_MSI_X_ENABLED; 2659 np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -2669,8 +2669,8 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
2669 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { 2669 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
2670 if ((ret = pci_enable_msi(np->pci_dev)) == 0) { 2670 if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
2671 np->msi_flags |= NV_MSI_ENABLED; 2671 np->msi_flags |= NV_MSI_ENABLED;
2672 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || 2672 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) ||
2673 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) { 2673 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) {
2674 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); 2674 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
2675 pci_disable_msi(np->pci_dev); 2675 pci_disable_msi(np->pci_dev);
2676 np->msi_flags &= ~NV_MSI_ENABLED; 2676 np->msi_flags &= ~NV_MSI_ENABLED;
@@ -2685,8 +2685,8 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
2685 } 2685 }
2686 } 2686 }
2687 if (ret != 0) { 2687 if (ret != 0) {
2688 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || 2688 if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) ||
2689 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) 2689 (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0))
2690 goto out_err; 2690 goto out_err;
2691 2691
2692 } 2692 }
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index e96a93c94941..f6abff5846b3 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -671,7 +671,7 @@ static int fs_request_irq(struct net_device *dev, int irq, const char *name,
671 struct fs_enet_private *fep = netdev_priv(dev); 671 struct fs_enet_private *fep = netdev_priv(dev);
672 672
673 (*fep->ops->pre_request_irq)(dev, irq); 673 (*fep->ops->pre_request_irq)(dev, irq);
674 return request_irq(irq, irqf, SA_SHIRQ, name, dev); 674 return request_irq(irq, irqf, IRQF_SHARED, name, dev);
675} 675}
676 676
677static void fs_free_irq(struct net_device *dev, int irq) 677static void fs_free_irq(struct net_device *dev, int irq)
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
index 2d2435404614..49dacc6e35aa 100644
--- a/drivers/net/gt96100eth.c
+++ b/drivers/net/gt96100eth.c
@@ -1030,7 +1030,7 @@ gt96100_open(struct net_device *dev)
1030 } 1030 }
1031 1031
1032 if ((retval = request_irq(dev->irq, &gt96100_interrupt, 1032 if ((retval = request_irq(dev->irq, &gt96100_interrupt,
1033 SA_SHIRQ, dev->name, dev))) { 1033 IRQF_SHARED, dev->name, dev))) {
1034 err("unable to get IRQ %d\n", dev->irq); 1034 err("unable to get IRQ %d\n", dev->irq);
1035 return retval; 1035 return retval;
1036 } 1036 }
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 0ea4cb4a0d80..7bcd939c6edd 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -871,7 +871,7 @@ static int hamachi_open(struct net_device *dev)
871 u32 rx_int_var, tx_int_var; 871 u32 rx_int_var, tx_int_var;
872 u16 fifo_info; 872 u16 fifo_info;
873 873
874 i = request_irq(dev->irq, &hamachi_interrupt, SA_SHIRQ, dev->name, dev); 874 i = request_irq(dev->irq, &hamachi_interrupt, IRQF_SHARED, dev->name, dev);
875 if (i) 875 if (i)
876 return i; 876 return i;
877 877
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 232793d2ce6b..55906c7b4bb1 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -434,7 +434,7 @@ static int ser12_open(struct net_device *dev)
434 outb(0, FCR(dev->base_addr)); /* disable FIFOs */ 434 outb(0, FCR(dev->base_addr)); /* disable FIFOs */
435 outb(0x0d, MCR(dev->base_addr)); 435 outb(0x0d, MCR(dev->base_addr));
436 outb(0, IER(dev->base_addr)); 436 outb(0, IER(dev->base_addr));
437 if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, 437 if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED,
438 "baycom_ser_fdx", dev)) { 438 "baycom_ser_fdx", dev)) {
439 release_region(dev->base_addr, SER12_EXTENT); 439 release_region(dev->base_addr, SER12_EXTENT);
440 return -EBUSY; 440 return -EBUSY;
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
index be596a3eb3fd..de95de8983da 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -488,7 +488,7 @@ static int ser12_open(struct net_device *dev)
488 outb(0, FCR(dev->base_addr)); /* disable FIFOs */ 488 outb(0, FCR(dev->base_addr)); /* disable FIFOs */
489 outb(0x0d, MCR(dev->base_addr)); 489 outb(0x0d, MCR(dev->base_addr));
490 outb(0, IER(dev->base_addr)); 490 outb(0, IER(dev->base_addr));
491 if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, 491 if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED,
492 "baycom_ser12", dev)) { 492 "baycom_ser12", dev)) {
493 release_region(dev->base_addr, SER12_EXTENT); 493 release_region(dev->base_addr, SER12_EXTENT);
494 return -EBUSY; 494 return -EBUSY;
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index b9b10caa031c..df4b68142ac7 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1736,7 +1736,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1736 1736
1737 if (!Ivec[hwcfg.irq].used && hwcfg.irq) 1737 if (!Ivec[hwcfg.irq].used && hwcfg.irq)
1738 { 1738 {
1739 if (request_irq(hwcfg.irq, scc_isr, SA_INTERRUPT, "AX.25 SCC", NULL)) 1739 if (request_irq(hwcfg.irq, scc_isr, IRQF_DISABLED, "AX.25 SCC", NULL))
1740 printk(KERN_WARNING "z8530drv: warning, cannot get IRQ %d\n", hwcfg.irq); 1740 printk(KERN_WARNING "z8530drv: warning, cannot get IRQ %d\n", hwcfg.irq);
1741 else 1741 else
1742 Ivec[hwcfg.irq].used = 1; 1742 Ivec[hwcfg.irq].used = 1;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index dd2f11c98530..f98f5777dfbb 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -873,7 +873,7 @@ static int yam_open(struct net_device *dev)
873 goto out_release_base; 873 goto out_release_base;
874 } 874 }
875 outb(0, IER(dev->base_addr)); 875 outb(0, IER(dev->base_addr));
876 if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) { 876 if (request_irq(dev->irq, yam_interrupt, IRQF_DISABLED | IRQF_SHARED, dev->name, dev)) {
877 printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq); 877 printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq);
878 ret = -EBUSY; 878 ret = -EBUSY;
879 goto out_release_base; 879 goto out_release_base;
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index dd1dc32dc98d..e7d9bf330287 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1079,7 +1079,7 @@ static int hp100_open(struct net_device *dev)
1079 /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ 1079 /* New: if bus is PCI or EISA, interrupts might be shared interrupts */
1080 if (request_irq(dev->irq, hp100_interrupt, 1080 if (request_irq(dev->irq, hp100_interrupt,
1081 lp->bus == HP100_BUS_PCI || lp->bus == 1081 lp->bus == HP100_BUS_PCI || lp->bus ==
1082 HP100_BUS_EISA ? SA_SHIRQ : SA_INTERRUPT, 1082 HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED,
1083 "hp100", dev)) { 1083 "hp100", dev)) {
1084 printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); 1084 printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq);
1085 return -EAGAIN; 1085 return -EAGAIN;
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index d9fb8e74e631..91326ea3e12b 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -117,7 +117,7 @@ static int __devinit hydra_init(struct zorro_dev *z)
117 dev->irq = IRQ_AMIGA_PORTS; 117 dev->irq = IRQ_AMIGA_PORTS;
118 118
119 /* Install the Interrupt handler */ 119 /* Install the Interrupt handler */
120 if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, "Hydra Ethernet", 120 if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, IRQF_SHARED, "Hydra Ethernet",
121 dev)) { 121 dev)) {
122 free_netdev(dev); 122 free_netdev(dev);
123 return -EAGAIN; 123 return -EAGAIN;
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 51fd51609ea9..2a95d72fa593 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -782,7 +782,7 @@ static int ibmlana_open(struct net_device *dev)
782 782
783 /* register resources - only necessary for IRQ */ 783 /* register resources - only necessary for IRQ */
784 784
785 result = request_irq(priv->realirq, irq_handler, SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); 785 result = request_irq(priv->realirq, irq_handler, IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
786 if (result != 0) { 786 if (result != 0) {
787 printk(KERN_ERR "%s: failed to register irq %d\n", dev->name, dev->irq); 787 printk(KERN_ERR "%s: failed to register irq %d\n", dev->name, dev->irq);
788 return result; 788 return result;
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index dbf67750d899..68d8af7df08e 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1063,7 +1063,7 @@ static int ioc3_open(struct net_device *dev)
1063{ 1063{
1064 struct ioc3_private *ip = netdev_priv(dev); 1064 struct ioc3_private *ip = netdev_priv(dev);
1065 1065
1066 if (request_irq(dev->irq, ioc3_interrupt, SA_SHIRQ, ioc3_str, dev)) { 1066 if (request_irq(dev->irq, ioc3_interrupt, IRQF_SHARED, ioc3_str, dev)) {
1067 printk(KERN_ERR "%s: Can't get irq %d\n", dev->name, dev->irq); 1067 printk(KERN_ERR "%s: Can't get irq %d\n", dev->name, dev->irq);
1068 1068
1069 return -EAGAIN; 1069 return -EAGAIN;
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 910c0cab35b0..33c07d5275da 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1372,7 +1372,7 @@ toshoboe_net_open (struct net_device *dev)
1372 return 0; 1372 return 0;
1373 1373
1374 if (request_irq (self->io.irq, toshoboe_interrupt, 1374 if (request_irq (self->io.irq, toshoboe_interrupt,
1375 SA_SHIRQ | SA_INTERRUPT, dev->name, (void *) self)) 1375 IRQF_SHARED | IRQF_DISABLED, dev->name, (void *) self))
1376 { 1376 {
1377 return -EAGAIN; 1377 return -EAGAIN;
1378 } 1378 }
@@ -1573,7 +1573,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
1573 self->io.fir_base = self->base; 1573 self->io.fir_base = self->base;
1574 self->io.fir_ext = OBOE_IO_EXTENT; 1574 self->io.fir_ext = OBOE_IO_EXTENT;
1575 self->io.irq = pci_dev->irq; 1575 self->io.irq = pci_dev->irq;
1576 self->io.irqflags = SA_SHIRQ | SA_INTERRUPT; 1576 self->io.irqflags = IRQF_SHARED | IRQF_DISABLED;
1577 1577
1578 self->speed = self->io.speed = 9600; 1578 self->speed = self->io.speed = 9600;
1579 self->async = 0; 1579 self->async = 0;
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index b9f28b14b3ae..92d646cc9edc 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1517,7 +1517,7 @@ static int vlsi_open(struct net_device *ndev)
1517 1517
1518 outb(IRINTR_INT_MASK, ndev->base_addr+VLSI_PIO_IRINTR); 1518 outb(IRINTR_INT_MASK, ndev->base_addr+VLSI_PIO_IRINTR);
1519 1519
1520 if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ, 1520 if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED,
1521 drivername, ndev)) { 1521 drivername, ndev)) {
1522 IRDA_WARNING("%s: couldn't get IRQ: %d\n", 1522 IRDA_WARNING("%s: couldn't get IRQ: %d\n",
1523 __FUNCTION__, ndev->irq); 1523 __FUNCTION__, ndev->irq);
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 8bb32f946993..b91e082483f6 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -253,7 +253,7 @@ ixgb_up(struct ixgb_adapter *adapter)
253 253
254#endif 254#endif
255 if((err = request_irq(adapter->pdev->irq, &ixgb_intr, 255 if((err = request_irq(adapter->pdev->irq, &ixgb_intr,
256 SA_SHIRQ | SA_SAMPLE_RANDOM, 256 IRQF_SHARED | IRQF_SAMPLE_RANDOM,
257 netdev->name, netdev))) { 257 netdev->name, netdev))) {
258 DPRINTK(PROBE, ERR, 258 DPRINTK(PROBE, ERR,
259 "Unable to allocate interrupt Error: %d\n", err); 259 "Unable to allocate interrupt Error: %d\n", err);
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 99229a0456d9..6eeb965b4d72 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -235,7 +235,7 @@ static int ixpdev_open(struct net_device *dev)
235 235
236 if (!nds_open++) { 236 if (!nds_open++) {
237 err = request_irq(IRQ_IXP2000_THDA0, ixpdev_interrupt, 237 err = request_irq(IRQ_IXP2000_THDA0, ixpdev_interrupt,
238 SA_SHIRQ, "ixp2000_eth", nds); 238 IRQF_SHARED, "ixp2000_eth", nds);
239 if (err) { 239 if (err) {
240 nds_open--; 240 nds_open--;
241 return err; 241 return err;
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index 272d331d29cd..661d75b4cad2 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -260,7 +260,7 @@ MODULE_DESCRIPTION("Jazz SONIC ethernet driver");
260module_param(sonic_debug, int, 0); 260module_param(sonic_debug, int, 0);
261MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); 261MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
262 262
263#define SONIC_IRQ_FLAG SA_INTERRUPT 263#define SONIC_IRQ_FLAG IRQF_DISABLED
264 264
265#include "sonic.c" 265#include "sonic.c"
266 266
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index bf3f343ae715..b783a6984abc 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -851,7 +851,7 @@ static int i596_open(struct net_device *dev)
851{ 851{
852 int i; 852 int i;
853 853
854 i = request_irq(dev->irq, &i596_interrupt, SA_SHIRQ, dev->name, dev); 854 i = request_irq(dev->irq, &i596_interrupt, IRQF_SHARED, dev->name, dev);
855 if (i) { 855 if (i) {
856 printk(KERN_ERR "%s: IRQ %d not free\n", dev->name, dev->irq); 856 printk(KERN_ERR "%s: IRQ %d not free\n", dev->name, dev->irq);
857 return i; 857 return i;
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index bbffb585b3b3..07e58f4a2916 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -179,7 +179,7 @@ static int mipsnet_open(struct net_device *dev)
179 pr_debug("%s: mipsnet_open\n", dev->name); 179 pr_debug("%s: mipsnet_open\n", dev->name);
180 180
181 err = request_irq(dev->irq, &mipsnet_interrupt, 181 err = request_irq(dev->irq, &mipsnet_interrupt,
182 SA_SHIRQ, dev->name, (void *) dev); 182 IRQF_SHARED, dev->name, (void *) dev);
183 183
184 if (err) { 184 if (err) {
185 pr_debug("%s: %s(): can't get irq %d\n", 185 pr_debug("%s: %s(): can't get irq %d\n",
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 625ff61c9988..760c61b98867 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -778,7 +778,7 @@ static int mv643xx_eth_open(struct net_device *dev)
778 int err; 778 int err;
779 779
780 err = request_irq(dev->irq, mv643xx_eth_int_handler, 780 err = request_irq(dev->irq, mv643xx_eth_int_handler,
781 SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); 781 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
782 if (err) { 782 if (err) {
783 printk(KERN_ERR "Can not assign IRQ number to MV643XX_eth%d\n", 783 printk(KERN_ERR "Can not assign IRQ number to MV643XX_eth%d\n",
784 port_num); 784 port_num);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index dbdf189436fa..72aad42db7b4 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -2413,7 +2413,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
2413 pci_enable_device(pdev); 2413 pci_enable_device(pdev);
2414 pci_set_master(pdev); 2414 pci_set_master(pdev);
2415 2415
2416 status = request_irq(pdev->irq, myri10ge_intr, SA_SHIRQ, 2416 status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED,
2417 netdev->name, mgp); 2417 netdev->name, mgp);
2418 if (status != 0) { 2418 if (status != 0) {
2419 dev_err(&pdev->dev, "failed to allocate IRQ\n"); 2419 dev_err(&pdev->dev, "failed to allocate IRQ\n");
@@ -2694,7 +2694,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2694 mgp->msi_enabled = 1; 2694 mgp->msi_enabled = 1;
2695 } 2695 }
2696 2696
2697 status = request_irq(pdev->irq, myri10ge_intr, SA_SHIRQ, 2697 status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED,
2698 netdev->name, mgp); 2698 netdev->name, mgp);
2699 if (status != 0) { 2699 if (status != 0) {
2700 dev_err(&pdev->dev, "failed to allocate IRQ\n"); 2700 dev_err(&pdev->dev, "failed to allocate IRQ\n");
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 19981065efb4..1b965a2b56e4 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -1069,7 +1069,7 @@ static int __init myri_ether_init(struct sbus_dev *sdev)
1069 /* Register interrupt handler now. */ 1069 /* Register interrupt handler now. */
1070 DET(("Requesting MYRIcom IRQ line.\n")); 1070 DET(("Requesting MYRIcom IRQ line.\n"));
1071 if (request_irq(dev->irq, &myri_interrupt, 1071 if (request_irq(dev->irq, &myri_interrupt,
1072 SA_SHIRQ, "MyriCOM Ethernet", (void *) dev)) { 1072 IRQF_SHARED, "MyriCOM Ethernet", (void *) dev)) {
1073 printk("MyriCOM: Cannot register interrupt handler.\n"); 1073 printk("MyriCOM: Cannot register interrupt handler.\n");
1074 goto err; 1074 goto err;
1075 } 1075 }
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 438c63f940b9..9df2628be1e7 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1574,7 +1574,7 @@ static int netdev_open(struct net_device *dev)
1574 /* Reset the chip, just in case. */ 1574 /* Reset the chip, just in case. */
1575 natsemi_reset(dev); 1575 natsemi_reset(dev);
1576 1576
1577 i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); 1577 i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
1578 if (i) return i; 1578 if (i) return i;
1579 1579
1580 if (netif_msg_ifup(np)) 1580 if (netif_msg_ifup(np))
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index ced9fdb8335c..fa50eb889408 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -420,7 +420,7 @@ static int ne2k_pci_set_fdx(struct net_device *dev)
420 420
421static int ne2k_pci_open(struct net_device *dev) 421static int ne2k_pci_open(struct net_device *dev)
422{ 422{
423 int ret = request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev); 423 int ret = request_irq(dev->irq, ei_interrupt, IRQF_SHARED, dev->name, dev);
424 if (ret) 424 if (ret)
425 return ret; 425 return ret;
426 426
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index b92430c4e3ac..b1311ae82675 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -223,7 +223,7 @@ static int netx_eth_open(struct net_device *ndev)
223 struct netx_eth_priv *priv = netdev_priv(ndev); 223 struct netx_eth_priv *priv = netdev_priv(ndev);
224 224
225 if (request_irq 225 if (request_irq
226 (ndev->irq, &netx_eth_interrupt, SA_SHIRQ, ndev->name, ndev)) 226 (ndev->irq, &netx_eth_interrupt, IRQF_SHARED, ndev->name, ndev))
227 return -EAGAIN; 227 return -EAGAIN;
228 228
229 writel(ndev->dev_addr[0] | 229 writel(ndev->dev_addr[0] |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index deedd7b2af5d..70429108c40d 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1881,7 +1881,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
1881 1881
1882 dev->IMR_cache = 0; 1882 dev->IMR_cache = 0;
1883 1883
1884 err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, 1884 err = request_irq(pci_dev->irq, ns83820_irq, IRQF_SHARED,
1885 DRV_NAME, ndev); 1885 DRV_NAME, ndev);
1886 if (err) { 1886 if (err) {
1887 printk(KERN_INFO "ns83820: unable to register irq %d\n", 1887 printk(KERN_INFO "ns83820: unable to register irq %d\n",
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index 978b95afc721..3388ee1313ea 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -1075,7 +1075,7 @@ static int netdrv_open (struct net_device *dev)
1075 1075
1076 DPRINTK ("ENTER\n"); 1076 DPRINTK ("ENTER\n");
1077 1077
1078 retval = request_irq (dev->irq, netdrv_interrupt, SA_SHIRQ, dev->name, dev); 1078 retval = request_irq (dev->irq, netdrv_interrupt, IRQF_SHARED, dev->name, dev);
1079 if (retval) { 1079 if (retval) {
1080 DPRINTK ("EXIT, returning %d\n", retval); 1080 DPRINTK ("EXIT, returning %d\n", retval);
1081 return retval; 1081 return retval;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 2ea66aca648b..297e9f805366 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -535,7 +535,7 @@ static int axnet_open(struct net_device *dev)
535 535
536 link->open++; 536 link->open++;
537 537
538 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev); 538 request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
539 539
540 info->link_status = 0x00; 540 info->link_status = 0x00;
541 init_timer(&info->watchdog); 541 init_timer(&info->watchdog);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 661bfe54ff5d..0ecebfc31f07 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -998,7 +998,7 @@ static int pcnet_open(struct net_device *dev)
998 link->open++; 998 link->open++;
999 999
1000 set_misc_reg(dev); 1000 set_misc_reg(dev);
1001 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); 1001 request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
1002 1002
1003 info->phy_id = info->eth_phy; 1003 info->phy_id = info->eth_phy;
1004 info->link_status = 0x00; 1004 info->link_status = 0x00;
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 0e01c75da429..d768f3d1ac28 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1541,7 +1541,7 @@ static int pcnet32_open(struct net_device *dev)
1541 unsigned long flags; 1541 unsigned long flags;
1542 1542
1543 if (request_irq(dev->irq, &pcnet32_interrupt, 1543 if (request_irq(dev->irq, &pcnet32_interrupt,
1544 lp->shared_irq ? SA_SHIRQ : 0, dev->name, 1544 lp->shared_irq ? IRQF_SHARED : 0, dev->name,
1545 (void *)dev)) { 1545 (void *)dev)) {
1546 return -EAGAIN; 1546 return -EAGAIN;
1547 } 1547 }
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 44bcd3eb2b83..7d5c2233c252 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -556,7 +556,7 @@ int phy_start_interrupts(struct phy_device *phydev)
556 INIT_WORK(&phydev->phy_queue, phy_change, phydev); 556 INIT_WORK(&phydev->phy_queue, phy_change, phydev);
557 557
558 if (request_irq(phydev->irq, phy_interrupt, 558 if (request_irq(phydev->irq, phy_interrupt,
559 SA_SHIRQ, 559 IRQF_SHARED,
560 "phy_interrupt", 560 "phy_interrupt",
561 phydev) < 0) { 561 phydev) < 0) {
562 printk(KERN_WARNING "%s: Can't get IRQ %d (PHY)\n", 562 printk(KERN_WARNING "%s: Can't get IRQ %d (PHY)\n",
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 12d1cb289bb0..16a0ef1b1369 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1726,7 +1726,7 @@ static int rtl8169_open(struct net_device *dev)
1726 rtl8169_set_rxbufsize(tp, dev); 1726 rtl8169_set_rxbufsize(tp, dev);
1727 1727
1728 retval = 1728 retval =
1729 request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev); 1729 request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev);
1730 if (retval < 0) 1730 if (retval < 0)
1731 goto out; 1731 goto out;
1732 1732
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 757c542ac40a..c3ed734cbe39 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1252,7 +1252,7 @@ static int rr_open(struct net_device *dev)
1252 readl(&regs->HostCtrl); 1252 readl(&regs->HostCtrl);
1253 spin_unlock_irqrestore(&rrpriv->lock, flags); 1253 spin_unlock_irqrestore(&rrpriv->lock, flags);
1254 1254
1255 if (request_irq(dev->irq, rr_interrupt, SA_SHIRQ, dev->name, dev)) { 1255 if (request_irq(dev->irq, rr_interrupt, IRQF_SHARED, dev->name, dev)) {
1256 printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", 1256 printk(KERN_WARNING "%s: Requested IRQ %d is busy\n",
1257 dev->name, dev->irq); 1257 dev->name, dev->irq);
1258 ecode = -EAGAIN; 1258 ecode = -EAGAIN;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 001344c0763e..c6b77acb35ef 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3761,7 +3761,7 @@ static int s2io_open(struct net_device *dev)
3761 /* After proper initialization of H/W, register ISR */ 3761 /* After proper initialization of H/W, register ISR */
3762 if (sp->intr_type == MSI) { 3762 if (sp->intr_type == MSI) {
3763 err = request_irq((int) sp->pdev->irq, s2io_msi_handle, 3763 err = request_irq((int) sp->pdev->irq, s2io_msi_handle,
3764 SA_SHIRQ, sp->name, dev); 3764 IRQF_SHARED, sp->name, dev);
3765 if (err) { 3765 if (err) {
3766 DBG_PRINT(ERR_DBG, "%s: MSI registration \ 3766 DBG_PRINT(ERR_DBG, "%s: MSI registration \
3767failed\n", dev->name); 3767failed\n", dev->name);
@@ -3799,7 +3799,7 @@ failed\n", dev->name, i);
3799 } 3799 }
3800 } 3800 }
3801 if (sp->intr_type == INTA) { 3801 if (sp->intr_type == INTA) {
3802 err = request_irq((int) sp->pdev->irq, s2io_isr, SA_SHIRQ, 3802 err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED,
3803 sp->name, dev); 3803 sp->name, dev);
3804 if (err) { 3804 if (err) {
3805 DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", 3805 DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n",
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index c7b5f0004e54..9ab1618e82a4 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2450,7 +2450,7 @@ static int sbmac_open(struct net_device *dev)
2450 */ 2450 */
2451 2451
2452 __raw_readq(sc->sbm_isr); 2452 __raw_readq(sc->sbm_isr);
2453 if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev)) 2453 if (request_irq(dev->irq, &sbmac_intr, IRQF_SHARED, dev->name, dev))
2454 return -EBUSY; 2454 return -EBUSY;
2455 2455
2456 /* 2456 /*
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index df39f3447655..df0cbebb3277 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1054,7 +1054,7 @@ static int sis190_open(struct net_device *dev)
1054 1054
1055 sis190_request_timer(dev); 1055 sis190_request_timer(dev);
1056 1056
1057 rc = request_irq(dev->irq, sis190_interrupt, SA_SHIRQ, dev->name, dev); 1057 rc = request_irq(dev->irq, sis190_interrupt, IRQF_SHARED, dev->name, dev);
1058 if (rc < 0) 1058 if (rc < 0)
1059 goto err_release_timer_2; 1059 goto err_release_timer_2;
1060 1060
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index d05874172209..29ee7ffedfff 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -1013,7 +1013,7 @@ sis900_open(struct net_device *net_dev)
1013 /* Equalizer workaround Rule */ 1013 /* Equalizer workaround Rule */
1014 sis630_set_eq(net_dev, sis_priv->chipset_rev); 1014 sis630_set_eq(net_dev, sis_priv->chipset_rev);
1015 1015
1016 ret = request_irq(net_dev->irq, &sis900_interrupt, SA_SHIRQ, 1016 ret = request_irq(net_dev->irq, &sis900_interrupt, IRQF_SHARED,
1017 net_dev->name, net_dev); 1017 net_dev->name, net_dev);
1018 if (ret) 1018 if (ret)
1019 return ret; 1019 return ret;
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index f3efbd177ae7..ee62845d3ac9 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -570,9 +570,9 @@ SK_BOOL DualNet;
570 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 570 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
571 571
572 if (pAC->GIni.GIMacsFound == 2) { 572 if (pAC->GIni.GIMacsFound == 2) {
573 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); 573 Ret = request_irq(dev->irq, SkGeIsr, IRQF_SHARED, "sk98lin", dev);
574 } else if (pAC->GIni.GIMacsFound == 1) { 574 } else if (pAC->GIni.GIMacsFound == 1) {
575 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, 575 Ret = request_irq(dev->irq, SkGeIsrOnePort, IRQF_SHARED,
576 "sk98lin", dev); 576 "sk98lin", dev);
577 } else { 577 } else {
578 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", 578 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
@@ -5073,9 +5073,9 @@ static int skge_resume(struct pci_dev *pdev)
5073 pci_enable_device(pdev); 5073 pci_enable_device(pdev);
5074 pci_set_master(pdev); 5074 pci_set_master(pdev);
5075 if (pAC->GIni.GIMacsFound == 2) 5075 if (pAC->GIni.GIMacsFound == 2)
5076 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); 5076 ret = request_irq(dev->irq, SkGeIsr, IRQF_SHARED, "sk98lin", dev);
5077 else 5077 else
5078 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev); 5078 ret = request_irq(dev->irq, SkGeIsrOnePort, IRQF_SHARED, "sk98lin", dev);
5079 if (ret) { 5079 if (ret) {
5080 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); 5080 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5081 pAC->AllocFlag &= ~SK_ALLOC_IRQ; 5081 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c
index e5d6d95960c7..799e09801934 100644
--- a/drivers/net/sk_mca.c
+++ b/drivers/net/sk_mca.c
@@ -824,7 +824,7 @@ static int skmca_open(struct net_device *dev)
824 /* register resources - only necessary for IRQ */ 824 /* register resources - only necessary for IRQ */
825 result = 825 result =
826 request_irq(priv->realirq, irq_handler, 826 request_irq(priv->realirq, irq_handler,
827 SA_SHIRQ | SA_SAMPLE_RANDOM, "sk_mca", dev); 827 IRQF_SHARED | IRQF_SAMPLE_RANDOM, "sk_mca", dev);
828 if (result != 0) { 828 if (result != 0) {
829 printk("%s: failed to register irq %d\n", dev->name, 829 printk("%s: failed to register irq %d\n", dev->name,
830 dev->irq); 830 dev->irq);
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index c7fb6133047e..b5714a60237d 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -497,7 +497,7 @@ static int skfp_open(struct net_device *dev)
497 497
498 PRINTK(KERN_INFO "entering skfp_open\n"); 498 PRINTK(KERN_INFO "entering skfp_open\n");
499 /* Register IRQ - support shared interrupts by passing device ptr */ 499 /* Register IRQ - support shared interrupts by passing device ptr */
500 err = request_irq(dev->irq, (void *) skfp_interrupt, SA_SHIRQ, 500 err = request_irq(dev->irq, (void *) skfp_interrupt, IRQF_SHARED,
501 dev->name, dev); 501 dev->name, dev);
502 if (err) 502 if (err)
503 return err; 503 return err;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 82df13be3d40..82200bfaa8ed 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -3341,7 +3341,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3341 goto err_out_free_hw; 3341 goto err_out_free_hw;
3342 } 3342 }
3343 3343
3344 err = request_irq(pdev->irq, skge_intr, SA_SHIRQ, DRV_NAME, hw); 3344 err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, DRV_NAME, hw);
3345 if (err) { 3345 if (err) {
3346 printk(KERN_ERR PFX "%s: cannot assign irq %d\n", 3346 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3347 pci_name(pdev), pdev->irq); 3347 pci_name(pdev), pdev->irq);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 3f1b0fef13e7..418f169a6a31 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3188,7 +3188,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
3188 3188
3189 sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); 3189 sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
3190 3190
3191 err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw); 3191 err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw);
3192 if (err) { 3192 if (err) {
3193 printk(KERN_ERR PFX "%s: cannot assign irq %d\n", 3193 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3194 pci_name(pdev), pdev->irq); 3194 pci_name(pdev), pdev->irq);
@@ -3348,7 +3348,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3348 goto err_out_unregister; 3348 goto err_out_unregister;
3349 } 3349 }
3350 3350
3351 err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw); 3351 err = request_irq(pdev->irq, sky2_intr, IRQF_SHARED, DRV_NAME, hw);
3352 if (err) { 3352 if (err) {
3353 printk(KERN_ERR PFX "%s: cannot assign irq %d\n", 3353 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
3354 pci_name(pdev), pdev->irq); 3354 pci_name(pdev), pdev->irq);
diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c
index ff9bd97746dc..85be22a05973 100644
--- a/drivers/net/smc-ultra32.c
+++ b/drivers/net/smc-ultra32.c
@@ -290,7 +290,7 @@ out:
290static int ultra32_open(struct net_device *dev) 290static int ultra32_open(struct net_device *dev)
291{ 291{
292 int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC addr */ 292 int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC addr */
293 int irq_flags = (inb(ioaddr + ULTRA32_CFG5) & 0x08) ? 0 : SA_SHIRQ; 293 int irq_flags = (inb(ioaddr + ULTRA32_CFG5) & 0x08) ? 0 : IRQF_SHARED;
294 int retval; 294 int retval;
295 295
296 retval = request_irq(dev->irq, ei_interrupt, irq_flags, dev->name, dev); 296 retval = request_irq(dev->irq, ei_interrupt, irq_flags, dev->name, dev);
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index bdd8702ead54..d37bd860b336 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -2081,7 +2081,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr)
2081 lp->ctl_rspeed = 100; 2081 lp->ctl_rspeed = 100;
2082 2082
2083 /* Grab the IRQ */ 2083 /* Grab the IRQ */
2084 retval = request_irq(dev->irq, &smc911x_interrupt, SA_SHIRQ, dev->name, dev); 2084 retval = request_irq(dev->irq, &smc911x_interrupt, IRQF_SHARED, dev->name, dev);
2085 if (retval) 2085 if (retval)
2086 goto err_out; 2086 goto err_out;
2087 2087
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index bf776125ca38..b4028049ed76 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -207,7 +207,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
207 machine_is_omap_h2() \ 207 machine_is_omap_h2() \
208 || machine_is_omap_h3() \ 208 || machine_is_omap_h3() \
209 || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ 209 || (machine_is_omap_innovator() && !cpu_is_omap1510()) \
210 ) ? SA_TRIGGER_FALLING : SA_TRIGGER_RISING) 210 ) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING)
211 211
212 212
213#elif defined(CONFIG_SH_SH4202_MICRODEV) 213#elif defined(CONFIG_SH_SH4202_MICRODEV)
@@ -540,7 +540,7 @@ smc_pxa_dma_irq(int dma, void *dummy, struct pt_regs *regs)
540#endif 540#endif
541 541
542#ifndef SMC_IRQ_FLAGS 542#ifndef SMC_IRQ_FLAGS
543#define SMC_IRQ_FLAGS SA_TRIGGER_RISING 543#define SMC_IRQ_FLAGS IRQF_TRIGGER_RISING
544#endif 544#endif
545 545
546#ifndef SMC_INTERRUPT_PREAMBLE 546#ifndef SMC_INTERRUPT_PREAMBLE
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index e0b72676922c..fb1d5a8a45cf 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1744,7 +1744,7 @@ spider_net_open(struct net_device *netdev)
1744 1744
1745 result = -EBUSY; 1745 result = -EBUSY;
1746 if (request_irq(netdev->irq, spider_net_interrupt, 1746 if (request_irq(netdev->irq, spider_net_interrupt,
1747 SA_SHIRQ, netdev->name, netdev)) 1747 IRQF_SHARED, netdev->name, netdev))
1748 goto register_int_failed; 1748 goto register_int_failed;
1749 1749
1750 spider_net_enable_card(card); 1750 spider_net_enable_card(card);
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index f91be95356a4..ed1f59901ff4 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1070,7 +1070,7 @@ static int netdev_open(struct net_device *dev)
1070 1070
1071 /* Do we ever need to reset the chip??? */ 1071 /* Do we ever need to reset the chip??? */
1072 1072
1073 retval = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); 1073 retval = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
1074 if (retval) 1074 if (retval)
1075 return retval; 1075 return retval;
1076 1076
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index a2fad50437e6..2dcadb169a22 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -341,7 +341,7 @@ static int __init lance_probe( struct net_device *dev)
341 341
342 REGA(CSR0) = CSR0_STOP; 342 REGA(CSR0) = CSR0_STOP;
343 343
344 request_irq(LANCE_IRQ, lance_interrupt, SA_INTERRUPT, "SUN3 Lance", dev); 344 request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev);
345 dev->irq = (unsigned short)LANCE_IRQ; 345 dev->irq = (unsigned short)LANCE_IRQ;
346 346
347 347
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 7127f0f36f0e..d46891510767 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -918,7 +918,7 @@ static int bigmac_open(struct net_device *dev)
918 struct bigmac *bp = (struct bigmac *) dev->priv; 918 struct bigmac *bp = (struct bigmac *) dev->priv;
919 int ret; 919 int ret;
920 920
921 ret = request_irq(dev->irq, &bigmac_interrupt, SA_SHIRQ, dev->name, bp); 921 ret = request_irq(dev->irq, &bigmac_interrupt, IRQF_SHARED, dev->name, bp);
922 if (ret) { 922 if (ret) {
923 printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq); 923 printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq);
924 return ret; 924 return ret;
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index f13b2a195c70..643fceae3db5 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -870,7 +870,7 @@ static int netdev_open(struct net_device *dev)
870 870
871 /* Do we need to reset the chip??? */ 871 /* Do we need to reset the chip??? */
872 872
873 i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); 873 i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
874 if (i) 874 if (i)
875 return i; 875 return i;
876 876
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 5248670d29f7..b70bbd748978 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2220,7 +2220,7 @@ static int gem_do_start(struct net_device *dev)
2220 spin_unlock_irqrestore(&gp->lock, flags); 2220 spin_unlock_irqrestore(&gp->lock, flags);
2221 2221
2222 if (request_irq(gp->pdev->irq, gem_interrupt, 2222 if (request_irq(gp->pdev->irq, gem_interrupt,
2223 SA_SHIRQ, dev->name, (void *)dev)) { 2223 IRQF_SHARED, dev->name, (void *)dev)) {
2224 printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); 2224 printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name);
2225 2225
2226 spin_lock_irqsave(&gp->lock, flags); 2226 spin_lock_irqsave(&gp->lock, flags);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index d85b83204f6b..8673fd4c08c7 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2194,7 +2194,7 @@ static int happy_meal_open(struct net_device *dev)
2194 */ 2194 */
2195 if ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO) { 2195 if ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO) {
2196 if (request_irq(dev->irq, &happy_meal_interrupt, 2196 if (request_irq(dev->irq, &happy_meal_interrupt,
2197 SA_SHIRQ, dev->name, (void *)dev)) { 2197 IRQF_SHARED, dev->name, (void *)dev)) {
2198 HMD(("EAGAIN\n")); 2198 HMD(("EAGAIN\n"));
2199 printk(KERN_ERR "happy_meal(SBUS): Can't order irq %d to go.\n", 2199 printk(KERN_ERR "happy_meal(SBUS): Can't order irq %d to go.\n",
2200 dev->irq); 2200 dev->irq);
@@ -2608,7 +2608,7 @@ static void __init quattro_sbus_register_irqs(void)
2608 2608
2609 err = request_irq(sdev->irqs[0], 2609 err = request_irq(sdev->irqs[0],
2610 quattro_sbus_interrupt, 2610 quattro_sbus_interrupt,
2611 SA_SHIRQ, "Quattro", 2611 IRQF_SHARED, "Quattro",
2612 qp); 2612 qp);
2613 if (err != 0) { 2613 if (err != 0) {
2614 printk(KERN_ERR "Quattro: Fatal IRQ registery error %d.\n", err); 2614 printk(KERN_ERR "Quattro: Fatal IRQ registery error %d.\n", err);
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 5b0b60f4d20e..1ef9fd39a79a 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -930,7 +930,7 @@ static int lance_open(struct net_device *dev)
930 930
931 STOP_LANCE(lp); 931 STOP_LANCE(lp);
932 932
933 if (request_irq(dev->irq, &lance_interrupt, SA_SHIRQ, 933 if (request_irq(dev->irq, &lance_interrupt, IRQF_SHARED,
934 lancestr, (void *) dev)) { 934 lancestr, (void *) dev)) {
935 printk(KERN_ERR "Lance: Can't get irq %d\n", dev->irq); 935 printk(KERN_ERR "Lance: Can't get irq %d\n", dev->irq);
936 return -EAGAIN; 936 return -EAGAIN;
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 9da6d5b87173..817a40b66638 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -811,7 +811,7 @@ static struct sunqec * __init get_qec(struct sbus_dev *child_sdev)
811 qec_init_once(qecp, qec_sdev); 811 qec_init_once(qecp, qec_sdev);
812 812
813 if (request_irq(qec_sdev->irqs[0], &qec_interrupt, 813 if (request_irq(qec_sdev->irqs[0], &qec_interrupt,
814 SA_SHIRQ, "qec", (void *) qecp)) { 814 IRQF_SHARED, "qec", (void *) qecp)) {
815 printk(KERN_ERR "qec: Can't register irq.\n"); 815 printk(KERN_ERR "qec: Can't register irq.\n");
816 goto fail; 816 goto fail;
817 } 817 }
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index c2ec9fd8c31d..8b53ded66d37 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -880,7 +880,7 @@ tc35815_open(struct net_device *dev)
880 */ 880 */
881 881
882 if (dev->irq == 0 || 882 if (dev->irq == 0 ||
883 request_irq(dev->irq, &tc35815_interrupt, SA_SHIRQ, cardname, dev)) { 883 request_irq(dev->irq, &tc35815_interrupt, IRQF_SHARED, cardname, dev)) {
884 return -EAGAIN; 884 return -EAGAIN;
885 } 885 }
886 886
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 953255e92633..e5e1b2962936 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6702,12 +6702,12 @@ static int tg3_request_irq(struct tg3 *tp)
6702 fn = tg3_msi; 6702 fn = tg3_msi;
6703 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) 6703 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)
6704 fn = tg3_msi_1shot; 6704 fn = tg3_msi_1shot;
6705 flags = SA_SAMPLE_RANDOM; 6705 flags = IRQF_SAMPLE_RANDOM;
6706 } else { 6706 } else {
6707 fn = tg3_interrupt; 6707 fn = tg3_interrupt;
6708 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) 6708 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
6709 fn = tg3_interrupt_tagged; 6709 fn = tg3_interrupt_tagged;
6710 flags = SA_SHIRQ | SA_SAMPLE_RANDOM; 6710 flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
6711 } 6711 }
6712 return (request_irq(tp->pdev->irq, fn, flags, dev->name, dev)); 6712 return (request_irq(tp->pdev->irq, fn, flags, dev->name, dev));
6713} 6713}
@@ -6726,7 +6726,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
6726 free_irq(tp->pdev->irq, dev); 6726 free_irq(tp->pdev->irq, dev);
6727 6727
6728 err = request_irq(tp->pdev->irq, tg3_test_isr, 6728 err = request_irq(tp->pdev->irq, tg3_test_isr,
6729 SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); 6729 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
6730 if (err) 6730 if (err)
6731 return err; 6731 return err;
6732 6732
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 12076f8f942c..23c0017f25a9 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -943,7 +943,7 @@ static int TLan_Open( struct net_device *dev )
943 int err; 943 int err;
944 944
945 priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION ); 945 priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION );
946 err = request_irq( dev->irq, TLan_HandleInterrupt, SA_SHIRQ, TLanSignature, dev ); 946 err = request_irq( dev->irq, TLan_HandleInterrupt, IRQF_SHARED, TLanSignature, dev );
947 947
948 if ( err ) { 948 if ( err ) {
949 printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq ); 949 printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq );
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 77bb298129d7..465921e3874c 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -576,7 +576,7 @@ static int xl_open(struct net_device *dev)
576 576
577 u16 switchsettings, switchsettings_eeprom ; 577 u16 switchsettings, switchsettings_eeprom ;
578 578
579 if(request_irq(dev->irq, &xl_interrupt, SA_SHIRQ , "3c359", dev)) { 579 if(request_irq(dev->irq, &xl_interrupt, IRQF_SHARED , "3c359", dev)) {
580 return -EAGAIN; 580 return -EAGAIN;
581 } 581 }
582 582
diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c
index 649d8ea354f5..1bdd3beefbe5 100644
--- a/drivers/net/tokenring/abyss.c
+++ b/drivers/net/tokenring/abyss.c
@@ -123,7 +123,7 @@ static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_
123 goto err_out_trdev; 123 goto err_out_trdev;
124 } 124 }
125 125
126 ret = request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ, 126 ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
127 dev->name, dev); 127 dev->name, dev);
128 if (ret) 128 if (ret)
129 goto err_out_region; 129 goto err_out_region;
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 30dcdaebf41a..28d968ffd5d0 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -601,7 +601,7 @@ static int streamer_open(struct net_device *dev)
601 rc=streamer_reset(dev); 601 rc=streamer_reset(dev);
602 } 602 }
603 603
604 if (request_irq(dev->irq, &streamer_interrupt, SA_SHIRQ, "lanstreamer", dev)) { 604 if (request_irq(dev->irq, &streamer_interrupt, IRQF_SHARED, "lanstreamer", dev)) {
605 return -EAGAIN; 605 return -EAGAIN;
606 } 606 }
607#if STREAMER_DEBUG 607#if STREAMER_DEBUG
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
index 19e6f4dfd69c..666bbaaae82f 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -311,7 +311,7 @@ static int __devinit madgemc_probe(struct device *device)
311 */ 311 */
312 outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */ 312 outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */
313 madgemc_setsifsel(dev, 1); 313 madgemc_setsifsel(dev, 1);
314 if (request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ, 314 if (request_irq(dev->irq, madgemc_interrupt, IRQF_SHARED,
315 "madgemc", dev)) { 315 "madgemc", dev)) {
316 ret = -EBUSY; 316 ret = -EBUSY;
317 goto getout3; 317 goto getout3;
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index d7a30d99ae8f..85831484bc40 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -445,7 +445,7 @@ static int olympic_open(struct net_device *dev)
445 445
446 olympic_init(dev); 446 olympic_init(dev);
447 447
448 if(request_irq(dev->irq, &olympic_interrupt, SA_SHIRQ , "olympic", dev)) { 448 if(request_irq(dev->irq, &olympic_interrupt, IRQF_SHARED , "olympic", dev)) {
449 return -EAGAIN; 449 return -EAGAIN;
450 } 450 }
451 451
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index f2807ab5a2be..cd2e0251e2bc 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -531,7 +531,7 @@ static int __init smctr_chk_mca(struct net_device *dev)
531 dev->irq = 15; 531 dev->irq = 15;
532 break; 532 break;
533 } 533 }
534 if (request_irq(dev->irq, smctr_interrupt, SA_SHIRQ, smctr_name, dev)) { 534 if (request_irq(dev->irq, smctr_interrupt, IRQF_SHARED, smctr_name, dev)) {
535 release_region(dev->base_addr, SMCTR_IO_EXTENT); 535 release_region(dev->base_addr, SMCTR_IO_EXTENT);
536 return -ENODEV; 536 return -ENODEV;
537 } 537 }
@@ -1061,7 +1061,7 @@ static int __init smctr_chk_isa(struct net_device *dev)
1061 goto out2; 1061 goto out2;
1062 } 1062 }
1063 1063
1064 if (request_irq(dev->irq, smctr_interrupt, SA_SHIRQ, smctr_name, dev)) 1064 if (request_irq(dev->irq, smctr_interrupt, IRQF_SHARED, smctr_name, dev))
1065 goto out2; 1065 goto out2;
1066 1066
1067 /* Get 58x Rom Base */ 1067 /* Get 58x Rom Base */
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c
index ab47c0547a3b..7d3e270c4f45 100644
--- a/drivers/net/tokenring/tmspci.c
+++ b/drivers/net/tokenring/tmspci.c
@@ -122,7 +122,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
122 goto err_out_trdev; 122 goto err_out_trdev;
123 } 123 }
124 124
125 ret = request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ, 125 ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
126 dev->name, dev); 126 dev->name, dev);
127 if (ret) 127 if (ret)
128 goto err_out_region; 128 goto err_out_region;
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 354294c6271e..d05c5aa254ee 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -1371,7 +1371,7 @@ static int de_open (struct net_device *dev)
1371 1371
1372 dw32(IntrMask, 0); 1372 dw32(IntrMask, 0);
1373 1373
1374 rc = request_irq(dev->irq, de_interrupt, SA_SHIRQ, dev->name, dev); 1374 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev);
1375 if (rc) { 1375 if (rc) {
1376 printk(KERN_ERR "%s: IRQ %d request failure, err=%d\n", 1376 printk(KERN_ERR "%s: IRQ %d request failure, err=%d\n",
1377 dev->name, dev->irq, rc); 1377 dev->name, dev->irq, rc);
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 2647a5bc5211..75ff14a55239 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -292,7 +292,7 @@
292 0.41 21-Mar-96 Don't check for get_hw_addr checksum unless DEC card 292 0.41 21-Mar-96 Don't check for get_hw_addr checksum unless DEC card
293 only <niles@axp745gsfc.nasa.gov> 293 only <niles@axp745gsfc.nasa.gov>
294 Fix for multiple PCI cards reported by <jos@xos.nl> 294 Fix for multiple PCI cards reported by <jos@xos.nl>
295 Duh, put the SA_SHIRQ flag into request_interrupt(). 295 Duh, put the IRQF_SHARED flag into request_interrupt().
296 Fix SMC ethernet address in enet_det[]. 296 Fix SMC ethernet address in enet_det[].
297 Print chip name instead of "UNKNOWN" during boot. 297 Print chip name instead of "UNKNOWN" during boot.
298 0.42 26-Apr-96 Fix MII write TA bit error. 298 0.42 26-Apr-96 Fix MII write TA bit error.
@@ -353,7 +353,7 @@
353 infoblocks. 353 infoblocks.
354 Added DC21142 and DC21143 functions. 354 Added DC21142 and DC21143 functions.
355 Added byte counters from <phil@tazenda.demon.co.uk> 355 Added byte counters from <phil@tazenda.demon.co.uk>
356 Added SA_INTERRUPT temporary fix from 356 Added IRQF_DISABLED temporary fix from
357 <mjacob@feral.com>. 357 <mjacob@feral.com>.
358 0.53 12-Nov-97 Fix the *_probe() to include 'eth??' name during 358 0.53 12-Nov-97 Fix the *_probe() to include 'eth??' name during
359 module load: bug reported by 359 module load: bug reported by
@@ -1319,10 +1319,10 @@ de4x5_open(struct net_device *dev)
1319 lp->state = OPEN; 1319 lp->state = OPEN;
1320 de4x5_dbg_open(dev); 1320 de4x5_dbg_open(dev);
1321 1321
1322 if (request_irq(dev->irq, (void *)de4x5_interrupt, SA_SHIRQ, 1322 if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED,
1323 lp->adapter_name, dev)) { 1323 lp->adapter_name, dev)) {
1324 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1324 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1325 if (request_irq(dev->irq, de4x5_interrupt, SA_INTERRUPT | SA_SHIRQ, 1325 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
1326 lp->adapter_name, dev)) { 1326 lp->adapter_name, dev)) {
1327 printk("\n Cannot get IRQ- reconfigure your hardware.\n"); 1327 printk("\n Cannot get IRQ- reconfigure your hardware.\n");
1328 disable_ast(dev); 1328 disable_ast(dev);
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ba5b112093f4..4e5b0f2acc39 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -506,7 +506,7 @@ static int dmfe_open(struct DEVICE *dev)
506 506
507 DMFE_DBUG(0, "dmfe_open", 0); 507 DMFE_DBUG(0, "dmfe_open", 0);
508 508
509 ret = request_irq(dev->irq, &dmfe_interrupt, SA_SHIRQ, dev->name, dev); 509 ret = request_irq(dev->irq, &dmfe_interrupt, IRQF_SHARED, dev->name, dev);
510 if (ret) 510 if (ret)
511 return ret; 511 return ret;
512 512
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 8f4f4840fc12..7351831f57ce 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -489,7 +489,7 @@ tulip_open(struct net_device *dev)
489{ 489{
490 int retval; 490 int retval;
491 491
492 if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) 492 if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev)))
493 return retval; 493 return retval;
494 494
495 tulip_init_ring (dev); 495 tulip_init_ring (dev);
@@ -1770,7 +1770,7 @@ static int tulip_resume(struct pci_dev *pdev)
1770 1770
1771 pci_enable_device(pdev); 1771 pci_enable_device(pdev);
1772 1772
1773 if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) { 1773 if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
1774 printk (KERN_ERR "tulip: request_irq failed in resume\n"); 1774 printk (KERN_ERR "tulip: request_irq failed in resume\n");
1775 return retval; 1775 return retval;
1776 } 1776 }
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 8b3a28f53c3d..fd64b2b3e99c 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -436,7 +436,7 @@ static int uli526x_open(struct net_device *dev)
436 436
437 ULI526X_DBUG(0, "uli526x_open", 0); 437 ULI526X_DBUG(0, "uli526x_open", 0);
438 438
439 ret = request_irq(dev->irq, &uli526x_interrupt, SA_SHIRQ, dev->name, dev); 439 ret = request_irq(dev->irq, &uli526x_interrupt, IRQF_SHARED, dev->name, dev);
440 if (ret) 440 if (ret)
441 return ret; 441 return ret;
442 442
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 602a6e5002a0..b4c0d101a7d7 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -658,7 +658,7 @@ static int netdev_open(struct net_device *dev)
658 iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */ 658 iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */
659 659
660 netif_device_detach(dev); 660 netif_device_detach(dev);
661 i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); 661 i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
662 if (i) 662 if (i)
663 goto out_err; 663 goto out_err;
664 664
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 63c2175ed138..f874e4f6ccf6 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -457,7 +457,7 @@ static int xircom_open(struct net_device *dev)
457 int retval; 457 int retval;
458 enter("xircom_open"); 458 enter("xircom_open");
459 printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq); 459 printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq);
460 retval = request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev); 460 retval = request_irq(dev->irq, &xircom_interrupt, IRQF_SHARED, dev->name, dev);
461 if (retval) { 461 if (retval) {
462 leave("xircom_open - No IRQ"); 462 leave("xircom_open - No IRQ");
463 return retval; 463 return retval;
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index aecafdabbc91..091ebb7a62f6 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -807,7 +807,7 @@ xircom_open(struct net_device *dev)
807{ 807{
808 struct xircom_private *tp = netdev_priv(dev); 808 struct xircom_private *tp = netdev_priv(dev);
809 809
810 if (request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev)) 810 if (request_irq(dev->irq, &xircom_interrupt, IRQF_SHARED, dev->name, dev))
811 return -EAGAIN; 811 return -EAGAIN;
812 812
813 xircom_up(dev); 813 xircom_up(dev);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index e24d2dafcf6c..063816f2b11e 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -2131,7 +2131,7 @@ typhoon_open(struct net_device *dev)
2131 goto out_sleep; 2131 goto out_sleep;
2132 } 2132 }
2133 2133
2134 err = request_irq(dev->irq, &typhoon_interrupt, SA_SHIRQ, 2134 err = request_irq(dev->irq, &typhoon_interrupt, IRQF_SHARED,
2135 dev->name, dev); 2135 dev->name, dev);
2136 if(err < 0) 2136 if(err < 0)
2137 goto out_sleep; 2137 goto out_sleep;
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index c80a4f1d5f7a..98b6f3207d3d 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1210,7 +1210,7 @@ static int rhine_open(struct net_device *dev)
1210 void __iomem *ioaddr = rp->base; 1210 void __iomem *ioaddr = rp->base;
1211 int rc; 1211 int rc;
1212 1212
1213 rc = request_irq(rp->pdev->irq, &rhine_interrupt, SA_SHIRQ, dev->name, 1213 rc = request_irq(rp->pdev->irq, &rhine_interrupt, IRQF_SHARED, dev->name,
1214 dev); 1214 dev);
1215 if (rc) 1215 if (rc)
1216 return rc; 1216 return rc;
@@ -1999,7 +1999,7 @@ static int rhine_resume(struct pci_dev *pdev)
1999 if (!netif_running(dev)) 1999 if (!netif_running(dev))
2000 return 0; 2000 return 0;
2001 2001
2002 if (request_irq(dev->irq, rhine_interrupt, SA_SHIRQ, dev->name, dev)) 2002 if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev))
2003 printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name); 2003 printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name);
2004 2004
2005 ret = pci_set_power_state(pdev, PCI_D0); 2005 ret = pci_set_power_state(pdev, PCI_D0);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 857d71c3c017..ba2972ba3757 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1750,7 +1750,7 @@ static int velocity_open(struct net_device *dev)
1750 1750
1751 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 1751 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
1752 1752
1753 ret = request_irq(vptr->pdev->irq, &velocity_intr, SA_SHIRQ, 1753 ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED,
1754 dev->name, dev); 1754 dev->name, dev);
1755 if (ret < 0) { 1755 if (ret < 0) {
1756 /* Power down the chip */ 1756 /* Power down the chip */
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 04a376ec0ed8..684af4316ffd 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -752,7 +752,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
752 752
753 priv = pci_get_drvdata(pdev); 753 priv = pci_get_drvdata(pdev);
754 754
755 rc = request_irq(pdev->irq, dscc4_irq, SA_SHIRQ, DRV_NAME, priv->root); 755 rc = request_irq(pdev->irq, dscc4_irq, IRQF_SHARED, DRV_NAME, priv->root);
756 if (rc < 0) { 756 if (rc < 0) {
757 printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq); 757 printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq);
758 goto err_release_4; 758 goto err_release_4;
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 7981a2c7906e..3705db04a343 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2519,7 +2519,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2519 dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); 2519 dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem);
2520 2520
2521 /* Register the interrupt handler */ 2521 /* Register the interrupt handler */
2522 if (request_irq(pdev->irq, fst_intr, SA_SHIRQ, FST_DEV_NAME, card)) { 2522 if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) {
2523 printk_err("Unable to register interrupt %d\n", card->irq); 2523 printk_err("Unable to register interrupt %d\n", card->irq);
2524 pci_release_regions(pdev); 2524 pci_release_regions(pdev);
2525 pci_disable_device(pdev); 2525 pci_disable_device(pdev);
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index cf5c805452a3..a4f735723c41 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -264,7 +264,7 @@ static struct sv11_device *sv11_init(int iobase, int irq)
264 /* We want a fast IRQ for this device. Actually we'd like an even faster 264 /* We want a fast IRQ for this device. Actually we'd like an even faster
265 IRQ ;) - This is one driver RtLinux is made for */ 265 IRQ ;) - This is one driver RtLinux is made for */
266 266
267 if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "Hostess SV11", dev)<0) 267 if(request_irq(irq, &z8530_interrupt, IRQF_DISABLED, "Hostess SV11", dev)<0)
268 { 268 {
269 printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq); 269 printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq);
270 goto fail1; 270 goto fail1;
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 40926d779161..39f44241a728 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1058,7 +1058,7 @@ static int lmc_open (struct net_device *dev) /*fold00*/
1058 lmc_softreset (sc); 1058 lmc_softreset (sc);
1059 1059
1060 /* Since we have to use PCI bus, this should work on x86,alpha,ppc */ 1060 /* Since we have to use PCI bus, this should work on x86,alpha,ppc */
1061 if (request_irq (dev->irq, &lmc_interrupt, SA_SHIRQ, dev->name, dev)){ 1061 if (request_irq (dev->irq, &lmc_interrupt, IRQF_SHARED, dev->name, dev)){
1062 printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq); 1062 printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
1063 lmc_trace(dev, "lmc_open irq failed out"); 1063 lmc_trace(dev, "lmc_open irq failed out");
1064 return -EAGAIN; 1064 return -EAGAIN;
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index d7897ae89f90..567effff4a3e 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -3600,7 +3600,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3600 } 3600 }
3601 3601
3602 /* Allocate IRQ */ 3602 /* Allocate IRQ */
3603 if (request_irq(card->hw.irq, cpc_intr, SA_SHIRQ, "Cyclades-PC300", card)) { 3603 if (request_irq(card->hw.irq, cpc_intr, IRQF_SHARED, "Cyclades-PC300", card)) {
3604 printk ("PC300 found at RAM 0x%08x, but could not allocate IRQ%d.\n", 3604 printk ("PC300 found at RAM 0x%08x, but could not allocate IRQ%d.\n",
3605 card->hw.ramphys, card->hw.irq); 3605 card->hw.ramphys, card->hw.irq);
3606 goto err_io_unmap; 3606 goto err_io_unmap;
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index 24c3c57c13c9..4df61fa3214b 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -402,7 +402,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
402 writew(readw(p) | 0x0040, p); 402 writew(readw(p) | 0x0040, p);
403 403
404 /* Allocate IRQ */ 404 /* Allocate IRQ */
405 if (request_irq(pdev->irq, sca_intr, SA_SHIRQ, devname, card)) { 405 if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, devname, card)) {
406 printk(KERN_WARNING "pci200syn: could not allocate IRQ%d.\n", 406 printk(KERN_WARNING "pci200syn: could not allocate IRQ%d.\n",
407 pdev->irq); 407 pdev->irq);
408 pci200_pci_remove_one(pdev); 408 pci200_pci_remove_one(pdev);
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index f2d071272cee..fc75bec19029 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1192,7 +1192,7 @@ sbni_open( struct net_device *dev )
1192 } 1192 }
1193 } 1193 }
1194 1194
1195 if( request_irq(dev->irq, sbni_interrupt, SA_SHIRQ, dev->name, dev) ) { 1195 if( request_irq(dev->irq, sbni_interrupt, IRQF_SHARED, dev->name, dev) ) {
1196 printk( KERN_ERR "%s: unable to get IRQ %d.\n", 1196 printk( KERN_ERR "%s: unable to get IRQ %d.\n",
1197 dev->name, dev->irq ); 1197 dev->name, dev->irq );
1198 return -EAGAIN; 1198 return -EAGAIN;
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 050e854e7774..70fb1b98b1dd 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -322,7 +322,7 @@ static __init struct slvl_board *slvl_init(int iobase, int irq,
322 /* We want a fast IRQ for this device. Actually we'd like an even faster 322 /* We want a fast IRQ for this device. Actually we'd like an even faster
323 IRQ ;) - This is one driver RtLinux is made for */ 323 IRQ ;) - This is one driver RtLinux is made for */
324 324
325 if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "SeaLevel", dev)<0) 325 if(request_irq(irq, &z8530_interrupt, IRQF_DISABLED, "SeaLevel", dev)<0)
326 { 326 {
327 printk(KERN_WARNING "sealevel: IRQ %d already in use.\n", irq); 327 printk(KERN_WARNING "sealevel: IRQ %d already in use.\n", irq);
328 goto fail1_1; 328 goto fail1_1;
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 437e0e938e38..d564224cdca9 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -755,7 +755,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
755 pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq); 755 pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq);
756 756
757 /* Allocate IRQ */ 757 /* Allocate IRQ */
758 if (request_irq(pdev->irq, wanxl_intr, SA_SHIRQ, "wanXL", card)) { 758 if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) {
759 printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", 759 printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n",
760 pci_name(pdev), pdev->irq); 760 pci_name(pdev), pdev->irq);
761 wanxl_pci_remove_one(pdev); 761 wanxl_pci_remove_one(pdev);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 89328d119efa..a4dd13942714 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2848,7 +2848,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2848 reset_card (dev, 1); 2848 reset_card (dev, 1);
2849 msleep(400); 2849 msleep(400);
2850 2850
2851 rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); 2851 rc = request_irq( dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev );
2852 if (rc) { 2852 if (rc) {
2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d", 2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d",
2854 irq, rc); 2854 irq, rc);
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 54e31fa2d402..995c7bea5897 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1577,7 +1577,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
1577 1577
1578 SET_NETDEV_DEV(dev, sys_dev); 1578 SET_NETDEV_DEV(dev, sys_dev);
1579 1579
1580 if ((rc = request_irq(dev->irq, service_interrupt, SA_SHIRQ, dev->name, dev))) { 1580 if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) {
1581 printk(KERN_ERR "%s: register interrupt %d failed, rc %d\n", dev->name, irq, rc); 1581 printk(KERN_ERR "%s: register interrupt %d failed, rc %d\n", dev->name, irq, rc);
1582 goto err_out_free; 1582 goto err_out_free;
1583 } 1583 }
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 27bcf47228e2..d8f5600578b4 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2175,7 +2175,7 @@ static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm)
2175 } 2175 }
2176#endif 2176#endif
2177 res = request_irq(bcm->irq, bcm43xx_interrupt_handler, 2177 res = request_irq(bcm->irq, bcm43xx_interrupt_handler,
2178 SA_SHIRQ, KBUILD_MODNAME, bcm); 2178 IRQF_SHARED, KBUILD_MODNAME, bcm);
2179 if (res) { 2179 if (res) {
2180 printk(KERN_ERR PFX "Cannot register IRQ%d\n", bcm->irq); 2180 printk(KERN_ERR PFX "Cannot register IRQ%d\n", bcm->irq);
2181 return -ENODEV; 2181 return -ENODEV;
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index 5ea8ac835857..c2fa011be291 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -337,7 +337,7 @@ static int prism2_pci_probe(struct pci_dev *pdev,
337 337
338 pci_set_drvdata(pdev, dev); 338 pci_set_drvdata(pdev, dev);
339 339
340 if (request_irq(dev->irq, prism2_interrupt, SA_SHIRQ, dev->name, 340 if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name,
341 dev)) { 341 dev)) {
342 printk(KERN_WARNING "%s: request_irq failed\n", dev->name); 342 printk(KERN_WARNING "%s: request_irq failed\n", dev->name);
343 goto fail; 343 goto fail;
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 4ee6abbc65ec..49860fa61c30 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -550,7 +550,7 @@ static int prism2_plx_probe(struct pci_dev *pdev,
550 550
551 pci_set_drvdata(pdev, dev); 551 pci_set_drvdata(pdev, dev);
552 552
553 if (request_irq(dev->irq, prism2_interrupt, SA_SHIRQ, dev->name, 553 if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name,
554 dev)) { 554 dev)) {
555 printk(KERN_WARNING "%s: request_irq failed\n", dev->name); 555 printk(KERN_WARNING "%s: request_irq failed\n", dev->name);
556 goto fail; 556 goto fail;
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 27f744e43095..e955db435b30 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -6229,7 +6229,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6229 ipw2100_queues_initialize(priv); 6229 ipw2100_queues_initialize(priv);
6230 6230
6231 err = request_irq(pci_dev->irq, 6231 err = request_irq(pci_dev->irq,
6232 ipw2100_interrupt, SA_SHIRQ, dev->name, priv); 6232 ipw2100_interrupt, IRQF_SHARED, dev->name, priv);
6233 if (err) { 6233 if (err) {
6234 printk(KERN_WARNING DRV_NAME 6234 printk(KERN_WARNING DRV_NAME
6235 "Error calling request_irq: %d.\n", pci_dev->irq); 6235 "Error calling request_irq: %d.\n", pci_dev->irq);
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index a8a8f975432f..b3300ffe4eec 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -11545,7 +11545,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11545 11545
11546 ipw_sw_reset(priv, 1); 11546 ipw_sw_reset(priv, 1);
11547 11547
11548 err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); 11548 err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv);
11549 if (err) { 11549 if (err) {
11550 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); 11550 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq);
11551 goto out_destroy_workqueue; 11551 goto out_destroy_workqueue;
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c
index 4597fe1d1979..bf05b907747e 100644
--- a/drivers/net/wireless/orinoco_nortel.c
+++ b/drivers/net/wireless/orinoco_nortel.c
@@ -198,7 +198,7 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,
198 198
199 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); 199 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING);
200 200
201 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, 201 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
202 dev->name, dev); 202 dev->name, dev);
203 if (err) { 203 if (err) {
204 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); 204 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
diff --git a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c
index de3eae082a0d..1759c543fbee 100644
--- a/drivers/net/wireless/orinoco_pci.c
+++ b/drivers/net/wireless/orinoco_pci.c
@@ -153,7 +153,7 @@ static int orinoco_pci_init_one(struct pci_dev *pdev,
153 153
154 hermes_struct_init(&priv->hw, hermes_io, HERMES_32BIT_REGSPACING); 154 hermes_struct_init(&priv->hw, hermes_io, HERMES_32BIT_REGSPACING);
155 155
156 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, 156 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
157 dev->name, dev); 157 dev->name, dev);
158 if (err) { 158 if (err) {
159 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); 159 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
diff --git a/drivers/net/wireless/orinoco_pci.h b/drivers/net/wireless/orinoco_pci.h
index 7eb1e08113e0..be1abea4b64f 100644
--- a/drivers/net/wireless/orinoco_pci.h
+++ b/drivers/net/wireless/orinoco_pci.h
@@ -63,7 +63,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev)
63 pci_enable_device(pdev); 63 pci_enable_device(pdev);
64 pci_restore_state(pdev); 64 pci_restore_state(pdev);
65 65
66 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, 66 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
67 dev->name, dev); 67 dev->name, dev);
68 if (err) { 68 if (err) {
69 printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n", 69 printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c
index 3f928b8939f0..7f006f624171 100644
--- a/drivers/net/wireless/orinoco_plx.c
+++ b/drivers/net/wireless/orinoco_plx.c
@@ -237,7 +237,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
237 237
238 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); 238 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING);
239 239
240 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, 240 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
241 dev->name, dev); 241 dev->name, dev);
242 if (err) { 242 if (err) {
243 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); 243 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
diff --git a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c
index 160a642185f0..0831721e4d6c 100644
--- a/drivers/net/wireless/orinoco_tmd.c
+++ b/drivers/net/wireless/orinoco_tmd.c
@@ -139,7 +139,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,
139 139
140 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); 140 hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING);
141 141
142 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, 142 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
143 dev->name, dev); 143 dev->name, dev);
144 if (err) { 144 if (err) {
145 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); 145 printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c
index bfa0cc319a09..09fc17a0f029 100644
--- a/drivers/net/wireless/prism54/islpci_hotplug.c
+++ b/drivers/net/wireless/prism54/islpci_hotplug.c
@@ -189,7 +189,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
189 189
190 /* request for the interrupt before uploading the firmware */ 190 /* request for the interrupt before uploading the firmware */
191 rvalue = request_irq(pdev->irq, &islpci_interrupt, 191 rvalue = request_irq(pdev->irq, &islpci_interrupt,
192 SA_SHIRQ, ndev->name, priv); 192 IRQF_SHARED, ndev->name, priv);
193 193
194 if (rvalue) { 194 if (rvalue) {
195 /* error, could not hook the handler to the irq */ 195 /* error, could not hook the handler to the irq */
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 569305f57561..bbbf7e274a2a 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -602,7 +602,7 @@ static int yellowfin_open(struct net_device *dev)
602 /* Reset the chip. */ 602 /* Reset the chip. */
603 iowrite32(0x80000000, ioaddr + DMACtrl); 603 iowrite32(0x80000000, ioaddr + DMACtrl);
604 604
605 i = request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev); 605 i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev);
606 if (i) return i; 606 if (i) return i;
607 607
608 if (yellowfin_debug > 1) 608 if (yellowfin_debug > 1)
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 8037e5806d0a..df04e050c647 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -201,7 +201,7 @@ static int __devinit zorro8390_init(struct net_device *dev,
201 dev->irq = IRQ_AMIGA_PORTS; 201 dev->irq = IRQ_AMIGA_PORTS;
202 202
203 /* Install the Interrupt handler */ 203 /* Install the Interrupt handler */
204 i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, DRV_NAME, dev); 204 i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, IRQF_SHARED, DRV_NAME, dev);
205 if (i) return i; 205 if (i) return i;
206 206
207 for(i = 0; i < ETHER_ADDR_LEN; i++) { 207 for(i = 0; i < ETHER_ADDR_LEN; i++) {
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 58f0ce8d78e0..884965cedec9 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -340,7 +340,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
340 } 340 }
341 pcibios_register_hba(&eisa_dev.hba); 341 pcibios_register_hba(&eisa_dev.hba);
342 342
343 result = request_irq(dev->irq, eisa_irq, SA_SHIRQ, "EISA", &eisa_dev); 343 result = request_irq(dev->irq, eisa_irq, IRQF_SHARED, "EISA", &eisa_dev);
344 if (result) { 344 if (result) {
345 printk(KERN_ERR "EISA: request_irq failed!\n"); 345 printk(KERN_ERR "EISA: request_irq failed!\n");
346 return result; 346 return result;
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index a988dc7a9abd..4ee26a6d9e25 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -271,7 +271,7 @@ superio_init(struct pci_dev *pcidev)
271 else 271 else
272 printk(KERN_ERR PFX "USB regulator not initialized!\n"); 272 printk(KERN_ERR PFX "USB regulator not initialized!\n");
273 273
274 if (request_irq(pdev->irq, superio_interrupt, SA_INTERRUPT, 274 if (request_irq(pdev->irq, superio_interrupt, IRQF_DISABLED,
275 SUPERIO, (void *)sio)) { 275 SUPERIO, (void *)sio)) {
276 276
277 printk(KERN_ERR PFX "could not get irq\n"); 277 printk(KERN_ERR PFX "could not get irq\n");
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 4baa719439a2..1850632590fd 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -345,7 +345,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
345 if (irq >= 0) { 345 if (irq >= 0) {
346 /* request irq */ 346 /* request irq */
347 ret = request_irq(irq, parport_ax88796_interrupt, 347 ret = request_irq(irq, parport_ax88796_interrupt,
348 SA_TRIGGER_FALLING, pdev->name, pp); 348 IRQF_TRIGGER_FALLING, pdev->name, pp);
349 349
350 if (ret < 0) 350 if (ret < 0)
351 goto exit_port; 351 goto exit_port;
diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index c85364765ef8..b2b8092a2b39 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -353,7 +353,7 @@ static int __init parport_mfc3_init(void)
353 353
354 if (p->irq != PARPORT_IRQ_NONE) { 354 if (p->irq != PARPORT_IRQ_NONE) {
355 if (use_cnt++ == 0) 355 if (use_cnt++ == 0)
356 if (request_irq(IRQ_AMIGA_PORTS, mfc3_interrupt, SA_SHIRQ, p->name, &pp_mfc3_ops)) 356 if (request_irq(IRQ_AMIGA_PORTS, mfc3_interrupt, IRQF_SHARED, p->name, &pp_mfc3_ops))
357 goto out_irq; 357 goto out_irq;
358 } 358 }
359 359
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 7c43c5392bed..fac333b279bf 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -322,7 +322,7 @@ static int __devinit init_one_port(struct sbus_dev *sdev)
322 p->size = size; 322 p->size = size;
323 323
324 if ((err = request_irq(p->irq, parport_sunbpp_interrupt, 324 if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
325 SA_SHIRQ, p->name, p)) != 0) { 325 IRQF_SHARED, p->name, p)) != 0) {
326 goto out_put_port; 326 goto out_put_port;
327 } 327 }
328 328
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 30d87143b5d9..d5df5871cfa2 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -347,7 +347,7 @@ cpci_hp_intr(int irq, void *data, struct pt_regs *regs)
347 dbg("entered cpci_hp_intr"); 347 dbg("entered cpci_hp_intr");
348 348
349 /* Check to see if it was our interrupt */ 349 /* Check to see if it was our interrupt */
350 if ((controller->irq_flags & SA_SHIRQ) && 350 if ((controller->irq_flags & IRQF_SHARED) &&
351 !controller->ops->check_irq(controller->dev_id)) { 351 !controller->ops->check_irq(controller->dev_id)) {
352 dbg("exited cpci_hp_intr, not our interrupt"); 352 dbg("exited cpci_hp_intr, not our interrupt");
353 return IRQ_NONE; 353 return IRQ_NONE;
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c
index 584f8538da13..1c12e9171097 100644
--- a/drivers/pci/hotplug/cpcihp_zt5550.c
+++ b/drivers/pci/hotplug/cpcihp_zt5550.c
@@ -35,7 +35,8 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/signal.h> /* SA_SHIRQ */ 38#include <linux/interrupt.h>
39#include <linux/signal.h> /* IRQF_SHARED */
39#include "cpci_hotplug.h" 40#include "cpci_hotplug.h"
40#include "cpcihp_zt5550.h" 41#include "cpcihp_zt5550.h"
41 42
@@ -219,7 +220,7 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
219 zt5550_hpc.ops = &zt5550_hpc_ops; 220 zt5550_hpc.ops = &zt5550_hpc_ops;
220 if(!poll) { 221 if(!poll) {
221 zt5550_hpc.irq = hc_dev->irq; 222 zt5550_hpc.irq = hc_dev->irq;
222 zt5550_hpc.irq_flags = SA_SHIRQ; 223 zt5550_hpc.irq_flags = IRQF_SHARED;
223 zt5550_hpc.dev_id = hc_dev; 224 zt5550_hpc.dev_id = hc_dev;
224 225
225 zt5550_hpc_ops.enable_irq = zt5550_hc_enable_irq; 226 zt5550_hpc_ops.enable_irq = zt5550_hc_enable_irq;
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index e6e171f77c34..1fc259913b68 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -1188,7 +1188,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1188 /* set up the interrupt */ 1188 /* set up the interrupt */
1189 dbg("HPC interrupt = %d \n", ctrl->interrupt); 1189 dbg("HPC interrupt = %d \n", ctrl->interrupt);
1190 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, 1190 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr,
1191 SA_SHIRQ, MY_NAME, ctrl)) { 1191 IRQF_SHARED, MY_NAME, ctrl)) {
1192 err("Can't get irq %d for the hotplug pci controller\n", 1192 err("Can't get irq %d for the hotplug pci controller\n",
1193 ctrl->interrupt); 1193 ctrl->interrupt);
1194 rc = -ENODEV; 1194 rc = -ENODEV;
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 11f7858f0064..0d8fb6e607a1 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1458,7 +1458,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1458 start_int_poll_timer( php_ctlr, 10 ); /* start with 10 second delay */ 1458 start_int_poll_timer( php_ctlr, 10 ); /* start with 10 second delay */
1459 } else { 1459 } else {
1460 /* Installs the interrupt handler */ 1460 /* Installs the interrupt handler */
1461 rc = request_irq(php_ctlr->irq, pcie_isr, SA_SHIRQ, MY_NAME, (void *) ctrl); 1461 rc = request_irq(php_ctlr->irq, pcie_isr, IRQF_SHARED, MY_NAME, (void *) ctrl);
1462 dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc); 1462 dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc);
1463 if (rc) { 1463 if (rc) {
1464 err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq); 1464 err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq);
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index 45facaad39bd..0f9798df4704 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -1246,7 +1246,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1246 } else 1246 } else
1247 php_ctlr->irq = pdev->irq; 1247 php_ctlr->irq = pdev->irq;
1248 1248
1249 rc = request_irq(php_ctlr->irq, shpc_isr, SA_SHIRQ, MY_NAME, (void *) ctrl); 1249 rc = request_irq(php_ctlr->irq, shpc_isr, IRQF_SHARED, MY_NAME, (void *) ctrl);
1250 dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc); 1250 dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc);
1251 if (rc) { 1251 if (rc) {
1252 err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq); 1252 err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq);
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 5256342e8532..40569f40e90e 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -267,7 +267,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
267 267
268 /* must be a GPIO; ergo must trigger on both edges */ 268 /* must be a GPIO; ergo must trigger on both edges */
269 status = request_irq(board->det_pin, at91_cf_irq, 269 status = request_irq(board->det_pin, at91_cf_irq,
270 SA_SAMPLE_RANDOM, driver_name, cf); 270 IRQF_SAMPLE_RANDOM, driver_name, cf);
271 if (status < 0) 271 if (status < 0)
272 goto fail0; 272 goto fail0;
273 device_init_wakeup(&pdev->dev, 1); 273 device_init_wakeup(&pdev->dev, 1);
@@ -280,7 +280,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
280 */ 280 */
281 if (board->irq_pin) { 281 if (board->irq_pin) {
282 status = request_irq(board->irq_pin, at91_cf_irq, 282 status = request_irq(board->irq_pin, at91_cf_irq,
283 SA_SHIRQ, driver_name, cf); 283 IRQF_SHARED, driver_name, cf);
284 if (status < 0) 284 if (status < 0)
285 goto fail0a; 285 goto fail0a;
286 cf->socket.pci_irq = board->irq_pin; 286 cf->socket.pci_irq = board->irq_pin;
diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c
index c662e4f89d46..ad02629c8be2 100644
--- a/drivers/pcmcia/hd64465_ss.c
+++ b/drivers/pcmcia/hd64465_ss.c
@@ -761,7 +761,7 @@ static int hs_init_socket(hs_socket_t *sp, int irq, unsigned long mem_base,
761 761
762 hd64465_register_irq_demux(sp->irq, hs_irq_demux, sp); 762 hd64465_register_irq_demux(sp->irq, hs_irq_demux, sp);
763 763
764 if ((err = request_irq(sp->irq, hs_interrupt, SA_INTERRUPT, MODNAME, sp)) < 0) 764 if ((err = request_irq(sp->irq, hs_interrupt, IRQF_DISABLED, MODNAME, sp)) < 0)
765 return err; 765 return err;
766 if (request_mem_region(sp->mem_base, sp->mem_length, MODNAME) == 0) { 766 if (request_mem_region(sp->mem_base, sp->mem_length, MODNAME) == 0) {
767 sp->mem_base = 0; 767 sp->mem_base = 0;
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index d5f03a338c6c..2163aa75a257 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -149,7 +149,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de
149 149
150 /* Register the interrupt handler */ 150 /* Register the interrupt handler */
151 dprintk(KERN_DEBUG "Requesting interrupt %i \n",dev->irq); 151 dprintk(KERN_DEBUG "Requesting interrupt %i \n",dev->irq);
152 if ((ret = request_irq(dev->irq, i82092aa_interrupt, SA_SHIRQ, "i82092aa", i82092aa_interrupt))) { 152 if ((ret = request_irq(dev->irq, i82092aa_interrupt, IRQF_SHARED, "i82092aa", i82092aa_interrupt))) {
153 printk(KERN_ERR "i82092aa: Failed to register IRQ %d, aborting\n", dev->irq); 153 printk(KERN_ERR "i82092aa: Failed to register IRQ %d, aborting\n", dev->irq);
154 goto err_out_free_res; 154 goto err_out_free_res;
155 } 155 }
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index ff51a65d9433..1cc2682394b1 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -509,7 +509,7 @@ static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs)
509static u_int __init test_irq(u_short sock, int irq) 509static u_int __init test_irq(u_short sock, int irq)
510{ 510{
511 debug(2, " testing ISA irq %d\n", irq); 511 debug(2, " testing ISA irq %d\n", irq);
512 if (request_irq(irq, i365_count_irq, SA_PROBEIRQ, "scan", 512 if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan",
513 i365_count_irq) != 0) 513 i365_count_irq) != 0)
514 return 1; 514 return 1;
515 irq_hits = 0; irq_sock = sock; 515 irq_hits = 0; irq_sock = sock;
@@ -562,7 +562,7 @@ static u_int __init isa_scan(u_short sock, u_int mask0)
562 } else { 562 } else {
563 /* Fallback: just find interrupts that aren't in use */ 563 /* Fallback: just find interrupts that aren't in use */
564 for (i = 0; i < 16; i++) 564 for (i = 0; i < 16; i++)
565 if ((mask0 & (1 << i)) && (_check_irq(i, SA_PROBEIRQ) == 0)) 565 if ((mask0 & (1 << i)) && (_check_irq(i, IRQF_PROBE_SHARED) == 0))
566 mask1 |= (1 << i); 566 mask1 |= (1 << i);
567 printk("default"); 567 printk("default");
568 /* If scan failed, default to polled status */ 568 /* If scan failed, default to polled status */
@@ -726,7 +726,7 @@ static void __init add_pcic(int ns, int type)
726 u_int cs_mask = mask & ((cs_irq) ? (1<<cs_irq) : ~(1<<12)); 726 u_int cs_mask = mask & ((cs_irq) ? (1<<cs_irq) : ~(1<<12));
727 for (cs_irq = 15; cs_irq > 0; cs_irq--) 727 for (cs_irq = 15; cs_irq > 0; cs_irq--)
728 if ((cs_mask & (1 << cs_irq)) && 728 if ((cs_mask & (1 << cs_irq)) &&
729 (_check_irq(cs_irq, SA_PROBEIRQ) == 0)) 729 (_check_irq(cs_irq, IRQF_PROBE_SHARED) == 0))
730 break; 730 break;
731 if (cs_irq) { 731 if (cs_irq) {
732 grab_irq = 1; 732 grab_irq = 1;
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 2c23d7584399..420e10aec0ae 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -232,7 +232,7 @@ static int __init omap_cf_probe(struct device *dev)
232 dev_set_drvdata(dev, cf); 232 dev_set_drvdata(dev, cf);
233 233
234 /* this primarily just shuts up irq handling noise */ 234 /* this primarily just shuts up irq handling noise */
235 status = request_irq(irq, omap_cf_irq, SA_SHIRQ, 235 status = request_irq(irq, omap_cf_irq, IRQF_SHARED,
236 driver_name, cf); 236 driver_name, cf);
237 if (status < 0) 237 if (status < 0)
238 goto fail0; 238 goto fail0;
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 3281e519e714..7bf25b88ea31 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -801,9 +801,9 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
801 /* Decide what type of interrupt we are registering */ 801 /* Decide what type of interrupt we are registering */
802 type = 0; 802 type = 0;
803 if (s->functions > 1) /* All of this ought to be handled higher up */ 803 if (s->functions > 1) /* All of this ought to be handled higher up */
804 type = SA_SHIRQ; 804 type = IRQF_SHARED;
805 if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) 805 if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
806 type = SA_SHIRQ; 806 type = IRQF_SHARED;
807 807
808#ifdef CONFIG_PCMCIA_PROBE 808#ifdef CONFIG_PCMCIA_PROBE
809 if (s->irq.AssignedIRQ != 0) { 809 if (s->irq.AssignedIRQ != 0) {
@@ -845,7 +845,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
845 if (ret && !s->irq.AssignedIRQ) { 845 if (ret && !s->irq.AssignedIRQ) {
846 if (!s->pci_irq) 846 if (!s->pci_irq)
847 return ret; 847 return ret;
848 type = SA_SHIRQ; 848 type = IRQF_SHARED;
849 irq = s->pci_irq; 849 irq = s->pci_irq;
850 } 850 }
851 851
@@ -855,7 +855,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
855 } 855 }
856 856
857 /* Make sure the fact the request type was overridden is passed back */ 857 /* Make sure the fact the request type was overridden is passed back */
858 if (type == SA_SHIRQ && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) { 858 if (type == IRQF_SHARED && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) {
859 req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING; 859 req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING;
860 printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n"); 860 printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n");
861 printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n"); 861 printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n");
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 9ee26c1b8635..22c5e7427ddd 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -689,7 +689,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
689 pci_set_drvdata(dev, socket); 689 pci_set_drvdata(dev, socket);
690 if (irq_mode == 1) { 690 if (irq_mode == 1) {
691 /* Register the interrupt handler */ 691 /* Register the interrupt handler */
692 if ((ret = request_irq(dev->irq, pd6729_interrupt, SA_SHIRQ, 692 if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
693 "pd6729", socket))) { 693 "pd6729", socket))) {
694 printk(KERN_ERR "pd6729: Failed to register irq %d, " 694 printk(KERN_ERR "pd6729: Failed to register irq %d, "
695 "aborting\n", dev->irq); 695 "aborting\n", dev->irq);
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 8ef3f91310d2..ecaa132fa592 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -523,7 +523,7 @@ int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt,
523 if (irqs[i].sock != skt->nr) 523 if (irqs[i].sock != skt->nr)
524 continue; 524 continue;
525 res = request_irq(irqs[i].irq, soc_common_pcmcia_interrupt, 525 res = request_irq(irqs[i].irq, soc_common_pcmcia_interrupt,
526 SA_INTERRUPT, irqs[i].str, skt); 526 IRQF_DISABLED, irqs[i].str, skt);
527 if (res) 527 if (res)
528 break; 528 break;
529 set_irq_type(irqs[i].irq, IRQT_NOEDGE); 529 set_irq_type(irqs[i].irq, IRQT_NOEDGE);
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index 459e6e1946fd..e076a13db555 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -730,7 +730,7 @@ static int __devinit vrc4171_card_init(void)
730 730
731 retval = vrc4171_add_sockets(); 731 retval = vrc4171_add_sockets();
732 if (retval == 0) 732 if (retval == 0)
733 retval = request_irq(vrc4171_irq, pccard_interrupt, SA_SHIRQ, 733 retval = request_irq(vrc4171_irq, pccard_interrupt, IRQF_SHARED,
734 vrc4171_card_name, vrc4171_sockets); 734 vrc4171_card_name, vrc4171_sockets);
735 735
736 if (retval < 0) { 736 if (retval < 0) {
diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c
index 6004196f7cc1..d19a9138135f 100644
--- a/drivers/pcmcia/vrc4173_cardu.c
+++ b/drivers/pcmcia/vrc4173_cardu.c
@@ -500,7 +500,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev,
500 return -ENOMEM; 500 return -ENOMEM;
501 } 501 }
502 502
503 if (request_irq(dev->irq, cardu_interrupt, SA_SHIRQ, socket->name, socket) < 0) { 503 if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) {
504 pcmcia_unregister_socket(socket->pcmcia_socket); 504 pcmcia_unregister_socket(socket->pcmcia_socket);
505 socket->pcmcia_socket = NULL; 505 socket->pcmcia_socket = NULL;
506 iounmap(socket->base); 506 iounmap(socket->base);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 47e57602d5ea..1344746381e8 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -923,7 +923,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
923 923
924 socket->probe_status = 0; 924 socket->probe_status = 0;
925 925
926 if (request_irq(socket->cb_irq, yenta_probe_handler, SA_SHIRQ, "yenta", socket)) { 926 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) {
927 printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); 927 printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n");
928 return -1; 928 return -1;
929 } 929 }
@@ -1172,7 +1172,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1172 1172
1173 /* We must finish initialization here */ 1173 /* We must finish initialization here */
1174 1174
1175 if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, SA_SHIRQ, "yenta", socket)) { 1175 if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket)) {
1176 /* No IRQ or request_irq failed. Poll */ 1176 /* No IRQ or request_irq failed. Poll */
1177 socket->cb_irq = 0; /* But zero is a valid IRQ number. */ 1177 socket->cb_irq = 0; /* But zero is a valid IRQ number. */
1178 init_timer(&socket->poll_timer); 1178 init_timer(&socket->poll_timer);
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index e7cf6bec737e..5c8ec21e1086 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -395,7 +395,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
395 /* check if the resource is already in use, skip if the 395 /* check if the resource is already in use, skip if the
396 * device is active because it itself may be in use */ 396 * device is active because it itself may be in use */
397 if(!dev->active) { 397 if(!dev->active) {
398 if (request_irq(*irq, pnp_test_handler, SA_INTERRUPT, "pnp", NULL)) 398 if (request_irq(*irq, pnp_test_handler,
399 IRQF_DISABLED|IRQF_PROBE_SHARED, "pnp", NULL))
399 return 0; 400 return 0;
400 free_irq(*irq, NULL); 401 free_irq(*irq, NULL);
401 } 402 }
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index d51afbe014e5..f5b9f187a930 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -182,6 +182,22 @@ config RTC_DRV_RS5C372
182 This driver can also be built as a module. If so, the module 182 This driver can also be built as a module. If so, the module
183 will be called rtc-rs5c372. 183 will be called rtc-rs5c372.
184 184
185config RTC_DRV_S3C
186 tristate "Samsung S3C series SoC RTC"
187 depends on RTC_CLASS && ARCH_S3C2410
188 help
189 RTC (Realtime Clock) driver for the clock inbuilt into the
190 Samsung S3C24XX series of SoCs. This can provide periodic
191 interrupt rates from 1Hz to 64Hz for user programs, and
192 wakeup from Alarm.
193
194 The driver currently supports the common features on all the
195 S3C24XX range, such as the S3C2410, S3C2412, S3C2413, S3C2440
196 and S3C2442.
197
198 This driver can also be build as a module. If so, the module
199 will be called rtc-s3c.
200
185config RTC_DRV_M48T86 201config RTC_DRV_M48T86
186 tristate "ST M48T86/Dallas DS12887" 202 tristate "ST M48T86/Dallas DS12887"
187 depends on RTC_CLASS 203 depends on RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index da5e38774e13..54220714ff49 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o
19obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 19obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
20obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 20obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
21obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o 21obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o
22obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o
22obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o 23obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
23obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o 24obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o
24obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o 25obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o
diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c
index b676f443c17e..dfd0ce86f6a0 100644
--- a/drivers/rtc/rtc-at91.c
+++ b/drivers/rtc/rtc-at91.c
@@ -293,7 +293,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
293 AT91_RTC_CALEV); 293 AT91_RTC_CALEV);
294 294
295 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, 295 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
296 SA_SHIRQ, "at91_rtc", pdev); 296 IRQF_SHARED, "at91_rtc", pdev);
297 if (ret) { 297 if (ret) {
298 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", 298 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n",
299 AT91_ID_SYS); 299 AT91_ID_SYS);
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 762521a1419c..209001495474 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -341,7 +341,7 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev)
341 341
342 if (pdata->irq >= 0) { 342 if (pdata->irq >= 0) {
343 writeb(0, ioaddr + RTC_INTERRUPTS); 343 writeb(0, ioaddr + RTC_INTERRUPTS);
344 if (request_irq(pdata->irq, ds1553_rtc_interrupt, SA_SHIRQ, 344 if (request_irq(pdata->irq, ds1553_rtc_interrupt, IRQF_SHARED,
345 pdev->name, pdev) < 0) { 345 pdev->name, pdev) < 0) {
346 dev_warn(&pdev->dev, "interrupt not available.\n"); 346 dev_warn(&pdev->dev, "interrupt not available.\n");
347 pdata->irq = -1; 347 pdata->irq = -1;
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index ee538632660b..d6d1c5726b0e 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -173,7 +173,7 @@ static int pl031_probe(struct amba_device *adev, void *id)
173 goto out_no_remap; 173 goto out_no_remap;
174 } 174 }
175 175
176 if (request_irq(adev->irq[0], pl031_interrupt, SA_INTERRUPT, 176 if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED,
177 "rtc-pl031", ldata->rtc)) { 177 "rtc-pl031", ldata->rtc)) {
178 ret = -EIO; 178 ret = -EIO;
179 goto out_no_irq; 179 goto out_no_irq;
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
new file mode 100644
index 000000000000..d6d1bff52b8e
--- /dev/null
+++ b/drivers/rtc/rtc-s3c.c
@@ -0,0 +1,607 @@
1/* drivers/rtc/rtc-s3c.c
2 *
3 * Copyright (c) 2004,2006 Simtec Electronics
4 * Ben Dooks, <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * S3C2410/S3C2440/S3C24XX Internal RTC Driver
12*/
13
14#include <linux/module.h>
15#include <linux/fs.h>
16#include <linux/string.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/interrupt.h>
20#include <linux/rtc.h>
21#include <linux/bcd.h>
22#include <linux/clk.h>
23
24#include <asm/hardware.h>
25#include <asm/uaccess.h>
26#include <asm/io.h>
27#include <asm/irq.h>
28#include <asm/rtc.h>
29
30#include <asm/mach/time.h>
31
32#include <asm/arch/regs-rtc.h>
33
34/* I have yet to find an S3C implementation with more than one
35 * of these rtc blocks in */
36
37static struct resource *s3c_rtc_mem;
38
39static void __iomem *s3c_rtc_base;
40static int s3c_rtc_alarmno = NO_IRQ;
41static int s3c_rtc_tickno = NO_IRQ;
42static int s3c_rtc_freq = 1;
43
44static DEFINE_SPINLOCK(s3c_rtc_pie_lock);
45static unsigned int tick_count;
46
47/* IRQ Handlers */
48
49static irqreturn_t s3c_rtc_alarmirq(int irq, void *id, struct pt_regs *r)
50{
51 struct rtc_device *rdev = id;
52
53 rtc_update_irq(&rdev->class_dev, 1, RTC_AF | RTC_IRQF);
54 return IRQ_HANDLED;
55}
56
57static irqreturn_t s3c_rtc_tickirq(int irq, void *id, struct pt_regs *r)
58{
59 struct rtc_device *rdev = id;
60
61 rtc_update_irq(&rdev->class_dev, tick_count++, RTC_PF | RTC_IRQF);
62 return IRQ_HANDLED;
63}
64
65/* Update control registers */
66static void s3c_rtc_setaie(int to)
67{
68 unsigned int tmp;
69
70 pr_debug("%s: aie=%d\n", __FUNCTION__, to);
71
72 tmp = readb(S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
73
74 if (to)
75 tmp |= S3C2410_RTCALM_ALMEN;
76
77 writeb(tmp, S3C2410_RTCALM);
78}
79
80static void s3c_rtc_setpie(int to)
81{
82 unsigned int tmp;
83
84 pr_debug("%s: pie=%d\n", __FUNCTION__, to);
85
86 spin_lock_irq(&s3c_rtc_pie_lock);
87 tmp = readb(S3C2410_TICNT) & ~S3C2410_TICNT_ENABLE;
88
89 if (to)
90 tmp |= S3C2410_TICNT_ENABLE;
91
92 writeb(tmp, S3C2410_TICNT);
93 spin_unlock_irq(&s3c_rtc_pie_lock);
94}
95
96static void s3c_rtc_setfreq(int freq)
97{
98 unsigned int tmp;
99
100 spin_lock_irq(&s3c_rtc_pie_lock);
101 tmp = readb(S3C2410_TICNT) & S3C2410_TICNT_ENABLE;
102
103 s3c_rtc_freq = freq;
104
105 tmp |= (128 / freq)-1;
106
107 writeb(tmp, S3C2410_TICNT);
108 spin_unlock_irq(&s3c_rtc_pie_lock);
109}
110
111/* Time read/write */
112
113static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
114{
115 unsigned int have_retried = 0;
116
117 retry_get_time:
118 rtc_tm->tm_min = readb(S3C2410_RTCMIN);
119 rtc_tm->tm_hour = readb(S3C2410_RTCHOUR);
120 rtc_tm->tm_mday = readb(S3C2410_RTCDATE);
121 rtc_tm->tm_mon = readb(S3C2410_RTCMON);
122 rtc_tm->tm_year = readb(S3C2410_RTCYEAR);
123 rtc_tm->tm_sec = readb(S3C2410_RTCSEC);
124
125 /* the only way to work out wether the system was mid-update
126 * when we read it is to check the second counter, and if it
127 * is zero, then we re-try the entire read
128 */
129
130 if (rtc_tm->tm_sec == 0 && !have_retried) {
131 have_retried = 1;
132 goto retry_get_time;
133 }
134
135 pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n",
136 rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday,
137 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);
138
139 BCD_TO_BIN(rtc_tm->tm_sec);
140 BCD_TO_BIN(rtc_tm->tm_min);
141 BCD_TO_BIN(rtc_tm->tm_hour);
142 BCD_TO_BIN(rtc_tm->tm_mday);
143 BCD_TO_BIN(rtc_tm->tm_mon);
144 BCD_TO_BIN(rtc_tm->tm_year);
145
146 rtc_tm->tm_year += 100;
147 rtc_tm->tm_mon -= 1;
148
149 return 0;
150}
151
152static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
153{
154 /* the rtc gets round the y2k problem by just not supporting it */
155
156 if (tm->tm_year < 100)
157 return -EINVAL;
158
159 writeb(BIN2BCD(tm->tm_sec), S3C2410_RTCSEC);
160 writeb(BIN2BCD(tm->tm_min), S3C2410_RTCMIN);
161 writeb(BIN2BCD(tm->tm_hour), S3C2410_RTCHOUR);
162 writeb(BIN2BCD(tm->tm_mday), S3C2410_RTCDATE);
163 writeb(BIN2BCD(tm->tm_mon + 1), S3C2410_RTCMON);
164 writeb(BIN2BCD(tm->tm_year - 100), S3C2410_RTCYEAR);
165
166 return 0;
167}
168
169static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)
170{
171 struct rtc_time *alm_tm = &alrm->time;
172 unsigned int alm_en;
173
174 alm_tm->tm_sec = readb(S3C2410_ALMSEC);
175 alm_tm->tm_min = readb(S3C2410_ALMMIN);
176 alm_tm->tm_hour = readb(S3C2410_ALMHOUR);
177 alm_tm->tm_mon = readb(S3C2410_ALMMON);
178 alm_tm->tm_mday = readb(S3C2410_ALMDATE);
179 alm_tm->tm_year = readb(S3C2410_ALMYEAR);
180
181 alm_en = readb(S3C2410_RTCALM);
182
183 pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n",
184 alm_en,
185 alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday,
186 alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec);
187
188
189 /* decode the alarm enable field */
190
191 if (alm_en & S3C2410_RTCALM_SECEN)
192 BCD_TO_BIN(alm_tm->tm_sec);
193 else
194 alm_tm->tm_sec = 0xff;
195
196 if (alm_en & S3C2410_RTCALM_MINEN)
197 BCD_TO_BIN(alm_tm->tm_min);
198 else
199 alm_tm->tm_min = 0xff;
200
201 if (alm_en & S3C2410_RTCALM_HOUREN)
202 BCD_TO_BIN(alm_tm->tm_hour);
203 else
204 alm_tm->tm_hour = 0xff;
205
206 if (alm_en & S3C2410_RTCALM_DAYEN)
207 BCD_TO_BIN(alm_tm->tm_mday);
208 else
209 alm_tm->tm_mday = 0xff;
210
211 if (alm_en & S3C2410_RTCALM_MONEN) {
212 BCD_TO_BIN(alm_tm->tm_mon);
213 alm_tm->tm_mon -= 1;
214 } else {
215 alm_tm->tm_mon = 0xff;
216 }
217
218 if (alm_en & S3C2410_RTCALM_YEAREN)
219 BCD_TO_BIN(alm_tm->tm_year);
220 else
221 alm_tm->tm_year = 0xffff;
222
223 return 0;
224}
225
226static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
227{
228 struct rtc_time *tm = &alrm->time;
229 unsigned int alrm_en;
230
231 pr_debug("s3c_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n",
232 alrm->enabled,
233 tm->tm_mday & 0xff, tm->tm_mon & 0xff, tm->tm_year & 0xff,
234 tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec);
235
236
237 alrm_en = readb(S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN;
238 writeb(0x00, S3C2410_RTCALM);
239
240 if (tm->tm_sec < 60 && tm->tm_sec >= 0) {
241 alrm_en |= S3C2410_RTCALM_SECEN;
242 writeb(BIN2BCD(tm->tm_sec), S3C2410_ALMSEC);
243 }
244
245 if (tm->tm_min < 60 && tm->tm_min >= 0) {
246 alrm_en |= S3C2410_RTCALM_MINEN;
247 writeb(BIN2BCD(tm->tm_min), S3C2410_ALMMIN);
248 }
249
250 if (tm->tm_hour < 24 && tm->tm_hour >= 0) {
251 alrm_en |= S3C2410_RTCALM_HOUREN;
252 writeb(BIN2BCD(tm->tm_hour), S3C2410_ALMHOUR);
253 }
254
255 pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en);
256
257 writeb(alrm_en, S3C2410_RTCALM);
258
259 if (0) {
260 alrm_en = readb(S3C2410_RTCALM);
261 alrm_en &= ~S3C2410_RTCALM_ALMEN;
262 writeb(alrm_en, S3C2410_RTCALM);
263 disable_irq_wake(s3c_rtc_alarmno);
264 }
265
266 if (alrm->enabled)
267 enable_irq_wake(s3c_rtc_alarmno);
268 else
269 disable_irq_wake(s3c_rtc_alarmno);
270
271 return 0;
272}
273
274static int s3c_rtc_ioctl(struct device *dev,
275 unsigned int cmd, unsigned long arg)
276{
277 unsigned int ret = -ENOIOCTLCMD;
278
279 switch (cmd) {
280 case RTC_AIE_OFF:
281 case RTC_AIE_ON:
282 s3c_rtc_setaie((cmd == RTC_AIE_ON) ? 1 : 0);
283 ret = 0;
284 break;
285
286 case RTC_PIE_OFF:
287 case RTC_PIE_ON:
288 tick_count = 0;
289 s3c_rtc_setpie((cmd == RTC_PIE_ON) ? 1 : 0);
290 ret = 0;
291 break;
292
293 case RTC_IRQP_READ:
294 ret = put_user(s3c_rtc_freq, (unsigned long __user *)arg);
295 break;
296
297 case RTC_IRQP_SET:
298 /* check for power of 2 */
299
300 if ((arg & (arg-1)) != 0 || arg < 1) {
301 ret = -EINVAL;
302 goto exit;
303 }
304
305 pr_debug("s3c2410_rtc: setting frequency %ld\n", arg);
306
307 s3c_rtc_setfreq(arg);
308 ret = 0;
309 break;
310
311 case RTC_UIE_ON:
312 case RTC_UIE_OFF:
313 ret = -EINVAL;
314 }
315
316 exit:
317 return ret;
318}
319
320static int s3c_rtc_proc(struct device *dev, struct seq_file *seq)
321{
322 unsigned int rtcalm = readb(S3C2410_RTCALM);
323 unsigned int ticnt = readb (S3C2410_TICNT);
324
325 seq_printf(seq, "alarm_IRQ\t: %s\n",
326 (rtcalm & S3C2410_RTCALM_ALMEN) ? "yes" : "no" );
327
328 seq_printf(seq, "periodic_IRQ\t: %s\n",
329 (ticnt & S3C2410_TICNT_ENABLE) ? "yes" : "no" );
330
331 seq_printf(seq, "periodic_freq\t: %d\n", s3c_rtc_freq);
332
333 return 0;
334}
335
336static int s3c_rtc_open(struct device *dev)
337{
338 struct platform_device *pdev = to_platform_device(dev);
339 struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
340 int ret;
341
342 ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq,
343 SA_INTERRUPT, "s3c2410-rtc alarm", rtc_dev);
344
345 if (ret) {
346 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret);
347 return ret;
348 }
349
350 ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq,
351 SA_INTERRUPT, "s3c2410-rtc tick", rtc_dev);
352
353 if (ret) {
354 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret);
355 goto tick_err;
356 }
357
358 return ret;
359
360 tick_err:
361 free_irq(s3c_rtc_alarmno, rtc_dev);
362 return ret;
363}
364
365static void s3c_rtc_release(struct device *dev)
366{
367 struct platform_device *pdev = to_platform_device(dev);
368 struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
369
370 /* do not clear AIE here, it may be needed for wake */
371
372 s3c_rtc_setpie(0);
373 free_irq(s3c_rtc_alarmno, rtc_dev);
374 free_irq(s3c_rtc_tickno, rtc_dev);
375}
376
377static struct rtc_class_ops s3c_rtcops = {
378 .open = s3c_rtc_open,
379 .release = s3c_rtc_release,
380 .ioctl = s3c_rtc_ioctl,
381 .read_time = s3c_rtc_gettime,
382 .set_time = s3c_rtc_settime,
383 .read_alarm = s3c_rtc_getalarm,
384 .set_alarm = s3c_rtc_setalarm,
385 .proc = s3c_rtc_proc,
386};
387
388static void s3c_rtc_enable(struct platform_device *pdev, int en)
389{
390 unsigned int tmp;
391
392 if (s3c_rtc_base == NULL)
393 return;
394
395 if (!en) {
396 tmp = readb(S3C2410_RTCCON);
397 writeb(tmp & ~S3C2410_RTCCON_RTCEN, S3C2410_RTCCON);
398
399 tmp = readb(S3C2410_TICNT);
400 writeb(tmp & ~S3C2410_TICNT_ENABLE, S3C2410_TICNT);
401 } else {
402 /* re-enable the device, and check it is ok */
403
404 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
405 dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
406
407 tmp = readb(S3C2410_RTCCON);
408 writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
409 }
410
411 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
412 dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n");
413
414 tmp = readb(S3C2410_RTCCON);
415 writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
416 }
417
418 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
419 dev_info(&pdev->dev, "removing RTCCON_CLKRST\n");
420
421 tmp = readb(S3C2410_RTCCON);
422 writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON);
423 }
424 }
425}
426
427static int s3c_rtc_remove(struct platform_device *dev)
428{
429 struct rtc_device *rtc = platform_get_drvdata(dev);
430
431 platform_set_drvdata(dev, NULL);
432 rtc_device_unregister(rtc);
433
434 s3c_rtc_setpie(0);
435 s3c_rtc_setaie(0);
436
437 iounmap(s3c_rtc_base);
438 release_resource(s3c_rtc_mem);
439 kfree(s3c_rtc_mem);
440
441 return 0;
442}
443
444static int s3c_rtc_probe(struct platform_device *pdev)
445{
446 struct rtc_device *rtc;
447 struct resource *res;
448 int ret;
449
450 pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
451
452 /* find the IRQs */
453
454 s3c_rtc_tickno = platform_get_irq(pdev, 1);
455 if (s3c_rtc_tickno < 0) {
456 dev_err(&pdev->dev, "no irq for rtc tick\n");
457 return -ENOENT;
458 }
459
460 s3c_rtc_alarmno = platform_get_irq(pdev, 0);
461 if (s3c_rtc_alarmno < 0) {
462 dev_err(&pdev->dev, "no irq for alarm\n");
463 return -ENOENT;
464 }
465
466 pr_debug("s3c2410_rtc: tick irq %d, alarm irq %d\n",
467 s3c_rtc_tickno, s3c_rtc_alarmno);
468
469 /* get the memory region */
470
471 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
472 if (res == NULL) {
473 dev_err(&pdev->dev, "failed to get memory region resource\n");
474 return -ENOENT;
475 }
476
477 s3c_rtc_mem = request_mem_region(res->start,
478 res->end-res->start+1,
479 pdev->name);
480
481 if (s3c_rtc_mem == NULL) {
482 dev_err(&pdev->dev, "failed to reserve memory region\n");
483 ret = -ENOENT;
484 goto err_nores;
485 }
486
487 s3c_rtc_base = ioremap(res->start, res->end - res->start + 1);
488 if (s3c_rtc_base == NULL) {
489 dev_err(&pdev->dev, "failed ioremap()\n");
490 ret = -EINVAL;
491 goto err_nomap;
492 }
493
494 /* check to see if everything is setup correctly */
495
496 s3c_rtc_enable(pdev, 1);
497
498 pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
499
500 s3c_rtc_setfreq(s3c_rtc_freq);
501
502 /* register RTC and exit */
503
504 rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
505 THIS_MODULE);
506
507 if (IS_ERR(rtc)) {
508 dev_err(&pdev->dev, "cannot attach rtc\n");
509 ret = PTR_ERR(rtc);
510 goto err_nortc;
511 }
512
513 rtc->max_user_freq = 128;
514
515 platform_set_drvdata(pdev, rtc);
516 return 0;
517
518 err_nortc:
519 s3c_rtc_enable(pdev, 0);
520 iounmap(s3c_rtc_base);
521
522 err_nomap:
523 release_resource(s3c_rtc_mem);
524
525 err_nores:
526 return ret;
527}
528
529#ifdef CONFIG_PM
530
531/* RTC Power management control */
532
533static struct timespec s3c_rtc_delta;
534
535static int ticnt_save;
536
537static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
538{
539 struct rtc_time tm;
540 struct timespec time;
541
542 time.tv_nsec = 0;
543
544 /* save TICNT for anyone using periodic interrupts */
545
546 ticnt_save = readb(S3C2410_TICNT);
547
548 /* calculate time delta for suspend */
549
550 s3c_rtc_gettime(&pdev->dev, &tm);
551 rtc_tm_to_time(&tm, &time.tv_sec);
552 save_time_delta(&s3c_rtc_delta, &time);
553 s3c_rtc_enable(pdev, 0);
554
555 return 0;
556}
557
558static int s3c_rtc_resume(struct platform_device *pdev)
559{
560 struct rtc_time tm;
561 struct timespec time;
562
563 time.tv_nsec = 0;
564
565 s3c_rtc_enable(pdev, 1);
566 s3c_rtc_gettime(&pdev->dev, &tm);
567 rtc_tm_to_time(&tm, &time.tv_sec);
568 restore_time_delta(&s3c_rtc_delta, &time);
569
570 writeb(ticnt_save, S3C2410_TICNT);
571 return 0;
572}
573#else
574#define s3c_rtc_suspend NULL
575#define s3c_rtc_resume NULL
576#endif
577
578static struct platform_driver s3c2410_rtcdrv = {
579 .probe = s3c_rtc_probe,
580 .remove = s3c_rtc_remove,
581 .suspend = s3c_rtc_suspend,
582 .resume = s3c_rtc_resume,
583 .driver = {
584 .name = "s3c2410-rtc",
585 .owner = THIS_MODULE,
586 },
587};
588
589static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n";
590
591static int __init s3c_rtc_init(void)
592{
593 printk(banner);
594 return platform_driver_register(&s3c2410_rtcdrv);
595}
596
597static void __exit s3c_rtc_exit(void)
598{
599 platform_driver_unregister(&s3c2410_rtcdrv);
600}
601
602module_init(s3c_rtc_init);
603module_exit(s3c_rtc_exit);
604
605MODULE_DESCRIPTION("Samsung S3C RTC Driver");
606MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
607MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 9cd1cb304bb2..ee4b61ee67b0 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -157,19 +157,19 @@ static int sa1100_rtc_open(struct device *dev)
157{ 157{
158 int ret; 158 int ret;
159 159
160 ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, SA_INTERRUPT, 160 ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED,
161 "rtc 1Hz", dev); 161 "rtc 1Hz", dev);
162 if (ret) { 162 if (ret) {
163 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); 163 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz);
164 goto fail_ui; 164 goto fail_ui;
165 } 165 }
166 ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, SA_INTERRUPT, 166 ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED,
167 "rtc Alrm", dev); 167 "rtc Alrm", dev);
168 if (ret) { 168 if (ret) {
169 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); 169 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm);
170 goto fail_ai; 170 goto fail_ai;
171 } 171 }
172 ret = request_irq(IRQ_OST1, timer1_interrupt, SA_INTERRUPT, 172 ret = request_irq(IRQ_OST1, timer1_interrupt, IRQF_DISABLED,
173 "rtc timer", dev); 173 "rtc timer", dev);
174 if (ret) { 174 if (ret) {
175 dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1); 175 dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1);
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 4b9291dd4443..bb6d5ff24fd0 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -345,11 +345,11 @@ static int __devinit rtc_probe(struct platform_device *pdev)
345 spin_unlock_irq(&rtc_lock); 345 spin_unlock_irq(&rtc_lock);
346 346
347 irq = ELAPSEDTIME_IRQ; 347 irq = ELAPSEDTIME_IRQ;
348 retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT, 348 retval = request_irq(irq, elapsedtime_interrupt, IRQF_DISABLED,
349 "elapsed_time", pdev); 349 "elapsed_time", pdev);
350 if (retval == 0) { 350 if (retval == 0) {
351 irq = RTCLONG1_IRQ; 351 irq = RTCLONG1_IRQ;
352 retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT, 352 retval = request_irq(irq, rtclong1_interrupt, IRQF_DISABLED,
353 "rtclong1", pdev); 353 "rtclong1", pdev);
354 } 354 }
355 355
diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c
index 015db40ad8a4..4fdb2c932210 100644
--- a/drivers/sbus/char/aurora.c
+++ b/drivers/sbus/char/aurora.c
@@ -337,19 +337,19 @@ static int aurora_probe(void)
337 printk("intr pri %d\n", grrr); 337 printk("intr pri %d\n", grrr);
338#endif 338#endif
339 if ((bp->irq=irqs[bn]) && valid_irq(bp->irq) && 339 if ((bp->irq=irqs[bn]) && valid_irq(bp->irq) &&
340 !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { 340 !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) {
341 free_irq(bp->irq|0x30, bp); 341 free_irq(bp->irq|0x30, bp);
342 } else 342 } else
343 if ((bp->irq=prom_getint(sdev->prom_node, "bintr")) && valid_irq(bp->irq) && 343 if ((bp->irq=prom_getint(sdev->prom_node, "bintr")) && valid_irq(bp->irq) &&
344 !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { 344 !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) {
345 free_irq(bp->irq|0x30, bp); 345 free_irq(bp->irq|0x30, bp);
346 } else 346 } else
347 if ((bp->irq=prom_getint(sdev->prom_node, "intr")) && valid_irq(bp->irq) && 347 if ((bp->irq=prom_getint(sdev->prom_node, "intr")) && valid_irq(bp->irq) &&
348 !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { 348 !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) {
349 free_irq(bp->irq|0x30, bp); 349 free_irq(bp->irq|0x30, bp);
350 } else 350 } else
351 for(grrr=0;grrr<TYPE_1_IRQS;grrr++) { 351 for(grrr=0;grrr<TYPE_1_IRQS;grrr++) {
352 if ((bp->irq=type_1_irq[grrr])&&!request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { 352 if ((bp->irq=type_1_irq[grrr])&&!request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) {
353 free_irq(bp->irq|0x30, bp); 353 free_irq(bp->irq|0x30, bp);
354 break; 354 break;
355 } else { 355 } else {
@@ -909,14 +909,14 @@ static int aurora_setup_board(struct Aurora_board * bp)
909#ifdef AURORA_ALLIRQ 909#ifdef AURORA_ALLIRQ
910 int i; 910 int i;
911 for (i = 0; i < AURORA_ALLIRQ; i++) { 911 for (i = 0; i < AURORA_ALLIRQ; i++) {
912 error = request_irq(allirq[i]|0x30, aurora_interrupt, SA_SHIRQ, 912 error = request_irq(allirq[i]|0x30, aurora_interrupt, IRQF_SHARED,
913 "sio16", bp); 913 "sio16", bp);
914 if (error) 914 if (error)
915 printk(KERN_ERR "IRQ%d request error %d\n", 915 printk(KERN_ERR "IRQ%d request error %d\n",
916 allirq[i], error); 916 allirq[i], error);
917 } 917 }
918#else 918#else
919 error = request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, 919 error = request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED,
920 "sio16", bp); 920 "sio16", bp);
921 if (error) { 921 if (error) {
922 printk(KERN_ERR "IRQ request error %d\n", error); 922 printk(KERN_ERR "IRQ request error %d\n", error);
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 73634371393b..7186235594f9 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -377,7 +377,7 @@ static int __init attach_one_i2c(struct linux_ebus_device *edev, int index)
377 bp->waiting = 0; 377 bp->waiting = 0;
378 init_waitqueue_head(&bp->wq); 378 init_waitqueue_head(&bp->wq);
379 if (request_irq(edev->irqs[0], bbc_i2c_interrupt, 379 if (request_irq(edev->irqs[0], bbc_i2c_interrupt,
380 SA_SHIRQ, "bbc_i2c", bp)) 380 IRQF_SHARED, "bbc_i2c", bp))
381 goto fail; 381 goto fail;
382 382
383 bp->index = index; 383 bp->index = index;
diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
index 21737b7e86a1..836a58bb0305 100644
--- a/drivers/sbus/char/cpwatchdog.c
+++ b/drivers/sbus/char/cpwatchdog.c
@@ -301,7 +301,7 @@ static int wd_open(struct inode *inode, struct file *f)
301 { 301 {
302 if (request_irq(wd_dev.irq, 302 if (request_irq(wd_dev.irq,
303 &wd_interrupt, 303 &wd_interrupt,
304 SA_SHIRQ, 304 IRQF_SHARED,
305 WD_OBPNAME, 305 WD_OBPNAME,
306 (void *)wd_dev.regs)) { 306 (void *)wd_dev.regs)) {
307 printk("%s: Cannot register IRQ %d\n", 307 printk("%s: Cannot register IRQ %d\n",
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index b003baf8d404..5a9475e56d0e 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -2122,7 +2122,7 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2122 TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH))); 2122 TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH)));
2123 2123
2124 /* Now setup the interrupt handler */ 2124 /* Now setup the interrupt handler */
2125 retval = request_irq(pdev->irq, twa_interrupt, SA_SHIRQ, "3w-9xxx", tw_dev); 2125 retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev);
2126 if (retval) { 2126 if (retval) {
2127 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x30, "Error requesting IRQ"); 2127 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x30, "Error requesting IRQ");
2128 goto out_remove_host; 2128 goto out_remove_host;
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 17dbd4ac8692..f3a5f422a8e4 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -2397,7 +2397,7 @@ static int __devinit tw_probe(struct pci_dev *pdev, const struct pci_device_id *
2397 printk(KERN_WARNING "3w-xxxx: scsi%d: Found a 3ware Storage Controller at 0x%x, IRQ: %d.\n", host->host_no, tw_dev->base_addr, pdev->irq); 2397 printk(KERN_WARNING "3w-xxxx: scsi%d: Found a 3ware Storage Controller at 0x%x, IRQ: %d.\n", host->host_no, tw_dev->base_addr, pdev->irq);
2398 2398
2399 /* Now setup the interrupt handler */ 2399 /* Now setup the interrupt handler */
2400 retval = request_irq(pdev->irq, tw_interrupt, SA_SHIRQ, "3w-xxxx", tw_dev); 2400 retval = request_irq(pdev->irq, tw_interrupt, IRQF_SHARED, "3w-xxxx", tw_dev);
2401 if (retval) { 2401 if (retval) {
2402 printk(KERN_WARNING "3w-xxxx: Error requesting IRQ."); 2402 printk(KERN_WARNING "3w-xxxx: Error requesting IRQ.");
2403 goto out_remove_host; 2403 goto out_remove_host;
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c
index c9bd0335995d..c690c2b89e41 100644
--- a/drivers/scsi/53c7xx.c
+++ b/drivers/scsi/53c7xx.c
@@ -1070,7 +1070,7 @@ NCR53c7x0_init (struct Scsi_Host *host) {
1070 1070
1071 NCR53c7x0_driver_init (host); 1071 NCR53c7x0_driver_init (host);
1072 1072
1073 if (request_irq(host->irq, NCR53c7x0_intr, SA_SHIRQ, "53c7xx", host)) 1073 if (request_irq(host->irq, NCR53c7x0_intr, IRQF_SHARED, "53c7xx", host))
1074 { 1074 {
1075 printk("scsi%d : IRQ%d not free, detaching\n", 1075 printk("scsi%d : IRQ%d not free, detaching\n",
1076 host->host_no, host->irq); 1076 host->host_no, host->irq);
@@ -4232,7 +4232,7 @@ restart:
4232 * Purpose : handle NCR53c7x0 interrupts for all NCR devices sharing 4232 * Purpose : handle NCR53c7x0 interrupts for all NCR devices sharing
4233 * the same IRQ line. 4233 * the same IRQ line.
4234 * 4234 *
4235 * Inputs : Since we're using the SA_INTERRUPT interrupt handler 4235 * Inputs : Since we're using the IRQF_DISABLED interrupt handler
4236 * semantics, irq indicates the interrupt which invoked 4236 * semantics, irq indicates the interrupt which invoked
4237 * this handler. 4237 * this handler.
4238 * 4238 *
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 259b47ec4f54..16a12a3b7b2b 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -1844,7 +1844,7 @@ static boolean __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *Hos
1844 /* 1844 /*
1845 Acquire shared access to the IRQ Channel. 1845 Acquire shared access to the IRQ Channel.
1846 */ 1846 */
1847 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, SA_SHIRQ, HostAdapter->FullModelName, HostAdapter) < 0) { 1847 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) {
1848 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel); 1848 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel);
1849 return false; 1849 return false;
1850 } 1850 }
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 75f2f7ae2a8e..616810ad17d8 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -585,7 +585,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
585 NCR5380_setup(instance); 585 NCR5380_setup(instance);
586 586
587 for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1) 587 for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1)
588 if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", NULL) == 0)) 588 if ((mask & possible) && (request_irq(i, &probe_intr, IRQF_DISABLED, "NCR-probe", NULL) == 0))
589 trying_irqs |= mask; 589 trying_irqs |= mask;
590 590
591 timeout = jiffies + (250 * HZ / 1000); 591 timeout = jiffies + (250 * HZ / 1000);
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c
index 577e63499778..a06f547e87f7 100644
--- a/drivers/scsi/NCR_D700.c
+++ b/drivers/scsi/NCR_D700.c
@@ -320,7 +320,7 @@ NCR_D700_probe(struct device *dev)
320 memset(p, '\0', sizeof(*p)); 320 memset(p, '\0', sizeof(*p));
321 p->dev = dev; 321 p->dev = dev;
322 snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); 322 snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id);
323 if (request_irq(irq, NCR_D700_intr, SA_SHIRQ, p->name, p)) { 323 if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) {
324 printk(KERN_ERR "D700: request_irq failed\n"); 324 printk(KERN_ERR "D700: request_irq failed\n");
325 kfree(p); 325 kfree(p);
326 return -EBUSY; 326 return -EBUSY;
diff --git a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c
index 9d18ec90510f..c39ffbb86e39 100644
--- a/drivers/scsi/NCR_Q720.c
+++ b/drivers/scsi/NCR_Q720.c
@@ -265,7 +265,7 @@ NCR_Q720_probe(struct device *dev)
265 p->irq = irq; 265 p->irq = irq;
266 p->siops = siops; 266 p->siops = siops;
267 267
268 if (request_irq(irq, NCR_Q720_intr, SA_SHIRQ, "NCR_Q720", p)) { 268 if (request_irq(irq, NCR_Q720_intr, IRQF_SHARED, "NCR_Q720", p)) {
269 printk(KERN_ERR "NCR_Q720: request irq %d failed\n", irq); 269 printk(KERN_ERR "NCR_Q720: request irq %d failed\n", irq);
270 goto out_release; 270 goto out_release;
271 } 271 }
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 3dce21c78737..d7e9fab54c60 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1120,7 +1120,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
1120 shost->sg_tablesize = TOTAL_SG_ENTRY; 1120 shost->sg_tablesize = TOTAL_SG_ENTRY;
1121 1121
1122 /* Initial orc chip */ 1122 /* Initial orc chip */
1123 error = request_irq(pdev->irq, inia100_intr, SA_SHIRQ, 1123 error = request_irq(pdev->irq, inia100_intr, IRQF_SHARED,
1124 "inia100", shost); 1124 "inia100", shost);
1125 if (error < 0) { 1125 if (error < 0) {
1126 printk(KERN_WARNING "inia100: unable to get irq %d\n", 1126 printk(KERN_WARNING "inia100: unable to get irq %d\n",
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index 54996eaae979..fddfa2ebcd70 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -208,7 +208,7 @@ int __init a2091_detect(struct scsi_host_template *tpnt)
208 regs.SASR = &(DMA(instance)->SASR); 208 regs.SASR = &(DMA(instance)->SASR);
209 regs.SCMD = &(DMA(instance)->SCMD); 209 regs.SCMD = &(DMA(instance)->SCMD);
210 wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); 210 wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
211 request_irq(IRQ_AMIGA_PORTS, a2091_intr, SA_SHIRQ, "A2091 SCSI", 211 request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI",
212 instance); 212 instance);
213 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; 213 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN;
214 num_a2091++; 214 num_a2091++;
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index f425d424bf08..ae9ab4b136ac 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -190,7 +190,7 @@ int __init a3000_detect(struct scsi_host_template *tpnt)
190 regs.SASR = &(DMA(a3000_host)->SASR); 190 regs.SASR = &(DMA(a3000_host)->SASR);
191 regs.SCMD = &(DMA(a3000_host)->SCMD); 191 regs.SCMD = &(DMA(a3000_host)->SCMD);
192 wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); 192 wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15);
193 if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, SA_SHIRQ, "A3000 SCSI", 193 if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI",
194 a3000_intr)) 194 a3000_intr))
195 goto fail_irq; 195 goto fail_irq;
196 DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; 196 DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN;
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index 5b52966bbbf3..458ea897fd72 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -453,7 +453,7 @@ int aac_rkt_init(struct aac_dev *dev)
453 } 453 }
454 msleep(1); 454 msleep(1);
455 } 455 }
456 if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 456 if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev)<0)
457 { 457 {
458 printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance); 458 printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance);
459 goto error_iounmap; 459 goto error_iounmap;
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 9dadfb28b3f1..035018db69b1 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -453,7 +453,7 @@ int aac_rx_init(struct aac_dev *dev)
453 } 453 }
454 msleep(1); 454 msleep(1);
455 } 455 }
456 if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 456 if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev)<0)
457 { 457 {
458 printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance); 458 printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance);
459 goto error_iounmap; 459 goto error_iounmap;
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 88d400fccc94..cd586cc8f9be 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -327,7 +327,7 @@ int aac_sa_init(struct aac_dev *dev)
327 msleep(1); 327 msleep(1);
328 } 328 }
329 329
330 if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) { 330 if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev ) < 0) {
331 printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance); 331 printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance);
332 goto error_iounmap; 332 goto error_iounmap;
333 } 333 }
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 537136457ea0..e32b4ab2f8fb 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -371,7 +371,7 @@
371 371
372 1.5 (8/8/96): 372 1.5 (8/8/96):
373 1. Add support for ABP-940U (PCI Ultra) adapter. 373 1. Add support for ABP-940U (PCI Ultra) adapter.
374 2. Add support for IRQ sharing by setting the SA_SHIRQ flag for 374 2. Add support for IRQ sharing by setting the IRQF_SHARED flag for
375 request_irq and supplying a dev_id pointer to both request_irq() 375 request_irq and supplying a dev_id pointer to both request_irq()
376 and free_irq(). 376 and free_irq().
377 3. In AscSearchIOPortAddr11() restore a call to check_region() which 377 3. In AscSearchIOPortAddr11() restore a call to check_region() which
@@ -504,9 +504,9 @@
504 3. For v2.1.93 and newer kernels use CONFIG_PCI and new PCI BIOS 504 3. For v2.1.93 and newer kernels use CONFIG_PCI and new PCI BIOS
505 access functions. 505 access functions.
506 4. Update board serial number printing. 506 4. Update board serial number printing.
507 5. Try allocating an IRQ both with and without the SA_INTERRUPT 507 5. Try allocating an IRQ both with and without the IRQF_DISABLED
508 flag set to allow IRQ sharing with drivers that do not set 508 flag set to allow IRQ sharing with drivers that do not set
509 the SA_INTERRUPT flag. Also display a more descriptive error 509 the IRQF_DISABLED flag. Also display a more descriptive error
510 message if request_irq() fails. 510 message if request_irq() fails.
511 6. Update to latest Asc and Adv Libraries. 511 6. Update to latest Asc and Adv Libraries.
512 512
@@ -5202,19 +5202,19 @@ advansys_detect(struct scsi_host_template *tpnt)
5202 /* Register IRQ Number. */ 5202 /* Register IRQ Number. */
5203 ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq); 5203 ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq);
5204 /* 5204 /*
5205 * If request_irq() fails with the SA_INTERRUPT flag set, 5205 * If request_irq() fails with the IRQF_DISABLED flag set,
5206 * then try again without the SA_INTERRUPT flag set. This 5206 * then try again without the IRQF_DISABLED flag set. This
5207 * allows IRQ sharing to work even with other drivers that 5207 * allows IRQ sharing to work even with other drivers that
5208 * do not set the SA_INTERRUPT flag. 5208 * do not set the IRQF_DISABLED flag.
5209 * 5209 *
5210 * If SA_INTERRUPT is not set, then interrupts are enabled 5210 * If IRQF_DISABLED is not set, then interrupts are enabled
5211 * before the driver interrupt function is called. 5211 * before the driver interrupt function is called.
5212 */ 5212 */
5213 if (((ret = request_irq(shp->irq, advansys_interrupt, 5213 if (((ret = request_irq(shp->irq, advansys_interrupt,
5214 SA_INTERRUPT | (share_irq == TRUE ? SA_SHIRQ : 0), 5214 IRQF_DISABLED | (share_irq == TRUE ? IRQF_SHARED : 0),
5215 "advansys", boardp)) != 0) && 5215 "advansys", boardp)) != 0) &&
5216 ((ret = request_irq(shp->irq, advansys_interrupt, 5216 ((ret = request_irq(shp->irq, advansys_interrupt,
5217 (share_irq == TRUE ? SA_SHIRQ : 0), 5217 (share_irq == TRUE ? IRQF_SHARED : 0),
5218 "advansys", boardp)) != 0)) 5218 "advansys", boardp)) != 0))
5219 { 5219 {
5220 if (ret == -EBUSY) { 5220 if (ret == -EBUSY) {
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index de80cdfb5b9d..36e63f82d9f8 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -855,7 +855,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
855 SETPORT(SIMODE0, 0); 855 SETPORT(SIMODE0, 0);
856 SETPORT(SIMODE1, 0); 856 SETPORT(SIMODE1, 0);
857 857
858 if( request_irq(shpnt->irq, swintr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt) ) { 858 if( request_irq(shpnt->irq, swintr, IRQF_DISABLED|IRQF_SHARED, "aha152x", shpnt) ) {
859 printk(KERN_ERR "aha152x%d: irq %d busy.\n", shpnt->host_no, shpnt->irq); 859 printk(KERN_ERR "aha152x%d: irq %d busy.\n", shpnt->host_no, shpnt->irq);
860 goto out_host_put; 860 goto out_host_put;
861 } 861 }
@@ -889,7 +889,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
889 SETPORT(SSTAT0, 0x7f); 889 SETPORT(SSTAT0, 0x7f);
890 SETPORT(SSTAT1, 0xef); 890 SETPORT(SSTAT1, 0xef);
891 891
892 if ( request_irq(shpnt->irq, intr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt) ) { 892 if ( request_irq(shpnt->irq, intr, IRQF_DISABLED|IRQF_SHARED, "aha152x", shpnt) ) {
893 printk(KERN_ERR "aha152x%d: failed to reassign irq %d.\n", shpnt->host_no, shpnt->irq); 893 printk(KERN_ERR "aha152x%d: failed to reassign irq %d.\n", shpnt->host_no, shpnt->irq);
894 goto out_host_put; 894 goto out_host_put;
895 } 895 }
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 4b8c6a543925..0e4a7ebe300a 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -634,7 +634,7 @@ static int aha1740_probe (struct device *dev)
634 } 634 }
635 635
636 DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level)); 636 DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level));
637 if (request_irq(irq_level,aha1740_intr_handle,irq_type ? 0 : SA_SHIRQ, 637 if (request_irq(irq_level,aha1740_intr_handle,irq_type ? 0 : IRQF_SHARED,
638 "aha1740",shpnt)) { 638 "aha1740",shpnt)) {
639 printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n", 639 printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n",
640 irq_level); 640 irq_level);
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index f05946777718..15f6cd4279b7 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -1371,7 +1371,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1371 probe_ent->port_ops = ahci_port_info[board_idx].port_ops; 1371 probe_ent->port_ops = ahci_port_info[board_idx].port_ops;
1372 1372
1373 probe_ent->irq = pdev->irq; 1373 probe_ent->irq = pdev->irq;
1374 probe_ent->irq_flags = SA_SHIRQ; 1374 probe_ent->irq_flags = IRQF_SHARED;
1375 probe_ent->mmio_base = mmio_base; 1375 probe_ent->mmio_base = mmio_base;
1376 probe_ent->private_data = hpriv; 1376 probe_ent->private_data = hpriv;
1377 1377
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
index d754b3267863..867cbe23579b 100644
--- a/drivers/scsi/aic7xxx/aic7770_osm.c
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c
@@ -65,7 +65,7 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq)
65 65
66 shared = 0; 66 shared = 0;
67 if ((ahc->flags & AHC_EDGE_INTERRUPT) == 0) 67 if ((ahc->flags & AHC_EDGE_INTERRUPT) == 0)
68 shared = SA_SHIRQ; 68 shared = IRQF_SHARED;
69 69
70 error = request_irq(irq, ahc_linux_isr, shared, "aic7xxx", ahc); 70 error = request_irq(irq, ahc_linux_isr, shared, "aic7xxx", ahc);
71 if (error == 0) 71 if (error == 0)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index ebbf7e4ff4cc..50a41eda580e 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -342,7 +342,7 @@ ahd_pci_map_int(struct ahd_softc *ahd)
342 int error; 342 int error;
343 343
344 error = request_irq(ahd->dev_softc->irq, ahd_linux_isr, 344 error = request_irq(ahd->dev_softc->irq, ahd_linux_isr,
345 SA_SHIRQ, "aic79xx", ahd); 345 IRQF_SHARED, "aic79xx", ahd);
346 if (!error) 346 if (!error)
347 ahd->platform_data->irq = ahd->dev_softc->irq; 347 ahd->platform_data->irq = ahd->dev_softc->irq;
348 348
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 0c9c2f400bf6..7e42f07a27f3 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -375,7 +375,7 @@ ahc_pci_map_int(struct ahc_softc *ahc)
375 int error; 375 int error;
376 376
377 error = request_irq(ahc->dev_softc->irq, ahc_linux_isr, 377 error = request_irq(ahc->dev_softc->irq, ahc_linux_isr,
378 SA_SHIRQ, "aic7xxx", ahc); 378 IRQF_SHARED, "aic7xxx", ahc);
379 if (error == 0) 379 if (error == 0)
380 ahc->platform_data->irq = ahc->dev_softc->irq; 380 ahc->platform_data->irq = ahc->dev_softc->irq;
381 381
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 5dba1c63122e..3f85b5e978f1 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -8322,11 +8322,11 @@ aic7xxx_register(struct scsi_host_template *template, struct aic7xxx_host *p,
8322 } 8322 }
8323 else 8323 else
8324 { 8324 {
8325 result = (request_irq(p->irq, do_aic7xxx_isr, SA_SHIRQ, 8325 result = (request_irq(p->irq, do_aic7xxx_isr, IRQF_SHARED,
8326 "aic7xxx", p)); 8326 "aic7xxx", p));
8327 if (result < 0) 8327 if (result < 0)
8328 { 8328 {
8329 result = (request_irq(p->irq, do_aic7xxx_isr, SA_INTERRUPT | SA_SHIRQ, 8329 result = (request_irq(p->irq, do_aic7xxx_isr, IRQF_DISABLED | IRQF_SHARED,
8330 "aic7xxx", p)); 8330 "aic7xxx", p));
8331 } 8331 }
8332 } 8332 }
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 1b9900b58956..7621e3fa37b1 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -3030,7 +3030,7 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
3030 if (!request_region(host->io_port, 2048, "acornscsi(ram)")) 3030 if (!request_region(host->io_port, 2048, "acornscsi(ram)"))
3031 goto err_5; 3031 goto err_5;
3032 3032
3033 ret = request_irq(host->irq, acornscsi_intr, SA_INTERRUPT, "acornscsi", ashost); 3033 ret = request_irq(host->irq, acornscsi_intr, IRQF_DISABLED, "acornscsi", ashost);
3034 if (ret) { 3034 if (ret) {
3035 printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n", 3035 printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n",
3036 host->host_no, ashost->scsi.irq, ret); 3036 host->host_no, ashost->scsi.irq, ret);
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index e6c9491dc5c0..3bdfc36481ae 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -277,7 +277,7 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id)
277 ((struct NCR5380_hostdata *)host->hostdata)->ctrl = 0; 277 ((struct NCR5380_hostdata *)host->hostdata)->ctrl = 0;
278 outb(0x00, host->io_port - 577); 278 outb(0x00, host->io_port - 577);
279 279
280 ret = request_irq(host->irq, cumanascsi_intr, SA_INTERRUPT, 280 ret = request_irq(host->irq, cumanascsi_intr, IRQF_DISABLED,
281 "CumanaSCSI-1", host); 281 "CumanaSCSI-1", host);
282 if (ret) { 282 if (ret) {
283 printk("scsi%d: IRQ%d not free: %d\n", 283 printk("scsi%d: IRQ%d not free: %d\n",
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index fad2109268bb..719af0dcc0e5 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -460,7 +460,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
460 goto out_free; 460 goto out_free;
461 461
462 ret = request_irq(ec->irq, cumanascsi_2_intr, 462 ret = request_irq(ec->irq, cumanascsi_2_intr,
463 SA_INTERRUPT, "cumanascsi2", info); 463 IRQF_DISABLED, "cumanascsi2", info);
464 if (ret) { 464 if (ret) {
465 printk("scsi%d: IRQ%d not free: %d\n", 465 printk("scsi%d: IRQ%d not free: %d\n",
466 host->host_no, ec->irq, ret); 466 host->host_no, ec->irq, ret);
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index 3d69f6c45a6b..b2c346a47052 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -373,7 +373,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
373 goto out_free; 373 goto out_free;
374 374
375 ret = request_irq(ec->irq, powertecscsi_intr, 375 ret = request_irq(ec->irq, powertecscsi_intr,
376 SA_INTERRUPT, "powertec", info); 376 IRQF_DISABLED, "powertec", info);
377 if (ret) { 377 if (ret) {
378 printk("scsi%d: IRQ%d not free: %d\n", 378 printk("scsi%d: IRQ%d not free: %d\n",
379 host->host_no, ec->irq, ret); 379 host->host_no, ec->irq, ret);
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 3ee4d4d3f445..412f8301b757 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -2751,7 +2751,7 @@ flash_ok_880:
2751 goto unregister; 2751 goto unregister;
2752 } 2752 }
2753 2753
2754 if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp880i", shpnt)) { 2754 if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp880i", shpnt)) {
2755 printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq); 2755 printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq);
2756 goto free_tables; 2756 goto free_tables;
2757 } 2757 }
@@ -2822,7 +2822,7 @@ flash_ok_880:
2822#ifdef ED_DBGP 2822#ifdef ED_DBGP
2823 printk("request_irq() shpnt %p hostdata %p\n", shpnt, p); 2823 printk("request_irq() shpnt %p hostdata %p\n", shpnt, p);
2824#endif 2824#endif
2825 if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870u", shpnt)) { 2825 if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp870u", shpnt)) {
2826 printk(KERN_ERR "Unable to allocate IRQ for Acard controller.\n"); 2826 printk(KERN_ERR "Unable to allocate IRQ for Acard controller.\n");
2827 goto free_tables; 2827 goto free_tables;
2828 } 2828 }
@@ -3004,7 +3004,7 @@ flash_ok_885:
3004 if (atp870u_init_tables(shpnt) < 0) 3004 if (atp870u_init_tables(shpnt) < 0)
3005 goto unregister; 3005 goto unregister;
3006 3006
3007 if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870i", shpnt)) { 3007 if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp870i", shpnt)) {
3008 printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq); 3008 printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq);
3009 goto free_tables; 3009 goto free_tables;
3010 } 3010 }
diff --git a/drivers/scsi/blz1230.c b/drivers/scsi/blz1230.c
index 3867ac2de4c2..329a8f297b31 100644
--- a/drivers/scsi/blz1230.c
+++ b/drivers/scsi/blz1230.c
@@ -172,7 +172,7 @@ int __init blz1230_esp_detect(struct scsi_host_template *tpnt)
172 172
173 esp->irq = IRQ_AMIGA_PORTS; 173 esp->irq = IRQ_AMIGA_PORTS;
174 esp->slot = board+REAL_BLZ1230_ESP_ADDR; 174 esp->slot = board+REAL_BLZ1230_ESP_ADDR;
175 if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 175 if (request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
176 "Blizzard 1230 SCSI IV", esp->ehost)) 176 "Blizzard 1230 SCSI IV", esp->ehost))
177 goto err_out; 177 goto err_out;
178 178
diff --git a/drivers/scsi/blz2060.c b/drivers/scsi/blz2060.c
index 4ebe69e32756..b6c137b97350 100644
--- a/drivers/scsi/blz2060.c
+++ b/drivers/scsi/blz2060.c
@@ -146,7 +146,7 @@ int __init blz2060_esp_detect(struct scsi_host_template *tpnt)
146 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); 146 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer);
147 147
148 esp->irq = IRQ_AMIGA_PORTS; 148 esp->irq = IRQ_AMIGA_PORTS;
149 request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 149 request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
150 "Blizzard 2060 SCSI", esp->ehost); 150 "Blizzard 2060 SCSI", esp->ehost);
151 151
152 /* Figure out our scsi ID on the bus */ 152 /* Figure out our scsi ID on the bus */
diff --git a/drivers/scsi/cyberstorm.c b/drivers/scsi/cyberstorm.c
index a4a4fac5c0a1..7c7cfb54e897 100644
--- a/drivers/scsi/cyberstorm.c
+++ b/drivers/scsi/cyberstorm.c
@@ -172,7 +172,7 @@ int __init cyber_esp_detect(struct scsi_host_template *tpnt)
172 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); 172 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer);
173 173
174 esp->irq = IRQ_AMIGA_PORTS; 174 esp->irq = IRQ_AMIGA_PORTS;
175 request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 175 request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
176 "CyberStorm SCSI", esp->ehost); 176 "CyberStorm SCSI", esp->ehost);
177 /* Figure out our scsi ID on the bus */ 177 /* Figure out our scsi ID on the bus */
178 /* The DMA cond flag contains a hardcoded jumper bit 178 /* The DMA cond flag contains a hardcoded jumper bit
diff --git a/drivers/scsi/cyberstormII.c b/drivers/scsi/cyberstormII.c
index 3a803d73bc5f..d88cb9cf091e 100644
--- a/drivers/scsi/cyberstormII.c
+++ b/drivers/scsi/cyberstormII.c
@@ -153,7 +153,7 @@ int __init cyberII_esp_detect(struct scsi_host_template *tpnt)
153 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); 153 esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer);
154 154
155 esp->irq = IRQ_AMIGA_PORTS; 155 esp->irq = IRQ_AMIGA_PORTS;
156 request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 156 request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
157 "CyberStorm SCSI Mk II", esp->ehost); 157 "CyberStorm SCSI Mk II", esp->ehost);
158 158
159 /* Figure out our scsi ID on the bus */ 159 /* Figure out our scsi ID on the bus */
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 58b0748045ee..ff2b1796fa34 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4562,7 +4562,7 @@ static int __devinit adapter_init(struct AdapterCtlBlk *acb,
4562 acb->io_port_base = io_port; 4562 acb->io_port_base = io_port;
4563 acb->io_port_len = io_port_len; 4563 acb->io_port_len = io_port_len;
4564 4564
4565 if (request_irq(irq, dc395x_interrupt, SA_SHIRQ, DC395X_NAME, acb)) { 4565 if (request_irq(irq, dc395x_interrupt, IRQF_SHARED, DC395X_NAME, acb)) {
4566 /* release the region we just claimed */ 4566 /* release the region we just claimed */
4567 dprintkl(KERN_INFO, "Failed to register IRQ\n"); 4567 dprintkl(KERN_INFO, "Failed to register IRQ\n");
4568 goto failed; 4568 goto failed;
diff --git a/drivers/scsi/dec_esp.c b/drivers/scsi/dec_esp.c
index a35ee43a48df..eb32062f7e68 100644
--- a/drivers/scsi/dec_esp.c
+++ b/drivers/scsi/dec_esp.c
@@ -202,19 +202,19 @@ static int dec_esp_detect(struct scsi_host_template * tpnt)
202 202
203 esp_initialize(esp); 203 esp_initialize(esp);
204 204
205 if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 205 if (request_irq(esp->irq, esp_intr, IRQF_DISABLED,
206 "ncr53c94", esp->ehost)) 206 "ncr53c94", esp->ehost))
207 goto err_dealloc; 207 goto err_dealloc;
208 if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR], 208 if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR],
209 scsi_dma_merr_int, SA_INTERRUPT, 209 scsi_dma_merr_int, IRQF_DISABLED,
210 "ncr53c94 error", esp->ehost)) 210 "ncr53c94 error", esp->ehost))
211 goto err_free_irq; 211 goto err_free_irq;
212 if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR], 212 if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR],
213 scsi_dma_err_int, SA_INTERRUPT, 213 scsi_dma_err_int, IRQF_DISABLED,
214 "ncr53c94 overrun", esp->ehost)) 214 "ncr53c94 overrun", esp->ehost))
215 goto err_free_irq_merr; 215 goto err_free_irq_merr;
216 if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA], 216 if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA],
217 scsi_dma_int, SA_INTERRUPT, 217 scsi_dma_int, IRQF_DISABLED,
218 "ncr53c94 dma", esp->ehost)) 218 "ncr53c94 dma", esp->ehost))
219 goto err_free_irq_err; 219 goto err_free_irq_err;
220 220
@@ -276,7 +276,7 @@ static int dec_esp_detect(struct scsi_host_template * tpnt)
276 esp->dma_mmu_release_scsi_sgl = 0; 276 esp->dma_mmu_release_scsi_sgl = 0;
277 esp->dma_advance_sg = 0; 277 esp->dma_advance_sg = 0;
278 278
279 if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 279 if (request_irq(esp->irq, esp_intr, IRQF_DISABLED,
280 "PMAZ_AA", esp->ehost)) { 280 "PMAZ_AA", esp->ehost)) {
281 esp_deallocate(esp); 281 esp_deallocate(esp);
282 release_tc_card(slot); 282 release_tc_card(slot);
diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
index 38e4010eff96..879a26657676 100644
--- a/drivers/scsi/dmx3191d.c
+++ b/drivers/scsi/dmx3191d.c
@@ -94,7 +94,7 @@ static int __devinit dmx3191d_probe_one(struct pci_dev *pdev,
94 94
95 NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E); 95 NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
96 96
97 if (request_irq(pdev->irq, NCR5380_intr, SA_SHIRQ, 97 if (request_irq(pdev->irq, NCR5380_intr, IRQF_SHARED,
98 DMX3191D_DRIVER_NAME, shost)) { 98 DMX3191D_DRIVER_NAME, shost)) {
99 /* 99 /*
100 * Steam powered scsi controllers run without an IRQ anyway 100 * Steam powered scsi controllers run without an IRQ anyway
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index b1b704a42efd..e1337339cacc 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1009,7 +1009,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
1009 printk(KERN_INFO" BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size); 1009 printk(KERN_INFO" BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size);
1010 } 1010 }
1011 1011
1012 if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ, pHba->name, pHba)) { 1012 if (request_irq (pDev->irq, adpt_isr, IRQF_SHARED, pHba->name, pHba)) {
1013 printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq); 1013 printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq);
1014 adpt_i2o_delete_hba(pHba); 1014 adpt_i2o_delete_hba(pHba);
1015 return -EINVAL; 1015 return -EINVAL;
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index c5108c8c887b..0d5713dfa204 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -280,7 +280,7 @@ found:
280 /* With interrupts enabled, it will sometimes hang when doing heavy 280 /* With interrupts enabled, it will sometimes hang when doing heavy
281 * reads. So better not enable them until I finger it out. */ 281 * reads. So better not enable them until I finger it out. */
282 if (instance->irq != SCSI_IRQ_NONE) 282 if (instance->irq != SCSI_IRQ_NONE)
283 if (request_irq(instance->irq, dtc_intr, SA_INTERRUPT, "dtc", instance)) { 283 if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) {
284 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 284 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
285 instance->irq = SCSI_IRQ_NONE; 285 instance->irq = SCSI_IRQ_NONE;
286 } 286 }
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 67c419402d8a..a5ff43b1b263 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1221,7 +1221,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
1221 1221
1222 /* Board detected, allocate its IRQ */ 1222 /* Board detected, allocate its IRQ */
1223 if (request_irq(irq, do_interrupt_handler, 1223 if (request_irq(irq, do_interrupt_handler,
1224 SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0), 1224 IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0),
1225 driver_name, (void *)&sha[j])) { 1225 driver_name, (void *)&sha[j])) {
1226 printk("%s: unable to allocate IRQ %u, detaching.\n", name, 1226 printk("%s: unable to allocate IRQ %u, detaching.\n", name,
1227 irq); 1227 irq);
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index d8c9ec21e0ef..771b01984cbc 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -731,7 +731,7 @@ static int register_pio_HBA(long base, struct get_conf *gc)
731 return 0; 731 return 0;
732 732
733 if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */ 733 if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */
734 if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", sh)) { 734 if (!request_irq(gc->IRQ, do_eata_pio_int_handler, IRQF_DISABLED, "EATA-PIO", sh)) {
735 reg_IRQ[gc->IRQ]++; 735 reg_IRQ[gc->IRQ]++;
736 if (!gc->IRQ_TR) 736 if (!gc->IRQ_TR)
737 reg_IRQL[gc->IRQ] = 1; /* IRQ is edge triggered */ 737 reg_IRQL[gc->IRQ] = 1; /* IRQ is edge triggered */
@@ -965,7 +965,7 @@ static int eata_pio_detect(struct scsi_host_template *tpnt)
965 965
966 for (i = 0; i <= MAXIRQ; i++) 966 for (i = 0; i <= MAXIRQ; i++)
967 if (reg_IRQ[i]) 967 if (reg_IRQ[i])
968 request_irq(i, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", NULL); 968 request_irq(i, do_eata_pio_int_handler, IRQF_DISABLED, "EATA-PIO", NULL);
969 969
970 HBA_ptr = first_HBA; 970 HBA_ptr = first_HBA;
971 971
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c
index 36c50b61f94d..10573c24a50b 100644
--- a/drivers/scsi/esp.c
+++ b/drivers/scsi/esp.c
@@ -778,7 +778,7 @@ static int __init esp_register_irq(struct esp *esp)
778 * sanely maintain. 778 * sanely maintain.
779 */ 779 */
780 if (request_irq(esp->ehost->irq, esp_intr, 780 if (request_irq(esp->ehost->irq, esp_intr,
781 SA_SHIRQ, "ESP SCSI", esp)) { 781 IRQF_SHARED, "ESP SCSI", esp)) {
782 printk("esp%d: Cannot acquire irq line\n", 782 printk("esp%d: Cannot acquire irq line\n",
783 esp->esp_id); 783 esp->esp_id);
784 return -1; 784 return -1;
diff --git a/drivers/scsi/fastlane.c b/drivers/scsi/fastlane.c
index 8ae9c406a83b..2a1c5c22b9e0 100644
--- a/drivers/scsi/fastlane.c
+++ b/drivers/scsi/fastlane.c
@@ -210,7 +210,7 @@ int __init fastlane_esp_detect(struct scsi_host_template *tpnt)
210 210
211 esp->irq = IRQ_AMIGA_PORTS; 211 esp->irq = IRQ_AMIGA_PORTS;
212 esp->slot = board+FASTLANE_ESP_ADDR; 212 esp->slot = board+FASTLANE_ESP_ADDR;
213 if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 213 if (request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
214 "Fastlane SCSI", esp->ehost)) { 214 "Fastlane SCSI", esp->ehost)) {
215 printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS); 215 printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS);
216 goto err_unmap; 216 goto err_unmap;
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index 70a1606bd580..dde3edf35c03 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -400,7 +400,7 @@ static int fd_mcs_detect(struct scsi_host_template * tpnt)
400 mca_set_adapter_name(slot - 1, fd_mcs_adapters[loop].name); 400 mca_set_adapter_name(slot - 1, fd_mcs_adapters[loop].name);
401 401
402 /* check irq/region */ 402 /* check irq/region */
403 if (request_irq(irq, fd_mcs_intr, SA_SHIRQ, "fd_mcs", hosts)) { 403 if (request_irq(irq, fd_mcs_intr, IRQF_SHARED, "fd_mcs", hosts)) {
404 printk(KERN_ERR "fd_mcs: interrupt is not available, skipping...\n"); 404 printk(KERN_ERR "fd_mcs: interrupt is not available, skipping...\n");
405 continue; 405 continue;
406 } 406 }
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 03356887202d..b0694dcce246 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -949,7 +949,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
949 /* Register the IRQ with the kernel */ 949 /* Register the IRQ with the kernel */
950 950
951 retcode = request_irq( interrupt_level, 951 retcode = request_irq( interrupt_level,
952 do_fdomain_16x0_intr, pdev?SA_SHIRQ:0, "fdomain", shpnt); 952 do_fdomain_16x0_intr, pdev?IRQF_SHARED:0, "fdomain", shpnt);
953 953
954 if (retcode < 0) { 954 if (retcode < 0) {
955 if (retcode == -EINVAL) { 955 if (retcode == -EINVAL) {
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index fbc8e16c8d15..67f1100f3103 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -461,7 +461,7 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
461 instance->irq = NCR5380_probe_irq(instance, 0xffff); 461 instance->irq = NCR5380_probe_irq(instance, 0xffff);
462 462
463 if (instance->irq != SCSI_IRQ_NONE) 463 if (instance->irq != SCSI_IRQ_NONE)
464 if (request_irq(instance->irq, generic_NCR5380_intr, SA_INTERRUPT, "NCR5380", instance)) { 464 if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) {
465 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 465 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
466 instance->irq = SCSI_IRQ_NONE; 466 instance->irq = SCSI_IRQ_NONE;
467 } 467 }
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 76071a158306..43afd476e606 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4350,7 +4350,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
4350 printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n", 4350 printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n",
4351 isa_bios,ha->irq,ha->drq); 4351 isa_bios,ha->irq,ha->drq);
4352 4352
4353 if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) { 4353 if (request_irq(ha->irq,gdth_interrupt,IRQF_DISABLED,"gdth",ha)) {
4354 printk("GDT-ISA: Unable to allocate IRQ\n"); 4354 printk("GDT-ISA: Unable to allocate IRQ\n");
4355 scsi_unregister(shp); 4355 scsi_unregister(shp);
4356 continue; 4356 continue;
@@ -4476,7 +4476,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
4476 printk("Configuring GDT-EISA HA at Slot %d IRQ %u\n", 4476 printk("Configuring GDT-EISA HA at Slot %d IRQ %u\n",
4477 eisa_slot>>12,ha->irq); 4477 eisa_slot>>12,ha->irq);
4478 4478
4479 if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) { 4479 if (request_irq(ha->irq,gdth_interrupt,IRQF_DISABLED,"gdth",ha)) {
4480 printk("GDT-EISA: Unable to allocate IRQ\n"); 4480 printk("GDT-EISA: Unable to allocate IRQ\n");
4481 scsi_unregister(shp); 4481 scsi_unregister(shp);
4482 continue; 4482 continue;
@@ -4603,7 +4603,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
4603 pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); 4603 pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq);
4604 4604
4605 if (request_irq(ha->irq, gdth_interrupt, 4605 if (request_irq(ha->irq, gdth_interrupt,
4606 SA_INTERRUPT|SA_SHIRQ, "gdth", ha)) 4606 IRQF_DISABLED|IRQF_SHARED, "gdth", ha))
4607 { 4607 {
4608 printk("GDT-PCI: Unable to allocate IRQ\n"); 4608 printk("GDT-PCI: Unable to allocate IRQ\n");
4609 scsi_unregister(shp); 4609 scsi_unregister(shp);
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 5b154498056d..a0d831b1bada 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -328,7 +328,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
328 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 328 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
329 : WD33C93_FS_12_15); 329 : WD33C93_FS_12_15);
330 330
331 request_irq(IRQ_AMIGA_PORTS, gvp11_intr, SA_SHIRQ, "GVP11 SCSI", 331 request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI",
332 instance); 332 instance);
333 DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; 333 DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE;
334 num_gvp11++; 334 num_gvp11++;
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index f77808329e7c..ab2f8b267908 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1304,7 +1304,7 @@ static int __devinit hptiop_probe(struct pci_dev *pcidev,
1304 1304
1305 pci_set_drvdata(pcidev, host); 1305 pci_set_drvdata(pcidev, host);
1306 1306
1307 if (request_irq(pcidev->irq, hptiop_intr, SA_SHIRQ, 1307 if (request_irq(pcidev->irq, hptiop_intr, IRQF_SHARED,
1308 driver_name, hba)) { 1308 driver_name, hba)) {
1309 printk(KERN_ERR "scsi%d: request irq %d failed\n", 1309 printk(KERN_ERR "scsi%d: request irq %d failed\n",
1310 hba->host->host_no, pcidev->irq); 1310 hba->host->host_no, pcidev->irq);
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index 1cbc94842cc6..2be1dc5d852a 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -1510,7 +1510,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template)
1510#endif 1510#endif
1511 1511
1512 /* get interrupt request level */ 1512 /* get interrupt request level */
1513 if (request_irq(IM_IRQ, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) { 1513 if (request_irq(IM_IRQ, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts)) {
1514 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ); 1514 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ);
1515 return 0; 1515 return 0;
1516 } else 1516 } else
@@ -1635,7 +1635,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template)
1635 /* IRQ11 is used by SCSI-2 F/W Adapter/A */ 1635 /* IRQ11 is used by SCSI-2 F/W Adapter/A */
1636 printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n"); 1636 printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n");
1637 /* get interrupt request level */ 1637 /* get interrupt request level */
1638 if (request_irq(IM_IRQ_FW, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) { 1638 if (request_irq(IM_IRQ_FW, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts)) {
1639 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW); 1639 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW);
1640 } else 1640 } else
1641 IRQ11_registered++; 1641 IRQ11_registered++;
@@ -1696,7 +1696,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template)
1696 /* IRQ11 is used by SCSI-2 F/W Adapter/A */ 1696 /* IRQ11 is used by SCSI-2 F/W Adapter/A */
1697 printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n"); 1697 printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n");
1698 /* get interrupt request level */ 1698 /* get interrupt request level */
1699 if (request_irq(IM_IRQ_FW, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) 1699 if (request_irq(IM_IRQ_FW, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts))
1700 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW); 1700 printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW);
1701 else 1701 else
1702 IRQ11_registered++; 1702 IRQ11_registered++;
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index 883bc92b4d9a..59a4097f1254 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2015,7 +2015,7 @@ static int __init in2000_detect(struct scsi_host_template * tpnt)
2015 write1_io(0, IO_FIFO_READ); /* start fifo out in read mode */ 2015 write1_io(0, IO_FIFO_READ); /* start fifo out in read mode */
2016 write1_io(0, IO_INTR_MASK); /* allow all ints */ 2016 write1_io(0, IO_INTR_MASK); /* allow all ints */
2017 x = int_tab[(switches & (SW_INT0 | SW_INT1)) >> SW_INT_SHIFT]; 2017 x = int_tab[(switches & (SW_INT0 | SW_INT1)) >> SW_INT_SHIFT];
2018 if (request_irq(x, in2000_intr, SA_INTERRUPT, "in2000", instance)) { 2018 if (request_irq(x, in2000_intr, IRQF_DISABLED, "in2000", instance)) {
2019 printk("in2000_detect: Unable to allocate IRQ.\n"); 2019 printk("in2000_detect: Unable to allocate IRQ.\n");
2020 detect_count--; 2020 detect_count--;
2021 continue; 2021 continue;
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 43acb1fe90b4..9e10dac61cfd 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2867,7 +2867,7 @@ static int i91u_detect(struct scsi_host_template * tpnt)
2867 hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ 2867 hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */
2868 2868
2869 /* Initial tulip chip */ 2869 /* Initial tulip chip */
2870 ok = request_irq(pHCB->HCS_Intr, i91u_intr, SA_INTERRUPT | SA_SHIRQ, "i91u", hreg); 2870 ok = request_irq(pHCB->HCS_Intr, i91u_intr, IRQF_DISABLED | IRQF_SHARED, "i91u", hreg);
2871 if (ok < 0) { 2871 if (ok < 0) {
2872 printk(KERN_WARNING "i91u: unable to request IRQ %d\n\n", pHCB->HCS_Intr); 2872 printk(KERN_WARNING "i91u: unable to request IRQ %d\n\n", pHCB->HCS_Intr);
2873 return 0; 2873 return 0;
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e19bf690cdf1..01080b3acf5e 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6428,7 +6428,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
6428 ioa_cfg->needs_hard_reset = 1; 6428 ioa_cfg->needs_hard_reset = 1;
6429 6429
6430 ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); 6430 ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER);
6431 rc = request_irq(pdev->irq, ipr_isr, SA_SHIRQ, IPR_NAME, ioa_cfg); 6431 rc = request_irq(pdev->irq, ipr_isr, IRQF_SHARED, IPR_NAME, ioa_cfg);
6432 6432
6433 if (rc) { 6433 if (rc) {
6434 dev_err(&pdev->dev, "Couldn't register IRQ %d! rc=%d\n", 6434 dev_err(&pdev->dev, "Couldn't register IRQ %d! rc=%d\n",
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 7436793c3ad3..3c639286ec1e 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -7007,7 +7007,7 @@ ips_register_scsi(int index)
7007 memcpy(ha, oldha, sizeof (ips_ha_t)); 7007 memcpy(ha, oldha, sizeof (ips_ha_t));
7008 free_irq(oldha->irq, oldha); 7008 free_irq(oldha->irq, oldha);
7009 /* Install the interrupt handler with the new ha */ 7009 /* Install the interrupt handler with the new ha */
7010 if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) { 7010 if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) {
7011 IPS_PRINTK(KERN_WARNING, ha->pcidev, 7011 IPS_PRINTK(KERN_WARNING, ha->pcidev,
7012 "Unable to install interrupt handler\n"); 7012 "Unable to install interrupt handler\n");
7013 scsi_host_put(sh); 7013 scsi_host_put(sh);
@@ -7419,7 +7419,7 @@ ips_init_phase2(int index)
7419 } 7419 }
7420 7420
7421 /* Install the interrupt handler */ 7421 /* Install the interrupt handler */
7422 if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) { 7422 if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) {
7423 IPS_PRINTK(KERN_WARNING, ha->pcidev, 7423 IPS_PRINTK(KERN_WARNING, ha->pcidev,
7424 "Unable to install interrupt handler\n"); 7424 "Unable to install interrupt handler\n");
7425 return ips_abort_init(ha, index); 7425 return ips_abort_init(ha, index);
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index fc031c76dade..3fd8a96f2af3 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -131,7 +131,7 @@ static int jazz_esp_detect(struct scsi_host_template *tpnt)
131 esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer)); 131 esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer));
132 132
133 esp->irq = JAZZ_SCSI_IRQ; 133 esp->irq = JAZZ_SCSI_IRQ;
134 request_irq(JAZZ_SCSI_IRQ, esp_intr, SA_INTERRUPT, "JAZZ SCSI", 134 request_irq(JAZZ_SCSI_IRQ, esp_intr, IRQF_DISABLED, "JAZZ SCSI",
135 esp->ehost); 135 esp->ehost);
136 136
137 /* 137 /*
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
index eb7bd310cc82..f0871c3ac3d9 100644
--- a/drivers/scsi/lasi700.c
+++ b/drivers/scsi/lasi700.c
@@ -131,7 +131,7 @@ lasi700_probe(struct parisc_device *dev)
131 host->this_id = 7; 131 host->this_id = 7;
132 host->base = base; 132 host->base = base;
133 host->irq = dev->irq; 133 host->irq = dev->irq;
134 if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) { 134 if(request_irq(dev->irq, NCR_700_intr, IRQF_SHARED, "lasi700", host)) {
135 printk(KERN_ERR "lasi700: request_irq failed!\n"); 135 printk(KERN_ERR "lasi700: request_irq failed!\n");
136 goto out_put_host; 136 goto out_put_host;
137 } 137 }
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index 38bfebf4fe8f..9ce221f25954 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -853,7 +853,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
853 return NULL; 853 return NULL;
854 854
855 probe_ent->irq = pdev->irq; 855 probe_ent->irq = pdev->irq;
856 probe_ent->irq_flags = SA_SHIRQ; 856 probe_ent->irq_flags = IRQF_SHARED;
857 probe_ent->private_data = port[0]->private_data; 857 probe_ent->private_data = port[0]->private_data;
858 858
859 if (ports & ATA_PORT_PRIMARY) { 859 if (ports & ATA_PORT_PRIMARY) {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 908d0f27706f..5a28d9bf8e4d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1620,7 +1620,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1620 if (error) 1620 if (error)
1621 goto out_remove_host; 1621 goto out_remove_host;
1622 1622
1623 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, 1623 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED,
1624 LPFC_DRIVER_NAME, phba); 1624 LPFC_DRIVER_NAME, phba);
1625 if (error) { 1625 if (error) {
1626 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1626 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 5d2cefb5e52d..76edbb639d37 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4714,7 +4714,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4714 4714
4715 if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ? 4715 if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ?
4716 megaraid_isr_memmapped : megaraid_isr_iomapped, 4716 megaraid_isr_memmapped : megaraid_isr_iomapped,
4717 SA_SHIRQ, "megaraid", adapter)) { 4717 IRQF_SHARED, "megaraid", adapter)) {
4718 printk(KERN_WARNING 4718 printk(KERN_WARNING
4719 "megaraid: Couldn't register IRQ %d!\n", irq); 4719 "megaraid: Couldn't register IRQ %d!\n", irq);
4720 goto out_free_scb_list; 4720 goto out_free_scb_list;
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index b7caf60638e8..92715130ac09 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -767,7 +767,7 @@ megaraid_init_mbox(adapter_t *adapter)
767 // 767 //
768 768
769 // request IRQ and register the interrupt service routine 769 // request IRQ and register the interrupt service routine
770 if (request_irq(adapter->irq, megaraid_isr, SA_SHIRQ, "megaraid", 770 if (request_irq(adapter->irq, megaraid_isr, IRQF_SHARED, "megaraid",
771 adapter)) { 771 adapter)) {
772 772
773 con_log(CL_ANN, (KERN_WARNING 773 con_log(CL_ANN, (KERN_WARNING
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 0c9516ff636f..e5c017ccda59 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -2191,7 +2191,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2191 /* 2191 /*
2192 * Register IRQ 2192 * Register IRQ
2193 */ 2193 */
2194 if (request_irq(pdev->irq, megasas_isr, SA_SHIRQ, "megasas", instance)) { 2194 if (request_irq(pdev->irq, megasas_isr, IRQF_SHARED, "megasas", instance)) {
2195 printk(KERN_DEBUG "megasas: Failed to register IRQ\n"); 2195 printk(KERN_DEBUG "megasas: Failed to register IRQ\n");
2196 goto fail_irq; 2196 goto fail_irq;
2197 } 2197 }
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 5c55e152e718..bd337a914298 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -2867,7 +2867,7 @@ static int nsp32_detect(struct scsi_host_template *sht)
2867 nsp32_do_bus_reset(data); 2867 nsp32_do_bus_reset(data);
2868 2868
2869 ret = request_irq(host->irq, do_nsp32_isr, 2869 ret = request_irq(host->irq, do_nsp32_isr,
2870 SA_SHIRQ | SA_SAMPLE_RANDOM, "nsp32", data); 2870 IRQF_SHARED | IRQF_SAMPLE_RANDOM, "nsp32", data);
2871 if (ret < 0) { 2871 if (ret < 0) {
2872 nsp32_msg(KERN_ERR, "Unable to allocate IRQ for NinjaSCSI32 " 2872 nsp32_msg(KERN_ERR, "Unable to allocate IRQ for NinjaSCSI32 "
2873 "SCSI PCI controller. Interrupt: %d", host->irq); 2873 "SCSI PCI controller. Interrupt: %d", host->irq);
diff --git a/drivers/scsi/oktagon_esp.c b/drivers/scsi/oktagon_esp.c
index d7a0bcc6c670..dd67a68c5c23 100644
--- a/drivers/scsi/oktagon_esp.c
+++ b/drivers/scsi/oktagon_esp.c
@@ -197,7 +197,7 @@ int oktagon_esp_detect(struct scsi_host_template *tpnt)
197 esp->esp_command_dvma = (__u32) cmd_buffer; 197 esp->esp_command_dvma = (__u32) cmd_buffer;
198 198
199 esp->irq = IRQ_AMIGA_PORTS; 199 esp->irq = IRQ_AMIGA_PORTS;
200 request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, 200 request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED,
201 "BSC Oktagon SCSI", esp->ehost); 201 "BSC Oktagon SCSI", esp->ehost);
202 202
203 /* Figure out our scsi ID on the bus */ 203 /* Figure out our scsi ID on the bus */
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index 1bf96ed8f935..1434209a8ac5 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -454,7 +454,7 @@ int __init pas16_detect(struct scsi_host_template * tpnt)
454 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); 454 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
455 455
456 if (instance->irq != SCSI_IRQ_NONE) 456 if (instance->irq != SCSI_IRQ_NONE)
457 if (request_irq(instance->irq, pas16_intr, SA_INTERRUPT, "pas16", instance)) { 457 if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) {
458 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 458 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
459 instance->host_no, instance->irq); 459 instance->host_no, instance->irq);
460 instance->irq = SCSI_IRQ_NONE; 460 instance->irq = SCSI_IRQ_NONE;
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 231f9c311c69..7ff5851c040b 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1623,7 +1623,7 @@ static int nsp_cs_probe(struct pcmcia_device *link)
1623 /* Interrupt handler */ 1623 /* Interrupt handler */
1624 link->irq.Handler = &nspintr; 1624 link->irq.Handler = &nspintr;
1625 link->irq.Instance = info; 1625 link->irq.Instance = info;
1626 link->irq.Attributes |= (SA_SHIRQ | SA_SAMPLE_RANDOM); 1626 link->irq.Attributes |= (IRQF_SHARED | IRQF_SAMPLE_RANDOM);
1627 1627
1628 /* General socket configuration */ 1628 /* General socket configuration */
1629 link->conf.Attributes = CONF_ENABLE_IRQ; 1629 link->conf.Attributes = CONF_ENABLE_IRQ;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 9f59827707f0..0b65099acb1a 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -799,7 +799,7 @@ next_entry:
799 data = (struct sym53c500_data *)host->hostdata; 799 data = (struct sym53c500_data *)host->hostdata;
800 800
801 if (irq_level > 0) { 801 if (irq_level > 0) {
802 if (request_irq(irq_level, SYM53C500_intr, SA_SHIRQ, "SYM53C500", host)) { 802 if (request_irq(irq_level, SYM53C500_intr, IRQF_SHARED, "SYM53C500", host)) {
803 printk("SYM53C500: unable to allocate IRQ %d\n", irq_level); 803 printk("SYM53C500: unable to allocate IRQ %d\n", irq_level);
804 goto err_free_scsi; 804 goto err_free_scsi;
805 } 805 }
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 7ebe8e03aa96..d1f38c32aa15 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -690,7 +690,7 @@ static int adma_ata_init_one(struct pci_dev *pdev,
690 probe_ent->port_ops = adma_port_info[board_idx].port_ops; 690 probe_ent->port_ops = adma_port_info[board_idx].port_ops;
691 691
692 probe_ent->irq = pdev->irq; 692 probe_ent->irq = pdev->irq;
693 probe_ent->irq_flags = SA_SHIRQ; 693 probe_ent->irq_flags = IRQF_SHARED;
694 probe_ent->mmio_base = mmio_base; 694 probe_ent->mmio_base = mmio_base;
695 probe_ent->n_ports = ADMA_PORTS; 695 probe_ent->n_ports = ADMA_PORTS;
696 696
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index a7e4183462b8..b818b9bfe678 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -192,7 +192,7 @@
192 - Don't walk the entire list in qla1280_putq_t() just to directly 192 - Don't walk the entire list in qla1280_putq_t() just to directly
193 grab the pointer to the last element afterwards 193 grab the pointer to the last element afterwards
194 Rev 3.23.5 Beta August 9, 2001, Jes Sorensen 194 Rev 3.23.5 Beta August 9, 2001, Jes Sorensen
195 - Don't use SA_INTERRUPT, it's use is deprecated for this kinda driver 195 - Don't use IRQF_DISABLED, it's use is deprecated for this kinda driver
196 Rev 3.23.4 Beta August 8, 2001, Jes Sorensen 196 Rev 3.23.4 Beta August 8, 2001, Jes Sorensen
197 - Set dev->max_sectors to 1024 197 - Set dev->max_sectors to 1024
198 Rev 3.23.3 Beta August 6, 2001, Jes Sorensen 198 Rev 3.23.3 Beta August 6, 2001, Jes Sorensen
@@ -4369,7 +4369,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4369 /* Disable ISP interrupts. */ 4369 /* Disable ISP interrupts. */
4370 qla1280_disable_intrs(ha); 4370 qla1280_disable_intrs(ha);
4371 4371
4372 if (request_irq(pdev->irq, qla1280_intr_handler, SA_SHIRQ, 4372 if (request_irq(pdev->irq, qla1280_intr_handler, IRQF_SHARED,
4373 "qla1280", ha)) { 4373 "qla1280", ha)) {
4374 printk("qla1280 : Failed to reserve interrupt %d already " 4374 printk("qla1280 : Failed to reserve interrupt %d already "
4375 "in use\n", pdev->irq); 4375 "in use\n", pdev->irq);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ccaad0b08d35..93062593ebe7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1541,7 +1541,7 @@ static int qla2x00_probe_one(struct pci_dev *pdev)
1541 host->transportt = qla2xxx_transport_template; 1541 host->transportt = qla2xxx_transport_template;
1542 1542
1543 ret = request_irq(pdev->irq, ha->isp_ops.intr_handler, 1543 ret = request_irq(pdev->irq, ha->isp_ops.intr_handler,
1544 SA_INTERRUPT|SA_SHIRQ, QLA2XXX_DRIVER_NAME, ha); 1544 IRQF_DISABLED|IRQF_SHARED, QLA2XXX_DRIVER_NAME, ha);
1545 if (ret) { 1545 if (ret) {
1546 qla_printk(KERN_WARNING, ha, 1546 qla_printk(KERN_WARNING, ha,
1547 "Failed to reserve interrupt %d already in use.\n", 1547 "Failed to reserve interrupt %d already in use.\n",
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 329ead263714..69e0551a81d2 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -718,7 +718,7 @@ static int __init qpti_register_irq(struct qlogicpti *qpti)
718 * sanely maintain. 718 * sanely maintain.
719 */ 719 */
720 if (request_irq(qpti->irq, qpti_intr, 720 if (request_irq(qpti->irq, qpti_intr,
721 SA_SHIRQ, "Qlogic/PTI", qpti)) 721 IRQF_SHARED, "Qlogic/PTI", qpti))
722 goto fail; 722 goto fail;
723 723
724 printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); 724 printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 4a71578df3c1..1053c7c76b7d 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -2395,7 +2395,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2395 probe_ent->port_ops = mv_port_info[board_idx].port_ops; 2395 probe_ent->port_ops = mv_port_info[board_idx].port_ops;
2396 2396
2397 probe_ent->irq = pdev->irq; 2397 probe_ent->irq = pdev->irq;
2398 probe_ent->irq_flags = SA_SHIRQ; 2398 probe_ent->irq_flags = IRQF_SHARED;
2399 probe_ent->mmio_base = mmio_base; 2399 probe_ent->mmio_base = mmio_base;
2400 probe_ent->private_data = hpriv; 2400 probe_ent->private_data = hpriv;
2401 2401
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index b2b6ed5216e0..64631bd38952 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -743,7 +743,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
743 probe_ent->port_ops = pdc_port_info[board_idx].port_ops; 743 probe_ent->port_ops = pdc_port_info[board_idx].port_ops;
744 744
745 probe_ent->irq = pdev->irq; 745 probe_ent->irq = pdev->irq;
746 probe_ent->irq_flags = SA_SHIRQ; 746 probe_ent->irq_flags = IRQF_SHARED;
747 probe_ent->mmio_base = mmio_base; 747 probe_ent->mmio_base = mmio_base;
748 748
749 pdc_ata_setup_port(&probe_ent->port[0], base + 0x200); 749 pdc_ata_setup_port(&probe_ent->port[0], base + 0x200);
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 98ddc25655f0..d374c1db0cf3 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -680,7 +680,7 @@ static int qs_ata_init_one(struct pci_dev *pdev,
680 probe_ent->port_ops = qs_port_info[board_idx].port_ops; 680 probe_ent->port_ops = qs_port_info[board_idx].port_ops;
681 681
682 probe_ent->irq = pdev->irq; 682 probe_ent->irq = pdev->irq;
683 probe_ent->irq_flags = SA_SHIRQ; 683 probe_ent->irq_flags = IRQF_SHARED;
684 probe_ent->mmio_base = mmio_base; 684 probe_ent->mmio_base = mmio_base;
685 probe_ent->n_ports = QS_PORTS; 685 probe_ent->n_ports = QS_PORTS;
686 686
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 51d86d750e84..7aabb45c35e5 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -608,7 +608,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
608 probe_ent->mwdma_mask = sil_port_info[ent->driver_data].mwdma_mask; 608 probe_ent->mwdma_mask = sil_port_info[ent->driver_data].mwdma_mask;
609 probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask; 609 probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask;
610 probe_ent->irq = pdev->irq; 610 probe_ent->irq = pdev->irq;
611 probe_ent->irq_flags = SA_SHIRQ; 611 probe_ent->irq_flags = IRQF_SHARED;
612 probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; 612 probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags;
613 613
614 mmio_base = pci_iomap(pdev, 5, 0); 614 mmio_base = pci_iomap(pdev, 5, 0);
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index b5f8fa955679..07a1c6a8a414 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -1041,7 +1041,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1041 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); 1041 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags);
1042 1042
1043 probe_ent->irq = pdev->irq; 1043 probe_ent->irq = pdev->irq;
1044 probe_ent->irq_flags = SA_SHIRQ; 1044 probe_ent->irq_flags = IRQF_SHARED;
1045 probe_ent->mmio_base = port_base; 1045 probe_ent->mmio_base = port_base;
1046 probe_ent->private_data = hpriv; 1046 probe_ent->private_data = hpriv;
1047 1047
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index a958b45e597c..7d0858095e1f 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -428,7 +428,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
428 probe_ent->port_ops = &k2_sata_ops; 428 probe_ent->port_ops = &k2_sata_ops;
429 probe_ent->n_ports = 4; 429 probe_ent->n_ports = 4;
430 probe_ent->irq = pdev->irq; 430 probe_ent->irq = pdev->irq;
431 probe_ent->irq_flags = SA_SHIRQ; 431 probe_ent->irq_flags = IRQF_SHARED;
432 probe_ent->mmio_base = mmio_base; 432 probe_ent->mmio_base = mmio_base;
433 433
434 /* We don't care much about the PIO/UDMA masks, but the core won't like us 434 /* We don't care much about the PIO/UDMA masks, but the core won't like us
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 7f864410f7c2..ccc8cad24f7d 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -1436,7 +1436,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1436 probe_ent->port_ops = pdc_port_info[board_idx].port_ops; 1436 probe_ent->port_ops = pdc_port_info[board_idx].port_ops;
1437 1437
1438 probe_ent->irq = pdev->irq; 1438 probe_ent->irq = pdev->irq;
1439 probe_ent->irq_flags = SA_SHIRQ; 1439 probe_ent->irq_flags = IRQF_SHARED;
1440 probe_ent->mmio_base = mmio_base; 1440 probe_ent->mmio_base = mmio_base;
1441 1441
1442 probe_ent->private_data = hpriv; 1442 probe_ent->private_data = hpriv;
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 501ce1791782..03baec2191bf 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -242,7 +242,7 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev)
242 probe_ent->port_ops = &svia_sata_ops; 242 probe_ent->port_ops = &svia_sata_ops;
243 probe_ent->n_ports = N_PORTS; 243 probe_ent->n_ports = N_PORTS;
244 probe_ent->irq = pdev->irq; 244 probe_ent->irq = pdev->irq;
245 probe_ent->irq_flags = SA_SHIRQ; 245 probe_ent->irq_flags = IRQF_SHARED;
246 probe_ent->pio_mask = 0x1f; 246 probe_ent->pio_mask = 0x1f;
247 probe_ent->mwdma_mask = 0x07; 247 probe_ent->mwdma_mask = 0x07;
248 probe_ent->udma_mask = 0x7f; 248 probe_ent->udma_mask = 0x7f;
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 616fd9634b4b..916fe6fba756 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -400,7 +400,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
400 probe_ent->port_ops = &vsc_sata_ops; 400 probe_ent->port_ops = &vsc_sata_ops;
401 probe_ent->n_ports = 4; 401 probe_ent->n_ports = 4;
402 probe_ent->irq = pdev->irq; 402 probe_ent->irq = pdev->irq;
403 probe_ent->irq_flags = SA_SHIRQ; 403 probe_ent->irq_flags = IRQF_SHARED;
404 probe_ent->mmio_base = mmio_base; 404 probe_ent->mmio_base = mmio_base;
405 405
406 /* We don't care much about the PIO/UDMA masks, but the core won't like us 406 /* We don't care much about the PIO/UDMA masks, but the core won't like us
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
index 7fa4da4ea64f..3f312a84c6a7 100644
--- a/drivers/scsi/seagate.c
+++ b/drivers/scsi/seagate.c
@@ -497,7 +497,7 @@ int __init seagate_st0x_detect (struct scsi_host_template * tpnt)
497 return 0; 497 return 0;
498 498
499 hostno = instance->host_no; 499 hostno = instance->host_no;
500 if (request_irq (irq, do_seagate_reconnect_intr, SA_INTERRUPT, (controller_type == SEAGATE) ? "seagate" : "tmc-8xx", instance)) { 500 if (request_irq (irq, do_seagate_reconnect_intr, IRQF_DISABLED, (controller_type == SEAGATE) ? "seagate" : "tmc-8xx", instance)) {
501 printk(KERN_ERR "scsi%d : unable to allocate IRQ%d\n", hostno, irq); 501 printk(KERN_ERR "scsi%d : unable to allocate IRQ%d\n", hostno, irq);
502 return 0; 502 return 0;
503 } 503 }
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
index 2b2789345c13..b27e85428daa 100644
--- a/drivers/scsi/sim710.c
+++ b/drivers/scsi/sim710.c
@@ -133,7 +133,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
133 host->this_id = scsi_id; 133 host->this_id = scsi_id;
134 host->base = base_addr; 134 host->base = base_addr;
135 host->irq = irq; 135 host->irq = irq;
136 if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) { 136 if (request_irq(irq, NCR_700_intr, IRQF_SHARED, "sim710", host)) {
137 printk(KERN_ERR "sim710: request_irq failed\n"); 137 printk(KERN_ERR "sim710: request_irq failed\n");
138 goto out_put_host; 138 goto out_put_host;
139 } 139 }
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 2e2c1eb15636..1f328cae5c05 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -97,7 +97,7 @@ int sun3x_esp_detect(struct scsi_host_template *tpnt)
97 esp->esp_command_dvma = dvma_vtob((unsigned long)esp->esp_command); 97 esp->esp_command_dvma = dvma_vtob((unsigned long)esp->esp_command);
98 98
99 esp->irq = 2; 99 esp->irq = 2;
100 if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 100 if (request_irq(esp->irq, esp_intr, IRQF_DISABLED,
101 "SUN3X SCSI", esp->ehost)) { 101 "SUN3X SCSI", esp->ehost)) {
102 esp_deallocate(esp); 102 esp_deallocate(esp);
103 return 0; 103 return 0;
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index ea82d3df63af..8c505076c0eb 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1547,7 +1547,7 @@ static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt,
1547 * If we synchonize the C code with SCRIPTS on interrupt, 1547 * If we synchonize the C code with SCRIPTS on interrupt,
1548 * we do not want to share the INTR line at all. 1548 * we do not want to share the INTR line at all.
1549 */ 1549 */
1550 if (request_irq(pdev->irq, sym53c8xx_intr, SA_SHIRQ, NAME53C8XX, np)) { 1550 if (request_irq(pdev->irq, sym53c8xx_intr, IRQF_SHARED, NAME53C8XX, np)) {
1551 printf_err("%s: request irq %d failure\n", 1551 printf_err("%s: request irq %d failure\n",
1552 sym_name(np), pdev->irq); 1552 sym_name(np), pdev->irq);
1553 goto attach_failed; 1553 goto attach_failed;
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index a24f661b0270..2df6747cb76f 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -260,7 +260,7 @@ found:
260 instance->irq = NCR5380_probe_irq(instance, T128_IRQS); 260 instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
261 261
262 if (instance->irq != SCSI_IRQ_NONE) 262 if (instance->irq != SCSI_IRQ_NONE)
263 if (request_irq(instance->irq, t128_intr, SA_INTERRUPT, "t128", instance)) { 263 if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) {
264 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 264 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
265 instance->host_no, instance->irq); 265 instance->host_no, instance->irq);
266 instance->irq = SCSI_IRQ_NONE; 266 instance->irq = SCSI_IRQ_NONE;
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 7540f6a7529f..9404ff3d4c79 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2584,7 +2584,7 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev,
2584 /* Reset Pending INT */ 2584 /* Reset Pending INT */
2585 DC390_read8_(INT_Status, io_port); 2585 DC390_read8_(INT_Status, io_port);
2586 2586
2587 if (request_irq(pdev->irq, do_DC390_Interrupt, SA_SHIRQ, 2587 if (request_irq(pdev->irq, do_DC390_Interrupt, IRQF_SHARED,
2588 "tmscsim", pACB)) { 2588 "tmscsim", pACB)) {
2589 printk(KERN_ERR "DC390: register IRQ error!\n"); 2589 printk(KERN_ERR "DC390: register IRQ error!\n");
2590 goto out_release_region; 2590 goto out_release_region;
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 35c043e38ed4..57449611e714 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -872,7 +872,7 @@ static int port_detect \
872 872
873 /* Board detected, allocate its IRQ */ 873 /* Board detected, allocate its IRQ */
874 if (request_irq(irq, do_interrupt_handler, 874 if (request_irq(irq, do_interrupt_handler,
875 SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0), 875 IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0),
876 driver_name, (void *) &sha[j])) { 876 driver_name, (void *) &sha[j])) {
877 printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq); 877 printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq);
878 goto freelock; 878 goto freelock;
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 574955b78a24..a0b61af48f1c 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1250,7 +1250,7 @@ static int wd7000_init(Adapter * host)
1250 return 0; 1250 return 0;
1251 1251
1252 1252
1253 if (request_irq(host->irq, wd7000_intr, SA_INTERRUPT, "wd7000", host)) { 1253 if (request_irq(host->irq, wd7000_intr, IRQF_DISABLED, "wd7000", host)) {
1254 printk("wd7000_init: can't get IRQ %d.\n", host->irq); 1254 printk("wd7000_init: can't get IRQ %d.\n", host->irq);
1255 return (0); 1255 return (0);
1256 } 1256 }
diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
index a6cfbb3b361c..4b5f908d35c3 100644
--- a/drivers/scsi/zalon.c
+++ b/drivers/scsi/zalon.c
@@ -136,7 +136,7 @@ zalon_probe(struct parisc_device *dev)
136 if (!host) 136 if (!host)
137 goto fail; 137 goto fail;
138 138
139 if (request_irq(dev->irq, ncr53c8xx_intr, SA_SHIRQ, "zalon", host)) { 139 if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) {
140 printk(KERN_ERR "%s: irq problem with %d, detaching\n ", 140 printk(KERN_ERR "%s: irq problem with %d, detaching\n ",
141 dev->dev.bus_id, dev->irq); 141 dev->dev.bus_id, dev->irq);
142 goto fail; 142 goto fail;
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 9c5d36f50140..0995430e4cf1 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -48,7 +48,7 @@
48 48
49/* 49/*
50 * Configuration: 50 * Configuration:
51 * share_irqs - whether we pass SA_SHIRQ to request_irq(). This option 51 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option
52 * is unsafe when used on edge-triggered interrupts. 52 * is unsafe when used on edge-triggered interrupts.
53 */ 53 */
54static unsigned int share_irqs = SERIAL8250_SHARE_IRQS; 54static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
@@ -1400,7 +1400,7 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up)
1400static int serial_link_irq_chain(struct uart_8250_port *up) 1400static int serial_link_irq_chain(struct uart_8250_port *up)
1401{ 1401{
1402 struct irq_info *i = irq_lists + up->port.irq; 1402 struct irq_info *i = irq_lists + up->port.irq;
1403 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0; 1403 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
1404 1404
1405 spin_lock_irq(&i->lock); 1405 spin_lock_irq(&i->lock);
1406 1406
diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c
index 7b3b3f3d5101..a7d664383dae 100644
--- a/drivers/serial/at91_serial.c
+++ b/drivers/serial/at91_serial.c
@@ -387,7 +387,7 @@ static int at91_startup(struct uart_port *port)
387 /* 387 /*
388 * Allocate the IRQ 388 * Allocate the IRQ
389 */ 389 */
390 retval = request_irq(port->irq, at91_interrupt, SA_SHIRQ, "at91_serial", port); 390 retval = request_irq(port->irq, at91_interrupt, IRQF_SHARED, "at91_serial", port);
391 if (retval) { 391 if (retval) {
392 printk("at91_serial: at91_startup - Can't get irq\n"); 392 printk("at91_serial: at91_startup - Can't get irq\n");
393 return retval; 393 return retval;
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 901be3483455..cabd048c8636 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -415,7 +415,7 @@
415 * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when 415 * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when
416 * closing the last filehandle, NASTY!. 416 * closing the last filehandle, NASTY!.
417 * Added break generation, not tested though! 417 * Added break generation, not tested though!
418 * Use SA_SHIRQ when request_irq() for ser2 and ser3 (shared with) par0 and par1. 418 * Use IRQF_SHARED when request_irq() for ser2 and ser3 (shared with) par0 and par1.
419 * You can't use them at the same time (yet..), but you can hopefully switch 419 * You can't use them at the same time (yet..), but you can hopefully switch
420 * between ser2/par0, ser3/par1 with the same kernel config. 420 * between ser2/par0, ser3/par1 with the same kernel config.
421 * Replaced some magic constants with defines 421 * Replaced some magic constants with defines
@@ -4942,55 +4942,55 @@ rs_init(void)
4942 /* Not needed in simulator. May only complicate stuff. */ 4942 /* Not needed in simulator. May only complicate stuff. */
4943 /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ 4943 /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */
4944 4944
4945 if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL)) 4945 if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL))
4946 panic("irq8"); 4946 panic("irq8");
4947 4947
4948#ifdef CONFIG_ETRAX_SERIAL_PORT0 4948#ifdef CONFIG_ETRAX_SERIAL_PORT0
4949#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT 4949#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
4950 if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL)) 4950 if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 0 dma tr", NULL))
4951 panic("irq22"); 4951 panic("irq22");
4952#endif 4952#endif
4953#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN 4953#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
4954 if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL)) 4954 if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 0 dma rec", NULL))
4955 panic("irq23"); 4955 panic("irq23");
4956#endif 4956#endif
4957#endif 4957#endif
4958 4958
4959#ifdef CONFIG_ETRAX_SERIAL_PORT1 4959#ifdef CONFIG_ETRAX_SERIAL_PORT1
4960#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT 4960#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
4961 if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL)) 4961 if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 1 dma tr", NULL))
4962 panic("irq24"); 4962 panic("irq24");
4963#endif 4963#endif
4964#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN 4964#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
4965 if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL)) 4965 if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 1 dma rec", NULL))
4966 panic("irq25"); 4966 panic("irq25");
4967#endif 4967#endif
4968#endif 4968#endif
4969#ifdef CONFIG_ETRAX_SERIAL_PORT2 4969#ifdef CONFIG_ETRAX_SERIAL_PORT2
4970 /* DMA Shared with par0 (and SCSI0 and ATA) */ 4970 /* DMA Shared with par0 (and SCSI0 and ATA) */
4971#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT 4971#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
4972 if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma tr", NULL)) 4972 if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma tr", NULL))
4973 panic("irq18"); 4973 panic("irq18");
4974#endif 4974#endif
4975#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN 4975#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
4976 if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma rec", NULL)) 4976 if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma rec", NULL))
4977 panic("irq19"); 4977 panic("irq19");
4978#endif 4978#endif
4979#endif 4979#endif
4980#ifdef CONFIG_ETRAX_SERIAL_PORT3 4980#ifdef CONFIG_ETRAX_SERIAL_PORT3
4981 /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */ 4981 /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */
4982#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT 4982#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
4983 if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma tr", NULL)) 4983 if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma tr", NULL))
4984 panic("irq20"); 4984 panic("irq20");
4985#endif 4985#endif
4986#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN 4986#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
4987 if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma rec", NULL)) 4987 if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma rec", NULL))
4988 panic("irq21"); 4988 panic("irq21");
4989#endif 4989#endif
4990#endif 4990#endif
4991 4991
4992#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST 4992#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
4993 if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ | SA_INTERRUPT, 4993 if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, IRQF_SHARED | IRQF_DISABLED,
4994 "fast serial dma timeout", NULL)) { 4994 "fast serial dma timeout", NULL)) {
4995 printk(KERN_CRIT "err: timer1 irq\n"); 4995 printk(KERN_CRIT "err: timer1 irq\n");
4996 } 4996 }
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index ecf824bd2d4e..d119c8296a78 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -797,7 +797,7 @@ int __init dz_init(void)
797 restore_flags(flags); 797 restore_flags(flags);
798 798
799 if (request_irq(dz_ports[0].port.irq, dz_interrupt, 799 if (request_irq(dz_ports[0].port.irq, dz_interrupt,
800 SA_INTERRUPT, "DZ", &dz_ports[0])) 800 IRQF_DISABLED, "DZ", &dz_ports[0]))
801 panic("Unable to register DZ interrupt"); 801 panic("Unable to register DZ interrupt");
802 802
803 ret = uart_register_driver(&dz_reg); 803 ret = uart_register_driver(&dz_reg);
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index ad1e753cbc53..a3c00a252149 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -1563,7 +1563,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
1563 1563
1564 /* save off irq and request irq line */ 1564 /* save off irq and request irq line */
1565 if ( (retval = request_irq(dev->irq, icom_interrupt, 1565 if ( (retval = request_irq(dev->irq, icom_interrupt,
1566 SA_INTERRUPT | SA_SHIRQ, ICOM_DRIVER_NAME, 1566 IRQF_DISABLED | IRQF_SHARED, ICOM_DRIVER_NAME,
1567 (void *) icom_adapter))) { 1567 (void *) icom_adapter))) {
1568 goto probe_exit2; 1568 goto probe_exit2;
1569 } 1569 }
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 0b5f39d038b9..4a142d6b8f38 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -404,7 +404,7 @@ static int imx_startup(struct uart_port *port)
404 if (retval) goto error_out2; 404 if (retval) goto error_out2;
405 405
406 retval = request_irq(sport->rtsirq, imx_rtsint, 406 retval = request_irq(sport->rtsirq, imx_rtsint,
407 SA_TRIGGER_FALLING | SA_TRIGGER_RISING, 407 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
408 DRIVER_NAME, sport); 408 DRIVER_NAME, sport);
409 if (retval) goto error_out3; 409 if (retval) goto error_out3;
410 410
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 717e47bbd784..576ca1eaa2b6 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -2855,7 +2855,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2855 control->ic_soft = soft; 2855 control->ic_soft = soft;
2856 2856
2857 /* Hook up interrupt handler */ 2857 /* Hook up interrupt handler */
2858 if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, 2858 if (!request_irq(idd->idd_pdev->irq, ioc4_intr, IRQF_SHARED,
2859 "sgi-ioc4serial", soft)) { 2859 "sgi-ioc4serial", soft)) {
2860 control->ic_irq = idd->idd_pdev->irq; 2860 control->ic_irq = idd->idd_pdev->irq;
2861 } else { 2861 } else {
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index b3e1f71be4da..244f63be3a03 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -121,7 +121,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
121 } 121 }
122 122
123 rc = request_irq(brd->irq, brd->bd_ops->intr, 123 rc = request_irq(brd->irq, brd->bd_ops->intr,
124 SA_INTERRUPT|SA_SHIRQ, "JSM", brd); 124 IRQF_DISABLED|IRQF_SHARED, "JSM", brd);
125 if (rc) { 125 if (rc) {
126 printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq); 126 printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq);
127 goto out_iounmap; 127 goto out_iounmap;
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index fbaae96f4c93..e7fe4bb46eca 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -542,7 +542,7 @@ static void serial_do_unlink(struct irq_info *i, struct uart_sio_port *up)
542static int serial_link_irq_chain(struct uart_sio_port *up) 542static int serial_link_irq_chain(struct uart_sio_port *up)
543{ 543{
544 struct irq_info *i = irq_lists + up->port.irq; 544 struct irq_info *i = irq_lists + up->port.irq;
545 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0; 545 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
546 546
547 spin_lock_irq(&i->lock); 547 spin_lock_irq(&i->lock);
548 548
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 29c0630e3e64..832abd3c4706 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -1596,7 +1596,7 @@ static void mcfrs_irqinit(struct mcf_serial *info)
1596 /* Clear mask, so no surprise interrupts. */ 1596 /* Clear mask, so no surprise interrupts. */
1597 uartp[MCFUART_UIMR] = 0; 1597 uartp[MCFUART_UIMR] = 0;
1598 1598
1599 if (request_irq(info->irq, mcfrs_interrupt, SA_INTERRUPT, 1599 if (request_irq(info->irq, mcfrs_interrupt, IRQF_DISABLED,
1600 "ColdFire UART", NULL)) { 1600 "ColdFire UART", NULL)) {
1601 printk("MCFRS: Unable to attach ColdFire UART %d interrupt " 1601 printk("MCFRS: Unable to attach ColdFire UART %d interrupt "
1602 "vector=%d\n", info->line, info->irq); 1602 "vector=%d\n", info->line, info->irq);
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 1b8e554f674f..48eb22d3a63e 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -190,7 +190,7 @@ mpc52xx_uart_startup(struct uart_port *port)
190 190
191 /* Request IRQ */ 191 /* Request IRQ */
192 ret = request_irq(port->irq, mpc52xx_uart_int, 192 ret = request_irq(port->irq, mpc52xx_uart_int,
193 SA_INTERRUPT | SA_SAMPLE_RANDOM, "mpc52xx_psc_uart", port); 193 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "mpc52xx_psc_uart", port);
194 if (ret) 194 if (ret)
195 return ret; 195 return ret;
196 196
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 8c498f785e21..63d2a66e563b 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1412,7 +1412,7 @@ mpsc_startup(struct uart_port *port)
1412 1412
1413 /* If irq's are shared, need to set flag */ 1413 /* If irq's are shared, need to set flag */
1414 if (mpsc_ports[0].port.irq == mpsc_ports[1].port.irq) 1414 if (mpsc_ports[0].port.irq == mpsc_ports[1].port.irq)
1415 flag = SA_SHIRQ; 1415 flag = IRQF_SHARED;
1416 1416
1417 if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, 1417 if (request_irq(pi->port.irq, mpsc_sdma_intr, flag,
1418 "mpsc-sdma", pi)) 1418 "mpsc-sdma", pi))
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 4d9435451f4a..459c0231aef3 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -934,7 +934,7 @@ static int pmz_startup(struct uart_port *port)
934 } 934 }
935 935
936 pmz_get_port_A(uap)->flags |= PMACZILOG_FLAG_IS_IRQ_ON; 936 pmz_get_port_A(uap)->flags |= PMACZILOG_FLAG_IS_IRQ_ON;
937 if (request_irq(uap->port.irq, pmz_interrupt, SA_SHIRQ, "PowerMac Zilog", uap)) { 937 if (request_irq(uap->port.irq, pmz_interrupt, IRQF_SHARED, "PowerMac Zilog", uap)) {
938 dev_err(&uap->dev->ofdev.dev, 938 dev_err(&uap->dev->ofdev.dev,
939 "Unable to register zs interrupt handler.\n"); 939 "Unable to register zs interrupt handler.\n");
940 pmz_set_scc_power(uap, 0); 940 pmz_set_scc_power(uap, 0);
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 28c1881a6691..b361669f85a1 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -495,7 +495,7 @@ static int serial_txx9_startup(struct uart_port *port)
495 sio_out(up, TXX9_SIDISR, 0); 495 sio_out(up, TXX9_SIDISR, 0);
496 496
497 retval = request_irq(up->port.irq, serial_txx9_interrupt, 497 retval = request_irq(up->port.irq, serial_txx9_interrupt,
498 SA_SHIRQ, "serial_txx9", up); 498 IRQF_SHARED, "serial_txx9", up);
499 if (retval) 499 if (retval)
500 return retval; 500 return retval;
501 501
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 2509c3237e87..301573373c30 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -841,7 +841,7 @@ static int sci_request_irq(struct sci_port *port)
841 printk(KERN_ERR "sci: Cannot allocate irq.(IRQ=0)\n"); 841 printk(KERN_ERR "sci: Cannot allocate irq.(IRQ=0)\n");
842 return -ENODEV; 842 return -ENODEV;
843 } 843 }
844 if (request_irq(port->irqs[0], sci_mpxed_interrupt, SA_INTERRUPT, 844 if (request_irq(port->irqs[0], sci_mpxed_interrupt, IRQF_DISABLED,
845 "sci", port)) { 845 "sci", port)) {
846 printk(KERN_ERR "sci: Cannot allocate irq.\n"); 846 printk(KERN_ERR "sci: Cannot allocate irq.\n");
847 return -ENODEV; 847 return -ENODEV;
@@ -850,7 +850,7 @@ static int sci_request_irq(struct sci_port *port)
850 for (i = 0; i < ARRAY_SIZE(handlers); i++) { 850 for (i = 0; i < ARRAY_SIZE(handlers); i++) {
851 if (!port->irqs[i]) 851 if (!port->irqs[i])
852 continue; 852 continue;
853 if (request_irq(port->irqs[i], handlers[i], SA_INTERRUPT, 853 if (request_irq(port->irqs[i], handlers[i], IRQF_DISABLED,
854 desc[i], port)) { 854 desc[i], port)) {
855 printk(KERN_ERR "sci: Cannot allocate irq.\n"); 855 printk(KERN_ERR "sci: Cannot allocate irq.\n");
856 return -ENODEV; 856 return -ENODEV;
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 4b0afc8f12b9..2f148e5b9255 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -648,7 +648,7 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
648static int sn_sal_connect_interrupt(struct sn_cons_port *port) 648static int sn_sal_connect_interrupt(struct sn_cons_port *port)
649{ 649{
650 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt, 650 if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
651 SA_INTERRUPT | SA_SHIRQ, 651 IRQF_DISABLED | IRQF_SHARED,
652 "SAL console driver", port) >= 0) { 652 "SAL console driver", port) >= 0) {
653 return SGI_UART_VECTOR; 653 return SGI_UART_VECTOR;
654 } 654 }
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 20a48697727c..0dbd4df44c05 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -1027,7 +1027,7 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,
1027 int err; 1027 int err;
1028 1028
1029 err = request_irq(up->port.irq, sunsab_interrupt, 1029 err = request_irq(up->port.irq, sunsab_interrupt,
1030 SA_SHIRQ, "sab", up); 1030 IRQF_SHARED, "sab", up);
1031 if (err) { 1031 if (err) {
1032 of_iounmap(up->port.membase, 1032 of_iounmap(up->port.membase,
1033 sizeof(union sab82532_async_regs)); 1033 sizeof(union sab82532_async_regs));
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index eabf477fee95..f9013baba05b 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -667,10 +667,10 @@ static int sunsu_startup(struct uart_port *port)
667 667
668 if (up->su_type != SU_PORT_PORT) { 668 if (up->su_type != SU_PORT_PORT) {
669 retval = request_irq(up->port.irq, sunsu_kbd_ms_interrupt, 669 retval = request_irq(up->port.irq, sunsu_kbd_ms_interrupt,
670 SA_SHIRQ, su_typev[up->su_type], up); 670 IRQF_SHARED, su_typev[up->su_type], up);
671 } else { 671 } else {
672 retval = request_irq(up->port.irq, sunsu_serial_interrupt, 672 retval = request_irq(up->port.irq, sunsu_serial_interrupt,
673 SA_SHIRQ, su_typev[up->su_type], up); 673 IRQF_SHARED, su_typev[up->su_type], up);
674 } 674 }
675 if (retval) { 675 if (retval) {
676 printk("su: Cannot register IRQ %d\n", up->port.irq); 676 printk("su: Cannot register IRQ %d\n", up->port.irq);
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 9ee7f3af9ae2..a1456d9352cb 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1354,7 +1354,7 @@ static int __devinit zs_probe(struct of_device *dev, const struct of_device_id *
1354 1354
1355 if (zilog_irq == -1) { 1355 if (zilog_irq == -1) {
1356 zilog_irq = op->irqs[0]; 1356 zilog_irq = op->irqs[0];
1357 err = request_irq(zilog_irq, sunzilog_interrupt, SA_SHIRQ, 1357 err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED,
1358 "zs", sunzilog_irq_chain); 1358 "zs", sunzilog_irq_chain);
1359 if (err) { 1359 if (err) {
1360 of_iounmap(rp, sizeof(struct zilog_layout)); 1360 of_iounmap(rp, sizeof(struct zilog_layout));
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
index a0da2aaf71c4..f802867c95c5 100644
--- a/drivers/serial/v850e_uart.c
+++ b/drivers/serial/v850e_uart.c
@@ -372,13 +372,13 @@ static int v850e_uart_startup (struct uart_port *port)
372 372
373 /* Alloc RX irq. */ 373 /* Alloc RX irq. */
374 err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq, 374 err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq,
375 SA_INTERRUPT, "v850e_uart", port); 375 IRQF_DISABLED, "v850e_uart", port);
376 if (err) 376 if (err)
377 return err; 377 return err;
378 378
379 /* Alloc TX irq. */ 379 /* Alloc TX irq. */
380 err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq, 380 err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq,
381 SA_INTERRUPT, "v850e_uart", port); 381 IRQF_DISABLED, "v850e_uart", port);
382 if (err) { 382 if (err) {
383 free_irq (V850E_UART_RX_IRQ (port->line), port); 383 free_irq (V850E_UART_RX_IRQ (port->line), port);
384 return err; 384 return err;
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index 0040f10c9e39..6c7e0352d561 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -706,7 +706,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
706 writel(~0, &idd->vma->eisr); 706 writel(~0, &idd->vma->eisr);
707 707
708 idd->dual_irq = 1; 708 idd->dual_irq = 1;
709 if (!request_irq(pdev->irq, ioc3_intr_eth, SA_SHIRQ, 709 if (!request_irq(pdev->irq, ioc3_intr_eth, IRQF_SHARED,
710 "ioc3-eth", (void *)idd)) { 710 "ioc3-eth", (void *)idd)) {
711 idd->irq_eth = pdev->irq; 711 idd->irq_eth = pdev->irq;
712 } else { 712 } else {
@@ -714,7 +714,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
714 "%s : request_irq fails for IRQ 0x%x\n ", 714 "%s : request_irq fails for IRQ 0x%x\n ",
715 __FUNCTION__, pdev->irq); 715 __FUNCTION__, pdev->irq);
716 } 716 }
717 if (!request_irq(pdev->irq+2, ioc3_intr_io, SA_SHIRQ, 717 if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED,
718 "ioc3-io", (void *)idd)) { 718 "ioc3-io", (void *)idd)) {
719 idd->irq_io = pdev->irq+2; 719 idd->irq_io = pdev->irq+2;
720 } else { 720 } else {
@@ -723,7 +723,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
723 __FUNCTION__, pdev->irq+2); 723 __FUNCTION__, pdev->irq+2);
724 } 724 }
725 } else { 725 } else {
726 if (!request_irq(pdev->irq, ioc3_intr_io, SA_SHIRQ, 726 if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED,
727 "ioc3", (void *)idd)) { 727 "ioc3", (void *)idd)) {
728 idd->irq_io = pdev->irq; 728 idd->irq_io = pdev->irq;
729 } else { 729 } else {
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 93bc90b8ff92..5e8a27620f6f 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -1791,7 +1791,7 @@ int __init zs_init(void)
1791 zs_soft[channel].clk_divisor = 16; 1791 zs_soft[channel].clk_divisor = 16;
1792 zs_soft[channel].zs_baud = get_zsbaud(&zs_soft[channel]); 1792 zs_soft[channel].zs_baud = get_zsbaud(&zs_soft[channel]);
1793 1793
1794 if (request_irq(zs_soft[channel].irq, rs_interrupt, SA_SHIRQ, 1794 if (request_irq(zs_soft[channel].irq, rs_interrupt, IRQF_SHARED,
1795 "scc", &zs_soft[channel])) 1795 "scc", &zs_soft[channel]))
1796 printk(KERN_ERR "decserial: can't get irq %d\n", 1796 printk(KERN_ERR "decserial: can't get irq %d\n",
1797 zs_soft[channel].irq); 1797 zs_soft[channel].irq);
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 9d16716d166e..5078fb3375e3 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -125,7 +125,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
125 125
126 pci_set_master (dev); 126 pci_set_master (dev);
127 127
128 retval = usb_add_hcd (hcd, dev->irq, SA_SHIRQ); 128 retval = usb_add_hcd (hcd, dev->irq, IRQF_SHARED);
129 if (retval != 0) 129 if (retval != 0)
130 goto err4; 130 goto err4;
131 return retval; 131 return retval;
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index acb3c3d2e888..1c459ff037ce 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1653,13 +1653,13 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1653 pullup(udc, 0); 1653 pullup(udc, 0);
1654 1654
1655 /* request UDC and maybe VBUS irqs */ 1655 /* request UDC and maybe VBUS irqs */
1656 if (request_irq(AT91_ID_UDP, at91_udc_irq, SA_INTERRUPT, driver_name, udc)) { 1656 if (request_irq(AT91_ID_UDP, at91_udc_irq, IRQF_DISABLED, driver_name, udc)) {
1657 DBG("request irq %d failed\n", AT91_ID_UDP); 1657 DBG("request irq %d failed\n", AT91_ID_UDP);
1658 retval = -EBUSY; 1658 retval = -EBUSY;
1659 goto fail1; 1659 goto fail1;
1660 } 1660 }
1661 if (udc->board.vbus_pin > 0) { 1661 if (udc->board.vbus_pin > 0) {
1662 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, SA_INTERRUPT, driver_name, udc)) { 1662 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, IRQF_DISABLED, driver_name, udc)) {
1663 DBG("request vbus irq %d failed\n", udc->board.vbus_pin); 1663 DBG("request vbus irq %d failed\n", udc->board.vbus_pin);
1664 free_irq(AT91_ID_UDP, udc); 1664 free_irq(AT91_ID_UDP, udc);
1665 retval = -EBUSY; 1665 retval = -EBUSY;
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 3f827ded8cdf..7cf2999e8616 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1916,7 +1916,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1916 /* init to known state, then setup irqs */ 1916 /* init to known state, then setup irqs */
1917 udc_reset(dev); 1917 udc_reset(dev);
1918 udc_reinit (dev); 1918 udc_reinit (dev);
1919 if (request_irq(pdev->irq, goku_irq, SA_SHIRQ/*|SA_SAMPLE_RANDOM*/, 1919 if (request_irq(pdev->irq, goku_irq, IRQF_SHARED/*|IRQF_SAMPLE_RANDOM*/,
1920 driver_name, dev) != 0) { 1920 driver_name, dev) != 0) {
1921 DBG(dev, "request interrupt %d failed\n", pdev->irq); 1921 DBG(dev, "request interrupt %d failed\n", pdev->irq);
1922 retval = -EBUSY; 1922 retval = -EBUSY;
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 0d3424eda038..bb22b7e82877 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2107,7 +2107,7 @@ static int lh7a40x_udc_probe(struct platform_device *pdev)
2107 2107
2108 /* irq setup after old hardware state is cleaned up */ 2108 /* irq setup after old hardware state is cleaned up */
2109 retval = 2109 retval =
2110 request_irq(IRQ_USBINTR, lh7a40x_udc_irq, SA_INTERRUPT, driver_name, 2110 request_irq(IRQ_USBINTR, lh7a40x_udc_irq, IRQF_DISABLED, driver_name,
2111 dev); 2111 dev);
2112 if (retval != 0) { 2112 if (retval != 0) {
2113 DEBUG(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name, 2113 DEBUG(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name,
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 570996d7eb34..09243239d948 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2895,7 +2895,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
2895 goto done; 2895 goto done;
2896 } 2896 }
2897 2897
2898 if (request_irq (pdev->irq, net2280_irq, SA_SHIRQ, driver_name, dev) 2898 if (request_irq (pdev->irq, net2280_irq, IRQF_SHARED, driver_name, dev)
2899 != 0) { 2899 != 0) {
2900 ERROR (dev, "request interrupt %d failed\n", pdev->irq); 2900 ERROR (dev, "request interrupt %d failed\n", pdev->irq);
2901 retval = -EBUSY; 2901 retval = -EBUSY;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 0d642ac70055..2de9748ee673 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -772,7 +772,7 @@ static void dma_error(int lch, u16 ch_status, void *data)
772 struct omap_ep *ep = data; 772 struct omap_ep *ep = data;
773 773
774 /* if ch_status & OMAP_DMA_DROP_IRQ ... */ 774 /* if ch_status & OMAP_DMA_DROP_IRQ ... */
775 /* if ch_status & OMAP_DMA_TOUT_IRQ ... */ 775 /* if ch_status & OMAP1_DMA_TOUT_IRQ ... */
776 ERR("%s dma error, lch %d status %02x\n", ep->ep.name, lch, ch_status); 776 ERR("%s dma error, lch %d status %02x\n", ep->ep.name, lch, ch_status);
777 777
778 /* complete current transfer ... */ 778 /* complete current transfer ... */
@@ -2818,7 +2818,7 @@ bad_on_1710:
2818 2818
2819 /* USB general purpose IRQ: ep0, state changes, dma, etc */ 2819 /* USB general purpose IRQ: ep0, state changes, dma, etc */
2820 status = request_irq(pdev->resource[1].start, omap_udc_irq, 2820 status = request_irq(pdev->resource[1].start, omap_udc_irq,
2821 SA_SAMPLE_RANDOM, driver_name, udc); 2821 IRQF_SAMPLE_RANDOM, driver_name, udc);
2822 if (status != 0) { 2822 if (status != 0) {
2823 ERR( "can't get irq %ld, err %d\n", 2823 ERR( "can't get irq %ld, err %d\n",
2824 pdev->resource[1].start, status); 2824 pdev->resource[1].start, status);
@@ -2827,7 +2827,7 @@ bad_on_1710:
2827 2827
2828 /* USB "non-iso" IRQ (PIO for all but ep0) */ 2828 /* USB "non-iso" IRQ (PIO for all but ep0) */
2829 status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, 2829 status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
2830 SA_SAMPLE_RANDOM, "omap_udc pio", udc); 2830 IRQF_SAMPLE_RANDOM, "omap_udc pio", udc);
2831 if (status != 0) { 2831 if (status != 0) {
2832 ERR( "can't get irq %ld, err %d\n", 2832 ERR( "can't get irq %ld, err %d\n",
2833 pdev->resource[2].start, status); 2833 pdev->resource[2].start, status);
@@ -2835,7 +2835,7 @@ bad_on_1710:
2835 } 2835 }
2836#ifdef USE_ISO 2836#ifdef USE_ISO
2837 status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, 2837 status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
2838 SA_INTERRUPT, "omap_udc iso", udc); 2838 IRQF_DISABLED, "omap_udc iso", udc);
2839 if (status != 0) { 2839 if (status != 0) {
2840 ERR("can't get irq %ld, err %d\n", 2840 ERR("can't get irq %ld, err %d\n",
2841 pdev->resource[3].start, status); 2841 pdev->resource[3].start, status);
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index c88650dffdeb..fff027d30a09 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2521,7 +2521,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2521 2521
2522 /* irq setup after old hardware state is cleaned up */ 2522 /* irq setup after old hardware state is cleaned up */
2523 retval = request_irq(IRQ_USB, pxa2xx_udc_irq, 2523 retval = request_irq(IRQ_USB, pxa2xx_udc_irq,
2524 SA_INTERRUPT, driver_name, dev); 2524 IRQF_DISABLED, driver_name, dev);
2525 if (retval != 0) { 2525 if (retval != 0) {
2526 printk(KERN_ERR "%s: can't get irq %i, err %d\n", 2526 printk(KERN_ERR "%s: can't get irq %i, err %d\n",
2527 driver_name, IRQ_USB, retval); 2527 driver_name, IRQ_USB, retval);
@@ -2533,7 +2533,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2533 if (machine_is_lubbock()) { 2533 if (machine_is_lubbock()) {
2534 retval = request_irq(LUBBOCK_USB_DISC_IRQ, 2534 retval = request_irq(LUBBOCK_USB_DISC_IRQ,
2535 lubbock_vbus_irq, 2535 lubbock_vbus_irq,
2536 SA_INTERRUPT | SA_SAMPLE_RANDOM, 2536 IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
2537 driver_name, dev); 2537 driver_name, dev);
2538 if (retval != 0) { 2538 if (retval != 0) {
2539 printk(KERN_ERR "%s: can't get irq %i, err %d\n", 2539 printk(KERN_ERR "%s: can't get irq %i, err %d\n",
@@ -2544,7 +2544,7 @@ lubbock_fail0:
2544 } 2544 }
2545 retval = request_irq(LUBBOCK_USB_IRQ, 2545 retval = request_irq(LUBBOCK_USB_IRQ,
2546 lubbock_vbus_irq, 2546 lubbock_vbus_irq,
2547 SA_INTERRUPT | SA_SAMPLE_RANDOM, 2547 IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
2548 driver_name, dev); 2548 driver_name, dev);
2549 if (retval != 0) { 2549 if (retval != 0) {
2550 printk(KERN_ERR "%s: can't get irq %i, err %d\n", 2550 printk(KERN_ERR "%s: can't get irq %i, err %d\n",
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 9b4697add313..d66867aa527e 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -148,7 +148,7 @@ int usb_ehci_au1xxx_probe(const struct hc_driver *driver,
148 /* ehci_hcd_init(hcd_to_ehci(hcd)); */ 148 /* ehci_hcd_init(hcd_to_ehci(hcd)); */
149 149
150 retval = 150 retval =
151 usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT | SA_SHIRQ); 151 usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED);
152 if (retval == 0) 152 if (retval == 0)
153 return retval; 153 return retval;
154 154
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index a49a689bf423..d030516edfb9 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -121,7 +121,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
121 temp = in_le32(hcd->regs + 0x1a8); 121 temp = in_le32(hcd->regs + 0x1a8);
122 out_le32(hcd->regs + 0x1a8, temp | 0x3); 122 out_le32(hcd->regs + 0x1a8, temp | 0x3);
123 123
124 retval = usb_add_hcd(hcd, irq, SA_SHIRQ); 124 retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
125 if (retval != 0) 125 if (retval != 0)
126 goto err4; 126 goto err4;
127 return retval; 127 return retval;
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 14386254c870..5147ed4a6662 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1653,7 +1653,7 @@ static int __init isp116x_probe(struct platform_device *pdev)
1653 goto err6; 1653 goto err6;
1654 } 1654 }
1655 1655
1656 ret = usb_add_hcd(hcd, irq, SA_INTERRUPT); 1656 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
1657 if (ret) 1657 if (ret)
1658 goto err6; 1658 goto err6;
1659 1659
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 6b7350b52419..cdbafb710000 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -125,7 +125,7 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
125 at91_start_hc(pdev); 125 at91_start_hc(pdev);
126 ohci_hcd_init(hcd_to_ohci(hcd)); 126 ohci_hcd_init(hcd_to_ohci(hcd));
127 127
128 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); 128 retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);
129 if (retval == 0) 129 if (retval == 0)
130 return retval; 130 return retval;
131 131
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index a1c8b3b2fcc7..689261e44018 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -191,7 +191,7 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver,
191 au1xxx_start_ohc(dev); 191 au1xxx_start_ohc(dev);
192 ohci_hcd_init(hcd_to_ohci(hcd)); 192 ohci_hcd_init(hcd_to_ohci(hcd));
193 193
194 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT | SA_SHIRQ); 194 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED);
195 if (retval == 0) 195 if (retval == 0)
196 return retval; 196 return retval;
197 197
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 0020ed7a39d0..5602da9bd52c 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -100,7 +100,7 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver,
100 lh7a404_start_hc(dev); 100 lh7a404_start_hc(dev);
101 ohci_hcd_init(hcd_to_ohci(hcd)); 101 ohci_hcd_init(hcd_to_ohci(hcd));
102 102
103 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); 103 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED);
104 if (retval == 0) 104 if (retval == 0)
105 return retval; 105 return retval;
106 106
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index ca19abe01c53..c4c4babd4767 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -14,7 +14,7 @@
14 * This file is licenced under the GPL. 14 * This file is licenced under the GPL.
15 */ 15 */
16 16
17#include <linux/signal.h> /* SA_INTERRUPT */ 17#include <linux/signal.h> /* IRQF_DISABLED */
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
@@ -334,7 +334,7 @@ int usb_hcd_omap_probe (const struct hc_driver *driver,
334 retval = -ENXIO; 334 retval = -ENXIO;
335 goto err2; 335 goto err2;
336 } 336 }
337 retval = usb_add_hcd(hcd, irq, SA_INTERRUPT); 337 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
338 if (retval == 0) 338 if (retval == 0)
339 return retval; 339 return retval;
340 340
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index b2a8dfa48870..9fe56ff1615d 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -75,7 +75,7 @@ static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver,
75 ohci->flags |= OHCI_BIG_ENDIAN; 75 ohci->flags |= OHCI_BIG_ENDIAN;
76 ohci_hcd_init(ohci); 76 ohci_hcd_init(ohci);
77 77
78 retval = usb_add_hcd(hcd, irq, SA_INTERRUPT); 78 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
79 if (retval == 0) 79 if (retval == 0)
80 return retval; 80 return retval;
81 81
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index fafe7c1265b3..6f559e102789 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -190,7 +190,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
190 190
191 ohci_hcd_init(hcd_to_ohci(hcd)); 191 ohci_hcd_init(hcd_to_ohci(hcd));
192 192
193 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); 193 retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);
194 if (retval == 0) 194 if (retval == 0)
195 return retval; 195 return retval;
196 196
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 1da5de573a6f..d2fc6969a9f7 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -388,7 +388,7 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
388 388
389 ohci_hcd_init(hcd_to_ohci(hcd)); 389 ohci_hcd_init(hcd_to_ohci(hcd));
390 390
391 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); 391 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED);
392 if (retval != 0) 392 if (retval != 0)
393 goto err_ioremap; 393 goto err_ioremap;
394 394
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index fb3221ebbb29..ce3de106cadc 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -143,7 +143,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
143 sa1111_start_hc(dev); 143 sa1111_start_hc(dev);
144 ohci_hcd_init(hcd_to_ohci(hcd)); 144 ohci_hcd_init(hcd_to_ohci(hcd));
145 145
146 retval = usb_add_hcd(hcd, dev->irq[1], SA_INTERRUPT); 146 retval = usb_add_hcd(hcd, dev->irq[1], IRQF_DISABLED);
147 if (retval == 0) 147 if (retval == 0)
148 return retval; 148 return retval;
149 149
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index c327168255cd..fa34092bbcde 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1749,7 +1749,7 @@ sl811h_probe(struct platform_device *dev)
1749 * was on a system with single edge triggering, so most sorts of 1749 * was on a system with single edge triggering, so most sorts of
1750 * triggering arrangement should work. 1750 * triggering arrangement should work.
1751 */ 1751 */
1752 retval = usb_add_hcd(hcd, irq, SA_INTERRUPT | SA_SHIRQ); 1752 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
1753 if (retval != 0) 1753 if (retval != 0)
1754 goto err6; 1754 goto err6;
1755 1755
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 466042808daf..fd95c2dbd4f7 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -561,7 +561,7 @@ static int __init arcfb_probe(struct platform_device *dev)
561 platform_set_drvdata(dev, info); 561 platform_set_drvdata(dev, info);
562 if (irq) { 562 if (irq) {
563 par->irq = irq; 563 par->irq = irq;
564 if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, 564 if (request_irq(par->irq, &arcfb_interrupt, IRQF_SHARED,
565 "arcfb", info)) { 565 "arcfb", info)) {
566 printk(KERN_INFO 566 printk(KERN_INFO
567 "arcfb: Failed req IRQ %d\n", par->irq); 567 "arcfb: Failed req IRQ %d\n", par->irq);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 85fcd22e6ed5..0c9706746d79 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -1567,7 +1567,7 @@ static int aty_enable_irq(struct atyfb_par *par, int reenable)
1567 u32 int_cntl; 1567 u32 int_cntl;
1568 1568
1569 if (!test_and_set_bit(0, &par->irq_flags)) { 1569 if (!test_and_set_bit(0, &par->irq_flags)) {
1570 if (request_irq(par->irq, aty_irq, SA_SHIRQ, "atyfb", par)) { 1570 if (request_irq(par->irq, aty_irq, IRQF_SHARED, "atyfb", par)) {
1571 clear_bit(0, &par->irq_flags); 1571 clear_bit(0, &par->irq_flags);
1572 return -EINVAL; 1572 return -EINVAL;
1573 } 1573 }
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 600d3e0e08b7..c6a5f0ccc107 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1694,7 +1694,7 @@ static int au1200fb_drv_probe(struct device *dev)
1694 1694
1695 /* Now hook interrupt too */ 1695 /* Now hook interrupt too */
1696 if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq, 1696 if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq,
1697 SA_INTERRUPT | SA_SHIRQ, "lcd", (void *)dev)) < 0) { 1697 IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)dev)) < 0) {
1698 print_err("fail to request interrupt line %d (err: %d)", 1698 print_err("fail to request interrupt line %d (err: %d)",
1699 AU1200_LCD_INT, ret); 1699 AU1200_LCD_INT, ret);
1700 goto failed; 1700 goto failed;
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 8b5bf7972ee3..4a57dabb77d4 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -233,7 +233,7 @@ int matroxfb_enable_irq(WPMINFO int reenable) {
233 233
234 if (!test_and_set_bit(0, &ACCESS_FBINFO(irq_flags))) { 234 if (!test_and_set_bit(0, &ACCESS_FBINFO(irq_flags))) {
235 if (request_irq(ACCESS_FBINFO(pcidev)->irq, matrox_irq, 235 if (request_irq(ACCESS_FBINFO(pcidev)->irq, matrox_irq,
236 SA_SHIRQ, "matroxfb", MINFO)) { 236 IRQF_SHARED, "matroxfb", MINFO)) {
237 clear_bit(0, &ACCESS_FBINFO(irq_flags)); 237 clear_bit(0, &ACCESS_FBINFO(irq_flags));
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 54663a9baf43..bbb07106cd54 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1334,7 +1334,7 @@ int __init pxafb_probe(struct platform_device *dev)
1334 goto failed; 1334 goto failed;
1335 } 1335 }
1336 1336
1337 ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); 1337 ret = request_irq(IRQ_LCD, pxafb_handle_irq, IRQF_DISABLED, "LCD", fbi);
1338 if (ret) { 1338 if (ret) {
1339 dev_err(&dev->dev, "request_irq failed: %d\n", ret); 1339 dev_err(&dev->dev, "request_irq failed: %d\n", ret);
1340 ret = -EBUSY; 1340 ret = -EBUSY;
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index fbc411850686..f461eb10cc79 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -735,7 +735,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
735 735
736 dprintk("got LCD region\n"); 736 dprintk("got LCD region\n");
737 737
738 ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); 738 ret = request_irq(irq, s3c2410fb_irq, IRQF_DISABLED, pdev->name, info);
739 if (ret) { 739 if (ret) {
740 dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); 740 dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret);
741 ret = -EBUSY; 741 ret = -EBUSY;
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index 553fd84af44f..a2e6e7205d7e 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1472,7 +1472,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev)
1472 if (ret) 1472 if (ret)
1473 goto failed; 1473 goto failed;
1474 1474
1475 ret = request_irq(irq, sa1100fb_handle_irq, SA_INTERRUPT, 1475 ret = request_irq(irq, sa1100fb_handle_irq, IRQF_DISABLED,
1476 "LCD", fbi); 1476 "LCD", fbi);
1477 if (ret) { 1477 if (ret) {
1478 printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); 1478 printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret);