aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX4
-rw-r--r--Documentation/README.cycladesZ (renamed from drivers/char/README.cycladesZ)0
-rw-r--r--Documentation/README.moxa18
-rw-r--r--Documentation/SAK.txt4
-rw-r--r--Documentation/cciss.txt27
-rw-r--r--Documentation/early-userspace/README67
-rw-r--r--Documentation/kernel-parameters.txt8
-rw-r--r--Documentation/mkdev.cciss40
-rw-r--r--Documentation/moxa-smartio10
-rw-r--r--Documentation/networking/e100.txt12
-rw-r--r--Documentation/networking/e1000.txt36
-rw-r--r--Documentation/pm.txt48
-rw-r--r--Documentation/riscom8.txt42
-rw-r--r--Documentation/sparse.txt72
-rw-r--r--Documentation/stallion.txt68
-rw-r--r--Documentation/vm/hugetlbpage.txt262
-rw-r--r--Documentation/vm/numa2
-rw-r--r--MAINTAINERS10
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/alpha/kernel/core_marvel.c2
-rw-r--r--arch/alpha/kernel/srmcons.c2
-rw-r--r--arch/alpha/mm/numa.c10
-rw-r--r--arch/arm/boot/compressed/head-xscale.S14
-rw-r--r--arch/arm/configs/ep80219_defconfig13
-rw-r--r--arch/arm/configs/iq31244_defconfig13
-rw-r--r--arch/arm/configs/iq80321_defconfig91
-rw-r--r--arch/arm/configs/iq80331_defconfig105
-rw-r--r--arch/arm/configs/iq80332_defconfig864
-rw-r--r--arch/arm/mach-integrator/impd1.c13
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c9
-rw-r--r--arch/arm/mach-iop3xx/Kconfig17
-rw-r--r--arch/arm/mach-iop3xx/Makefile2
-rw-r--r--arch/arm/mach-iop3xx/iop321-pci.c8
-rw-r--r--arch/arm/mach-iop3xx/iop321-setup.c61
-rw-r--r--arch/arm/mach-iop3xx/iop331-pci.c35
-rw-r--r--arch/arm/mach-iop3xx/iop331-setup.c92
-rw-r--r--arch/arm/mach-iop3xx/iq31244-pci.c22
-rw-r--r--arch/arm/mach-iop3xx/iq80321-pci.c33
-rw-r--r--arch/arm/mach-iop3xx/iq80331-pci.c34
-rw-r--r--arch/arm/mach-iop3xx/iq80332-mm.c36
-rw-r--r--arch/arm/mach-iop3xx/iq80332-pci.c128
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c2
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c2
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c37
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c4
-rw-r--r--arch/arm/mach-ixp4xx/prpmc1100-setup.c4
-rw-r--r--arch/arm/mach-versatile/core.c9
-rw-r--r--arch/arm/mm/consistent.c56
-rw-r--r--arch/arm/mm/init.c34
-rw-r--r--arch/arm/mm/mm-armv.c4
-rw-r--r--arch/arm/mm/proc-xscale.S4
-rw-r--r--arch/arm/tools/mach-types41
-rw-r--r--arch/arm26/mm/init.c3
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c30
-rw-r--r--arch/i386/Kconfig11
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c19
-rw-r--r--arch/i386/kernel/entry.S3
-rw-r--r--arch/i386/kernel/mpparse.c4
-rw-r--r--arch/i386/kernel/numaq.c10
-rw-r--r--arch/i386/kernel/process.c2
-rw-r--r--arch/i386/kernel/srat.c32
-rw-r--r--arch/i386/kernel/traps.c2
-rw-r--r--arch/i386/lib/delay.c2
-rw-r--r--arch/i386/mm/discontig.c28
-rw-r--r--arch/i386/oprofile/nmi_int.c8
-rw-r--r--arch/i386/pci/numa.c7
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/configs/zx1_defconfig215
-rw-r--r--arch/ia64/kernel/acpi.c22
-rw-r--r--arch/ia64/kernel/head.S2
-rw-r--r--arch/ia64/kernel/irq_ia64.c2
-rw-r--r--arch/ia64/kernel/perfmon.c2
-rw-r--r--arch/ia64/kernel/topology.c3
-rw-r--r--arch/ia64/kernel/unwind.c2
-rw-r--r--arch/ia64/lib/io.c17
-rw-r--r--arch/ia64/lib/swiotlb.c314
-rw-r--r--arch/ia64/mm/contig.c4
-rw-r--r--arch/ia64/mm/discontig.c70
-rw-r--r--arch/ia64/mm/init.c1
-rw-r--r--arch/ia64/sn/kernel/io_init.c2
-rw-r--r--arch/ia64/sn/kernel/setup.c17
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c13
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c14
-rw-r--r--arch/m32r/kernel/setup.c4
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/m32r/mm/discontig.c6
-rw-r--r--arch/m32r/mm/init.c6
-rw-r--r--arch/m32r/oprofile/init.c6
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c2
-rw-r--r--arch/mips/configs/pb1500_defconfig2
-rw-r--r--arch/mips/gt64120/ev64120/irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-init.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-klnuma.c28
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c32
-rw-r--r--arch/mips/sgi-ip27/ip27-nmi.c8
-rw-r--r--arch/mips/sgi-ip27/ip27-reset.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c14
-rw-r--r--arch/parisc/mm/init.c2
-rw-r--r--arch/ppc/platforms/prep_setup.c4
-rw-r--r--arch/ppc/syslib/ppc4xx_dma.c4
-rw-r--r--arch/ppc64/Makefile4
-rw-r--r--arch/ppc64/kernel/LparData.c70
-rw-r--r--arch/ppc64/kernel/Makefile2
-rw-r--r--arch/ppc64/kernel/eeh.c37
-rw-r--r--arch/ppc64/kernel/entry.S6
-rw-r--r--arch/ppc64/kernel/head.S226
-rw-r--r--arch/ppc64/kernel/iSeries_iommu.c11
-rw-r--r--arch/ppc64/kernel/iSeries_setup.c3
-rw-r--r--arch/ppc64/kernel/iommu.c21
-rw-r--r--arch/ppc64/kernel/maple_pci.c3
-rw-r--r--arch/ppc64/kernel/maple_setup.c7
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c283
-rw-r--r--arch/ppc64/kernel/pSeries_pci.c5
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c17
-rw-r--r--arch/ppc64/kernel/pSeries_smp.c6
-rw-r--r--arch/ppc64/kernel/pci.c5
-rw-r--r--arch/ppc64/kernel/pci_direct_iommu.c (renamed from arch/ppc64/kernel/pci_dma_direct.c)2
-rw-r--r--arch/ppc64/kernel/pmac_pci.c2
-rw-r--r--arch/ppc64/kernel/pmac_setup.c7
-rw-r--r--arch/ppc64/kernel/prom.c11
-rw-r--r--arch/ppc64/kernel/ras.c120
-rw-r--r--arch/ppc64/kernel/setup.c2
-rw-r--r--arch/ppc64/kernel/traps.c153
-rw-r--r--arch/ppc64/kernel/u3_iommu.c106
-rw-r--r--arch/ppc64/kernel/vio.c18
-rw-r--r--arch/ppc64/lib/sstep.c4
-rw-r--r--arch/ppc64/mm/init.c2
-rw-r--r--arch/ppc64/mm/numa.c14
-rw-r--r--arch/ppc64/oprofile/op_impl.h38
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/io.c4
-rw-r--r--arch/sh/drivers/pci/Kconfig3
-rw-r--r--arch/sh/kernel/sh_ksyms.c4
-rw-r--r--arch/sh/lib/delay.c2
-rw-r--r--arch/sparc64/lib/delay.c2
-rw-r--r--arch/x86_64/Kconfig11
-rw-r--r--arch/x86_64/kernel/setup64.c3
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/mm/k8topology.c9
-rw-r--r--arch/x86_64/mm/numa.c15
-rw-r--r--arch/x86_64/mm/srat.c13
-rw-r--r--drivers/acpi/asus_acpi.c4
-rw-r--r--drivers/acpi/ec.c4
-rw-r--r--drivers/base/node.c3
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/Kconfig57
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/cciss_scsi.c4
-rw-r--r--drivers/block/cciss_scsi.h2
-rw-r--r--drivers/block/cpqarray.c4
-rw-r--r--drivers/block/cpqarray.h2
-rw-r--r--drivers/block/floppy.c5
-rw-r--r--drivers/block/ida_cmd.h2
-rw-r--r--drivers/block/ida_ioctl.h2
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/paride/bpck6.c2
-rw-r--r--drivers/block/paride/pcd.c16
-rw-r--r--drivers/block/paride/pd.c18
-rw-r--r--drivers/block/paride/pf.c18
-rw-r--r--drivers/block/paride/pg.c14
-rw-r--r--drivers/block/paride/pt.c14
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/block/ps2esdi.c8
-rw-r--r--drivers/block/smart1,2.h2
-rw-r--r--drivers/block/sx8.c2
-rw-r--r--drivers/block/xd.c6
-rw-r--r--drivers/cdrom/aztcd.c2
-rw-r--r--drivers/cdrom/cdrom.c26
-rw-r--r--drivers/cdrom/gscd.c3
-rw-r--r--drivers/cdrom/isp16.c8
-rw-r--r--drivers/cdrom/mcd.c12
-rw-r--r--drivers/cdrom/mcdx.c11
-rw-r--r--drivers/cdrom/optcd.c2
-rw-r--r--drivers/cdrom/sjcd.c2
-rw-r--r--drivers/cdrom/sonycd535.c2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c4
-rw-r--r--drivers/char/applicom.c9
-rw-r--r--drivers/char/cyclades.c21
-rw-r--r--drivers/char/drm/gamma_lists.h6
-rw-r--r--drivers/char/drm/i810_dma.c18
-rw-r--r--drivers/char/drm/i915_dma.c18
-rw-r--r--drivers/char/ds1286.c2
-rw-r--r--drivers/char/ec3104_keyb.c2
-rw-r--r--drivers/char/efirtc.c2
-rw-r--r--drivers/char/ftape/compressor/zftape-compress.c4
-rw-r--r--drivers/char/ftape/lowlevel/fc-10.c4
-rw-r--r--drivers/char/ftape/lowlevel/fdc-io.c67
-rw-r--r--drivers/char/ftape/lowlevel/fdc-io.h5
-rw-r--r--drivers/char/ftape/lowlevel/ftape-bsm.c8
-rw-r--r--drivers/char/ftape/lowlevel/ftape-bsm.h1
-rw-r--r--drivers/char/ftape/lowlevel/ftape-ctl.c15
-rw-r--r--drivers/char/ftape/lowlevel/ftape-ctl.h1
-rw-r--r--drivers/char/ftape/lowlevel/ftape-init.c6
-rw-r--r--drivers/char/ftape/lowlevel/ftape-io.c24
-rw-r--r--drivers/char/ftape/lowlevel/ftape-io.h4
-rw-r--r--drivers/char/ftape/lowlevel/ftape-proc.c4
-rw-r--r--drivers/char/ftape/lowlevel/ftape-rw.c2
-rw-r--r--drivers/char/ftape/lowlevel/ftape-rw.h1
-rw-r--r--drivers/char/ftape/zftape/zftape-buffers.c7
-rw-r--r--drivers/char/ftape/zftape/zftape-buffers.h1
-rw-r--r--drivers/char/ftape/zftape/zftape-init.c13
-rw-r--r--drivers/char/ftape/zftape/zftape-init.h1
-rw-r--r--drivers/char/ftape/zftape/zftape-rw.c1
-rw-r--r--drivers/char/ftape/zftape/zftape-rw.h1
-rw-r--r--drivers/char/ftape/zftape/zftape-vtbl.c4
-rw-r--r--drivers/char/ftape/zftape/zftape-vtbl.h1
-rw-r--r--drivers/char/ftape/zftape/zftape_syms.c1
-rw-r--r--drivers/char/generic_serial.c26
-rw-r--r--drivers/char/genrtc.c2
-rw-r--r--drivers/char/hpet.c4
-rw-r--r--drivers/char/hvc_console.c4
-rw-r--r--drivers/char/hvcs.c6
-rw-r--r--drivers/char/hvsi.c2
-rw-r--r--drivers/char/hw_random.c2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c8
-rw-r--r--drivers/char/ipmi/ipmi_poweroff.c12
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c26
-rw-r--r--drivers/char/isicom.c836
-rw-r--r--drivers/char/mwave/3780i.c2
-rw-r--r--drivers/char/mwave/mwavedd.c10
-rw-r--r--drivers/char/n_hdlc.c4
-rw-r--r--drivers/char/nvram.c2
-rw-r--r--drivers/char/pcmcia/synclink_cs.c16
-rw-r--r--drivers/char/qtronix.c2
-rw-r--r--drivers/char/random.c4
-rw-r--r--drivers/char/rio/func.h21
-rw-r--r--drivers/char/rio/rio_linux.c34
-rw-r--r--drivers/char/rio/rioboot.c8
-rw-r--r--drivers/char/rio/riocmd.c58
-rw-r--r--drivers/char/rio/rioctrl.c35
-rw-r--r--drivers/char/rio/rioinit.c59
-rw-r--r--drivers/char/rio/riointr.c166
-rw-r--r--drivers/char/rio/rioroute.c18
-rw-r--r--drivers/char/rio/riotable.c19
-rw-r--r--drivers/char/rio/riotty.c17
-rw-r--r--drivers/char/rtc.c2
-rw-r--r--drivers/char/scx200_gpio.c2
-rw-r--r--drivers/char/sonypi.c4
-rw-r--r--drivers/char/synclink.c20
-rw-r--r--drivers/char/synclinkmp.c10
-rw-r--r--drivers/char/sysrq.c2
-rw-r--r--drivers/char/tipar.c49
-rw-r--r--drivers/char/toshiba.c2
-rw-r--r--drivers/char/tty_io.c43
-rw-r--r--drivers/char/viocons.c4
-rw-r--r--drivers/char/watchdog/machzwd.c29
-rw-r--r--drivers/ide/arm/icside.c2
-rw-r--r--drivers/ide/cris/ide-v10.c2
-rw-r--r--drivers/ide/ide-cd.c73
-rw-r--r--drivers/ide/ide-disk.c190
-rw-r--r--drivers/ide/ide-dma.c3
-rw-r--r--drivers/ide/ide-floppy.c4
-rw-r--r--drivers/ide/ide-io.c171
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/ide-lib.c132
-rw-r--r--drivers/ide/ide-taskfile.c8
-rw-r--r--drivers/ide/ide.c151
-rw-r--r--drivers/ide/legacy/ide-cs.c4
-rw-r--r--drivers/ide/pci/sgiioc4.c8
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--drivers/ide/setup-pci.c27
-rw-r--r--drivers/ieee1394/csr.c2
-rw-r--r--drivers/ieee1394/eth1394.c4
-rw-r--r--drivers/ieee1394/pcilynx.c10
-rw-r--r--drivers/ieee1394/sbp2.c2
-rw-r--r--drivers/input/gameport/Kconfig2
-rw-r--r--drivers/input/gameport/Makefile2
-rw-r--r--drivers/input/serio/maceps2.c2
-rw-r--r--drivers/isdn/act2000/module.c8
-rw-r--r--drivers/isdn/hardware/avm/b1pcmcia.c1
-rw-r--r--drivers/isdn/hardware/eicon/divamnt.c4
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c2
-rw-r--r--drivers/isdn/hisax/avma1_cs.c6
-rw-r--r--drivers/isdn/hisax/config.c18
-rw-r--r--drivers/isdn/hisax/elsa_cs.c8
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c6
-rw-r--r--drivers/isdn/hisax/hisax_isac.c2
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c8
-rw-r--r--drivers/isdn/hisax/st5481_init.c6
-rw-r--r--drivers/isdn/hisax/teles_cs.c8
-rw-r--r--drivers/isdn/icn/icn.c8
-rw-r--r--drivers/isdn/pcbit/module.c5
-rw-r--r--drivers/isdn/sc/init.c9
-rw-r--r--drivers/isdn/tpam/tpam_main.c4
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/mca/mca-bus.c2
-rw-r--r--drivers/mca/mca-legacy.c59
-rw-r--r--drivers/mca/mca-proc.c4
-rw-r--r--drivers/md/Makefile30
-rw-r--r--drivers/md/kcopyd.c2
-rw-r--r--drivers/md/linear.c38
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/md/raid5.c4
-rw-r--r--drivers/md/raid6algos.c10
-rw-r--r--drivers/md/raid6altivec.uc122
-rw-r--r--drivers/md/raid6main.c4
-rw-r--r--drivers/media/common/saa7146_core.c4
-rw-r--r--drivers/media/dvb/b2c2/skystar2.c2
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c15
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c4
-rw-r--r--drivers/media/radio/miropcm20-radio.c2
-rw-r--r--drivers/media/radio/radio-aimslab.c8
-rw-r--r--drivers/media/radio/radio-aztech.c4
-rw-r--r--drivers/media/radio/radio-cadet.c8
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c6
-rw-r--r--drivers/media/radio/radio-gemtek.c6
-rw-r--r--drivers/media/radio/radio-maestro.c6
-rw-r--r--drivers/media/radio/radio-maxiradio.c6
-rw-r--r--drivers/media/radio/radio-rtrack2.c4
-rw-r--r--drivers/media/radio/radio-sf16fmi.c4
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c4
-rw-r--r--drivers/media/radio/radio-terratec.c6
-rw-r--r--drivers/media/radio/radio-trust.c4
-rw-r--r--drivers/media/radio/radio-typhoon.c12
-rw-r--r--drivers/media/radio/radio-zoltrix.c8
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/adv7170.c2
-rw-r--r--drivers/media/video/adv7175.c2
-rw-r--r--drivers/media/video/bt819.c4
-rw-r--r--drivers/media/video/bt856.c2
-rw-r--r--drivers/media/video/bttv-cards.c20
-rw-r--r--drivers/media/video/bttv-driver.c16
-rw-r--r--drivers/media/video/bttv-i2c.c6
-rw-r--r--drivers/media/video/bttv-risc.c8
-rw-r--r--drivers/media/video/bttv.h2
-rw-r--r--drivers/media/video/bttvp.h19
-rw-r--r--drivers/media/video/bw-qcam.c16
-rw-r--r--drivers/media/video/c-qcam.c13
-rw-r--r--drivers/media/video/cpia.c2
-rw-r--r--drivers/media/video/cpia_pp.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/dpc7146.c9
-rw-r--r--drivers/media/video/hexium_gemini.c2
-rw-r--r--drivers/media/video/hexium_orion.c6
-rw-r--r--drivers/media/video/ir-kbd-i2c.c10
-rw-r--r--drivers/media/video/meye.c4
-rw-r--r--drivers/media/video/msp3400.c8
-rw-r--r--drivers/media/video/mxb.c4
-rw-r--r--drivers/media/video/mxb.h2
-rw-r--r--drivers/media/video/pms.c8
-rw-r--r--drivers/media/video/saa7110.c2
-rw-r--r--drivers/media/video/saa7114.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c14
-rw-r--r--drivers/media/video/saa7185.c2
-rw-r--r--drivers/media/video/stradis.c9
-rw-r--r--drivers/media/video/tda7432.c12
-rw-r--r--drivers/media/video/tda9875.c4
-rw-r--r--drivers/media/video/tuner-3036.c6
-rw-r--r--drivers/media/video/videocodec.c2
-rw-r--r--drivers/media/video/vpx3220.c2
-rw-r--r--drivers/media/video/w9966.c6
-rw-r--r--drivers/media/video/zoran_card.c27
-rw-r--r--drivers/media/video/zoran_device.c8
-rw-r--r--drivers/media/video/zoran_device.h1
-rw-r--r--drivers/media/video/zoran_driver.c4
-rw-r--r--drivers/media/video/zr36016.c2
-rw-r--r--drivers/media/video/zr36050.c2
-rw-r--r--drivers/media/video/zr36060.c4
-rw-r--r--drivers/media/video/zr36120.c2
-rw-r--r--drivers/message/fusion/mptlan.c4
-rw-r--r--drivers/misc/ibmasm/module.c6
-rw-r--r--drivers/mmc/mmci.c3
-rw-r--r--drivers/mmc/pxamci.c2
-rw-r--r--drivers/mmc/wbsd.c6
-rw-r--r--drivers/mtd/devices/Kconfig2
-rw-r--r--drivers/mtd/devices/blkmtd.c9
-rw-r--r--drivers/mtd/devices/block2mtd.c1
-rw-r--r--drivers/mtd/devices/docprobe.c2
-rw-r--r--drivers/mtd/devices/mtdram.c4
-rw-r--r--drivers/mtd/devices/pmc551.c9
-rw-r--r--drivers/mtd/devices/slram.c6
-rw-r--r--drivers/mtd/ftl.c2
-rw-r--r--drivers/mtd/maps/scx200_docflash.c18
-rw-r--r--drivers/net/3c501.c4
-rw-r--r--drivers/net/3c503.c6
-rw-r--r--drivers/net/3c505.c6
-rw-r--r--drivers/net/3c507.c154
-rw-r--r--drivers/net/3c509.c29
-rw-r--r--drivers/net/3c515.c19
-rw-r--r--drivers/net/3c523.c4
-rw-r--r--drivers/net/3c59x.c61
-rw-r--r--drivers/net/8139cp.c2
-rw-r--r--drivers/net/82596.c8
-rw-r--r--drivers/net/8390.c21
-rw-r--r--drivers/net/8390.h1
-rw-r--r--drivers/net/Kconfig10
-rw-r--r--drivers/net/ac3200.c66
-rwxr-xr-xdrivers/net/amd8111e.c6
-rw-r--r--drivers/net/appletalk/cops.c6
-rw-r--r--drivers/net/appletalk/ipddp.c2
-rw-r--r--drivers/net/appletalk/ltpc.c8
-rw-r--r--drivers/net/arcnet/arcnet.c2
-rw-r--r--drivers/net/at1700.c6
-rw-r--r--drivers/net/atp.c10
-rw-r--r--drivers/net/bonding/bond_main.c20
-rw-r--r--drivers/net/cs89x0.c16
-rw-r--r--drivers/net/de600.c6
-rw-r--r--drivers/net/de620.c12
-rw-r--r--drivers/net/depca.c24
-rw-r--r--drivers/net/dgrs.c16
-rw-r--r--drivers/net/dl2k.c20
-rw-r--r--drivers/net/e100.c19
-rw-r--r--drivers/net/e1000/e1000_ethtool.c68
-rw-r--r--drivers/net/e1000/e1000_hw.c125
-rw-r--r--drivers/net/e1000/e1000_hw.h8
-rw-r--r--drivers/net/e1000/e1000_main.c220
-rw-r--r--drivers/net/e1000/e1000_osdep.h9
-rw-r--r--drivers/net/e1000/e1000_param.c8
-rw-r--r--drivers/net/e2100.c26
-rw-r--r--drivers/net/eepro100.c315
-rw-r--r--drivers/net/eexpress.c4
-rw-r--r--drivers/net/epic100.c8
-rw-r--r--drivers/net/es3210.c6
-rw-r--r--drivers/net/eth16i.c8
-rw-r--r--drivers/net/ewrk3.c5
-rw-r--r--drivers/net/fealnx.c12
-rw-r--r--drivers/net/forcedeth.c305
-rw-r--r--drivers/net/hamachi.c30
-rw-r--r--drivers/net/hamradio/baycom_epp.c4
-rw-r--r--drivers/net/hamradio/baycom_par.c4
-rw-r--r--drivers/net/hamradio/baycom_ser_fdx.c8
-rw-r--r--drivers/net/hamradio/baycom_ser_hdx.c6
-rw-r--r--drivers/net/hp-plus.c4
-rw-r--r--drivers/net/hp.c4
-rw-r--r--drivers/net/hp100.c8
-rw-r--r--drivers/net/ibmlana.c4
-rw-r--r--drivers/net/irda/ali-ircc.c6
-rw-r--r--drivers/net/irda/donauboe.c4
-rw-r--r--drivers/net/irda/irtty-sir.c6
-rw-r--r--drivers/net/irda/nsc-ircc.c10
-rw-r--r--drivers/net/irda/smsc-ircc2.c12
-rw-r--r--drivers/net/irda/tekram-sir.c4
-rw-r--r--drivers/net/irda/via-ircc.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c16
-rw-r--r--drivers/net/irda/w83977af_ir.c6
-rw-r--r--drivers/net/ixgb/ixgb_param.c4
-rw-r--r--drivers/net/lance.c8
-rw-r--r--drivers/net/lne390.c66
-rw-r--r--drivers/net/lp486e.c14
-rw-r--r--drivers/net/natsemi.c12
-rw-r--r--drivers/net/ne.c6
-rw-r--r--drivers/net/ne2.c6
-rw-r--r--drivers/net/ne2k-pci.c6
-rw-r--r--drivers/net/ne3210.c34
-rw-r--r--drivers/net/ni52.c8
-rw-r--r--drivers/net/ni65.c6
-rw-r--r--drivers/net/pcmcia/3c574_cs.c4
-rw-r--r--drivers/net/pcmcia/3c589_cs.c4
-rw-r--r--drivers/net/pcmcia/axnet_cs.c4
-rw-r--r--drivers/net/pcmcia/com20020_cs.c16
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c8
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c14
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c4
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c47
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c6
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c8
-rw-r--r--drivers/net/plip.c4
-rw-r--r--drivers/net/ppp_async.c2
-rw-r--r--drivers/net/r8169.c100
-rw-r--r--drivers/net/s2io.h2
-rw-r--r--drivers/net/seeq8005.c4
-rw-r--r--drivers/net/shaper.c2
-rw-r--r--drivers/net/sk98lin/Makefile1
-rw-r--r--drivers/net/sk98lin/h/skdrv2nd.h5
-rw-r--r--drivers/net/sk98lin/skaddr.c2
-rw-r--r--drivers/net/sk98lin/skethtool.c555
-rw-r--r--drivers/net/sk98lin/skge.c280
-rw-r--r--drivers/net/sk98lin/skproc.c433
-rw-r--r--drivers/net/smc-mca.c4
-rw-r--r--drivers/net/smc-ultra.c4
-rw-r--r--drivers/net/smc9194.c6
-rw-r--r--drivers/net/starfire.c18
-rw-r--r--drivers/net/sundance.c8
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--drivers/net/tlan.c10
-rw-r--r--drivers/net/tokenring/3c359.c42
-rw-r--r--drivers/net/tokenring/3c359.h2
-rw-r--r--drivers/net/tokenring/ibmtr.c6
-rw-r--r--drivers/net/tokenring/lanstreamer.c7
-rw-r--r--drivers/net/tokenring/olympic.c8
-rw-r--r--drivers/net/tokenring/proteon.c6
-rw-r--r--drivers/net/tokenring/skisa.c6
-rw-r--r--drivers/net/tokenring/smctr.c6
-rw-r--r--drivers/net/tulip/de2104x.c4
-rw-r--r--drivers/net/tulip/dmfe.c18
-rw-r--r--drivers/net/tulip/media.c37
-rw-r--r--drivers/net/tulip/timer.c1
-rw-r--r--drivers/net/tulip/tulip.h8
-rw-r--r--drivers/net/tulip/tulip_core.c52
-rw-r--r--drivers/net/tulip/winbond-840.c12
-rw-r--r--drivers/net/tulip/xircom_tulip_cb.c19
-rw-r--r--drivers/net/tun.c151
-rw-r--r--drivers/net/via-rhine.c2
-rw-r--r--drivers/net/via-velocity.c6
-rw-r--r--drivers/net/wan/cosa.c8
-rw-r--r--drivers/net/wan/cosa.h10
-rw-r--r--drivers/net/wan/cycx_main.c2
-rw-r--r--drivers/net/wan/dscc4.c4
-rw-r--r--drivers/net/wan/farsync.c11
-rw-r--r--drivers/net/wan/hostess_sv11.c8
-rw-r--r--drivers/net/wan/sbni.c14
-rw-r--r--drivers/net/wan/sealevel.c10
-rw-r--r--drivers/net/wan/syncppp.c2
-rw-r--r--drivers/net/wan/x25_asy.c2
-rw-r--r--drivers/net/wd.c8
-rw-r--r--drivers/net/wireless/airo.c28
-rw-r--r--drivers/net/wireless/airo_cs.c6
-rw-r--r--drivers/net/wireless/arlan-main.c47
-rw-r--r--drivers/net/wireless/atmel_cs.c6
-rw-r--r--drivers/net/wireless/netwave_cs.c12
-rw-r--r--drivers/net/wireless/orinoco.c4
-rw-r--r--drivers/net/wireless/orinoco_cs.c6
-rw-r--r--drivers/net/wireless/prism54/islpci_dev.c2
-rw-r--r--drivers/net/wireless/prism54/prismcompat.h6
-rw-r--r--drivers/net/wireless/ray_cs.c26
-rw-r--r--drivers/net/wireless/wavelan.c3
-rw-r--r--drivers/net/wireless/wavelan.p.h9
-rw-r--r--drivers/net/wireless/wavelan_cs.c4
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h8
-rw-r--r--drivers/net/wireless/wl3501_cs.c6
-rw-r--r--drivers/net/yellowfin.c14
-rw-r--r--drivers/net/znet.c2
-rw-r--r--drivers/oprofile/buffer_sync.c4
-rw-r--r--drivers/parport/parport_cs.c4
-rw-r--r--drivers/parport/parport_pc.c30
-rw-r--r--drivers/parport/share.c2
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c4
-rw-r--r--drivers/pci/quirks.c20
-rw-r--r--drivers/pnp/isapnp/core.c8
-rw-r--r--drivers/scsi/NCR_D700.c2
-rw-r--r--drivers/scsi/aacraid/aachba.c14
-rw-r--r--drivers/scsi/aha152x.c52
-rw-r--r--drivers/scsi/aha1542.c4
-rw-r--r--drivers/scsi/ahci.c9
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c40
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c12
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/scsi/g_NCR5380.c14
-rw-r--r--drivers/scsi/gdth.c24
-rw-r--r--drivers/scsi/ibmmca.c9
-rw-r--r--drivers/scsi/ide-scsi.c33
-rw-r--r--drivers/scsi/in2000.c2
-rw-r--r--drivers/scsi/nsp32.c6
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c16
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c6
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c8
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c4
-rw-r--r--drivers/scsi/qlogicfas.c4
-rw-r--r--drivers/scsi/sim710.c2
-rw-r--r--drivers/scsi/sr.c3
-rw-r--r--drivers/scsi/sr_ioctl.c3
-rw-r--r--drivers/serial/icom.c1
-rw-r--r--drivers/serial/mpc52xx_uart.c4
-rw-r--r--drivers/serial/sn_console.c2
-rw-r--r--drivers/telephony/ixj.c111
-rw-r--r--drivers/usb/net/usbnet.c2
-rw-r--r--drivers/video/amba-clcd.c18
-rw-r--r--drivers/video/console/mdacon.c15
-rw-r--r--drivers/video/console/sticore.c2
-rw-r--r--drivers/video/console/vgacon.c3
-rw-r--r--drivers/video/cyber2000fb.c2
-rw-r--r--drivers/video/hgafb.c2
-rw-r--r--drivers/video/i810/i810_accel.c43
-rw-r--r--drivers/video/matrox/matroxfb_base.c74
-rw-r--r--drivers/video/matrox/matroxfb_crtc2.c2
-rw-r--r--drivers/video/neofb.c5
-rw-r--r--drivers/video/pm2fb.c7
-rw-r--r--drivers/video/pxafb.c15
-rw-r--r--drivers/video/radeonfb.c24
-rw-r--r--drivers/video/riva/fbdev.c3
-rw-r--r--drivers/video/sa1100fb.c32
-rw-r--r--drivers/video/sstfb.c10
-rw-r--r--drivers/video/tdfxfb.c35
-rw-r--r--drivers/video/tridentfb.c27
-rw-r--r--drivers/video/vfb.c4
-rw-r--r--fs/Kconfig2
-rw-r--r--fs/afs/types.h2
-rw-r--r--fs/afs/volume.c4
-rw-r--r--fs/befs/debug.c2
-rw-r--r--fs/binfmt_aout.c2
-rw-r--r--fs/binfmt_elf.c7
-rw-r--r--fs/binfmt_em86.c2
-rw-r--r--fs/binfmt_script.c2
-rw-r--r--fs/bio.c2
-rw-r--r--fs/cifs/cifsfs.c4
-rw-r--r--fs/cifs/misc.c2
-rw-r--r--fs/coda/psdev.c1
-rw-r--r--fs/dcache.c23
-rw-r--r--fs/devpts/inode.c2
-rw-r--r--fs/exec.c7
-rw-r--r--fs/ext3/balloc.c5
-rw-r--r--fs/ext3/file.c16
-rw-r--r--fs/ext3/ialloc.c1
-rw-r--r--fs/ext3/namei.c9
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/file_table.c2
-rw-r--r--fs/fs-writeback.c1
-rw-r--r--fs/inode.c9
-rw-r--r--fs/jbd/checkpoint.c12
-rw-r--r--fs/jbd/commit.c17
-rw-r--r--fs/jbd/recovery.c2
-rw-r--r--fs/lockd/mon.c4
-rw-r--r--fs/lockd/svc.c16
-rw-r--r--fs/nfsd/nfs3xdr.c16
-rw-r--r--fs/nfsd/nfs4state.c3
-rw-r--r--fs/pipe.c152
-rw-r--r--fs/proc/generic.c5
-rw-r--r--fs/proc/kcore.c17
-rw-r--r--fs/proc/proc_misc.c4
-rw-r--r--fs/readdir.c3
-rw-r--r--fs/reiserfs/bitmap.c2
-rw-r--r--fs/reiserfs/dir.c4
-rw-r--r--fs/reiserfs/do_balan.c6
-rw-r--r--fs/reiserfs/file.c14
-rw-r--r--fs/reiserfs/fix_node.c2
-rw-r--r--fs/reiserfs/ibalance.c4
-rw-r--r--fs/reiserfs/inode.c18
-rw-r--r--fs/reiserfs/ioctl.c4
-rw-r--r--fs/reiserfs/item_ops.c10
-rw-r--r--fs/reiserfs/journal.c25
-rw-r--r--fs/reiserfs/prints.c75
-rw-r--r--fs/reiserfs/stree.c84
-rw-r--r--fs/reiserfs/super.c34
-rw-r--r--fs/reiserfs/xattr_acl.c4
-rw-r--r--fs/romfs/inode.c3
-rw-r--r--fs/select.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.c2
-rw-r--r--include/asm-alpha/spinlock.h6
-rw-r--r--include/asm-arm/arch-iop3xx/entry-macro.S11
-rw-r--r--include/asm-arm/arch-iop3xx/hardware.h1
-rw-r--r--include/asm-arm/arch-iop3xx/iop321.h28
-rw-r--r--include/asm-arm/arch-iop3xx/iop331-irqs.h23
-rw-r--r--include/asm-arm/arch-iop3xx/iop331.h47
-rw-r--r--include/asm-arm/arch-iop3xx/iq31244.h12
-rw-r--r--include/asm-arm/arch-iop3xx/iq80321.h11
-rw-r--r--include/asm-arm/arch-iop3xx/iq80331.h15
-rw-r--r--include/asm-arm/arch-iop3xx/iq80332.h23
-rw-r--r--include/asm-arm/arch-iop3xx/timex.h2
-rw-r--r--include/asm-arm/arch-iop3xx/uncompress.h8
-rw-r--r--include/asm-arm/arch-iop3xx/vmalloc.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h14
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h12
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h1
-rw-r--r--include/asm-arm/arch-pxa/memory.h2
-rw-r--r--include/asm-arm/dma-mapping.h19
-rw-r--r--include/asm-arm/hardware/amba_clcd.h5
-rw-r--r--include/asm-arm/pgtable.h2
-rw-r--r--include/asm-arm/spinlock.h8
-rw-r--r--include/asm-i386/bug.h2
-rw-r--r--include/asm-i386/mach-numaq/mach_apic.h10
-rw-r--r--include/asm-i386/smp.h2
-rw-r--r--include/asm-i386/spinlock.h16
-rw-r--r--include/asm-i386/string.h3
-rw-r--r--include/asm-i386/topology.h4
-rw-r--r--include/asm-ia64/io.h11
-rw-r--r--include/asm-ia64/mmzone.h11
-rw-r--r--include/asm-ia64/nodedata.h2
-rw-r--r--include/asm-ia64/numa.h2
-rw-r--r--include/asm-ia64/spinlock.h8
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-m32r/hardirq.h12
-rw-r--r--include/asm-m68k/adb_mouse.h23
-rw-r--r--include/asm-mips/sections.h1
-rw-r--r--include/asm-mips/sn/sn_private.h4
-rw-r--r--include/asm-mips/spinlock.h8
-rw-r--r--include/asm-parisc/spinlock.h5
-rw-r--r--include/asm-parisc/system.h3
-rw-r--r--include/asm-ppc/spinlock.h8
-rw-r--r--include/asm-ppc64/iommu.h13
-rw-r--r--include/asm-ppc64/machdep.h6
-rw-r--r--include/asm-ppc64/pci-bridge.h8
-rw-r--r--include/asm-ppc64/processor.h25
-rw-r--r--include/asm-ppc64/spinlock.h8
-rw-r--r--include/asm-ppc64/topology.h4
-rw-r--r--include/asm-s390/pgtable.h8
-rw-r--r--include/asm-s390/spinlock.h8
-rw-r--r--include/asm-sh/mpc1211/keyboard.h2
-rw-r--r--include/asm-sh/spinlock.h8
-rw-r--r--include/asm-sh64/keyboard.h2
-rw-r--r--include/asm-sparc/spinlock.h23
-rw-r--r--include/asm-sparc64/spinlock.h2
-rw-r--r--include/asm-x86_64/numa.h3
-rw-r--r--include/asm-x86_64/smp.h2
-rw-r--r--include/asm-x86_64/spinlock.h16
-rw-r--r--include/asm-x86_64/topology.h4
-rw-r--r--include/linux/ac97_codec.h22
-rw-r--r--include/linux/cdrom.h2
-rw-r--r--include/linux/fs.h4
-rw-r--r--include/linux/generic_serial.h1
-rw-r--r--include/linux/hardirq.h14
-rw-r--r--include/linux/ide.h22
-rw-r--r--include/linux/if_tun.h5
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/isicom.h173
-rw-r--r--include/linux/mca-legacy.h5
-rw-r--r--include/linux/mm.h14
-rw-r--r--include/linux/mmzone.h10
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/page-flags.h6
-rw-r--r--include/linux/parport_pc.h6
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pipe_fs_i.h19
-rw-r--r--include/linux/preempt.h19
-rw-r--r--include/linux/proc_fs.h5
-rw-r--r--include/linux/raid/linear.h7
-rw-r--r--include/linux/reiserfs_acl.h2
-rw-r--r--include/linux/reiserfs_fs.h32
-rw-r--r--include/linux/reiserfs_fs_sb.h1
-rw-r--r--include/linux/sched.h56
-rw-r--r--include/linux/smp.h33
-rw-r--r--include/linux/smp_lock.h14
-rw-r--r--include/linux/spinlock.h26
-rw-r--r--include/linux/topology.h16
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/pcmcia/mem_op.h89
-rw-r--r--init/initramfs.c11
-rw-r--r--init/main.c24
-rw-r--r--kernel/audit.c8
-rw-r--r--kernel/capability.c2
-rw-r--r--kernel/cpu.c3
-rw-r--r--kernel/dma.c2
-rw-r--r--kernel/exec_domain.c2
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c5
-rw-r--r--kernel/intermodule.c2
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/kthread.c25
-rw-r--r--kernel/module.c4
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/posix-timers.c2
-rw-r--r--kernel/printk.c10
-rw-r--r--kernel/profile.c2
-rw-r--r--kernel/resource.c2
-rw-r--r--kernel/sched.c665
-rw-r--r--kernel/softirq.c4
-rw-r--r--kernel/spinlock.c235
-rw-r--r--kernel/stop_machine.c4
-rw-r--r--kernel/sys.c5
-rw-r--r--kernel/timer.c13
-rw-r--r--kernel/user.c2
-rw-r--r--kernel/workqueue.c4
-rw-r--r--lib/Kconfig.debug15
-rw-r--r--lib/kernel_lock.c142
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/string.c2
-rw-r--r--mm/filemap.c30
-rw-r--r--mm/highmem.c2
-rw-r--r--mm/hugetlb.c7
-rw-r--r--mm/memory.c219
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/mlock.c2
-rw-r--r--mm/mmap.c17
-rw-r--r--mm/mremap.c16
-rw-r--r--mm/msync.c29
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/oom_kill.c2
-rw-r--r--mm/page_alloc.c210
-rw-r--r--mm/pdflush.c2
-rw-r--r--mm/rmap.c9
-rw-r--r--mm/shmem.c2
-rw-r--r--mm/slab.c2
-rw-r--r--mm/swapfile.c2
-rw-r--r--mm/thrash.c2
-rw-r--r--mm/truncate.c72
-rw-r--r--mm/vmalloc.c2
-rw-r--r--mm/vmscan.c9
-rw-r--r--net/core/sock.c9
-rw-r--r--net/ipv4/tcp_ipv4.c9
-rw-r--r--scripts/gen_initramfs_list.sh147
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/oss/ac97.c13
-rw-r--r--sound/oss/ac97.h16
-rw-r--r--sound/oss/ac97_codec.c91
-rw-r--r--sound/oss/aci.c6
-rw-r--r--sound/oss/ad1816.c23
-rw-r--r--sound/oss/ad1848.c30
-rw-r--r--sound/oss/ad1889.c18
-rw-r--r--sound/oss/adlib_card.c2
-rw-r--r--sound/oss/aedsp16.c22
-rw-r--r--sound/oss/ali5455.c13
-rw-r--r--sound/oss/awe_wave.c14
-rw-r--r--sound/oss/btaudio.c18
-rw-r--r--sound/oss/cmpci.c31
-rw-r--r--sound/oss/cs4232.c23
-rw-r--r--sound/oss/cs4232.h3
-rw-r--r--sound/oss/cs4281/cs4281_wrapper-24.c4
-rw-r--r--sound/oss/cs4281/cs4281m.c44
-rw-r--r--sound/oss/cs4281/cs4281pm-24.c6
-rw-r--r--sound/oss/cs46xx.c64
-rw-r--r--sound/oss/cs46xx_wrapper-24.h2
-rw-r--r--sound/oss/cs46xxpm-24.h1
-rw-r--r--sound/oss/emu10k1/audio.c13
-rw-r--r--sound/oss/emu10k1/audio.h3
-rw-r--r--sound/oss/emu10k1/cardmi.c59
-rw-r--r--sound/oss/emu10k1/cardmi.h17
-rw-r--r--sound/oss/emu10k1/cardwi.c2
-rw-r--r--sound/oss/emu10k1/efxmgr.c4
-rw-r--r--sound/oss/emu10k1/hwaccess.c38
-rw-r--r--sound/oss/emu10k1/hwaccess.h2
-rw-r--r--sound/oss/emu10k1/main.c8
-rw-r--r--sound/oss/emu10k1/voicemgr.c3
-rw-r--r--sound/oss/es1370.c4
-rw-r--r--sound/oss/es1371.c6
-rw-r--r--sound/oss/forte.c4
-rw-r--r--sound/oss/gus_card.c16
-rw-r--r--sound/oss/gus_wave.c2
-rw-r--r--sound/oss/i810_audio.c122
-rw-r--r--sound/oss/mad16.c26
-rw-r--r--sound/oss/maestro.c18
-rw-r--r--sound/oss/maestro3.c26
-rw-r--r--sound/oss/maestro3.h4
-rw-r--r--sound/oss/maui.c4
-rw-r--r--sound/oss/mpu401.c4
-rw-r--r--sound/oss/msnd_pinnacle.c35
-rw-r--r--sound/oss/nm256_audio.c12
-rw-r--r--sound/oss/opl3.c2
-rw-r--r--sound/oss/opl3sa.c12
-rw-r--r--sound/oss/opl3sa2.c25
-rw-r--r--sound/oss/pas2_card.c32
-rw-r--r--sound/oss/pss.c32
-rw-r--r--sound/oss/rme96xx.c28
-rw-r--r--sound/oss/sb.h3
-rw-r--r--sound/oss/sb_card.c2
-rw-r--r--sound/oss/sb_common.c13
-rw-r--r--sound/oss/sb_ess.c2
-rw-r--r--sound/oss/sequencer.c2
-rw-r--r--sound/oss/sgalaxy.c10
-rw-r--r--sound/oss/sonicvibes.c2
-rw-r--r--sound/oss/sscape.c14
-rw-r--r--sound/oss/trident.c3
-rw-r--r--sound/oss/trix.c20
-rw-r--r--sound/oss/uart6850.c4
-rw-r--r--sound/oss/via82cxxx_audio.c220
-rw-r--r--sound/oss/vwsnd.c6
-rw-r--r--sound/oss/wavfront.c100
-rw-r--r--sound/oss/ymfpci.c9
-rw-r--r--usr/Makefile48
-rw-r--r--usr/gen_init_cpio.c138
849 files changed, 10735 insertions, 8258 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index a8c19aa347674..72dc90f8f4a70 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -40,8 +40,6 @@ RCU/
- directory with info on RCU (read-copy update).
README.DAC960
- info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux.
-README.moxa
- - release notes for Moxa mutiport serial card.
SAK.txt
- info on Secure Attention Keys.
SubmittingDrivers
@@ -174,8 +172,6 @@ memory.txt
- info on typical Linux memory problems.
mips/
- directory with info about Linux on MIPS architecture.
-mkdev.cciss
- - script to make /dev entries for SMART controllers (see cciss.txt).
mono.txt
- how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
moxa-smartio
diff --git a/drivers/char/README.cycladesZ b/Documentation/README.cycladesZ
index 024a69443cc26..024a69443cc26 100644
--- a/drivers/char/README.cycladesZ
+++ b/Documentation/README.cycladesZ
diff --git a/Documentation/README.moxa b/Documentation/README.moxa
deleted file mode 100644
index 20600ad324b8c..0000000000000
--- a/Documentation/README.moxa
+++ /dev/null
@@ -1,18 +0,0 @@
- ===================================================================
- Release Note of Linux Driver for Moxa's C104/C168/CI-104J
- ===================================================================
-
- -------------------------------------------------------------------
- Ver. 1.1 Sep. 1, 1999
- -------------------------------------------------------------------
- 1. Improved:
- a. Static driver (kernel) and dynamic driver (loadable module)
- modes are supported.
- b. Multiple Smartio PCI series boards sharing the same IRQ
- supported.
-
- -------------------------------------------------------------------
- Ver. 1.0 Feb 17, 1997
- -------------------------------------------------------------------
- 1. Newly release.
-
diff --git a/Documentation/SAK.txt b/Documentation/SAK.txt
index 9be5a227b30e5..b9019ca872eaf 100644
--- a/Documentation/SAK.txt
+++ b/Documentation/SAK.txt
@@ -1,5 +1,5 @@
Linux 2.4.2 Secure Attention Key (SAK) handling
-18 March 2001, Andrew Morton <andrewm@uow.edu.au>
+18 March 2001, Andrew Morton <akpm@osdl.org>
An operating system's Secure Attention Key is a security tool which is
provided as protection against trojan password capturing programs. It
@@ -44,7 +44,7 @@ NOTES
/dev/console opened.
Unfortunately this includes a number of things which you don't
- actually want killed. This is because these appliccaitons are
+ actually want killed. This is because these applications are
incorrectly holding /dev/console open. Be sure to complain to your
Linux distributor about this!
diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
index 7d8f67e5c8377..aadd46fc30010 100644
--- a/Documentation/cciss.txt
+++ b/Documentation/cciss.txt
@@ -17,25 +17,27 @@ This driver is known to work with the following cards:
* SA 6422
* SA V100
-If nodes are not already created in the /dev/cciss directory
+If nodes are not already created in the /dev/cciss directory, run as root:
-# mkdev.cciss [ctlrs]
-
-Where ctlrs is the number of controllers you have (defaults to 1 if not
-specified).
+# cd /dev
+# ./MAKEDEV cciss
Device Naming:
--------------
-You need some entries in /dev for the cciss device. The mkdev.cciss script
+You need some entries in /dev for the cciss device. The MAKEDEV script
can make device nodes for you automatically. Currently the device setup
is as follows:
Major numbers:
104 cciss0
105 cciss1
- 106 cciss2
- etc...
+ 106 cciss2
+ 105 cciss3
+ 108 cciss4
+ 109 cciss5
+ 110 cciss6
+ 111 cciss7
Minor numbers:
b7 b6 b5 b4 b3 b2 b1 b0
@@ -45,7 +47,7 @@ Minor numbers:
|
+-------------------- Logical Volume number
-The suggested device naming scheme is:
+The device naming scheme is:
/dev/cciss/c0d0 Controller 0, disk 0, whole device
/dev/cciss/c0d0p1 Controller 0, disk 0, partition 1
/dev/cciss/c0d0p2 Controller 0, disk 0, partition 2
@@ -117,16 +119,13 @@ from the adapter, informing the SCSI mid layer may not be necessary.
Note that the naming convention of the /proc filesystem entries
contains a number in addition to the driver name. (E.g. "cciss0"
-instead of just "cciss" which you might expect.) This is because
-of changes to the 2.4 kernel PCI interface related to PCI hot plug
-that imply the driver must register with the SCSI mid layer once per
-adapter instance rather than once per driver.
+instead of just "cciss" which you might expect.)
Note: ONLY sequential access devices and medium changers are presented
as SCSI devices to the SCSI mid layer by the cciss driver. Specifically,
physical SCSI disk drives are NOT presented to the SCSI mid layer. The
physical SCSI disk drives are controlled directly by the array controller
-hardware and it is important to prevent the OS from attempting to directly
+hardware and it is important to prevent the kernel from attempting to directly
access these devices too, as if the array controller were merely a SCSI
controller in the same way that we are allowing it to access SCSI tape drives.
diff --git a/Documentation/early-userspace/README b/Documentation/early-userspace/README
index 7d5661284f257..270a88e22fb93 100644
--- a/Documentation/early-userspace/README
+++ b/Documentation/early-userspace/README
@@ -1,7 +1,7 @@
Early userspace support
=======================
-Last update: 2003-08-21
+Last update: 2004-12-20 tlh
"Early userspace" is a set of libraries and programs that provide
@@ -17,15 +17,66 @@ It consists of several major infrastructure components:
- initramfs, a chunk of code that unpacks the compressed cpio image
midway through the kernel boot process.
- klibc, a userspace C library, currently packaged separately, that is
- optimised for correctness and small size.
+ optimized for correctness and small size.
The cpio file format used by initramfs is the "newc" (aka "cpio -c")
-format, and is documented in the file "buffer-format.txt". If you
-want to generate your own cpio files directly instead of hacking on
-gen_init_cpio, you will need to short-circuit the build process in
-usr/ so that gen_init_cpio does not get run, then simply pop your own
-initramfs_data.cpio.gz file into place.
-
+format, and is documented in the file "buffer-format.txt". There are
+two ways to add an early userspace image: specify an existing cpio
+archive to be used as the image or have the kernel build process build
+the image from specifications.
+
+CPIO ARCHIVE method
+
+You can create a cpio archive that contains the early userspace image.
+Youre cpio archive should be specified in CONFIG_INITRAMFS_SOURCE and it
+will be used directly. Only a single cpio file may be specified in
+CONFIG_INITRAMFS_SOURCE and directory and file names are not allowed in
+combination with a cpio archive.
+
+IMAGE BUILDING method
+
+The kernel build process can also build an early userspace image from
+source parts rather than supplying a cpio archive. This method provides
+a way to create images with root-owned files even though the image was
+built by an unprivileged user.
+
+The image is specified as one or more sources in
+CONFIG_INITRAMFS_SOURCE. Sources can be either directories or files -
+cpio archives are *not* allowed when building from sources.
+
+A source directory will have it and all of it's contents packaged. The
+specified directory name will be mapped to '/'. When packaging a
+directory, limited user and group ID translation can be performed.
+INITRAMFS_ROOT_UID can be set to a user ID that needs to be mapped to
+user root (0). INITRAMFS_ROOT_GID can be set to a group ID that needs
+to be mapped to group root (0).
+
+A source file must be directives in the format required by the
+usr/gen_init_cpio utility (run 'usr/gen_init_cpio --help' to get the
+file format). The directives in the file will be passed directly to
+usr/gen_init_cpio.
+
+When a combination of directories and files are specified then the
+initramfs image will be an aggregate of all of them. In this way a user
+can create a 'root-image' directory and install all files into it.
+Because device-special files cannot be created by a unprivileged user,
+special files can be listed in a 'root-files' file. Both 'root-image'
+and 'root-files' can be listed in CONFIG_INITRAMFS_SOURCE and a complete
+early userspace image can be built by an unprivileged user.
+
+As a technical note, when directories and files are specified, the
+entire CONFIG_INITRAMFS_SOURCE is passed to
+scripts/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE
+can really be interpreted as any legal argument to
+gen_initramfs_list.sh. If a directory is specified as an argument then
+the contents are scanned, uid/gid translation is performed, and
+usr/gen_init_cpio file directives are output. If a directory is
+specified as an arugemnt to scripts/gen_initramfs_list.sh then the
+contents of the file are simply copied to the output. All of the output
+directives from directory scanning and file contents copying are
+processed by usr/gen_init_cpio.
+
+See also 'scripts/gen_initramfs_list.sh -h'.
Where's this all leading?
=========================
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 46f59e879f54d..26f119c12940b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1342,8 +1342,12 @@ running once the system is up.
thash_entries= [KNL,NET]
Set number of hash buckets for TCP connection
- tipar= [HW]
- See header of drivers/char/tipar.c.
+ tipar.timeout= [HW,PPT]
+ Set communications timeout in tenths of a second
+ (default 15).
+
+ tipar.delay= [HW,PPT]
+ Set inter-bit delay in microseconds (default 10).
tiusb= [HW,USB] Texas Instruments' USB GraphLink (aka SilverLink)
Format: <timeout>
diff --git a/Documentation/mkdev.cciss b/Documentation/mkdev.cciss
deleted file mode 100644
index fbbaf30a7175d..0000000000000
--- a/Documentation/mkdev.cciss
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# Script to create device nodes for SMART array controllers
-# Usage:
-# mkdev.cciss [num controllers] [num log volumes] [num partitions]
-#
-# With no arguments, the script assumes 1 controller, 16 logical volumes,
-# and 16 partitions/volume, which is adequate for most configurations.
-#
-# If you had 5 controllers and were planning on no more than 4 logical volumes
-# each, using a maximum of 8 partitions per volume, you could say:
-#
-# mkdev.cciss 5 4 8
-#
-# Of course, this has no real benefit over "mkdev.cciss 5" except that it
-# doesn't create so many device nodes in /dev/cciss.
-
-NR_CTLR=${1-1}
-NR_VOL=${2-16}
-NR_PART=${3-16}
-
-if [ ! -d /dev/cciss ]; then
- mkdir -p /dev/cciss
-fi
-
-C=0; while [ $C -lt $NR_CTLR ]; do
- MAJ=`expr $C + 104`
- D=0; while [ $D -lt $NR_VOL ]; do
- P=0; while [ $P -lt $NR_PART ]; do
- MIN=`expr $D \* 16 + $P`
- if [ $P -eq 0 ]; then
- mknod /dev/cciss/c${C}d${D} b $MAJ $MIN
- else
- mknod /dev/cciss/c${C}d${D}p${P} b $MAJ $MIN
- fi
- P=`expr $P + 1`
- done
- D=`expr $D + 1`
- done
- C=`expr $C + 1`
-done
diff --git a/Documentation/moxa-smartio b/Documentation/moxa-smartio
index fe24ecc6372e6..6a13b8e2aab4e 100644
--- a/Documentation/moxa-smartio
+++ b/Documentation/moxa-smartio
@@ -1,3 +1,13 @@
+***NOTE*** - The driver included in the kernel is not maintained by Moxa. They
+have a version 1.8 driver available from:
+
+http://www.moxa.com
+
+that works with 2.6 kernels. Currently, Moxa has no plans to have their updated
+driver merged into the kernel.
+
+James Nelson <james4765@gmail.com> - 12-12-2004
+
=============================================================================
MOXA Smartio Family Device Driver Ver 1.1 Installation Guide
diff --git a/Documentation/networking/e100.txt b/Documentation/networking/e100.txt
index e4b6c7afc6821..df7246947858e 100644
--- a/Documentation/networking/e100.txt
+++ b/Documentation/networking/e100.txt
@@ -1,7 +1,7 @@
Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
==============================================================
-September 13, 2004
+November 17, 2004
Contents
@@ -18,9 +18,7 @@ In This Release
===============
This file describes the Linux* Base Driver for the Intel(R) PRO/100 Family of
-Adapters, version 3.2.x. This driver includes support for Itanium(TM)2 and
-EM64T systems.
-
+Adapters, version 3.3.x. This driver supports 2.4.x and 2.6.x kernels.
Identifying Your Adapter
========================
@@ -119,12 +117,6 @@ Additional Configurations
The latest release of ethtool can be found at:
http://sf.net/projects/gkernel.
- After ethtool is installed, ethtool-copy.h must be copied and renamed to
- ethtool.h in your kernel source tree at <linux_kernel_src>/include/linux.
- Backup the original ethtool.h as needed before copying. The driver then
- must be recompiled in order to take advantage of the latest ethtool
- features.
-
NOTE: This driver uses mii support from the kernel. As a result, when
there is no link, ethtool will report speed/duplex to be 10/half.
diff --git a/Documentation/networking/e1000.txt b/Documentation/networking/e1000.txt
index 794c9254289f6..2ebd4058d46d4 100644
--- a/Documentation/networking/e1000.txt
+++ b/Documentation/networking/e1000.txt
@@ -1,7 +1,7 @@
Linux* Base Driver for the Intel(R) PRO/1000 Family of Adapters
===============================================================
-September 13, 2004
+November 17, 2004
Contents
@@ -20,8 +20,7 @@ In This Release
===============
This file describes the Linux* Base Driver for the Intel(R) PRO/1000 Family
-of Adapters, version 5.x.x. This driver includes support for Itanium(TM)2
-and EM64T systems.
+of Adapters, version 5.x.x.
For questions related to hardware requirements, refer to the documentation
supplied with your Intel PRO/1000 adapter. All hardware requirements listed
@@ -145,9 +144,11 @@ Valid Range: 80-256 for 82542 and 82543-based adapters
Default Value: 256
This value is the number of receive descriptors allocated by the driver.
Increasing this value allows the driver to buffer more incoming packets.
- Each descriptor is 16 bytes. A receive buffer is also allocated for each
- descriptor and can be either 2048, 4096, 8192, or 16384 bytes, depending
- on the MTU setting. The maximum MTU size is 16110.
+ Each descriptor is 16 bytes. A receive buffer is allocated for each
+ descriptor and can either be 2048 or 4096 bytes long, depending on the MTU
+
+ setting. An incoming packet can span one or more receive descriptors.
+ The maximum MTU size is 16110.
NOTE: MTU designates the frame size. It only needs to be set for Jumbo
Frames.
@@ -251,17 +252,16 @@ For copper-based boards, the keywords interact as follows:
also be forced.
The AutoNeg parameter is used when more control is required over the auto-
-negotiation process. When this parameter is used, Speed and Duplex must not
-be specified. This parameter is a bitmap that specifies which speed and
-duplex settings are advertised to the link partner.
+negotiation process. When this parameter is used, Speed and Duplex parameters
+must not be specified. The following table describes supported values for the
+AutoNeg parameter:
-Bit 7 6 5 4 3 2 1 0
-Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
-Duplex Full Full Half Full Half
+Speed (Mbps) 1000 100 100 10 10
+Duplex Full Full Half Full Half
+Value (in base 16) 0x20 0x08 0x04 0x02 0x01
-For example to limit the negotiated speed/duplex on the interface to 10 Mbps
-Half or Full duplex, set AutoNeg to 0x02:
- insmod e1000 AutoNeg=0x02
+Example: insmod e1000 AutoNeg=0x03, loads e1000 and specifies (10 full duplex,
+10 half duplex) for negotiation with the peer.
Note that setting AutoNeg does not guarantee that the board will link at the
highest specified speed or duplex mode, but the board will link at the
@@ -333,11 +333,7 @@ Additional Configurations
version 1.6 or later is required for this functionality.
The latest release of ethtool can be found from
- http://sf.net/projects/gkernel. After ethtool is installed,
- ethtool-copy.h must be copied and renamed to ethtool.h in your kernel
- source tree at <linux_kernel_src>/include/linux. Backup the original
- ethtool.h as needed before copying. The driver then must be recompiled
- in order to take advantage of the latest ethtool features.
+ http://sf.net/projects/gkernel.
NOTE: Ethtool 1.6 only supports a limited set of ethtool options. Support
for a more complete ethtool feature set can be enabled by upgrading
diff --git a/Documentation/pm.txt b/Documentation/pm.txt
index 008ac7d2d6d36..6b9aecc4cd5fb 100644
--- a/Documentation/pm.txt
+++ b/Documentation/pm.txt
@@ -91,54 +91,6 @@ void pm_unregister(struct pm_dev *dev);
void pm_unregister_all(pm_callback cback);
/*
- * Device idle/use detection
- *
- * In general, drivers for all devices should call "pm_access"
- * before accessing the hardware (ie. before reading or modifying
- * a hardware register). Request or packet-driven drivers should
- * additionally call "pm_dev_idle" when a device is not being used.
- *
- * Examples:
- * 1) A keyboard driver would call pm_access whenever a key is pressed
- * 2) A network driver would call pm_access before submitting
- * a packet for transmit or receive and pm_dev_idle when its
- * transfer and receive queues are empty.
- * 3) A VGA driver would call pm_access before it accesses any
- * of the video controller registers
- *
- * Ultimately, the PM policy manager uses the access and idle
- * information to decide when to suspend individual devices
- * or when to suspend the entire system
- */
-
-/*
- * Description: Update device access time and wake up device, if necessary
- *
- * Parameters:
- * dev - PM device previously returned from pm_register
- *
- * Details: If called from an interrupt handler pm_access updates
- * access time but should never need to wake up the device
- * (if device is generating interrupts, it should be awake
- * already) This is important as we can not wake up
- * devices from an interrupt handler.
- */
-void pm_access(struct pm_dev *dev);
-
-/*
- * Description: Identify device as currently being idle
- *
- * Parameters:
- * dev - PM device previously returned from pm_register
- *
- * Details: A call to pm_dev_idle might signal to the policy manager
- * to put a device to sleep. If a new device request arrives
- * between the call to pm_dev_idle and the pm_callback
- * callback, the driver should fail the pm_callback request.
- */
-void pm_dev_idle(struct pm_dev *dev);
-
-/*
* Power management request callback
*
* Parameters:
diff --git a/Documentation/riscom8.txt b/Documentation/riscom8.txt
index a51dafefff43e..14f61fdad7ca7 100644
--- a/Documentation/riscom8.txt
+++ b/Documentation/riscom8.txt
@@ -1,5 +1,12 @@
+* NOTE - this is an unmaintained driver. The original author cannot be located.
+
+SDL Communications is now SBS Technologies, and does not have any
+information on these ancient ISA cards on their website.
+
+James Nelson <james4765@gmail.com> - 12-12-2004
+
This is the README for RISCom/8 multi-port serial driver
- (C) 1994-1996 D.Gorodchanin (pgmdsg@ibi.com)
+ (C) 1994-1996 D.Gorodchanin
See file LICENSE for terms and conditions.
NOTE: English is not my native language.
@@ -10,47 +17,20 @@ Misc. notes for RISCom/8 serial driver, in no particular order :)
1) This driver can support up to 4 boards at time.
Use string "riscom8=0xXXX,0xXXX,0xXXX,0xXXX" at LILO prompt, for
setting I/O base addresses for boards. If you compile driver
- as module use insmod options "iobase=0xXXX iobase1=0xXXX iobase2=..."
+ as module use modprobe options "iobase=0xXXX iobase1=0xXXX iobase2=..."
2) The driver partially supports famous 'setserial' program, you can use almost
any of its options, excluding port & irq settings.
3) There are some misc. defines at the beginning of riscom8.c, please read the
comments and try to change some of them in case of problems.
-
+
4) I consider the current state of the driver as BETA.
- If you REALLY think you found a bug, send me e-mail, I hope I'll
- fix it. For any other problems please ask support@sdlcomm.com.
5) SDL Communications WWW page is http://www.sdlcomm.com.
-6) You can use the script at the end of this file to create RISCom/8 devices.
+6) You can use the MAKEDEV program to create RISCom/8 /dev/ttyL* entries.
7) Minor numbers for first board are 0-7, for second 8-15, etc.
22 Apr 1996.
-
--------------------------------cut here-------------------------------------
-#!/bin/bash
-NORMAL_DEVICE=/dev/ttyL
-CALLOUT_DEVICE=/dev/cuL
-NORMAL_MAJOR=48
-CALLOUT_MAJOR=49
-
-echo "Creating devices... "
-for i in 0 1 2 3; do
- echo "Board No $[$i+1]"
- for j in 0 1 2 3 4 5 6 7; do
- k=$[ 8 * $i + $j]
- rm -f $NORMAL_DEVICE$k
- mknod $NORMAL_DEVICE$k c $NORMAL_MAJOR $k
- chmod a+rw $NORMAL_DEVICE$k
- echo -n $NORMAL_DEVICE$k" "
- rm -f $CALLOUT_DEVICE$k
- mknod $CALLOUT_DEVICE$k c $CALLOUT_MAJOR $k
- chmod a+rw $CALLOUT_DEVICE$k
- echo $CALLOUT_DEVICE$k
- done
-done
-echo "done."
--------------------------------cut here-------------------------------------
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
new file mode 100644
index 0000000000000..f978414784590
--- /dev/null
+++ b/Documentation/sparse.txt
@@ -0,0 +1,72 @@
+Copyright 2004 Linus Torvalds
+Copyright 2004 Pavel Machek <pavel@suse.cz>
+
+Using sparse for typechecking
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+"__bitwise" is a type attribute, so you have to do something like this:
+
+ typedef int __bitwise pm_request_t;
+
+ enum pm_request {
+ PM_SUSPEND = (__force pm_request_t) 1,
+ PM_RESUME = (__force pm_request_t) 2
+ };
+
+which makes PM_SUSPEND and PM_RESUME "bitwise" integers (the "__force" is
+there because sparse will complain about casting to/from a bitwise type,
+but in this case we really _do_ want to force the conversion). And because
+the enum values are all the same type, now "enum pm_request" will be that
+type too.
+
+And with gcc, all the __bitwise/__force stuff goes away, and it all ends
+up looking just like integers to gcc.
+
+Quite frankly, you don't need the enum there. The above all really just
+boils down to one special "int __bitwise" type.
+
+So the simpler way is to just do
+
+ typedef int __bitwise pm_request_t;
+
+ #define PM_SUSPEND ((__force pm_request_t) 1)
+ #define PM_RESUME ((__force pm_request_t) 2)
+
+and you now have all the infrastructure needed for strict typechecking.
+
+One small note: the constant integer "0" is special. You can use a
+constant zero as a bitwise integer type without sparse ever complaining.
+This is because "bitwise" (as the name implies) was designed for making
+sure that bitwise types don't get mixed up (little-endian vs big-endian
+vs cpu-endian vs whatever), and there the constant "0" really _is_
+special.
+
+Modify top-level Makefile to say
+
+CHECK = sparse -Wbitwise
+
+or you don't get any checking at all.
+
+
+Where to get sparse
+~~~~~~~~~~~~~~~~~~~
+
+With BK, you can just get it from
+
+ bk://sparse.bkbits.net/sparse
+
+and DaveJ has tar-balls at
+
+ http://www.codemonkey.org.uk/projects/bitkeeper/sparse/
+
+
+Once you have it, just do
+
+ make
+ make install
+
+as your regular user, and it will install sparse in your ~/bin directory.
+After that, doing a kernel make with "make C=1" will run sparse on all the
+C files that get recompiled, or with "make C=2" will run sparse on the
+files whether they need to be recompiled or not (ie the latter is fast way
+to check the whole tree if you have already built it).
diff --git a/Documentation/stallion.txt b/Documentation/stallion.txt
index 084d485b1581a..5c4902d9a5bec 100644
--- a/Documentation/stallion.txt
+++ b/Documentation/stallion.txt
@@ -1,8 +1,13 @@
+* NOTE - This is an unmaintained driver. Lantronix, which bought Stallion
+technologies, is not active in driver maintenance, and they have no information
+on when or if they will have a 2.6 driver.
+
+James Nelson <james4765@gmail.com> - 12-12-2004
Stallion Multiport Serial Driver Readme
---------------------------------------
-Copyright (C) 1994-1999, Stallion Technologies (support@stallion.com).
+Copyright (C) 1994-1999, Stallion Technologies.
Version: 5.5.1
Date: 28MAR99
@@ -19,29 +24,20 @@ the true Stallion intelligent multiport boards - EasyConnection 8/64
If you are using any of the Stallion intelligent multiport boards (Brumby,
ONboard, EasyConnection 8/64 (ISA, EISA, MCA), EasyConnection/RA-PCI) with
-Linux you will need to get the driver utility package. This package is
-available at most of the Linux archive sites (and on CD-ROMs that contain
-these archives). The file will be called stallion-X.X.X.tar.gz where X.X.X
-will be the version number. In particular this package contains the board
-embedded executable images that are required for these boards. It also
-contains the downloader program. These boards cannot be used without this.
+Linux you will need to get the driver utility package. This contains a
+firmware loader and the firmware images necessary to make the devices operate.
The Stallion Technologies ftp site, ftp.stallion.com, will always have
-the latest version of the driver utility package. Other sites that usually
-have the latest version are tsx-11.mit.edu, sunsite.unc.edu and their
-mirrors.
+the latest version of the driver utility package.
-ftp.stallion.com:/drivers/ata5/Linux/v550.tar.gz
-tsx-11.mit.edu:/pub/linux/packages/stallion/stallion-5.5.0.tar.gz
-sunsite.unc.edu:/pub/Linux/kernel/patches/serial/stallion-5.5.0.tar.gz
+ftp://ftp.stallion.com/drivers/ata5/Linux/ata-linux-550.tar.gz
As of the printing of this document the latest version of the driver
utility package is 5.5.0. If a later version is now available then you
should use the latest version.
If you are using the EasyIO, EasyConnection 8/32 or EasyConnection 8/64-PCI
-boards then you don't need this package. Although it does have a handy
-script to create the /dev device nodes for these boards, and a serial stats
+boards then you don't need this package, although it does have a serial stats
display program.
If you require DIP switch settings, EISA or MCA configuration files, or any
@@ -85,7 +81,7 @@ Brumby or original Stallion board then use the "istallion" driver module.
Typically to load up the smart board driver use:
- insmod stallion.o
+ modprobe stallion
This will load the EasyIO and EasyConnection 8/32 driver. It will output a
message to say that it loaded and print the driver version number. It will
@@ -96,12 +92,12 @@ syslogd daemons are setup on your system.
To load the intelligent board driver use:
- insmod istallion.o
+ modprobe istallion
It will output similar messages to the smart board driver.
If not using an auto-detectable board type (that is a PCI board) then you
-will also need to supply command line arguments to the "insmod" command
+will also need to supply command line arguments to the modprobe command
when loading the driver. The general form of the configuration argument is
board?=<name>[,<ioaddr>[,<addr>][,<irq>]]
@@ -111,7 +107,7 @@ where:
board? -- specifies the arbitrary board number of this board,
can be in the range 0 to 3.
- name -- textual name of this board. The board name is the comman
+ name -- textual name of this board. The board name is the common
board name, or any "shortened" version of that. The board
type number may also be used here.
@@ -127,24 +123,24 @@ where:
Up to 4 board configuration arguments can be specified on the load line.
Here is some examples:
- insmod stallion.o board0=easyio,0x2a0,5
+ modprobe stallion board0=easyio,0x2a0,5
This configures an EasyIO board as board 0 at I/O address 0x2a0 and IRQ 5.
- insmod istallion.o board3=ec8/64,0x2c0,0xcc000
+ modprobe istallion board3=ec8/64,0x2c0,0xcc000
This configures an EasyConnection 8/64 ISA as board 3 at I/O address 0x2c0 at
memory address 0xcc000.
- insmod stallion.o board1=ec8/32-at,0x2a0,0x280,10
+ modprobe stallion board1=ec8/32-at,0x2a0,0x280,10
This configures an EasyConnection 8/32 ISA board at primary I/O address 0x2a0,
secondary address 0x280 and IRQ 10.
You will probably want to enter this module load and configuration information
into your system startup scripts so that the drivers are loaded and configured
-on each system boot. Typically the start up script would be something line
-/etc/rc.d/rc.modules.
+on each system boot. Typically the start up script would be something like
+/etc/modprobe.conf.
2.2 STATIC DRIVER CONFIGURATION:
@@ -161,8 +157,8 @@ supports any combination of ONboards, Brumbys, Stallions and EasyConnection
To set up the driver(s) for the boards that you want to use you need to
edit the appropriate driver file and add configuration entries.
-If using EasyIO or EasyConnection 8/32 ISA or MCA boards, do:
- vi /usr/src/linux/drivers/char/stallion.c
+If using EasyIO or EasyConnection 8/32 ISA or MCA boards,
+ In drivers/char/stallion.c:
- find the definition of the stl_brdconf array (of structures)
near the top of the file
- modify this to match the boards you are going to install
@@ -170,8 +166,8 @@ If using EasyIO or EasyConnection 8/32 ISA or MCA boards, do:
- save and exit
If using ONboard, Brumby, Stallion or EasyConnection 8/64 (ISA or EISA)
-boards then do:
- vi /usr/src/linux/drivers/char/istallion.c
+boards,
+ In drivers/char/istallion.c:
- find the definition of the stli_brdconf array (of structures)
near the top of the file
- modify this to match the boards you are going to install
@@ -291,20 +287,20 @@ If you load the wrong image file into a board it will fail to start up, and
of course the ports will not be operational!
If you are using the modularized version of the driver you might want to put
-the insmod calls in the startup script as well (before the download lines
+the modprobe calls in the startup script as well (before the download lines
obviously).
3.2 USING THE SERIAL PORTS
Once the driver is installed you will need to setup some device nodes to
-access the serial ports. The simplest method is to use the stallion utility
-"mkdevnods" script. It will automatically create device entries for Stallion
-boards. This will create the normal serial port devices as /dev/ttyE# where
-# is the port number starting from 0. A bank of 64 minor device numbers is
-allocated to each board, so the first port on the second board is port 64,
-etc. A set of callout type devices is also created. They are created as the
-devices /dev/cue# where # is the same as for the ttyE devices.
+access the serial ports. The simplest method is to use the /dev/MAKEDEV program.
+It will automatically create device entries for Stallion boards. This will
+create the normal serial port devices as /dev/ttyE# where# is the port number
+starting from 0. A bank of 64 minor device numbers is allocated to each board,
+so the first port on the second board is port 64,etc. A set of callout type
+devices may also be created. They are created as the devices /dev/cue# where #
+is the same as for the ttyE devices.
For the most part the Stallion driver tries to emulate the standard PC system
COM ports and the standard Linux serial driver. The idea is that you should
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 47a7121b4dc5e..7546b4faad75c 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -1,14 +1,14 @@
The intent of this file is to give a brief summary of hugetlbpage support in
the Linux kernel. This support is built on top of multiple page size support
-that is provided by most of modern architectures. For example, IA-32
+that is provided by most modern architectures. For example, IA-32
architecture supports 4K and 4M (2M in PAE mode) page sizes, IA-64
architecture supports multiple page sizes 4K, 8K, 64K, 256K, 1M, 4M, 16M,
-256M. A TLB is a cache of virtual-to-physical translations. Typically this
-is a very scarce resource on processor. Operating systems try to make best
-use of limited number of TLB resources. This optimization is more critical
-now as bigger and bigger physical memories (several GBs) are more readily
-available.
+256M and ppc64 supports 4K and 16M. A TLB is a cache of virtual-to-physical
+translations. Typically this is a very scarce resource on processor.
+Operating systems try to make best use of limited number of TLB resources.
+This optimization is more critical now as bigger and bigger physical memories
+(several GBs) are more readily available.
Users can use the huge page support in Linux kernel by either using the mmap
system call or standard SYSv shared memory system calls (shmget, shmat).
@@ -98,125 +98,187 @@ a supplementary group and system admin needs to configure that gid into
applications to use any combination of mmaps and shm* calls. Though the
mount of filesystem will be required for using mmaps.
-/* Example of using hugepage in user application using Sys V shared memory
- * system calls. In this example, app is requesting memory of size 256MB that
- * is backed by huge pages. Application uses the flag SHM_HUGETLB in shmget
- * system call to informt the kernel that it is requesting hugepages. For
- * IA-64 architecture, Linux kernel reserves Region number 4 for hugepages.
- * That means the addresses starting with 0x800000....will need to be
- * specified.
+*******************************************************************
+
+/*
+ * Example of using hugepage memory in a user application using Sys V shared
+ * memory system calls. In this example the app is requesting 256MB of
+ * memory that is backed by huge pages. The application uses the flag
+ * SHM_HUGETLB in the shmget system call to inform the kernel that it is
+ * requesting hugepages.
+ *
+ * For the IA-64 architecture, the Linux kernel reserves Region number 4 for
+ * hugepages. That means the addresses starting with 0x800000... will need
+ * to be specified. Specifying a fixed address is not required on ppc64,
+ * i386 or amd64.
+ *
+ * Note: The default shared memory limit is quite low on many kernels,
+ * you may need to increase it via:
+ *
+ * echo 268435456 > /proc/sys/kernel/shmmax
+ *
+ * This will increase the maximum size per shared memory segment to 256MB.
+ * The other limit that you will hit eventually is shmall which is the
+ * total amount of shared memory in pages. To set it to 16GB on a system
+ * with a 4kB pagesize do:
+ *
+ * echo 4194304 > /proc/sys/kernel/shmall
*/
+#include <stdlib.h>
+#include <stdio.h>
#include <sys/types.h>
+#include <sys/ipc.h>
#include <sys/shm.h>
-#include <sys/types.h>
#include <sys/mman.h>
-#include <errno.h>
-extern int errno;
+#ifndef SHM_HUGETLB
#define SHM_HUGETLB 04000
-#define LPAGE_SIZE (256UL*1024UL*1024UL)
-#define dprintf(x) printf(x)
-#define ADDR (0x8000000000000000UL)
-main()
+#endif
+
+#define LENGTH (256UL*1024*1024)
+
+#define dprintf(x) printf(x)
+
+/* Only IA64 requires this */
+#ifdef IA64
+#define ADDR (void *)(0x8000000000000000UL)
+#define SHMAT_FLAGS (SHM_RND)
+#else
+#define ADDR (void *)(0x0UL)
+#define SHMAT_FLAGS (0)
+#endif
+
+int main(void)
{
- int shmid;
- int i, j, k;
- volatile char *shmaddr;
-
- if ((shmid =shmget(2, LPAGE_SIZE, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W ))
-< 0) {
- perror("Failure:");
- exit(1);
- }
- printf("shmid: 0x%x\n", shmid);
- shmaddr = shmat(shmid, (void *)ADDR, SHM_RND) ;
- if (errno != 0) {
- perror("Shared Memory Attach Failure:");
- exit(2);
- }
- printf("shmaddr: %p\n", shmaddr);
-
- dprintf("Starting the writes:\n");
- for (i=0;i<LPAGE_SIZE;i++) {
- shmaddr[i] = (char) (i);
- if (!(i%(1024*1024))) dprintf(".");
- }
- dprintf("\n");
- dprintf("Starting the Check...");
- for (i=0; i<LPAGE_SIZE;i++)
- if (shmaddr[i] != (char)i)
- printf("\nIndex %d mismatched.");
- dprintf("Done.\n");
- if (shmdt((const void *)shmaddr) != 0) {
- perror("Detached Failure:");
- exit (3);
- }
+ int shmid;
+ unsigned long i;
+ char *shmaddr;
+
+ if ((shmid = shmget(2, LENGTH,
+ SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W)) < 0) {
+ perror("shmget");
+ exit(1);
+ }
+ printf("shmid: 0x%x\n", shmid);
+
+ shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS);
+ if (shmaddr == (char *)-1) {
+ perror("Shared memory attach failure");
+ shmctl(shmid, IPC_RMID, NULL);
+ exit(2);
+ }
+ printf("shmaddr: %p\n", shmaddr);
+
+ dprintf("Starting the writes:\n");
+ for (i = 0; i < LENGTH; i++) {
+ shmaddr[i] = (char)(i);
+ if (!(i % (1024 * 1024)))
+ dprintf(".");
+ }
+ dprintf("\n");
+
+ dprintf("Starting the Check...");
+ for (i = 0; i < LENGTH; i++)
+ if (shmaddr[i] != (char)i)
+ printf("\nIndex %lu mismatched\n", i);
+ dprintf("Done.\n");
+
+ if (shmdt((const void *)shmaddr) != 0) {
+ perror("Detach failure");
+ shmctl(shmid, IPC_RMID, NULL);
+ exit(3);
+ }
+
+ shmctl(shmid, IPC_RMID, NULL);
+
+ return 0;
}
-*******************************************************************
-*******************************************************************
+*******************************************************************
-/* Example of using hugepage in user application using mmap
- * system call. Before running this application, make sure that
- * administrator has mounted the hugetlbfs (on some directory like /mnt) using
- * the command mount -t hugetlbfs nodev /mnt
- * In this example, app is requesting memory of size 256MB that
- * is backed by huge pages. Application uses the flag SHM_HUGETLB in shmget
- * system call to informt the kernel that it is requesting hugepages. For
- * IA-64 architecture, Linux kernel reserves Region number 4 for hugepages.
- * That means the addresses starting with 0x800000....will need to be
- * specified.
+/*
+ * Example of using hugepage memory in a user application using the mmap
+ * system call. Before running this application, make sure that the
+ * administrator has mounted the hugetlbfs filesystem (on some directory
+ * like /mnt) using the command mount -t hugetlbfs nodev /mnt. In this
+ * example, the app is requesting memory of size 256MB that is backed by
+ * huge pages.
+ *
+ * For IA-64 architecture, Linux kernel reserves Region number 4 for hugepages.
+ * That means the addresses starting with 0x800000... will need to be
+ * specified. Specifying a fixed address is not required on ppc64, i386
+ * or amd64.
*/
-#include <unistd.h>
+#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
-#include <errno.h>
#define FILE_NAME "/mnt/hugepagefile"
-#define LENGTH (256*1024*1024)
+#define LENGTH (256UL*1024*1024)
#define PROTECTION (PROT_READ | PROT_WRITE)
-#define FLAGS MAP_SHARED |MAP_FIXED
-#define ADDRESS (char *)(0x60000000UL + 0x8000000000000000UL)
-extern errno;
+/* Only IA64 requires this */
+#ifdef IA64
+#define ADDR (void *)(0x8000000000000000UL)
+#define FLAGS (MAP_SHARED | MAP_FIXED)
+#else
+#define ADDR (void *)(0x0UL)
+#define FLAGS (MAP_SHARED)
+#endif
-check_bytes(char *addr)
+void check_bytes(char *addr)
{
- printf("First hex is %x\n", *((unsigned int *)addr));
+ printf("First hex is %x\n", *((unsigned int *)addr));
}
-write_bytes(char *addr)
+void write_bytes(char *addr)
{
- int i;
- for (i=0;i<LENGTH;i++)
- *(addr+i)=(char)i;
+ unsigned long i;
+
+ for (i = 0; i < LENGTH; i++)
+ *(addr + i) = (char)i;
}
-read_bytes(char *addr)
+
+void read_bytes(char *addr)
{
- int i;
- check_bytes(addr);
- for (i=0;i<LENGTH;i++)
- if (*(addr+i)!=(char)i) {
- printf("Mismatch at %d\n", i);
- break;
- }
+ unsigned long i;
+
+ check_bytes(addr);
+ for (i = 0; i < LENGTH; i++)
+ if (*(addr + i) != (char)i) {
+ printf("Mismatch at %lu\n", i);
+ break;
+ }
}
-main()
+
+int main(void)
{
- unsigned long addr = 0;
- int fd ;
-
- fd = open(FILE_NAME, O_CREAT|O_RDWR, 0755);
- if (fd < 0) {
- perror("Open failed");
- exit(errno);
- }
- addr = (unsigned long)mmap(ADDRESS, LENGTH, PROTECTION, FLAGS, fd, 0);
- if (errno != 0)
- perror("mmap failed");
- printf("Returned address is %p\n", addr);
- check_bytes((char*)addr);
- write_bytes((char*)addr);
- read_bytes((char *)addr);
+ void *addr;
+ int fd;
+
+ fd = open(FILE_NAME, O_CREAT | O_RDWR, 0755);
+ if (fd < 0) {
+ perror("Open failed");
+ exit(1);
+ }
+
+ addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, fd, 0);
+ if (addr == MAP_FAILED) {
+ perror("mmap");
+ unlink(FILE_NAME);
+ exit(1);
+ }
+
+ printf("Returned address is %p\n", addr);
+ check_bytes(addr);
+ write_bytes(addr);
+ read_bytes(addr);
+
+ munmap(addr, LENGTH);
+ close(fd);
+ unlink(FILE_NAME);
+
+ return 0;
}
diff --git a/Documentation/vm/numa b/Documentation/vm/numa
index 21a3442b77b91..4b8db1bd3b78e 100644
--- a/Documentation/vm/numa
+++ b/Documentation/vm/numa
@@ -29,7 +29,7 @@ Each node's page allocation data structures have also been encapsulated
into a pg_data_t. The bootmem_data_t is just one part of this. To
make the code look uniform between NUMA and regular UMA platforms,
UMA platforms have a statically allocated pg_data_t too (contig_page_data).
-For the sake of uniformity, the variable "numnodes" is also defined
+For the sake of uniformity, the function num_online_nodes() is also defined
for all platforms. As we run benchmarks, we might decide to NUMAize
more variables like low_on_memory, nr_free_pages etc into the pg_data_t.
diff --git a/MAINTAINERS b/MAINTAINERS
index 91730edf85997..da90e2c0a1e9e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -972,6 +972,11 @@ P: Oliver Neukum
M: oliver@neukum.name
S: Maintained
+HUGETLB FILESYSTEM
+P: William Irwin
+M: wli@holomorphy.com
+S: Maintained
+
I2C AND SENSORS DRIVERS
P: Greg Kroah-Hartman
M: greg@kroah.com
@@ -1871,9 +1876,7 @@ L: linux-hams@vger.kernel.org
S: Maintained
RISCOM8 DRIVER
-P: Dmitry Gorodchanin
-L: linux-kernel@vger.kernel.org
-S: Maintained
+S: Orphan
RTLINUX REALTIME LINUX
P: Victor Yodaiken
@@ -2082,7 +2085,6 @@ S: Maintained
SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
P: Roger Wolff
M: R.E.Wolff@BitWizard.nl
-M: io8-linux@specialix.co.uk
L: linux-kernel@vger.kernel.org ?
S: Supported
diff --git a/Makefile b/Makefile
index 2338eecc5171f..3c7e1afc4a5b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1168,7 +1168,7 @@ cmd_TAGS = $(all-sources) | etags -
quiet_cmd_tags = MAKE $@
define cmd_tags
rm -f $@; \
- CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
+ CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_GPL"`; \
$(all-sources) | xargs ctags $$CTAGSF -a
endef
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 74d70f26f4cdc..0c79b9d95f74e 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -489,7 +489,7 @@ config SMP
singleprocessor machines. On a singleprocessor machine, the kernel
will run faster if you say N here.
- See also the <file:Documentation/smp.tex>, and the SMP-HOWTO
+ See also the <file:Documentation/smp.txt>, and the SMP-HOWTO
available at <http://www.tldp.org/docs.html#howto>.
If you don't know what to do here, say N.
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
index bb4fe0498390e..44866cb26a802 100644
--- a/arch/alpha/kernel/core_marvel.c
+++ b/arch/alpha/kernel/core_marvel.c
@@ -118,7 +118,7 @@ alloc_io7(unsigned int pe)
io7 = alloc_bootmem(sizeof(*io7));
io7->pe = pe;
- io7->irq_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&io7->irq_lock);
for (h = 0; h < 4; h++) {
io7->ports[h].io7 = io7;
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
index 631240245e9e2..1e09ac5a026a8 100644
--- a/arch/alpha/kernel/srmcons.c
+++ b/arch/alpha/kernel/srmcons.c
@@ -179,7 +179,7 @@ srmcons_get_private_struct(struct srmcons_private **ps)
}
srmconsp->tty = NULL;
- srmconsp->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&srmconsp->lock);
init_timer(&srmconsp->timer);
*ps = srmconsp;
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index a839578e9f56e..ba81c4422aaf5 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -246,7 +246,7 @@ setup_memory_node(int nid, void *kernel_end)
reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start), bootmap_size);
printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
- numnodes++;
+ node_set_online(nid);
}
void __init
@@ -256,7 +256,7 @@ setup_memory(void *kernel_end)
show_mem_layout();
- numnodes = 0;
+ nodes_clear(node_online_map);
min_low_pfn = ~0UL;
max_low_pfn = 0UL;
@@ -303,7 +303,7 @@ void __init paging_init(void)
*/
dma_local_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
unsigned long start_pfn = node_bdata[nid].node_boot_start >> PAGE_SHIFT;
unsigned long end_pfn = node_bdata[nid].node_low_pfn;
@@ -332,7 +332,7 @@ void __init mem_init(void)
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
reservedpages = 0;
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
/*
* This will free up the bootmem, ie, slot 0 memory
*/
@@ -372,7 +372,7 @@ show_mem(void)
printk("\nMem-info:\n");
show_free_areas();
printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
struct page * lmem_map = node_mem_map(nid);
i = node_spanned_pages(nid);
while (i-- > 0) {
diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S
index 637e63773db53..7a14f508e1846 100644
--- a/arch/arm/boot/compressed/head-xscale.S
+++ b/arch/arm/boot/compressed/head-xscale.S
@@ -34,20 +34,6 @@ __XScale_start:
bic r0, r0, #0x1000 @ clear Icache
mcr p15, 0, r0, c1, c0, 0
-#ifdef CONFIG_ARCH_IQ80321
- mov r7, #MACH_TYPE_IQ80321
-#endif
-
-#ifdef CONFIG_ARCH_IQ31244
- mov r7, #(MACH_TYPE_IQ31244 & 0xff)
- orr r7, r7, #(MACH_TYPE_IQ31244 & 0xff00)
-#endif
-
-#ifdef CONFIG_ARCH_IQ80331
- mov r7, #(MACH_TYPE_IQ80331 & 0xff)
- orr r7, r7, #(MACH_TYPE_IQ80331 & 0xff00)
-#endif
-
#ifdef CONFIG_ARCH_LUBBOCK
mov r7, #MACH_TYPE_LUBBOCK
#endif
diff --git a/arch/arm/configs/ep80219_defconfig b/arch/arm/configs/ep80219_defconfig
index e2c9926372ce0..2659f0d325091 100644
--- a/arch/arm/configs/ep80219_defconfig
+++ b/arch/arm/configs/ep80219_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc3
-# Wed Dec 15 17:03:41 2004
+# Linux kernel version: 2.6.10
+# Thu Jan 6 10:54:33 2005
#
CONFIG_ARM=y
CONFIG_MMU=y
@@ -90,6 +90,7 @@ CONFIG_ARCH_IOP3XX=y
# CONFIG_ARCH_IQ80321 is not set
CONFIG_ARCH_IQ31244=y
# CONFIG_ARCH_IQ80331 is not set
+# CONFIG_MACH_IQ80332 is not set
CONFIG_ARCH_EP80219=y
CONFIG_ARCH_IOP321=y
# CONFIG_ARCH_IOP331 is not set
@@ -119,7 +120,6 @@ CONFIG_XSCALE_PMU=y
# General setup
#
CONFIG_PCI=y
-# CONFIG_ZBOOT_ROM is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
# CONFIG_XIP_KERNEL is not set
@@ -144,7 +144,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
# CONFIG_PM is not set
# CONFIG_PREEMPT is not set
# CONFIG_ARTHUR is not set
-CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200 mem=128M@0xa0000000"
+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
CONFIG_ALIGNMENT_TRAP=y
#
@@ -398,7 +398,8 @@ CONFIG_E100_NAPI=y
#
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
+CONFIG_E1000=y
+CONFIG_E1000_NAPI=y
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
@@ -537,7 +538,7 @@ CONFIG_INPUT=y
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
diff --git a/arch/arm/configs/iq31244_defconfig b/arch/arm/configs/iq31244_defconfig
index 89c0eb224198f..5dd8397ca17c3 100644
--- a/arch/arm/configs/iq31244_defconfig
+++ b/arch/arm/configs/iq31244_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc3
-# Wed Dec 15 16:58:36 2004
+# Linux kernel version: 2.6.10
+# Thu Jan 6 10:53:05 2005
#
CONFIG_ARM=y
CONFIG_MMU=y
@@ -30,7 +30,8 @@ CONFIG_SYSCTL=y
CONFIG_LOG_BUF_SHIFT=14
# CONFIG_HOTPLUG is not set
CONFIG_KOBJECT_UEVENT=y
-# CONFIG_IKCONFIG is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -90,6 +91,7 @@ CONFIG_ARCH_IOP3XX=y
# CONFIG_ARCH_IQ80321 is not set
CONFIG_ARCH_IQ31244=y
# CONFIG_ARCH_IQ80331 is not set
+# CONFIG_MACH_IQ80332 is not set
# CONFIG_ARCH_EP80219 is not set
CONFIG_ARCH_IOP321=y
# CONFIG_ARCH_IOP331 is not set
@@ -119,7 +121,6 @@ CONFIG_XSCALE_PMU=y
# General setup
#
CONFIG_PCI=y
-# CONFIG_ZBOOT_ROM is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
# CONFIG_XIP_KERNEL is not set
@@ -144,7 +145,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
# CONFIG_PM is not set
# CONFIG_PREEMPT is not set
# CONFIG_ARTHUR is not set
-CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200 mem=256M@0xa0000000"
+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
CONFIG_ALIGNMENT_TRAP=y
#
@@ -506,7 +507,7 @@ CONFIG_INPUT=y
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
diff --git a/arch/arm/configs/iq80321_defconfig b/arch/arm/configs/iq80321_defconfig
index f3e08188f4187..527b62a0f8ff2 100644
--- a/arch/arm/configs/iq80321_defconfig
+++ b/arch/arm/configs/iq80321_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc3
-# Wed Dec 15 16:48:43 2004
+# Linux kernel version: 2.6.10
+# Thu Jan 6 10:52:05 2005
#
CONFIG_ARM=y
CONFIG_MMU=y
@@ -90,6 +90,7 @@ CONFIG_ARCH_IOP3XX=y
CONFIG_ARCH_IQ80321=y
# CONFIG_ARCH_IQ31244 is not set
# CONFIG_ARCH_IQ80331 is not set
+# CONFIG_MACH_IQ80332 is not set
# CONFIG_ARCH_EP80219 is not set
CONFIG_ARCH_IOP321=y
# CONFIG_ARCH_IOP331 is not set
@@ -119,7 +120,6 @@ CONFIG_XSCALE_PMU=y
# General setup
#
CONFIG_PCI=y
-# CONFIG_ZBOOT_ROM is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
# CONFIG_XIP_KERNEL is not set
@@ -144,7 +144,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
# CONFIG_PM is not set
# CONFIG_PREEMPT is not set
# CONFIG_ARTHUR is not set
-CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200 mem=128M@0xa0000000"
+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
CONFIG_ALIGNMENT_TRAP=y
#
@@ -427,7 +427,7 @@ CONFIG_INPUT=y
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
@@ -500,7 +500,84 @@ CONFIG_LEGACY_PTY_COUNT=256
#
# I2C support
#
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+CONFIG_I2C_IOP3XX=y
+# CONFIG_I2C_ISA is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Hardware Sensors Chip support
+#
+# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+
+#
+# Other I2C Chip support
+#
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
#
# Multimedia devices
@@ -689,7 +766,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_DEBUG_INFO is not set
CONFIG_FRAME_POINTER=y
-# CONFIG_DEBUG_USER is not set
+CONFIG_DEBUG_USER=y
#
# Security options
diff --git a/arch/arm/configs/iq80331_defconfig b/arch/arm/configs/iq80331_defconfig
index b744add800a23..43aeebbb92052 100644
--- a/arch/arm/configs/iq80331_defconfig
+++ b/arch/arm/configs/iq80331_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-rc3
-# Wed Dec 15 16:43:39 2004
+# Linux kernel version: 2.6.10
+# Thu Jan 6 10:44:16 2005
#
CONFIG_ARM=y
CONFIG_MMU=y
@@ -33,7 +33,6 @@ CONFIG_KOBJECT_UEVENT=y
# CONFIG_IKCONFIG is not set
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_FUTEX=y
CONFIG_EPOLL=y
@@ -91,12 +90,14 @@ CONFIG_ARCH_IOP3XX=y
# CONFIG_ARCH_IQ80321 is not set
# CONFIG_ARCH_IQ31244 is not set
CONFIG_ARCH_IQ80331=y
+# CONFIG_MACH_IQ80332 is not set
# CONFIG_ARCH_EP80219 is not set
CONFIG_ARCH_IOP331=y
#
# IOP3xx Chipset Features
#
+CONFIG_IOP331_STEPD=y
#
# Processor Type
@@ -119,7 +120,6 @@ CONFIG_XSCALE_PMU=y
# General setup
#
CONFIG_PCI=y
-# CONFIG_ZBOOT_ROM is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
# CONFIG_XIP_KERNEL is not set
@@ -141,11 +141,10 @@ CONFIG_BINFMT_AOUT=y
#
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_DEBUG_DRIVER is not set
# CONFIG_PM is not set
# CONFIG_PREEMPT is not set
# CONFIG_ARTHUR is not set
-CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200 mem=128M@0x00000000"
+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
CONFIG_ALIGNMENT_TRAP=y
#
@@ -511,7 +510,7 @@ CONFIG_INPUT=y
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
@@ -584,7 +583,84 @@ CONFIG_LEGACY_PTY_COUNT=256
#
# I2C support
#
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+CONFIG_I2C_IOP3XX=y
+# CONFIG_I2C_ISA is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Hardware Sensors Chip support
+#
+# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+
+#
+# Other I2C Chip support
+#
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
#
# Multimedia devices
@@ -764,19 +840,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y
#
# Kernel hacking
#
-CONFIG_DEBUG_KERNEL=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_SCHEDSTATS is not set
-# CONFIG_DEBUG_SLAB is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_KOBJECT is not set
-CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_KERNEL is not set
# CONFIG_DEBUG_INFO is not set
CONFIG_FRAME_POINTER=y
CONFIG_DEBUG_USER=y
-# CONFIG_DEBUG_WAITQ is not set
-CONFIG_DEBUG_ERRORS=y
-# CONFIG_DEBUG_LL is not set
#
# Security options
@@ -793,5 +860,5 @@ CONFIG_DEBUG_ERRORS=y
# Library routines
#
# CONFIG_CRC_CCITT is not set
-CONFIG_CRC32=y
+# CONFIG_CRC32 is not set
# CONFIG_LIBCRC32C is not set
diff --git a/arch/arm/configs/iq80332_defconfig b/arch/arm/configs/iq80332_defconfig
new file mode 100644
index 0000000000000..f6dacc4539d2c
--- /dev/null
+++ b/arch/arm/configs/iq80332_defconfig
@@ -0,0 +1,864 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.10
+# Thu Jan 6 10:51:02 2005
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_IOMAP=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+
+#
+# System Type
+#
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_CAMELOT is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+CONFIG_ARCH_IOP3XX=y
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_H720X is not set
+
+#
+# IOP3xx Implementation Options
+#
+
+#
+# IOP3xx Platform Types
+#
+# CONFIG_ARCH_IQ80321 is not set
+# CONFIG_ARCH_IQ31244 is not set
+# CONFIG_ARCH_IQ80331 is not set
+CONFIG_MACH_IQ80332=y
+# CONFIG_ARCH_EP80219 is not set
+CONFIG_ARCH_IOP331=y
+
+#
+# IOP3xx Chipset Features
+#
+# CONFIG_IOP331_STEPD is not set
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_MINICACHE=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_THUMB is not set
+CONFIG_XSCALE_PMU=y
+
+#
+# General setup
+#
+CONFIG_PCI=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_PCI_LEGACY_PROC is not set
+CONFIG_PCI_NAMES=y
+
+#
+# At least one math emulation must be selected
+#
+CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=y
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_PM is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_ARTHUR is not set
+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_REDBOOT_PARTS=y
+CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
+CONFIG_MTD_REDBOOT_PARTS_READONLY=y
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_GEOMETRY is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0xc0000000
+CONFIG_MTD_PHYSMAP_LEN=0x00800000
+CONFIG_MTD_PHYSMAP_BANKWIDTH=1
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_EDB7312 is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=8192
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+
+#
+# Multi-device support (RAID and LVM)
+#
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_LINEAR=y
+CONFIG_MD_RAID0=y
+CONFIG_MD_RAID1=y
+# CONFIG_MD_RAID10 is not set
+CONFIG_MD_RAID5=y
+# CONFIG_MD_RAID6 is not set
+# CONFIG_MD_MULTIPATH is not set
+# CONFIG_MD_FAULTY is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_CRYPT is not set
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_ZERO is not set
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_PACKET_MMAP=y
+# CONFIG_NETLINK_DEV is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+# CONFIG_NET_ETHERNET is not set
+
+#
+# Ethernet (1000 Mbit)
+#
+# CONFIG_ACENIC is not set
+# CONFIG_DL2K is not set
+CONFIG_E1000=y
+CONFIG_E1000_NAPI=y
+# CONFIG_NS83820 is not set
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+# CONFIG_R8169 is not set
+# CONFIG_SK98LIN is not set
+# CONFIG_TIGON3 is not set
+
+#
+# Ethernet (10000 Mbit)
+#
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+
+#
+# SCSI Transport Attributes
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
+# SCSI low-level drivers
+#
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_SCSI_SATA is not set
+# CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_EATA is not set
+# CONFIG_SCSI_EATA_PIO is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_GDTH is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
+# CONFIG_SCSI_QLOGIC_ISP is not set
+# CONFIG_SCSI_QLOGIC_FC is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+CONFIG_SCSI_QLA2XXX=y
+# CONFIG_SCSI_QLA21XX is not set
+# CONFIG_SCSI_QLA22XX is not set
+# CONFIG_SCSI_QLA2300 is not set
+# CONFIG_SCSI_QLA2322 is not set
+# CONFIG_SCSI_QLA6312 is not set
+# CONFIG_SCSI_QLA6322 is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_NSP32 is not set
+# CONFIG_SCSI_DEBUG is not set
+
+#
+# Fusion MPT device support
+#
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+# CONFIG_SERIO is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM is not set
+# CONFIG_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+CONFIG_I2C_IOP3XX=y
+# CONFIG_I2C_ISA is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Hardware Sensors Chip support
+#
+# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+
+#
+# Other I2C Chip support
+#
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+CONFIG_XFS_FS=y
+# CONFIG_XFS_RT is not set
+# CONFIG_XFS_QUOTA is not set
+CONFIG_XFS_SECURITY=y
+CONFIG_XFS_POSIX_ACL=y
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+CONFIG_NFSD=y
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V4 is not set
+# CONFIG_NFSD_TCP is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_INFO is not set
+CONFIG_FRAME_POINTER=y
+CONFIG_DEBUG_USER=y
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0859557e7133e..68543b2c27fd0 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/errno.h>
+#include <linux/mm.h>
#include <asm/io.h>
#include <asm/hardware/icst525.h>
@@ -259,6 +260,17 @@ static int impd1fb_clcd_setup(struct clcd_fb *fb)
return ret;
}
+static int impd1fb_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
+{
+ unsigned long start, size;
+
+ start = vma->vm_pgoff + (fb->fb.fix.smem_start >> PAGE_SHIFT);
+ size = vma->vm_end - vma->vm_start;
+
+ return remap_pfn_range(vma, vma->vm_start, start, size,
+ vma->vm_page_prot);
+}
+
static void impd1fb_clcd_remove(struct clcd_fb *fb)
{
iounmap(fb->fb.screen_base);
@@ -272,6 +284,7 @@ static struct clcd_board impd1_clcd_data = {
.disable = impd1fb_clcd_disable,
.enable = impd1fb_clcd_enable,
.setup = impd1fb_clcd_setup,
+ .mmap = impd1fb_clcd_mmap,
.remove = impd1fb_clcd_remove,
};
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 19809bba47172..68e15c36e3361 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -444,6 +444,14 @@ static int cp_clcd_setup(struct clcd_fb *fb)
return 0;
}
+static int cp_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
+{
+ return dma_mmap_writecombine(&fb->dev->dev, vma,
+ fb->fb.screen_base,
+ fb->fb.fix.smem_start,
+ fb->fb.fix.smem_len);
+}
+
static void cp_clcd_remove(struct clcd_fb *fb)
{
dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
@@ -456,6 +464,7 @@ static struct clcd_board clcd_data = {
.decode = clcdfb_decode,
.enable = cp_clcd_enable,
.setup = cp_clcd_setup,
+ .mmap = cp_clcd_mmap,
.remove = cp_clcd_remove,
};
diff --git a/arch/arm/mach-iop3xx/Kconfig b/arch/arm/mach-iop3xx/Kconfig
index 019b1bf258c56..2bfe8c729f9f3 100644
--- a/arch/arm/mach-iop3xx/Kconfig
+++ b/arch/arm/mach-iop3xx/Kconfig
@@ -25,6 +25,13 @@ config ARCH_IQ80331
Say Y here if you want to run your kernel on the Intel IQ80331
evaluation kit for the IOP331 chipset.
+config MACH_IQ80332
+ bool "Enable support for IQ80332"
+ select ARCH_IOP331
+ help
+ Say Y here if you want to run your kernel on the Intel IQ80332
+ evaluation kit for the IOP332 chipset
+
config ARCH_EP80219
bool "Enable support for EP80219"
select ARCH_IOP321
@@ -41,10 +48,16 @@ config ARCH_IOP331
bool
default ARCH_IQ80331
help
- The IQ80331 uses the IOP331 variant.
+ The IQ80331, IQ80332, and IQ80333 uses the IOP331 variant.
comment "IOP3xx Chipset Features"
-endmenu
+config IOP331_STEPD
+ bool "Chip stepping D of the IOP80331 processor or IOP80333"
+ depends on (ARCH_IOP331)
+ help
+ Say Y here if you have StepD of the IOP80331 or IOP8033
+ based platforms.
+endmenu
endif
diff --git a/arch/arm/mach-iop3xx/Makefile b/arch/arm/mach-iop3xx/Makefile
index e633dd9f4b267..b17eb1f461023 100644
--- a/arch/arm/mach-iop3xx/Makefile
+++ b/arch/arm/mach-iop3xx/Makefile
@@ -19,3 +19,5 @@ obj-$(CONFIG_ARCH_IQ80321) += iq80321-mm.o iq80321-pci.o
obj-$(CONFIG_ARCH_IQ31244) += iq31244-mm.o iq31244-pci.o
obj-$(CONFIG_ARCH_IQ80331) += iq80331-mm.o iq80331-pci.o
+
+obj-$(CONFIG_MACH_IQ80332) += iq80332-mm.o iq80332-pci.o
diff --git a/arch/arm/mach-iop3xx/iop321-pci.c b/arch/arm/mach-iop3xx/iop321-pci.c
index 8fdfc3a8fe0c3..580ef5af7588d 100644
--- a/arch/arm/mach-iop3xx/iop321-pci.c
+++ b/arch/arm/mach-iop3xx/iop321-pci.c
@@ -197,14 +197,6 @@ struct pci_bus *iop321_scan_bus(int nr, struct pci_sys_data *sys)
void iop321_init(void)
{
-#if CONFIG_ARCH_EP80219
- *IOP321_ATUCR = 0x2;
- *IOP321_OIOWTVR = 0x90000000;
- *IOP321_IABAR0 = 0x00000004;
- *IOP321_IABAR2 = 0xa000000c;
- *IOP321_IALR2 = 0xe0000000;
-#endif
-
DBG("PCI: Intel 80321 PCI init code.\n");
DBG("\tATU: IOP321_ATUCMD=0x%04x\n", *IOP321_ATUCMD);
DBG("\tATU: IOP321_OMWTVR0=0x%04x, IOP321_OIOWTVR=0x%04x\n",
diff --git a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c
index 12e4a787b8368..bf23e0fd28438 100644
--- a/arch/arm/mach-iop3xx/iop321-setup.c
+++ b/arch/arm/mach-iop3xx/iop321-setup.c
@@ -3,6 +3,7 @@
*
* Author: Nicolas Pitre <nico@cam.org>
* Copyright (C) 2001 MontaVista Software, Inc.
+ * Copyright (C) 2004 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -40,10 +41,10 @@ static struct map_desc iop321_std_desc[] __initdata = {
/* virtual physical length type */
/* mem mapped registers */
- { IOP321_VIRT_MEM_BASE, IOP321_PHY_MEM_BASE, 0x00002000, MT_DEVICE },
+ { IOP321_VIRT_MEM_BASE, IOP321_PHYS_MEM_BASE, 0x00002000, MT_DEVICE },
/* PCI IO space */
- { 0xfe000000, 0x90000000, 0x00020000, MT_DEVICE }
+ { IOP321_PCI_LOWER_IO_VA, IOP321_PCI_LOWER_IO_PA, IOP321_PCI_IO_WINDOW_SIZE, MT_DEVICE }
};
#ifdef CONFIG_ARCH_IQ80321
@@ -71,6 +72,60 @@ static struct uart_port iop321_serial_ports[] = {
}
};
+static struct resource iop32x_i2c_0_resources[] = {
+ [0] = {
+ .start = 0xfffff680,
+ .end = 0xfffff698,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IOP321_I2C_0,
+ .end = IRQ_IOP321_I2C_0,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct resource iop32x_i2c_1_resources[] = {
+ [0] = {
+ .start = 0xfffff6a0,
+ .end = 0xfffff6b8,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IOP321_I2C_1,
+ .end = IRQ_IOP321_I2C_1,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct platform_device iop32x_i2c_0_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 0,
+ .num_resources = 2,
+ .resource = iop32x_i2c_0_resources
+};
+
+static struct platform_device iop32x_i2c_1_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 1,
+ .num_resources = 2,
+ .resource = iop32x_i2c_1_resources
+};
+
+static struct platform_device *iop32x_devices[] __initdata = {
+ &iop32x_i2c_0_controller,
+ &iop32x_i2c_1_controller
+};
+
+void __init iop32x_init(void)
+{
+ if(iop_is_321())
+ {
+ platform_add_devices(iop32x_devices,
+ ARRAY_SIZE(iop32x_devices));
+ }
+}
+
void __init iop321_map_io(void)
{
iotable_init(iop321_std_desc, ARRAY_SIZE(iop321_std_desc));
@@ -97,6 +152,7 @@ MACHINE_START(IQ80321, "Intel IQ80321")
INITIRQ(iop321_init_irq)
.timer = &iop321_timer,
BOOT_PARAMS(0xa0000100)
+ INIT_MACHINE(iop32x_init)
MACHINE_END
#elif defined(CONFIG_ARCH_IQ31244)
MACHINE_START(IQ31244, "Intel IQ31244")
@@ -106,6 +162,7 @@ MACHINE_START(IQ31244, "Intel IQ31244")
INITIRQ(iop321_init_irq)
.timer = &iop321_timer,
BOOT_PARAMS(0xa0000100)
+ INIT_MACHINE(iop32x_init)
MACHINE_END
#else
#error No machine descriptor defined for this IOP3XX implementation
diff --git a/arch/arm/mach-iop3xx/iop331-pci.c b/arch/arm/mach-iop3xx/iop331-pci.c
index f6118dd10fa01..44dd213b48a35 100644
--- a/arch/arm/mach-iop3xx/iop331-pci.c
+++ b/arch/arm/mach-iop3xx/iop331-pci.c
@@ -4,7 +4,7 @@
* PCI support for the Intel IOP331 chipset
*
* Author: Dave Jiang (dave.jiang@intel.com)
- * Copyright (C) 2003 Intel Corp.
+ * Copyright (C) 2003, 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -26,7 +26,8 @@
#include <asm/arch/iop331.h>
-//#define DEBUG
+#undef DEBUG
+#undef DEBUG1
#ifdef DEBUG
#define DBG(x...) printk(x)
@@ -34,6 +35,12 @@
#define DBG(x...) do { } while (0)
#endif
+#ifdef DEBUG1
+#define DBG1(x...) printk(x)
+#else
+#define DBG1(x...) do { } while (0)
+#endif
+
/*
* This routine builds either a type0 or type1 configuration command. If the
* bus is on the 80331 then a type0 made, else a type1 is created.
@@ -197,21 +204,19 @@ struct pci_bus *iop331_scan_bus(int nr, struct pci_sys_data *sys)
void iop331_init(void)
{
- DBG("PCI: Intel 80331 PCI init code.\n");
- DBG("\tATU: IOP331_ATUCMD=0x%04x\n", *IOP331_ATUCMD);
- DBG("\tATU: IOP331_OMWTVR0=0x%04x, IOP331_OIOWTVR=0x%04x\n",
+ DBG1("PCI: Intel 80331 PCI init code.\n");
+ DBG1("\tATU: IOP331_ATUCMD=0x%04x\n", *IOP331_ATUCMD);
+ DBG1("\tATU: IOP331_OMWTVR0=0x%04x, IOP331_OIOWTVR=0x%04x\n",
*IOP331_OMWTVR0,
*IOP331_OIOWTVR);
- DBG("\tATU: IOP331_ATUCR=0x%08x\n", *IOP331_ATUCR);
- DBG("\tATU: IOP331_IABAR0=0x%08x IOP331_IALR0=0x%08x IOP331_IATVR0=%08x\n", *IOP331_IABAR0, *IOP331_IALR0, *IOP331_IATVR0);
- DBG("\tATU: IOP331_ERBAR=0x%08x IOP331_ERLR=0x%08x IOP331_ERTVR=%08x\n", *IOP331_ERBAR, *IOP331_ERLR, *IOP331_ERTVR);
- DBG("\tATU: IOP331_IABAR2=0x%08x IOP331_IALR2=0x%08x IOP331_IATVR2=%08x\n", *IOP331_IABAR2, *IOP331_IALR2, *IOP331_IATVR2);
- DBG("\tATU: IOP331_IABAR3=0x%08x IOP331_IALR3=0x%08x IOP331_IATVR3=%08x\n", *IOP331_IABAR3, *IOP331_IALR3, *IOP331_IATVR3);
-
- /* redboot changed, reset IABAR0 to something sane */
- /* fixes master aborts in plugged in cards */
- /* will clean up later and work nicely with redboot */
- *IOP331_IABAR0 = 0x00000004;
+ DBG1("\tATU: IOP331_OMWTVR1=0x%04x\n", *IOP331_OMWTVR1);
+ DBG1("\tATU: IOP331_ATUCR=0x%08x\n", *IOP331_ATUCR);
+ DBG1("\tATU: IOP331_IABAR0=0x%08x IOP331_IALR0=0x%08x IOP331_IATVR0=%08x\n", *IOP331_IABAR0, *IOP331_IALR0, *IOP331_IATVR0);
+ DBG1("\tATU: IOP31_IABAR1=0x%08x IOP331_IALR1=0x%08x\n", *IOP331_IABAR1, *IOP331_IALR1);
+ DBG1("\tATU: IOP331_ERBAR=0x%08x IOP331_ERLR=0x%08x IOP331_ERTVR=%08x\n", *IOP331_ERBAR, *IOP331_ERLR, *IOP331_ERTVR);
+ DBG1("\tATU: IOP331_IABAR2=0x%08x IOP331_IALR2=0x%08x IOP331_IATVR2=%08x\n", *IOP331_IABAR2, *IOP331_IALR2, *IOP331_IATVR2);
+ DBG1("\tATU: IOP331_IABAR3=0x%08x IOP331_IALR3=0x%08x IOP331_IATVR3=%08x\n", *IOP331_IABAR3, *IOP331_IALR3, *IOP331_IATVR3);
+
hook_fault_code(16+6, iop331_pci_abort, SIGBUS, "imprecise external abort");
}
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c
index 6cb68f3e839f4..622e7914819a4 100644
--- a/arch/arm/mach-iop3xx/iop331-setup.c
+++ b/arch/arm/mach-iop3xx/iop331-setup.c
@@ -12,6 +12,7 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/config.h>
+#include <linux/init.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/device.h>
@@ -42,13 +43,13 @@ static struct map_desc iop331_std_desc[] __initdata = {
{ IOP331_VIRT_MEM_BASE, IOP331_PHYS_MEM_BASE, 0x00002000, MT_DEVICE },
/* PCI IO space */
- { 0xfe000000, 0x90000000, 0x00020000, MT_DEVICE }
+ { IOP331_PCI_LOWER_IO_VA, IOP331_PCI_LOWER_IO_PA, IOP331_PCI_IO_WINDOW_SIZE, MT_DEVICE }
};
static struct uart_port iop331_serial_ports[] = {
{
- .membase = (char*)(IQ80331_UART0_VIRT),
- .mapbase = (IQ80331_UART0_PHYS),
+ .membase = (char*)(IOP331_UART0_VIRT),
+ .mapbase = (IOP331_UART0_PHYS),
.irq = IRQ_IOP331_UART0,
.flags = UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -58,8 +59,8 @@ static struct uart_port iop331_serial_ports[] = {
.type = PORT_XSCALE,
.fifosize = 32
} , {
- .membase = (char*)(IQ80331_UART1_VIRT),
- .mapbase = (IQ80331_UART1_PHYS),
+ .membase = (char*)(IOP331_UART1_VIRT),
+ .mapbase = (IOP331_UART1_PHYS),
.irq = IRQ_IOP331_UART1,
.flags = UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -71,6 +72,60 @@ static struct uart_port iop331_serial_ports[] = {
}
};
+static struct resource iop33x_i2c_0_resources[] = {
+ [0] = {
+ .start = 0xfffff680,
+ .end = 0xfffff698,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IOP331_I2C_0,
+ .end = IRQ_IOP331_I2C_0,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct resource iop33x_i2c_1_resources[] = {
+ [0] = {
+ .start = 0xfffff6a0,
+ .end = 0xfffff6b8,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IOP331_I2C_1,
+ .end = IRQ_IOP331_I2C_1,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct platform_device iop33x_i2c_0_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 0,
+ .num_resources = 2,
+ .resource = iop33x_i2c_0_resources
+};
+
+static struct platform_device iop33x_i2c_1_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 1,
+ .num_resources = 2,
+ .resource = iop33x_i2c_1_resources
+};
+
+static struct platform_device *iop33x_devices[] __initdata = {
+ &iop33x_i2c_0_controller,
+ &iop33x_i2c_1_controller
+};
+
+void __init iop33x_init(void)
+{
+ if(iop_is_331())
+ {
+ platform_add_devices(iop33x_devices,
+ ARRAY_SIZE(iop33x_devices));
+ }
+}
+
void __init iop331_map_io(void)
{
iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
@@ -78,22 +133,43 @@ void __init iop331_map_io(void)
early_serial_setup(&iop331_serial_ports[1]);
}
-#ifdef CONFIG_ARCH_IQ80331
+#ifdef CONFIG_ARCH_IOP331
extern void iop331_init_irq(void);
extern struct sys_timer iop331_timer;
+#endif
+
+#ifdef CONFIG_ARCH_IQ80331
extern void iq80331_map_io(void);
#endif
+#ifdef CONFIG_MACH_IQ80332
+extern void iq80332_map_io(void);
+#endif
+
#if defined(CONFIG_ARCH_IQ80331)
MACHINE_START(IQ80331, "Intel IQ80331")
MAINTAINER("Intel Corp.")
BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
- //BOOT_MEM(PHYS_OFFSET, IQ80331_UART0_VIRT, IQ80331_UART0_PHYS)
+ //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
MAPIO(iq80331_map_io)
INITIRQ(iop331_init_irq)
- .timer = &iop331_timer,
+ .timer = &iop331_timer,
BOOT_PARAMS(0x0100)
+ INIT_MACHINE(iop33x_init)
MACHINE_END
+
+#elif defined(CONFIG_MACH_IQ80332)
+MACHINE_START(IQ80332, "Intel IQ80332")
+ MAINTAINER("Intel Corp.")
+ BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
+ //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
+ MAPIO(iq80332_map_io)
+ INITIRQ(iop331_init_irq)
+ .timer = &iop331_timer,
+ BOOT_PARAMS(0x0100)
+ INIT_MACHINE(iop33x_init)
+MACHINE_END
+
#else
#error No machine descriptor defined for this IOP3XX implementation
#endif
diff --git a/arch/arm/mach-iop3xx/iq31244-pci.c b/arch/arm/mach-iop3xx/iq31244-pci.c
index 5eac93eb9d3d9..d33d8e41026c7 100644
--- a/arch/arm/mach-iop3xx/iq31244-pci.c
+++ b/arch/arm/mach-iop3xx/iq31244-pci.c
@@ -5,6 +5,7 @@
*
* Author: Rory Bolt <rorybolt@pacbell.net>
* Copyright (C) 2002 Rory Bolt
+ * Copyright (C) 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -77,28 +78,28 @@ static int iq31244_setup(int nr, struct pci_sys_data *sys)
memset(res, 0, sizeof(struct resource) * 2);
- res[0].start = IQ31244_PCI_IO_BASE + 0x6e000000;
- res[0].end = IQ31244_PCI_IO_BASE + IQ31244_PCI_IO_SIZE - 1 + IQ31244_PCI_IO_OFFSET;
+ res[0].start = IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_OFFSET;
+ res[0].end = IOP321_PCI_UPPER_IO_BA + IOP321_PCI_IO_OFFSET;
res[0].name = "IQ31244 PCI I/O Space";
res[0].flags = IORESOURCE_IO;
- res[1].start = IQ31244_PCI_MEM_BASE;
- res[1].end = IQ31244_PCI_MEM_BASE + IQ31244_PCI_MEM_SIZE;
+ res[1].start = IOP321_PCI_LOWER_MEM_BA + IOP321_PCI_MEM_OFFSET;
+ res[1].end = IOP321_PCI_UPPER_MEM_BA + IOP321_PCI_MEM_OFFSET;
res[1].name = "IQ31244 PCI Memory Space";
res[1].flags = IORESOURCE_MEM;
request_resource(&ioport_resource, &res[0]);
request_resource(&iomem_resource, &res[1]);
+ sys->mem_offset = IOP321_PCI_MEM_OFFSET;
+ sys->io_offset = IOP321_PCI_IO_OFFSET;
+
sys->resource[0] = &res[0];
sys->resource[1] = &res[1];
sys->resource[2] = NULL;
- sys->io_offset = IQ31244_PCI_IO_OFFSET;
- sys->mem_offset = IQ80321_PCI_MEM_BASE -
- (*IOP321_IABAR1 & PCI_BASE_ADDRESS_MEM_MASK);
- iop3xx_pcibios_min_io = IQ31244_PCI_IO_BASE;
- iop3xx_pcibios_min_mem = IQ31244_PCI_MEM_BASE;
+ iop3xx_pcibios_min_io = IOP321_PCI_LOWER_IO_VA;
+ iop3xx_pcibios_min_mem = IOP321_PCI_LOWER_MEM_VA;
return 1;
}
@@ -106,9 +107,6 @@ static int iq31244_setup(int nr, struct pci_sys_data *sys)
static void iq31244_preinit(void)
{
iop321_init();
- /* setting up the second translation window */
- *IOP321_OMWTVR1 = IQ31244_PCI_MEM_BASE + 0x04000000;
- *IOP321_OUMWTVR1 = 0x0;
}
static struct hw_pci iq31244_pci __initdata = {
diff --git a/arch/arm/mach-iop3xx/iq80321-pci.c b/arch/arm/mach-iop3xx/iq80321-pci.c
index 5d9624863e4ee..f314199e5b81c 100644
--- a/arch/arm/mach-iop3xx/iq80321-pci.c
+++ b/arch/arm/mach-iop3xx/iq80321-pci.c
@@ -5,6 +5,7 @@
*
* Author: Rory Bolt <rorybolt@pacbell.net>
* Copyright (C) 2002 Rory Bolt
+ * Copyright (C) 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -71,44 +72,28 @@ static int iq80321_setup(int nr, struct pci_sys_data *sys)
memset(res, 0, sizeof(struct resource) * 2);
- res[0].start = IQ80321_PCI_IO_BASE + IQ80321_PCI_IO_OFFSET;
- res[0].end = IQ80321_PCI_IO_BASE + IQ80321_PCI_IO_SIZE - 1 + IQ80321_PCI_IO_OFFSET;
+ res[0].start = IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_OFFSET;
+ res[0].end = IOP321_PCI_UPPER_IO_BA + IOP321_PCI_IO_OFFSET;
res[0].name = "IQ80321 PCI I/O Space";
res[0].flags = IORESOURCE_IO;
- res[1].start = IQ80321_PCI_MEM_BASE;
- res[1].end = IQ80321_PCI_MEM_BASE + IQ80321_PCI_MEM_SIZE;
+ res[1].start = IOP321_PCI_LOWER_MEM_BA + IOP321_PCI_MEM_OFFSET;
+ res[1].end = IOP321_PCI_UPPER_MEM_BA + IOP321_PCI_MEM_OFFSET;
res[1].name = "IQ80321 PCI Memory Space";
res[1].flags = IORESOURCE_MEM;
request_resource(&ioport_resource, &res[0]);
request_resource(&iomem_resource, &res[1]);
- /*
- * Since the IQ80321 is a slave card on a PCI backplane,
- * it uses BAR1 to reserve a portion of PCI memory space for
- * use with the private devices on the secondary bus
- * (GigE and PCI-X slot). We read BAR1 and configure
- * our outbound translation windows to target that
- * address range and assign all devices in that
- * address range. W/O this, certain BIOSes will fail
- * to boot as the IQ80321 claims addresses that are
- * in use by other devices.
- *
- * Note that the same cannot be done with I/O space,
- * so hopefully the host will stick to the lower 64K for
- * PCI I/O and leave us alone.
- */
- sys->mem_offset = IQ80321_PCI_MEM_BASE -
- (*IOP321_IABAR1 & PCI_BASE_ADDRESS_MEM_MASK);
+ sys->mem_offset = IOP321_PCI_MEM_OFFSET;
+ sys->io_offset = IOP321_PCI_IO_OFFSET;
sys->resource[0] = &res[0];
sys->resource[1] = &res[1];
sys->resource[2] = NULL;
- sys->io_offset = IQ80321_PCI_IO_OFFSET;
- iop3xx_pcibios_min_io = IQ80321_PCI_IO_BASE;
- iop3xx_pcibios_min_mem = IQ80321_PCI_MEM_BASE;
+ iop3xx_pcibios_min_io = IOP321_PCI_LOWER_IO_VA;
+ iop3xx_pcibios_min_mem = IOP321_PCI_LOWER_MEM_VA;
return 1;
}
diff --git a/arch/arm/mach-iop3xx/iq80331-pci.c b/arch/arm/mach-iop3xx/iq80331-pci.c
index 1eff5573d7bad..591aa32a80b8c 100644
--- a/arch/arm/mach-iop3xx/iq80331-pci.c
+++ b/arch/arm/mach-iop3xx/iq80331-pci.c
@@ -4,7 +4,7 @@
* PCI support for the Intel IQ80331 reference board
*
* Author: Dave Jiang <dave.jiang@intel.com>
- * Copyright (C) 2003 Intel Corp.
+ * Copyright (C) 2003, 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -68,44 +68,28 @@ static int iq80331_setup(int nr, struct pci_sys_data *sys)
memset(res, 0, sizeof(struct resource) * 2);
- res[0].start = IQ80331_PCI_IO_BASE + 0x6e000000;
- res[0].end = IQ80331_PCI_IO_BASE + IQ80331_PCI_IO_SIZE - 1 + IQ80331_PCI_IO_OFFSET;
+ res[0].start = IOP331_PCI_LOWER_IO_BA + IOP331_PCI_IO_OFFSET;
+ res[0].end = IOP331_PCI_UPPER_IO_BA + IOP331_PCI_IO_OFFSET;
res[0].name = "IQ80331 PCI I/O Space";
res[0].flags = IORESOURCE_IO;
- res[1].start = IQ80331_PCI_MEM_BASE;
- res[1].end = IQ80331_PCI_MEM_BASE + IQ80331_PCI_MEM_SIZE;
+ res[1].start = IOP331_PCI_LOWER_MEM_BA + IOP331_PCI_MEM_OFFSET;
+ res[1].end = IOP331_PCI_UPPER_MEM_BA + IOP331_PCI_MEM_OFFSET;
res[1].name = "IQ80331 PCI Memory Space";
res[1].flags = IORESOURCE_MEM;
request_resource(&ioport_resource, &res[0]);
request_resource(&iomem_resource, &res[1]);
- /*
- * Since the IQ80331 is a slave card on a PCI backplane,
- * it uses BAR1 to reserve a portion of PCI memory space for
- * use with the private devices on the secondary bus
- * (GigE and PCI-X slot). We read BAR1 and configure
- * our outbound translation windows to target that
- * address range and assign all devices in that
- * address range. W/O this, certain BIOSes will fail
- * to boot as the IQ80331 claims addresses that are
- * in use by other devices.
- *
- * Note that the same cannot be done with I/O space,
- * so hopefully the host will stick to the lower 64K for
- * PCI I/O and leave us alone.
- */
- sys->mem_offset = IQ80331_PCI_MEM_BASE -
- (*IOP331_IABAR1 & PCI_BASE_ADDRESS_MEM_MASK);
+ sys->mem_offset = IOP331_PCI_MEM_OFFSET;
+ sys->io_offset = IOP331_PCI_IO_OFFSET;
sys->resource[0] = &res[0];
sys->resource[1] = &res[1];
sys->resource[2] = NULL;
- sys->io_offset = IQ80331_PCI_IO_OFFSET;
- iop3xx_pcibios_min_io = IQ80331_PCI_IO_BASE;
- iop3xx_pcibios_min_mem = IQ80331_PCI_MEM_BASE;
+ iop3xx_pcibios_min_io = IOP331_PCI_LOWER_IO_VA;
+ iop3xx_pcibios_min_mem = IOP331_PCI_LOWER_MEM_VA;
return 1;
}
diff --git a/arch/arm/mach-iop3xx/iq80332-mm.c b/arch/arm/mach-iop3xx/iq80332-mm.c
new file mode 100644
index 0000000000000..084afcdfb1eb8
--- /dev/null
+++ b/arch/arm/mach-iop3xx/iq80332-mm.c
@@ -0,0 +1,36 @@
+/*
+ * linux/arch/arm/mach-iop3xx/mm.c
+ *
+ * Low level memory initialization for iq80332 platform
+ *
+ * Author: Dave Jiang <dave.jiang@intel.com>
+ * Copyright (C) 2004 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include <linux/mm.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+
+#include <asm/mach/map.h>
+#include <asm/mach-types.h>
+
+
+/*
+ * IQ80332 specific IO mappings
+ *
+ * We use RedBoot's setup for the onboard devices.
+ */
+
+void __init iq80332_map_io(void)
+{
+ iop331_map_io();
+}
diff --git a/arch/arm/mach-iop3xx/iq80332-pci.c b/arch/arm/mach-iop3xx/iq80332-pci.c
new file mode 100644
index 0000000000000..89cf3b63b1a32
--- /dev/null
+++ b/arch/arm/mach-iop3xx/iq80332-pci.c
@@ -0,0 +1,128 @@
+/*
+ * arch/arm/mach-iop3xx/iq80332-pci.c
+ *
+ * PCI support for the Intel IQ80332 reference board
+ *
+ * Author: Dave Jiang <dave.jiang@intel.com>
+ * Copyright (C) 2004 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include <asm/hardware.h>
+#include <asm/irq.h>
+#include <asm/mach/pci.h>
+#include <asm/mach-types.h>
+
+/*
+ * The following macro is used to lookup irqs in a standard table
+ * format for those systems that do not already have PCI
+ * interrupts properly routed. We assume 1 <= pin <= 4
+ */
+#define PCI_IRQ_TABLE_LOOKUP(minid,maxid) \
+({ int _ctl_ = -1; \
+ unsigned int _idsel = idsel - minid; \
+ if (_idsel <= maxid) \
+ _ctl_ = pci_irq_table[_idsel][pin-1]; \
+ _ctl_; })
+
+#define INTA IRQ_IQ80332_INTA
+#define INTB IRQ_IQ80332_INTB
+#define INTC IRQ_IQ80332_INTC
+#define INTD IRQ_IQ80332_INTD
+
+//#define INTE IRQ_IQ80332_I82544
+
+static inline int __init
+iq80332_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
+{
+ static int pci_irq_table[][8] = {
+ /*
+ * PCI IDSEL/INTPIN->INTLINE
+ * A B C D
+ */
+ {-1, -1, -1, -1},
+ {-1, -1, -1, -1},
+ {-1, -1, -1, -1},
+ {INTA, INTB, INTC, INTD}, /* PCI-X Slot */
+ {-1, -1, -1, -1},
+ {INTC, INTC, INTC, INTC}, /* GigE */
+ {-1, -1, -1, -1},
+ {-1, -1, -1, -1},
+ };
+
+ BUG_ON(pin < 1 || pin > 4);
+
+ return PCI_IRQ_TABLE_LOOKUP(1, 7);
+}
+
+static int iq80332_setup(int nr, struct pci_sys_data *sys)
+{
+ struct resource *res;
+
+ if(nr != 0)
+ return 0;
+
+ res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL);
+ if (!res)
+ panic("PCI: unable to alloc resources");
+
+ memset(res, 0, sizeof(struct resource) * 2);
+
+ res[0].start = IOP331_PCI_LOWER_IO_BA + IOP331_PCI_IO_OFFSET;
+ res[0].end = IOP331_PCI_UPPER_IO_BA + IOP331_PCI_IO_OFFSET;
+ res[0].name = "IQ80332 PCI I/O Space";
+ res[0].flags = IORESOURCE_IO;
+
+ res[1].start = IOP331_PCI_LOWER_MEM_BA + IOP331_PCI_MEM_OFFSET;
+ res[1].end = IOP331_PCI_UPPER_MEM_BA + IOP331_PCI_MEM_OFFSET;
+ res[1].name = "IQ80332 PCI Memory Space";
+ res[1].flags = IORESOURCE_MEM;
+
+ request_resource(&ioport_resource, &res[0]);
+ request_resource(&iomem_resource, &res[1]);
+
+ sys->mem_offset = IOP331_PCI_MEM_OFFSET;
+ sys->io_offset = IOP331_PCI_IO_OFFSET;
+
+ sys->resource[0] = &res[0];
+ sys->resource[1] = &res[1];
+ sys->resource[2] = NULL;
+
+ iop3xx_pcibios_min_io = IOP331_PCI_LOWER_IO_VA;
+ iop3xx_pcibios_min_mem = IOP331_PCI_LOWER_MEM_VA;
+
+ return 1;
+}
+
+static void iq80332_preinit(void)
+{
+ iop331_init();
+}
+
+static struct hw_pci iq80332_pci __initdata = {
+ .swizzle = pci_std_swizzle,
+ .nr_controllers = 1,
+ .setup = iq80332_setup,
+ .scan = iop331_scan_bus,
+ .preinit = iq80332_preinit,
+ .map_irq = iq80332_map_irq
+};
+
+static int __init iq80332_pci_init(void)
+{
+ if (machine_is_iq80332())
+ pci_common_init(&iq80332_pci);
+ return 0;
+}
+
+subsys_initcall(iq80332_pci_init);
+
+
+
+
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index af894f4ccb8c7..97c5d1f4b32c6 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -57,7 +57,7 @@ static void __init enp2611_timer_init(void)
ixp2000_init_time(50 * 1000 * 1000);
}
-static struct enp2611_timer = {
+static struct sys_timer enp2611_timer = {
.init = enp2611_timer_init,
.offset = ixp2000_gettimeoffset,
};
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index cd98116e13f07..df3ff26c8cdd1 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -56,7 +56,7 @@ static void __init ixdp2400_timer_init(void)
ixp2000_init_time(((3125000 * numerator) / (denominator)) / 2);
}
-static struct timer ixdp2400_timer = {
+static struct sys_timer ixdp2400_timer = {
.init = ixdp2400_timer_init,
.offset = ixp2000_gettimeoffset,
};
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index 49334b485f076..c4683aaff84ac 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -113,7 +113,7 @@ static int __init ixdp2800_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
* Device behind the first bridge
*/
if(dev->bus->self->devfn == IXDP2X00_P2P_DEVFN) {
- switch(PCI_SLOT(dev->devfn)) {
+ switch(dev->devfn) {
case IXDP2X00_PMC_DEVFN:
return IRQ_IXDP2800_PMC;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index b63d4f609bc87..9c7614b9125c2 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -279,3 +279,40 @@ struct sys_timer ixp4xx_timer = {
.init = ixp4xx_timer_init,
.offset = ixp4xx_gettimeoffset,
};
+
+static struct resource ixp46x_i2c_resources[] = {
+ [0] = {
+ .start = 0xc8011000,
+ .end = 0xc801101c,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_IXP4XX_I2C,
+ .end = IRQ_IXP4XX_I2C,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+/*
+ * I2C controller. The IXP46x uses the same block as the IOP3xx, so
+ * we just use the same device name.
+ */
+static struct platform_device ixp46x_i2c_controller = {
+ .name = "IOP3xx-I2C",
+ .id = 0,
+ .num_resources = 2,
+ .resource = &ixp46x_i2c_resources
+};
+
+static struct platform_device *ixp46x_devices[] __initdata = {
+ &ixp46x_i2c_controller
+};
+
+void __init ixp4xx_sys_init(void)
+{
+ if (cpu_is_ixp46x()) {
+ platform_add_devices(ixp46x_devices,
+ ARRAY_SIZE(ixp46x_devices));
+ }
+}
+
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index a4b54430f121b..651ff67a57548 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -89,7 +89,8 @@ static void __init coyote_init(void)
*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
- platform_add_devices(&coyote_devices, ARRAY_SIZE(coyote_devices));
+ ixp4xx_sys_init();
+ platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
}
#ifdef CONFIG_ARCH_ADI_COYOTE
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index e6a4e60ef17b7..4aafd8e6e98aa 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -108,6 +108,8 @@ static struct platform_device *ixdp425_devices[] __initdata = {
static void __init ixdp425_init(void)
{
+ ixp4xx_sys_init();
+
/*
* IXP465 has 32MB window
*/
@@ -115,7 +117,7 @@ static void __init ixdp425_init(void)
ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
}
- platform_add_devices(&ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
+ platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
}
MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
diff --git a/arch/arm/mach-ixp4xx/prpmc1100-setup.c b/arch/arm/mach-ixp4xx/prpmc1100-setup.c
index 199e454d1d3fd..68f679a415283 100644
--- a/arch/arm/mach-ixp4xx/prpmc1100-setup.c
+++ b/arch/arm/mach-ixp4xx/prpmc1100-setup.c
@@ -79,7 +79,9 @@ static struct platform_device *prpmc1100_devices[] __initdata = {
static void __init prpmc1100_init(void)
{
- platform_add_devices(&prpmc1100_devices, ARRAY_SIZE(prpmc1100_devices));
+ ixp4xx_sys_init();
+
+ platform_add_devices(prpmc1100_devices, ARRAY_SIZE(prpmc1100_devices));
}
MACHINE_START(PRPMC1100, "Motorola PrPMC1100")
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 2e71ad68362f8..554e1bd30d6e6 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -597,6 +597,14 @@ static int versatile_clcd_setup(struct clcd_fb *fb)
return 0;
}
+static int versatile_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
+{
+ return dma_mmap_writecombine(&fb->dev->dev, vma,
+ fb->fb.screen_base,
+ fb->fb.fix.smem_start,
+ fb->fb.fix.smem_len);
+}
+
static void versatile_clcd_remove(struct clcd_fb *fb)
{
dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
@@ -610,6 +618,7 @@ static struct clcd_board clcd_plat_data = {
.disable = versatile_clcd_disable,
.enable = versatile_clcd_enable,
.setup = versatile_clcd_setup,
+ .mmap = versatile_clcd_mmap,
.remove = versatile_clcd_remove,
};
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index 57b0be2ab3c93..fa16e3372849c 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -1,7 +1,7 @@
/*
* linux/arch/arm/mm/consistent.c
*
- * Copyright (C) 2000-2002 Russell King
+ * Copyright (C) 2000-2004 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -65,6 +65,7 @@ struct vm_region {
struct list_head vm_list;
unsigned long vm_start;
unsigned long vm_end;
+ struct page *vm_pages;
};
static struct vm_region consistent_head = {
@@ -206,6 +207,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, int gfp,
pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
struct page *end = page + (1 << order);
+ c->vm_pages = page;
+
/*
* Set the "dma handle"
*/
@@ -215,6 +218,9 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, int gfp,
BUG_ON(!pte_none(*pte));
set_page_count(page, 1);
+ /*
+ * x86 does not mark the pages reserved...
+ */
SetPageReserved(page);
set_pte(pte, mk_pte(page, prot));
page++;
@@ -264,6 +270,50 @@ dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, int
}
EXPORT_SYMBOL(dma_alloc_writecombine);
+static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
+{
+ unsigned long flags, user_size, kern_size;
+ struct vm_region *c;
+ int ret = -ENXIO;
+
+ user_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+
+ spin_lock_irqsave(&consistent_lock, flags);
+ c = vm_region_find(&consistent_head, (unsigned long)cpu_addr);
+ spin_unlock_irqrestore(&consistent_lock, flags);
+
+ if (c) {
+ kern_size = (c->vm_end - c->vm_start) >> PAGE_SHIFT;
+
+ if (vma->vm_pgoff < kern_size ||
+ user_size <= (kern_size - vma->vm_pgoff)) {
+ vma->vm_flags |= VM_RESERVED;
+ ret = remap_pfn_range(vma, vma->vm_start,
+ page_to_pfn(c->vm_pages),
+ user_size, vma->vm_page_prot);
+ }
+ }
+
+ return ret;
+}
+
+int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
+{
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ return dma_mmap(dev, vma, cpu_addr, dma_addr, size);
+}
+EXPORT_SYMBOL(dma_mmap_coherent);
+
+int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
+{
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+ return dma_mmap(dev, vma, cpu_addr, dma_addr, size);
+}
+EXPORT_SYMBOL(dma_mmap_writecombine);
+
/*
* free a page as defined by the above mapping.
*/
@@ -300,6 +350,10 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
if (pfn_valid(pfn)) {
struct page *page = pfn_to_page(pfn);
+
+ /*
+ * x86 does not mark the pages reserved...
+ */
ClearPageReserved(page);
__free_page(page);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 51f3be19ec41d..e2437813cbb7e 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -55,7 +55,7 @@ void show_mem(void)
show_free_areas();
printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
struct page *page, *end;
page = NODE_MEM_MAP(node);
@@ -178,18 +178,14 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
node = mi->bank[i].node;
- if (node >= numnodes) {
- numnodes = node + 1;
-
- /*
- * Make sure we haven't exceeded the maximum number
- * of nodes that we have in this configuration. If
- * we have, we're in trouble. (maybe we ought to
- * limit, instead of bugging?)
- */
- if (numnodes > MAX_NUMNODES)
- BUG();
- }
+ /*
+ * Make sure we haven't exceeded the maximum number of nodes
+ * that we have in this configuration. If we have, we're in
+ * trouble. (maybe we ought to limit, instead of bugging?)
+ */
+ if (node >= MAX_NUMNODES)
+ BUG();
+ node_set_online(node);
/*
* Get the start and end pfns for this bank
@@ -211,7 +207,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
* Calculate the number of pages we require to
* store the bootmem bitmaps.
*/
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
if (np[i].end == 0)
continue;
@@ -380,13 +376,13 @@ static void __init bootmem_init(struct meminfo *mi)
* (we could also do with rolling bootmem_init and paging_init
* into one generic "memory_init" type function).
*/
- np += numnodes - 1;
- for (node = numnodes - 1; node >= 0; node--, np--) {
+ np += num_online_nodes() - 1;
+ for (node = num_online_nodes() - 1; node >= 0; node--, np--) {
/*
* If there are no pages in this node, ignore it.
* Note that node 0 must always have some pages.
*/
- if (np->end == 0) {
+ if (np->end == 0 || !node_online(node)) {
if (node == 0)
BUG();
continue;
@@ -449,7 +445,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
/*
* initialise the zones within each node
*/
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
unsigned long zone_size[MAX_NR_ZONES];
unsigned long zhole_size[MAX_NR_ZONES];
struct bootmem_data *bdata;
@@ -558,7 +554,7 @@ void __init mem_init(void)
create_memmap_holes(&meminfo);
/* this will put all unused low memory onto the freelists */
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
pg_data_t *pgdat = NODE_DATA(node);
if (pgdat->node_spanned_pages != 0)
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 2066087070da5..9c1cd177fb93f 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -526,7 +526,7 @@ void setup_mm_for_reboot(char mode)
pmdval |= PMD_BIT4;
pmd = pmd_offset(pgd + i, i << PGDIR_SHIFT);
set_pmd(pmd, __pmd(pmdval));
- set_pmd(pmd + 1, __pmd(pmdval + 1 << (PGDIR_SHIFT - 1)));
+ set_pmd(pmd + 1, __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))));
}
}
@@ -701,6 +701,6 @@ void __init create_memmap_holes(struct meminfo *mi)
{
int node;
- for (node = 0; node < numnodes; node++)
+ for_each_online_node(node)
free_unused_memmap_node(node, mi);
}
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index d588603c3893d..6ce87506537a1 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -754,8 +754,8 @@ __8032x_proc_info:
.type __8033x_proc_info,#object
__8033x_proc_info:
- .long 0x69054090
- .long 0xffffffb0
+ .long 0x69054010
+ .long 0xffffff30
.long PMD_TYPE_SECT | \
PMD_SECT_BUFFERABLE | \
PMD_SECT_CACHEABLE | \
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 82bdef29919bd..0678f4fcba399 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -6,7 +6,7 @@
# To add an entry into this database, please see Documentation/arm/README,
# or contact rmk@arm.linux.org.uk
#
-# Last update: Sun Nov 7 13:20:41 2004
+# Last update: Thu Jan 6 00:10:23 2005
#
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
#
@@ -226,7 +226,7 @@ dnp1110 SA1100_DNP1110 DNP1110 214
pnp1110 SA1100_PNP1110 PNP1110 215
csb226 ARCH_CSB226 CSB226 216
arnold SA1100_ARNOLD ARNOLD 217
-psiboard SA1100_PSIBOARD PSIBOARD 218
+voiceblue SA1100_PSIBOARD PSIBOARD 218
jz8028 ARCH_JZ8028 JZ8028 219
h5400 ARCH_H5400 H5400 220
forte SA1100_FORTE FORTE 221
@@ -250,8 +250,8 @@ pxa_eagle250 ARCH_PXA_EAGLE250 PXA_EAGLE250 238
pdb ARCH_PDB PDB 239
blue_2g SA1100_BLUE_2G BLUE_2G 240
bluearch SA1100_BLUEARCH BLUEARCH 241
-ixdp2400 ARCH_IXDB2400 IXDB2400 242
-ixdp2800 ARCH_IXDB2800 IXDB2800 243
+ixdp2400 ARCH_IXDP2400 IXDP2400 242
+ixdp2800 ARCH_IXDP2800 IXDP2800 243
explorer SA1100_EXPLORER EXPLORER 244
ixdp425 ARCH_IXDP425 IXDP425 245
chimp ARCH_CHIMP CHIMP 246
@@ -634,3 +634,36 @@ ecia MACH_ECIA ECIA 623
cm4008 MACH_CM4008 CM4008 624
p2001 MACH_P2001 P2001 625
twister MACH_TWISTER TWISTER 626
+mudshark MACH_MUDSHARK MUDSHARK 627
+hb2 MACH_HB2 HB2 628
+iq80332 MACH_IQ80332 IQ80332 629
+sendt MACH_SENDT SENDT 630
+mx2jazz MACH_MX2JAZZ MX2JAZZ 631
+multiio MACH_MULTIIO MULTIIO 632
+hrdisplay MACH_HRDISPLAY HRDISPLAY 633
+scma11bb MACH_SCMA11BB SCMA11BB 634
+trizeps3 MACH_TRIZEPS3 TRIZEPS3 635
+zefeerdza MACH_ZEFEERDZA ZEFEERDZA 636
+zefeerdzb MACH_ZEFEERDZB ZEFEERDZB 637
+zefeerdzg MACH_ZEFEERDZG ZEFEERDZG 638
+zefeerdzn MACH_ZEFEERDZN ZEFEERDZN 639
+zefeerdzq MACH_ZEFEERDZQ ZEFEERDZQ 640
+gtwx5715 MACH_GTWX5715 GTWX5715 641
+unknown MACH_VL420 VL420 642
+astro_jack MACH_ASTRO_JACK ASTRO_JACK 643
+tip03 MACH_TIP03 TIP03 644
+a9200ec MACH_A9200EC A9200EC 645
+pnx0105 MACH_PNX0105 PNX0105 646
+adcpoecpu MACH_ADCPOECPU ADCPOECPU 647
+csb637 MACH_CSB637 CSB637 648
+ml69q6203 MACH_ML69Q6203 ML69Q6203 649
+mb9200 MACH_MB9200 MB9200 650
+kulun MACH_KULUN KULUN 651
+snapper MACH_SNAPPER SNAPPER 652
+optima MACH_OPTIMA OPTIMA 653
+dlhsbc MACH_DLHSBC DLHSBC 654
+x30 MACH_X30 X30 655
+n30 MACH_N30 N30 656
+manga_ks8695 MACH_MANGA_KS8695 MANGA_KS8695 657
+ajax MACH_AJAX AJAX 658
+nec_mp900 MACH_NEC_MP900 NEC_MP900 659
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
index acb4f6d4fce3c..1dba6bf03db3f 100644
--- a/arch/arm26/mm/init.c
+++ b/arch/arm26/mm/init.c
@@ -155,7 +155,8 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
{
unsigned int memend_pfn = 0;
- numnodes = 1;
+ nodes_clear(node_online_map);
+ node_set_online(0);
np->bootmap_pages = 0;
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 53b94eb3e1af8..4717f7ae8e515 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -599,23 +599,8 @@ void schedule_usleep(unsigned long us)
#ifdef CONFIG_PROC_FS
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
- ,int *eof, void *data_unused
-#else
- ,int unused
-#endif
- );
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+ ,int *eof, void *data_unused);
static struct proc_dir_entry *fasttimer_proc_entry;
-#else
-static struct proc_dir_entry fasttimer_proc_entry =
-{
- 0, 9, "fasttimer",
- S_IFREG | S_IRUGO, 1, 0, 0,
- 0, NULL /* ops -- default to array */,
- &proc_fasttimer_read /* get_info */,
-};
-#endif
#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_PROC_FS
@@ -624,12 +609,7 @@ static struct proc_dir_entry fasttimer_proc_entry =
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
- ,int *eof, void *data_unused
-#else
- ,int unused
-#endif
- )
+ ,int *eof, void *data_unused)
{
unsigned long flags;
int i = 0;
@@ -805,9 +785,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
memcpy(buf, bigbuf + offset, len);
*start = buf;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
*eof = 1;
-#endif
return len;
}
@@ -982,12 +960,8 @@ void fast_timer_init(void)
}
#endif
#ifdef CONFIG_PROC_FS
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
fasttimer_proc_entry->read_proc = proc_fasttimer_read;
-#else
- proc_register_dynamic(&proc_root, &fasttimer_proc_entry);
-#endif
#endif /* PROC_FS */
if(request_irq(TIMER1_IRQ_NBR, timer1_handler, SA_SHIRQ,
"fast timer int", NULL))
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 2f498bfc1dfcb..cae9d38b5c9f1 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -517,6 +517,17 @@ config PREEMPT
Say Y here if you are building a kernel for a desktop, embedded
or real-time system. Say N if you are unsure.
+config PREEMPT_BKL
+ bool "Preempt The Big Kernel Lock"
+ depends on PREEMPT || SMP
+ default y
+ help
+ This option reduces the latency of the kernel by making the
+ big kernel lock preemptible.
+
+ Say Y here if you are building a kernel for a desktop system.
+ Say N if you are unsure.
+
config X86_UP_APIC
bool "Local APIC support on uniprocessors" if !SMP
depends on !(X86_VISWS || X86_VOYAGER)
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index f37977fdb1e65..60a04638e3979 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -233,6 +233,13 @@ static unsigned long cr4 = 0;
static u32 deftype_lo, deftype_hi;
static spinlock_t set_atomicity_lock = SPIN_LOCK_UNLOCKED;
+/*
+ * Since we are disabling the cache don't allow any interrupts - they
+ * would run extremely slow and would only increase the pain. The caller must
+ * ensure that local interrupts are disabled and are reenabled after post_set()
+ * has been called.
+ */
+
static void prepare_set(void)
{
unsigned long cr0;
@@ -240,11 +247,11 @@ static void prepare_set(void)
/* Note that this is not ideal, since the cache is only flushed/disabled
for this CPU while the MTRRs are changed, but changing this requires
more invasive changes to the way the kernel boots */
+
spin_lock(&set_atomicity_lock);
/* Enter the no-fill (CD=1, NW=0) cache mode and flush caches. */
cr0 = read_cr0() | 0x40000000; /* set CD flag */
- wbinvd();
write_cr0(cr0);
wbinvd();
@@ -266,8 +273,7 @@ static void prepare_set(void)
static void post_set(void)
{
- /* Flush caches and TLBs */
- wbinvd();
+ /* Flush TLBs (no need to flush caches - they are disabled) */
__flush_tlb();
/* Intel (P6) standard MTRRs */
@@ -285,13 +291,16 @@ static void post_set(void)
static void generic_set_all(void)
{
unsigned long mask, count;
+ unsigned long flags;
+ local_irq_save(flags);
prepare_set();
/* Actually set the state */
mask = set_mtrr_state(deftype_lo,deftype_hi);
post_set();
+ local_irq_restore(flags);
/* Use the atomic bitops to update the global mask */
for (count = 0; count < sizeof mask * 8; ++count) {
@@ -314,6 +323,9 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
[RETURNS] Nothing.
*/
{
+ unsigned long flags;
+
+ local_irq_save(flags);
prepare_set();
if (size == 0) {
@@ -328,6 +340,7 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
}
post_set();
+ local_irq_restore(flags);
}
int generic_validate_add_page(unsigned long base, unsigned long size, unsigned int type)
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 2935c94039820..8bda886f21db6 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -184,9 +184,8 @@ need_resched:
jz restore_all
testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ?
jz restore_all
- movl $PREEMPT_ACTIVE,TI_preempt_count(%ebp)
sti
- call schedule
+ call preempt_schedule
cli
movl $0,TI_preempt_count(%ebp)
jmp need_resched
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 0c8026c2c600d..e5ad7e03fc7fe 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -309,8 +309,8 @@ static void __init MP_translation_info (struct mpc_config_translation *m)
printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n");
else
translation_table[mpc_record] = m; /* stash this for later */
- if (m->trans_quad+1 > numnodes)
- numnodes = m->trans_quad+1;
+ if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad))
+ node_set_online(m->trans_quad);
}
/*
diff --git a/arch/i386/kernel/numaq.c b/arch/i386/kernel/numaq.c
index 38c762daba5a5..0ee22fcb12d15 100644
--- a/arch/i386/kernel/numaq.c
+++ b/arch/i386/kernel/numaq.c
@@ -40,8 +40,7 @@ extern long node_start_pfn[], node_end_pfn[];
* Function: smp_dump_qct()
*
* Description: gets memory layout from the quad config table. This
- * function also increments numnodes with the number of nodes (quads)
- * present.
+ * function also updates node_online_map with the nodes (quads) present.
*/
static void __init smp_dump_qct(void)
{
@@ -50,11 +49,10 @@ static void __init smp_dump_qct(void)
struct sys_cfg_data *scd =
(struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
- numnodes = 0;
- for(node = 0; node < MAX_NUMNODES; node++) {
- if(scd->quads_present31_0 & (1 << node)) {
+ nodes_clear(node_online_map);
+ for_each_node(node) {
+ if (scd->quads_present31_0 & (1 << node)) {
node_set_online(node);
- numnodes++;
eq = &scd->eq[node];
/* Convert to pages */
node_start_pfn[node] = MB_TO_PAGES(
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 7b79a9b6a04f0..b5db26cbde87f 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -145,7 +145,7 @@ static void poll_idle (void)
*/
void cpu_idle (void)
{
- int cpu = smp_processor_id();
+ int cpu = _smp_processor_id();
/* endless idle loop with no priority at all */
while (1) {
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c
index bb55e0d5187ea..74b0c8e03fb80 100644
--- a/arch/i386/kernel/srat.c
+++ b/arch/i386/kernel/srat.c
@@ -232,18 +232,22 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
* a set of sequential node IDs starting at zero. (ACPI doesn't seem
* to specify the range of _PXM values.)
*/
- numnodes = 0; /* init total nodes in system */
+ /*
+ * MCD - we no longer HAVE to number nodes sequentially. PXM domain
+ * numbers could go as high as 256, and MAX_NUMNODES for i386 is typically
+ * 32, so we will continue numbering them in this manner until MAX_NUMNODES
+ * approaches MAX_PXM_DOMAINS for i386.
+ */
+ nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (BMAP_TEST(pxm_bitmap, i)) {
- pxm_to_nid_map[i] = numnodes;
- nid_to_pxm_map[numnodes] = i;
- node_set_online(numnodes);
- ++numnodes;
+ nid = num_online_nodes();
+ pxm_to_nid_map[i] = nid;
+ nid_to_pxm_map[nid] = i;
+ node_set_online(nid);
}
}
-
- if (numnodes == 0)
- BUG();
+ BUG_ON(num_online_nodes() == 0);
/* set cnode id in memory chunk structure */
for (i = 0; i < num_memory_chunks; i++)
@@ -254,7 +258,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
printk("%02X ", pxm_bitmap[i]);
}
printk("\n");
- printk("Number of logical nodes in system = %d\n", numnodes);
+ printk("Number of logical nodes in system = %d\n", num_online_nodes());
printk("Number of memory chunks in system = %d\n", num_memory_chunks);
for (j = 0; j < num_memory_chunks; j++){
@@ -265,7 +269,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
}
/*calculate node_start_pfn/node_end_pfn arrays*/
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
int been_here_before = 0;
for (j = 0; j < num_memory_chunks; j++){
@@ -397,7 +401,7 @@ static void __init get_zholes_init(void)
int first;
unsigned long end = 0;
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
first = 1;
for (c = 0; c < num_memory_chunks; c++){
if (node_memory_chunk[c].nid == nid) {
@@ -425,8 +429,8 @@ unsigned long * __init get_zholes_size(int nid)
zholes_size_init++;
get_zholes_init();
}
- if((nid >= numnodes) | (nid >= MAX_NUMNODES))
- printk("%s: nid = %d is invalid. numnodes = %d",
- __FUNCTION__, nid, numnodes);
+ if (nid >= MAX_NUMNODES || !node_online(nid))
+ printk("%s: nid = %d is invalid/offline. num_online_nodes = %d",
+ __FUNCTION__, nid, num_online_nodes());
return &zholes_size[nid * MAX_NR_ZONES];
}
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index b3e28427de978..71553a8dbe54c 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -306,7 +306,7 @@ void die(const char * str, struct pt_regs * regs, long err)
};
static int die_counter;
- if (die.lock_owner != smp_processor_id()) {
+ if (die.lock_owner != _smp_processor_id()) {
console_verbose();
spin_lock_irq(&die.lock);
die.lock_owner = smp_processor_id();
diff --git a/arch/i386/lib/delay.c b/arch/i386/lib/delay.c
index 97b97af9c5e96..080639f262b13 100644
--- a/arch/i386/lib/delay.c
+++ b/arch/i386/lib/delay.c
@@ -34,7 +34,7 @@ inline void __const_udelay(unsigned long xloops)
xloops *= 4;
__asm__("mull %0"
:"=d" (xloops), "=&a" (d0)
- :"1" (xloops),"0" (current_cpu_data.loops_per_jiffy * (HZ/4)));
+ :"1" (xloops),"0" (cpu_data[_smp_processor_id()].loops_per_jiffy * (HZ/4)));
__delay(++xloops);
}
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index 3906c48d6e2f4..2b535d2c97dac 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -41,7 +41,7 @@ bootmem_data_t node0_bdata;
* numa interface - we expect the numa architecture specfic code to have
* populated the following initialisation.
*
- * 1) numnodes - the total number of nodes configured in the system
+ * 1) node_online_map - the map of all nodes configured (online) in the system
* 2) physnode_map - the mapping between a pfn and owning node
* 3) node_start_pfn - the starting page frame number for a node
* 3) node_end_pfn - the ending page fram number for a node
@@ -93,12 +93,12 @@ int __init get_memcfg_numa_flat(void)
/* Run the memory configuration and find the top of memory. */
find_max_pfn();
- node_start_pfn[0] = 0;
- node_end_pfn[0] = max_pfn;
+ node_start_pfn[0] = 0;
+ node_end_pfn[0] = max_pfn;
/* Indicate there is one node available. */
+ nodes_clear(node_online_map);
node_set_online(0);
- numnodes = 1;
return 1;
}
@@ -183,7 +183,9 @@ void __init remap_numa_kva(void)
unsigned long pfn;
int node;
- for (node = 1; node < numnodes; ++node) {
+ for_each_online_node(node) {
+ if (node == 0)
+ continue;
for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) {
vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT);
set_pmd_pfn((ulong) vaddr,
@@ -198,7 +200,9 @@ static unsigned long calculate_numa_remap_pages(void)
int nid;
unsigned long size, reserve_pages = 0;
- for (nid = 1; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
+ if (nid == 0)
+ continue;
/* calculate the size of the mem_map needed in bytes */
size = (node_end_pfn[nid] - node_start_pfn[nid] + 1)
* sizeof(struct page) + sizeof(pg_data_t);
@@ -248,7 +252,7 @@ unsigned long __init setup_memory(void)
get_memcfg_numa();
/* Fill in the physnode_map */
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
printk("Node: %d, start_pfn: %ld, end_pfn: %ld\n",
nid, node_start_pfn[nid], node_end_pfn[nid]);
printk(" Setting physnode_map array to node %d for pfns:\n ",
@@ -285,7 +289,7 @@ unsigned long __init setup_memory(void)
printk("Low memory ends at vaddr %08lx\n",
(ulong) pfn_to_kaddr(max_low_pfn));
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
node_remap_start_vaddr[nid] = pfn_to_kaddr(
(highstart_pfn + reserve_pages) - node_remap_offset[nid]);
allocate_pgdat(nid);
@@ -297,7 +301,7 @@ unsigned long __init setup_memory(void)
printk("High memory starts at vaddr %08lx\n",
(ulong) pfn_to_kaddr(highstart_pfn));
vmalloc_earlyreserve = reserve_pages * PAGE_SIZE;
- for (nid = 0; nid < numnodes; nid++)
+ for_each_online_node(nid)
find_max_pfn_node(nid);
NODE_DATA(0)->bdata = &node0_bdata;
@@ -375,14 +379,16 @@ void __init zone_sizes_init(void)
* Clobber node 0's links and NULL out pgdat_list before starting.
*/
pgdat_list = NULL;
- for (nid = numnodes - 1; nid >= 0; nid--) {
+ for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) {
+ if (!node_online(nid))
+ continue;
if (nid)
memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
NODE_DATA(nid)->pgdat_next = pgdat_list;
pgdat_list = NODE_DATA(nid);
}
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
unsigned long *zholes_size;
unsigned int max_dma;
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index d4ffd3f9c33ba..d1e240c869451 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -302,7 +302,7 @@ static int nmi_create_files(struct super_block * sb, struct dentry * root)
static int __init p4_init(char ** cpu_type)
{
- __u8 cpu_model = current_cpu_data.x86_model;
+ __u8 cpu_model = boot_cpu_data.x86_model;
if (cpu_model > 3)
return 0;
@@ -333,7 +333,7 @@ static int __init p4_init(char ** cpu_type)
static int __init ppro_init(char ** cpu_type)
{
- __u8 cpu_model = current_cpu_data.x86_model;
+ __u8 cpu_model = boot_cpu_data.x86_model;
if (cpu_model > 0xd)
return 0;
@@ -357,8 +357,8 @@ static int using_nmi;
int __init nmi_init(struct oprofile_operations *ops)
{
- __u8 vendor = current_cpu_data.x86_vendor;
- __u8 family = current_cpu_data.x86;
+ __u8 vendor = boot_cpu_data.x86_vendor;
+ __u8 family = boot_cpu_data.x86;
char *cpu_type;
if (!cpu_has_apic)
diff --git a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c
index c8046737bd161..070661abda067 100644
--- a/arch/i386/pci/numa.c
+++ b/arch/i386/pci/numa.c
@@ -112,14 +112,15 @@ static int __init pci_numa_init(void)
return 0;
pci_root_bus = pcibios_scan_root(0);
- if (numnodes > 1) {
- for (quad = 1; quad < numnodes; ++quad) {
+ if (num_online_nodes() > 1)
+ for_each_online_node(quad) {
+ if (quad == 0)
+ continue;
printk("Scanning PCI bus %d for quad %d\n",
QUADLOCAL2BUS(quad,0), quad);
pci_scan_bus(QUADLOCAL2BUS(quad,0),
&pci_root_ops, NULL);
}
- }
return 0;
}
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 480ab214db613..4cbcf366e3f8a 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -182,6 +182,10 @@ config VIRTUAL_MEM_MAP
require the DISCONTIGMEM option for your machine. If you are
unsure, say Y.
+config HOLES_IN_ZONE
+ bool
+ default y if VIRTUAL_MEM_MAP
+
config DISCONTIGMEM
bool "Discontiguous memory support"
depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1) && NUMA && VIRTUAL_MEM_MAP
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 7ef08d376f6f0..21d6f9bab5e98 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.9-rc2-aegl
-# Mon Sep 27 19:03:13 2004
+# Linux kernel version: 2.6.10
+# Wed Dec 29 09:05:48 2004
#
#
@@ -11,6 +11,7 @@ CONFIG_EXPERIMENTAL=y
# CONFIG_CLEAN_COMPILE is not set
CONFIG_BROKEN=y
CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
#
# General setup
@@ -25,6 +26,7 @@ CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
# CONFIG_IKCONFIG is not set
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
@@ -32,12 +34,12 @@ CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_FUTEX=y
CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
# CONFIG_TINY_SHMEM is not set
#
@@ -47,6 +49,7 @@ CONFIG_MODULES=y
# CONFIG_MODULE_UNLOAD is not set
CONFIG_OBSOLETE_MODPARM=y
# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_KMOD is not set
#
@@ -83,6 +86,7 @@ CONFIG_NR_CPUS=16
CONFIG_HAVE_DEC_LOCK=y
CONFIG_IA32_SUPPORT=y
CONFIG_COMPAT=y
+CONFIG_IA64_MCA_RECOVERY=y
CONFIG_PERFMON=y
CONFIG_IA64_PALINFO=y
@@ -106,9 +110,11 @@ CONFIG_ACPI=y
CONFIG_ACPI_BOOT=y
CONFIG_ACPI_INTERPRETER=y
CONFIG_ACPI_BUTTON=y
+CONFIG_ACPI_VIDEO=m
CONFIG_ACPI_FAN=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_THERMAL=y
+CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
CONFIG_ACPI_BUS=y
CONFIG_ACPI_POWER=y
@@ -136,9 +142,13 @@ CONFIG_HOTPLUG_PCI_ACPI=y
# CONFIG_HOTPLUG_PCI_SHPC is not set
#
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
#
-# CONFIG_PCMCIA is not set
#
# Device Drivers
@@ -165,6 +175,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
#
# Plug and Play support
#
+# CONFIG_PNP is not set
#
# Block devices
@@ -179,8 +190,19 @@ CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
#
# ATA/ATAPI/MFM/RLL support
@@ -199,7 +221,6 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
#
# IDE chipset support/bugfixes
@@ -303,6 +324,7 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
# CONFIG_SCSI_QLOGIC_ISP is not set
# CONFIG_SCSI_QLOGIC_FC is not set
CONFIG_SCSI_QLOGIC_1280=y
+# CONFIG_SCSI_QLOGIC_1280_1040 is not set
CONFIG_SCSI_QLA2XXX=y
# CONFIG_SCSI_QLA21XX is not set
# CONFIG_SCSI_QLA22XX is not set
@@ -362,6 +384,8 @@ CONFIG_IP_MULTICAST=y
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_TUNNEL is not set
+# CONFIG_IP_TCPDIAG is not set
+# CONFIG_IP_TCPDIAG_IPV6 is not set
#
# IP: Virtual Server Configuration
@@ -375,6 +399,7 @@ CONFIG_NETFILTER=y
# IP: Netfilter Configuration
#
# CONFIG_IP_NF_CONNTRACK is not set
+# CONFIG_IP_NF_CONNTRACK_MARK is not set
# CONFIG_IP_NF_QUEUE is not set
# CONFIG_IP_NF_IPTABLES is not set
CONFIG_IP_NF_ARPTABLES=y
@@ -399,7 +424,6 @@ CONFIG_IP_NF_ARPTABLES=y
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
#
# QoS and/or fair queueing
@@ -469,7 +493,6 @@ CONFIG_E100=y
# CONFIG_EPIC100 is not set
# CONFIG_SUNDANCE is not set
# CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
#
# Ethernet (1000 Mbit)
@@ -483,6 +506,7 @@ CONFIG_E1000=y
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
# CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
CONFIG_TIGON3=y
#
@@ -653,6 +677,7 @@ CONFIG_I2C_ALGOPCF=y
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
# CONFIG_I2C_VIA is not set
# CONFIG_I2C_VIAPRO is not set
# CONFIG_I2C_VOODOO3 is not set
@@ -664,20 +689,24 @@ CONFIG_I2C_ALGOPCF=y
# CONFIG_I2C_SENSOR is not set
# CONFIG_SENSORS_ADM1021 is not set
# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1031 is not set
# CONFIG_SENSORS_ASB100 is not set
# CONFIG_SENSORS_DS1621 is not set
# CONFIG_SENSORS_FSCHER is not set
# CONFIG_SENSORS_GL518SM is not set
# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
# CONFIG_SENSORS_LM75 is not set
# CONFIG_SENSORS_LM77 is not set
# CONFIG_SENSORS_LM78 is not set
# CONFIG_SENSORS_LM80 is not set
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_W83781D is not set
@@ -708,7 +737,37 @@ CONFIG_I2C_ALGOPCF=y
#
# Multimedia devices
#
-# CONFIG_VIDEO_DEV is not set
+CONFIG_VIDEO_DEV=y
+
+#
+# Video For Linux
+#
+
+#
+# Video Adapters
+#
+# CONFIG_VIDEO_BT848 is not set
+# CONFIG_VIDEO_CPIA is not set
+# CONFIG_VIDEO_SAA5246A is not set
+# CONFIG_VIDEO_SAA5249 is not set
+# CONFIG_TUNER_3036 is not set
+# CONFIG_VIDEO_STRADIS is not set
+# CONFIG_VIDEO_ZORAN is not set
+# CONFIG_VIDEO_ZR36120 is not set
+# CONFIG_VIDEO_SAA7134 is not set
+# CONFIG_VIDEO_MXB is not set
+# CONFIG_VIDEO_DPC is not set
+# CONFIG_VIDEO_HEXIUM_ORION is not set
+# CONFIG_VIDEO_HEXIUM_GEMINI is not set
+# CONFIG_VIDEO_CX88 is not set
+# CONFIG_VIDEO_OVCAMCHIP is not set
+
+#
+# Radio Adapters
+#
+# CONFIG_RADIO_GEMTEK_PCI is not set
+# CONFIG_RADIO_MAXIRADIO is not set
+# CONFIG_RADIO_MAESTRO is not set
#
# Digital Video Broadcasting Devices
@@ -720,6 +779,7 @@ CONFIG_I2C_ALGOPCF=y
#
CONFIG_FB=y
CONFIG_FB_MODE_HELPERS=y
+# CONFIG_FB_TILEBLITTING is not set
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
@@ -733,6 +793,7 @@ CONFIG_FB_RADEON_I2C=y
CONFIG_FB_RADEON_DEBUG=y
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
@@ -763,7 +824,87 @@ CONFIG_LOGO_LINUX_CLUT224=y
#
# Sound
#
-# CONFIG_SOUND is not set
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_HWDEP=y
+CONFIG_SND_RAWMIDI=y
+CONFIG_SND_SEQUENCER=y
+# CONFIG_SND_SEQ_DUMMY is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_SEQUENCER_OSS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+CONFIG_SND_MPU401_UART=y
+CONFIG_SND_OPL3_LIB=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_VIRMIDI is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# PCI devices
+#
+CONFIG_SND_AC97_CODEC=y
+# CONFIG_SND_ALI5451 is not set
+# CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_ATIIXP_MODEM is not set
+# CONFIG_SND_AU8810 is not set
+# CONFIG_SND_AU8820 is not set
+# CONFIG_SND_AU8830 is not set
+# CONFIG_SND_AZT3328 is not set
+# CONFIG_SND_BT87X is not set
+# CONFIG_SND_CS46XX is not set
+# CONFIG_SND_CS4281 is not set
+# CONFIG_SND_EMU10K1 is not set
+# CONFIG_SND_KORG1212 is not set
+# CONFIG_SND_MIXART is not set
+# CONFIG_SND_NM256 is not set
+# CONFIG_SND_RME32 is not set
+# CONFIG_SND_RME96 is not set
+# CONFIG_SND_RME9652 is not set
+# CONFIG_SND_HDSP is not set
+# CONFIG_SND_TRIDENT is not set
+# CONFIG_SND_YMFPCI is not set
+# CONFIG_SND_ALS4000 is not set
+# CONFIG_SND_CMIPCI is not set
+# CONFIG_SND_ENS1370 is not set
+# CONFIG_SND_ENS1371 is not set
+# CONFIG_SND_ES1938 is not set
+# CONFIG_SND_ES1968 is not set
+# CONFIG_SND_MAESTRO3 is not set
+CONFIG_SND_FM801=y
+CONFIG_SND_FM801_TEA575X=y
+# CONFIG_SND_ICE1712 is not set
+# CONFIG_SND_ICE1724 is not set
+# CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
+# CONFIG_SND_SONICVIBES is not set
+# CONFIG_SND_VIA82XX is not set
+# CONFIG_SND_VX222 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_USX2Y is not set
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
#
# USB support
@@ -779,6 +920,8 @@ CONFIG_USB_BANDWIDTH=y
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_SUSPEND is not set
# CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
#
# USB Host Controller Drivers
@@ -788,13 +931,20 @@ CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_UHCI_HCD=y
+# CONFIG_USB_SL811_HCD is not set
#
# USB Device Class drivers
#
+# CONFIG_USB_AUDIO is not set
# CONFIG_USB_BLUETOOTH_TTY is not set
+# CONFIG_USB_MIDI is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_RW_DETECT is not set
@@ -808,7 +958,7 @@ CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_JUMPSHOT is not set
#
-# USB Human Interface Devices (HID)
+# USB Input Devices
#
CONFIG_USB_HID=y
CONFIG_USB_HIDINPUT=y
@@ -834,13 +984,17 @@ CONFIG_USB_HIDDEV=y
# USB Multimedia devices
#
# CONFIG_USB_DABUSB is not set
+# CONFIG_USB_VICAM is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_USB_IBMCAM is not set
+# CONFIG_USB_KONICAWC is not set
+# CONFIG_USB_OV511 is not set
+# CONFIG_USB_SE401 is not set
+# CONFIG_USB_SN9C102 is not set
+# CONFIG_USB_STV680 is not set
#
-# Video4Linux support is needed for USB Multimedia device support
-#
-
-#
-# USB Network adaptors
+# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
@@ -869,14 +1023,24 @@ CONFIG_USB_HIDDEV=y
# CONFIG_USB_LCD is not set
# CONFIG_USB_LED is not set
# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
# CONFIG_USB_PHIDGETSERVO is not set
#
+# USB ATM/DSL drivers
+#
+
+#
# USB Gadget Support
#
# CONFIG_USB_GADGET is not set
#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
# File systems
#
CONFIG_EXT2_FS=y
@@ -896,6 +1060,7 @@ CONFIG_FS_MBCACHE=y
# CONFIG_MINIX_FS is not set
# CONFIG_ROMFS_FS is not set
# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
CONFIG_AUTOFS_FS=y
# CONFIG_AUTOFS4_FS is not set
@@ -927,6 +1092,8 @@ CONFIG_SYSFS=y
# CONFIG_DEVFS_FS is not set
# CONFIG_DEVPTS_FS_XATTR is not set
CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_RAMFS=y
@@ -1053,9 +1220,11 @@ CONFIG_CRC32=y
#
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_INFO is not set
CONFIG_IA64_GRANULE_16MB=y
# CONFIG_IA64_GRANULE_64MB is not set
@@ -1068,6 +1237,7 @@ CONFIG_SYSVIPC_COMPAT=y
#
# Security options
#
+# CONFIG_KEYS is not set
# CONFIG_SECURITY is not set
#
@@ -1081,7 +1251,7 @@ CONFIG_CRYPTO_MD5=y
# CONFIG_CRYPTO_SHA1 is not set
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_WHIRLPOOL is not set
+# CONFIG_CRYPTO_WP512 is not set
CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_TWOFISH is not set
@@ -1092,7 +1262,12 @@ CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_ARC4 is not set
# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
# CONFIG_CRYPTO_DEFLATE is not set
# CONFIG_CRYPTO_MICHAEL_MIC is not set
# CONFIG_CRYPTO_CRC32C is not set
# CONFIG_CRYPTO_TEST is not set
+
+#
+# Hardware crypto devices
+#
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index d9f35a76c3fd5..baa9c1eee662a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -445,16 +445,20 @@ acpi_numa_arch_fixup (void)
return;
}
+ /*
+ * MCD - This can probably be dropped now. No need for pxm ID to node ID
+ * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
+ */
/* calculate total number of nodes in system from PXM bitmap */
- numnodes = 0; /* init total nodes in system */
-
memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
+ nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (pxm_bit_test(i)) {
- pxm_to_nid_map[i] = numnodes;
- node_set_online(numnodes);
- nid_to_pxm_map[numnodes++] = i;
+ int nid = num_online_nodes();
+ pxm_to_nid_map[i] = nid;
+ nid_to_pxm_map[nid] = i;
+ node_set_online(nid);
}
}
@@ -463,7 +467,7 @@ acpi_numa_arch_fixup (void)
node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
/* assign memory bank numbers for each chunk on each node */
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
int bank;
bank = 0;
@@ -476,7 +480,7 @@ acpi_numa_arch_fixup (void)
for (i = 0; i < srat_num_cpus; i++)
node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
- printk(KERN_INFO "Number of logical nodes in system = %d\n", numnodes);
+ printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes());
printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
if (!slit_table) return;
@@ -496,8 +500,8 @@ acpi_numa_arch_fixup (void)
#ifdef SLIT_DEBUG
printk("ACPI 2.0 SLIT locality table:\n");
- for (i = 0; i < numnodes; i++) {
- for (j = 0; j < numnodes; j++)
+ for_each_online_node(i) {
+ for_each_online_node(j)
printk("%03d ", node_distance(i,j));
printk("\n");
}
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 0e821d0c3710b..f2ea1ad67cb75 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -949,6 +949,8 @@ GLOBAL_ENTRY(ia64_spinlock_contention_pre3_4)
(p14) br.cond.sptk.few .wait
(p15) rsm psr.i // disable interrupts if we reenabled them
br.cond.sptk.few b6 // lock is now free, try to acquire
+ .global ia64_spinlock_contention_pre3_4_end // for kernprof
+ia64_spinlock_contention_pre3_4_end:
END(ia64_spinlock_contention_pre3_4)
#else
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index b67299305f3d6..29ccd97681915 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -119,7 +119,7 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
* switched atomically.
*/
bsp = ia64_getreg(_IA64_REG_AR_BSP);
- sp = ia64_getreg(_IA64_REG_AR_SP);
+ sp = ia64_getreg(_IA64_REG_SP);
if ((sp - bsp) < 1024) {
static unsigned char count;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index a141ecbd40edd..be2ddcbc20726 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2160,9 +2160,7 @@ pfm_alloc_fd(struct file **cfile)
DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
- inode->i_sb = pfmfs_mnt->mnt_sb;
inode->i_mode = S_IFCHR|S_IRUGO;
- inode->i_sock = 0;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index aba0ea358b4a0..76539968ac4f1 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -68,7 +68,8 @@ static int __init topology_init(void)
}
memset(sysfs_nodes, 0, sizeof(struct node) * MAX_NUMNODES);
- for (i = 0; i < numnodes; i++)
+ /* MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes? */
+ for_each_online_node(i)
if ((err = register_node(&sysfs_nodes[i], i, 0)))
goto out;
#endif
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 07c2c178cf501..057ec2479600b 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -2256,7 +2256,7 @@ unw_init (void)
if (i > 0)
unw.cache[i].lru_chain = (i - 1);
unw.cache[i].coll_chain = -1;
- unw.cache[i].lock = RW_LOCK_UNLOCKED;
+ rwlock_init(&unw.cache[i].lock);
}
unw.lru_head = UNW_CACHE_SIZE - 1;
unw.lru_tail = 0;
diff --git a/arch/ia64/lib/io.c b/arch/ia64/lib/io.c
index 5b48cc5f39934..8949e44091acb 100644
--- a/arch/ia64/lib/io.c
+++ b/arch/ia64/lib/io.c
@@ -8,8 +8,7 @@
* Copy data from IO memory space to "real" memory space.
* This needs to be optimized.
*/
-void
-__ia64_memcpy_fromio (void *to, volatile void __iomem *from, long count)
+void memcpy_fromio(void *to, const volatile void __iomem *from, long count)
{
char *dst = to;
@@ -18,30 +17,28 @@ __ia64_memcpy_fromio (void *to, volatile void __iomem *from, long count)
*dst++ = readb(from++);
}
}
-EXPORT_SYMBOL(__ia64_memcpy_fromio);
+EXPORT_SYMBOL(memcpy_fromio);
/*
* Copy data from "real" memory space to IO memory space.
* This needs to be optimized.
*/
-void
-__ia64_memcpy_toio (volatile void __iomem *to, void *from, long count)
+void memcpy_toio(volatile void __iomem *to, const void *from, long count)
{
- char *src = from;
+ const char *src = from;
while (count) {
count--;
writeb(*src++, to++);
}
}
-EXPORT_SYMBOL(__ia64_memcpy_toio);
+EXPORT_SYMBOL(memcpy_toio);
/*
* "memset" on IO memory space.
* This needs to be optimized.
*/
-void
-__ia64_memset_c_io (volatile void __iomem *dst, unsigned long c, long count)
+void memset_io(volatile void __iomem *dst, int c, long count)
{
unsigned char ch = (char)(c & 0xff);
@@ -51,7 +48,7 @@ __ia64_memset_c_io (volatile void __iomem *dst, unsigned long c, long count)
dst++;
}
}
-EXPORT_SYMBOL(__ia64_memset_c_io);
+EXPORT_SYMBOL(memset_io);
#ifdef CONFIG_IA64_GENERIC
diff --git a/arch/ia64/lib/swiotlb.c b/arch/ia64/lib/swiotlb.c
index b7467a989f19e..e4770828db597 100644
--- a/arch/ia64/lib/swiotlb.c
+++ b/arch/ia64/lib/swiotlb.c
@@ -44,41 +44,44 @@
#define IO_TLB_SEGSIZE 128
/*
- * log of the size of each IO TLB slab. The number of slabs is command line controllable.
+ * log of the size of each IO TLB slab. The number of slabs is command line
+ * controllable.
*/
#define IO_TLB_SHIFT 11
int swiotlb_force;
/*
- * Used to do a quick range check in swiotlb_unmap_single and swiotlb_sync_single_*, to see
- * if the memory was in fact allocated by this API.
+ * Used to do a quick range check in swiotlb_unmap_single and
+ * swiotlb_sync_single_*, to see if the memory was in fact allocated by this
+ * API.
*/
static char *io_tlb_start, *io_tlb_end;
/*
- * The number of IO TLB blocks (in groups of 64) betweeen io_tlb_start and io_tlb_end.
- * This is command line adjustable via setup_io_tlb_npages.
+ * The number of IO TLB blocks (in groups of 64) betweeen io_tlb_start and
+ * io_tlb_end. This is command line adjustable via setup_io_tlb_npages.
* Default to 64MB.
*/
static unsigned long io_tlb_nslabs = 32768;
-/*
+/*
* When the IOMMU overflows we return a fallback buffer. This sets the size.
*/
static unsigned long io_tlb_overflow = 32*1024;
-void *io_tlb_overflow_buffer;
+void *io_tlb_overflow_buffer;
/*
- * This is a free list describing the number of free entries available from each index
+ * This is a free list describing the number of free entries available from
+ * each index
*/
static unsigned int *io_tlb_list;
static unsigned int io_tlb_index;
/*
- * We need to save away the original address corresponding to a mapped entry for the sync
- * operations.
+ * We need to save away the original address corresponding to a mapped entry
+ * for the sync operations.
*/
static unsigned char **io_tlb_orig_addr;
@@ -88,10 +91,11 @@ static unsigned char **io_tlb_orig_addr;
static spinlock_t io_tlb_lock = SPIN_LOCK_UNLOCKED;
static int __init
-setup_io_tlb_npages (char *str)
+setup_io_tlb_npages(char *str)
{
- if (isdigit(*str)) {
- io_tlb_nslabs = simple_strtoul(str, &str, 0) << (PAGE_SHIFT - IO_TLB_SHIFT);
+ if (isdigit(*str)) {
+ io_tlb_nslabs = simple_strtoul(str, &str, 0) <<
+ (PAGE_SHIFT - IO_TLB_SHIFT);
/* avoid tail segment of size < IO_TLB_SEGSIZE */
io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
}
@@ -105,18 +109,19 @@ __setup("swiotlb=", setup_io_tlb_npages);
/* make io_tlb_overflow tunable too? */
/*
- * Statically reserve bounce buffer space and initialize bounce buffer data structures for
- * the software IO TLB used to implement the PCI DMA API.
+ * Statically reserve bounce buffer space and initialize bounce buffer data
+ * structures for the software IO TLB used to implement the PCI DMA API.
*/
void
-swiotlb_init (void)
+swiotlb_init(void)
{
unsigned long i;
/*
* Get IO TLB memory from the low pages
*/
- io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs * (1 << IO_TLB_SHIFT));
+ io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
+ (1 << IO_TLB_SHIFT));
if (!io_tlb_start)
panic("Cannot allocate SWIOTLB buffer");
io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
@@ -131,28 +136,30 @@ swiotlb_init (void)
io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
io_tlb_index = 0;
io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
-
- /*
- * Get the overflow emergency buffer
+
+ /*
+ * Get the overflow emergency buffer
*/
- io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
+ io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
}
-static inline int address_needs_mapping(struct device *hwdev, dma_addr_t addr)
-{
- dma_addr_t mask = 0xffffffff;
- if (hwdev && hwdev->dma_mask)
- mask = *hwdev->dma_mask;
- return (addr & ~mask) != 0;
-}
+static inline int
+address_needs_mapping(struct device *hwdev, dma_addr_t addr)
+{
+ dma_addr_t mask = 0xffffffff;
+ /* If the device has a mask, use it, otherwise default to 32 bits */
+ if (hwdev && hwdev->dma_mask)
+ mask = *hwdev->dma_mask;
+ return (addr & ~mask) != 0;
+}
/*
* Allocates bounce buffer and returns its kernel virtual address.
*/
static void *
-map_single (struct device *hwdev, char *buffer, size_t size, int dir)
+map_single(struct device *hwdev, char *buffer, size_t size, int dir)
{
unsigned long flags;
char *dma_addr;
@@ -160,11 +167,11 @@ map_single (struct device *hwdev, char *buffer, size_t size, int dir)
int i;
/*
- * For mappings greater than a page size, we limit the stride (and hence alignment)
- * to a page size.
+ * For mappings greater than a page, we limit the stride (and
+ * hence alignment) to a page size.
*/
nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
- if (size > (1 << PAGE_SHIFT))
+ if (size > PAGE_SIZE)
stride = (1 << (PAGE_SHIFT - IO_TLB_SHIFT));
else
stride = 1;
@@ -173,8 +180,8 @@ map_single (struct device *hwdev, char *buffer, size_t size, int dir)
BUG();
/*
- * Find suitable number of IO TLB entries size that will fit this request and
- * allocate a buffer from that IO TLB pool.
+ * Find suitable number of IO TLB entries size that will fit this
+ * request and allocate a buffer from that IO TLB pool.
*/
spin_lock_irqsave(&io_tlb_lock, flags);
{
@@ -185,22 +192,23 @@ map_single (struct device *hwdev, char *buffer, size_t size, int dir)
do {
/*
- * If we find a slot that indicates we have 'nslots' number of
- * contiguous buffers, we allocate the buffers from that slot and
- * mark the entries as '0' indicating unavailable.
+ * If we find a slot that indicates we have 'nslots'
+ * number of contiguous buffers, we allocate the
+ * buffers from that slot and mark the entries as '0'
+ * indicating unavailable.
*/
if (io_tlb_list[index] >= nslots) {
int count = 0;
for (i = index; i < (int) (index + nslots); i++)
io_tlb_list[i] = 0;
- for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1)
- && io_tlb_list[i]; i--)
+ for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1) && io_tlb_list[i]; i--)
io_tlb_list[i] = ++count;
dma_addr = io_tlb_start + (index << IO_TLB_SHIFT);
/*
- * Update the indices to avoid searching in the next round.
+ * Update the indices to avoid searching in
+ * the next round.
*/
io_tlb_index = ((index + nslots) < io_tlb_nslabs
? (index + nslots) : 0);
@@ -219,8 +227,9 @@ map_single (struct device *hwdev, char *buffer, size_t size, int dir)
spin_unlock_irqrestore(&io_tlb_lock, flags);
/*
- * Save away the mapping from the original address to the DMA address. This is
- * needed when we sync the memory. Then we sync the buffer if needed.
+ * Save away the mapping from the original address to the DMA address.
+ * This is needed when we sync the memory. Then we sync the buffer if
+ * needed.
*/
io_tlb_orig_addr[index] = buffer;
if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
@@ -233,52 +242,51 @@ map_single (struct device *hwdev, char *buffer, size_t size, int dir)
* dma_addr is the kernel virtual address of the bounce buffer to unmap.
*/
static void
-unmap_single (struct device *hwdev, char *dma_addr, size_t size, int dir)
+unmap_single(struct device *hwdev, char *dma_addr, size_t size, int dir)
{
unsigned long flags;
- int i, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
+ int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
char *buffer = io_tlb_orig_addr[index];
/*
* First, sync the memory before unmapping the entry
*/
- if ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))
+ if (buffer && ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL)))
/*
- * bounce... copy the data back into the original buffer * and delete the
- * bounce buffer.
+ * bounce... copy the data back into the original buffer * and
+ * delete the bounce buffer.
*/
memcpy(buffer, dma_addr, size);
/*
- * Return the buffer to the free list by setting the corresponding entries to
- * indicate the number of contigous entries available. While returning the
- * entries to the free list, we merge the entries with slots below and above the
- * pool being returned.
+ * Return the buffer to the free list by setting the corresponding
+ * entries to indicate the number of contigous entries available.
+ * While returning the entries to the free list, we merge the entries
+ * with slots below and above the pool being returned.
*/
spin_lock_irqsave(&io_tlb_lock, flags);
{
- int count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ?
- io_tlb_list[index + nslots] : 0);
+ count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ?
+ io_tlb_list[index + nslots] : 0);
/*
- * Step 1: return the slots to the free list, merging the slots with
- * superceeding slots
+ * Step 1: return the slots to the free list, merging the
+ * slots with superceeding slots
*/
for (i = index + nslots - 1; i >= index; i--)
io_tlb_list[i] = ++count;
/*
- * Step 2: merge the returned slots with the preceding slots, if
- * available (non zero)
+ * Step 2: merge the returned slots with the preceding slots,
+ * if available (non zero)
*/
- for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1) &&
- io_tlb_list[i]; i--)
+ for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1) && io_tlb_list[i]; i--)
io_tlb_list[i] = ++count;
}
spin_unlock_irqrestore(&io_tlb_lock, flags);
}
static void
-sync_single (struct device *hwdev, char *dma_addr, size_t size, int dir)
+sync_single(struct device *hwdev, char *dma_addr, size_t size, int dir)
{
int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
char *buffer = io_tlb_orig_addr[index];
@@ -296,17 +304,36 @@ sync_single (struct device *hwdev, char *dma_addr, size_t size, int dir)
}
void *
-swiotlb_alloc_coherent (struct device *hwdev, size_t size, dma_addr_t *dma_handle, int flags)
+swiotlb_alloc_coherent(struct device *hwdev, size_t size,
+ dma_addr_t *dma_handle, int flags)
{
unsigned long dev_addr;
void *ret;
+ int order = get_order(size);
- /* XXX fix me: the DMA API should pass us an explicit DMA mask instead: */
+ /*
+ * XXX fix me: the DMA API should pass us an explicit DMA mask
+ * instead, or use ZONE_DMA32 (ia64 overloads ZONE_DMA to be a ~32
+ * bit range instead of a 16MB one).
+ */
flags |= GFP_DMA;
- ret = (void *)__get_free_pages(flags, get_order(size));
+ ret = (void *)__get_free_pages(flags, order);
+ if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
+ /*
+ * The allocated memory isn't reachable by the device.
+ * Fall back on swiotlb_map_single().
+ */
+ free_pages((unsigned long) ret, order);
+ ret = NULL;
+ }
if (!ret) {
- /* DMA_FROM_DEVICE is to avoid the memcpy in map_single */
+ /*
+ * We are either out of memory or the device can't DMA
+ * to GFP_DMA memory; fall back on
+ * swiotlb_map_single(), which will grab memory from
+ * the lowest available address range.
+ */
dma_addr_t handle;
handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE);
if (dma_mapping_error(handle))
@@ -317,14 +344,21 @@ swiotlb_alloc_coherent (struct device *hwdev, size_t size, dma_addr_t *dma_handl
memset(ret, 0, size);
dev_addr = virt_to_phys(ret);
- if (address_needs_mapping(hwdev,dev_addr))
- panic("swiotlb_alloc_consistent: allocated memory is out of range for device");
+
+ /* Confirm address can be DMA'd by device */
+ if (address_needs_mapping(hwdev, dev_addr)) {
+ printk("hwdev DMA mask = 0x%016lx, dev_addr = 0x%016lx\n",
+ *hwdev->dma_mask, dev_addr);
+ panic("swiotlb_alloc_coherent: allocated memory is out of "
+ "range for device");
+ }
*dma_handle = dev_addr;
return ret;
}
void
-swiotlb_free_coherent (struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
+swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
+ dma_addr_t dma_handle)
{
if (!(vaddr >= (void *)io_tlb_start
&& vaddr < (void *)io_tlb_end))
@@ -334,66 +368,63 @@ swiotlb_free_coherent (struct device *hwdev, size_t size, void *vaddr, dma_addr_
swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
}
-static void swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
+static void
+swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
{
- /*
+ /*
* Ran out of IOMMU space for this operation. This is very bad.
* Unfortunately the drivers cannot handle this operation properly.
* unless they check for pci_dma_mapping_error (most don't)
* When the mapping is small enough return a static buffer to limit
- * the damage, or panic when the transfer is too big.
- */
-
- printk(KERN_ERR
- "PCI-DMA: Out of SW-IOMMU space for %lu bytes at device %s\n",
- size, dev ? dev->bus_id : "?");
+ * the damage, or panic when the transfer is too big.
+ */
+ printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
+ "device %s\n", size, dev ? dev->bus_id : "?");
if (size > io_tlb_overflow && do_panic) {
if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
panic("PCI-DMA: Memory would be corrupted\n");
- if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL)
- panic("PCI-DMA: Random memory would be DMAed\n");
- }
-}
+ if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL)
+ panic("PCI-DMA: Random memory would be DMAed\n");
+ }
+}
/*
- * Map a single buffer of the indicated size for DMA in streaming mode. The PCI address
- * to use is returned.
+ * Map a single buffer of the indicated size for DMA in streaming mode. The
+ * PCI address to use is returned.
*
- * Once the device is given the dma address, the device owns this memory until either
- * swiotlb_unmap_single or swiotlb_dma_sync_single is performed.
+ * Once the device is given the dma address, the device owns this memory until
+ * either swiotlb_unmap_single or swiotlb_dma_sync_single is performed.
*/
dma_addr_t
-swiotlb_map_single (struct device *hwdev, void *ptr, size_t size, int dir)
+swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
{
unsigned long dev_addr = virt_to_phys(ptr);
- void *map;
+ void *map;
if (dir == DMA_NONE)
BUG();
/*
- * Check if the PCI device can DMA to ptr... if so, just return ptr
+ * If the pointer passed in happens to be in the device's DMA window,
+ * we can safely return the device addr and not worry about bounce
+ * buffering it.
*/
- if (!address_needs_mapping(hwdev, dev_addr) && !swiotlb_force)
- /*
- * Device is bit capable of DMA'ing to the buffer... just return the PCI
- * address of ptr
- */
+ if (!address_needs_mapping(hwdev, dev_addr) && !swiotlb_force)
return dev_addr;
/*
- * get a bounce buffer:
+ * Oh well, have to allocate and map a bounce buffer.
*/
map = map_single(hwdev, ptr, size, dir);
- if (!map) {
- swiotlb_full(hwdev, size, dir, 1);
- map = io_tlb_overflow_buffer;
+ if (!map) {
+ swiotlb_full(hwdev, size, dir, 1);
+ map = io_tlb_overflow_buffer;
}
dev_addr = virt_to_phys(map);
/*
- * Ensure that the address returned is DMA'ble:
+ * Ensure that the address returned is DMA'ble
*/
if (address_needs_mapping(hwdev, dev_addr))
panic("map_single: bounce buffer is not DMA'ble");
@@ -407,7 +438,7 @@ swiotlb_map_single (struct device *hwdev, void *ptr, size_t size, int dir)
* flush them when they get mapped into an executable vm-area.
*/
static void
-mark_clean (void *addr, size_t size)
+mark_clean(void *addr, size_t size)
{
unsigned long pg_addr, end;
@@ -421,15 +452,16 @@ mark_clean (void *addr, size_t size)
}
/*
- * Unmap a single streaming mode DMA translation. The dma_addr and size must match what
- * was provided for in a previous swiotlb_map_single call. All other usages are
- * undefined.
+ * Unmap a single streaming mode DMA translation. The dma_addr and size must
+ * match what was provided for in a previous swiotlb_map_single call. All
+ * other usages are undefined.
*
- * After this call, reads by the cpu to the buffer are guaranteed to see whatever the
- * device wrote there.
+ * After this call, reads by the cpu to the buffer are guaranteed to see
+ * whatever the device wrote there.
*/
void
-swiotlb_unmap_single (struct device *hwdev, dma_addr_t dev_addr, size_t size, int dir)
+swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size,
+ int dir)
{
char *dma_addr = phys_to_virt(dev_addr);
@@ -442,16 +474,18 @@ swiotlb_unmap_single (struct device *hwdev, dma_addr_t dev_addr, size_t size, in
}
/*
- * Make physical memory consistent for a single streaming mode DMA translation after a
- * transfer.
+ * Make physical memory consistent for a single streaming mode DMA translation
+ * after a transfer.
*
- * If you perform a swiotlb_map_single() but wish to interrogate the buffer using the cpu,
- * yet do not wish to teardown the PCI dma mapping, you must call this function before
- * doing so. At the next point you give the PCI dma address back to the card, you must
- * first perform a swiotlb_dma_sync_for_device, and then the device again owns the buffer
+ * If you perform a swiotlb_map_single() but wish to interrogate the buffer
+ * using the cpu, yet do not wish to teardown the PCI dma mapping, you must
+ * call this function before doing so. At the next point you give the PCI dma
+ * address back to the card, you must first perform a
+ * swiotlb_dma_sync_for_device, and then the device again owns the buffer
*/
void
-swiotlb_sync_single_for_cpu (struct device *hwdev, dma_addr_t dev_addr, size_t size, int dir)
+swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
+ size_t size, int dir)
{
char *dma_addr = phys_to_virt(dev_addr);
@@ -464,7 +498,8 @@ swiotlb_sync_single_for_cpu (struct device *hwdev, dma_addr_t dev_addr, size_t s
}
void
-swiotlb_sync_single_for_device (struct device *hwdev, dma_addr_t dev_addr, size_t size, int dir)
+swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
+ size_t size, int dir)
{
char *dma_addr = phys_to_virt(dev_addr);
@@ -477,10 +512,11 @@ swiotlb_sync_single_for_device (struct device *hwdev, dma_addr_t dev_addr, size_
}
/*
- * Map a set of buffers described by scatterlist in streaming mode for DMA. This is the
- * scatter-gather version of the above swiotlb_map_single interface. Here the scatter
- * gather list elements are each tagged with the appropriate dma address and length. They
- * are obtained via sg_dma_{address,length}(SG).
+ * Map a set of buffers described by scatterlist in streaming mode for DMA.
+ * This is the scatter-gather version of the above swiotlb_map_single
+ * interface. Here the scatter gather list elements are each tagged with the
+ * appropriate dma address and length. They are obtained via
+ * sg_dma_{address,length}(SG).
*
* NOTE: An implementation may be able to use a smaller number of
* DMA address/length pairs than there are SG table elements.
@@ -488,10 +524,12 @@ swiotlb_sync_single_for_device (struct device *hwdev, dma_addr_t dev_addr, size_
* The routine returns the number of addr/length pairs actually
* used, at most nents.
*
- * Device ownership issues as mentioned above for swiotlb_map_single are the same here.
+ * Device ownership issues as mentioned above for swiotlb_map_single are the
+ * same here.
*/
int
-swiotlb_map_sg (struct device *hwdev, struct scatterlist *sg, int nelems, int dir)
+swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
+ int dir)
{
void *addr;
unsigned long dev_addr;
@@ -506,9 +544,9 @@ swiotlb_map_sg (struct device *hwdev, struct scatterlist *sg, int nelems, int di
if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) {
sg->dma_address = (dma_addr_t) virt_to_phys(map_single(hwdev, addr, sg->length, dir));
if (!sg->dma_address) {
- /* Don't panic here, we expect pci_map_sg users
+ /* Don't panic here, we expect map_sg users
to do proper error handling. */
- swiotlb_full(hwdev, sg->length, dir, 0);
+ swiotlb_full(hwdev, sg->length, dir, 0);
swiotlb_unmap_sg(hwdev, sg - i, i, dir);
sg[0].dma_length = 0;
return 0;
@@ -521,11 +559,12 @@ swiotlb_map_sg (struct device *hwdev, struct scatterlist *sg, int nelems, int di
}
/*
- * Unmap a set of streaming mode DMA translations. Again, cpu read rules concerning calls
- * here are the same as for swiotlb_unmap_single() above.
+ * Unmap a set of streaming mode DMA translations. Again, cpu read rules
+ * concerning calls here are the same as for swiotlb_unmap_single() above.
*/
void
-swiotlb_unmap_sg (struct device *hwdev, struct scatterlist *sg, int nelems, int dir)
+swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
+ int dir)
{
int i;
@@ -540,14 +579,15 @@ swiotlb_unmap_sg (struct device *hwdev, struct scatterlist *sg, int nelems, int
}
/*
- * Make physical memory consistent for a set of streaming mode DMA translations after a
- * transfer.
+ * Make physical memory consistent for a set of streaming mode DMA translations
+ * after a transfer.
*
- * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules and
- * usage.
+ * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules
+ * and usage.
*/
void
-swiotlb_sync_sg_for_cpu (struct device *hwdev, struct scatterlist *sg, int nelems, int dir)
+swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
+ int nelems, int dir)
{
int i;
@@ -556,11 +596,13 @@ swiotlb_sync_sg_for_cpu (struct device *hwdev, struct scatterlist *sg, int nelem
for (i = 0; i < nelems; i++, sg++)
if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
- sync_single(hwdev, (void *) sg->dma_address, sg->dma_length, dir);
+ sync_single(hwdev, (void *) sg->dma_address,
+ sg->dma_length, dir);
}
void
-swiotlb_sync_sg_for_device (struct device *hwdev, struct scatterlist *sg, int nelems, int dir)
+swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
+ int nelems, int dir)
{
int i;
@@ -569,24 +611,26 @@ swiotlb_sync_sg_for_device (struct device *hwdev, struct scatterlist *sg, int ne
for (i = 0; i < nelems; i++, sg++)
if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
- sync_single(hwdev, (void *) sg->dma_address, sg->dma_length, dir);
+ sync_single(hwdev, (void *) sg->dma_address,
+ sg->dma_length, dir);
}
int
-swiotlb_dma_mapping_error (dma_addr_t dma_addr)
+swiotlb_dma_mapping_error(dma_addr_t dma_addr)
{
return (dma_addr == virt_to_phys(io_tlb_overflow_buffer));
}
/*
- * Return whether the given PCI device DMA address mask can be supported properly. For
- * example, if your device can only drive the low 24-bits during PCI bus mastering, then
- * you would pass 0x00ffffff as the mask to this function.
+ * Return whether the given PCI device DMA address mask can be supported
+ * properly. For example, if your device can only drive the low 24-bits
+ * during PCI bus mastering, then you would pass 0x00ffffff as the mask to
+ * this function.
*/
int
swiotlb_dma_supported (struct device *hwdev, u64 mask)
{
- return 1;
+ return (virt_to_phys (io_tlb_end) - 1) <= mask;
}
EXPORT_SYMBOL(swiotlb_init);
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 0f905a6371b22..09212381c4f92 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -214,8 +214,8 @@ count_dma_pages (u64 start, u64 end, void *arg)
{
unsigned long *count = arg;
- if (end <= MAX_DMA_ADDRESS)
- *count += (end - start) >> PAGE_SHIFT;
+ if (start < MAX_DMA_ADDRESS)
+ *count += (min(end, MAX_DMA_ADDRESS) - start) >> PAGE_SHIFT;
return 0;
}
#endif
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 343a86092a7bd..9a27fb3991dd9 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -39,7 +39,7 @@ struct early_node_data {
unsigned long max_pfn;
};
-static struct early_node_data mem_data[NR_NODES] __initdata;
+static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
/**
* reassign_cpu_only_nodes - called from find_memory to move CPU-only nodes to a memory node
@@ -56,9 +56,9 @@ static void __init reassign_cpu_only_nodes(void)
struct node_memblk_s *p;
int i, j, k, nnode, nid, cpu, cpunid, pxm;
u8 cslit, slit;
- static DECLARE_BITMAP(nodes_with_mem, NR_NODES) __initdata;
+ static DECLARE_BITMAP(nodes_with_mem, MAX_NUMNODES) __initdata;
static u8 numa_slit_fix[MAX_NUMNODES * MAX_NUMNODES] __initdata;
- static int node_flip[NR_NODES] __initdata;
+ static int node_flip[MAX_NUMNODES] __initdata;
static int old_nid_map[NR_CPUS] __initdata;
for (nnode = 0, p = &node_memblk[0]; p < &node_memblk[num_node_memblks]; p++)
@@ -70,7 +70,7 @@ static void __init reassign_cpu_only_nodes(void)
/*
* All nids with memory.
*/
- if (nnode == numnodes)
+ if (nnode == num_online_nodes())
return;
/*
@@ -79,10 +79,17 @@ static void __init reassign_cpu_only_nodes(void)
* For reassigned CPU nodes a nid can't be arrived at
* until after this loop because the target nid's new
* identity might not have been established yet. So
- * new nid values are fabricated above numnodes and
+ * new nid values are fabricated above num_online_nodes() and
* mapped back later to their true value.
*/
- for (nid = 0, i = 0; i < numnodes; i++) {
+ /* MCD - This code is a bit complicated, but may be unnecessary now.
+ * We can now handle much more interesting node-numbering.
+ * The old requirement that 0 <= nid <= numnodes <= MAX_NUMNODES
+ * and that there be no holes in the numbering 0..numnodes
+ * has become simply 0 <= nid <= MAX_NUMNODES.
+ */
+ nid = 0;
+ for_each_online_node(i) {
if (test_bit(i, (void *) nodes_with_mem)) {
/*
* Save original nid value for numa_slit
@@ -102,7 +109,7 @@ static void __init reassign_cpu_only_nodes(void)
cpunid = nid;
nid++;
} else
- cpunid = numnodes;
+ cpunid = MAX_NUMNODES;
for (cpu = 0; cpu < NR_CPUS; cpu++)
if (node_cpuid[cpu].nid == i) {
@@ -110,7 +117,7 @@ static void __init reassign_cpu_only_nodes(void)
* For nodes not being reassigned just
* fix the cpu's nid and reverse pxm map
*/
- if (cpunid < numnodes) {
+ if (cpunid < MAX_NUMNODES) {
pxm = nid_to_pxm_map[i];
pxm_to_nid_map[pxm] =
node_cpuid[cpu].nid = cpunid;
@@ -120,18 +127,21 @@ static void __init reassign_cpu_only_nodes(void)
/*
* For nodes being reassigned, find best node by
* numa_slit information and then make a temporary
- * nid value based on current nid and numnodes.
+ * nid value based on current nid and num_online_nodes().
*/
- for (slit = 0xff, k = numnodes + numnodes, j = 0; j < numnodes; j++)
+ slit = 0xff;
+ k = 2*num_online_nodes();
+ for_each_online_node(j) {
if (i == j)
continue;
else if (test_bit(j, (void *) nodes_with_mem)) {
- cslit = numa_slit[i * numnodes + j];
+ cslit = numa_slit[i * num_online_nodes() + j];
if (cslit < slit) {
- k = numnodes + j;
+ k = num_online_nodes() + j;
slit = cslit;
}
}
+ }
/* save old nid map so we can update the pxm */
old_nid_map[cpu] = node_cpuid[cpu].nid;
@@ -143,12 +153,12 @@ static void __init reassign_cpu_only_nodes(void)
* Fixup temporary nid values for CPU-only nodes.
*/
for (cpu = 0; cpu < NR_CPUS; cpu++)
- if (node_cpuid[cpu].nid == (numnodes + numnodes)) {
+ if (node_cpuid[cpu].nid == (2*num_online_nodes())) {
pxm = nid_to_pxm_map[old_nid_map[cpu]];
pxm_to_nid_map[pxm] = node_cpuid[cpu].nid = nnode - 1;
} else {
for (i = 0; i < nnode; i++) {
- if (node_flip[i] != (node_cpuid[cpu].nid - numnodes))
+ if (node_flip[i] != (node_cpuid[cpu].nid - num_online_nodes()))
continue;
pxm = nid_to_pxm_map[old_nid_map[cpu]];
@@ -164,14 +174,13 @@ static void __init reassign_cpu_only_nodes(void)
for (i = 0; i < nnode; i++)
for (j = 0; j < nnode; j++)
numa_slit_fix[i * nnode + j] =
- numa_slit[node_flip[i] * numnodes + node_flip[j]];
+ numa_slit[node_flip[i] * num_online_nodes() + node_flip[j]];
memcpy(numa_slit, numa_slit_fix, sizeof (numa_slit));
- for (i = nnode; i < numnodes; i++)
- node_set_offline(i);
-
- numnodes = nnode;
+ nodes_clear(node_online_map);
+ for (i = 0; i < nnode; i++)
+ node_set_online(i);
return;
}
@@ -370,7 +379,7 @@ static void __init reserve_pernode_space(void)
struct bootmem_data *bdp;
int node;
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
pg_data_t *pdp = mem_data[node].pgdat;
bdp = pdp->bdata;
@@ -399,13 +408,13 @@ static void __init reserve_pernode_space(void)
static void __init initialize_pernode_data(void)
{
int cpu, node;
- pg_data_t *pgdat_list[NR_NODES];
+ pg_data_t *pgdat_list[MAX_NUMNODES];
- for (node = 0; node < numnodes; node++)
+ for_each_online_node(node)
pgdat_list[node] = mem_data[node].pgdat;
/* Copy the pg_data_t list to each node and init the node field */
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
memcpy(mem_data[node].node_data->pg_data_ptrs, pgdat_list,
sizeof(pgdat_list));
}
@@ -429,15 +438,15 @@ void __init find_memory(void)
reserve_memory();
- if (numnodes == 0) {
+ if (num_online_nodes() == 0) {
printk(KERN_ERR "node info missing!\n");
- numnodes = 1;
+ node_set_online(0);
}
min_low_pfn = -1;
max_low_pfn = 0;
- if (numnodes > 1)
+ if (num_online_nodes() > 1)
reassign_cpu_only_nodes();
/* These actually end up getting called by call_pernode_memory() */
@@ -448,10 +457,13 @@ void __init find_memory(void)
* Initialize the boot memory maps in reverse order since that's
* what the bootmem allocator expects
*/
- for (node = numnodes - 1; node >= 0; node--) {
+ for (node = MAX_NUMNODES - 1; node >= 0; node--) {
unsigned long pernode, pernodesize, map;
struct bootmem_data *bdp;
+ if (!node_online(node))
+ continue;
+
bdp = &mem_data[node].bootmem_data;
pernode = mem_data[node].pernode_addr;
pernodesize = mem_data[node].pernode_size;
@@ -638,12 +650,12 @@ void __init paging_init(void)
max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
/* so min() will work in count_node_pages */
- for (node = 0; node < numnodes; node++)
+ for_each_online_node(node)
mem_data[node].min_pfn = ~0UL;
efi_memmap_walk(filter_rsvd_memory, count_node_pages);
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
memset(zones_size, 0, sizeof(zones_size));
memset(zholes_size, 0, sizeof(zholes_size));
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index a5dbfc46e2417..b83bc675e4116 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -432,7 +432,6 @@ virtual_memmap_init (u64 start, u64 end, void *arg)
struct page *map_start, *map_end;
args = (struct memmap_init_callback_data *) arg;
-
map_start = vmem_map + (__pa(start) >> PAGE_SHIFT);
map_end = vmem_map + (__pa(end) >> PAGE_SHIFT);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index abb0f4283cdff..032fc4774c56a 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -382,7 +382,7 @@ void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
struct hubdev_info *hubdev_info;
- if (node >= numnodes) /* Headless/memless IO nodes */
+ if (node >= num_online_nodes()) /* Headless/memless IO nodes */
hubdev_info =
(struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0),
sizeof(struct
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index c92b4b4434a90..b91a5a2d9f4cd 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -224,9 +224,10 @@ static void __init sn_check_for_wars(void)
{
int cnode;
- for (cnode = 0; cnode < numnodes; cnode++)
+ for_each_online_node(cnode) {
if (is_shub_1_1(cnodeid_to_nasid(cnode)))
shub_1_1_found = 1;
+ }
}
/**
@@ -346,17 +347,17 @@ void __init sn_init_pdas(char **cmdline_p)
memset(pda->cnodeid_to_nasid_table, -1,
sizeof(pda->cnodeid_to_nasid_table));
- for (cnode = 0; cnode < numnodes; cnode++)
+ for_each_online_node(cnode)
pda->cnodeid_to_nasid_table[cnode] =
pxm_to_nasid(nid_to_pxm_map[cnode]);
- numionodes = numnodes;
+ numionodes = num_online_nodes();
scan_for_ionodes();
/*
* Allocate & initalize the nodepda for each node.
*/
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
nodepdaindr[cnode] =
alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t));
memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
@@ -367,7 +368,7 @@ void __init sn_init_pdas(char **cmdline_p)
/*
* Allocate & initialize nodepda for TIOs. For now, put them on node 0.
*/
- for (cnode = numnodes; cnode < numionodes; cnode++) {
+ for (cnode = num_online_nodes(); cnode < numionodes; cnode++) {
nodepdaindr[cnode] =
alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t));
memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
@@ -385,7 +386,7 @@ void __init sn_init_pdas(char **cmdline_p)
* The following routine actually sets up the hubinfo struct
* in nodepda.
*/
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
bte_init_node(nodepdaindr[cnode], cnode);
}
@@ -431,7 +432,7 @@ void __init sn_cpu_init(void)
if (ia64_sn_get_sapic_info(cpuphyid, &nasid, &subnode, &slice))
BUG();
- for (i=0; i < NR_NODES; i++) {
+ for (i=0; i < MAX_NUMNODES; i++) {
if (nodepdaindr[i]) {
nodepdaindr[i]->phys_cpuid[cpuid].nasid = nasid;
nodepdaindr[i]->phys_cpuid[cpuid].slice = slice;
@@ -484,7 +485,7 @@ void __init sn_cpu_init(void)
int buddy_nasid;
buddy_nasid =
cnodeid_to_nasid(numa_node_id() ==
- numnodes - 1 ? 0 : numa_node_id() + 1);
+ num_online_nodes() - 1 ? 0 : numa_node_id() + 1);
pda->pio_shub_war_cam_addr =
(volatile unsigned long *)GLOBAL_MMR_ADDR(nasid,
SH_PI_CAM_CONTROL);
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index fd569e70268d9..78520eb5f0bfd 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -233,14 +233,13 @@ int __init prominfo_init(void)
if (!ia64_platform_is("sn2"))
return 0;
- proc_entries = kmalloc(numnodes * sizeof(struct proc_dir_entry *),
+ proc_entries = kmalloc(num_online_nodes() * sizeof(struct proc_dir_entry *),
GFP_KERNEL);
sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
- for (cnodeid = 0, entp = proc_entries;
- cnodeid < numnodes;
- cnodeid++, entp++) {
+ entp = proc_entries;
+ for_each_online_node(cnodeid) {
sprintf(name, "node%d", cnodeid);
*entp = proc_mkdir(name, sgi_prominfo_entry);
nasid = cnodeid_to_nasid(cnodeid);
@@ -254,6 +253,7 @@ int __init prominfo_init(void)
(void *)nasid);
if (p)
p->owner = THIS_MODULE;
+ entp++;
}
return 0;
@@ -265,12 +265,13 @@ void __exit prominfo_exit(void)
unsigned cnodeid;
char name[NODE_NAME_LEN];
- for (cnodeid = 0, entp = proc_entries;
- cnodeid < numnodes; cnodeid++, entp++) {
+ entp = proc_entries;
+ for_each_online_node(cnodeid) {
remove_proc_entry("fit", *entp);
remove_proc_entry("version", *entp);
sprintf(name, "node%d", cnodeid);
remove_proc_entry(name, sgi_prominfo_entry);
+ entp++;
}
remove_proc_entry("sgi_prominfo", NULL);
kfree(proc_entries);
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 0d425f7a8fc04..f102dc58131ec 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -92,16 +92,15 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
volatile unsigned long *ptc0, *ptc1;
unsigned long flags = 0, data0, data1;
struct mm_struct *mm = current->active_mm;
- short nasids[NR_NODES], nix;
- DECLARE_BITMAP(nodes_flushed, NR_NODES);
-
- bitmap_zero(nodes_flushed, NR_NODES);
+ short nasids[MAX_NUMNODES], nix;
+ nodemask_t nodes_flushed;
+ nodes_clear(nodes_flushed);
i = 0;
for_each_cpu_mask(cpu, mm->cpu_vm_mask) {
cnode = cpu_to_node(cpu);
- __set_bit(cnode, nodes_flushed);
+ node_set(cnode, nodes_flushed);
lcpu = cpu;
i++;
}
@@ -125,8 +124,7 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
}
nix = 0;
- for (cnode = find_first_bit(&nodes_flushed, NR_NODES); cnode < NR_NODES;
- cnode = find_next_bit(&nodes_flushed, NR_NODES, ++cnode))
+ for_each_node_mask(cnode, nodes_flushed)
nasids[nix++] = cnodeid_to_nasid(cnode);
data0 = (1UL << SH_PTC_0_A_SHFT) |
@@ -194,7 +192,7 @@ void sn2_ptc_deadlock_recovery(unsigned long data0, unsigned long data1)
mycnode = numa_node_id();
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
if (is_headless_node(cnode) || cnode == mycnode)
continue;
nasid = cnodeid_to_nasid(cnode);
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index db9589c24de5b..bde87d3aa921e 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -251,7 +251,9 @@ void __init setup_arch(char **cmdline_p)
#endif
#ifdef CONFIG_DISCONTIGMEM
- numnodes = 2;
+ nodes_clear(node_online_map);
+ node_set_online(0);
+ node_set_online(1);
#endif /* CONFIG_DISCONTIGMEM */
init_mm.start_code = (unsigned long) _text;
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 9eb3632917e12..5180c7a12a66d 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -247,7 +247,7 @@ static void __init init_ipi_lock(void)
int ipi;
for (ipi = 0 ; ipi < NR_IPIS ; ipi++)
- ipi_lock[ipi] = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&ipi_lock[ipi]);
}
/*==========================================================================*
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 3e49ff64bc9f0..bf3104a159087 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -75,7 +75,7 @@ unsigned long __init setup_memory(void)
mem_prof_init();
- for (nid = 0 ; nid < numnodes ; nid++) {
+ for_each_online_node(nid) {
mp = &mem_prof[nid];
NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid];
NODE_DATA(nid)->bdata = &node_bdata[nid];
@@ -135,12 +135,12 @@ unsigned long __init zone_sizes_init(void)
mem_prof_t *mp;
pgdat_list = NULL;
- for (nid = numnodes - 1 ; nid >= 0 ; nid--) {
+ for (nid = num_online_nodes() - 1 ; nid >= 0 ; nid--) {
NODE_DATA(nid)->pgdat_next = pgdat_list;
pgdat_list = NODE_DATA(nid);
}
- for (nid = 0 ; nid < numnodes ; nid++) {
+ for_each_online_node(nid) {
mp = &mem_prof[nid];
for (i = 0 ; i < MAX_NR_ZONES ; i++) {
zones_size[i] = 0;
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index b6a5aaceaadf3..736c8d86f64b9 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -153,7 +153,7 @@ int __init reservedpages_count(void)
int reservedpages, nid, i;
reservedpages = 0;
- for (nid = 0 ; nid < numnodes ; nid++)
+ for_each_online_node(nid)
for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++)
if (PageReserved(NODE_DATA(nid)->node_mem_map + i))
reservedpages++;
@@ -174,7 +174,7 @@ void __init mem_init(void)
#endif
num_physpages = 0;
- for (nid = 0 ; nid < numnodes ; nid++)
+ for_each_online_node(nid)
num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1;
num_physpages -= hole_pages;
@@ -193,7 +193,7 @@ void __init mem_init(void)
memset(empty_zero_page, 0, PAGE_SIZE);
/* this will put all low memory onto the freelists */
- for (nid = 0 ; nid < numnodes ; nid++)
+ for_each_online_node(nid)
totalram_pages += free_all_bootmem_node(NODE_DATA(nid));
reservedpages = reservedpages_count() - hole_pages;
diff --git a/arch/m32r/oprofile/init.c b/arch/m32r/oprofile/init.c
index f5843c8cc15d8..679553e6f65ac 100644
--- a/arch/m32r/oprofile/init.c
+++ b/arch/m32r/oprofile/init.c
@@ -12,14 +12,10 @@
#include <linux/errno.h>
#include <linux/init.h>
-extern void timer_init(struct oprofile_operations ** ops);
-
-int __init oprofile_arch_init(struct oprofile_operations ** ops)
+void __init oprofile_arch_init(struct oprofile_operations * ops)
{
- return -ENODEV;
}
-
void oprofile_arch_exit(void)
{
}
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2c77911eb1b75..80e3503414058 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -990,7 +990,7 @@ config SYSCLK_100
endchoice
-config AU1000_USB_DEVICE
+config AU1X00_USB_DEVICE
bool
depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000
default n
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
index 54a89a6c832bf..61e756d1c8cab 100644
--- a/arch/mips/au1000/mtx-1/board_setup.c
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -60,7 +60,7 @@ void __init board_setup(void)
// enable USB power switch
au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR );
au_writel( 0x100000, GPIO2_OUTPUT );
-#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1000_USB_DEVICE)
+#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
#ifdef CONFIG_PCI
#if defined(__MIPSEB__)
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 77254620cb210..cd98436e9ec4e 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -104,7 +104,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_HAVE_DEC_LOCK=y
CONFIG_DMA_COHERENT=y
CONFIG_CPU_LITTLE_ENDIAN=y
-# CONFIG_AU1000_USB_DEVICE is not set
+# CONFIG_AU1X00_USB_DEVICE is not set
CONFIG_MIPS_L1_CACHE_SHIFT=5
# CONFIG_FB is not set
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
index 93101358ad42b..cbf9043a3d6d6 100644
--- a/arch/mips/gt64120/ev64120/irq.c
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -138,7 +138,7 @@ void __init arch_init_irq(void)
irq_desc[i].handler = &no_irq_type;
irq_desc[i].action = NULL;
irq_desc[i].depth = 0;
- irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&irq_desc[i].lock);
}
gt64120_irq_setup();
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index f624f9da5262a..aef3c80d581f1 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -10,7 +10,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
-#include <linux/mmzone.h> /* for numnodes */
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/cpumask.h>
diff --git a/arch/mips/sgi-ip27/ip27-klnuma.c b/arch/mips/sgi-ip27/ip27-klnuma.c
index fb47c75c45f29..95cc85872a978 100644
--- a/arch/mips/sgi-ip27/ip27-klnuma.c
+++ b/arch/mips/sgi-ip27/ip27-klnuma.c
@@ -27,33 +27,25 @@ static cpumask_t ktext_repmask;
* kernel. For example, we should never put a copy on a headless node,
* and we should respect the topology of the machine.
*/
-void __init setup_replication_mask(int maxnodes)
+void __init setup_replication_mask()
{
- static int numa_kernel_replication_ratio;
cnodeid_t cnode;
/* Set only the master cnode's bit. The master cnode is always 0. */
cpus_clear(ktext_repmask);
cpu_set(0, ktext_repmask);
- numa_kernel_replication_ratio = 0;
#ifdef CONFIG_REPLICATE_KTEXT
#ifndef CONFIG_MAPPED_KERNEL
#error Kernel replication works with mapped kernel support. No calias support.
#endif
- numa_kernel_replication_ratio = 1;
-#endif
-
- for (cnode = 1; cnode < numnodes; cnode++) {
- /* See if this node should get a copy of the kernel */
- if (numa_kernel_replication_ratio &&
- !(cnode % numa_kernel_replication_ratio)) {
-
- /* Advertise that we have a copy of the kernel */
- cpu_set(cnode, ktext_repmask);
- }
+ for_each_online_node(cnode) {
+ if (cnode == 0)
+ continue;
+ /* Advertise that we have a copy of the kernel */
+ cpu_set(cnode, ktext_repmask);
}
-
+#endif
/* Set up a GDA pointer to the replication mask. */
GDA->g_ktext_repmask = &ktext_repmask;
}
@@ -92,7 +84,7 @@ static __init void copy_kernel(nasid_t dest_nasid)
memcpy((void *)dest_kern_start, (void *)source_start, kern_size);
}
-void __init replicate_kernel_text(int maxnodes)
+void __init replicate_kernel_text()
{
cnodeid_t cnode;
nasid_t client_nasid;
@@ -103,7 +95,9 @@ void __init replicate_kernel_text(int maxnodes)
/* Record where the master node should get its kernel text */
set_ktext_source(master_nasid, master_nasid);
- for (cnode = 1; cnode < maxnodes; cnode++) {
+ for_each_online_node(cnode) {
+ if (cnode == 0)
+ continue;
client_nasid = COMPACT_TO_NASID_NODEID(cnode);
/* Check if this node should get a copy of the kernel */
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 327eadb4f3da0..2a03de11f6c05 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -59,12 +59,12 @@ static hubreg_t get_region(cnodeid_t cnode)
static hubreg_t region_mask;
-static void gen_region_mask(hubreg_t *region_mask, int maxnodes)
+static void gen_region_mask(hubreg_t *region_mask)
{
cnodeid_t cnode;
(*region_mask) = 0;
- for (cnode = 0; cnode < maxnodes; cnode++) {
+ for_each_online_node(cnode) {
(*region_mask) |= 1ULL << get_region(cnode);
}
}
@@ -120,7 +120,7 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
int port;
/* Figure out which routers nodes in question are connected to */
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
@@ -187,9 +187,9 @@ static void __init init_topology_matrix(void)
for (col = 0; col < MAX_COMPACT_NODES; col++)
__node_distances[row][col] = -1;
- for (row = 0; row < numnodes; row++) {
+ for_each_online_node(row) {
nasid = COMPACT_TO_NASID_NODEID(row);
- for (col = 0; col < numnodes; col++) {
+ for_each_online_node(col) {
nasid2 = COMPACT_TO_NASID_NODEID(col);
__node_distances[row][col] =
compute_node_distance(nasid, nasid2);
@@ -210,17 +210,17 @@ static void __init dump_topology(void)
printk("************** Topology ********************\n");
printk(" ");
- for (col = 0; col < numnodes; col++)
+ for_each_online_node(col)
printk("%02d ", col);
printk("\n");
- for (row = 0; row < numnodes; row++) {
+ for_each_online_node(row) {
printk("%02d ", row);
- for (col = 0; col < numnodes; col++)
+ for_each_online_node(col)
printk("%2d ", node_distance(row, col));
printk("\n");
}
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
@@ -363,14 +363,14 @@ static void __init mlreset(void)
init_topology_matrix();
dump_topology();
- gen_region_mask(&region_mask, numnodes);
+ gen_region_mask(&region_mask);
- setup_replication_mask(numnodes);
+ setup_replication_mask();
/*
* Set all nodes' calias sizes to 8k
*/
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
nasid_t nasid;
nasid = COMPACT_TO_NASID_NODEID(i);
@@ -407,7 +407,7 @@ static void __init szmem(void)
num_physpages = 0;
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
ignore = nodebytes = 0;
for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
slot_psize = slot_psize_compute(node, slot);
@@ -489,7 +489,7 @@ void __init prom_meminit(void)
szmem();
for (node = 0; node < MAX_COMPACT_NODES; node++) {
- if (node < numnodes) {
+ if (node_online(node)) {
node_mem_init(node);
continue;
}
@@ -513,7 +513,7 @@ void __init paging_init(void)
pagetable_init();
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
pfn_t start_pfn = slot_getbasepfn(node, 0);
pfn_t end_pfn = node_getmaxclick(node) + 1;
@@ -533,7 +533,7 @@ void __init mem_init(void)
high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
unsigned slot, numslots;
struct page *end, *p;
diff --git a/arch/mips/sgi-ip27/ip27-nmi.c b/arch/mips/sgi-ip27/ip27-nmi.c
index da8ed29df2391..5310815a5699c 100644
--- a/arch/mips/sgi-ip27/ip27-nmi.c
+++ b/arch/mips/sgi-ip27/ip27-nmi.c
@@ -183,7 +183,7 @@ nmi_eframes_save(void)
{
cnodeid_t cnode;
- for(cnode = 0 ; cnode < numnodes; cnode++)
+ for_each_online_node(cnode)
nmi_node_eframe_save(cnode);
}
@@ -214,13 +214,13 @@ cont_nmi_dump(void)
* send NMIs to all cpus on a 256p system.
*/
for (i=0; i < 1500; i++) {
- for (node=0; node < numnodes; node++)
+ for_each_online_node(node)
if (NODEPDA(node)->dump_count == 0)
break;
- if (node == numnodes)
+ if (node == MAX_NUMNODES)
break;
if (i == 1000) {
- for (node=0; node < numnodes; node++)
+ for_each_online_node(node)
if (NODEPDA(node)->dump_count == 0) {
cpu = node_to_first_cpu(node);
for (n=0; n < CNODE_NUM_CPUS(node); cpu++, n++) {
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c
index aa19dc1361df4..0565e19cf17dc 100644
--- a/arch/mips/sgi-ip27/ip27-reset.c
+++ b/arch/mips/sgi-ip27/ip27-reset.c
@@ -43,7 +43,7 @@ static void ip27_machine_restart(char *command)
smp_send_stop();
#endif
#if 0
- for (i = 0; i < numnodes; i++)
+ for_each_online_node(i)
REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
PROMOP_REBOOT);
#else
@@ -59,7 +59,7 @@ static void ip27_machine_halt(void)
#ifdef CONFIG_SMP
smp_send_stop();
#endif
- for (i = 0; i < numnodes; i++)
+ for_each_online_node(i)
REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
PROMOP_RESTART);
LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 1103e2910289b..dd173320f2241 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -108,18 +108,22 @@ void cpu_node_probe(void)
for (i = 0; i < MAXCPUS; i++)
cpuid_to_compact_node[i] = INVALID_CNODEID;
- numnodes = 0;
+ /*
+ * MCD - this whole "compact node" stuff can probably be dropped,
+ * as we can handle sparse numbering now
+ */
+ nodes_clear(node_online_map);
for (i = 0; i < MAX_COMPACT_NODES; i++) {
nasid_t nasid = gdap->g_nasidtable[i];
if (nasid == INVALID_NASID)
break;
compact_to_nasid_node[i] = nasid;
nasid_to_compact_node[nasid] = i;
- numnodes++;
+ node_set_online(num_online_nodes());
highest = do_cpumask(i, nasid, highest);
}
- printk("Discovered %d cpus on %d nodes\n", highest + 1, numnodes);
+ printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
}
static void intr_clear_bits(nasid_t nasid, volatile hubreg_t *pend,
@@ -151,10 +155,10 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
{
cnodeid_t cnode;
- for (cnode = 0; cnode < numnodes; cnode++)
+ for_each_online_node(cnode)
intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
- replicate_kernel_text(numnodes);
+ replicate_kernel_text();
/*
* Assumption to be fixed: we're always booted on logical / physical
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index a2dced5bec013..00a717334de77 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -269,8 +269,6 @@ static void __init setup_bootmem(void)
}
memset(pfnnid_map, 0xff, sizeof(pfnnid_map));
- numnodes = npmem_ranges;
-
for (i = 0; i < npmem_ranges; i++)
node_set_online(i);
#endif
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
index 8051df176f654..c6bd7b86bd61f 100644
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -645,7 +645,7 @@ static void __init prep_init_sound(void)
static void __init
prep_init_vesa(void)
{
-#if (defined(CONFIG_FB_VGA16) || defined(CONFIG_FB_VGA_16_MODULE) || \
+#if (defined(CONFIG_FB_VGA16) || defined(CONFIG_FB_VGA16_MODULE) || \
defined(CONFIG_FB_VESA))
PPC_DEVICE *vgadev = NULL;
@@ -1126,7 +1126,7 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
_prep_type = _PREP_Motorola;
}
-#ifdef CONFIG_PREP_PRESIDUAL
+#ifdef CONFIG_PREP_RESIDUAL
/* Switch off all residual data processing if the user requests it */
if (strstr(cmd_line, "noresidual") != NULL)
res = NULL;
diff --git a/arch/ppc/syslib/ppc4xx_dma.c b/arch/ppc/syslib/ppc4xx_dma.c
index 89f6825240ce9..71533ba90ccf1 100644
--- a/arch/ppc/syslib/ppc4xx_dma.c
+++ b/arch/ppc/syslib/ppc4xx_dma.c
@@ -48,7 +48,7 @@ ppc4xx_set_src_addr(int dmanr, phys_addr_t src_addr)
return;
}
-#ifdef PPC4xx_DMA64BIT
+#ifdef PPC4xx_DMA_64BIT
mtdcr(DCRN_DMASAH0 + dmanr*2, (u32)(src_addr >> 32));
#else
mtdcr(DCRN_DMASA0 + dmanr*2, (u32)src_addr);
@@ -63,7 +63,7 @@ ppc4xx_set_dst_addr(int dmanr, phys_addr_t dst_addr)
return;
}
-#ifdef PPC4xx_DMA64BIT
+#ifdef PPC4xx_DMA_64BIT
mtdcr(DCRN_DMADAH0 + dmanr*2, (u32)(dst_addr >> 32));
#else
mtdcr(DCRN_DMADA0 + dmanr*2, (u32)dst_addr);
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index cbcb8e3a27fde..e8f9cd714c4c7 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -36,7 +36,11 @@ CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \
-mcall-aixdesc
ifeq ($(CONFIG_POWER4_ONLY),y)
+ifeq ($(CONFIG_ALTIVEC),y)
+ CFLAGS += $(call cc-option,-mcpu=970)
+else
CFLAGS += $(call cc-option,-mcpu=power4)
+endif
else
CFLAGS += $(call cc-option,-mtune=power4)
endif
diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
index 87756d158cc9c..bfda45cf801d3 100644
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/ppc64/kernel/LparData.c
@@ -59,23 +59,23 @@ struct HvReleaseData hvReleaseData = {
0xf4, 0x4b, 0xf6, 0xf4 },
};
-extern void SystemReset_Iseries(void);
-extern void MachineCheck_Iseries(void);
-extern void DataAccess_Iseries(void);
-extern void InstructionAccess_Iseries(void);
-extern void HardwareInterrupt_Iseries(void);
-extern void Alignment_Iseries(void);
-extern void ProgramCheck_Iseries(void);
-extern void FPUnavailable_Iseries(void);
-extern void Decrementer_Iseries(void);
-extern void Trap_0a_Iseries(void);
-extern void Trap_0b_Iseries(void);
-extern void SystemCall_Iseries(void);
-extern void SingleStep_Iseries(void);
-extern void Trap_0e_Iseries(void);
-extern void PerformanceMonitor_Iseries(void);
-extern void DataAccessSLB_Iseries(void);
-extern void InstructionAccessSLB_Iseries(void);
+extern void system_reset_iSeries(void);
+extern void machine_check_iSeries(void);
+extern void data_access_iSeries(void);
+extern void instruction_access_iSeries(void);
+extern void hardware_interrupt_iSeries(void);
+extern void alignment_iSeries(void);
+extern void program_check_iSeries(void);
+extern void fp_unavailable_iSeries(void);
+extern void decrementer_iSeries(void);
+extern void trap_0a_iSeries(void);
+extern void trap_0b_iSeries(void);
+extern void system_call_iSeries(void);
+extern void single_step_iSeries(void);
+extern void trap_0e_iSeries(void);
+extern void performance_monitor_iSeries(void);
+extern void data_access_slb_iSeries(void);
+extern void instruction_access_slb_iSeries(void);
struct ItLpNaca itLpNaca = {
.xDesc = 0xd397d581, /* "LpNa" ebcdic */
@@ -105,27 +105,27 @@ struct ItLpNaca itLpNaca = {
.xSlicSegmentTablePtr = 0, /* seg table */
.xOldLpQueue = { 0 }, /* Old LP Queue */
.xInterruptHdlr = {
- (u64)SystemReset_Iseries, /* 0x100 System Reset */
- (u64)MachineCheck_Iseries, /* 0x200 Machine Check */
- (u64)DataAccess_Iseries, /* 0x300 Data Access */
- (u64)InstructionAccess_Iseries, /* 0x400 Instruction Access */
- (u64)HardwareInterrupt_Iseries, /* 0x500 External */
- (u64)Alignment_Iseries, /* 0x600 Alignment */
- (u64)ProgramCheck_Iseries, /* 0x700 Program Check */
- (u64)FPUnavailable_Iseries, /* 0x800 FP Unavailable */
- (u64)Decrementer_Iseries, /* 0x900 Decrementer */
- (u64)Trap_0a_Iseries, /* 0xa00 Trap 0A */
- (u64)Trap_0b_Iseries, /* 0xb00 Trap 0B */
- (u64)SystemCall_Iseries, /* 0xc00 System Call */
- (u64)SingleStep_Iseries, /* 0xd00 Single Step */
- (u64)Trap_0e_Iseries, /* 0xe00 Trap 0E */
- (u64)PerformanceMonitor_Iseries,/* 0xf00 Performance Monitor */
+ (u64)system_reset_iSeries, /* 0x100 System Reset */
+ (u64)machine_check_iSeries, /* 0x200 Machine Check */
+ (u64)data_access_iSeries, /* 0x300 Data Access */
+ (u64)instruction_access_iSeries, /* 0x400 Instruction Access */
+ (u64)hardware_interrupt_iSeries, /* 0x500 External */
+ (u64)alignment_iSeries, /* 0x600 Alignment */
+ (u64)program_check_iSeries, /* 0x700 Program Check */
+ (u64)fp_unavailable_iSeries, /* 0x800 FP Unavailable */
+ (u64)decrementer_iSeries, /* 0x900 Decrementer */
+ (u64)trap_0a_iSeries, /* 0xa00 Trap 0A */
+ (u64)trap_0b_iSeries, /* 0xb00 Trap 0B */
+ (u64)system_call_iSeries, /* 0xc00 System Call */
+ (u64)single_step_iSeries, /* 0xd00 Single Step */
+ (u64)trap_0e_iSeries, /* 0xe00 Trap 0E */
+ (u64)performance_monitor_iSeries,/* 0xf00 Performance Monitor */
0, /* int 0x1000 */
0, /* int 0x1010 */
0, /* int 0x1020 CPU ctls */
- (u64)HardwareInterrupt_Iseries, /* SC Ret Hdlr */
- (u64)DataAccessSLB_Iseries, /* 0x380 D-SLB */
- (u64)InstructionAccessSLB_Iseries /* 0x480 I-SLB */
+ (u64)hardware_interrupt_iSeries, /* SC Ret Hdlr */
+ (u64)data_access_slb_iSeries, /* 0x380 D-SLB */
+ (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */
}
};
EXPORT_SYMBOL(itLpNaca);
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index af3b7522ca711..bc2a508a4c353 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y := setup.o entry.o traps.o irq.o idle.o dma.o \
obj-$(CONFIG_PPC_OF) += of_device.o
pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_pci_reset.o
-pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_dma_direct.o
+pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y)
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index c3c05a159f8fa..cfecc9145a4b6 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -96,6 +96,7 @@ static atomic_t eeh_fail_count;
static int ibm_set_eeh_option;
static int ibm_set_slot_reset;
static int ibm_read_slot_reset_state;
+static int ibm_read_slot_reset_state2;
static int ibm_slot_error_detail;
static int eeh_subsystem_enabled;
@@ -408,6 +409,27 @@ int eeh_unregister_notifier(struct notifier_block *nb)
}
/**
+ * read_slot_reset_state - Read the reset state of a device node's slot
+ * @dn: device node to read
+ * @rets: array to return results in
+ */
+static int read_slot_reset_state(struct device_node *dn, int rets[])
+{
+ int token, outputs;
+
+ if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
+ token = ibm_read_slot_reset_state2;
+ outputs = 4;
+ } else {
+ token = ibm_read_slot_reset_state;
+ outputs = 3;
+ }
+
+ return rtas_call(token, 3, outputs, rets, dn->eeh_config_addr,
+ BUID_HI(dn->phb->buid), BUID_LO(dn->phb->buid));
+}
+
+/**
* eeh_panic - call panic() for an eeh event that cannot be handled.
* The philosophy of this routine is that it is better to panic and
* halt the OS than it is to risk possible data corruption by
@@ -509,7 +531,7 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
{
int ret;
- int rets[2];
+ int rets[3];
unsigned long flags;
int rc, reset_state;
struct eeh_event *event;
@@ -540,11 +562,8 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
atomic_inc(&eeh_fail_count);
if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) {
/* re-read the slot reset state */
- rets[0] = -1;
- rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
- dn->eeh_config_addr,
- BUID_HI(dn->phb->buid),
- BUID_LO(dn->phb->buid));
+ if (read_slot_reset_state(dn, rets) != 0)
+ rets[0] = -1; /* reset state unknown */
eeh_panic(dev, rets[0]);
}
return 0;
@@ -557,10 +576,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
* function zero of a multi-function device.
* In any case they must share a common PHB.
*/
- ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
- dn->eeh_config_addr, BUID_HI(dn->phb->buid),
- BUID_LO(dn->phb->buid));
-
+ ret = read_slot_reset_state(dn, rets);
if (!(ret == 0 && rets[1] == 1 && (rets[0] == 2 || rets[0] == 4))) {
__get_cpu_var(false_positives)++;
return 0;
@@ -756,6 +772,7 @@ void __init eeh_init(void)
ibm_set_eeh_option = rtas_token("ibm,set-eeh-option");
ibm_set_slot_reset = rtas_token("ibm,set-slot-reset");
+ ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2");
ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
diff --git a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S
index 74e7d48bc8f39..b3b7da3a4c928 100644
--- a/arch/ppc64/kernel/entry.S
+++ b/arch/ppc64/kernel/entry.S
@@ -54,8 +54,8 @@ exception_marker:
#undef SHOW_SYSCALLS
- .globl SystemCall_common
-SystemCall_common:
+ .globl system_call_common
+system_call_common:
andi. r10,r12,MSR_PR
mr r10,r1
addi r1,r1,-INT_FRAME_SIZE
@@ -100,7 +100,7 @@ SystemCall_common:
cmpdi cr1,r0,0x5555 /* syscall 0x5555 */
andi. r10,r12,MSR_PR /* from kernel */
crand 4*cr0+eq,4*cr1+eq,4*cr0+eq
- beq HardwareInterrupt_entry
+ beq hardware_interrupt_entry
lbz r10,PACAPROCENABLED(r13)
std r10,SOFTE(r1)
#endif
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index e4fdb87d27b42..194ea84559d96 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -78,7 +78,7 @@
*
* For iSeries:
* 1. The MMU is on (as it always is for iSeries)
- * 2. The kernel is entered at SystemReset_Iseries
+ * 2. The kernel is entered at system_reset_iSeries
*/
.text
@@ -165,7 +165,7 @@ _GLOBAL(__secondary_hold)
#else
#ifdef CONFIG_SMP
mr r3,r24
- b .pseries_secondary_smp_init
+ b .pSeries_secondary_smp_init
#else
BUG_OPCODE
#endif
@@ -305,15 +305,15 @@ exception_marker:
*/
#define STD_EXCEPTION_PSERIES(n, label) \
. = n; \
- .globl label##_Pseries; \
-label##_Pseries: \
+ .globl label##_pSeries; \
+label##_pSeries: \
HMT_MEDIUM; \
mtspr SPRG1,r13; /* save r13 */ \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
#define STD_EXCEPTION_ISERIES(n, label, area) \
- .globl label##_Iseries; \
-label##_Iseries: \
+ .globl label##_iSeries; \
+label##_iSeries: \
HMT_MEDIUM; \
mtspr SPRG1,r13; /* save r13 */ \
EXCEPTION_PROLOG_ISERIES_1(area); \
@@ -321,14 +321,14 @@ label##_Iseries: \
b label##_common
#define MASKABLE_EXCEPTION_ISERIES(n, label) \
- .globl label##_Iseries; \
-label##_Iseries: \
+ .globl label##_iSeries; \
+label##_iSeries: \
HMT_MEDIUM; \
mtspr SPRG1,r13; /* save r13 */ \
EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \
lbz r10,PACAPROCENABLED(r13); \
cmpwi 0,r10,0; \
- beq- label##_Iseries_masked; \
+ beq- label##_iSeries_masked; \
EXCEPTION_PROLOG_ISERIES_2; \
b label##_common; \
@@ -388,17 +388,17 @@ label##_common: \
.globl __start_interrupts
__start_interrupts:
- STD_EXCEPTION_PSERIES(0x100, SystemReset)
+ STD_EXCEPTION_PSERIES(0x100, system_reset)
. = 0x200
-_MachineCheckPseries:
+_machine_check_pSeries:
HMT_MEDIUM
mtspr SPRG1,r13 /* save r13 */
- EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common)
+ EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
. = 0x300
- .globl DataAccess_Pseries
-DataAccess_Pseries:
+ .globl data_access_pSeries
+data_access_pSeries:
HMT_MEDIUM
mtspr SPRG1,r13
BEGIN_FTR_SECTION
@@ -409,15 +409,15 @@ BEGIN_FTR_SECTION
rlwimi r13,r12,16,0x20
mfcr r12
cmpwi r13,0x2c
- beq .do_stab_bolted_Pseries
+ beq .do_stab_bolted_pSeries
mtcrf 0x80,r12
mfspr r12,SPRG2
END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
- EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, DataAccess_common)
+ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common)
. = 0x380
- .globl DataAccessSLB_Pseries
-DataAccessSLB_Pseries:
+ .globl data_access_slb_pSeries
+data_access_slb_pSeries:
HMT_MEDIUM
mtspr SPRG1,r13
mfspr r13,SPRG3 /* get paca address into r13 */
@@ -433,11 +433,11 @@ DataAccessSLB_Pseries:
mfspr r3,DAR
b .do_slb_miss /* Rel. branch works in real mode */
- STD_EXCEPTION_PSERIES(0x400, InstructionAccess)
+ STD_EXCEPTION_PSERIES(0x400, instruction_access)
. = 0x480
- .globl InstructionAccessSLB_Pseries
-InstructionAccessSLB_Pseries:
+ .globl instruction_access_slb_pSeries
+instruction_access_slb_pSeries:
HMT_MEDIUM
mtspr SPRG1,r13
mfspr r13,SPRG3 /* get paca address into r13 */
@@ -453,25 +453,25 @@ InstructionAccessSLB_Pseries:
mfspr r3,SRR0 /* SRR0 is faulting address */
b .do_slb_miss /* Rel. branch works in real mode */
- STD_EXCEPTION_PSERIES(0x500, HardwareInterrupt)
- STD_EXCEPTION_PSERIES(0x600, Alignment)
- STD_EXCEPTION_PSERIES(0x700, ProgramCheck)
- STD_EXCEPTION_PSERIES(0x800, FPUnavailable)
- STD_EXCEPTION_PSERIES(0x900, Decrementer)
- STD_EXCEPTION_PSERIES(0xa00, Trap_0a)
- STD_EXCEPTION_PSERIES(0xb00, Trap_0b)
+ STD_EXCEPTION_PSERIES(0x500, hardware_interrupt)
+ STD_EXCEPTION_PSERIES(0x600, alignment)
+ STD_EXCEPTION_PSERIES(0x700, program_check)
+ STD_EXCEPTION_PSERIES(0x800, fp_unavailable)
+ STD_EXCEPTION_PSERIES(0x900, decrementer)
+ STD_EXCEPTION_PSERIES(0xa00, trap_0a)
+ STD_EXCEPTION_PSERIES(0xb00, trap_0b)
. = 0xc00
- .globl SystemCall_Pseries
-SystemCall_Pseries:
+ .globl system_call_pSeries
+system_call_pSeries:
HMT_MEDIUM
mr r9,r13
mfmsr r10
mfspr r13,SPRG3
mfspr r11,SRR0
clrrdi r12,r13,32
- oris r12,r12,SystemCall_common@h
- ori r12,r12,SystemCall_common@l
+ oris r12,r12,system_call_common@h
+ ori r12,r12,system_call_common@l
mtspr SRR0,r12
ori r10,r10,MSR_IR|MSR_DR|MSR_RI
mfspr r12,SRR1
@@ -479,8 +479,8 @@ SystemCall_Pseries:
rfid
b . /* prevent speculative execution */
- STD_EXCEPTION_PSERIES(0xd00, SingleStep)
- STD_EXCEPTION_PSERIES(0xe00, Trap_0e)
+ STD_EXCEPTION_PSERIES(0xd00, single_step)
+ STD_EXCEPTION_PSERIES(0xe00, trap_0e)
/* We need to deal with the Altivec unavailable exception
* here which is at 0xf20, thus in the middle of the
@@ -488,18 +488,18 @@ SystemCall_Pseries:
* trickery is thus necessary
*/
. = 0xf00
- b PerformanceMonitor_Pseries
+ b performance_monitor_pSeries
- STD_EXCEPTION_PSERIES(0xf20, AltivecUnavailable)
+ STD_EXCEPTION_PSERIES(0xf20, altivec_unavailable)
- STD_EXCEPTION_PSERIES(0x1300, InstructionBreakpoint)
- STD_EXCEPTION_PSERIES(0x1700, AltivecAssist)
+ STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint)
+ STD_EXCEPTION_PSERIES(0x1700, altivec_assist)
/* moved from 0xf00 */
- STD_EXCEPTION_PSERIES(0x3000, PerformanceMonitor)
+ STD_EXCEPTION_PSERIES(0x3000, performance_monitor)
. = 0x3100
-_GLOBAL(do_stab_bolted_Pseries)
+_GLOBAL(do_stab_bolted_pSeries)
mtcrf 0x80,r12
mfspr r12,SPRG2
EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
@@ -558,10 +558,10 @@ __end_systemcfg:
/*** ISeries-LPAR interrupt handlers ***/
- STD_EXCEPTION_ISERIES(0x200, MachineCheck, PACA_EXMC)
+ STD_EXCEPTION_ISERIES(0x200, machine_check, PACA_EXMC)
- .globl DataAccess_Iseries
-DataAccess_Iseries:
+ .globl data_access_iSeries
+data_access_iSeries:
mtspr SPRG1,r13
BEGIN_FTR_SECTION
mtspr SPRG2,r12
@@ -571,23 +571,23 @@ BEGIN_FTR_SECTION
rlwimi r13,r12,16,0x20
mfcr r12
cmpwi r13,0x2c
- beq .do_stab_bolted_Iseries
+ beq .do_stab_bolted_iSeries
mtcrf 0x80,r12
mfspr r12,SPRG2
END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN)
EXCEPTION_PROLOG_ISERIES_2
- b DataAccess_common
+ b data_access_common
-.do_stab_bolted_Iseries:
+.do_stab_bolted_iSeries:
mtcrf 0x80,r12
mfspr r12,SPRG2
EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB)
EXCEPTION_PROLOG_ISERIES_2
b .do_stab_bolted
- .globl DataAccessSLB_Iseries
-DataAccessSLB_Iseries:
+ .globl data_access_slb_iSeries
+data_access_slb_iSeries:
mtspr SPRG1,r13 /* save r13 */
EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB)
std r3,PACA_EXSLB+EX_R3(r13)
@@ -595,10 +595,10 @@ DataAccessSLB_Iseries:
mfspr r3,DAR
b .do_slb_miss
- STD_EXCEPTION_ISERIES(0x400, InstructionAccess, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN)
- .globl InstructionAccessSLB_Iseries
-InstructionAccessSLB_Iseries:
+ .globl instruction_access_slb_iSeries
+instruction_access_slb_iSeries:
mtspr SPRG1,r13 /* save r13 */
EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB)
std r3,PACA_EXSLB+EX_R3(r13)
@@ -606,27 +606,27 @@ InstructionAccessSLB_Iseries:
ld r3,PACALPPACA+LPPACASRR0(r13)
b .do_slb_miss
- MASKABLE_EXCEPTION_ISERIES(0x500, HardwareInterrupt)
- STD_EXCEPTION_ISERIES(0x600, Alignment, PACA_EXGEN)
- STD_EXCEPTION_ISERIES(0x700, ProgramCheck, PACA_EXGEN)
- STD_EXCEPTION_ISERIES(0x800, FPUnavailable, PACA_EXGEN)
- MASKABLE_EXCEPTION_ISERIES(0x900, Decrementer)
- STD_EXCEPTION_ISERIES(0xa00, Trap_0a, PACA_EXGEN)
- STD_EXCEPTION_ISERIES(0xb00, Trap_0b, PACA_EXGEN)
+ MASKABLE_EXCEPTION_ISERIES(0x500, hardware_interrupt)
+ STD_EXCEPTION_ISERIES(0x600, alignment, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES(0x700, program_check, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES(0x800, fp_unavailable, PACA_EXGEN)
+ MASKABLE_EXCEPTION_ISERIES(0x900, decrementer)
+ STD_EXCEPTION_ISERIES(0xa00, trap_0a, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES(0xb00, trap_0b, PACA_EXGEN)
- .globl SystemCall_Iseries
-SystemCall_Iseries:
+ .globl system_call_iSeries
+system_call_iSeries:
mr r9,r13
mfspr r13,SPRG3
EXCEPTION_PROLOG_ISERIES_2
- b SystemCall_common
+ b system_call_common
- STD_EXCEPTION_ISERIES( 0xd00, SingleStep, PACA_EXGEN)
- STD_EXCEPTION_ISERIES( 0xe00, Trap_0e, PACA_EXGEN)
- STD_EXCEPTION_ISERIES( 0xf00, PerformanceMonitor, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES( 0xd00, single_step, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES( 0xe00, trap_0e, PACA_EXGEN)
+ STD_EXCEPTION_ISERIES( 0xf00, performance_monitor, PACA_EXGEN)
- .globl SystemReset_Iseries
-SystemReset_Iseries:
+ .globl system_reset_iSeries
+system_reset_iSeries:
mfspr r13,SPRG3 /* Get paca address */
mfmsr r24
ori r24,r24,MSR_RI
@@ -652,11 +652,11 @@ SystemReset_Iseries:
subi r1,r1,STACK_FRAME_OVERHEAD
cmpwi 0,r23,0
- beq iseries_secondary_smp_loop /* Loop until told to go */
+ beq iSeries_secondary_smp_loop /* Loop until told to go */
#ifdef SECONDARY_PROCESSORS
bne .__secondary_start /* Loop until told to go */
#endif
-iseries_secondary_smp_loop:
+iSeries_secondary_smp_loop:
/* Let the Hypervisor know we are alive */
/* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
lis r3,0x8002
@@ -676,16 +676,16 @@ iseries_secondary_smp_loop:
b 1b /* If SMP not configured, secondaries
* loop forever */
- .globl Decrementer_Iseries_masked
-Decrementer_Iseries_masked:
+ .globl decrementer_iSeries_masked
+decrementer_iSeries_masked:
li r11,1
stb r11,PACALPPACA+LPPACADECRINT(r13)
lwz r12,PACADEFAULTDECR(r13)
mtspr SPRN_DEC,r12
/* fall through */
- .globl HardwareInterrupt_Iseries_masked
-HardwareInterrupt_Iseries_masked:
+ .globl hardware_interrupt_iSeries_masked
+hardware_interrupt_iSeries_masked:
mtcrf 0x80,r9 /* Restore regs */
ld r11,PACALPPACA+LPPACASRR0(r13)
ld r12,PACALPPACA+LPPACASRR1(r13)
@@ -711,16 +711,16 @@ fwnmi_data_area:
* Vectors for the FWNMI option. Share common code.
*/
. = 0x8000
- .globl SystemReset_FWNMI
-SystemReset_FWNMI:
+ .globl system_reset_fwnmi
+system_reset_fwnmi:
HMT_MEDIUM
mtspr SPRG1,r13 /* save r13 */
- EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, SystemReset_common)
- .globl MachineCheck_FWNMI
-MachineCheck_FWNMI:
+ EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
+ .globl machine_check_fwnmi
+machine_check_fwnmi:
HMT_MEDIUM
mtspr SPRG1,r13 /* save r13 */
- EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common)
+ EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
/*
* Space for the initial segment table
@@ -738,33 +738,33 @@ __end_stab:
/*** Common interrupt handlers ***/
- STD_EXCEPTION_COMMON(0x100, SystemReset, .SystemResetException)
+ STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception)
/*
* Machine check is different because we use a different
* save area: PACA_EXMC instead of PACA_EXGEN.
*/
.align 7
- .globl MachineCheck_common
-MachineCheck_common:
+ .globl machine_check_common
+machine_check_common:
EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
DISABLE_INTS
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
- bl .MachineCheckException
+ bl .machine_check_exception
b .ret_from_except
- STD_EXCEPTION_COMMON_LITE(0x900, Decrementer, .timer_interrupt)
- STD_EXCEPTION_COMMON(0xa00, Trap_0a, .UnknownException)
- STD_EXCEPTION_COMMON(0xb00, Trap_0b, .UnknownException)
- STD_EXCEPTION_COMMON(0xd00, SingleStep, .SingleStepException)
- STD_EXCEPTION_COMMON(0xe00, Trap_0e, .UnknownException)
- STD_EXCEPTION_COMMON(0xf00, PerformanceMonitor, .PerformanceMonitorException)
- STD_EXCEPTION_COMMON(0x1300, InstructionBreakpoint, .InstructionBreakpointException)
+ STD_EXCEPTION_COMMON_LITE(0x900, decrementer, .timer_interrupt)
+ STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception)
+ STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
+ STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
+ STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
+ STD_EXCEPTION_COMMON(0xf00, performance_monitor, .performance_monitor_exception)
+ STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
#ifdef CONFIG_ALTIVEC
- STD_EXCEPTION_COMMON(0x1700, AltivecAssist, .AltivecAssistException)
+ STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
#else
- STD_EXCEPTION_COMMON(0x1700, AltivecAssist, .UnknownException)
+ STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception)
#endif
/*
@@ -854,8 +854,8 @@ unrecov_fer:
* r9 - r13 are saved in paca->exgen.
*/
.align 7
- .globl DataAccess_common
-DataAccess_common:
+ .globl data_access_common
+data_access_common:
mfspr r10,DAR
std r10,PACA_EXGEN+EX_DAR(r13)
mfspr r10,DSISR
@@ -867,8 +867,8 @@ DataAccess_common:
b .do_hash_page /* Try to handle as hpte fault */
.align 7
- .globl InstructionAccess_common
-InstructionAccess_common:
+ .globl instruction_access_common
+instruction_access_common:
EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
ld r3,_NIP(r1)
andis. r4,r12,0x5820
@@ -876,19 +876,19 @@ InstructionAccess_common:
b .do_hash_page /* Try to handle as hpte fault */
.align 7
- .globl HardwareInterrupt_common
- .globl HardwareInterrupt_entry
-HardwareInterrupt_common:
+ .globl hardware_interrupt_common
+ .globl hardware_interrupt_entry
+hardware_interrupt_common:
EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN)
-HardwareInterrupt_entry:
+hardware_interrupt_entry:
DISABLE_INTS
addi r3,r1,STACK_FRAME_OVERHEAD
bl .do_IRQ
b .ret_from_except_lite
.align 7
- .globl Alignment_common
-Alignment_common:
+ .globl alignment_common
+alignment_common:
mfspr r10,DAR
std r10,PACA_EXGEN+EX_DAR(r13)
mfspr r10,DSISR
@@ -901,33 +901,33 @@ Alignment_common:
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
- bl .AlignmentException
+ bl .alignment_exception
b .ret_from_except
.align 7
- .globl ProgramCheck_common
-ProgramCheck_common:
+ .globl program_check_common
+program_check_common:
EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
- bl .ProgramCheckException
+ bl .program_check_exception
b .ret_from_except
.align 7
- .globl FPUnavailable_common
-FPUnavailable_common:
+ .globl fp_unavailable_common
+fp_unavailable_common:
EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
bne .load_up_fpu /* if from user, just load it up */
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
- bl .KernelFPUnavailableException
+ bl .kernel_fp_unavailable_exception
BUG_OPCODE
.align 7
- .globl AltivecUnavailable_common
-AltivecUnavailable_common:
+ .globl altivec_unavailable_common
+altivec_unavailable_common:
EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
#ifdef CONFIG_ALTIVEC
bne .load_up_altivec /* if from user, just load it up */
@@ -935,7 +935,7 @@ AltivecUnavailable_common:
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
- bl .AltivecUnavailableException
+ bl .altivec_unavailable_exception
b .ret_from_except
/*
@@ -1188,7 +1188,7 @@ unrecov_slb:
* On pSeries, secondary processors spin in the following code.
* At entry, r3 = this processor's number (physical cpu id)
*/
-_GLOBAL(pseries_secondary_smp_init)
+_GLOBAL(pSeries_secondary_smp_init)
mr r24,r3
/* turn on 64-bit mode */
@@ -2083,7 +2083,7 @@ __hmt_secondary_hold:
101:
#endif
mr r3,r24
- b .pseries_secondary_smp_init
+ b .pSeries_secondary_smp_init
#ifdef CONFIG_HMT
_GLOBAL(hmt_start_secondary)
diff --git a/arch/ppc64/kernel/iSeries_iommu.c b/arch/ppc64/kernel/iSeries_iommu.c
index 4f06318603002..4e1a47c8a8026 100644
--- a/arch/ppc64/kernel/iSeries_iommu.c
+++ b/arch/ppc64/kernel/iSeries_iommu.c
@@ -132,11 +132,11 @@ static void iommu_table_getparms(struct iSeries_Device_Node* dn,
if (parms->itc_size == 0)
panic("PCI_DMA: parms->size is zero, parms is 0x%p", parms);
- tbl->it_size = parms->itc_size;
+ /* itc_size is in pages worth of table, it_size is in # of entries */
+ tbl->it_size = (parms->itc_size * PAGE_SIZE) / sizeof(union tce_entry);
tbl->it_busno = parms->itc_busno;
tbl->it_offset = parms->itc_offset;
tbl->it_index = parms->itc_index;
- tbl->it_entrysize = sizeof(union tce_entry);
tbl->it_blocksize = 1;
tbl->it_type = TCE_PCI;
@@ -160,11 +160,16 @@ void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn)
kfree(tbl);
}
+static void iommu_dev_setup_iSeries(struct pci_dev *dev) { }
+static void iommu_bus_setup_iSeries(struct pci_bus *bus) { }
-void tce_init_iSeries(void)
+void iommu_init_early_iSeries(void)
{
ppc_md.tce_build = tce_build_iSeries;
ppc_md.tce_free = tce_free_iSeries;
+ ppc_md.iommu_dev_setup = iommu_dev_setup_iSeries;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_iSeries;
+
pci_iommu_init();
}
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
index b48af5ef347b0..7191f57d88563 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -68,7 +68,6 @@ extern void hvlog(char *fmt, ...);
/* Function Prototypes */
extern void ppcdbg_initialize(void);
-extern void tce_init_iSeries(void);
static void build_iSeries_Memory_Map(void);
static void setup_iSeries_cache_sizes(void);
@@ -344,7 +343,7 @@ static void __init iSeries_parse_cmdline(void)
/*
* Initialize the DMA/TCE management
*/
- tce_init_iSeries();
+ iommu_init_early_iSeries();
/*
* Initialize the table which translate Linux physical addresses to
diff --git a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
index 7221346dc0287..0f0ba6b649933 100644
--- a/arch/ppc64/kernel/iommu.c
+++ b/arch/ppc64/kernel/iommu.c
@@ -87,7 +87,7 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl,
start = largealloc ? tbl->it_largehint : tbl->it_hint;
/* Use only half of the table for small allocs (15 pages or less) */
- limit = largealloc ? tbl->it_mapsize : tbl->it_halfpoint;
+ limit = largealloc ? tbl->it_size : tbl->it_halfpoint;
if (largealloc && start < tbl->it_halfpoint)
start = tbl->it_halfpoint;
@@ -114,7 +114,7 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl,
* Second failure, rescan the other half of the table.
*/
start = (largealloc ^ pass) ? tbl->it_halfpoint : 0;
- limit = pass ? tbl->it_mapsize : limit;
+ limit = pass ? tbl->it_size : limit;
pass++;
goto again;
} else {
@@ -194,7 +194,7 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
entry = dma_addr >> PAGE_SHIFT;
free_entry = entry - tbl->it_offset;
- if (((free_entry + npages) > tbl->it_mapsize) ||
+ if (((free_entry + npages) > tbl->it_size) ||
(entry < tbl->it_offset)) {
if (printk_ratelimit()) {
printk(KERN_INFO "iommu_free: invalid entry\n");
@@ -202,7 +202,7 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
printk(KERN_INFO "\tdma_addr = 0x%lx\n", (u64)dma_addr);
printk(KERN_INFO "\tTable = 0x%lx\n", (u64)tbl);
printk(KERN_INFO "\tbus# = 0x%lx\n", (u64)tbl->it_busno);
- printk(KERN_INFO "\tmapsize = 0x%lx\n", (u64)tbl->it_mapsize);
+ printk(KERN_INFO "\tsize = 0x%lx\n", (u64)tbl->it_size);
printk(KERN_INFO "\tstartOff = 0x%lx\n", (u64)tbl->it_offset);
printk(KERN_INFO "\tindex = 0x%lx\n", (u64)tbl->it_index);
WARN_ON(1);
@@ -407,14 +407,11 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl)
unsigned long sz;
static int welcomed = 0;
- /* it_size is in pages, it_mapsize in number of entries */
- tbl->it_mapsize = (tbl->it_size << PAGE_SHIFT) / tbl->it_entrysize;
-
/* Set aside 1/4 of the table for large allocations. */
- tbl->it_halfpoint = tbl->it_mapsize * 3 / 4;
+ tbl->it_halfpoint = tbl->it_size * 3 / 4;
/* number of bytes needed for the bitmap */
- sz = (tbl->it_mapsize + 7) >> 3;
+ sz = (tbl->it_size + 7) >> 3;
tbl->it_map = (unsigned long *)__get_free_pages(GFP_ATOMIC, get_order(sz));
if (!tbl->it_map)
@@ -448,8 +445,8 @@ void iommu_free_table(struct device_node *dn)
}
/* verify that table contains no entries */
- /* it_mapsize is in entries, and we're examining 64 at a time */
- for (i = 0; i < (tbl->it_mapsize/64); i++) {
+ /* it_size is in entries, and we're examining 64 at a time */
+ for (i = 0; i < (tbl->it_size/64); i++) {
if (tbl->it_map[i] != 0) {
printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
__FUNCTION__, dn->full_name);
@@ -458,7 +455,7 @@ void iommu_free_table(struct device_node *dn)
}
/* calculate bitmap size in bytes */
- bitmap_sz = (tbl->it_mapsize + 7) / 8;
+ bitmap_sz = (tbl->it_size + 7) / 8;
/* free bitmap */
order = get_order(bitmap_sz);
diff --git a/arch/ppc64/kernel/maple_pci.c b/arch/ppc64/kernel/maple_pci.c
index bf3a3c05762fd..f8cd5b495d6b0 100644
--- a/arch/ppc64/kernel/maple_pci.c
+++ b/arch/ppc64/kernel/maple_pci.c
@@ -385,9 +385,6 @@ void __init maple_pcibios_fixup(void)
/* Fixup the pci_bus sysdata pointers */
pci_fix_bus_sysdata();
- /* Setup the iommu */
- iommu_setup_u3();
-
DBG(" <- maple_pcibios_fixup\n");
}
diff --git a/arch/ppc64/kernel/maple_setup.c b/arch/ppc64/kernel/maple_setup.c
index 6c8d19cc7a328..1db6ea0f336f6 100644
--- a/arch/ppc64/kernel/maple_setup.c
+++ b/arch/ppc64/kernel/maple_setup.c
@@ -111,11 +111,6 @@ void __init maple_setup_arch(void)
#ifdef CONFIG_SMP
smp_ops = &maple_smp_ops;
#endif
- /* Setup the PCI DMA to "direct" by default. May be overriden
- * by iommu later on
- */
- pci_dma_init_direct();
-
/* Lookup PCI hosts */
maple_pci_init();
@@ -159,6 +154,8 @@ static void __init maple_init_early(void)
/* Setup interrupt mapping options */
ppc64_interrupt_controller = IC_OPEN_PIC;
+ iommu_init_early_u3();
+
DBG(" <- maple_init_early\n");
}
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 2d67121e9f6fe..3d625552739ff 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -46,6 +46,9 @@
#include <asm/systemcfg.h>
#include "pci.h"
+#define DBG(fmt...)
+
+extern int is_python(struct device_node *);
static void tce_build_pSeries(struct iommu_table *tbl, long index,
long npages, unsigned long uaddr,
@@ -121,7 +124,7 @@ static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
}
}
-DEFINE_PER_CPU(void *, tce_page) = NULL;
+static DEFINE_PER_CPU(void *, tce_page) = NULL;
static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
long npages, unsigned long uaddr,
@@ -233,85 +236,6 @@ static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long n
}
}
-
-static void iommu_buses_init(void)
-{
- struct pci_controller *phb, *tmp;
- struct device_node *dn, *first_dn;
- int num_slots, num_slots_ilog2;
- int first_phb = 1;
- unsigned long tcetable_ilog2;
-
- /*
- * We default to a TCE table that maps 2GB (4MB table, 22 bits),
- * however some machines have a 3GB IO hole and for these we
- * create a table that maps 1GB (2MB table, 21 bits)
- */
- if (io_hole_start < 0x80000000UL)
- tcetable_ilog2 = 21;
- else
- tcetable_ilog2 = 22;
-
- /* XXX Should we be using pci_root_buses instead? -ojn
- */
-
- list_for_each_entry_safe(phb, tmp, &hose_list, list_node) {
- first_dn = ((struct device_node *)phb->arch_data)->child;
-
- /* Carve 2GB into the largest dma_window_size possible */
- for (dn = first_dn, num_slots = 0; dn != NULL; dn = dn->sibling)
- num_slots++;
- num_slots_ilog2 = __ilog2(num_slots);
-
- if ((1<<num_slots_ilog2) != num_slots)
- num_slots_ilog2++;
-
- phb->dma_window_size = 1 << (tcetable_ilog2 - num_slots_ilog2);
-
- /* Reserve 16MB of DMA space on the first PHB.
- * We should probably be more careful and use firmware props.
- * In reality this space is remapped, not lost. But we don't
- * want to get that smart to handle it -- too much work.
- */
- phb->dma_window_base_cur = first_phb ? (1 << 12) : 0;
- first_phb = 0;
-
- for (dn = first_dn; dn != NULL; dn = dn->sibling)
- iommu_devnode_init_pSeries(dn);
- }
-}
-
-
-static void iommu_buses_init_lpar(struct list_head *bus_list)
-{
- struct list_head *ln;
- struct pci_bus *bus;
- struct device_node *busdn;
- unsigned int *dma_window;
-
- for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
- bus = pci_bus_b(ln);
-
- if (bus->self)
- busdn = pci_device_to_OF_node(bus->self);
- else
- busdn = bus->sysdata; /* must be a phb */
-
- dma_window = (unsigned int *)get_property(busdn, "ibm,dma-window", NULL);
- if (dma_window) {
- /* Bussubno hasn't been copied yet.
- * Do it now because iommu_table_setparms_lpar needs it.
- */
- busdn->bussubno = bus->number;
- iommu_devnode_init_pSeries(busdn);
- }
-
- /* look for a window on a bridge even if the PHB had one */
- iommu_buses_init_lpar(&bus->children);
- }
-}
-
-
static void iommu_table_setparms(struct pci_controller *phb,
struct device_node *dn,
struct iommu_table *tbl)
@@ -336,27 +260,18 @@ static void iommu_table_setparms(struct pci_controller *phb,
tbl->it_busno = phb->bus->number;
/* Units of tce entries */
- tbl->it_offset = phb->dma_window_base_cur;
-
- /* Adjust the current table offset to the next
- * region. Measured in TCE entries. Force an
- * alignment to the size allotted per IOA. This
- * makes it easier to remove the 1st 16MB.
- */
- phb->dma_window_base_cur += (phb->dma_window_size>>3);
- phb->dma_window_base_cur &=
- ~((phb->dma_window_size>>3)-1);
-
- /* Set the tce table size - measured in pages */
- tbl->it_size = ((phb->dma_window_base_cur -
- tbl->it_offset) << 3) >> PAGE_SHIFT;
+ tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT;
/* Test if we are going over 2GB of DMA space */
- if (phb->dma_window_base_cur > (1 << 19))
+ if (phb->dma_window_base_cur + phb->dma_window_size > (1L << 31))
panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
+ phb->dma_window_base_cur += phb->dma_window_size;
+
+ /* Set the tce table size - measured in entries */
+ tbl->it_size = phb->dma_window_size >> PAGE_SHIFT;
+
tbl->it_index = 0;
- tbl->it_entrysize = sizeof(union tce_entry);
tbl->it_blocksize = 16;
tbl->it_type = TCE_PCI;
}
@@ -375,82 +290,174 @@ static void iommu_table_setparms(struct pci_controller *phb,
*/
static void iommu_table_setparms_lpar(struct pci_controller *phb,
struct device_node *dn,
- struct iommu_table *tbl)
+ struct iommu_table *tbl,
+ unsigned int *dma_window)
{
- unsigned int *dma_window;
-
- dma_window = (unsigned int *)get_property(dn, "ibm,dma-window", NULL);
-
if (!dma_window)
panic("iommu_table_setparms_lpar: device %s has no"
" ibm,dma-window property!\n", dn->full_name);
tbl->it_busno = dn->bussubno;
- tbl->it_size = (((((unsigned long)dma_window[4] << 32) |
- (unsigned long)dma_window[5]) >> PAGE_SHIFT) << 3) >> PAGE_SHIFT;
- tbl->it_offset = ((((unsigned long)dma_window[2] << 32) |
- (unsigned long)dma_window[3]) >> 12);
+
+ /* TODO: Parse field size properties properly. */
+ tbl->it_size = (((unsigned long)dma_window[4] << 32) |
+ (unsigned long)dma_window[5]) >> PAGE_SHIFT;
+ tbl->it_offset = (((unsigned long)dma_window[2] << 32) |
+ (unsigned long)dma_window[3]) >> PAGE_SHIFT;
tbl->it_base = 0;
tbl->it_index = dma_window[0];
- tbl->it_entrysize = sizeof(union tce_entry);
tbl->it_blocksize = 16;
tbl->it_type = TCE_PCI;
}
+static void iommu_bus_setup_pSeries(struct pci_bus *bus)
+{
+ struct device_node *dn, *pdn;
+
+ DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self);
+
+ /* For each (root) bus, we carve up the available DMA space in 256MB
+ * pieces. Since each piece is used by one (sub) bus/device, that would
+ * give a maximum of 7 devices per PHB. In most cases, this is plenty.
+ *
+ * The exception is on Python PHBs (pre-POWER4). Here we don't have EADS
+ * bridges below the PHB to allocate the sectioned tables to, so instead
+ * we allocate a 1GB table at the PHB level.
+ */
+
+ dn = pci_bus_to_OF_node(bus);
+
+ if (!bus->self) {
+ /* Root bus */
+ if (is_python(dn)) {
+ struct iommu_table *tbl;
+
+ DBG("Python root bus %s\n", bus->name);
+
+ /* 1GB window by default */
+ dn->phb->dma_window_size = 1 << 30;
+ dn->phb->dma_window_base_cur = 0;
+
+ tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
+
+ iommu_table_setparms(dn->phb, dn, tbl);
+ dn->iommu_table = iommu_init_table(tbl);
+ } else {
+ /* 256 MB window by default */
+ dn->phb->dma_window_size = 1 << 28;
+ /* always skip the first 256MB */
+ dn->phb->dma_window_base_cur = 1 << 28;
+
+ /* No table at PHB level for non-python PHBs */
+ }
+ } else {
+ pdn = pci_bus_to_OF_node(bus->parent);
+
+ if (!pdn->iommu_table) {
+ struct iommu_table *tbl;
+ /* First child, allocate new table (256MB window) */
+
+ tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
+
+ iommu_table_setparms(dn->phb, dn, tbl);
+
+ dn->iommu_table = iommu_init_table(tbl);
+ } else {
+ /* Lower than first child or under python, copy parent table */
+ dn->iommu_table = pdn->iommu_table;
+ }
+ }
+}
+
-void iommu_devnode_init_pSeries(struct device_node *dn)
+static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
{
struct iommu_table *tbl;
+ struct device_node *dn, *pdn;
+ unsigned int *dma_window = NULL;
- tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
- GFP_KERNEL);
-
- if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
- iommu_table_setparms_lpar(dn->phb, dn, tbl);
- else
- iommu_table_setparms(dn->phb, dn, tbl);
+ dn = pci_bus_to_OF_node(bus);
+
+ /* Find nearest ibm,dma-window, walking up the device tree */
+ for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
+ dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL);
+ if (dma_window != NULL)
+ break;
+ }
+
+ WARN_ON(dma_window == NULL);
+
+ if (!pdn->iommu_table) {
+ /* Bussubno hasn't been copied yet.
+ * Do it now because iommu_table_setparms_lpar needs it.
+ */
+ pdn->bussubno = bus->number;
+
+ tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
+ GFP_KERNEL);
- dn->iommu_table = iommu_init_table(tbl);
+ iommu_table_setparms_lpar(pdn->phb, pdn, tbl, dma_window);
+
+ pdn->iommu_table = iommu_init_table(tbl);
+ }
+
+ if (pdn != dn)
+ dn->iommu_table = pdn->iommu_table;
}
-void iommu_setup_pSeries(void)
+
+static void iommu_dev_setup_pSeries(struct pci_dev *dev)
{
- struct pci_dev *dev = NULL;
struct device_node *dn, *mydn;
- if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
- iommu_buses_init_lpar(&pci_root_buses);
- else
- iommu_buses_init();
-
- /* Now copy the iommu_table ptr from the bus devices down to every
+ DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name);
+ /* Now copy the iommu_table ptr from the bus device down to the
* pci device_node. This means get_iommu_table() won't need to search
* up the device tree to find it.
*/
- for_each_pci_dev(dev) {
- mydn = dn = pci_device_to_OF_node(dev);
+ mydn = dn = pci_device_to_OF_node(dev);
- while (dn && dn->iommu_table == NULL)
- dn = dn->parent;
- if (dn)
- mydn->iommu_table = dn->iommu_table;
- }
+ while (dn && dn->iommu_table == NULL)
+ dn = dn->parent;
+
+ WARN_ON(!dn);
+
+ if (dn)
+ mydn->iommu_table = dn->iommu_table;
}
+static void iommu_bus_setup_null(struct pci_bus *b) { }
+static void iommu_dev_setup_null(struct pci_dev *d) { }
+
/* These are called very early. */
-void tce_init_pSeries(void)
+void iommu_init_early_pSeries(void)
{
- if (!(systemcfg->platform & PLATFORM_LPAR)) {
+ if (of_chosen && get_property(of_chosen, "linux,iommu-off", NULL)) {
+ /* Direct I/O, IOMMU off */
+ ppc_md.iommu_dev_setup = iommu_dev_setup_null;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_null;
+ pci_direct_iommu_init();
+
+ return;
+ }
+
+ if (systemcfg->platform & PLATFORM_LPAR) {
+ if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) {
+ ppc_md.tce_build = tce_buildmulti_pSeriesLP;
+ ppc_md.tce_free = tce_freemulti_pSeriesLP;
+ } else {
+ ppc_md.tce_build = tce_build_pSeriesLP;
+ ppc_md.tce_free = tce_free_pSeriesLP;
+ }
+ ppc_md.iommu_bus_setup = iommu_bus_setup_pSeriesLP;
+ } else {
ppc_md.tce_build = tce_build_pSeries;
ppc_md.tce_free = tce_free_pSeries;
- } else if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) {
- ppc_md.tce_build = tce_buildmulti_pSeriesLP;
- ppc_md.tce_free = tce_freemulti_pSeriesLP;
- } else {
- ppc_md.tce_build = tce_build_pSeriesLP;
- ppc_md.tce_free = tce_free_pSeriesLP;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_pSeries;
}
+ ppc_md.iommu_dev_setup = iommu_dev_setup_pSeries;
+
pci_iommu_init();
}
diff --git a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c
index 1382fa03cb229..2b9a00951f207 100644
--- a/arch/ppc64/kernel/pSeries_pci.c
+++ b/arch/ppc64/kernel/pSeries_pci.c
@@ -148,7 +148,7 @@ struct pci_ops rtas_pci_ops = {
rtas_pci_write_config
};
-static int is_python(struct device_node *dev)
+int is_python(struct device_node *dev)
{
char *model = (char *)get_property(dev, "model", NULL);
@@ -554,9 +554,6 @@ void __init pSeries_final_fixup(void)
pSeries_request_regions();
pci_fix_bus_sysdata();
- if (!of_chosen || !get_property(of_chosen, "linux,iommu-off", NULL))
- iommu_setup_pSeries();
-
pci_addr_cache_build();
}
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index 140eb59775b91..69591745eabe7 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -80,7 +80,8 @@ extern void pSeries_get_boot_time(struct rtc_time *rtc_time);
extern void pSeries_get_rtc_time(struct rtc_time *rtc_time);
extern int pSeries_set_rtc_time(struct rtc_time *rtc_time);
extern void find_udbg_vterm(void);
-extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */
+extern void system_reset_fwnmi(void); /* from head.S */
+extern void machine_check_fwnmi(void); /* from head.S */
extern void generic_find_legacy_serial_ports(u64 *physport,
unsigned int *default_speed);
@@ -93,6 +94,9 @@ extern unsigned long loops_per_jiffy;
extern unsigned long ppc_proc_freq;
extern unsigned long ppc_tb_freq;
+extern void pSeries_system_reset_exception(struct pt_regs *regs);
+extern int pSeries_machine_check_exception(struct pt_regs *regs);
+
static volatile void __iomem * chrp_int_ack_special;
struct mpic *pSeries_mpic;
@@ -119,8 +123,8 @@ static void __init fwnmi_init(void)
if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE)
return;
ret = rtas_call(ibm_nmi_register, 2, 1, NULL,
- __pa((unsigned long)SystemReset_FWNMI),
- __pa((unsigned long)MachineCheck_FWNMI));
+ __pa((unsigned long)system_reset_fwnmi),
+ __pa((unsigned long)machine_check_fwnmi));
if (ret == 0)
fwnmi_active = 1;
}
@@ -375,10 +379,7 @@ static void __init pSeries_init_early(void)
}
- if (iommu_off)
- pci_dma_init_direct();
- else
- tce_init_pSeries();
+ iommu_init_early_pSeries();
pSeries_discover_pic();
@@ -612,4 +613,6 @@ struct machdep_calls __initdata pSeries_md = {
.calibrate_decr = pSeries_calibrate_decr,
.progress = pSeries_progress,
.check_legacy_ioport = pSeries_check_legacy_ioport,
+ .system_reset_exception = pSeries_system_reset_exception,
+ .machine_check_exception = pSeries_machine_check_exception,
};
diff --git a/arch/ppc64/kernel/pSeries_smp.c b/arch/ppc64/kernel/pSeries_smp.c
index d546877c8b851..d03c471640017 100644
--- a/arch/ppc64/kernel/pSeries_smp.c
+++ b/arch/ppc64/kernel/pSeries_smp.c
@@ -56,7 +56,7 @@
#define DBG(fmt...)
#endif
-extern void pseries_secondary_smp_init(unsigned long);
+extern void pSeries_secondary_smp_init(unsigned long);
/* Get state of physical CPU.
* Return codes:
@@ -192,7 +192,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
{
int status;
unsigned long start_here = __pa((u32)*((unsigned long *)
- pseries_secondary_smp_init));
+ pSeries_secondary_smp_init));
unsigned int pcpu;
/* At boot time the cpus are already spinning in hold
@@ -362,7 +362,7 @@ void __init smp_init_pSeries(void)
rtas_call(rtas_token("start-cpu"), 3, 1, &ret,
get_hard_smp_processor_id(i),
__pa((u32)*((unsigned long *)
- pseries_secondary_smp_init)),
+ pSeries_secondary_smp_init)),
i);
}
}
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index 9891dbeadf638..25822272542e3 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -845,6 +845,11 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
pcibios_fixup_device_resources(dev, bus);
}
+ ppc_md.iommu_bus_setup(bus);
+
+ list_for_each_entry(dev, &bus->devices, bus_list)
+ ppc_md.iommu_dev_setup(dev);
+
if (!pci_probe_only)
return;
diff --git a/arch/ppc64/kernel/pci_dma_direct.c b/arch/ppc64/kernel/pci_direct_iommu.c
index dc96c0cf2b91c..8faabca93b298 100644
--- a/arch/ppc64/kernel/pci_dma_direct.c
+++ b/arch/ppc64/kernel/pci_direct_iommu.c
@@ -78,7 +78,7 @@ static void pci_direct_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
{
}
-void __init pci_dma_init_direct(void)
+void __init pci_direct_iommu_init(void)
{
pci_dma_ops.pci_alloc_consistent = pci_direct_alloc_consistent;
pci_dma_ops.pci_free_consistent = pci_direct_free_consistent;
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
index 00d1db487cdfd..32634216ad78f 100644
--- a/arch/ppc64/kernel/pmac_pci.c
+++ b/arch/ppc64/kernel/pmac_pci.c
@@ -666,8 +666,6 @@ void __init pmac_pcibios_fixup(void)
pci_read_irq_line(dev);
pci_fix_bus_sysdata();
-
- iommu_setup_u3();
}
static void __init pmac_fixup_phb_resources(void)
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 6f851d2d1a6dc..41fa6e95a06f9 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -166,11 +166,6 @@ void __init pmac_setup_arch(void)
pmac_setup_smp();
#endif
- /* Setup the PCI DMA to "direct" by default. May be overriden
- * by iommu later on
- */
- pci_dma_init_direct();
-
/* Lookup PCI hosts */
pmac_pci_init();
@@ -317,6 +312,8 @@ void __init pmac_init_early(void)
/* Setup interrupt mapping options */
ppc64_interrupt_controller = IC_OPEN_PIC;
+ iommu_init_early_u3();
+
DBG(" <- pmac_init_early\n");
}
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index ca7ad16f84f9c..f636c398e3312 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -1743,17 +1743,6 @@ static int of_finish_dynamic_node(struct device_node *node)
node->devfn = (regs[0] >> 8) & 0xff;
}
- /* fixing up iommu_table */
-
-#ifdef CONFIG_PPC_PSERIES
- if (strcmp(node->name, "pci") == 0 &&
- get_property(node, "ibm,dma-window", NULL)) {
- node->bussubno = node->busno;
- iommu_devnode_init_pSeries(node);
- } else
- node->iommu_table = parent->iommu_table;
-#endif /* CONFIG_PPC_PSERIES */
-
out:
of_node_put(parent);
return err;
diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c
index 06f69b37fe349..7639e3d99c046 100644
--- a/arch/ppc64/kernel/ras.c
+++ b/arch/ppc64/kernel/ras.c
@@ -55,6 +55,13 @@
static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
static spinlock_t ras_log_buf_lock = SPIN_LOCK_UNLOCKED;
+char mce_data_buf[RTAS_ERROR_LOG_MAX]
+;
+/* This is true if we are using the firmware NMI handler (typically LPAR) */
+extern int fwnmi_active;
+
+extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
+
static int ras_get_sensor_state_token;
static int ras_check_exception_token;
@@ -234,3 +241,116 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
spin_unlock(&ras_log_buf_lock);
return IRQ_HANDLED;
}
+
+/* Get the error information for errors coming through the
+ * FWNMI vectors. The pt_regs' r3 will be updated to reflect
+ * the actual r3 if possible, and a ptr to the error log entry
+ * will be returned if found.
+ *
+ * The mce_data_buf does not have any locks or protection around it,
+ * if a second machine check comes in, or a system reset is done
+ * before we have logged the error, then we will get corruption in the
+ * error log. This is preferable over holding off on calling
+ * ibm,nmi-interlock which would result in us checkstopping if a
+ * second machine check did come in.
+ */
+static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
+{
+ unsigned long errdata = regs->gpr[3];
+ struct rtas_error_log *errhdr = NULL;
+ unsigned long *savep;
+
+ if ((errdata >= 0x7000 && errdata < 0x7fff0) ||
+ (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
+ savep = __va(errdata);
+ regs->gpr[3] = savep[0]; /* restore original r3 */
+ memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
+ memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
+ errhdr = (struct rtas_error_log *)mce_data_buf;
+ } else {
+ printk("FWNMI: corrupt r3\n");
+ }
+ return errhdr;
+}
+
+/* Call this when done with the data returned by FWNMI_get_errinfo.
+ * It will release the saved data area for other CPUs in the
+ * partition to receive FWNMI errors.
+ */
+static void fwnmi_release_errinfo(void)
+{
+ int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL);
+ if (ret != 0)
+ printk("FWNMI: nmi-interlock failed: %d\n", ret);
+}
+
+void pSeries_system_reset_exception(struct pt_regs *regs)
+{
+ if (fwnmi_active) {
+ struct rtas_error_log *errhdr = fwnmi_get_errinfo(regs);
+ if (errhdr) {
+ /* XXX Should look at FWNMI information */
+ }
+ fwnmi_release_errinfo();
+ }
+}
+
+/*
+ * See if we can recover from a machine check exception.
+ * This is only called on power4 (or above) and only via
+ * the Firmware Non-Maskable Interrupts (fwnmi) handler
+ * which provides the error analysis for us.
+ *
+ * Return 1 if corrected (or delivered a signal).
+ * Return 0 if there is nothing we can do.
+ */
+static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err)
+{
+ int nonfatal = 0;
+
+ if (err->disposition == RTAS_DISP_FULLY_RECOVERED) {
+ /* Platform corrected itself */
+ nonfatal = 1;
+ } else if ((regs->msr & MSR_RI) &&
+ user_mode(regs) &&
+ err->severity == RTAS_SEVERITY_ERROR_SYNC &&
+ err->disposition == RTAS_DISP_NOT_RECOVERED &&
+ err->target == RTAS_TARGET_MEMORY &&
+ err->type == RTAS_TYPE_ECC_UNCORR &&
+ !(current->pid == 0 || current->pid == 1)) {
+ /* Kill off a user process with an ECC error */
+ printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
+ current->pid);
+ /* XXX something better for ECC error? */
+ _exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
+ nonfatal = 1;
+ }
+
+ log_error((char *)err, ERR_TYPE_RTAS_LOG, !nonfatal);
+
+ return nonfatal;
+}
+
+/*
+ * Handle a machine check.
+ *
+ * Note that on Power 4 and beyond Firmware Non-Maskable Interrupts (fwnmi)
+ * should be present. If so the handler which called us tells us if the
+ * error was recovered (never true if RI=0).
+ *
+ * On hardware prior to Power 4 these exceptions were asynchronous which
+ * means we can't tell exactly where it occurred and so we can't recover.
+ */
+int pSeries_machine_check_exception(struct pt_regs *regs)
+{
+ struct rtas_error_log *errp;
+
+ if (fwnmi_active) {
+ errp = fwnmi_get_errinfo(regs);
+ fwnmi_release_errinfo();
+ if (errp && recover_mce(regs, errp))
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index 0e057df623da1..870c69ee8c590 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -116,6 +116,7 @@ u64 ppc64_pft_size;
u64 ppc64_debug_switch;
struct ppc64_caches ppc64_caches;
+EXPORT_SYMBOL_GPL(ppc64_caches);
/*
* These are used in binfmt_elf.c to put aux entries on the stack
@@ -1344,6 +1345,7 @@ early_param("xmon", early_xmon);
void cpu_die(void)
{
+ idle_task_exit();
if (ppc_md.cpu_die)
ppc_md.cpu_die();
local_irq_disable();
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
index 76c942871e015..44f04fc727fd5 100644
--- a/arch/ppc64/kernel/traps.c
+++ b/arch/ppc64/kernel/traps.c
@@ -39,11 +39,7 @@
#include <asm/ppcdebug.h>
#include <asm/rtas.h>
#include <asm/systemcfg.h>
-
-#ifdef CONFIG_PPC_PSERIES
-/* This is true if we are using the firmware NMI handler (typically LPAR) */
-extern int fwnmi_active;
-#endif
+#include <asm/machdep.h>
#ifdef CONFIG_DEBUGGER
int (*__debugger)(struct pt_regs *regs);
@@ -149,8 +145,7 @@ int die(const char *str, struct pt_regs *regs, long err)
return 0;
}
-static void
-_exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
+void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
{
siginfo_t info;
@@ -166,53 +161,11 @@ _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
force_sig_info(signr, &info, current);
}
-#ifdef CONFIG_PPC_PSERIES
-/* Get the error information for errors coming through the
- * FWNMI vectors. The pt_regs' r3 will be updated to reflect
- * the actual r3 if possible, and a ptr to the error log entry
- * will be returned if found.
- */
-static struct rtas_error_log *FWNMI_get_errinfo(struct pt_regs *regs)
-{
- unsigned long errdata = regs->gpr[3];
- struct rtas_error_log *errhdr = NULL;
- unsigned long *savep;
-
- if ((errdata >= 0x7000 && errdata < 0x7fff0) ||
- (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
- savep = __va(errdata);
- regs->gpr[3] = savep[0]; /* restore original r3 */
- errhdr = (struct rtas_error_log *)(savep + 1);
- } else {
- printk("FWNMI: corrupt r3\n");
- }
- return errhdr;
-}
-
-/* Call this when done with the data returned by FWNMI_get_errinfo.
- * It will release the saved data area for other CPUs in the
- * partition to receive FWNMI errors.
- */
-static void FWNMI_release_errinfo(void)
-{
- int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL);
- if (ret != 0)
- printk("FWNMI: nmi-interlock failed: %d\n", ret);
-}
-#endif
-
-void
-SystemResetException(struct pt_regs *regs)
+void system_reset_exception(struct pt_regs *regs)
{
-#ifdef CONFIG_PPC_PSERIES
- if (fwnmi_active) {
- struct rtas_error_log *errhdr = FWNMI_get_errinfo(regs);
- if (errhdr) {
- /* XXX Should look at FWNMI information */
- }
- FWNMI_release_errinfo();
- }
-#endif
+ /* See if any machine dependent calls */
+ if (ppc_md.system_reset_exception)
+ ppc_md.system_reset_exception(regs);
die("System Reset", regs, 0);
@@ -223,64 +176,16 @@ SystemResetException(struct pt_regs *regs)
/* What should we do here? We could issue a shutdown or hard reset. */
}
-#ifdef CONFIG_PPC_PSERIES
-/*
- * See if we can recover from a machine check exception.
- * This is only called on power4 (or above) and only via
- * the Firmware Non-Maskable Interrupts (fwnmi) handler
- * which provides the error analysis for us.
- *
- * Return 1 if corrected (or delivered a signal).
- * Return 0 if there is nothing we can do.
- */
-static int recover_mce(struct pt_regs *regs, struct rtas_error_log err)
+void machine_check_exception(struct pt_regs *regs)
{
- if (err.disposition == RTAS_DISP_FULLY_RECOVERED) {
- /* Platform corrected itself */
- return 1;
- } else if ((regs->msr & MSR_RI) &&
- user_mode(regs) &&
- err.severity == RTAS_SEVERITY_ERROR_SYNC &&
- err.disposition == RTAS_DISP_NOT_RECOVERED &&
- err.target == RTAS_TARGET_MEMORY &&
- err.type == RTAS_TYPE_ECC_UNCORR &&
- !(current->pid == 0 || current->pid == 1)) {
- /* Kill off a user process with an ECC error */
- printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
- current->pid);
- /* XXX something better for ECC error? */
- _exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
- return 1;
- }
- return 0;
-}
-#endif
+ int recover = 0;
-/*
- * Handle a machine check.
- *
- * Note that on Power 4 and beyond Firmware Non-Maskable Interrupts (fwnmi)
- * should be present. If so the handler which called us tells us if the
- * error was recovered (never true if RI=0).
- *
- * On hardware prior to Power 4 these exceptions were asynchronous which
- * means we can't tell exactly where it occurred and so we can't recover.
- */
-void
-MachineCheckException(struct pt_regs *regs)
-{
-#ifdef CONFIG_PPC_PSERIES
- struct rtas_error_log err, *errp;
-
- if (fwnmi_active) {
- errp = FWNMI_get_errinfo(regs);
- if (errp)
- err = *errp;
- FWNMI_release_errinfo(); /* frees errp */
- if (errp && recover_mce(regs, err))
- return;
- }
-#endif
+ /* See if any machine dependent calls */
+ if (ppc_md.machine_check_exception)
+ recover = ppc_md.machine_check_exception(regs);
+
+ if (recover)
+ return;
if (debugger_fault_handler(regs))
return;
@@ -291,8 +196,7 @@ MachineCheckException(struct pt_regs *regs)
panic("Unrecoverable Machine check");
}
-void
-UnknownException(struct pt_regs *regs)
+void unknown_exception(struct pt_regs *regs)
{
printk("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
regs->nip, regs->msr, regs->trap);
@@ -300,8 +204,7 @@ UnknownException(struct pt_regs *regs)
_exception(SIGTRAP, regs, 0, 0);
}
-void
-InstructionBreakpointException(struct pt_regs *regs)
+void instruction_breakpoint_exception(struct pt_regs *regs)
{
if (notify_die(DIE_IABR_MATCH, "iabr_match", regs, 5,
5, SIGTRAP) == NOTIFY_STOP)
@@ -311,8 +214,7 @@ InstructionBreakpointException(struct pt_regs *regs)
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
}
-void
-SingleStepException(struct pt_regs *regs)
+void single_step_exception(struct pt_regs *regs)
{
regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */
@@ -334,7 +236,7 @@ SingleStepException(struct pt_regs *regs)
static inline void emulate_single_step(struct pt_regs *regs)
{
if (regs->msr & MSR_SE)
- SingleStepException(regs);
+ single_step_exception(regs);
}
static void parse_fpe(struct pt_regs *regs)
@@ -478,8 +380,7 @@ check_bug_trap(struct pt_regs *regs)
return 0;
}
-void
-ProgramCheckException(struct pt_regs *regs)
+void program_check_exception(struct pt_regs *regs)
{
if (debugger_fault_handler(regs))
return;
@@ -526,14 +427,14 @@ ProgramCheckException(struct pt_regs *regs)
}
}
-void KernelFPUnavailableException(struct pt_regs *regs)
+void kernel_fp_unavailable_exception(struct pt_regs *regs)
{
printk(KERN_EMERG "Unrecoverable FP Unavailable Exception "
"%lx at %lx\n", regs->trap, regs->nip);
die("Unrecoverable FP Unavailable Exception", regs, SIGABRT);
}
-void AltivecUnavailableException(struct pt_regs *regs)
+void altivec_unavailable_exception(struct pt_regs *regs)
{
#ifndef CONFIG_ALTIVEC
if (user_mode(regs)) {
@@ -549,9 +450,6 @@ void AltivecUnavailableException(struct pt_regs *regs)
}
/* Ensure exceptions are disabled */
-#define MMCR0_PMXE (1UL << (31 - 5))
-#define MMCR0_PMAO (1UL << (31 - 24))
-
static void dummy_perf(struct pt_regs *regs)
{
unsigned int mmcr0 = mfspr(SPRN_MMCR0);
@@ -564,14 +462,12 @@ void (*perf_irq)(struct pt_regs *) = dummy_perf;
EXPORT_SYMBOL(perf_irq);
-void
-PerformanceMonitorException(struct pt_regs *regs)
+void performance_monitor_exception(struct pt_regs *regs)
{
perf_irq(regs);
}
-void
-AlignmentException(struct pt_regs *regs)
+void alignment_exception(struct pt_regs *regs)
{
int fixed;
@@ -599,8 +495,7 @@ AlignmentException(struct pt_regs *regs)
}
#ifdef CONFIG_ALTIVEC
-void
-AltivecAssistException(struct pt_regs *regs)
+void altivec_assist_exception(struct pt_regs *regs)
{
int err;
siginfo_t info;
diff --git a/arch/ppc64/kernel/u3_iommu.c b/arch/ppc64/kernel/u3_iommu.c
index 051cac60b46f1..b6e3bca4102db 100644
--- a/arch/ppc64/kernel/u3_iommu.c
+++ b/arch/ppc64/kernel/u3_iommu.c
@@ -91,6 +91,7 @@ static unsigned int *dart;
static unsigned int dart_emptyval;
static struct iommu_table iommu_table_u3;
+static int iommu_table_u3_inited;
static int dart_dirty;
#define DBG(...)
@@ -192,7 +193,6 @@ static int dart_init(struct device_node *dart_node)
unsigned int regword;
unsigned int i;
unsigned long tmp;
- struct page *p;
if (dart_tablebase == 0 || dart_tablesize == 0) {
printk(KERN_INFO "U3-DART: table not allocated, using direct DMA\n");
@@ -209,16 +209,15 @@ static int dart_init(struct device_node *dart_node)
* that to work around what looks like a problem with the HT bridge
* prefetching into invalid pages and corrupting data
*/
- tmp = __get_free_pages(GFP_ATOMIC, 1);
- if (tmp == 0)
- panic("U3-DART: Cannot allocate spare page !");
- dart_emptyval = DARTMAP_VALID |
- ((virt_to_abs(tmp) >> PAGE_SHIFT) & DARTMAP_RPNMASK);
+ tmp = lmb_alloc(PAGE_SIZE, PAGE_SIZE);
+ if (!tmp)
+ panic("U3-DART: Cannot allocate spare page!");
+ dart_emptyval = DARTMAP_VALID | ((tmp >> PAGE_SHIFT) & DARTMAP_RPNMASK);
/* Map in DART registers. FIXME: Use device node to get base address */
dart = ioremap(DART_BASE, 0x7000);
if (dart == NULL)
- panic("U3-DART: Cannot map registers !");
+ panic("U3-DART: Cannot map registers!");
/* Set initial control register contents: table base,
* table size and enable bit
@@ -227,7 +226,6 @@ static int dart_init(struct device_node *dart_node)
((dart_tablebase >> PAGE_SHIFT) << DARTCNTL_BASE_SHIFT) |
(((dart_tablesize >> PAGE_SHIFT) & DARTCNTL_SIZE_MASK)
<< DARTCNTL_SIZE_SHIFT);
- p = virt_to_page(dart_tablebase);
dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize);
/* Fill initial table */
@@ -240,35 +238,67 @@ static int dart_init(struct device_node *dart_node)
/* Invalidate DART to get rid of possible stale TLBs */
dart_tlb_invalidate_all();
+ printk(KERN_INFO "U3/CPC925 DART IOMMU initialized\n");
+
+ return 0;
+}
+
+static void iommu_table_u3_setup(void)
+{
iommu_table_u3.it_busno = 0;
-
- /* Units of tce entries */
iommu_table_u3.it_offset = 0;
-
- /* Set the tce table size - measured in pages */
- iommu_table_u3.it_size = dart_tablesize >> PAGE_SHIFT;
+ /* it_size is in number of entries */
+ iommu_table_u3.it_size = dart_tablesize / sizeof(u32);
/* Initialize the common IOMMU code */
iommu_table_u3.it_base = (unsigned long)dart_vbase;
iommu_table_u3.it_index = 0;
iommu_table_u3.it_blocksize = 1;
- iommu_table_u3.it_entrysize = sizeof(u32);
iommu_init_table(&iommu_table_u3);
/* Reserve the last page of the DART to avoid possible prefetch
* past the DART mapped area
*/
- set_bit(iommu_table_u3.it_mapsize - 1, iommu_table_u3.it_map);
+ set_bit(iommu_table_u3.it_size - 1, iommu_table_u3.it_map);
+}
- printk(KERN_INFO "U3/CPC925 DART IOMMU initialized\n");
+static void iommu_dev_setup_u3(struct pci_dev *dev)
+{
+ struct device_node *dn;
- return 0;
+ /* We only have one iommu table on the mac for now, which makes
+ * things simple. Setup all PCI devices to point to this table
+ *
+ * We must use pci_device_to_OF_node() to make sure that
+ * we get the real "final" pointer to the device in the
+ * pci_dev sysdata and not the temporary PHB one
+ */
+ dn = pci_device_to_OF_node(dev);
+
+ if (dn)
+ dn->iommu_table = &iommu_table_u3;
}
-void iommu_setup_u3(void)
+static void iommu_bus_setup_u3(struct pci_bus *bus)
+{
+ struct device_node *dn;
+
+ if (!iommu_table_u3_inited) {
+ iommu_table_u3_inited = 1;
+ iommu_table_u3_setup();
+ }
+
+ dn = pci_bus_to_OF_node(bus);
+
+ if (dn)
+ dn->iommu_table = &iommu_table_u3;
+}
+
+static void iommu_dev_setup_null(struct pci_dev *dev) { }
+static void iommu_bus_setup_null(struct pci_bus *bus) { }
+
+void iommu_init_early_u3(void)
{
- struct pci_controller *phb, *tmp;
- struct pci_dev *dev = NULL;
struct device_node *dn;
/* Find the DART in the device-tree */
@@ -282,31 +312,23 @@ void iommu_setup_u3(void)
ppc_md.tce_flush = dart_flush;
/* Initialize the DART HW */
- if (dart_init(dn))
- return;
-
- /* Setup pci_dma ops */
- pci_iommu_init();
-
- /* We only have one iommu table on the mac for now, which makes
- * things simple. Setup all PCI devices to point to this table
- */
- for_each_pci_dev(dev) {
- /* We must use pci_device_to_OF_node() to make sure that
- * we get the real "final" pointer to the device in the
- * pci_dev sysdata and not the temporary PHB one
- */
- struct device_node *dn = pci_device_to_OF_node(dev);
- if (dn)
- dn->iommu_table = &iommu_table_u3;
- }
- /* We also make sure we set all PHBs ... */
- list_for_each_entry_safe(phb, tmp, &hose_list, list_node) {
- dn = (struct device_node *)phb->arch_data;
- dn->iommu_table = &iommu_table_u3;
+ if (dart_init(dn)) {
+ /* If init failed, use direct iommu and null setup functions */
+ ppc_md.iommu_dev_setup = iommu_dev_setup_null;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_null;
+
+ /* Setup pci_dma ops */
+ pci_direct_iommu_init();
+ } else {
+ ppc_md.iommu_dev_setup = iommu_dev_setup_u3;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_u3;
+
+ /* Setup pci_dma ops */
+ pci_iommu_init();
}
}
+
void __init alloc_u3_dart_table(void)
{
/* Only reserve DART space if machine has more than 2GB of RAM
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index ed20451775b69..8adddd7ca1ad9 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -158,6 +158,7 @@ void __init iommu_vio_init(void)
struct iommu_table *t;
struct iommu_table_cb cb;
unsigned long cbp;
+ unsigned long itc_entries;
cb.itc_busno = 255; /* Bus 255 is the virtual bus */
cb.itc_virtbus = 0xff; /* Ask for virtual bus */
@@ -165,12 +166,12 @@ void __init iommu_vio_init(void)
cbp = virt_to_abs(&cb);
HvCallXm_getTceTableParms(cbp);
- veth_iommu_table.it_size = cb.itc_size / 2;
+ itc_entries = cb.itc_size * PAGE_SIZE / sizeof(union tce_entry);
+ veth_iommu_table.it_size = itc_entries / 2;
veth_iommu_table.it_busno = cb.itc_busno;
veth_iommu_table.it_offset = cb.itc_offset;
veth_iommu_table.it_index = cb.itc_index;
veth_iommu_table.it_type = TCE_VB;
- veth_iommu_table.it_entrysize = sizeof(union tce_entry);
veth_iommu_table.it_blocksize = 1;
t = iommu_init_table(&veth_iommu_table);
@@ -178,13 +179,12 @@ void __init iommu_vio_init(void)
if (!t)
printk("Virtual Bus VETH TCE table failed.\n");
- vio_iommu_table.it_size = cb.itc_size - veth_iommu_table.it_size;
+ vio_iommu_table.it_size = itc_entries - veth_iommu_table.it_size;
vio_iommu_table.it_busno = cb.itc_busno;
vio_iommu_table.it_offset = cb.itc_offset +
- veth_iommu_table.it_size * (PAGE_SIZE/sizeof(union tce_entry));
+ veth_iommu_table.it_size;
vio_iommu_table.it_index = cb.itc_index;
vio_iommu_table.it_type = TCE_VB;
- vio_iommu_table.it_entrysize = sizeof(union tce_entry);
vio_iommu_table.it_blocksize = 1;
t = iommu_init_table(&vio_iommu_table);
@@ -511,7 +511,6 @@ static struct iommu_table * vio_build_iommu_table(struct vio_dev *dev)
unsigned int *dma_window;
struct iommu_table *newTceTable;
unsigned long offset;
- unsigned long size;
int dma_window_property_size;
dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size);
@@ -521,21 +520,18 @@ static struct iommu_table * vio_build_iommu_table(struct vio_dev *dev)
newTceTable = (struct iommu_table *) kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
- size = ((dma_window[4] >> PAGE_SHIFT) << 3) >> PAGE_SHIFT;
-
/* There should be some code to extract the phys-encoded offset
using prom_n_addr_cells(). However, according to a comment
on earlier versions, it's always zero, so we don't bother */
offset = dma_window[1] >> PAGE_SHIFT;
- /* TCE table size - measured in units of pages of tce table */
- newTceTable->it_size = size;
+ /* TCE table size - measured in tce entries */
+ newTceTable->it_size = dma_window[4] >> PAGE_SHIFT;
/* offset for VIO should always be 0 */
newTceTable->it_offset = offset;
newTceTable->it_busno = 0;
newTceTable->it_index = (unsigned long)dma_window[0];
newTceTable->it_type = TCE_VB;
- newTceTable->it_entrysize = sizeof(union tce_entry);
return iommu_init_table(newTceTable);
}
diff --git a/arch/ppc64/lib/sstep.c b/arch/ppc64/lib/sstep.c
index ce9ecc6b7a9b3..e79123d1485cd 100644
--- a/arch/ppc64/lib/sstep.c
+++ b/arch/ppc64/lib/sstep.c
@@ -13,7 +13,7 @@
#include <asm/sstep.h>
#include <asm/processor.h>
-extern char SystemCall_common[];
+extern char system_call_common[];
/* Bits in SRR1 that are copied from MSR */
#define MSR_MASK 0xffffffff87c0ffff
@@ -76,7 +76,7 @@ int emulate_step(struct pt_regs *regs, unsigned int instr)
regs->gpr[11] = regs->nip + 4;
regs->gpr[12] = regs->msr & MSR_MASK;
regs->gpr[13] = (unsigned long) get_paca();
- regs->nip = (unsigned long) &SystemCall_common;
+ regs->nip = (unsigned long) &system_call_common;
regs->msr = MSR_KERNEL;
return 1;
case 18: /* b */
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index c6f79ebb185ac..056db88671b4d 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -702,7 +702,7 @@ void __init mem_init(void)
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
#ifdef CONFIG_DISCONTIGMEM
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
if (NODE_DATA(nid)->node_spanned_pages != 0) {
printk("freeing bootmem node %x\n", nid);
totalram_pages +=
diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c
index 5d902b744741c..ad07e3d0d3445 100644
--- a/arch/ppc64/mm/numa.c
+++ b/arch/ppc64/mm/numa.c
@@ -216,7 +216,7 @@ static int numa_setup_cpu(unsigned long lcpu)
numa_domain = of_node_numa_domain(cpu);
- if (numa_domain >= numnodes) {
+ if (numa_domain >= num_online_nodes()) {
/*
* POWER4 LPAR uses 0xffff as invalid node,
* dont warn in this case.
@@ -384,7 +384,8 @@ new_range:
goto new_range;
}
- numnodes = max_domain + 1;
+ for (i = 0; i <= max_domain; i++)
+ node_set_online(i);
return 0;
}
@@ -430,12 +431,9 @@ static void __init dump_numa_topology(void)
if (min_common_depth == -1 || !numa_enabled)
return;
- for (node = 0; node < MAX_NUMNODES; node++) {
+ for_each_online_node(node) {
unsigned long i;
- if (!node_online(node))
- continue;
-
printk(KERN_INFO "Node %d Memory:", node);
count = 0;
@@ -519,7 +517,7 @@ void __init do_init_bootmem(void)
register_cpu_notifier(&ppc64_numa_nb);
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
unsigned long start_paddr, end_paddr;
int i;
unsigned long bootmem_paddr;
@@ -619,7 +617,7 @@ void __init paging_init(void)
memset(zones_size, 0, sizeof(zones_size));
memset(zholes_size, 0, sizeof(zholes_size));
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
unsigned long start_pfn;
unsigned long end_pfn;
diff --git a/arch/ppc64/oprofile/op_impl.h b/arch/ppc64/oprofile/op_impl.h
index 30c71a03b189b..7fa7eaabc0351 100644
--- a/arch/ppc64/oprofile/op_impl.h
+++ b/arch/ppc64/oprofile/op_impl.h
@@ -14,44 +14,6 @@
#define OP_MAX_COUNTER 8
-#define MSR_PMM (1UL << (63 - 61))
-
-/* freeze counters. set to 1 on a perfmon exception */
-#define MMCR0_FC (1UL << (31 - 0))
-
-/* freeze in supervisor state */
-#define MMCR0_KERNEL_DISABLE (1UL << (31 - 1))
-
-/* freeze in problem state */
-#define MMCR0_PROBLEM_DISABLE (1UL << (31 - 2))
-
-/* freeze counters while MSR mark = 1 */
-#define MMCR0_FCM1 (1UL << (31 - 3))
-
-/* performance monitor exception enable */
-#define MMCR0_PMXE (1UL << (31 - 5))
-
-/* freeze counters on enabled condition or event */
-#define MMCR0_FCECE (1UL << (31 - 6))
-
-/* PMC1 count enable*/
-#define MMCR0_PMC1INTCONTROL (1UL << (31 - 16))
-
-/* PMCn count enable*/
-#define MMCR0_PMCNINTCONTROL (1UL << (31 - 17))
-
-/* performance monitor alert has occurred, set to 0 after handling exception */
-#define MMCR0_PMAO (1UL << (31 - 24))
-
-/* state of MSR HV when SIAR set */
-#define MMCRA_SIHV (1UL << (63 - 35))
-
-/* state of MSR PR when SIAR set */
-#define MMCRA_SIPR (1UL << (63 - 36))
-
-/* enable sampling */
-#define MMCRA_SAMPLE_ENABLE (1UL << (63 - 63))
-
/* Per-counter configuration as set via oprofilefs. */
struct op_counter_config {
unsigned long valid;
diff --git a/arch/sh/boards/renesas/hs7751rvoip/io.c b/arch/sh/boards/renesas/hs7751rvoip/io.c
index a2ecd2d6af531..456753d2649ca 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/io.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/io.c
@@ -166,7 +166,7 @@ void hs7751rvoip_outb(unsigned char value, unsigned long port)
if (PXSEG(port))
*(volatile unsigned char *)port = value;
-#if defined(CONFIG_HS7751RVOIP_CIDEC)
+#if defined(CONFIG_HS7751RVOIP_CODEC)
else if (codec_port(port))
*(volatile unsigned cjar *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value;
#endif
@@ -180,7 +180,7 @@ void hs7751rvoip_outb_p(unsigned char value, unsigned long port)
{
if (PXSEG(port))
*(volatile unsigned char *)port = value;
-#if defined(CONFIG_HS7751RVOIP_CIDEC)
+#if defined(CONFIG_HS7751RVOIP_CODEC)
else if (codec_port(port))
*(volatile unsigned cjar *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value;
#endif
diff --git a/arch/sh/drivers/pci/Kconfig b/arch/sh/drivers/pci/Kconfig
index 184cb8a56bba7..6d1cbbe6745ca 100644
--- a/arch/sh/drivers/pci/Kconfig
+++ b/arch/sh/drivers/pci/Kconfig
@@ -3,8 +3,7 @@ config PCI
help
Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside
- your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
- VESA. If you have PCI, say Y, otherwise N.
+ your box. If you have PCI, say Y, otherwise N.
The PCI-HOWTO, available from
<http://www.tldp.org/docs.html#howto>, contains valuable
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index 46969861091c5..4f371f6470a3d 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(__const_udelay);
EXPORT_SYMBOL(__div64_32);
-#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL_NOVERS(name)
+#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name)
/* These symbols are generated by the compiler itself */
DECLARE_EXPORT(__udivsi3);
@@ -100,7 +100,7 @@ DECLARE_EXPORT(__ashldi3);
DECLARE_EXPORT(__lshrdi3);
DECLARE_EXPORT(__movstr);
-EXPORT_SYMBOL_NOVERS(strcpy);
+EXPORT_SYMBOL(strcpy);
#ifdef CONFIG_CPU_SH4
DECLARE_EXPORT(__movstr_i4_even);
diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c
index 5504546494c8e..50b36037d86b0 100644
--- a/arch/sh/lib/delay.c
+++ b/arch/sh/lib/delay.c
@@ -24,7 +24,7 @@ inline void __const_udelay(unsigned long xloops)
__asm__("dmulu.l %0, %2\n\t"
"sts mach, %0"
: "=r" (xloops)
- : "0" (xloops), "r" (current_cpu_data.loops_per_jiffy)
+ : "0" (xloops), "r" (cpu_data[_smp_processor_id()].loops_per_jiffy)
: "macl", "mach");
__delay(xloops * HZ);
}
diff --git a/arch/sparc64/lib/delay.c b/arch/sparc64/lib/delay.c
index f55f528a7f6b6..f6b4c784d53e0 100644
--- a/arch/sparc64/lib/delay.c
+++ b/arch/sparc64/lib/delay.c
@@ -31,7 +31,7 @@ void __const_udelay(unsigned long n)
{
n *= 4;
- n *= (cpu_data(smp_processor_id()).udelay_val * (HZ/4));
+ n *= (cpu_data(_smp_processor_id()).udelay_val * (HZ/4));
n >>= 32;
__delay(n + 1);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index c0972864ac7d3..47339a83c9957 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -249,6 +249,17 @@ config PREEMPT
Say Y here if you are feeling brave and building a kernel for a
desktop, embedded or real-time system. Say N if you are unsure.
+config PREEMPT_BKL
+ bool "Preempt The Big Kernel Lock"
+ depends on PREEMPT || SMP
+ default y
+ help
+ This option reduces the latency of the kernel by making the
+ big kernel lock preemptible.
+
+ Say Y here if you are building a kernel for a desktop system.
+ Say N if you are unsure.
+
config SCHED_SMT
bool "SMT (Hyperthreading) scheduler support"
depends on SMP
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index d0abfe9ae5658..d07c439cafe4e 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -82,7 +82,8 @@ void __init setup_per_cpu_areas(void)
unsigned char *ptr;
if (!NODE_DATA(cpu_to_node(i))) {
- printk("cpu with no node %d, numnodes %d\n", i, numnodes);
+ printk("cpu with no node %d, num_online_nodes %d\n",
+ i, num_online_nodes());
ptr = alloc_bootmem(size);
} else {
ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 9fcdb2d2d4cdc..05689cc549017 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -34,7 +34,7 @@ void __delay(unsigned long loops)
inline void __const_udelay(unsigned long xloops)
{
- __delay(((xloops * current_cpu_data.loops_per_jiffy) >> 32) * HZ);
+ __delay(((xloops * cpu_data[_smp_processor_id()].loops_per_jiffy) >> 32) * HZ);
}
void __udelay(unsigned long usecs)
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c
index 7869b4c5c75dd..b3acd04b3b30e 100644
--- a/arch/x86_64/mm/k8topology.c
+++ b/arch/x86_64/mm/k8topology.c
@@ -55,9 +55,10 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb);
reg = read_pci_config(0, nb, 0, 0x60);
- numnodes = ((reg >> 4) & 7) + 1;
+ for (i = 0; i <= ((reg >> 4) & 7); i++)
+ node_set_online(i);
- printk(KERN_INFO "Number of nodes %d (%x)\n", numnodes, reg);
+ printk(KERN_INFO "Number of nodes %d (%x)\n", num_online_nodes(), reg);
memset(&nodes,0,sizeof(nodes));
prevbase = 0;
@@ -69,11 +70,11 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
nodeid = limit & 7;
if ((base & 3) == 0) {
- if (i < numnodes)
+ if (i < num_online_nodes())
printk("Skipping disabled node %d\n", i);
continue;
}
- if (nodeid >= numnodes) {
+ if (nodeid >= num_online_nodes()) {
printk("Ignoring excess node %d (%lx:%lx)\n", nodeid,
base, limit);
continue;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index c7661956f7960..b1a7db4f4d6dc 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -45,7 +45,7 @@ int __init compute_hash_shift(struct node *nodes)
/* When in doubt use brute force. */
while (shift < 48) {
memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE);
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
if (nodes[i].start == nodes[i].end)
continue;
for (addr = nodes[i].start;
@@ -111,8 +111,6 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size);
reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT);
- if (nodeid + 1 > numnodes)
- numnodes = nodeid + 1;
node_set_online(nodeid);
}
@@ -197,15 +195,15 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
i,
nodes[i].start, nodes[i].end,
(nodes[i].end - nodes[i].start) >> 20);
+ node_set_online(i);
}
- numnodes = numa_fake;
memnode_shift = compute_hash_shift(nodes);
if (memnode_shift < 0) {
memnode_shift = 0;
printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
return -1;
}
- for (i = 0; i < numa_fake; i++)
+ for_each_online_node(i)
setup_node_bootmem(i, nodes[i].start, nodes[i].end);
numa_init_array();
return 0;
@@ -240,7 +238,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
/* setup dummy node covering all memory */
memnode_shift = 63;
memnodemap[0] = 0;
- numnodes = 1;
+ nodes_clear(node_online_map);
+ node_set_online(0);
for (i = 0; i < NR_CPUS; i++)
cpu_to_node[i] = 0;
node_to_cpumask[0] = cpumask_of_cpu(0);
@@ -258,7 +257,7 @@ unsigned long __init numa_free_all_bootmem(void)
{
int i;
unsigned long pages = 0;
- for_all_nodes(i) {
+ for_each_online_node(i) {
pages += free_all_bootmem_node(NODE_DATA(i));
}
return pages;
@@ -267,7 +266,7 @@ unsigned long __init numa_free_all_bootmem(void)
void __init paging_init(void)
{
int i;
- for_all_nodes(i) {
+ for_each_online_node(i) {
setup_node_zones(i);
}
}
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index da7ee4812790a..1db7483a0564d 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -27,10 +27,10 @@ static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff };
static __init int setup_node(int pxm)
{
if (pxm2node[pxm] == 0xff) {
- if (numnodes > MAX_NUMNODES)
+ if (num_online_nodes() >= MAX_NUMNODES)
return -1;
- pxm2node[pxm] = numnodes - 1;
- numnodes++;
+ pxm2node[pxm] = num_online_nodes();
+ node_set_online(num_online_nodes());
}
return pxm2node[pxm];
}
@@ -38,7 +38,7 @@ static __init int setup_node(int pxm)
static __init int conflicting_nodes(unsigned long start, unsigned long end)
{
int i;
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
struct node *nd = &nodes[i];
if (nd->start == nd->end)
continue;
@@ -155,10 +155,7 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
nd->start, nd->end);
}
-void __init acpi_numa_arch_fixup(void)
-{
- numnodes--;
-}
+void __init acpi_numa_arch_fixup(void) {}
/* Use the information discovered above to actually set up the nodes. */
int __init acpi_scan_nodes(unsigned long start, unsigned long end)
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 0078c8fb1b783..a75cb565caeb2 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -78,9 +78,9 @@ MODULE_LICENSE("GPL");
static uid_t asus_uid;
static gid_t asus_gid;
-MODULE_PARM(asus_uid, "i");
+module_param(asus_uid, uint, 0);
MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
-MODULE_PARM(asus_gid, "i");
+module_param(asus_gid, uint, 0);
MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n");
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index fb748b491cfc8..a8edcf1bdaa44 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -623,7 +623,7 @@ acpi_ec_add (
ec->handle = device->handle;
ec->uid = -1;
- ec->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&ec->lock);
strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_EC_CLASS);
acpi_driver_data(device) = ec;
@@ -909,7 +909,7 @@ acpi_ec_get_real_ecdt(void)
ec_ecdt->status_addr = ecdt_ptr->ec_control;
ec_ecdt->data_addr = ecdt_ptr->ec_data;
ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;
- ec_ecdt->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&ec_ecdt->lock);
/* use the GL just to be safe */
ec_ecdt->global_lock = TRUE;
ec_ecdt->uid = ecdt_ptr->uid;
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 3bda91ad82e6b..583d57ec49a82 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -10,6 +10,7 @@
#include <linux/hugetlb.h>
#include <linux/cpumask.h>
#include <linux/topology.h>
+#include <linux/nodemask.h>
static struct sysdev_class node_class = {
set_kset_name("node"),
@@ -120,7 +121,7 @@ static ssize_t node_read_distance(struct sys_device * dev, char * buf)
/* buf currently PAGE_SIZE, need ~4 chars per node */
BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2);
- for (i = 0; i < numnodes; i++)
+ for_each_online_node(i)
len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
len += sprintf(buf + len, "\n");
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 9d28e25fcc9ed..2c0946c49d5d9 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -2738,7 +2738,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
}
init_waitqueue_head(&Controller->CommandWaitQueue);
init_waitqueue_head(&Controller->HealthStatusWaitQueue);
- Controller->queue_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&Controller->queue_lock);
DAC960_AnnounceDriver(Controller);
/*
Map the Controller Register Window.
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index f4ed730a7ae79..8e1c8535effd0 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -359,31 +359,48 @@ config BLK_DEV_INITRD
for details.
config INITRAMFS_SOURCE
- string "Source directory of cpio_list"
+ string "Initramfs source file(s)"
default ""
help
- This can be set to either a directory containing files, etc to be
- included in the initramfs archive, or a file containing newline
- separated entries.
-
- If it is a file, it should be in the following format:
- # a comment
- file <name> <location> <mode> <uid> <gid>
- dir <name> <mode> <uid> <gid>
- nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>
-
- Where:
- <name> name of the file/dir/nod in the archive
- <location> location of the file in the current filesystem
- <mode> mode/permissions of the file
- <uid> user id (0=root)
- <gid> group id (0=root)
- <dev_type> device type (b=block, c=character)
- <maj> major number of nod
- <min> minor number of nod
+ This can be either a single cpio archive with a .cpio suffix or a
+ space-separated list of directories and files for building the
+ initramfs image. A cpio archive should contain a filesystem archive
+ to be used as an initramfs image. Directories should contain a
+ filesystem layout to be included in the initramfs image. Files
+ should contain entries according to the format described by the
+ "usr/gen_init_cpio" program in the kernel tree.
+
+ When multiple directories and files are specified then the
+ initramfs image will be the aggregate of all of them.
+
+ See <file:Documentation/early-userspace/README for more details.
If you are not sure, leave it blank.
+config INITRAMFS_ROOT_UID
+ int "User ID to map to 0 (user root)"
+ depends on INITRAMFS_SOURCE!=""
+ default "0"
+ help
+ This setting is only meaningful if the INITRAMFS_SOURCE is
+ contains a directory. Setting this user ID (UID) to something
+ other than "0" will cause all files owned by that UID to be
+ owned by user root in the initial ramdisk image.
+
+ If you are not sure, leave it set to "0".
+
+config INITRAMFS_ROOT_GID
+ int "Group ID to map to 0 (group root)"
+ depends on INITRAMFS_SOURCE!=""
+ default "0"
+ help
+ This setting is only meaningful if the INITRAMFS_SOURCE is
+ contains a directory. Setting this group ID (GID) to something
+ other than "0" will cause all files owned by that GID to be
+ owned by group root in the initial ramdisk image.
+
+ If you are not sure, leave it set to "0".
+
config LBD
bool "Support for Large Block Devices"
depends on X86 || MIPS32 || PPC32 || ARCH_S390_31 || SUPERH
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 97bf2d4b92074..f747fb3d13dba 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to Cciss-discuss@lists.sourceforge.net
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 452a4aff9e6d7..944e9efb4538a 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
* Author: Stephen M. Cameron
*/
@@ -534,7 +534,7 @@ cciss_scsi_setup(int cntl_num)
if (shba == NULL)
return;
shba->scsi_host = NULL;
- shba->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&shba->lock);
shba->registered = 0;
if (scsi_cmd_stack_setup(cntl_num, shba) != 0) {
kfree(shba);
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h
index a2279b77d39e5..51f1a9b404462 100644
--- a/drivers/block/cciss_scsi.h
+++ b/drivers/block/cciss_scsi.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
#ifdef CONFIG_CISS_SCSI_TAPE
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 1374519313fa1..a231daff00250 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to Cpqarray-discuss@lists.sourceforge.net
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
#include <linux/config.h> /* CONFIG_PROC_FS */
@@ -310,7 +310,7 @@ static int ida_proc_get_info(char *buffer, char **start, off_t offset, int lengt
}
#endif /* CONFIG_PROC_FS */
-MODULE_PARM(eisa, "1-8i");
+module_param_array(eisa, int, NULL, 0);
/* This is a bit of a hack,
* necessary to support both eisa and pci
diff --git a/drivers/block/cpqarray.h b/drivers/block/cpqarray.h
index 6a9ded0545611..be73e9d579c59 100644
--- a/drivers/block/cpqarray.h
+++ b/drivers/block/cpqarray.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
* If you want to make changes, improve or add functionality to this
* driver, you'll probably need the Compaq Array Controller Interface
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 50780e50b58e1..b080ad722d203 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3318,11 +3318,6 @@ static int invalidate_drive(struct block_device *bdev)
return 0;
}
-static inline void clear_write_error(int drive)
-{
- CLEARSTRUCT(UDRWE);
-}
-
static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
int drive, int type, struct block_device *bdev)
{
diff --git a/drivers/block/ida_cmd.h b/drivers/block/ida_cmd.h
index e5f096e262c4a..98b5746b30893 100644
--- a/drivers/block/ida_cmd.h
+++ b/drivers/block/ida_cmd.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
#ifndef ARRAYCMD_H
diff --git a/drivers/block/ida_ioctl.h b/drivers/block/ida_ioctl.h
index 4159e52e8b996..888fff9caed08 100644
--- a/drivers/block/ida_ioctl.h
+++ b/drivers/block/ida_ioctl.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
#ifndef IDA_IOCTL_H
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 75ad39dc653d6..775b8ae21ccdb 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -726,6 +726,6 @@ MODULE_DESCRIPTION("Network Block Device");
MODULE_LICENSE("GPL");
#ifndef NDEBUG
-MODULE_PARM(debugflags, "i");
+module_param(debugflags, int, 0644);
MODULE_PARM_DESC(debugflags, "flags for controlling debug output");
#endif
diff --git a/drivers/block/paride/bpck6.c b/drivers/block/paride/bpck6.c
index 354f67ac5fecb..08d858ad64db9 100644
--- a/drivers/block/paride/bpck6.c
+++ b/drivers/block/paride/bpck6.c
@@ -277,6 +277,6 @@ static void __exit bpck6_exit(void)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Micro Solutions Inc.");
MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
-MODULE_PARM(verbose,"i");
+module_param(verbose, bool, 0644);
module_init(bpck6_init)
module_exit(bpck6_exit)
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 876a236908839..c4d537874d6f2 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -162,14 +162,14 @@ void pcd_setup(char *str, int *ints)
#endif
-MODULE_PARM(verbose, "i");
-MODULE_PARM(major, "i");
-MODULE_PARM(name, "s");
-MODULE_PARM(nice, "i");
-MODULE_PARM(drive0, "1-6i");
-MODULE_PARM(drive1, "1-6i");
-MODULE_PARM(drive2, "1-6i");
-MODULE_PARM(drive3, "1-6i");
+module_param(verbose, bool, 0644);
+module_param(major, int, 0);
+module_param(name, charp, 0);
+module_param(nice, int, 0);
+module_param_array(drive0, int, NULL, 0);
+module_param_array(drive1, int, NULL, 0);
+module_param_array(drive2, int, NULL, 0);
+module_param_array(drive3, int, NULL, 0);
#include "paride.h"
#include "pseudo.h"
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 5f6534daa2c86..c4c8f0df59eec 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -178,15 +178,15 @@ void pd_setup(char *str, int *ints)
#endif
-MODULE_PARM(verbose, "i");
-MODULE_PARM(major, "i");
-MODULE_PARM(name, "s");
-MODULE_PARM(cluster, "i");
-MODULE_PARM(nice, "i");
-MODULE_PARM(drive0, "1-8i");
-MODULE_PARM(drive1, "1-8i");
-MODULE_PARM(drive2, "1-8i");
-MODULE_PARM(drive3, "1-8i");
+module_param(verbose, bool, 0);
+module_param(major, int, 0);
+module_param(name, charp, 0);
+module_param(cluster, int, 0);
+module_param(nice, int, 0);
+module_param_array(drive0, int, NULL, 0);
+module_param_array(drive1, int, NULL, 0);
+module_param_array(drive2, int, NULL, 0);
+module_param_array(drive3, int, NULL, 0);
#include "paride.h"
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index c4fab51d96e48..a1355ceaa2c2b 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -177,15 +177,15 @@ void pf_setup(char *str, int *ints)
#endif
-MODULE_PARM(verbose, "i");
-MODULE_PARM(major, "i");
-MODULE_PARM(name, "s");
-MODULE_PARM(cluster, "i");
-MODULE_PARM(nice, "i");
-MODULE_PARM(drive0, "1-7i");
-MODULE_PARM(drive1, "1-7i");
-MODULE_PARM(drive2, "1-7i");
-MODULE_PARM(drive3, "1-7i");
+module_param(verbose, bool, 0644);
+module_param(major, int, 0);
+module_param(name, charp, 0);
+module_param(cluster, int, 0);
+module_param(nice, int, 0);
+module_param_array(drive0, int, NULL, 0);
+module_param_array(drive1, int, NULL, 0);
+module_param_array(drive2, int, NULL, 0);
+module_param_array(drive3, int, NULL, 0);
#include "paride.h"
#include "pseudo.h"
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 8f28ff71aa96c..dd8c4d9546ed5 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -184,13 +184,13 @@ void pg_setup(char *str, int *ints)
#endif
-MODULE_PARM(verbose, "i");
-MODULE_PARM(major, "i");
-MODULE_PARM(name, "s");
-MODULE_PARM(drive0, "1-6i");
-MODULE_PARM(drive1, "1-6i");
-MODULE_PARM(drive2, "1-6i");
-MODULE_PARM(drive3, "1-6i");
+module_param(verbose, bool, 0644);
+module_param(major, int, 0);
+module_param(name, charp, 0);
+module_param_array(drive0, int, NULL, 0);
+module_param_array(drive1, int, NULL, 0);
+module_param_array(drive2, int, NULL, 0);
+module_param_array(drive3, int, NULL, 0);
#include "paride.h"
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 44b12134d8388..e37f8b18c23db 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -169,13 +169,13 @@ pt_setup(char *str, int *ints)
#endif
-MODULE_PARM(verbose, "i");
-MODULE_PARM(major, "i");
-MODULE_PARM(name, "s");
-MODULE_PARM(drive0, "1-6i");
-MODULE_PARM(drive1, "1-6i");
-MODULE_PARM(drive2, "1-6i");
-MODULE_PARM(drive3, "1-6i");
+module_param(verbose, bool, 0);
+module_param(major, int, 0);
+module_param(name, charp, 0);
+module_param_array(drive0, int, NULL, 0);
+module_param_array(drive1, int, NULL, 0);
+module_param_array(drive2, int, NULL, 0);
+module_param_array(drive3, int, NULL, 0);
#include "paride.h"
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index aa4a3065b3615..4487cfc24037f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -135,7 +135,7 @@ static struct packet_data *pkt_alloc_packet_data(void)
goto no_bio;
for (i = 0; i < PAGES_PER_PACKET; i++) {
- pkt->pages[i] = alloc_page(GFP_KERNEL|| __GFP_ZERO);
+ pkt->pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO);
if (!pkt->pages[i])
goto no_page;
}
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index 82a5f19fd5d10..84f4e62765e48 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -177,10 +177,10 @@ static int cyl[MAX_HD] = {-1,-1};
static int head[MAX_HD] = {-1, -1};
static int sect[MAX_HD] = {-1, -1};
-MODULE_PARM(tp720esdi, "i");
-MODULE_PARM(cyl, "i");
-MODULE_PARM(head, "i");
-MODULE_PARM(sect, "i");
+module_param(tp720esdi, bool, 0);
+module_param_array(cyl, int, NULL, 0);
+module_param_array(head, int, NULL, 0);
+module_param_array(sect, int, NULL, 0);
MODULE_LICENSE("GPL");
int init_module(void) {
diff --git a/drivers/block/smart1,2.h b/drivers/block/smart1,2.h
index 6f9513346179b..a0b403a6b4ed8 100644
--- a/drivers/block/smart1,2.h
+++ b/drivers/block/smart1,2.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Questions/Comments/Bugfixes to arrays@compaq.com
+ * Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
* If you want to make changes, improve or add functionality to this
* driver, you'll probably need the Compaq Array Controller Interface
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 02a541ae784f6..cc8a17251534a 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -1503,7 +1503,7 @@ static int carm_init_disks(struct carm_host *host)
}
port->disk = disk;
- sprintf(disk->disk_name, DRV_NAME "%u_%u", host->id, i);
+ sprintf(disk->disk_name, DRV_NAME "/%u", (host->id * CARM_MAX_PORTS) + i);
sprintf(disk->devfs_name, DRV_NAME "/%u_%u", host->id, i);
disk->major = host->major;
disk->first_minor = i * CARM_MINORS_PER_MAJOR;
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index e78a177c22fe4..2fa910e06425d 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -1054,9 +1054,9 @@ static void __init xd_setparam (u_char command,u_char drive,u_char heads,u_short
#ifdef MODULE
-MODULE_PARM(xd, "1-4i");
-MODULE_PARM(xd_geo, "3-6i");
-MODULE_PARM(nodma, "i");
+module_param_array(xd, int, NULL, 0);
+module_param_array(xd_geo, int, NULL, 0);
+module_param(nodma, bool, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
index b6a14c80e2379..4304ee708c09c 100644
--- a/drivers/cdrom/aztcd.c
+++ b/drivers/cdrom/aztcd.c
@@ -288,7 +288,7 @@ static volatile int azt_read_count = 1;
static int azt_port = AZT_BASE_ADDR;
-MODULE_PARM(azt_port, "i");
+module_param(azt_port, int, 0);
static int azt_port_auto[16] = AZT_BASE_AUTO;
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index fc4e07a4e8fa8..36dd2004840db 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -505,7 +505,7 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi,
* the first prototypes used 0x2c as the page code for the mrw mode page,
* subsequently this was changed to 0x03. probe the one used by this drive
*/
-int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
+static int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
{
struct packet_command cgc;
char buffer[16];
@@ -526,7 +526,7 @@ int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
return 1;
}
-int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)
+static int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)
{
struct packet_command cgc;
struct mrw_feature_desc *mfd;
@@ -680,7 +680,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
return 0;
}
-int cdrom_get_random_writable(struct cdrom_device_info *cdi,
+static int cdrom_get_random_writable(struct cdrom_device_info *cdi,
struct rwrt_feature_desc *rfd)
{
struct packet_command cgc;
@@ -701,7 +701,7 @@ int cdrom_get_random_writable(struct cdrom_device_info *cdi,
return 0;
}
-int cdrom_has_defect_mgt(struct cdrom_device_info *cdi)
+static int cdrom_has_defect_mgt(struct cdrom_device_info *cdi)
{
struct packet_command cgc;
char buffer[16];
@@ -726,7 +726,7 @@ int cdrom_has_defect_mgt(struct cdrom_device_info *cdi)
}
-int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write)
+static int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write)
{
struct rwrt_feature_desc rfd;
int ret;
@@ -1076,6 +1076,8 @@ int open_for_data(struct cdrom_device_info * cdi)
}
cdinfo(CD_OPEN, "the tray is now closed.\n");
}
+ /* the door should be closed now, check for the disc */
+ ret = cdo->drive_status(cdi, CDSL_CURRENT);
if (ret!=CDS_DISC_OK) {
ret = -ENOMEDIUM;
goto clean_up_and_return;
@@ -3074,14 +3076,12 @@ EXPORT_SYMBOL(cdrom_mode_select);
EXPORT_SYMBOL(cdrom_mode_sense);
EXPORT_SYMBOL(init_cdrom_command);
EXPORT_SYMBOL(cdrom_get_media_event);
-EXPORT_SYMBOL(cdrom_is_mrw);
-EXPORT_SYMBOL(cdrom_is_random_writable);
#ifdef CONFIG_SYSCTL
#define CDROM_STR_SIZE 1000
-struct cdrom_sysctl_settings {
+static struct cdrom_sysctl_settings {
char info[CDROM_STR_SIZE]; /* general info */
int autoclose; /* close tray upon mount, etc */
int autoeject; /* eject on umount */
@@ -3090,7 +3090,7 @@ struct cdrom_sysctl_settings {
int check; /* check media type */
} cdrom_sysctl_settings;
-int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
+static int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int pos;
@@ -3193,7 +3193,7 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
procfs/sysctl yet. When they are, this will naturally disappear. For now
just update all drives. Later this will become the template on which
new registered drives will be based. */
-void cdrom_update_settings(void)
+static void cdrom_update_settings(void)
{
struct cdrom_device_info *cdi;
@@ -3271,7 +3271,7 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
}
/* Place files in /proc/sys/dev/cdrom */
-ctl_table cdrom_table[] = {
+static ctl_table cdrom_table[] = {
{
.ctl_name = DEV_CDROM_INFO,
.procname = "info",
@@ -3323,7 +3323,7 @@ ctl_table cdrom_table[] = {
{ .ctl_name = 0 }
};
-ctl_table cdrom_cdrom_table[] = {
+static ctl_table cdrom_cdrom_table[] = {
{
.ctl_name = DEV_CDROM,
.procname = "cdrom",
@@ -3335,7 +3335,7 @@ ctl_table cdrom_cdrom_table[] = {
};
/* Make sure that /proc/sys/dev is there */
-ctl_table cdrom_root_table[] = {
+static ctl_table cdrom_root_table[] = {
{
.ctl_name = CTL_DEV,
.procname = "dev",
diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
index a89cc98c12b46..ccf2af8f25943 100644
--- a/drivers/cdrom/gscd.c
+++ b/drivers/cdrom/gscd.c
@@ -70,7 +70,6 @@
#define MAJOR_NR GOLDSTAR_CDROM_MAJOR
#include <linux/blkdev.h>
-#define gscd_port gscd /* for compatible parameter passing with "insmod" */
#include "gscd.h"
static int gscdPresent = 0;
@@ -78,7 +77,7 @@ static int gscdPresent = 0;
static unsigned char gscd_buf[2048]; /* buffer for block size conversion */
static int gscd_bn = -1;
static short gscd_port = GSCD_BASE_ADDR;
-MODULE_PARM(gscd, "h");
+module_param_named(gscd, gscd_port, short, 0);
/* Kommt spaeter vielleicht noch mal dran ...
* static DECLARE_WAIT_QUEUE_HEAD(gscd_waitq);
diff --git a/drivers/cdrom/isp16.c b/drivers/cdrom/isp16.c
index ff89164bc98a6..6746cfea55eb7 100644
--- a/drivers/cdrom/isp16.c
+++ b/drivers/cdrom/isp16.c
@@ -72,10 +72,10 @@ static int isp16_cdrom_irq = ISP16_CDROM_IRQ;
static int isp16_cdrom_dma = ISP16_CDROM_DMA;
static char *isp16_cdrom_type = ISP16_CDROM_TYPE;
-MODULE_PARM(isp16_cdrom_base, "i");
-MODULE_PARM(isp16_cdrom_irq, "i");
-MODULE_PARM(isp16_cdrom_dma, "i");
-MODULE_PARM(isp16_cdrom_type, "s");
+module_param(isp16_cdrom_base, int, 0);
+module_param(isp16_cdrom_irq, int, 0);
+module_param(isp16_cdrom_dma, int, 0);
+module_param(isp16_cdrom_type, charp, 0);
#ifdef MODULE
void isp16_exit(void);
diff --git a/drivers/cdrom/mcd.c b/drivers/cdrom/mcd.c
index b4f5e02957a6f..821f7dec108bf 100644
--- a/drivers/cdrom/mcd.c
+++ b/drivers/cdrom/mcd.c
@@ -103,7 +103,6 @@
#include <asm/uaccess.h>
#include <linux/blkdev.h>
-#define mcd_port mcd /* for compatible parameter passing with "insmod" */
#include "mcd.h"
/* I added A flag to drop to 1x speed if too many errors 0 = 1X ; 1 = 2X */
@@ -157,7 +156,6 @@ int mitsumi_bug_93_wait;
static short mcd_port = CONFIG_MCD_BASE; /* used as "mcd" by "insmod" */
static int mcd_irq = CONFIG_MCD_IRQ; /* must directly follow mcd_port */
-MODULE_PARM(mcd, "1-2i");
static int McdTimeout, McdTries;
static DECLARE_WAIT_QUEUE_HEAD(mcd_waitq);
@@ -246,7 +244,6 @@ static struct block_device_operations mcd_bdops =
static struct gendisk *mcd_gendisk;
-#ifndef MODULE
static int __init mcd_setup(char *str)
{
int ints[9];
@@ -265,7 +262,14 @@ static int __init mcd_setup(char *str)
__setup("mcd=", mcd_setup);
-#endif /* MODULE */
+#ifdef MODULE
+static int __init param_set_mcd(const char *val, struct kernel_param *kp)
+{
+ mcd_setup(val);
+ return 0;
+}
+module_param_call(mcd, param_set_mcd, NULL, NULL, 0);
+#endif
static int mcd_media_changed(struct cdrom_device_info *cdi, int disc_nr)
{
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index 01b4e9a5602e4..5e294e61992c7 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -77,8 +77,6 @@ static const char *mcdx_c_version
#include <linux/blkdev.h>
#include <linux/devfs_fs_kernel.h>
-/* for compatible parameter passing with "insmod" */
-#define mcdx_drive_map mcdx
#include "mcdx.h"
#ifndef HZ
@@ -309,7 +307,14 @@ static int mcdx_drive_map[][2] = MCDX_DRIVEMAP;
static struct s_drive_stuff *mcdx_stuffp[MCDX_NDRIVES];
static spinlock_t mcdx_lock = SPIN_LOCK_UNLOCKED;
static struct request_queue *mcdx_queue;
-MODULE_PARM(mcdx, "1-4i");
+
+/* You can only set the first two pairs, from old MODULE_PARM code. */
+static int mcdx_set(const char *val, struct kernel_param *kp)
+{
+ get_options((char *)val, 4, (int *)mcdx_drive_map);
+ return 0;
+}
+module_param_call(mcdx, mcdx_set, NULL, NULL, 0);
static struct cdrom_device_ops mcdx_dops = {
.open = mcdx_open,
diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
index caaeb724a3424..edaff299d59db 100644
--- a/drivers/cdrom/optcd.c
+++ b/drivers/cdrom/optcd.c
@@ -116,7 +116,7 @@ static void debug(int debug_this, const char* fmt, ...)
#define optcd_port optcd /* Needed for the modutils. */
static short optcd_port = OPTCD_PORTBASE; /* I/O base of drive. */
-MODULE_PARM(optcd_port, "h");
+module_param(optcd_port, short, 0);
/* Drive registers, read */
#define DATA_PORT optcd_port /* Read data/status */
#define STATUS_PORT optcd_port+1 /* Indicate data/status availability */
diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
index 0e60b5c6a42fc..5e87209da475d 100644
--- a/drivers/cdrom/sjcd.c
+++ b/drivers/cdrom/sjcd.c
@@ -116,7 +116,7 @@ static struct sjcd_play_msf sjcd_playing;
static int sjcd_base = SJCD_BASE_ADDR;
-MODULE_PARM(sjcd_base, "i");
+module_param(sjcd_base, int, 0);
static DECLARE_WAIT_QUEUE_HEAD(sjcd_waitq);
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index a0c9c8d42cbb6..f184e29625a9e 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -210,7 +210,7 @@ static int do_sony_cmd(Byte * cmd, int nCmd, Byte status[2],
/* The base I/O address of the Sony Interface. This is a variable (not a
#define) so it can be easily changed via some future ioctl() */
static unsigned int sony535_cd_base_io = CDU535_ADDRESS;
-MODULE_PARM(sony535_cd_base_io, "i");
+module_param(sony535_cd_base_io, int, 0);
/*
* The following are I/O addresses of the various registers for the drive. The
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index e98239d940fc7..1c3eca465743a 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -203,7 +203,7 @@ config MOXA_SMARTIO
config ISI
tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
- depends on SERIAL_NONSTANDARD && PCI && EXPERIMENTAL && BROKEN_ON_SMP && m
+ depends on SERIAL_NONSTANDARD
help
This is a driver for the Multi-Tech cards which provide several
serial ports. The driver is experimental and can currently only be
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 057b13dba4532..eca1c4f7add8a 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -756,5 +756,5 @@ module_exit(agp_amd64_cleanup);
#endif
MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>, Andi Kleen");
-MODULE_PARM(agp_try_unsupported, "1i");
+module_param(agp_try_unsupported, bool, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index a1a39f2fe2a83..e70999aa88891 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -353,8 +353,8 @@ static void __exit agp_sis_cleanup(void)
module_init(agp_sis_init);
module_exit(agp_sis_cleanup);
-MODULE_PARM(agp_sis_force_delay,"i");
+module_param(agp_sis_force_delay, bool, 0);
MODULE_PARM_DESC(agp_sis_force_delay,"forces sis delay hack");
-MODULE_PARM(agp_sis_agp_spec,"i");
+module_param(agp_sis_agp_spec, int, 0);
MODULE_PARM_DESC(agp_sis_agp_spec,"0=force sis init, 1=force generic agp3 init, default: autodetect");
MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index fe9c7ea3496d0..6bf2e27dc23ad 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -79,10 +79,6 @@ MODULE_DEVICE_TABLE(pci, applicom_pci_tbl);
MODULE_AUTHOR("David Woodhouse & Applicom International");
MODULE_DESCRIPTION("Driver for Applicom Profibus card");
MODULE_LICENSE("GPL");
-MODULE_PARM(irq, "i");
-MODULE_PARM_DESC(irq, "IRQ of the Applicom board");
-MODULE_PARM(mem, "i");
-MODULE_PARM_DESC(mem, "Shared Memory Address of Applicom board");
MODULE_SUPPORTED_DEVICE("ac");
@@ -98,6 +94,11 @@ static struct applicom_board {
static unsigned int irq = 0; /* interrupt number IRQ */
static unsigned long mem = 0; /* physical segment of board */
+module_param(irq, uint, 0);
+MODULE_PARM_DESC(irq, "IRQ of the Applicom board");
+module_param(mem, ulong, 0);
+MODULE_PARM_DESC(mem, "Shared Memory Address of Applicom board");
+
static unsigned int numboards; /* number of installed boards */
static volatile unsigned char Dummy;
static DECLARE_WAIT_QUEUE_HEAD(FlagSleepRec);
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index dac1d80cbe615..6a5337bf09368 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -758,7 +758,6 @@ static int cy_next_channel; /* next minor available */
* allocated when the first cy_open occurs.
*/
static unsigned char *tmp_buf;
-DECLARE_MUTEX(tmp_buf_sem);
/*
* This is used to look up the divisor speeds and the timeouts
@@ -5538,24 +5537,4 @@ cy_cleanup_module(void)
module_init(cy_init);
module_exit(cy_cleanup_module);
-#ifndef MODULE
-/* called by linux/init/main.c to parse command line options */
-void
-cy_setup(char *str, int *ints)
-{
-#ifdef CONFIG_ISA
- int i, j;
-
- for (i = 0 ; i < NR_ISA_ADDRS ; i++) {
- if (cy_isa_addresses[i] == 0) break;
- }
- for (j = 1; j <= ints[0]; j++){
- if ( i < NR_ISA_ADDRS ){
- cy_isa_addresses[i++] = ints[j];
- }
- }
-#endif /* CONFIG_ISA */
-} /* cy_setup */
-#endif /* MODULE */
-
MODULE_LICENSE("GPL");
diff --git a/drivers/char/drm/gamma_lists.h b/drivers/char/drm/gamma_lists.h
index d42d7d3a5cc7a..2d93f412b96be 100644
--- a/drivers/char/drm/gamma_lists.h
+++ b/drivers/char/drm/gamma_lists.h
@@ -45,8 +45,8 @@ int DRM(waitlist_create)(drm_waitlist_t *bl, int count)
bl->rp = bl->bufs;
bl->wp = bl->bufs;
bl->end = &bl->bufs[bl->count+1];
- bl->write_lock = SPIN_LOCK_UNLOCKED;
- bl->read_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&bl->write_lock);
+ spin_lock_init(&bl->read_lock);
return 0;
}
@@ -110,7 +110,7 @@ int DRM(freelist_create)(drm_freelist_t *bl, int count)
bl->low_mark = 0;
bl->high_mark = 0;
atomic_set(&bl->wfh, 0);
- bl->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&bl->lock);
++bl->initialized;
return 0;
}
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index 022cb8fc58b6a..0a43691017793 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -50,24 +50,6 @@
#define up_write up
#endif
-static inline void i810_print_status_page(drm_device_t *dev)
-{
- drm_device_dma_t *dma = dev->dma;
- drm_i810_private_t *dev_priv = dev->dev_private;
- u32 *temp = dev_priv->hw_status_page;
- int i;
-
- DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]);
- DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]);
- DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]);
- DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]);
- DRM_DEBUG( "hw_status: Last Render: %x\n", temp[4]);
- DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]);
- for(i = 6; i < dma->buf_count + 6; i++) {
- DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]);
- }
-}
-
static drm_buf_t *i810_freelist_get(drm_device_t *dev)
{
drm_device_dma_t *dma = dev->dma;
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 5fbcd14541fe3..a1b45a087e669 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -12,24 +12,6 @@
#include "i915_drm.h"
#include "i915_drv.h"
-static inline void i915_print_status_page(drm_device_t * dev)
-{
- drm_i915_private_t *dev_priv = dev->dev_private;
- u32 *temp = dev_priv->hw_status_page;
-
- if (!temp) {
- DRM_DEBUG("no status page\n");
- return;
- }
-
- DRM_DEBUG("hw_status: Interrupt Status : %x\n", temp[0]);
- DRM_DEBUG("hw_status: LpRing Head ptr : %x\n", temp[1]);
- DRM_DEBUG("hw_status: IRing Head ptr : %x\n", temp[2]);
- DRM_DEBUG("hw_status: Reserved : %x\n", temp[3]);
- DRM_DEBUG("hw_status: Driver Counter : %d\n", temp[5]);
-
-}
-
/* Really want an OS-independent resettable timer. Would like to have
* this loop run for (eg) 3 sec, but have the timer reset every time
* the head pointer changes, so that EBUSY only happens if the ring
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index bc042fb2d5cde..d755cac14bc12 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -68,7 +68,7 @@ static int ds1286_set_time(struct rtc_time *rtc_tm);
static inline unsigned char ds1286_is_updating(void);
-static spinlock_t ds1286_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ds1286_lock);
static int ds1286_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data);
diff --git a/drivers/char/ec3104_keyb.c b/drivers/char/ec3104_keyb.c
index 452d45c7b13bf..4aed66968821d 100644
--- a/drivers/char/ec3104_keyb.c
+++ b/drivers/char/ec3104_keyb.c
@@ -92,7 +92,7 @@ static void aux_write_ack(int val);
static void __aux_write_ack(int val);
#endif
-static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(kbd_controller_lock);
static unsigned char handle_kbd_event(void);
/* used only by send_data - set by keyboard_interrupt */
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index 1845739eea848..0090e7a4fcd34 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -48,7 +48,7 @@
*/
#define EFI_RTC_EPOCH 1998
-static spinlock_t efi_rtc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(efi_rtc_lock);
static int efi_rtc_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
diff --git a/drivers/char/ftape/compressor/zftape-compress.c b/drivers/char/ftape/compressor/zftape-compress.c
index 874627ab1e628..3ad8ad19cd42d 100644
--- a/drivers/char/ftape/compressor/zftape-compress.c
+++ b/drivers/char/ftape/compressor/zftape-compress.c
@@ -27,10 +27,6 @@
* changed * appropriately. See below.
*/
- char zftc_src[] ="$Source: /homes/cvs/ftape-stacked/ftape/compressor/zftape-compress.c,v $";
- char zftc_rev[] = "$Revision: 1.1.6.1 $";
- char zftc_dat[] = "$Date: 1997/11/16 15:15:56 $";
-
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/mm.h>
diff --git a/drivers/char/ftape/lowlevel/fc-10.c b/drivers/char/ftape/lowlevel/fc-10.c
index cbfd71f49b940..9bc1cddade765 100644
--- a/drivers/char/ftape/lowlevel/fc-10.c
+++ b/drivers/char/ftape/lowlevel/fc-10.c
@@ -56,13 +56,13 @@
#include "../lowlevel/fdc-io.h"
#include "../lowlevel/fc-10.h"
-__u16 inbs_magic[] = {
+static __u16 inbs_magic[] = {
0x3, 0x3, 0x0, 0x4, 0x7, 0x2, 0x5, 0x3, 0x1, 0x4,
0x3, 0x5, 0x2, 0x0, 0x3, 0x7, 0x4, 0x2,
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7
};
-__u16 fc10_ports[] = {
+static __u16 fc10_ports[] = {
0x180, 0x210, 0x2A0, 0x300, 0x330, 0x340, 0x370
};
diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c
index a3b0f510b1e8f..f589e7e98d363 100644
--- a/drivers/char/ftape/lowlevel/fdc-io.c
+++ b/drivers/char/ftape/lowlevel/fdc-io.c
@@ -50,7 +50,7 @@
/* Global vars.
*/
-int ftape_motor;
+static int ftape_motor;
volatile int ftape_current_cylinder = -1;
volatile fdc_mode_enum fdc_mode = fdc_idle;
fdc_config_info fdc;
@@ -86,6 +86,8 @@ static __u8 fdc_prec_code; /* fdc precomp. select code */
static char ftape_id[] = "ftape"; /* used by request irq and free irq */
+static int fdc_set_seek_rate(int seek_rate);
+
void fdc_catch_stray_interrupts(int count)
{
unsigned long flags;
@@ -103,7 +105,7 @@ void fdc_catch_stray_interrupts(int count)
* If usecs == 0 then just test status, else wait at least for usecs.
* Returns -ETIME on timeout. Function must be calibrated first !
*/
-int fdc_wait(unsigned int usecs, __u8 mask, __u8 state)
+static int fdc_wait(unsigned int usecs, __u8 mask, __u8 state)
{
int count_1 = (fdc_calibr_count * usecs +
fdc_calibr_count - 1) / fdc_calibr_time;
@@ -129,18 +131,12 @@ static void fdc_usec_wait(unsigned int usecs)
fdc_wait(usecs, 0, 1); /* will always timeout ! */
}
-int fdc_ready_out_wait(unsigned int usecs)
+static int fdc_ready_out_wait(unsigned int usecs)
{
fdc_usec_wait(FT_RQM_DELAY); /* wait for valid RQM status */
return fdc_wait(usecs, FDC_DATA_OUT_READY, FDC_DATA_OUT_READY);
}
-int fdc_ready_in_wait(unsigned int usecs)
-{
- fdc_usec_wait(FT_RQM_DELAY); /* wait for valid RQM status */
- return fdc_wait(usecs, FDC_DATA_OUT_READY, FDC_DATA_IN_READY);
-}
-
void fdc_wait_calibrate(void)
{
ftape_calibrate("fdc_wait",
@@ -341,7 +337,7 @@ int fdc_result(__u8 * res_data, int res_len)
/* Handle command and result phases for
* commands without data phase.
*/
-int fdc_issue_command(const __u8 * out_data, int out_count,
+static int fdc_issue_command(const __u8 * out_data, int out_count,
__u8 * in_data, int in_count)
{
TRACE_FUN(ft_t_any);
@@ -497,7 +493,7 @@ void fdc_set_write_precomp(int precomp)
/* Reprogram the 82078 registers to use Data Rate Table 1 on all drives.
*/
-void fdc_set_drive_specs(void)
+static void fdc_set_drive_specs(void)
{
__u8 cmd[] = { FDC_DRIVE_SPEC, 0x00, 0x00, 0x00, 0x00, 0xc0};
int result;
@@ -705,7 +701,7 @@ void fdc_disable(void)
/* Specify FDC seek-rate (milliseconds)
*/
-int fdc_set_seek_rate(int seek_rate)
+static int fdc_set_seek_rate(int seek_rate)
{
/* set step rate, dma mode, and minimal head load and unload times
*/
@@ -803,49 +799,6 @@ int fdc_seek(int track)
TRACE_EXIT 0;
}
-/* Recalibrate and wait until home.
- */
-int fdc_recalibrate(void)
-{
- __u8 out[2];
- int st0;
- int pcn;
- int retry;
- int old_seek_rate = fdc_seek_rate;
- TRACE_FUN(ft_t_any);
-
- TRACE_CATCH(fdc_set_seek_rate(6),);
- out[0] = FDC_RECAL;
- out[1] = ft_drive_sel;
- ft_seek_completed = 0;
- TRACE_CATCH(fdc_command(out, 2),);
- /* Handle interrupts until ft_seek_completed or timeout.
- */
- for (retry = 0;; ++retry) {
- TRACE_CATCH(fdc_interrupt_wait(2 * FT_SECOND),);
- if (ft_seek_completed) {
- TRACE_CATCH(fdc_sense_interrupt_status(&st0, &pcn),);
- if ((st0 & ST0_SEEK_END) == 0) {
- if (retry < 1) {
- continue; /* some drives/fdc's
- * give an extra interrupt
- */
- } else {
- TRACE_ABORT(-EIO, ft_t_err,
- "no seek-end after seek completion !??");
- }
- }
- break;
- }
- }
- ftape_current_cylinder = pcn;
- if (pcn != 0) {
- TRACE(ft_t_err, "failed: resulting track = %d", pcn);
- }
- TRACE_CATCH(fdc_set_seek_rate(old_seek_rate),);
- TRACE_EXIT 0;
-}
-
static int perpend_mode; /* set if fdc is in perpendicular mode */
static int perpend_off(void)
@@ -1079,7 +1032,7 @@ static int fdc_fifo_enable(void)
*/
static __u8 fdc_save_state[2];
-int fdc_probe(void)
+static int fdc_probe(void)
{
__u8 cmd[1];
__u8 stat[16]; /* must be able to hold dumpregs & save results */
@@ -1308,7 +1261,7 @@ static irqreturn_t ftape_interrupt(int irq, void *dev_id, struct pt_regs *regs)
TRACE_EXIT IRQ_RETVAL(handled);
}
-int fdc_grab_irq_and_dma(void)
+static int fdc_grab_irq_and_dma(void)
{
TRACE_FUN(ft_t_any);
diff --git a/drivers/char/ftape/lowlevel/fdc-io.h b/drivers/char/ftape/lowlevel/fdc-io.h
index d7093b316d03a..7ec3c72178bb6 100644
--- a/drivers/char/ftape/lowlevel/fdc-io.h
+++ b/drivers/char/ftape/lowlevel/fdc-io.h
@@ -210,7 +210,6 @@ typedef struct {
extern volatile fdc_mode_enum fdc_mode;
extern int fdc_setup_error; /* outdated ??? */
extern wait_queue_head_t ftape_wait_intr;
-extern int ftape_motor; /* fdc motor line state */
extern volatile int ftape_current_cylinder; /* track nr FDC thinks we're on */
extern volatile __u8 fdc_head; /* FDC head */
extern volatile __u8 fdc_cyl; /* FDC track */
@@ -231,15 +230,11 @@ extern void fdc_catch_stray_interrupts(int count);
extern int fdc_ready_wait(unsigned int timeout);
extern int fdc_command(const __u8 * cmd_data, int cmd_len);
extern int fdc_result(__u8 * res_data, int res_len);
-extern int fdc_issue_command(const __u8 * out_data, int out_count,
- __u8 * in_data, int in_count);
extern int fdc_interrupt_wait(unsigned int time);
-extern int fdc_set_seek_rate(int seek_rate);
extern int fdc_seek(int track);
extern int fdc_sense_drive_status(int *st3);
extern void fdc_motor(int motor);
extern void fdc_reset(void);
-extern int fdc_recalibrate(void);
extern void fdc_disable(void);
extern int fdc_fifo_threshold(__u8 threshold,
int *fifo_state, int *lock_state, int *fifo_thr);
diff --git a/drivers/char/ftape/lowlevel/ftape-bsm.c b/drivers/char/ftape/lowlevel/ftape-bsm.c
index ab58bafcbf25d..d1a301cc344f4 100644
--- a/drivers/char/ftape/lowlevel/ftape-bsm.c
+++ b/drivers/char/ftape/lowlevel/ftape-bsm.c
@@ -47,6 +47,10 @@ typedef enum {
} mode_type;
#if 0
+static void ftape_put_bad_sector_entry(int segment_id, SectorMap new_map);
+#endif
+
+#if 0
/* fix_tape converts a normal QIC-80 tape into a 'wide' tape.
* For testing purposes only !
*/
@@ -375,7 +379,8 @@ static int backwards_seek_entry(int segment_id,
}
}
-void ftape_put_bad_sector_entry(int segment_id, SectorMap new_map)
+#if 0
+static void ftape_put_bad_sector_entry(int segment_id, SectorMap new_map)
{
SectorCount *ptr = (SectorCount *)bad_sector_map;
int count;
@@ -438,6 +443,7 @@ void ftape_put_bad_sector_entry(int segment_id, SectorMap new_map)
}
TRACE_EXIT;
}
+#endif /* 0 */
SectorMap ftape_get_bad_sector_entry(int segment_id)
{
diff --git a/drivers/char/ftape/lowlevel/ftape-bsm.h b/drivers/char/ftape/lowlevel/ftape-bsm.h
index e3568cd9a9fcc..ed45465af4d4a 100644
--- a/drivers/char/ftape/lowlevel/ftape-bsm.h
+++ b/drivers/char/ftape/lowlevel/ftape-bsm.h
@@ -60,7 +60,6 @@ typedef struct NewSectorMap {
extern void update_bad_sector_map(__u8 * buffer);
extern void ftape_extract_bad_sector_map(__u8 * buffer);
extern SectorMap ftape_get_bad_sector_entry(int segment_id);
-extern void ftape_put_bad_sector_entry(int segment_id, SectorMap mask);
extern __u8 *ftape_find_end_of_bsm_list(__u8 * address);
extern void ftape_init_bsm(void);
diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c b/drivers/char/ftape/lowlevel/ftape-ctl.c
index f83b60ccc273a..32e0439117900 100644
--- a/drivers/char/ftape/lowlevel/ftape-ctl.c
+++ b/drivers/char/ftape/lowlevel/ftape-ctl.c
@@ -113,11 +113,6 @@ const ftape_info *ftape_get_status(void)
#endif
}
-void ftape_set_status(const ftape_info *status)
-{
- ftape_status = *status;
-}
-
static int ftape_not_operational(int status)
{
/* return true if status indicates tape can not be used.
@@ -210,7 +205,7 @@ static int lookup_vendor_id(unsigned int vendor_id)
return i;
}
-void ftape_detach_drive(void)
+static void ftape_detach_drive(void)
{
TRACE_FUN(ft_t_any);
@@ -241,7 +236,7 @@ static void clear_history(void)
ft_history.rewinds = 0;
}
-int ftape_activate_drive(vendor_struct * drive_type)
+static int ftape_activate_drive(vendor_struct * drive_type)
{
int result = 0;
TRACE_FUN(ft_t_flow);
@@ -301,7 +296,7 @@ int ftape_activate_drive(vendor_struct * drive_type)
TRACE_EXIT result;
}
-int ftape_get_drive_status(void)
+static int ftape_get_drive_status(void)
{
int result;
int status;
@@ -374,7 +369,7 @@ int ftape_get_drive_status(void)
TRACE_EXIT 0;
}
-void ftape_log_vendor_id(void)
+static void ftape_log_vendor_id(void)
{
int vendor_index;
TRACE_FUN(ft_t_flow);
@@ -580,7 +575,7 @@ int ftape_calibrate_data_rate(unsigned int qic_std)
TRACE_EXIT 0;
}
-int ftape_init_drive(void)
+static int ftape_init_drive(void)
{
int status;
qic_model model;
diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.h b/drivers/char/ftape/lowlevel/ftape-ctl.h
index b23970ee2f59d..5f5e30bc36157 100644
--- a/drivers/char/ftape/lowlevel/ftape-ctl.h
+++ b/drivers/char/ftape/lowlevel/ftape-ctl.h
@@ -158,6 +158,5 @@ extern void ftape_calc_timeouts(unsigned int qic_std,
unsigned int data_rate,
unsigned int tape_len);
extern int ftape_calibrate_data_rate(unsigned int qic_std);
-extern int ftape_init_drive(void);
extern const ftape_info *ftape_get_status(void);
#endif
diff --git a/drivers/char/ftape/lowlevel/ftape-init.c b/drivers/char/ftape/lowlevel/ftape-init.c
index 68f302f5a63af..f5950ee5b8273 100644
--- a/drivers/char/ftape/lowlevel/ftape-init.c
+++ b/drivers/char/ftape/lowlevel/ftape-init.c
@@ -48,12 +48,6 @@
#include "../lowlevel/ftape-proc.h"
#include "../lowlevel/ftape-tracing.h"
-/* Global vars.
- */
-char ft_src[] __initdata = "$Source: /homes/cvs/ftape-stacked/ftape/lowlevel/ftape-init.c,v $";
-char ft_rev[] __initdata = "$Revision: 1.8 $";
-char ft_dat[] __initdata = "$Date: 1997/11/06 00:38:08 $";
-
#if defined(MODULE) && !defined(CONFIG_FT_NO_TRACE_AT_ALL)
static int ft_tracing = -1;
diff --git a/drivers/char/ftape/lowlevel/ftape-io.c b/drivers/char/ftape/lowlevel/ftape-io.c
index b7910d429f34b..259015aeff559 100644
--- a/drivers/char/ftape/lowlevel/ftape-io.c
+++ b/drivers/char/ftape/lowlevel/ftape-io.c
@@ -350,7 +350,7 @@ int ftape_command_wait(qic117_cmd_t command, unsigned int timeout, int *status)
return result;
}
-int ftape_parameter_wait(unsigned int parm, unsigned int timeout, int *status)
+static int ftape_parameter_wait(unsigned int parm, unsigned int timeout, int *status)
{
int result;
@@ -503,16 +503,6 @@ int ftape_report_error(unsigned int *error,
TRACE_EXIT 0;
}
-int ftape_in_error_state(int status)
-{
- TRACE_FUN(ft_t_any);
-
- if ((status & QIC_STATUS_READY) && (status & QIC_STATUS_ERROR)) {
- TRACE_ABORT(1, ft_t_warn, "warning: error status set!");
- }
- TRACE_EXIT 0;
-}
-
int ftape_report_configuration(qic_model *model,
unsigned int *rate,
int *qic_std,
@@ -617,7 +607,7 @@ int ftape_report_configuration(qic_model *model,
TRACE_EXIT (result < 0) ? -EIO : 0;
}
-int ftape_report_rom_version(int *version)
+static int ftape_report_rom_version(int *version)
{
if (ftape_report_operation(version, QIC_REPORT_ROM_VERSION, 8) < 0) {
@@ -627,16 +617,6 @@ int ftape_report_rom_version(int *version)
}
}
-int ftape_report_signature(int *signature)
-{
- int result;
-
- result = ftape_command(28);
- result = ftape_report_operation(signature, 9, 8);
- result = ftape_command(30);
- return (result < 0) ? -EIO : 0;
-}
-
void ftape_report_vendor_id(unsigned int *id)
{
int result;
diff --git a/drivers/char/ftape/lowlevel/ftape-io.h b/drivers/char/ftape/lowlevel/ftape-io.h
index 841f52d736d3c..26a7baad87172 100644
--- a/drivers/char/ftape/lowlevel/ftape-io.h
+++ b/drivers/char/ftape/lowlevel/ftape-io.h
@@ -65,9 +65,6 @@ extern int ftape_command_wait(qic117_cmd_t command,
unsigned int timeout,
int *status);
extern int ftape_parameter(unsigned int parameter);
-extern int ftape_parameter_wait(unsigned int parameter,
- unsigned int timeout,
- int *status);
extern int ftape_report_operation(int *status,
qic117_cmd_t command,
int result_length);
@@ -80,7 +77,6 @@ extern int ftape_report_raw_drive_status(int *status);
extern int ftape_report_status(int *status);
extern int ftape_ready_wait(unsigned int timeout, int *status);
extern int ftape_seek_head_to_track(unsigned int track);
-extern int ftape_in_error_state(int status);
extern int ftape_set_data_rate(unsigned int new_rate, unsigned int qic_std);
extern int ftape_report_error(unsigned int *error,
qic117_cmd_t *command,
diff --git a/drivers/char/ftape/lowlevel/ftape-proc.c b/drivers/char/ftape/lowlevel/ftape-proc.c
index 1e27c908eeee3..c66251e997ed5 100644
--- a/drivers/char/ftape/lowlevel/ftape-proc.c
+++ b/drivers/char/ftape/lowlevel/ftape-proc.c
@@ -174,8 +174,8 @@ static size_t get_history_info(char *buf)
return len;
}
-int ftape_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int ftape_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
{
char *ptr = page;
size_t len;
diff --git a/drivers/char/ftape/lowlevel/ftape-rw.c b/drivers/char/ftape/lowlevel/ftape-rw.c
index e6ac3b62536bb..c0d6dc2cbfd31 100644
--- a/drivers/char/ftape/lowlevel/ftape-rw.c
+++ b/drivers/char/ftape/lowlevel/ftape-rw.c
@@ -301,7 +301,7 @@ static int check_bot_eot(int status)
/* Read Id of first sector passing tape head.
*/
-int ftape_read_id(void)
+static int ftape_read_id(void)
{
int status;
__u8 out[2];
diff --git a/drivers/char/ftape/lowlevel/ftape-rw.h b/drivers/char/ftape/lowlevel/ftape-rw.h
index f93d224413e0e..32f4feeb887cd 100644
--- a/drivers/char/ftape/lowlevel/ftape-rw.h
+++ b/drivers/char/ftape/lowlevel/ftape-rw.h
@@ -101,7 +101,6 @@ extern buffer_struct *ftape_next_buffer (ft_buffer_queue_t pos);
extern buffer_struct *ftape_get_buffer (ft_buffer_queue_t pos);
extern int ftape_buffer_id (ft_buffer_queue_t pos);
extern void ftape_reset_buffer(void);
-extern int ftape_read_id(void);
extern void ftape_tape_parameters(__u8 drive_configuration);
extern int ftape_wait_segment(buffer_state_enum state);
extern int ftape_dumb_stop(void);
diff --git a/drivers/char/ftape/zftape/zftape-buffers.c b/drivers/char/ftape/zftape/zftape-buffers.c
index ec4fdaabe39b1..da06f138334ec 100644
--- a/drivers/char/ftape/zftape/zftape-buffers.c
+++ b/drivers/char/ftape/zftape/zftape-buffers.c
@@ -87,13 +87,6 @@ int zft_vmalloc_once(void *new, size_t size)
TRACE_ABORT(0, ft_t_noise,
"allocated buffer @ %p, %d bytes", *(void **)new, size);
}
-int zft_vcalloc_always(void *new, size_t size)
-{
- TRACE_FUN(ft_t_flow);
-
- zft_vfree(new, size);
- TRACE_EXIT zft_vcalloc_once(new, size);
-}
int zft_vmalloc_always(void *new, size_t size)
{
TRACE_FUN(ft_t_flow);
diff --git a/drivers/char/ftape/zftape/zftape-buffers.h b/drivers/char/ftape/zftape/zftape-buffers.h
index c614984950aec..798e3128c6821 100644
--- a/drivers/char/ftape/zftape/zftape-buffers.h
+++ b/drivers/char/ftape/zftape/zftape-buffers.h
@@ -37,7 +37,6 @@ extern void zft_memory_stats(void);
extern int zft_vmalloc_once(void *new, size_t size);
extern int zft_vcalloc_once(void *new, size_t size);
extern int zft_vmalloc_always(void *new, size_t size);
-extern int zft_vcalloc_always(void *new, size_t size);
extern void zft_vfree(void *old, size_t size);
extern void *zft_kmalloc(size_t size);
extern void zft_kfree(void *old, size_t size);
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
index eefd94a6d04c8..d1450f7c4ad0f 100644
--- a/drivers/char/ftape/zftape/zftape-init.c
+++ b/drivers/char/ftape/zftape/zftape-init.c
@@ -46,10 +46,6 @@
#include "../zftape/zftape-ctl.h"
#include "../zftape/zftape-buffers.h"
-char zft_src[] __initdata = "$Source: /homes/cvs/ftape-stacked/ftape/zftape/zftape-init.c,v $";
-char zft_rev[] __initdata = "$Revision: 1.8 $";
-char zft_dat[] __initdata = "$Date: 1997/11/06 00:48:56 $";
-
MODULE_AUTHOR("(c) 1996, 1997 Claus-Justus Heine "
"(claus@momo.math.rwth-aachen.de)");
MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
@@ -278,15 +274,6 @@ int zft_cmpr_register(struct zft_cmpr_ops *new_ops)
}
}
-struct zft_cmpr_ops *zft_cmpr_unregister(void)
-{
- struct zft_cmpr_ops *old_ops = zft_cmpr_ops;
- TRACE_FUN(ft_t_flow);
-
- zft_cmpr_ops = NULL;
- TRACE_EXIT old_ops;
-}
-
/* lock the zft-compressor() module.
*/
int zft_cmpr_lock(int try_to_load)
diff --git a/drivers/char/ftape/zftape/zftape-init.h b/drivers/char/ftape/zftape/zftape-init.h
index 2145892b9eea7..937e5d48c20ec 100644
--- a/drivers/char/ftape/zftape/zftape-init.h
+++ b/drivers/char/ftape/zftape/zftape-init.h
@@ -70,7 +70,6 @@ extern struct zft_cmpr_ops *zft_cmpr_ops;
/* zftape-init.c defined global functions.
*/
extern int zft_cmpr_register(struct zft_cmpr_ops *new_ops);
-extern struct zft_cmpr_ops *zft_cmpr_unregister(void);
extern int zft_cmpr_lock(int try_to_load);
#endif
diff --git a/drivers/char/ftape/zftape/zftape-rw.c b/drivers/char/ftape/zftape/zftape-rw.c
index 4ff2548c517f2..a61ef50f3dfce 100644
--- a/drivers/char/ftape/zftape/zftape-rw.c
+++ b/drivers/char/ftape/zftape/zftape-rw.c
@@ -45,7 +45,6 @@ __u8 *zft_hseg_buf;
int zft_deblock_segment = -1;
zft_status_enum zft_io_state = zft_idle;
int zft_header_changed;
-int zft_bad_sector_map_changed;
int zft_qic113; /* conform to old specs. and old zftape */
int zft_use_compression;
zft_position zft_pos = {
diff --git a/drivers/char/ftape/zftape/zftape-rw.h b/drivers/char/ftape/zftape/zftape-rw.h
index 69678229e1c55..14c07f0865755 100644
--- a/drivers/char/ftape/zftape/zftape-rw.h
+++ b/drivers/char/ftape/zftape/zftape-rw.h
@@ -79,7 +79,6 @@ extern __u8 *zft_hseg_buf;
extern int zft_deblock_segment;
extern zft_status_enum zft_io_state;
extern int zft_header_changed;
-extern int zft_bad_sector_map_changed;
extern int zft_qic113; /* conform to old specs. and old zftape */
extern int zft_use_compression;
extern unsigned int zft_blk_sz;
diff --git a/drivers/char/ftape/zftape/zftape-vtbl.c b/drivers/char/ftape/zftape/zftape-vtbl.c
index 18c6b5fe9e6de..ad7f8be6340bd 100644
--- a/drivers/char/ftape/zftape/zftape-vtbl.c
+++ b/drivers/char/ftape/zftape/zftape-vtbl.c
@@ -62,7 +62,7 @@ static zft_volinfo tape_vtbl;
static zft_volinfo eot_vtbl;
static zft_volinfo *cur_vtbl;
-inline void zft_new_vtbl_entry(void)
+static inline void zft_new_vtbl_entry(void)
{
struct list_head *tmp = &zft_last_vtbl->node;
zft_volinfo *new = zft_kmalloc(sizeof(zft_volinfo));
@@ -248,7 +248,7 @@ static void create_zft_volume(__u8 *entry, zft_volinfo *vtbl)
* that buffer already contains the old volume-table, so that vtbl
* entries without the zft_volume flag set can savely be ignored.
*/
-void zft_create_volume_headers(__u8 *buffer)
+static void zft_create_volume_headers(__u8 *buffer)
{
__u8 *entry;
struct list_head *tmp;
diff --git a/drivers/char/ftape/zftape/zftape-vtbl.h b/drivers/char/ftape/zftape/zftape-vtbl.h
index 08e93d724fbca..f31d196d17594 100644
--- a/drivers/char/ftape/zftape/zftape-vtbl.h
+++ b/drivers/char/ftape/zftape/zftape-vtbl.h
@@ -152,7 +152,6 @@ extern int zft_volume_table_changed;
/* exported functions */
extern void zft_init_vtbl (void);
extern void zft_free_vtbl (void);
-extern void zft_new_vtbl_entry (void);
extern int zft_extract_volume_headers(__u8 *buffer);
extern int zft_update_volume_table (unsigned int segment);
extern int zft_open_volume (zft_position *pos,
diff --git a/drivers/char/ftape/zftape/zftape_syms.c b/drivers/char/ftape/zftape/zftape_syms.c
index 810171bb39116..2db1401682dfc 100644
--- a/drivers/char/ftape/zftape/zftape_syms.c
+++ b/drivers/char/ftape/zftape/zftape_syms.c
@@ -35,7 +35,6 @@
/* zftape-init.c */
EXPORT_SYMBOL(zft_cmpr_register);
-EXPORT_SYMBOL(zft_cmpr_unregister);
/* zftape-read.c */
EXPORT_SYMBOL(zft_fetch_segment_fraction);
/* zftape-buffers.c */
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index d95ad27cb4ec8..71435d1cb069e 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -279,7 +279,7 @@ int gs_chars_in_buffer(struct tty_struct *tty)
}
-int gs_real_chars_in_buffer(struct tty_struct *tty)
+static int gs_real_chars_in_buffer(struct tty_struct *tty)
{
struct gs_port *port;
func_enter ();
@@ -457,7 +457,7 @@ void gs_start(struct tty_struct * tty)
}
-void gs_shutdown_port (struct gs_port *port)
+static void gs_shutdown_port (struct gs_port *port)
{
unsigned long flags;
@@ -511,27 +511,6 @@ void gs_hangup(struct tty_struct *tty)
}
-void gs_do_softint(void *private_)
-{
- struct gs_port *port = private_;
- struct tty_struct *tty;
-
- func_enter ();
-
- if (!port) return;
-
- tty = port->tty;
-
- if (!tty) return;
-
- if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
- tty_wakeup(tty);
- wake_up_interruptible(&tty->write_wait);
- }
- func_exit ();
-}
-
-
int gs_block_til_ready(void *port_, struct file * filp)
{
struct gs_port *port = port_;
@@ -996,7 +975,6 @@ EXPORT_SYMBOL(gs_flush_chars);
EXPORT_SYMBOL(gs_stop);
EXPORT_SYMBOL(gs_start);
EXPORT_SYMBOL(gs_hangup);
-EXPORT_SYMBOL(gs_do_softint);
EXPORT_SYMBOL(gs_block_til_ready);
EXPORT_SYMBOL(gs_close);
EXPORT_SYMBOL(gs_set_termios);
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 266fe40022fea..fc02f72f013bb 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -95,7 +95,7 @@ static void gen_rtc_timer(unsigned long data);
static volatile int stask_active; /* schedule_work */
static volatile int ttask_active; /* timer_task */
static int stop_rtc_timers; /* don't requeue tasks */
-static spinlock_t gen_rtc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(gen_rtc_lock);
static void gen_rtc_interrupt(unsigned long arg);
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index ca7d88a6e3042..a266632e9b70b 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -52,9 +52,9 @@
static u32 hpet_ntimer, hpet_nhpet, hpet_max_freq = HPET_USER_FREQ;
/* A lock for concurrent access by app and isr hpet activity. */
-static spinlock_t hpet_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hpet_lock);
/* A lock for concurrent intermodule access to hpet and isr hpet activity. */
-static spinlock_t hpet_task_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hpet_task_lock);
#define HPET_DEV_NAME (7)
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 9d7682c825096..88cd858f74d0d 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -94,7 +94,7 @@ static struct list_head hvc_structs = LIST_HEAD_INIT(hvc_structs);
* Protect the list of hvc_struct instances from inserts and removals during
* list traversal.
*/
-static spinlock_t hvc_structs_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hvc_structs_lock);
/*
* Initial console vtermnos for console API usage prior to full console
@@ -629,7 +629,7 @@ static int __devinit hvc_probe(
kobject_init(&hp->kobj);
hp->kobj.ktype = &hvc_kobj_type;
- hp->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hp->lock);
spin_lock(&hvc_structs_lock);
hp->index = ++hvc_count;
list_add_tail(&(hp->next), &hvc_structs);
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c
index c60528082bc4d..0d01151999a09 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -257,7 +257,7 @@ static struct task_struct *hvcs_task;
static unsigned long *hvcs_pi_buff;
/* Only allow one hvcs_struct to use the hvcs_pi_buff at a time. */
-static spinlock_t hvcs_pi_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hvcs_pi_lock);
/* One vty-server per hvcs_struct */
struct hvcs_struct {
@@ -308,7 +308,7 @@ struct hvcs_struct {
#define from_kobj(kobj) container_of(kobj, struct hvcs_struct, kobj)
static struct list_head hvcs_structs = LIST_HEAD_INIT(hvcs_structs);
-static spinlock_t hvcs_structs_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hvcs_structs_lock);
static void hvcs_unthrottle(struct tty_struct *tty);
static void hvcs_throttle(struct tty_struct *tty);
@@ -631,7 +631,7 @@ static int __devinit hvcs_probe(
/* hvcsd->tty is zeroed out with the memset */
memset(hvcsd, 0x00, sizeof(*hvcsd));
- hvcsd->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hvcsd->lock);
/* Automatically incs the refcount the first time */
kobject_init(&hvcsd->kobj);
/* Set up the callback for terminating the hvcs_struct's life */
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 35babe64436c3..07d7e212bb187 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1331,7 +1331,7 @@ static int __init hvsi_console_init(void)
INIT_WORK(&hp->handshaker, hvsi_handshaker, hp);
init_waitqueue_head(&hp->emptyq);
init_waitqueue_head(&hp->stateq);
- hp->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hp->lock);
hp->index = hvsi_count;
hp->inbuf_end = hp->inbuf;
hp->state = HVSI_CLOSED;
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c
index 143cec829e770..7e6ac14c2450d 100644
--- a/drivers/char/hw_random.c
+++ b/drivers/char/hw_random.c
@@ -482,7 +482,7 @@ static int rng_dev_open (struct inode *inode, struct file *filp)
static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
loff_t * offp)
{
- static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(rng_lock);
unsigned int have_data;
u32 data = 0;
ssize_t ret = 0;
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 2ed14fd57e32c..30ddedd57bec3 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -304,7 +304,7 @@ static DECLARE_RWSEM(interfaces_sem);
/* Directly protects the ipmi_interfaces data structure. This is
claimed in the timer interrupt. */
-static spinlock_t interfaces_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(interfaces_lock);
/* List of watchers that want to know when smi's are added and
deleted. */
@@ -3038,9 +3038,9 @@ static int panic_event(struct notifier_block *this,
}
static struct notifier_block panic_block = {
- panic_event,
- NULL,
- 200 /* priority: INT_MAX >= x >= 0 */
+ .notifier_call = panic_event,
+ .next = NULL,
+ .priority = 200 /* priority: INT_MAX >= x >= 0 */
};
static int ipmi_init_msghandler(void)
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index c7ffa06a04dea..cb5cdc6f14bf0 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -381,11 +381,17 @@ struct poweroff_function {
};
static struct poweroff_function poweroff_functions[] = {
- { "ATCA", ipmi_atca_detect, ipmi_poweroff_atca },
- { "CPI1", ipmi_cpi1_detect, ipmi_poweroff_cpi1 },
+ { .platform_type = "ATCA",
+ .detect = ipmi_atca_detect,
+ .poweroff_func = ipmi_poweroff_atca },
+ { .platform_type = "CPI1",
+ .detect = ipmi_cpi1_detect,
+ .poweroff_func = ipmi_poweroff_cpi1 },
/* Chassis should generally be last, other things should override
it. */
- { "chassis", ipmi_chassis_detect, ipmi_poweroff_chassis },
+ { .platform_type = "chassis",
+ .detect = ipmi_chassis_detect,
+ .poweroff_func = ipmi_poweroff_chassis },
};
#define NUM_PO_FUNCS (sizeof(poweroff_functions) \
/ sizeof(struct poweroff_function))
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 6655ab92b03a0..7e83d48fd759e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -959,7 +959,7 @@ MODULE_PARM_DESC(regshifts, "The amount to shift the data read from the."
#define IPMI_MEM_ADDR_SPACE 1
#define IPMI_IO_ADDR_SPACE 2
-#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI)
+#if defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_X86) || defined(CONFIG_PCI)
static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr)
{
int i;
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 1fe79d5bdc845..fd7093879c660 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -157,7 +157,7 @@ static char preaction[16] = "pre_none";
static unsigned char preop_val = WDOG_PREOP_NONE;
static char preop[16] = "preop_none";
-static spinlock_t ipmi_read_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ipmi_read_lock);
static char data_to_read = 0;
static DECLARE_WAIT_QUEUE_HEAD(read_q);
static struct fasync_struct *fasync_q = NULL;
@@ -504,9 +504,9 @@ static void panic_halt_ipmi_heartbeat(void)
static struct watchdog_info ident=
{
- 0, /* WDIOF_SETTIMEOUT, */
- 1,
- "IPMI"
+ .options = 0, /* WDIOF_SETTIMEOUT, */
+ .firmware_version = 1,
+ .identity = "IPMI"
};
static int ipmi_ioctl(struct inode *inode, struct file *file,
@@ -734,9 +734,9 @@ static struct file_operations ipmi_wdog_fops = {
};
static struct miscdevice ipmi_wdog_miscdev = {
- WATCHDOG_MINOR,
- "watchdog",
- &ipmi_wdog_fops
+ .minor = WATCHDOG_MINOR,
+ .name = "watchdog",
+ .fops = &ipmi_wdog_fops
};
static DECLARE_RWSEM(register_sem);
@@ -871,9 +871,9 @@ static int wdog_reboot_handler(struct notifier_block *this,
}
static struct notifier_block wdog_reboot_notifier = {
- wdog_reboot_handler,
- NULL,
- 0
+ .notifier_call = wdog_reboot_handler,
+ .next = NULL,
+ .priority = 0
};
static int wdog_panic_handler(struct notifier_block *this,
@@ -899,9 +899,9 @@ static int wdog_panic_handler(struct notifier_block *this,
}
static struct notifier_block wdog_panic_notifier = {
- wdog_panic_handler,
- NULL,
- 150 /* priority: INT_MAX >= x >= 0 */
+ .notifier_call = wdog_panic_handler,
+ .next = NULL,
+ .priority = 150 /* priority: INT_MAX >= x >= 0 */
};
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index b3f40fe9dafda..2ccde4de37cc2 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -16,10 +16,81 @@
*
* 10/6/99 sameer Merged the ISA and PCI drivers to
* a new unified driver.
+ *
+ * 3/9/99 sameer Added support for ISI4616 cards.
+ *
+ * 16/9/99 sameer We do not force RTS low anymore.
+ * This is to prevent the firmware
+ * from getting confused.
+ *
+ * 26/10/99 sameer Cosmetic changes:The driver now
+ * dumps the Port Count information
+ * along with I/O address and IRQ.
+ *
+ * 13/12/99 sameer Fixed the problem with IRQ sharing.
+ *
+ * 10/5/00 sameer Fixed isicom_shutdown_board()
+ * to not lower DTR on all the ports
+ * when the last port on the card is
+ * closed.
+ *
+ * 10/5/00 sameer Signal mask setup command added
+ * to isicom_setup_port and
+ * isicom_shutdown_port.
+ *
+ * 24/5/00 sameer The driver is now SMP aware.
+ *
+ *
+ * 27/11/00 Vinayak P Risbud Fixed the Driver Crash Problem
+ *
+ *
+ * 03/01/01 anil .s Added support for resetting the
+ * internal modems on ISI cards.
+ *
+ * 08/02/01 anil .s Upgraded the driver for kernel
+ * 2.4.x
+ *
+ * 11/04/01 Kevin Fixed firmware load problem with
+ * ISIHP-4X card
+ *
+ * 30/04/01 anil .s Fixed the remote login through
+ * ISI port problem. Now the link
+ * does not go down before password
+ * prompt.
+ *
+ * 03/05/01 anil .s Fixed the problem with IRQ sharing
+ * among ISI-PCI cards.
+ *
+ * 03/05/01 anil .s Added support to display the version
+ * info during insmod as well as module
+ * listing by lsmod.
+ *
+ * 10/05/01 anil .s Done the modifications to the source
+ * file and Install script so that the
+ * same installation can be used for
+ * 2.2.x and 2.4.x kernel.
+ *
+ * 06/06/01 anil .s Now we drop both dtr and rts during
+ * shutdown_port as well as raise them
+ * during isicom_config_port.
+ *
* 09/06/01 acme@conectiva.com.br use capable, not suser, do
* restore_flags on failure in
* isicom_send_break, verify put_user
* result
+ *
+ * 11/02/03 ranjeeth Added support for 230 Kbps and 460 Kbps
+ * Baud index extended to 21
+ *
+ * 20/03/03 ranjeeth Made to work for Linux Advanced server.
+ * Taken care of license warning.
+ *
+ * 10/12/03 Ravindra Made to work for Fedora Core 1 of
+ * Red Hat Distribution
+ *
+ * 06/01/05 Alan Cox Merged the ISI and base kernel strands
+ * into a single 2.6 driver
+ *
* ***********************************************************
*
* To use this driver you also need the support package. You
@@ -35,6 +106,10 @@
*
* Omit those entries for boards you don't have installed.
*
+ * TODO
+ * Hotplug
+ * Merge testing
+ * 64-bit verification
*/
#include <linux/module.h>
@@ -74,7 +149,6 @@ static struct pci_device_id isicom_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, isicom_pci_tbl);
static int prev_card = 3; /* start servicing isi_card[0] */
-static struct isi_board * irq_to_board[16];
static struct tty_driver *isicom_normal;
static struct isi_board isi_card[BOARD_COUNT];
@@ -101,9 +175,205 @@ static signed char linuxb_to_isib[] = {
18, 19
};
+struct isi_board {
+ unsigned short base;
+ unsigned char irq;
+ unsigned char port_count;
+ unsigned short status;
+ unsigned short port_status; /* each bit represents a single port */
+ unsigned short shift_count;
+ struct isi_port * ports;
+ signed char count;
+ unsigned char isa;
+ spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */
+ unsigned long flags;
+};
+
+struct isi_port {
+ unsigned short magic;
+ unsigned int flags;
+ int count;
+ int blocked_open;
+ int close_delay;
+ unsigned short channel;
+ unsigned short status;
+ unsigned short closing_wait;
+ struct isi_board * card;
+ struct tty_struct * tty;
+ wait_queue_head_t close_wait;
+ wait_queue_head_t open_wait;
+ struct work_struct hangup_tq;
+ struct work_struct bh_tqueue;
+ unsigned char * xmit_buf;
+ int xmit_head;
+ int xmit_tail;
+ int xmit_cnt;
+};
+
+/*
+ * Locking functions for card level locking. We need to own both
+ * the kernel lock for the card and have the card in a position that
+ * it wants to talk.
+ */
+
+static int lock_card(struct isi_board *card)
+{
+ char retries;
+ unsigned short base = card->base;
+
+ for (retries = 0; retries < 100; retries++) {
+ spin_lock_irqsave(&card->card_lock, card->flags);
+ if (inw(base + 0xe) & 0x1) {
+ return 1;
+ } else {
+ spin_unlock_irqrestore(&card->card_lock, card->flags);
+ udelay(1000); /* 1ms */
+ }
+ }
+ printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%x)\n", card->base);
+ return 0; /* Failed to aquire the card! */
+}
+
+static int lock_card_at_interrupt(struct isi_board *card)
+{
+ unsigned char retries;
+ unsigned short base = card->base;
+
+ for (retries = 0; retries < 200; retries++) {
+ spin_lock_irqsave(&card->card_lock, card->flags);
+
+ if (inw(base + 0xe) & 0x1)
+ return 1;
+ else
+ spin_unlock_irqrestore(&card->card_lock, card->flags);
+ }
+ /* Failing in interrupt is an acceptable event */
+ return 0; /* Failed to aquire the card! */
+}
+
+static void unlock_card(struct isi_board *card)
+{
+ spin_unlock_irqrestore(&card->card_lock, card->flags);
+}
+
+/*
+ * ISI Card specific ops ...
+ */
+
+static void raise_dtr(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0504, base);
+ InterruptTheCard(base);
+ port->status |= ISI_DTR;
+ unlock_card(card);
+}
+
+static inline void drop_dtr(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0404, base);
+ InterruptTheCard(base);
+ port->status &= ~ISI_DTR;
+ unlock_card(card);
+}
+
+static inline void raise_rts(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0a04, base);
+ InterruptTheCard(base);
+ port->status |= ISI_RTS;
+ unlock_card(card);
+}
+static inline void drop_rts(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0804, base);
+ InterruptTheCard(base);
+ port->status &= ~ISI_RTS;
+ unlock_card(card);
+}
+
+static inline void raise_dtr_rts(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0f04, base);
+ InterruptTheCard(base);
+ port->status |= (ISI_DTR | ISI_RTS);
+ unlock_card(card);
+}
+
+static void drop_dtr_rts(struct isi_port * port)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw(0x0c04, base);
+ InterruptTheCard(base);
+ port->status &= ~(ISI_RTS | ISI_DTR);
+ unlock_card(card);
+}
+
+static inline void kill_queue(struct isi_port * port, short queue)
+{
+ struct isi_board * card = port->card;
+ unsigned short base = card->base;
+ unsigned char channel = port->channel;
+
+ if (!lock_card(card))
+ return;
+
+ outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
+ outw((queue << 8) | 0x06, base);
+ InterruptTheCard(base);
+ unlock_card(card);
+}
+
+
/*
- * Firmware loader driver specific routines
- *
+ * Firmware loader driver specific routines. This needs to mostly die
+ * and be replaced with request_firmware.
*/
static struct file_operations ISILoad_fops = {
@@ -354,15 +624,19 @@ static inline int isicom_paranoia_check(struct isi_port const * port, char *name
return 0;
}
-/* Transmitter */
+/*
+ * Transmitter.
+ *
+ * We shovel data into the card buffers on a regular basis. The card
+ * will do the rest of the work for us.
+ */
static void isicom_tx(unsigned long _data)
{
short count = (BOARD_COUNT-1), card, base;
- short txcount, wait, wrd, residue, word_count, cnt;
+ short txcount, wrd, residue, word_count, cnt;
struct isi_port * port;
struct tty_struct * tty;
- unsigned long flags;
#ifdef ISICOM_DEBUG
++tx_count;
@@ -384,33 +658,29 @@ static void isicom_tx(unsigned long _data)
port = isi_card[card].ports;
base = isi_card[card].base;
for (;count > 0;count--, port++) {
+ if (!lock_card_at_interrupt(&isi_card[card]))
+ continue;
/* port not active or tx disabled to force flow control */
- if (!(port->status & ISI_TXOK))
+ if (!(port->flags & ASYNC_INITIALIZED) ||
+ !(port->status & ISI_TXOK))
+ unlock_card(&isi_card[card]);
continue;
tty = port->tty;
- save_flags(flags); cli();
- txcount = min_t(short, TX_SIZE, port->xmit_cnt);
- if ((txcount <= 0) || tty->stopped || tty->hw_stopped) {
- restore_flags(flags);
+
+
+ if(tty == NULL) {
+ unlock_card(&isi_card[card]);
continue;
}
- wait = 200;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- restore_flags(flags);
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_tx:Card(0x%x) found busy.\n",
- card);
-#endif
+
+ txcount = min_t(short, TX_SIZE, port->xmit_cnt);
+ if (txcount <= 0 || tty->stopped || tty->hw_stopped) {
+ unlock_card(&isi_card[card]);
continue;
}
if (!(inw(base + 0x02) & (1 << port->channel))) {
- restore_flags(flags);
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_tx: cannot tx to 0x%x:%d.\n",
- base, port->channel + 1);
-#endif
+ unlock_card(&isi_card[card]);
continue;
}
#ifdef ISICOM_DEBUG
@@ -459,10 +729,10 @@ static void isicom_tx(unsigned long _data)
port->status &= ~ISI_TXOK;
if (port->xmit_cnt <= WAKEUP_CHARS)
schedule_work(&port->bh_tqueue);
- restore_flags(flags);
+ unlock_card(&isi_card[card]);
}
- /* schedule another tx for hopefully in about 10ms */
+ /* schedule another tx for hopefully in about 10ms */
sched_again:
if (!re_schedule)
return;
@@ -490,7 +760,10 @@ static void isicom_bottomhalf(void * data)
wake_up_interruptible(&tty->write_wait);
}
-/* main interrupt handler routine */
+/*
+ * Main interrupt handler routine
+ */
+
static irqreturn_t isicom_interrupt(int irq, void *dev_id,
struct pt_regs *regs)
{
@@ -501,31 +774,19 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
unsigned char channel;
short byte_count;
- /*
- * find the source of interrupt
- */
-
- for(count = 0; count < BOARD_COUNT; count++) {
- card = &isi_card[count];
- if (card->base != 0) {
- if (((card->isa == YES) && (card->irq == irq)) ||
- ((card->isa == NO) && (card->irq == irq) && (inw(card->base+0x0e) & 0x02)))
- break;
- }
- card = NULL;
- }
+ card = (struct isi_board *) dev_id;
- if (!card || !(card->status & FIRMWARE_LOADED)) {
-/* printk(KERN_DEBUG "ISICOM: interrupt: not handling irq%d!.\n", irq);*/
+ if (!card || !(card->status & FIRMWARE_LOADED))
return IRQ_NONE;
- }
base = card->base;
+ spin_lock(&card->card_lock);
+
if (card->isa == NO) {
- /*
- * disable any interrupts from the PCI card and lower the
- * interrupt line
- */
+ /*
+ * disable any interrupts from the PCI card and lower the
+ * interrupt line
+ */
outw(0x8000, base+0x04);
ClearInterrupt(base);
}
@@ -534,16 +795,15 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
header = inw(base);
channel = (header & 0x7800) >> card->shift_count;
byte_count = header & 0xff;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM:Intr:(0x%x:%d).\n", base, channel+1);
-#endif
- if ((channel+1) > card->port_count) {
+
+ if (channel + 1 > card->port_count) {
printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%x): %d(channel) > port_count.\n",
base, channel+1);
if (card->isa)
ClearInterrupt(base);
else
outw(0x0000, base+0x04); /* enable interrupts */
+ spin_unlock(&card->card_lock);
return IRQ_HANDLED;
}
port = card->ports + channel;
@@ -556,6 +816,21 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
}
tty = port->tty;
+ if (tty == NULL) {
+ word_count = byte_count >> 1;
+ while(byte_count > 1) {
+ inw(base);
+ byte_count -= 2;
+ }
+ if (byte_count & 0x01)
+ inw(base);
+ if (card->isa == YES)
+ ClearInterrupt(base);
+ else
+ outw(0x0000, base+0x04); /* enable interrupts */
+ spin_unlock(&card->card_lock);
+ return IRQ_HANDLED;
+ }
if (header & 0x8000) { /* Status Packet */
header = inw(base);
@@ -631,7 +906,6 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
if (tty->flip.count >= TTY_FLIPBUF_SIZE)
break;
*tty->flip.flag_buf_ptr++ = TTY_BREAK;
- /* dunno if this is right */
*tty->flip.char_buf_ptr++ = 0;
tty->flip.count++;
if (port->flags & ASYNC_SAK)
@@ -683,13 +957,12 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id,
return IRQ_HANDLED;
}
- /* called with interrupts disabled */
static void isicom_config_port(struct isi_port * port)
{
struct isi_board * card = port->card;
struct tty_struct * tty;
unsigned long baud;
- unsigned short channel_setup, wait, base = card->base;
+ unsigned short channel_setup, base = card->base;
unsigned short channel = port->channel, shift_count = card->shift_count;
unsigned char flow_ctrl;
@@ -729,40 +1002,36 @@ static void isicom_config_port(struct isi_port * port)
else
raise_dtr(port);
- wait = 100;
- while (((inw(base + 0x0e) & 0x0001) == 0) && (wait-- > 0));
- if (!wait) {
- printk(KERN_WARNING "ISICOM: Card found busy in isicom_config_port at channel setup.\n");
- return;
- }
- outw(0x8000 | (channel << shift_count) |0x03, base);
- outw(linuxb_to_isib[baud] << 8 | 0x03, base);
- channel_setup = 0;
- switch(C_CSIZE(tty)) {
- case CS5:
- channel_setup |= ISICOM_CS5;
- break;
- case CS6:
- channel_setup |= ISICOM_CS6;
- break;
- case CS7:
- channel_setup |= ISICOM_CS7;
- break;
- case CS8:
- channel_setup |= ISICOM_CS8;
- break;
- }
-
- if (C_CSTOPB(tty))
- channel_setup |= ISICOM_2SB;
-
- if (C_PARENB(tty))
- channel_setup |= ISICOM_EVPAR;
- if (C_PARODD(tty))
- channel_setup |= ISICOM_ODPAR;
- outw(channel_setup, base);
- InterruptTheCard(base);
-
+ if (lock_card(card)) {
+ outw(0x8000 | (channel << shift_count) |0x03, base);
+ outw(linuxb_to_isib[baud] << 8 | 0x03, base);
+ channel_setup = 0;
+ switch(C_CSIZE(tty)) {
+ case CS5:
+ channel_setup |= ISICOM_CS5;
+ break;
+ case CS6:
+ channel_setup |= ISICOM_CS6;
+ break;
+ case CS7:
+ channel_setup |= ISICOM_CS7;
+ break;
+ case CS8:
+ channel_setup |= ISICOM_CS8;
+ break;
+ }
+
+ if (C_CSTOPB(tty))
+ channel_setup |= ISICOM_2SB;
+ if (C_PARENB(tty)) {
+ channel_setup |= ISICOM_EVPAR;
+ if (C_PARODD(tty))
+ channel_setup |= ISICOM_ODPAR;
+ }
+ outw(channel_setup, base);
+ InterruptTheCard(base);
+ unlock_card(card);
+ }
if (C_CLOCAL(tty))
port->flags &= ~ASYNC_CHECK_CD;
else
@@ -780,23 +1049,19 @@ static void isicom_config_port(struct isi_port * port)
if (I_IXOFF(tty))
flow_ctrl |= ISICOM_INITIATE_XONXOFF;
- wait = 100;
- while (((inw(base + 0x0e) & 0x0001) == 0) && (wait-- > 0));
- if (!wait) {
- printk(KERN_WARNING "ISICOM: Card found busy in isicom_config_port at flow setup.\n");
- return;
- }
- outw(0x8000 | (channel << shift_count) |0x04, base);
- outw(flow_ctrl << 8 | 0x05, base);
- outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base);
- InterruptTheCard(base);
+ if (lock_card(card)) {
+ outw(0x8000 | (channel << shift_count) |0x04, base);
+ outw(flow_ctrl << 8 | 0x05, base);
+ outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base);
+ InterruptTheCard(base);
+ unlock_card(card);
+ }
/* rx enabled -> enable port for rx on the card */
if (C_CREAD(tty)) {
card->port_status |= (1 << channel);
outw(card->port_status, base + 0x02);
}
-
}
/* open et all */
@@ -807,22 +1072,16 @@ static inline void isicom_setup_board(struct isi_board * bp)
struct isi_port * port;
unsigned long flags;
- if (bp->status & BOARD_ACTIVE)
+ spin_lock_irqsave(&bp->card_lock, flags);
+ if (bp->status & BOARD_ACTIVE) {
+ spin_unlock_irqrestore(&bp->card_lock, flags);
return;
- port = bp->ports;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: setup_board: drop_dtr_rts start, port_count %d...\n", bp->port_count);
-#endif
- for(channel = 0; channel < bp->port_count; channel++, port++) {
- save_flags(flags); cli();
- drop_dtr_rts(port);
- restore_flags(flags);
}
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: setup_board: drop_dtr_rts stop...\n");
-#endif
-
+ port = bp->ports;
bp->status |= BOARD_ACTIVE;
+ spin_unlock_irqrestore(&bp->card_lock, flags);
+ for(channel = 0; channel < bp->port_count; channel++, port++)
+ drop_dtr_rts(port);
return;
}
@@ -831,8 +1090,9 @@ static int isicom_setup_port(struct isi_port * port)
struct isi_board * card = port->card;
unsigned long flags;
- if (port->flags & ASYNC_INITIALIZED)
+ if (port->flags & ASYNC_INITIALIZED) {
return 0;
+ }
if (!port->xmit_buf) {
unsigned long page;
@@ -845,7 +1105,8 @@ static int isicom_setup_port(struct isi_port * port)
}
port->xmit_buf = (unsigned char *) page;
}
- save_flags(flags); cli();
+
+ spin_lock_irqsave(&card->card_lock, flags);
if (port->tty)
clear_bit(TTY_IO_ERROR, &port->tty->flags);
if (port->count == 1)
@@ -858,15 +1119,16 @@ static int isicom_setup_port(struct isi_port * port)
isicom_config_port(port);
port->flags |= ASYNC_INITIALIZED;
-
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->card_lock, flags);
return 0;
}
static int block_til_ready(struct tty_struct * tty, struct file * filp, struct isi_port * port)
{
+ struct isi_board * card = port->card;
int do_clocal = 0, retval;
+ unsigned long flags;
DECLARE_WAITQUEUE(wait, current);
/* block if port is in the process of being closed */
@@ -894,49 +1156,34 @@ static int block_til_ready(struct tty_struct * tty, struct file * filp, struct i
if (C_CLOCAL(tty))
do_clocal = 1;
-#ifdef ISICOM_DEBUG
- if (do_clocal)
- printk(KERN_DEBUG "ISICOM: block_til_ready: CLOCAL set.\n");
-#endif
/* block waiting for DCD to be asserted, and while
callout dev is busy */
retval = 0;
add_wait_queue(&port->open_wait, &wait);
- cli();
- if (!tty_hung_up_p(filp))
- port->count--;
- sti();
+
+ spin_lock_irqsave(&card->card_lock, flags);
+ if (!tty_hung_up_p(filp))
+ port->count--;
port->blocked_open++;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: block_til_ready: waiting for DCD...\n");
-#endif
+ spin_unlock_irqrestore(&card->card_lock, flags);
+
while (1) {
- cli();
raise_dtr_rts(port);
- sti();
+
set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) {
if (port->flags & ASYNC_HUP_NOTIFY)
retval = -EAGAIN;
else
retval = -ERESTARTSYS;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: block_til_ready: tty_hung_up_p || not init.\n");
-#endif
break;
}
if (!(port->flags & ASYNC_CLOSING) &&
(do_clocal || (port->status & ISI_DCD))) {
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: block_til_ready: do_clocal || DCD.\n");
-#endif
break;
}
if (signal_pending(current)) {
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: block_til_ready: sig blocked.\n");
-#endif
retval = -ERESTARTSYS;
break;
}
@@ -944,9 +1191,11 @@ static int block_til_ready(struct tty_struct * tty, struct file * filp, struct i
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&port->open_wait, &wait);
+ spin_lock_irqsave(&card->card_lock, flags);
if (!tty_hung_up_p(filp))
port->count++;
port->blocked_open--;
+ spin_unlock_irqrestore(&card->card_lock, flags);
if (retval)
return retval;
port->flags |= ASYNC_NORMAL_ACTIVE;
@@ -960,62 +1209,33 @@ static int isicom_open(struct tty_struct * tty, struct file * filp)
unsigned int line, board;
int error;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: open start!!!.\n");
-#endif
line = tty->index;
-
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "line = %d.\n", line);
-#endif
-
- if ((line < 0) || (line > (PORT_COUNT-1)))
+ if (line < 0 || line > PORT_COUNT-1)
return -ENODEV;
board = BOARD(line);
-
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "board = %d.\n", board);
-#endif
-
card = &isi_card[board];
- if (!(card->status & FIRMWARE_LOADED)) {
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG"ISICOM: Firmware not loaded to card%d.\n", board);
-#endif
+
+ if (!(card->status & FIRMWARE_LOADED))
return -ENODEV;
- }
/* open on a port greater than the port count for the card !!! */
- if (line > ((board * 16) + card->port_count - 1)) {
- printk(KERN_ERR "ISICOM: Open on a port which exceeds the port_count of the card!\n");
+ if (line > ((board * 16) + card->port_count - 1))
return -ENODEV;
- }
+
port = &isi_ports[line];
if (isicom_paranoia_check(port, tty->name, "isicom_open"))
return -ENODEV;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_setup_board ...\n");
-#endif
isicom_setup_board(card);
port->count++;
tty->driver_data = port;
port->tty = tty;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_setup_port ...\n");
-#endif
if ((error = isicom_setup_port(port))!=0)
return error;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: block_til_ready ...\n");
-#endif
if ((error = block_til_ready(tty, filp, port))!=0)
return error;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: open end!!!.\n");
-#endif
return 0;
}
@@ -1023,38 +1243,50 @@ static int isicom_open(struct tty_struct * tty, struct file * filp)
static inline void isicom_shutdown_board(struct isi_board * bp)
{
- int channel;
- struct isi_port * port;
-
- if (!(bp->status & BOARD_ACTIVE))
- return;
- bp->status &= ~BOARD_ACTIVE;
- port = bp->ports;
- for(channel = 0; channel < bp->port_count; channel++, port++) {
- drop_dtr_rts(port);
- }
+ unsigned long flags;
+
+ spin_lock_irqsave(&bp->card_lock, flags);
+ if (bp->status & BOARD_ACTIVE) {
+ bp->status &= ~BOARD_ACTIVE;
+ }
+ spin_unlock_irqrestore(&bp->card_lock, flags);
}
static void isicom_shutdown_port(struct isi_port * port)
{
struct isi_board * card = port->card;
struct tty_struct * tty;
+ unsigned long flags;
- if (!(port->flags & ASYNC_INITIALIZED))
+ tty = port->tty;
+
+ spin_lock_irqsave(&card->card_lock, flags);
+ if (!(port->flags & ASYNC_INITIALIZED)) {
+ spin_unlock_irqrestore(&card->card_lock, flags);
return;
+ }
if (port->xmit_buf) {
free_page((unsigned long) port->xmit_buf);
port->xmit_buf = NULL;
}
- if (!(tty = port->tty) || C_HUPCL(tty))
+ port->flags &= ~ASYNC_INITIALIZED;
+ /* 3rd October 2000 : Vinayak P Risbud */
+ port->tty = 0;
+ spin_unlock_irqrestore(&card->card_lock, flags);
+
+ /*Fix done by Anil .S on 30-04-2001
+ remote login through isi port has dtr toggle problem
+ due to which the carrier drops before the password prompt
+ appears on the remote end. Now we drop the dtr only if the
+ HUPCL(Hangup on close) flag is set for the tty*/
+
+ if (C_HUPCL(tty))
/* drop dtr on this port */
drop_dtr(port);
/* any other port uninits */
-
if (tty)
set_bit(TTY_IO_ERROR, &tty->flags);
- port->flags &= ~ASYNC_INITIALIZED;
if (--card->count < 0) {
printk(KERN_DEBUG "ISICOM: isicom_shutdown_port: bad board(0x%x) count %d.\n",
@@ -1063,8 +1295,10 @@ static void isicom_shutdown_port(struct isi_port * port)
}
/* last port was closed , shutdown that boad too */
- if (!card->count)
- isicom_shutdown_board(card);
+ if(C_HUPCL(tty)) {
+ if (!card->count)
+ isicom_shutdown_board(card);
+ }
}
static void isicom_close(struct tty_struct * tty, struct file * filp)
@@ -1082,13 +1316,13 @@ static void isicom_close(struct tty_struct * tty, struct file * filp)
printk(KERN_DEBUG "ISICOM: Close start!!!.\n");
#endif
- save_flags(flags); cli();
+ spin_lock_irqsave(&card->card_lock, flags);
if (tty_hung_up_p(filp)) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->card_lock, flags);
return;
}
- if ((tty->count == 1) && (port->count != 1)) {
+ if (tty->count == 1 && port->count != 1) {
printk(KERN_WARNING "ISICOM:(0x%x) isicom_close: bad port count"
"tty->count = 1 port count = %d.\n",
card->base, port->count);
@@ -1102,41 +1336,46 @@ static void isicom_close(struct tty_struct * tty, struct file * filp)
}
if (port->count) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->card_lock, flags);
return;
}
port->flags |= ASYNC_CLOSING;
tty->closing = 1;
+ spin_unlock_irqrestore(&card->card_lock, flags);
+
if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
tty_wait_until_sent(tty, port->closing_wait);
/* indicate to the card that no more data can be received
on this port */
+ spin_lock_irqsave(&card->card_lock, flags);
if (port->flags & ASYNC_INITIALIZED) {
card->port_status &= ~(1 << port->channel);
outw(card->port_status, card->base + 0x02);
}
isicom_shutdown_port(port);
+ spin_unlock_irqrestore(&card->card_lock, flags);
+
if (tty->driver->flush_buffer)
tty->driver->flush_buffer(tty);
-
tty_ldisc_flush(tty);
+
+ spin_lock_irqsave(&card->card_lock, flags);
tty->closing = 0;
- port->tty = NULL;
+
if (port->blocked_open) {
+ spin_unlock_irqrestore(&card->card_lock, flags);
if (port->close_delay) {
#ifdef ISICOM_DEBUG
printk(KERN_DEBUG "ISICOM: scheduling until time out.\n");
#endif
msleep_interruptible(jiffies_to_msecs(port->close_delay));
}
+ spin_lock_irqsave(&card->card_lock, flags);
wake_up_interruptible(&port->open_wait);
}
port->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
wake_up_interruptible(&port->close_wait);
- restore_flags(flags);
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: Close end!!!.\n");
-#endif
+ spin_unlock_irqrestore(&card->card_lock, flags);
}
/* write et all */
@@ -1144,21 +1383,19 @@ static int isicom_write(struct tty_struct * tty,
const unsigned char * buf, int count)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
+ struct isi_board * card = port->card;
unsigned long flags;
int cnt, total = 0;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_write for port%d: %d bytes.\n",
- port->channel+1, count);
-#endif
+
if (isicom_paranoia_check(port, tty->name, "isicom_write"))
return 0;
if (!tty || !port->xmit_buf || !tmp_buf)
return 0;
- save_flags(flags);
+ spin_lock_irqsave(&card->card_lock, flags);
+
while(1) {
- cli();
cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
SERIAL_XMIT_SIZE - port->xmit_head));
if (cnt <= 0)
@@ -1167,17 +1404,13 @@ static int isicom_write(struct tty_struct * tty,
memcpy(port->xmit_buf + port->xmit_head, buf, cnt);
port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE - 1);
port->xmit_cnt += cnt;
- restore_flags(flags);
buf += cnt;
count -= cnt;
total += cnt;
}
if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped)
port->status |= ISI_TXOK;
- restore_flags(flags);
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: isicom_write %d bytes written.\n", total);
-#endif
+ spin_unlock_irqrestore(&card->card_lock, flags);
return total;
}
@@ -1185,6 +1418,7 @@ static int isicom_write(struct tty_struct * tty,
static void isicom_put_char(struct tty_struct * tty, unsigned char ch)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
+ struct isi_board * card = port->card;
unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
@@ -1192,21 +1426,17 @@ static void isicom_put_char(struct tty_struct * tty, unsigned char ch)
if (!tty || !port->xmit_buf)
return;
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: put_char, port %d, char %c.\n", port->channel+1, ch);
-#endif
-
- save_flags(flags); cli();
-
- if (port->xmit_cnt >= (SERIAL_XMIT_SIZE - 1)) {
- restore_flags(flags);
+
+ spin_lock_irqsave(&card->card_lock, flags);
+ if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
+ spin_unlock_irqrestore(&card->card_lock, flags);
return;
}
port->xmit_buf[port->xmit_head++] = ch;
port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
port->xmit_cnt++;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->card_lock, flags);
}
/* flush_chars et all */
@@ -1217,8 +1447,7 @@ static void isicom_flush_chars(struct tty_struct * tty)
if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars"))
return;
- if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
- !port->xmit_buf)
+ if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !port->xmit_buf)
return;
/* this tells the transmitter to consider this port for
@@ -1231,6 +1460,7 @@ static int isicom_write_room(struct tty_struct * tty)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
int free;
+
if (isicom_paranoia_check(port, tty->name, "isicom_write_room"))
return 0;
@@ -1253,21 +1483,17 @@ static int isicom_chars_in_buffer(struct tty_struct * tty)
static inline void isicom_send_break(struct isi_port * port, unsigned long length)
{
struct isi_board * card = port->card;
- short wait = 10;
unsigned short base = card->base;
- unsigned long flags;
- save_flags(flags); cli();
- while (((inw(base + 0x0e) & 0x0001) == 0) && (wait-- > 0));
- if (!wait) {
- printk(KERN_DEBUG "ISICOM: Card found busy in isicom_send_break.\n");
- goto out;
- }
+ if(!lock_card(card))
+ return;
+
outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base);
outw((length & 0xff) << 8 | 0x00, base);
outw((length & 0xff00), base);
InterruptTheCard(base);
-out: restore_flags(flags);
+
+ unlock_card(card);
}
static int isicom_tiocmget(struct tty_struct *tty, struct file *file)
@@ -1291,12 +1517,10 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
- unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
return -ENODEV;
- save_flags(flags); cli();
if (set & TIOCM_RTS)
raise_rts(port);
if (set & TIOCM_DTR)
@@ -1307,7 +1531,6 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file,
if (clear & TIOCM_DTR)
drop_dtr(port);
- restore_flags(flags);
return 0;
}
@@ -1315,7 +1538,6 @@ static int isicom_set_serial_info(struct isi_port * port,
struct serial_struct __user *info)
{
struct serial_struct newinfo;
- unsigned long flags;
int reconfig_port;
if(copy_from_user(&newinfo, info, sizeof(newinfo)))
@@ -1340,9 +1562,7 @@ static int isicom_set_serial_info(struct isi_port * port,
(newinfo.flags & ASYNC_FLAGS));
}
if (reconfig_port) {
- save_flags(flags); cli();
isicom_config_port(port);
- restore_flags(flags);
}
return 0;
}
@@ -1421,7 +1641,6 @@ static int isicom_ioctl(struct tty_struct * tty, struct file * filp,
static void isicom_set_termios(struct tty_struct * tty, struct termios * old_termios)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
- unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_set_termios"))
return;
@@ -1430,9 +1649,7 @@ static void isicom_set_termios(struct tty_struct * tty, struct termios * old_ter
tty->termios->c_iflag == old_termios->c_iflag)
return;
- save_flags(flags); cli();
isicom_config_port(port);
- restore_flags(flags);
if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios->c_cflag & CRTSCTS)) {
@@ -1446,16 +1663,13 @@ static void isicom_throttle(struct tty_struct * tty)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
struct isi_board * card = port->card;
- unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_throttle"))
return;
/* tell the card that this port cannot handle any more data for now */
- save_flags(flags); cli();
card->port_status &= ~(1 << port->channel);
outw(card->port_status, card->base + 0x02);
- restore_flags(flags);
}
/* unthrottle et all */
@@ -1463,16 +1677,13 @@ static void isicom_unthrottle(struct tty_struct * tty)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
struct isi_board * card = port->card;
- unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle"))
return;
/* tell the card that this port is ready to accept more data */
- save_flags(flags); cli();
card->port_status |= (1 << port->channel);
outw(card->port_status, card->base + 0x02);
- restore_flags(flags);
}
/* stop et all */
@@ -1509,7 +1720,7 @@ static void do_isicom_hangup(void * data)
tty = port->tty;
if (tty)
- tty_hangup(tty); /* FIXME: module removal race here - AKPM */
+ tty_hangup(tty);
}
static void isicom_hangup(struct tty_struct * tty)
@@ -1530,21 +1741,22 @@ static void isicom_hangup(struct tty_struct * tty)
static void isicom_flush_buffer(struct tty_struct * tty)
{
struct isi_port * port = (struct isi_port *) tty->driver_data;
+ struct isi_board * card = port->card;
unsigned long flags;
if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer"))
return;
- save_flags(flags); cli();
+ spin_lock_irqsave(&card->card_lock, flags);
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->card_lock, flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty);
}
-static int register_ioregion(void)
+static int __init register_ioregion(void)
{
int count, done=0;
for (count=0; count < BOARD_COUNT; count++ ) {
@@ -1559,7 +1771,7 @@ static int register_ioregion(void)
return done;
}
-static void unregister_ioregion(void)
+static void __exit unregister_ioregion(void)
{
int count;
for (count=0; count < BOARD_COUNT; count++ )
@@ -1591,7 +1803,7 @@ static struct tty_operations isicom_ops = {
.tiocmset = isicom_tiocmset,
};
-static int register_drivers(void)
+static int __init register_drivers(void)
{
int error;
@@ -1622,7 +1834,7 @@ static int register_drivers(void)
return 0;
}
-static void unregister_drivers(void)
+static void __exit unregister_drivers(void)
{
int error = tty_unregister_driver(isicom_normal);
if (error)
@@ -1630,78 +1842,48 @@ static void unregister_drivers(void)
put_tty_driver(isicom_normal);
}
-static int register_isr(void)
+static int __init register_isr(void)
{
- int count, done=0, card;
- int flag;
- unsigned char request;
+ int count, done=0;
+ unsigned long irqflags;
+
for (count=0; count < BOARD_COUNT; count++ ) {
if (isi_card[count].base) {
- /*
- * verify if the required irq has already been requested for
- * another ISI Card, if so we already have it, else request it
- */
- request = YES;
- for(card = 0; card < count; card++)
- if ((isi_card[card].base) && (isi_card[card].irq == isi_card[count].irq)) {
- request = NO;
- if ((isi_card[count].isa == NO) && (isi_card[card].isa == NO))
- break;
- /*
- * ISA cards cannot share interrupts with other
- * PCI or ISA devices hence disable this card.
- */
+ irqflags = (isi_card[count].isa == YES) ?
+ SA_INTERRUPT :
+ (SA_INTERRUPT | SA_SHIRQ);
+
+ if (request_irq(isi_card[count].irq,
+ isicom_interrupt,
+ irqflags,
+ ISICOM_NAME, &isi_card[count])) {
+
+ printk(KERN_WARNING "ISICOM: Could not"
+ " install handler at Irq %d."
+ " Card%d will be disabled.\n",
+ isi_card[count].irq, count+1);
+
release_region(isi_card[count].base,16);
- isi_card[count].base = 0;
- break;
- }
- flag=0;
- if(isi_card[count].isa == NO)
- flag |= SA_SHIRQ;
-
- if (request == YES) {
- if (request_irq(isi_card[count].irq, isicom_interrupt, SA_INTERRUPT|flag, ISICOM_NAME, NULL)) {
- printk(KERN_WARNING "ISICOM: Could not install handler at Irq %d. Card%d will be disabled.\n",
- isi_card[count].irq, count+1);
- release_region(isi_card[count].base,16);
- isi_card[count].base=0;
- }
- else {
- printk(KERN_INFO "ISICOM: Card%d at 0x%x using irq %d.\n",
- count+1, isi_card[count].base, isi_card[count].irq);
-
- irq_to_board[isi_card[count].irq]=&isi_card[count];
- done++;
- }
+ isi_card[count].base=0;
}
+ else
+ done++;
}
}
return done;
}
-static void unregister_isr(void)
+static void __exit unregister_isr(void)
{
- int count, card;
- unsigned char freeirq;
+ int count;
+
for (count=0; count < BOARD_COUNT; count++ ) {
- if (isi_card[count].base) {
- freeirq = YES;
- for(card = 0; card < count; card++)
- if ((isi_card[card].base) && (isi_card[card].irq == isi_card[count].irq)) {
- freeirq = NO;
- break;
- }
- if (freeirq == YES) {
- free_irq(isi_card[count].irq, NULL);
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: Irq %d released for Card%d.\n",isi_card[count].irq, count+1);
-#endif
- }
- }
+ if (isi_card[count].base)
+ free_irq(isi_card[count].irq, &isi_card[count]);
}
}
-static int isicom_init(void)
+static int __init isicom_init(void)
{
int card, channel, base;
struct isi_port * port;
@@ -1744,11 +1926,12 @@ static int isicom_init(void)
for (card = 0; card < BOARD_COUNT; card++) {
port = &isi_ports[card * 16];
isi_card[card].ports = port;
+ spin_lock_init(&isi_card[card].card_lock);
base = isi_card[card].base;
for (channel = 0; channel < 16; channel++, port++) {
port->magic = ISICOM_MAGIC;
port->card = &isi_card[card];
- port->channel = channel;
+ port->channel = channel;
port->close_delay = 50 * HZ/100;
port->closing_wait = 3000 * HZ/100;
INIT_WORK(&port->hangup_tq, do_isicom_hangup, port);
@@ -1778,7 +1961,7 @@ MODULE_PARM_DESC(io, "I/O ports for the cards");
module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "Interrupts for the cards");
-int init_module(void)
+static int __devinit isicom_setup(void)
{
struct pci_dev *dev = NULL;
int retval, card, idx, count;
@@ -1878,38 +2061,19 @@ int init_module(void)
return 0;
}
-void cleanup_module(void)
+static void __exit isicom_exit(void)
{
re_schedule = 0;
+ /* FIXME */
msleep(1000);
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: isicom_tx tx_count = %ld.\n", tx_count);
-#endif
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: uregistering isr ...\n");
-#endif
unregister_isr();
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: unregistering drivers ...\n");
-#endif
unregister_drivers();
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: unregistering ioregion ...\n");
-#endif
unregister_ioregion();
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: freeing tmp_buf ...\n");
-#endif
- free_page((unsigned long)tmp_buf);
-
-#ifdef ISICOM_DEBUG
- printk("ISICOM: unregistering firmware loader ...\n");
-#endif
+ if(tmp_buf)
+ free_page((unsigned long)tmp_buf);
if (misc_deregister(&isiloader_device))
printk(KERN_ERR "ISICOM: Unable to unregister Firmware Loader driver\n");
}
+
+module_init(isicom_setup);
+module_exit(isicom_exit);
diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c
index 0dee98b146fb0..ab00f51475dfb 100644
--- a/drivers/char/mwave/3780i.c
+++ b/drivers/char/mwave/3780i.c
@@ -61,7 +61,7 @@
#include "mwavedd.h"
#include "3780i.h"
-static spinlock_t dsp_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(dsp_lock);
static unsigned long flags;
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index 2983c278ca8c6..d37625d477465 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -76,11 +76,11 @@ int mwave_3780i_irq = 0;
int mwave_3780i_io = 0;
int mwave_uart_irq = 0;
int mwave_uart_io = 0;
-MODULE_PARM(mwave_debug, "i");
-MODULE_PARM(mwave_3780i_irq, "i");
-MODULE_PARM(mwave_3780i_io, "i");
-MODULE_PARM(mwave_uart_irq, "i");
-MODULE_PARM(mwave_uart_io, "i");
+module_param(mwave_debug, int, 0);
+module_param(mwave_3780i_irq, int, 0);
+module_param(mwave_3780i_io, int, 0);
+module_param(mwave_uart_irq, int, 0);
+module_param(mwave_uart_io, int, 0);
static int mwave_open(struct inode *inode, struct file *file);
static int mwave_close(struct inode *inode, struct file *file);
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index d60627b343235..0256d5823504d 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -975,6 +975,6 @@ module_exit(n_hdlc_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Paul Fulghum paulkf@microgate.com");
-MODULE_PARM(debuglevel, "i");
-MODULE_PARM(maxframe, "i");
+module_param(debuglevel, int, 0);
+module_param(maxframe, int, 0);
MODULE_ALIAS_LDISC(N_HDLC);
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index e4d24e0682249..f63a3fd7ca6f1 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -133,7 +133,7 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-static spinlock_t nvram_state_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(nvram_state_lock);
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
#define NVRAM_WRITE 1 /* opened for writing (exclusive) */
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index f98bb96e3dcc1..e331fc0ce3c5c 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -471,14 +471,14 @@ static u_int irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-
-MODULE_PARM(break_on_load,"i");
-MODULE_PARM(ttymajor,"i");
-MODULE_PARM(debug_level,"i");
-MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i");
-MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
+
+module_param(break_on_load, bool, 0);
+module_param(ttymajor, int, 0);
+module_param(debug_level, int, 0);
+module_param_array(maxframe, int, NULL, 0);
+module_param_array(dosyncppp, int, NULL, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/char/qtronix.c b/drivers/char/qtronix.c
index e016ef7e8edaf..371c87c739ff7 100644
--- a/drivers/char/qtronix.c
+++ b/drivers/char/qtronix.c
@@ -350,7 +350,7 @@ static int handle_data(unsigned char *p_data)
}
-spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(kbd_controller_lock);
static unsigned char handle_kbd_event(void);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 879cedec7cb17..69784eb102a11 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -540,7 +540,7 @@ static int create_entropy_store(int size, const char *name,
return -ENOMEM;
}
memset(r->pool, 0, POOLBYTES);
- r->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&r->lock);
r->name = name;
*ret_bucket = r;
return 0;
@@ -683,7 +683,7 @@ struct sample {
static struct sample *batch_entropy_pool, *batch_entropy_copy;
static int batch_head, batch_tail;
-static spinlock_t batch_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(batch_lock);
static int batch_max;
static void batch_entropy_process(void *private_);
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h
index 1e15d1cf0a102..e8f3860f4726c 100644
--- a/drivers/char/rio/func.h
+++ b/drivers/char/rio/func.h
@@ -47,7 +47,6 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *);
int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *);
void msec_timeout(struct Host *);
int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *);
-int RIOBootComplete(struct rio_info *, struct Host *, uint, struct PktCmd *);
int RIOBootOk(struct rio_info *,struct Host *, ulong);
int RIORtaBound(struct rio_info *, uint);
void FillSlot(int, int, uint, struct Host *);
@@ -61,15 +60,10 @@ int RIOIdentifyRta(struct rio_info *, caddr_t);
int RIOKillNeighbour(struct rio_info *, caddr_t);
int RIOSuspendBootRta(struct Host *, int, int);
int RIOFoadWakeup(struct rio_info *);
-int RIOCommandRup(struct rio_info *, uint, struct Host *, struct PKT *);
struct CmdBlk * RIOGetCmdBlk(void);
void RIOFreeCmdBlk(struct CmdBlk *);
int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *);
void RIOPollHostCommands(struct rio_info *, struct Host *);
-int RIOStrlen(register char *);
-int RIOStrCmp(register char *, register char *);
-int RIOStrnCmp(register char *, register char *, int);
-void RIOStrNCpy(char *, char *, int);
int RIOWFlushMark(int, struct CmdBlk *);
int RIORFlushEnable(int, struct CmdBlk *);
int RIOUnUse(int, struct CmdBlk *);
@@ -77,7 +71,6 @@ void ShowPacket(uint, struct PKT *);
/* rioctrl.c */
int copyin(int, caddr_t, int);
-int copyout(caddr_t, int, int);
int riocontrol(struct rio_info *, dev_t,int,caddr_t,int);
int RIOPreemptiveCmd(struct rio_info *,struct Port *,uchar);
@@ -89,24 +82,17 @@ int RIODoAT(struct rio_info *, int, int);
caddr_t RIOCheckForATCard(int);
int RIOAssignAT(struct rio_info *, int, caddr_t, int);
int RIOBoardTest(paddr_t, caddr_t, uchar, int);
-int RIOScrub(int, BYTE *, int);
-void RIOAllocateInterrupts(struct rio_info *);
-void RIOStopInterrupts(struct rio_info *, int, int);
void RIOAllocDataStructs(struct rio_info *);
void RIOSetupDataStructs(struct rio_info *);
int RIODefaultName(struct rio_info *, struct Host *, uint);
-int RIOReport(struct rio_info *);
struct rioVersion * RIOVersid(void);
int RIOMapin(paddr_t, int, caddr_t *);
void RIOMapout(paddr_t, long, caddr_t);
void RIOHostReset(uint, volatile struct DpRam *, uint);
/* riointr.c */
-void riopoll(struct rio_info *);
-void riointr(struct rio_info *);
void RIOTxEnable(char *);
void RIOServiceHost(struct rio_info *, struct Host *, int);
-void RIOReceive(struct rio_info *, struct Port *);
int riotproc(struct rio_info *, register struct ttystatics *, int, int);
/* rioparam.c */
@@ -123,22 +109,15 @@ void remove_receive(struct Port *);
/* rioroute.c */
int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *);
void RIOFixPhbs(struct rio_info *, struct Host *, uint);
-int RIOCheckIsolated(struct rio_info *, struct Host *, uint);
-int RIOIsolate(struct rio_info *, struct Host *, uint);
-int RIOCheck(struct Host *, uint);
uint GetUnitType(uint);
int RIOSetChange(struct rio_info *);
-void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, int);
int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *);
-int RIOFreeDisconnected(struct rio_info *, struct Host *, int );
-int RIORemoveFromSavedTable(struct rio_info *, struct Map *);
/* riotty.c */
int riotopen(struct tty_struct * tty, struct file * filp);
int riotclose(void *ptr);
-int RIOCookMode(struct ttystatics *);
int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t);
void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg);
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index aa23b1cba7c97..75f0b826b65be 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -32,11 +32,6 @@
*
* */
-
-#define RCS_ID "$Id: rio.c,v 1.1 1999/07/11 10:13:54 wolff Exp wolff $"
-#define RCS_REV "$Revision: 1.1 $"
-
-
#include <linux/module.h>
#include <linux/config.h>
#include <linux/kdev_t.h>
@@ -198,7 +193,7 @@ static int rio_fw_ioctl (struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
static int rio_init_drivers(void);
-void my_hd (void *addr, int len);
+static void my_hd (void *addr, int len);
static struct tty_driver *rio_driver, *rio_driver2;
@@ -206,11 +201,6 @@ static struct tty_driver *rio_driver, *rio_driver2;
sources use all over the place. */
struct rio_info *p;
-/* struct rio_board boards[RIO_HOSTS]; */
-struct rio_port *rio_ports;
-
-int rio_initialized;
-int rio_nports;
int rio_debug;
@@ -218,12 +208,12 @@ int rio_debug;
- Set rio_poll to 1 to poll every timer tick (10ms on Intel).
This is used when the card cannot use an interrupt for some reason.
*/
-int rio_poll = 1;
+static int rio_poll = 1;
/* These are the only open spaces in my computer. Yours may have more
or less.... */
-int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};
+static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};
#define NR_RIO_ADDRS (sizeof(rio_probe_addrs)/sizeof (int))
@@ -264,7 +254,7 @@ static struct file_operations rio_fw_fops = {
.ioctl = rio_fw_ioctl,
};
-struct miscdevice rio_fw_device = {
+static struct miscdevice rio_fw_device = {
RIOCTL_MISC_MINOR, "rioctl", &rio_fw_fops
};
@@ -302,7 +292,7 @@ static inline int rio_paranoia_check(struct rio_port const * port,
#ifdef DEBUG
-void my_hd (void *ad, int len)
+static void my_hd (void *ad, int len)
{
int i, j, ch;
unsigned char *addr = ad;
@@ -387,7 +377,7 @@ static int rio_set_real_termios (void *ptr)
}
-void rio_reset_interrupt (struct Host *HostP)
+static void rio_reset_interrupt (struct Host *HostP)
{
func_enter();
@@ -824,7 +814,7 @@ static void rio_unthrottle (struct tty_struct * tty)
* ********************************************************************** */
-struct vpd_prom *get_VPD_PROM (struct Host *hp)
+static struct vpd_prom *get_VPD_PROM (struct Host *hp)
{
static struct vpd_prom vpdp;
char *p;
@@ -979,7 +969,7 @@ static int rio_init_datastructures (void)
port->gs.close_delay = HZ/2;
port->gs.closing_wait = 30 * HZ;
port->gs.rd = &rio_real_driver;
- port->portSem = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&port->portSem);
/*
* Initializing wait queue
*/
@@ -1045,7 +1035,7 @@ static void __exit rio_release_drivers(void)
EEprom. As the bit is read/write for the CPU, we can fix it here,
if we detect that it isn't set correctly. -- REW */
-void fix_rio_pci (struct pci_dev *pdev)
+static void fix_rio_pci (struct pci_dev *pdev)
{
unsigned int hwbase;
unsigned long rebase;
@@ -1141,7 +1131,7 @@ static int __init rio_init(void)
hp->Type = RIO_PCI;
hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM;
- hp->HostLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hp->HostLock);
rio_reset_interrupt (hp);
rio_start_card_running (hp);
@@ -1199,7 +1189,7 @@ static int __init rio_init(void)
hp->Type = RIO_PCI;
hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM;
- hp->HostLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hp->HostLock);
rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec);
rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
@@ -1249,7 +1239,7 @@ static int __init rio_init(void)
* Moreover, the ISA card will work with the
* special PCI copy anyway. -- REW */
hp->Mode = 0;
- hp->HostLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&hp->HostLock);
vpdp = get_VPD_PROM (hp);
rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n");
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index f4a59108f0242..a8be11dfcba3c 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -80,6 +80,8 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
#include "cmdblk.h"
#include "route.h"
+static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP );
+
static uchar
RIOAtVec2Ctrl[] =
{
@@ -580,14 +582,14 @@ register struct DownLoad *rbp;
HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN];
HostP->UnixRups[RupN].Id = RupN+1;
HostP->UnixRups[RupN].BaseSysPort = NO_PORT;
- HostP->UnixRups[RupN].RupLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&HostP->UnixRups[RupN].RupLock);
}
for ( RupN = 0; RupN<LINKS_PER_UNIT; RupN++ ) {
HostP->UnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup;
HostP->UnixRups[RupN+MAX_RUP].Id = 0;
HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT;
- HostP->UnixRups[RupN+MAX_RUP].RupLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&HostP->UnixRups[RupN+MAX_RUP].RupLock);
}
/*
@@ -802,7 +804,7 @@ struct PKT *PacketP;
** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA.
** RtaUniq is the booted RTA.
*/
-int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP )
+static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP )
{
struct Map *MapP = NULL;
struct Map *MapP2 = NULL;
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index f83f15ca6fe12..8f70185f192af 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -397,7 +397,7 @@ struct rio_info * p;
/*
** Incoming command on the COMMAND_RUP to be processed.
*/
-int
+static int
RIOCommandRup(p, Rup, HostP, PacketP)
struct rio_info * p;
uint Rup;
@@ -917,62 +917,6 @@ struct Host * HostP;
} while ( Rup );
}
-
-/*
-** Return the length of the named string
-*/
-int
-RIOStrlen(Str)
-register char *Str;
-{
- register int len = 0;
-
- while ( *Str++ )
- len++;
- return len;
-}
-
-/*
-** compares s1 to s2 and return 0 if they match.
-*/
-int
-RIOStrCmp(s1, s2)
-register char *s1;
-register char *s2;
-{
- while ( *s1 && *s2 && *s1==*s2 )
- s1++, s2++;
- return *s1-*s2;
-}
-
-/*
-** compares s1 to s2 for upto n bytes and return 0 if they match.
-*/
-int
-RIOStrnCmp(s1, s2, n)
-register char *s1;
-register char *s2;
-int n;
-{
- while ( n && *s1 && *s2 && *s1==*s2 )
- n--, s1++, s2++;
- return n ? *s1!=*s2 : 0;
-}
-
-/*
-** copy up to 'len' bytes from 'from' to 'to'.
-*/
-void
-RIOStrNCpy(to, from, len)
-char *to;
-char *from;
-int len;
-{
- while ( len-- && (*to++ = *from++) )
- ;
- to[-1]='\0';
-}
-
int
RIOWFlushMark(iPortP, CmdBlkP)
int iPortP;
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index 7a74e2c872b79..b4d1a23e27e45 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -130,7 +130,6 @@ static int
#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
-#ifdef linux
int copyin (int arg, caddr_t dp, int siz)
{
int rv;
@@ -141,8 +140,7 @@ int copyin (int arg, caddr_t dp, int siz)
else return rv;
}
-
-int copyout (caddr_t dp, int arg, int siz)
+static int copyout (caddr_t dp, int arg, int siz)
{
int rv;
@@ -152,35 +150,6 @@ int copyout (caddr_t dp, int arg, int siz)
else return rv;
}
-#else
-
-int
-copyin(arg, dp, siz)
-int arg;
-caddr_t dp;
-int siz;
-{
- if (rbounds ((unsigned long) arg) >= siz) {
- bcopy ( arg, dp, siz );
- return OK;
- } else
- return ( COPYFAIL );
-}
-
-int
-copyout (dp, arg, siz)
-caddr_t dp;
-int arg;
-int siz;
-{
- if (wbounds ((unsigned long) arg) >= siz ) {
- bcopy ( dp, arg, siz );
- return OK;
- } else
- return ( COPYFAIL );
-}
-#endif
-
int
riocontrol(p, dev, cmd, arg, su)
struct rio_info * p;
@@ -1203,7 +1172,7 @@ RIO_DEBUG_CTRL, if (su)
p->RIOPortp[loop]->TtyP = &p->channel[loop];
#endif
- p->RIOPortp[loop]->portSem = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&p->RIOPortp[loop]->portSem);
p->RIOPortp[loop]->InUse = NOT_INUSE;
}
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index 5712bdef20f83..dca941ed10cfb 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -84,9 +84,15 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
#undef bcopy
#define bcopy rio_pcicopy
-int
-RIOPCIinit(struct rio_info *p, int Mode);
+int RIOPCIinit(struct rio_info *p, int Mode);
+
+#if 0
+static void RIOAllocateInterrupts(struct rio_info *);
+static int RIOReport(struct rio_info *);
+static void RIOStopInterrupts(struct rio_info *, int, int);
+#endif
+static int RIOScrub(int, BYTE *, int);
#if 0
extern int rio_intr();
@@ -1116,7 +1122,7 @@ int slot;
** Call with op not zero, and the RAM will be read and compated with val[op-1]
** to check that the data from the previous phase was retained.
*/
-int
+static int
RIOScrub(op, ram, size)
int op;
BYTE * ram;
@@ -1262,7 +1268,8 @@ int size;
** and force into polled mode if told to. Patch up the
** interrupt vector & salute The Queen when you've done.
*/
-void
+#if 0
+static void
RIOAllocateInterrupts(p)
struct rio_info * p;
{
@@ -1301,7 +1308,7 @@ struct rio_info * p;
** new-fangled interrupt thingies. Set everything up to just
** poll.
*/
-void
+static void
RIOStopInterrupts(p, Reason, Host)
struct rio_info * p;
int Reason;
@@ -1360,7 +1367,6 @@ int Host;
}
}
-#if 0
/*
** This function is called at init time to setup the data structures.
*/
@@ -1444,7 +1450,7 @@ struct rio_info * p;
}
RIODefaultName(p, HostP, rup);
}
- HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&HostP->UnixRups[rup].RupLock);
}
}
}
@@ -1476,7 +1482,8 @@ uint UnitId;
#define RIO_RELEASE "Linux"
#define RELEASE_ID "1.0"
-int
+#if 0
+static int
RIOReport(p)
struct rio_info * p;
{
@@ -1500,41 +1507,7 @@ struct rio_info * p;
}
return 0;
}
-
-/*
-** This function returns release/version information as used by ioctl() calls
-** It returns a MAX_VERSION_LEN byte string, null terminated.
-*/
-char *
-OLD_RIOVersid( void )
-{
- static char Info[MAX_VERSION_LEN];
- char * RIORelease = RIO_RELEASE;
- char * cp;
- int ct = 0;
-
- for ( ct=0; RIORelease[ct] && ct<MAX_VERSION_LEN; ct++ )
- Info[ct] = RIORelease[ct];
- if ( ct>=MAX_VERSION_LEN ) {
- Info[MAX_VERSION_LEN-1] = '\0';
- return Info;
- }
- Info[ct++]=' ';
- if ( ct>=MAX_VERSION_LEN ) {
- Info[MAX_VERSION_LEN-1] = '\0';
- return Info;
- }
-
- cp=""; /* Fill the RCS Id here */
-
- while ( *cp && ct<MAX_VERSION_LEN )
- Info[ct++] = *cp++;
- if ( ct<MAX_VERSION_LEN-1 )
- Info[ct] = '\0';
- Info[MAX_VERSION_LEN-1] = '\0';
- return Info;
-}
-
+#endif
static struct rioVersion stVersion;
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
index f43499e0226ff..e42e7b50bf6bf 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/char/rio/riointr.c
@@ -84,83 +84,10 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
#include "rioioctl.h"
+static void RIOReceive(struct rio_info *, struct Port *);
-/*
-** riopoll is called every clock tick. Once the /dev/rio device has been
-** opened, and polldistributed( ) has been called, this routine is called
-** every clock tick *by every cpu*. The 'interesting' piece of code that
-** manipulates 'RIONumCpus' and 'RIOCpuCountdown' is used to fair-share
-** the work between the CPUs. If there are 'N' cpus, then each poll time
-** we increment a counter, modulo 'N-1'. When this counter is 0, we call
-** the interrupt handler. This has the effect that polls are serviced
-** by processor 'N', 'N-1', 'N-2', ... '0', round and round. Neat.
-*/
-void
-riopoll(p)
-struct rio_info * p;
-{
- int host;
-
- /*
- ** Here's the deal. We try to fair share as much as possible amongst
- ** all the processors that are available. Since each processor
- ** should generate HZ ticks per second and since we only need HZ ticks
- ** in total for proper operation we simply attempt to cycle round each
- ** processor in turn, using RIOCpuCountdown to decide whether to call
- ** the interrupt routine. ( In fact the count zeroes when it reaches
- ** one less than the total number of processors - so e.g. on a two
- ** processor system RIOService will get called 2*HZ times per second. )
- ** this_cpu (cur_cpu()) tells us the number of the current processor
- ** as follows:
- **
- ** 0 - default CPU
- ** 1 - first extra CPU
- ** 2 - second extra CPU
- ** etc.
- */
-
- /*
- ** okay, we've got a cpu that hasn't had a go recently
- ** - lets check to see what needs doing.
- */
- for ( host=0; host<p->RIONumHosts; host++ ) {
- struct Host *HostP = &p->RIOHosts[host];
-
- rio_spin_lock( &HostP->HostLock );
-
- if ( ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) ||
- HostP->InIntr ) {
- rio_spin_unlock (&HostP->HostLock);
- continue;
- }
-
- if ( RWORD( HostP->ParmMapP->rup_intr ) ||
- RWORD( HostP->ParmMapP->rx_intr ) ||
- RWORD( HostP->ParmMapP->tx_intr ) ) {
- HostP->InIntr = 1;
-
-#ifdef FUTURE_RELEASE
- if( HostP->Type == RIO_EISA )
- INBZ( HostP->Slot, EISA_INTERRUPT_RESET );
- else
-#endif
- WBYTE( HostP->ResetInt , 0xff );
-
- rio_spin_lock(&HostP->HostLock);
-
- p->_RIO_Polled++;
- RIOServiceHost(p, HostP, 'p' );
- rio_spin_lock( &HostP->HostLock);
- HostP->InIntr = 0;
- rio_spin_unlock (&HostP->HostLock);
- }
- }
- rio_spin_unlock (&p->RIOIntrSem);
-}
-
-
-char *firstchars (char *p, int nch)
+static char *firstchars (char *p, int nch)
{
static char buf[2][128];
static int t=0;
@@ -258,93 +185,6 @@ char * en;
/*
-** When a real-life interrupt comes in here, we try to find out
-** which host card it belongs to, and then service only that host
-** Notice the cunning way that, once we've found a candidate, we
-** continue just in case we are sharing interrupts.
-*/
-void
-riointr(p)
-struct rio_info * p;
-{
- int host;
-
- for ( host=0; host<p->RIONumHosts; host++ ) {
- struct Host *HostP = &p->RIOHosts[host];
-
- rio_dprintk (RIO_DEBUG_INTR, "riointr() doing host %d type %d\n", host, HostP->Type);
-
- switch( HostP->Type ) {
- case RIO_AT:
- case RIO_MCA:
- case RIO_PCI:
- rio_spin_lock(&HostP->HostLock);
- WBYTE(HostP->ResetInt , 0xff);
- if ( !HostP->InIntr ) {
- HostP->InIntr = 1;
- rio_spin_unlock (&HostP->HostLock);
- p->_RIO_Interrupted++;
- RIOServiceHost(p, HostP, 'i');
- rio_spin_lock(&HostP->HostLock);
- HostP->InIntr = 0;
- }
- rio_spin_unlock(&HostP->HostLock);
- break;
-#ifdef FUTURE_RELEASE
- case RIO_EISA:
- if ( ivec == HostP->Ivec )
- {
- OldSpl = LOCKB( &HostP->HostLock );
- INBZ( HostP->Slot, EISA_INTERRUPT_RESET );
- if ( !HostP->InIntr )
- {
- HostP->InIntr = 1;
- UNLOCKB( &HostP->HostLock, OldSpl );
- if ( this_cpu < RIO_CPU_LIMIT )
- {
- int intrSpl = LOCKB( &RIOIntrLock );
- UNLOCKB( &RIOIntrLock, intrSpl );
- }
- p->_RIO_Interrupted++;
- RIOServiceHost( HostP, 'i' );
- OldSpl = LOCKB( &HostP->HostLock );
- HostP->InIntr = 0;
- }
- UNLOCKB( &HostP->HostLock, OldSpl );
- done++;
- }
- break;
-#endif
- }
-
- HostP->IntSrvDone++;
- }
-
-#ifdef FUTURE_RELEASE
- if ( !done )
- {
- cmn_err( CE_WARN, "RIO: Interrupt received with vector 0x%x\n", ivec );
- cmn_err( CE_CONT, " Valid vectors are:\n");
- for ( host=0; host<RIONumHosts; host++ )
- {
- switch( RIOHosts[host].Type )
- {
- case RIO_AT:
- case RIO_MCA:
- case RIO_EISA:
- cmn_err( CE_CONT, "0x%x ", RIOHosts[host].Ivec );
- break;
- case RIO_PCI:
- cmn_err( CE_CONT, "0x%x ", get_intr_arg( RIOHosts[host].PciDevInfo.busnum, IDIST_PCI_IRQ( RIOHosts[host].PciDevInfo.slotnum, RIOHosts[host].PciDevInfo.funcnum ) ));
- break;
- }
- }
- cmn_err( CE_CONT, "\n" );
- }
-#endif
-}
-
-/*
** RIO Host Service routine. Does all the work traditionally associated with an
** interrupt.
*/
@@ -710,7 +550,7 @@ int From;
** NB: Called with the tty locked. The spl from the lockb( ) is passed.
** we return the ttySpl level that we re-locked at.
*/
-void
+static void
RIOReceive(p, PortP)
struct rio_info * p;
struct Port * PortP;
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index 503c035496222..106b31f48a217 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -83,6 +83,12 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3";
#include "list.h"
#include "sam.h"
+static int RIOCheckIsolated(struct rio_info *, struct Host *, uint);
+static int RIOIsolate(struct rio_info *, struct Host *, uint);
+static int RIOCheck(struct Host *, uint);
+static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, int);
+
+
/*
** Incoming on the ROUTE_RUP
** I wrote this while I was tired. Forgive me.
@@ -717,7 +723,7 @@ uint unit;
** the world about it. This is done to ensure that the configurator
** only gets up-to-date information about what is going on.
*/
-int
+static int
RIOCheckIsolated(p, HostP, UnitId)
struct rio_info * p;
struct Host *HostP;
@@ -747,7 +753,7 @@ uint UnitId;
** all the units attached to it. This will mean that the entire
** subnet will re-introduce itself.
*/
-int
+static int
RIOIsolate(p, HostP, UnitId)
struct rio_info * p;
struct Host * HostP;
@@ -782,7 +788,7 @@ uint UnitId;
return 1;
}
-int
+static int
RIOCheck(HostP, UnitId)
struct Host *HostP;
uint UnitId;
@@ -883,7 +889,7 @@ struct rio_info * p;
return(0);
}
-void
+static void
RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
struct rio_info * p;
struct Host *HostP;
@@ -966,7 +972,7 @@ int Change;
** Delete and RTA entry from the saved table given to us
** by the configuration program.
*/
-int
+static int
RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
{
int entry;
@@ -993,7 +999,7 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
** Scan the unit links to and return zero if the unit is completely
** disconnected.
*/
-int
+static int
RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
{
int link;
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 70ccf786565e4..8fb26ad2aa120 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -37,6 +37,7 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
+#include <linux/string.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -276,7 +277,7 @@ struct rio_info * p;
return -ENXIO;
}
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
- if (RIOStrCmp(MapP->Name,
+ if (strcmp(MapP->Name,
p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
p->RIOError.Error = NAME_USED_TWICE;
@@ -405,7 +406,7 @@ struct rio_info * p;
for ( Host2=0; Host2<p->RIONumHosts; Host2++ ) {
if (Host2 == Host)
continue;
- if (RIOStrCmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name)
+ if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name)
== 0) {
NameIsUnique = 0;
Host1++;
@@ -940,20 +941,6 @@ struct Map *HostMapP;
PortP->FirstOpen = 1;
/*
- ** handle the xprint issues
- */
-#ifdef XPRINT_SUPPORT
- PortP->Xprint.XpActive = 0;
- PortP->Xprint.XttyP = &riox_tty[SysPort];
- /* TO FROM MAXLEN */
- RIOStrNCpy( PortP->Xprint.XpOn, RIOConf.XpOn, MAX_XP_CTRL_LEN );
- RIOStrNCpy( PortP->Xprint.XpOff, RIOConf.XpOff, MAX_XP_CTRL_LEN );
- PortP->Xprint.XpCps = RIOConf.XpCps;
- PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+
- RIOStrlen(PortP->Xprint.XpOff);
-#endif
-
- /*
** Buffers 'n things
*/
PortP->RxDataStart = 0;
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index d851c86baf90c..db655002671f3 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -40,6 +40,7 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/tty.h>
+#include <linux/string.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/string.h>
@@ -97,6 +98,9 @@ static void RIOClearUp(struct Port *PortP);
int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg);
+#if 0
+static int RIOCookMode(struct ttystatics *);
+#endif
extern int conv_vb[]; /* now defined in ttymgr.c */
extern int conv_bv[]; /* now defined in ttymgr.c */
@@ -726,7 +730,8 @@ close_end:
** COOK_WELL if the line discipline must be used to do the processing
** COOK_MEDIUM if the card can do all the processing necessary.
*/
-int
+#if 0
+static int
RIOCookMode(struct ttystatics *tp)
{
/*
@@ -757,7 +762,7 @@ RIOCookMode(struct ttystatics *tp)
*/
return COOK_MEDIUM;
}
-
+#endif
static void
RIOClearUp(PortP)
@@ -1011,8 +1016,8 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
pseterr(EFAULT);
}
PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0';
- PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+
- RIOStrlen(PortP->Xprint.XpOff);
+ PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
+ strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
@@ -1026,8 +1031,8 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
pseterr(EFAULT);
}
PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0';
- PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+
- RIOStrlen(PortP->Xprint.XpOff);
+ PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
+ strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 1f9d4fa665034..3f2bb4f9a84f9 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -177,7 +177,7 @@ static unsigned long rtc_max_user_freq = 64; /* > this, need CAP_SYS_RESOURCE */
/*
* rtc_task_lock nests inside rtc_lock.
*/
-static spinlock_t rtc_task_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(rtc_task_lock);
static rtc_task_t *rtc_callback = NULL;
#endif
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
index 70b5e94b5df94..664a6e97eb1a8 100644
--- a/drivers/char/scx200_gpio.c
+++ b/drivers/char/scx200_gpio.c
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver");
MODULE_LICENSE("GPL");
static int major = 0; /* default to dynamic major */
-MODULE_PARM(major, "i");
+module_param(major, int, 0);
MODULE_PARM_DESC(major, "Major device number");
static ssize_t scx200_gpio_write(struct file *file, const char __user *data,
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index da49f9f130537..4b2b83b30371a 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -739,7 +739,7 @@ static int __devinit sonypi_probe(void)
sonypi_device.model = pcidev ?
SONYPI_DEVICE_MODEL_TYPE1 : SONYPI_DEVICE_MODEL_TYPE2;
- sonypi_device.fifo_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sonypi_device.fifo_lock);
sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
&sonypi_device.fifo_lock);
if (IS_ERR(sonypi_device.fifo)) {
@@ -852,7 +852,7 @@ static int __devinit sonypi_probe(void)
printk(KERN_INFO "%s input method installed.\n",
sonypi_device.input_key_dev.name);
- sonypi_device.input_fifo_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sonypi_device.input_fifo_lock);
sonypi_device.input_fifo =
kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
&sonypi_device.input_fifo_lock);
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 73bfe95c99e0b..a233427245823 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -886,16 +886,16 @@ static int dosyncppp[MAX_TOTAL_DEVICES];
static int txdmabufs[MAX_TOTAL_DEVICES];
static int txholdbufs[MAX_TOTAL_DEVICES];
-MODULE_PARM(break_on_load,"i");
-MODULE_PARM(ttymajor,"i");
-MODULE_PARM(io,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
-MODULE_PARM(irq,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
-MODULE_PARM(dma,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
-MODULE_PARM(debug_level,"i");
-MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
-MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
-MODULE_PARM(txdmabufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
-MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
+module_param(break_on_load, bool, 0);
+module_param(ttymajor, int, 0);
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
+module_param(debug_level, int, 0);
+module_param_array(maxframe, int, NULL, 0);
+module_param_array(dosyncppp, int, NULL, 0);
+module_param_array(txdmabufs, int, NULL, 0);
+module_param_array(txholdbufs, int, NULL, 0);
static char *driver_name = "SyncLink serial driver";
static char *driver_version = "$Revision: 4.28 $";
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index eccdcbdef8964..dc0af4ea75a25 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -480,11 +480,11 @@ static int debug_level = 0;
static int maxframe[MAX_DEVICES] = {0,};
static int dosyncppp[MAX_DEVICES] = {0,};
-MODULE_PARM(break_on_load,"i");
-MODULE_PARM(ttymajor,"i");
-MODULE_PARM(debug_level,"i");
-MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICES) "i");
-MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i");
+module_param(break_on_load, bool, 0);
+module_param(ttymajor, int, 0);
+module_param(debug_level, int, 0);
+module_param_array(maxframe, int, NULL, 0);
+module_param_array(dosyncppp, int, NULL, 0);
static char *driver_name = "SyncLink MultiPort driver";
static char *driver_version = "$Revision: 4.29 $";
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 12ce2d4bdc38d..057eaf87b9b28 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -229,7 +229,7 @@ static struct sysrq_key_op sysrq_unrt_op = {
};
/* Key Operations table and lock */
-static spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(sysrq_key_table_lock);
#define SYSRQ_KEY_TABLE_LENGTH 36
static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
/* 0 */ &sysrq_loglevel_op,
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c
index 2fd2901ffc457..7696ead16862f 100644
--- a/drivers/char/tipar.c
+++ b/drivers/char/tipar.c
@@ -40,10 +40,10 @@
* the minor number.
*
*/
-
+#undef DEBUG /* change to #define to get debugging
+ * output - for pr_debug() */
#include <linux/config.h>
#include <linux/module.h>
-#include <linux/version.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
@@ -57,7 +57,7 @@
#include <asm/io.h>
#include <linux/bitops.h>
#include <linux/devfs_fs_kernel.h> /* DevFs support */
-#include <linux/parport.h> /* Our code depend on parport */
+#include <linux/parport.h> /* Our code depend on parport */
#include <linux/device.h>
/*
@@ -74,9 +74,6 @@
#define DRIVER_LICENSE "GPL"
#define VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
-#if LINUX_VERSION_CODE < VERSION(2,5,0)
-# define need_resched() (current->need_resched)
-#endif
/* ----- global variables --------------------------------------------- */
@@ -143,7 +140,7 @@ White: ________ | ______ | _______
static int
put_ti_parallel(int minor, unsigned char data)
{
- int bit;
+ unsigned int bit;
unsigned long max;
for (bit = 0; bit < 8; bit++) {
@@ -187,7 +184,7 @@ put_ti_parallel(int minor, unsigned char data)
static int
get_ti_parallel(int minor)
{
- int bit;
+ unsigned int bit;
unsigned char v, data = 0;
unsigned long max;
@@ -234,7 +231,8 @@ probe_ti_parallel(int minor)
outbyte(3, minor);
outbyte(i, minor);
udelay(delay);
- /*printk(KERN_DEBUG "Probing -> %i: 0x%02x 0x%02x\n", i, data & 0x30, seq[i]); */
+ pr_debug("tipar: Probing -> %i: 0x%02x 0x%02x\n", i,
+ data & 0x30, seq[i]);
if ((inbyte(minor) & 0x30) != seq[i]) {
outbyte(3, minor);
return -1;
@@ -279,7 +277,8 @@ tipar_close(struct inode *inode, struct file *file)
}
static ssize_t
-tipar_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
+tipar_write (struct file *file, const char __user *buf, size_t count,
+ loff_t * ppos)
{
unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR;
ssize_t n;
@@ -405,7 +404,8 @@ tipar_setup(char *str)
if (ints[1] != 0)
timeout = ints[1];
else
- printk("tipar: wrong timeout value (0), using default value instead.");
+ printk(KERN_WARNING "tipar: bad timeout value (0), "
+ "using default value instead");
if (ints[0] > 1) {
delay = ints[2];
}
@@ -436,8 +436,8 @@ tipar_register(int nr, struct parport *port)
goto out;
}
- class_simple_device_add(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
- NULL, "par%d", nr);
+ class_simple_device_add(tipar_class, MKDEV(TIPAR_MAJOR,
+ TIPAR_MINOR + nr), NULL, "par%d", nr);
/* Use devfs, tree: /dev/ticables/par/[0..2] */
err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
S_IFCHR | S_IRUGO | S_IWUGO,
@@ -446,14 +446,13 @@ tipar_register(int nr, struct parport *port)
goto out_class;
/* Display informations */
- printk(KERN_INFO "tipar%d: using %s (%s).\n", nr, port->name,
- (port->irq ==
+ pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
PARPORT_IRQ_NONE) ? "polling" : "interrupt-driven");
if (probe_ti_parallel(nr) != -1)
- printk("tipar%d: link cable found !\n", nr);
+ pr_info("tipar%d: link cable found\n", nr);
else
- printk("tipar%d: link cable not found.\n", nr);
+ pr_info("tipar%d: link cable not found\n", nr);
err = 0;
goto out;
@@ -469,7 +468,7 @@ static void
tipar_attach(struct parport *port)
{
if (tp_count == PP_NO) {
- printk("tipar: ignoring parallel port (max. %d)\n", PP_NO);
+ pr_info("tipar: ignoring parallel port (max. %d)\n", PP_NO);
return;
}
@@ -494,11 +493,11 @@ tipar_init_module(void)
{
int err = 0;
- printk("tipar: parallel link cable driver, version %s\n",
- DRIVER_VERSION);
+ pr_info("tipar: parallel link cable driver, version %s\n",
+ DRIVER_VERSION);
if (register_chrdev(TIPAR_MAJOR, "tipar", &tipar_fops)) {
- printk("tipar: unable to get major %d\n", TIPAR_MAJOR);
+ printk(KERN_ERR "tipar: unable to get major %d\n", TIPAR_MAJOR);
err = -EIO;
goto out;
}
@@ -512,7 +511,7 @@ tipar_init_module(void)
goto out_chrdev;
}
if (parport_register_driver(&tipar_driver)) {
- printk("tipar: unable to register with parport\n");
+ printk(KERN_ERR "tipar: unable to register with parport\n");
err = -EIO;
goto out;
}
@@ -546,7 +545,7 @@ tipar_cleanup_module(void)
class_simple_destroy(tipar_class);
devfs_remove("ticables/par");
- printk("tipar: module unloaded !\n");
+ pr_info("tipar: module unloaded\n");
}
/* --------------------------------------------------------------------- */
@@ -559,7 +558,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENSE);
-MODULE_PARM(timeout, "i");
+module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Timeout (default=1.5 seconds)");
-MODULE_PARM(delay, "i");
+module_param(delay, int, 0);
MODULE_PARM_DESC(delay, "Inter-bit delay (default=10 microseconds)");
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 5b84af027d6a6..baf65901ab41b 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -81,7 +81,7 @@ static int tosh_fan = 0;
static int tosh_fn = 0;
-MODULE_PARM(tosh_fn, "i");
+module_param(tosh_fn, int, 0);
static int tosh_ioctl(struct inode *, struct file *, unsigned int,
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index b5a5edfebb994..ffc82ee87b373 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -249,7 +249,7 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
* callers who will do ldisc lookups and cannot sleep.
*/
-static spinlock_t tty_ldisc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(tty_ldisc_lock);
static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait);
static struct tty_ldisc tty_ldiscs[NR_LDISCS]; /* line disc dispatch table */
@@ -690,7 +690,7 @@ static struct file_operations hung_up_tty_fops = {
.release = tty_release,
};
-static spinlock_t redirect_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(redirect_lock);
static struct file *redirect;
/**
@@ -918,9 +918,11 @@ void disassociate_ctty(int on_exit)
lock_kernel();
+ down(&tty_sem);
tty = current->signal->tty;
if (tty) {
tty_pgrp = tty->pgrp;
+ up(&tty_sem);
if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY)
tty_vhangup(tty);
} else {
@@ -928,6 +930,7 @@ void disassociate_ctty(int on_exit)
kill_pg(current->signal->tty_old_pgrp, SIGHUP, on_exit);
kill_pg(current->signal->tty_old_pgrp, SIGCONT, on_exit);
}
+ up(&tty_sem);
unlock_kernel();
return;
}
@@ -937,15 +940,19 @@ void disassociate_ctty(int on_exit)
kill_pg(tty_pgrp, SIGCONT, on_exit);
}
+ /* Must lock changes to tty_old_pgrp */
+ down(&tty_sem);
current->signal->tty_old_pgrp = 0;
tty->session = 0;
tty->pgrp = -1;
+ /* Now clear signal->tty under the lock */
read_lock(&tasklist_lock);
do_each_task_pid(current->signal->session, PIDTYPE_SID, p) {
p->signal->tty = NULL;
} while_each_task_pid(current->signal->session, PIDTYPE_SID, p);
read_unlock(&tasklist_lock);
+ up(&tty_sem);
unlock_kernel();
}
@@ -1172,12 +1179,6 @@ static int init_dev(struct tty_driver *driver, int idx,
struct termios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc;
int retval=0;
- /*
- * Check whether we need to acquire the tty semaphore to avoid
- * race conditions. For now, play it safe.
- */
- down(&tty_sem);
-
/* check whether we're reopening an existing tty */
if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
tty = devpts_get_tty(idx);
@@ -1366,7 +1367,6 @@ success:
/* All paths come through here to release the semaphore */
end_init:
- up(&tty_sem);
return retval;
/* Release locally allocated memory ... nothing placed in slots */
@@ -1562,9 +1562,14 @@ static void release_dev(struct file * filp)
* each iteration we avoid any problems.
*/
while (1) {
+ /* Guard against races with tty->count changes elsewhere and
+ opens on /dev/tty */
+
+ down(&tty_sem);
tty_closing = tty->count <= 1;
o_tty_closing = o_tty &&
(o_tty->count <= (pty_master ? 1 : 0));
+ up(&tty_sem);
do_sleep = 0;
if (tty_closing) {
@@ -1600,6 +1605,8 @@ static void release_dev(struct file * filp)
* both sides, and we've completed the last operation that could
* block, so it's safe to proceed with closing.
*/
+
+ down(&tty_sem);
if (pty_master) {
if (--o_tty->count < 0) {
printk(KERN_WARNING "release_dev: bad pty slave count "
@@ -1613,7 +1620,8 @@ static void release_dev(struct file * filp)
tty->count, tty_name(tty, buf));
tty->count = 0;
}
-
+ up(&tty_sem);
+
/*
* We've decremented tty->count, so we need to remove this file
* descriptor off the tty->tty_files list; this serves two
@@ -1760,10 +1768,14 @@ retry_open:
noctty = filp->f_flags & O_NOCTTY;
index = -1;
retval = 0;
+
+ down(&tty_sem);
if (device == MKDEV(TTYAUX_MAJOR,0)) {
- if (!current->signal->tty)
+ if (!current->signal->tty) {
+ up(&tty_sem);
return -ENXIO;
+ }
driver = current->signal->tty->driver;
index = current->signal->tty->index;
filp->f_flags |= O_NONBLOCK; /* Don't let /dev/tty block */
@@ -1788,14 +1800,18 @@ retry_open:
noctty = 1;
goto got_driver;
}
+ up(&tty_sem);
return -ENODEV;
}
driver = get_tty_driver(device, &index);
- if (!driver)
+ if (!driver) {
+ up(&tty_sem);
return -ENODEV;
+ }
got_driver:
retval = init_dev(driver, index, &tty);
+ up(&tty_sem);
if (retval)
return retval;
@@ -1881,7 +1897,10 @@ static int ptmx_open(struct inode * inode, struct file * filp)
}
up(&allocated_ptys_lock);
+ down(&tty_sem);
retval = init_dev(ptm_driver, index, &tty);
+ up(&tty_sem);
+
if (retval)
goto out;
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
index 945b3689183d9..44f5fb4a46efa 100644
--- a/drivers/char/viocons.c
+++ b/drivers/char/viocons.c
@@ -61,8 +61,8 @@
#define VIOCONS_KERN_WARN KERN_WARNING "viocons: "
#define VIOCONS_KERN_INFO KERN_INFO "viocons: "
-static spinlock_t consolelock = SPIN_LOCK_UNLOCKED;
-static spinlock_t consoleloglock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(consolelock);
+static DEFINE_SPINLOCK(consoleloglock);
#ifdef CONFIG_MAGIC_SYSRQ
static int vio_sysrq_pressed;
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
index 6e14abbb4b7fe..a70dd81f4d1bc 100644
--- a/drivers/char/watchdog/machzwd.c
+++ b/drivers/char/watchdog/machzwd.c
@@ -88,12 +88,6 @@ static unsigned short zf_readw(unsigned char port)
return inw(DATA_W);
}
-static unsigned short zf_readb(unsigned char port)
-{
- outb(port, INDEX);
- return inb(DATA_B);
-}
-
MODULE_AUTHOR("Fernando Fuganti <fuganti@conectiva.com.br>");
MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver");
@@ -155,13 +149,6 @@ static unsigned long next_heartbeat = 0;
#endif
-/* STATUS register functions */
-
-static inline unsigned char zf_get_status(void)
-{
- return zf_readb(STATUS);
-}
-
static inline void zf_set_status(unsigned char new)
{
zf_writeb(STATUS, new);
@@ -183,22 +170,6 @@ static inline void zf_set_control(unsigned short new)
/* WD#? counter functions */
/*
- * Just get current counter value
- */
-
-static inline unsigned short zf_get_timer(unsigned char n)
-{
- switch(n){
- case WD1:
- return zf_readw(COUNTER_1);
- case WD2:
- return zf_readb(COUNTER_2);
- default:
- return 0;
- }
-}
-
-/*
* Just set counter value
*/
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index a90f41e4dcdd5..82817bc7ff61f 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -423,7 +423,7 @@ static ide_startstop_t icside_dmaintr(ide_drive_t *drive)
drive->name, dma_stat);
}
- return DRIVER(drive)->error(drive, __FUNCTION__, stat);
+ return ide_error(drive, __FUNCTION__, stat);
}
static int icside_dma_setup(ide_drive_t *drive)
diff --git a/drivers/ide/cris/ide-v10.c b/drivers/ide/cris/ide-v10.c
index 4631b4adf09ac..6a782931c3335 100644
--- a/drivers/ide/cris/ide-v10.c
+++ b/drivers/ide/cris/ide-v10.c
@@ -773,7 +773,7 @@ static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
}
printk("%s: bad DMA status\n", drive->name);
}
- return DRIVER(drive)->error(drive, "dma_intr", stat);
+ return ide_error(drive, "dma_intr", stat);
}
/*
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2dae7b2933144..912dfca74e150 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -559,62 +559,6 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
(void) ide_do_drive_cmd(drive, rq, ide_preempt);
}
-/*
- * ide_error() takes action based on the error returned by the drive.
- */
-static ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat)
-{
- struct request *rq;
- byte err;
-
- err = ide_dump_atapi_status(drive, msg, stat);
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
- /* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, stat, err);
- return ide_stopped;
- }
-
- if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
- /* other bits are useless when BUSY */
- rq->errors |= ERROR_RESET;
- } else {
- /* add decoding error stuff */
- }
- if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
- /* force an abort */
- HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
- if (rq->errors >= ERROR_MAX) {
- DRIVER(drive)->end_request(drive, 0, 0);
- } else {
- if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
- ++rq->errors;
- return ide_do_reset(drive);
- }
- ++rq->errors;
- }
- return ide_stopped;
-}
-
-static ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg)
-{
- struct request *rq;
-
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
- /* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, BUSY_STAT, 0);
- return ide_stopped;
- }
- rq->errors |= ERROR_RESET;
- DRIVER(drive)->end_request(drive, 0, 0);
- return ide_stopped;
-}
-
static void cdrom_end_request (ide_drive_t *drive, int uptodate)
{
struct request *rq = HWGROUP(drive)->rq;
@@ -690,7 +634,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
rq->flags |= REQ_FAILED;
cdrom_end_request(drive, 0);
- DRIVER(drive)->error(drive, "request sense failure", stat);
+ ide_error(drive, "request sense failure", stat);
return 1;
} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
@@ -801,7 +745,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
} else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler
for other errors. */
- DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
+ ide_error(drive, "cdrom_decode_status", stat);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */
@@ -1070,7 +1014,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
ide_end_request(drive, 1, rq->nr_sectors);
return ide_stopped;
} else
- return DRIVER(drive)->error(drive, "dma error", stat);
+ return ide_error(drive, "dma error", stat);
}
/* Read the interrupt reason and the transfer length. */
@@ -1673,7 +1617,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
if (dma_error) {
printk("ide-cd: dma error\n");
__ide_dma_off(drive);
- return DRIVER(drive)->error(drive, "dma error", stat);
+ return ide_error(drive, "dma error", stat);
}
end_that_request_chunk(rq, 1, rq->data_len);
@@ -1811,7 +1755,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
*/
if (dma) {
if (dma_error)
- return DRIVER(drive)->error(drive, "dma error", stat);
+ return ide_error(drive, "dma error", stat);
ide_end_request(drive, 1, rq->nr_sectors);
return ide_stopped;
@@ -2744,9 +2688,9 @@ int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
*/
if (sense.sense_key == NOT_READY) {
if (sense.asc == 0x3a) {
- if (sense.ascq == 0 || sense.ascq == 1)
+ if (sense.ascq == 1)
return CDS_NO_DISC;
- else if (sense.ascq == 2)
+ else if (sense.ascq == 0 || sense.ascq == 2)
return CDS_TRAY_OPEN;
}
}
@@ -3369,9 +3313,6 @@ static ide_driver_t ide_cdrom_driver = {
.supports_dsc_overlap = 1,
.cleanup = ide_cdrom_cleanup,
.do_request = ide_do_rw_cdrom,
- .sense = ide_dump_atapi_status,
- .error = ide_cdrom_error,
- .abort = ide_cdrom_abort,
.capacity = ide_cdrom_capacity,
.attach = ide_cdrom_attach,
.drives = LIST_HEAD_INIT(ide_cdrom_driver.drives),
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 44a49da840698..ee15134a33d3c 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -287,189 +287,6 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s
return __ide_do_rw_disk(drive, rq, block);
}
-static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
-{
- ide_hwif_t *hwif = HWIF(drive);
- unsigned long flags;
- u8 err = 0;
-
- local_irq_set(flags);
- printk("%s: %s: status=0x%02x", drive->name, msg, stat);
- printk(" { ");
- if (stat & BUSY_STAT)
- printk("Busy ");
- else {
- if (stat & READY_STAT) printk("DriveReady ");
- if (stat & WRERR_STAT) printk("DeviceFault ");
- if (stat & SEEK_STAT) printk("SeekComplete ");
- if (stat & DRQ_STAT) printk("DataRequest ");
- if (stat & ECC_STAT) printk("CorrectedError ");
- if (stat & INDEX_STAT) printk("Index ");
- if (stat & ERR_STAT) printk("Error ");
- }
- printk("}");
- printk("\n");
- if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
- err = hwif->INB(IDE_ERROR_REG);
- printk("%s: %s: error=0x%02x", drive->name, msg, err);
- printk(" { ");
- if (err & ABRT_ERR) printk("DriveStatusError ");
- if (err & ICRC_ERR)
- printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
- if (err & ECC_ERR) printk("UncorrectableError ");
- if (err & ID_ERR) printk("SectorIdNotFound ");
- if (err & TRK0_ERR) printk("TrackZeroNotFound ");
- if (err & MARK_ERR) printk("AddrMarkNotFound ");
- printk("}");
- if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR ||
- (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
- if (drive->addressing == 1) {
- __u64 sectors = 0;
- u32 low = 0, high = 0;
- low = ide_read_24(drive);
- hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
- high = ide_read_24(drive);
- sectors = ((__u64)high << 24) | low;
- printk(", LBAsect=%llu, high=%d, low=%d",
- (unsigned long long) sectors,
- high, low);
- } else {
- u8 cur = hwif->INB(IDE_SELECT_REG);
- if (cur & 0x40) { /* using LBA? */
- printk(", LBAsect=%ld", (unsigned long)
- ((cur&0xf)<<24)
- |(hwif->INB(IDE_HCYL_REG)<<16)
- |(hwif->INB(IDE_LCYL_REG)<<8)
- | hwif->INB(IDE_SECTOR_REG));
- } else {
- printk(", CHS=%d/%d/%d",
- (hwif->INB(IDE_HCYL_REG)<<8) +
- hwif->INB(IDE_LCYL_REG),
- cur & 0xf,
- hwif->INB(IDE_SECTOR_REG));
- }
- }
- if (HWGROUP(drive) && HWGROUP(drive)->rq)
- printk(", sector=%llu",
- (unsigned long long)HWGROUP(drive)->rq->sector);
- }
- }
- printk("\n");
- {
- struct request *rq;
- unsigned char opcode = 0;
- int found = 0;
-
- spin_lock(&ide_lock);
- rq = HWGROUP(drive)->rq;
- spin_unlock(&ide_lock);
- if (!rq)
- goto out;
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
- char *args = rq->buffer;
- if (args) {
- opcode = args[0];
- found = 1;
- }
- } else if (rq->flags & REQ_DRIVE_TASKFILE) {
- ide_task_t *args = rq->special;
- if (args) {
- task_struct_t *tf = (task_struct_t *) args->tfRegister;
- opcode = tf->command;
- found = 1;
- }
- }
- printk("ide: failed opcode was: ");
- if (!found)
- printk("unknown\n");
- else
- printk("0x%02x\n", opcode);
- }
-out:
- local_irq_restore(flags);
- return err;
-}
-
-static ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat)
-{
- ide_hwif_t *hwif;
- struct request *rq;
- u8 err;
-
- err = idedisk_dump_status(drive, msg, stat);
-
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
-
- hwif = HWIF(drive);
- /* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, stat, err);
- return ide_stopped;
- }
-
- if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
- /* other bits are useless when BUSY */
- rq->errors |= ERROR_RESET;
- } else if (stat & ERR_STAT) {
- /* err has different meaning on cdrom and tape */
- if (err == ABRT_ERR) {
- if (drive->select.b.lba &&
- /* some newer drives don't support WIN_SPECIFY */
- hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
- return ide_stopped;
- } else if ((err & BAD_CRC) == BAD_CRC) {
- /* UDMA crc error, just retry the operation */
- drive->crc_count++;
- } else if (err & (BBD_ERR | ECC_ERR)) {
- /* retries won't help these */
- rq->errors = ERROR_MAX;
- } else if (err & TRK0_ERR) {
- /* help it find track zero */
- rq->errors |= ERROR_RECAL;
- }
- }
- if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
- try_to_flush_leftover_data(drive);
- if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
- /* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
- }
- if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
- DRIVER(drive)->end_request(drive, 0, 0);
- else {
- if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
- ++rq->errors;
- return ide_do_reset(drive);
- }
- if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
- drive->special.b.recalibrate = 1;
- ++rq->errors;
- }
- return ide_stopped;
-}
-
-static ide_startstop_t idedisk_abort(ide_drive_t *drive, const char *msg)
-{
- ide_hwif_t *hwif;
- struct request *rq;
-
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
-
- hwif = HWIF(drive);
-
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, BUSY_STAT, 0);
- return ide_stopped;
- }
-
- DRIVER(drive)->end_request(drive, 0, 0);
- return ide_stopped;
-}
-
/*
* Queries for true maximum capacity of the drive.
* Returns maximum LBA address (> 0) of the drive, 0 if failed.
@@ -1358,9 +1175,6 @@ static ide_driver_t idedisk_driver = {
.supports_dsc_overlap = 0,
.cleanup = idedisk_cleanup,
.do_request = ide_do_rw_disk,
- .sense = idedisk_dump_status,
- .error = idedisk_error,
- .abort = idedisk_abort,
.pre_reset = idedisk_pre_reset,
.capacity = idedisk_capacity,
.special = idedisk_special,
@@ -1434,7 +1248,7 @@ static int idedisk_media_changed(struct gendisk *disk)
static int idedisk_revalidate_disk(struct gendisk *disk)
{
ide_drive_t *drive = disk->private_data;
- set_capacity(disk, current_capacity(drive));
+ set_capacity(disk, idedisk_capacity(drive));
return 0;
}
@@ -1478,7 +1292,7 @@ static int idedisk_attach(ide_drive_t *drive)
strcpy(g->devfs_name, drive->devfs_name);
g->driverfs_dev = &drive->gendev;
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
- set_capacity(g, current_capacity(drive));
+ set_capacity(g, idedisk_capacity(drive));
g->fops = &idedisk_ops;
add_disk(g);
return 0;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index aeaed74f949a2..560e483eb63d4 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -116,7 +116,6 @@ static const struct drive_list_entry drive_blacklist [] = {
{ "Compaq CRD-8241B" , "ALL" },
{ "CRD-8400B" , "ALL" },
{ "CRD-8480B", "ALL" },
- { "CRD-8480C", "ALL" },
{ "CRD-8482B", "ALL" },
{ "CRD-84" , "ALL" },
{ "SanDisk SDP3B" , "ALL" },
@@ -184,7 +183,7 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive)
printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
- return DRIVER(drive)->error(drive, "dma_intr", stat);
+ return ide_error(drive, "dma_intr", stat);
}
EXPORT_SYMBOL_GPL(ide_dma_intr);
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 39819daed56c9..8e5c808517743 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1640,7 +1640,7 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)
}
/*
- * Return the current floppy capacity to ide.c.
+ * Return the current floppy capacity.
*/
static sector_t idefloppy_capacity (ide_drive_t *drive)
{
@@ -2034,7 +2034,7 @@ static int idefloppy_media_changed(struct gendisk *disk)
static int idefloppy_revalidate_disk(struct gendisk *disk)
{
ide_drive_t *drive = disk->private_data;
- set_capacity(disk, current_capacity(drive));
+ set_capacity(disk, idefloppy_capacity(drive));
return 0;
}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 5eff90ebe1987..e0ab726b1e436 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -454,9 +454,88 @@ void try_to_flush_leftover_data (ide_drive_t *drive)
EXPORT_SYMBOL(try_to_flush_leftover_data);
-/*
- * FIXME Add an ATAPI error
- */
+static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+ ide_hwif_t *hwif = drive->hwif;
+
+ if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
+ /* other bits are useless when BUSY */
+ rq->errors |= ERROR_RESET;
+ } else if (stat & ERR_STAT) {
+ /* err has different meaning on cdrom and tape */
+ if (err == ABRT_ERR) {
+ if (drive->select.b.lba &&
+ /* some newer drives don't support WIN_SPECIFY */
+ hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY)
+ return ide_stopped;
+ } else if ((err & BAD_CRC) == BAD_CRC) {
+ /* UDMA crc error, just retry the operation */
+ drive->crc_count++;
+ } else if (err & (BBD_ERR | ECC_ERR)) {
+ /* retries won't help these */
+ rq->errors = ERROR_MAX;
+ } else if (err & TRK0_ERR) {
+ /* help it find track zero */
+ rq->errors |= ERROR_RECAL;
+ }
+ }
+
+ if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
+ try_to_flush_leftover_data(drive);
+
+ if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+ /* force an abort */
+ hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
+
+ if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
+ drive->driver->end_request(drive, 0, 0);
+ else {
+ if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+ ++rq->errors;
+ return ide_do_reset(drive);
+ }
+ if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
+ drive->special.b.recalibrate = 1;
+ ++rq->errors;
+ }
+ return ide_stopped;
+}
+
+static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+ ide_hwif_t *hwif = drive->hwif;
+
+ if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
+ /* other bits are useless when BUSY */
+ rq->errors |= ERROR_RESET;
+ } else {
+ /* add decoding error stuff */
+ }
+
+ if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+ /* force an abort */
+ hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
+
+ if (rq->errors >= ERROR_MAX) {
+ drive->driver->end_request(drive, 0, 0);
+ } else {
+ if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+ ++rq->errors;
+ return ide_do_reset(drive);
+ }
+ ++rq->errors;
+ }
+
+ return ide_stopped;
+}
+
+ide_startstop_t
+__ide_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
+{
+ if (drive->media == ide_disk)
+ return ide_ata_error(drive, rq, stat, err);
+ return ide_atapi_error(drive, rq, stat, err);
+}
/**
* ide_error - handle an error on the IDE
@@ -473,73 +552,32 @@ EXPORT_SYMBOL(try_to_flush_leftover_data);
ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
{
- ide_hwif_t *hwif;
struct request *rq;
u8 err;
err = ide_dump_status(drive, msg, stat);
+
if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
return ide_stopped;
- hwif = HWIF(drive);
/* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, stat, err);
- return ide_stopped;
- }
- if (rq->flags & REQ_DRIVE_TASKFILE) {
+ if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
rq->errors = 1;
ide_end_drive_cmd(drive, stat, err);
return ide_stopped;
}
- if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) {
- /* other bits are useless when BUSY */
+ return drive->driver->error(drive, rq, stat, err);
+}
+
+EXPORT_SYMBOL_GPL(ide_error);
+
+ide_startstop_t __ide_abort(ide_drive_t *drive, struct request *rq)
+{
+ if (drive->media != ide_disk)
rq->errors |= ERROR_RESET;
- } else {
- if (drive->media != ide_disk)
- goto media_out;
-
- if (stat & ERR_STAT) {
- /* err has different meaning on cdrom and tape */
- if (err == ABRT_ERR) {
- if (drive->select.b.lba &&
- (hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY))
- /* some newer drives don't
- * support WIN_SPECIFY
- */
- return ide_stopped;
- } else if ((err & BAD_CRC) == BAD_CRC) {
- drive->crc_count++;
- /* UDMA crc error -- just retry the operation */
- } else if (err & (BBD_ERR | ECC_ERR)) {
- /* retries won't help these */
- rq->errors = ERROR_MAX;
- } else if (err & TRK0_ERR) {
- /* help it find track zero */
- rq->errors |= ERROR_RECAL;
- }
- }
-media_out:
- if ((stat & DRQ_STAT) && rq_data_dir(rq) != WRITE)
- try_to_flush_leftover_data(drive);
- }
- if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
- /* force an abort */
- hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
- }
- if (rq->errors >= ERROR_MAX) {
- DRIVER(drive)->end_request(drive, 0, 0);
- } else {
- if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
- ++rq->errors;
- return ide_do_reset(drive);
- }
- if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
- drive->special.b.recalibrate = 1;
- ++rq->errors;
- }
+
+ DRIVER(drive)->end_request(drive, 0, 0);
return ide_stopped;
}
@@ -559,28 +597,19 @@ media_out:
ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg)
{
- ide_hwif_t *hwif;
struct request *rq;
if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
return ide_stopped;
- hwif = HWIF(drive);
/* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, BUSY_STAT, 0);
- return ide_stopped;
- }
- if (rq->flags & REQ_DRIVE_TASKFILE) {
+ if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
rq->errors = 1;
ide_end_drive_cmd(drive, BUSY_STAT, 0);
return ide_stopped;
}
- rq->errors |= ERROR_RESET;
- DRIVER(drive)->end_request(drive, 0, 0);
- return ide_stopped;
+ return drive->driver->abort(drive, rq);
}
/**
@@ -634,7 +663,7 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
}
if (!OK_STAT(stat, READY_STAT, BAD_STAT) && DRIVER(drive) != NULL)
- return DRIVER(drive)->error(drive, "drive_cmd", stat);
+ return ide_error(drive, "drive_cmd", stat);
/* calls ide_end_drive_cmd */
ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG));
return ide_stopped;
@@ -1181,7 +1210,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
if (error < 0) {
printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
(void)HWIF(drive)->ide_dma_end(drive);
- ret = DRIVER(drive)->error(drive, "dma timeout error",
+ ret = ide_error(drive, "dma timeout error",
hwif->INB(IDE_STATUS_REG));
} else {
printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
@@ -1212,7 +1241,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
rq->sector = rq->bio->bi_sector;
rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
rq->hard_cur_sectors = rq->current_nr_sectors;
- rq->buffer = NULL;
+ rq->buffer = bio_data(rq->bio);
out:
return ret;
}
@@ -1304,7 +1333,7 @@ void ide_timer_expiry (unsigned long data)
startstop = ide_dma_timeout_retry(drive, wait);
} else
startstop =
- DRIVER(drive)->error(drive, "irq timeout", hwif->INB(IDE_STATUS_REG));
+ ide_error(drive, "irq timeout", hwif->INB(IDE_STATUS_REG));
}
drive->service_time = jiffies - drive->service_start;
spin_lock_irq(&ide_lock);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 68adac6a44fb4..acb56b26fa326 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -576,7 +576,7 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b
break;
local_irq_restore(flags);
- *startstop = DRIVER(drive)->error(drive, "status timeout", stat);
+ *startstop = ide_error(drive, "status timeout", stat);
return 1;
}
}
@@ -594,7 +594,7 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b
if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), good, bad))
return 0;
}
- *startstop = DRIVER(drive)->error(drive, "status error", stat);
+ *startstop = ide_error(drive, "status error", stat);
return 1;
}
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 1050de22645b1..26ceda6134d6e 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -445,6 +445,114 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
EXPORT_SYMBOL_GPL(ide_set_xfer_rate);
+static void ide_dump_opcode(ide_drive_t *drive)
+{
+ struct request *rq;
+ u8 opcode = 0;
+ int found = 0;
+
+ spin_lock(&ide_lock);
+ rq = NULL;
+ if (HWGROUP(drive))
+ rq = HWGROUP(drive)->rq;
+ spin_unlock(&ide_lock);
+ if (!rq)
+ return;
+ if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
+ char *args = rq->buffer;
+ if (args) {
+ opcode = args[0];
+ found = 1;
+ }
+ } else if (rq->flags & REQ_DRIVE_TASKFILE) {
+ ide_task_t *args = rq->special;
+ if (args) {
+ task_struct_t *tf = (task_struct_t *) args->tfRegister;
+ opcode = tf->command;
+ found = 1;
+ }
+ }
+
+ printk("ide: failed opcode was: ");
+ if (!found)
+ printk("unknown\n");
+ else
+ printk("0x%02x\n", opcode);
+}
+
+static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
+{
+ ide_hwif_t *hwif = HWIF(drive);
+ unsigned long flags;
+ u8 err = 0;
+
+ local_irq_set(flags);
+ printk("%s: %s: status=0x%02x", drive->name, msg, stat);
+ printk(" { ");
+ if (stat & BUSY_STAT)
+ printk("Busy ");
+ else {
+ if (stat & READY_STAT) printk("DriveReady ");
+ if (stat & WRERR_STAT) printk("DeviceFault ");
+ if (stat & SEEK_STAT) printk("SeekComplete ");
+ if (stat & DRQ_STAT) printk("DataRequest ");
+ if (stat & ECC_STAT) printk("CorrectedError ");
+ if (stat & INDEX_STAT) printk("Index ");
+ if (stat & ERR_STAT) printk("Error ");
+ }
+ printk("}");
+ printk("\n");
+ if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
+ err = hwif->INB(IDE_ERROR_REG);
+ printk("%s: %s: error=0x%02x", drive->name, msg, err);
+ printk(" { ");
+ if (err & ABRT_ERR) printk("DriveStatusError ");
+ if (err & ICRC_ERR)
+ printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
+ if (err & ECC_ERR) printk("UncorrectableError ");
+ if (err & ID_ERR) printk("SectorIdNotFound ");
+ if (err & TRK0_ERR) printk("TrackZeroNotFound ");
+ if (err & MARK_ERR) printk("AddrMarkNotFound ");
+ printk("}");
+ if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR ||
+ (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
+ if (drive->addressing == 1) {
+ __u64 sectors = 0;
+ u32 low = 0, high = 0;
+ low = ide_read_24(drive);
+ hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
+ high = ide_read_24(drive);
+ sectors = ((__u64)high << 24) | low;
+ printk(", LBAsect=%llu, high=%d, low=%d",
+ (unsigned long long) sectors,
+ high, low);
+ } else {
+ u8 cur = hwif->INB(IDE_SELECT_REG);
+ if (cur & 0x40) { /* using LBA? */
+ printk(", LBAsect=%ld", (unsigned long)
+ ((cur&0xf)<<24)
+ |(hwif->INB(IDE_HCYL_REG)<<16)
+ |(hwif->INB(IDE_LCYL_REG)<<8)
+ | hwif->INB(IDE_SECTOR_REG));
+ } else {
+ printk(", CHS=%d/%d/%d",
+ (hwif->INB(IDE_HCYL_REG)<<8) +
+ hwif->INB(IDE_LCYL_REG),
+ cur & 0xf,
+ hwif->INB(IDE_SECTOR_REG));
+ }
+ }
+ if (HWGROUP(drive) && HWGROUP(drive)->rq)
+ printk(", sector=%llu",
+ (unsigned long long)HWGROUP(drive)->rq->sector);
+ }
+ }
+ printk("\n");
+ ide_dump_opcode(drive);
+ local_irq_restore(flags);
+ return err;
+}
+
/**
* ide_dump_atapi_status - print human readable atapi status
* @drive: drive that status applies to
@@ -453,7 +561,8 @@ EXPORT_SYMBOL_GPL(ide_set_xfer_rate);
*
* Error reporting, in human readable form (luxurious, but a memory hog).
*/
-byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat)
+
+static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat)
{
unsigned long flags;
@@ -488,8 +597,27 @@ byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat)
error.b.sense_key);
printk("\n");
}
+ ide_dump_opcode(drive);
local_irq_restore(flags);
return error.all;
}
-EXPORT_SYMBOL(ide_dump_atapi_status);
+/**
+ * ide_dump_status - translate ATA/ATAPI error
+ * @drive: drive the error occured on
+ * @msg: information string
+ * @stat: status byte
+ *
+ * Error reporting, in human readable form (luxurious, but a memory hog).
+ * Combines the drive name, message and status byte to provide a
+ * user understandable explanation of the device error.
+ */
+
+u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
+{
+ if (drive->media == ide_disk)
+ return ide_dump_ata_status(drive, msg, stat);
+ return ide_dump_atapi_status(drive, msg, stat);
+}
+
+EXPORT_SYMBOL(ide_dump_status);
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 182980eec4773..2b8d743f8a926 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -199,7 +199,7 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive)
return ide_stopped;
if (stat & (ERR_STAT|DRQ_STAT))
- return DRIVER(drive)->error(drive, "set_geometry_intr", stat);
+ return ide_error(drive, "set_geometry_intr", stat);
if (HWGROUP(drive)->handler != NULL)
BUG();
@@ -218,7 +218,7 @@ ide_startstop_t recal_intr (ide_drive_t *drive)
u8 stat;
if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), READY_STAT, BAD_STAT))
- return DRIVER(drive)->error(drive, "recal_intr", stat);
+ return ide_error(drive, "recal_intr", stat);
return ide_stopped;
}
@@ -235,7 +235,7 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive)
local_irq_enable();
if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) {
- return DRIVER(drive)->error(drive, "task_no_data_intr", stat);
+ return ide_error(drive, "task_no_data_intr", stat);
/* calls ide_end_drive_cmd */
}
if (args)
@@ -363,7 +363,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
if (sectors > 0)
drive->driver->end_request(drive, 1, sectors);
}
- return drive->driver->error(drive, s, stat);
+ return ide_error(drive, s, stat);
}
static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 12509b6cabc62..2e50f8597b833 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -358,137 +358,6 @@ int ide_system_bus_speed (void)
return system_bus_speed;
}
-/**
- * current_capacity - drive capacity
- * @drive: drive to query
- *
- * Return the current capacity (in sectors) of a drive according to
- * its current geometry/LBA settings. Empty removables are reported
- * as size zero.
- */
-
-sector_t current_capacity (ide_drive_t *drive)
-{
- if (!drive->present)
- return 0;
- return DRIVER(drive)->capacity(drive);
-}
-
-EXPORT_SYMBOL(current_capacity);
-
-/**
- * ide_dump_status - translate ATA error
- * @drive: drive the error occured on
- * @msg: information string
- * @stat: status byte
- *
- * Error reporting, in human readable form (luxurious, but a memory hog).
- * Combines the drive name, message and status byte to provide a
- * user understandable explanation of the device error.
- */
-
-u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
-{
- ide_hwif_t *hwif = HWIF(drive);
- unsigned long flags;
- u8 err = 0;
-
- local_irq_set(flags);
- printk(KERN_WARNING "%s: %s: status=0x%02x", drive->name, msg, stat);
- printk(" { ");
- if (stat & BUSY_STAT) {
- printk("Busy ");
- } else {
- if (stat & READY_STAT) printk("DriveReady ");
- if (stat & WRERR_STAT) printk("DeviceFault ");
- if (stat & SEEK_STAT) printk("SeekComplete ");
- if (stat & DRQ_STAT) printk("DataRequest ");
- if (stat & ECC_STAT) printk("CorrectedError ");
- if (stat & INDEX_STAT) printk("Index ");
- if (stat & ERR_STAT) printk("Error ");
- }
- printk("}");
- printk("\n");
- if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
- err = hwif->INB(IDE_ERROR_REG);
- printk("%s: %s: error=0x%02x", drive->name, msg, err);
- if (drive->media == ide_disk) {
- printk(" { ");
- if (err & ABRT_ERR) printk("DriveStatusError ");
- if (err & ICRC_ERR) printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector");
- if (err & ECC_ERR) printk("UncorrectableError ");
- if (err & ID_ERR) printk("SectorIdNotFound ");
- if (err & TRK0_ERR) printk("TrackZeroNotFound ");
- if (err & MARK_ERR) printk("AddrMarkNotFound ");
- printk("}");
- if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR || (err & (ECC_ERR|ID_ERR|MARK_ERR))) {
- if ((drive->id->command_set_2 & 0x0400) &&
- (drive->id->cfs_enable_2 & 0x0400) &&
- (drive->addressing == 1)) {
- u64 sectors = 0;
- u32 high = 0;
- u32 low = ide_read_24(drive);
- hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
- high = ide_read_24(drive);
-
- sectors = ((u64)high << 24) | low;
- printk(", LBAsect=%llu, high=%d, low=%d",
- (long long) sectors,
- high, low);
- } else {
- u8 cur = hwif->INB(IDE_SELECT_REG);
- if (cur & 0x40) { /* using LBA? */
- printk(", LBAsect=%ld", (unsigned long)
- ((cur&0xf)<<24)
- |(hwif->INB(IDE_HCYL_REG)<<16)
- |(hwif->INB(IDE_LCYL_REG)<<8)
- | hwif->INB(IDE_SECTOR_REG));
- } else {
- printk(", CHS=%d/%d/%d",
- (hwif->INB(IDE_HCYL_REG)<<8) +
- hwif->INB(IDE_LCYL_REG),
- cur & 0xf,
- hwif->INB(IDE_SECTOR_REG));
- }
- }
- if (HWGROUP(drive) && HWGROUP(drive)->rq)
- printk(", sector=%llu", (unsigned long long)HWGROUP(drive)->rq->sector);
- }
- }
- printk("\n");
- }
- {
- struct request *rq;
- int opcode = 0x100;
-
- spin_lock(&ide_lock);
- rq = NULL;
- if (HWGROUP(drive))
- rq = HWGROUP(drive)->rq;
- spin_unlock(&ide_lock);
- if (!rq)
- goto out;
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
- char *args = rq->buffer;
- if (args)
- opcode = args[0];
- } else if (rq->flags & REQ_DRIVE_TASKFILE) {
- ide_task_t *args = rq->special;
- if (args) {
- task_struct_t *tf = (task_struct_t *) args->tfRegister;
- opcode = tf->command;
- }
- }
-
- printk("ide: failed opcode was %x\n", opcode);
- }
-out:
- local_irq_restore(flags);
- return err;
-}
-
-EXPORT_SYMBOL(ide_dump_status);
-
static int ide_open (struct inode * inode, struct file * filp)
{
return -ENXIO;
@@ -1673,8 +1542,9 @@ int generic_ide_ioctl(struct file *file, struct block_device *bdev,
*/
spin_lock_irqsave(&ide_lock, flags);
-
- DRIVER(drive)->abort(drive, "drive reset");
+
+ ide_abort(drive, "drive reset");
+
if(HWGROUP(drive)->handler)
BUG();
@@ -2180,14 +2050,10 @@ static int default_end_request (ide_drive_t *drive, int uptodate, int nr_sects)
return ide_end_request(drive, uptodate, nr_sects);
}
-static u8 default_sense (ide_drive_t *drive, const char *msg, u8 stat)
-{
- return ide_dump_status(drive, msg, stat);
-}
-
-static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, u8 stat)
+static ide_startstop_t
+default_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
{
- return ide_error(drive, msg, stat);
+ return __ide_error(drive, rq, stat, err);
}
static void default_pre_reset (ide_drive_t *drive)
@@ -2216,9 +2082,9 @@ static int default_attach (ide_drive_t *drive)
return 0;
}
-static ide_startstop_t default_abort (ide_drive_t *drive, const char *msg)
+static ide_startstop_t default_abort(ide_drive_t *drive, struct request *rq)
{
- return ide_abort(drive, msg);
+ return __ide_abort(drive, rq);
}
static ide_startstop_t default_start_power_step(ide_drive_t *drive,
@@ -2233,7 +2099,6 @@ static void setup_driver_defaults (ide_driver_t *d)
if (d->cleanup == NULL) d->cleanup = default_cleanup;
if (d->do_request == NULL) d->do_request = default_do_request;
if (d->end_request == NULL) d->end_request = default_end_request;
- if (d->sense == NULL) d->sense = default_sense;
if (d->error == NULL) d->error = default_error;
if (d->abort == NULL) d->abort = default_abort;
if (d->pre_reset == NULL) d->pre_reset = default_pre_reset;
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 36426f72cb3f8..abab060fd230b 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -62,12 +62,12 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver");
MODULE_LICENSE("Dual MPL/GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Bit map of interrupts to choose from */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 91199f71f8a8d..99ef30c6fd469 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -701,17 +701,11 @@ pci_init_sgiioc4(struct pci_dev *dev, ide_pci_device_t * d)
"firmware is obsolete - please upgrade to revision"
"46 or higher\n", d->name, dev->slot_name);
ret = -EAGAIN;
- goto err_disable;
+ goto out;
}
ret = sgiioc4_ide_setup_pci_device(dev, d);
- if (ret < 0)
- goto err_disable;
out:
return ret;
-
-err_disable:
- pci_disable_device(dev);
- goto out;
}
static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 011d3f27e6584..9c7ea648d471a 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -52,7 +52,7 @@
#include "ide-timing.h"
-#define IDE_PMAC_DEBUG
+#undef IDE_PMAC_DEBUG
#define DMA_WAIT_TIMEOUT 50
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 3b3c21212a5d2..e501675ad72e6 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -311,13 +311,11 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
if (ret < 0) {
printk(KERN_ERR "%s: can't set dma mask\n", d->name);
- pci_disable_device(dev);
goto out;
}
/* FIXME: Temporary - until we put in the hotplug interface logic
- Check that the bits we want are not in use by someone else.
- As someone else uses it, we do not (yuck) disable the device */
+ Check that the bits we want are not in use by someone else. */
ret = pci_request_region(dev, 4, "ide_tmp");
if (ret < 0)
goto out;
@@ -542,12 +540,12 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in
ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
if (ret < 0) {
printk(KERN_ERR "%s: error accessing PCI regs\n", d->name);
- goto err_disable;
+ goto out;
}
if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */
ret = ide_pci_configure(dev, d);
if (ret < 0)
- goto err_disable;
+ goto out;
*config = 1;
printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
}
@@ -558,17 +556,6 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in
printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
out:
return ret;
-
-err_disable:
- pci_disable_device(dev);
- goto out;
-}
-
-static void ide_release_pci_controller(struct pci_dev *dev, ide_pci_device_t *d,
- int noisy)
-{
- /* Balance ide_pci_enable() */
- pci_disable_device(dev);
}
/**
@@ -701,7 +688,7 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
*/
ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0;
if (ret < 0)
- goto err_release_pci_controller;
+ goto out;
pciirq = ret;
} else if (tried_config) {
if (noisy)
@@ -716,7 +703,7 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
if (d->init_chipset) {
ret = d->init_chipset(dev, d->name);
if (ret < 0)
- goto err_release_pci_controller;
+ goto out;
}
if (noisy)
#ifdef __sparc__
@@ -734,10 +721,6 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
ide_pci_setup_ports(dev, d, pciirq, index);
out:
return ret;
-
-err_release_pci_controller:
- ide_release_pci_controller(dev, d, noisy);
- goto out;
}
int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
diff --git a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c
index 6bfc74d87989c..1b98684aebcd7 100644
--- a/drivers/ieee1394/csr.c
+++ b/drivers/ieee1394/csr.c
@@ -201,7 +201,7 @@ static void add_host(struct hpsb_host *host)
CSR_REGISTER_BASE + CSR_SPEED_MAP,
CSR_REGISTER_BASE + CSR_SPEED_MAP_END);
- host->csr.lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&host->csr.lock);
host->csr.state = 0;
host->csr.node_ids = 0;
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 1c8d1c813731c..9b01d57486e3f 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -168,11 +168,11 @@ MODULE_LICENSE("GPL");
* consume in the event that some partial datagrams are never completed. This
* should probably change to a sysctl item or the like if possible.
*/
-MODULE_PARM(max_partial_datagrams, "i");
+static int max_partial_datagrams = 25;
+module_param(max_partial_datagrams, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(max_partial_datagrams,
"Maximum number of partially received fragmented datagrams "
"(default = 25).");
-static int max_partial_datagrams = 25;
static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
index dc78e2183c5f1..4bd76bf7d479a 100644
--- a/drivers/ieee1394/pcilynx.c
+++ b/drivers/ieee1394/pcilynx.c
@@ -1546,8 +1546,8 @@ static int __devinit add_card(struct pci_dev *dev,
host->pdev = dev;
pci_set_drvdata(dev, lynx);
- lynx->lock = SPIN_LOCK_UNLOCKED;
- lynx->phy_reg_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&lynx->lock);
+ spin_lock_init(&lynx->phy_reg_lock);
#ifndef CONFIG_IEEE1394_PCILYNX_LOCALRAM
lynx->pcl_mem = pci_alloc_consistent(dev, LOCALRAM_SIZE,
@@ -1659,11 +1659,11 @@ static int __devinit add_card(struct pci_dev *dev,
tasklet_init(&lynx->iso_rcv.tq, (void (*)(unsigned long))iso_rcv_bh,
(unsigned long)lynx);
- lynx->iso_rcv.lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&lynx->iso_rcv.lock);
- lynx->async.queue_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&lynx->async.queue_lock);
lynx->async.channel = CHANNEL_ASYNC_SEND;
- lynx->iso_send.queue_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&lynx->iso_send.queue_lock);
lynx->iso_send.channel = CHANNEL_ISO_SEND;
PRINT(KERN_INFO, lynx->id, "remapped memory spaces reg 0x%p, rom 0x%p, "
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index aa9ab3378e4c7..125eb6c64f6ab 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -708,7 +708,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse);
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed);
INIT_LIST_HEAD(&scsi_id->scsi_list);
- scsi_id->sbp2_command_orb_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&scsi_id->sbp2_command_orb_lock);
scsi_id->sbp2_device_type_and_lun = SBP2_DEVICE_TYPE_LUN_UNINITIALIZED;
ud->device.driver_data = scsi_id;
diff --git a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig
index 67064b1a01846..4473553389602 100644
--- a/drivers/input/gameport/Kconfig
+++ b/drivers/input/gameport/Kconfig
@@ -84,7 +84,7 @@ config GAMEPORT_FM801
tristate "ForteMedia FM801 gameport support"
depends on GAMEPORT
-config GAMEPORT_CS461x
+config GAMEPORT_CS461X
tristate "Crystal SoundFusion gameport support"
depends on GAMEPORT
diff --git a/drivers/input/gameport/Makefile b/drivers/input/gameport/Makefile
index 5d8305bb11f5e..5367b4267adf8 100644
--- a/drivers/input/gameport/Makefile
+++ b/drivers/input/gameport/Makefile
@@ -5,7 +5,7 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_GAMEPORT) += gameport.o
-obj-$(CONFIG_GAMEPORT_CS461x) += cs461x.o
+obj-$(CONFIG_GAMEPORT_CS461X) += cs461x.o
obj-$(CONFIG_GAMEPORT_EMU10K1) += emu10k1-gp.o
obj-$(CONFIG_GAMEPORT_FM801) += fm801-gp.o
obj-$(CONFIG_GAMEPORT_L4) += lightning.o
diff --git a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c
index 78f4d9b5a5d9a..3175c392fabc9 100644
--- a/drivers/input/serio/maceps2.c
+++ b/drivers/input/serio/maceps2.c
@@ -90,7 +90,7 @@ static int maceps2_open(struct serio *dev)
{
struct maceps2_data *data = (struct maceps2_data *)dev->port_data;
- if (request_irq(data->irq, maceps2_interrupt, 0, "PS/2 port", dev)) {
+ if (request_irq(data->irq, maceps2_interrupt, 0, "PS2 port", dev)) {
printk(KERN_ERR "Could not allocate PS/2 IRQ\n");
return -EBUSY;
}
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 07522663b800f..d89dcde4eadef 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -40,10 +40,10 @@ MODULE_PARM_DESC(act_bus, "BusType of first card, 1=ISA, 2=MCA, 3=PCMCIA, curren
MODULE_PARM_DESC(membase, "Base port address of first card");
MODULE_PARM_DESC(act_irq, "IRQ of first card");
MODULE_PARM_DESC(act_id, "ID-String of first card");
-MODULE_PARM(act_bus, "i");
-MODULE_PARM(act_port, "i");
-MODULE_PARM(act_irq, "i");
-MODULE_PARM(act_id, "s");
+module_param(act_bus, int, 0);
+module_param(act_port, int, 0);
+module_param(act_irq, int, 0);
+module_param(act_id, charp, 0);
static int act2000_addcard(int, int, int, char *);
diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c
index ebb30cf3a1fb9..9746cc5ffff8d 100644
--- a/drivers/isdn/hardware/avm/b1pcmcia.c
+++ b/drivers/isdn/hardware/avm/b1pcmcia.c
@@ -200,7 +200,6 @@ static int __init b1pcmcia_init(void)
{
char *p;
char rev[32];
- int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c
index 989cdef607764..a02fdfb0906a0 100644
--- a/drivers/isdn/hardware/eicon/divamnt.c
+++ b/drivers/isdn/hardware/eicon/divamnt.c
@@ -34,9 +34,9 @@ MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
int buffer_length = 128;
-MODULE_PARM(buffer_length, "i");
+module_param(buffer_length, int, 0);
unsigned long diva_dbg_mem = 0;
-MODULE_PARM(diva_dbg_mem, "l");
+module_param(diva_dbg_mem, ulong, 0);
static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)";
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index e849864ed4d9e..3b06dbb113fc9 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -51,7 +51,7 @@ MODULE_DESCRIPTION("Kernel driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_LICENSE("GPL");
-MODULE_PARM(dbgmask, "i");
+module_param(dbgmask, int, 0);
MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME =
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 79091cf202a5a..06ce6605517b1 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -41,7 +41,7 @@ MODULE_LICENSE("GPL");
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)";
@@ -57,8 +57,8 @@ static int default_irq_list[11] = { 15, 13, 12, 11, 10, 9, 7, 5, 4, 3, -1 };
static int irq_list[11] = { -1 };
static int isdnprot = 2;
-MODULE_PARM(irq_list, "1-11i");
-MODULE_PARM(isdnprot, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
+module_param(isdnprot, int, 0);
/*====================================================================*/
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 15b80c844205d..1663ee69d41d2 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -354,20 +354,18 @@ static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
static char *id = HiSaxID;
-#define PARM_PARA "1-" __MODULE_STRING(HISAX_MAX_CARDS) "i"
-
MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
MODULE_AUTHOR("Karsten Keil");
MODULE_LICENSE("GPL");
-MODULE_PARM(type, PARM_PARA);
-MODULE_PARM(protocol, PARM_PARA);
-MODULE_PARM(io, PARM_PARA);
-MODULE_PARM(irq, PARM_PARA);
-MODULE_PARM(mem, PARM_PARA);
-MODULE_PARM(id, "s");
+module_param_array(type, int, NULL, 0);
+module_param_array(protocol, int, NULL, 0);
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
+module_param(id, charp, 0);
#ifdef IO0_IO1
-MODULE_PARM(io0, PARM_PARA);
-MODULE_PARM(io1, PARM_PARA);
+module_param_array(io0, int, NULL, 0);
+module_param_array(io1, int, NULL, 0);
#endif
#endif /* MODULE */
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 0c198804ea0b3..5087eefd1e3dd 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -69,7 +69,7 @@ MODULE_LICENSE("Dual MPL/GPL");
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"elsa_cs.c $Revision: 1.2.2.4 $ $Date: 2004/01/25 15:07:06 $ (K.Lichtenwalder)";
@@ -88,11 +88,11 @@ static u_long irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, ulong, 0);
+module_param_array(irq_list, int, NULL, 0);
static int protocol = 2; /* EURO-ISDN Default */
-MODULE_PARM(protocol, "i");
+module_param(protocol, int, 0);
/*====================================================================*/
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 987d441c92d3e..e8fd6af948c3d 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -45,8 +45,8 @@
#ifdef CONFIG_HISAX_DEBUG
static int debug = 0;
/* static int hdlcfifosize = 32; */
-MODULE_PARM(debug, "i");
-/* MODULE_PARM(hdlcfifosize, "i"); */
+module_param(debug, int, 0);
+/* module_param(hdlcfifosize, int, 0); */
#endif
MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
@@ -81,7 +81,7 @@ MODULE_DEVICE_TABLE(isapnp, fcpnp_ids);
#endif
static int protocol = 2; /* EURO-ISDN Default */
-MODULE_PARM(protocol, "i");
+module_param(protocol, int, 0);
MODULE_LICENSE("GPL");
// ----------------------------------------------------------------------
diff --git a/drivers/isdn/hisax/hisax_isac.c b/drivers/isdn/hisax/hisax_isac.c
index 77f1320fc2690..f4972f6c1f5d2 100644
--- a/drivers/isdn/hisax/hisax_isac.c
+++ b/drivers/isdn/hisax/hisax_isac.c
@@ -32,7 +32,7 @@
#ifdef CONFIG_HISAX_DEBUG
static int debug = 1;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
static char *ISACVer[] = {
"2086/2186 V1.1",
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 3008adee4270b..44545eaf8333f 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -69,7 +69,7 @@ MODULE_LICENSE("Dual MPL/GPL");
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)";
@@ -88,11 +88,11 @@ static u_int irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
static int protocol = 2; /* EURO-ISDN Default */
-MODULE_PARM(protocol, "i");
+module_param(protocol, int, 0);
/*====================================================================*/
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c
index 92676bd60db6c..251956823729f 100644
--- a/drivers/isdn/hisax/st5481_init.c
+++ b/drivers/isdn/hisax/st5481_init.c
@@ -37,14 +37,14 @@ MODULE_AUTHOR("Frode Isaksen");
MODULE_LICENSE("GPL");
static int protocol = 2; /* EURO-ISDN Default */
-MODULE_PARM(protocol, "i");
+module_param(protocol, int, 0);
static int number_of_leds = 2; /* 2 LEDs on the adpater default */
-MODULE_PARM(number_of_leds, "i");
+module_param(number_of_leds, int, 0);
#ifdef CONFIG_HISAX_DEBUG
static int debug = 0x1;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
int st5481_debug;
#endif
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 74b89d8a11b37..b84b3a21553cd 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"teles_cs.c 2.10 2002/07/30 22:23:34 kkeil";
@@ -69,11 +69,11 @@ static u_long irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, ulong, 0);
+module_param_array(irq_list, int, NULL, 0);
static int protocol = 2; /* EURO-ISDN Default */
-MODULE_PARM(protocol, "i");
+module_param(protocol, int, 0);
/*====================================================================*/
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 70989aa4c157c..20c13c12802ca 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -21,13 +21,13 @@ static char *icn_id2 = "\0";
MODULE_DESCRIPTION("ISDN4Linux: Driver for ICN active ISDN card");
MODULE_AUTHOR("Fritz Elfert");
MODULE_LICENSE("GPL");
-MODULE_PARM(portbase, "i");
+module_param(portbase, int, 0);
MODULE_PARM_DESC(portbase, "Port address of first card");
-MODULE_PARM(membase, "l");
+module_param(membase, ulong, 0);
MODULE_PARM_DESC(membase, "Shared memory address of all cards");
-MODULE_PARM(icn_id, "s");
+module_param(icn_id, charp, 0);
MODULE_PARM_DESC(icn_id, "ID-String of first card");
-MODULE_PARM(icn_id2, "s");
+module_param(icn_id2, charp, 0);
MODULE_PARM_DESC(icn_id2, "ID-String of first card, second S0 (4B only)");
/*
diff --git a/drivers/isdn/pcbit/module.c b/drivers/isdn/pcbit/module.c
index c546ad3c81280..282073a35d6a4 100644
--- a/drivers/isdn/pcbit/module.c
+++ b/drivers/isdn/pcbit/module.c
@@ -22,12 +22,13 @@
MODULE_DESCRIPTION("ISDN4Linux: Driver for PCBIT-T card");
MODULE_AUTHOR("Pedro Roque Marques");
MODULE_LICENSE("GPL");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
static int mem[MAX_PCBIT_CARDS];
static int irq[MAX_PCBIT_CARDS];
+module_param_array(mem, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+
static int num_boards;
struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS];
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c
index a10c6af42a97d..efefedea37b9a 100644
--- a/drivers/isdn/sc/init.c
+++ b/drivers/isdn/sc/init.c
@@ -15,10 +15,6 @@
MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card");
MODULE_AUTHOR("Spellcaster Telecommunications Inc.");
MODULE_LICENSE("GPL");
-MODULE_PARM( io, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(ram, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(do_reset, "i");
board *sc_adapter[MAX_CARDS];
int cinst;
@@ -34,6 +30,11 @@ static unsigned char irq[] = {0,0,0,0};
static unsigned long ram[] = {0,0,0,0};
static int do_reset = 0;
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(ram, int, NULL, 0);
+module_param(do_reset, bool, 0);
+
static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 };
#define MAX_IRQS 10
diff --git a/drivers/isdn/tpam/tpam_main.c b/drivers/isdn/tpam/tpam_main.c
index 7788f42a56d5c..e11cb903297b4 100644
--- a/drivers/isdn/tpam/tpam_main.c
+++ b/drivers/isdn/tpam/tpam_main.c
@@ -39,7 +39,7 @@ MODULE_DESCRIPTION("ISDN4Linux: Driver for TurboPAM ISDN cards");
MODULE_AUTHOR("Stelian Pop");
MODULE_LICENSE("GPL");
MODULE_PARM_DESC(id,"ID-String of the driver");
-MODULE_PARM(id,"s");
+module_param(id, charp, 0);
/*
* Finds a board by its driver ID.
@@ -105,7 +105,7 @@ static int __devinit tpam_probe(struct pci_dev *dev, const struct pci_device_id
memset((char *)card, 0, sizeof(tpam_card));
card->irq = dev->irq;
- card->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&card->lock);
sprintf(card->interface.id, "%s%d", id, cards_num);
/* request interrupt */
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 85e375692b26b..72c5165ffb124 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -418,7 +418,7 @@ static int __init via_pmu_start(void)
}
if (pmu_kind == PMU_KEYLARGO_BASED && gpio_irq != -1) {
- if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1/ADB", (void *)0))
+ if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1 ADB", (void *)0))
printk(KERN_ERR "pmu: can't get irq %d (GPIO1)\n", gpio_irq);
gpio_irq_enabled = 1;
}
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c
index a967aad59aabd..ff9be67c2a15b 100644
--- a/drivers/mca/mca-bus.c
+++ b/drivers/mca/mca-bus.c
@@ -34,7 +34,7 @@
/* Very few machines have more than one MCA bus. However, there are
* those that do (Voyager 35xx/5xxx), so we do it this way for future
* expansion. None that I know have more than 2 */
-struct mca_bus *mca_root_busses[MAX_MCA_BUSSES];
+static struct mca_bus *mca_root_busses[MAX_MCA_BUSSES];
#define MCA_DEVINFO(i,s) { .pos = i, .name = s }
diff --git a/drivers/mca/mca-legacy.c b/drivers/mca/mca-legacy.c
index 7c86071ea1f84..af56313ba0af9 100644
--- a/drivers/mca/mca-legacy.c
+++ b/drivers/mca/mca-legacy.c
@@ -283,25 +283,6 @@ void mca_set_adapter_name(int slot, char* name)
EXPORT_SYMBOL(mca_set_adapter_name);
/**
- * mca_get_adapter_name - get the adapter description
- * @slot: slot to query
- *
- * Return the adapter description if set. If it has not been
- * set or the slot is out range then return NULL.
- */
-
-char *mca_get_adapter_name(int slot)
-{
- struct mca_device *mca_dev = mca_find_device_by_slot(slot);
-
- if(!mca_dev)
- return NULL;
-
- return mca_device_get_name(mca_dev);
-}
-EXPORT_SYMBOL(mca_get_adapter_name);
-
-/**
* mca_is_adapter_used - check if claimed by driver
* @slot: slot to check
*
@@ -365,43 +346,3 @@ void mca_mark_as_unused(int slot)
}
EXPORT_SYMBOL(mca_mark_as_unused);
-/**
- * mca_isadapter - check if the slot holds an adapter
- * @slot: slot to query
- *
- * Returns zero if the slot does not hold an adapter, non zero if
- * it does.
- */
-
-int mca_isadapter(int slot)
-{
- struct mca_device *mca_dev = mca_find_device_by_slot(slot);
- enum MCA_AdapterStatus status;
-
- if(!mca_dev)
- return 0;
-
- status = mca_device_status(mca_dev);
-
- return status == MCA_ADAPTER_NORMAL
- || status == MCA_ADAPTER_DISABLED;
-}
-EXPORT_SYMBOL(mca_isadapter);
-
-/**
- * mca_isenabled - check if the slot holds an enabled adapter
- * @slot: slot to query
- *
- * Returns a non zero value if the slot holds an enabled adapter
- * and zero for any other case.
- */
-
-int mca_isenabled(int slot)
-{
- struct mca_device *mca_dev = mca_find_device_by_slot(slot);
-
- if(!mca_dev)
- return 0;
-
- return mca_device_status(mca_dev) == MCA_ADAPTER_NORMAL;
-}
diff --git a/drivers/mca/mca-proc.c b/drivers/mca/mca-proc.c
index e14ee89a4a079..33d5e0820cc50 100644
--- a/drivers/mca/mca-proc.c
+++ b/drivers/mca/mca-proc.c
@@ -43,8 +43,8 @@ static int get_mca_info_helper(struct mca_device *mca_dev, char *page, int len)
return len;
}
-int get_mca_info(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int get_mca_info(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
{
int i, len = 0;
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index b9e64e8764b2d..eeba14dcbecf7 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -9,6 +9,8 @@ dm-mirror-objs := dm-log.o dm-raid1.o
raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \
raid6int1.o raid6int2.o raid6int4.o \
raid6int8.o raid6int16.o raid6int32.o \
+ raid6altivec1.o raid6altivec2.o raid6altivec4.o \
+ raid6altivec8.o \
raid6mmx.o raid6sse1.o raid6sse2.o
hostprogs-y := mktables
@@ -36,6 +38,10 @@ quiet_cmd_unroll = UNROLL $@
cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \
< $< > $@ || ( rm -f $@ && exit 1 )
+ifeq ($(CONFIG_ALTIVEC),y)
+altivec_flags := -maltivec -mabi=altivec
+endif
+
targets += raid6int1.c
$(obj)/raid6int1.c: UNROLL := 1
$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE
@@ -66,6 +72,30 @@ $(obj)/raid6int32.c: UNROLL := 32
$(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE
$(call if_changed,unroll)
+CFLAGS_raid6altivec1.o += $(altivec_flags)
+targets += raid6altivec1.c
+$(obj)/raid6altivec1.c: UNROLL := 1
+$(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE
+ $(call if_changed,unroll)
+
+CFLAGS_raid6altivec2.o += $(altivec_flags)
+targets += raid6altivec2.c
+$(obj)/raid6altivec2.c: UNROLL := 2
+$(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE
+ $(call if_changed,unroll)
+
+CFLAGS_raid6altivec4.o += $(altivec_flags)
+targets += raid6altivec4.c
+$(obj)/raid6altivec4.c: UNROLL := 4
+$(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE
+ $(call if_changed,unroll)
+
+CFLAGS_raid6altivec8.o += $(altivec_flags)
+targets += raid6altivec8.c
+$(obj)/raid6altivec8.c: UNROLL := 8
+$(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE
+ $(call if_changed,unroll)
+
quiet_cmd_mktable = TABLE $@
cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 )
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index f2961618b7427..f2e7f7d7e86bf 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -649,7 +649,7 @@ int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result)
return -ENOMEM;
}
- kc->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&kc->lock);
kc->pages = NULL;
kc->nr_pages = kc->nr_free_pages = 0;
r = client_alloc_pages(kc, nr_pages);
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 7356511443617..161e9aa872917 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -31,7 +31,7 @@
*/
static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
{
- struct linear_hash *hash;
+ dev_info_t *hash;
linear_conf_t *conf = mddev_to_conf(mddev);
sector_t block = sector >> 1;
@@ -39,12 +39,11 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
* sector_div(a,b) returns the remainer and sets a to a/b
*/
(void)sector_div(block, conf->smallest->size);
- hash = conf->hash_table + block;
+ hash = conf->hash_table[block];
- if ((sector>>1) >= (hash->dev0->size + hash->dev0->offset))
- return hash->dev1;
- else
- return hash->dev0;
+ while ((sector>>1) >= (hash->size + hash->offset))
+ hash++;
+ return hash;
}
/**
@@ -114,7 +113,7 @@ static int linear_issue_flush(request_queue_t *q, struct gendisk *disk,
static int linear_run (mddev_t *mddev)
{
linear_conf_t *conf;
- struct linear_hash *table;
+ dev_info_t **table;
mdk_rdev_t *rdev;
int i, nb_zone, cnt;
sector_t start;
@@ -184,7 +183,7 @@ static int linear_run (mddev_t *mddev)
nb_zone = conf->nr_zones = sz + (round ? 1 : 0);
}
- conf->hash_table = kmalloc (sizeof (struct linear_hash) * nb_zone,
+ conf->hash_table = kmalloc (sizeof (dev_info_t*) * nb_zone,
GFP_KERNEL);
if (!conf->hash_table)
goto out;
@@ -198,9 +197,6 @@ static int linear_run (mddev_t *mddev)
for (i = 0; i < cnt; i++) {
dev_info_t *disk = conf->disks + i;
- if (start > curr_offset)
- table[-1].dev1 = disk;
-
disk->offset = curr_offset;
curr_offset += disk->size;
@@ -208,10 +204,8 @@ static int linear_run (mddev_t *mddev)
* 'start' is the start of table
*/
while (start < curr_offset) {
- table->dev0 = disk;
- table->dev1 = NULL;
+ *table++ = disk;
start += conf->smallest->size;
- table++;
}
}
if (table-conf->hash_table != nb_zone)
@@ -255,13 +249,6 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
tmp_dev = which_dev(mddev, bio->bi_sector);
block = bio->bi_sector >> 1;
-
- if (unlikely(!tmp_dev)) {
- printk("linear_make_request: hash->dev1==NULL for block %llu\n",
- (unsigned long long)block);
- bio_io_error(bio, bio->bi_size);
- return 0;
- }
if (unlikely(block >= (tmp_dev->size + tmp_dev->offset)
|| block < tmp_dev->offset)) {
@@ -306,17 +293,20 @@ static void linear_status (struct seq_file *seq, mddev_t *mddev)
#ifdef MD_DEBUG
int j;
linear_conf_t *conf = mddev_to_conf(mddev);
+ sector_t s = 0;
seq_printf(seq, " ");
for (j = 0; j < conf->nr_zones; j++)
{
char b[BDEVNAME_SIZE];
+ s += conf->smallest_size;
seq_printf(seq, "[%s",
- bdevname(conf->hash_table[j].dev0->rdev->bdev,b));
+ bdevname(conf->hash_table[j][0].rdev->bdev,b));
- if (conf->hash_table[j].dev1)
+ while (s > conf->hash_table[j][0].offset +
+ conf->hash_table[j][0].size)
seq_printf(seq, "/%s] ",
- bdevname(conf->hash_table[j].dev1->rdev->bdev,b));
+ bdevname(conf->hash_table[j][1].rdev->bdev,b));
else
seq_printf(seq, "] ");
}
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 309398219556c..63f81fd3d25a8 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -491,7 +491,7 @@ static int multipath_run (mddev_t *mddev)
conf->raid_disks = mddev->raid_disks;
mddev->sb_dirty = 1;
conf->mddev = mddev;
- conf->device_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->device_lock);
INIT_LIST_HEAD(&conf->retry_list);
if (!conf->working_disks) {
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 4e25ebd533857..060c6a28c86c3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1210,12 +1210,12 @@ static int run(mddev_t *mddev)
}
conf->raid_disks = mddev->raid_disks;
conf->mddev = mddev;
- conf->device_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->device_lock);
INIT_LIST_HEAD(&conf->retry_list);
if (conf->working_disks == 1)
mddev->recovery_cp = MaxSector;
- conf->resync_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->resync_lock);
init_waitqueue_head(&conf->wait_idle);
init_waitqueue_head(&conf->wait_resume);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 596df3cb90028..7c8ea87ded1fd 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1668,10 +1668,10 @@ static int run(mddev_t *mddev)
}
conf->raid_disks = mddev->raid_disks;
conf->mddev = mddev;
- conf->device_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->device_lock);
INIT_LIST_HEAD(&conf->retry_list);
- conf->resync_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->resync_lock);
init_waitqueue_head(&conf->wait_idle);
init_waitqueue_head(&conf->wait_resume);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 1dceb098a7fbf..eb472ef7c0bfb 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -302,7 +302,7 @@ static int grow_stripes(raid5_conf_t *conf, int num)
return 1;
memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev));
sh->raid_conf = conf;
- sh->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sh->lock);
if (grow_buffers(sh, conf->raid_disks)) {
shrink_buffers(sh, conf->raid_disks);
@@ -1566,7 +1566,7 @@ static int run (mddev_t *mddev)
goto abort;
memset(conf->stripe_hashtbl, 0, HASH_PAGES * PAGE_SIZE);
- conf->device_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->device_lock);
init_waitqueue_head(&conf->wait_for_stripe);
INIT_LIST_HEAD(&conf->handle_list);
INIT_LIST_HEAD(&conf->delayed_list);
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c
index b02cff36a13f1..acf386fc4b4fd 100644
--- a/drivers/md/raid6algos.c
+++ b/drivers/md/raid6algos.c
@@ -37,6 +37,10 @@ extern const struct raid6_calls raid6_sse1x2;
extern const struct raid6_calls raid6_sse2x1;
extern const struct raid6_calls raid6_sse2x2;
extern const struct raid6_calls raid6_sse2x4;
+extern const struct raid6_calls raid6_altivec1;
+extern const struct raid6_calls raid6_altivec2;
+extern const struct raid6_calls raid6_altivec4;
+extern const struct raid6_calls raid6_altivec8;
const struct raid6_calls * const raid6_algos[] = {
&raid6_intx1,
@@ -60,6 +64,12 @@ const struct raid6_calls * const raid6_algos[] = {
&raid6_sse2x2,
&raid6_sse2x4,
#endif
+#ifdef CONFIG_ALTIVEC
+ &raid6_altivec1,
+ &raid6_altivec2,
+ &raid6_altivec4,
+ &raid6_altivec8,
+#endif
NULL
};
diff --git a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc
new file mode 100644
index 0000000000000..e21197a363c3c
--- /dev/null
+++ b/drivers/md/raid6altivec.uc
@@ -0,0 +1,122 @@
+/* -*- linux-c -*- ------------------------------------------------------- *
+ *
+ * Copyright 2002-2004 H. Peter Anvin - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Bostom MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * raid6altivec$#.c
+ *
+ * $#-way unrolled portable integer math RAID-6 instruction set
+ *
+ * This file is postprocessed using unroll.pl
+ *
+ * <benh> hpa: in process,
+ * you can just "steal" the vec unit with enable_kernel_altivec() (but
+ * bracked this with preempt_disable/enable or in a lock)
+ */
+
+#include "raid6.h"
+
+#ifdef CONFIG_ALTIVEC
+
+#include <altivec.h>
+#include <asm/system.h>
+#include <asm/cputable.h>
+
+/*
+ * This is the C data type to use
+ */
+
+typedef vector unsigned char unative_t;
+
+#define NBYTES(x) ((vector unsigned char) {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x})
+#define NSIZE sizeof(unative_t)
+
+/*
+ * The SHLBYTE() operation shifts each byte left by 1, *not*
+ * rolling over into the next byte
+ */
+static inline __attribute_const__ unative_t SHLBYTE(unative_t v)
+{
+ return vec_add(v,v);
+}
+
+/*
+ * The MASK() operation returns 0xFF in any byte for which the high
+ * bit is 1, 0x00 for any byte for which the high bit is 0.
+ */
+static inline __attribute_const__ unative_t MASK(unative_t v)
+{
+ unative_t zv = NBYTES(0);
+
+ /* vec_cmpgt returns a vector bool char; thus the need for the cast */
+ return (unative_t)vec_cmpgt(zv, v);
+}
+
+
+/* This is noinline to make damned sure that gcc doesn't move any of the
+ Altivec code around the enable/disable code */
+static void noinline
+raid6_altivec$#_gen_syndrome_real(int disks, size_t bytes, void **ptrs)
+{
+ u8 **dptr = (u8 **)ptrs;
+ u8 *p, *q;
+ int d, z, z0;
+
+ unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
+ unative_t x1d = NBYTES(0x1d);
+
+ z0 = disks - 3; /* Highest data disk */
+ p = dptr[z0+1]; /* XOR parity */
+ q = dptr[z0+2]; /* RS syndrome */
+
+ for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
+ wq$$ = wp$$ = *(unative_t *)&dptr[z0][d+$$*NSIZE];
+ for ( z = z0-1 ; z >= 0 ; z-- ) {
+ wd$$ = *(unative_t *)&dptr[z][d+$$*NSIZE];
+ wp$$ = vec_xor(wp$$, wd$$);
+ w2$$ = MASK(wq$$);
+ w1$$ = SHLBYTE(wq$$);
+ w2$$ = vec_and(w2$$, x1d);
+ w1$$ = vec_xor(w1$$, w2$$);
+ wq$$ = vec_xor(w1$$, wd$$);
+ }
+ *(unative_t *)&p[d+NSIZE*$$] = wp$$;
+ *(unative_t *)&q[d+NSIZE*$$] = wq$$;
+ }
+}
+
+static void raid6_altivec$#_gen_syndrome(int disks, size_t bytes, void **ptrs)
+{
+ preempt_disable();
+ enable_kernel_altivec();
+
+ raid6_altivec$#_gen_syndrome_real(disks, bytes, ptrs);
+
+ preempt_enable();
+}
+
+int raid6_have_altivec(void);
+#if $# == 1
+int raid6_have_altivec(void)
+{
+ /* This assumes either all CPUs have Altivec or none does */
+ return cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC;
+}
+#endif
+
+const struct raid6_calls raid6_altivec$# = {
+ raid6_altivec$#_gen_syndrome,
+ raid6_have_altivec,
+ "altivecx$#",
+ 0
+};
+
+#endif /* CONFIG_ALTIVEC */
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index 9a27f8f88a918..f944018949f60 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -321,7 +321,7 @@ static int grow_stripes(raid6_conf_t *conf, int num)
return 1;
memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev));
sh->raid_conf = conf;
- sh->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sh->lock);
if (grow_buffers(sh, conf->raid_disks)) {
shrink_buffers(sh, conf->raid_disks);
@@ -1730,7 +1730,7 @@ static int run (mddev_t *mddev)
goto abort;
memset(conf->stripe_hashtbl, 0, HASH_PAGES * PAGE_SIZE);
- conf->device_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&conf->device_lock);
init_waitqueue_head(&conf->wait_for_stripe);
INIT_LIST_HEAD(&conf->handle_list);
INIT_LIST_HEAD(&conf->delayed_list);
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 5c3a549a548ea..11d17d1e52cfa 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -426,8 +426,8 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
pci_set_drvdata(pci,dev);
init_MUTEX(&dev->lock);
- dev->int_slock = SPIN_LOCK_UNLOCKED;
- dev->slock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dev->int_slock);
+ spin_lock_init(&dev->slock);
init_MUTEX(&dev->i2c_lock);
diff --git a/drivers/media/dvb/b2c2/skystar2.c b/drivers/media/dvb/b2c2/skystar2.c
index bfebb3d685612..3c412a96f9b38 100644
--- a/drivers/media/dvb/b2c2/skystar2.c
+++ b/drivers/media/dvb/b2c2/skystar2.c
@@ -1979,7 +1979,7 @@ static int driver_initialize(struct pci_dev *pdev)
ctrl_enable_mac(adapter, 1);
}
- adapter->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&adapter->lock);
return 0;
}
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index f5e08f258d993..6bd4a037c798a 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -655,21 +655,11 @@ int av7110_diseqc_send(struct av7110 *av7110, int len, u8 *msg, unsigned long bu
#ifdef CONFIG_DVB_AV7110_OSD
-static inline int ResetBlend(struct av7110 *av7110, u8 windownr)
-{
- return av7110_fw_cmd(av7110, COMTYPE_OSD, SetNonBlend, 1, windownr);
-}
-
static inline int SetColorBlend(struct av7110 *av7110, u8 windownr)
{
return av7110_fw_cmd(av7110, COMTYPE_OSD, SetCBlend, 1, windownr);
}
-static inline int SetWindowBlend(struct av7110 *av7110, u8 windownr, u8 blending)
-{
- return av7110_fw_cmd(av7110, COMTYPE_OSD, SetWBlend, 2, windownr, blending);
-}
-
static inline int SetBlend_(struct av7110 *av7110, u8 windownr,
enum av7110_osd_palette_type colordepth, u16 index, u8 blending)
{
@@ -684,11 +674,6 @@ static inline int SetColor_(struct av7110 *av7110, u8 windownr,
windownr, colordepth, index, colorhi, colorlo);
}
-static inline int BringToTop(struct av7110 *av7110, u8 windownr)
-{
- return av7110_fw_cmd(av7110, COMTYPE_OSD, WTop, 1, windownr);
-}
-
static inline int SetFont(struct av7110 *av7110, u8 windownr, u8 fontsize,
u16 colorfg, u16 colorbg)
{
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index b51a961413921..fa494caf12e7d 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -1090,7 +1090,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
static void ttusb_dec_init_tasklet(struct ttusb_dec *dec)
{
- dec->urb_frame_list_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dec->urb_frame_list_lock);
INIT_LIST_HEAD(&dec->urb_frame_list);
tasklet_init(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list,
(unsigned long)dec);
@@ -1401,7 +1401,7 @@ static void ttusb_dec_exit_tasklet(struct ttusb_dec *dec)
static void ttusb_dec_init_filters(struct ttusb_dec *dec)
{
INIT_LIST_HEAD(&dec->filter_info_list);
- dec->filter_info_list_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dec->filter_info_list_lock);
}
static void ttusb_dec_exit_filters(struct ttusb_dec *dec)
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c
index 4fd5e32cc67a1..eb8cc6fd1b3f8 100644
--- a/drivers/media/radio/miropcm20-radio.c
+++ b/drivers/media/radio/miropcm20-radio.c
@@ -26,7 +26,7 @@
#include "miropcm20-rds-core.h"
static int radio_nr = -1;
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
struct pcm20_device {
unsigned long freq;
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 7aab2ed627325..8b4ad70dd1b2f 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -130,7 +130,7 @@ static int rt_setvol(struct rt_device *dev, int vol)
* and bit 4 (+16) is to keep the signal strength meter enabled
*/
-void send_0_byte(int port, struct rt_device *dev)
+static void send_0_byte(int port, struct rt_device *dev)
{
if ((dev->curvol == 0) || (dev->muted)) {
outb_p(128+64+16+ 1, port); /* wr-enable + data low */
@@ -143,7 +143,7 @@ void send_0_byte(int port, struct rt_device *dev)
sleep_delay(1000);
}
-void send_1_byte(int port, struct rt_device *dev)
+static void send_1_byte(int port, struct rt_device *dev)
{
if ((dev->curvol == 0) || (dev->muted)) {
outb_p(128+64+16+4 +1, port); /* wr-enable+data high */
@@ -353,9 +353,9 @@ MODULE_AUTHOR("M.Kirkwood");
MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the RadioTrack card (0x20f or 0x30f)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit cleanup_rtrack_module(void)
{
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index e23e3d5f437e5..013c835ed910d 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -301,8 +301,8 @@ MODULE_AUTHOR("Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath,
MODULE_DESCRIPTION("A driver for the Aztech radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
-MODULE_PARM(radio_nr, "i");
+module_param(io, int, 0);
+module_param(radio_nr, int, 0);
MODULE_PARM_DESC(io, "I/O address of the Aztech card (0x350 or 0x358)");
static void __exit aztech_cleanup(void)
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index abb03c53d530f..53d399b6652b8 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -46,7 +46,7 @@ static int curtuner=0;
static int tunestat=0;
static int sigstrength=0;
static wait_queue_head_t read_queue;
-struct timer_list tunertimer,rdstimer,readtimer;
+static struct timer_list readtimer;
static __u8 rdsin=0,rdsout=0,rdsstat=0;
static unsigned char rdsbuf[RDS_BUFFER];
static spinlock_t cadet_io_lock;
@@ -280,7 +280,7 @@ static void cadet_setvol(int vol)
spin_unlock(&cadet_io_lock);
}
-void cadet_handler(unsigned long data)
+static void cadet_handler(unsigned long data)
{
/*
* Service the RDS fifo
@@ -604,9 +604,9 @@ MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, S
MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit cadet_cleanup_module(void)
{
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index 86217cb163afd..630cc786d0a4f 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -294,7 +294,7 @@ static struct pci_device_id gemtek_pci_id[] =
MODULE_DEVICE_TABLE( pci, gemtek_pci_id );
-static u8 mx = 1;
+static int mx = 1;
static struct file_operations gemtek_pci_fops = {
.owner = THIS_MODULE,
@@ -406,9 +406,9 @@ MODULE_AUTHOR( "Vladimir Shebordaev <vshebordaev@mail.ru>" );
MODULE_DESCRIPTION( "The video4linux driver for the Gemtek PCI Radio Card" );
MODULE_LICENSE("GPL");
-MODULE_PARM( mx, "b" );
+module_param(mx, bool, 0);
MODULE_PARM_DESC( mx, "single digit: 1 - turn off the turner upon module exit (default), 0 - do not" );
-MODULE_PARM( nr_radio, "i");
+module_param(nr_radio, int, 0);
MODULE_PARM_DESC( nr_radio, "video4linux device number to use");
module_init( gemtek_pci_init_module );
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 23bc25d1027dc..202bfe6819b88 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -127,7 +127,7 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq)
return 0;
}
-int gemtek_getsigstr(struct gemtek_device *dev)
+static int gemtek_getsigstr(struct gemtek_device *dev)
{
spin_lock(&lock);
inb(io);
@@ -284,9 +284,9 @@ MODULE_AUTHOR("Jonas Munsin");
MODULE_DESCRIPTION("A driver for the GemTek Radio Card");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the GemTek card (0x20c, 0x30c, 0x24c or 0x34c (0x20c or 0x248 have been reported to work for the combined sound/radiocard)).");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit gemtek_cleanup(void)
{
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index b226aa437c576..e62147e4ed1ba 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -62,7 +62,7 @@
#define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF)
static int radio_nr = -1;
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static int radio_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
@@ -256,12 +256,12 @@ MODULE_AUTHOR("Adam Tlalka, atlka@pg.gda.pl");
MODULE_DESCRIPTION("Radio driver for the Maestro PCI sound card radio.");
MODULE_LICENSE("GPL");
-void __exit maestro_radio_exit(void)
+static void __exit maestro_radio_exit(void)
{
video_unregister_device(&maestro_radio);
}
-int __init maestro_radio_init(void)
+static int __init maestro_radio_init(void)
{
register __u16 found=0;
struct pci_dev *pcidev = NULL;
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index c3c62095fac85..5b748a48ce721 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -57,7 +57,7 @@
static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16 ;
static int radio_nr = -1;
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
#define FREQ_LO 50*16000
@@ -335,12 +335,12 @@ static struct pci_driver maxiradio_driver = {
.remove = __devexit_p(maxiradio_remove_one),
};
-int __init maxiradio_radio_init(void)
+static int __init maxiradio_radio_init(void)
{
return pci_module_init(&maxiradio_driver);
}
-void __exit maxiradio_radio_exit(void)
+static void __exit maxiradio_radio_exit(void)
{
pci_unregister_driver(&maxiradio_driver);
}
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index 8af2d134311f4..c00245d4d2490 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -246,9 +246,9 @@ MODULE_AUTHOR("Ben Pfaff");
MODULE_DESCRIPTION("A driver for the RadioTrack II radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the RadioTrack card (0x20c or 0x30c)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit rtrack2_cleanup_module(void)
{
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index f0575fb2cf1d7..ec3ff0e1cf621 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -312,9 +312,9 @@ MODULE_AUTHOR("Petr Vandrovec, vandrove@vc.cvut.cz and M. Kirkwood");
MODULE_DESCRIPTION("A driver for the SF16MI radio.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the SF16MI card (0x284 or 0x384)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit fmi_cleanup_module(void)
{
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index 7e980d15f317a..0732efda6a983 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -408,9 +408,9 @@ MODULE_AUTHOR("Ziglio Frediano, freddy77@angelfire.com");
MODULE_DESCRIPTION("A driver for the SF16FMR2 radio.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the SF16FMR2 card (should be 0x384, if do not work try 0x284)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit fmr2_cleanup_module(void)
{
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index 48392ff5cfd0f..248d67fde0372 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -175,7 +175,7 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
return 0;
}
-int tt_getsigstr(struct tt_device *dev) /* TODO */
+static int tt_getsigstr(struct tt_device *dev) /* TODO */
{
if (inb(io) & 2) /* bit set = no signal present */
return 0;
@@ -325,9 +325,9 @@ static int __init terratec_init(void)
MODULE_AUTHOR("R.OFFERMANNS & others");
MODULE_DESCRIPTION("A driver for the TerraTec ActiveRadio Standalone radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the TerraTec ActiveRadio card (0x590 or 0x591)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit terratec_cleanup_module(void)
{
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c
index 8dd4cd2e1dbdb..b300bedf7c743 100644
--- a/drivers/media/radio/radio-trust.c
+++ b/drivers/media/radio/radio-trust.c
@@ -306,9 +306,9 @@ MODULE_AUTHOR("Eric Lammerts, Russell Kroll, Quay Lu, Donald Song, Jason Lewis,
MODULE_DESCRIPTION("A driver for the Trust FM Radio card.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the Trust FM Radio card (0x350 or 0x358)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit cleanup_trust_module(void)
{
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index ea1dbce249aee..ed55e8af29db4 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -305,17 +305,17 @@ MODULE_AUTHOR("Dr. Henrik Seidel");
MODULE_DESCRIPTION("A driver for the Typhoon radio card (a.k.a. EcoRadio).");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
-MODULE_PARM_DESC(io, "I/O address of the Typhoon card (0x316 or 0x336)");
-MODULE_PARM(mutefreq, "i");
-MODULE_PARM_DESC(mutefreq, "Frequency used when muting the card (in kHz)");
-MODULE_PARM(radio_nr, "i");
-
static int io = -1;
static int radio_nr = -1;
+module_param(io, int, 0);
+MODULE_PARM_DESC(io, "I/O address of the Typhoon card (0x316 or 0x336)");
+module_param(radio_nr, int, 0);
+
#ifdef MODULE
static unsigned long mutefreq = 0;
+module_param(mutefreq, int, 0);
+MODULE_PARM_DESC(mutefreq, "Frequency used when muting the card (in kHz)");
#endif
static int __init typhoon_init(void)
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 8bc9075b281a8..31ee3f02a00a7 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -169,7 +169,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
/* Get signal strength */
-int zol_getsigstr(struct zol_device *dev)
+static int zol_getsigstr(struct zol_device *dev)
{
int a, b;
@@ -194,7 +194,7 @@ int zol_getsigstr(struct zol_device *dev)
return (0);
}
-int zol_is_stereo (struct zol_device *dev)
+static int zol_is_stereo (struct zol_device *dev)
{
int x1, x2;
@@ -382,9 +382,9 @@ MODULE_AUTHOR("C.van Schaik");
MODULE_DESCRIPTION("A driver for the Zoltrix Radio Plus.");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O address of the Zoltrix Radio Plus (0x20c or 0x30c)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
static void __exit zoltrix_cleanup_module(void)
{
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 9332b9c8b020b..ba091e0bff594 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -22,7 +22,7 @@ config VIDEO_BT848
<file:Documentation/video4linux/bttv/> for more information.
If you say Y or M here, you need to say Y or M to "I2C support" and
- "I2C bit-banging interfaces" in the character device section.
+ "I2C bit-banging interfaces" in the device drivers section.
To compile this driver as a module, choose M here: the
module will be called bttv.
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
index b1913c9af8279..4e1f5554846c3 100644
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_encoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index 74fefc2df8b6c..1e24c0b96e823 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -57,7 +57,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_encoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
index 16be0ef8088e7..83857c1dc9514 100644
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_decoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
@@ -95,7 +95,7 @@ struct timing {
};
/* for values, see the bt819 datasheet */
-struct timing timing_data[] = {
+static struct timing timing_data[] = {
{864 - 24, 20, 625 - 2, 1, 0x0504, 0x0000},
{858 - 24, 20, 525 - 2, 1, 0x00f8, 0x0000},
};
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
index d58aa77b18850..d7e45f85a92c8 100644
--- a/drivers/media/video/bt856.c
+++ b/drivers/media/video/bt856.c
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_encoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 6c119fd6ef2b0..e94680bb5a487 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -2158,7 +2158,7 @@ struct tvcard bttv_tvcards[] = {
// .has_remote = 1,
}};
-const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
+static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
/* ----------------------------------------------------------------------- */
@@ -2327,10 +2327,10 @@ static void flyvideo_gpio(struct bttv *btv)
//todo: if(has_tda9874) btv->audio_hook = fv2000s_audio;
}
-int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
- 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
-int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
- 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
+static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
+ 14,2,17,1, 4,1,4,3, 1,2,16,1, 4,4,4,4 };
+static int miro_fmtuner[] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1,
+ 1,1,1,1, 1,1,1,0, 0,0,0,0, 0,1,0,0 };
static void miro_pinnacle_gpio(struct bttv *btv)
{
@@ -3072,7 +3072,7 @@ static void __devinit osprey_eeprom(struct bttv *btv)
/* ----------------------------------------------------------------------- */
/* AVermedia specific stuff, from bktr_card.c */
-int tuner_0_table[] = {
+static int tuner_0_table[] = {
TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
@@ -3087,7 +3087,7 @@ int tuner_0_fm_table[] = {
PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
#endif
-int tuner_1_table[] = {
+static int tuner_1_table[] = {
TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
@@ -3281,7 +3281,7 @@ static void __devinit init_PXC200(struct bttv *btv)
* Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
*/
-void bus_low(struct bttv *btv, int bit)
+static void bus_low(struct bttv *btv, int bit)
{
if (btv->mbox_ior) {
gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
@@ -3298,7 +3298,7 @@ void bus_low(struct bttv *btv, int bit)
}
}
-void bus_high(struct bttv *btv, int bit)
+static void bus_high(struct bttv *btv, int bit)
{
if (btv->mbox_ior) {
gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
@@ -3315,7 +3315,7 @@ void bus_high(struct bttv *btv, int bit)
}
}
-int bus_in(struct bttv *btv, int bit)
+static int bus_in(struct bttv *btv, int bit)
{
if (btv->mbox_ior) {
gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index ab82636c1496a..a2b6a19376f99 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -313,12 +313,12 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
.sram = -1,
}
};
-const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms);
+static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms);
/* ----------------------------------------------------------------------- */
/* bttv format list
packed pixel formats must come first */
-const struct bttv_format bttv_formats[] = {
+static const struct bttv_format bttv_formats[] = {
{
.name = "8 bpp, gray",
.palette = VIDEO_PALETTE_GREY,
@@ -470,7 +470,7 @@ const struct bttv_format bttv_formats[] = {
.flags = FORMAT_FLAGS_RAW,
}
};
-const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats);
+static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats);
/* ----------------------------------------------------------------------- */
@@ -619,7 +619,7 @@ static const struct v4l2_queryctrl bttv_ctls[] = {
}
};
-const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls);
+static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls);
/* ----------------------------------------------------------------------- */
/* resource management */
@@ -755,7 +755,7 @@ static void set_pll(struct bttv *btv)
}
/* used to switch between the bt848's analog/digital video capture modes */
-void bt848A_set_timing(struct bttv *btv)
+static void bt848A_set_timing(struct bttv *btv)
{
int i, len;
int table_idx = bttv_tvnorms[btv->tvnorm].sram;
@@ -3030,7 +3030,7 @@ static struct video_device bttv_video_template =
.minor = -1,
};
-struct video_device bttv_vbi_template =
+static struct video_device bttv_vbi_template =
{
.name = "bt848/878 vbi",
.type = VID_TYPE_TUNER|VID_TYPE_TELETEXT,
@@ -3717,8 +3717,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
/* initialize structs / fill in defaults */
init_MUTEX(&btv->lock);
init_MUTEX(&btv->reslock);
- btv->s_lock = SPIN_LOCK_UNLOCKED;
- btv->gpio_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&btv->s_lock);
+ spin_lock_init(&btv->gpio_lock);
init_waitqueue_head(&btv->gpioq);
init_waitqueue_head(&btv->i2c_queue);
INIT_LIST_HEAD(&btv->c.subs);
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index a7fb01843abf5..cddcf37c5c19d 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
/* ----------------------------------------------------------------------- */
/* I2C functions - bitbanging adapter (software i2c) */
-void bttv_bit_setscl(void *data, int state)
+static void bttv_bit_setscl(void *data, int state)
{
struct bttv *btv = (struct bttv*)data;
@@ -63,7 +63,7 @@ void bttv_bit_setscl(void *data, int state)
btread(BT848_I2C);
}
-void bttv_bit_setsda(void *data, int state)
+static void bttv_bit_setsda(void *data, int state)
{
struct bttv *btv = (struct bttv*)data;
@@ -244,7 +244,7 @@ bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last)
return retval;
}
-int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
+static int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
{
struct bttv *btv = i2c_get_adapdata(i2c_adap);
int retval = 0;
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index 8ef610c345cac..da8022a431b2d 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -109,7 +109,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
return 0;
}
-int
+static int
bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
struct scatterlist *sglist,
unsigned int yoffset, unsigned int ybpl,
@@ -227,7 +227,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
return 0;
}
-int
+static int
bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
const struct bttv_format *fmt, struct bttv_overlay *ov,
int skip_even, int skip_odd)
@@ -315,7 +315,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
/* ---------------------------------------------------------- */
-void
+static void
bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
int width, int height, int interleaved, int norm)
{
@@ -363,7 +363,7 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
}
}
-void
+static void
bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd)
{
int off = odd ? 0x80 : 0x00;
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
index fa96757f4ef62..179f91cf7eb0d 100644
--- a/drivers/media/video/bttv.h
+++ b/drivers/media/video/bttv.h
@@ -325,8 +325,6 @@ void bttv_gpio_bits(struct bttv_core *core, u32 mask, u32 bits);
/* ---------------------------------------------------------- */
/* i2c */
-extern void bttv_bit_setscl(void *data, int state);
-extern void bttv_bit_setsda(void *data, int state);
extern void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg);
extern int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for);
extern int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index bf6ac447b30d9..d5ba457e4a98c 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -89,7 +89,6 @@ struct bttv_tvnorm {
int sram;
};
extern const struct bttv_tvnorm bttv_tvnorms[];
-extern const unsigned int BTTV_TVNORMS;
struct bttv_format {
char *name;
@@ -101,8 +100,6 @@ struct bttv_format {
int flags;
int hshift,vshift; /* for planar modes */
};
-extern const struct bttv_format bttv_formats[];
-extern const unsigned int BTTV_FORMATS;
/* ---------------------------------------------------------- */
@@ -173,22 +170,6 @@ int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
struct scatterlist *sglist,
unsigned int offset, unsigned int bpl,
unsigned int pitch, unsigned int lines);
-int bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
- struct scatterlist *sglist,
- unsigned int yoffset, unsigned int ybpl,
- unsigned int ypadding, unsigned int ylines,
- unsigned int uoffset, unsigned int voffset,
- unsigned int hshift, unsigned int vshift,
- unsigned int cpadding);
-int bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
- const struct bttv_format *fmt,
- struct bttv_overlay *ov,
- int skip_top, int skip_bottom);
-
-/* calculate / apply geometry settings */
-void bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
- int width, int height, int interleaved, int norm);
-void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int top);
/* control dma register + risc main loop */
void bttv_set_dma(struct bttv *btv, int override);
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 356bde0e3e100..0065d0c240d14 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -82,9 +82,9 @@ static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */
static unsigned int yieldlines=4; /* Yield after this many during capture */
static int video_nr = -1;
-MODULE_PARM(maxpoll,"i");
-MODULE_PARM(yieldlines,"i");
-MODULE_PARM(video_nr,"i");
+module_param(maxpoll, int, 0);
+module_param(yieldlines, int, 0);
+module_param(video_nr, int, 0);
static inline int read_lpstatus(struct qcam_device *q)
{
@@ -441,7 +441,7 @@ static int qc_setscanmode(struct qcam_device *q)
/* Reset the QuickCam and program for brightness, contrast,
* white-balance, and resolution. */
-void qc_set(struct qcam_device *q)
+static void qc_set(struct qcam_device *q)
{
int val;
int val2;
@@ -591,7 +591,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
* n=2^(bit depth)-1. Ask me for more details if you don't understand
* this. */
-long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len)
+static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len)
{
int i, j, k, yield;
int bytes;
@@ -891,7 +891,7 @@ static struct video_device qcam_template=
static struct qcam_device *qcams[MAX_CAMS];
static unsigned int num_cams = 0;
-int init_bwqcam(struct parport *port)
+static int init_bwqcam(struct parport *port)
{
struct qcam_device *qcam;
@@ -934,7 +934,7 @@ int init_bwqcam(struct parport *port)
return 0;
}
-void close_bwqcam(struct qcam_device *qcam)
+static void close_bwqcam(struct qcam_device *qcam)
{
video_unregister_device(&qcam->vdev);
parport_unregister_device(qcam->pdev);
@@ -946,7 +946,7 @@ void close_bwqcam(struct qcam_device *qcam)
* -- March 14, 1999 Billy Donahue <billy@escape.com> */
#ifdef MODULE
static char *parport[MAX_CAMS] = { NULL, };
-MODULE_PARM(parport, "1-" __MODULE_STRING(MAX_CAMS) "s");
+module_param_array(parport, charp, NULL, 0);
#endif
static int accept_bwqcam(struct parport *port)
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 703c4cba97b63..3ea10d4bc9c72 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -741,7 +741,7 @@ static struct qcam_device *qcam_init(struct parport *port)
static struct qcam_device *qcams[MAX_CAMS];
static unsigned int num_cams = 0;
-int init_cqcam(struct parport *port)
+static int init_cqcam(struct parport *port)
{
struct qcam_device *qcam;
@@ -798,7 +798,7 @@ int init_cqcam(struct parport *port)
return 0;
}
-void close_cqcam(struct qcam_device *qcam)
+static void close_cqcam(struct qcam_device *qcam)
{
video_unregister_device(&qcam->vdev);
parport_unregister_device(qcam->pdev);
@@ -842,13 +842,14 @@ MODULE_AUTHOR("Philip Blundell <philb@gnu.org>");
MODULE_DESCRIPTION(BANNER);
MODULE_LICENSE("GPL");
+/* FIXME: parport=auto would never have worked, surely? --RR */
MODULE_PARM_DESC(parport ,"parport=<auto|n[,n]...> for port detection method\n\
probe=<0|1|2> for camera detection method\n\
force_rgb=<0|1> for RGB data format (default BGR)");
-MODULE_PARM(parport, "1-" __MODULE_STRING(MAX_CAMS) "i");
-MODULE_PARM(probe, "i");
-MODULE_PARM(force_rgb, "i");
-MODULE_PARM(video_nr,"i");
+module_param_array(parport, int, NULL, 0);
+module_param(probe, int, 0);
+module_param(force_rgb, bool, 0);
+module_param(video_nr, int, 0);
module_init(cqcam_init);
module_exit(cqcam_cleanup);
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index f3206751a326c..8c08b7f1ad233 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -57,7 +57,7 @@ extern int cpia_usb_init(void);
static int video_nr = -1;
#ifdef MODULE
-MODULE_PARM(video_nr,"i");
+module_param(video_nr, int, 0);
MODULE_AUTHOR("Scott J. Bertin <sbertin@securenym.net> & Peter Pregler <Peter_Pregler@email.com> & Johannes Erdfelt <johannes@erdfeld.com>");
MODULE_DESCRIPTION("V4L-driver for Vision CPiA based cameras");
MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c
index bee7728b43a3c..ddf184f95d80c 100644
--- a/drivers/media/video/cpia_pp.c
+++ b/drivers/media/video/cpia_pp.c
@@ -71,7 +71,7 @@ MODULE_AUTHOR("B. Huisman <bhuism@cs.utwente.nl> & Peter Pregler <Peter_Pregler@
MODULE_DESCRIPTION("Parallel port driver for Vision CPiA based cameras");
MODULE_LICENSE("GPL");
-MODULE_PARM(parport, "1-" __MODULE_STRING(PARPORT_MAX) "s");
+module_param_array(parport, charp, NULL, 0);
MODULE_PARM_DESC(parport, "'auto' or a list of parallel port numbers. Just like lp.");
#else
static int parport_nr[PARPORT_MAX] __initdata =
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index b538c8385af0c..3045b4b62eab3 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -343,7 +343,7 @@ int cx8802_init_common(struct cx8802_dev *dev)
/* initialize driver struct */
init_MUTEX(&dev->lock);
- dev->slock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dev->slock);
/* init dma queue */
INIT_LIST_HEAD(&dev->mpegq.active);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 5892e51395ad8..aa1f35a2fa439 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -2026,7 +2026,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
/* initialize driver struct */
init_MUTEX(&dev->lock);
- dev->slock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dev->slock);
core->tvnorm = tvnorms;
/* init video dma queues */
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c
index 054708879490a..da9481198c530 100644
--- a/drivers/media/video/dpc7146.c
+++ b/drivers/media/video/dpc7146.c
@@ -55,11 +55,10 @@
#define DPC_BOARD_CAN_DO_VBI(dev) (dev->revision != 0)
static int debug = 0;
-MODULE_PARM(debug,"i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "debug verbosity");
-/* global variables */
-int dpc_num = 0;
+static int dpc_num = 0;
#define DPC_INPUTS 2
static struct v4l2_input dpc_inputs[DPC_INPUTS] = {
@@ -379,7 +378,7 @@ static struct saa7146_extension extension = {
.irq_func = NULL,
};
-int __init dpc_init_module(void)
+static int __init dpc_init_module(void)
{
if( 0 != saa7146_register_extension(&extension)) {
DEB_S(("failed to register extension.\n"));
@@ -389,7 +388,7 @@ int __init dpc_init_module(void)
return 0;
}
-void __exit dpc_cleanup_module(void)
+static void __exit dpc_cleanup_module(void)
{
saa7146_unregister_extension(&extension);
}
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index 50c436d036840..c9b00eafefde1 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -26,7 +26,7 @@
#include <media/saa7146_vv.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "debug verbosity");
/* global variables */
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index fba27bb4026ee..42a9414155c37 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -26,7 +26,7 @@
#include <media/saa7146_vv.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "debug verbosity");
/* global variables */
@@ -499,7 +499,7 @@ static struct saa7146_extension extension = {
.irq_func = NULL,
};
-int __init hexium_init_module(void)
+static int __init hexium_init_module(void)
{
if (0 != saa7146_register_extension(&extension)) {
DEB_S(("failed to register extension.\n"));
@@ -509,7 +509,7 @@ int __init hexium_init_module(void)
return 0;
}
-void __exit hexium_cleanup_module(void)
+static void __exit hexium_cleanup_module(void)
{
saa7146_unregister_extension(&extension);
}
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 84968642615a7..d4cfdc4b4428a 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -155,16 +155,6 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */
/* ----------------------------------------------------------------------- */
-static inline int reverse(int data, int bits)
-{
- int i,c;
-
- for (c=0,i=0; i<bits; i++) {
- c |= (((data & (1<<i)) ? 1:0)) << (bits-1-i);
- }
- return c;
-}
-
static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char buf[3];
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 2618f20af8ede..d0478307fbacc 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1829,14 +1829,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
goto outvmalloc;
}
- meye.grabq_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&meye.grabq_lock);
meye.grabq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL,
&meye.grabq_lock);
if (IS_ERR(meye.grabq)) {
printk(KERN_ERR "meye: fifo allocation failed\n");
goto outkfifoalloc1;
}
- meye.doneq_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&meye.doneq_lock);
meye.doneq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL,
&meye.doneq_lock);
if (IS_ERR(meye.doneq)) {
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index 386963798f341..c5c96bbf7aa1b 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -633,14 +633,6 @@ struct REGISTER_DUMP {
char *name;
};
-struct REGISTER_DUMP d1[] = {
- { 0x007e, "autodetect" },
- { 0x0023, "C_AD_BITS " },
- { 0x0038, "ADD_BITS " },
- { 0x003e, "CIB_BITS " },
- { 0x0057, "ERROR_RATE" },
-};
-
static int
autodetect_stereo(struct i2c_client *client)
{
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 5c785191bd9f3..a76571ddd03c9 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -1012,7 +1012,7 @@ static struct saa7146_extension extension = {
.irq_func = NULL,
};
-int __init mxb_init_module(void)
+static int __init mxb_init_module(void)
{
if( 0 != saa7146_register_extension(&extension)) {
DEB_S(("failed to register extension.\n"));
@@ -1022,7 +1022,7 @@ int __init mxb_init_module(void)
return 0;
}
-void __exit mxb_cleanup_module(void)
+static void __exit mxb_cleanup_module(void)
{
saa7146_unregister_extension(&extension);
}
diff --git a/drivers/media/video/mxb.h b/drivers/media/video/mxb.h
index 755e7927b348d..2332ed5f7c6b3 100644
--- a/drivers/media/video/mxb.h
+++ b/drivers/media/video/mxb.h
@@ -12,7 +12,7 @@
/* these are the available audio sources, which can switched
to the line- and cd-output individually */
-struct v4l2_audio mxb_audios[MXB_AUDIOS] = {
+static struct v4l2_audio mxb_audios[MXB_AUDIOS] = {
{
.index = 0,
.name = "Tuner",
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index 3ad4bddd76d2a..2504207b2e3da 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -896,7 +896,7 @@ static struct video_device pms_template=
.fops = &pms_fops,
};
-struct pms_device pms_device;
+static struct pms_device pms_device;
/*
@@ -1036,9 +1036,9 @@ static int __init init_pms_cards(void)
return video_register_device((struct video_device *)&pms_device, VFL_TYPE_GRABBER, video_nr);
}
-MODULE_PARM(io_port,"i");
-MODULE_PARM(mem_base,"i");
-MODULE_PARM(video_nr,"i");
+module_param(io_port, int, 0);
+module_param(mem_base, int, 0);
+module_param(video_nr, int, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
index 280f38b5183d5..4d8c922667fa0 100644
--- a/drivers/media/video/saa7110.c
+++ b/drivers/media/video/saa7110.c
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_decoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
index 122229e7b4631..627457ad77ee8 100644
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -63,7 +63,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_decoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 10699b49037a6..dbc3f4bba9f4a 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -225,7 +225,7 @@ static void dump_statusregs(struct saa7134_dev *dev)
/* ------------------------------------------------------------------ */
/* nr of (saa7134-)pages for the given buffer size */
-int saa7134_buffer_pages(int size)
+static int saa7134_buffer_pages(int size)
{
size = PAGE_ALIGN(size);
size += PAGE_SIZE; /* for non-page-aligned buffers */
@@ -630,7 +630,7 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
saa_writel(SAA7134_IRQ1, 0);
saa_writel(SAA7134_IRQ2, 0);
init_MUTEX(&dev->lock);
- dev->slock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dev->slock);
saa7134_track_gpio(dev,"pre-init");
saa7134_video_init1(dev);
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 2bbe9ebdd267b..b00696a26b968 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1378,7 +1378,7 @@ video_mmap(struct file *file, struct vm_area_struct * vma)
/* ------------------------------------------------------------------ */
-void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
+static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
{
struct saa7134_tvnorm *norm = dev->tvnorm;
@@ -1401,8 +1401,8 @@ void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
#endif
}
-int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
- struct v4l2_format *f)
+static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
+ struct v4l2_format *f)
{
switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -1427,8 +1427,8 @@ int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
}
}
-int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
- struct v4l2_format *f)
+static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
+ struct v4l2_format *f)
{
int err;
@@ -1492,8 +1492,8 @@ int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
}
}
-int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
- struct v4l2_format *f)
+static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
+ struct v4l2_format *f)
{
unsigned long flags;
int err;
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
index 71d866a15944a..26d62b43e816c 100644
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -57,7 +57,7 @@ MODULE_LICENSE("GPL");
#include <linux/video_encoder.h>
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index 37545acdb0235..35fc25454e85b 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -60,7 +60,7 @@ static struct saa7146 saa7146s[SAA7146_MAX];
static int saa_num = 0; /* number of SAA7146s in use */
static int video_nr = -1;
-MODULE_PARM(video_nr,"i");
+module_param(video_nr, int, 0);
MODULE_LICENSE("GPL");
@@ -97,13 +97,6 @@ MODULE_LICENSE("GPL");
#define debAudio (NewCard ? nDebAudio : oDebAudio)
#define debDMA (NewCard ? nDebDMA : oDebDMA)
-#ifdef DEBUG
-int stradis_driver(void) /* for the benefit of ksymoops */
-{
- return 1;
-}
-#endif
-
#ifdef USE_RESCUE_EEPROM_SDM275
static unsigned char rescue_eeprom[64] = {
0x00,0x01,0x04,0x13,0x26,0x0f,0x10,0x00,0x00,0x00,0x43,0x63,0x22,0x01,0x29,0x15,0x73,0x00,0x1f, 'd', 'e', 'c', 'x', 'l', 'd', 'v', 'a',0x02,0x00,0x01,0x00,0xcc,0xa4,0x63,0x09,0xe2,0x10,0x00,0x0a,0x00,0x02,0x02, 'd', 'e', 'c', 'x', 'l', 'a',0x00,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index de47c94d9507f..1272113e118f8 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -60,13 +60,13 @@ MODULE_AUTHOR("Eric Sandeen <eric_sandeen@bigfoot.com>");
MODULE_DESCRIPTION("bttv driver for the tda7432 audio processor chip");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug,"i");
-MODULE_PARM(loudness,"i");
+static int maxvol;
+static int loudness; /* disable loudness by default */
+static int debug; /* insmod parameter */
+module_param(debug, int, S_IRUGO | S_IWUSR);
+module_param(loudness, int, S_IRUGO);
MODULE_PARM_DESC(maxvol,"Set maximium volume to +20db (0), default is 0db(1)");
-MODULE_PARM(maxvol,"i");
-static int maxvol = 0;
-static int loudness = 0; /* disable loudness by default */
-static int debug = 0; /* insmod parameter */
+module_param(maxvol, int, S_IRUGO | S_IWUSR);
/* Address to scan (I2C address of this chip) */
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index fe2b038213456..707cadaf1e573 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -34,10 +34,10 @@
#include <media/audiochip.h>
#include <media/id.h>
-MODULE_PARM(debug,"i");
+static int debug; /* insmod parameter */
+module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_LICENSE("GPL");
-static int debug = 0; /* insmod parameter */
/* Addresses to scan */
static unsigned short normal_i2c[] = {
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c
index d98803161129b..d97e2de690cf9 100644
--- a/drivers/media/video/tuner-3036.c
+++ b/drivers/media/video/tuner-3036.c
@@ -197,14 +197,14 @@ static struct i2c_client client_template =
.name = "SAB3036",
};
-int __init
+static int __init
tuner3036_init(void)
{
i2c_add_driver(&i2c_driver_tuner);
return 0;
}
-void __exit
+static void __exit
tuner3036_exit(void)
{
i2c_del_driver(&i2c_driver_tuner);
@@ -214,7 +214,7 @@ MODULE_DESCRIPTION("SAB3036 tuner driver");
MODULE_AUTHOR("Philip Blundell <philb@gnu.org>");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug,"i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug,"Enable debugging output");
module_init(tuner3036_init);
diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c
index ae1063e09a016..c9d5f1a873cc0 100644
--- a/drivers/media/video/videocodec.c
+++ b/drivers/media/video/videocodec.c
@@ -46,7 +46,7 @@
#include "videocodec.h"
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
index 935b72c3da3db..917d0d2760b3a 100644
--- a/drivers/media/video/vpx3220.c
+++ b/drivers/media/video/vpx3220.c
@@ -41,7 +41,7 @@
#define VPX3220_DEBUG KERN_DEBUG "vpx3220: "
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 4ab1267e10445..f7a9a0932fe62 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -127,18 +127,18 @@ static const char* pardev[] = {[0 ... W9966_MAXCAMS] = ""};
#else
static const char* pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"};
#endif
-MODULE_PARM(pardev, "1-" __MODULE_STRING(W9966_MAXCAMS) "s");
+module_param_array(pardev, charp, NULL, 0);
MODULE_PARM_DESC(pardev, "pardev: where to search for\n\
\teach camera. 'aggressive' means brute-force search.\n\
\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n\
\tcam 1 to parport3 and search every parport for cam 2 etc...");
static int parmode = 0;
-MODULE_PARM(parmode, "i");
+module_param(parmode, int, 0);
MODULE_PARM_DESC(parmode, "parmode: transfer mode (0=auto, 1=ecp, 2=epp");
static int video_nr = -1;
-MODULE_PARM(video_nr, "i");
+module_param(video_nr, int, 0);
/*
* Private data
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 807c96ec7ea89..227ba2fb3f368 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -58,18 +58,17 @@
#define I2C_NAME(x) (x)->name
extern const struct zoran_format zoran_formats[];
-extern const int zoran_num_formats;
static int card[BUZ_MAX] = { -1, -1, -1, -1 };
-MODULE_PARM(card, "1-" __stringify(BUZ_MAX) "i");
+module_param_array(card, int, NULL, 0);
MODULE_PARM_DESC(card, "The type of card");
static int encoder[BUZ_MAX] = { -1, -1, -1, -1 };
-MODULE_PARM(encoder, "1-" __stringify(BUZ_MAX) "i");
+module_param_array(encoder, int, NULL, 0);
MODULE_PARM_DESC(encoder, "i2c TV encoder");
static int decoder[BUZ_MAX] = { -1, -1, -1, -1 };
-MODULE_PARM(decoder, "1-" __stringify(BUZ_MAX) "i");
+module_param_array(decoder, int, NULL, 0);
MODULE_PARM_DESC(decoder, "i2c TV decoder");
/*
@@ -81,23 +80,23 @@ MODULE_PARM_DESC(decoder, "i2c TV decoder");
*/
static unsigned long vidmem = 0; /* Video memory base address */
-MODULE_PARM(vidmem, "i");
+module_param(vidmem, ulong, 0);
/*
Default input and video norm at startup of the driver.
*/
static int default_input = 0; /* 0=Composite, 1=S-Video */
-MODULE_PARM(default_input, "i");
+module_param(default_input, int, 0);
MODULE_PARM_DESC(default_input,
"Default input (0=Composite, 1=S-Video, 2=Internal)");
static int default_norm = 0; /* 0=PAL, 1=NTSC 2=SECAM */
-MODULE_PARM(default_norm, "i");
+module_param(default_norm, int, 0);
MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)");
static int video_nr = -1; /* /dev/videoN, -1 for autodetect */
-MODULE_PARM(video_nr, "i");
+module_param(video_nr, int, 0);
MODULE_PARM_DESC(video_nr, "video device number");
/*
@@ -119,27 +118,27 @@ MODULE_PARM_DESC(video_nr, "video device number");
int v4l_nbufs = 2;
int v4l_bufsize = 128; /* Everybody should be able to work with this setting */
-MODULE_PARM(v4l_nbufs, "i");
+module_param(v4l_nbufs, int, 0);
MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use");
-MODULE_PARM(v4l_bufsize, "i");
+module_param(v4l_bufsize, int, 0);
MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)");
int jpg_nbufs = 32;
int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */
-MODULE_PARM(jpg_nbufs, "i");
+module_param(jpg_nbufs, int, 0);
MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use");
-MODULE_PARM(jpg_bufsize, "i");
+module_param(jpg_bufsize, int, 0);
MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)");
int pass_through = 0; /* 1=Pass through TV signal when device is not used */
/* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */
-MODULE_PARM(pass_through, "i");
+module_param(pass_through, int, 0);
MODULE_PARM_DESC(pass_through,
"Pass TV signal through to TV-out when idling");
static int debug = 1;
int *zr_debug = &debug;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-4)");
MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver");
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
index 75f3d49be82b5..5409db41a58ee 100644
--- a/drivers/media/video/zoran_device.c
+++ b/drivers/media/video/zoran_device.c
@@ -58,7 +58,6 @@
ZR36057_ISR_JPEGRepIRQ )
extern const struct zoran_format zoran_formats[];
-extern const int zoran_num_formats;
extern int *zr_debug;
@@ -77,10 +76,13 @@ static int lml33dpath = 0; /* 1 will use digital path in capture
* load on Bt819 input, there will be
* some image imperfections */
-MODULE_PARM(lml33dpath, "i");
+module_param(lml33dpath, bool, 0);
MODULE_PARM_DESC(lml33dpath,
"Use digital path capture mode (on LML33 cards)");
+static void
+zr36057_init_vfe (struct zoran *zr);
+
/*
* General Purpose I/O and Guest bus access
*/
@@ -1723,7 +1725,7 @@ zr36057_restart (struct zoran *zr)
* initialize video front end
*/
-void
+static void
zr36057_init_vfe (struct zoran *zr)
{
u32 reg;
diff --git a/drivers/media/video/zoran_device.h b/drivers/media/video/zoran_device.h
index 3f68b57080d61..f315203d71059 100644
--- a/drivers/media/video/zoran_device.h
+++ b/drivers/media/video/zoran_device.h
@@ -79,7 +79,6 @@ extern void zoran_set_pci_master(struct zoran *zr,
int set_master);
extern void zoran_init_hardware(struct zoran *zr);
extern void zr36057_restart(struct zoran *zr);
-extern void zr36057_init_vfe(struct zoran *zr);
/* i2c */
extern int decoder_command(struct zoran *zr,
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 8cda20af9089e..8af43a633663f 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -177,7 +177,7 @@ const struct zoran_format zoran_formats[] = {
ZORAN_FORMAT_COMPRESSED,
}
};
-const int zoran_num_formats =
+static const int zoran_num_formats =
(sizeof(zoran_formats) / sizeof(struct zoran_format));
// RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined
@@ -205,7 +205,7 @@ extern int jpg_bufsize;
extern int pass_through;
static int lock_norm = 0; /* 1=Don't change TV standard (norm) */
-MODULE_PARM(lock_norm, "i");
+module_param(lock_norm, int, 0);
MODULE_PARM_DESC(lock_norm, "Users can't change norm");
#ifdef HAVE_V4L2
diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c
index ceb83bd57c395..d4740a89cea1c 100644
--- a/drivers/media/video/zr36016.c
+++ b/drivers/media/video/zr36016.c
@@ -61,7 +61,7 @@ static int zr36016_codecs = 0;
/* debugging is available via module parameter */
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c
index 7416d1da94720..1e1bec697a560 100644
--- a/drivers/media/video/zr36050.c
+++ b/drivers/media/video/zr36050.c
@@ -58,7 +58,7 @@ static int zr36050_codecs = 0;
/* debugging is available via module parameter */
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c
index ff60fcd0826e8..b50dc403e6db6 100644
--- a/drivers/media/video/zr36060.c
+++ b/drivers/media/video/zr36060.c
@@ -56,12 +56,12 @@
static int zr36060_codecs = 0;
static int low_bitrate = 0;
-MODULE_PARM(low_bitrate, "i");
+module_param(low_bitrate, bool, 0);
MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate");
/* debugging is available via module parameter */
static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index 9780261c59ce3..f218ba606f337 100644
--- a/drivers/media/video/zr36120.c
+++ b/drivers/media/video/zr36120.c
@@ -1950,7 +1950,7 @@ int __init init_zoran(int card)
ztv->tuner_type = 0;
ztv->running = 0;
ztv->users = 0;
- ztv->lock = RW_LOCK_UNLOCKED;
+ rwlock_init(&ztv->lock);
ztv->workqueue = 0;
ztv->fieldnr = 0;
ztv->lastfieldnr = 0;
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index 5327c92155fea..a5725446176ef 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -1401,8 +1401,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
priv->max_buckets_out));
priv->bucketthresh = priv->max_buckets_out * 2 / 3;
- priv->txfidx_lock = SPIN_LOCK_UNLOCKED;
- priv->rxfidx_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&priv->txfidx_lock);
+ spin_lock_init(&priv->rxfidx_lock);
memset(&priv->stats, 0, sizeof(priv->stats));
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index eb7f13093c5fa..c46da50699ba1 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -57,7 +57,7 @@
#include "remote.h"
-static int __init ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
+static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
int err, result = -ENOMEM;
struct service_processor *sp;
@@ -107,7 +107,7 @@ static int __init ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_
goto error_remote_queue;
}
- sp->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sp->lock);
INIT_LIST_HEAD(&sp->command_queue);
result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);
@@ -161,7 +161,7 @@ error_kmalloc:
return result;
}
-static void __exit ibmasm_remove_one(struct pci_dev *pdev)
+static void __devexit ibmasm_remove_one(struct pci_dev *pdev)
{
struct service_processor *sp = (struct service_processor *)pci_get_drvdata(pdev);
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index dd592d0d3d2e7..3ee961c206bd8 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -14,14 +14,15 @@
#include <linux/ioport.h>
#include <linux/device.h>
#include <linux/interrupt.h>
-#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/err.h>
+#include <linux/highmem.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
#include <asm/io.h>
#include <asm/irq.h>
+#include <asm/scatterlist.h>
#include <asm/hardware/amba.h>
#include <asm/hardware/clock.h>
#include <asm/mach/mmc.h>
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index 97ee26d8acef8..bcad4e3bad12d 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -23,7 +23,6 @@
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
-#include <linux/blkdev.h>
#include <linux/dma-mapping.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
@@ -31,6 +30,7 @@
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/irq.h>
+#include <asm/scatterlist.h>
#include <asm/sizes.h>
#include <asm/arch/pxa-regs.h>
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 9c2318de7ce14..f6239d0559551 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -16,13 +16,13 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
-#include <linux/blkdev.h>
-
+#include <linux/highmem.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
#include <asm/io.h>
#include <asm/dma.h>
+#include <asm/scatterlist.h>
#include "wbsd.h"
@@ -33,7 +33,7 @@
#define DBG(x...) \
printk(KERN_DEBUG DRIVER_NAME ": " x)
#define DBGF(f, x...) \
- printk(KERN_DEBUG DRIVER_NAME " [%s()]: " f, __func__, ##x)
+ printk(KERN_DEBUG DRIVER_NAME " [%s()]: " f, __func__ , ##x)
#else
#define DBG(x...) do { } while (0)
#define DBGF(x...) do { } while (0)
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index fb862d06e9755..c4a56a4ac5e20 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -127,7 +127,7 @@ config MTD_BLKMTD
config MTD_BLOCK2MTD
tristate "MTD using block device (rewrite)"
- depends on MTD || EXPERIMENTAL
+ depends on MTD && EXPERIMENTAL
help
This driver is basically the same at MTD_BLKMTD above, but
experienced some interface changes plus serious speedups. In
diff --git a/drivers/mtd/devices/blkmtd.c b/drivers/mtd/devices/blkmtd.c
index 80d3393ee8176..662e807801ed0 100644
--- a/drivers/mtd/devices/blkmtd.c
+++ b/drivers/mtd/devices/blkmtd.c
@@ -68,13 +68,13 @@ static int sync;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
MODULE_DESCRIPTION("Emulate an MTD using a block device");
-MODULE_PARM(device, "1-4s");
+module_param_array(device, charp, NULL, 0);
MODULE_PARM_DESC(device, "block device to use");
-MODULE_PARM(erasesz, "1-4i");
+module_param_array(erasesz, int, NULL, 0);
MODULE_PARM_DESC(erasesz, "optional erase size to use in KiB. eg 4=4KiB.");
-MODULE_PARM(ro, "1-4i");
+module_param_array(ro, bool, NULL, 0);
MODULE_PARM_DESC(ro, "1=Read only, writes and erases cause errors");
-MODULE_PARM(sync, "i");
+module_param(sync, bool, 0);
MODULE_PARM_DESC(sync, "1=Synchronous writes");
@@ -661,7 +661,6 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
memset(dev, 0, sizeof(struct blkmtd_dev));
dev->blkdev = bdev;
- atomic_set(&(dev->blkdev->bd_inode->i_mapping->truncate_count), 0);
if(!readonly) {
init_MUTEX(&dev->wrbuf_mutex);
}
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 84e98e45bde2d..f82c539d8f6aa 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -324,7 +324,6 @@ static struct blockmtd_dev *add_device(char *devname, int erase_size)
goto devinit_err;
}
- atomic_set(&bdev->bd_inode->i_mapping->truncate_count, 0);
init_MUTEX(&dev->write_mutex);
/* Setup the MTD structure */
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c
index e64efe3386817..197d67045e1e7 100644
--- a/drivers/mtd/devices/docprobe.c
+++ b/drivers/mtd/devices/docprobe.c
@@ -62,7 +62,7 @@
static unsigned long doc_config_location = CONFIG_MTD_DOCPROBE_ADDRESS;
-MODULE_PARM(doc_config_location, "l");
+module_param(doc_config_location, ulong, 0);
MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe for DiskOnChip");
static unsigned long __initdata doc_locations[] = {
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index 2f999368960e3..edac4156d69c8 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -29,9 +29,9 @@
#ifdef MODULE
static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE;
static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE;
-MODULE_PARM(total_size,"l");
+module_param(total_size,ulong,0);
MODULE_PARM_DESC(total_size, "Total device size in KiB");
-MODULE_PARM(erase_size,"l");
+module_param(erase_size,ulong,0);
MODULE_PARM_DESC(erase_size, "Device erase block size in KiB");
#define MTDRAM_TOTAL_SIZE (total_size * 1024)
#define MTDRAM_ERASE_SIZE (erase_size * 1024)
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index b00a67099157c..5b3defadf884d 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -630,10 +630,6 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>");
MODULE_DESCRIPTION(PMC551_VERSION);
-MODULE_PARM(msize, "i");
-MODULE_PARM_DESC(msize, "memory size in Megabytes [1 - 1024]");
-MODULE_PARM(asize, "i");
-MODULE_PARM_DESC(asize, "aperture size, must be <= memsize [1-1024]");
/*
* Stuff these outside the ifdef so as to not bust compiled in driver support
@@ -645,6 +641,11 @@ static int asize=CONFIG_MTD_PMC551_APERTURE_SIZE
static int asize=0;
#endif
+module_param(msize, int, 0);
+MODULE_PARM_DESC(msize, "memory size in Megabytes [1 - 1024]");
+module_param(asize, int, 0);
+MODULE_PARM_DESC(asize, "aperture size, must be <= memsize [1-1024]");
+
/*
* PMC551 Card Initialization
*/
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index c6e81d1cf2381..5ab15e643be78 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -66,13 +66,13 @@ typedef struct slram_mtd_list {
#ifdef MODULE
static char *map[SLRAM_MAX_DEVICES_PARAMS];
+
+module_param_array(map, charp, NULL, 0);
+MODULE_PARM_DESC(map, "List of memory regions to map. \"map=<name>, <start>, <length / end>\"");
#else
static char *map;
#endif
-MODULE_PARM(map, "3-" __MODULE_STRING(SLRAM_MAX_DEVICES_PARAMS) "s");
-MODULE_PARM_DESC(map, "List of memory regions to map. \"map=<name>, <start>, <length / end>\"");
-
static slram_mtd_list_t *slram_mtdlist = NULL;
static int slram_erase(struct mtd_info *, struct erase_info *);
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 5f164955b8aea..18cc8846e7337 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -80,7 +80,7 @@
/* Parameters that can be set with 'insmod' */
static int shuffle_freq = 50;
-MODULE_PARM(shuffle_freq, "i");
+module_param(shuffle_freq, int, 0);
/*====================================================================*/
diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c
index 1f738e165c4b0..23eb4567cf988 100644
--- a/drivers/mtd/maps/scx200_docflash.c
+++ b/drivers/mtd/maps/scx200_docflash.c
@@ -29,20 +29,20 @@ MODULE_LICENSE("GPL");
/* Set this to one if you want to partition the flash */
#define PARTITION 1
-MODULE_PARM(probe, "i");
-MODULE_PARM_DESC(probe, "Probe for a BIOS mapping");
-MODULE_PARM(size, "i");
-MODULE_PARM_DESC(size, "Size of the flash mapping");
-MODULE_PARM(width, "i");
-MODULE_PARM_DESC(width, "Data width of the flash mapping (8/16)");
-MODULE_PARM(flashtype, "s");
-MODULE_PARM_DESC(flashtype, "Type of MTD probe to do");
-
static int probe = 0; /* Don't autoprobe */
static unsigned size = 0x1000000; /* 16 MiB the whole ISA address space */
static unsigned width = 8; /* Default to 8 bits wide */
static char *flashtype = "cfi_probe";
+module_param(probe, int, 0);
+MODULE_PARM_DESC(probe, "Probe for a BIOS mapping");
+module_param(size, int, 0);
+MODULE_PARM_DESC(size, "Size of the flash mapping");
+module_param(width, int, 0);
+MODULE_PARM_DESC(width, "Data width of the flash mapping (8/16)");
+module_param(flashtype, charp, 0);
+MODULE_PARM_DESC(flashtype, "Type of MTD probe to do");
+
static struct resource docmem = {
.flags = IORESOURCE_MEM,
.name = "NatSemi SCx200 DOCCS Flash",
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index 7628bda82c91b..f6d51ce34b005 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -892,8 +892,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
static struct net_device *dev_3c501;
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
MODULE_PARM_DESC(io, "EtherLink I/O base address");
MODULE_PARM_DESC(irq, "EtherLink IRQ number");
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index c4524decb9e97..4453fe43b5e5d 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -673,9 +673,9 @@ static struct net_device *dev_el2[MAX_EL2_CARDS];
static int io[MAX_EL2_CARDS];
static int irq[MAX_EL2_CARDS];
static int xcvr[MAX_EL2_CARDS]; /* choose int. or ext. xcvr */
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i");
-MODULE_PARM(xcvr, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(xcvr, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(xcvr, "transceiver(s) (0=internal, 1=external)");
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index ea8dbb0cdf064..8e9887fa26c88 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -1628,9 +1628,9 @@ static struct net_device *dev_3c505[ELP_MAX_CARDS];
static int io[ELP_MAX_CARDS];
static int irq[ELP_MAX_CARDS];
static int dma[ELP_MAX_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
-MODULE_PARM(dma, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
MODULE_PARM_DESC(io, "EtherLink Plus I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherLink Plus IRQ number(s) (assigned)");
MODULE_PARM_DESC(dma, "EtherLink Plus DMA channel(s)");
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index 8c2a06bfefc7e..4db82893909c3 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -127,6 +127,7 @@ struct net_local {
ushort tx_reap;
ushort tx_pkts_in_ring;
spinlock_t lock;
+ void __iomem *base;
};
/*
@@ -348,6 +349,7 @@ struct net_device * __init el16_probe(int unit)
return dev;
out1:
free_irq(dev->irq, dev);
+ iounmap(((struct net_local *)netdev_priv(dev))->base);
release_region(dev->base_addr, EL16_IO_EXTENT);
out:
free_netdev(dev);
@@ -395,7 +397,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
irqval = request_irq(irq, &el16_interrupt, 0, DRV_NAME, dev);
if (irqval) {
- printk ("unable to get IRQ %d (irqval=%d).\n", irq, irqval);
+ printk(KERN_ERR "3c507: unable to get IRQ %d (irqval=%d).\n", irq, irqval);
retval = -EAGAIN;
goto out;
}
@@ -445,6 +447,12 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
lp = netdev_priv(dev);
memset(lp, 0, sizeof(*lp));
spin_lock_init(&lp->lock);
+ lp->base = ioremap(dev->mem_start, RX_BUF_END);
+ if (!lp->base) {
+ printk(KERN_ERR "3c507: unable to remap memory\n");
+ retval = -EAGAIN;
+ goto out1;
+ }
dev->open = el16_open;
dev->stop = el16_close;
@@ -455,6 +463,8 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
dev->ethtool_ops = &netdev_ethtool_ops;
dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */
return 0;
+out1:
+ free_irq(dev->irq, dev);
out:
release_region(ioaddr, EL16_IO_EXTENT);
return retval;
@@ -474,11 +484,11 @@ static void el16_tx_timeout (struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
- unsigned long shmem = dev->mem_start;
+ void __iomem *shmem = lp->base;
if (net_debug > 1)
printk ("%s: transmit timed out, %s? ", dev->name,
- isa_readw (shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
+ readw(shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
"network cable problem");
/* Try to restart the adaptor. */
if (lp->last_restart == lp->stats.tx_packets) {
@@ -491,7 +501,7 @@ static void el16_tx_timeout (struct net_device *dev)
/* Issue the channel attention signal and hope it "gets better". */
if (net_debug > 1)
printk ("Kicking board.\n");
- isa_writew (0xf000 | CUC_START | RX_START, shmem + iSCB_CMD);
+ writew(0xf000 | CUC_START | RX_START, shmem + iSCB_CMD);
outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
lp->last_restart = lp->stats.tx_packets;
}
@@ -539,7 +549,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
struct net_local *lp;
int ioaddr, status, boguscount = 0;
ushort ack_cmd = 0;
- unsigned long shmem;
+ void __iomem *shmem;
if (dev == NULL) {
printk ("net_interrupt(): irq %d for unknown device.\n", irq);
@@ -548,11 +558,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
ioaddr = dev->base_addr;
lp = netdev_priv(dev);
- shmem = dev->mem_start;
+ shmem = lp->base;
spin_lock(&lp->lock);
- status = isa_readw(shmem+iSCB_STATUS);
+ status = readw(shmem+iSCB_STATUS);
if (net_debug > 4) {
printk("%s: 3c507 interrupt, status %4.4x.\n", dev->name, status);
@@ -563,7 +573,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* Reap the Tx packet buffers. */
while (lp->tx_pkts_in_ring) {
- unsigned short tx_status = isa_readw(shmem+lp->tx_reap);
+ unsigned short tx_status = readw(shmem+lp->tx_reap);
if (!(tx_status & 0x8000)) {
if (net_debug > 5)
printk("Tx command incomplete (%#x).\n", lp->tx_reap);
@@ -619,11 +629,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
printk("%s: Rx unit stopped, status %04x, restarting.\n",
dev->name, status);
init_rx_bufs(dev);
- isa_writew(RX_BUF_START,shmem+iSCB_RFA);
+ writew(RX_BUF_START,shmem+iSCB_RFA);
ack_cmd |= RX_START;
}
- isa_writew(ack_cmd,shmem+iSCB_CMD);
+ writew(ack_cmd,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
/* Clear the latched interrupt. */
@@ -637,13 +647,14 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static int el16_close(struct net_device *dev)
{
+ struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
- unsigned long shmem = dev->mem_start;
+ void __iomem *shmem = lp->base;
netif_stop_queue(dev);
/* Flush the Tx and disable Rx. */
- isa_writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD);
+ writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA);
/* Disable the 82586's input to the interrupt line. */
@@ -671,7 +682,7 @@ static struct net_device_stats *el16_get_stats(struct net_device *dev)
static void init_rx_bufs(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
- unsigned long write_ptr;
+ void __iomem *write_ptr;
unsigned short SCB_base = SCB_BASE;
int cur_rxbuf = lp->rx_head = RX_BUF_START;
@@ -679,26 +690,26 @@ static void init_rx_bufs(struct net_device *dev)
/* Initialize each Rx frame + data buffer. */
do { /* While there is room for one more. */
- write_ptr = dev->mem_start + cur_rxbuf;
-
- isa_writew(0x0000,write_ptr); /* Status */
- isa_writew(0x0000,write_ptr+=2); /* Command */
- isa_writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */
- isa_writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */
- isa_writew(0x0000,write_ptr+=2); /* Pad for dest addr. */
- isa_writew(0x0000,write_ptr+=2);
- isa_writew(0x0000,write_ptr+=2);
- isa_writew(0x0000,write_ptr+=2); /* Pad for source addr. */
- isa_writew(0x0000,write_ptr+=2);
- isa_writew(0x0000,write_ptr+=2);
- isa_writew(0x0000,write_ptr+=2); /* Pad for protocol. */
-
- isa_writew(0x0000,write_ptr+=2); /* Buffer: Actual count */
- isa_writew(-1,write_ptr+=2); /* Buffer: Next (none). */
- isa_writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */
- isa_writew(0x0000,write_ptr+=2);
+ write_ptr = lp->base + cur_rxbuf;
+
+ writew(0x0000,write_ptr); /* Status */
+ writew(0x0000,write_ptr+=2); /* Command */
+ writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */
+ writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */
+ writew(0x0000,write_ptr+=2); /* Pad for dest addr. */
+ writew(0x0000,write_ptr+=2);
+ writew(0x0000,write_ptr+=2);
+ writew(0x0000,write_ptr+=2); /* Pad for source addr. */
+ writew(0x0000,write_ptr+=2);
+ writew(0x0000,write_ptr+=2);
+ writew(0x0000,write_ptr+=2); /* Pad for protocol. */
+
+ writew(0x0000,write_ptr+=2); /* Buffer: Actual count */
+ writew(-1,write_ptr+=2); /* Buffer: Next (none). */
+ writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */
+ writew(0x0000,write_ptr+=2);
/* Finally, the number of bytes in the buffer. */
- isa_writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2);
+ writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2);
lp->rx_tail = cur_rxbuf;
cur_rxbuf += RX_BUF_SIZE;
@@ -706,16 +717,16 @@ static void init_rx_bufs(struct net_device *dev)
/* Terminate the list by setting the EOL bit, and wrap the pointer to make
the list a ring. */
- write_ptr = dev->mem_start + lp->rx_tail + 2;
- isa_writew(0xC000,write_ptr); /* Command, mark as last. */
- isa_writew(lp->rx_head,write_ptr+2); /* Link */
+ write_ptr = lp->base + lp->rx_tail + 2;
+ writew(0xC000,write_ptr); /* Command, mark as last. */
+ writew(lp->rx_head,write_ptr+2); /* Link */
}
static void init_82586_mem(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
short ioaddr = dev->base_addr;
- unsigned long shmem = dev->mem_start;
+ void __iomem *shmem = lp->base;
/* Enable loopback to protect the wire while starting up,
and hold the 586 in reset during the memory initialization. */
@@ -726,13 +737,13 @@ static void init_82586_mem(struct net_device *dev)
init_words[7] = SCB_BASE;
/* Write the words at 0xfff6 (address-aliased to 0xfffff6). */
- isa_memcpy_toio(dev->mem_end-10, init_words, 10);
+ memcpy_toio(lp->base + RX_BUF_END - 10, init_words, 10);
/* Write the words at 0x0000. */
- isa_memcpy_toio(dev->mem_start, init_words + 5, sizeof(init_words) - 10);
+ memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10);
/* Fill in the station address. */
- isa_memcpy_toio(dev->mem_start+SA_OFFSET, dev->dev_addr,
+ memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr,
sizeof(dev->dev_addr));
/* The Tx-block list is written as needed. We just set up the values. */
@@ -750,11 +761,11 @@ static void init_82586_mem(struct net_device *dev)
{
int boguscnt = 50;
- while (isa_readw(shmem+iSCB_STATUS) == 0)
+ while (readw(shmem+iSCB_STATUS) == 0)
if (--boguscnt == 0) {
printk("%s: i82586 initialization timed out with status %04x,"
"cmd %04x.\n", dev->name,
- isa_readw(shmem+iSCB_STATUS), isa_readw(shmem+iSCB_CMD));
+ readw(shmem+iSCB_STATUS), readw(shmem+iSCB_CMD));
break;
}
/* Issue channel-attn -- the 82586 won't start. */
@@ -765,7 +776,7 @@ static void init_82586_mem(struct net_device *dev)
outb(0x84, ioaddr + MISC_CTRL);
if (net_debug > 4)
printk("%s: Initialized 82586, status %04x.\n", dev->name,
- isa_readw(shmem+iSCB_STATUS));
+ readw(shmem+iSCB_STATUS));
return;
}
@@ -774,33 +785,33 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length
struct net_local *lp = netdev_priv(dev);
short ioaddr = dev->base_addr;
ushort tx_block = lp->tx_head;
- unsigned long write_ptr = dev->mem_start + tx_block;
+ void __iomem *write_ptr = lp->base + tx_block;
static char padding[ETH_ZLEN];
/* Set the write pointer to the Tx block, and put out the header. */
- isa_writew(0x0000,write_ptr); /* Tx status */
- isa_writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */
- isa_writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */
- isa_writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */
+ writew(0x0000,write_ptr); /* Tx status */
+ writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */
+ writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */
+ writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */
/* Output the data buffer descriptor. */
- isa_writew((pad + length) | 0x8000,write_ptr+=2); /* Byte count parameter. */
- isa_writew(-1,write_ptr+=2); /* No next data buffer. */
- isa_writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */
- isa_writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */
+ writew((pad + length) | 0x8000,write_ptr+=2); /* Byte count parameter. */
+ writew(-1,write_ptr+=2); /* No next data buffer. */
+ writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */
+ writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */
/* Output the Loop-back NoOp command. */
- isa_writew(0x0000,write_ptr+=2); /* Tx status */
- isa_writew(CmdNOp,write_ptr+=2); /* Tx command */
- isa_writew(tx_block+16,write_ptr+=2); /* Next is myself. */
+ writew(0x0000,write_ptr+=2); /* Tx status */
+ writew(CmdNOp,write_ptr+=2); /* Tx command */
+ writew(tx_block+16,write_ptr+=2); /* Next is myself. */
/* Output the packet at the write pointer. */
- isa_memcpy_toio(write_ptr+2, buf, length);
+ memcpy_toio(write_ptr+2, buf, length);
if (pad)
- isa_memcpy_toio(write_ptr+length+2, padding, pad);
+ memcpy_toio(write_ptr+length+2, padding, pad);
/* Set the old command link pointing to this send packet. */
- isa_writew(tx_block,dev->mem_start + lp->tx_cmd_link);
+ writew(tx_block,lp->base + lp->tx_cmd_link);
lp->tx_cmd_link = tx_block + 20;
/* Set the next free tx region. */
@@ -821,19 +832,19 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length
static void el16_rx(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
- unsigned long shmem = dev->mem_start;
+ void __iomem *shmem = lp->base;
ushort rx_head = lp->rx_head;
ushort rx_tail = lp->rx_tail;
ushort boguscount = 10;
short frame_status;
- while ((frame_status = isa_readw(shmem+rx_head)) < 0) { /* Command complete */
- unsigned long read_frame = dev->mem_start + rx_head;
- ushort rfd_cmd = isa_readw(read_frame+2);
- ushort next_rx_frame = isa_readw(read_frame+4);
- ushort data_buffer_addr = isa_readw(read_frame+6);
- unsigned long data_frame = dev->mem_start + data_buffer_addr;
- ushort pkt_len = isa_readw(data_frame);
+ while ((frame_status = readw(shmem+rx_head)) < 0) { /* Command complete */
+ void __iomem *read_frame = lp->base + rx_head;
+ ushort rfd_cmd = readw(read_frame+2);
+ ushort next_rx_frame = readw(read_frame+4);
+ ushort data_buffer_addr = readw(read_frame+6);
+ void __iomem *data_frame = lp->base + data_buffer_addr;
+ ushort pkt_len = readw(data_frame);
if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22
|| (pkt_len & 0xC000) != 0xC000) {
@@ -865,7 +876,7 @@ static void el16_rx(struct net_device *dev)
skb->dev = dev;
/* 'skb->data' points to the start of sk_buff data area. */
- isa_memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len);
+ memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len);
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
@@ -875,10 +886,10 @@ static void el16_rx(struct net_device *dev)
}
/* Clear the status word and set End-of-List on the rx frame. */
- isa_writew(0,read_frame);
- isa_writew(0xC000,read_frame+2);
+ writew(0,read_frame);
+ writew(0xC000,read_frame+2);
/* Clear the end-of-list on the prev. RFD. */
- isa_writew(0x0000,dev->mem_start + rx_tail + 2);
+ writew(0x0000,lp->base + rx_tail + 2);
rx_tail = rx_head;
rx_head = next_rx_frame;
@@ -916,8 +927,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
#ifdef MODULE
static struct net_device *dev_3c507;
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
MODULE_PARM_DESC(io, "EtherLink16 I/O base address");
MODULE_PARM_DESC(irq, "(ignored)");
@@ -935,6 +946,7 @@ cleanup_module(void)
struct net_device *dev = dev_3c507;
unregister_netdev(dev);
free_irq(dev->irq, dev);
+ iounmap(((struct net_local *)netdev_priv(dev))->base);
release_region(dev->base_addr, EL16_IO_EXTENT);
free_netdev(dev);
}
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index 7d25f2e36fc75..d474ba6238262 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -209,6 +209,9 @@ static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data);
#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
static int el3_device_remove (struct device *device);
#endif
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void el3_poll_controller(struct net_device *dev);
+#endif
#ifdef CONFIG_EISA
struct eisa_device_id el3_eisa_ids[] = {
@@ -321,6 +324,9 @@ static int __init el3_common_init(struct net_device *dev)
dev->set_multicast_list = &set_multicast_list;
dev->tx_timeout = el3_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ dev->poll_controller = el3_poll_controller;
+#endif
SET_ETHTOOL_OPS(dev, &ethtool_ops);
err = register_netdev(dev);
@@ -999,6 +1005,19 @@ el3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ */
+static void el3_poll_controller(struct net_device *dev)
+{
+ disable_irq(dev->irq);
+ el3_interrupt(dev->irq, dev, NULL);
+ enable_irq(dev->irq);
+}
+#endif
+
static struct net_device_stats *
el3_get_stats(struct net_device *dev)
{
@@ -1535,16 +1554,16 @@ static int debug = -1;
static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
-MODULE_PARM(debug,"i");
-MODULE_PARM(irq,"1-8i");
-MODULE_PARM(xcvr,"1-12i");
-MODULE_PARM(max_interrupt_work, "i");
+module_param(debug,int, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(xcvr, int, NULL, 0);
+module_param(max_interrupt_work, int, 0);
MODULE_PARM_DESC(debug, "debug level (0-6)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(xcvr,"transceiver(s) (0=internal, 1=external)");
MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt");
#if defined(__ISAPNP__)
-MODULE_PARM(nopnp, "i");
+module_param(nopnp, int, 0);
MODULE_PARM_DESC(nopnp, "disable ISA PnP support (0-1)");
MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters);
#endif /* __ISAPNP__ */
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 7dca6e585e664..f1a08b5631b01 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -87,15 +87,6 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("3Com 3c515 Corkscrew driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM_DESC(debug, "3c515 debug level (0-6)");
-MODULE_PARM_DESC(options, "3c515: Bits 0-2: media type, bit 3: full duplex, bit 4: bus mastering");
-MODULE_PARM_DESC(rx_copybreak, "3c515 copy breakpoint for copy-only-tiny-frames");
-MODULE_PARM_DESC(max_interrupt_work, "3c515 maximum events handled per interrupt");
-
/* "Knobs" for adjusting internal parameters. */
/* Put out somewhat more debugging messages. (0 - no msg, 1 minimal msgs). */
#define DRIVER_DEBUG 1
@@ -409,6 +400,16 @@ static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1, };
#ifdef MODULE
static int debug = -1;
+
+module_param(debug, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param(rx_copybreak, int, 0);
+module_param(max_interrupt_work, int, 0);
+MODULE_PARM_DESC(debug, "3c515 debug level (0-6)");
+MODULE_PARM_DESC(options, "3c515: Bits 0-2: media type, bit 3: full duplex, bit 4: bus mastering");
+MODULE_PARM_DESC(rx_copybreak, "3c515 copy breakpoint for copy-only-tiny-frames");
+MODULE_PARM_DESC(max_interrupt_work, "3c515 maximum events handled per interrupt");
+
/* A list of all installed Vortex devices, for removing the driver module. */
/* we will need locking (and refcounting) if we ever use it for more */
static LIST_HEAD(root_corkscrew_dev);
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 0a5df59d46fd1..8f6b2fa13e283 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -1271,8 +1271,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
static struct net_device *dev_elmc[MAX_3C523_CARDS];
static int irq[MAX_3C523_CARDS];
static int io[MAX_3C523_CARDS];
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_3C523_CARDS) "i");
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_3C523_CARDS) "i");
+module_param_array(irq, int, NULL, 0);
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "EtherLink/MC I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherLink/MC IRQ number(s)");
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 6b835d15efc70..c73750625e72b 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -279,36 +279,6 @@ MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver "
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(debug, "i");
-MODULE_PARM(global_options, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_full_duplex, "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(hw_checksums, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(flow_ctrl, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(global_enable_wol, "i");
-MODULE_PARM(enable_wol, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(compaq_ioaddr, "i");
-MODULE_PARM(compaq_irq, "i");
-MODULE_PARM(compaq_device_id, "i");
-MODULE_PARM(watchdog, "i");
-MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
-MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
-MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
-MODULE_PARM_DESC(full_duplex, "3c59x full duplex setting(s) (1)");
-MODULE_PARM_DESC(global_full_duplex, "3c59x: same as full_duplex, but applies to all NICs if options is unset");
-MODULE_PARM_DESC(hw_checksums, "3c59x Hardware checksum checking by adapter(s) (0-1)");
-MODULE_PARM_DESC(flow_ctrl, "3c59x 802.3x flow control usage (PAUSE only) (0-1)");
-MODULE_PARM_DESC(enable_wol, "3c59x: Turn on Wake-on-LAN for adapter(s) (0-1)");
-MODULE_PARM_DESC(global_enable_wol, "3c59x: same as enable_wol, but applies to all NICs if options is unset");
-MODULE_PARM_DESC(rx_copybreak, "3c59x copy breakpoint for copy-only-tiny-frames");
-MODULE_PARM_DESC(max_interrupt_work, "3c59x maximum events handled per interrupt");
-MODULE_PARM_DESC(compaq_ioaddr, "3c59x PCI I/O base address (Compaq BIOS problem workaround)");
-MODULE_PARM_DESC(compaq_irq, "3c59x PCI IRQ number (Compaq BIOS problem workaround)");
-MODULE_PARM_DESC(compaq_device_id, "3c59x PCI device ID (Compaq BIOS problem workaround)");
-MODULE_PARM_DESC(watchdog, "3c59x transmit timeout in milliseconds");
/* Operational parameter that usually are not changed. */
@@ -931,6 +901,37 @@ static struct net_device *compaq_net_device;
static int vortex_cards_found;
+module_param(debug, int, 0);
+module_param(global_options, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param(global_full_duplex, int, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param_array(hw_checksums, int, NULL, 0);
+module_param_array(flow_ctrl, int, NULL, 0);
+module_param(global_enable_wol, int, 0);
+module_param_array(enable_wol, int, NULL, 0);
+module_param(rx_copybreak, int, 0);
+module_param(max_interrupt_work, int, 0);
+module_param(compaq_ioaddr, int, 0);
+module_param(compaq_irq, int, 0);
+module_param(compaq_device_id, int, 0);
+module_param(watchdog, int, 0);
+MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
+MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
+MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(full_duplex, "3c59x full duplex setting(s) (1)");
+MODULE_PARM_DESC(global_full_duplex, "3c59x: same as full_duplex, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(hw_checksums, "3c59x Hardware checksum checking by adapter(s) (0-1)");
+MODULE_PARM_DESC(flow_ctrl, "3c59x 802.3x flow control usage (PAUSE only) (0-1)");
+MODULE_PARM_DESC(enable_wol, "3c59x: Turn on Wake-on-LAN for adapter(s) (0-1)");
+MODULE_PARM_DESC(global_enable_wol, "3c59x: same as enable_wol, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(rx_copybreak, "3c59x copy breakpoint for copy-only-tiny-frames");
+MODULE_PARM_DESC(max_interrupt_work, "3c59x maximum events handled per interrupt");
+MODULE_PARM_DESC(compaq_ioaddr, "3c59x PCI I/O base address (Compaq BIOS problem workaround)");
+MODULE_PARM_DESC(compaq_irq, "3c59x PCI IRQ number (Compaq BIOS problem workaround)");
+MODULE_PARM_DESC(compaq_device_id, "3c59x PCI device ID (Compaq BIOS problem workaround)");
+MODULE_PARM_DESC(watchdog, "3c59x transmit timeout in milliseconds");
+
#ifdef CONFIG_NET_POLL_CONTROLLER
static void poll_vortex(struct net_device *dev)
{
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index a71423c751e2f..80ebac6d2c9e8 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -398,6 +398,8 @@ static void cp_clean_rings (struct cp_private *cp);
static struct pci_device_id cp_pci_tbl[] = {
{ PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, },
+ { PCI_VENDOR_ID_TTTECH, PCI_DEVICE_ID_TTTECH_MC322,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, },
{ },
};
MODULE_DEVICE_TABLE(pci, cp_pci_tbl);
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index ff9bf1cbe2ab1..65f97b1dc5818 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -150,7 +150,7 @@ MODULE_AUTHOR("Richard Hirst");
MODULE_DESCRIPTION("i82596 driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(i596_debug, "i");
+module_param(i596_debug, int, 0);
MODULE_PARM_DESC(i596_debug, "i82596 debug mask");
@@ -1572,13 +1572,13 @@ static void set_multicast_list(struct net_device *dev)
static struct net_device *dev_82596;
#ifdef ENABLE_APRICOT
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(irq, "Apricot IRQ number");
#endif
-MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug, "i82596 debug mask");
static int debug = -1;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, "i82596 debug mask");
int init_module(void)
{
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index 873f0d358f347..0486d3ecb1e84 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -43,6 +43,7 @@
Paul Gortmaker : Separate out Tx timeout code from Tx path.
Paul Gortmaker : Remove old unused single Tx buffer code.
Hayato Fujiwara : Add m32r support.
+ Paul Gortmaker : use skb_padto() instead of stack scratch area
Sources:
The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
@@ -272,11 +273,15 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
long e8390_base = dev->base_addr;
struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
- int length, send_length, output_page;
+ int send_length = skb->len, output_page;
unsigned long flags;
- char scratch[ETH_ZLEN];
- length = skb->len;
+ if (skb->len < ETH_ZLEN) {
+ skb = skb_padto(skb, ETH_ZLEN);
+ if (skb == NULL)
+ return 0;
+ send_length = ETH_ZLEN;
+ }
/* Mask interrupts from the ethercard.
SMP: We have to grab the lock here otherwise the IRQ handler
@@ -298,8 +303,6 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
ei_local->irqlock = 1;
- send_length = ETH_ZLEN < length ? length : ETH_ZLEN;
-
/*
* We have two Tx slots available for use. Find the first free
* slot, and then perform some sanity checks. With two Tx bufs,
@@ -344,13 +347,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
* trigger the send later, upon receiving a Tx done interrupt.
*/
- if (length == send_length)
- ei_block_output(dev, length, skb->data, output_page);
- else {
- memset(scratch, 0, ETH_ZLEN);
- memcpy(scratch, skb->data, skb->len);
- ei_block_output(dev, ETH_ZLEN, scratch, output_page);
- }
+ ei_block_output(dev, send_length, skb->data, output_page);
if (! ei_local->txing)
{
diff --git a/drivers/net/8390.h b/drivers/net/8390.h
index 948723b72d4ad..599b68d8c45f9 100644
--- a/drivers/net/8390.h
+++ b/drivers/net/8390.h
@@ -52,6 +52,7 @@ struct ei_device {
void (*block_input)(struct net_device *, int, struct sk_buff *, int);
unsigned long rmem_start;
unsigned long rmem_end;
+ void __iomem *mem;
unsigned char mcfilter[8];
unsigned open:1;
unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6b037bea841a9..4ff0f47d53324 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1399,16 +1399,6 @@ config EEPRO100
will be called eepro100.
-config EEPRO100_PIO
- bool "Use PIO instead of MMIO" if !X86_VISWS
- depends on EEPRO100
- default y if X86_VISWS
- help
- This instructs the driver to use programmed I/O ports (PIO) instead
- of PCI shared memory (MMIO). This can possibly solve some problems
- in case your mainboard has memory consistency issues. If unsure,
- say N.
-
config E100
tristate "Intel(R) PRO/100+ support"
depends on NET_PCI && PCI
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index 6f2e92f09d41f..24fba36b5c1d8 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -128,8 +128,7 @@ static void cleanup_card(struct net_device *dev)
/* Someday free_irq may be in ac_close_card() */
free_irq(dev->irq, dev);
release_region(dev->base_addr, AC_IO_EXTENT);
- if (ei_status.reg0)
- iounmap((void *)dev->mem_start);
+ iounmap(ei_status.mem);
}
#ifndef MODULE
@@ -237,32 +236,22 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
/*
* BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
* the card mem within the region covered by `normal' RAM !!!
+ *
+ * ioremap() will fail in that case.
*/
- if (dev->mem_start > 1024*1024) { /* phys addr > 1MB */
- if (dev->mem_start < virt_to_phys(high_memory)) {
- printk(KERN_CRIT "ac3200.c: Card RAM overlaps with normal memory!!!\n");
- printk(KERN_CRIT "ac3200.c: Use EISA SCU to set card memory below 1MB,\n");
- printk(KERN_CRIT "ac3200.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory));
- printk(KERN_CRIT "ac3200.c: Driver NOT installed.\n");
- retval = -EINVAL;
- goto out1;
- }
- dev->mem_start = (unsigned long)ioremap(dev->mem_start, AC_STOP_PG*0x100);
- if (dev->mem_start == 0) {
- printk(KERN_ERR "ac3200.c: Unable to remap card memory above 1MB !!\n");
- printk(KERN_ERR "ac3200.c: Try using EISA SCU to set memory below 1MB.\n");
- printk(KERN_ERR "ac3200.c: Driver NOT installed.\n");
- retval = -EINVAL;
- goto out1;
- }
- ei_status.reg0 = 1; /* Use as remap flag */
- printk("ac3200.c: remapped %dkB card memory to virtual address %#lx\n",
- AC_STOP_PG/4, dev->mem_start);
+ ei_status.mem = ioremap(dev->mem_start, AC_STOP_PG*0x100);
+ if (!ei_status.mem) {
+ printk(KERN_ERR "ac3200.c: Unable to remap card memory above 1MB !!\n");
+ printk(KERN_ERR "ac3200.c: Try using EISA SCU to set memory below 1MB.\n");
+ printk(KERN_ERR "ac3200.c: Driver NOT installed.\n");
+ retval = -EINVAL;
+ goto out1;
}
+ printk("ac3200.c: remapped %dkB card memory to virtual address %p\n",
+ AC_STOP_PG/4, ei_status.mem);
- ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
- dev->mem_end = ei_status.rmem_end = dev->mem_start
- + (AC_STOP_PG - AC_START_PG)*256;
+ dev->mem_start = (unsigned long)ei_status.mem;
+ dev->mem_end = dev->mem_start + (AC_STOP_PG - AC_START_PG)*256;
ei_status.name = "AC3200";
ei_status.tx_start_page = AC_START_PG;
@@ -324,8 +313,8 @@ static void ac_reset_8390(struct net_device *dev)
static void
ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
- unsigned long hdr_start = dev->mem_start + ((ring_page - AC_START_PG)<<8);
- isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ void __iomem *hdr_start = ei_status.mem + ((ring_page - AC_START_PG)<<8);
+ memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
}
/* Block input and output are easy on shared memory ethercards, the only
@@ -334,26 +323,27 @@ ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page
static void ac_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset)
{
- unsigned long xfer_start = dev->mem_start + ring_offset - (AC_START_PG<<8);
+ void __iomem *start = ei_status.mem + ring_offset - AC_START_PG*256;
- if (xfer_start + count > ei_status.rmem_end) {
+ if (ring_offset + count > AC_STOP_PG*256) {
/* We must wrap the input move. */
- int semi_count = ei_status.rmem_end - xfer_start;
- isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+ int semi_count = AC_STOP_PG*256 - ring_offset;
+ memcpy_fromio(skb->data, start, semi_count);
count -= semi_count;
- isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
+ memcpy_fromio(skb->data + semi_count,
+ ei_status.mem + TX_PAGES*256, count);
} else {
/* Packet is in one chunk -- we can copy + cksum. */
- isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
+ eth_io_copy_and_sum(skb, start, count, 0);
}
}
static void ac_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page)
{
- unsigned long shmem = dev->mem_start + ((start_page - AC_START_PG)<<8);
+ void __iomem *shmem = ei_status.mem + ((start_page - AC_START_PG)<<8);
- isa_memcpy_toio(shmem, buf, count);
+ memcpy_toio(shmem, buf, count);
}
static int ac_close_card(struct net_device *dev)
@@ -377,9 +367,9 @@ static struct net_device *dev_ac32[MAX_AC32_CARDS];
static int io[MAX_AC32_CARDS];
static int irq[MAX_AC32_CARDS];
static int mem[MAX_AC32_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(mem, "Memory base address(es)");
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 89183239bfd43..dbc9a9da3b9fa 100755
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -105,11 +105,11 @@ Revision History:
MODULE_AUTHOR("Advanced Micro Devices, Inc.");
MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version 3.0.3");
MODULE_LICENSE("GPL");
-MODULE_PARM(speed_duplex, "1-" __MODULE_STRING (MAX_UNITS) "i");
+module_param_array(speed_duplex, int, NULL, 0);
MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotitate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex");
-MODULE_PARM(coalesce, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param_array(coalesce, bool, NULL, 0);
MODULE_PARM_DESC(coalesce, "Enable or Disable interrupt coalescing, 1: Enable, 0: Disable");
-MODULE_PARM(dynamic_ipg, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param_array(dynamic_ipg, bool, NULL, 0);
MODULE_PARM_DESC(dynamic_ipg, "Enable or Disable dynamic IPG, 1: Enable, 0: Disable");
static struct pci_device_id amd8111e_pci_tbl[] = {
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 00bb1b2ae4a0e..2161c2d585f08 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -1027,9 +1027,9 @@ static struct net_device_stats *cops_get_stats(struct net_device *dev)
static struct net_device *cops_dev;
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(board_type, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(board_type, int, 0);
int init_module(void)
{
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index 8bf0bba6276af..1a44a79ed0644 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -289,7 +289,7 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static struct net_device *dev_ipddp;
MODULE_LICENSE("GPL");
-MODULE_PARM(ipddp_mode, "i");
+module_param(ipddp_mode, int, 0);
static int __init ipddp_init_module(void)
{
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 118503bc38237..e9b11453b710e 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1257,10 +1257,10 @@ static struct net_device *dev_ltpc;
#ifdef MODULE
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(dma, "i");
+module_param(debug, int, 0);
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
int __init init_module(void)
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 6b4051df2d6f1..282a678007b3e 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -110,7 +110,7 @@ static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
static int go_tx(struct net_device *dev);
static int debug = ARCNET_DEBUG;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_LICENSE("GPL");
static int __init arcnet_init(void)
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index 0dcf27a51dd67..b8ab2b6355ebf 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -899,9 +899,9 @@ set_rx_mode(struct net_device *dev)
#ifdef MODULE
static struct net_device *dev_at1700;
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(net_debug, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(net_debug, int, 0);
MODULE_PARM_DESC(io, "AT1700/FMV18X I/O base address");
MODULE_PARM_DESC(irq, "AT1700/FMV18X IRQ number");
MODULE_PARM_DESC(net_debug, "AT1700/FMV18X debug level (0-6)");
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index 662e40f300311..16f7f164a070f 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -153,11 +153,11 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("RealTek RTL8002/8012 parallel port Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(io, "1-" __MODULE_STRING(NUM_UNITS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(NUM_UNITS) "i");
-MODULE_PARM(xcvr, "1-" __MODULE_STRING(NUM_UNITS) "i");
+module_param(max_interrupt_work, int, 0);
+module_param(debug, int, 0);
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(xcvr, int, NULL, 0);
MODULE_PARM_DESC(max_interrupt_work, "ATP maximum events handled per interrupt");
MODULE_PARM_DESC(debug, "ATP debug level (0-7)");
MODULE_PARM_DESC(io, "ATP I/O base address(es)");
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 654a79fb65d82..2a4b7cb97523d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -540,25 +540,25 @@ static char *lacp_rate = NULL;
static int arp_interval = BOND_LINK_ARP_INTERV;
static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, };
-MODULE_PARM(max_bonds, "i");
+module_param(max_bonds, int, 0);
MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
-MODULE_PARM(miimon, "i");
+module_param(miimon, int, 0);
MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
-MODULE_PARM(updelay, "i");
+module_param(updelay, int, 0);
MODULE_PARM_DESC(updelay, "Delay before considering link up, in milliseconds");
-MODULE_PARM(downdelay, "i");
+module_param(downdelay, int, 0);
MODULE_PARM_DESC(downdelay, "Delay before considering link down, in milliseconds");
-MODULE_PARM(use_carrier, "i");
+module_param(use_carrier, int, 0);
MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default)");
-MODULE_PARM(mode, "s");
+module_param(mode, charp, 0);
MODULE_PARM_DESC(mode, "Mode of operation : 0 for round robin, 1 for active-backup, 2 for xor");
-MODULE_PARM(primary, "s");
+module_param(primary, charp, 0);
MODULE_PARM_DESC(primary, "Primary network device to use");
-MODULE_PARM(lacp_rate, "s");
+module_param(lacp_rate, charp, 0);
MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)");
-MODULE_PARM(arp_interval, "i");
+module_param(arp_interval, int, 0);
MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
-MODULE_PARM(arp_ip_target, "1-" __MODULE_STRING(BOND_MAX_ARP_TARGETS) "s");
+module_param_array(arp_ip_target, charp, NULL, 0);
MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
/*----------------------------- Global variables ----------------------------*/
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index e8c74071fed35..8171b10926eb7 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1710,14 +1710,14 @@ static int use_dma; /* These generate unused var warnings if ALLOW_DMA = 0 */
static int dma;
static int dmasize=16; /* or 64 */
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(media, "c8");
-MODULE_PARM(duplex, "i");
-MODULE_PARM(dma , "i");
-MODULE_PARM(dmasize , "i");
-MODULE_PARM(use_dma , "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(debug, int, 0);
+module_param_string(media, media, sizeof(media), 0);
+module_param(duplex, int, 0);
+module_param(dma , int, 0);
+module_param(dmasize , int, 0);
+module_param(use_dma , int, 0);
MODULE_PARM_DESC(io, "cs89x0 I/O base address");
MODULE_PARM_DESC(irq, "cs89x0 IRQ number");
#if DEBUGGING
diff --git a/drivers/net/de600.c b/drivers/net/de600.c
index 0e8b0771e67c8..1b6b437f5d405 100644
--- a/drivers/net/de600.c
+++ b/drivers/net/de600.c
@@ -75,15 +75,15 @@ static const char version[] = "de600.c: $Revision: 1.41-2.5 $, Bjorn Ekwall (bj
#include "de600.h"
static unsigned int de600_debug = DE600_DEBUG;
-MODULE_PARM(de600_debug, "i");
+module_param(de600_debug, int, 0);
MODULE_PARM_DESC(de600_debug, "DE-600 debug level (0-2)");
static unsigned int check_lost = 1;
-MODULE_PARM(check_lost, "i");
+module_param(check_lost, bool, 0);
MODULE_PARM_DESC(check_lost, "If set then check for unplugged de600");
static unsigned int delay_time = 10;
-MODULE_PARM(delay_time, "i");
+module_param(delay_time, int, 0);
MODULE_PARM_DESC(delay_time, "DE-600 deley on I/O in microseconds");
diff --git a/drivers/net/de620.c b/drivers/net/de620.c
index 3623c7d99fb32..0069f5fa973aa 100644
--- a/drivers/net/de620.c
+++ b/drivers/net/de620.c
@@ -190,12 +190,12 @@ static unsigned int de620_debug = DE620_DEBUG;
static spinlock_t de620_lock;
-MODULE_PARM(bnc, "i");
-MODULE_PARM(utp, "i");
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(clone, "i");
-MODULE_PARM(de620_debug, "i");
+module_param(bnc, int, 0);
+module_param(utp, int, 0);
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(clone, int, 0);
+module_param(de620_debug, int, 0);
MODULE_PARM_DESC(bnc, "DE-620 set BNC medium (0-1)");
MODULE_PARM_DESC(utp, "DE-620 set UTP medium (0-1)");
MODULE_PARM_DESC(io, "DE-620 I/O base address,required");
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index 28109cb70b799..ec6d9d096163f 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -463,11 +463,11 @@ struct depca_private {
} depca_bus; /* type of bus */
struct depca_init init_block; /* Shadow Initialization block */
/* CPU address space fields */
- struct depca_rx_desc *rx_ring; /* Pointer to start of RX descriptor ring */
- struct depca_tx_desc *tx_ring; /* Pointer to start of TX descriptor ring */
- void *rx_buff[NUM_RX_DESC]; /* CPU virt address of sh'd memory buffs */
- void *tx_buff[NUM_TX_DESC]; /* CPU virt address of sh'd memory buffs */
- void *sh_mem; /* CPU mapped virt address of device RAM */
+ struct depca_rx_desc __iomem *rx_ring; /* Pointer to start of RX descriptor ring */
+ struct depca_tx_desc __iomem *tx_ring; /* Pointer to start of TX descriptor ring */
+ void __iomem *rx_buff[NUM_RX_DESC]; /* CPU virt address of sh'd memory buffs */
+ void __iomem *tx_buff[NUM_TX_DESC]; /* CPU virt address of sh'd memory buffs */
+ void __iomem *sh_mem; /* CPU mapped virt address of device RAM */
u_long mem_start; /* Bus address of device RAM (before remap) */
u_long mem_len; /* device memory size */
/* Device address space fields */
@@ -693,11 +693,11 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
/* Tx & Rx descriptors (aligned to a quadword boundary) */
offset = (offset + DEPCA_ALIGN) & ~DEPCA_ALIGN;
- lp->rx_ring = (struct depca_rx_desc *) (lp->sh_mem + offset);
+ lp->rx_ring = (struct depca_rx_desc __iomem *) (lp->sh_mem + offset);
lp->rx_ring_offset = offset;
offset += (sizeof(struct depca_rx_desc) * NUM_RX_DESC);
- lp->tx_ring = (struct depca_tx_desc *) (lp->sh_mem + offset);
+ lp->tx_ring = (struct depca_tx_desc __iomem *) (lp->sh_mem + offset);
lp->tx_ring_offset = offset;
offset += (sizeof(struct depca_tx_desc) * NUM_TX_DESC);
@@ -1649,7 +1649,7 @@ static int __devexit depca_device_remove (struct device *device)
static int __init DepcaSignature(char *name, u_long base_addr)
{
u_int i, j, k;
- void *ptr;
+ void __iomem *ptr;
char tmpstr[16];
u_long prom_addr = base_addr + 0xc000;
u_long mem_addr = base_addr + 0x8000; /* 32KB */
@@ -1876,17 +1876,17 @@ static void depca_dbg_open(struct net_device *dev)
printk("Descriptor addresses (CPU):\nRX: ");
for (i = 0; i < lp->rxRingMask; i++) {
if (i < 3) {
- printk("0x%8.8lx ", (long) &lp->rx_ring[i].base);
+ printk("%p ", &lp->rx_ring[i].base);
}
}
- printk("...0x%8.8lx\n", (long) &lp->rx_ring[i].base);
+ printk("...%p\n", &lp->rx_ring[i].base);
printk("TX: ");
for (i = 0; i < lp->txRingMask; i++) {
if (i < 3) {
- printk("0x%8.8lx ", (long) &lp->tx_ring[i].base);
+ printk("%p ", &lp->tx_ring[i].base);
}
}
- printk("...0x%8.8lx\n", (long) &lp->tx_ring[i].base);
+ printk("...%p\n", &lp->tx_ring[i].base);
printk("\nDescriptor buffers (Device):\nRX: ");
for (i = 0; i < lp->rxRingMask; i++) {
if (i < 3) {
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c
index 779af1727eef9..91d32f77486e1 100644
--- a/drivers/net/dgrs.c
+++ b/drivers/net/dgrs.c
@@ -1534,14 +1534,14 @@ static int iptrap[4] = { -1 };
static __u32 ipxnet = -1;
static int nicmode = -1;
-MODULE_PARM(debug, "i");
-MODULE_PARM(dma, "i");
-MODULE_PARM(hashexpire, "i");
-MODULE_PARM(spantree, "i");
-MODULE_PARM(ipaddr, "1-4i");
-MODULE_PARM(iptrap, "1-4i");
-MODULE_PARM(ipxnet, "i");
-MODULE_PARM(nicmode, "i");
+module_param(debug, int, 0);
+module_param(dma, int, 0);
+module_param(hashexpire, int, 0);
+module_param(spantree, int, 0);
+module_param_array(ipaddr, int, NULL, 0);
+module_param_array(iptrap, int, NULL, 0);
+module_param(ipxnet, int, 0);
+module_param(nicmode, int, 0);
MODULE_PARM_DESC(debug, "Digi RightSwitch enable debugging (0-1)");
MODULE_PARM_DESC(dma, "Digi RightSwitch enable BM DMA (0-1)");
MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi-NIC)");
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 575896cb9354f..0c6c4ade0e743 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -72,16 +72,16 @@ static int tx_coalesce=16; /* HW xmit count each TxDMAComplete */
MODULE_AUTHOR ("Edward Peng");
MODULE_DESCRIPTION ("D-Link DL2000-based Gigabit Ethernet Adapter");
MODULE_LICENSE("GPL");
-MODULE_PARM (mtu, "1-" __MODULE_STRING (MAX_UNITS) "i");
-MODULE_PARM (media, "1-" __MODULE_STRING (MAX_UNITS) "s");
-MODULE_PARM (vlan, "1-" __MODULE_STRING (MAX_UNITS) "i");
-MODULE_PARM (jumbo, "1-" __MODULE_STRING (MAX_UNITS) "i");
-MODULE_PARM (tx_flow, "i");
-MODULE_PARM (rx_flow, "i");
-MODULE_PARM (copy_thresh, "i");
-MODULE_PARM (rx_coalesce, "i"); /* Rx frame count each interrupt */
-MODULE_PARM (rx_timeout, "i"); /* Rx DMA wait time in 64ns increments */
-MODULE_PARM (tx_coalesce, "i"); /* HW xmit count each TxDMAComplete */
+module_param_array(mtu, int, NULL, 0);
+module_param_array(media, charp, NULL, 0);
+module_param_array(vlan, int, NULL, 0);
+module_param_array(jumbo, int, NULL, 0);
+module_param(tx_flow, int, 0);
+module_param(rx_flow, int, 0);
+module_param(copy_thresh, int, 0);
+module_param(rx_coalesce, int, 0); /* Rx frame count each interrupt */
+module_param(rx_timeout, int, 0); /* Rx DMA wait time in 64ns increments */
+module_param(tx_coalesce, int, 0); /* HW xmit count each TxDMAComplete */
/* Enable the default interrupts */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 17eecc72d791e..d9574c63900a8 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -155,7 +155,7 @@
#define DRV_NAME "e100"
#define DRV_EXT "-NAPI"
-#define DRV_VERSION "3.2.3-k2"DRV_EXT
+#define DRV_VERSION "3.3.6-k2"DRV_EXT
#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
#define DRV_COPYRIGHT "Copyright(c) 1999-2004 Intel Corporation"
#define PFX DRV_NAME ": "
@@ -201,6 +201,7 @@ static struct pci_device_id e100_id_table[] = {
INTEL_8255X_ETHERNET_DEVICE(0x1055, 5),
INTEL_8255X_ETHERNET_DEVICE(0x1056, 5),
INTEL_8255X_ETHERNET_DEVICE(0x1057, 5),
+ INTEL_8255X_ETHERNET_DEVICE(0x1059, 0),
INTEL_8255X_ETHERNET_DEVICE(0x1064, 6),
INTEL_8255X_ETHERNET_DEVICE(0x1065, 6),
INTEL_8255X_ETHERNET_DEVICE(0x1066, 6),
@@ -209,7 +210,6 @@ static struct pci_device_id e100_id_table[] = {
INTEL_8255X_ETHERNET_DEVICE(0x1069, 6),
INTEL_8255X_ETHERNET_DEVICE(0x106A, 6),
INTEL_8255X_ETHERNET_DEVICE(0x106B, 6),
- INTEL_8255X_ETHERNET_DEVICE(0x1059, 0),
INTEL_8255X_ETHERNET_DEVICE(0x1209, 0),
INTEL_8255X_ETHERNET_DEVICE(0x1229, 0),
INTEL_8255X_ETHERNET_DEVICE(0x2449, 2),
@@ -621,8 +621,7 @@ static int e100_self_test(struct nic *nic)
writel(selftest | dma_addr, &nic->csr->port);
e100_write_flush(nic);
/* Wait 10 msec for self-test to complete */
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ / 100 + 1);
+ msleep(10);
/* Interrupts are enabled after self-test */
e100_disable_irq(nic);
@@ -670,8 +669,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data)
e100_write_flush(nic); udelay(4);
}
/* Wait 10 msec for cmd to complete */
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ / 100 + 1);
+ msleep(10);
/* Chip deselect */
writeb(0, &nic->csr->eeprom_ctrl_lo);
@@ -1760,8 +1758,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
memset(skb->data, 0xFF, ETH_DATA_LEN);
e100_xmit_frame(skb, nic->netdev);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ / 100 + 1);
+ msleep(10);
if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd),
skb->data, ETH_DATA_LEN))
@@ -1847,8 +1844,7 @@ static void e100_get_regs(struct net_device *netdev,
mdio_read(netdev, nic->mii.phy_id, i);
memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf));
e100_exec_cb(nic, NULL, e100_dump);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(HZ / 100 + 1);
+ msleep(10);
memcpy(&buff[2 + E100_PHY_REGS], nic->mem->dump_buf,
sizeof(nic->mem->dump_buf));
}
@@ -2027,8 +2023,7 @@ static int e100_phys_id(struct net_device *netdev, u32 data)
if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
mod_timer(&nic->blink_timer, jiffies);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(data * HZ);
+ msleep_interruptible(data * 1000);
del_timer_sync(&nic->blink_timer);
mdio_write(netdev, nic->mii.phy_id, MII_LED_CONTROL, 0);
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index cc50e4d5d4632..9b40cf1c2c9c8 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -776,7 +776,7 @@ static int
e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
{
struct net_device *netdev = adapter->netdev;
- uint32_t icr, mask, i=0, shared_int = TRUE;
+ uint32_t mask, i=0, shared_int = TRUE;
uint32_t irq = adapter->pdev->irq;
*data = 0;
@@ -784,7 +784,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
/* Hook up test interrupt handler just for this test */
if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
shared_int = FALSE;
- } else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ, netdev->name, netdev)){
+ } else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ,
+ netdev->name, netdev)){
*data = 1;
return -1;
}
@@ -793,21 +794,6 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF);
msec_delay(10);
- /* Interrupts are disabled, so read interrupt cause
- * register (icr) twice to verify that there are no interrupts
- * pending. icr is clear on read.
- */
- icr = E1000_READ_REG(&adapter->hw, ICR);
- icr = E1000_READ_REG(&adapter->hw, ICR);
-
- if(icr != 0) {
- /* if icr is non-zero, there is no point
- * running other interrupt tests.
- */
- *data = 2;
- i = 10;
- }
-
/* Test each interrupt */
for(; i < 10; i++) {
@@ -856,8 +842,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
* test failed.
*/
adapter->test_icr = 0;
- E1000_WRITE_REG(&adapter->hw, IMC, ~mask);
- E1000_WRITE_REG(&adapter->hw, ICS, ~mask);
+ E1000_WRITE_REG(&adapter->hw, IMC,
+ (~mask & 0x00007FFF));
+ E1000_WRITE_REG(&adapter->hw, ICS,
+ (~mask & 0x00007FFF));
msec_delay(10);
if(adapter->test_icr) {
@@ -1336,10 +1324,17 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
msec_delay(200);
- pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[0].dma,
- rxdr->buffer_info[0].length, PCI_DMA_FROMDEVICE);
+ i = 0;
+ do {
+ pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[i].dma,
+ rxdr->buffer_info[i].length,
+ PCI_DMA_FROMDEVICE);
+
+ if (!e1000_check_lbtest_frame(rxdr->buffer_info[i++].skb, 1024))
+ return 0;
+ } while (i < 64);
- return e1000_check_lbtest_frame(rxdr->buffer_info[0].skb, 1024);
+ return 13;
}
static int
@@ -1358,10 +1353,27 @@ static int
e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
{
*data = 0;
- e1000_check_for_link(&adapter->hw);
- if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) {
- *data = 1;
+ if (adapter->hw.media_type == e1000_media_type_internal_serdes) {
+ int i = 0;
+ adapter->hw.serdes_link_down = TRUE;
+
+ /* on some blade server designs link establishment */
+ /* could take as long as 2-3 minutes. */
+ do {
+ e1000_check_for_link(&adapter->hw);
+ if (adapter->hw.serdes_link_down == FALSE)
+ return *data;
+ msec_delay(20);
+ } while (i++ < 3750);
+
+ *data = 1;
+ } else {
+ e1000_check_for_link(&adapter->hw);
+
+ if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) {
+ *data = 1;
+ }
}
return *data;
}
@@ -1490,6 +1502,8 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case E1000_DEV_ID_82543GC_COPPER:
case E1000_DEV_ID_82544EI_FIBER:
case E1000_DEV_ID_82546EB_QUAD_COPPER:
+ case E1000_DEV_ID_82545EM_FIBER:
+ case E1000_DEV_ID_82545EM_COPPER:
return wol->wolopts ? -EOPNOTSUPP : 0;
case E1000_DEV_ID_82546EB_FIBER:
@@ -1554,9 +1568,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
e1000_setup_led(&adapter->hw);
mod_timer(&adapter->blink_timer, jiffies);
- set_current_state(TASK_INTERRUPTIBLE);
-
- schedule_timeout(data * HZ);
+ msleep_interruptible(data * 1000);
del_timer_sync(&adapter->blink_timer);
e1000_led_off(&adapter->hw);
clear_bit(E1000_LED_ON, &adapter->led_status);
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 0c7d458fdfe63..f140e2c7eab0e 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -123,16 +123,31 @@ e1000_set_phy_type(struct e1000_hw *hw)
static void
e1000_phy_init_script(struct e1000_hw *hw)
{
+ uint32_t ret_val;
+ uint16_t phy_saved_data;
+
DEBUGFUNC("e1000_phy_init_script");
+
if(hw->phy_init_script) {
msec_delay(20);
+ /* Save off the current value of register 0x2F5B to be restored at
+ * the end of this routine. */
+ ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
+
+ /* Disabled the PHY transmitter */
+ e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
+
+ msec_delay(20);
+
e1000_write_phy_reg(hw,0x0000,0x0140);
msec_delay(5);
- if(hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547) {
+ switch(hw->mac_type) {
+ case e1000_82541:
+ case e1000_82547:
e1000_write_phy_reg(hw, 0x1F95, 0x0001);
e1000_write_phy_reg(hw, 0x1F71, 0xBD21);
@@ -150,12 +165,23 @@ e1000_phy_init_script(struct e1000_hw *hw)
e1000_write_phy_reg(hw, 0x1F96, 0x003F);
e1000_write_phy_reg(hw, 0x2010, 0x0008);
- } else {
+ break;
+
+ case e1000_82541_rev_2:
+ case e1000_82547_rev_2:
e1000_write_phy_reg(hw, 0x1F73, 0x0099);
+ break;
+ default:
+ break;
}
e1000_write_phy_reg(hw, 0x0000, 0x3300);
+ msec_delay(20);
+
+ /* Now enable the transmitter */
+ e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
+
if(hw->mac_type == e1000_82547) {
uint16_t fused, fine, coarse;
@@ -244,6 +270,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
case E1000_DEV_ID_82546GB_COPPER:
case E1000_DEV_ID_82546GB_FIBER:
case E1000_DEV_ID_82546GB_SERDES:
+ case E1000_DEV_ID_82546GB_PCIE:
hw->mac_type = e1000_82546_rev_3;
break;
case E1000_DEV_ID_82541EI:
@@ -967,7 +994,7 @@ e1000_setup_copper_link(struct e1000_hw *hw)
if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
hw->dsp_config_state = e1000_dsp_config_disabled;
- /* Force MDI for IGP B-0 PHY */
+ /* Force MDI for earlier revs of the IGP PHY */
phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX |
IGP01E1000_PSCR_FORCE_MDI_MDIX);
hw->mdix = 1;
@@ -2111,7 +2138,7 @@ e1000_check_for_link(struct e1000_hw *hw)
* at gigabit speed, then TBI compatibility is not needed. If we are
* at gigabit speed, we turn on TBI compatibility.
*/
- if(hw->tbi_compatibility_en) {
+ if(hw->tbi_compatibility_en) {
uint16_t speed, duplex;
e1000_get_speed_and_duplex(hw, &speed, &duplex);
if(speed != SPEED_1000) {
@@ -2466,12 +2493,14 @@ e1000_read_phy_reg(struct e1000_hw *hw,
DEBUGFUNC("e1000_read_phy_reg");
+
if(hw->phy_type == e1000_phy_igp &&
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
(uint16_t)reg_addr);
- if(ret_val)
+ if(ret_val) {
return ret_val;
+ }
}
ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,
@@ -2570,12 +2599,14 @@ e1000_write_phy_reg(struct e1000_hw *hw,
DEBUGFUNC("e1000_write_phy_reg");
+
if(hw->phy_type == e1000_phy_igp &&
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
(uint16_t)reg_addr);
- if(ret_val)
+ if(ret_val) {
return ret_val;
+ }
}
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,
@@ -3478,7 +3509,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
- if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) ||
+ if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
(words == 0)) {
DEBUGOUT("\"words\" parameter out of bounds\n");
return -E1000_ERR_EEPROM;
@@ -3626,7 +3657,7 @@ e1000_write_eeprom(struct e1000_hw *hw,
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
- if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) ||
+ if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) ||
(words == 0)) {
DEBUGOUT("\"words\" parameter out of bounds\n");
return -E1000_ERR_EEPROM;
@@ -4918,7 +4949,7 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
boolean_t link_up)
{
int32_t ret_val;
- uint16_t phy_data, speed, duplex, i;
+ uint16_t phy_data, phy_saved_data, speed, duplex, i;
uint16_t dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] =
{IGP01E1000_PHY_AGC_PARAM_A,
IGP01E1000_PHY_AGC_PARAM_B,
@@ -4999,6 +5030,21 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
}
} else {
if(hw->dsp_config_state == e1000_dsp_config_activated) {
+ /* Save off the current value of register 0x2F5B to be restored at
+ * the end of the routines. */
+ ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
+
+ if(ret_val)
+ return ret_val;
+
+ /* Disable the PHY transmitter */
+ ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
+
+ if(ret_val)
+ return ret_val;
+
+ msec_delay(20);
+
ret_val = e1000_write_phy_reg(hw, 0x0000,
IGP01E1000_IEEE_FORCE_GIGA);
if(ret_val)
@@ -5021,10 +5067,33 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
if(ret_val)
return ret_val;
+ msec_delay(20);
+
+ /* Now enable the transmitter */
+ ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
+
+ if(ret_val)
+ return ret_val;
+
hw->dsp_config_state = e1000_dsp_config_enabled;
}
if(hw->ffe_config_state == e1000_ffe_config_active) {
+ /* Save off the current value of register 0x2F5B to be restored at
+ * the end of the routines. */
+ ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
+
+ if(ret_val)
+ return ret_val;
+
+ /* Disable the PHY transmitter */
+ ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
+
+ if(ret_val)
+ return ret_val;
+
+ msec_delay(20);
+
ret_val = e1000_write_phy_reg(hw, 0x0000,
IGP01E1000_IEEE_FORCE_GIGA);
if(ret_val)
@@ -5038,6 +5107,15 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
IGP01E1000_IEEE_RESTART_AUTONEG);
if(ret_val)
return ret_val;
+
+ msec_delay(20);
+
+ /* Now enable the transmitter */
+ ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);
+
+ if(ret_val)
+ return ret_val;
+
hw->ffe_config_state = e1000_ffe_config_enabled;
}
}
@@ -5126,14 +5204,29 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw,
* Dx states where the power conservation is most important. During
* driver activity we should enable SmartSpeed, so performance is
* maintained. */
- ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data);
- if(ret_val)
- return ret_val;
+ if (hw->smart_speed == e1000_smart_speed_on) {
+ ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ &phy_data);
+ if(ret_val)
+ return ret_val;
- phy_data |= IGP01E1000_PSCFR_SMART_SPEED;
- ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data);
- if(ret_val)
- return ret_val;
+ phy_data |= IGP01E1000_PSCFR_SMART_SPEED;
+ ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ phy_data);
+ if(ret_val)
+ return ret_val;
+ } else if (hw->smart_speed == e1000_smart_speed_off) {
+ ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ &phy_data);
+ if (ret_val)
+ return ret_val;
+
+ phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
+ ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ phy_data);
+ if(ret_val)
+ return ret_val;
+ }
} else if((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) ||
(hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) ||
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index b1054cf14980a..756727eb434ab 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -168,6 +168,12 @@ typedef enum {
} e1000_downshift;
typedef enum {
+ e1000_smart_speed_default = 0,
+ e1000_smart_speed_on,
+ e1000_smart_speed_off
+} e1000_smart_speed;
+
+typedef enum {
e1000_polarity_reversal_enabled = 0,
e1000_polarity_reversal_disabled,
e1000_polarity_reversal_undefined = 0xFF
@@ -361,6 +367,7 @@ int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
#define E1000_DEV_ID_82546GB_COPPER 0x1079
#define E1000_DEV_ID_82546GB_FIBER 0x107A
#define E1000_DEV_ID_82546GB_SERDES 0x107B
+#define E1000_DEV_ID_82546GB_PCIE 0x108A
#define E1000_DEV_ID_82547EI 0x1019
#define NODE_ADDRESS_SIZE 6
#define ETH_LENGTH_OF_ADDRESS 6
@@ -1026,6 +1033,7 @@ struct e1000_hw {
uint8_t perm_mac_addr[NODE_ADDRESS_SIZE];
boolean_t disable_polarity_correction;
boolean_t speed_downgraded;
+ e1000_smart_speed smart_speed;
e1000_dsp_config dsp_config_state;
boolean_t get_link_status;
boolean_t serdes_link_down;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 92ecad3117ba5..216a5b6eb76a3 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -35,10 +35,19 @@
* - More errlogging support from Jon Mason <jonmason@us.ibm.com>
* - Fix TSO issues on PPC64 machines -- Jon Mason <jonmason@us.ibm.com>
*
- * 5.3.11 6/4/04
- * - ethtool register dump reads MANC register conditionally.
- *
- * 5.3.10 6/1/04
+ * 5.6.5 11/01/04
+ * - Enabling NETIF_F_SG without checksum offload is illegal -
+ John Mason <jdmason@us.ibm.com>
+ * 5.6.3 10/26/04
+ * - Remove redundant initialization - Jamal Hadi
+ * - Reset buffer_info->dma in tx resource cleanup logic
+ * 5.6.2 10/12/04
+ * - Avoid filling tx_ring completely - shemminger@osdl.org
+ * - Replace schedule_timeout() with msleep()/msleep_interruptible() -
+ * nacc@us.ibm.com
+ * - Sparse cleanup - shemminger@osdl.org
+ * - Fix tx resource cleanup logic
+ * - LLTX support - ak@suse.de and hadi@cyberus.ca
*/
char e1000_driver_name[] = "e1000";
@@ -48,7 +57,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
#else
#define DRIVERNAPI "-NAPI"
#endif
-char e1000_driver_version[] = "5.5.4-k2"DRIVERNAPI;
+char e1000_driver_version[] = "5.6.10.1-k2"DRIVERNAPI;
char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table
@@ -90,6 +99,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
INTEL_E1000_ETHERNET_DEVICE(0x107A),
INTEL_E1000_ETHERNET_DEVICE(0x107B),
INTEL_E1000_ETHERNET_DEVICE(0x107C),
+ INTEL_E1000_ETHERNET_DEVICE(0x108A),
/* required last entry */
{0,}
};
@@ -128,8 +138,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
static struct net_device_stats * e1000_get_stats(struct net_device *netdev);
static int e1000_change_mtu(struct net_device *netdev, int new_mtu);
static int e1000_set_mac(struct net_device *netdev, void *p);
-static void e1000_irq_disable(struct e1000_adapter *adapter);
-static void e1000_irq_enable(struct e1000_adapter *adapter);
static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs);
static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter);
#ifdef CONFIG_E1000_NAPI
@@ -146,9 +154,6 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
void set_ethtool_ops(struct net_device *netdev);
static void e1000_enter_82542_rst(struct e1000_adapter *adapter);
static void e1000_leave_82542_rst(struct e1000_adapter *adapter);
-static void e1000_rx_checksum(struct e1000_adapter *adapter,
- struct e1000_rx_desc *rx_desc,
- struct sk_buff *skb);
static void e1000_tx_timeout(struct net_device *dev);
static void e1000_tx_timeout_task(struct net_device *dev);
static void e1000_smartspeed(struct e1000_adapter *adapter);
@@ -242,6 +247,33 @@ e1000_exit_module(void)
module_exit(e1000_exit_module);
+/**
+ * e1000_irq_disable - Mask off interrupt generation on the NIC
+ * @adapter: board private structure
+ **/
+
+static inline void
+e1000_irq_disable(struct e1000_adapter *adapter)
+{
+ atomic_inc(&adapter->irq_sem);
+ E1000_WRITE_REG(&adapter->hw, IMC, ~0);
+ E1000_WRITE_FLUSH(&adapter->hw);
+ synchronize_irq(adapter->pdev->irq);
+}
+
+/**
+ * e1000_irq_enable - Enable default interrupt generation settings
+ * @adapter: board private structure
+ **/
+
+static inline void
+e1000_irq_enable(struct e1000_adapter *adapter)
+{
+ if(likely(atomic_dec_and_test(&adapter->irq_sem))) {
+ E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
+ E1000_WRITE_FLUSH(&adapter->hw);
+ }
+}
int
e1000_up(struct e1000_adapter *adapter)
@@ -475,8 +507,6 @@ e1000_probe(struct pci_dev *pdev,
NETIF_F_HW_VLAN_TX |
NETIF_F_HW_VLAN_RX |
NETIF_F_HW_VLAN_FILTER;
- } else {
- netdev->features = NETIF_F_SG;
}
#ifdef NETIF_F_TSO
@@ -1061,6 +1091,24 @@ e1000_free_tx_resources(struct e1000_adapter *adapter)
adapter->tx_ring.desc = NULL;
}
+static inline void
+e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter,
+ struct e1000_buffer *buffer_info)
+{
+ struct pci_dev *pdev = adapter->pdev;
+ if(buffer_info->dma) {
+ pci_unmap_page(pdev,
+ buffer_info->dma,
+ buffer_info->length,
+ PCI_DMA_TODEVICE);
+ buffer_info->dma = 0;
+ }
+ if(buffer_info->skb) {
+ dev_kfree_skb_any(buffer_info->skb);
+ buffer_info->skb = NULL;
+ }
+}
+
/**
* e1000_clean_tx_ring - Free Tx Buffers
* @adapter: board private structure
@@ -1071,7 +1119,6 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter)
{
struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
struct e1000_buffer *buffer_info;
- struct pci_dev *pdev = adapter->pdev;
unsigned long size;
unsigned int i;
@@ -1079,17 +1126,7 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter)
for(i = 0; i < tx_ring->count; i++) {
buffer_info = &tx_ring->buffer_info[i];
- if(buffer_info->skb) {
-
- pci_unmap_page(pdev,
- buffer_info->dma,
- buffer_info->length,
- PCI_DMA_TODEVICE);
-
- dev_kfree_skb(buffer_info->skb);
-
- buffer_info->skb = NULL;
- }
+ e1000_unmap_and_free_tx_resource(adapter, buffer_info);
}
size = sizeof(struct e1000_buffer) * tx_ring->count;
@@ -1762,7 +1799,6 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
unsigned int mss = 0;
int count = 0;
unsigned int f;
- nr_frags = skb_shinfo(skb)->nr_frags;
len -= skb->data_len;
if(unlikely(skb->len <= 0)) {
@@ -1811,7 +1847,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
/* need: count + 2 desc gap to keep tail from touching
* head, otherwise try next time */
- if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
+ if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2)) {
netif_stop_queue(netdev);
spin_unlock_irqrestore(&adapter->tx_lock, flags);
return NETDEV_TX_BUSY;
@@ -1844,6 +1880,10 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
netdev->trans_start = jiffies;
+ /* Make sure there is space in the ring for the next send. */
+ if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < MAX_SKB_FRAGS + 2))
+ netif_stop_queue(netdev);
+
spin_unlock_irqrestore(&adapter->tx_lock, flags);
return NETDEV_TX_OK;
}
@@ -1904,9 +1944,9 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
- (max_frame > MAX_JUMBO_FRAME_SIZE)) {
- DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
- return -EINVAL;
+ (max_frame > MAX_JUMBO_FRAME_SIZE)) {
+ DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
+ return -EINVAL;
}
if(max_frame <= MAXIMUM_ETHERNET_FRAME_SIZE) {
@@ -2074,34 +2114,6 @@ e1000_update_stats(struct e1000_adapter *adapter)
}
/**
- * e1000_irq_disable - Mask off interrupt generation on the NIC
- * @adapter: board private structure
- **/
-
-static void
-e1000_irq_disable(struct e1000_adapter *adapter)
-{
- atomic_inc(&adapter->irq_sem);
- E1000_WRITE_REG(&adapter->hw, IMC, ~0);
- E1000_WRITE_FLUSH(&adapter->hw);
- synchronize_irq(adapter->pdev->irq);
-}
-
-/**
- * e1000_irq_enable - Enable default interrupt generation settings
- * @adapter: board private structure
- **/
-
-static void
-e1000_irq_enable(struct e1000_adapter *adapter)
-{
- if(likely(atomic_dec_and_test(&adapter->irq_sem))) {
- E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
- E1000_WRITE_FLUSH(&adapter->hw);
- }
-}
-
-/**
* e1000_intr - Interrupt Handler
* @irq: interrupt number
* @data: pointer to a network interface device structure
@@ -2162,6 +2174,9 @@ e1000_clean(struct net_device *netdev, int *budget)
int tx_cleaned;
int work_done = 0;
+ if (!netif_carrier_ok(netdev))
+ goto quit_polling;
+
tx_cleaned = e1000_clean_tx_irq(adapter);
e1000_clean_rx_irq(adapter, &work_done, work_to_do);
@@ -2171,7 +2186,7 @@ e1000_clean(struct net_device *netdev, int *budget)
/* if no Rx and Tx cleanup work was done, exit the polling mode */
if(!tx_cleaned || (work_done < work_to_do) ||
!netif_running(netdev)) {
- netif_rx_complete(netdev);
+quit_polling: netif_rx_complete(netdev);
e1000_irq_enable(adapter);
return 0;
}
@@ -2190,7 +2205,6 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
{
struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
struct net_device *netdev = adapter->netdev;
- struct pci_dev *pdev = adapter->pdev;
struct e1000_tx_desc *tx_desc, *eop_desc;
struct e1000_buffer *buffer_info;
unsigned int i, eop;
@@ -2205,19 +2219,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
tx_desc = E1000_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
- if(likely(buffer_info->dma)) {
- pci_unmap_page(pdev,
- buffer_info->dma,
- buffer_info->length,
- PCI_DMA_TODEVICE);
- buffer_info->dma = 0;
- }
-
- if(buffer_info->skb) {
- dev_kfree_skb_any(buffer_info->skb);
- buffer_info->skb = NULL;
- }
-
+ e1000_unmap_and_free_tx_resource(adapter, buffer_info);
tx_desc->buffer_addr = 0;
tx_desc->lower.data = 0;
tx_desc->upper.data = 0;
@@ -2244,6 +2246,41 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
}
/**
+ * e1000_rx_checksum - Receive Checksum Offload for 82543
+ * @adapter: board private structure
+ * @rx_desc: receive descriptor
+ * @sk_buff: socket buffer with received data
+ **/
+
+static inline void
+e1000_rx_checksum(struct e1000_adapter *adapter,
+ struct e1000_rx_desc *rx_desc,
+ struct sk_buff *skb)
+{
+ /* 82543 or newer only */
+ if(unlikely((adapter->hw.mac_type < e1000_82543) ||
+ /* Ignore Checksum bit is set */
+ (rx_desc->status & E1000_RXD_STAT_IXSM) ||
+ /* TCP Checksum has not been calculated */
+ (!(rx_desc->status & E1000_RXD_STAT_TCPCS)))) {
+ skb->ip_summed = CHECKSUM_NONE;
+ return;
+ }
+
+ /* At this point we know the hardware did the TCP checksum */
+ /* now look at the TCP checksum error bit */
+ if(rx_desc->errors & E1000_RXD_ERR_TCPE) {
+ /* let the stack verify checksum errors */
+ skb->ip_summed = CHECKSUM_NONE;
+ adapter->hw_csum_err++;
+ } else {
+ /* TCP checksum is good */
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ adapter->hw_csum_good++;
+ }
+}
+
+/**
* e1000_clean_rx_irq - Send received data up the network stack
* @adapter: board private structure
**/
@@ -2291,7 +2328,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) {
/* All receives must fit into a single buffer */
E1000_DBG("%s: Receive packet consumed multiple"
- " buffers\n", netdev->name);
+ " buffers\n", netdev->name);
dev_kfree_skb_irq(skb);
goto next_desc;
}
@@ -2376,8 +2413,8 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
buffer_info = &rx_ring->buffer_info[i];
while(!buffer_info->skb) {
-
skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN);
+
if(unlikely(!skb)) {
/* Better luck next round */
break;
@@ -2587,41 +2624,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
return E1000_SUCCESS;
}
-/**
- * e1000_rx_checksum - Receive Checksum Offload for 82543
- * @adapter: board private structure
- * @rx_desc: receive descriptor
- * @sk_buff: socket buffer with received data
- **/
-
-static void
-e1000_rx_checksum(struct e1000_adapter *adapter,
- struct e1000_rx_desc *rx_desc,
- struct sk_buff *skb)
-{
- /* 82543 or newer only */
- if(unlikely((adapter->hw.mac_type < e1000_82543) ||
- /* Ignore Checksum bit is set */
- (rx_desc->status & E1000_RXD_STAT_IXSM) ||
- /* TCP Checksum has not been calculated */
- (!(rx_desc->status & E1000_RXD_STAT_TCPCS)))) {
- skb->ip_summed = CHECKSUM_NONE;
- return;
- }
-
- /* At this point we know the hardware did the TCP checksum */
- /* now look at the TCP checksum error bit */
- if(rx_desc->errors & E1000_RXD_ERR_TCPE) {
- /* let the stack verify checksum errors */
- skb->ip_summed = CHECKSUM_NONE;
- adapter->hw_csum_err++;
- } else {
- /* TCP checksum is good */
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- adapter->hw_csum_good++;
- }
-}
-
void
e1000_pci_set_mwi(struct e1000_hw *hw)
{
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index 630beaf27e09c..970c656a517c1 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -42,13 +42,8 @@
#include <linux/sched.h>
#ifndef msec_delay
-#define msec_delay(x) do { if(in_interrupt()) { \
- /* Don't mdelay in interrupt context! */ \
- BUG(); \
- } else { \
- set_current_state(TASK_UNINTERRUPTIBLE); \
- schedule_timeout((x * HZ)/1000 + 2); \
- } } while(0)
+#define msec_delay(x) msleep(x)
+
/* Some workarounds require millisecond delays and are run during interrupt
* context. Most notably, when establishing link, the phy may need tweaking
* but cannot process phy register reads/writes faster than millisecond
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index 038d55958d940..e914d09fe6f93 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -47,7 +47,7 @@
#define E1000_PARAM(X, desc) \
static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static int num_##X = 0; \
- module_param_array(X, int, &num_##X, 0); \
+ module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
@@ -470,9 +470,6 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd];
switch(adapter->itr) {
- case -1:
- adapter->itr = 1;
- break;
case 0:
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
@@ -481,13 +478,14 @@ e1000_check_options(struct e1000_adapter *adapter)
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
opt.name);
break;
+ case -1:
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
break;
}
} else {
- adapter->itr = 1;
+ adapter->itr = opt.def;
}
}
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c
index 7fc98601c483c..51c9fa2608306 100644
--- a/drivers/net/e2100.c
+++ b/drivers/net/e2100.c
@@ -72,7 +72,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0};
#define E21_SAPROM 0x10 /* Offset to station address data. */
#define E21_IO_EXTENT 0x20
-static inline void mem_on(short port, volatile char *mem_base,
+static inline void mem_on(short port, volatile char __iomem *mem_base,
unsigned char start_page )
{
/* This is a little weird: set the shared memory window by doing a
@@ -143,6 +143,7 @@ static int __init do_e2100_probe(struct net_device *dev)
static void cleanup_card(struct net_device *dev)
{
/* NB: e21_close() handles free_irq */
+ iounmap(ei_status.mem);
release_region(dev->base_addr, E21_IO_EXTENT);
}
@@ -257,6 +258,13 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
if (dev->mem_start == 0)
dev->mem_start = 0xd0000;
+ ei_status.mem = ioremap(dev->mem_start, 2*1024);
+ if (!ei_status.mem) {
+ printk("unable to remap memory\n");
+ retval = -EAGAIN;
+ goto out;
+ }
+
#ifdef notdef
/* These values are unused. The E2100 has a 2K window into the packet
buffer. The window can be set to start on any page boundary. */
@@ -329,7 +337,7 @@ e21_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_pag
{
short ioaddr = dev->base_addr;
- char *shared_mem = (char *)dev->mem_start;
+ char __iomem *shared_mem = ei_status.mem;
mem_on(ioaddr, shared_mem, ring_page);
@@ -352,12 +360,12 @@ static void
e21_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
{
short ioaddr = dev->base_addr;
- char *shared_mem = (char *)dev->mem_start;
+ char __iomem *shared_mem = ei_status.mem;
mem_on(ioaddr, shared_mem, (ring_offset>>8));
/* Packet is always in one chunk -- we can copy + cksum. */
- eth_io_copy_and_sum(skb, dev->mem_start + (ring_offset & 0xff), count, 0);
+ eth_io_copy_and_sum(skb, ei_status.mem + (ring_offset & 0xff), count, 0);
mem_off(ioaddr);
}
@@ -367,7 +375,7 @@ e21_block_output(struct net_device *dev, int count, const unsigned char *buf,
int start_page)
{
short ioaddr = dev->base_addr;
- volatile char *shared_mem = (char *)dev->mem_start;
+ volatile char __iomem *shared_mem = ei_status.mem;
/* Set the shared memory window start by doing a read, with the low address
bits specifying the starting page. */
@@ -413,10 +421,10 @@ static int irq[MAX_E21_CARDS];
static int mem[MAX_E21_CARDS];
static int xcvr[MAX_E21_CARDS]; /* choose int. or ext. xcvr */
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_E21_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_E21_CARDS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_E21_CARDS) "i");
-MODULE_PARM(xcvr, "1-" __MODULE_STRING(MAX_E21_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
+module_param_array(xcvr, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(mem, " memory base address(es)");
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 0199073aaee60..ce26ac9d32121 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -114,11 +114,7 @@ static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
#include <linux/skbuff.h>
#include <linux/ethtool.h>
-/* enable PIO instead of MMIO, if CONFIG_EEPRO100_PIO is selected */
-#ifdef CONFIG_EEPRO100_PIO
-#define USE_IO 1
-#endif
-
+static int use_io;
static int debug = -1;
#define DEBUG_DEFAULT (NETIF_MSG_DRV | \
NETIF_MSG_HW | \
@@ -130,17 +126,18 @@ static int debug = -1;
MODULE_AUTHOR("Maintainer: Andrey V. Savochkin <saw@saw.sw.com.sg>");
MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(congenb, "i");
-MODULE_PARM(txfifo, "i");
-MODULE_PARM(rxfifo, "i");
-MODULE_PARM(txdmacount, "i");
-MODULE_PARM(rxdmacount, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(multicast_filter_limit, "i");
+module_param(use_io, int, 0);
+module_param(debug, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param(congenb, int, 0);
+module_param(txfifo, int, 0);
+module_param(rxfifo, int, 0);
+module_param(txdmacount, int, 0);
+module_param(rxdmacount, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param(max_interrupt_work, int, 0);
+module_param(multicast_filter_limit, int, 0);
MODULE_PARM_DESC(debug, "debug level (0-6)");
MODULE_PARM_DESC(options, "Bits 0-3: transceiver type, bit 4: full duplex, bit 5: 100Mbps");
MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)");
@@ -289,39 +286,13 @@ having to sign an Intel NDA when I'm helping Intel sell their own product!
*/
-static int speedo_found1(struct pci_dev *pdev, long ioaddr, int fnd_cnt, int acpi_idle_state);
+static int speedo_found1(struct pci_dev *pdev, void __iomem *ioaddr, int fnd_cnt, int acpi_idle_state);
enum pci_flags_bit {
PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
};
-static inline unsigned int io_inw(unsigned long port)
-{
- return inw(port);
-}
-static inline void io_outw(unsigned int val, unsigned long port)
-{
- outw(val, port);
-}
-
-#ifndef USE_IO
-/* Currently alpha headers define in/out macros.
- Undefine them. 2000/03/30 SAW */
-#undef inb
-#undef inw
-#undef inl
-#undef outb
-#undef outw
-#undef outl
-#define inb readb
-#define inw readw
-#define inl readl
-#define outb writeb
-#define outw writew
-#define outl writel
-#endif
-
/* Offsets to the various registers.
All accesses need not be longword aligned. */
enum speedo_offsets {
@@ -453,6 +424,7 @@ enum Rx_ring_state_bits {
Unfortunately, all the positions have been shifted since there.
A new re-alignment is required. 2000/03/06 SAW */
struct speedo_private {
+ void __iomem *regs;
struct TxFD *tx_ring; /* Commands (usually CmdTxPacket). */
struct RxFD *rx_ringp[RX_RING_SIZE]; /* Rx descriptor, used as ring. */
/* The addresses of a Tx/Rx-in-place packets/buffers. */
@@ -520,7 +492,7 @@ static const char is_mii[] = { 0, 1, 1, 0, 1, 1, 0, 1 };
static int eepro100_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent);
-static int do_eeprom_cmd(long ioaddr, int cmd, int cmd_len);
+static int do_eeprom_cmd(void __iomem *ioaddr, int cmd, int cmd_len);
static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int speedo_open(struct net_device *dev);
@@ -551,15 +523,16 @@ static int mii_ctrl[8] = { 0x3300, 0x3100, 0x0000, 0x0100,
/* How to wait for the command unit to accept a command.
Typically this takes 0 ticks. */
-static inline unsigned char wait_for_cmd_done(struct net_device *dev)
+static inline unsigned char wait_for_cmd_done(struct net_device *dev,
+ struct speedo_private *sp)
{
int wait = 1000;
- long cmd_ioaddr = dev->base_addr + SCBCmd;
+ void __iomem *cmd_ioaddr = sp->regs + SCBCmd;
unsigned char r;
do {
udelay(1);
- r = inb(cmd_ioaddr);
+ r = ioread8(cmd_ioaddr);
} while(r && --wait >= 0);
if (wait < 0)
@@ -570,10 +543,11 @@ static inline unsigned char wait_for_cmd_done(struct net_device *dev)
static int __devinit eepro100_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
- unsigned long ioaddr;
- int irq;
+ void __iomem *ioaddr;
+ int irq, pci_bar;
int acpi_idle_state = 0, pm;
static int cards_found /* = 0 */;
+ unsigned long pci_base;
#ifndef MODULE
/* when built-in, we only print version if device is found */
@@ -607,24 +581,17 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
}
irq = pdev->irq;
-#ifdef USE_IO
- ioaddr = pci_resource_start(pdev, 1);
+ pci_bar = use_io ? 1 : 0;
+ pci_base = pci_resource_start(pdev, pci_bar);
if (DEBUG & NETIF_MSG_PROBE)
- printk("Found Intel i82557 PCI Speedo at I/O %#lx, IRQ %d.\n",
- ioaddr, irq);
-#else
- ioaddr = (unsigned long)ioremap(pci_resource_start(pdev, 0),
- pci_resource_len(pdev, 0));
+ printk("Found Intel i82557 PCI Speedo at %#lx, IRQ %d.\n",
+ pci_base, irq);
+
+ ioaddr = pci_iomap(pdev, pci_bar, 0);
if (!ioaddr) {
- printk (KERN_ERR "eepro100: cannot remap MMIO region %lx @ %lx\n",
- pci_resource_len(pdev, 0), pci_resource_start(pdev, 0));
+ printk (KERN_ERR "eepro100: cannot remap IO\n");
goto err_out_free_mmio_region;
}
- if (DEBUG & NETIF_MSG_PROBE)
- printk("Found Intel i82557 PCI Speedo, MMIO at %#lx, IRQ %d.\n",
- pci_resource_start(pdev, 0), irq);
-#endif
-
if (speedo_found1(pdev, ioaddr, cards_found, acpi_idle_state) == 0)
cards_found++;
@@ -634,9 +601,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
return 0;
err_out_iounmap: ;
-#ifndef USE_IO
- iounmap ((void *)ioaddr);
-#endif
+ pci_iounmap(pdev, ioaddr);
err_out_free_mmio_region:
release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
err_out_free_pio_region:
@@ -663,7 +628,7 @@ static void poll_speedo (struct net_device *dev)
#endif
static int __devinit speedo_found1(struct pci_dev *pdev,
- long ioaddr, int card_idx, int acpi_idle_state)
+ void __iomem *ioaddr, int card_idx, int acpi_idle_state)
{
struct net_device *dev;
struct speedo_private *sp;
@@ -706,14 +671,16 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
The size test is for 6 bit vs. 8 bit address serial EEPROMs.
*/
{
- unsigned long iobase;
+ void __iomem *iobase;
int read_cmd, ee_size;
u16 sum;
int j;
/* Use IO only to avoid postponed writes and satisfy EEPROM timing
requirements. */
- iobase = pci_resource_start(pdev, 1);
+ iobase = pci_iomap(pdev, 1, pci_resource_len(pdev, 1));
+ if (!iobase)
+ goto err_free_unlock;
if ((do_eeprom_cmd(iobase, EE_READ_CMD << 24, 27) & 0xffe0000)
== 0xffe0000) {
ee_size = 0x100;
@@ -739,13 +706,15 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
/* Don't unregister_netdev(dev); as the EEPro may actually be
usable, especially if the MAC address is set later.
On the other hand, it may be unusable if MDI data is corrupted. */
+
+ pci_iounmap(pdev, iobase);
}
/* Reset the chip: stop Tx and Rx processes and clear counters.
This takes less than 10usec and will easily finish before the next
action. */
- outl(PortReset, ioaddr + SCBPort);
- inl(ioaddr + SCBPort);
+ iowrite32(PortReset, ioaddr + SCBPort);
+ ioread32(ioaddr + SCBPort);
udelay(10);
if (eeprom[3] & 0x0100)
@@ -758,13 +727,12 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
for (i = 0; i < 5; i++)
printk("%2.2X:", dev->dev_addr[i]);
printk("%2.2X, ", dev->dev_addr[i]);
-#ifdef USE_IO
- printk("I/O at %#3lx, ", ioaddr);
-#endif
printk("IRQ %d.\n", pdev->irq);
- /* we must initialize base_addr early, for mdio_{read,write} */
- dev->base_addr = ioaddr;
+ sp = netdev_priv(dev);
+
+ /* we must initialize this early, for mdio_{read,write} */
+ sp->regs = ioaddr;
#if 1 || defined(kernel_bloat)
/* OK, this is pure kernel bloat. I don't like it when other drivers
@@ -811,7 +779,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
self_test_results = (s32*) ((((long) tx_ring_space) + 15) & ~0xf);
self_test_results[0] = 0;
self_test_results[1] = -1;
- outl(tx_ring_dma | PortSelfTest, ioaddr + SCBPort);
+ iowrite32(tx_ring_dma | PortSelfTest, ioaddr + SCBPort);
do {
udelay(10);
} while (self_test_results[1] == -1 && --boguscnt >= 0);
@@ -835,8 +803,8 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
}
#endif /* kernel_bloat */
- outl(PortReset, ioaddr + SCBPort);
- inl(ioaddr + SCBPort);
+ iowrite32(PortReset, ioaddr + SCBPort);
+ ioread32(ioaddr + SCBPort);
udelay(10);
/* Return the chip to its original power state. */
@@ -847,7 +815,6 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
dev->irq = pdev->irq;
- sp = netdev_priv(dev);
sp->pdev = pdev;
sp->msg_enable = DEBUG;
sp->acpi_pwr = acpi_idle_state;
@@ -910,27 +877,27 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
return -1;
}
-static void do_slow_command(struct net_device *dev, int cmd)
+static void do_slow_command(struct net_device *dev, struct speedo_private *sp, int cmd)
{
- long cmd_ioaddr = dev->base_addr + SCBCmd;
+ void __iomem *cmd_ioaddr = sp->regs + SCBCmd;
int wait = 0;
do
- if (inb(cmd_ioaddr) == 0) break;
+ if (ioread8(cmd_ioaddr) == 0) break;
while(++wait <= 200);
if (wait > 100)
printk(KERN_ERR "Command %4.4x never accepted (%d polls)!\n",
- inb(cmd_ioaddr), wait);
+ ioread8(cmd_ioaddr), wait);
- outb(cmd, cmd_ioaddr);
+ iowrite8(cmd, cmd_ioaddr);
for (wait = 0; wait <= 100; wait++)
- if (inb(cmd_ioaddr) == 0) return;
+ if (ioread8(cmd_ioaddr) == 0) return;
for (; wait <= 20000; wait++)
- if (inb(cmd_ioaddr) == 0) return;
+ if (ioread8(cmd_ioaddr) == 0) return;
else udelay(1);
printk(KERN_ERR "Command %4.4x was not accepted after %d polls!"
" Current status %8.8x.\n",
- cmd, wait, inl(dev->base_addr + SCBStatus));
+ cmd, wait, ioread32(sp->regs + SCBStatus));
}
/* Serial EEPROM section.
@@ -952,35 +919,36 @@ static void do_slow_command(struct net_device *dev, int cmd)
interval for serial EEPROM. However, it looks like that there is an
additional requirement dictating larger udelay's in the code below.
2000/05/24 SAW */
-static int __devinit do_eeprom_cmd(long ioaddr, int cmd, int cmd_len)
+static int __devinit do_eeprom_cmd(void __iomem *ioaddr, int cmd, int cmd_len)
{
unsigned retval = 0;
- long ee_addr = ioaddr + SCBeeprom;
+ void __iomem *ee_addr = ioaddr + SCBeeprom;
- io_outw(EE_ENB, ee_addr); udelay(2);
- io_outw(EE_ENB | EE_SHIFT_CLK, ee_addr); udelay(2);
+ iowrite16(EE_ENB, ee_addr); udelay(2);
+ iowrite16(EE_ENB | EE_SHIFT_CLK, ee_addr); udelay(2);
/* Shift the command bits out. */
do {
short dataval = (cmd & (1 << cmd_len)) ? EE_WRITE_1 : EE_WRITE_0;
- io_outw(dataval, ee_addr); udelay(2);
- io_outw(dataval | EE_SHIFT_CLK, ee_addr); udelay(2);
- retval = (retval << 1) | ((io_inw(ee_addr) & EE_DATA_READ) ? 1 : 0);
+ iowrite16(dataval, ee_addr); udelay(2);
+ iowrite16(dataval | EE_SHIFT_CLK, ee_addr); udelay(2);
+ retval = (retval << 1) | ((ioread16(ee_addr) & EE_DATA_READ) ? 1 : 0);
} while (--cmd_len >= 0);
- io_outw(EE_ENB, ee_addr); udelay(2);
+ iowrite16(EE_ENB, ee_addr); udelay(2);
/* Terminate the EEPROM access. */
- io_outw(EE_ENB & ~EE_CS, ee_addr);
+ iowrite16(EE_ENB & ~EE_CS, ee_addr);
return retval;
}
static int mdio_read(struct net_device *dev, int phy_id, int location)
{
- long ioaddr = dev->base_addr;
+ struct speedo_private *sp = netdev_priv(dev);
+ void __iomem *ioaddr = sp->regs;
int val, boguscnt = 64*10; /* <64 usec. to complete, typ 27 ticks */
- outl(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI);
+ iowrite32(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI);
do {
- val = inl(ioaddr + SCBCtrlMDI);
+ val = ioread32(ioaddr + SCBCtrlMDI);
if (--boguscnt < 0) {
printk(KERN_ERR " mdio_read() timed out with val = %8.8x.\n", val);
break;
@@ -991,12 +959,13 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
{
- long ioaddr = dev->base_addr;
+ struct speedo_private *sp = netdev_priv(dev);
+ void __iomem *ioaddr = sp->regs;
int val, boguscnt = 64*10; /* <64 usec. to complete, typ 27 ticks */
- outl(0x04000000 | (location<<16) | (phy_id<<21) | value,
+ iowrite32(0x04000000 | (location<<16) | (phy_id<<21) | value,
ioaddr + SCBCtrlMDI);
do {
- val = inl(ioaddr + SCBCtrlMDI);
+ val = ioread32(ioaddr + SCBCtrlMDI);
if (--boguscnt < 0) {
printk(KERN_ERR" mdio_write() timed out with val = %8.8x.\n", val);
break;
@@ -1008,7 +977,7 @@ static int
speedo_open(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
int retval;
if (netif_msg_ifup(sp))
@@ -1052,7 +1021,7 @@ speedo_open(struct net_device *dev)
speedo_init_rx_ring(dev);
/* Fire up the hardware. */
- outw(SCBMaskAll, ioaddr + SCBCmd);
+ iowrite16(SCBMaskAll, ioaddr + SCBCmd);
speedo_resume(dev);
netdevice_start(dev);
@@ -1071,7 +1040,7 @@ speedo_open(struct net_device *dev)
if (netif_msg_ifup(sp)) {
printk(KERN_DEBUG "%s: Done speedo_open(), status %8.8x.\n",
- dev->name, inw(ioaddr + SCBStatus));
+ dev->name, ioread16(ioaddr + SCBStatus));
}
/* Set the timer. The timer serves a dual purpose:
@@ -1095,46 +1064,46 @@ speedo_open(struct net_device *dev)
static void speedo_resume(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
/* Start with a Tx threshold of 256 (0x..20.... 8 byte units). */
sp->tx_threshold = 0x01208000;
/* Set the segment registers to '0'. */
- if (wait_for_cmd_done(dev) != 0) {
- outl(PortPartialReset, ioaddr + SCBPort);
+ if (wait_for_cmd_done(dev, sp) != 0) {
+ iowrite32(PortPartialReset, ioaddr + SCBPort);
udelay(10);
}
- outl(0, ioaddr + SCBPointer);
- inl(ioaddr + SCBPointer); /* Flush to PCI. */
+ iowrite32(0, ioaddr + SCBPointer);
+ ioread32(ioaddr + SCBPointer); /* Flush to PCI. */
udelay(10); /* Bogus, but it avoids the bug. */
/* Note: these next two operations can take a while. */
- do_slow_command(dev, RxAddrLoad);
- do_slow_command(dev, CUCmdBase);
+ do_slow_command(dev, sp, RxAddrLoad);
+ do_slow_command(dev, sp, CUCmdBase);
/* Load the statistics block and rx ring addresses. */
- outl(sp->lstats_dma, ioaddr + SCBPointer);
- inl(ioaddr + SCBPointer); /* Flush to PCI */
+ iowrite32(sp->lstats_dma, ioaddr + SCBPointer);
+ ioread32(ioaddr + SCBPointer); /* Flush to PCI */
- outb(CUStatsAddr, ioaddr + SCBCmd);
+ iowrite8(CUStatsAddr, ioaddr + SCBCmd);
sp->lstats->done_marker = 0;
- wait_for_cmd_done(dev);
+ wait_for_cmd_done(dev, sp);
if (sp->rx_ringp[sp->cur_rx % RX_RING_SIZE] == NULL) {
if (netif_msg_rx_err(sp))
printk(KERN_DEBUG "%s: NULL cur_rx in speedo_resume().\n",
dev->name);
} else {
- outl(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE],
+ iowrite32(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE],
ioaddr + SCBPointer);
- inl(ioaddr + SCBPointer); /* Flush to PCI */
+ ioread32(ioaddr + SCBPointer); /* Flush to PCI */
}
/* Note: RxStart should complete instantly. */
- do_slow_command(dev, RxStart);
- do_slow_command(dev, CUDumpStats);
+ do_slow_command(dev, sp, RxStart);
+ do_slow_command(dev, sp, CUDumpStats);
/* Fill the first command with our physical address. */
{
@@ -1153,11 +1122,11 @@ static void speedo_resume(struct net_device *dev)
}
/* Start the chip's Tx process and unmask interrupts. */
- outl(TX_RING_ELEM_DMA(sp, sp->dirty_tx % TX_RING_SIZE),
+ iowrite32(TX_RING_ELEM_DMA(sp, sp->dirty_tx % TX_RING_SIZE),
ioaddr + SCBPointer);
/* We are not ACK-ing FCP and ER in the interrupt handler yet so they should
remain masked --Dragan */
- outw(CUStart | SCBMaskEarlyRx | SCBMaskFlowCtl, ioaddr + SCBCmd);
+ iowrite16(CUStart | SCBMaskEarlyRx | SCBMaskFlowCtl, ioaddr + SCBCmd);
}
/*
@@ -1176,29 +1145,29 @@ speedo_rx_soft_reset(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
struct RxFD *rfd;
- long ioaddr;
+ void __iomem *ioaddr;
- ioaddr = dev->base_addr;
- if (wait_for_cmd_done(dev) != 0) {
+ ioaddr = sp->regs;
+ if (wait_for_cmd_done(dev, sp) != 0) {
printk("%s: previous command stalled\n", dev->name);
return;
}
/*
* Put the hardware into a known state.
*/
- outb(RxAbort, ioaddr + SCBCmd);
+ iowrite8(RxAbort, ioaddr + SCBCmd);
rfd = sp->rx_ringp[sp->cur_rx % RX_RING_SIZE];
rfd->rx_buf_addr = 0xffffffff;
- if (wait_for_cmd_done(dev) != 0) {
+ if (wait_for_cmd_done(dev, sp) != 0) {
printk("%s: RxAbort command stalled\n", dev->name);
return;
}
- outl(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE],
+ iowrite32(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE],
ioaddr + SCBPointer);
- outb(RxStart, ioaddr + SCBCmd);
+ iowrite8(RxStart, ioaddr + SCBCmd);
}
@@ -1207,7 +1176,7 @@ static void speedo_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
int phy_num = sp->phy[0] & 0x1f;
/* We have MII and lost link beat. */
@@ -1230,7 +1199,7 @@ static void speedo_timer(unsigned long data)
mii_check_link(&sp->mii_if);
if (netif_msg_timer(sp)) {
printk(KERN_DEBUG "%s: Media control tick, status %4.4x.\n",
- dev->name, inw(ioaddr + SCBStatus));
+ dev->name, ioread16(ioaddr + SCBStatus));
}
if (sp->rx_mode < 0 ||
(sp->rx_bug && jiffies - sp->last_rx_time > 2*HZ)) {
@@ -1277,7 +1246,7 @@ static void speedo_show_state(struct net_device *dev)
#if 0
{
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
int phy_num = sp->phy[0] & 0x1f;
for (i = 0; i < 16; i++) {
/* FIXME: what does it mean? --SAW */
@@ -1398,14 +1367,14 @@ static void reset_mii(struct net_device *dev)
static void speedo_tx_timeout(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
- int status = inw(ioaddr + SCBStatus);
+ void __iomem *ioaddr = sp->regs;
+ int status = ioread16(ioaddr + SCBStatus);
unsigned long flags;
if (netif_msg_tx_err(sp)) {
printk(KERN_WARNING "%s: Transmit timed out: status %4.4x "
" %4.4x at %d/%d command %8.8x.\n",
- dev->name, status, inw(ioaddr + SCBCmd),
+ dev->name, status, ioread16(ioaddr + SCBCmd),
sp->dirty_tx, sp->cur_tx,
sp->tx_ring[sp->dirty_tx % TX_RING_SIZE].status);
@@ -1417,9 +1386,9 @@ static void speedo_tx_timeout(struct net_device *dev)
/* Only the command unit has stopped. */
printk(KERN_WARNING "%s: Trying to restart the transmitter...\n",
dev->name);
- outl(TX_RING_ELEM_DMA(sp, dirty_tx % TX_RING_SIZE]),
+ iowrite32(TX_RING_ELEM_DMA(sp, dirty_tx % TX_RING_SIZE]),
ioaddr + SCBPointer);
- outw(CUStart, ioaddr + SCBCmd);
+ iowrite16(CUStart, ioaddr + SCBCmd);
reset_mii(dev);
} else {
#else
@@ -1427,12 +1396,12 @@ static void speedo_tx_timeout(struct net_device *dev)
#endif
del_timer_sync(&sp->timer);
/* Reset the Tx and Rx units. */
- outl(PortReset, ioaddr + SCBPort);
+ iowrite32(PortReset, ioaddr + SCBPort);
/* We may get spurious interrupts here. But I don't think that they
may do much harm. 1999/12/09 SAW */
udelay(10);
/* Disable interrupts. */
- outw(SCBMaskAll, ioaddr + SCBCmd);
+ iowrite16(SCBMaskAll, ioaddr + SCBCmd);
synchronize_irq(dev->irq);
speedo_tx_buffer_gc(dev);
/* Free as much as possible.
@@ -1460,7 +1429,7 @@ static int
speedo_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
int entry;
/* Prevent interrupts from changing the Tx ring from underneath us. */
@@ -1499,18 +1468,18 @@ speedo_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* workaround for hardware bug on 10 mbit half duplex */
if ((sp->partner == 0) && (sp->chip_id == 1)) {
- wait_for_cmd_done(dev);
- outb(0 , ioaddr + SCBCmd);
+ wait_for_cmd_done(dev, sp);
+ iowrite8(0 , ioaddr + SCBCmd);
udelay(1);
}
/* Trigger the command unit resume. */
- wait_for_cmd_done(dev);
+ wait_for_cmd_done(dev, sp);
clear_suspend(sp->last_cmd);
/* We want the time window between clearing suspend flag on the previous
command and resuming CU to be as small as possible.
Interrupts in between are very undesired. --SAW */
- outb(CUResume, ioaddr + SCBCmd);
+ iowrite8(CUResume, ioaddr + SCBCmd);
sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry];
/* Leave room for set_rx_mode(). If there is no more space than reserved
@@ -1592,12 +1561,13 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs
{
struct net_device *dev = (struct net_device *)dev_instance;
struct speedo_private *sp;
- long ioaddr, boguscnt = max_interrupt_work;
+ void __iomem *ioaddr;
+ long boguscnt = max_interrupt_work;
unsigned short status;
unsigned int handled = 0;
- ioaddr = dev->base_addr;
sp = netdev_priv(dev);
+ ioaddr = sp->regs;
#ifndef final_version
/* A lock to prevent simultaneous entry on SMP machines. */
@@ -1610,11 +1580,11 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs
#endif
do {
- status = inw(ioaddr + SCBStatus);
+ status = ioread16(ioaddr + SCBStatus);
/* Acknowledge all of the current interrupt sources ASAP. */
/* Will change from 0xfc00 to 0xff00 when we start handling
FCP and ER interrupts --Dragan */
- outw(status & 0xfc00, ioaddr + SCBStatus);
+ iowrite16(status & 0xfc00, ioaddr + SCBStatus);
if (netif_msg_intr(sp))
printk(KERN_DEBUG "%s: interrupt status=%#4.4x.\n",
@@ -1674,14 +1644,14 @@ static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs
/* Clear all interrupt sources. */
/* Will change from 0xfc00 to 0xff00 when we start handling
FCP and ER interrupts --Dragan */
- outw(0xfc00, ioaddr + SCBStatus);
+ iowrite16(0xfc00, ioaddr + SCBStatus);
break;
}
} while (1);
if (netif_msg_intr(sp))
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
- dev->name, inw(ioaddr + SCBStatus));
+ dev->name, ioread16(ioaddr + SCBStatus));
clear_bit(0, (void*)&sp->in_interrupt);
return IRQ_RETVAL(handled);
@@ -1900,8 +1870,8 @@ speedo_rx(struct net_device *dev)
static int
speedo_close(struct net_device *dev)
{
- long ioaddr = dev->base_addr;
struct speedo_private *sp = netdev_priv(dev);
+ void __iomem *ioaddr = sp->regs;
int i;
netdevice_stop(dev);
@@ -1909,16 +1879,16 @@ speedo_close(struct net_device *dev)
if (netif_msg_ifdown(sp))
printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x.\n",
- dev->name, inw(ioaddr + SCBStatus));
+ dev->name, ioread16(ioaddr + SCBStatus));
/* Shut off the media monitoring timer. */
del_timer_sync(&sp->timer);
- outw(SCBMaskAll, ioaddr + SCBCmd);
+ iowrite16(SCBMaskAll, ioaddr + SCBCmd);
/* Shutting down the chip nicely fails to disable flow control. So.. */
- outl(PortPartialReset, ioaddr + SCBPort);
- inl(ioaddr + SCBPort); /* flush posted write */
+ iowrite32(PortPartialReset, ioaddr + SCBPort);
+ ioread32(ioaddr + SCBPort); /* flush posted write */
/*
* The chip requires a 10 microsecond quiet period. Wait here!
*/
@@ -1980,7 +1950,7 @@ static struct net_device_stats *
speedo_get_stats(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
/* Update only if the previous dump finished. */
if (sp->lstats->done_marker == le32_to_cpu(0xA007)) {
@@ -2001,8 +1971,8 @@ speedo_get_stats(struct net_device *dev)
/* Take a spinlock to make wait_for_cmd_done and sending the
command atomic. --SAW */
spin_lock_irqsave(&sp->lock, flags);
- wait_for_cmd_done(dev);
- outb(CUDumpStats, ioaddr + SCBCmd);
+ wait_for_cmd_done(dev, sp);
+ iowrite8(CUDumpStats, ioaddr + SCBCmd);
spin_unlock_irqrestore(&sp->lock, flags);
}
}
@@ -2123,7 +2093,7 @@ static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static void set_rx_mode(struct net_device *dev)
{
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
struct descriptor *last_cmd;
char new_rx_mode;
unsigned long flags;
@@ -2178,9 +2148,9 @@ static void set_rx_mode(struct net_device *dev)
config_cmd_data[8] = 0;
}
/* Trigger the command unit resume. */
- wait_for_cmd_done(dev);
+ wait_for_cmd_done(dev, sp);
clear_suspend(last_cmd);
- outb(CUResume, ioaddr + SCBCmd);
+ iowrite8(CUResume, ioaddr + SCBCmd);
if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
netif_stop_queue(dev);
sp->tx_full = 1;
@@ -2215,10 +2185,10 @@ static void set_rx_mode(struct net_device *dev)
*setup_params++ = *eaddrs++;
}
- wait_for_cmd_done(dev);
+ wait_for_cmd_done(dev, sp);
clear_suspend(last_cmd);
/* Immediately trigger the command unit resume. */
- outb(CUResume, ioaddr + SCBCmd);
+ iowrite8(CUResume, ioaddr + SCBCmd);
if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
netif_stop_queue(dev);
@@ -2291,10 +2261,10 @@ static void set_rx_mode(struct net_device *dev)
pci_dma_sync_single_for_device(sp->pdev, mc_blk->frame_dma,
mc_blk->len, PCI_DMA_TODEVICE);
- wait_for_cmd_done(dev);
+ wait_for_cmd_done(dev, sp);
clear_suspend(last_cmd);
/* Immediately trigger the command unit resume. */
- outb(CUResume, ioaddr + SCBCmd);
+ iowrite8(CUResume, ioaddr + SCBCmd);
if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
netif_stop_queue(dev);
@@ -2315,7 +2285,7 @@ static int eepro100_suspend(struct pci_dev *pdev, u32 state)
{
struct net_device *dev = pci_get_drvdata (pdev);
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
pci_save_state(pdev);
@@ -2325,7 +2295,7 @@ static int eepro100_suspend(struct pci_dev *pdev, u32 state)
del_timer_sync(&sp->timer);
netif_device_detach(dev);
- outl(PortPartialReset, ioaddr + SCBPort);
+ iowrite32(PortPartialReset, ioaddr + SCBPort);
/* XXX call pci_set_power_state ()? */
pci_disable_device(pdev);
@@ -2337,7 +2307,7 @@ static int eepro100_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata (pdev);
struct speedo_private *sp = netdev_priv(dev);
- long ioaddr = dev->base_addr;
+ void __iomem *ioaddr = sp->regs;
pci_set_power_state(pdev, 0);
pci_restore_state(pdev);
@@ -2354,7 +2324,7 @@ static int eepro100_resume(struct pci_dev *pdev)
reinitialization;
- serialization with other driver calls.
2000/03/08 SAW */
- outw(SCBMaskAll, ioaddr + SCBCmd);
+ iowrite16(SCBMaskAll, ioaddr + SCBCmd);
speedo_resume(dev);
netif_device_attach(dev);
sp->rx_mode = -1;
@@ -2376,10 +2346,7 @@ static void __devexit eepro100_remove_one (struct pci_dev *pdev)
release_region(pci_resource_start(pdev, 1), pci_resource_len(pdev, 1));
release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
-#ifndef USE_IO
- iounmap((char *)dev->base_addr);
-#endif
-
+ pci_iounmap(pdev, sp->regs);
pci_free_consistent(pdev, TX_RING_SIZE * sizeof(struct TxFD)
+ sizeof(struct speedo_stats),
sp->tx_ring, sp->tx_ring_dma);
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index 8d0585f7841b3..335fde87fce7b 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -1691,8 +1691,8 @@ static struct net_device *dev_eexp[EEXP_MAX_CARDS];
static int irq[EEXP_MAX_CARDS];
static int io[EEXP_MAX_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(EEXP_MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(EEXP_MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(io, "EtherExpress 16 I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherExpress 16 IRQ number(s)");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 459013762bd8a..b283f1a7ce562 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -149,10 +149,10 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(debug, "EPIC/100 debug level (0-5)");
MODULE_PARM_DESC(options, "EPIC/100: Bits 0-3: media type, bit 4: full duplex");
MODULE_PARM_DESC(rx_copybreak, "EPIC/100 copy breakpoint for copy-only-tiny-frames");
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c
index 50d8aadbb2c7f..96866a42c00de 100644
--- a/drivers/net/es3210.c
+++ b/drivers/net/es3210.c
@@ -414,9 +414,9 @@ static int io[MAX_ES_CARDS];
static int irq[MAX_ES_CARDS];
static int mem[MAX_ES_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ES_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_ES_CARDS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_ES_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(mem, "memory base address(es)");
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index 39f6782707052..ccae6ba5f7c59 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -1420,18 +1420,18 @@ MODULE_DESCRIPTION("ICL EtherTeam 16i/32 driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ETH16I_CARDS) "i");
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "eth16i I/O base address(es)");
#if 0
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_ETH16I_CARDS) "i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "eth16i interrupt request number");
#endif
-MODULE_PARM(mediatype, "1-" __MODULE_STRING(MAX_ETH16I_CARDS) "s");
+module_param_array(mediatype, charp, NULL, 0);
MODULE_PARM_DESC(mediatype, "eth16i media type of interface(s) (bnc,tp,dix,auto,eprom)");
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "eth16i debug level (0-6)");
int init_module(void)
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 8f995141b5181..b208b0aa30341 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -202,7 +202,6 @@ static int ewrk3_debug = 1;
#define EWRK3_IOP_INC 0x20 /* I/O address increment */
#define EWRK3_TOTAL_SIZE 0x20 /* required I/O address length */
-/* If you change this, remember to also change MODULE_PARM array limits */
#ifndef MAX_NUM_EWRK3S
#define MAX_NUM_EWRK3S 21
#endif
@@ -1945,8 +1944,8 @@ static int ndevs;
static int io[MAX_NUM_EWRK3S+1] = { 0x300, 0, };
/* '21' below should really be 'MAX_NUM_EWRK3S' */
-MODULE_PARM(io, "0-21i");
-MODULE_PARM(irq, "0-21i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(io, "EtherWORKS 3 I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherWORKS 3 IRQ number(s)");
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index fddc5360fd1cf..bd4e571ba827d 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -125,13 +125,13 @@ KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "\n";
MODULE_AUTHOR("Myson or whoever");
MODULE_DESCRIPTION("Myson MTD-8xx 100/10M Ethernet PCI Adapter Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
+module_param(max_interrupt_work, int, 0);
//MODULE_PARM(min_pci_latency, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(multicast_filter_limit, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param(multicast_filter_limit, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(max_interrupt_work, "fealnx maximum events handled per interrupt");
MODULE_PARM_DESC(debug, "fealnx enable debugging (0-1)");
MODULE_PARM_DESC(rx_copybreak, "fealnx copy breakpoint for copy-only-tiny-frames");
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index cb40c184f3030..cda48c5d72a91 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -79,6 +79,8 @@
* 0.30: 25 Sep 2004: rx checksum support for nf 250 Gb. Add rx reset
* into nv_close, otherwise reenabling for wol can
* cause DMA to kfree'd memory.
+ * 0.31: 14 Nov 2004: ethtool support for getting/setting link
+ * capabilities.
*
* Known bugs:
* We suspect that on some hardware no TX done interrupts are generated.
@@ -90,7 +92,7 @@
* DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
* superfluous timer interrupts from the nic.
*/
-#define FORCEDETH_VERSION "0.30"
+#define FORCEDETH_VERSION "0.31"
#define DRV_NAME "forcedeth"
#include <linux/module.h>
@@ -210,6 +212,7 @@ enum {
#define NVREG_LINKSPEED_10 1000
#define NVREG_LINKSPEED_100 100
#define NVREG_LINKSPEED_1000 50
+#define NVREG_LINKSPEED_MASK (0xFFF)
NvRegUnknownSetupReg5 = 0x130,
#define NVREG_UNKSETUP5_BIT31 (1<<31)
NvRegUnknownSetupReg3 = 0x13c,
@@ -441,6 +444,8 @@ struct fe_priv {
int in_shutdown;
u32 linkspeed;
int duplex;
+ int autoneg;
+ int fixed_mode;
int phyaddr;
int wolenabled;
unsigned int phy_oui;
@@ -765,50 +770,6 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
return &np->stats;
}
-static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
-{
- struct fe_priv *np = get_nvpriv(dev);
- strcpy(info->driver, "forcedeth");
- strcpy(info->version, FORCEDETH_VERSION);
- strcpy(info->bus_info, pci_name(np->pci_dev));
-}
-
-static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
-{
- struct fe_priv *np = get_nvpriv(dev);
- wolinfo->supported = WAKE_MAGIC;
-
- spin_lock_irq(&np->lock);
- if (np->wolenabled)
- wolinfo->wolopts = WAKE_MAGIC;
- spin_unlock_irq(&np->lock);
-}
-
-static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
-{
- struct fe_priv *np = get_nvpriv(dev);
- u8 __iomem *base = get_hwbase(dev);
-
- spin_lock_irq(&np->lock);
- if (wolinfo->wolopts == 0) {
- writel(0, base + NvRegWakeUpFlags);
- np->wolenabled = 0;
- }
- if (wolinfo->wolopts & WAKE_MAGIC) {
- writel(NVREG_WAKEUPFLAGS_ENABLE, base + NvRegWakeUpFlags);
- np->wolenabled = 1;
- }
- spin_unlock_irq(&np->lock);
- return 0;
-}
-
-static struct ethtool_ops ops = {
- .get_drvinfo = nv_get_drvinfo,
- .get_link = ethtool_op_get_link,
- .get_wol = nv_get_wol,
- .set_wol = nv_set_wol,
-};
-
/*
* nv_alloc_rx: fill rx ring entries.
* Return 1 if the allocations for the skbs failed and the
@@ -1286,6 +1247,25 @@ static int nv_update_linkspeed(struct net_device *dev)
goto set_speed;
}
+ if (np->autoneg == 0) {
+ dprintk(KERN_DEBUG "%s: nv_update_linkspeed: autoneg off, PHY set to 0x%04x.\n",
+ dev->name, np->fixed_mode);
+ if (np->fixed_mode & LPA_100FULL) {
+ newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100;
+ newdup = 1;
+ } else if (np->fixed_mode & LPA_100HALF) {
+ newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_100;
+ newdup = 0;
+ } else if (np->fixed_mode & LPA_10FULL) {
+ newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
+ newdup = 1;
+ } else {
+ newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
+ newdup = 0;
+ }
+ retval = 1;
+ goto set_speed;
+ }
/* check auto negotiation is complete */
if (!(mii_status & BMSR_ANEGCOMPLETE)) {
/* still in autonegotiation - configure nic for 10 MBit HD and wait. */
@@ -1303,7 +1283,7 @@ static int nv_update_linkspeed(struct net_device *dev)
if ((control_1000 & ADVERTISE_1000FULL) &&
(status_1000 & LPA_1000FULL)) {
- dprintk(KERN_DEBUG "%s: nv_update_linkspeed: GBit ethernet detected.\n",
+ dprintk(KERN_DEBUG "%s: nv_update_linkspeed: GBit ethernet detected.\n",
dev->name);
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_1000;
newdup = 1;
@@ -1362,9 +1342,9 @@ set_speed:
phyreg &= ~(PHY_HALF|PHY_100|PHY_1000);
if (np->duplex == 0)
phyreg |= PHY_HALF;
- if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100)
+ if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_100)
phyreg |= PHY_100;
- else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000)
+ else if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000)
phyreg |= PHY_1000;
writel(phyreg, base + NvRegPhyInterface);
@@ -1500,6 +1480,227 @@ static void nv_do_nic_poll(unsigned long data)
enable_irq(dev->irq);
}
+static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+ struct fe_priv *np = get_nvpriv(dev);
+ strcpy(info->driver, "forcedeth");
+ strcpy(info->version, FORCEDETH_VERSION);
+ strcpy(info->bus_info, pci_name(np->pci_dev));
+}
+
+static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
+{
+ struct fe_priv *np = get_nvpriv(dev);
+ wolinfo->supported = WAKE_MAGIC;
+
+ spin_lock_irq(&np->lock);
+ if (np->wolenabled)
+ wolinfo->wolopts = WAKE_MAGIC;
+ spin_unlock_irq(&np->lock);
+}
+
+static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
+{
+ struct fe_priv *np = get_nvpriv(dev);
+ u8 __iomem *base = get_hwbase(dev);
+
+ spin_lock_irq(&np->lock);
+ if (wolinfo->wolopts == 0) {
+ writel(0, base + NvRegWakeUpFlags);
+ np->wolenabled = 0;
+ }
+ if (wolinfo->wolopts & WAKE_MAGIC) {
+ writel(NVREG_WAKEUPFLAGS_ENABLE, base + NvRegWakeUpFlags);
+ np->wolenabled = 1;
+ }
+ spin_unlock_irq(&np->lock);
+ return 0;
+}
+
+static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
+{
+ struct fe_priv *np = netdev_priv(dev);
+ int adv;
+
+ spin_lock_irq(&np->lock);
+ ecmd->port = PORT_MII;
+ if (!netif_running(dev)) {
+ /* We do not track link speed / duplex setting if the
+ * interface is disabled. Force a link check */
+ nv_update_linkspeed(dev);
+ }
+ switch(np->linkspeed & (NVREG_LINKSPEED_MASK)) {
+ case NVREG_LINKSPEED_10:
+ ecmd->speed = SPEED_10;
+ break;
+ case NVREG_LINKSPEED_100:
+ ecmd->speed = SPEED_100;
+ break;
+ case NVREG_LINKSPEED_1000:
+ ecmd->speed = SPEED_1000;
+ break;
+ }
+ ecmd->duplex = DUPLEX_HALF;
+ if (np->duplex)
+ ecmd->duplex = DUPLEX_FULL;
+
+ ecmd->autoneg = np->autoneg;
+
+ ecmd->advertising = ADVERTISED_MII;
+ if (np->autoneg) {
+ ecmd->advertising |= ADVERTISED_Autoneg;
+ adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
+ } else {
+ adv = np->fixed_mode;
+ }
+ if (adv & ADVERTISE_10HALF)
+ ecmd->advertising |= ADVERTISED_10baseT_Half;
+ if (adv & ADVERTISE_10FULL)
+ ecmd->advertising |= ADVERTISED_10baseT_Full;
+ if (adv & ADVERTISE_100HALF)
+ ecmd->advertising |= ADVERTISED_100baseT_Half;
+ if (adv & ADVERTISE_100FULL)
+ ecmd->advertising |= ADVERTISED_100baseT_Full;
+ if (np->autoneg && np->gigabit == PHY_GIGABIT) {
+ adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ);
+ if (adv & ADVERTISE_1000FULL)
+ ecmd->advertising |= ADVERTISED_1000baseT_Full;
+ }
+
+ ecmd->supported = (SUPPORTED_Autoneg |
+ SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
+ SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
+ SUPPORTED_MII);
+ if (np->gigabit == PHY_GIGABIT)
+ ecmd->supported |= SUPPORTED_1000baseT_Full;
+
+ ecmd->phy_address = np->phyaddr;
+ ecmd->transceiver = XCVR_EXTERNAL;
+
+ /* ignore maxtxpkt, maxrxpkt for now */
+ spin_unlock_irq(&np->lock);
+ return 0;
+}
+
+static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
+{
+ struct fe_priv *np = netdev_priv(dev);
+
+ if (ecmd->port != PORT_MII)
+ return -EINVAL;
+ if (ecmd->transceiver != XCVR_EXTERNAL)
+ return -EINVAL;
+ if (ecmd->phy_address != np->phyaddr) {
+ /* TODO: support switching between multiple phys. Should be
+ * trivial, but not enabled due to lack of test hardware. */
+ return -EINVAL;
+ }
+ if (ecmd->autoneg == AUTONEG_ENABLE) {
+ u32 mask;
+
+ mask = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
+ ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
+ if (np->gigabit == PHY_GIGABIT)
+ mask |= ADVERTISED_1000baseT_Full;
+
+ if ((ecmd->advertising & mask) == 0)
+ return -EINVAL;
+
+ } else if (ecmd->autoneg == AUTONEG_DISABLE) {
+ /* Note: autonegotiation disable, speed 1000 intentionally
+ * forbidden - noone should need that. */
+
+ if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
+ return -EINVAL;
+ if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
+ return -EINVAL;
+ } else {
+ return -EINVAL;
+ }
+
+ spin_lock_irq(&np->lock);
+ if (ecmd->autoneg == AUTONEG_ENABLE) {
+ int adv, bmcr;
+
+ np->autoneg = 1;
+
+ /* advertise only what has been requested */
+ adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
+ adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
+ if (ecmd->advertising & ADVERTISED_10baseT_Half)
+ adv |= ADVERTISE_10HALF;
+ if (ecmd->advertising & ADVERTISED_10baseT_Full)
+ adv |= ADVERTISE_10FULL;
+ if (ecmd->advertising & ADVERTISED_100baseT_Half)
+ adv |= ADVERTISE_100HALF;
+ if (ecmd->advertising & ADVERTISED_100baseT_Full)
+ adv |= ADVERTISE_100FULL;
+ mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv);
+
+ if (np->gigabit == PHY_GIGABIT) {
+ adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ);
+ adv &= ~ADVERTISE_1000FULL;
+ if (ecmd->advertising & ADVERTISED_1000baseT_Full)
+ adv |= ADVERTISE_1000FULL;
+ mii_rw(dev, np->phyaddr, MII_1000BT_CR, adv);
+ }
+
+ bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
+ bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
+ mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
+
+ } else {
+ int adv, bmcr;
+
+ np->autoneg = 0;
+
+ adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
+ adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
+ if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF)
+ adv |= ADVERTISE_10HALF;
+ if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_FULL)
+ adv |= ADVERTISE_10FULL;
+ if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_HALF)
+ adv |= ADVERTISE_100HALF;
+ if (ecmd->speed == SPEED_100 && ecmd->duplex == DUPLEX_FULL)
+ adv |= ADVERTISE_100FULL;
+ mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv);
+ np->fixed_mode = adv;
+
+ if (np->gigabit == PHY_GIGABIT) {
+ adv = mii_rw(dev, np->phyaddr, MII_1000BT_CR, MII_READ);
+ adv &= ~ADVERTISE_1000FULL;
+ mii_rw(dev, np->phyaddr, MII_1000BT_CR, adv);
+ }
+
+ bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
+ bmcr |= ~(BMCR_ANENABLE|BMCR_SPEED100|BMCR_FULLDPLX);
+ if (adv & (ADVERTISE_10FULL|ADVERTISE_100FULL))
+ bmcr |= BMCR_FULLDPLX;
+ if (adv & (ADVERTISE_100HALF|ADVERTISE_100FULL))
+ bmcr |= BMCR_SPEED100;
+ mii_rw(dev, np->phyaddr, MII_BMCR, bmcr);
+
+ if (netif_running(dev)) {
+ /* Wait a bit and then reconfigure the nic. */
+ udelay(10);
+ nv_linkchange(dev);
+ }
+ }
+ spin_unlock_irq(&np->lock);
+
+ return 0;
+}
+
+static struct ethtool_ops ops = {
+ .get_drvinfo = nv_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_wol = nv_get_wol,
+ .set_wol = nv_set_wol,
+ .get_settings = nv_get_settings,
+ .set_settings = nv_set_settings,
+};
+
static int nv_open(struct net_device *dev)
{
struct fe_priv *np = get_nvpriv(dev);
@@ -1550,9 +1751,6 @@ static int nv_open(struct net_device *dev)
base + NvRegRingSizes);
/* 5) continue setup */
- np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
- np->duplex = 0;
-
writel(np->linkspeed, base + NvRegLinkSpeed);
writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3);
writel(np->desc_ver, base + NvRegTxRxControl);
@@ -1866,6 +2064,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
phy_init(dev);
}
+ /* set default link speed settings */
+ np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
+ np->duplex = 0;
+ np->autoneg = 1;
+
err = register_netdev(dev);
if (err) {
printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err);
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 9b885efadf002..d10d20821e7ec 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -518,21 +518,21 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>, Eric Kasten <kasten@nscl.msu.ed
MODULE_DESCRIPTION("Packet Engines 'Hamachi' GNIC-II Gigabit Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(mtu, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(min_rx_pkt, "i");
-MODULE_PARM(max_rx_gap, "i");
-MODULE_PARM(max_rx_latency, "i");
-MODULE_PARM(min_tx_pkt, "i");
-MODULE_PARM(max_tx_gap, "i");
-MODULE_PARM(max_tx_latency, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(rx_params, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(tx_params, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(force32, "i");
+module_param(max_interrupt_work, int, 0);
+module_param(mtu, int, 0);
+module_param(debug, int, 0);
+module_param(min_rx_pkt, int, 0);
+module_param(max_rx_gap, int, 0);
+module_param(max_rx_latency, int, 0);
+module_param(min_tx_pkt, int, 0);
+module_param(max_tx_gap, int, 0);
+module_param(max_tx_latency, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param_array(rx_params, int, NULL, 0);
+module_param_array(tx_params, int, NULL, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param(force32, int, 0);
MODULE_PARM_DESC(max_interrupt_work, "GNIC-II maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "GNIC-II MTU (all boards)");
MODULE_PARM_DESC(debug, "GNIC-II debug level (0-7)");
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index b3f64f722cc7a..274d15cc4688e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -1294,9 +1294,9 @@ static void baycom_probe(struct net_device *dev)
static const char *mode[NR_PORTS] = { "", };
static int iobase[NR_PORTS] = { 0x378, };
-MODULE_PARM(mode, "1-" __MODULE_STRING(NR_PORTS) "s");
+module_param_array(mode, charp, NULL, 0);
MODULE_PARM_DESC(mode, "baycom operating mode");
-MODULE_PARM(iobase, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(iobase, int, NULL, 0);
MODULE_PARM_DESC(iobase, "baycom io base address");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index 77f29fdde8efc..eb9a680092b20 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -480,9 +480,9 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr,
static const char *mode[NR_PORTS] = { "picpar", };
static int iobase[NR_PORTS] = { 0x378, };
-MODULE_PARM(mode, "1-" __MODULE_STRING(NR_PORTS) "s");
+module_param_array(mode, charp, NULL, 0);
MODULE_PARM_DESC(mode, "baycom operating mode; eg. par96 or picpar");
-MODULE_PARM(iobase, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(iobase, int, NULL, 0);
MODULE_PARM_DESC(iobase, "baycom io base address");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 5c6257ee5361e..454dff0c48622 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -599,13 +599,13 @@ static int iobase[NR_PORTS] = { 0x3f8, };
static int irq[NR_PORTS] = { 4, };
static int baud[NR_PORTS] = { [0 ... NR_PORTS-1] = 1200 };
-MODULE_PARM(mode, "1-" __MODULE_STRING(NR_PORTS) "s");
+module_param_array(mode, charp, NULL, 0);
MODULE_PARM_DESC(mode, "baycom operating mode; * for software DCD");
-MODULE_PARM(iobase, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(iobase, int, NULL, 0);
MODULE_PARM_DESC(iobase, "baycom io base address");
-MODULE_PARM(irq, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "baycom irq number");
-MODULE_PARM(baud, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(baud, int, NULL, 0);
MODULE_PARM_DESC(baud, "baycom baud rate (300 to 4800)");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
index 4aef97039b9c5..14267aaeb0060 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -638,11 +638,11 @@ static char *mode[NR_PORTS] = { "ser12*", };
static int iobase[NR_PORTS] = { 0x3f8, };
static int irq[NR_PORTS] = { 4, };
-MODULE_PARM(mode, "1-" __MODULE_STRING(NR_PORTS) "s");
+module_param_array(mode, charp, NULL, 0);
MODULE_PARM_DESC(mode, "baycom operating mode; * for software DCD");
-MODULE_PARM(iobase, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(iobase, int, NULL, 0);
MODULE_PARM_DESC(iobase, "baycom io base address");
-MODULE_PARM(irq, "1-" __MODULE_STRING(NR_PORTS) "i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "baycom irq number");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 4b6c01aa27901..4834314b676dc 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -437,8 +437,8 @@ static struct net_device *dev_hpp[MAX_HPP_CARDS];
static int io[MAX_HPP_CARDS];
static int irq[MAX_HPP_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_HPP_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_HPP_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O port address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s); ignored if properly detected");
MODULE_DESCRIPTION("HP PC-LAN+ ISA ethernet driver");
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index 00358a92733f8..026888611d6fe 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -406,8 +406,8 @@ static struct net_device *dev_hp[MAX_HP_CARDS];
static int io[MAX_HP_CARDS];
static int irq[MAX_HP_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_HP_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_HP_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_DESCRIPTION("HP PC-LAN ISA ethernet driver");
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index ec5b7f403c3c7..84fcb71895937 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -224,9 +224,9 @@ static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO;
static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX;
static int hp100_mode = 1;
-MODULE_PARM(hp100_rx_ratio, "1i");
-MODULE_PARM(hp100_priority_tx, "1i");
-MODULE_PARM(hp100_mode, "1i");
+module_param(hp100_rx_ratio, int, 0);
+module_param(hp100_priority_tx, int, 0);
+module_param(hp100_mode, int, 0);
/*
* prototypes
@@ -3005,7 +3005,7 @@ MODULE_DESCRIPTION("HP CASCADE Architecture Driver for 100VG-AnyLan Network Adap
#define HP100_DEVICES 5
/* Parameters set by insmod */
static int hp100_port[HP100_DEVICES] = { 0, [1 ... (HP100_DEVICES-1)] = -1 };
-MODULE_PARM(hp100_port, "1-" __MODULE_STRING(HP100_DEVICES) "i");
+module_param_array(hp100_port, int, NULL, 0);
/* List of devices */
static struct net_device *hp100_devlist[HP100_DEVICES];
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 2f7a9e769bdf5..79c3fbfcbfefa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -1020,8 +1020,8 @@ static struct net_device *moddevs[DEVMAX];
static int irq;
static int io;
-MODULE_PARM(irq, "i");
-MODULE_PARM(io, "i");
+module_param(irq, int, 0);
+module_param(io, int, 0);
MODULE_PARM_DESC(irq, "IBM LAN/A IRQ number");
MODULE_PARM_DESC(io, "IBM LAN/A I/O base address");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 6a10d9643e886..c9595a1a3b862 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -2264,11 +2264,11 @@ MODULE_DESCRIPTION("ALi FIR Controller Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-4i");
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "Base I/O addresses");
-MODULE_PARM(irq, "1-4i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "IRQ lines");
-MODULE_PARM(dma, "1-4i");
+module_param_array(dma, int, NULL, 0);
MODULE_PARM_DESC(dma, "DMA channels");
module_init(ali_ircc_init);
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 4cc3f5c1e3c6a..0da9d83a9a757 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1493,11 +1493,11 @@ MODULE_DESCRIPTION("Toshiba OBOE IrDA Device Driver");
MODULE_AUTHOR("James McKenzie <james@fishsoup.dhs.org>");
MODULE_LICENSE("GPL");
-MODULE_PARM (max_baud, "i");
+module_param (max_baud, int, 0);
MODULE_PARM_DESC(max_baud, "Maximum baud rate");
#ifdef USE_PROBE
-MODULE_PARM (do_probe, "i");
+module_param (do_probe, bool, 0);
MODULE_PARM_DESC(do_probe, "Enable/disable chip probing and self-test");
#endif
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 1a7dff9489eac..d865375d7a4d9 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -39,11 +39,11 @@
#include "sir-dev.h"
#include "irtty-sir.h"
-MODULE_PARM(qos_mtt_bits, "i");
-MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
-
static int qos_mtt_bits = 0x03; /* 5 ms or more */
+module_param(qos_mtt_bits, int, 0);
+MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
+
/* ------------------------------------------------------- */
/* device configuration callbacks always invoked with irda-thread context */
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 480454f657110..b9b66a7fe0326 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -2206,15 +2206,15 @@ MODULE_DESCRIPTION("NSC IrDA Device Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(qos_mtt_bits, "i");
+module_param(qos_mtt_bits, int, 0);
MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
-MODULE_PARM(io, "1-4i");
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "Base I/O addresses");
-MODULE_PARM(irq, "1-4i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "IRQ lines");
-MODULE_PARM(dma, "1-4i");
+module_param_array(dma, int, NULL, 0);
MODULE_PARM_DESC(dma, "DMA channels");
-MODULE_PARM(dongle_id, "i");
+module_param(dongle_id, int, 0);
MODULE_PARM_DESC(dongle_id, "Type-id of used dongle");
module_init(nsc_ircc_init);
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index fc3580ae18360..792ba02a4c005 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -2378,15 +2378,15 @@ MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(ircc_dma, "1i");
+module_param(ircc_dma, int, 0);
MODULE_PARM_DESC(ircc_dma, "DMA channel");
-MODULE_PARM(ircc_irq, "1i");
+module_param(ircc_irq, int, 0);
MODULE_PARM_DESC(ircc_irq, "IRQ line");
-MODULE_PARM(ircc_fir, "1-4i");
+module_param(ircc_fir, int, 0);
MODULE_PARM_DESC(ircc_fir, "FIR Base Address");
-MODULE_PARM(ircc_sir, "1-4i");
+module_param(ircc_sir, int, 0);
MODULE_PARM_DESC(ircc_sir, "SIR Base Address");
-MODULE_PARM(ircc_cfg, "1-4i");
+module_param(ircc_cfg, int, 0);
MODULE_PARM_DESC(ircc_cfg, "Configuration register base address");
-MODULE_PARM(ircc_transceiver, "1i");
+module_param(ircc_transceiver, int, 0);
MODULE_PARM_DESC(ircc_transceiver, "Transceiver type");
diff --git a/drivers/net/irda/tekram-sir.c b/drivers/net/irda/tekram-sir.c
index 8d3d775b75c2e..62708801ad687 100644
--- a/drivers/net/irda/tekram-sir.c
+++ b/drivers/net/irda/tekram-sir.c
@@ -32,9 +32,9 @@
#include "sir-dev.h"
-MODULE_PARM(tekram_delay, "i");
-MODULE_PARM_DESC(tekram_delay, "tekram dongle write complete delay");
static int tekram_delay = 150; /* default is 150 ms */
+module_param(tekram_delay, int, 0);
+MODULE_PARM_DESC(tekram_delay, "tekram dongle write complete delay");
static int tekram_open(struct sir_dev *);
static int tekram_close(struct sir_dev *);
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index feaaf3f9dce12..ec4cba25f5924 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -73,7 +73,7 @@ static int qos_mtt_bits = 0x07; /* 1 ms or more */
static int dongle_id = 0; /* default: probe */
/* We can't guess the type of connected dongle, user *must* supply it. */
-MODULE_PARM(dongle_id, "i");
+module_param(dongle_id, int, 0);
/* FIXME : we should not need this, because instances should be automatically
* managed by the PCI layer. Especially that we seem to only be using the
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 5ee2550ff32cb..f7cd2269490c7 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -83,9 +83,9 @@ MODULE_DEVICE_TABLE(pci, vlsi_irda_table);
* 3: external 40MHz XCLK (HP OB-800)
*/
-MODULE_PARM(clksrc, "i");
-MODULE_PARM_DESC(clksrc, "clock input source selection");
static int clksrc = 0; /* default is 0(auto) */
+module_param(clksrc, int, 0);
+MODULE_PARM_DESC(clksrc, "clock input source selection");
/* ringsize: size of the tx and rx descriptor rings
* independent for tx and rx
@@ -95,9 +95,9 @@ static int clksrc = 0; /* default is 0(auto) */
* there should be no gain when using rings larger than 8
*/
-MODULE_PARM(ringsize, "1-2i");
-MODULE_PARM_DESC(ringsize, "TX, RX ring descriptor size");
static int ringsize[] = {8,8}; /* default is tx=8 / rx=8 */
+module_param_array(ringsize, int, NULL, 0);
+MODULE_PARM_DESC(ringsize, "TX, RX ring descriptor size");
/* sirpulse: tuning of the SIR pulse width within IrPHY 1.3 limits
* 0: very short, 1.5us (exception: 6us at 2.4 kbaud)
@@ -108,9 +108,9 @@ static int ringsize[] = {8,8}; /* default is tx=8 / rx=8 */
* pulse width saves more than 90% of the transmitted IR power.
*/
-MODULE_PARM(sirpulse, "i");
-MODULE_PARM_DESC(sirpulse, "SIR pulse width tuning");
static int sirpulse = 1; /* default is 3/16 bittime */
+module_param(sirpulse, int, 0);
+MODULE_PARM_DESC(sirpulse, "SIR pulse width tuning");
/* qos_mtt_bits: encoded min-turn-time value we require the peer device
* to use before transmitting to us. "Type 1" (per-station)
@@ -119,9 +119,9 @@ static int sirpulse = 1; /* default is 3/16 bittime */
* pretty common HP HDLS-1100 requires 1 msec - so lets use this.
*/
-MODULE_PARM(qos_mtt_bits, "i");
-MODULE_PARM_DESC(qos_mtt_bits, "IrLAP bitfield representing min-turn-time");
static int qos_mtt_bits = 0x07; /* default is 1 ms or more */
+module_param(qos_mtt_bits, int, 0);
+MODULE_PARM_DESC(qos_mtt_bits, "IrLAP bitfield representing min-turn-time");
/********************************************************/
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 64d8d3fc9568b..6968584cd4d88 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -1355,11 +1355,11 @@ MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(qos_mtt_bits, "i");
+module_param(qos_mtt_bits, int, 0);
MODULE_PARM_DESC(qos_mtt_bits, "Mimimum Turn Time");
-MODULE_PARM(io, "1-4i");
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "Base I/O addresses");
-MODULE_PARM(irq, "1-4i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "IRQ lines");
/*
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index 9c66a259ee70a..0cb1027fc2954 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -56,8 +56,8 @@
*/
#define IXGB_PARAM(X, S) \
-static const int __devinitdata X[IXGB_MAX_NIC + 1] = IXGB_PARAM_INIT; \
-MODULE_PARM(X, "1-" __MODULE_STRING(IXGB_MAX_NIC) "i"); \
+static int __devinitdata X[IXGB_MAX_NIC + 1] = IXGB_PARAM_INIT; \
+module_param_array(X, int, NULL, 0); \
MODULE_PARM_DESC(X, S);
/* Transmit Descriptor Count
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 87acad34266f4..bc952029e145f 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -327,10 +327,10 @@ static int io[MAX_CARDS];
static int dma[MAX_CARDS];
static int irq[MAX_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(dma, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(lance_debug, "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param(lance_debug, int, 0);
MODULE_PARM_DESC(io, "LANCE/PCnet I/O base address(es),required");
MODULE_PARM_DESC(dma, "LANCE/PCnet ISA DMA channel (ignored for some devices)");
MODULE_PARM_DESC(irq, "LANCE/PCnet IRQ number (ignored for some devices)");
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c
index 0aa574b109647..179a97c0af69d 100644
--- a/drivers/net/lne390.c
+++ b/drivers/net/lne390.c
@@ -149,8 +149,7 @@ static void cleanup_card(struct net_device *dev)
{
free_irq(dev->irq, dev);
release_region(dev->base_addr, LNE390_IO_EXTENT);
- if (ei_status.reg0)
- iounmap((void *)dev->mem_start);
+ iounmap(ei_status.mem);
}
#ifndef MODULE
@@ -257,32 +256,22 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
/*
BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
the card mem within the region covered by `normal' RAM !!!
+
+ ioremap() will fail in that case.
*/
- if (dev->mem_start > 1024*1024) { /* phys addr > 1MB */
- if (dev->mem_start < virt_to_phys(high_memory)) {
- printk(KERN_CRIT "lne390.c: Card RAM overlaps with normal memory!!!\n");
- printk(KERN_CRIT "lne390.c: Use EISA SCU to set card memory below 1MB,\n");
- printk(KERN_CRIT "lne390.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory));
- printk(KERN_CRIT "lne390.c: Driver NOT installed.\n");
- ret = -EINVAL;
- goto cleanup;
- }
- dev->mem_start = (unsigned long)ioremap(dev->mem_start, LNE390_STOP_PG*0x100);
- if (dev->mem_start == 0) {
- printk(KERN_ERR "lne390.c: Unable to remap card memory above 1MB !!\n");
- printk(KERN_ERR "lne390.c: Try using EISA SCU to set memory below 1MB.\n");
- printk(KERN_ERR "lne390.c: Driver NOT installed.\n");
- ret = -EAGAIN;
- goto cleanup;
- }
- ei_status.reg0 = 1; /* Use as remap flag */
- printk("lne390.c: remapped %dkB card memory to virtual address %#lx\n",
- LNE390_STOP_PG/4, dev->mem_start);
+ ei_status.mem = ioremap(dev->mem_start, LNE390_STOP_PG*0x100);
+ if (!ei_status.mem) {
+ printk(KERN_ERR "lne390.c: Unable to remap card memory above 1MB !!\n");
+ printk(KERN_ERR "lne390.c: Try using EISA SCU to set memory below 1MB.\n");
+ printk(KERN_ERR "lne390.c: Driver NOT installed.\n");
+ ret = -EAGAIN;
+ goto cleanup;
}
+ printk("lne390.c: remapped %dkB card memory to virtual address %p\n",
+ LNE390_STOP_PG/4, ei_status.mem);
- dev->mem_end = ei_status.rmem_end = dev->mem_start
- + (LNE390_STOP_PG - LNE390_START_PG)*256;
- ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
+ dev->mem_start = (unsigned long)ei_status.mem;
+ dev->mem_end = dev->mem_start + (LNE390_STOP_PG - LNE390_START_PG)*256;
/* The 8390 offset is zero for the LNE390 */
dev->base_addr = ioaddr;
@@ -352,8 +341,8 @@ static void lne390_reset_8390(struct net_device *dev)
static void
lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
- unsigned long hdr_start = dev->mem_start + ((ring_page - LNE390_START_PG)<<8);
- isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+ void __iomem *hdr_start = ei_status.mem + ((ring_page - LNE390_START_PG)<<8);
+ memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
@@ -366,27 +355,28 @@ lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_
static void lne390_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset)
{
- unsigned long xfer_start = dev->mem_start + ring_offset - (LNE390_START_PG<<8);
+ void __iomem *xfer_start = ei_status.mem + ring_offset - (LNE390_START_PG<<8);
- if (xfer_start + count > ei_status.rmem_end) {
+ if (ring_offset + count > (LNE390_STOP_PG<<8)) {
/* Packet wraps over end of ring buffer. */
- int semi_count = ei_status.rmem_end - xfer_start;
- isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+ int semi_count = (LNE390_STOP_PG<<8) - ring_offset;
+ memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
- isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
+ memcpy_fromio(skb->data + semi_count,
+ ei_status.mem + (TX_PAGES<<8), count);
} else {
/* Packet is in one chunk. */
- isa_memcpy_fromio(skb->data, xfer_start, count);
+ memcpy_fromio(skb->data, xfer_start, count);
}
}
static void lne390_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page)
{
- unsigned long shmem = dev->mem_start + ((start_page - LNE390_START_PG)<<8);
+ void __iomem *shmem = ei_status.mem + ((start_page - LNE390_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
- isa_memcpy_toio(shmem, buf, count);
+ memcpy_toio(shmem, buf, count);
}
static int lne390_open(struct net_device *dev)
@@ -412,9 +402,9 @@ static int io[MAX_LNE_CARDS];
static int irq[MAX_LNE_CARDS];
static int mem[MAX_LNE_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(mem, "memory base address(es)");
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index 70be2a9e3820e..643a787c8cc0e 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -1302,19 +1302,19 @@ MODULE_AUTHOR("Ard van Breemen <ard@cstmel.nl.eu.org>");
MODULE_DESCRIPTION("Intel Panther onboard i82596 driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-//MODULE_PARM(max_interrupt_work, "i");
-//MODULE_PARM(reverse_probe, "i");
-//MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
-
static struct net_device *dev_lp486e;
static int full_duplex;
static int options;
static int io = IOADDR;
static int irq = IRQ;
+module_param(debug, int, 0);
+//module_param(max_interrupt_work, int, 0);
+//module_param(reverse_probe, int, 0);
+//module_param(rx_copybreak, int, 0);
+module_param(options, int, 0);
+module_param(full_duplex, int, 0);
+
static int __init lp486e_init_module(void) {
int err;
struct net_device *dev = alloc_etherdev(sizeof(struct i596_private));
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 5bb12dc93496a..c6211439ac9c1 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -251,12 +251,12 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(mtu, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(max_interrupt_work, int, 0);
+module_param(mtu, int, 0);
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(max_interrupt_work,
"DP8381x maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index d9a9a0bb70a1d..496433902adee 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -800,9 +800,9 @@ static int io[MAX_NE_CARDS];
static int irq[MAX_NE_CARDS];
static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(bad, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es),required");
MODULE_PARM_DESC(irq, "IRQ number(s)");
MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures");
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index 4fe6e75748555..6ebef27dbfaea 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -776,9 +776,9 @@ static int irq[MAX_NE_CARDS];
static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(bad, int, NULL, 0);
MODULE_PARM_DESC(io, "(ignored)");
MODULE_PARM_DESC(irq, "(ignored)");
MODULE_PARM_DESC(bad, "(ignored)");
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index ae0698bd70bdb..7d43a87963860 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -77,9 +77,9 @@ MODULE_AUTHOR("Donald Becker / Paul Gortmaker");
MODULE_DESCRIPTION("PCI NE2000 clone driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(debug, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(debug, "debug level (1-2)");
MODULE_PARM_DESC(options, "Bit 5: full duplex");
MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)");
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c
index 7228ba29adf40..f744f8ecd9efe 100644
--- a/drivers/net/ne3210.c
+++ b/drivers/net/ne3210.c
@@ -174,18 +174,17 @@ static int __init ne3210_eisa_probe (struct device *device)
printk("%dkB memory at physical address %#lx\n",
NE3210_STOP_PG/4, phys_mem);
- dev->mem_start = (unsigned long)ioremap(phys_mem, NE3210_STOP_PG*0x100);
- if (dev->mem_start == 0) {
+ ei_status.mem = ioremap(phys_mem, NE3210_STOP_PG*0x100);
+ if (!ei_status.mem) {
printk(KERN_ERR "ne3210.c: Unable to remap card memory !!\n");
printk(KERN_ERR "ne3210.c: Driver NOT installed.\n");
retval = -EAGAIN;
goto out4;
}
- printk("ne3210.c: remapped %dkB card memory to virtual address %#lx\n",
- NE3210_STOP_PG/4, dev->mem_start);
- dev->mem_end = ei_status.rmem_end = dev->mem_start
- + (NE3210_STOP_PG - NE3210_START_PG)*256;
- ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
+ printk("ne3210.c: remapped %dkB card memory to virtual address %p\n",
+ NE3210_STOP_PG/4, ei_status.mem);
+ dev->mem_start = (unsigned long)ei_status.mem;
+ dev->mem_end = dev->mem_start + (NE3210_STOP_PG - NE3210_START_PG)*256;
/* The 8390 offset is zero for the NE3210 */
dev->base_addr = ioaddr;
@@ -219,7 +218,7 @@ static int __init ne3210_eisa_probe (struct device *device)
return 0;
out5:
- iounmap((void *)dev->mem_start);
+ iounmap(ei_status.mem);
out4:
release_mem_region (phys_mem, NE3210_STOP_PG*0x100);
out3:
@@ -240,7 +239,7 @@ static int __devexit ne3210_eisa_remove (struct device *device)
unsigned long ioaddr = to_eisa_device (device)->base_addr;
unregister_netdev (dev);
- iounmap((void *)dev->mem_start);
+ iounmap(ei_status.mem);
release_mem_region (ei_status.priv, NE3210_STOP_PG*0x100);
free_irq (dev->irq, dev);
release_region (ioaddr + NE3210_CFG1, NE3210_CFG_EXTENT);
@@ -288,7 +287,7 @@ static void ne3210_reset_8390(struct net_device *dev)
static void
ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{
- unsigned long hdr_start = dev->mem_start + ((ring_page - NE3210_START_PG)<<8);
+ void __iomem *hdr_start = ei_status.mem + ((ring_page - NE3210_START_PG)<<8);
memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
}
@@ -302,24 +301,25 @@ ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_
static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset)
{
- unsigned long xfer_start = dev->mem_start + ring_offset - (NE3210_START_PG<<8);
+ void __iomem *start = ei_status.mem + ring_offset - NE3210_START_PG*256;
- if (xfer_start + count > ei_status.rmem_end) {
+ if (ring_offset + count > NE3210_STOP_PG*256) {
/* Packet wraps over end of ring buffer. */
- int semi_count = ei_status.rmem_end - xfer_start;
- memcpy_fromio(skb->data, xfer_start, semi_count);
+ int semi_count = NE3210_STOP_PG*256 - ring_offset;
+ memcpy_fromio(skb->data, start, semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
+ memcpy_fromio(skb->data + semi_count,
+ ei_status.mem + TX_PAGES*256, count);
} else {
/* Packet is in one chunk. */
- memcpy_fromio(skb->data, xfer_start, count);
+ memcpy_fromio(skb->data, start, count);
}
}
static void ne3210_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page)
{
- unsigned long shmem = dev->mem_start + ((start_page - NE3210_START_PG)<<8);
+ void __iomem *shmem = ei_status.mem + ((start_page - NE3210_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */
memcpy_toio(shmem, buf, count);
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index a76c8575ccff5..fa854c8fde75c 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -1314,10 +1314,10 @@ static void set_multicast_list(struct net_device *dev)
#ifdef MODULE
static struct net_device *dev_ni52;
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(memstart, "l");
-MODULE_PARM(memend, "l");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(memstart, long, 0);
+module_param(memend, long, 0);
MODULE_PARM_DESC(io, "NI5210 I/O base address,required");
MODULE_PARM_DESC(irq, "NI5210 IRQ number,required");
MODULE_PARM_DESC(memstart, "NI5210 memory base address,required");
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c
index fd58f0d9e6445..1dffbbf83ccb7 100644
--- a/drivers/net/ni65.c
+++ b/drivers/net/ni65.c
@@ -1250,9 +1250,9 @@ static void set_multicast_list(struct net_device *dev)
#ifdef MODULE
static struct net_device *dev_ni65;
-MODULE_PARM(irq, "i");
-MODULE_PARM(io, "i");
-MODULE_PARM(dma, "i");
+module_param(irq, int, 0);
+module_param(io, int, 0);
+module_param(dma, int, 0);
MODULE_PARM_DESC(irq, "ni6510 IRQ number (ignored for some cards)");
MODULE_PARM_DESC(io, "ni6510 I/O base address");
MODULE_PARM_DESC(dma, "ni6510 ISA DMA channel (ignored for some cards)");
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index b5c99d2f37b6d..08ffa1bcb68c8 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -107,12 +107,12 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("3Com 3c574 series PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Now-standard PC card module parameters. */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
INT_MODULE_PARM(max_interrupt_work, 32);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 970ed7bb596fa..06ace14a6ba2a 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -126,7 +126,7 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("3Com 3c589 series PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Special hook for setting if_port when module is loaded */
INT_MODULE_PARM(if_port, 0);
@@ -134,7 +134,7 @@ INT_MODULE_PARM(if_port, 0);
/* Bit map of interrupts to choose from */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3029129ae650c..957bd2e8ab89e 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -73,12 +73,12 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Bit map of interrupts to choose from */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index a824548388d85..fbdc0b7a53d76 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -57,7 +57,7 @@
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static void regdump(struct net_device *dev)
@@ -109,18 +109,18 @@ static int backplane;
static int clockp;
static int clockm;
-MODULE_PARM(node, "i");
-MODULE_PARM(timeout, "i");
-MODULE_PARM(backplane, "i");
-MODULE_PARM(clockp, "i");
-MODULE_PARM(clockm, "i");
+module_param(node, int, 0);
+module_param(timeout, int, 0);
+module_param(backplane, int, 0);
+module_param(clockp, int, 0);
+module_param(clockm, int, 0);
/* Bit map of interrupts to choose from */
static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
MODULE_LICENSE("GPL");
/*====================================================================*/
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 9c40e61fa1bce..d676aba69dc15 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -67,13 +67,13 @@
MODULE_DESCRIPTION("fmvj18x and compatible PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Bit map of interrupts to choose from */
/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
/* SRAM configuration */
/* 0:4KB*2 TX buffer else:8KB*2 TX buffer */
@@ -623,7 +623,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
{
win_req_t req;
memreq_t mem;
- u_char *base;
+ u_char __iomem *base;
int i, j;
/* Allocate a small memory window */
@@ -676,7 +676,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
{
win_req_t req;
memreq_t mem;
- u_char *base;
+ u_char __iomem *base;
int i, j;
struct net_device *dev = link->priv;
ioaddr_t ioaddr;
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 884ee94ea2793..dbdcbc6cec052 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -72,7 +72,7 @@
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n"
@@ -102,12 +102,12 @@ static u_long sramsize = 64;
/* Ringspeed 4,16 */
static int ringspeed = 16;
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(mmiobase, "i");
-MODULE_PARM(srambase, "i");
-MODULE_PARM(sramsize, "i");
-MODULE_PARM(ringspeed, "i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
+module_param(mmiobase, ulong, 0);
+module_param(srambase, ulong, 0);
+module_param(sramsize, ulong, 0);
+module_param(ringspeed, int, 0);
MODULE_LICENSE("GPL");
/*====================================================================*/
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 0ec78c327343a..f97ce65d76b0c 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -405,10 +405,10 @@ Parameters
MODULE_DESCRIPTION("New Media PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
/* 0=auto, 1=10baseT, 2 = 10base2, default=auto */
INT_MODULE_PARM(if_port, 0);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 2db4baabe9c91..b17b3fb862969 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -71,7 +71,7 @@ static char *if_names[] = { "auto", "10baseT", "10base2"};
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)";
@@ -87,12 +87,12 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("NE2000 compatible PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Bit map of interrupts to choose from */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
INT_MODULE_PARM(if_port, 1); /* Transceiver type */
INT_MODULE_PARM(use_big_buf, 1); /* use 64K packet buffer? */
@@ -104,7 +104,7 @@ INT_MODULE_PARM(full_duplex, 0); /* full duplex? */
/* Ugh! Let the user hardwire the hardware address for queer cards */
static int hw_addr[6] = { 0, /* ... */ };
-MODULE_PARM(hw_addr, "6i");
+module_param_array(hw_addr, int, NULL, 0);
/*====================================================================*/
@@ -227,7 +227,7 @@ typedef struct pcnet_dev_t {
dev_link_t link;
dev_node_t node;
u_int flags;
- caddr_t base;
+ void __iomem *base;
struct timer_list watchdog;
int stale, fast_poll;
u_char phy_id;
@@ -352,7 +352,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
struct net_device *dev = link->priv;
win_req_t req;
memreq_t mem;
- u_char *base, *virt;
+ u_char __iomem *base, *virt;
int i, j;
/* Allocate a small memory window */
@@ -1491,9 +1491,10 @@ static int setup_dma_config(dev_link_t *link, int start_pg,
/*====================================================================*/
-static void copyin(u_char *dest, u_char *src, int c)
+static void copyin(void *dest, void __iomem *src, int c)
{
- u_short *d = (u_short *)dest, *s = (u_short *)src;
+ u_short *d = dest;
+ u_short __iomem *s = src;
int odd;
if (c <= 0)
@@ -1508,9 +1509,10 @@ static void copyin(u_char *dest, u_char *src, int c)
*((u_char *)d) = readw(s) & 0xff;
}
-static void copyout(u_char *dest, const u_char *src, int c)
+static void copyout(void __iomem *dest, const void *src, int c)
{
- u_short *d = (u_short *)dest, *s = (u_short *)src;
+ u_short __iomem *d = dest;
+ const u_short *s = src;
int odd;
if (c <= 0)
@@ -1531,10 +1533,11 @@ static void shmem_get_8390_hdr(struct net_device *dev,
struct e8390_pkt_hdr *hdr,
int ring_page)
{
- void *xfer_start = (void *)(ei_status.rmem_start + (ring_page << 8)
- - (ei_status.rx_start_page << 8));
+ void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
+ + (ring_page << 8)
+ - (ei_status.rx_start_page << 8);
- copyin((void *)hdr, xfer_start, sizeof(struct e8390_pkt_hdr));
+ copyin(hdr, xfer_start, sizeof(struct e8390_pkt_hdr));
/* Fix for big endian systems */
hdr->count = le16_to_cpu(hdr->count);
}
@@ -1544,17 +1547,17 @@ static void shmem_get_8390_hdr(struct net_device *dev,
static void shmem_block_input(struct net_device *dev, int count,
struct sk_buff *skb, int ring_offset)
{
- void *xfer_start = (void *)(ei_status.rmem_start + ring_offset
- - (ei_status.rx_start_page << 8));
+ void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
+ + ring_offset
+ - (ei_status.rx_start_page << 8);
char *buf = skb->data;
- if (xfer_start + count > (void *)ei_status.rmem_end) {
+ if (xfer_start + count > (void __iomem *)ei_status.rmem_end) {
/* We must wrap the input move. */
- int semi_count = (void*)ei_status.rmem_end - xfer_start;
+ int semi_count = (void __iomem *)ei_status.rmem_end - xfer_start;
copyin(buf, xfer_start, semi_count);
buf += semi_count;
- ring_offset = ei_status.rx_start_page << 8;
- xfer_start = (void *)ei_status.rmem_start;
+ xfer_start = ei_status.mem + (TX_PAGES<<8);
count -= semi_count;
}
copyin(buf, xfer_start, count);
@@ -1565,7 +1568,7 @@ static void shmem_block_input(struct net_device *dev, int count,
static void shmem_block_output(struct net_device *dev, int count,
const u_char *buf, const int start_page)
{
- void *shmem = (void *)dev->mem_start + (start_page << 8);
+ void __iomem *shmem = ei_status.mem + (start_page << 8);
shmem -= ei_status.tx_start_page << 8;
copyout(shmem, buf, count);
}
@@ -1617,8 +1620,8 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
goto failed;
}
- dev->mem_start = (u_long)info->base + offset;
- ei_status.rmem_start = dev->mem_start + (TX_PAGES<<8);
+ ei_status.mem = info->base + offset;
+ dev->mem_start = (u_long)ei_status.mem;
dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size;
ei_status.tx_start_page = start_pg;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index dc560feaa14db..284375f2026c4 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -66,7 +66,7 @@ static char *if_names[] = { "auto", "10baseT", "10base2"};
MODULE_DESCRIPTION("SMC 91c92 series PCMCIA ethernet driver");
MODULE_LICENSE("GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/*
Transceiver/media type.
@@ -79,7 +79,7 @@ INT_MODULE_PARM(if_port, 0);
/* Bit map of interrupts to choose from. */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
@@ -120,7 +120,7 @@ struct smc_private {
dev_node_t node;
struct sk_buff *saved_skb;
int packets_waiting;
- caddr_t base;
+ void __iomem *base;
u_short cfg;
struct timer_list media;
int watchdog, tx_err;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 25c2fc991405f..6f4eeaf7f5de2 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -220,7 +220,7 @@ static char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args)
#else
#define DEBUG(n, args...)
@@ -255,10 +255,10 @@ MODULE_PARM(pc_debug, "i");
MODULE_DESCRIPTION("Xircom PCMCIA ethernet driver");
MODULE_LICENSE("Dual MPL/GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
INT_MODULE_PARM(irq_mask, 0xdeb8);
INT_MODULE_PARM(if_port, 0);
INT_MODULE_PARM(full_duplex, 0);
@@ -365,7 +365,7 @@ typedef struct local_info_t {
int dingo; /* a CEM56 type card */
int new_mii; /* has full 10baseT/100baseT MII */
int modem; /* is a multi function card (i.e with a modem) */
- caddr_t dingo_ccr; /* only used for CEM56 cards */
+ void __iomem *dingo_ccr; /* only used for CEM56 cards */
unsigned last_ptr_value; /* last packets transmitted value */
const char *manf_str;
} local_info_t;
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 3dd010328f16b..f4b62405d2e59 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -1242,8 +1242,8 @@ plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 };
static int timid;
-MODULE_PARM(parport, "1-" __MODULE_STRING(PLIP_MAX) "i");
-MODULE_PARM(timid, "1i");
+module_param_array(parport, int, NULL, 0);
+module_param(timid, int, 0);
MODULE_PARM_DESC(parport, "List of parport device numbers to use by plip");
static struct net_device *dev_plip[PLIP_MAX] = { NULL, };
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index e8be5a26db81f..e98b527bfef04 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -84,7 +84,7 @@ struct asyncppp {
#define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP)
static int flag_time = HZ;
-MODULE_PARM(flag_time, "i");
+module_param(flag_time, int, 0);
MODULE_PARM_DESC(flag_time, "ppp_async: interval between flagged packets (in clock ticks)");
MODULE_LICENSE("GPL");
MODULE_ALIAS_LDISC(N_PPP);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d8a5b70f69c3c..4923ad730efb3 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -63,7 +63,6 @@ VERSION 1.6LK <2004/04/14>
#define RTL8169_VERSION "1.6LK"
#define MODULENAME "r8169"
-#define RTL8169_DRIVER_NAME MODULENAME " Gigabit Ethernet driver " RTL8169_VERSION
#define PFX MODULENAME ": "
#ifdef RTL8169_DEBUG
@@ -112,7 +111,8 @@ static int multicast_filter_limit = 32;
#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */
-#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */
+#define RxPacketMaxSize 0x3FE8 /* 16K - 1 - ETH_HLEN - VLAN - CRC... */
+#define SafeMtu 0x1c20 /* ... actually life sucks beyond ~7k */
#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
#define R8169_REGS_SIZE 256
@@ -427,6 +427,9 @@ static void rtl8169_tx_timeout(struct net_device *dev);
static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev);
static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
void __iomem *);
+static int rtl8169_change_mtu(struct net_device *netdev, int new_mtu);
+static void rtl8169_down(struct net_device *dev);
+
#ifdef CONFIG_R8169_NAPI
static int rtl8169_poll(struct net_device *dev, int *budget);
#endif
@@ -560,8 +563,8 @@ static void rtl8169_get_drvinfo(struct net_device *dev,
{
struct rtl8169_private *tp = netdev_priv(dev);
- strcpy(info->driver, RTL8169_DRIVER_NAME);
- strcpy(info->version, RTL8169_VERSION );
+ strcpy(info->driver, MODULENAME);
+ strcpy(info->version, RTL8169_VERSION);
strcpy(info->bus_info, pci_name(tp->pci_dev));
}
@@ -1238,8 +1241,6 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
}
tp->chipset = i;
- tp->rx_buf_sz = RX_BUF_SIZE;
-
*ioaddr_out = ioaddr;
*dev_out = dev;
out:
@@ -1280,7 +1281,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
board_idx++;
if (!printed_version) {
- printk(KERN_INFO RTL8169_DRIVER_NAME " loaded\n");
+ printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
+ MODULENAME, RTL8169_VERSION);
printed_version = 1;
}
@@ -1321,6 +1323,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
dev->irq = pdev->irq;
dev->base_addr = (unsigned long) ioaddr;
+ dev->change_mtu = rtl8169_change_mtu;
#ifdef CONFIG_R8169_NAPI
dev->poll = rtl8169_poll;
@@ -1449,13 +1452,22 @@ static int rtl8169_resume(struct pci_dev *pdev)
#endif /* CONFIG_PM */
-static int
-rtl8169_open(struct net_device *dev)
+static void rtl8169_set_rxbufsize(struct rtl8169_private *tp,
+ struct net_device *dev)
+{
+ unsigned int mtu = dev->mtu;
+
+ tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE;
+}
+
+static int rtl8169_open(struct net_device *dev)
{
struct rtl8169_private *tp = netdev_priv(dev);
struct pci_dev *pdev = tp->pci_dev;
int retval;
+ rtl8169_set_rxbufsize(tp, dev);
+
retval =
request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev);
if (retval < 0)
@@ -1535,8 +1547,8 @@ rtl8169_hw_start(struct net_device *dev)
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W8(EarlyTxThres, EarlyTxThld);
- // For gigabit rtl8169
- RTL_W16(RxMaxSize, RxPacketMaxSize);
+ // For gigabit rtl8169, MTU + header + CRC + VLAN
+ RTL_W16(RxMaxSize, tp->rx_buf_sz);
// Set Rx Config register
i = rtl8169_rx_config |
@@ -1577,6 +1589,37 @@ rtl8169_hw_start(struct net_device *dev)
netif_start_queue(dev);
}
+static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
+{
+ struct rtl8169_private *tp = netdev_priv(dev);
+ int ret = 0;
+
+ if (new_mtu < ETH_ZLEN || new_mtu > SafeMtu)
+ return -EINVAL;
+
+ dev->mtu = new_mtu;
+
+ if (!netif_running(dev))
+ goto out;
+
+ rtl8169_down(dev);
+
+ rtl8169_set_rxbufsize(tp, dev);
+
+ ret = rtl8169_init_ring(dev);
+ if (ret < 0)
+ goto out;
+
+ rtl8169_hw_start(dev);
+
+ netif_poll_enable(dev);
+
+ rtl8169_request_timer(dev);
+
+out:
+ return ret;
+}
+
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
{
desc->addr = 0x0badbadbadbadbadull;
@@ -1743,10 +1786,19 @@ static void rtl8169_schedule_work(struct net_device *dev, void (*task)(void *))
static void rtl8169_wait_for_quiescence(struct net_device *dev)
{
+ struct rtl8169_private *tp = netdev_priv(dev);
+ void __iomem *ioaddr = tp->mmio_addr;
+
synchronize_irq(dev->irq);
/* Wait for any pending NAPI task to complete */
netif_poll_disable(dev);
+
+ RTL_W16(IntrMask, 0x0000);
+
+ RTL_W16(IntrStatus, 0xffff);
+
+ netif_poll_enable(dev);
}
static void rtl8169_reinit_task(void *_data)
@@ -1970,7 +2022,7 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_SIG_TARGET_ABORT));
/* The infamous DAC f*ckup only happens at boot time */
- if ((tp->cp_cmd & PCIDAC) && (tp->dirty_rx == tp->cur_rx == 0)) {
+ if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) {
printk(KERN_INFO PFX "%s: disabling PCI DAC.\n", dev->name);
tp->cp_cmd &= ~PCIDAC;
RTL_W16(CPlusCmd, tp->cp_cmd);
@@ -2256,19 +2308,17 @@ static int rtl8169_poll(struct net_device *dev, int *budget)
}
#endif
-static int
-rtl8169_close(struct net_device *dev)
+static void rtl8169_down(struct net_device *dev)
{
struct rtl8169_private *tp = netdev_priv(dev);
- struct pci_dev *pdev = tp->pci_dev;
void __iomem *ioaddr = tp->mmio_addr;
+ rtl8169_delete_timer(dev);
+
netif_stop_queue(dev);
flush_scheduled_work();
- rtl8169_delete_timer(dev);
-
spin_lock_irq(&tp->lock);
/* Stop the chip's Tx and Rx DMA processes. */
@@ -2283,13 +2333,27 @@ rtl8169_close(struct net_device *dev)
spin_unlock_irq(&tp->lock);
- free_irq(dev->irq, dev);
+ synchronize_irq(dev->irq);
netif_poll_disable(dev);
+ /* Give a racing hard_start_xmit a few cycles to complete. */
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(1);
+
rtl8169_tx_clear(tp);
rtl8169_rx_clear(tp);
+}
+
+static int rtl8169_close(struct net_device *dev)
+{
+ struct rtl8169_private *tp = netdev_priv(dev);
+ struct pci_dev *pdev = tp->pci_dev;
+
+ rtl8169_down(dev);
+
+ free_irq(dev->irq, dev);
pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
tp->RxPhyAddr);
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 70cdd866dd8a5..d2deaaf5d98ba 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -61,7 +61,7 @@ typedef enum xena_max_outstanding_splits {
#define INTR_DBG 4
/* Global variable that defines the present debug level of the driver. */
-int debug_level = ERR_DBG; /* Default level. */
+static int debug_level = ERR_DBG; /* Default level. */
/* DEBUG message print. */
#define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args)
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index d9fd930047306..79dca398f3ac3 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -737,8 +737,8 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
static struct net_device *dev_seeq;
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
MODULE_PARM_DESC(io, "SEEQ 8005 I/O base address");
MODULE_PARM_DESC(irq, "SEEQ 8005 IRQ number");
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index 2351e186af24e..269e7f7f78ee9 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -674,7 +674,7 @@ static void __init shaper_setup(struct net_device *dev)
static int shapers = 1;
#ifdef MODULE
-MODULE_PARM(shapers, "i");
+module_param(shapers, int, 0);
MODULE_PARM_DESC(shapers, "Traffic shaper: maximum number of shapers");
#else /* MODULE */
diff --git a/drivers/net/sk98lin/Makefile b/drivers/net/sk98lin/Makefile
index 759a3b0ebff4d..6783039ffb757 100644
--- a/drivers/net/sk98lin/Makefile
+++ b/drivers/net/sk98lin/Makefile
@@ -13,6 +13,7 @@
obj-$(CONFIG_SK98LIN) += sk98lin.o
sk98lin-objs := \
skge.o \
+ skethtool.o \
skdim.o \
skaddr.o \
skgehwt.o \
diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h
index 3b4c11036f732..542cec57f86a3 100644
--- a/drivers/net/sk98lin/h/skdrv2nd.h
+++ b/drivers/net/sk98lin/h/skdrv2nd.h
@@ -266,7 +266,6 @@ struct s_TxD {
typedef struct s_DevNet DEV_NET;
struct s_DevNet {
- struct proc_dir_entry *proc;
int PortNr;
int NetNr;
int Mtu;
@@ -383,6 +382,8 @@ struct s_AC {
SK_CSUM Csum; /* for checksum module */
SK_RLMT Rlmt; /* for rlmt module */
spinlock_t SlowPathLock; /* Normal IRQ lock */
+ struct timer_list BlinkTimer; /* for LED blinking */
+ int LedsOn;
SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */
int RlmtMode; /* link check mode to set */
int RlmtNets; /* Number of nets */
@@ -395,7 +396,7 @@ struct s_AC {
SK_U32 PciDevId; /* pci device id */
struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
char Name[30]; /* driver name */
- struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */
+
int RxBufSize; /* length of receive buffers */
struct net_device_stats stats; /* linux 'netstat -i' statistics */
int Index; /* internal board index number */
diff --git a/drivers/net/sk98lin/skaddr.c b/drivers/net/sk98lin/skaddr.c
index abf8576030ad5..a7e25edc7fc44 100644
--- a/drivers/net/sk98lin/skaddr.c
+++ b/drivers/net/sk98lin/skaddr.c
@@ -79,7 +79,7 @@ extern "C" {
/* 64-bit hash values with all bits set. */
-SK_U16 OnesHash[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
+static const SK_U16 OnesHash[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
/* local variables ************************************************************/
diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c
new file mode 100644
index 0000000000000..0aed3b9aa51fb
--- /dev/null
+++ b/drivers/net/sk98lin/skethtool.c
@@ -0,0 +1,555 @@
+/******************************************************************************
+ *
+ * Name: skethtool.c
+ * Project: GEnesis, PCI Gigabit Ethernet Adapter
+ * Version: $Revision: 1.7 $
+ * Date: $Date: 2004/09/29 13:32:07 $
+ * Purpose: All functions regarding ethtool handling
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * (C)Copyright 1998-2002 SysKonnect GmbH.
+ * (C)Copyright 2002-2004 Marvell.
+ *
+ * Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
+ * Server Adapters.
+ *
+ * Author: Ralph Roesler (rroesler@syskonnect.de)
+ * Mirko Lindner (mlindner@syskonnect.de)
+ *
+ * Address all question to: linux@syskonnect.de
+ *
+ * The technical manual for the adapters is available from SysKonnect's
+ * web pages: www.syskonnect.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The information in this file is provided "AS IS" without warranty.
+ *
+ *****************************************************************************/
+
+#include "h/skdrv1st.h"
+#include "h/skdrv2nd.h"
+#include "h/skversion.h"
+
+#include <linux/ethtool.h>
+#include <linux/timer.h>
+#include <linux/delay.h>
+
+/******************************************************************************
+ *
+ * Defines
+ *
+ *****************************************************************************/
+
+#define SUPP_COPPER_ALL (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
+ SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
+ SUPPORTED_1000baseT_Half| SUPPORTED_1000baseT_Full| \
+ SUPPORTED_TP)
+
+#define ADV_COPPER_ALL (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \
+ ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | \
+ ADVERTISED_1000baseT_Half| ADVERTISED_1000baseT_Full| \
+ ADVERTISED_TP)
+
+#define SUPP_FIBRE_ALL (SUPPORTED_1000baseT_Full | \
+ SUPPORTED_FIBRE | \
+ SUPPORTED_Autoneg)
+
+#define ADV_FIBRE_ALL (ADVERTISED_1000baseT_Full | \
+ ADVERTISED_FIBRE | \
+ ADVERTISED_Autoneg)
+
+
+/******************************************************************************
+ *
+ * Local Functions
+ *
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * getSettings - retrieves the current settings of the selected adapter
+ *
+ * Description:
+ * The current configuration of the selected adapter is returned.
+ * This configuration involves a)speed, b)duplex and c)autoneg plus
+ * a number of other variables.
+ *
+ * Returns: always 0
+ *
+ */
+static int getSettings(struct net_device *dev, struct ethtool_cmd *ecmd)
+{
+ const DEV_NET *pNet = netdev_priv(dev);
+ int port = pNet->PortNr;
+ const SK_AC *pAC = pNet->pAC;
+ const SK_GEPORT *pPort = &pAC->GIni.GP[port];
+
+ static int DuplexAutoNegConfMap[9][3]= {
+ { -1 , -1 , -1 },
+ { 0 , -1 , -1 },
+ { SK_LMODE_HALF , DUPLEX_HALF, AUTONEG_DISABLE },
+ { SK_LMODE_FULL , DUPLEX_FULL, AUTONEG_DISABLE },
+ { SK_LMODE_AUTOHALF , DUPLEX_HALF, AUTONEG_ENABLE },
+ { SK_LMODE_AUTOFULL , DUPLEX_FULL, AUTONEG_ENABLE },
+ { SK_LMODE_AUTOBOTH , DUPLEX_FULL, AUTONEG_ENABLE },
+ { SK_LMODE_AUTOSENSE , -1 , -1 },
+ { SK_LMODE_INDETERMINATED, -1 , -1 }
+ };
+ static int SpeedConfMap[6][2] = {
+ { 0 , -1 },
+ { SK_LSPEED_AUTO , -1 },
+ { SK_LSPEED_10MBPS , SPEED_10 },
+ { SK_LSPEED_100MBPS , SPEED_100 },
+ { SK_LSPEED_1000MBPS , SPEED_1000 },
+ { SK_LSPEED_INDETERMINATED, -1 }
+ };
+ static int AdvSpeedMap[6][2] = {
+ { 0 , -1 },
+ { SK_LSPEED_AUTO , -1 },
+ { SK_LSPEED_10MBPS , ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full },
+ { SK_LSPEED_100MBPS , ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full },
+ { SK_LSPEED_1000MBPS , ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full},
+ { SK_LSPEED_INDETERMINATED, -1 }
+ };
+
+ ecmd->phy_address = port;
+ ecmd->speed = SpeedConfMap[pPort->PLinkSpeedUsed][1];
+ ecmd->duplex = DuplexAutoNegConfMap[pPort->PLinkModeStatus][1];
+ ecmd->autoneg = DuplexAutoNegConfMap[pPort->PLinkModeStatus][2];
+ ecmd->transceiver = XCVR_INTERNAL;
+
+ if (pAC->GIni.GICopperType) {
+ ecmd->port = PORT_TP;
+ ecmd->supported = (SUPP_COPPER_ALL|SUPPORTED_Autoneg);
+ if (pAC->GIni.GIGenesis) {
+ ecmd->supported &= ~(SUPPORTED_10baseT_Half);
+ ecmd->supported &= ~(SUPPORTED_10baseT_Full);
+ ecmd->supported &= ~(SUPPORTED_100baseT_Half);
+ ecmd->supported &= ~(SUPPORTED_100baseT_Full);
+ } else {
+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
+ ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
+ }
+#ifdef CHIP_ID_YUKON_FE
+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
+ ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
+ ecmd->supported &= ~(SUPPORTED_1000baseT_Full);
+ }
+#endif
+ }
+ if (pAC->GIni.GP[0].PLinkSpeed != SK_LSPEED_AUTO) {
+ ecmd->advertising = AdvSpeedMap[pPort->PLinkSpeed][1];
+ if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
+ ecmd->advertising &= ~(SUPPORTED_1000baseT_Half);
+ }
+ } else {
+ ecmd->advertising = ecmd->supported;
+ }
+
+ if (ecmd->autoneg == AUTONEG_ENABLE)
+ ecmd->advertising |= ADVERTISED_Autoneg;
+ } else {
+ ecmd->port = PORT_FIBRE;
+ ecmd->supported = SUPP_FIBRE_ALL;
+ ecmd->advertising = ADV_FIBRE_ALL;
+ }
+ return 0;
+}
+
+/*
+ * MIB infrastructure uses instance value starting at 1
+ * based on board and port.
+ */
+static inline u32 pnmiInstance(const DEV_NET *pNet)
+{
+ return 1 + (pNet->pAC->RlmtNets == 2) + pNet->PortNr;
+}
+
+/*****************************************************************************
+ *
+ * setSettings - configures the settings of a selected adapter
+ *
+ * Description:
+ * Possible settings that may be altered are a)speed, b)duplex or
+ * c)autonegotiation.
+ *
+ * Returns:
+ * 0: everything fine, no error
+ * <0: the return value is the error code of the failure
+ */
+static int setSettings(struct net_device *dev, struct ethtool_cmd *ecmd)
+{
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ u32 instance;
+ char buf[4];
+ int len = 1;
+
+ if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100
+ && ecmd->speed != SPEED_1000)
+ return -EINVAL;
+
+ if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
+ return -EINVAL;
+
+ if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
+ return -EINVAL;
+
+ if (ecmd->autoneg == AUTONEG_DISABLE)
+ *buf = (ecmd->duplex == DUPLEX_FULL)
+ ? SK_LMODE_FULL : SK_LMODE_HALF;
+ else
+ *buf = (ecmd->duplex == DUPLEX_FULL)
+ ? SK_LMODE_AUTOFULL : SK_LMODE_AUTOHALF;
+
+ instance = pnmiInstance(pNet);
+ if (SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_LINK_MODE,
+ &buf, &len, instance, pNet->NetNr) != SK_PNMI_ERR_OK)
+ return -EINVAL;
+
+ switch(ecmd->speed) {
+ case SPEED_1000:
+ *buf = SK_LSPEED_1000MBPS;
+ break;
+ case SPEED_100:
+ *buf = SK_LSPEED_100MBPS;
+ break;
+ case SPEED_10:
+ *buf = SK_LSPEED_10MBPS;
+ }
+
+ if (SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
+ &buf, &len, instance, pNet->NetNr) != SK_PNMI_ERR_OK)
+ return -EINVAL;
+
+ return 0;
+}
+
+/*****************************************************************************
+ *
+ * getDriverInfo - returns generic driver and adapter information
+ *
+ * Description:
+ * Generic driver information is returned via this function, such as
+ * the name of the driver, its version and and firmware version.
+ * In addition to this, the location of the selected adapter is
+ * returned as a bus info string (e.g. '01:05.0').
+ *
+ * Returns: N/A
+ *
+ */
+static void getDriverInfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+ const DEV_NET *pNet = netdev_priv(dev);
+ const SK_AC *pAC = pNet->pAC;
+ char vers[32];
+
+ snprintf(vers, sizeof(vers)-1, VER_STRING "(v%d.%d)",
+ (pAC->GIni.GIPciHwRev >> 4) & 0xf, pAC->GIni.GIPciHwRev & 0xf);
+
+ strlcpy(info->driver, DRIVER_FILE_NAME, sizeof(info->driver));
+ strcpy(info->version, vers);
+ strcpy(info->fw_version, "N/A");
+ strlcpy(info->bus_info, pAC->PciDev->slot_name, ETHTOOL_BUSINFO_LEN);
+}
+
+/*
+ * Ethtool statistics support.
+ */
+static const char StringsStats[][ETH_GSTRING_LEN] = {
+ "rx_packets", "tx_packets",
+ "rx_bytes", "tx_bytes",
+ "rx_errors", "tx_errors",
+ "rx_dropped", "tx_dropped",
+ "multicasts", "collisions",
+ "rx_length_errors", "rx_buffer_overflow_errors",
+ "rx_crc_errors", "rx_frame_errors",
+ "rx_too_short_errors", "rx_too_long_errors",
+ "rx_carrier_extension_errors", "rx_symbol_errors",
+ "rx_llc_mac_size_errors", "rx_carrier_errors",
+ "rx_jabber_errors", "rx_missed_errors",
+ "tx_abort_collision_errors", "tx_carrier_errors",
+ "tx_buffer_underrun_errors", "tx_heartbeat_errors",
+ "tx_window_errors",
+};
+
+static int getStatsCount(struct net_device *dev)
+{
+ return ARRAY_SIZE(StringsStats);
+}
+
+static void getStrings(struct net_device *dev, u32 stringset, u8 *data)
+{
+ switch(stringset) {
+ case ETH_SS_STATS:
+ memcpy(data, *StringsStats, sizeof(StringsStats));
+ break;
+ }
+}
+
+static void getEthtoolStats(struct net_device *dev,
+ struct ethtool_stats *stats, u64 *data)
+{
+ const DEV_NET *pNet = netdev_priv(dev);
+ const SK_AC *pAC = pNet->pAC;
+ const SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
+
+ *data++ = pPnmiStruct->Stat[0].StatRxOkCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxOkCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxOctetsOkCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxOctetsOkCts;
+ *data++ = pPnmiStruct->InErrorsCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxSingleCollisionCts;
+ *data++ = pPnmiStruct->RxNoBufCts;
+ *data++ = pPnmiStruct->TxNoBufCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxMulticastOkCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxSingleCollisionCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxRuntCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxFifoOverflowCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxFcsCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxFramingCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxShortsCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxTooLongCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxCextCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxSymbolCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxIRLengthCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxCarrierCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxJabberCts;
+ *data++ = pPnmiStruct->Stat[0].StatRxMissedCts;
+ *data++ = pAC->stats.tx_aborted_errors;
+ *data++ = pPnmiStruct->Stat[0].StatTxCarrierCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxFifoUnderrunCts;
+ *data++ = pPnmiStruct->Stat[0].StatTxCarrierCts;
+ *data++ = pAC->stats.tx_window_errors;
+}
+
+
+/*****************************************************************************
+ *
+ * toggleLeds - Changes the LED state of an adapter
+ *
+ * Description:
+ * This function changes the current state of all LEDs of an adapter so
+ * that it can be located by a user.
+ *
+ * Returns: N/A
+ *
+ */
+static void toggleLeds(DEV_NET *pNet, int on)
+{
+ SK_AC *pAC = pNet->pAC;
+ int port = pNet->PortNr;
+ void __iomem *io = pAC->IoBase;
+
+ if (pAC->GIni.GIGenesis) {
+ SK_OUT8(io, MR_ADDR(port,LNK_LED_REG),
+ on ? SK_LNK_ON : SK_LNK_OFF);
+ SkGeYellowLED(pAC, io,
+ on ? (LED_ON >> 1) : (LED_OFF >> 1));
+ SkGeXmitLED(pAC, io, MR_ADDR(port,RX_LED_INI),
+ on ? SK_LED_TST : SK_LED_DIS);
+
+ if (pAC->GIni.GP[port].PhyType == SK_PHY_BCOM)
+ SkXmPhyWrite(pAC, io, port, PHY_BCOM_P_EXT_CTRL,
+ on ? PHY_B_PEC_LED_ON : PHY_B_PEC_LED_OFF);
+ else if (pAC->GIni.GP[port].PhyType == SK_PHY_LONE)
+ SkXmPhyWrite(pAC, io, port, PHY_LONE_LED_CFG,
+ on ? 0x0800 : PHY_L_LC_LEDT);
+ else
+ SkGeXmitLED(pAC, io, MR_ADDR(port,TX_LED_INI),
+ on ? SK_LED_TST : SK_LED_DIS);
+ } else {
+ const u16 YukLedOn = (PHY_M_LED_MO_DUP(MO_LED_ON) |
+ PHY_M_LED_MO_10(MO_LED_ON) |
+ PHY_M_LED_MO_100(MO_LED_ON) |
+ PHY_M_LED_MO_1000(MO_LED_ON) |
+ PHY_M_LED_MO_RX(MO_LED_ON));
+ const u16 YukLedOff = (PHY_M_LED_MO_DUP(MO_LED_OFF) |
+ PHY_M_LED_MO_10(MO_LED_OFF) |
+ PHY_M_LED_MO_100(MO_LED_OFF) |
+ PHY_M_LED_MO_1000(MO_LED_OFF) |
+ PHY_M_LED_MO_RX(MO_LED_OFF));
+
+
+ SkGmPhyWrite(pAC,io,port,PHY_MARV_LED_CTRL,0);
+ SkGmPhyWrite(pAC,io,port,PHY_MARV_LED_OVER,
+ on ? YukLedOn : YukLedOff);
+ }
+}
+
+/*****************************************************************************
+ *
+ * skGeBlinkTimer - Changes the LED state of an adapter
+ *
+ * Description:
+ * This function changes the current state of all LEDs of an adapter so
+ * that it can be located by a user. If the requested time interval for
+ * this test has elapsed, this function cleans up everything that was
+ * temporarily setup during the locate NIC test. This involves of course
+ * also closing or opening any adapter so that the initial board state
+ * is recovered.
+ *
+ * Returns: N/A
+ *
+ */
+void SkGeBlinkTimer(unsigned long data)
+{
+ struct net_device *dev = (struct net_device *) data;
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+
+ toggleLeds(pNet, pAC->LedsOn);
+
+ pAC->LedsOn = !pAC->LedsOn;
+ mod_timer(&pAC->BlinkTimer, jiffies + HZ/4);
+}
+
+/*****************************************************************************
+ *
+ * locateDevice - start the locate NIC feature of the elected adapter
+ *
+ * Description:
+ * This function is used if the user want to locate a particular NIC.
+ * All LEDs are regularly switched on and off, so the NIC can easily
+ * be identified.
+ *
+ * Returns:
+ * ==0: everything fine, no error, locateNIC test was started
+ * !=0: one locateNIC test runs already
+ *
+ */
+static int locateDevice(struct net_device *dev, u32 data)
+{
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+
+ if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
+ data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
+
+ /* start blinking */
+ pAC->LedsOn = 0;
+ mod_timer(&pAC->BlinkTimer, jiffies);
+ msleep_interruptible(data * 1000);
+
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(data * HZ);
+ del_timer_sync(&pAC->BlinkTimer);
+ toggleLeds(pNet, 0);
+
+ return 0;
+}
+
+/*****************************************************************************
+ *
+ * getPauseParams - retrieves the pause parameters
+ *
+ * Description:
+ * All current pause parameters of a selected adapter are placed
+ * in the passed ethtool_pauseparam structure and are returned.
+ *
+ * Returns: N/A
+ *
+ */
+static void getPauseParams(struct net_device *dev, struct ethtool_pauseparam *epause)
+{
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ SK_GEPORT *pPort = &pAC->GIni.GP[pNet->PortNr];
+
+ epause->rx_pause = (pPort->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC) ||
+ (pPort->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM);
+
+ epause->tx_pause = epause->rx_pause || (pPort->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND);
+ epause->autoneg = epause->rx_pause || epause->tx_pause;
+}
+
+/*****************************************************************************
+ *
+ * setPauseParams - configures the pause parameters of an adapter
+ *
+ * Description:
+ * This function sets the Rx or Tx pause parameters
+ *
+ * Returns:
+ * ==0: everything fine, no error
+ * !=0: the return value is the error code of the failure
+ */
+static int setPauseParams(struct net_device *dev , struct ethtool_pauseparam *epause)
+{
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ SK_GEPORT *pPort = &pAC->GIni.GP[pNet->PortNr];
+ u32 instance = pnmiInstance(pNet);
+ struct ethtool_pauseparam old;
+ u8 oldspeed = pPort->PLinkSpeedUsed;
+ char buf[4];
+ int len = 1;
+ int ret;
+
+ /*
+ ** we have to determine the current settings to see if
+ ** the operator requested any modification of the flow
+ ** control parameters...
+ */
+ getPauseParams(dev, &old);
+
+ /*
+ ** perform modifications regarding the changes
+ ** requested by the operator
+ */
+ if (epause->autoneg != old.autoneg)
+ *buf = epause->autoneg ? SK_FLOW_MODE_NONE : SK_FLOW_MODE_SYMMETRIC;
+ else {
+ if (epause->rx_pause && epause->tx_pause)
+ *buf = SK_FLOW_MODE_SYMMETRIC;
+ else if (epause->rx_pause && !epause->tx_pause)
+ *buf = SK_FLOW_MODE_SYM_OR_REM;
+ else if (!epause->rx_pause && epause->tx_pause)
+ *buf = SK_FLOW_MODE_LOC_SEND;
+ else
+ *buf = SK_FLOW_MODE_NONE;
+ }
+
+ ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_FLOWCTRL_MODE,
+ &buf, &len, instance, pNet->NetNr);
+
+ if (ret != SK_PNMI_ERR_OK) {
+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
+ ("ethtool (sk98lin): error changing rx/tx pause (%i)\n", ret));
+ goto err;
+ }
+
+ /*
+ ** It may be that autoneg has been disabled! Therefore
+ ** set the speed to the previously used value...
+ */
+ if (!epause->autoneg) {
+ len = 1;
+ ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
+ &oldspeed, &len, instance, pNet->NetNr);
+ if (ret != SK_PNMI_ERR_OK)
+ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
+ ("ethtool (sk98lin): error setting speed (%i)\n", ret));
+ }
+ err:
+ return ret ? -EIO : 0;
+}
+
+struct ethtool_ops SkGeEthtoolOps = {
+ .get_settings = getSettings,
+ .set_settings = setSettings,
+ .get_drvinfo = getDriverInfo,
+ .get_strings = getStrings,
+ .get_stats_count = getStatsCount,
+ .get_ethtool_stats = getEthtoolStats,
+ .phys_id = locateDevice,
+ .get_pauseparam = getPauseParams,
+ .set_pauseparam = setPauseParams,
+};
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 5db59c43f6a29..5eb7bc1398912 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -109,6 +109,7 @@
#include "h/skversion.h"
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
@@ -233,17 +234,33 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
* Extern Function Prototypes
*
******************************************************************************/
-
-#ifdef CONFIG_PROC_FS
-static const char SK_Root_Dir_entry[] = "sk98lin";
+static const char SKRootName[] = "sk98lin";
static struct proc_dir_entry *pSkRootDir;
extern struct file_operations sk_proc_fops;
-#endif
+
+static inline void SkGeProcCreate(struct net_device *dev)
+{
+ struct proc_dir_entry *pe;
+
+ if (pSkRootDir &&
+ (pe = create_proc_entry(dev->name, S_IRUGO, pSkRootDir))) {
+ pe->proc_fops = &sk_proc_fops;
+ pe->data = dev;
+ pe->owner = THIS_MODULE;
+ }
+}
+
+static inline void SkGeProcRemove(struct net_device *dev)
+{
+ if (pSkRootDir)
+ remove_proc_entry(dev->name, pSkRootDir);
+}
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
extern void SkDimDisplayModerationSettings(SK_AC *pAC);
extern void SkDimStartModerationTimer(SK_AC *pAC);
extern void SkDimModerate(SK_AC *pAC);
+extern void SkGeBlinkTimer(unsigned long data);
#ifdef DEBUG
static void DumpMsg(struct sk_buff*, char*);
@@ -252,8 +269,8 @@ static void DumpLong(char*, int);
#endif
/* global variables *********************************************************/
-struct SK_NET_DEVICE *SkGeRootDev = NULL;
static SK_BOOL DoPrintInterfaceChange = SK_TRUE;
+extern struct ethtool_ops SkGeEthtoolOps;
/* local variables **********************************************************/
static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}};
@@ -337,22 +354,20 @@ SK_U32 AllocFlag;
DEV_NET *pNet;
SK_AC *pAC;
- if (dev->priv) {
- pNet = (DEV_NET*) dev->priv;
- pAC = pNet->pAC;
- AllocFlag = pAC->AllocFlag;
- if (pAC->PciDev) {
- pci_release_regions(pAC->PciDev);
- }
- if (AllocFlag & SK_ALLOC_IRQ) {
- free_irq(dev->irq, dev);
- }
- if (pAC->IoBase) {
- iounmap(pAC->IoBase);
- }
- if (pAC->pDescrMem) {
- BoardFreeMem(pAC);
- }
+ pNet = netdev_priv(dev);
+ pAC = pNet->pAC;
+ AllocFlag = pAC->AllocFlag;
+ if (pAC->PciDev) {
+ pci_release_regions(pAC->PciDev);
+ }
+ if (AllocFlag & SK_ALLOC_IRQ) {
+ free_irq(dev->irq, dev);
+ }
+ if (pAC->IoBase) {
+ iounmap(pAC->IoBase);
+ }
+ if (pAC->pDescrMem) {
+ BoardFreeMem(pAC);
}
} /* FreeResources */
@@ -360,26 +375,6 @@ SK_AC *pAC;
MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>");
MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(Speed_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(Speed_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(ConType, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-/* used for interrupt moderation */
-MODULE_PARM(IntsPerSec, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i");
-MODULE_PARM(Moderation, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(Stats, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(ModerationMask, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-MODULE_PARM(AutoSizing, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
-
#ifdef LINK_SPEED_A
static char *Speed_A[SK_MAX_CARD_PARAM] = LINK_SPEED;
@@ -465,6 +460,26 @@ static char *ModerationMask[SK_MAX_CARD_PARAM];
static char *AutoSizing[SK_MAX_CARD_PARAM];
static char *Stats[SK_MAX_CARD_PARAM];
+module_param_array(Speed_A, charp, NULL, 0);
+module_param_array(Speed_B, charp, NULL, 0);
+module_param_array(AutoNeg_A, charp, NULL, 0);
+module_param_array(AutoNeg_B, charp, NULL, 0);
+module_param_array(DupCap_A, charp, NULL, 0);
+module_param_array(DupCap_B, charp, NULL, 0);
+module_param_array(FlowCtrl_A, charp, NULL, 0);
+module_param_array(FlowCtrl_B, charp, NULL, 0);
+module_param_array(Role_A, charp, NULL, 0);
+module_param_array(Role_B, charp, NULL, 0);
+module_param_array(ConType, charp, NULL, 0);
+module_param_array(PrefPort, charp, NULL, 0);
+module_param_array(RlmtMode, charp, NULL, 0);
+/* used for interrupt moderation */
+module_param_array(IntsPerSec, int, NULL, 0);
+module_param_array(Moderation, charp, NULL, 0);
+module_param_array(Stats, charp, NULL, 0);
+module_param_array(ModerationMask, charp, NULL, 0);
+module_param_array(AutoSizing, charp, NULL, 0);
+
/*****************************************************************************
*
* SkGeBoardInit - do level 0 and 1 initialization
@@ -503,6 +518,11 @@ SK_BOOL DualNet;
}
spin_lock_init(&pAC->SlowPathLock);
+ /* setup phy_id blink timer */
+ pAC->BlinkTimer.function = SkGeBlinkTimer;
+ pAC->BlinkTimer.data = (unsigned long) dev;
+ init_timer(&pAC->BlinkTimer);
+
/* level 0 init common modules here */
spin_lock_irqsave(&pAC->SlowPathLock, Flags);
@@ -601,12 +621,6 @@ SK_BOOL DualNet;
return(-EAGAIN);
}
- /*
- * Register the device here
- */
- pAC->Next = SkGeRootDev;
- SkGeRootDev = dev;
-
return (0);
} /* SkGeBoardInit */
@@ -887,7 +901,7 @@ DEV_NET *pNet;
SK_AC *pAC;
SK_U32 IntSrc; /* interrupts source register contents */
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
/*
@@ -1036,7 +1050,7 @@ DEV_NET *pNet;
SK_AC *pAC;
SK_U32 IntSrc; /* interrupts source register contents */
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
/*
@@ -1126,6 +1140,24 @@ SK_U32 IntSrc; /* interrupts source register contents */
return SkIsrRetHandled;
} /* SkGeIsrOnePort */
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/****************************************************************************
+ *
+ * SkGePollController - polling receive, for netconsole
+ *
+ * Description:
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ *
+ * Returns: N/A
+ */
+static void SkGePollController(struct net_device *dev)
+{
+ disable_irq(dev->irq);
+ SkGeIsr(dev->irq, dev, NULL);
+ enable_irq(dev->irq);
+}
+#endif
/****************************************************************************
*
@@ -1152,7 +1184,7 @@ struct SK_NET_DEVICE *dev)
int i;
SK_EVPARA EvPara; /* an event parameter union */
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
@@ -1166,10 +1198,6 @@ struct SK_NET_DEVICE *dev)
}
#endif
- if (!try_module_get(THIS_MODULE)) {
- return (-1); /* increase of usage count not possible */
- }
-
/* Set blink mode */
if ((pAC->PciDev->vendor == 0x1186) || (pAC->PciDev->vendor == 0x11ab ))
pAC->GIni.GILedBlinkCtrl = OEM_CONFIG_VALUE;
@@ -1177,7 +1205,6 @@ struct SK_NET_DEVICE *dev)
if (pAC->BoardLevel == SK_INIT_DATA) {
/* level 1 init common modules here */
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) {
- module_put(THIS_MODULE); /* decrease usage count */
printk("%s: HWInit (1) failed.\n", pAC->dev[pNet->PortNr]->name);
return (-1);
}
@@ -1193,7 +1220,6 @@ struct SK_NET_DEVICE *dev)
if (pAC->BoardLevel != SK_INIT_RUN) {
/* tschilling: Level 2 init modules here, check return value. */
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_RUN) != 0) {
- module_put(THIS_MODULE); /* decrease usage count */
printk("%s: HWInit (2) failed.\n", pAC->dev[pNet->PortNr]->name);
return (-1);
}
@@ -1279,19 +1305,18 @@ struct SK_NET_DEVICE *dev)
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeClose: pAC=0x%lX ", (unsigned long)pAC));
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
#ifdef SK_DIAG_SUPPORT
if (pAC->DiagModeActive == DIAG_ACTIVE) {
if (pAC->DiagFlowCtrl == SK_FALSE) {
- module_put(THIS_MODULE);
/*
** notify that the interface which has been closed
** by operator interaction must not be started up
** again when the DIAG has finished.
*/
- newPtrNet = (DEV_NET *) pAC->dev[0]->priv;
+ newPtrNet = netdev_priv(pAC->dev[0]);
if (newPtrNet == pNet) {
pAC->WasIfUp[0] = SK_FALSE;
} else {
@@ -1376,7 +1401,6 @@ struct SK_NET_DEVICE *dev)
pAC->MaxPorts--;
pNet->Up = 0;
- module_put(THIS_MODULE);
return (0);
} /* SkGeClose */
@@ -1402,7 +1426,7 @@ DEV_NET *pNet;
SK_AC *pAC;
int Rc; /* return code of XmitFrame */
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
if ((!skb_shinfo(skb)->nr_frags) ||
@@ -2498,7 +2522,7 @@ unsigned long Flags;
static int SkGeSetMacAddr(struct SK_NET_DEVICE *dev, void *p)
{
-DEV_NET *pNet = (DEV_NET*) dev->priv;
+DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
struct sockaddr *addr = p;
@@ -2555,7 +2579,7 @@ unsigned long Flags;
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeSetRxMode starts now... "));
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
if (pAC->RlmtNets == 1)
PortIdx = pAC->ActivePort;
@@ -2627,7 +2651,7 @@ SK_EVPARA EvPara;
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeChangeMtu starts now...\n"));
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) {
@@ -2649,7 +2673,7 @@ SK_EVPARA EvPara;
#endif
pNet->Mtu = NewMtu;
- pOtherNet = (DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv;
+ pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]);
if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) {
return(0);
}
@@ -2855,7 +2879,7 @@ SK_EVPARA EvPara;
*/
static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev)
{
-DEV_NET *pNet = (DEV_NET*) dev->priv;
+DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */
SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */
@@ -2953,7 +2977,7 @@ int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32);
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
("SkGeIoctl starts now...\n"));
- pNet = (DEV_NET*) dev->priv;
+ pNet = netdev_priv(dev);
pAC = pNet->pAC;
if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) {
@@ -4539,11 +4563,8 @@ char ClassStr[80];
int SkDrvEnterDiagMode(
SK_AC *pAc) /* pointer to adapter context */
{
- SK_AC *pAC = NULL;
- DEV_NET *pNet = NULL;
-
- pNet = (DEV_NET *) pAc->dev[0]->priv;
- pAC = pNet->pAC;
+ DEV_NET *pNet = netdev_priv(pAc->dev[0]);
+ SK_AC *pAC = pNet->pAC;
SK_MEMCPY(&(pAc->PnmiBackup), &(pAc->PnmiStruct),
sizeof(SK_PNMI_STRUCT_DATA));
@@ -4558,8 +4579,8 @@ SK_AC *pAc) /* pointer to adapter context */
} else {
pAC->WasIfUp[0] = SK_FALSE;
}
- if (pNet != (DEV_NET *) pAc->dev[1]->priv) {
- pNet = (DEV_NET *) pAc->dev[1]->priv;
+ if (pNet != netdev_priv(pAC->dev[1])) {
+ pNet = netdev_priv(pAC->dev[1]);
if (pNet->Up) {
pAC->WasIfUp[1] = SK_TRUE;
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
@@ -4681,20 +4702,11 @@ int devNbr) /* what device is to be handled */
dev = pAC->dev[devNbr];
- /*
- ** Function SkGeClose() uses MOD_DEC_USE_COUNT (2.2/2.4)
- ** or module_put() (2.6) to decrease the number of users for
- ** a device, but if a device is to be put under control of
- ** the DIAG, that count is OK already and does not need to
- ** be adapted! Hence the opposite MOD_INC_USE_COUNT or
- ** try_module_get() needs to be used again to correct that.
+ /* On Linux 2.6 the network driver does NOT mess with reference
+ ** counts. The driver MUST be able to be unloaded at any time
+ ** due to the possibility of hotplug.
*/
- if (!try_module_get(THIS_MODULE)) {
- return (-1);
- }
-
if (SkGeClose(dev) != 0) {
- module_put(THIS_MODULE);
return (-1);
}
return (0);
@@ -4723,17 +4735,6 @@ int devNbr) /* what device is to be handled */
if (SkGeOpen(dev) != 0) {
return (-1);
- } else {
- /*
- ** Function SkGeOpen() uses MOD_INC_USE_COUNT (2.2/2.4)
- ** or try_module_get() (2.6) to increase the number of
- ** users for a device, but if a device was just under
- ** control of the DIAG, that count is OK already and
- ** does not need to be adapted! Hence the opposite
- ** MOD_DEC_USE_COUNT or module_put() needs to be used
- ** again to correct that.
- */
- module_put(THIS_MODULE);
}
/*
@@ -4904,9 +4905,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
SK_AC *pAC;
DEV_NET *pNet = NULL;
struct net_device *dev = NULL;
-#ifdef CONFIG_PROC_FS
- struct proc_dir_entry *pProcFile;
-#endif
static int boards_found = 0;
int error = -ENODEV;
@@ -4925,7 +4923,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
goto out_disable_device;
}
- pNet = dev->priv;
+ pNet = netdev_priv(dev);
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
if (!pNet->pAC) {
printk(KERN_ERR "Unable to allocate adapter "
@@ -4960,8 +4958,12 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
dev->set_mac_address = &SkGeSetMacAddr;
dev->do_ioctl = &SkGeIoctl;
dev->change_mtu = &SkGeChangeMtu;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ dev->poll_controller = &SkGePollController;
+#endif
dev->flags &= ~IFF_RUNNING;
SET_NETDEV_DEV(dev, &pdev->dev);
+ SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
#ifdef SK_ZEROCOPY
#ifdef USE_SK_TX_CHECKSUM
@@ -5002,14 +5004,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6);
-#ifdef CONFIG_PROC_FS
- pProcFile = create_proc_entry(dev->name, S_IRUGO, pSkRootDir);
- if (pProcFile) {
- pProcFile->proc_fops = &sk_proc_fops;
- pProcFile->data = dev;
- pProcFile->owner = THIS_MODULE;
- }
-#endif
+ SkGeProcCreate(dev);
pNet->PortNr = 0;
pNet->NetNr = 0;
@@ -5025,7 +5020,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
}
pAC->dev[1] = dev;
- pNet = dev->priv;
+ pNet = netdev_priv(dev);
pNet->PortNr = 1;
pNet->NetNr = 1;
pNet->pAC = pAC;
@@ -5041,6 +5036,8 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
dev->do_ioctl = &SkGeIoctl;
dev->change_mtu = &SkGeChangeMtu;
dev->flags &= ~IFF_RUNNING;
+ SET_NETDEV_DEV(dev, &pdev->dev);
+ SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
#ifdef SK_ZEROCOPY
#ifdef USE_SK_TX_CHECKSUM
@@ -5056,16 +5053,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
free_netdev(dev);
pAC->dev[1] = pAC->dev[0];
} else {
-#ifdef CONFIG_PROC_FS
- pProcFile = create_proc_entry(dev->name, S_IRUGO,
- pSkRootDir);
- if (pProcFile) {
- pProcFile->proc_fops = &sk_proc_fops;
- pProcFile->data = dev;
- pProcFile->owner = THIS_MODULE;
- }
-#endif
-
+ SkGeProcCreate(dev);
memcpy(&dev->dev_addr,
&pAC->Addr.Net[1].CurrentMacAddress, 6);
@@ -5101,19 +5089,14 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
static void __devexit skge_remove_one(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
- DEV_NET *pNet = (DEV_NET *) dev->priv;
+ DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
- int have_second_mac = 0;
-
- if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2)
- have_second_mac = 1;
+ struct net_device *otherdev = pAC->dev[1];
- remove_proc_entry(dev->name, pSkRootDir);
+ SkGeProcRemove(dev);
unregister_netdev(dev);
- if (have_second_mac) {
- remove_proc_entry(pAC->dev[1]->name, pSkRootDir);
- unregister_netdev(pAC->dev[1]);
- }
+ if (otherdev != dev)
+ SkGeProcRemove(otherdev);
SkGeYellowLED(pAC, pAC->IoBase, 0);
@@ -5146,8 +5129,8 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
FreeResources(dev);
free_netdev(dev);
- if (have_second_mac)
- free_netdev(pAC->dev[1]);
+ if (otherdev != dev)
+ free_netdev(otherdev);
kfree(pAC);
}
@@ -5180,34 +5163,21 @@ static int __init skge_init(void)
{
int error;
-#ifdef CONFIG_PROC_FS
- memcpy(&SK_Root_Dir_entry, BOOT_STRING, sizeof(SK_Root_Dir_entry) - 1);
-
- pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
- if (!pSkRootDir) {
- printk(KERN_WARNING "Unable to create /proc/net/%s",
- SK_Root_Dir_entry);
- return -ENOMEM;
- }
- pSkRootDir->owner = THIS_MODULE;
-#endif
-
- error = pci_module_init(&skge_driver);
- if (error) {
-#ifdef CONFIG_PROC_FS
- remove_proc_entry(pSkRootDir->name, proc_net);
-#endif
- }
-
+ pSkRootDir = proc_mkdir(SKRootName, proc_net);
+ if (pSkRootDir)
+ pSkRootDir->owner = THIS_MODULE;
+
+ error = pci_register_driver(&skge_driver);
+ if (error)
+ proc_net_remove(SKRootName);
return error;
}
static void __exit skge_exit(void)
{
- pci_unregister_driver(&skge_driver);
-#ifdef CONFIG_PROC_FS
- remove_proc_entry(pSkRootDir->name, proc_net);
-#endif
+ pci_unregister_driver(&skge_driver);
+ proc_net_remove(SKRootName);
+
}
module_init(skge_init);
diff --git a/drivers/net/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c
index 5ce61e3f48a43..5cece25c034e0 100644
--- a/drivers/net/sk98lin/skproc.c
+++ b/drivers/net/sk98lin/skproc.c
@@ -31,13 +31,9 @@
#include "h/skdrv2nd.h"
#include "h/skversion.h"
-extern struct SK_NET_DEVICE *SkGeRootDev;
-static int sk_proc_print(void *writePtr, char *format, ...);
-static void sk_gen_browse(void *buffer);
-int len;
-
static int sk_seq_show(struct seq_file *seq, void *v);
static int sk_proc_open(struct inode *inode, struct file *file);
+
struct file_operations sk_proc_fops = {
.owner = THIS_MODULE,
.open = sk_proc_open,
@@ -45,315 +41,206 @@ struct file_operations sk_proc_fops = {
.llseek = seq_lseek,
.release = single_release,
};
-struct net_device *currDev = NULL;
+
/*****************************************************************************
*
- * sk_gen_browse -generic print "summaries" entry
+ * sk_seq_show - show proc information of a particular adapter
*
* Description:
* This function fills the proc entry with statistic data about
- * the ethernet device.
+ * the ethernet device. It invokes the generic sk_gen_browse() to
+ * print out all items one per one.
*
- * Returns: -
- *
+ * Returns: 0
+ *
*/
-static void sk_gen_browse(void *buffer)
+static int sk_seq_show(struct seq_file *seq, void *v)
{
- struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev;
- struct SK_NET_DEVICE *next;
- SK_PNMI_STRUCT_DATA *pPnmiStruct;
- SK_PNMI_STAT *pPnmiStat;
+ struct net_device *dev = seq->private;
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
unsigned long Flags;
unsigned int Size;
- DEV_NET *pNet;
- SK_AC *pAC;
char sens_msg[50];
- int MaxSecurityCount = 0;
int t;
int i;
- while (SkgeProcDev) {
- MaxSecurityCount++;
- if (MaxSecurityCount > 100) {
- printk("Max limit for sk_proc_read security counter!\n");
- return;
- }
- pNet = (DEV_NET*) SkgeProcDev->priv;
- pAC = pNet->pAC;
- next = pAC->Next;
- pPnmiStruct = &pAC->PnmiStruct;
- /* NetIndex in GetStruct is now required, zero is only dummy */
-
- for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
- if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
- t--;
+ /* NetIndex in GetStruct is now required, zero is only dummy */
+ for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
+ if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
+ t--;
- spin_lock_irqsave(&pAC->SlowPathLock, Flags);
- Size = SK_PNMI_STRUCT_SIZE;
+ spin_lock_irqsave(&pAC->SlowPathLock, Flags);
+ Size = SK_PNMI_STRUCT_SIZE;
#ifdef SK_DIAG_SUPPORT
- if (pAC->BoardLevel == SK_INIT_DATA) {
- SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA));
- if (pAC->DiagModeActive == DIAG_NOTACTIVE) {
- pAC->Pnmi.DiagAttached = SK_DIAG_IDLE;
- }
- } else {
- SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1);
+ if (pAC->BoardLevel == SK_INIT_DATA) {
+ SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA));
+ if (pAC->DiagModeActive == DIAG_NOTACTIVE) {
+ pAC->Pnmi.DiagAttached = SK_DIAG_IDLE;
}
+ } else {
+ SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1);
+ }
#else
- SkPnmiGetStruct(pAC, pAC->IoBase,
+ SkPnmiGetStruct(pAC, pAC->IoBase,
pPnmiStruct, &Size, t-1);
#endif
- spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
+ spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
- if (strcmp(pAC->dev[t-1]->name, currDev->name) == 0) {
- pPnmiStat = &pPnmiStruct->Stat[0];
- len = sk_proc_print(buffer,
- "\nDetailed statistic for device %s\n",
- pAC->dev[t-1]->name);
- len += sk_proc_print(buffer,
- "=======================================\n");
+ if (pAC->dev[t-1] == dev) {
+ SK_PNMI_STAT *pPnmiStat = &pPnmiStruct->Stat[0];
+
+ seq_printf(seq, "\nDetailed statistic for device %s\n",
+ pAC->dev[t-1]->name);
+ seq_printf(seq, "=======================================\n");
- /* Board statistics */
- len += sk_proc_print(buffer,
- "\nBoard statistics\n\n");
- len += sk_proc_print(buffer,
- "Active Port %c\n",
- 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
- Net[t-1].PrefPort]->PortNumber);
- len += sk_proc_print(buffer,
- "Preferred Port %c\n",
- 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
- Net[t-1].PrefPort]->PortNumber);
+ /* Board statistics */
+ seq_printf(seq, "\nBoard statistics\n\n");
+ seq_printf(seq, "Active Port %c\n",
+ 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
+ Net[t-1].PrefPort]->PortNumber);
+ seq_printf(seq, "Preferred Port %c\n",
+ 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
+ Net[t-1].PrefPort]->PortNumber);
- len += sk_proc_print(buffer,
- "Bus speed (MHz) %d\n",
- pPnmiStruct->BusSpeed);
+ seq_printf(seq, "Bus speed (MHz) %d\n",
+ pPnmiStruct->BusSpeed);
- len += sk_proc_print(buffer,
- "Bus width (Bit) %d\n",
- pPnmiStruct->BusWidth);
- len += sk_proc_print(buffer,
- "Driver version %s\n",
- VER_STRING);
- len += sk_proc_print(buffer,
- "Hardware revision v%d.%d\n",
- (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
- pAC->GIni.GIPciHwRev & 0x0F);
+ seq_printf(seq, "Bus width (Bit) %d\n",
+ pPnmiStruct->BusWidth);
+ seq_printf(seq, "Driver version %s\n",
+ VER_STRING);
+ seq_printf(seq, "Hardware revision v%d.%d\n",
+ (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
+ pAC->GIni.GIPciHwRev & 0x0F);
- /* Print sensor informations */
- for (i=0; i < pAC->I2c.MaxSens; i ++) {
- /* Check type */
- switch (pAC->I2c.SenTable[i].SenType) {
- case 1:
- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
- strcat(sens_msg, " (C)");
- len += sk_proc_print(buffer,
- "%-25s %d.%02d\n",
- sens_msg,
- pAC->I2c.SenTable[i].SenValue / 10,
- pAC->I2c.SenTable[i].SenValue % 10);
+ /* Print sensor informations */
+ for (i=0; i < pAC->I2c.MaxSens; i ++) {
+ /* Check type */
+ switch (pAC->I2c.SenTable[i].SenType) {
+ case 1:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (C)");
+ seq_printf(seq, "%-25s %d.%02d\n",
+ sens_msg,
+ pAC->I2c.SenTable[i].SenValue / 10,
+ pAC->I2c.SenTable[i].SenValue % 10);
- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
- strcat(sens_msg, " (F)");
- len += sk_proc_print(buffer,
- "%-25s %d.%02d\n",
- sens_msg,
- ((((pAC->I2c.SenTable[i].SenValue)
- *10)*9)/5 + 3200)/100,
- ((((pAC->I2c.SenTable[i].SenValue)
- *10)*9)/5 + 3200) % 10);
- break;
- case 2:
- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
- strcat(sens_msg, " (V)");
- len += sk_proc_print(buffer,
- "%-25s %d.%03d\n",
- sens_msg,
- pAC->I2c.SenTable[i].SenValue / 1000,
- pAC->I2c.SenTable[i].SenValue % 1000);
- break;
- case 3:
- strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
- strcat(sens_msg, " (rpm)");
- len += sk_proc_print(buffer,
- "%-25s %d\n",
- sens_msg,
- pAC->I2c.SenTable[i].SenValue);
- break;
- default:
- break;
- }
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (F)");
+ seq_printf(seq, "%-25s %d.%02d\n",
+ sens_msg,
+ ((((pAC->I2c.SenTable[i].SenValue)
+ *10)*9)/5 + 3200)/100,
+ ((((pAC->I2c.SenTable[i].SenValue)
+ *10)*9)/5 + 3200) % 10);
+ break;
+ case 2:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (V)");
+ seq_printf(seq, "%-25s %d.%03d\n",
+ sens_msg,
+ pAC->I2c.SenTable[i].SenValue / 1000,
+ pAC->I2c.SenTable[i].SenValue % 1000);
+ break;
+ case 3:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (rpm)");
+ seq_printf(seq, "%-25s %d\n",
+ sens_msg,
+ pAC->I2c.SenTable[i].SenValue);
+ break;
+ default:
+ break;
}
+ }
- /*Receive statistics */
- len += sk_proc_print(buffer,
- "\nReceive statistics\n\n");
+ /*Receive statistics */
+ seq_printf(seq, "\nReceive statistics\n\n");
- len += sk_proc_print(buffer,
- "Received bytes %Lu\n",
- (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
- len += sk_proc_print(buffer,
- "Received packets %Lu\n",
- (unsigned long long) pPnmiStat->StatRxOkCts);
+ seq_printf(seq, "Received bytes %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
+ seq_printf(seq, "Received packets %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxOkCts);
#if 0
- if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
- pAC->HWRevision < 12) {
- pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
- pPnmiStat->StatRxShortsCts;
- pPnmiStat->StatRxShortsCts = 0;
- }
+ if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
+ pAC->HWRevision < 12) {
+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
+ pPnmiStat->StatRxShortsCts;
+ pPnmiStat->StatRxShortsCts = 0;
+ }
#endif
- if (pNet->Mtu > 1500)
- pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
- pPnmiStat->StatRxTooLongCts;
+ if (dev->mtu > 1500)
+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
+ pPnmiStat->StatRxTooLongCts;
- len += sk_proc_print(buffer,
- "Receive errors %Lu\n",
- (unsigned long long) pPnmiStruct->InErrorsCts);
- len += sk_proc_print(buffer,
- "Receive dropped %Lu\n",
- (unsigned long long) pPnmiStruct->RxNoBufCts);
- len += sk_proc_print(buffer,
- "Received multicast %Lu\n",
- (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
- len += sk_proc_print(buffer,
- "Receive error types\n");
- len += sk_proc_print(buffer,
- " length %Lu\n",
- (unsigned long long) pPnmiStat->StatRxRuntCts);
- len += sk_proc_print(buffer,
- " buffer overflow %Lu\n",
- (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
- len += sk_proc_print(buffer,
- " bad crc %Lu\n",
- (unsigned long long) pPnmiStat->StatRxFcsCts);
- len += sk_proc_print(buffer,
- " framing %Lu\n",
- (unsigned long long) pPnmiStat->StatRxFramingCts);
- len += sk_proc_print(buffer,
- " missed frames %Lu\n",
- (unsigned long long) pPnmiStat->StatRxMissedCts);
+ seq_printf(seq, "Receive errors %Lu\n",
+ (unsigned long long) pPnmiStruct->InErrorsCts);
+ seq_printf(seq, "Receive dropped %Lu\n",
+ (unsigned long long) pPnmiStruct->RxNoBufCts);
+ seq_printf(seq, "Received multicast %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
+ seq_printf(seq, "Receive error types\n");
+ seq_printf(seq, " length %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxRuntCts);
+ seq_printf(seq, " buffer overflow %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
+ seq_printf(seq, " bad crc %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxFcsCts);
+ seq_printf(seq, " framing %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxFramingCts);
+ seq_printf(seq, " missed frames %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxMissedCts);
- if (pNet->Mtu > 1500)
- pPnmiStat->StatRxTooLongCts = 0;
+ if (dev->mtu > 1500)
+ pPnmiStat->StatRxTooLongCts = 0;
- len += sk_proc_print(buffer,
- " too long %Lu\n",
- (unsigned long long) pPnmiStat->StatRxTooLongCts);
- len += sk_proc_print(buffer,
- " carrier extension %Lu\n",
- (unsigned long long) pPnmiStat->StatRxCextCts);
- len += sk_proc_print(buffer,
- " too short %Lu\n",
- (unsigned long long) pPnmiStat->StatRxShortsCts);
- len += sk_proc_print(buffer,
- " symbol %Lu\n",
- (unsigned long long) pPnmiStat->StatRxSymbolCts);
- len += sk_proc_print(buffer,
- " LLC MAC size %Lu\n",
- (unsigned long long) pPnmiStat->StatRxIRLengthCts);
- len += sk_proc_print(buffer,
- " carrier event %Lu\n",
- (unsigned long long) pPnmiStat->StatRxCarrierCts);
- len += sk_proc_print(buffer,
- " jabber %Lu\n",
- (unsigned long long) pPnmiStat->StatRxJabberCts);
+ seq_printf(seq, " too long %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxTooLongCts);
+ seq_printf(seq, " carrier extension %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxCextCts);
+ seq_printf(seq, " too short %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxShortsCts);
+ seq_printf(seq, " symbol %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxSymbolCts);
+ seq_printf(seq, " LLC MAC size %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxIRLengthCts);
+ seq_printf(seq, " carrier event %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxCarrierCts);
+ seq_printf(seq, " jabber %Lu\n",
+ (unsigned long long) pPnmiStat->StatRxJabberCts);
- /*Transmit statistics */
- len += sk_proc_print(buffer,
- "\nTransmit statistics\n\n");
+ /*Transmit statistics */
+ seq_printf(seq, "\nTransmit statistics\n\n");
- len += sk_proc_print(buffer,
- "Transmited bytes %Lu\n",
- (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
- len += sk_proc_print(buffer,
- "Transmited packets %Lu\n",
- (unsigned long long) pPnmiStat->StatTxOkCts);
- len += sk_proc_print(buffer,
- "Transmit errors %Lu\n",
- (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
- len += sk_proc_print(buffer,
- "Transmit dropped %Lu\n",
- (unsigned long long) pPnmiStruct->TxNoBufCts);
- len += sk_proc_print(buffer,
- "Transmit collisions %Lu\n",
- (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
- len += sk_proc_print(buffer,
- "Transmit error types\n");
- len += sk_proc_print(buffer,
- " excessive collision %ld\n",
- pAC->stats.tx_aborted_errors);
- len += sk_proc_print(buffer,
- " carrier %Lu\n",
- (unsigned long long) pPnmiStat->StatTxCarrierCts);
- len += sk_proc_print(buffer,
- " fifo underrun %Lu\n",
- (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
- len += sk_proc_print(buffer,
- " heartbeat %Lu\n",
- (unsigned long long) pPnmiStat->StatTxCarrierCts);
- len += sk_proc_print(buffer,
- " window %ld\n",
- pAC->stats.tx_window_errors);
+ seq_printf(seq, "Transmited bytes %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
+ seq_printf(seq, "Transmited packets %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxOkCts);
+ seq_printf(seq, "Transmit errors %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
+ seq_printf(seq, "Transmit dropped %Lu\n",
+ (unsigned long long) pPnmiStruct->TxNoBufCts);
+ seq_printf(seq, "Transmit collisions %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
+ seq_printf(seq, "Transmit error types\n");
+ seq_printf(seq, " excessive collision %ld\n",
+ pAC->stats.tx_aborted_errors);
+ seq_printf(seq, " carrier %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxCarrierCts);
+ seq_printf(seq, " fifo underrun %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
+ seq_printf(seq, " heartbeat %Lu\n",
+ (unsigned long long) pPnmiStat->StatTxCarrierCts);
+ seq_printf(seq, " window %ld\n",
+ pAC->stats.tx_window_errors);
- } /* if (strcmp(pACname, currDeviceName) == 0) */
}
- SkgeProcDev = next;
}
-}
-
-/*****************************************************************************
- *
- * sk_proc_print -generic line print
- *
- * Description:
- * This function fills the proc entry with statistic data about
- * the ethernet device.
- *
- * Returns: number of bytes written
- *
- */
-static int sk_proc_print(void *writePtr, char *format, ...)
-{
-#define MAX_LEN_SINGLE_LINE 256
- char str[MAX_LEN_SINGLE_LINE];
- va_list a_start;
- int lenght = 0;
-
- struct seq_file *seq = (struct seq_file *) writePtr;
-
- SK_MEMSET(str, 0, MAX_LEN_SINGLE_LINE);
-
- va_start(a_start, format);
- vsprintf(str, format, a_start);
- va_end(a_start);
-
- lenght = strlen(str);
-
- seq_printf(seq, str);
- return lenght;
-}
-
-/*****************************************************************************
- *
- * sk_seq_show - show proc information of a particular adapter
- *
- * Description:
- * This function fills the proc entry with statistic data about
- * the ethernet device. It invokes the generic sk_gen_browse() to
- * print out all items one per one.
- *
- * Returns: number of bytes written
- *
- */
-static int sk_seq_show(struct seq_file *seq, void *v)
-{
- void *castedBuffer = (void *) seq;
- currDev = seq->private;
- sk_gen_browse(castedBuffer);
- return 0;
+ return 0;
}
/*****************************************************************************
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c
index c176df6c24bec..b7c5a4cdb6aa1 100644
--- a/drivers/net/smc-mca.c
+++ b/drivers/net/smc-mca.c
@@ -95,8 +95,8 @@ static int ultra_io[MAX_ULTRAMCA_CARDS];
static int ultra_irq[MAX_ULTRAMCA_CARDS];
MODULE_LICENSE("GPL");
-MODULE_PARM(ultra_io, "1-" __MODULE_STRING(MAX_ULTRAMCA_CARDS) "i");
-MODULE_PARM(ultra_irq, "1-" __MODULE_STRING(MAX_ULTRAMCA_CARDS) "i");
+module_param_array(ultra_io, int, NULL, 0);
+module_param_array(ultra_irq, int, NULL, 0);
MODULE_PARM_DESC(ultra_io, "SMC Ultra/EtherEZ MCA I/O base address(es)");
MODULE_PARM_DESC(ultra_irq, "SMC Ultra/EtherEZ MCA IRQ number(s)");
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index ce4628f6242db..695278c97afec 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -553,8 +553,8 @@ static struct net_device *dev_ultra[MAX_ULTRA_CARDS];
static int io[MAX_ULTRA_CARDS];
static int irq[MAX_ULTRA_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ULTRA_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_ULTRA_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_DESCRIPTION("SMC Ultra/EtherEZ ISA/PnP Ethernet driver");
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index de31ab71384c7..f86697da04d69 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -1600,9 +1600,9 @@ static void smc_set_multicast_list(struct net_device *dev)
static struct net_device *devSMC9194;
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(ifport, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(ifport, int, 0);
MODULE_PARM_DESC(io, "SMC 99194 I/O base address");
MODULE_PARM_DESC(irq, "SMC 99194 IRQ number");
MODULE_PARM_DESC(ifport, "SMC 99194 interface port (0-default, 1-TP, 2-AUI)");
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index d6d1890f27984..1ed2a7896f233 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -372,15 +372,15 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(mtu, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(intr_latency, "i");
-MODULE_PARM(small_frames, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(enable_hw_cksum, "i");
+module_param(max_interrupt_work, int, 0);
+module_param(mtu, int, 0);
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param(intr_latency, int, 0);
+module_param(small_frames, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param(enable_hw_cksum, int, 0);
MODULE_PARM_DESC(max_interrupt_work, "Maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "MTU (all boards)");
MODULE_PARM_DESC(debug, "Debug level (0-6)");
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 4a77d1072d675..f3e4876d02fcd 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -188,10 +188,10 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Sundance Alta Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "s");
-MODULE_PARM(flowctrl, "i");
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param_array(media, charp, NULL, 0);
+module_param(flowctrl, int, 0);
MODULE_PARM_DESC(debug, "Sundance Alta debug level (0-5)");
MODULE_PARM_DESC(rx_copybreak, "Sundance Alta copy breakpoint for copy-only-tiny-frames");
MODULE_PARM_DESC(flowctrl, "Sundance Alta flow control [0|1]");
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 525b9ca619723..1b2c4b9274b84 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -73,7 +73,7 @@ static char version[] =
static int macaddr[6];
/* accept MAC address of the form macaddr=0x08,0x00,0x20,0x30,0x40,0x50 */
-MODULE_PARM(macaddr, "6i");
+module_param_array(macaddr, int, NULL, 0);
MODULE_PARM_DESC(macaddr, "Happy Meal MAC address to set");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 798f977c2abb8..a7ffa64502dd3 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -198,16 +198,6 @@ MODULE_AUTHOR("Maintainer: Samuel Chessman <chessman@tux.org>");
MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters");
MODULE_LICENSE("GPL");
-MODULE_PARM(aui, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
-MODULE_PARM(duplex, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
-MODULE_PARM(speed, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(bbuf, "i");
-MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)");
-MODULE_PARM_DESC(duplex, "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)");
-MODULE_PARM_DESC(speed, "ThunderLAN port speen setting(s) (0,10,100)");
-MODULE_PARM_DESC(debug, "ThunderLAN debug mask");
-MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
/* Define this to enable Link beat monitoring */
#undef MONITOR
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 47d7d6d4ca645..0d1dcf421771f 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -94,20 +94,20 @@ MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
static int ringspeed[XL_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(ringspeed, "1-" __MODULE_STRING(XL_MAX_ADAPTERS) "i");
+module_param_array(ringspeed, int, NULL, 0);
MODULE_PARM_DESC(ringspeed,"3c359: Ringspeed selection - 4,16 or 0") ;
/* Packet buffer size */
static int pkt_buf_sz[XL_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(pkt_buf_sz, "1-" __MODULE_STRING(XL_MAX_ADAPTERS) "i") ;
+module_param_array(pkt_buf_sz, int, NULL, 0) ;
MODULE_PARM_DESC(pkt_buf_sz,"3c359: Initial buffer size") ;
/* Message Level */
static int message_level[XL_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(message_level, "1-" __MODULE_STRING(XL_MAX_ADAPTERS) "i") ;
+module_param_array(message_level, int, NULL, 0) ;
MODULE_PARM_DESC(message_level, "3c359: Level of reported messages \n") ;
/*
* This is a real nasty way of doing this, but otherwise you
@@ -159,7 +159,7 @@ static void print_tx_state(struct net_device *dev)
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
struct xl_tx_desc *txd ;
- u8 *xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ;
printk("tx_ring_head: %d, tx_ring_tail: %d, free_ent: %d \n",xl_priv->tx_ring_head,
@@ -182,7 +182,7 @@ static void print_rx_state(struct net_device *dev)
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
struct xl_rx_desc *rxd ;
- u8 *xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ;
printk("rx_ring_tail: %d \n", xl_priv->rx_ring_tail) ;
@@ -215,7 +215,7 @@ static void print_rx_state(struct net_device *dev)
static u16 xl_ee_read(struct net_device *dev, int ee_addr)
{
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
- u8 *xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
/* Wait for EEProm to not be busy */
writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
@@ -247,7 +247,7 @@ static u16 xl_ee_read(struct net_device *dev, int ee_addr)
static void xl_ee_write(struct net_device *dev, int ee_addr, u16 ee_value)
{
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
- u8 *xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
/* Wait for EEProm to not be busy */
writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
@@ -386,7 +386,7 @@ static int __init xl_init(struct net_device *dev)
static int xl_hw_reset(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
- u8 *xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
unsigned long t ;
u16 i ;
u16 result_16 ;
@@ -569,7 +569,7 @@ static int xl_hw_reset(struct net_device *dev)
static int xl_open(struct net_device *dev)
{
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
u8 i ;
u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
int open_err ;
@@ -727,7 +727,7 @@ static int xl_open(struct net_device *dev)
static int xl_open_hw(struct net_device *dev)
{
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
u16 vsoff ;
char ver_str[33];
int open_err ;
@@ -891,7 +891,7 @@ static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on
static void xl_rx(struct net_device *dev)
{
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
struct sk_buff *skb, *skb2 ;
int frame_length = 0, copy_len = 0 ;
int temp_ring_loc ;
@@ -999,7 +999,7 @@ static void xl_rx(struct net_device *dev)
static void xl_reset(struct net_device *dev)
{
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
unsigned long t;
writew( GLOBAL_RESET, xl_mmio + MMIO_COMMAND ) ;
@@ -1046,7 +1046,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *)dev_id;
struct xl_private *xl_priv =(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u16 intstatus, macstatus ;
if (!dev) {
@@ -1234,7 +1234,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
static void xl_dn_comp(struct net_device *dev)
{
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
struct xl_tx_desc *txd ;
@@ -1270,7 +1270,7 @@ static void xl_dn_comp(struct net_device *dev)
static int xl_close(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
unsigned long t ;
netif_stop_queue(dev) ;
@@ -1409,7 +1409,7 @@ static void xl_set_rx_mode(struct net_device *dev)
static void xl_srb_bh(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 srb_cmd, ret_code ;
int i ;
@@ -1506,7 +1506,7 @@ static int xl_set_mac_address (struct net_device *dev, void *addr)
static void xl_arb_cmd(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 arb_cmd ;
u16 lan_status, lan_status_diff ;
@@ -1634,7 +1634,7 @@ static void xl_arb_cmd(struct net_device *dev)
static void xl_asb_cmd(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
if (xl_priv->asb_queued == 1)
writel(ACK_INTERRUPT | LATCH_ACK | ASBFACK, xl_mmio + MMIO_COMMAND) ;
@@ -1665,7 +1665,7 @@ static void xl_asb_cmd(struct net_device *dev)
static void xl_asb_bh(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 ret_code ;
writel(MMIO_BYTE_READ | 0xd0000 | xl_priv->asb | 2, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
@@ -1693,7 +1693,7 @@ static void xl_asb_bh(struct net_device *dev)
static void xl_srb_cmd(struct net_device *dev, int srb_cmd)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
switch (srb_cmd) {
case READ_LOG:
@@ -1750,7 +1750,7 @@ static void xl_srb_cmd(struct net_device *dev, int srb_cmd)
static void xl_wait_misr_flags(struct net_device *dev)
{
struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
- u8 * xl_mmio = xl_priv->xl_mmio ;
+ u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
int i ;
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h
index eb3cea9f22553..05c860368852d 100644
--- a/drivers/net/tokenring/3c359.h
+++ b/drivers/net/tokenring/3c359.h
@@ -263,7 +263,7 @@ struct xl_private {
u16 arb;
u16 asb;
- u8 *xl_mmio;
+ u8 __iomem *xl_mmio;
char *xl_card_name;
struct pci_dev *pdev ;
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 8458e21350a22..4e5b1c5742828 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -1945,9 +1945,9 @@ static int mem[IBMTR_MAX_ADAPTERS];
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
static int __init ibmtr_init(void)
{
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index ce7834e203478..99e0b03b69a81 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -182,20 +182,19 @@ static char *open_min_error[] = {
static int ringspeed[STREAMER_MAX_ADAPTERS] = { 0, };
-MODULE_PARM(ringspeed, "1-" __MODULE_STRING(STREAMER_MAX_ADAPTERS) "i");
+module_param_array(ringspeed, int, NULL, 0);
/* Packet buffer size */
static int pkt_buf_sz[STREAMER_MAX_ADAPTERS] = { 0, };
-MODULE_PARM(pkt_buf_sz, "1-" __MODULE_STRING(STREAMER_MAX_ADAPTERS) "i");
+module_param_array(pkt_buf_sz, int, NULL, 0);
/* Message Level */
static int message_level[STREAMER_MAX_ADAPTERS] = { 1, };
-MODULE_PARM(message_level,
- "1-" __MODULE_STRING(STREAMER_MAX_ADAPTERS) "i");
+module_param_array(message_level, int, NULL, 0);
#if STREAMER_IOCTL
static int streamer_ioctl(struct net_device *, struct ifreq *, int);
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 66bb2f7ede3a5..9e7923192a49f 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -150,17 +150,17 @@ MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ;
*/
static int ringspeed[OLYMPIC_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(ringspeed, "1-" __MODULE_STRING(OLYMPIC_MAX_ADAPTERS) "i");
+module_param_array(ringspeed, int, NULL, 0);
/* Packet buffer size */
static int pkt_buf_sz[OLYMPIC_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(pkt_buf_sz, "1-" __MODULE_STRING(OLYMPIC_MAX_ADAPTERS) "i") ;
+module_param_array(pkt_buf_sz, int, NULL, 0) ;
/* Message Level */
static int message_level[OLYMPIC_MAX_ADAPTERS] = {0,} ;
-MODULE_PARM(message_level, "1-" __MODULE_STRING(OLYMPIC_MAX_ADAPTERS) "i") ;
+module_param_array(message_level, int, NULL, 0) ;
/* Change network_monitor to receive mac frames through the arb channel.
* Will also create a /proc/net/olympic_tr%d entry, where %d is the tr
@@ -169,7 +169,7 @@ MODULE_PARM(message_level, "1-" __MODULE_STRING(OLYMPIC_MAX_ADAPTERS) "i") ;
* i.e. it will give you the source address of beaconers on the ring
*/
static int network_monitor[OLYMPIC_MAX_ADAPTERS] = {0,};
-MODULE_PARM(network_monitor, "1-" __MODULE_STRING(OLYMPIC_MAX_ADAPTERS) "i");
+module_param_array(network_monitor, int, NULL, 0);
static struct pci_device_id olympic_pci_tbl[] = {
{PCI_VENDOR_ID_IBM,PCI_DEVICE_ID_IBM_TR_WAKE,PCI_ANY_ID,PCI_ANY_ID,},
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c
index 0ddfb1582e61b..675b063508e37 100644
--- a/drivers/net/tokenring/proteon.c
+++ b/drivers/net/tokenring/proteon.c
@@ -362,9 +362,9 @@ static int dma[ISATR_MAX_ADAPTERS];
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
-MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
static struct net_device *proteon_dev[ISATR_MAX_ADAPTERS];
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c
index 4ba3dfe25bc88..3fab54a264666 100644
--- a/drivers/net/tokenring/skisa.c
+++ b/drivers/net/tokenring/skisa.c
@@ -371,9 +371,9 @@ static int dma[ISATR_MAX_ADAPTERS];
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
-MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
static struct net_device *sk_isa_dev[ISATR_MAX_ADAPTERS];
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 1331fd1d8f906..5c8aeacb83186 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -5663,9 +5663,9 @@ static int irq[SMCTR_MAX_ADAPTERS];
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "1-" __MODULE_STRING(SMCTR_MAX_ADAPTERS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SMCTR_MAX_ADAPTERS) "i");
-MODULE_PARM(ringspeed, "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param(ringspeed, int, 0);
static struct net_device *setup_card(int n)
{
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index c9767b14a0e51..9f3ca64e80edd 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -59,7 +59,7 @@ MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
static int debug = -1;
-MODULE_PARM (debug, "i");
+module_param (debug, int, 0);
MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number");
/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
@@ -70,7 +70,7 @@ static int rx_copybreak = 1518;
#else
static int rx_copybreak = 100;
#endif
-MODULE_PARM (rx_copybreak, "i");
+module_param (rx_copybreak, int, 0);
MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied");
#define PFX DRV_NAME ": "
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index c5a1ef410a0b4..e25f33df223ea 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -1989,15 +1989,15 @@ MODULE_DESCRIPTION("Davicom DM910X fast ethernet driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(debug, "i");
-MODULE_PARM(mode, "i");
-MODULE_PARM(cr6set, "i");
-MODULE_PARM(chkmode, "i");
-MODULE_PARM(HPNA_mode, "i");
-MODULE_PARM(HPNA_rx_cmd, "i");
-MODULE_PARM(HPNA_tx_cmd, "i");
-MODULE_PARM(HPNA_NoiseFloor, "i");
-MODULE_PARM(SF_mode, "i");
+module_param(debug, int, 0);
+module_param(mode, byte, 0);
+module_param(cr6set, int, 0);
+module_param(chkmode, byte, 0);
+module_param(HPNA_mode, byte, 0);
+module_param(HPNA_rx_cmd, byte, 0);
+module_param(HPNA_tx_cmd, byte, 0);
+module_param(HPNA_NoiseFloor, byte, 0);
+module_param(SF_mode, byte, 0);
MODULE_PARM_DESC(debug, "Davicom DM9xxx enable debugging (0-1)");
MODULE_PARM_DESC(mode, "Davicom DM9xxx: Bit 0: 10/100Mbps, bit 2: duplex, bit 8: HomePNA");
MODULE_PARM_DESC(SF_mode, "Davicom DM9xxx special function (bit 0: VLAN, bit 1 Flow Control, bit 2: TX pause packet)");
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index 0b914b46b9a43..091a0e07a5865 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -81,6 +81,25 @@ int tulip_mdio_read(struct net_device *dev, int phy_id, int location)
return retval & 0xffff;
}
+ if(tp->chip_id == ULI526X && tp->revision >= 0x40) {
+ int value;
+ int i = 1000;
+
+ value = ioread32(ioaddr + CSR9);
+ iowrite32(value & 0xFFEFFFFF, ioaddr + CSR9);
+
+ value = (phy_id << 21) | (location << 16) | 0x80000000;
+ iowrite32(value, ioaddr + CSR10);
+
+ while(--i > 0) {
+ mdio_delay();
+ if(ioread32(ioaddr + CSR10) & 0x10000000)
+ break;
+ }
+ retval = ioread32(ioaddr + CSR10);
+ spin_unlock_irqrestore(&tp->mii_lock, flags);
+ return retval & 0xFFFF;
+ }
/* Establish sync by sending at least 32 logic ones. */
for (i = 32; i >= 0; i--) {
iowrite32(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr);
@@ -140,7 +159,23 @@ void tulip_mdio_write(struct net_device *dev, int phy_id, int location, int val)
spin_unlock_irqrestore(&tp->mii_lock, flags);
return;
}
-
+ if (tp->chip_id == ULI526X && tp->revision >= 0x40) {
+ int value;
+ int i = 1000;
+
+ value = ioread32(ioaddr + CSR9);
+ iowrite32(value & 0xFFEFFFFF, ioaddr + CSR9);
+
+ value = (phy_id << 21) | (location << 16) | 0x40000000 | (val & 0xFFFF);
+ iowrite32(value, ioaddr + CSR10);
+
+ while(--i > 0) {
+ if (ioread32(ioaddr + CSR10) & 0x10000000)
+ break;
+ }
+ spin_unlock_irqrestore(&tp->mii_lock, flags);
+ }
+
/* Establish sync by sending 32 logic ones. */
for (i = 32; i >= 0; i--) {
iowrite32(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr);
diff --git a/drivers/net/tulip/timer.c b/drivers/net/tulip/timer.c
index e058a9fbfe884..691568283553b 100644
--- a/drivers/net/tulip/timer.c
+++ b/drivers/net/tulip/timer.c
@@ -39,6 +39,7 @@ void tulip_timer(unsigned long data)
case MX98713:
case COMPEX9881:
case DM910X:
+ case ULI526X:
default: {
struct medialeaf *mleaf;
unsigned char *p;
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index 6cce2834d6c70..063a1f05a3d8f 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -88,6 +88,7 @@ enum chips {
I21145,
DM910X,
CONEXANT,
+ ULI526X
};
@@ -481,8 +482,11 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp)
static inline void tulip_restart_rxtx(struct tulip_private *tp)
{
- tulip_stop_rxtx(tp);
- udelay(5);
+ if(!(tp->chip_id == ULI526X &&
+ (tp->revision == 0x40 || tp->revision == 0x50))) {
+ tulip_stop_rxtx(tp);
+ udelay(5);
+ }
tulip_start_rxtx(tp);
}
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index c1e3f70226d9a..87f580093687e 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -88,9 +88,9 @@ static int rx_copybreak = 100;
ToDo: Non-Intel setting could be better.
*/
-#if defined(__alpha__) || defined(__ia64__) || defined(__x86_64__)
+#if defined(__alpha__) || defined(__ia64__)
static int csr0 = 0x01A00000 | 0xE000;
-#elif defined(__i386__) || defined(__powerpc__)
+#elif defined(__i386__) || defined(__powerpc__) || defined(__x86_64__)
static int csr0 = 0x01A00000 | 0x8000;
#elif defined(__sparc__) || defined(__hppa__)
/* The UltraSparc PCI controllers will disconnect at every 64-byte
@@ -116,12 +116,12 @@ MODULE_AUTHOR("The Linux Kernel Team");
MODULE_DESCRIPTION("Digital 21*4* Tulip ethernet driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(tulip_debug, "i");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(csr0, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(tulip_debug, int, 0);
+module_param(max_interrupt_work, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param(csr0, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
#define PFX DRV_NAME ": "
@@ -198,6 +198,10 @@ struct tulip_chip_table tulip_tbl[] = {
/* RS7112 */
{ "Conexant LANfinity", 256, 0x0001ebef,
HAS_MII | HAS_ACPI, tulip_timer },
+
+ /* ULi526X */
+ { "ULi M5261/M5263", 128, 0x0001ebef,
+ HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, tulip_timer },
};
@@ -229,12 +233,14 @@ static struct pci_device_id tulip_pci_tbl[] = {
{ 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1186, 0x1541, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1186, 0x1561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
+ { 0x1186, 0x1591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x14f1, 0x1803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CONEXANT },
{ 0x1626, 0x8410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1737, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
- { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, /* ALi 1563 integrated ethernet */
+ { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */
+ { 0x10b9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */
{ 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
{ } /* terminate list */
};
@@ -515,7 +521,7 @@ static void tulip_tx_timeout(struct net_device *dev)
dev->name);
} else if (tp->chip_id == DC21140 || tp->chip_id == DC21142
|| tp->chip_id == MX98713 || tp->chip_id == COMPEX9881
- || tp->chip_id == DM910X) {
+ || tp->chip_id == DM910X || tp->chip_id == ULI526X) {
printk(KERN_WARNING "%s: 21140 transmit timed out, status %8.8x, "
"SIA %8.8x %8.8x %8.8x %8.8x, resetting...\n",
dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12),
@@ -1216,6 +1222,22 @@ out:
}
#endif
+/*
+ * Chips that have the MRM/reserved bit quirk and the burst quirk. That
+ * is the DM910X and the on chip ULi devices
+ */
+
+static int tulip_uli_dm_quirk(struct pci_dev *pdev)
+{
+ if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
+ return 1;
+ if (pdev->vendor == 0x10b9 && pdev->device == 0x5261)
+ return 1;
+ if (pdev->vendor == 0x10b9 && pdev->device == 0x5263)
+ return 1;
+ return 0;
+}
+
static int __devinit tulip_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1304,17 +1326,12 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
csr0 &= ~0xfff10000; /* zero reserved bits 31:20, 16 */
/* DM9102A has troubles with MRM & clear reserved bits 24:22, 20, 16, 7:1 */
- if ((pdev->vendor == 0x1282 && pdev->device == 0x9102)
- || (pdev->vendor == 0x10b9 && pdev->device == 0x5261))
+ if (tulip_uli_dm_quirk(pdev)) {
csr0 &= ~0x01f100ff;
-
#if defined(__sparc__)
- /* DM9102A needs 32-dword alignment/burst length on sparc - chip bug? */
- if ((pdev->vendor == 0x1282 && pdev->device == 0x9102)
- || (pdev->vendor == 0x10b9 && pdev->device == 0x5261))
csr0 = (csr0 & ~0xff00) | 0xe000;
#endif
-
+ }
/*
* And back to business
*/
@@ -1659,6 +1676,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
switch (chip_idx) {
case DC21140:
case DM910X:
+ case ULI526X:
default:
if (tp->mtable)
iowrite32(tp->mtable->csr12dir | 0x100, ioaddr + CSR12);
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index f22aab52ca1be..57d33df3f0dca 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -146,12 +146,12 @@ MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(multicast_filter_limit, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+module_param(max_interrupt_work, int, 0);
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param(multicast_filter_limit, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(max_interrupt_work, "winbond-840 maximum events handled per interrupt");
MODULE_PARM_DESC(debug, "winbond-840 debug level (0-6)");
MODULE_PARM_DESC(rx_copybreak, "winbond-840 copy breakpoint for copy-only-tiny-frames");
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index 5b0647c2f44c5..32ccb26890c3c 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -33,6 +33,13 @@
/* A few user-configurable values. */
+#define xircom_debug debug
+#ifdef XIRCOM_DEBUG
+static int xircom_debug = XIRCOM_DEBUG;
+#else
+static int xircom_debug = 1;
+#endif
+
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
static int max_interrupt_work = 25;
@@ -124,19 +131,11 @@ module_param(max_interrupt_work, int, 0);
module_param(rx_copybreak, int, 0);
module_param(csr0, int, 0);
-static int num_units;
-module_param_array(options, num_units, int, 0);
-module_param_array(full_duplex, num_units, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
#define RUN_AT(x) (jiffies + (x))
-#define xircom_debug debug
-#ifdef XIRCOM_DEBUG
-static int xircom_debug = XIRCOM_DEBUG;
-#else
-static int xircom_debug = 1;
-#endif
-
/*
Theory of Operation
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d0fe0f656ea68..87a4e0008d420 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -41,6 +41,7 @@
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
+#include <linux/crc32.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -104,11 +105,42 @@ drop:
return 0;
}
-static void tun_net_mclist(struct net_device *dev)
+/** Add the specified Ethernet address to this multicast filter. */
+static void
+add_multi(u32* filter, const u8* addr)
{
- /* Nothing to do for multicast filters.
- * We always accept all frames. */
- return;
+ int bit_nr = ether_crc(ETH_ALEN, addr) >> 26;
+ filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
+}
+
+/** Remove the specified Ethernet addres from this multicast filter. */
+static void
+del_multi(u32* filter, const u8* addr)
+{
+ int bit_nr = ether_crc(ETH_ALEN, addr) >> 26;
+ filter[bit_nr >> 5] &= ~(1 << (bit_nr & 31));
+}
+
+/** Update the list of multicast groups to which the network device belongs.
+ * This list is used to filter packets being sent from the character device to
+ * the network device. */
+static void
+tun_net_mclist(struct net_device *dev)
+{
+ struct tun_struct *tun = netdev_priv(dev);
+ const struct dev_mc_list *mclist;
+ int i;
+ DBG(KERN_DEBUG "%s: tun_net_mclist: mc_count %d\n",
+ dev->name, dev->mc_count);
+ memset(tun->chr_filter, 0, sizeof tun->chr_filter);
+ for (i = 0, mclist = dev->mc_list; i < dev->mc_count && mclist != NULL;
+ i++, mclist = mclist->next) {
+ add_multi(tun->net_filter, mclist->dmi_addr);
+ DBG(KERN_DEBUG "%s: tun_net_mclist: %x:%x:%x:%x:%x:%x\n",
+ dev->name,
+ mclist->dmi_addr[0], mclist->dmi_addr[1], mclist->dmi_addr[2],
+ mclist->dmi_addr[3], mclist->dmi_addr[4], mclist->dmi_addr[5]);
+ }
}
static struct net_device_stats *tun_net_stats(struct net_device *dev)
@@ -301,6 +333,10 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
add_wait_queue(&tun->read_wait, &wait);
while (len) {
+ const u8 ones[ ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ u8 addr[ ETH_ALEN];
+ int bit_nr;
+
current->state = TASK_INTERRUPTIBLE;
/* Read frames from the queue */
@@ -320,10 +356,37 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
}
netif_start_queue(tun->dev);
- ret = tun_put_user(tun, skb, (struct iovec *) iv, len);
-
- kfree_skb(skb);
- break;
+ /** Decide whether to accept this packet. This code is designed to
+ * behave identically to an Ethernet interface. Accept the packet if
+ * - we are promiscuous.
+ * - the packet is addressed to us.
+ * - the packet is broadcast.
+ * - the packet is multicast and
+ * - we are multicast promiscous.
+ * - we belong to the multicast group.
+ */
+ memcpy(addr, skb->data, min(sizeof addr, skb->len));
+ bit_nr = ether_crc(sizeof addr, addr) >> 26;
+ if ((tun->if_flags & IFF_PROMISC) ||
+ memcmp(addr, tun->dev_addr, sizeof addr) == 0 ||
+ memcmp(addr, ones, sizeof addr) == 0 ||
+ (((addr[0] == 1 && addr[1] == 0 && addr[2] == 0x5e) ||
+ (addr[0] == 0x33 && addr[1] == 0x33)) &&
+ ((tun->if_flags & IFF_ALLMULTI) ||
+ (tun->chr_filter[bit_nr >> 5] & (1 << (bit_nr & 31)))))) {
+ DBG(KERN_DEBUG "%s: tun_chr_readv: accepted: %x:%x:%x:%x:%x:%x\n",
+ tun->dev->name, addr[0], addr[1], addr[2],
+ addr[3], addr[4], addr[5]);
+ ret = tun_put_user(tun, skb, (struct iovec *) iv, len);
+ kfree_skb(skb);
+ break;
+ } else {
+ DBG(KERN_DEBUG "%s: tun_chr_readv: rejected: %x:%x:%x:%x:%x:%x\n",
+ tun->dev->name, addr[0], addr[1], addr[2],
+ addr[3], addr[4], addr[5]);
+ kfree_skb(skb);
+ continue;
+ }
}
current->state = TASK_RUNNING;
@@ -417,6 +480,12 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
tun = netdev_priv(dev);
tun->dev = dev;
tun->flags = flags;
+ /* Be promiscuous by default to maintain previous behaviour. */
+ tun->if_flags = IFF_PROMISC;
+ /* Generate random Ethernet address. */
+ *(u16 *)tun->dev_addr = htons(0x00FF);
+ get_random_bytes(tun->dev_addr + sizeof(u16), 4);
+ memset(tun->chr_filter, 0, sizeof tun->chr_filter);
tun_net_init(dev);
@@ -457,13 +526,16 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct tun_struct *tun = file->private_data;
+ void __user* argp = (void __user*)arg;
+ struct ifreq ifr;
+
+ if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
+ if (copy_from_user(&ifr, argp, sizeof ifr))
+ return -EFAULT;
if (cmd == TUNSETIFF && !tun) {
- struct ifreq ifr;
int err;
- if (copy_from_user(&ifr, (void __user *)arg, sizeof(ifr)))
- return -EFAULT;
ifr.ifr_name[IFNAMSIZ-1] = '\0';
rtnl_lock();
@@ -473,7 +545,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
if (err)
return err;
- if (copy_to_user((void __user *)arg, &ifr, sizeof(ifr)))
+ if (copy_to_user(argp, &ifr, sizeof(ifr)))
return -EFAULT;
return 0;
}
@@ -519,6 +591,61 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
break;
#endif
+ case SIOCGIFFLAGS:
+ ifr.ifr_flags = tun->if_flags;
+ if (copy_to_user( argp, &ifr, sizeof ifr))
+ return -EFAULT;
+ return 0;
+
+ case SIOCSIFFLAGS:
+ /** Set the character device's interface flags. Currently only
+ * IFF_PROMISC and IFF_ALLMULTI are used. */
+ tun->if_flags = ifr.ifr_flags;
+ DBG(KERN_INFO "%s: interface flags 0x%lx\n",
+ tun->dev->name, tun->if_flags);
+ return 0;
+
+ case SIOCGIFHWADDR:
+ memcpy(ifr.ifr_hwaddr.sa_data, tun->dev_addr,
+ min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr));
+ if (copy_to_user( argp, &ifr, sizeof ifr))
+ return -EFAULT;
+ return 0;
+
+ case SIOCSIFHWADDR:
+ /** Set the character device's hardware address. This is used when
+ * filtering packets being sent from the network device to the character
+ * device. */
+ memcpy(tun->dev_addr, ifr.ifr_hwaddr.sa_data,
+ min(sizeof ifr.ifr_hwaddr.sa_data, sizeof tun->dev_addr));
+ DBG(KERN_DEBUG "%s: set hardware address: %x:%x:%x:%x:%x:%x\n",
+ tun->dev->name,
+ tun->dev_addr[0], tun->dev_addr[1], tun->dev_addr[2],
+ tun->dev_addr[3], tun->dev_addr[4], tun->dev_addr[5]);
+ return 0;
+
+ case SIOCADDMULTI:
+ /** Add the specified group to the character device's multicast filter
+ * list. */
+ add_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data);
+ DBG(KERN_DEBUG "%s: add multi: %x:%x:%x:%x:%x:%x\n",
+ tun->dev->name,
+ (u8)ifr.ifr_hwaddr.sa_data[0], (u8)ifr.ifr_hwaddr.sa_data[1],
+ (u8)ifr.ifr_hwaddr.sa_data[2], (u8)ifr.ifr_hwaddr.sa_data[3],
+ (u8)ifr.ifr_hwaddr.sa_data[4], (u8)ifr.ifr_hwaddr.sa_data[5]);
+ return 0;
+
+ case SIOCDELMULTI:
+ /** Remove the specified group from the character device's multicast
+ * filter list. */
+ del_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data);
+ DBG(KERN_DEBUG "%s: del multi: %x:%x:%x:%x:%x:%x\n",
+ tun->dev->name,
+ (u8)ifr.ifr_hwaddr.sa_data[0], (u8)ifr.ifr_hwaddr.sa_data[1],
+ (u8)ifr.ifr_hwaddr.sa_data[2], (u8)ifr.ifr_hwaddr.sa_data[3],
+ (u8)ifr.ifr_hwaddr.sa_data[4], (u8)ifr.ifr_hwaddr.sa_data[5]);
+ return 0;
+
default:
return -EINVAL;
};
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 4c33ad4e5dab0..04eced2181c7d 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -859,7 +859,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
#ifdef USE_MMIO
memaddr
#else
- ioaddr
+ (long)ioaddr
#endif
);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 1886fe6b982e8..c889078c315f5 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -100,8 +100,8 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver");
#define VELOCITY_PARAM(N,D) \
- static const int N[MAX_UNITS]=OPTION_DEFAULT;\
- MODULE_PARM(N, "1-" __MODULE_STRING(MAX_UNITS) "i");\
+ static int N[MAX_UNITS]=OPTION_DEFAULT;\
+ module_param_array(N, int, NULL, 0); \
MODULE_PARM_DESC(N, D);
#define RX_DESC_MIN 64
@@ -229,7 +229,7 @@ VELOCITY_PARAM(wol_opts, "Wake On Lan options");
VELOCITY_PARAM(int_works, "Number of packets per interrupt services");
static int rx_copybreak = 200;
-MODULE_PARM(rx_copybreak, "i");
+module_param(rx_copybreak, int, 0644);
MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info);
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 67cf7377e1696..7a84ca7e7c40c 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -238,11 +238,11 @@ static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, };
static struct class_simple *cosa_class;
#ifdef MODULE
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
MODULE_PARM_DESC(io, "The I/O bases of the COSA or SRP cards");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(irq, "The IRQ lines of the COSA or SRP cards");
-MODULE_PARM(dma, "1-" __MODULE_STRING(MAX_CARDS) "i");
+module_param_array(dma, int, NULL, 0);
MODULE_PARM_DESC(dma, "The DMA channels of the COSA or SRP cards");
MODULE_AUTHOR("Jan \"Yenya\" Kasprzak, <kas@fi.muni.cz>");
@@ -642,11 +642,11 @@ static void sppp_channel_init(struct channel_data *chan)
return;
}
chan->pppdev.dev = d;
- sppp_attach(&chan->pppdev);
d->base_addr = chan->cosa->datareg;
d->irq = chan->cosa->irq;
d->dma = chan->cosa->dma;
d->priv = chan;
+ sppp_attach(&chan->pppdev);
if (register_netdev(d)) {
printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
sppp_detach(d);
diff --git a/drivers/net/wan/cosa.h b/drivers/net/wan/cosa.h
index 63a8a5c42f0a5..028f3d96b9717 100644
--- a/drivers/net/wan/cosa.h
+++ b/drivers/net/wan/cosa.h
@@ -76,10 +76,16 @@ struct cosa_download {
#define COSAIOSTRT _IOW('C',0xf1, int)
/* Read the block from the device memory */
-#define COSAIORMEM _IOWR('C',0xf2, struct cosa_download)
+#define COSAIORMEM _IOWR('C',0xf2, struct cosa_download *)
+ /* actually the struct cosa_download itself; this is to keep
+ * the ioctl number same as in 2.4 in order to keep the user-space
+ * utils compatible. */
/* Write the block to the device memory (i.e. download the microcode) */
-#define COSAIODOWNLD _IOW('C',0xf2, struct cosa_download)
+#define COSAIODOWNLD _IOW('C',0xf2, struct cosa_download *)
+ /* actually the struct cosa_download itself; this is to keep
+ * the ioctl number same as in 2.4 in order to keep the user-space
+ * utils compatible. */
/* Read the device type (one of "srp", "cosa", and "cosa8" for now) */
#define COSAIORTYPE _IOR('C',0xf3, char *)
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c
index 3dadcb42a3c8b..7b48064364dc7 100644
--- a/drivers/net/wan/cycx_main.c
+++ b/drivers/net/wan/cycx_main.c
@@ -57,7 +57,7 @@ unsigned int cycx_debug;
MODULE_AUTHOR("Arnaldo Carvalho de Melo");
MODULE_DESCRIPTION("Cyclom 2X Sync Card Driver.");
MODULE_LICENSE("GPL");
-MODULE_PARM(cycx_debug, "i");
+module_param(cycx_debug, int, 0);
MODULE_PARM_DESC(cycx_debug, "cyclomx debug level");
/* Defines & Macros */
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index e998cfff9fa9b..cd2185a347908 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -125,9 +125,9 @@ static u32 dscc4_pci_config_store[16];
MODULE_AUTHOR("Maintainer: Francois Romieu <romieu@cogenit.fr>");
MODULE_DESCRIPTION("Siemens PEB20534 PCI Controler");
MODULE_LICENSE("GPL");
-MODULE_PARM(debug,"i");
+module_param(debug, int, 0);
MODULE_PARM_DESC(debug,"Enable/disable extra messages");
-MODULE_PARM(quartz,"i");
+module_param(quartz, int, 0);
MODULE_PARM_DESC(quartz,"If present, on-board quartz frequency (Hz)");
/* Structures */
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 3955bf1ad1e50..7575b799ce536 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -33,11 +33,6 @@
*/
MODULE_AUTHOR("R.J.Dunlop <bob.dunlop@farsite.co.uk>");
MODULE_DESCRIPTION("FarSync T-Series WAN driver. FarSite Communications Ltd.");
-MODULE_PARM(fst_txq_low, "i");
-MODULE_PARM(fst_txq_high, "i");
-MODULE_PARM(fst_max_reads, "i");
-MODULE_PARM(fst_excluded_cards, "i");
-MODULE_PARM(fst_excluded_list, "0-32i");
MODULE_LICENSE("GPL");
/* Driver configuration and global parameters
@@ -85,6 +80,12 @@ int fst_max_reads = 7;
int fst_excluded_cards = 0;
int fst_excluded_list[FST_MAX_CARDS];
+module_param(fst_txq_low, int, 0);
+module_param(fst_txq_high, int, 0);
+module_param(fst_max_reads, int, 0);
+module_param(fst_excluded_cards, int, 0);
+module_param_array(fst_excluded_list, int, NULL, 0);
+
/* Card shared memory layout
* =========================
*/
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index be8d583b3b7cc..7db1d1d0bb349 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -263,7 +263,7 @@ static struct sv11_device *sv11_init(int iobase, int irq)
/* We want a fast IRQ for this device. Actually we'd like an even faster
IRQ ;) - This is one driver RtLinux is made for */
- if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "Hostess SV/11", dev)<0)
+ if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "Hostess SV11", dev)<0)
{
printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq);
goto fail1;
@@ -388,11 +388,11 @@ static void sv11_shutdown(struct sv11_device *dev)
static int io=0x200;
static int irq=9;
-MODULE_PARM(io,"i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "The I/O base of the Comtrol Hostess SV11 card");
-MODULE_PARM(dma,"i");
+module_param(dma, int, 0);
MODULE_PARM_DESC(dma, "Set this to 1 to use DMA1/DMA3 for TX/RX");
-MODULE_PARM(irq,"i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(irq, "The interrupt line setting for the Comtrol Hostess SV11 card");
MODULE_AUTHOR("Alan Cox");
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 34578429d486d..da388973375d3 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1485,14 +1485,12 @@ set_multicast_list( struct net_device *dev )
#ifdef MODULE
-
-MODULE_PARM( io, "1-" __MODULE_STRING( SBNI_MAX_NUM_CARDS ) "i" );
-MODULE_PARM( irq, "1-" __MODULE_STRING( SBNI_MAX_NUM_CARDS ) "i" );
-MODULE_PARM( baud, "1-" __MODULE_STRING( SBNI_MAX_NUM_CARDS ) "i" );
-MODULE_PARM( rxl, "1-" __MODULE_STRING( SBNI_MAX_NUM_CARDS ) "i" );
-MODULE_PARM( mac, "1-" __MODULE_STRING( SBNI_MAX_NUM_CARDS ) "i" );
-
-MODULE_PARM( skip_pci_probe, "i" );
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(baud, int, NULL, 0);
+module_param_array(rxl, int, NULL, 0);
+module_param_array(mac, int, NULL, 0);
+module_param(skip_pci_probe, bool, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 3f997bf96d94f..5380ddfcd7d5a 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -431,15 +431,15 @@ static int rxdma=3;
static int irq=5;
static int slow=0;
-MODULE_PARM(io,"i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "The I/O base of the Sealevel card");
-MODULE_PARM(txdma,"i");
+module_param(txdma, int, 0);
MODULE_PARM_DESC(txdma, "Transmit DMA channel");
-MODULE_PARM(rxdma,"i");
+module_param(rxdma, int, 0);
MODULE_PARM_DESC(rxdma, "Receive DMA channel");
-MODULE_PARM(irq,"i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(irq, "The interrupt line setting for the SeaLevel card");
-MODULE_PARM(slow,"i");
+module_param(slow, bool, 0);
MODULE_PARM_DESC(slow, "Set this for an older Sealevel card such as the 4012");
MODULE_AUTHOR("Alan Cox");
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 2329c23af83e0..2678648d825c1 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -1483,6 +1483,6 @@ static void __exit sync_ppp_cleanup(void)
module_init(sync_ppp_init);
module_exit(sync_ppp_cleanup);
-MODULE_PARM(debug,"1i");
+module_param(debug, int, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 03f4331b4a22a..8c5cfcb55826b 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -39,7 +39,7 @@
static struct net_device **x25_asy_devs;
static int x25_asy_maxdev = SL_NRUNIT;
-MODULE_PARM(x25_asy_maxdev, "i");
+module_param(x25_asy_maxdev, int, 0);
MODULE_LICENSE("GPL");
static int x25_asy_esc(unsigned char *p, unsigned char *d, int len);
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index 1f7a27c38bbf3..5d2eeb0524178 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -487,10 +487,10 @@ static int irq[MAX_WD_CARDS];
static int mem[MAX_WD_CARDS];
static int mem_end[MAX_WD_CARDS]; /* for non std. mem size */
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_WD_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_WD_CARDS) "i");
-MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_WD_CARDS) "i");
-MODULE_PARM(mem_end, "1-" __MODULE_STRING(MAX_WD_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0);
+module_param_array(mem_end, int, NULL, 0);
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)");
MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)");
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index e28bd368f7152..aee87bb343842 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -246,36 +246,36 @@ MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet \
for PCMCIA when used with airo_cs.");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350");
-MODULE_PARM(io,"1-4i");
-MODULE_PARM(irq,"1-4i");
-MODULE_PARM(basic_rate,"i");
-MODULE_PARM(rates,"1-8i");
-MODULE_PARM(ssids,"1-3s");
-MODULE_PARM(auto_wep,"i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param(basic_rate, int, 0);
+module_param_array(rates, int, NULL, 0);
+module_param_array(ssids, charp, NULL, 0);
+module_param(auto_wep, int, 0);
MODULE_PARM_DESC(auto_wep, "If non-zero, the driver will keep looping through \
the authentication options until an association is made. The value of \
auto_wep is number of the wep keys to check. A value of 2 will try using \
the key at index 0 and index 1.");
-MODULE_PARM(aux_bap,"i");
+module_param(aux_bap, int, 0);
MODULE_PARM_DESC(aux_bap, "If non-zero, the driver will switch into a mode \
than seems to work better for older cards with some older buses. Before \
switching it checks that the switch is needed.");
-MODULE_PARM(maxencrypt, "i");
+module_param(maxencrypt, int, 0);
MODULE_PARM_DESC(maxencrypt, "The maximum speed that the card can do \
encryption. Units are in 512kbs. Zero (default) means there is no limit. \
Older cards used to be limited to 2mbs (4).");
-MODULE_PARM(adhoc, "i");
+module_param(adhoc, int, 0);
MODULE_PARM_DESC(adhoc, "If non-zero, the card will start in adhoc mode.");
-MODULE_PARM(probe, "i");
+module_param(probe, int, 0);
MODULE_PARM_DESC(probe, "If zero, the driver won't start the card.");
-MODULE_PARM(proc_uid, "i");
+module_param(proc_uid, int, 0);
MODULE_PARM_DESC(proc_uid, "The uid that the /proc files will belong to.");
-MODULE_PARM(proc_gid, "i");
+module_param(proc_gid, int, 0);
MODULE_PARM_DESC(proc_gid, "The gid that the /proc files will belong to.");
-MODULE_PARM(airo_perm, "i");
+module_param(airo_perm, int, 0);
MODULE_PARM_DESC(airo_perm, "The permission bits of /proc/[driver/]aironet.");
-MODULE_PARM(proc_perm, "i");
+module_param(proc_perm, int, 0);
MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc");
/* This is a kind of sloppy hack to get this information to OUT4500 and
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 6f3d7c25ab74c..939783ff11203 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -52,7 +52,7 @@
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
static char *version = "$Revision: 1.2 $";
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
#else
@@ -75,8 +75,8 @@ MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet \
with the airo module.");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
/*====================================================================*/
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c
index 4cd8102e8a947..4f304c6e693a7 100644
--- a/drivers/net/wireless/arlan-main.c
+++ b/drivers/net/wireless/arlan-main.c
@@ -39,35 +39,32 @@ static int testMemory = testMemoryUNKNOWN;
static int irq = irqUNKNOWN;
static int txScrambled = 1;
static int mdebug;
-#endif
-MODULE_PARM(irq, "i");
-MODULE_PARM(mem, "i");
-MODULE_PARM(arlan_debug, "i");
-MODULE_PARM(testMemory, "i");
-MODULE_PARM(spreadingCode, "i");
-MODULE_PARM(channelNumber, "i");
-MODULE_PARM(channelSet, "i");
-MODULE_PARM(systemId, "i");
-MODULE_PARM(registrationMode, "i");
-MODULE_PARM(radioNodeId, "i");
-MODULE_PARM(SID, "i");
-MODULE_PARM(txScrambled, "i");
-MODULE_PARM(keyStart, "i");
-MODULE_PARM(mdebug, "i");
-MODULE_PARM(tx_delay_ms, "i");
-MODULE_PARM(retries, "i");
-MODULE_PARM(async, "i");
-MODULE_PARM(tx_queue_len, "i");
-MODULE_PARM(arlan_entry_debug, "i");
-MODULE_PARM(arlan_exit_debug, "i");
-MODULE_PARM(arlan_entry_and_exit_debug, "i");
-MODULE_PARM(arlan_EEPROM_bad, "i");
+module_param(irq, int, 0);
+module_param(mdebug, int, 0);
+module_param(testMemory, int, 0);
+module_param(arlan_entry_debug, int, 0);
+module_param(arlan_exit_debug, int, 0);
+module_param(txScrambled, int, 0);
MODULE_PARM_DESC(irq, "(unused)");
-MODULE_PARM_DESC(mem, "Arlan memory address for single device probing");
-MODULE_PARM_DESC(arlan_debug, "Arlan debug enable (0-1)");
MODULE_PARM_DESC(testMemory, "(unused)");
MODULE_PARM_DESC(mdebug, "Arlan multicast debugging (0-1)");
+#endif
+
+module_param(arlan_debug, int, 0);
+module_param(spreadingCode, int, 0);
+module_param(channelNumber, int, 0);
+module_param(channelSet, int, 0);
+module_param(systemId, int, 0);
+module_param(registrationMode, int, 0);
+module_param(radioNodeId, int, 0);
+module_param(SID, int, 0);
+module_param(keyStart, int, 0);
+module_param(tx_delay_ms, int, 0);
+module_param(retries, int, 0);
+module_param(tx_queue_len, int, 0);
+module_param(arlan_EEPROM_bad, int, 0);
+MODULE_PARM_DESC(arlan_debug, "Arlan debug enable (0-1)");
MODULE_PARM_DESC(retries, "Arlan maximum packet retransmisions");
#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
MODULE_PARM_DESC(arlan_entry_debug, "Arlan driver function entry debugging");
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index b99c439aca433..8337121c9ed97 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -65,7 +65,7 @@
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
static char *version = "$Revision: 1.2 $";
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
#else
@@ -86,8 +86,8 @@ MODULE_AUTHOR("Simon Kelley");
MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
/*====================================================================*/
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index f60eb341a9af0..4936d7e3469d1 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -161,7 +161,7 @@ static const unsigned int txConfLoop = 0x01; /* Loopback mode */
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n";
@@ -195,11 +195,11 @@ static int mem_speed;
static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(domain, "i");
-MODULE_PARM(scramble_key, "i");
-MODULE_PARM(mem_speed, "i");
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(domain, int, 0);
+module_param(scramble_key, int, 0);
+module_param(mem_speed, int, 0);
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
/*====================================================================*/
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 284aabeffa283..823fa82e6b9a4 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -461,12 +461,12 @@ MODULE_LICENSE("Dual MPL/GPL");
/* Level of debugging. Used in the macros in orinoco.h */
#ifdef ORINOCO_DEBUG
int orinoco_debug = ORINOCO_DEBUG;
-MODULE_PARM(orinoco_debug, "i");
+module_param(orinoco_debug, int, 0);
EXPORT_SYMBOL(orinoco_debug);
#endif
static int suppress_linkstatus; /* = 0 */
-MODULE_PARM(suppress_linkstatus, "i");
+module_param(suppress_linkstatus, bool, 0);
/********************************************************************/
/* Compile time configuration and compatibility stuff */
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 4eb92ac6a5c6b..d7085037eb9bc 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -64,9 +64,9 @@ static int irq_list[4] = { -1 };
* don't have any CIS entry for it. This workaround it... */
static int ignore_cis_vcc; /* = 0 */
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(ignore_cis_vcc, "i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
+module_param(ignore_cis_vcc, int, 0);
/********************************************************************/
/* Magic constants */
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
index 1ae168527c749..f5fc41972f173 100644
--- a/drivers/net/wireless/prism54/islpci_dev.c
+++ b/drivers/net/wireless/prism54/islpci_dev.c
@@ -419,7 +419,7 @@ prism54_bring_down(islpci_private *priv)
* currently in progress by emptying the TX and RX queues. */
/* wait until interrupts have finished executing on other CPUs */
- prism54_synchronize_irq(priv->pdev->irq);
+ synchronize_irq(priv->pdev->irq);
reg = readl(device_base + ISL38XX_CTRL_STAT_REG);
reg &= ~(ISL38XX_CTRL_STAT_RESET | ISL38XX_CTRL_STAT_RAMBOOT);
diff --git a/drivers/net/wireless/prism54/prismcompat.h b/drivers/net/wireless/prism54/prismcompat.h
index a644eb40ffcae..55541c01752eb 100644
--- a/drivers/net/wireless/prism54/prismcompat.h
+++ b/drivers/net/wireless/prism54/prismcompat.h
@@ -34,16 +34,10 @@
#include <linux/workqueue.h>
#include <linux/compiler.h>
-#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
-#error Firmware Loading is not configured in the kernel !
-#endif
-
#ifndef __iomem
#define __iomem
#endif
-#define prism54_synchronize_irq(irq) synchronize_irq(irq)
-
#define PRISM_FW_PDEV &priv->pdev->dev
#endif /* _PRISM_COMPAT_H */
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index ef89c15f876d6..7ba64e3c87571 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -84,7 +84,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */
#ifdef PCMCIA_DEBUG
static int ray_debug;
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */
#define DEBUG(n, args...) if (pc_debug>(n)) printk(args);
#else
@@ -222,18 +222,18 @@ MODULE_AUTHOR("Corey Thomas <corey@world.std.com>");
MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(irq_mask,"i");
-MODULE_PARM(net_type,"i");
-MODULE_PARM(hop_dwell,"i");
-MODULE_PARM(beacon_period,"i");
-MODULE_PARM(psm,"i");
-MODULE_PARM(essid,"s");
-MODULE_PARM(translate,"i");
-MODULE_PARM(country,"i");
-MODULE_PARM(sniffer,"i");
-MODULE_PARM(bc,"i");
-MODULE_PARM(phy_addr,"s");
-MODULE_PARM(ray_mem_speed, "i");
+module_param(irq_mask, ulong, 0);
+module_param(net_type, int, 0);
+module_param(hop_dwell, int, 0);
+module_param(beacon_period, int, 0);
+module_param(psm, int, 0);
+module_param(essid, charp, 0);
+module_param(translate, int, 0);
+module_param(country, int, 0);
+module_param(sniffer, int, 0);
+module_param(bc, int, 0);
+module_param(phy_addr, charp, 0);
+module_param(ray_mem_speed, int, 0);
static UCHAR b5_default_startup_parms[] = {
0, 0, /* Adhoc station */
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index 2562c1deb6e87..7a5e20a17890c 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -4344,7 +4344,8 @@ int init_module(void)
struct net_device *dev = alloc_etherdev(sizeof(net_local));
if (!dev)
break;
- memcpy(dev->name, name[i], IFNAMSIZ); /* Copy name */
+ if (name[i])
+ strcpy(dev->name, name[i]); /* Copy name */
dev->base_addr = io[i];
dev->irq = irq[i];
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h
index 475add67f5bf7..509ff22a6caa6 100644
--- a/drivers/net/wireless/wavelan.p.h
+++ b/drivers/net/wireless/wavelan.p.h
@@ -703,10 +703,11 @@ static unsigned short iobase[] =
/* Parameters set by insmod */
static int io[4];
static int irq[4];
-static char name[4][IFNAMSIZ];
-MODULE_PARM(io, "1-4i");
-MODULE_PARM(irq, "1-4i");
-MODULE_PARM(name, "1-4c" __MODULE_STRING(IFNAMSIZ));
+static char *name[4];
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(name, charp, NULL, 0);
+
MODULE_PARM_DESC(io, "WaveLAN I/O base address(es),required");
MODULE_PARM_DESC(irq, "WaveLAN IRQ number(s)");
MODULE_PARM_DESC(name, "WaveLAN interface neme(s)");
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 53577999de43a..17fcd84c1a14a 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -952,7 +952,7 @@ wv_diag(struct net_device * dev)
OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED))
ret = TRUE;
-#ifdef DEBUG_CONFIG_ERROR
+#ifdef DEBUG_CONFIG_ERRORS
printk(KERN_INFO "wavelan_cs: i82593 Self Test failed!\n");
#endif
return(ret);
@@ -3465,7 +3465,7 @@ wv_ru_stop(struct net_device * dev)
/* If there was a problem */
if(spin <= 0)
{
-#ifdef DEBUG_CONFIG_ERROR
+#ifdef DEBUG_CONFIG_ERRORS
printk(KERN_INFO "%s: wv_ru_stop(): The chip doesn't want to stop...\n",
dev->name);
#endif
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 6e2ea3f711620..ddb8aed7f5326 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -804,14 +804,14 @@ static int irq_list[4] = { -1 };
static int mem_speed = 0;
/* New module interface */
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(mem_speed, "i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
+module_param(mem_speed, int, 0);
#ifdef WAVELAN_ROAMING /* Conditional compile, see above in options */
/* Enable roaming mode ? No ! Please keep this to 0 */
static int do_roaming = 0;
-MODULE_PARM(do_roaming, "i");
+module_param(do_roaming, bool, 0);
#endif /* WAVELAN_ROAMING */
MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index ffd8d7da2f1e0..58b101389ffa5 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -79,7 +79,7 @@
#define PCMCIA_DEBUG 0
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define dprintk(n, format, args...) \
{ if (pc_debug > (n)) \
printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##args); }
@@ -2279,8 +2279,8 @@ static void __exit wl3501_exit_module(void)
module_init(wl3501_init_module);
module_exit(wl3501_exit_module);
-MODULE_PARM(wl3501_irq_mask, "i");
-MODULE_PARM(wl3501_irq_list, "1-4i");
+module_param(wl3501_irq_mask, int, 0);
+module_param_array(wl3501_irq_list, int, NULL, 0);
MODULE_AUTHOR("Fox Chen <mhchen@golf.ccl.itri.org.tw>, "
"Arnaldo Carvalho de Melo <acme@conectiva.com.br>,"
"Gustavo Niemeyer <niemeyer@conectiva.com>");
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 9c2d0752ab904..9da925430109c 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -140,13 +140,13 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(max_interrupt_work, "i");
-MODULE_PARM(mtu, "i");
-MODULE_PARM(debug, "i");
-MODULE_PARM(rx_copybreak, "i");
-MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
-MODULE_PARM(gx_fix, "i");
+module_param(max_interrupt_work, int, 0);
+module_param(mtu, int, 0);
+module_param(debug, int, 0);
+module_param(rx_copybreak, int, 0);
+module_param_array(options, int, NULL, 0);
+module_param_array(full_duplex, int, NULL, 0);
+module_param(gx_fix, int, 0);
MODULE_PARM_DESC(max_interrupt_work, "G-NIC maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "G-NIC MTU (all boards)");
MODULE_PARM_DESC(debug, "G-NIC debug level (0-7)");
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index 20b26912d6066..3ac047bc727d0 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -113,7 +113,7 @@ static char version[] __initdata = "znet.c:v1.02 9/23/94 becker@scyld.com\n";
#define ZNET_DEBUG 1
#endif
static unsigned int znet_debug = ZNET_DEBUG;
-MODULE_PARM (znet_debug, "i");
+module_param (znet_debug, int, 0);
MODULE_PARM_DESC (znet_debug, "ZNet debug level");
MODULE_LICENSE("GPL");
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 2abfb37e8dd1e..59ac78146d2ef 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -62,7 +62,7 @@ static int task_exit_notify(struct notifier_block * self, unsigned long val, voi
/* To avoid latency problems, we only process the current CPU,
* hoping that most samples for the task are on this CPU
*/
- sync_buffer(smp_processor_id());
+ sync_buffer(_smp_processor_id());
return 0;
}
@@ -86,7 +86,7 @@ static int munmap_notify(struct notifier_block * self, unsigned long val, void *
/* To avoid latency problems, we only process the current CPU,
* hoping that most samples for the task are on this CPU
*/
- sync_buffer(smp_processor_id());
+ sync_buffer(_smp_processor_id());
return 0;
}
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index eddb789837bda..58706683b886d 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -64,12 +64,12 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("PCMCIA parallel port card driver");
MODULE_LICENSE("Dual MPL/GPL");
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
/* Bit map of interrupts to choose from */
INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
INT_MODULE_PARM(epp_mode, 1);
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index eb429cf57dea4..9d1570d392af6 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -193,6 +193,7 @@ static int change_mode(struct parport *p, int m)
#ifdef CONFIG_PARPORT_1284
/* Find FIFO lossage; FIFO is reset */
+#if 0
static int get_fifo_residue (struct parport *p)
{
int residue;
@@ -233,6 +234,7 @@ static int get_fifo_residue (struct parport *p)
DPRINTK (KERN_DEBUG "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n", inb (ECONTROL (p)));
return residue;
}
+#endif /* 0 */
#endif /* IEEE 1284 support */
#endif /* FIFO support */
@@ -273,7 +275,7 @@ static irqreturn_t parport_pc_interrupt(int irq, void *dev_id, struct pt_regs *r
return IRQ_HANDLED;
}
-void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
+static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
{
s->u.pc.ctr = 0xc;
if (dev->irq_func &&
@@ -285,7 +287,7 @@ void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
* D.Gruszka VScom */
}
-void parport_pc_save_state(struct parport *p, struct parport_state *s)
+static void parport_pc_save_state(struct parport *p, struct parport_state *s)
{
const struct parport_pc_private *priv = p->physport->private_data;
s->u.pc.ctr = priv->ctr;
@@ -293,7 +295,7 @@ void parport_pc_save_state(struct parport *p, struct parport_state *s)
s->u.pc.ecr = inb (ECONTROL (p));
}
-void parport_pc_restore_state(struct parport *p, struct parport_state *s)
+static void parport_pc_restore_state(struct parport *p, struct parport_state *s)
{
struct parport_pc_private *priv = p->physport->private_data;
register unsigned char c = s->u.pc.ctr & priv->ctr_writable;
@@ -732,9 +734,9 @@ dump_parport_state ("leave fifo_write_block_dma", port);
}
/* Parallel Port FIFO mode (ECP chipsets) */
-size_t parport_pc_compat_write_block_pio (struct parport *port,
- const void *buf, size_t length,
- int flags)
+static size_t parport_pc_compat_write_block_pio (struct parport *port,
+ const void *buf, size_t length,
+ int flags)
{
size_t written;
int r;
@@ -809,9 +811,9 @@ size_t parport_pc_compat_write_block_pio (struct parport *port,
/* ECP */
#ifdef CONFIG_PARPORT_1284
-size_t parport_pc_ecp_write_block_pio (struct parport *port,
- const void *buf, size_t length,
- int flags)
+static size_t parport_pc_ecp_write_block_pio (struct parport *port,
+ const void *buf, size_t length,
+ int flags)
{
size_t written;
int r;
@@ -924,8 +926,10 @@ size_t parport_pc_ecp_write_block_pio (struct parport *port,
return written;
}
-size_t parport_pc_ecp_read_block_pio (struct parport *port,
- void *buf, size_t length, int flags)
+#if 0
+static size_t parport_pc_ecp_read_block_pio (struct parport *port,
+ void *buf, size_t length,
+ int flags)
{
size_t left = length;
size_t fifofull;
@@ -1143,7 +1147,7 @@ out_no_data:
dump_parport_state ("fwd idle", port);
return length - left;
}
-
+#endif /* 0 */
#endif /* IEEE 1284 support */
#endif /* Allowed to use FIFO/DMA */
@@ -1156,7 +1160,7 @@ dump_parport_state ("fwd idle", port);
/* GCC is not inlining extern inline function later overwriten to non-inline,
so we use outlined_ variants here. */
-struct parport_operations parport_pc_ops =
+static struct parport_operations parport_pc_ops =
{
.write_data = parport_pc_write_data,
.read_data = parport_pc_read_data,
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 5bce27150b1a9..76dcb24e2fa40 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -306,7 +306,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
tmp->ops = ops;
tmp->physport = tmp;
memset (tmp->probe_info, 0, 5 * sizeof (struct parport_device_info));
- tmp->cad_lock = RW_LOCK_UNLOCKED;
+ rwlock_init(&tmp->cad_lock);
spin_lock_init(&tmp->waitlist_lock);
spin_lock_init(&tmp->pardevice_lock);
tmp->ieee1284.mode = IEEE1284_MODE_COMPAT;
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 002c91fff205f..9e81bdedca5a2 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -25,6 +25,7 @@
#include <linux/pci.h>
#include <asm/pci-bridge.h>
#include <asm/rtas.h>
+#include <asm/machdep.h>
#include "../pci.h" /* for pci_add_new_bus */
#include "rpaphp.h"
@@ -168,6 +169,9 @@ rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
if (list_empty(&dev->global_list)) {
int i;
+ /* Need to setup IOMMU tables */
+ ppc_md.iommu_dev_setup(dev);
+
if(fix_bus)
pcibios_fixup_device_resources(dev, bus);
pci_read_irq_line(dev);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8eb14375eddcd..288645ab8ba62 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -699,6 +699,26 @@ static void __init quirk_svwks_csb5ide(struct pci_dev *pdev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide );
+/*
+ * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same
+ */
+static void __init quirk_ide_samemode(struct pci_dev *pdev)
+{
+ u8 prog;
+
+ pci_read_config_byte(pdev, PCI_CLASS_PROG, &prog);
+
+ if (((prog & 1) && !(prog & 4)) || ((prog & 4) && !(prog & 1))) {
+ printk(KERN_INFO "PCI: IDE mode mismatch; forcing legacy mode\n");
+ prog &= ~5;
+ pdev->class &= ~5;
+ pci_write_config_byte(pdev, PCI_CLASS_PROG, prog);
+ /* need to re-assign BARs for compat mode */
+ quirk_ide_bases(pdev);
+ }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode);
+
/* This was originally an Alpha specific thing, but it really fits here.
* The i82375 PCI/EISA bridge appears as non-classified. Fix that.
*/
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 9df2b43db640b..6ec4862425951 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -58,13 +58,13 @@ int isapnp_verbose = 1; /* verbose mode */
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Generic ISA Plug & Play support");
-MODULE_PARM(isapnp_disable, "i");
+module_param(isapnp_disable, int, 0);
MODULE_PARM_DESC(isapnp_disable, "ISA Plug & Play disable");
-MODULE_PARM(isapnp_rdp, "i");
+module_param(isapnp_rdp, int, 0);
MODULE_PARM_DESC(isapnp_rdp, "ISA Plug & Play read data port");
-MODULE_PARM(isapnp_reset, "i");
+module_param(isapnp_reset, int, 0);
MODULE_PARM_DESC(isapnp_reset, "ISA Plug & Play reset all cards");
-MODULE_PARM(isapnp_verbose, "i");
+module_param(isapnp_verbose, int, 0);
MODULE_PARM_DESC(isapnp_verbose, "ISA Plug & Play verbose mode");
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c
index c2a31517b3cab..9161af9c4d14d 100644
--- a/drivers/scsi/NCR_D700.c
+++ b/drivers/scsi/NCR_D700.c
@@ -111,7 +111,7 @@ char *NCR_D700; /* command line from insmod */
MODULE_AUTHOR("James Bottomley");
MODULE_DESCRIPTION("NCR Dual700 SCSI Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(NCR_D700, "s");
+module_param(NCR_D700, charp, 0);
static __u8 __initdata id_array[2*(MCA_MAX_SLOT_NR + 1)] =
{ [0 ... 2*(MCA_MAX_SLOT_NR + 1)-1] = 7 };
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index ef4702f23f506..514caa9adc2c2 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -146,18 +146,18 @@ static char *aac_get_status_string(u32 status);
* Non dasd selection is handled entirely in aachba now
*/
-MODULE_PARM(nondasd, "i");
-MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
-MODULE_PARM(dacmode, "i");
-MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
-MODULE_PARM(commit, "i");
-MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on");
-
static int nondasd = -1;
static int dacmode = -1;
static int commit = -1;
+module_param(nondasd, int, 0);
+MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
+module_param(dacmode, int, 0);
+MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
+module_param(commit, int, 0);
+MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on");
+
/**
* aac_get_config_status - check the adapter configuration
* @common: adapter to query
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 50cb2be49e1bb..d7b8efe864010 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -353,58 +353,58 @@ MODULE_LICENSE("GPL");
#if !defined(PCMCIA)
#if defined(MODULE)
-MODULE_PARM(io, "1-2i");
-MODULE_PARM_DESC(io,"base io address of controller");
static int io[] = {0, 0};
+module_param_array(io, int, NULL, 0);
+MODULE_PARM_DESC(io,"base io address of controller");
-MODULE_PARM(irq, "1-2i");
-MODULE_PARM_DESC(irq,"interrupt for controller");
static int irq[] = {0, 0};
+module_param_array(irq, int, NULL, 0);
+MODULE_PARM_DESC(irq,"interrupt for controller");
-MODULE_PARM(scsiid, "1-2i");
-MODULE_PARM_DESC(scsiid,"scsi id of controller");
static int scsiid[] = {7, 7};
+module_param_array(scsiid, int, NULL, 0);
+MODULE_PARM_DESC(scsiid,"scsi id of controller");
-MODULE_PARM(reconnect, "1-2i");
-MODULE_PARM_DESC(reconnect,"allow targets to disconnect");
static int reconnect[] = {1, 1};
+module_param_array(reconnect, int, NULL, 0);
+MODULE_PARM_DESC(reconnect,"allow targets to disconnect");
-MODULE_PARM(parity, "1-2i");
-MODULE_PARM_DESC(parity,"use scsi parity");
static int parity[] = {1, 1};
+module_param_array(parity, int, NULL, 0);
+MODULE_PARM_DESC(parity,"use scsi parity");
-MODULE_PARM(sync, "1-2i");
-MODULE_PARM_DESC(sync,"use synchronous transfers");
static int sync[] = {1, 1};
+module_param_array(sync, int, NULL, 0);
+MODULE_PARM_DESC(sync,"use synchronous transfers");
-MODULE_PARM(delay, "1-2i");
-MODULE_PARM_DESC(delay,"scsi reset delay");
static int delay[] = {DELAY_DEFAULT, DELAY_DEFAULT};
+module_param_array(delay, int, NULL, 0);
+MODULE_PARM_DESC(delay,"scsi reset delay");
-MODULE_PARM(exttrans, "1-2i");
-MODULE_PARM_DESC(exttrans,"use extended translation");
static int exttrans[] = {0, 0};
+module_param_array(exttrans, int, NULL, 0);
+MODULE_PARM_DESC(exttrans,"use extended translation");
#if !defined(AHA152X_DEBUG)
-MODULE_PARM(aha152x, "1-8i");
-MODULE_PARM_DESC(aha152x, "parameters for first controller");
static int aha152x[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
+module_param_array(aha152x, int, NULL, 0);
+MODULE_PARM_DESC(aha152x, "parameters for first controller");
-MODULE_PARM(aha152x1, "1-8i");
-MODULE_PARM_DESC(aha152x1, "parameters for second controller");
static int aha152x1[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
+module_param_array(aha152x1, int, NULL, 0);
+MODULE_PARM_DESC(aha152x1, "parameters for second controller");
#else
-MODULE_PARM(debug, "1-2i");
-MODULE_PARM_DESC(debug, "flags for driver debugging");
static int debug[] = {DEBUG_DEFAULT, DEBUG_DEFAULT};
+module_param_array(debug, int, NULL, 0);
+MODULE_PARM_DESC(debug, "flags for driver debugging");
-MODULE_PARM(aha152x, "1-9i");
-MODULE_PARM_DESC(aha152x, "parameters for first controller");
static int aha152x[] = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
+module_param_array(aha152x, int, NULL, 0);
+MODULE_PARM_DESC(aha152x, "parameters for first controller");
-MODULE_PARM(aha152x1, "1-9i");
-MODULE_PARM_DESC(aha152x1, "parameters for second controller");
static int aha152x1[] = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
+module_param_array(aha152x1, int, NULL, 0);
+MODULE_PARM_DESC(aha152x1, "parameters for second controller");
#endif /* !defined(AHA152X_DEBUG) */
#endif /* MODULE */
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index d5130de871129..4c27a01bf1c08 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -131,8 +131,8 @@ static int setup_dmaspeed[MAXBOARDS] __initdata = { -1, -1, -1, -1 };
#if defined(MODULE)
static int isapnp = 0;
static int aha1542[] = {0x330, 11, 4, -1};
-MODULE_PARM(aha1542, "1-4i");
-MODULE_PARM(isapnp, "i");
+module_param_array(aha1542, int, NULL, 0);
+module_param(isapnp, bool, 0);
static struct isapnp_device_id id_table[] __initdata = {
{
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index af6614c2e81f5..926a585c26132 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -513,15 +513,6 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
ahci_fill_sg(qc);
}
-static inline void ahci_dma_complete (struct ata_port *ap,
- struct ata_queued_cmd *qc,
- int have_err)
-{
- /* get drive status; clear intr; complete txn */
- ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag),
- have_err ? ATA_ERR : 0);
-}
-
static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
{
void *mmio = ap->host_set->mmio_base;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index e7f688f19bcdc..fb2877c303f0f 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -407,18 +407,12 @@ uint32_t aic79xx_periodic_otag;
* Module information and settable options.
*/
static char *aic79xx = NULL;
-/*
- * Just in case someone uses commas to separate items on the insmod
- * command line, we define a dummy buffer here to avoid having insmod
- * write wild stuff into our code segment
- */
-static char dummy_buffer[60] = "Please don't trounce on me insmod!!\n";
MODULE_AUTHOR("Maintainer: Justin T. Gibbs <gibbs@scsiguy.com>");
MODULE_DESCRIPTION("Adaptec Aic790X U320 SCSI Host Bus Adapter driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(AIC79XX_DRIVER_VERSION);
-MODULE_PARM(aic79xx, "s");
+module_param(aic79xx, charp, 0);
MODULE_PARM_DESC(aic79xx,
"period delimited, options string.\n"
" verbose Enable verbose/diagnostic logging\n"
@@ -549,10 +543,6 @@ static __inline struct ahd_linux_device *
static __inline void ahd_linux_run_device_queues(struct ahd_softc *ahd);
static __inline void ahd_linux_unmap_scb(struct ahd_softc*, struct scb*);
-static __inline int ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb,
- struct ahd_dma_seg *sg,
- dma_addr_t addr, bus_size_t len);
-
static __inline void
ahd_schedule_completeq(struct ahd_softc *ahd)
{
@@ -711,28 +701,6 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
}
}
-static __inline int
-ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb,
- struct ahd_dma_seg *sg, dma_addr_t addr, bus_size_t len)
-{
- int consumed;
-
- if ((scb->sg_count + 1) > AHD_NSEG)
- panic("Too few segs for dma mapping. "
- "Increase AHD_NSEG\n");
-
- consumed = 1;
- sg->addr = ahd_htole32(addr & 0xFFFFFFFF);
- scb->platform_data->xfer_len += len;
-
- if (sizeof(dma_addr_t) > 4
- && (ahd->flags & AHD_39BIT_ADDRESSING) != 0)
- len |= (addr >> 8) & AHD_SG_HIGH_ADDR_MASK;
-
- sg->len = ahd_htole32(len);
- return (consumed);
-}
-
/******************************** Macros **************************************/
#define BUILD_SCSIID(ahd, cmd) \
((((cmd)->device->id << TID_SHIFT) & TID) | (ahd)->our_id)
@@ -861,12 +829,6 @@ ahd_linux_detect(Scsi_Host_Template *template)
*/
if (aic79xx)
aic79xx_setup(aic79xx);
- if (dummy_buffer[0] != 'P')
- printk(KERN_WARNING
-"aic79xx: Please read the file /usr/src/linux/drivers/scsi/README.aic79xx\n"
-"aic79xx: to see the proper way to specify options to the aic79xx module\n"
-"aic79xx: Specifically, don't use any commas when passing arguments to\n"
-"aic79xx: insmod or else it might trash certain memory areas.\n");
#endif
template->proc_name = "aic79xx";
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 89bfdcdd5a540..031c6aaa5ca57 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -427,12 +427,6 @@ uint32_t aic7xxx_periodic_otag;
* Module information and settable options.
*/
static char *aic7xxx = NULL;
-/*
- * Just in case someone uses commas to separate items on the insmod
- * command line, we define a dummy buffer here to avoid having insmod
- * write wild stuff into our code segment
- */
-static char dummy_buffer[60] = "Please don't trounce on me insmod!!\n";
MODULE_AUTHOR("Maintainer: Justin T. Gibbs <gibbs@scsiguy.com>");
MODULE_DESCRIPTION("Adaptec Aic77XX/78XX SCSI Host Bus Adapter driver");
@@ -850,12 +844,6 @@ ahc_linux_detect(Scsi_Host_Template *template)
*/
if (aic7xxx)
aic7xxx_setup(aic7xxx);
- if (dummy_buffer[0] != 'P')
- printk(KERN_WARNING
-"aic7xxx: Please read the file /usr/src/linux/drivers/scsi/README.aic7xxx\n"
-"aic7xxx: to see the proper way to specify options to the aic7xxx module\n"
-"aic7xxx: Specifically, don't use any commas when passing arguments to\n"
-"aic7xxx: insmod or else it might trash certain memory areas.\n");
template->proc_name = "aic7xxx";
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 075312fcc3f47..a843c080c1d87 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -409,7 +409,7 @@ static irqreturn_t do_fdomain_16x0_intr( int irq, void *dev_id,
/* Allow insmod parameters to be like LILO parameters. For example:
insmod fdomain fdomain=0x140,11 */
static char * fdomain = NULL;
-MODULE_PARM(fdomain, "s");
+module_param(fdomain, charp, 0);
static unsigned long addresses[] = {
0xc8000,
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 9c1f8cc4d5adf..ca9d5bd26ca31 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -920,13 +920,13 @@ static Scsi_Host_Template driver_template = {
#include <linux/module.h>
#include "scsi_module.c"
-MODULE_PARM(ncr_irq, "i");
-MODULE_PARM(ncr_dma, "i");
-MODULE_PARM(ncr_addr, "i");
-MODULE_PARM(ncr_5380, "i");
-MODULE_PARM(ncr_53c400, "i");
-MODULE_PARM(ncr_53c400a, "i");
-MODULE_PARM(dtc_3181e, "i");
+module_param(ncr_irq, int, 0);
+module_param(ncr_dma, int, 0);
+module_param(ncr_addr, int, 0);
+module_param(ncr_5380, int, 0);
+module_param(ncr_53c400, int, 0);
+module_param(ncr_53c400a, int, 0);
+module_param(dtc_3181e, int, 0);
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index df28e91a6721e..2442ca46aeb0f 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -676,18 +676,18 @@ static int force_dma32 = 0;
#ifdef MODULE
/* parameters for modprobe/insmod */
-MODULE_PARM(irq, "i");
-MODULE_PARM(disable, "i");
-MODULE_PARM(reserve_mode, "i");
-MODULE_PARM(reserve_list, "4-" __MODULE_STRING(MAX_RES_ARGS) "i");
-MODULE_PARM(reverse_scan, "i");
-MODULE_PARM(hdr_channel, "i");
-MODULE_PARM(max_ids, "i");
-MODULE_PARM(rescan, "i");
-MODULE_PARM(virt_ctr, "i");
-MODULE_PARM(shared_access, "i");
-MODULE_PARM(probe_eisa_isa, "i");
-MODULE_PARM(force_dma32, "i");
+module_param(irq, int, 0);
+module_param(disable, int, 0);
+module_param(reserve_mode, int, 0);
+module_param_array(reserve_list, int, NULL, 0);
+module_param(reverse_scan, int, 0);
+module_param(hdr_channel, int, 0);
+module_param(max_ids, int, 0);
+module_param(rescan, int, 0);
+module_param(virt_ctr, int, 0);
+module_param(shared_access, int, 0);
+module_param(probe_eisa_isa, int, 0);
+module_param(force_dma32, int, 0);
MODULE_AUTHOR("Achim Leubner");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index 0c87fa83472b7..a3fdead9bce99 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -451,14 +451,17 @@ static int scsi_id[IM_MAX_HOSTS] = { 7, 7, 7, 7, 7, 7, 7, 7 };
(that is kernel version 2.1.x) */
#if defined(MODULE)
static char *boot_options = NULL;
-MODULE_PARM(boot_options, "s");
-MODULE_PARM(io_port, "1-" __MODULE_STRING(IM_MAX_HOSTS) "i");
-MODULE_PARM(scsi_id, "1-" __MODULE_STRING(IM_MAX_HOSTS) "i");
+module_param(boot_options, charp, 0);
+module_param_array(io_port, int, NULL, 0);
+module_param_array(scsi_id, int, NULL, 0);
+
+#if 0 /* FIXME: No longer exist? --RR */
MODULE_PARM(display, "1i");
MODULE_PARM(adisplay, "1i");
MODULE_PARM(normal, "1i");
MODULE_PARM(ansi, "1i");
#endif
+#endif
/*counter of concurrent disk read/writes, to turn on/off disk led */
static int disk_rw_in_progress = 0;
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index f12a587024c2f..20ffcefb67481 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -301,23 +301,9 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
return ide_do_drive_cmd(drive, rq, ide_preempt);
}
-ide_startstop_t idescsi_atapi_error (ide_drive_t *drive, const char *msg, byte stat)
+static ide_startstop_t
+idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
{
- struct request *rq;
- byte err;
-
- err = ide_dump_atapi_status(drive, msg, stat);
-
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
-
- /* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, stat, err);
- return ide_stopped;
- }
-
if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */
HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
@@ -327,20 +313,9 @@ ide_startstop_t idescsi_atapi_error (ide_drive_t *drive, const char *msg, byte s
return ide_stopped;
}
-ide_startstop_t idescsi_atapi_abort (ide_drive_t *drive, const char *msg)
+static ide_startstop_t
+idescsi_atapi_abort(ide_drive_t *drive, struct request *rq)
{
- struct request *rq;
-
- if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
- return ide_stopped;
-
- /* retry only "normal" I/O: */
- if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
- rq->errors = 1;
- ide_end_drive_cmd(drive, BUSY_STAT, 0);
- return ide_stopped;
- }
-
#if IDESCSI_DEBUG_LOG
printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n",
((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number);
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index 2597da1d20e36..0bb0369efb2da 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -186,7 +186,7 @@ static char *setup_args[] = { "", "", "", "", "", "", "", "", "" };
/* filled in by 'insmod' */
static char *setup_strings;
-MODULE_PARM(setup_strings, "s");
+module_param(setup_strings, charp, 0);
static inline uchar read_3393(struct IN2000_hostdata *hostdata, uchar reg_num)
{
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index ddb60c018322b..acfead1e9f170 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -60,17 +60,17 @@
* Module parameters
*/
static int trans_mode = 0; /* default: BIOS */
-MODULE_PARM (trans_mode, "i");
+module_param (trans_mode, int, 0);
MODULE_PARM_DESC(trans_mode, "transfer mode (0: BIOS(default) 1: Async 2: Ultra20M");
#define ASYNC_MODE 1
#define ULTRA20M_MODE 2
static int auto_param = 0; /* default: ON */
-MODULE_PARM (auto_param, "i");
+module_param (auto_param, bool, 0);
MODULE_PARM_DESC(auto_param, "AutoParameter mode (0: ON(default) 1: OFF)");
static int disc_priv = 1; /* default: OFF */
-MODULE_PARM (disc_priv, "i");
+module_param (disc_priv, bool, 0);
MODULE_PARM_DESC(disc_priv, "disconnection privilege mode (0: ON 1: OFF(default))");
MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>, GOTO Masanori <gotom@debian.or.jp>");
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 0520121af9f47..c0b9e1cc20cac 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -82,14 +82,14 @@ static int synchronous = 1;
static int reset_delay = 100;
static int ext_trans = 0;
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(host_id, "i");
-MODULE_PARM(reconnect, "i");
-MODULE_PARM(parity, "i");
-MODULE_PARM(synchronous, "i");
-MODULE_PARM(reset_delay, "i");
-MODULE_PARM(ext_trans, "i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
+module_param(host_id, int, 0);
+module_param(reconnect, int, 0);
+module_param(parity, int, 0);
+module_param(synchronous, int, 0);
+module_param(reset_delay, int, 0);
+module_param(ext_trans, int, 0);
MODULE_LICENSE("Dual MPL/GPL");
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 59aca6b423409..c841137e73a97 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -63,13 +63,13 @@ MODULE_LICENSE("Dual MPL/GPL");
/* Bit map of interrupts to choose from */
static int irq_mask = 0xdeb8;
-MODULE_PARM(irq_mask, "i");
+module_param(irq_mask, int, 0);
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
+module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)";
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 93161b01b5284..0d0bbd26a5f25 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -73,20 +73,20 @@ MODULE_LICENSE("GPL");
/* Parameters that can be set with 'insmod' */
static unsigned int irq_mask = 0xffff;
-MODULE_PARM (irq_mask, "i");
+module_param(irq_mask, int, 0);
MODULE_PARM_DESC(irq_mask, "IRQ mask bits (default: 0xffff)");
static int irq_list[4] = { -1 };
-MODULE_PARM (irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0);
MODULE_PARM_DESC(irq_list, "Use specified IRQ number. (default: auto select)");
static int nsp_burst_mode = BURST_MEM32;
-MODULE_PARM (nsp_burst_mode, "i");
+module_param(nsp_burst_mode, int, 0);
MODULE_PARM_DESC(nsp_burst_mode, "Burst transfer mode (0=io8, 1=io32, 2=mem32(default))");
/* Release IO ports after configuration? */
static int free_ports = 0;
-MODULE_PARM (free_ports, "i");
+module_param(free_ports, bool, 0);
MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 (=no))");
/* /usr/src/linux/drivers/scsi/hosts.h */
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index abb755f94a5f5..584b513140415 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -99,8 +99,8 @@ static Scsi_Host_Template qlogicfas_driver_template = {
static unsigned int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_mask, "i");
-MODULE_PARM(irq_list, "1-4i");
+module_param(irq_mask, int, 0);
+module_param_array(irq_list, int, NULL, 0);
/*====================================================================*/
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
index 03dbd6707564b..a1adb38f69bb7 100644
--- a/drivers/scsi/qlogicfas.c
+++ b/drivers/scsi/qlogicfas.c
@@ -137,8 +137,8 @@ err:
static struct qlogicfas408_priv *cards;
static int iobase[MAX_QLOGICFAS];
static int irq[MAX_QLOGICFAS] = { [0 ... MAX_QLOGICFAS-1] = -1 };
-MODULE_PARM(iobase, "1-" __MODULE_STRING(MAX_QLOGICFAS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_QLOGICFAS) "i");
+module_param_array(iobase, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
MODULE_PARM_DESC(iobase, "I/O address");
MODULE_PARM_DESC(irq, "IRQ");
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
index 3e684c2ad5504..add007a81e0e6 100644
--- a/drivers/scsi/sim710.c
+++ b/drivers/scsi/sim710.c
@@ -53,7 +53,7 @@ MODULE_AUTHOR("Richard Hirst");
MODULE_DESCRIPTION("Simple NCR53C710 driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(sim710, "s");
+module_param(sim710, charp, 0);
#ifdef MODULE
#define ARG_SEP ' '
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index dc9d740da8b05..21cfabb7783b8 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -59,9 +59,6 @@
#include "sr.h"
-MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */
-
-
#define SR_DISKS 256
#define MAX_RETRIES 3
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index 462b791679c02..3471be05779a5 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -29,6 +29,9 @@
* It is off by default and can be turned on with this module parameter */
static int xa_test = 0;
+module_param(xa_test, int, S_IRUGO | S_IWUSR);
+
+
#define IOCTL_RETRIES 3
/* ATAPI drives don't have a SCMD_PLAYAUDIO_TI command. When these drives
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index 63b647fcc75ed..990df76165180 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -1656,7 +1656,6 @@ static int __init icom_init(void)
int ret;
spin_lock_init(&icom_lock);
- icom_lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
ret = uart_register_driver(&icom_uart_driver);
if (ret)
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 3feba05b4e2f7..900f7bb51de92 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -640,7 +640,7 @@ mpc52xx_console_setup(struct console *co, char *options)
/* Basic port init. Needed since we use some uart_??? func before
* real init for early access */
- port->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&port->lock);
port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
port->ops = &mpc52xx_uart_ops;
port->mapbase = MPC52xx_PSCx(co->index);
@@ -724,7 +724,7 @@ mpc52xx_uart_probe(struct ocp_device *ocp)
port = &mpc52xx_uart_ports[idx];
/* Init the port structure */
- port->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&port->lock);
port->mapbase = ocp->def->paddr;
port->irq = ocp->def->irq;
port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 92e69e24df9c2..57aa612b5d357 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -853,7 +853,7 @@ static int __init sn_sal_module_init(void)
return -ENODEV;
}
- sal_console_port.sc_port.lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sal_console_port.sc_port.lock);
/* Setup the port struct with the minimum needed */
sal_console_port.sc_port.membase = (char *)1; /* just needs to be non-zero */
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 59a6515e760f5..210b0b16345ef 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -285,7 +285,7 @@ static int ixjdebug;
static int hertz = HZ;
static int samplerate = 100;
-MODULE_PARM(ixjdebug, "i");
+module_param(ixjdebug, int, 0);
/************************************************************************
*
@@ -406,14 +406,10 @@ static int Stub(IXJ * J, unsigned long arg)
return 0;
}
-static IXJ_REGFUNC ixj_DownloadG729 = &Stub;
-static IXJ_REGFUNC ixj_DownloadTS85 = &Stub;
static IXJ_REGFUNC ixj_PreRead = &Stub;
static IXJ_REGFUNC ixj_PostRead = &Stub;
static IXJ_REGFUNC ixj_PreWrite = &Stub;
static IXJ_REGFUNC ixj_PostWrite = &Stub;
-static IXJ_REGFUNC ixj_PreIoctl = &Stub;
-static IXJ_REGFUNC ixj_PostIoctl = &Stub;
static void ixj_read_frame(IXJ *j);
static void ixj_write_frame(IXJ *j);
@@ -792,97 +788,6 @@ static int ixj_wink(IXJ *j)
return 0;
}
-static int ixj_register(int index, IXJ_REGFUNC regfunc)
-{
- int cnt;
- int retval = 0;
- switch (index) {
- case G729LOADER:
- ixj_DownloadG729 = regfunc;
- for (cnt = 0; cnt < IXJMAX; cnt++) {
- IXJ *j = get_ixj(cnt);
- while(test_and_set_bit(cnt, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
- ixj_DownloadG729(j, 0L);
- clear_bit(cnt, &j->busyflags);
- }
- break;
- case TS85LOADER:
- ixj_DownloadTS85 = regfunc;
- for (cnt = 0; cnt < IXJMAX; cnt++) {
- IXJ *j = get_ixj(cnt);
- while(test_and_set_bit(cnt, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
- ixj_DownloadTS85(j, 0L);
- clear_bit(cnt, &j->busyflags);
- }
- break;
- case PRE_READ:
- ixj_PreRead = regfunc;
- break;
- case POST_READ:
- ixj_PostRead = regfunc;
- break;
- case PRE_WRITE:
- ixj_PreWrite = regfunc;
- break;
- case POST_WRITE:
- ixj_PostWrite = regfunc;
- break;
- case PRE_IOCTL:
- ixj_PreIoctl = regfunc;
- break;
- case POST_IOCTL:
- ixj_PostIoctl = regfunc;
- break;
- default:
- retval = 1;
- }
- return retval;
-}
-
-EXPORT_SYMBOL(ixj_register);
-
-static int ixj_unregister(int index)
-{
- int retval = 0;
- switch (index) {
- case G729LOADER:
- ixj_DownloadG729 = &Stub;
- break;
- case TS85LOADER:
- ixj_DownloadTS85 = &Stub;
- break;
- case PRE_READ:
- ixj_PreRead = &Stub;
- break;
- case POST_READ:
- ixj_PostRead = &Stub;
- break;
- case PRE_WRITE:
- ixj_PreWrite = &Stub;
- break;
- case POST_WRITE:
- ixj_PostWrite = &Stub;
- break;
- case PRE_IOCTL:
- ixj_PreIoctl = &Stub;
- break;
- case POST_IOCTL:
- ixj_PostIoctl = &Stub;
- break;
- default:
- retval = 1;
- }
- return retval;
-}
-
-EXPORT_SYMBOL(ixj_unregister);
-
static void ixj_init_timer(IXJ *j)
{
init_timer(&j->timer);
@@ -2257,7 +2162,7 @@ static int ixj_open(struct phone_device *p, struct file *file_p)
return 0;
}
-int ixj_release(struct inode *inode, struct file *file_p)
+static int ixj_release(struct inode *inode, struct file *file_p)
{
IXJ_TONE ti;
int cnt;
@@ -6785,7 +6690,7 @@ static int ixj_fasync(int fd, struct file *file_p, int mode)
return fasync_helper(fd, file_p, mode, &j->async_queue);
}
-struct file_operations ixj_fops =
+static struct file_operations ixj_fops =
{
.owner = THIS_MODULE,
.read = ixj_enhanced_read,
@@ -7707,8 +7612,8 @@ static int xio[IXJMAX + 1] =
0,
};
-MODULE_PARM(dspio, "1-" __MODULE_STRING(IXJMAX) "i");
-MODULE_PARM(xio, "1-" __MODULE_STRING(IXJMAX) "i");
+module_param_array(dspio, int, NULL, 0);
+module_param_array(xio, int, NULL, 0);
MODULE_DESCRIPTION("Quicknet VoIP Telephony card module - www.quicknet.net");
MODULE_AUTHOR("Ed Okerson <eokerson@quicknet.net>");
MODULE_LICENSE("GPL");
@@ -7735,7 +7640,7 @@ static IXJ *new_ixj(unsigned long port)
return res;
}
-int __init ixj_probe_isapnp(int *cnt)
+static int __init ixj_probe_isapnp(int *cnt)
{
int probe = 0;
int func = 0x110;
@@ -7815,7 +7720,7 @@ int __init ixj_probe_isapnp(int *cnt)
return probe;
}
-int __init ixj_probe_isa(int *cnt)
+static int __init ixj_probe_isa(int *cnt)
{
int i, probe;
@@ -7839,7 +7744,7 @@ int __init ixj_probe_isa(int *cnt)
return 0;
}
-int __init ixj_probe_pci(int *cnt)
+static int __init ixj_probe_pci(int *cnt)
{
struct pci_dev *pci = NULL;
int i, probe = 0;
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 2ef83c117bcdd..837e450385a03 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -1298,7 +1298,7 @@ struct gl_header {
struct gl_packet packets;
};
-#ifdef GENLINK_ACK
+#ifdef GENELINK_ACK
// FIXME: this code is incomplete, not debugged; it doesn't
// handle interrupts correctly. interrupts should be generic
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index d6af37b7a68fb..acdba0c67fb8c 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -16,6 +16,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/mm.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/ioport.h>
@@ -300,6 +301,22 @@ static int clcdfb_blank(int blank_mode, struct fb_info *info)
return 0;
}
+static int clcdfb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma)
+{
+ struct clcd_fb *fb = to_clcd(info);
+ unsigned long len, off = vma->vm_pgoff << PAGE_SHIFT;
+ int ret = -EINVAL;
+
+ len = info->fix.smem_len;
+
+ if (off <= len && vma->vm_end - vma->vm_start <= len - off &&
+ fb->board->mmap)
+ ret = fb->board->mmap(fb, vma);
+
+ return ret;
+}
+
static struct fb_ops clcdfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = clcdfb_check_var,
@@ -310,6 +327,7 @@ static struct fb_ops clcdfb_ops = {
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = soft_cursor,
+ .fb_mmap = clcdfb_mmap,
};
static int clcdfb_register(struct clcd_fb *fb)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 6dbeb18946b9c..c490b33d7804c 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -64,7 +64,6 @@ static unsigned int mda_gfx_port; /* Graphics control port */
/* current hardware state */
-static int mda_origin_loc=-1;
static int mda_cursor_loc=-1;
static int mda_cursor_size_from=-1;
static int mda_cursor_size_to=-1;
@@ -79,8 +78,8 @@ static int mda_last_vc = 16;
static struct vc_data *mda_display_fg = NULL;
-MODULE_PARM(mda_first_vc, "1-255i");
-MODULE_PARM(mda_last_vc, "1-255i");
+module_param(mda_first_vc, int, 0);
+module_param(mda_last_vc, int, 0);
/* MDA register values
*/
@@ -148,16 +147,6 @@ static int test_mda_b(unsigned char val, unsigned char reg)
}
#endif
-static inline void mda_set_origin(unsigned int location)
-{
- if (mda_origin_loc == location)
- return;
-
- write_mda_w(location >> 1, 0x0c);
-
- mda_origin_loc = location;
-}
-
static inline void mda_set_cursor(unsigned int location)
{
if (mda_cursor_loc == location)
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 7cf956e4a1344..836196d3517ef 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -817,7 +817,7 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
}
memset(sti, 0, sizeof(*sti));
- sti->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sti->lock);
test_rom:
/* if we can't read the ROM, bail out early. Not being able
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 61181b2d7a195..3d8388348d401 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -49,6 +49,7 @@
#include <linux/spinlock.h>
#include <linux/ioport.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <video/vga.h>
#include <asm/io.h>
@@ -763,6 +764,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
charmap += 4 * cmapsz;
#endif
+ unlock_kernel();
spin_lock_irq(&vga_lock);
/* First, the Sequencer */
vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x1);
@@ -848,6 +850,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);
}
spin_unlock_irq(&vga_lock);
+ lock_kernel();
return 0;
}
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index ebd3ea8feb3fb..c6aa0458c5b62 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -94,7 +94,7 @@ struct cfb_info {
static char default_font_storage[40];
static char *default_font = "Acorn8x8";
-MODULE_PARM(default_font, "s");
+module_param(default_font, charp, 0);
MODULE_PARM_DESC(default_font, "Default font name");
/*
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index 98b1044871768..d0d68d2194800 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -618,7 +618,7 @@ MODULE_AUTHOR("Ferenc Bakonyi (fero@drama.obuda.kando.hu)");
MODULE_DESCRIPTION("FBDev driver for Hercules Graphics Adaptor");
MODULE_LICENSE("GPL");
-MODULE_PARM(nologo, "i");
+module_param(nologo, bool, 0);
MODULE_PARM_DESC(nologo, "Disables startup logo if != 0 (default=0)");
module_init(hgafb_init);
diff --git a/drivers/video/i810/i810_accel.c b/drivers/video/i810/i810_accel.c
index 9921db8a48c7b..64cd1c827cf00 100644
--- a/drivers/video/i810/i810_accel.c
+++ b/drivers/video/i810/i810_accel.c
@@ -252,49 +252,6 @@ static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch,
end_iring(par);
}
-/**
- * mono_src_copy_blit - color expand from video memory to framebuffer
- * @dwidth: width of destination
- * @dheight: height of destination
- * @dpitch: pixels per line of the buffer
- * @qsize: size of bitmap in quad words
- * @dest: address of first byte of pixel;
- * @rop: raster operation
- * @blit_bpp: pixelformat to use which can be different from the
- * framebuffer's pixelformat
- * @src: address of image data
- * @bg: backgound color
- * @fg: forground color
- * @par: pointer to i810fb_par structure
- *
- * DESCRIPTION:
- * A color expand operation where the source data is in video memory.
- * Useful for drawing text.
- *
- * REQUIREMENT:
- * The end of a scanline must be padded to the next word.
- */
-static inline void mono_src_copy_blit(int dwidth, int dheight, int dpitch,
- int qsize, int blit_bpp, int rop,
- int dest, int src, int bg,
- int fg, struct fb_info *info)
-{
- struct i810fb_par *par = (struct i810fb_par *) info->par;
-
- if (begin_iring(info, 32 + IRING_PAD)) return;
-
- PUT_RING(BLIT | MONO_SOURCE_COPY_BLIT | 6);
- PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch | 1 << 27);
- PUT_RING(dheight << 16 | dwidth);
- PUT_RING(dest);
- PUT_RING(qsize - 1);
- PUT_RING(src);
- PUT_RING(bg);
- PUT_RING(fg);
-
- end_iring(par);
-}
-
static inline void load_front(int offset, struct fb_info *info)
{
struct i810fb_par *par = (struct i810fb_par *) info->par;
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 5cffad2c237de..0fdf9af099d33 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -2459,84 +2459,84 @@ MODULE_AUTHOR("(c) 1998-2002 Petr Vandrovec <vandrove@vc.cvut.cz>");
MODULE_DESCRIPTION("Accelerated FBDev driver for Matrox Millennium/Mystique/G100/G200/G400/G450/G550");
MODULE_LICENSE("GPL");
-MODULE_PARM(mem, "i");
+module_param(mem, int, 0);
MODULE_PARM_DESC(mem, "Size of available memory in MB, KB or B (2,4,8,12,16MB, default=autodetect)");
-MODULE_PARM(disabled, "i");
+module_param(disabled, int, 0);
MODULE_PARM_DESC(disabled, "Disabled (0 or 1=disabled) (default=0)");
-MODULE_PARM(noaccel, "i");
+module_param(noaccel, int, 0);
MODULE_PARM_DESC(noaccel, "Do not use accelerating engine (0 or 1=disabled) (default=0)");
-MODULE_PARM(nopan, "i");
+module_param(nopan, int, 0);
MODULE_PARM_DESC(nopan, "Disable pan on startup (0 or 1=disabled) (default=0)");
-MODULE_PARM(no_pci_retry, "i");
+module_param(no_pci_retry, int, 0);
MODULE_PARM_DESC(no_pci_retry, "PCI retries enabled (0 or 1=disabled) (default=0)");
-MODULE_PARM(novga, "i");
+module_param(novga, int, 0);
MODULE_PARM_DESC(novga, "VGA I/O (0x3C0-0x3DF) disabled (0 or 1=disabled) (default=0)");
-MODULE_PARM(nobios, "i");
+module_param(nobios, int, 0);
MODULE_PARM_DESC(nobios, "Disables ROM BIOS (0 or 1=disabled) (default=do not change BIOS state)");
-MODULE_PARM(noinit, "i");
+module_param(noinit, int, 0);
MODULE_PARM_DESC(noinit, "Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)");
-MODULE_PARM(memtype, "i");
+module_param(memtype, int, 0);
MODULE_PARM_DESC(memtype, "Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400)");
-MODULE_PARM(mtrr, "i");
+module_param(mtrr, int, 0);
MODULE_PARM_DESC(mtrr, "This speeds up video memory accesses (0=disabled or 1) (default=1)");
-MODULE_PARM(sgram, "i");
+module_param(sgram, int, 0);
MODULE_PARM_DESC(sgram, "Indicates that G100/G200/G400 has SGRAM memory (0=SDRAM, 1=SGRAM) (default=0)");
-MODULE_PARM(inv24, "i");
+module_param(inv24, int, 0);
MODULE_PARM_DESC(inv24, "Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)");
-MODULE_PARM(inverse, "i");
+module_param(inverse, int, 0);
MODULE_PARM_DESC(inverse, "Inverse (0 or 1) (default=0)");
#ifdef CONFIG_FB_MATROX_MULTIHEAD
-MODULE_PARM(dev, "i");
+module_param(dev, int, 0);
MODULE_PARM_DESC(dev, "Multihead support, attach to device ID (0..N) (default=all working)");
#else
-MODULE_PARM(dev, "i");
+module_param(dev, int, 0);
MODULE_PARM_DESC(dev, "Multihead support, attach to device ID (0..N) (default=first working)");
#endif
-MODULE_PARM(vesa, "i");
+module_param(vesa, int, 0);
MODULE_PARM_DESC(vesa, "Startup videomode (0x000-0x1FF) (default=0x101)");
-MODULE_PARM(xres, "i");
+module_param(xres, int, 0);
MODULE_PARM_DESC(xres, "Horizontal resolution (px), overrides xres from vesa (default=vesa)");
-MODULE_PARM(yres, "i");
+module_param(yres, int, 0);
MODULE_PARM_DESC(yres, "Vertical resolution (scans), overrides yres from vesa (default=vesa)");
-MODULE_PARM(upper, "i");
+module_param(upper, int, 0);
MODULE_PARM_DESC(upper, "Upper blank space (scans), overrides upper from vesa (default=vesa)");
-MODULE_PARM(lower, "i");
+module_param(lower, int, 0);
MODULE_PARM_DESC(lower, "Lower blank space (scans), overrides lower from vesa (default=vesa)");
-MODULE_PARM(vslen, "i");
+module_param(vslen, int, 0);
MODULE_PARM_DESC(vslen, "Vertical sync length (scans), overrides lower from vesa (default=vesa)");
-MODULE_PARM(left, "i");
+module_param(left, int, 0);
MODULE_PARM_DESC(left, "Left blank space (px), overrides left from vesa (default=vesa)");
-MODULE_PARM(right, "i");
+module_param(right, int, 0);
MODULE_PARM_DESC(right, "Right blank space (px), overrides right from vesa (default=vesa)");
-MODULE_PARM(hslen, "i");
+module_param(hslen, int, 0);
MODULE_PARM_DESC(hslen, "Horizontal sync length (px), overrides hslen from vesa (default=vesa)");
-MODULE_PARM(pixclock, "i");
+module_param(pixclock, int, 0);
MODULE_PARM_DESC(pixclock, "Pixelclock (ns), overrides pixclock from vesa (default=vesa)");
-MODULE_PARM(sync, "i");
+module_param(sync, int, 0);
MODULE_PARM_DESC(sync, "Sync polarity, overrides sync from vesa (default=vesa)");
-MODULE_PARM(depth, "i");
+module_param(depth, int, 0);
MODULE_PARM_DESC(depth, "Color depth (0=text,8,15,16,24,32) (default=vesa)");
-MODULE_PARM(maxclk, "i");
+module_param(maxclk, int, 0);
MODULE_PARM_DESC(maxclk, "Startup maximal clock, 0-999MHz, 1000-999999kHz, 1000000-INF Hz");
-MODULE_PARM(fh, "i");
+module_param(fh, int, 0);
MODULE_PARM_DESC(fh, "Startup horizontal frequency, 0-999kHz, 1000-INF Hz");
-MODULE_PARM(fv, "i");
+module_param(fv, int, 0);
MODULE_PARM_DESC(fv, "Startup vertical frequency, 0-INF Hz\n"
"You should specify \"fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock\"\n");
-MODULE_PARM(grayscale, "i");
+module_param(grayscale, int, 0);
MODULE_PARM_DESC(grayscale, "Sets display into grayscale. Works perfectly with paletized videomode (4, 8bpp), some limitations apply to 16, 24 and 32bpp videomodes (default=nograyscale)");
-MODULE_PARM(cross4MB, "i");
+module_param(cross4MB, int, 0);
MODULE_PARM_DESC(cross4MB, "Specifies that 4MB boundary can be in middle of line. (default=autodetected)");
-MODULE_PARM(dfp, "i");
+module_param(dfp, int, 0);
MODULE_PARM_DESC(dfp, "Specifies whether to use digital flat panel interface of G200/G400 (0 or 1) (default=0)");
-MODULE_PARM(dfp_type, "i");
+module_param(dfp_type, int, 0);
MODULE_PARM_DESC(dfp_type, "Specifies DFP interface type (0 to 255) (default=read from hardware)");
-MODULE_PARM(outputs, "c8");
+module_param_string(outputs, outputs, sizeof(outputs), 0);
MODULE_PARM_DESC(outputs, "Specifies which CRTC is mapped to which output (string of up to three letters, consisting of 0 (disabled), 1 (CRTC1), 2 (CRTC2)) (default=111 for Gx50, 101 for G200/G400 with DFP, and 100 for all other devices)");
#ifdef CONFIG_PPC_PMAC
-MODULE_PARM(vmode, "i");
+module_param(vmode, int, 0);
MODULE_PARM_DESC(vmode, "Specify the vmode mode number that should be used (640x480 default)");
-MODULE_PARM(cmode, "i");
+module_param(cmode, int, 0);
MODULE_PARM_DESC(cmode, "Specify the video depth that should be used (8bit default)");
#endif
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c
index 610c4aebc71ce..429047ac615a5 100644
--- a/drivers/video/matrox/matroxfb_crtc2.c
+++ b/drivers/video/matrox/matroxfb_crtc2.c
@@ -21,7 +21,7 @@
static int mem = 8192;
-MODULE_PARM(mem, "i");
+module_param(mem, int, 0);
MODULE_PARM_DESC(mem, "Memory size reserved for dualhead (default=8MB)");
/* **************************************************** */
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index 3b3f84f34cb29..f9e0dd7f1c535 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -152,11 +152,6 @@ static biosMode bios32[] = {
};
#endif
-static inline u32 read_le32(int regindex, const struct neofb_par *par)
-{
- return readl(par->neo2200 + par->cursorOff + regindex);
-}
-
static inline void write_le32(int regindex, u32 val, const struct neofb_par *par)
{
writel(val, par->neo2200 + par->cursorOff + regindex);
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index d287708146a4d..144ac3e28d73f 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -190,13 +190,6 @@ inline static void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
pm2_WR(p, index, v);
}
-inline static u32 pm2v_RDAC_RD(struct pm2fb_par* p, s32 idx)
-{
- pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
- mb();
- return pm2_RD(p, PM2VR_RD_INDEXED_DATA);
-}
-
inline static void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
{
pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index a8389c668b2e8..13057451a116f 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -394,6 +394,20 @@ static int pxafb_blank(int blank, struct fb_info *info)
return 0;
}
+static int pxafb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma)
+{
+ struct pxafb_info *fbi = (struct pxafb_info *)info;
+ unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
+
+ if (off < info->fix.smem_len) {
+ vma->vm_pgoff += 1;
+ return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
+ fbi->map_dma, fbi->map_size);
+ }
+ return -EINVAL;
+}
+
static struct fb_ops pxafb_ops = {
.owner = THIS_MODULE,
.fb_check_var = pxafb_check_var,
@@ -404,6 +418,7 @@ static struct fb_ops pxafb_ops = {
.fb_imageblit = cfb_imageblit,
.fb_blank = pxafb_blank,
.fb_cursor = soft_cursor,
+ .fb_mmap = pxafb_mmap,
};
/*
diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c
index 7b5944e1fb456..ccbc4fc7200a9 100644
--- a/drivers/video/radeonfb.c
+++ b/drivers/video/radeonfb.c
@@ -621,30 +621,6 @@ static void _radeon_engine_reset(struct radeonfb_info *rinfo)
#define radeon_engine_reset() _radeon_engine_reset(rinfo)
-static __inline__ u8 radeon_get_post_div_bitval(int post_div)
-{
- switch (post_div) {
- case 1:
- return 0x00;
- case 2:
- return 0x01;
- case 3:
- return 0x04;
- case 4:
- return 0x02;
- case 6:
- return 0x06;
- case 8:
- return 0x03;
- case 12:
- return 0x07;
- default:
- return 0x02;
- }
-}
-
-
-
static __inline__ int round_div(int num, int den)
{
return (num + (den / 2)) / den;
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 85466205814ea..04706b6d7a85b 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -152,6 +152,9 @@ static struct pci_device_id rivafb_pci_tbl[] = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+ // NF2/IGP version, GeForce 4 MX, NV18
+ { PCI_VENDOR_ID_NVIDIA, 0x01f0,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO,
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index acfe8aeb02e80..f892ee8e8695d 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -393,7 +393,7 @@ static struct sa1100fb_mach_info shannon_info __initdata = {
.left_margin = 2, .upper_margin = 0,
.right_margin = 1, .lower_margin = 0,
- .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
.lccr0 = LCCR0_Color | LCCR0_Dual | LCCR0_Pas,
.lccr3 = LCCR3_ACBsDiv(512),
@@ -814,6 +814,33 @@ static int sa1100fb_blank(int blank, struct fb_info *info)
return 0;
}
+static int sa1100fb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma)
+{
+ struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;
+ unsigned long start, len, off = vma->vm_pgoff << PAGE_SHIFT;
+
+ if (off < info->fix.smem_len) {
+ vma->vm_pgoff += 1; /* skip over the palette */
+ return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
+ fbi->map_dma, fbi->map_size);
+ }
+
+ start = info->fix.mmio_start;
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);
+
+ if ((vma->vm_end - vma->vm_start + off) > len)
+ return -EINVAL;
+
+ off += start & PAGE_MASK;
+ vma->vm_pgoff = off >> PAGE_SHIFT;
+ vma->vm_flags |= VM_IO;
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ return io_remap_page_range(vma, vma->vm_start, off,
+ vma->vm_end - vma->vm_start,
+ vma->vm_page_prot);
+}
+
static struct fb_ops sa1100fb_ops = {
.owner = THIS_MODULE,
.fb_check_var = sa1100fb_check_var,
@@ -825,6 +852,7 @@ static struct fb_ops sa1100fb_ops = {
.fb_imageblit = cfb_imageblit,
.fb_blank = sa1100fb_blank,
.fb_cursor = soft_cursor,
+ .fb_mmap = sa1100fb_mmap,
};
/*
@@ -1024,7 +1052,7 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi)
if (machine_is_shannon()) {
GPDR |= SHANNON_GPIO_DISP_EN;
GPSR |= SHANNON_GPIO_DISP_EN;
- }
+ }
DPRINTK("DBAR1 = 0x%08x\n", DBAR1);
DPRINTK("DBAR2 = 0x%08x\n", DBAR2);
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 52686d8499261..9c67b4b0b7a8f 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -1706,14 +1706,14 @@ MODULE_AUTHOR("(c) 2000,2002 Ghozlane Toumi <gtoumi@laposte.net>");
MODULE_DESCRIPTION("FBDev driver for 3dfx Voodoo Graphics and Voodoo2 based video boards");
MODULE_LICENSE("GPL");
-MODULE_PARM(mem, "i");
+module_param(mem, int, 0);
MODULE_PARM_DESC(mem, "Size of frame buffer memory in MB (1, 2, 4 MB, default=autodetect)");
-MODULE_PARM(vgapass, "i");
+module_param(vgapass, bool, 0);
MODULE_PARM_DESC(vgapass, "Enable VGA PassThrough mode (0 or 1) (default=0)");
-MODULE_PARM(clipping , "i");
+module_param(clipping, bool, 0);
MODULE_PARM_DESC(clipping, "Enable clipping (slower, safer) (0 or 1) (default=1)");
-MODULE_PARM(gfxclk , "i");
+module_param(gfxclk, int, 0);
MODULE_PARM_DESC(gfxclk, "Force graphic chip frequency in MHz. DANGEROUS. (default=auto)");
-MODULE_PARM(slowpci, "i");
+module_param(slowpci, bool, 0);
MODULE_PARM_DESC(slowpci, "Uses slow PCI settings (0 or 1) (default=0)");
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
index 6cf29b3909f90..4e509d6821289 100644
--- a/drivers/video/tdfxfb.c
+++ b/drivers/video/tdfxfb.c
@@ -210,41 +210,21 @@ static char *mode_option __initdata = NULL;
#ifdef VGA_REG_IO
static inline u8 vga_inb(struct tdfx_par *par, u32 reg) { return inb(reg); }
-static inline u16 vga_inw(struct tdfx_par *par, u32 reg) { return inw(reg); }
-static inline u16 vga_inl(struct tdfx_par *par, u32 reg) { return inl(reg); }
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) { outb(val, reg); }
-static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) { outw(val, reg); }
-static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) { outl(val, reg); }
#else
static inline u8 vga_inb(struct tdfx_par *par, u32 reg) {
return inb(par->iobase + reg - 0x300);
}
-static inline u16 vga_inw(struct tdfx_par *par, u32 reg) {
- return inw(par->iobase + reg - 0x300);
-}
-static inline u16 vga_inl(struct tdfx_par *par, u32 reg) {
- return inl(par->iobase + reg - 0x300);
-}
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) {
outb(val, par->iobase + reg - 0x300);
}
-static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) {
- outw(val, par->iobase + reg - 0x300);
-}
-static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) {
- outl(val, par->iobase + reg - 0x300);
-}
#endif
static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(par, GRA_I, idx); vga_outb(par, GRA_D, val);
}
-static inline u8 gra_inb(struct tdfx_par *par, u32 idx) {
- vga_outb(par, GRA_I, idx); return vga_inb(par, GRA_D);
-}
-
static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(par, SEQ_I, idx); vga_outb(par, SEQ_D, val);
}
@@ -270,15 +250,6 @@ static inline void att_outb(struct tdfx_par *par, u32 idx, u8 val)
vga_outb(par, ATT_IW, val);
}
-static inline u8 att_inb(struct tdfx_par *par, u32 idx)
-{
- unsigned char tmp;
-
- tmp = vga_inb(par, IS1_R);
- vga_outb(par, ATT_IW, idx);
- return vga_inb(par, ATT_IW);
-}
-
static inline void vga_disable_video(struct tdfx_par *par)
{
unsigned char s;
@@ -299,12 +270,6 @@ static inline void vga_enable_video(struct tdfx_par *par)
seq_outb(par, 0x00, 0x03);
}
-static inline void vga_disable_palette(struct tdfx_par *par)
-{
- vga_inb(par, IS1_R);
- vga_outb(par, ATT_IW, 0x00);
-}
-
static inline void vga_enable_palette(struct tdfx_par *par)
{
vga_inb(par, IS1_R);
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 15f9b59d576ae..42e18fda51dcf 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -76,16 +76,16 @@ static int memdiff;
static int nativex;
-MODULE_PARM(mode,"s");
-MODULE_PARM(bpp,"i");
-MODULE_PARM(center,"i");
-MODULE_PARM(stretch,"i");
-MODULE_PARM(noaccel,"i");
-MODULE_PARM(memsize,"i");
-MODULE_PARM(memdiff,"i");
-MODULE_PARM(nativex,"i");
-MODULE_PARM(fp,"i");
-MODULE_PARM(crt,"i");
+module_param(mode, charp, 0);
+module_param(bpp, int, 0);
+module_param(center, int, 0);
+module_param(stretch, int, 0);
+module_param(noaccel, int, 0);
+module_param(memsize, int, 0);
+module_param(memdiff, int, 0);
+module_param(nativex, int, 0);
+module_param(fp, int, 0);
+module_param(crt, int, 0);
static int chip3D;
@@ -523,13 +523,6 @@ static inline void writeAttr(int reg, unsigned char val)
t_outb(val, 0x3C0);
}
-static inline unsigned char readAttr(int reg)
-{
- readb(((struct tridentfb_par *)fb_info.par)->io_virt + CRT + 0x0A); //flip-flop to index
- t_outb(reg, 0x3C0);
- return t_inb(0x3C1);
-}
-
static inline void write3CE(int reg, unsigned char val)
{
t_outb(reg, 0x3CE);
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index c08e21b42bec0..2a2a765c63210 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -35,7 +35,7 @@
static void *videomemory;
static u_long videomemorysize = VIDEOMEMSIZE;
-MODULE_PARM(videomemorysize, "l");
+module_param(videomemorysize, ulong, 0);
static struct fb_var_screeninfo vfb_default __initdata = {
.xres = 640,
@@ -70,7 +70,7 @@ static struct fb_fix_screeninfo vfb_fix __initdata = {
};
static int vfb_enable __initdata = 0; /* disabled by default */
-MODULE_PARM(vfb_enable, "i");
+module_param(vfb_enable, bool, 0);
/*
* Interface used by the world
diff --git a/fs/Kconfig b/fs/Kconfig
index f36e155f1091d..e2661f504c5da 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1338,7 +1338,7 @@ config QNX4FS_FS
config QNX4FS_RW
bool "QNX4FS write support (DANGEROUS)"
- depends on QNX4FS_FS && EXPERIMENTAL
+ depends on QNX4FS_FS && EXPERIMENTAL && BROKEN
help
Say Y if you want to test write support for QNX4 file systems.
diff --git a/fs/afs/types.h b/fs/afs/types.h
index 27596b35dcc60..b1a2367c7587f 100644
--- a/fs/afs/types.h
+++ b/fs/afs/types.h
@@ -26,8 +26,6 @@ typedef enum {
AFSVL_BACKVOL, /* backup volume */
} __attribute__((packed)) afs_voltype_t;
-extern const char *afs_voltypes[];
-
typedef enum {
AFS_FTYPE_INVALID = 0,
AFS_FTYPE_FILE = 1,
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index 4ebdb2d50b769..0ff4b86476e39 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -24,7 +24,9 @@
#include "vlclient.h"
#include "internal.h"
-const char *afs_voltypes[] = { "R/W", "R/O", "BAK" };
+#ifdef __KDEBUG
+static const char *afs_voltypes[] = { "R/W", "R/O", "BAK" };
+#endif
#ifdef AFS_CACHING_SUPPORT
static cachefs_match_val_t afs_volume_cache_match(void *target,
diff --git a/fs/befs/debug.c b/fs/befs/debug.c
index f1ad4e00f22e5..875cc0aa318c9 100644
--- a/fs/befs/debug.c
+++ b/fs/befs/debug.c
@@ -222,6 +222,7 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
#endif //CONFIG_BEFS_DEBUG
}
+#if 0
/* unused */
void
befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
@@ -241,6 +242,7 @@ befs_dump_run(const struct super_block *sb, befs_block_run run)
#endif //CONFIG_BEFS_DEBUG
}
+#endif /* 0 */
void
befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super)
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 24194a43f32a6..acdd538485665 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -512,7 +512,9 @@ static int load_aout_library(struct file *file)
len = PAGE_ALIGN(ex.a_text + ex.a_data);
bss = ex.a_text + ex.a_data + ex.a_bss;
if (bss > len) {
+ down_write(&current->mm->mmap_sem);
error = do_brk(start_addr + len, bss - len);
+ up_write(&current->mm->mmap_sem);
retval = error;
if (error != start_addr + len)
goto out;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 66846bc438560..0ecc44fb05513 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1024,8 +1024,11 @@ static int load_elf_library(struct file *file)
len = ELF_PAGESTART(elf_phdata->p_filesz + elf_phdata->p_vaddr + ELF_MIN_ALIGN - 1);
bss = elf_phdata->p_memsz + elf_phdata->p_vaddr;
- if (bss > len)
+ if (bss > len) {
+ down_write(&current->mm->mmap_sem);
do_brk(len, bss - len);
+ up_write(&current->mm->mmap_sem);
+ }
error = 0;
out_free_ph:
@@ -1201,7 +1204,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
prstatus->pr_ppid = p->parent->pid;
prstatus->pr_pgrp = process_group(p);
prstatus->pr_sid = p->signal->session;
- if (p->pid == p->tgid) {
+ if (thread_group_leader(p)) {
/*
* This is the record for the group leader. Add in the
* cumulative times of previous dead threads. This total
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
index a7f2299cf1f2d..1f2d1ad633194 100644
--- a/fs/binfmt_em86.c
+++ b/fs/binfmt_em86.c
@@ -95,7 +95,7 @@ static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs)
return search_binary_handler(bprm, regs);
}
-struct linux_binfmt em86_format = {
+static struct linux_binfmt em86_format = {
.module = THIS_MODULE,
.load_binary = load_em86,
};
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 44d37eb61f9e6..1edbcca25a736 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -96,7 +96,7 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
return search_binary_handler(bprm,regs);
}
-struct linux_binfmt script_format = {
+static struct linux_binfmt script_format = {
.module = THIS_MODULE,
.load_binary = load_script,
};
diff --git a/fs/bio.c b/fs/bio.c
index 932266e3fd3bc..3580d5ce64dff 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -91,7 +91,7 @@ static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *id
/*
* default destructor for a bio allocated with bio_alloc()
*/
-void bio_destructor(struct bio *bio)
+static void bio_destructor(struct bio *bio)
{
const int pool_idx = BIO_POOL_IDX(bio);
struct biovec_pool *bp = bvec_array + pool_idx;
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 8de4890ca1ae8..b0884aa697984 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -853,8 +853,8 @@ init_cifs(void)
GlobalCurrentXid = 0;
GlobalTotalActiveXid = 0;
GlobalMaxActiveXid = 0;
- GlobalSMBSeslock = RW_LOCK_UNLOCKED;
- GlobalMid_Lock = SPIN_LOCK_UNLOCKED;
+ rwlock_init(&GlobalSMBSeslock);
+ spin_lock_init(&GlobalMid_Lock);
if(cifs_max_pending < 2) {
cifs_max_pending = 2;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 495504dd1f6ad..c79d8f707771c 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -125,7 +125,7 @@ tconInfoAlloc(void)
INIT_LIST_HEAD(&ret_buf->openFileList);
init_MUTEX(&ret_buf->tconSem);
#ifdef CONFIG_CIFS_STATS
- ret_buf->stat_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&ret_buf->stat_lock);
#endif
write_unlock(&GlobalSMBSeslock);
}
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 9051ac1736b38..f115e41d4ccaf 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -22,7 +22,6 @@
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/time.h>
-#include <linux/lp.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/fcntl.h>
diff --git a/fs/dcache.c b/fs/dcache.c
index bd8f593a3a7dc..7608c466ea1c7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -156,7 +156,7 @@ repeat:
spin_unlock(&dcache_lock);
return;
}
-
+
/*
* AV: ->d_delete() is _NOT_ allowed to block now.
*/
@@ -392,6 +392,8 @@ static void prune_dcache(int count)
struct dentry *dentry;
struct list_head *tmp;
+ cond_resched_lock(&dcache_lock);
+
tmp = dentry_unused.prev;
if (tmp == &dentry_unused)
break;
@@ -548,6 +550,13 @@ positive:
* list for prune_dcache(). We descend to the next level
* whenever the d_subdirs list is non-empty and continue
* searching.
+ *
+ * It returns zero iff there are no unused children,
+ * otherwise it returns the number of children moved to
+ * the end of the unused list. This may not be the total
+ * number of unused children, because select_parent can
+ * drop the lock and return early due to latency
+ * constraints.
*/
static int select_parent(struct dentry * parent)
{
@@ -577,6 +586,15 @@ resume:
dentry_stat.nr_unused++;
found++;
}
+
+ /*
+ * We can return to the caller if we have found some (this
+ * ensures forward progress). We'll be coming back to find
+ * the rest.
+ */
+ if (found && need_resched())
+ goto out;
+
/*
* Descend a level if the d_subdirs list is non-empty.
*/
@@ -601,6 +619,7 @@ this_parent->d_parent->d_name.name, this_parent->d_name.name, found);
#endif
goto resume;
}
+out:
spin_unlock(&dcache_lock);
return found;
}
@@ -718,7 +737,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
atomic_set(&dentry->d_count, 1);
dentry->d_flags = DCACHE_UNHASHED;
- dentry->d_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&dentry->d_lock);
dentry->d_inode = NULL;
dentry->d_parent = NULL;
dentry->d_sb = NULL;
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index db7f97d4e422d..1571c8d6c2322 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -31,7 +31,7 @@ static struct xattr_handler *devpts_xattr_handlers[] = {
NULL
};
-struct inode_operations devpts_file_inode_operations = {
+static struct inode_operations devpts_file_inode_operations = {
#ifdef CONFIG_DEVPTS_FS_XATTR
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
diff --git a/fs/exec.c b/fs/exec.c
index d201715796bf5..c401dc74226ea 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -186,6 +186,7 @@ static int count(char __user * __user * argv, int max)
argv++;
if(++i > max)
return -E2BIG;
+ cond_resched();
}
}
return i;
@@ -618,7 +619,7 @@ static inline int de_thread(struct task_struct *tsk)
* Account for the thread group leader hanging around:
*/
count = 2;
- if (current->pid == current->tgid)
+ if (thread_group_leader(current))
count = 1;
while (atomic_read(&sig->count) > count) {
sig->group_exit_task = current;
@@ -637,7 +638,7 @@ static inline int de_thread(struct task_struct *tsk)
* do is to wait for the thread group leader to become inactive,
* and to assume its PID:
*/
- if (current->pid != current->tgid) {
+ if (!thread_group_leader(current)) {
struct task_struct *leader = current->group_leader, *parent;
struct dentry *proc_dentry1, *proc_dentry2;
unsigned long exit_state, ptrace;
@@ -747,7 +748,7 @@ no_thread_group:
if (!thread_group_empty(current))
BUG();
- if (current->tgid != current->pid)
+ if (!thread_group_leader(current))
BUG();
return 0;
}
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 071237559c997..4631ae139bf7e 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -378,6 +378,11 @@ do_more:
}
jbd_lock_bh_state(bitmap_bh);
#endif
+ if (need_resched()) {
+ jbd_unlock_bh_state(bitmap_bh);
+ cond_resched();
+ jbd_lock_bh_state(bitmap_bh);
+ }
/* @@@ This prevents newly-allocated data from being
* freed and then reallocated within the same
* transaction.
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index dd237a0a5d8ca..5ad8cf0292df5 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -43,20 +43,6 @@ static int ext3_release_file (struct inode * inode, struct file * filp)
return 0;
}
-/*
- * Called when an inode is about to be opened.
- * We use this to disallow opening RW large files on 32bit systems if
- * the caller didn't specify O_LARGEFILE. On 64bit systems we force
- * on this flag in sys_open.
- */
-static int ext3_open_file (struct inode *inode, struct file *filp)
-{
- if (!(filp->f_flags & O_LARGEFILE) &&
- inode->i_size > 0x7FFFFFFFLL)
- return -EFBIG;
- return 0;
-}
-
static ssize_t
ext3_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos)
{
@@ -125,7 +111,7 @@ struct file_operations ext3_file_operations = {
.writev = generic_file_writev,
.ioctl = ext3_ioctl,
.mmap = generic_file_mmap,
- .open = ext3_open_file,
+ .open = generic_file_open,
.release = ext3_release_file,
.fsync = ext3_sync_file,
.sendfile = generic_file_sendfile,
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 825aeb6655160..54e43497235f5 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -737,6 +737,7 @@ unsigned long ext3_count_free_inodes (struct super_block * sb)
if (!gdp)
continue;
desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
+ cond_resched();
}
return desc_count;
#endif
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index c5ba3ffc2aa10..79742d824a0a3 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -610,10 +610,14 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
de = (struct ext3_dir_entry_2 *) frames[0].bh->b_data;
if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
goto errout;
+ count++;
+ }
+ if (start_hash < 2 || (start_hash ==2 && start_minor_hash==0)) {
+ de = (struct ext3_dir_entry_2 *) frames[0].bh->b_data;
de = ext3_next_entry(de);
- if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
+ if ((err = ext3_htree_store_dirent(dir_file, 2, 0, de)) != 0)
goto errout;
- count += 2;
+ count++;
}
while (1) {
@@ -671,6 +675,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size,
map_tail->hash = h.hash;
map_tail->offs = (u32) ((char *) de - base);
count++;
+ cond_resched();
}
/* XXX: do we need to check rec_len == 0 case? -Chris */
de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len));
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index d8d11de66d08e..9b654f7f29d7f 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1266,6 +1266,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
sbi->s_resuid = EXT3_DEF_RESUID;
sbi->s_resgid = EXT3_DEF_RESGID;
+ unlock_kernel();
+
blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
if (!blocksize) {
printk(KERN_ERR "EXT3-fs: unable to set blocksize\n");
@@ -1622,6 +1624,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
percpu_counter_mod(&sbi->s_dirs_counter,
ext3_count_dirs(sb));
+ lock_kernel();
return 0;
cantfind_ext3:
@@ -1646,6 +1649,7 @@ failed_mount:
out_fail:
sb->s_fs_info = NULL;
kfree(sbi);
+ lock_kernel();
return -EINVAL;
}
@@ -2170,9 +2174,11 @@ int ext3_statfs (struct super_block * sb, struct kstatfs * buf)
* block group descriptors. If the sparse superblocks
* feature is turned on, then not all groups have this.
*/
- for (i = 0; i < ngroups; i++)
+ for (i = 0; i < ngroups; i++) {
overhead += ext3_bg_has_super(sb, i) +
ext3_bg_num_gdb(sb, i);
+ cond_resched();
+ }
/*
* Every block group has an inode bitmap, a block
diff --git a/fs/file_table.c b/fs/file_table.c
index e9ce5279ef6d2..c2e4d6f33d360 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -82,7 +82,7 @@ static int old_max;
atomic_set(&f->f_count, 1);
f->f_uid = current->fsuid;
f->f_gid = current->fsgid;
- f->f_owner.lock = RW_LOCK_UNLOCKED;
+ rwlock_init(&f->f_owner.lock);
/* f->f_version: 0 */
INIT_LIST_HEAD(&f->f_list);
return f;
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 969e9b0e0afc1..26f234a0da93d 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -378,6 +378,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
list_move(&inode->i_list, &sb->s_dirty);
}
spin_unlock(&inode_lock);
+ cond_resched();
iput(inode);
spin_lock(&inode_lock);
if (wbc->nr_to_write <= 0)
diff --git a/fs/inode.c b/fs/inode.c
index 016962a47b0c6..0beebc00a6453 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -198,7 +198,6 @@ void inode_init_once(struct inode *inode)
INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC);
spin_lock_init(&inode->i_data.tree_lock);
spin_lock_init(&inode->i_data.i_mmap_lock);
- atomic_set(&inode->i_data.truncate_count, 0);
INIT_LIST_HEAD(&inode->i_data.private_list);
spin_lock_init(&inode->i_data.private_lock);
INIT_RAW_PRIO_TREE_ROOT(&inode->i_data.i_mmap);
@@ -306,6 +305,14 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
struct list_head * tmp = next;
struct inode * inode;
+ /*
+ * We can reschedule here without worrying about the list's
+ * consistency because the per-sb list of inodes must not
+ * change during umount anymore, and because iprune_sem keeps
+ * shrink_icache_memory() away.
+ */
+ cond_resched_lock(&inode_lock);
+
next = next->next;
if (tmp == head)
break;
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
index 85c874177f052..98d830401c56c 100644
--- a/fs/jbd/checkpoint.c
+++ b/fs/jbd/checkpoint.c
@@ -333,6 +333,10 @@ int log_do_checkpoint(journal_t *journal)
break;
}
retry = __flush_buffer(journal, jh, bhs, &batch_count, &drop_count);
+ if (cond_resched_lock(&journal->j_list_lock)) {
+ retry = 1;
+ break;
+ }
} while (jh != last_jh && !retry);
if (batch_count)
@@ -487,6 +491,14 @@ int __journal_clean_checkpoint_list(journal_t *journal)
/* Use trylock because of the ranknig */
if (jbd_trylock_bh_state(jh2bh(jh)))
ret += __try_to_free_cp_buf(jh);
+ /*
+ * This function only frees up some memory
+ * if possible so we dont have an obligation
+ * to finish processing. Bail out if preemption
+ * requested:
+ */
+ if (need_resched())
+ goto out;
} while (jh != last_jh);
}
} while (transaction != last_transaction);
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index 875e06ba9aba8..c5c9983e3a606 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -262,7 +262,7 @@ write_out_data:
__journal_file_buffer(jh, commit_transaction,
BJ_Locked);
jbd_unlock_bh_state(bh);
- if (need_resched()) {
+ if (lock_need_resched(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
@@ -288,7 +288,7 @@ write_out_data:
jbd_unlock_bh_state(bh);
journal_remove_journal_head(bh);
put_bh(bh);
- if (need_resched()) {
+ if (lock_need_resched(&journal->j_list_lock)) {
spin_unlock(&journal->j_list_lock);
goto write_out_data;
}
@@ -333,11 +333,7 @@ write_out_data:
jbd_unlock_bh_state(bh);
}
put_bh(bh);
- if (need_resched()) {
- spin_unlock(&journal->j_list_lock);
- cond_resched();
- spin_lock(&journal->j_list_lock);
- }
+ cond_resched_lock(&journal->j_list_lock);
}
spin_unlock(&journal->j_list_lock);
@@ -545,6 +541,8 @@ wait_for_iobuf:
wait_on_buffer(bh);
goto wait_for_iobuf;
}
+ if (cond_resched())
+ goto wait_for_iobuf;
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
@@ -599,6 +597,8 @@ wait_for_iobuf:
wait_on_buffer(bh);
goto wait_for_ctlbuf;
}
+ if (cond_resched())
+ goto wait_for_ctlbuf;
if (unlikely(!buffer_uptodate(bh)))
err = -EIO;
@@ -695,6 +695,7 @@ skip_commit: /* The journal should be unlocked by now. */
J_ASSERT(commit_transaction->t_shadow_list == NULL);
J_ASSERT(commit_transaction->t_log_list == NULL);
+restart_loop:
while (commit_transaction->t_forget) {
transaction_t *cp_transaction;
struct buffer_head *bh;
@@ -768,6 +769,8 @@ skip_commit: /* The journal should be unlocked by now. */
release_buffer_page(bh);
}
spin_unlock(&journal->j_list_lock);
+ if (cond_resched())
+ goto restart_loop;
}
/* Done with this transaction! */
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
index 4a3d494a35743..103c34e4fb280 100644
--- a/fs/jbd/recovery.c
+++ b/fs/jbd/recovery.c
@@ -354,6 +354,8 @@ static int do_one_pass(journal_t *journal,
struct buffer_head * obh;
struct buffer_head * nbh;
+ cond_resched(); /* We're under lock_kernel() */
+
/* If we already know where to stop the log traversal,
* check right now that we haven't gone past the end of
* the log. */
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index a9f08284cf2d2..6fc1bebeec1df 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -19,7 +19,7 @@
static struct rpc_clnt * nsm_create(void);
-extern struct rpc_program nsm_program;
+static struct rpc_program nsm_program;
/*
* Local NSM state
@@ -237,7 +237,7 @@ static struct rpc_version * nsm_version[] = {
static struct rpc_stat nsm_stats;
-struct rpc_program nsm_program = {
+static struct rpc_program nsm_program = {
.name = "statd",
.number = SM_PROGRAM,
.nrvers = sizeof(nsm_version)/sizeof(nsm_version[0]),
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 3195b5cb53759..d3ee09c5196eb 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -38,7 +38,7 @@
#define LOCKD_BUFSIZE (1024 + NLMSVC_XDRSIZE)
#define ALLOWED_SIGS (sigmask(SIGKILL))
-extern struct svc_program nlmsvc_program;
+static struct svc_program nlmsvc_program;
struct nlmsvc_binding * nlmsvc_ops;
EXPORT_SYMBOL(nlmsvc_ops);
@@ -476,11 +476,11 @@ static struct svc_version * nlmsvc_version[] = {
static struct svc_stat nlmsvc_stats;
#define NLM_NRVERS (sizeof(nlmsvc_version)/sizeof(nlmsvc_version[0]))
-struct svc_program nlmsvc_program = {
- .pg_prog = NLM_PROGRAM, /* program number */
- .pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
- .pg_vers = nlmsvc_version, /* version table */
- .pg_name = "lockd", /* service name */
- .pg_class = "nfsd", /* share authentication with nfsd */
- .pg_stats = &nlmsvc_stats, /* stats table */
+static struct svc_program nlmsvc_program = {
+ .pg_prog = NLM_PROGRAM, /* program number */
+ .pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
+ .pg_vers = nlmsvc_version, /* version table */
+ .pg_name = "lockd", /* service name */
+ .pg_class = "nfsd", /* share authentication with nfsd */
+ .pg_stats = &nlmsvc_stats, /* stats table */
};
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index f3fbef66ec0f9..941881de48a1f 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -102,22 +102,6 @@ decode_filename(u32 *p, char **namp, int *lenp)
}
static inline u32 *
-decode_pathname(u32 *p, char **namp, int *lenp)
-{
- char *name;
- int i;
-
- if ((p = xdr_decode_string_inplace(p, namp, lenp, NFS3_MAXPATHLEN)) != NULL) {
- for (i = 0, name = *namp; i < *lenp; i++, name++) {
- if (*name == '\0')
- return NULL;
- }
- }
-
- return p;
-}
-
-static inline u32 *
decode_sattr3(u32 *p, struct iattr *iap)
{
u32 tmp;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ca5b440d715fd..498f30290fa9b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -802,9 +802,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
clientid_t * clid = &setclientid_confirm->sc_clientid;
int status;
- status = nfserr_stale_clientid;
if (STALE_CLIENTID(clid))
- goto out;
+ return nfserr_stale_clientid;
/*
* XXX The Duplicate Request Cache (DRC) has been checked (??)
* We get here on a DRC miss.
diff --git a/fs/pipe.c b/fs/pipe.c
index 464a83fc4749c..eb7df855732ec 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -14,6 +14,8 @@
#include <linux/mount.h>
#include <linux/pipe_fs_i.h>
#include <linux/uio.h>
+#include <linux/highmem.h>
+
#include <asm/uaccess.h>
#include <asm/ioctls.h>
@@ -89,6 +91,7 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
unsigned long nr_segs, loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
+ struct pipe_inode_info *info;
int do_wakeup;
ssize_t ret;
struct iovec *iov = (struct iovec *)_iov;
@@ -102,32 +105,40 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
do_wakeup = 0;
ret = 0;
down(PIPE_SEM(*inode));
+ info = inode->i_pipe;
for (;;) {
- int size = PIPE_LEN(*inode);
- if (size) {
- char *pipebuf = PIPE_BASE(*inode) + PIPE_START(*inode);
- ssize_t chars = PIPE_MAX_RCHUNK(*inode);
+ int bufs = info->nrbufs;
+ if (bufs) {
+ int curbuf = info->curbuf;
+ struct pipe_buffer *buf = info->bufs + curbuf;
+ size_t chars = buf->len;
+ int error;
if (chars > total_len)
chars = total_len;
- if (chars > size)
- chars = size;
- if (pipe_iov_copy_to_user(iov, pipebuf, chars)) {
+ error = pipe_iov_copy_to_user(iov, kmap(buf->page) + buf->offset, chars);
+ kunmap(buf->page);
+ if (unlikely(error)) {
if (!ret) ret = -EFAULT;
break;
}
ret += chars;
-
- PIPE_START(*inode) += chars;
- PIPE_START(*inode) &= (PIPE_SIZE - 1);
- PIPE_LEN(*inode) -= chars;
+ buf->offset += chars;
+ buf->len -= chars;
+ if (!buf->len) {
+ __free_page(buf->page);
+ buf->page = NULL;
+ curbuf = (curbuf + 1) & (PIPE_BUFFERS-1);
+ info->curbuf = curbuf;
+ info->nrbufs = --bufs;
+ do_wakeup = 1;
+ }
total_len -= chars;
- do_wakeup = 1;
if (!total_len)
break; /* common path: read succeeded */
}
- if (PIPE_LEN(*inode)) /* test for cyclic buffers */
+ if (bufs) /* More to do? */
continue;
if (!PIPE_WRITERS(*inode))
break;
@@ -177,8 +188,8 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
unsigned long nr_segs, loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
+ struct pipe_inode_info *info;
ssize_t ret;
- size_t min;
int do_wakeup;
struct iovec *iov = (struct iovec *)_iov;
size_t total_len;
@@ -190,48 +201,79 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
do_wakeup = 0;
ret = 0;
- min = total_len;
- if (min > PIPE_BUF)
- min = 1;
down(PIPE_SEM(*inode));
+ info = inode->i_pipe;
+
+ /* We try to merge small writes */
+ if (info->nrbufs && total_len < PAGE_SIZE) {
+ int lastbuf = (info->curbuf + info->nrbufs - 1) & (PIPE_BUFFERS-1);
+ struct pipe_buffer *buf = info->bufs + lastbuf;
+ int offset = buf->offset + buf->len;
+ if (offset + total_len <= PAGE_SIZE) {
+ struct page *page = buf->page;
+ int error = pipe_iov_copy_from_user(offset + kmap(page), iov, total_len);
+ kunmap(page);
+ ret = error;
+ do_wakeup = 1;
+ if (error)
+ goto out;
+ buf->len += total_len;
+ ret = total_len;
+ goto out;
+ }
+
+ }
+
for (;;) {
- int free;
+ int bufs;
if (!PIPE_READERS(*inode)) {
send_sig(SIGPIPE, current, 0);
if (!ret) ret = -EPIPE;
break;
}
- free = PIPE_FREE(*inode);
- if (free >= min) {
- /* transfer data */
- ssize_t chars = PIPE_MAX_WCHUNK(*inode);
- char *pipebuf = PIPE_BASE(*inode) + PIPE_END(*inode);
+ bufs = info->nrbufs;
+ if (bufs < PIPE_BUFFERS) {
+ ssize_t chars;
+ int newbuf = (info->curbuf + bufs) & (PIPE_BUFFERS-1);
+ struct pipe_buffer *buf = info->bufs + newbuf;
+ struct page *page = alloc_page(GFP_USER);
+ int error;
+
+ if (unlikely(!page)) {
+ ret = ret ? : -ENOMEM;
+ break;
+ }
/* Always wakeup, even if the copy fails. Otherwise
* we lock up (O_NONBLOCK-)readers that sleep due to
* syscall merging.
+ * FIXME! Is this really true?
*/
do_wakeup = 1;
+ chars = PAGE_SIZE;
if (chars > total_len)
chars = total_len;
- if (chars > free)
- chars = free;
- if (pipe_iov_copy_from_user(pipebuf, iov, chars)) {
+ error = pipe_iov_copy_from_user(kmap(page), iov, chars);
+ kunmap(page);
+ if (unlikely(error)) {
if (!ret) ret = -EFAULT;
+ __free_page(page);
break;
}
ret += chars;
- PIPE_LEN(*inode) += chars;
+ /* Insert it into the buffer array */
+ buf->page = page;
+ buf->offset = 0;
+ buf->len = chars;
+ info->nrbufs = ++bufs;
+
total_len -= chars;
if (!total_len)
break;
}
- if (PIPE_FREE(*inode) && ret) {
- /* handle cyclic data buffers */
- min = 1;
+ if (bufs < PIPE_BUFFERS)
continue;
- }
if (filp->f_flags & O_NONBLOCK) {
if (!ret) ret = -EAGAIN;
break;
@@ -249,6 +291,7 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
pipe_wait(inode);
PIPE_WAITING_WRITERS(*inode)--;
}
+out:
up(PIPE_SEM(*inode));
if (do_wakeup) {
wake_up_interruptible(PIPE_WAIT(*inode));
@@ -283,9 +326,23 @@ static int
pipe_ioctl(struct inode *pino, struct file *filp,
unsigned int cmd, unsigned long arg)
{
+ struct inode *inode = filp->f_dentry->d_inode;
+ struct pipe_inode_info *info;
+ int count, buf, nrbufs;
+
switch (cmd) {
case FIONREAD:
- return put_user(PIPE_LEN(*pino), (int __user *)arg);
+ down(PIPE_SEM(*inode));
+ info = inode->i_pipe;
+ count = 0;
+ buf = info->curbuf;
+ nrbufs = info->nrbufs;
+ while (--nrbufs >= 0) {
+ count += info->bufs[buf].len;
+ buf = (buf+1) & (PIPE_BUFFERS-1);
+ }
+ up(PIPE_SEM(*inode));
+ return put_user(count, (int __user *)arg);
default:
return -EINVAL;
}
@@ -297,13 +354,16 @@ pipe_poll(struct file *filp, poll_table *wait)
{
unsigned int mask;
struct inode *inode = filp->f_dentry->d_inode;
+ struct pipe_inode_info *info = inode->i_pipe;
+ int nrbufs;
poll_wait(filp, PIPE_WAIT(*inode), wait);
/* Reading only -- no need for acquiring the semaphore. */
- mask = POLLIN | POLLRDNORM;
- if (PIPE_EMPTY(*inode))
- mask = POLLOUT | POLLWRNORM;
+ nrbufs = info->nrbufs;
+ mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0;
+ mask |= (nrbufs < PIPE_BUFFERS) ? POLLOUT | POLLWRNORM : 0;
+
if (!PIPE_WRITERS(*inode) && filp->f_version != PIPE_WCOUNTER(*inode))
mask |= POLLHUP;
if (!PIPE_READERS(*inode))
@@ -529,31 +589,37 @@ struct file_operations rdwr_pipe_fops = {
void free_pipe_info(struct inode *inode)
{
+ int i;
struct pipe_inode_info *info = inode->i_pipe;
+
inode->i_pipe = NULL;
- free_page((unsigned long)info->base);
+ for (i = 0; i < PIPE_BUFFERS; i++) {
+ struct page *page = info->bufs[i].page;
+
+ /* We'll make this a data-dependent free some day .. */
+ if (page)
+ __free_page(page);
+ }
kfree(info);
}
struct inode* pipe_new(struct inode* inode)
{
unsigned long page;
+ struct pipe_inode_info *info;
page = __get_free_page(GFP_USER);
if (!page)
return NULL;
- inode->i_pipe = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
- if (!inode->i_pipe)
+ info = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
+ if (!info)
goto fail_page;
+ memset(info, 0, sizeof(*info));
+ inode->i_pipe = info;
init_waitqueue_head(PIPE_WAIT(*inode));
- PIPE_BASE(*inode) = (char*) page;
- PIPE_START(*inode) = PIPE_LEN(*inode) = 0;
- PIPE_READERS(*inode) = PIPE_WRITERS(*inode) = 0;
- PIPE_WAITING_WRITERS(*inode) = 0;
PIPE_RCOUNTER(*inode) = PIPE_WCOUNTER(*inode) = 1;
- *PIPE_FASYNC_READERS(*inode) = *PIPE_FASYNC_WRITERS(*inode) = NULL;
return inode;
fail_page:
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index e0e72ec5b978d..1e97c99bc4e03 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -551,6 +551,11 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0)
goto out;
+
+ /* At this point there must not be any '/' characters beyond *fn */
+ if (strchr(fn, '/'))
+ goto out;
+
len = strlen(fn);
ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index f7c0cda58f82b..5cc4361de09aa 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -68,23 +68,6 @@ kclist_add(struct kcore_list *new, void *addr, size_t size)
write_unlock(&kclist_lock);
}
-struct kcore_list *
-kclist_del(void *addr)
-{
- struct kcore_list *m, **p = &kclist;
-
- write_lock(&kclist_lock);
- for (m = *p; m; p = &m->next) {
- if (m->addr == (unsigned long)addr) {
- *p = m->next;
- write_unlock(&kclist_lock);
- return m;
- }
- }
- write_unlock(&kclist_lock);
- return NULL;
-}
-
static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
{
size_t try, size;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 04420987fcbba..c7322cfefe13b 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -318,7 +318,7 @@ static struct file_operations proc_slabinfo_operations = {
.release = seq_release,
};
-int show_stat(struct seq_file *p, void *v)
+static int show_stat(struct seq_file *p, void *v)
{
int i;
unsigned long jif;
@@ -461,7 +461,7 @@ static struct seq_operations int_seq_ops = {
.show = show_interrupts
};
-int interrupts_open(struct inode *inode, struct file *filp)
+static int interrupts_open(struct inode *inode, struct file *filp)
{
return seq_open(filp, &int_seq_ops);
}
diff --git a/fs/readdir.c b/fs/readdir.c
index de97df7f5e6d8..b95ded5814714 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -287,8 +287,9 @@ asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * d
lastdirent = buf.previous;
if (lastdirent) {
typeof(lastdirent->d_off) d_off = file->f_pos;
- __put_user(d_off, &lastdirent->d_off);
error = count - buf.count;
+ if (__put_user(d_off, &lastdirent->d_off))
+ error = -EFAULT;
}
out_putf:
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 40729481b2ba6..a4e2ed544bbe5 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -405,7 +405,7 @@ void reiserfs_free_block (struct reiserfs_transaction_handle *th,
}
/* preallocated blocks don't need to be run through journal_mark_freed */
-void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,
+static void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,
struct inode *inode, b_blocknr_t block) {
RFALSE(!th->t_super, "vs-4060: trying to free block on nonexistent device");
RFALSE(is_reusable (th->t_super, block, 1) == 0, "vs-4070: can not free such block");
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 268474f468309..d1514a9b0514e 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -15,7 +15,7 @@
extern struct reiserfs_key MIN_KEY;
static int reiserfs_readdir (struct file *, void *, filldir_t);
-int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) ;
+static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) ;
struct file_operations reiserfs_dir_operations = {
.read = generic_read_dir,
@@ -24,7 +24,7 @@ struct file_operations reiserfs_dir_operations = {
.ioctl = reiserfs_ioctl,
};
-int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) {
+static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) {
struct inode *inode = dentry->d_inode;
int err;
reiserfs_write_lock(inode->i_sb);
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
index 5423bf01b1bdf..2118db2896c7c 100644
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -1382,7 +1382,7 @@ static int check_before_balancing (struct tree_balance * tb)
}
-void check_after_balance_leaf (struct tree_balance * tb)
+static void check_after_balance_leaf (struct tree_balance * tb)
{
if (tb->lnum[0]) {
if (B_FREE_SPACE (tb->L[0]) !=
@@ -1422,14 +1422,14 @@ void check_after_balance_leaf (struct tree_balance * tb)
}
-void check_leaf_level (struct tree_balance * tb)
+static void check_leaf_level (struct tree_balance * tb)
{
check_leaf (tb->L[0]);
check_leaf (tb->R[0]);
check_leaf (PATH_PLAST_BUFFER (tb->tb_path));
}
-void check_internal_levels (struct tree_balance * tb)
+static void check_internal_levels (struct tree_balance * tb)
{
int h;
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 45e5a733b5bb6..9cf2282c8ca98 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -147,7 +147,7 @@ static int reiserfs_sync_file(
/* Allocates blocks for a file to fulfil write request.
Maps all unmapped but prepared pages from the list.
Updates metadata with newly allocated blocknumbers as needed */
-int reiserfs_allocate_blocks_for_region(
+static int reiserfs_allocate_blocks_for_region(
struct reiserfs_transaction_handle *th,
struct inode *inode, /* Inode we work with */
loff_t pos, /* Writing position */
@@ -587,7 +587,7 @@ error_exit:
}
/* Unlock pages prepared by reiserfs_prepare_file_region_for_write */
-void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pages */
+static void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pages */
int num_pages /* amount of pages */) {
int i; // loop counter
@@ -602,7 +602,7 @@ void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pa
/* This function will copy data from userspace to specified pages within
supplied byte range */
-int reiserfs_copy_from_user_to_file_region(
+static int reiserfs_copy_from_user_to_file_region(
loff_t pos, /* In-file position */
int num_pages, /* Number of pages affected */
int write_bytes, /* Amount of bytes to write */
@@ -714,7 +714,7 @@ drop_write_lock:
/* Submit pages for write. This was separated from actual file copying
because we might want to allocate block numbers in-between.
This function assumes that caller will adjust file size to correct value. */
-int reiserfs_submit_file_region_for_write(
+static int reiserfs_submit_file_region_for_write(
struct reiserfs_transaction_handle *th,
struct inode *inode,
loff_t pos, /* Writing position offset */
@@ -795,7 +795,7 @@ int reiserfs_submit_file_region_for_write(
/* Look if passed writing region is going to touch file's tail
(if it is present). And if it is, convert the tail to unformatted node */
-int reiserfs_check_for_tail_and_convert( struct inode *inode, /* inode to deal with */
+static int reiserfs_check_for_tail_and_convert( struct inode *inode, /* inode to deal with */
loff_t pos, /* Writing position */
int write_bytes /* amount of bytes to write */
)
@@ -851,7 +851,7 @@ int reiserfs_check_for_tail_and_convert( struct inode *inode, /* inode to deal w
append), it is zeroed, then.
Returns number of unallocated blocks that should be allocated to cover
new file data.*/
-int reiserfs_prepare_file_region_for_write(
+static int reiserfs_prepare_file_region_for_write(
struct inode *inode /* Inode of the file */,
loff_t pos, /* position in the file */
int num_pages, /* number of pages to
@@ -1148,7 +1148,7 @@ failed_read:
Future Features: providing search_by_key with hints.
*/
-ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */
+static ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */
const char __user *buf, /* pointer to user supplied data
(in userspace) */
size_t count, /* amount of bytes to write */
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 814561b10324a..1bffb65798b71 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -724,7 +724,7 @@ else \
}
-void free_buffers_in_tb (
+static void free_buffers_in_tb (
struct tree_balance * p_s_tb
) {
int n_counter;
diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c
index d1033e3f89eaa..a362125da0d8b 100644
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -698,7 +698,7 @@ static void balance_internal_when_delete (struct tree_balance * tb,
/* Replace delimiting key of buffers L[h] and S[h] by the given key.*/
-void replace_lkey (
+static void replace_lkey (
struct tree_balance * tb,
int h,
struct item_head * key
@@ -718,7 +718,7 @@ void replace_lkey (
/* Replace delimiting key of buffers S[h] and R[h] by the given key.*/
-void replace_rkey (
+static void replace_rkey (
struct tree_balance * tb,
int h,
struct item_head * key
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index aad4a6f1aab89..6060b3d6e8351 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -22,6 +22,8 @@ extern int reiserfs_default_io_size; /* default io size devuned in super.c */
static int reiserfs_commit_write(struct file *f, struct page *page,
unsigned from, unsigned to);
+static int reiserfs_prepare_write(struct file *f, struct page *page,
+ unsigned from, unsigned to);
void reiserfs_delete_inode (struct inode * inode)
{
@@ -403,8 +405,8 @@ finished:
// this is called to create file map. So, _get_block_create_0 will not
// read direct item
-int reiserfs_bmap (struct inode * inode, sector_t block,
- struct buffer_head * bh_result, int create)
+static int reiserfs_bmap (struct inode * inode, sector_t block,
+ struct buffer_head * bh_result, int create)
{
if (!file_capable (inode, block))
return -EFBIG;
@@ -1565,16 +1567,6 @@ int reiserfs_write_inode (struct inode * inode, int do_sync) {
return 0;
}
-/* FIXME: no need any more. right? */
-int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, struct inode * inode)
-{
- int err = 0;
-
- reiserfs_update_sd (th, inode);
- return err;
-}
-
-
/* stat data of new object is inserted already, this inserts the item
containing "." and ".." entries */
static int reiserfs_new_directory (struct reiserfs_transaction_handle *th,
@@ -2420,7 +2412,7 @@ static int reiserfs_writepage (struct page * page, struct writeback_control *wbc
return reiserfs_write_full_page(page, wbc) ;
}
-int reiserfs_prepare_write(struct file *f, struct page *page,
+static int reiserfs_prepare_write(struct file *f, struct page *page,
unsigned from, unsigned to) {
struct inode *inode = page->mapping->host ;
int ret;
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 5dbddbc8a25a1..94dc42475a046 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -9,6 +9,8 @@
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
+static int reiserfs_unpack (struct inode * inode, struct file * filp);
+
/*
** reiserfs_ioctl - handler for ioctl for inode
** supported commands:
@@ -87,7 +89,7 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
** Function try to convert tail from direct item into indirect.
** It set up nopack attribute in the REISERFS_I(inode)->nopack
*/
-int reiserfs_unpack (struct inode * inode, struct file * filp)
+static int reiserfs_unpack (struct inode * inode, struct file * filp)
{
int retval = 0;
int index ;
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index 57779620a626b..9cf7c13b120d9 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -110,7 +110,7 @@ static void sd_print_vi (struct virtual_item * vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}
-struct item_operations stat_data_ops = {
+static struct item_operations stat_data_ops = {
.bytes_number = sd_bytes_number,
.decrement_key = sd_decrement_key,
.is_left_mergeable = sd_is_left_mergeable,
@@ -213,7 +213,7 @@ static void direct_print_vi (struct virtual_item * vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}
-struct item_operations direct_ops = {
+static struct item_operations direct_ops = {
.bytes_number = direct_bytes_number,
.decrement_key = direct_decrement_key,
.is_left_mergeable = direct_is_left_mergeable,
@@ -367,7 +367,7 @@ static void indirect_print_vi (struct virtual_item * vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}
-struct item_operations indirect_ops = {
+static struct item_operations indirect_ops = {
.bytes_number = indirect_bytes_number,
.decrement_key = indirect_decrement_key,
.is_left_mergeable = indirect_is_left_mergeable,
@@ -660,7 +660,7 @@ static void direntry_print_vi (struct virtual_item * vi)
printk ("\n");
}
-struct item_operations direntry_ops = {
+static struct item_operations direntry_ops = {
.bytes_number = direntry_bytes_number,
.decrement_key = direntry_decrement_key,
.is_left_mergeable = direntry_is_left_mergeable,
@@ -750,7 +750,7 @@ static void errcatch_print_vi (struct virtual_item * vi)
reiserfs_warning (NULL, "green-16011: Invalid item type observed, run fsck ASAP");
}
-struct item_operations errcatch_ops = {
+static struct item_operations errcatch_ops = {
errcatch_bytes_number,
errcatch_decrement_key,
errcatch_is_left_mergeable,
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 77f29ff989802..3ae84cc4a7619 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -436,19 +436,6 @@ get_journal_hash_dev(struct super_block *sb,
return (struct reiserfs_journal_cnode *)0 ;
}
-/* returns a cnode with same size, block number and dev as bh in the current transaction hash. NULL if not found */
-static inline struct reiserfs_journal_cnode *get_journal_hash(struct super_block *p_s_sb, struct buffer_head *bh) {
- struct reiserfs_journal *journal = SB_JOURNAL (p_s_sb);
- struct reiserfs_journal_cnode *cn ;
- if (bh) {
- cn = get_journal_hash_dev(p_s_sb, journal->j_hash_table, bh->b_blocknr);
- }
- else {
- return (struct reiserfs_journal_cnode *)0 ;
- }
- return cn ;
-}
-
/*
** this actually means 'can this block be reallocated yet?'. If you set search_all, a block can only be allocated
** if it is not in the current transaction, was not freed by the current transaction, and has no chance of ever
@@ -516,7 +503,7 @@ int reiserfs_in_journal(struct super_block *p_s_sb,
/* insert cn into table
*/
-inline void insert_journal_hash(struct reiserfs_journal_cnode **table, struct reiserfs_journal_cnode *cn) {
+static inline void insert_journal_hash(struct reiserfs_journal_cnode **table, struct reiserfs_journal_cnode *cn) {
struct reiserfs_journal_cnode *cn_orig ;
cn_orig = journal_hash(table, cn->sb, cn->blocknr) ;
@@ -693,7 +680,7 @@ static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh,
}
-atomic_t nr_reiserfs_jh = ATOMIC_INIT(0);
+static atomic_t nr_reiserfs_jh = ATOMIC_INIT(0);
static struct reiserfs_jh *alloc_jh(void) {
struct reiserfs_jh *jh;
while(1) {
@@ -1090,7 +1077,7 @@ static struct reiserfs_journal_list *find_newer_jl_for_cn(struct reiserfs_journa
return NULL ;
}
-void remove_journal_hash(struct super_block *, struct reiserfs_journal_cnode **,
+static void remove_journal_hash(struct super_block *, struct reiserfs_journal_cnode **,
struct reiserfs_journal_list *, unsigned long, int);
/*
@@ -2028,7 +2015,7 @@ abort_replay:
Right now it is only used from journal code. But later we might use it
from other places.
Note: Do not use journal_getblk/sb_getblk functions here! */
-struct buffer_head * reiserfs_breada (struct block_device *dev, int block, int bufsize,
+static struct buffer_head * reiserfs_breada (struct block_device *dev, int block, int bufsize,
unsigned int max_block)
{
struct buffer_head * bhlist[BUFNR];
@@ -3848,7 +3835,7 @@ out:
return journal->j_errno;
}
-void
+static void
__reiserfs_journal_abort_hard (struct super_block *sb)
{
struct reiserfs_journal *journal = SB_JOURNAL (sb);
@@ -3866,7 +3853,7 @@ __reiserfs_journal_abort_hard (struct super_block *sb)
#endif
}
-void
+static void
__reiserfs_journal_abort_soft (struct super_block *sb, int errno)
{
struct reiserfs_journal *journal = SB_JOURNAL (sb);
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index 5f08f356da1a2..16fdca1d4bd79 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -286,7 +286,7 @@ void reiserfs_info (struct super_block *sb, const char * fmt, ...)
}
/* No newline.. reiserfs_printk calls can be followed by printk's */
-void reiserfs_printk (const char * fmt, ...)
+static void reiserfs_printk (const char * fmt, ...)
{
do_reiserfs_warning(fmt);
printk (error_buf);
@@ -366,30 +366,6 @@ void reiserfs_panic (struct super_block * sb, const char * fmt, ...)
reiserfs_bdevname (sb), error_buf);
}
-static void
-do_handle_error (struct super_block *sb, int errno)
-{
- if (reiserfs_error_panic (sb)) {
- panic ("REISERFS: panic (device %s): Panic forced after error\n",
- reiserfs_bdevname (sb));
- }
-
- if (reiserfs_error_ro (sb)) {
- printk (KERN_CRIT "REISERFS: error (device %s): Re-mounting fs "
- "readonly\n", reiserfs_bdevname (sb));
- reiserfs_journal_abort (sb, errno);
- }
-}
-
-void
-reiserfs_error (struct super_block * sb, int errno, const char *fmt, ...)
-{
- do_reiserfs_warning (fmt);
- printk (KERN_CRIT "REISERFS: error (device %s): %s\n",
- reiserfs_bdevname (sb), error_buf);
- do_handle_error (sb, errno);
-}
-
void
reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...)
{
@@ -410,53 +386,6 @@ reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...)
reiserfs_journal_abort (sb, errno);
}
-void print_virtual_node (struct virtual_node * vn)
-{
- int i;
- struct virtual_item * vi;
-
- printk ("VIRTUAL NODE CONTAINS %d items, has size %d,%s,%s, ITEM_POS=%d POS_IN_ITEM=%d MODE=\'%c\'\n",
- vn->vn_nr_item, vn->vn_size,
- (vn->vn_vi[0].vi_type & VI_TYPE_LEFT_MERGEABLE )? "left mergeable" : "",
- (vn->vn_vi[vn->vn_nr_item - 1].vi_type & VI_TYPE_RIGHT_MERGEABLE) ? "right mergeable" : "",
- vn->vn_affected_item_num, vn->vn_pos_in_item, vn->vn_mode);
-
- vi = vn->vn_vi;
- for (i = 0; i < vn->vn_nr_item; i ++, vi ++)
- op_print_vi (vi);
-
-}
-
-
-void print_path (struct tree_balance * tb, struct path * path)
-{
- int h = 0;
- struct buffer_head * bh;
-
- if (tb) {
- while (tb->insert_size[h]) {
- bh = PATH_H_PBUFFER (path, h);
- printk ("block %llu (level=%d), position %d\n", bh ? (unsigned long long)bh->b_blocknr : 0LL,
- bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h));
- h ++;
- }
- } else {
- int offset = path->path_length;
- struct buffer_head * bh;
- printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n");
- while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) {
- bh = PATH_OFFSET_PBUFFER (path, offset);
- printk ("%6d %10p (%9llu, %7d) %8d %7d\n", offset,
- bh, bh ? (unsigned long long)bh->b_blocknr : 0LL, bh ? atomic_read (&(bh->b_count)) : 0,
- PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1);
-
- offset --;
- }
- }
-
-}
-
-
/* this prints internal nodes (4 keys/items in line) (dc_number,
dc_size)[k_dirid, k_objectid, k_offset, k_uniqueness](dc_number,
dc_size)...*/
@@ -648,7 +577,7 @@ void print_block (struct buffer_head * bh, ...)//int print_mode, int first, int
-char print_tb_buf[2048];
+static char print_tb_buf[2048];
/* this stores initial state of tree balance in the print_tb_buf */
void store_print_tb (struct tree_balance * tb)
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index f2b5e0521e7fe..73ec5212178b7 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -12,14 +12,10 @@
* This file contains functions dealing with S+tree
*
* B_IS_IN_TREE
- * copy_short_key
* copy_item_head
* comp_short_keys
* comp_keys
- * comp_cpu_keys
* comp_short_le_keys
- * comp_short_cpu_keys
- * cpu_key2cpu_key
* le_key2cpu_key
* comp_le_keys
* bin_search
@@ -72,11 +68,6 @@ inline int B_IS_IN_TREE (const struct buffer_head * p_s_bh)
return ( B_LEVEL (p_s_bh) != FREE_LEVEL );
}
-inline void copy_short_key (void * to, const void * from)
-{
- memcpy (to, from, SHORT_KEY_SIZE);
-}
-
//
// to gets item head in le form
//
@@ -117,7 +108,7 @@ inline int comp_short_keys (const struct reiserfs_key * le_key,
Compare keys using all 4 key fields.
Returns: -1 if key1 < key2 0
if key1 = key2 1 if key1 > key2 */
-inline int comp_keys (const struct reiserfs_key * le_key, const struct cpu_key * cpu_key)
+static inline int comp_keys (const struct reiserfs_key * le_key, const struct cpu_key * cpu_key)
{
int retval;
@@ -143,37 +134,6 @@ inline int comp_keys (const struct reiserfs_key * le_key, const struct cpu_key
}
-//
-// FIXME: not used yet
-//
-inline int comp_cpu_keys (const struct cpu_key * key1,
- const struct cpu_key * key2)
-{
- if (key1->on_disk_key.k_dir_id < key2->on_disk_key.k_dir_id)
- return -1;
- if (key1->on_disk_key.k_dir_id > key2->on_disk_key.k_dir_id)
- return 1;
-
- if (key1->on_disk_key.k_objectid < key2->on_disk_key.k_objectid)
- return -1;
- if (key1->on_disk_key.k_objectid > key2->on_disk_key.k_objectid)
- return 1;
-
- if (cpu_key_k_offset (key1) < cpu_key_k_offset (key2))
- return -1;
- if (cpu_key_k_offset (key1) > cpu_key_k_offset (key2))
- return 1;
-
- reiserfs_warning (NULL, "comp_cpu_keys: type are compared for %K and %K",
- key1, key2);
-
- if (cpu_key_k_type (key1) < cpu_key_k_type (key2))
- return -1;
- if (cpu_key_k_type (key1) > cpu_key_k_type (key2))
- return 1;
- return 0;
-}
-
inline int comp_short_le_keys (const struct reiserfs_key * key1, const struct reiserfs_key * key2)
{
__u32 * p_s_1_u32, * p_s_2_u32;
@@ -190,32 +150,6 @@ inline int comp_short_le_keys (const struct reiserfs_key * key1, const struct re
return 0;
}
-inline int comp_short_cpu_keys (const struct cpu_key * key1,
- const struct cpu_key * key2)
-{
- __u32 * p_s_1_u32, * p_s_2_u32;
- int n_key_length = REISERFS_SHORT_KEY_LEN;
-
- p_s_1_u32 = (__u32 *)key1;
- p_s_2_u32 = (__u32 *)key2;
-
- for( ; n_key_length--; ++p_s_1_u32, ++p_s_2_u32 ) {
- if ( *p_s_1_u32 < *p_s_2_u32 )
- return -1;
- if ( *p_s_1_u32 > *p_s_2_u32 )
- return 1;
- }
- return 0;
-}
-
-
-
-inline void cpu_key2cpu_key (struct cpu_key * to, const struct cpu_key * from)
-{
- memcpy (to, from, sizeof (struct cpu_key));
-}
-
-
inline void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from)
{
to->on_disk_key.k_dir_id = le32_to_cpu (from->k_dir_id);
@@ -255,7 +189,7 @@ inline int comp_le_keys (const struct reiserfs_key * k1, const struct reiserfs_k
there are no possible items, and we have not found it. With each examination we
cut the number of possible items it could be by one more than half rounded down,
or we find it. */
-inline int bin_search (
+static inline int bin_search (
const void * p_v_key, /* Key to search for. */
const void * p_v_base,/* First item in the array. */
int p_n_num, /* Number of items in the array. */
@@ -272,7 +206,7 @@ inline int bin_search (
int n_rbound, n_lbound, n_j;
for ( n_j = ((n_rbound = p_n_num - 1) + (n_lbound = 0))/2; n_lbound <= n_rbound; n_j = (n_rbound + n_lbound)/2 )
- switch( COMP_KEYS((struct reiserfs_key *)((char * )p_v_base + n_j * p_n_width), (struct cpu_key *)p_v_key) ) {
+ switch( comp_keys((struct reiserfs_key *)((char * )p_v_base + n_j * p_n_width), (struct cpu_key *)p_v_key) ) {
case -1: n_lbound = n_j + 1; continue;
case 1: n_rbound = n_j - 1; continue;
case 0: *p_n_pos = n_j; return ITEM_FOUND; /* Key found in the array. */
@@ -301,7 +235,7 @@ const struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xff
of the path, and going upwards. We must check the path's validity at each step. If the key is not in
the path, there is no delimiting key in the tree (buffer is first or last buffer in tree), and in this
case we return a special key, either MIN_KEY or MAX_KEY. */
-inline const struct reiserfs_key * get_lkey (
+static inline const struct reiserfs_key * get_lkey (
const struct path * p_s_chk_path,
const struct super_block * p_s_sb
) {
@@ -396,11 +330,11 @@ static inline int key_in_buffer (
RFALSE( !PATH_PLAST_BUFFER(p_s_chk_path)->b_bdev,
"PAP-5060: device must not be NODEV");
- if ( COMP_KEYS(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 )
+ if ( comp_keys(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 )
/* left delimiting key is bigger, that the key we look for */
return 0;
- // if ( COMP_KEYS(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 )
- if ( COMP_KEYS(get_rkey(p_s_chk_path, p_s_sb), p_s_key) != 1 )
+ // if ( comp_keys(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 )
+ if ( comp_keys(get_rkey(p_s_chk_path, p_s_sb), p_s_key) != 1 )
/* p_s_key must be less than right delimitiing key */
return 0;
return 1;
@@ -745,7 +679,7 @@ io_error:
/* only check that the key is in the buffer if p_s_key is not
equal to the MAX_KEY. Latter case is only possible in
"finish_unfinished()" processing during mount. */
- RFALSE( COMP_KEYS( &MAX_KEY, p_s_key ) &&
+ RFALSE( comp_keys( &MAX_KEY, p_s_key ) &&
! key_in_buffer(p_s_search_path, p_s_key, p_s_sb),
"PAP-5130: key is not in the buffer");
#ifdef CONFIG_REISERFS_CHECK
@@ -1192,7 +1126,7 @@ static char prepare_for_delete_or_cut(
}
/* Calculate number of bytes which will be deleted or cut during balance */
-int calc_deleted_bytes_number(
+static int calc_deleted_bytes_number(
struct tree_balance * p_s_tb,
char c_mode
) {
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 992221af3f2da..0fe66eb258d6f 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -31,9 +31,9 @@
struct file_system_type reiserfs_fs_type;
-const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
-const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
-const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING;
+static const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
+static const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
+static const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING;
int is_reiserfs_3_5 (struct reiserfs_super_block * rs)
{
@@ -106,7 +106,7 @@ static void reiserfs_write_super_lockfs (struct super_block * s)
reiserfs_write_unlock(s);
}
-void reiserfs_unlockfs(struct super_block *s) {
+static void reiserfs_unlockfs(struct super_block *s) {
reiserfs_allow_writes(s) ;
}
@@ -561,7 +561,7 @@ static ssize_t reiserfs_quota_write(struct super_block *, int, const char *, siz
static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t, loff_t);
#endif
-struct super_operations reiserfs_sops =
+static struct super_operations reiserfs_sops =
{
.alloc_inode = reiserfs_alloc_inode,
.destroy_inode = reiserfs_destroy_inode,
@@ -1284,24 +1284,6 @@ static int read_old_bitmaps (struct super_block * s)
return 0;
}
-void check_bitmap (struct super_block * s)
-{
- int i = 0;
- int free = 0;
- char * buf;
-
- while (i < SB_BLOCK_COUNT (s)) {
- buf = SB_AP_BITMAP (s)[i / (s->s_blocksize * 8)].bh->b_data;
- if (!reiserfs_test_le_bit (i % (s->s_blocksize * 8), buf))
- free ++;
- i ++;
- }
-
- if (free != SB_FREE_BLOCKS (s))
- reiserfs_warning (s,"vs-4000: check_bitmap: %d free blocks, must be %d",
- free, SB_FREE_BLOCKS (s));
-}
-
static int read_super_block (struct super_block * s, int offset)
{
struct buffer_head * bh;
@@ -1429,7 +1411,7 @@ static int reread_meta_blocks(struct super_block *s) {
// FIXME: we look for only one name in a directory. If tea and yura
// bith have the same value - we ask user to send report to the
// mailing list
-__u32 find_hash_out (struct super_block * s)
+static __u32 find_hash_out (struct super_block * s)
{
int retval;
struct inode * inode;
@@ -1560,7 +1542,7 @@ static hashf_t hash_function (struct super_block * s)
}
// this is used to set up correct value for old partitions
-int function2code (hashf_t func)
+static int function2code (hashf_t func)
{
if (func == keyed_hash)
return TEA_HASH;
@@ -1799,7 +1781,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
reiserfs_proc_info_init( s );
init_waitqueue_head (&(sbi->s_wait));
- sbi->bitmap_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&sbi->bitmap_lock);
return (0);
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index b600930ffd8e4..df4592a4f107c 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -9,6 +9,8 @@
#include <linux/reiserfs_acl.h>
#include <asm/uaccess.h>
+static int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl);
+
static int
xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
{
@@ -243,7 +245,7 @@ reiserfs_get_acl(struct inode *inode, int type)
* inode->i_sem: down
* BKL held [before 2.5.x]
*/
-int
+static int
reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
{
char *name;
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 3076d56f66b00..c74f382dabba2 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -161,8 +161,7 @@ static int romfs_fill_super(struct super_block *s, void *data, int silent)
if (!root)
goto out;
- s->s_root = d_alloc_root(iget(s, sz));
-
+ s->s_root = d_alloc_root(root);
if (!s->s_root)
goto outiput;
diff --git a/fs/select.c b/fs/select.c
index 57e776cafb3b3..1de9b6ac7d352 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -240,6 +240,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout)
retval++;
}
}
+ cond_resched();
}
if (res_in)
*rinp = res_in;
diff --git a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c
index 855e9148801df..cce462dcbaea2 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.c
+++ b/fs/xfs/linux-2.6/xfs_vfs.c
@@ -250,7 +250,7 @@ vfs_allocate( void )
vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
INIT_LIST_HEAD(&vfsp->vfs_sync_list);
- vfsp->vfs_sync_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&vfsp->vfs_sync_lock);
init_waitqueue_head(&vfsp->vfs_wait_sync_task);
init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
return vfsp;
diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h
index b5f355444fc24..a256bef459cf2 100644
--- a/include/asm-alpha/spinlock.h
+++ b/include/asm-alpha/spinlock.h
@@ -23,6 +23,9 @@ typedef struct {
struct task_struct * task;
const char *base_file;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#ifdef CONFIG_DEBUG_SPINLOCK
@@ -96,6 +99,9 @@ static inline int _raw_spin_trylock(spinlock_t *lock)
typedef struct {
volatile unsigned int write_lock:1, read_counter:31;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} /*__attribute__((aligned(32)))*/ rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
diff --git a/include/asm-arm/arch-iop3xx/entry-macro.S b/include/asm-arm/arch-iop3xx/entry-macro.S
index a5a86a9df51fb..e2ce7f5467c89 100644
--- a/include/asm-arm/arch-iop3xx/entry-macro.S
+++ b/include/asm-arm/arch-iop3xx/entry-macro.S
@@ -43,16 +43,11 @@
cmp \irqstat, #0
beq 1001f
clz \irqnr, \irqstat
-/*
- * mov \base, #31
- * subs \irqnr,\base,\irqnr
- */
- rsbs \irqnr,\irqnr,#31 @ recommend by RMK
+ rsbs \irqnr,\irqnr,#31 @ recommend by RMK
add \irqnr,\irqnr,#IRQ_IOP331_XINT8
b 1001f
-1002: clz \irqnr, \irqstat
- mov \base, #31
- subs \irqnr,\base,\irqnr
+1002: clz \irqnr, \irqstat
+ rsbs \irqnr,\irqnr,#31 @ recommend by RMK
add \irqnr,\irqnr,#IRQ_IOP331_DMA0_EOT
1001:
.endm
diff --git a/include/asm-arm/arch-iop3xx/hardware.h b/include/asm-arm/arch-iop3xx/hardware.h
index 6c15fde86310b..3b138171d086a 100644
--- a/include/asm-arm/arch-iop3xx/hardware.h
+++ b/include/asm-arm/arch-iop3xx/hardware.h
@@ -52,5 +52,6 @@ extern unsigned int processor_id;
#include "iq80321.h"
#include "iq31244.h"
#include "iq80331.h"
+#include "iq80332.h"
#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-iop3xx/iop321.h b/include/asm-arm/arch-iop3xx/iop321.h
index 98908a02c0706..f83511f27e39a 100644
--- a/include/asm-arm/arch-iop3xx/iop321.h
+++ b/include/asm-arm/arch-iop3xx/iop321.h
@@ -5,6 +5,7 @@
*
* Author: Rory Bolt <rorybolt@pacbell.net>
* Copyright (C) 2002 Rory Bolt
+ * Copyright (C) 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,21 +31,30 @@
/*
* IOP321 I/O and Mem space regions for PCI autoconfiguration
*/
-#define IOP321_PCI_LOWER_IO 0x90000000
-#define IOP321_PCI_UPPER_IO 0x9000ffff
-#define IOP321_PCI_LOWER_MEM 0x80000000
-#define IOP321_PCI_UPPER_MEM 0x83ffffff
-
-#define IOP321_PCI_WINDOW_SIZE 64 * 0x100000
+#define IOP321_PCI_IO_WINDOW_SIZE 0x10000
+#define IOP321_PCI_LOWER_IO_PA 0x90000000
+#define IOP321_PCI_LOWER_IO_VA 0xfe000000
+#define IOP321_PCI_LOWER_IO_BA (*IOP321_OIOWTVR)
+#define IOP321_PCI_UPPER_IO_PA (IOP321_PCI_LOWER_IO_PA + IOP321_PCI_IO_WINDOW_SIZE - 1)
+#define IOP321_PCI_UPPER_IO_VA (IOP321_PCI_LOWER_IO_VA + IOP321_PCI_IO_WINDOW_SIZE - 1)
+#define IOP321_PCI_UPPER_IO_BA (IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_WINDOW_SIZE - 1)
+#define IOP321_PCI_IO_OFFSET (IOP321_PCI_LOWER_IO_VA - IOP321_PCI_LOWER_IO_BA)
+
+#define IOP321_PCI_MEM_WINDOW_SIZE (~*IOP321_IALR1 + 1)
+#define IOP321_PCI_LOWER_MEM_PA 0x80000000
+#define IOP321_PCI_LOWER_MEM_VA 0x80000000
+#define IOP321_PCI_LOWER_MEM_BA (*IOP321_OMWTVR0)
+#define IOP321_PCI_UPPER_MEM_PA (IOP321_PCI_LOWER_MEM_PA + IOP321_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP321_PCI_UPPER_MEM_VA (IOP321_PCI_LOWER_MEM_VA + IOP321_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP321_PCI_UPPER_MEM_BA (IOP321_PCI_LOWER_MEM_BA + IOP321_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP321_PCI_MEM_OFFSET (IOP321_PCI_LOWER_MEM_VA - IOP321_PCI_LOWER_MEM_BA)
/*
* IOP321 chipset registers
*/
#define IOP321_VIRT_MEM_BASE 0xfeffe000 /* chip virtual mem address*/
-//#define IOP321_VIRT_MEM_BASE 0xfff00000 /* chip virtual mem address*/
-
-#define IOP321_PHY_MEM_BASE 0xffffe000 /* chip physical memory address */
+#define IOP321_PHYS_MEM_BASE 0xffffe000 /* chip physical memory address */
#define IOP321_REG_ADDR(reg) (IOP321_VIRT_MEM_BASE | (reg))
/* Reserved 0x00000000 through 0x000000FF */
diff --git a/include/asm-arm/arch-iop3xx/iop331-irqs.h b/include/asm-arm/arch-iop3xx/iop331-irqs.h
index 37063b445e131..8ff73d4872225 100644
--- a/include/asm-arm/arch-iop3xx/iop331-irqs.h
+++ b/include/asm-arm/arch-iop3xx/iop331-irqs.h
@@ -91,6 +91,7 @@
#define NR_IRQS NR_IOP331_IRQS
+#if defined(CONFIG_ARCH_IQ80331)
/*
* Interrupts available on the IQ80331 board
*/
@@ -110,4 +111,26 @@
#define IRQ_IQ80331_INTC IRQ_IOP331_XINT2
#define IRQ_IQ80331_INTD IRQ_IOP331_XINT3
+#elif defined(CONFIG_MACH_IQ80332)
+/*
+ * Interrupts available on the IQ80332 board
+ */
+
+/*
+ * On board devices
+ */
+#define IRQ_IQ80332_I82544 IRQ_IOP331_XINT0
+#define IRQ_IQ80332_UART0 IRQ_IOP331_UART0
+#define IRQ_IQ80332_UART1 IRQ_IOP331_UART1
+
+/*
+ * PCI interrupts
+ */
+#define IRQ_IQ80332_INTA IRQ_IOP331_XINT0
+#define IRQ_IQ80332_INTB IRQ_IOP331_XINT1
+#define IRQ_IQ80332_INTC IRQ_IOP331_XINT2
+#define IRQ_IQ80332_INTD IRQ_IOP331_XINT3
+
+#endif
+
#endif // _IOP331_IRQ_H_
diff --git a/include/asm-arm/arch-iop3xx/iop331.h b/include/asm-arm/arch-iop3xx/iop331.h
index c4854a1d3563f..cb16c5fda78e6 100644
--- a/include/asm-arm/arch-iop3xx/iop331.h
+++ b/include/asm-arm/arch-iop3xx/iop331.h
@@ -4,7 +4,7 @@
* Intel IOP331 Chip definitions
*
* Author: Dave Jiang (dave.jiang@intel.com)
- * Copyright (C) 2003 Intel Corp.
+ * Copyright (C) 2003, 2004 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -21,7 +21,8 @@
*/
#ifndef __ASSEMBLY__
#ifdef CONFIG_ARCH_IOP331
-#define iop_is_331() ((processor_id & 0xffffffb0) == 0x69054090)
+/*#define iop_is_331() ((processor_id & 0xffffffb0) == 0x69054090) */
+#define iop_is_331() ((processor_id & 0xffffff30) == 0x69054010)
#else
#define iop_is_331() 0
#endif
@@ -30,20 +31,28 @@
/*
* IOP331 I/O and Mem space regions for PCI autoconfiguration
*/
-#define IOP331_PCI_LOWER_IO 0x90000000
-#define IOP331_PCI_UPPER_IO 0x900fffff
-#define IOP331_PCI_LOWER_MEM 0x80000000
-#define IOP331_PCI_UPPER_MEM 0x87ffffff
-
-#define IOP331_PCI_WINDOW_SIZE 128 * 0x100000
-
+#define IOP331_PCI_IO_WINDOW_SIZE 0x10000
+#define IOP331_PCI_LOWER_IO_PA 0x90000000
+#define IOP331_PCI_LOWER_IO_VA 0xfe000000
+#define IOP331_PCI_LOWER_IO_BA (*IOP331_OIOWTVR)
+#define IOP331_PCI_UPPER_IO_PA (IOP331_PCI_LOWER_IO_PA + IOP331_PCI_IO_WINDOW_SIZE - 1)
+#define IOP331_PCI_UPPER_IO_VA (IOP331_PCI_LOWER_IO_VA + IOP331_PCI_IO_WINDOW_SIZE - 1)
+#define IOP331_PCI_UPPER_IO_BA (IOP331_PCI_LOWER_IO_BA + IOP331_PCI_IO_WINDOW_SIZE - 1)
+#define IOP331_PCI_IO_OFFSET (IOP331_PCI_LOWER_IO_VA - IOP331_PCI_LOWER_IO_BA)
+
+#define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1)
+#define IOP331_PCI_LOWER_MEM_PA 0x80000000
+#define IOP331_PCI_LOWER_MEM_VA 0x80000000
+#define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0)
+#define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP331_PCI_UPPER_MEM_VA (IOP331_PCI_LOWER_MEM_VA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP331_PCI_UPPER_MEM_BA (IOP331_PCI_LOWER_MEM_BA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
+#define IOP331_PCI_MEM_OFFSET (IOP331_PCI_LOWER_MEM_VA - IOP331_PCI_LOWER_MEM_BA)
/*
* IOP331 chipset registers
*/
-#define IOP331_VIRT_MEM_BASE 0xfeffe000 /* chip virtual mem address*/
-// #define IOP331_VIRT_MEM_BASE 0xfff00000 /* chip virtual mem address*/
-
+#define IOP331_VIRT_MEM_BASE 0xfeffe000 /* chip virtual mem address*/
#define IOP331_PHYS_MEM_BASE 0xffffe000 /* chip physical memory address */
#define IOP331_REG_ADDR(reg) (IOP331_VIRT_MEM_BASE | (reg))
@@ -248,8 +257,14 @@
#define IOP331_TU_TISR (volatile u32 *)IOP331_REG_ADDR(0x000007E8)
#define IOP331_TU_WDTCR (volatile u32 *)IOP331_REG_ADDR(0x000007EC)
-#define IOP331_TICK_RATE 266000000 /* 266 MHz clock */
+#if defined(CONFIG_ARCH_IOP331)
+#define IOP331_TICK_RATE 266000000 /* 266 MHz IB clock */
+#endif
+#if defined(CONFIG_IOP331_STEPD) || defined(CONFIG_ARCH_IQ80333)
+#undef IOP331_TICK_RATE
+#define IOP331_TICK_RATE 333000000 /* 333 Mhz IB clock */
+#endif
/* Application accelerator unit 0x00000800 - 0x000008FF */
#define IOP331_AAU_ACR (volatile u32 *)IOP331_REG_ADDR(0x00000800)
@@ -324,6 +339,11 @@
/* 0x00001740 through 0x0000176C UART 1 */
+#define IOP331_UART0_PHYS (IOP331_PHYS_MEM_BASE | 0x00001700) /* UART #1 physical */
+#define IOP331_UART1_PHYS (IOP331_PHYS_MEM_BASE | 0x00001740) /* UART #2 physical */
+#define IOP331_UART0_VIRT (IOP331_VIRT_MEM_BASE | 0x00001700) /* UART #1 virtual addr */
+#define IOP331_UART1_VIRT (IOP331_VIRT_MEM_BASE | 0x00001740) /* UART #2 virtual addr */
+
/* Reserved 0x00001770 through 0x0000177F */
/* General Purpose I/O Registers */
@@ -333,6 +353,7 @@
/* Reserved 0x0000178c through 0x000019ff */
+
#ifndef __ASSEMBLY__
extern void iop331_map_io(void);
extern void iop331_init_irq(void);
diff --git a/include/asm-arm/arch-iop3xx/iq31244.h b/include/asm-arm/arch-iop3xx/iq31244.h
index c62c216aefd10..4177cfa8100f6 100644
--- a/include/asm-arm/arch-iop3xx/iq31244.h
+++ b/include/asm-arm/arch-iop3xx/iq31244.h
@@ -7,8 +7,6 @@
#ifndef _IQ31244_H_
#define _IQ31244_H_
-#define IQ31244_RAMBASE 0xa0000000
-
#define IQ31244_FLASHBASE 0xf0000000 /* Flash */
#define IQ31244_FLASHSIZE 0x00800000
#define IQ31244_FLASHWIDTH 2
@@ -19,16 +17,6 @@
#define IQ31244_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
#define IQ31244_BATT_STAT 0xfe8f0000 /* Battery Status */
-/*
- * IQ31244 PCI I/O and Mem space regions
- */
-#define IQ31244_PCI_IO_BASE 0x90000000
-#define IQ31244_PCI_IO_SIZE 0x00010000
-#define IQ31244_PCI_MEM_BASE 0x80000000
-//#define IQ31244_PCI_MEM_SIZE 0x04000000
-#define IQ31244_PCI_MEM_SIZE 0x08000000
-#define IQ31244_PCI_IO_OFFSET 0x6e000000
-
#ifndef __ASSEMBLY__
extern void iq31244_map_io(void);
#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80321.h b/include/asm-arm/arch-iop3xx/iq80321.h
index e1c5430397809..cb8725979ffad 100644
--- a/include/asm-arm/arch-iop3xx/iq80321.h
+++ b/include/asm-arm/arch-iop3xx/iq80321.h
@@ -7,8 +7,6 @@
#ifndef _IQ80321_H_
#define _IQ80321_H_
-#define IQ80321_RAMBASE 0xa0000000
-
#define IQ80321_FLASHBASE 0xf0000000 /* Flash */
#define IQ80321_FLASHSIZE 0x00800000
#define IQ80321_FLASHWIDTH 1
@@ -19,15 +17,6 @@
#define IQ80321_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
#define IQ80321_BATT_STAT 0xfe8f0000 /* Battery Status */
-/*
- * IQ80321 PCI I/O and Mem space regions
- */
-#define IQ80321_PCI_IO_BASE 0x90000000
-#define IQ80321_PCI_IO_SIZE 0x00010000
-#define IQ80321_PCI_MEM_BASE 0x80000000
-#define IQ80321_PCI_MEM_SIZE 0x04000000
-#define IQ80321_PCI_IO_OFFSET 0x6e000000
-
#ifndef __ASSEMBLY__
extern void iq80321_map_io(void);
#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80331.h b/include/asm-arm/arch-iop3xx/iq80331.h
index a076327fe5f28..0668e78d483e3 100644
--- a/include/asm-arm/arch-iop3xx/iq80331.h
+++ b/include/asm-arm/arch-iop3xx/iq80331.h
@@ -7,30 +7,15 @@
#ifndef _IQ80331_H_
#define _IQ80331_H_
-#define IQ80331_RAMBASE 0x00000000
-
#define IQ80331_FLASHBASE 0xc0000000 /* Flash */
#define IQ80331_FLASHSIZE 0x00800000
#define IQ80331_FLASHWIDTH 1
-#define IQ80331_UART0_PHYS (IOP331_PHYS_MEM_BASE | 0x00001700) /* UART #1 physical */
-#define IQ80331_UART1_PHYS (IOP331_PHYS_MEM_BASE | 0x00001740) /* UART #2 physical */
-#define IQ80331_UART0_VIRT (IOP331_VIRT_MEM_BASE | 0x00001700) /* UART #1 virtual addr */
-#define IQ80331_UART1_VIRT (IOP331_VIRT_MEM_BASE | 0x00001740) /* UART #2 virtual addr */
#define IQ80331_7SEG_1 0xce840000 /* 7-Segment MSB */
#define IQ80331_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
#define IQ80331_ROTARY_SW 0xce8d0000 /* Rotary Switch */
#define IQ80331_BATT_STAT 0xce8f0000 /* Battery Status */
-/*
- * IQ80331 PCI I/O and Mem space regions
- */
-#define IQ80331_PCI_IO_BASE 0x90000000
-#define IQ80331_PCI_IO_SIZE 0x00010000
-#define IQ80331_PCI_MEM_BASE 0x80000000
-#define IQ80331_PCI_MEM_SIZE 0x08000000
-#define IQ80331_PCI_IO_OFFSET 0x6e000000
-
#ifndef __ASSEMBLY__
extern void iq80331_map_io(void);
#endif
diff --git a/include/asm-arm/arch-iop3xx/iq80332.h b/include/asm-arm/arch-iop3xx/iq80332.h
new file mode 100644
index 0000000000000..e5fff1775d1a3
--- /dev/null
+++ b/include/asm-arm/arch-iop3xx/iq80332.h
@@ -0,0 +1,23 @@
+/*
+ * linux/include/asm/arch-iop3xx/iq80332.h
+ *
+ * Intel IQ80332 evaluation board registers
+ */
+
+#ifndef _IQ80332_H_
+#define _IQ80332_H_
+
+#define IQ80332_FLASHBASE 0xc0000000 /* Flash */
+#define IQ80332_FLASHSIZE 0x00800000
+#define IQ80332_FLASHWIDTH 1
+
+#define IQ80332_7SEG_1 0xce840000 /* 7-Segment MSB */
+#define IQ80332_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
+#define IQ80332_ROTARY_SW 0xce8d0000 /* Rotary Switch */
+#define IQ80332_BATT_STAT 0xce8f0000 /* Battery Status */
+
+#ifndef __ASSEMBLY__
+extern void iq80332_map_io(void);
+#endif
+
+#endif // _IQ80332_H_
diff --git a/include/asm-arm/arch-iop3xx/timex.h b/include/asm-arm/arch-iop3xx/timex.h
index d9dbb443ca8c6..d4187fe9a85a2 100644
--- a/include/asm-arm/arch-iop3xx/timex.h
+++ b/include/asm-arm/arch-iop3xx/timex.h
@@ -10,7 +10,7 @@
#define CLOCK_TICK_RATE IOP321_TICK_RATE
-#elif defined(CONFIG_ARCH_IQ80331)
+#elif defined(CONFIG_ARCH_IQ80331) || defined(CONFIG_MACH_IQ80332)
#define CLOCK_TICK_RATE IOP331_TICK_RATE
diff --git a/include/asm-arm/arch-iop3xx/uncompress.h b/include/asm-arm/arch-iop3xx/uncompress.h
index 673fabc1f216d..82b88762c3cc0 100644
--- a/include/asm-arm/arch-iop3xx/uncompress.h
+++ b/include/asm-arm/arch-iop3xx/uncompress.h
@@ -9,8 +9,10 @@
#ifdef CONFIG_ARCH_IOP321
#define UTYPE unsigned char *
-#else
+#elif defined(CONFIG_ARCH_IOP331)
#define UTYPE u32 *
+#else
+#error "Missing IOP3xx arch type def"
#endif
static volatile UTYPE uart_base;
@@ -42,8 +44,8 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
uart_base = (volatile UTYPE)IQ80321_UART;
else if(machine_is_iq31244())
uart_base = (volatile UTYPE)IQ31244_UART;
- else if(machine_is_iq80331())
- uart_base = (volatile UTYPE)IQ80331_UART0_PHYS;
+ else if(machine_is_iq80331() || machine_is_iq80332())
+ uart_base = (volatile UTYPE)IOP331_UART0_PHYS;
else
uart_base = (volatile UTYPE)0xfe800000;
}
diff --git a/include/asm-arm/arch-iop3xx/vmalloc.h b/include/asm-arm/arch-iop3xx/vmalloc.h
index d59dfeda9ab28..dc1d2a9571643 100644
--- a/include/asm-arm/arch-iop3xx/vmalloc.h
+++ b/include/asm-arm/arch-iop3xx/vmalloc.h
@@ -13,4 +13,7 @@
#define VMALLOC_OFFSET (8*1024*1024)
#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
#define VMALLOC_VMADDR(x) ((unsigned long)(x))
-#define VMALLOC_END (0xe8000000)
+//#define VMALLOC_END (0xe8000000)
+/* increase usable physical RAM to ~992M per RMK */
+#define VMALLOC_END (0xfe000000)
+
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index ca6de70b7ba3b..ca808281c7f98 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -48,14 +48,6 @@
#define IRQ_IXP4XX_GPIO12 29
#define IRQ_IXP4XX_SW_INT1 30
#define IRQ_IXP4XX_SW_INT2 31
-
-#ifndef CONFIG_CPU_IXP46X
-#define NR_IRQS 32
-#else
-
-/*
- * IXP465 adds new sources
- */
#define IRQ_IXP4XX_USB_HOST 32
#define IRQ_IXP4XX_I2C 33
#define IRQ_IXP4XX_SSP 34
@@ -67,6 +59,12 @@
#define IRQ_IXP4XX_MCU_ECC 61
#define IRQ_IXP4XX_EXP_PE 62
+/*
+ * Only first 32 sources are valid if running on IXP42x systems
+ */
+#ifndef CONFIG_CPU_IXP46X
+#define NR_IRQS 32
+#else
#define NR_IRQS 64
#endif
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index aaf6b2a3602c7..8eeb1db6309df 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -43,6 +43,10 @@
* 0xC8000000 0x0000C000 0xffbf2000 On-Chip Peripherals
*/
+/*
+ * Queue Manager
+ */
+#define IXP4XX_QMGR_BASE_PHYS (0x60000000)
/*
* Expansion BUS Configuration registers
@@ -107,7 +111,9 @@
#define IXP4XX_INTC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
#define IXP4XX_GPIO_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
#define IXP4XX_TIMER_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
-#define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
+#define IXP4XX_EthA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000)
+#define IXP4XX_EthB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000)
+#define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000)
#define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
#define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
@@ -115,7 +121,9 @@
#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
-#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
+#define IXP4XX_EthA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
+#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
+#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
/*
* Constants to make it easy to access Interrupt Controller registers
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index fc9d710184f39..d0e195b329533 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -60,6 +60,7 @@ struct sys_timer;
*/
extern void ixp4xx_map_io(void);
extern void ixp4xx_init_irq(void);
+extern void ixp4xx_sys_init(void);
extern struct sys_timer ixp4xx_timer;
extern void ixp4xx_pci_preinit(void);
struct pci_sys_data;
diff --git a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h
index 427e6ff5c79f2..217a80b820ff8 100644
--- a/include/asm-arm/arch-pxa/memory.h
+++ b/include/asm-arm/arch-pxa/memory.h
@@ -37,8 +37,6 @@
* node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
*/
-#define NR_NODES 4
-
/*
* Given a kernel address, find the home node of the underlying memory.
*/
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index b8750631dd09d..925d016dd4b51 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -87,6 +87,22 @@ dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t handle);
/**
+ * dma_mmap_coherent - map a coherent DMA allocation into user space
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @vma: vm_area_struct describing requested user mapping
+ * @cpu_addr: kernel CPU-view address returned from dma_alloc_coherent
+ * @handle: device-view address returned from dma_alloc_coherent
+ * @size: size of memory originally requested in dma_alloc_coherent
+ *
+ * Map a coherent DMA buffer previously allocated by dma_alloc_coherent
+ * into user space. The coherent DMA buffer must not be freed by the
+ * driver until the user space mapping has been released.
+ */
+int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t handle, size_t size);
+
+
+/**
* dma_alloc_writecombine - allocate writecombining memory for DMA
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @size: required memory size
@@ -103,6 +119,9 @@ dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, int
#define dma_free_writecombine(dev,size,cpu_addr,handle) \
dma_free_coherent(dev,size,cpu_addr,handle)
+int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t handle, size_t size);
+
/**
* dma_map_single - map a single buffer for streaming DMA
diff --git a/include/asm-arm/hardware/amba_clcd.h b/include/asm-arm/hardware/amba_clcd.h
index 97681e3590f85..2149be7c70237 100644
--- a/include/asm-arm/hardware/amba_clcd.h
+++ b/include/asm-arm/hardware/amba_clcd.h
@@ -125,6 +125,11 @@ struct clcd_board {
int (*setup)(struct clcd_fb *);
/*
+ * mmap the framebuffer memory
+ */
+ int (*mmap)(struct clcd_fb *, struct vm_area_struct *);
+
+ /*
* Remove platform specific parts of CLCD driver
*/
void (*remove)(struct clcd_fb *);
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 547e5aa8be7b3..10d747ba0ce03 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -310,7 +310,7 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
#define set_pmd(pmdp,pmd) \
do { \
- *pmdp = pmd; \
+ *(pmdp) = pmd; \
flush_pmd_entry(pmdp); \
} while (0)
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 1c22e7feabf50..182323619caa8 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -17,6 +17,9 @@
*/
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -70,6 +73,9 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
*/
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
@@ -143,6 +149,8 @@ static inline void _raw_read_unlock(rwlock_t *rw)
: "cc", "memory");
}
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
static inline int _raw_write_trylock(rwlock_t *rw)
{
unsigned long tmp;
diff --git a/include/asm-i386/bug.h b/include/asm-i386/bug.h
index c9f0bf3435d19..706eb511c3307 100644
--- a/include/asm-i386/bug.h
+++ b/include/asm-i386/bug.h
@@ -9,7 +9,7 @@
* undefined" opcode for parsing in the trap handler.
*/
-#if 1 /* Set to zero for a slightly smaller kernel */
+#ifdef CONFIG_DEBUG_BUGVERBOSE
#define BUG() \
__asm__ __volatile__( "ud2\n" \
"\t.word %c0\n" \
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h
index b852593a1c7ba..7bf453bd3305e 100644
--- a/include/asm-i386/mach-numaq/mach_apic.h
+++ b/include/asm-i386/mach-numaq/mach_apic.h
@@ -112,13 +112,15 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
static inline void setup_portio_remap(void)
{
- if (numnodes <= 1)
+ int num_quads = num_online_nodes();
+
+ if (num_quads <= 1)
return;
- printk("Remapping cross-quad port I/O for %d quads\n", numnodes);
- xquad_portio = ioremap (XQUAD_PORTIO_BASE, numnodes*XQUAD_PORTIO_QUAD);
+ printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
+ xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
- (u_long) xquad_portio, (u_long) numnodes*XQUAD_PORTIO_QUAD);
+ (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
}
static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index ba7eccc97f191..a1e2a1de82375 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -50,7 +50,7 @@ extern u8 x86_cpu_to_apicid[];
* from the initial startup. We map APIC_BASE very early in page_setup(),
* so this is correct in the x86 case.
*/
-#define smp_processor_id() (current_thread_info()->cpu)
+#define __smp_processor_id() (current_thread_info()->cpu)
extern cpumask_t cpu_callout_map;
#define cpu_possible_map cpu_callout_map
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index 89ad2d7b58ad1..6c6b452c99c65 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -19,6 +19,9 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPINLOCK_MAGIC 0xdead4ead
@@ -166,6 +169,9 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RWLOCK_MAGIC 0xdeaf1eed
@@ -212,6 +218,16 @@ static inline void _raw_write_lock(rwlock_t *rw)
#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory")
#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
+static inline int _raw_read_trylock(rwlock_t *lock)
+{
+ atomic_t *count = (atomic_t *)lock;
+ atomic_dec(count);
+ if (atomic_read(count) >= 0)
+ return 1;
+ atomic_inc(count);
+ return 0;
+}
+
static inline int _raw_write_trylock(rwlock_t *lock)
{
atomic_t *count = (atomic_t *)lock;
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h
index fc66609bb7614..1679983d053f9 100644
--- a/include/asm-i386/string.h
+++ b/include/asm-i386/string.h
@@ -25,7 +25,6 @@
/* AK: in fact I bet it would be better to move this stuff all out of line.
*/
-#if !defined(IN_STRING_C)
#define __HAVE_ARCH_STRCPY
static inline char * strcpy(char * dest,const char *src)
@@ -180,8 +179,6 @@ __asm__ __volatile__(
return __res;
}
-#endif
-
#define __HAVE_ARCH_STRLEN
static inline size_t strlen(const char * s)
{
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index efd38639e12d7..dcbed87f1c71b 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -75,11 +75,13 @@ static inline cpumask_t pcibus_to_cpumask(int bus)
.max_interval = 32, \
.busy_factor = 32, \
.imbalance_pct = 125, \
- .cache_hot_time = (10*1000), \
+ .cache_hot_time = (10*1000000), \
.cache_nice_tries = 1, \
.per_cpu_gain = 100, \
.flags = SD_LOAD_BALANCE \
| SD_BALANCE_EXEC \
+ | SD_BALANCE_NEWIDLE \
+ | SD_WAKE_IDLE \
| SD_WAKE_BALANCE, \
.last_balance = jiffies, \
.balance_interval = 1, \
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 263cacb2c7fec..491e9d1fc538d 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -447,14 +447,9 @@ iounmap (volatile void __iomem *addr)
/*
* String version of IO memory access ops:
*/
-extern void __ia64_memcpy_fromio (void *, volatile void __iomem *, long);
-extern void __ia64_memcpy_toio (volatile void __iomem *, void *, long);
-extern void __ia64_memset_c_io (volatile void __iomem *, unsigned long, long);
-
-#define memcpy_fromio(to,from,len) __ia64_memcpy_fromio((to), (from),(len))
-#define memcpy_toio(to,from,len) __ia64_memcpy_toio((to),(from),(len))
-#define memset_io(addr,c,len) __ia64_memset_c_io((addr), 0x0101010101010101UL*(u8)(c), \
- (len))
+extern void memcpy_fromio(void *dst, const volatile void __iomem *src, long n);
+extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n);
+extern void memset_io(volatile void __iomem *s, int c, long n);
#define dma_cache_inv(_start,_size) do { } while (0)
#define dma_cache_wback(_start,_size) do { } while (0)
diff --git a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h
index 89c392d2dab37..9491dacc89cfe 100644
--- a/include/asm-ia64/mmzone.h
+++ b/include/asm-ia64/mmzone.h
@@ -11,7 +11,7 @@
#ifndef _ASM_IA64_MMZONE_H
#define _ASM_IA64_MMZONE_H
-#include <linux/config.h>
+#include <linux/numa.h>
#include <asm/page.h>
#include <asm/meminit.h>
@@ -19,15 +19,14 @@
#ifdef CONFIG_IA64_DIG /* DIG systems are small */
# define MAX_PHYSNODE_ID 8
-# define NR_NODES 8
-# define NR_NODE_MEMBLKS (NR_NODES * 8)
+# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
#else /* sn2 is the biggest case, so we use that if !DIG */
# define MAX_PHYSNODE_ID 2048
-# define NR_NODES 256
-# define NR_NODE_MEMBLKS (NR_NODES * 4)
+# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4)
#endif
#else /* CONFIG_DISCONTIGMEM */
-# define NR_NODE_MEMBLKS 4
+# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4)
#endif /* CONFIG_DISCONTIGMEM */
+
#endif /* _ASM_IA64_MMZONE_H */
diff --git a/include/asm-ia64/nodedata.h b/include/asm-ia64/nodedata.h
index 90908767b4f2b..6b0f3ed89b7ee 100644
--- a/include/asm-ia64/nodedata.h
+++ b/include/asm-ia64/nodedata.h
@@ -27,7 +27,7 @@ struct pglist_data;
struct ia64_node_data {
short active_cpu_count;
short node;
- struct pglist_data *pg_data_ptrs[NR_NODES];
+ struct pglist_data *pg_data_ptrs[MAX_NUMNODES];
};
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index f62773284501c..3ae128fe08231 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -59,7 +59,7 @@ extern struct node_cpuid_s node_cpuid[NR_CPUS];
*/
extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES];
-#define node_distance(from,to) (numa_slit[(from) * numnodes + (to)])
+#define node_distance(from,to) (numa_slit[(from) * num_online_nodes() + (to)])
extern int paddr_to_nid(unsigned long paddr);
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index a56a066656747..d809f9f8ecaf1 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -19,6 +19,9 @@
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -116,6 +119,9 @@ do { \
typedef struct {
volatile unsigned int read_counter : 31;
volatile unsigned int write_lock : 1;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
@@ -190,6 +196,8 @@ do { \
#endif /* !ASM_SUPPORTED */
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
#define _raw_write_unlock(x) \
({ \
smp_mb__before_clear_bit(); /* need barrier before releasing lock... */ \
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index 5b0dd8cc6bd49..21cf351fd05cc 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -56,6 +56,8 @@ void build_cpu_to_node_map(void);
.per_cpu_gain = 100, \
.flags = SD_LOAD_BALANCE \
| SD_BALANCE_EXEC \
+ | SD_BALANCE_NEWIDLE \
+ | SD_WAKE_IDLE \
| SD_WAKE_BALANCE, \
.last_balance = jiffies, \
.balance_interval = 1, \
diff --git a/include/asm-m32r/hardirq.h b/include/asm-m32r/hardirq.h
index a89dbc156ca6f..5da830ec15873 100644
--- a/include/asm-m32r/hardirq.h
+++ b/include/asm-m32r/hardirq.h
@@ -27,18 +27,6 @@ typedef struct {
# error HARDIRQ_BITS is too low!
#endif
-#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
-#define nmi_enter() (irq_enter())
-#define nmi_exit() (preempt_count() -= HARDIRQ_OFFSET)
-
-#define irq_exit() \
-do { \
- preempt_count() -= IRQ_EXIT_OFFSET; \
- if (!in_interrupt() && softirq_pending(smp_processor_id())) \
- do_softirq(); \
- preempt_enable_no_resched(); \
-} while (0)
-
static inline void ack_bad_irq(int irq)
{
printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
diff --git a/include/asm-m68k/adb_mouse.h b/include/asm-m68k/adb_mouse.h
deleted file mode 100644
index 6918c83026690..0000000000000
--- a/include/asm-m68k/adb_mouse.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _ASM_ADB_MOUSE_H
-#define _ASM_ADB_MOUSE_H
-
-/*
- * linux/include/asm-m68k/adb_mouse.h
- * header file for Macintosh ADB mouse driver
- * 27-10-97 Michael Schmitz
- * copied from:
- * header file for Atari Mouse driver
- * by Robert de Vries (robert@and.nl) on 19Jul93
- */
-
-struct mouse_status {
- char buttons;
- short dx;
- short dy;
- int ready;
- int active;
- wait_queue_head_t wait;
- struct fasync_struct *fasyncptr;
-};
-
-#endif
diff --git a/include/asm-mips/sections.h b/include/asm-mips/sections.h
index 51ce12aeee836..f7016278b266f 100644
--- a/include/asm-mips/sections.h
+++ b/include/asm-mips/sections.h
@@ -4,6 +4,5 @@
#include <asm-generic/sections.h>
extern char _fdata;
-extern char _end;
#endif /* _ASM_SECTIONS_H */
diff --git a/include/asm-mips/sn/sn_private.h b/include/asm-mips/sn/sn_private.h
index 43d5dc9b33025..13505b37daaef 100644
--- a/include/asm-mips/sn/sn_private.h
+++ b/include/asm-mips/sn/sn_private.h
@@ -12,8 +12,8 @@ extern void cpu_time_init(void);
extern void per_cpu_init(void);
extern void install_cpu_nmi_handler(int slice);
extern void install_ipi(void);
-extern void setup_replication_mask(int);
-extern void replicate_kernel_text(int);
+extern void setup_replication_mask();
+extern void replicate_kernel_text();
extern pfn_t node_getfirstfree(cnodeid_t);
#endif /* __ASM_SN_SN_PRIVATE_H */
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index adbca38ead512..01d4ec0722b55 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -17,6 +17,9 @@
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -127,6 +130,9 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock)
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
@@ -246,6 +252,8 @@ static inline void _raw_write_unlock(rwlock_t *rw)
: "memory");
}
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
static inline int _raw_write_trylock(rwlock_t *rw)
{
unsigned int tmp;
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
index 8a65f6c766e7b..632831f9e6e01 100644
--- a/include/asm-parisc/spinlock.h
+++ b/include/asm-parisc/spinlock.h
@@ -142,6 +142,9 @@ do { \
typedef struct {
spinlock_t lock;
volatile int counter;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { __SPIN_LOCK_UNLOCKED, 0 }
@@ -150,6 +153,8 @@ typedef struct {
#define rwlock_is_locked(lp) ((lp)->counter != 0)
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
/* read_lock, read_unlock are pretty straightforward. Of course it somehow
* sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index cc61eba6a8597..8aecb9e93fc06 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -176,6 +176,9 @@ typedef struct {
void *previous;
struct task_struct * task;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
index d91ba524d8fde..5c3d3baaae181 100644
--- a/include/asm-ppc/spinlock.h
+++ b/include/asm-ppc/spinlock.h
@@ -13,6 +13,9 @@ typedef struct {
volatile unsigned long owner_pc;
volatile unsigned long owner_cpu;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#ifdef __KERNEL__
@@ -83,6 +86,9 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
volatile unsigned long owner_pc;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#ifdef CONFIG_DEBUG_SPINLOCK
@@ -192,5 +198,7 @@ extern int _raw_write_trylock(rwlock_t *rw);
#endif
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
#endif /* __ASM_SPINLOCK_H */
#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
index aea9a3b5f23ff..19f57ab596414 100644
--- a/include/asm-ppc64/iommu.h
+++ b/include/asm-ppc64/iommu.h
@@ -69,18 +69,16 @@ union tce_entry {
struct iommu_table {
unsigned long it_busno; /* Bus number this table belongs to */
- unsigned long it_size; /* Size in pages of iommu table */
+ unsigned long it_size; /* Size of iommu table in entries */
unsigned long it_offset; /* Offset into global table */
unsigned long it_base; /* mapped address of tce table */
unsigned long it_index; /* which iommu table this is */
unsigned long it_type; /* type: PCI or Virtual Bus */
- unsigned long it_entrysize; /* Size of an entry in bytes */
unsigned long it_blocksize; /* Entries in each block (cacheline) */
unsigned long it_hint; /* Hint for next alloc */
unsigned long it_largehint; /* Hint for large allocs */
unsigned long it_halfpoint; /* Breaking point for small/large allocs */
spinlock_t it_lock; /* Protects it_map */
- unsigned long it_mapsize; /* Size of map in # of entries (bits) */
unsigned long *it_map; /* A simple allocation bitmap for now */
};
@@ -156,14 +154,13 @@ extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
size_t size, enum dma_data_direction direction);
-extern void tce_init_pSeries(void);
-extern void tce_init_iSeries(void);
+extern void iommu_init_early_pSeries(void);
+extern void iommu_init_early_iSeries(void);
+extern void iommu_init_early_u3(void);
extern void pci_iommu_init(void);
-extern void pci_dma_init_direct(void);
+extern void pci_direct_iommu_init(void);
extern void alloc_u3_dart_table(void);
-extern int ppc64_iommu_off;
-
#endif /* _ASM_IOMMU_H */
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index ca66a629911f9..ae1c4fd4a7cfb 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -70,6 +70,8 @@ struct machdep_calls {
long index,
long npages);
void (*tce_flush)(struct iommu_table *tbl);
+ void (*iommu_dev_setup)(struct pci_dev *dev);
+ void (*iommu_bus_setup)(struct pci_bus *bus);
int (*probe)(int platform);
void (*setup_arch)(void);
@@ -110,6 +112,10 @@ struct machdep_calls {
ssize_t (*nvram_size)(void);
int (*nvram_sync)(void);
+ /* Exception handlers */
+ void (*system_reset_exception)(struct pt_regs *regs);
+ int (*machine_check_exception)(struct pt_regs *regs);
+
/* Motherboard/chipset features. This is a kind of general purpose
* hook used to control some machine specific features (like reset
* lines, chip power control, etc...).
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index 428cc1947d954..51cfa8b728122 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -79,6 +79,14 @@ static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
return fetch_dev_dn(dev);
}
+static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
+{
+ if (bus->self)
+ return pci_device_to_OF_node(bus->self);
+ else
+ return bus->sysdata; /* Must be root bus (PHB) */
+}
+
extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
struct device_node *dev);
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 0ec53a4addf61..d5b23b426efab 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -45,6 +45,7 @@
#define MSR_DR_LG 4 /* Data Relocate */
#define MSR_PE_LG 3 /* Protection Enable */
#define MSR_PX_LG 2 /* Protection Exclusive Mode */
+#define MSR_PMM_LG 2 /* Performance monitor */
#define MSR_RI_LG 1 /* Recoverable Exception */
#define MSR_LE_LG 0 /* Little Endian */
@@ -77,6 +78,7 @@
#define MSR_DR __MASK(MSR_DR_LG) /* Data Relocate */
#define MSR_PE __MASK(MSR_PE_LG) /* Protection Enable */
#define MSR_PX __MASK(MSR_PX_LG) /* Protection Exclusive Mode */
+#define MSR_PMM __MASK(MSR_PMM_LG) /* Performance monitor */
#define MSR_RI __MASK(MSR_RI_LG) /* Recoverable Exception */
#define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */
@@ -306,6 +308,9 @@
#define SPRN_SIAR 780
#define SPRN_SDAR 781
#define SPRN_MMCRA 786
+#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */
+#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */
+#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */
#define SPRN_PMC1 787
#define SPRN_PMC2 788
#define SPRN_PMC3 789
@@ -315,6 +320,26 @@
#define SPRN_PMC7 793
#define SPRN_PMC8 794
#define SPRN_MMCR0 795
+#define MMCR0_FC 0x80000000UL /* freeze counters. set to 1 on a perfmon exception */
+#define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */
+#define MMCR0_KERNEL_DISABLE MMCR0_FCS
+#define MMCR0_FCP 0x20000000UL /* freeze in problem state */
+#define MMCR0_PROBLEM_DISABLE MMCR0_FCP
+#define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */
+#define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */
+#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
+#define MMCR0_FCECE 0x02000000UL /* freeze counters on enabled condition or event */
+/* time base exception enable */
+#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
+#define MMCR0_PMC1INTCONTROL 0x00008000UL /* PMC1 count enable*/
+#define MMCR0_PMCNINTCONTROL 0x00004000UL /* PMCn count enable*/
+#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
+#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */
+#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */
+#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */
+#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */
+#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
+#define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */
#define SPRN_MMCR1 798
/* Short-hand versions for a number of the above SPRNs */
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h
index f0c034753835f..58e5dc61d9d8e 100644
--- a/include/asm-ppc64/spinlock.h
+++ b/include/asm-ppc64/spinlock.h
@@ -23,10 +23,16 @@
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
typedef struct {
volatile signed int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#ifdef __KERNEL__
@@ -216,6 +222,8 @@ static void __inline__ _raw_read_unlock(rwlock_t *rw)
: "cr0", "memory");
}
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
/*
* This returns the old value in the lock,
* so we got the write lock if the return value is 0.
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h
index ed630fc5cf4a6..d58d9dd799980 100644
--- a/include/asm-ppc64/topology.h
+++ b/include/asm-ppc64/topology.h
@@ -46,11 +46,13 @@ static inline int node_to_first_cpu(int node)
.max_interval = 32, \
.busy_factor = 32, \
.imbalance_pct = 125, \
- .cache_hot_time = (10*1000), \
+ .cache_hot_time = (10*1000000), \
.cache_nice_tries = 1, \
.per_cpu_gain = 100, \
.flags = SD_LOAD_BALANCE \
| SD_BALANCE_EXEC \
+ | SD_BALANCE_NEWIDLE \
+ | SD_WAKE_IDLE \
| SD_WAKE_BALANCE, \
.last_balance = jiffies, \
.balance_interval = 1, \
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 9f52f2650f228..85f043c6d5cff 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -418,6 +418,14 @@ extern inline int pte_young(pte_t pte)
return 0;
}
+extern inline int pte_read(pte_t pte)
+{
+ /* All pages are readable since we don't use the fetch
+ * protection bit in the storage key.
+ */
+ return 1;
+}
+
/*
* pgd/pmd/pte modification functions
*/
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index bc7a8471cd5e4..dbb8223e20df9 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -36,6 +36,9 @@
typedef struct {
volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} __attribute__ ((aligned (4))) spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -105,6 +108,9 @@ extern inline void _raw_spin_unlock(spinlock_t *lp)
typedef struct {
volatile unsigned long lock;
volatile unsigned long owner_pc;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
@@ -211,6 +217,8 @@ typedef struct {
"m" ((rw)->lock) : "2", "3", "cc", "memory" )
#endif /* __s390x__ */
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
extern inline int _raw_write_trylock(rwlock_t *rw)
{
unsigned long result, reg;
diff --git a/include/asm-sh/mpc1211/keyboard.h b/include/asm-sh/mpc1211/keyboard.h
index 33f7b7be6dc4a..5f0b9088c7967 100644
--- a/include/asm-sh/mpc1211/keyboard.h
+++ b/include/asm-sh/mpc1211/keyboard.h
@@ -57,7 +57,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
#define AUX_IRQ 12
#define aux_request_irq(hand, dev_id) \
- request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id)
+ request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS2 Mouse", dev_id)
#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 31f45f2a76826..b2c7f3a9f5bf9 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -17,6 +17,9 @@
*/
typedef struct {
volatile unsigned long lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -68,6 +71,9 @@ static inline void _raw_spin_unlock(spinlock_t *lock)
typedef struct {
spinlock_t lock;
atomic_t counter;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RW_LOCK_BIAS 0x01000000
@@ -105,6 +111,8 @@ static inline void _raw_write_unlock(rwlock_t *rw)
_raw_spin_unlock(&rw->lock);
}
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
static inline int _raw_write_trylock(rwlock_t *rw)
{
if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter))
diff --git a/include/asm-sh64/keyboard.h b/include/asm-sh64/keyboard.h
index cda75f6d1e0c9..733e2bbe7b8c9 100644
--- a/include/asm-sh64/keyboard.h
+++ b/include/asm-sh64/keyboard.h
@@ -65,7 +65,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
#endif
#define aux_request_irq(hand, dev_id) \
- request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id)
+ request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS2 Mouse", dev_id)
#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 4b44ef3b59b45..b0f57d1f38e5d 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -16,6 +16,9 @@
struct _spinlock_debug {
unsigned char lock;
unsigned long owner_pc;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
};
typedef struct _spinlock_debug spinlock_t;
@@ -36,6 +39,9 @@ struct _rwlock_debug {
volatile unsigned int lock;
unsigned long owner_pc;
unsigned long reader_pc[NR_CPUS];
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
};
typedef struct _rwlock_debug rwlock_t;
@@ -79,8 +85,14 @@ do { unsigned long flags; \
#else /* !CONFIG_DEBUG_SPINLOCK */
-typedef unsigned char spinlock_t;
-#define SPIN_LOCK_UNLOCKED 0
+typedef struct {
+ unsigned char lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
+} spinlock_t;
+
+#define SPIN_LOCK_UNLOCKED { 0, }
#define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0)
#define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0)
@@ -137,7 +149,12 @@ extern __inline__ void _raw_spin_unlock(spinlock_t *lock)
* XXX This might create some problems with my dual spinlock
* XXX scheme, deadlocks etc. -DaveM
*/
-typedef struct { volatile unsigned int lock; } rwlock_t;
+typedef struct {
+ volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
+} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index fb7c5b0ea6f10..0f73ca7aaa468 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -304,6 +304,8 @@ do { unsigned long flags; \
#endif /* CONFIG_DEBUG_SPINLOCK */
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
#endif /* !(__ASSEMBLY__) */
#endif /* !(__SPARC64_SPINLOCK_H) */
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index f102bbbc41ab4..21843b35ef181 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -8,9 +8,6 @@ struct node {
u64 start,end;
};
-#define for_all_nodes(x) for ((x) = 0; (x) < numnodes; (x)++) \
- if (node_online(x))
-
extern int compute_hash_shift(struct node *nodes);
#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index a0229ff0baa28..dd354e282a92e 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -66,7 +66,7 @@ static inline int num_booting_cpus(void)
return cpus_weight(cpu_callout_map);
}
-#define smp_processor_id() read_pda(cpunumber)
+#define __smp_processor_id() read_pda(cpunumber)
extern __inline int hard_smp_processor_id(void)
{
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
index 185e087e88ab8..576100a0c21fa 100644
--- a/include/asm-x86_64/spinlock.h
+++ b/include/asm-x86_64/spinlock.h
@@ -18,6 +18,9 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} spinlock_t;
#define SPINLOCK_MAGIC 0xdead4ead
@@ -139,6 +142,9 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
+#ifdef CONFIG_PREEMPT
+ unsigned int break_lock;
+#endif
} rwlock_t;
#define RWLOCK_MAGIC 0xdeaf1eed
@@ -185,6 +191,16 @@ static inline void _raw_write_lock(rwlock_t *rw)
#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory")
#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
+static inline int _raw_read_trylock(rwlock_t *lock)
+{
+ atomic_t *count = (atomic_t *)lock;
+ atomic_dec(count);
+ if (atomic_read(count) >= 0)
+ return 1;
+ atomic_inc(count);
+ return 0;
+}
+
static inline int _raw_write_trylock(rwlock_t *lock)
{
atomic_t *count = (atomic_t *)lock;
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 19fe1613aa6d2..c5fea186bdf28 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -48,11 +48,13 @@ static inline cpumask_t __pcibus_to_cpumask(int bus)
.max_interval = 32, \
.busy_factor = 32, \
.imbalance_pct = 125, \
- .cache_hot_time = (10*1000), \
+ .cache_hot_time = (10*1000000), \
.cache_nice_tries = 1, \
.per_cpu_gain = 100, \
.flags = SD_LOAD_BALANCE \
+ | SD_BALANCE_NEWIDLE \
| SD_BALANCE_EXEC \
+ | SD_WAKE_IDLE \
| SD_WAKE_BALANCE, \
.last_balance = jiffies, \
.balance_interval = 1, \
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index 2b68241da8120..4e2fe240d5d08 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -315,4 +315,26 @@ struct ac97_driver {
extern int ac97_register_driver(struct ac97_driver *driver);
extern void ac97_unregister_driver(struct ac97_driver *driver);
+/* quirk types */
+enum {
+ AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
+ AC97_TUNE_NONE = 0, /* nothing extra to do */
+ AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */
+ AC97_TUNE_SWAP_HP, /* swap headphone and master controls */
+ AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */
+ AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */
+ AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
+};
+
+struct ac97_quirk {
+ unsigned short vendor; /* PCI vendor id */
+ unsigned short device; /* PCI device id */
+ unsigned short mask; /* device id bit mask, 0 = accept all */
+ const char *name; /* name shown as info */
+ int type; /* quirk type above */
+};
+
+struct pci_dev;
+extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
+
#endif /* _AC97_CODEC_H_ */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 141a7460763b3..b68fdf1f31562 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -1186,8 +1186,6 @@ struct media_event_desc {
};
extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med);
-extern int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write);
-extern int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write);
#endif /* End of kernel only stuff */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2d9885aa26266..31391d59ddc24 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -341,7 +341,7 @@ struct address_space {
struct prio_tree_root i_mmap; /* tree of private and shared mappings */
struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
spinlock_t i_mmap_lock; /* protect tree, count, list */
- atomic_t truncate_count; /* Cover race condition with truncate */
+ unsigned int truncate_count; /* Cover race condition with truncate */
unsigned long nrpages; /* number of total pages */
pgoff_t writeback_index;/* writeback starts here */
struct address_space_operations *a_ops; /* methods */
@@ -1345,7 +1345,7 @@ static inline void invalidate_remote_inode(struct inode *inode)
S_ISLNK(inode->i_mode))
invalidate_inode_pages(inode->i_mapping);
}
-extern void invalidate_inode_pages2(struct address_space *mapping);
+extern int invalidate_inode_pages2(struct address_space *mapping);
extern void write_inode_now(struct inode *, int);
extern int filemap_fdatawrite(struct address_space *);
extern int filemap_flush(struct address_space *);
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 1c8417aff025d..09d2047093412 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -82,7 +82,6 @@ void gs_flush_chars(struct tty_struct *tty);
void gs_stop(struct tty_struct *tty);
void gs_start(struct tty_struct *tty);
void gs_hangup(struct tty_struct *tty);
-void gs_do_softint(void *private_);
int gs_block_til_ready(void *port, struct file *filp);
void gs_close(struct tty_struct *tty, struct file *filp);
void gs_set_termios (struct tty_struct * tty,
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index afb35ca096e82..ba0fcb34c8cd5 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -61,12 +61,16 @@
#define in_softirq() (softirq_count())
#define in_interrupt() (irq_count())
-#ifdef CONFIG_PREEMPT
+#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
+#else
+# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
+#endif
+
+#ifdef CONFIG_PREEMPT
# define preemptible() (preempt_count() == 0 && !irqs_disabled())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else
-# define in_atomic() (preempt_count() != 0)
# define preemptible() 0
# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
#endif
@@ -77,10 +81,10 @@ extern void synchronize_irq(unsigned int irq);
# define synchronize_irq(irq) barrier()
#endif
-#define nmi_enter() (preempt_count() += HARDIRQ_OFFSET)
-#define nmi_exit() (preempt_count() -= HARDIRQ_OFFSET)
+#define nmi_enter() irq_enter()
+#define nmi_exit() sub_preempt_count(HARDIRQ_OFFSET)
-#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
+#define irq_enter() add_preempt_count(HARDIRQ_OFFSET)
extern void irq_exit(void);
#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index f11d04d235f2c..c863ab98f1e23 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1097,9 +1097,8 @@ typedef struct ide_driver_s {
int (*cleanup)(ide_drive_t *);
ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
int (*end_request)(ide_drive_t *, int, int);
- u8 (*sense)(ide_drive_t *, const char *, u8);
- ide_startstop_t (*error)(ide_drive_t *, const char *, u8);
- ide_startstop_t (*abort)(ide_drive_t *, const char *);
+ ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
+ ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
void (*pre_reset)(ide_drive_t *);
sector_t (*capacity)(ide_drive_t *);
@@ -1147,12 +1146,7 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
*/
extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
-/*
- * Error reporting, in human readable form (luxurious, but a memory hog).
- *
- * (drive, msg, status)
- */
-byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat);
+ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
/*
* ide_error() takes action based on the error returned by the controller.
@@ -1162,6 +1156,8 @@ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat);
*/
ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
+ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
+
/*
* Abort a running command on the controller triggering the abort
* from a host side, non error situation
@@ -1192,11 +1188,6 @@ extern void ide_fixstring(u8 *, const int, const int);
extern int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
/*
- * Return the current idea about the total capacity of this drive.
- */
-extern sector_t current_capacity (ide_drive_t *drive);
-
-/*
* Start a reset operation for an IDE interface.
* The caller should return immediately after invoking this.
*/
@@ -1511,7 +1502,8 @@ extern int ide_dma_enable(ide_drive_t *drive);
extern char *ide_xfer_verbose(u8 xfer_rate);
extern void ide_toggle_bounce(ide_drive_t *drive, int on);
extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
-extern byte ide_dump_atapi_status(ide_drive_t *drive, const char *msg, byte stat);
+
+u8 ide_dump_status(ide_drive_t *, const char *, u8);
typedef struct ide_pio_timings_s {
int setup_time; /* Address setup (ns) minimum */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index ad1e168004ee5..386e1f91a1e1e 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -45,6 +45,11 @@ struct tun_struct {
struct fasync_struct *fasync;
+ unsigned long if_flags;
+ u8 dev_addr[ETH_ALEN];
+ u32 chr_filter[2];
+ u32 net_filter[2];
+
#ifdef TUN_DEBUG
int debug;
#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 6ef18a885b96e..991831cff1da8 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -70,9 +70,9 @@ extern void enable_irq(unsigned int irq);
/* SoftIRQ primitives. */
#define local_bh_disable() \
- do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0)
+ do { add_preempt_count(SOFTIRQ_OFFSET); barrier(); } while (0)
#define __local_bh_enable() \
- do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0)
+ do { barrier(); sub_preempt_count(SOFTIRQ_OFFSET); } while (0)
extern void local_bh_enable(void);
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index f9974634b833f..7c6eae7f6ed73 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -125,179 +125,6 @@ typedef struct {
#define ISI_TXOK 0x0001
-struct isi_board {
- unsigned short base;
- unsigned char irq;
- unsigned char port_count;
- unsigned short status;
- unsigned short port_status; /* each bit represents a single port */
- unsigned short shift_count;
- struct isi_port * ports;
- signed char count;
- unsigned char isa;
-};
-
-struct isi_port {
- unsigned short magic;
- unsigned int flags;
- int count;
- int blocked_open;
- int close_delay;
- unsigned short channel;
- unsigned short status;
- unsigned short closing_wait;
- struct isi_board * card;
- struct tty_struct * tty;
- wait_queue_head_t close_wait;
- wait_queue_head_t open_wait;
- struct work_struct hangup_tq;
- struct work_struct bh_tqueue;
- unsigned char * xmit_buf;
- int xmit_head;
- int xmit_tail;
- int xmit_cnt;
-};
-
-
-/*
- * ISI Card specific ops ...
- */
-
-static inline void raise_dtr(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: raise_dtr.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0504, base);
- InterruptTheCard(base);
- port->status |= ISI_DTR;
-}
-
-static inline void drop_dtr(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: drop_dtr.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0404, base);
- InterruptTheCard(base);
- port->status &= ~ISI_DTR;
-}
-static inline void raise_rts(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: raise_rts.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0a04, base);
- InterruptTheCard(base);
- port->status |= ISI_RTS;
-}
-static inline void drop_rts(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: drop_rts.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0804, base);
- InterruptTheCard(base);
- port->status &= ~ISI_RTS;
-}
-static inline void raise_dtr_rts(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0f04, base);
- InterruptTheCard(base);
- port->status |= (ISI_DTR | ISI_RTS);
-}
-static inline void drop_dtr_rts(struct isi_port * port)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
- return;
- }
-#ifdef ISICOM_DEBUG_DTR_RTS
- printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n");
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw(0x0c04, base);
- InterruptTheCard(base);
- port->status &= ~(ISI_RTS | ISI_DTR);
-}
-
-static inline void kill_queue(struct isi_port * port, short queue)
-{
- struct isi_board * card = port->card;
- unsigned short base = card->base;
- unsigned char channel = port->channel;
- short wait=400;
- while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
- if (wait <= 0) {
- printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
- return;
- }
-#ifdef ISICOM_DEBUG
- printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue);
-#endif
- outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
- outw((queue << 8) | 0x06, base);
- InterruptTheCard(base);
-}
-
#endif /* __KERNEL__ */
#endif /* ISICOM_H */
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
index ae5d7bda2773d..f2bb770e530aa 100644
--- a/include/linux/mca-legacy.h
+++ b/include/linux/mca-legacy.h
@@ -34,10 +34,6 @@
extern int mca_find_adapter(int id, int start);
extern int mca_find_unused_adapter(int id, int start);
-/* adapter state info - returns 0 if no */
-extern int mca_isadapter(int slot);
-extern int mca_isenabled(int slot);
-
extern int mca_is_adapter_used(int slot);
extern int mca_mark_as_used(int slot);
extern void mca_mark_as_unused(int slot);
@@ -50,7 +46,6 @@ extern unsigned char mca_read_stored_pos(int slot, int reg);
* so we can have a more interesting /proc/mca.
*/
extern void mca_set_adapter_name(int slot, char* name);
-extern char* mca_get_adapter_name(int slot);
/* These routines actually mess with the hardware POS registers. They
* temporarily disable the device (and interrupts), so make sure you know
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3995937c714d1..ee98171353769 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -105,6 +105,7 @@ struct vm_area_struct {
units, *not* PAGE_CACHE_SIZE */
struct file * vm_file; /* File we map to (can be NULL). */
void * vm_private_data; /* was vm_pte (shared mem) */
+ unsigned long vm_truncate_count;/* truncate_count or restart_addr */
#ifndef CONFIG_MMU
atomic_t vm_usage; /* refcount (VMAs shared if !MMU) */
@@ -231,6 +232,8 @@ struct page {
* usually used for buffer_heads
* if PagePrivate set; used for
* swp_entry_t if PageSwapCache
+ * When page is free, this indicates
+ * order in the buddy system.
*/
struct address_space *mapping; /* If low bit clear, points to
* inode address_space, or NULL.
@@ -577,7 +580,9 @@ struct zap_details {
struct address_space *check_mapping; /* Check page->mapping if set */
pgoff_t first_index; /* Lowest page->index to unmap */
pgoff_t last_index; /* Highest page->index to unmap */
- int atomic; /* May not schedule() */
+ spinlock_t *i_mmap_lock; /* For unmap_mapping_range: */
+ unsigned long break_addr; /* Where unmap_vmas stopped */
+ unsigned long truncate_count; /* Compare vm_truncate_count */
};
void zap_page_range(struct vm_area_struct *vma, unsigned long address,
@@ -808,13 +813,6 @@ extern int check_user_page_readable(struct mm_struct *mm, unsigned long address)
int remap_pfn_range(struct vm_area_struct *, unsigned long,
unsigned long, unsigned long, pgprot_t);
-static inline __deprecated /* since 25 Sept 2004 -- wli */
-int remap_page_range(struct vm_area_struct *vma, unsigned long uvaddr,
- unsigned long paddr, unsigned long size, pgprot_t prot)
-{
- return remap_pfn_range(vma, uvaddr, paddr >> PAGE_SHIFT, size, prot);
-}
-
#ifdef CONFIG_PROC_FS
void __vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
#else
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e048bbcacf67e..1d46bd35ab789 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -22,7 +22,6 @@
struct free_area {
struct list_head free_list;
- unsigned long *map;
unsigned long nr_free;
};
@@ -272,7 +271,6 @@ typedef struct pglist_data {
#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
#define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
-extern int numnodes;
extern struct pglist_data *pgdat_list;
void __get_zone_counts(unsigned long *active, unsigned long *inactive,
@@ -311,7 +309,7 @@ static inline struct zone *next_zone(struct zone *zone)
{
pg_data_t *pgdat = zone->zone_pgdat;
- if (zone - pgdat->node_zones < MAX_NR_ZONES - 1)
+ if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
zone++;
else if (pgdat->pgdat_next) {
pgdat = pgdat->pgdat_next;
@@ -357,12 +355,12 @@ static inline int is_normal_idx(int idx)
*/
static inline int is_highmem(struct zone *zone)
{
- return (is_highmem_idx(zone - zone->zone_pgdat->node_zones));
+ return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
}
static inline int is_normal(struct zone *zone)
{
- return (is_normal_idx(zone - zone->zone_pgdat->node_zones));
+ return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
}
/* These two functions are used to setup the per zone pages min values */
@@ -375,7 +373,7 @@ int lower_zone_protection_sysctl_handler(struct ctl_table *, int, struct file *,
#include <linux/topology.h>
/* Returns the number of the current Node. */
-#define numa_node_id() (cpu_to_node(smp_processor_id()))
+#define numa_node_id() (cpu_to_node(_smp_processor_id()))
#ifndef CONFIG_DISCONTIGMEM
diff --git a/include/linux/module.h b/include/linux/module.h
index c8dd7b8495c6d..f496542252671 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -206,10 +206,6 @@ void *__symbol_get_gpl(const char *symbol);
#endif
-/* We don't mangle the actual symbol anymore, so no need for
- * special casing EXPORT_SYMBOL_NOVERS. FIXME: Deprecated */
-#define EXPORT_SYMBOL_NOVERS(sym) EXPORT_SYMBOL(sym)
-
struct module_ref
{
local_t count;
@@ -449,7 +445,6 @@ void module_remove_driver(struct device_driver *);
#else /* !CONFIG_MODULES... */
#define EXPORT_SYMBOL(sym)
#define EXPORT_SYMBOL_GPL(sym)
-#define EXPORT_SYMBOL_NOVERS(sym)
/* Given an address, look for it in the exception tables. */
static inline const struct exception_table_entry *
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 4ac9f8c49d24b..f11387a4cc504 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -239,6 +239,8 @@ extern unsigned long __read_page_state(unsigned offset);
#define SetPagePrivate(page) set_bit(PG_private, &(page)->flags)
#define ClearPagePrivate(page) clear_bit(PG_private, &(page)->flags)
#define PagePrivate(page) test_bit(PG_private, &(page)->flags)
+#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags)
+#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags)
#define SetPageWriteback(page) \
@@ -291,7 +293,11 @@ extern unsigned long __read_page_state(unsigned offset);
#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
+#ifdef CONFIG_HUGETLB_PAGE
#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
+#else
+#define PageCompound(page) 0
+#endif
#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags)
#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags)
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index 0682cb927170f..7825c76cbd00d 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -228,12 +228,6 @@ extern void parport_pc_release_resources(struct parport *p);
extern int parport_pc_claim_resources(struct parport *p);
-extern void parport_pc_init_state(struct pardevice *, struct parport_state *s);
-
-extern void parport_pc_save_state(struct parport *p, struct parport_state *s);
-
-extern void parport_pc_restore_state(struct parport *p, struct parport_state *s);
-
/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */
extern struct parport *parport_pc_probe_port (unsigned long base,
unsigned long base_hi,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d607c59b38516..db0ba81bd689e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2397,6 +2397,9 @@
#define PCI_DEVICE_ID_TIGERJET_300 0x0001
#define PCI_DEVICE_ID_TIGERJET_100 0x0002
+#define PCI_VENDOR_ID_TTTECH 0x0357
+#define PCI_DEVICE_ID_TTTECH_MC322 0x000A
+
#define PCI_VENDOR_ID_ARK 0xedd8
#define PCI_DEVICE_ID_ARK_STING 0xa091
#define PCI_DEVICE_ID_ARK_STINGARK 0xa099
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ba955acdbb010..1e73dd8fd258c 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -2,10 +2,18 @@
#define _LINUX_PIPE_FS_I_H
#define PIPEFS_MAGIC 0x50495045
+
+#define PIPE_BUFFERS (16)
+
+struct pipe_buffer {
+ struct page *page;
+ unsigned short offset, len;
+};
+
struct pipe_inode_info {
wait_queue_head_t wait;
- char *base;
- unsigned int len;
+ unsigned int nrbufs, curbuf;
+ struct pipe_buffer bufs[PIPE_BUFFERS];
unsigned int start;
unsigned int readers;
unsigned int writers;
@@ -33,13 +41,6 @@ struct pipe_inode_info {
#define PIPE_FASYNC_READERS(inode) (&((inode).i_pipe->fasync_readers))
#define PIPE_FASYNC_WRITERS(inode) (&((inode).i_pipe->fasync_writers))
-#define PIPE_EMPTY(inode) (PIPE_LEN(inode) == 0)
-#define PIPE_FULL(inode) (PIPE_LEN(inode) == PIPE_SIZE)
-#define PIPE_FREE(inode) (PIPE_SIZE - PIPE_LEN(inode))
-#define PIPE_END(inode) ((PIPE_START(inode) + PIPE_LEN(inode)) & (PIPE_SIZE-1))
-#define PIPE_MAX_RCHUNK(inode) (PIPE_SIZE - PIPE_START(inode))
-#define PIPE_MAX_WCHUNK(inode) (PIPE_SIZE - PIPE_END(inode))
-
/* Drop the inode semaphore and wait for a pipe event, atomically */
void pipe_wait(struct inode * inode);
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index a7ad90136d642..dd98c54a23b4b 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -9,17 +9,18 @@
#include <linux/config.h>
#include <linux/linkage.h>
-#define preempt_count() (current_thread_info()->preempt_count)
+#ifdef CONFIG_DEBUG_PREEMPT
+ extern void fastcall add_preempt_count(int val);
+ extern void fastcall sub_preempt_count(int val);
+#else
+# define add_preempt_count(val) do { preempt_count() += (val); } while (0)
+# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
+#endif
-#define inc_preempt_count() \
-do { \
- preempt_count()++; \
-} while (0)
+#define inc_preempt_count() add_preempt_count(1)
+#define dec_preempt_count() sub_preempt_count(1)
-#define dec_preempt_count() \
-do { \
- preempt_count()--; \
-} while (0)
+#define preempt_count() (current_thread_info()->preempt_count)
#ifdef CONFIG_PREEMPT
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 14b0b41e5eccc..59e505261fd67 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -231,13 +231,8 @@ extern struct proc_dir_entry proc_root;
static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
{
}
-static inline struct kcore_list * kclist_del(void *addr)
-{
- return NULL;
-}
#else
extern void kclist_add(struct kcore_list *, void *, size_t);
-extern struct kcore_list *kclist_del(void *);
#endif
struct proc_inode {
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index e951b2bb9cdf1..e04c4fe45b533 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -11,14 +11,9 @@ struct dev_info {
typedef struct dev_info dev_info_t;
-struct linear_hash
-{
- dev_info_t *dev0, *dev1;
-};
-
struct linear_private_data
{
- struct linear_hash *hash_table;
+ dev_info_t **hash_table;
dev_info_t *smallest;
int nr_zones;
dev_info_t disks[0];
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index acfde2d1d1526..a57e973af0bd0 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -50,7 +50,6 @@ static inline int reiserfs_acl_count(size_t size)
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
-int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl);
int reiserfs_acl_chmod (struct inode *inode);
int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
int reiserfs_cache_default_acl (struct inode *dir);
@@ -60,7 +59,6 @@ extern struct reiserfs_xattr_handler posix_acl_default_handler;
extern struct reiserfs_xattr_handler posix_acl_access_handler;
#else
-#define reiserfs_set_acl NULL
#define reiserfs_get_acl NULL
#define reiserfs_cache_default_acl(inode) 0
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 6a6062e506893..bccff8b17dc4e 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -243,10 +243,6 @@ struct reiserfs_super_block
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
-extern const char reiserfs_3_5_magic_string[];
-extern const char reiserfs_3_6_magic_string[];
-extern const char reiserfs_jr_magic_string[];
-
int is_reiserfs_3_5 (struct reiserfs_super_block * rs);
int is_reiserfs_3_6 (struct reiserfs_super_block * rs);
int is_reiserfs_jr (struct reiserfs_super_block * rs);
@@ -1559,8 +1555,6 @@ struct item_operations {
};
-extern struct item_operations stat_data_ops, indirect_ops, direct_ops,
- direntry_ops;
extern struct item_operations * item_ops [TYPE_ANY + 1];
#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
@@ -1576,11 +1570,7 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
-
-
-#define COMP_KEYS comp_keys
#define COMP_SHORT_KEYS comp_short_keys
-/*#define keys_of_same_object comp_short_keys*/
/* number of blocks pointed to by the indirect item */
#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE )
@@ -1835,23 +1825,14 @@ int reiserfs_convert_objectid_map_v1(struct super_block *) ;
/* stree.c */
int B_IS_IN_TREE(const struct buffer_head *);
-extern inline void copy_short_key (void * to, const void * from);
extern void copy_item_head(struct item_head * p_v_to,
const struct item_head * p_v_from);
// first key is in cpu form, second - le
-extern int comp_keys (const struct reiserfs_key * le_key,
- const struct cpu_key * cpu_key);
extern int comp_short_keys (const struct reiserfs_key * le_key,
const struct cpu_key * cpu_key);
extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from);
-// both are cpu keys
-extern int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *);
-extern int comp_short_cpu_keys (const struct cpu_key *,
- const struct cpu_key *);
-extern void cpu_key2cpu_key (struct cpu_key *, const struct cpu_key *);
-
// both are in le form
extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *);
extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *);
@@ -1881,8 +1862,6 @@ static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key
int comp_items (const struct item_head * stored_ih, const struct path * p_s_path);
const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path,
const struct super_block * p_s_sb);
-inline int bin_search (const void * p_v_key, const void * p_v_base,
- int p_n_num, int p_n_width, int * p_n_pos);
int search_by_key (struct super_block *, const struct cpu_key *,
struct path *, int);
#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
@@ -1960,7 +1939,6 @@ struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data,
int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp,
int connectable );
-int reiserfs_prepare_write(struct file *, struct page *, unsigned, unsigned) ;
int reiserfs_truncate_file(struct inode *, int update_timestamps) ;
void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset,
int type, int key_length);
@@ -1976,9 +1954,6 @@ int reiserfs_new_inode (struct reiserfs_transaction_handle *th,
const char * symname, loff_t i_size,
struct dentry *dentry, struct inode *inode);
-int reiserfs_sync_inode (struct reiserfs_transaction_handle *th,
- struct inode * inode);
-
void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th,
struct inode * inode, loff_t size);
@@ -2077,15 +2052,12 @@ static inline void reiserfs_kfree(const void *vp, size_t size,
int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb,
struct item_head * p_s_ins_ih, const void *);
void unfix_nodes (struct tree_balance *);
-void free_buffers_in_tb (struct tree_balance * p_s_tb);
/* prints.c */
void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) );
void reiserfs_info (struct super_block *s, const char * fmt, ...);
-void reiserfs_printk (const char * fmt, ...);
void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...);
-void print_virtual_node (struct virtual_node * vn);
void print_indirect_item (struct buffer_head * bh, int item_num);
void store_print_tb (struct tree_balance * tb);
void print_cur_tb (char * mes);
@@ -2095,7 +2067,6 @@ void print_bi (struct buffer_info * bi, char * mes);
#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */
#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */
void print_block (struct buffer_head * bh, ...);
-void print_path (struct tree_balance * tb, struct path * path);
void print_bmap (struct super_block * s, int silent);
void print_bmap_block (int i, char * data, int size, int silent);
/*void print_super_block (struct super_block * s, char * mes);*/
@@ -2136,8 +2107,6 @@ void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head *
int get_left_neighbor_position (struct tree_balance * tb, int h);
int get_right_neighbor_position (struct tree_balance * tb, int h);
void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int);
-void replace_lkey (struct tree_balance *, int, struct item_head *);
-void replace_rkey (struct tree_balance *, int, struct item_head *);
void make_empty_node (struct buffer_info *);
struct buffer_head * get_FEB (struct tree_balance *);
@@ -2262,7 +2231,6 @@ __u32 r5_hash (const signed char *msg, int len);
/* prototypes from ioctl.c */
int reiserfs_ioctl (struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg);
-int reiserfs_unpack (struct inode * inode, struct file * filp);
/* ioctl's command */
#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 84a5728cafa1d..37a3a7afbec7e 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -501,7 +501,6 @@ enum reiserfs_mount_options {
#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC))
#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO))
-#define reiserfs_error_continue(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_CONTINUE))
void reiserfs_file_buffer (struct buffer_head * bh, int list);
extern struct file_system_type reiserfs_fs_type;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fe3e325923a12..3c2c63f23a4a1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -86,9 +86,6 @@ extern unsigned long avenrun[]; /* Load averages */
load += n*(FIXED_1-exp); \
load >>= FSHIFT;
-#define CT_TO_SECS(x) ((x) / HZ)
-#define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ)
-
extern unsigned long total_forks;
extern int nr_threads;
extern int last_pid;
@@ -538,7 +535,6 @@ struct task_struct {
prio_array_t *array;
unsigned long sleep_avg;
- long interactive_credit;
unsigned long long timestamp, last_ran;
int activated;
@@ -756,12 +752,19 @@ extern void sched_exec(void);
#define sched_exec() {}
#endif
+#ifdef CONFIG_HOTPLUG_CPU
+extern void idle_task_exit(void);
+#else
+static inline void idle_task_exit(void) {}
+#endif
+
extern void sched_idle_next(void);
extern void set_user_nice(task_t *p, long nice);
extern int task_prio(const task_t *p);
extern int task_nice(const task_t *p);
extern int task_curr(const task_t *p);
extern int idle_cpu(int cpu);
+extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
void yield(void);
@@ -1064,29 +1067,36 @@ static inline int need_resched(void)
return unlikely(test_thread_flag(TIF_NEED_RESCHED));
}
-extern void __cond_resched(void);
-static inline void cond_resched(void)
-{
- if (need_resched())
- __cond_resched();
-}
+/*
+ * cond_resched() and cond_resched_lock(): latency reduction via
+ * explicit rescheduling in places that are safe. The return
+ * value indicates whether a reschedule was done in fact.
+ * cond_resched_lock() will drop the spinlock before scheduling,
+ * cond_resched_softirq() will enable bhs before scheduling.
+ */
+extern int cond_resched(void);
+extern int cond_resched_lock(spinlock_t * lock);
+extern int cond_resched_softirq(void);
/*
- * cond_resched_lock() - if a reschedule is pending, drop the given lock,
- * call schedule, and on return reacquire the lock.
- *
- * This works OK both with and without CONFIG_PREEMPT. We do strange low-level
- * operations here to prevent schedule() from being called twice (once via
- * spin_unlock(), once by hand).
+ * Does a critical section need to be broken due to another
+ * task waiting?:
*/
-static inline void cond_resched_lock(spinlock_t * lock)
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
+# define need_lockbreak(lock) ((lock)->break_lock)
+#else
+# define need_lockbreak(lock) 0
+#endif
+
+/*
+ * Does a critical section need to be broken due to another
+ * task waiting or preemption being signalled:
+ */
+static inline int lock_need_resched(spinlock_t *lock)
{
- if (need_resched()) {
- _raw_spin_unlock(lock);
- preempt_enable_no_resched();
- __cond_resched();
- spin_lock(lock);
- }
+ if (need_lockbreak(lock) || need_resched())
+ return 1;
+ return 0;
}
/* Reevaluate whether the task has signals pending delivery.
diff --git a/include/linux/smp.h b/include/linux/smp.h
index a4ca8abdbedb5..c438ec9880e94 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -97,8 +97,10 @@ void smp_prepare_boot_cpu(void);
/*
* These macros fold the SMP functionality into a single CPU system
*/
-
-#define smp_processor_id() 0
+
+#if !defined(__smp_processor_id) || !defined(CONFIG_PREEMPT)
+# define smp_processor_id() 0
+#endif
#define hard_smp_processor_id() 0
#define smp_threads_ready 1
#define smp_call_function(func,info,retry,wait) ({ 0; })
@@ -109,6 +111,33 @@ static inline void smp_send_reschedule(int cpu) { }
#endif /* !SMP */
+/*
+ * DEBUG_PREEMPT support: check whether smp_processor_id() is being
+ * used in a preemption-safe way.
+ *
+ * An architecture has to enable this debugging code explicitly.
+ * It can do so by renaming the smp_processor_id() macro to
+ * __smp_processor_id(). This should only be done after some minimal
+ * testing, because usually there are a number of false positives
+ * that an architecture will trigger.
+ *
+ * To fix a false positive (i.e. smp_processor_id() use that the
+ * debugging code reports but which use for some reason is legal),
+ * change the smp_processor_id() reference to _smp_processor_id(),
+ * which is the nondebug variant. NOTE: don't use this to hack around
+ * real bugs.
+ */
+#ifdef __smp_processor_id
+# if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT)
+ extern unsigned int smp_processor_id(void);
+# else
+# define smp_processor_id() __smp_processor_id()
+# endif
+# define _smp_processor_id() __smp_processor_id()
+#else
+# define _smp_processor_id() smp_processor_id()
+#endif
+
#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
#define put_cpu() preempt_enable()
#define put_cpu_no_resched() preempt_enable_no_resched()
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 8a142e0311a2b..b63ce70140931 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -9,15 +9,15 @@
#define kernel_locked() (current->lock_depth >= 0)
-extern int __lockfunc get_kernel_lock(void);
-extern void __lockfunc put_kernel_lock(void);
+extern int __lockfunc __reacquire_kernel_lock(void);
+extern void __lockfunc __release_kernel_lock(void);
/*
* Release/re-acquire global kernel lock for the scheduler
*/
#define release_kernel_lock(tsk) do { \
if (unlikely((tsk)->lock_depth >= 0)) \
- put_kernel_lock(); \
+ __release_kernel_lock(); \
} while (0)
/*
@@ -26,16 +26,16 @@ extern void __lockfunc put_kernel_lock(void);
* reacquire_kernel_lock() so that the compiler can see
* it at compile-time.
*/
-#ifdef CONFIG_SMP
-#define return_value_on_smp return
+#if defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_BKL)
+# define return_value_on_smp return
#else
-#define return_value_on_smp
+# define return_value_on_smp
#endif
static inline int reacquire_kernel_lock(struct task_struct *task)
{
if (unlikely(task->lock_depth >= 0))
- return_value_on_smp get_kernel_lock();
+ return_value_on_smp __reacquire_kernel_lock();
return 0;
}
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 027c06f522bd9..b8224ded2d979 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -41,6 +41,7 @@
#include <asm/spinlock.h>
int __lockfunc _spin_trylock(spinlock_t *lock);
+int __lockfunc _read_trylock(rwlock_t *lock);
int __lockfunc _write_trylock(rwlock_t *lock);
void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t);
@@ -73,6 +74,7 @@ void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
int __lockfunc _spin_trylock_bh(spinlock_t *lock);
+int __lockfunc generic_raw_read_trylock(rwlock_t *lock);
int in_lock_functions(unsigned long addr);
#else
@@ -219,11 +221,15 @@ typedef struct {
#define _raw_read_unlock(lock) do { (void)(lock); } while(0)
#define _raw_write_lock(lock) do { (void)(lock); } while(0)
#define _raw_write_unlock(lock) do { (void)(lock); } while(0)
+#define _raw_read_trylock(lock) ({ (void)(lock); (1); })
#define _raw_write_trylock(lock) ({ (void)(lock); (1); })
#define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \
1 : ({preempt_enable(); 0;});})
+#define _read_trylock(lock) ({preempt_disable();_raw_read_trylock(lock) ? \
+ 1 : ({preempt_enable(); 0;});})
+
#define _write_trylock(lock) ({preempt_disable(); _raw_write_trylock(lock) ? \
1 : ({preempt_enable(); 0;});})
@@ -425,16 +431,12 @@ do { \
* methods are defined as nops in the case they are not required.
*/
#define spin_trylock(lock) __cond_lock(_spin_trylock(lock))
+#define read_trylock(lock) __cond_lock(_read_trylock(lock))
#define write_trylock(lock) __cond_lock(_write_trylock(lock))
-/* Where's read_trylock? */
-
#define spin_lock(lock) _spin_lock(lock)
#define write_lock(lock) _write_lock(lock)
#define read_lock(lock) _read_lock(lock)
-#define spin_unlock(lock) _spin_unlock(lock)
-#define write_unlock(lock) _write_unlock(lock)
-#define read_unlock(lock) _read_unlock(lock)
#ifdef CONFIG_SMP
#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
@@ -454,6 +456,11 @@ do { \
#define write_lock_irq(lock) _write_lock_irq(lock)
#define write_lock_bh(lock) _write_lock_bh(lock)
+
+#define spin_unlock(lock) _spin_unlock(lock)
+#define write_unlock(lock) _write_unlock(lock)
+#define read_unlock(lock) _read_unlock(lock)
+
#define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags)
#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
@@ -490,6 +497,7 @@ extern void _metered_read_lock (rwlock_t *lock);
extern void _metered_read_unlock (rwlock_t *lock);
extern void _metered_write_lock (rwlock_t *lock);
extern void _metered_write_unlock (rwlock_t *lock);
+extern int _metered_read_trylock (rwlock_t *lock);
extern int _metered_write_trylock(rwlock_t *lock);
#endif
@@ -519,8 +527,11 @@ static inline void bit_spin_lock(int bitnum, unsigned long *addr)
preempt_disable();
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
while (test_and_set_bit(bitnum, addr)) {
- while (test_bit(bitnum, addr))
+ while (test_bit(bitnum, addr)) {
+ preempt_enable();
cpu_relax();
+ preempt_disable();
+ }
}
#endif
__acquire(bitlock);
@@ -570,4 +581,7 @@ static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
#endif
}
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
+
#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 1206d5a983a98..295f4c05c7f5d 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -43,16 +43,9 @@
})
#endif
-static inline int __next_node_with_cpus(int node)
-{
- do
- ++node;
- while (node < numnodes && !nr_cpus_node(node));
- return node;
-}
-
-#define for_each_node_with_cpus(node) \
- for (node = 0; node < numnodes; node = __next_node_with_cpus(node))
+#define for_each_node_with_cpus(node) \
+ for_each_online_node(node) \
+ if (nr_cpus_node(node))
#ifndef node_distance
/* Conform to ACPI 2.0 SLIT distance definitions */
@@ -116,13 +109,14 @@ static inline int __next_node_with_cpus(int node)
.max_interval = 4, \
.busy_factor = 64, \
.imbalance_pct = 125, \
- .cache_hot_time = (5*1000/2), \
+ .cache_hot_time = (5*1000000/2), \
.cache_nice_tries = 1, \
.per_cpu_gain = 100, \
.flags = SD_LOAD_BALANCE \
| SD_BALANCE_NEWIDLE \
| SD_BALANCE_EXEC \
| SD_WAKE_AFFINE \
+ | SD_WAKE_IDLE \
| SD_WAKE_BALANCE, \
.last_balance = jiffies, \
.balance_interval = 1, \
diff --git a/include/net/route.h b/include/net/route.h
index 5e0100185d95e..6228a91777dc4 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -105,7 +105,7 @@ struct rt_cache_stat
extern struct rt_cache_stat *rt_cache_stat;
#define RT_CACHE_STAT_INC(field) \
- (per_cpu_ptr(rt_cache_stat, smp_processor_id())->field++)
+ (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++)
extern struct ip_rt_acct *ip_rt_acct;
diff --git a/include/net/snmp.h b/include/net/snmp.h
index b7068876e0ebc..a15ab256276ed 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -128,18 +128,18 @@ struct linux_mib {
#define SNMP_STAT_USRPTR(name) (name[1])
#define SNMP_INC_STATS_BH(mib, field) \
- (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field]++)
+ (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field]++)
#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \
- (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field + (offset)]++)
+ (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field + (offset)]++)
#define SNMP_INC_STATS_USER(mib, field) \
- (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field]++)
+ (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field]++)
#define SNMP_INC_STATS(mib, field) \
- (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]++)
+ (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]++)
#define SNMP_DEC_STATS(mib, field) \
- (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]--)
+ (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]--)
#define SNMP_ADD_STATS_BH(mib, field, addend) \
- (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field] += addend)
+ (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field] += addend)
#define SNMP_ADD_STATS_USER(mib, field, addend) \
- (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field] += addend)
+ (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field] += addend)
#endif
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h
index 559d87352f9a8..261dd5bbbdf27 100644
--- a/include/pcmcia/mem_op.h
+++ b/include/pcmcia/mem_op.h
@@ -76,67 +76,54 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n)
#else /* UNSAFE_MEMCPY */
-static inline void copy_from_pc(void *to, const void *from, size_t n)
+static inline void copy_from_pc(void *to, void __iomem *from, size_t n)
{
- size_t odd = (n & 1);
- n -= odd;
- while (n) {
- u_short *t = to;
-
- *t = __raw_readw(from);
- to = (void *)((long)to + 2);
- from = (const void *)((long)from + 2);
- n -= 2;
- }
- if (odd)
- *(u_char *)to = readb(from);
+ __u16 *t = to;
+ __u16 __iomem *f = from;
+ size_t odd = (n & 1);
+ for (n >>= 1; n; n--)
+ *t++ = __raw_readw(f++);
+ if (odd)
+ *(__u8 *)t = readb(f);
}
-static inline void copy_to_pc(void *to, const void *from, size_t n)
+static inline void copy_to_pc(void __iomem *to, const void *from, size_t n)
{
- size_t odd = (n & 1);
- n -= odd;
- while (n) {
- __raw_writew(*(u_short *)from, to);
- to = (void *)((long)to + 2);
- from = (const void *)((long)from + 2);
- n -= 2;
- }
- if (odd)
- writeb(*(u_char *)from, to);
+ __u16 __iomem *t = to;
+ const __u16 *f = from;
+ size_t odd = (n & 1);
+ for (n >>= 1; n ; n--)
+ __raw_writew(*f++, t++);
+ if (odd)
+ writeb(*(__u8 *)f, t);
}
-static inline void copy_pc_to_user(void *to, const void *from, size_t n)
+static inline void copy_pc_to_user(void __user *to, void __iomem *from, size_t n)
{
- size_t odd = (n & 1);
- n -= odd;
- while (n) {
- put_user(__raw_readw(from), (short *)to);
- to = (void *)((long)to + 2);
- from = (const void *)((long)from + 2);
- n -= 2;
- }
- if (odd)
- put_user(readb(from), (char *)to);
+ __u16 __user *t = to;
+ __u16 __iomem *f = from;
+ size_t odd = (n & 1);
+ for (n >>= 1; n ; n--)
+ put_user(__raw_readw(f++), t++);
+ if (odd)
+ put_user(readb(f), (char __user *)t);
}
-static inline void copy_user_to_pc(void *to, const void *from, size_t n)
+static inline void copy_user_to_pc(void __iomem *to, void __user *from, size_t n)
{
- short s;
- char c;
- size_t odd = (n & 1);
- n -= odd;
- while (n) {
- get_user(s, (short *)from);
- __raw_writew(s, to);
- to = (void *)((long)to + 2);
- from = (const void *)((long)from + 2);
- n -= 2;
- }
- if (odd) {
- get_user(c, (char *)from);
- writeb(c, to);
- }
+ __u16 __user *f = from;
+ __u16 __iomem *t = to;
+ short s;
+ char c;
+ size_t odd = (n & 1);
+ for (n >>= 1; n; n--) {
+ get_user(s, f++);
+ __raw_writew(s, t++);
+ }
+ if (odd) {
+ get_user(c, (char __user *)f);
+ writeb(c, t);
+ }
}
#endif /* UNSAFE_MEMCPY */
diff --git a/init/initramfs.c b/init/initramfs.c
index 722bb17241f23..20b12cae0903b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -241,10 +241,9 @@ static __initdata int wfd;
static int __init do_name(void)
{
state = SkipIt;
- next_state = Start;
+ next_state = Reset;
if (strcmp(collected, "TRAILER!!!") == 0) {
free_hash();
- next_state = Reset;
return 0;
}
if (dry_run)
@@ -295,7 +294,7 @@ static int __init do_symlink(void)
sys_symlink(collected + N_ALIGN(name_len), collected);
sys_lchown(collected, uid, gid);
state = SkipIt;
- next_state = Start;
+ next_state = Reset;
return 0;
}
@@ -331,6 +330,10 @@ static void __init flush_buffer(char *buf, unsigned len)
buf += written;
len -= written;
state = Start;
+ } else if (c == 0) {
+ buf += written;
+ len -= written;
+ state = Reset;
} else
error("junk in compressed archive");
}
@@ -410,7 +413,7 @@ static void __init flush_window(void)
outcnt = 0;
}
-char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
+static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
{
int written;
dry_run = check_only;
diff --git a/init/main.c b/init/main.c
index 6eaeffde35f6f..dfc7a13758741 100644
--- a/init/main.c
+++ b/init/main.c
@@ -373,6 +373,12 @@ static void noinline rest_init(void)
{
kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
+ /*
+ * Re-enable preemption but disable interrupts to make sure
+ * we dont get preempted until we schedule() in cpu_idle().
+ */
+ local_irq_disable();
+ preempt_enable_no_resched();
unlock_kernel();
cpu_idle();
}
@@ -438,6 +444,11 @@ asmlinkage void __init start_kernel(void)
* time - but meanwhile we still have a functioning scheduler.
*/
sched_init();
+ /*
+ * Disable preemption - early bootup scheduling is extremely
+ * fragile until we cpu_idle() for the first time.
+ */
+ preempt_disable();
build_all_zonelists();
page_alloc_init();
printk("Kernel command line: %s\n", saved_command_line);
@@ -688,16 +699,3 @@ static int init(void * unused)
panic("No init found. Try passing init= option to kernel.");
}
-
-static int early_param_test(char *rest)
-{
- printk("early_parm_test: %s\n", rest ?: "(null)");
- return rest ? 0 : -EINVAL;
-}
-early_param("testsetup", early_param_test);
-static int early_setup_test(char *rest)
-{
- printk("early_setup_test: %s\n", rest ?: "(null)");
- return 0;
-}
-__setup("testsetup_long", early_setup_test);
diff --git a/kernel/audit.c b/kernel/audit.c
index d813b7aa4b4ca..8ec8a88ad35c3 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -98,8 +98,8 @@ static struct sock *audit_sock;
* The second list is a list of pre-allocated audit buffers (if more
* than AUDIT_MAXFREE are in use, the audit buffer is freed instead of
* being placed on the freelist). */
-static spinlock_t audit_txlist_lock = SPIN_LOCK_UNLOCKED;
-static spinlock_t audit_freelist_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(audit_txlist_lock);
+static DEFINE_SPINLOCK(audit_freelist_lock);
static int audit_freelist_count = 0;
static LIST_HEAD(audit_txlist);
static LIST_HEAD(audit_freelist);
@@ -169,7 +169,7 @@ static inline int audit_rate_check(void)
{
static unsigned long last_check = 0;
static int messages = 0;
- static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(lock);
unsigned long flags;
unsigned long now;
unsigned long elapsed;
@@ -199,7 +199,7 @@ static inline int audit_rate_check(void)
void audit_log_lost(const char *message)
{
static unsigned long last_msg = 0;
- static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(lock);
unsigned long flags;
unsigned long now;
int print;
diff --git a/kernel/capability.c b/kernel/capability.c
index 1d70f47058e84..b828d545a97b7 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -23,7 +23,7 @@ EXPORT_SYMBOL(cap_bset);
* This global lock protects task->cap_* for all tasks including current.
* Locking rule: acquire this prior to tasklist_lock.
*/
-spinlock_t task_capability_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(task_capability_lock);
/*
* For sys_getproccap() and sys_setproccap(), any of the three
diff --git a/kernel/cpu.c b/kernel/cpu.c
index ebaba873ebadc..b97f7f91ec6dc 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -132,7 +132,8 @@ int cpu_down(unsigned int cpu)
__cpu_die(cpu);
/* Move it here so it can run. */
- kthread_bind(p, smp_processor_id());
+ kthread_bind(p, get_cpu());
+ put_cpu();
/* CPU is completely dead: tell everyone. Too late to complain. */
if (notifier_call_chain(&cpu_chain, CPU_DEAD, (void *)(long)cpu)
diff --git a/kernel/dma.c b/kernel/dma.c
index 940d02c508799..aef0a45b7893d 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -38,7 +38,7 @@
*/
-spinlock_t dma_spin_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(dma_spin_lock);
/*
* If our port doesn't define this it has no PC like DMA
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index ad3e5d54e1194..867d6dbeb5743 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -22,7 +22,7 @@
static void default_handler(int, struct pt_regs *);
static struct exec_domain *exec_domains = &default_exec_domain;
-static rwlock_t exec_domains_lock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(exec_domains_lock);
static u_long ident_map[32] = {
diff --git a/kernel/exit.c b/kernel/exit.c
index dc7549cd7a581..54a59c727356c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -332,7 +332,9 @@ void daemonize(const char *name, ...)
exit_mm(current);
set_special_pids(1, 1);
+ down(&tty_sem);
current->signal->tty = NULL;
+ up(&tty_sem);
/* Block and flush all signals */
sigfillset(&blocked);
diff --git a/kernel/fork.c b/kernel/fork.c
index e861703f11e8d..6d9412937d372 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -58,7 +58,7 @@ int max_threads; /* tunable limit on nr_threads */
DEFINE_PER_CPU(unsigned long, process_counts) = 0;
-rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED; /* outer */
+ __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */
EXPORT_SYMBOL(tasklist_lock);
@@ -219,6 +219,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
/* insert tmp into the share list, just after mpnt */
spin_lock(&file->f_mapping->i_mmap_lock);
+ tmp->vm_truncate_count = mpnt->vm_truncate_count;
flush_dcache_mmap_lock(file->f_mapping);
vma_prio_tree_add(tmp, mpnt);
flush_dcache_mmap_unlock(file->f_mapping);
@@ -280,7 +281,7 @@ static inline void mm_free_pgd(struct mm_struct * mm)
#define mm_free_pgd(mm)
#endif /* CONFIG_MMU */
-spinlock_t mmlist_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
+ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
#define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm)))
diff --git a/kernel/intermodule.c b/kernel/intermodule.c
index 09f556507f57c..9078649382cfe 100644
--- a/kernel/intermodule.c
+++ b/kernel/intermodule.c
@@ -14,7 +14,7 @@
*/
static struct list_head ime_list = LIST_HEAD_INIT(ime_list);
-static spinlock_t ime_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ime_lock);
static int kmalloc_failed;
struct inter_module_entry {
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index d3d1321b0e5c2..cc6f72585f1e8 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -43,7 +43,7 @@
static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE];
unsigned int kprobe_cpu = NR_CPUS;
-static spinlock_t kprobe_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(kprobe_lock);
/* Locks kprobe: irqs must be disabled */
void lock_kprobes(void)
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 5689ebb1a250c..e377e2244103b 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -14,6 +14,12 @@
#include <linux/module.h>
#include <asm/semaphore.h>
+/*
+ * We dont want to execute off keventd since it might
+ * hold a semaphore our callers hold too:
+ */
+static struct workqueue_struct *helper_wq;
+
struct kthread_create_info
{
/* Information passed to kthread() from keventd. */
@@ -126,12 +132,13 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
init_completion(&create.started);
init_completion(&create.done);
- /* If we're being called to start the first workqueue, we
- * can't use keventd. */
- if (!keventd_up())
+ /*
+ * The workqueue needs to start up first:
+ */
+ if (!helper_wq)
work.func(work.data);
else {
- schedule_work(&work);
+ queue_work(helper_wq, &work);
wait_for_completion(&create.done);
}
if (!IS_ERR(create.result)) {
@@ -183,3 +190,13 @@ int kthread_stop(struct task_struct *k)
return ret;
}
EXPORT_SYMBOL(kthread_stop);
+
+static __init int helper_init(void)
+{
+ helper_wq = create_singlethread_workqueue("kthread");
+ BUG_ON(!helper_wq);
+
+ return 0;
+}
+core_initcall(helper_init);
+
diff --git a/kernel/module.c b/kernel/module.c
index 887ed2510105d..167089669c0f0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -53,7 +53,7 @@
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
/* Protects module list */
-static spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(modlist_lock);
/* List of modules, protected by module_mutex AND modlist_lock */
static DECLARE_MUTEX(module_mutex);
@@ -379,7 +379,7 @@ static void module_unload_init(struct module *mod)
for (i = 0; i < NR_CPUS; i++)
local_set(&mod->ref[i].count, 0);
/* Hold reference count during initialization. */
- local_set(&mod->ref[smp_processor_id()].count, 1);
+ local_set(&mod->ref[_smp_processor_id()].count, 1);
/* Backwards compatibility macros put refcount during init. */
mod->waiter = current;
}
diff --git a/kernel/pid.c b/kernel/pid.c
index 185a8bee81683..edba31c681ace 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -60,7 +60,7 @@ typedef struct pidmap {
static pidmap_t pidmap_array[PIDMAP_ENTRIES] =
{ [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } };
-static spinlock_t pidmap_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock);
fastcall void free_pidmap(int pid)
{
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 33a67e7ad826f..9e79eca513ca7 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -85,7 +85,7 @@ static inline u64 mpy_l_X_l_ll(unsigned long mpy1,unsigned long mpy2)
*/
static kmem_cache_t *posix_timers_cache;
static struct idr posix_timers_id;
-static spinlock_t idr_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(idr_lock);
/*
* Just because the timer is not in the timer list does NOT mean it is
diff --git a/kernel/printk.c b/kernel/printk.c
index 4e9fd492f30ec..d914a90d6206d 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -78,7 +78,7 @@ static int console_locked;
* It is also used in interesting ways to provide interlocking in
* release_console_sem().
*/
-static spinlock_t logbuf_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(logbuf_lock);
static char __log_buf[__LOG_BUF_LEN];
static char *log_buf = __log_buf;
@@ -284,6 +284,7 @@ int do_syslog(int type, char __user * buf, int len)
error = __put_user(c,buf);
buf++;
i++;
+ cond_resched();
spin_lock_irq(&logbuf_lock);
}
spin_unlock_irq(&logbuf_lock);
@@ -325,6 +326,7 @@ int do_syslog(int type, char __user * buf, int len)
c = LOG_BUF(j);
spin_unlock_irq(&logbuf_lock);
error = __put_user(c,&buf[count-1-i]);
+ cond_resched();
spin_lock_irq(&logbuf_lock);
}
spin_unlock_irq(&logbuf_lock);
@@ -340,6 +342,7 @@ int do_syslog(int type, char __user * buf, int len)
error = -EFAULT;
break;
}
+ cond_resched();
}
}
break;
@@ -642,8 +645,9 @@ void release_console_sem(void)
_con_start = con_start;
_log_end = log_end;
con_start = log_end; /* Flush */
- spin_unlock_irqrestore(&logbuf_lock, flags);
+ spin_unlock(&logbuf_lock);
call_console_drivers(_con_start, _log_end);
+ local_irq_restore(flags);
}
console_locked = 0;
console_may_schedule = 0;
@@ -871,7 +875,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)
*/
int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst)
{
- static spinlock_t ratelimit_lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(ratelimit_lock);
static unsigned long toks = 10*5*HZ;
static unsigned long last_msg;
static int missed;
diff --git a/kernel/profile.c b/kernel/profile.c
index 1bf1ec5fe56bd..a38fa70075fe4 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -83,7 +83,7 @@ void __init profile_init(void)
#ifdef CONFIG_PROFILING
static DECLARE_RWSEM(profile_rwsem);
-static rwlock_t handoff_lock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(handoff_lock);
static struct notifier_block * task_exit_notifier;
static struct notifier_block * task_free_notifier;
static struct notifier_block * munmap_notifier;
diff --git a/kernel/resource.c b/kernel/resource.c
index 5f013dc4f649f..72596bc6fdafb 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -39,7 +39,7 @@ struct resource iomem_resource = {
EXPORT_SYMBOL(iomem_resource);
-static rwlock_t resource_lock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(resource_lock);
#ifdef CONFIG_PROC_FS
diff --git a/kernel/sched.c b/kernel/sched.c
index 9f1e93a2bf0ef..1c523337bc617 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -49,12 +49,6 @@
#include <asm/unistd.h>
-#ifdef CONFIG_NUMA
-#define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
-#else
-#define cpu_to_node_mask(cpu) (cpu_online_map)
-#endif
-
/*
* Convert user-nice values [ -20 ... 0 ... 19 ]
* to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
@@ -98,7 +92,6 @@
#define MAX_SLEEP_AVG (DEF_TIMESLICE * MAX_BONUS)
#define STARVATION_LIMIT (MAX_SLEEP_AVG)
#define NS_MAX_SLEEP_AVG (JIFFIES_TO_NS(MAX_SLEEP_AVG))
-#define CREDIT_LIMIT 100
/*
* If a task is 'interactive' then we reinsert it in the active
@@ -132,12 +125,14 @@
(NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \
MAX_SLEEP_AVG)
+#define GRANULARITY (10 * HZ / 1000 ? : 1)
+
#ifdef CONFIG_SMP
-#define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \
+#define TIMESLICE_GRANULARITY(p) (GRANULARITY * \
(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \
num_online_cpus())
#else
-#define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \
+#define TIMESLICE_GRANULARITY(p) (GRANULARITY * \
(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)))
#endif
@@ -154,12 +149,6 @@
(JIFFIES_TO_NS(MAX_SLEEP_AVG * \
(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))
-#define HIGH_CREDIT(p) \
- ((p)->interactive_credit > CREDIT_LIMIT)
-
-#define LOW_CREDIT(p) \
- ((p)->interactive_credit < -CREDIT_LIMIT)
-
#define TASK_PREEMPTS_CURR(p, rq) \
((p)->prio < (rq)->curr->prio)
@@ -449,11 +438,21 @@ static runqueue_t *this_rq_lock(void)
return rq;
}
-static inline void rq_unlock(runqueue_t *rq)
- __releases(rq->lock)
+#ifdef CONFIG_SCHED_SMT
+static int cpu_and_siblings_are_idle(int cpu)
{
- spin_unlock_irq(&rq->lock);
+ int sib;
+ for_each_cpu_mask(sib, cpu_sibling_map[cpu]) {
+ if (idle_cpu(sib))
+ continue;
+ return 0;
+ }
+
+ return 1;
}
+#else
+#define cpu_and_siblings_are_idle(A) idle_cpu(A)
+#endif
#ifdef CONFIG_SCHEDSTATS
/*
@@ -582,10 +581,14 @@ static void enqueue_task(struct task_struct *p, prio_array_t *array)
}
/*
- * Used by the migration code - we pull tasks from the head of the
- * remote queue so we want these tasks to show up at the head of the
- * local queue:
+ * Put task to the end of the run list without the overhead of dequeue
+ * followed by enqueue.
*/
+static void requeue_task(struct task_struct *p, prio_array_t *array)
+{
+ list_move_tail(&p->run_list, array->queue + p->prio);
+}
+
static inline void enqueue_task_head(struct task_struct *p, prio_array_t *array)
{
list_add(&p->run_list, array->queue + p->prio);
@@ -664,8 +667,6 @@ static void recalc_task_prio(task_t *p, unsigned long long now)
sleep_time > INTERACTIVE_SLEEP(p)) {
p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG -
DEF_TIMESLICE);
- if (!HIGH_CREDIT(p))
- p->interactive_credit++;
} else {
/*
* The lower the sleep avg a task has the more
@@ -674,19 +675,11 @@ static void recalc_task_prio(task_t *p, unsigned long long now)
sleep_time *= (MAX_BONUS - CURRENT_BONUS(p)) ? : 1;
/*
- * Tasks with low interactive_credit are limited to
- * one timeslice worth of sleep avg bonus.
+ * Tasks waking from uninterruptible sleep are
+ * limited in their sleep_avg rise as they
+ * are likely to be waiting on I/O
*/
- if (LOW_CREDIT(p) &&
- sleep_time > JIFFIES_TO_NS(task_timeslice(p)))
- sleep_time = JIFFIES_TO_NS(task_timeslice(p));
-
- /*
- * Non high_credit tasks waking from uninterruptible
- * sleep are limited in their sleep_avg rise as they
- * are likely to be cpu hogs waiting on I/O
- */
- if (p->activated == -1 && !HIGH_CREDIT(p) && p->mm) {
+ if (p->activated == -1 && p->mm) {
if (p->sleep_avg >= INTERACTIVE_SLEEP(p))
sleep_time = 0;
else if (p->sleep_avg + sleep_time >=
@@ -706,11 +699,8 @@ static void recalc_task_prio(task_t *p, unsigned long long now)
*/
p->sleep_avg += sleep_time;
- if (p->sleep_avg > NS_MAX_SLEEP_AVG) {
+ if (p->sleep_avg > NS_MAX_SLEEP_AVG)
p->sleep_avg = NS_MAX_SLEEP_AVG;
- if (!HIGH_CREDIT(p))
- p->interactive_credit++;
- }
}
}
@@ -935,9 +925,10 @@ static inline unsigned long target_load(int cpu)
#endif
/*
- * wake_idle() is useful especially on SMT architectures to wake a
- * task onto an idle sibling if we would otherwise wake it onto a
- * busy sibling.
+ * wake_idle() will wake a task on an idle cpu if task->cpu is
+ * not idle and an idle cpu is available. The span of cpus to
+ * search starts with cpus closest then further out as needed,
+ * so we always favor a closer, idle cpu.
*
* Returns the CPU we should wake onto.
*/
@@ -945,24 +936,23 @@ static inline unsigned long target_load(int cpu)
static int wake_idle(int cpu, task_t *p)
{
cpumask_t tmp;
- runqueue_t *rq = cpu_rq(cpu);
struct sched_domain *sd;
int i;
if (idle_cpu(cpu))
return cpu;
- sd = rq->sd;
- if (!(sd->flags & SD_WAKE_IDLE))
- return cpu;
-
- cpus_and(tmp, sd->span, p->cpus_allowed);
-
- for_each_cpu_mask(i, tmp) {
- if (idle_cpu(i))
- return i;
+ for_each_domain(cpu, sd) {
+ if (sd->flags & SD_WAKE_IDLE) {
+ cpus_and(tmp, sd->span, cpu_online_map);
+ cpus_and(tmp, tmp, p->cpus_allowed);
+ for_each_cpu_mask(i, tmp) {
+ if (idle_cpu(i))
+ return i;
+ }
+ }
+ else break;
}
-
return cpu;
}
#else
@@ -1074,7 +1064,7 @@ static int try_to_wake_up(task_t * p, unsigned int state, int sync)
out_set_cpu:
schedstat_inc(rq, ttwu_attempts);
new_cpu = wake_idle(new_cpu, p);
- if (new_cpu != cpu && cpu_isset(new_cpu, p->cpus_allowed)) {
+ if (new_cpu != cpu) {
schedstat_inc(rq, ttwu_moved);
set_task_cpu(p, new_cpu);
task_rq_unlock(rq, &flags);
@@ -1127,7 +1117,7 @@ out:
int fastcall wake_up_process(task_t * p)
{
return try_to_wake_up(p, TASK_STOPPED | TASK_TRACED |
- TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE, 0);
+ TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wake_up_process);
@@ -1228,8 +1218,6 @@ void fastcall wake_up_new_task(task_t * p, unsigned long clone_flags)
p->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(p) *
CHILD_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
- p->interactive_credit = 0;
-
p->prio = effective_prio(p);
if (likely(cpu == this_cpu)) {
@@ -1668,13 +1656,18 @@ int can_migrate_task(task_t *p, runqueue_t *rq, int this_cpu,
if (!cpu_isset(this_cpu, p->cpus_allowed))
return 0;
- /* Aggressive migration if we've failed balancing */
- if (idle == NEWLY_IDLE ||
- sd->nr_balance_failed < sd->cache_nice_tries) {
- if (task_hot(p, rq->timestamp_last_tick, sd))
- return 0;
- }
+ /*
+ * Aggressive migration if:
+ * 1) the [whole] cpu is idle, or
+ * 2) too many balance attempts have failed.
+ */
+
+ if (cpu_and_siblings_are_idle(this_cpu) || \
+ sd->nr_balance_failed > sd->cache_nice_tries)
+ return 1;
+ if (task_hot(p, rq->timestamp_last_tick, sd))
+ return 0;
return 1;
}
@@ -2010,7 +2003,7 @@ static int load_balance(int this_cpu, runqueue_t *this_rq,
if (sd->balance_interval < sd->max_interval)
sd->balance_interval++;
} else {
- sd->nr_balance_failed = 0;
+ sd->nr_balance_failed = 0;
/* We were unbalanced, so reset the balancing interval */
sd->balance_interval = sd->min_interval;
@@ -2089,23 +2082,6 @@ static inline void idle_balance(int this_cpu, runqueue_t *this_rq)
}
}
-#ifdef CONFIG_SCHED_SMT
-static int cpu_and_siblings_are_idle(int cpu)
-{
- int sib;
- for_each_cpu_mask(sib, cpu_sibling_map[cpu]) {
- if (idle_cpu(sib))
- continue;
- return 0;
- }
-
- return 1;
-}
-#else
-#define cpu_and_siblings_are_idle(A) idle_cpu(A)
-#endif
-
-
/*
* active_load_balance is run by migration threads. It pushes running tasks
* off the busiest CPU onto idle CPUs. It requires at least 1 task to be
@@ -2118,7 +2094,9 @@ static void active_load_balance(runqueue_t *busiest_rq, int busiest_cpu)
{
struct sched_domain *sd;
struct sched_group *cpu_group;
+ runqueue_t *target_rq;
cpumask_t visited_cpus;
+ int cpu;
schedstat_inc(busiest_rq, alb_cnt);
/*
@@ -2127,46 +2105,43 @@ static void active_load_balance(runqueue_t *busiest_rq, int busiest_cpu)
*/
visited_cpus = CPU_MASK_NONE;
for_each_domain(busiest_cpu, sd) {
- if (!(sd->flags & SD_LOAD_BALANCE) || busiest_rq->nr_running <= 1)
- break; /* no more domains to search or no more tasks to move */
+ if (!(sd->flags & SD_LOAD_BALANCE))
+ /* no more domains to search */
+ break;
cpu_group = sd->groups;
- do { /* sched_groups should either use list_heads or be merged into the domains structure */
- int cpu, target_cpu = -1;
- runqueue_t *target_rq;
-
+ do {
for_each_cpu_mask(cpu, cpu_group->cpumask) {
- if (cpu_isset(cpu, visited_cpus) || cpu == busiest_cpu ||
- !cpu_and_siblings_are_idle(cpu)) {
- cpu_set(cpu, visited_cpus);
+ if (busiest_rq->nr_running <= 1)
+ /* no more tasks left to move */
+ return;
+ if (cpu_isset(cpu, visited_cpus))
+ continue;
+ cpu_set(cpu, visited_cpus);
+ if (!cpu_and_siblings_are_idle(cpu) || cpu == busiest_cpu)
continue;
- }
- target_cpu = cpu;
- break;
- }
- if (target_cpu == -1)
- goto next_group; /* failed to find a suitable target cpu in this domain */
-
- target_rq = cpu_rq(target_cpu);
- /*
- * This condition is "impossible", if it occurs we need to fix it
- * Reported by Bjorn Helgaas on a 128-cpu setup.
- */
- BUG_ON(busiest_rq == target_rq);
-
- /* move a task from busiest_rq to target_rq */
- double_lock_balance(busiest_rq, target_rq);
- if (move_tasks(target_rq, target_cpu, busiest_rq, 1, sd, SCHED_IDLE)) {
- schedstat_inc(busiest_rq, alb_lost);
- schedstat_inc(target_rq, alb_gained);
- } else {
- schedstat_inc(busiest_rq, alb_failed);
+ target_rq = cpu_rq(cpu);
+ /*
+ * This condition is "impossible", if it occurs
+ * we need to fix it. Originally reported by
+ * Bjorn Helgaas on a 128-cpu setup.
+ */
+ BUG_ON(busiest_rq == target_rq);
+
+ /* move a task from busiest_rq to target_rq */
+ double_lock_balance(busiest_rq, target_rq);
+ if (move_tasks(target_rq, cpu, busiest_rq,
+ 1, sd, SCHED_IDLE)) {
+ schedstat_inc(busiest_rq, alb_lost);
+ schedstat_inc(target_rq, alb_gained);
+ } else {
+ schedstat_inc(busiest_rq, alb_failed);
+ }
+ spin_unlock(&target_rq->lock);
}
- spin_unlock(&target_rq->lock);
-next_group:
cpu_group = cpu_group->next;
- } while (cpu_group != sd->groups && busiest_rq->nr_running > 1);
+ } while (cpu_group != sd->groups);
}
}
@@ -2343,8 +2318,7 @@ void scheduler_tick(int user_ticks, int sys_ticks)
set_tsk_need_resched(p);
/* put it at the end of the queue: */
- dequeue_task(p, rq->active);
- enqueue_task(p, rq->active);
+ requeue_task(p, rq->active);
}
goto out_unlock;
}
@@ -2385,10 +2359,8 @@ void scheduler_tick(int user_ticks, int sys_ticks)
(p->time_slice >= TIMESLICE_GRANULARITY(p)) &&
(p->array == rq->active)) {
- dequeue_task(p, rq->active);
+ requeue_task(p, rq->active);
set_tsk_need_resched(p);
- p->prio = effective_prio(p);
- enqueue_task(p, rq->active);
}
}
out_unlock:
@@ -2522,6 +2494,38 @@ static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq)
}
#endif
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT)
+
+void fastcall add_preempt_count(int val)
+{
+ /*
+ * Underflow?
+ */
+ BUG_ON(((int)preempt_count() < 0));
+ preempt_count() += val;
+ /*
+ * Spinlock count overflowing soon?
+ */
+ BUG_ON((preempt_count() & PREEMPT_MASK) >= PREEMPT_MASK-10);
+}
+EXPORT_SYMBOL(add_preempt_count);
+
+void fastcall sub_preempt_count(int val)
+{
+ /*
+ * Underflow?
+ */
+ BUG_ON(val > preempt_count());
+ /*
+ * Is the spinlock portion underflowing?
+ */
+ BUG_ON((val < PREEMPT_MASK) && !(preempt_count() & PREEMPT_MASK));
+ preempt_count() -= val;
+}
+EXPORT_SYMBOL(sub_preempt_count);
+
+#endif
+
/*
* schedule() is the main scheduler function.
*/
@@ -2562,7 +2566,7 @@ need_resched_nonpreemptible:
* The idle thread is not allowed to schedule!
* Remove this check after it has been exercised a bit.
*/
- if (unlikely(current == rq->idle) && current->state != TASK_RUNNING) {
+ if (unlikely(prev == rq->idle) && prev->state != TASK_RUNNING) {
printk(KERN_ERR "bad: scheduling from the idle thread!\n");
dump_stack();
}
@@ -2575,21 +2579,16 @@ need_resched_nonpreemptible:
run_time = NS_MAX_SLEEP_AVG;
/*
- * Tasks with interactive credits get charged less run_time
- * at high sleep_avg to delay them losing their interactive
- * status
+ * Tasks charged proportionately less run_time at high sleep_avg to
+ * delay them losing their interactive status
*/
- if (HIGH_CREDIT(prev))
- run_time /= (CURRENT_BONUS(prev) ? : 1);
+ run_time /= (CURRENT_BONUS(prev) ? : 1);
spin_lock_irq(&rq->lock);
- if (unlikely(current->flags & PF_DEAD))
- current->state = EXIT_DEAD;
- /*
- * if entering off of a kernel preemption go straight
- * to picking the next task.
- */
+ if (unlikely(prev->flags & PF_DEAD))
+ prev->state = EXIT_DEAD;
+
switch_count = &prev->nivcsw;
if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
switch_count = &prev->nvcsw;
@@ -2671,11 +2670,8 @@ switch_tasks:
rcu_qsctr_inc(task_cpu(prev));
prev->sleep_avg -= run_time;
- if ((long)prev->sleep_avg <= 0) {
+ if ((long)prev->sleep_avg <= 0)
prev->sleep_avg = 0;
- if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev)))
- prev->interactive_credit--;
- }
prev->timestamp = prev->last_ran = now;
sched_info_switch(prev, next);
@@ -2712,7 +2708,10 @@ EXPORT_SYMBOL(schedule);
asmlinkage void __sched preempt_schedule(void)
{
struct thread_info *ti = current_thread_info();
-
+#ifdef CONFIG_PREEMPT_BKL
+ struct task_struct *task = current;
+ int saved_lock_depth;
+#endif
/*
* If there is a non-zero preempt_count or interrupts are disabled,
* we do not want to preempt the current task. Just return..
@@ -2721,9 +2720,21 @@ asmlinkage void __sched preempt_schedule(void)
return;
need_resched:
- ti->preempt_count = PREEMPT_ACTIVE;
+ add_preempt_count(PREEMPT_ACTIVE);
+ /*
+ * We keep the big kernel semaphore locked, but we
+ * clear ->lock_depth so that schedule() doesnt
+ * auto-release the semaphore:
+ */
+#ifdef CONFIG_PREEMPT_BKL
+ saved_lock_depth = task->lock_depth;
+ task->lock_depth = -1;
+#endif
schedule();
- ti->preempt_count = 0;
+#ifdef CONFIG_PREEMPT_BKL
+ task->lock_depth = saved_lock_depth;
+#endif
+ sub_preempt_count(PREEMPT_ACTIVE);
/* we could miss a preemption opportunity between schedule and now */
barrier();
@@ -2956,7 +2967,7 @@ void set_user_nice(task_t *p, long nice)
*/
rq = task_rq_lock(p, &flags);
/*
- * The RT priorities are set via setscheduler(), but we still
+ * The RT priorities are set via sched_setscheduler(), but we still
* allow the 'normal' nice value to be set - but as expected
* it wont have any effect on scheduling until the task is
* not SCHED_NORMAL:
@@ -3088,67 +3099,48 @@ static void __setscheduler(struct task_struct *p, int policy, int prio)
p->prio = p->static_prio;
}
-/*
- * setscheduler - change the scheduling policy and/or RT priority of a thread.
+/**
+ * sched_setscheduler - change the scheduling policy and/or RT priority of
+ * a thread.
+ * @p: the task in question.
+ * @policy: new policy.
+ * @param: structure containing the new RT priority.
*/
-static int setscheduler(pid_t pid, int policy, struct sched_param __user *param)
+int sched_setscheduler(struct task_struct *p, int policy, struct sched_param *param)
{
- struct sched_param lp;
- int retval = -EINVAL;
+ int retval;
int oldprio, oldpolicy = -1;
prio_array_t *array;
unsigned long flags;
runqueue_t *rq;
- task_t *p;
-
- if (!param || pid < 0)
- goto out_nounlock;
-
- retval = -EFAULT;
- if (copy_from_user(&lp, param, sizeof(struct sched_param)))
- goto out_nounlock;
- /*
- * We play safe to avoid deadlocks.
- */
- read_lock_irq(&tasklist_lock);
-
- p = find_process_by_pid(pid);
-
- retval = -ESRCH;
- if (!p)
- goto out_unlock;
recheck:
/* double check policy once rq lock held */
if (policy < 0)
policy = oldpolicy = p->policy;
- else {
- retval = -EINVAL;
- if (policy != SCHED_FIFO && policy != SCHED_RR &&
+ else if (policy != SCHED_FIFO && policy != SCHED_RR &&
policy != SCHED_NORMAL)
- goto out_unlock;
- }
+ return -EINVAL;
/*
* Valid priorities for SCHED_FIFO and SCHED_RR are
* 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
*/
- retval = -EINVAL;
- if (lp.sched_priority < 0 || lp.sched_priority > MAX_USER_RT_PRIO-1)
- goto out_unlock;
- if ((policy == SCHED_NORMAL) != (lp.sched_priority == 0))
- goto out_unlock;
+ if (param->sched_priority < 0 ||
+ param->sched_priority > MAX_USER_RT_PRIO-1)
+ return -EINVAL;
+ if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
+ return -EINVAL;
- retval = -EPERM;
if ((policy == SCHED_FIFO || policy == SCHED_RR) &&
!capable(CAP_SYS_NICE))
- goto out_unlock;
+ return -EPERM;
if ((current->euid != p->euid) && (current->euid != p->uid) &&
!capable(CAP_SYS_NICE))
- goto out_unlock;
+ return -EPERM;
- retval = security_task_setscheduler(p, policy, &lp);
+ retval = security_task_setscheduler(p, policy, param);
if (retval)
- goto out_unlock;
+ return retval;
/*
* To be able to change p->policy safely, the apropriate
* runqueue lock must be held.
@@ -3162,12 +3154,11 @@ recheck:
}
array = p->array;
if (array)
- deactivate_task(p, task_rq(p));
- retval = 0;
+ deactivate_task(p, rq);
oldprio = p->prio;
- __setscheduler(p, policy, lp.sched_priority);
+ __setscheduler(p, policy, param->sched_priority);
if (array) {
- __activate_task(p, task_rq(p));
+ __activate_task(p, rq);
/*
* Reschedule if we are currently running on this runqueue and
* our priority decreased, or if we are not currently running on
@@ -3180,22 +3171,41 @@ recheck:
resched_task(rq->curr);
}
task_rq_unlock(rq, &flags);
-out_unlock:
+ return 0;
+}
+EXPORT_SYMBOL_GPL(sched_setscheduler);
+
+static int do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
+{
+ int retval;
+ struct sched_param lparam;
+ struct task_struct *p;
+
+ if (!param || pid < 0)
+ return -EINVAL;
+ if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
+ return -EFAULT;
+ read_lock_irq(&tasklist_lock);
+ p = find_process_by_pid(pid);
+ if (!p) {
+ read_unlock_irq(&tasklist_lock);
+ return -ESRCH;
+ }
+ retval = sched_setscheduler(p, policy, &lparam);
read_unlock_irq(&tasklist_lock);
-out_nounlock:
return retval;
}
/**
* sys_sched_setscheduler - set/change the scheduler policy and RT priority
* @pid: the pid in question.
- * @policy: new policy
+ * @policy: new policy.
* @param: structure containing the new RT priority.
*/
asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
struct sched_param __user *param)
{
- return setscheduler(pid, policy, param);
+ return do_sched_setscheduler(pid, policy, param);
}
/**
@@ -3205,7 +3215,7 @@ asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
*/
asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
{
- return setscheduler(pid, -1, param);
+ return do_sched_setscheduler(pid, -1, param);
}
/**
@@ -3436,8 +3446,14 @@ asmlinkage long sys_sched_yield(void)
} else if (!rq->expired->nr_active)
schedstat_inc(rq, yld_exp_empty);
- dequeue_task(current, array);
- enqueue_task(current, target);
+ if (array != target) {
+ dequeue_task(current, array);
+ enqueue_task(current, target);
+ } else
+ /*
+ * requeue_task is cheaper so perform that if possible.
+ */
+ requeue_task(current, array);
/*
* Since we are going to call schedule() anyway, there's
@@ -3452,13 +3468,71 @@ asmlinkage long sys_sched_yield(void)
return 0;
}
-void __sched __cond_resched(void)
+static inline void __cond_resched(void)
{
- set_current_state(TASK_RUNNING);
- schedule();
+ do {
+ add_preempt_count(PREEMPT_ACTIVE);
+ schedule();
+ sub_preempt_count(PREEMPT_ACTIVE);
+ } while (need_resched());
}
-EXPORT_SYMBOL(__cond_resched);
+int __sched cond_resched(void)
+{
+ if (need_resched()) {
+ __cond_resched();
+ return 1;
+ }
+ return 0;
+}
+
+EXPORT_SYMBOL(cond_resched);
+
+/*
+ * cond_resched_lock() - if a reschedule is pending, drop the given lock,
+ * call schedule, and on return reacquire the lock.
+ *
+ * This works OK both with and without CONFIG_PREEMPT. We do strange low-level
+ * operations here to prevent schedule() from being called twice (once via
+ * spin_unlock(), once by hand).
+ */
+int cond_resched_lock(spinlock_t * lock)
+{
+#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
+ if (lock->break_lock) {
+ lock->break_lock = 0;
+ spin_unlock(lock);
+ cpu_relax();
+ spin_lock(lock);
+ }
+#endif
+ if (need_resched()) {
+ _raw_spin_unlock(lock);
+ preempt_enable_no_resched();
+ __cond_resched();
+ spin_lock(lock);
+ return 1;
+ }
+ return 0;
+}
+
+EXPORT_SYMBOL(cond_resched_lock);
+
+int __sched cond_resched_softirq(void)
+{
+ BUG_ON(!in_softirq());
+
+ if (need_resched()) {
+ __local_bh_enable();
+ __cond_resched();
+ local_bh_disable();
+ return 1;
+ }
+ return 0;
+}
+
+EXPORT_SYMBOL(cond_resched_softirq);
+
/**
* yield - yield the current processor to other threads.
@@ -3483,7 +3557,7 @@ EXPORT_SYMBOL(yield);
*/
void __sched io_schedule(void)
{
- struct runqueue *rq = this_rq();
+ struct runqueue *rq = &per_cpu(runqueues, _smp_processor_id());
atomic_inc(&rq->nr_iowait);
schedule();
@@ -3494,7 +3568,7 @@ EXPORT_SYMBOL(io_schedule);
long __sched io_schedule_timeout(long timeout)
{
- struct runqueue *rq = this_rq();
+ struct runqueue *rq = &per_cpu(runqueues, _smp_processor_id());
long ret;
atomic_inc(&rq->nr_iowait);
@@ -3691,7 +3765,6 @@ void __devinit init_idle(task_t *idle, int cpu)
unsigned long flags;
idle->sleep_avg = 0;
- idle->interactive_credit = 0;
idle->array = NULL;
idle->prio = MAX_PRIO;
idle->state = TASK_RUNNING;
@@ -3703,7 +3776,7 @@ void __devinit init_idle(task_t *idle, int cpu)
spin_unlock_irqrestore(&rq->lock, flags);
/* Set the preempt count _outside_ the spinlocks! */
-#ifdef CONFIG_PREEMPT
+#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
idle->thread_info->preempt_count = (idle->lock_depth >= 0);
#else
idle->thread_info->preempt_count = 0;
@@ -3871,8 +3944,7 @@ static int migration_thread(void * data)
if (req->type == REQ_MOVE_TASK) {
spin_unlock(&rq->lock);
- __migrate_task(req->task, smp_processor_id(),
- req->dest_cpu);
+ __migrate_task(req->task, cpu, req->dest_cpu);
local_irq_enable();
} else if (req->type == REQ_SET_DOMAIN) {
rq->sd = req->sd;
@@ -3996,6 +4068,20 @@ void sched_idle_next(void)
spin_unlock_irqrestore(&rq->lock, flags);
}
+/* Ensures that the idle task is using init_mm right before its cpu goes
+ * offline.
+ */
+void idle_task_exit(void)
+{
+ struct mm_struct *mm = current->active_mm;
+
+ BUG_ON(cpu_online(smp_processor_id()));
+
+ if (mm != &init_mm)
+ switch_mm(mm, &init_mm, current);
+ mmdrop(mm);
+}
+
static void migrate_dead(unsigned int dead_cpu, task_t *tsk)
{
struct runqueue *rq = cpu_rq(dead_cpu);
@@ -4128,6 +4214,94 @@ int __init migration_init(void)
#endif
#ifdef CONFIG_SMP
+#define SCHED_DOMAIN_DEBUG
+#ifdef SCHED_DOMAIN_DEBUG
+static void sched_domain_debug(struct sched_domain *sd, int cpu)
+{
+ int level = 0;
+
+ printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
+
+ do {
+ int i;
+ char str[NR_CPUS];
+ struct sched_group *group = sd->groups;
+ cpumask_t groupmask;
+
+ cpumask_scnprintf(str, NR_CPUS, sd->span);
+ cpus_clear(groupmask);
+
+ printk(KERN_DEBUG);
+ for (i = 0; i < level + 1; i++)
+ printk(" ");
+ printk("domain %d: ", level);
+
+ if (!(sd->flags & SD_LOAD_BALANCE)) {
+ printk("does not load-balance\n");
+ if (sd->parent)
+ printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain has parent");
+ break;
+ }
+
+ printk("span %s\n", str);
+
+ if (!cpu_isset(cpu, sd->span))
+ printk(KERN_ERR "ERROR: domain->span does not contain CPU%d\n", cpu);
+ if (!cpu_isset(cpu, group->cpumask))
+ printk(KERN_ERR "ERROR: domain->groups does not contain CPU%d\n", cpu);
+
+ printk(KERN_DEBUG);
+ for (i = 0; i < level + 2; i++)
+ printk(" ");
+ printk("groups:");
+ do {
+ if (!group) {
+ printk("\n");
+ printk(KERN_ERR "ERROR: group is NULL\n");
+ break;
+ }
+
+ if (!group->cpu_power) {
+ printk("\n");
+ printk(KERN_ERR "ERROR: domain->cpu_power not set\n");
+ }
+
+ if (!cpus_weight(group->cpumask)) {
+ printk("\n");
+ printk(KERN_ERR "ERROR: empty group\n");
+ }
+
+ if (cpus_intersects(groupmask, group->cpumask)) {
+ printk("\n");
+ printk(KERN_ERR "ERROR: repeated CPUs\n");
+ }
+
+ cpus_or(groupmask, groupmask, group->cpumask);
+
+ cpumask_scnprintf(str, NR_CPUS, group->cpumask);
+ printk(" %s", str);
+
+ group = group->next;
+ } while (group != sd->groups);
+ printk("\n");
+
+ if (!cpus_equal(sd->span, groupmask))
+ printk(KERN_ERR "ERROR: groups don't span domain->span\n");
+
+ level++;
+ sd = sd->parent;
+
+ if (sd) {
+ if (!cpus_subset(groupmask, sd->span))
+ printk(KERN_ERR "ERROR: parent span is not a superset of domain->span\n");
+ }
+
+ } while (sd);
+}
+#else
+#define sched_domain_debug(sd, cpu) {}
+#endif
+
/*
* Attach the domain 'sd' to 'cpu' as its base domain. Callers must
* hold the hotplug lock.
@@ -4139,6 +4313,8 @@ void __devinit cpu_attach_domain(struct sched_domain *sd, int cpu)
runqueue_t *rq = cpu_rq(cpu);
int local = 1;
+ sched_domain_debug(sd, cpu);
+
spin_lock_irqsave(&rq->lock, flags);
if (cpu == smp_processor_id() || !cpu_online(cpu)) {
@@ -4414,96 +4590,6 @@ static void __devinit arch_destroy_sched_domains(void)
#endif /* ARCH_HAS_SCHED_DOMAIN */
-#define SCHED_DOMAIN_DEBUG
-#ifdef SCHED_DOMAIN_DEBUG
-static void sched_domain_debug(void)
-{
- int i;
-
- for_each_online_cpu(i) {
- runqueue_t *rq = cpu_rq(i);
- struct sched_domain *sd;
- int level = 0;
-
- sd = rq->sd;
-
- printk(KERN_DEBUG "CPU%d:\n", i);
-
- do {
- int j;
- char str[NR_CPUS];
- struct sched_group *group = sd->groups;
- cpumask_t groupmask;
-
- cpumask_scnprintf(str, NR_CPUS, sd->span);
- cpus_clear(groupmask);
-
- printk(KERN_DEBUG);
- for (j = 0; j < level + 1; j++)
- printk(" ");
- printk("domain %d: ", level);
-
- if (!(sd->flags & SD_LOAD_BALANCE)) {
- printk("does not load-balance");
- if (sd->parent)
- printk(" ERROR !SD_LOAD_BALANCE domain has parent");
- printk("\n");
- break;
- }
-
- printk("span %s\n", str);
-
- if (!cpu_isset(i, sd->span))
- printk(KERN_DEBUG "ERROR domain->span does not contain CPU%d\n", i);
- if (!cpu_isset(i, group->cpumask))
- printk(KERN_DEBUG "ERROR domain->groups does not contain CPU%d\n", i);
-
- printk(KERN_DEBUG);
- for (j = 0; j < level + 2; j++)
- printk(" ");
- printk("groups:");
- do {
- if (!group) {
- printk(" ERROR: NULL");
- break;
- }
-
- if (!group->cpu_power)
- printk(KERN_DEBUG "ERROR group->cpu_power not set\n");
-
- if (!cpus_weight(group->cpumask))
- printk(" ERROR empty group:");
-
- if (cpus_intersects(groupmask, group->cpumask))
- printk(" ERROR repeated CPUs:");
-
- cpus_or(groupmask, groupmask, group->cpumask);
-
- cpumask_scnprintf(str, NR_CPUS, group->cpumask);
- printk(" %s", str);
-
- group = group->next;
- } while (group != sd->groups);
- printk("\n");
-
- if (!cpus_equal(sd->span, groupmask))
- printk(KERN_DEBUG "ERROR groups don't span domain->span\n");
-
- level++;
- sd = sd->parent;
-
- if (sd) {
- if (!cpus_subset(groupmask, sd->span))
- printk(KERN_DEBUG "ERROR parent span is not a superset of domain->span\n");
- }
-
- } while (sd);
- }
-}
-#else
-#define sched_domain_debug() {}
-#endif
-
/*
* Initial dummy domain for early boot and for hotplug cpu. Being static,
* it is initialized to zero, so all balancing flags are cleared which is
@@ -4546,8 +4632,6 @@ static int update_sched_domains(struct notifier_block *nfb,
/* The hotplug lock is already held by cpu_up/cpu_down */
arch_init_sched_domains();
- sched_domain_debug();
-
return NOTIFY_OK;
}
#endif
@@ -4556,7 +4640,6 @@ void __init sched_init_smp(void)
{
lock_cpu_hotplug();
arch_init_sched_domains();
- sched_domain_debug();
unlock_cpu_hotplug();
/* XXX: Theoretical race here - CPU may be hotplugged now */
hotcpu_notifier(update_sched_domains, 0);
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 8d6e9055e2b91..9e2d204da3645 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -142,7 +142,7 @@ void local_bh_enable(void)
* Keep preemption disabled until we are done with
* softirq processing:
*/
- preempt_count() -= SOFTIRQ_OFFSET - 1;
+ sub_preempt_count(SOFTIRQ_OFFSET - 1);
if (unlikely(!in_interrupt() && local_softirq_pending()))
do_softirq();
@@ -163,7 +163,7 @@ EXPORT_SYMBOL(local_bh_enable);
*/
void irq_exit(void)
{
- preempt_count() -= IRQ_EXIT_OFFSET;
+ sub_preempt_count(IRQ_EXIT_OFFSET);
if (!in_interrupt() && local_softirq_pending())
invoke_softirq();
preempt_enable_no_resched();
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
index 476da1fd86f4c..b485593430ec1 100644
--- a/kernel/spinlock.c
+++ b/kernel/spinlock.c
@@ -2,6 +2,8 @@
* Copyright (2004) Linus Torvalds
*
* Author: Zwane Mwaikambo <zwane@fsmlabs.com>
+ *
+ * Copyright (2004) Ingo Molnar
*/
#include <linux/config.h>
@@ -11,6 +13,17 @@
#include <linux/interrupt.h>
#include <linux/module.h>
+/*
+ * Generic declaration of the raw read_trylock() function,
+ * architectures are supposed to optimize this:
+ */
+int __lockfunc generic_raw_read_trylock(rwlock_t *lock)
+{
+ _raw_read_lock(lock);
+ return 1;
+}
+EXPORT_SYMBOL(generic_raw_read_trylock);
+
int __lockfunc _spin_trylock(spinlock_t *lock)
{
preempt_disable();
@@ -22,86 +35,29 @@ int __lockfunc _spin_trylock(spinlock_t *lock)
}
EXPORT_SYMBOL(_spin_trylock);
-int __lockfunc _write_trylock(rwlock_t *lock)
+int __lockfunc _read_trylock(rwlock_t *lock)
{
preempt_disable();
- if (_raw_write_trylock(lock))
+ if (_raw_read_trylock(lock))
return 1;
preempt_enable();
return 0;
}
-EXPORT_SYMBOL(_write_trylock);
-
-#ifdef CONFIG_PREEMPT
-/*
- * This could be a long-held lock. If another CPU holds it for a long time,
- * and that CPU is not asked to reschedule then *this* CPU will spin on the
- * lock for a long time, even if *this* CPU is asked to reschedule.
- *
- * So what we do here, in the slow (contended) path is to spin on the lock by
- * hand while permitting preemption.
- *
- * Called inside preempt_disable().
- */
-static inline void __preempt_spin_lock(spinlock_t *lock)
-{
- if (preempt_count() > 1) {
- _raw_spin_lock(lock);
- return;
- }
-
- do {
- preempt_enable();
- while (spin_is_locked(lock))
- cpu_relax();
- preempt_disable();
- } while (!_raw_spin_trylock(lock));
-}
+EXPORT_SYMBOL(_read_trylock);
-void __lockfunc _spin_lock(spinlock_t *lock)
+int __lockfunc _write_trylock(rwlock_t *lock)
{
preempt_disable();
- if (unlikely(!_raw_spin_trylock(lock)))
- __preempt_spin_lock(lock);
-}
-
-static inline void __preempt_write_lock(rwlock_t *lock)
-{
- if (preempt_count() > 1) {
- _raw_write_lock(lock);
- return;
- }
-
- do {
- preempt_enable();
- while (rwlock_is_locked(lock))
- cpu_relax();
- preempt_disable();
- } while (!_raw_write_trylock(lock));
-}
+ if (_raw_write_trylock(lock))
+ return 1;
-void __lockfunc _write_lock(rwlock_t *lock)
-{
- preempt_disable();
- if (unlikely(!_raw_write_trylock(lock)))
- __preempt_write_lock(lock);
-}
-#else
-void __lockfunc _spin_lock(spinlock_t *lock)
-{
- preempt_disable();
- _raw_spin_lock(lock);
+ preempt_enable();
+ return 0;
}
+EXPORT_SYMBOL(_write_trylock);
-void __lockfunc _write_lock(rwlock_t *lock)
-{
- preempt_disable();
- _raw_write_lock(lock);
-}
-#endif
-EXPORT_SYMBOL(_spin_lock);
-EXPORT_SYMBOL(_write_lock);
+#ifndef CONFIG_PREEMPT
void __lockfunc _read_lock(rwlock_t *lock)
{
@@ -110,27 +66,6 @@ void __lockfunc _read_lock(rwlock_t *lock)
}
EXPORT_SYMBOL(_read_lock);
-void __lockfunc _spin_unlock(spinlock_t *lock)
-{
- _raw_spin_unlock(lock);
- preempt_enable();
-}
-EXPORT_SYMBOL(_spin_unlock);
-
-void __lockfunc _write_unlock(rwlock_t *lock)
-{
- _raw_write_unlock(lock);
- preempt_enable();
-}
-EXPORT_SYMBOL(_write_unlock);
-
-void __lockfunc _read_unlock(rwlock_t *lock)
-{
- _raw_read_unlock(lock);
- preempt_enable();
-}
-EXPORT_SYMBOL(_read_unlock);
-
unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
{
unsigned long flags;
@@ -212,6 +147,130 @@ void __lockfunc _write_lock_bh(rwlock_t *lock)
}
EXPORT_SYMBOL(_write_lock_bh);
+void __lockfunc _spin_lock(spinlock_t *lock)
+{
+ preempt_disable();
+ _raw_spin_lock(lock);
+}
+
+EXPORT_SYMBOL(_spin_lock);
+
+void __lockfunc _write_lock(rwlock_t *lock)
+{
+ preempt_disable();
+ _raw_write_lock(lock);
+}
+
+EXPORT_SYMBOL(_write_lock);
+
+#else /* CONFIG_PREEMPT: */
+
+/*
+ * This could be a long-held lock. We both prepare to spin for a long
+ * time (making _this_ CPU preemptable if possible), and we also signal
+ * towards that other CPU that it should break the lock ASAP.
+ *
+ * (We do this in a function because inlining it would be excessive.)
+ */
+
+#define BUILD_LOCK_OPS(op, locktype) \
+void __lockfunc _##op##_lock(locktype *lock) \
+{ \
+ preempt_disable(); \
+ for (;;) { \
+ if (likely(_raw_##op##_trylock(lock))) \
+ break; \
+ preempt_enable(); \
+ if (!(lock)->break_lock) \
+ (lock)->break_lock = 1; \
+ cpu_relax(); \
+ preempt_disable(); \
+ } \
+} \
+ \
+EXPORT_SYMBOL(_##op##_lock); \
+ \
+unsigned long __lockfunc _##op##_lock_irqsave(locktype *lock) \
+{ \
+ unsigned long flags; \
+ \
+ preempt_disable(); \
+ for (;;) { \
+ local_irq_save(flags); \
+ if (likely(_raw_##op##_trylock(lock))) \
+ break; \
+ local_irq_restore(flags); \
+ \
+ preempt_enable(); \
+ if (!(lock)->break_lock) \
+ (lock)->break_lock = 1; \
+ cpu_relax(); \
+ preempt_disable(); \
+ } \
+ return flags; \
+} \
+ \
+EXPORT_SYMBOL(_##op##_lock_irqsave); \
+ \
+void __lockfunc _##op##_lock_irq(locktype *lock) \
+{ \
+ _##op##_lock_irqsave(lock); \
+} \
+ \
+EXPORT_SYMBOL(_##op##_lock_irq); \
+ \
+void __lockfunc _##op##_lock_bh(locktype *lock) \
+{ \
+ unsigned long flags; \
+ \
+ /* */ \
+ /* Careful: we must exclude softirqs too, hence the */ \
+ /* irq-disabling. We use the generic preemption-aware */ \
+ /* function: */ \
+ /**/ \
+ flags = _##op##_lock_irqsave(lock); \
+ local_bh_disable(); \
+ local_irq_restore(flags); \
+} \
+ \
+EXPORT_SYMBOL(_##op##_lock_bh)
+
+/*
+ * Build preemption-friendly versions of the following
+ * lock-spinning functions:
+ *
+ * _[spin|read|write]_lock()
+ * _[spin|read|write]_lock_irq()
+ * _[spin|read|write]_lock_irqsave()
+ * _[spin|read|write]_lock_bh()
+ */
+BUILD_LOCK_OPS(spin, spinlock_t);
+BUILD_LOCK_OPS(read, rwlock_t);
+BUILD_LOCK_OPS(write, rwlock_t);
+
+#endif /* CONFIG_PREEMPT */
+
+void __lockfunc _spin_unlock(spinlock_t *lock)
+{
+ _raw_spin_unlock(lock);
+ preempt_enable();
+}
+EXPORT_SYMBOL(_spin_unlock);
+
+void __lockfunc _write_unlock(rwlock_t *lock)
+{
+ _raw_write_unlock(lock);
+ preempt_enable();
+}
+EXPORT_SYMBOL(_write_unlock);
+
+void __lockfunc _read_unlock(rwlock_t *lock)
+{
+ _raw_read_unlock(lock);
+ preempt_enable();
+}
+EXPORT_SYMBOL(_read_unlock);
+
void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
{
_raw_spin_unlock(lock);
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 2ceea25f67f67..e31b1cb8e5030 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -95,7 +95,7 @@ static int stop_machine(void)
stopmachine_state = STOPMACHINE_WAIT;
for_each_online_cpu(i) {
- if (i == smp_processor_id())
+ if (i == _smp_processor_id())
continue;
ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL);
if (ret < 0)
@@ -177,7 +177,7 @@ struct task_struct *__stop_machine_run(int (*fn)(void *), void *data,
/* If they don't care which CPU fn runs on, bind to any online one. */
if (cpu == NR_CPUS)
- cpu = smp_processor_id();
+ cpu = _smp_processor_id();
p = kthread_create(do_stop, &smdata, "kstopmachine");
if (!IS_ERR(p)) {
diff --git a/kernel/sys.c b/kernel/sys.c
index 1561c2787cc7c..20080da0c3def 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -23,6 +23,7 @@
#include <linux/security.h>
#include <linux/dcookies.h>
#include <linux/suspend.h>
+#include <linux/tty.h>
#include <linux/compat.h>
#include <linux/syscalls.h>
@@ -88,7 +89,7 @@ int cad_pid = 1;
*/
static struct notifier_block *reboot_notifier_list;
-rwlock_t notifier_lock = RW_LOCK_UNLOCKED;
+DEFINE_RWLOCK(notifier_lock);
/**
* notifier_chain_register - Add notifier to a notifier chain
@@ -1075,6 +1076,7 @@ asmlinkage long sys_setsid(void)
if (!thread_group_leader(current))
return -EINVAL;
+ down(&tty_sem);
write_lock_irq(&tasklist_lock);
pid = find_pid(PIDTYPE_PGID, current->pid);
@@ -1088,6 +1090,7 @@ asmlinkage long sys_setsid(void)
err = process_group(current);
out:
write_unlock_irq(&tasklist_lock);
+ up(&tty_sem);
return err;
}
diff --git a/kernel/timer.c b/kernel/timer.c
index d0177a7f573a1..ec35a6e801a8e 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -465,7 +465,14 @@ repeat:
smp_wmb();
timer->base = NULL;
spin_unlock_irq(&base->lock);
- fn(data);
+ {
+ u32 preempt_count = preempt_count();
+ fn(data);
+ if (preempt_count != preempt_count()) {
+ printk("huh, entered %p with %08x, exited with %08x?\n", fn, preempt_count, preempt_count());
+ BUG();
+ }
+ }
spin_lock_irq(&base->lock);
goto repeat;
}
@@ -554,7 +561,7 @@ unsigned long tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */
/*
* The current time
* wall_to_monotonic is what we need to add to xtime (or xtime corrected
- * for sub jiffie times) to get to monotonic time. Monotonic is pegged at zero
+ * for sub jiffie times) to get to monotonic time. Monotonic is pegged
* at zero at system boot time, so wall_to_monotonic will be negative,
* however, we will ALWAYS keep the tv_nsec part positive so we can use
* the usual normalization.
@@ -1438,7 +1445,7 @@ void __init init_timers(void)
struct time_interpolator *time_interpolator;
static struct time_interpolator *time_interpolator_list;
-static spinlock_t time_interpolator_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(time_interpolator_lock);
static inline u64 time_interpolator_get_cycles(unsigned int src)
{
diff --git a/kernel/user.c b/kernel/user.c
index 693487dc940e6..18f63146602a1 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -26,7 +26,7 @@
static kmem_cache_t *uid_cachep;
static struct list_head uidhash_table[UIDHASH_SZ];
-static spinlock_t uidhash_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(uidhash_lock);
struct user_struct root_user = {
.__count = ATOMIC_INIT(1),
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 9e08e0c343f8c..3993f7bdf5c27 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -64,7 +64,7 @@ struct workqueue_struct {
/* All the per-cpu workqueues on the system, for hotplug cpu to add/remove
threads to each one as cpus come/go. */
-static spinlock_t workqueue_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(workqueue_lock);
static LIST_HEAD(workqueues);
/* If it's single threaded, it isn't in the list of workqueues. */
@@ -188,7 +188,7 @@ static int worker_thread(void *__cwq)
current->flags |= PF_NOFREEZE;
- set_user_nice(current, -10);
+ set_user_nice(current, -5);
/* Block and flush all signals */
sigfillset(&blocked);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d9da4ec792b45..908333250671a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -48,6 +48,16 @@ config DEBUG_SLAB
allocation as well as poisoning memory on free to catch use of freed
memory. This can make kmalloc/kfree-intensive workloads much slower.
+config DEBUG_PREEMPT
+ bool "Debug preemptible kernel"
+ depends on PREEMPT && X86
+ default y
+ help
+ If you say Y here then the kernel will use a debug variant of the
+ commonly used smp_processor_id() function and will print warnings
+ if kernel code uses it in a preemption-unsafe way. Also, the kernel
+ will detect preemption count underflows.
+
config DEBUG_SPINLOCK
bool "Spinlock debugging"
depends on DEBUG_KERNEL && (ALPHA || ARM || X86 || IA64 || M32R || MIPS || PARISC || PPC32 || (SUPERH && !SUPERH64) || SPARC32 || SPARC64 || USERMODE || X86_64)
@@ -79,8 +89,9 @@ config DEBUG_HIGHMEM
Disable for production systems.
config DEBUG_BUGVERBOSE
- bool "Verbose BUG() reporting (adds 70K)"
- depends on DEBUG_KERNEL && (ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64)
+ bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
+ depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || (X86 && !X86_64)
+ default !EMBEDDED
help
Say Y here to make BUG() panics output the file name and line number
of the BUG call as well as the EIP and oops trace. This aids
diff --git a/lib/kernel_lock.c b/lib/kernel_lock.c
index 48dc05a13963d..8819c12a74ee3 100644
--- a/lib/kernel_lock.c
+++ b/lib/kernel_lock.c
@@ -7,6 +7,141 @@
*/
#include <linux/smp_lock.h>
#include <linux/module.h>
+#include <linux/kallsyms.h>
+
+#if defined(CONFIG_PREEMPT) && defined(__smp_processor_id) && \
+ defined(CONFIG_DEBUG_PREEMPT)
+
+/*
+ * Debugging check.
+ */
+unsigned int smp_processor_id(void)
+{
+ unsigned long preempt_count = preempt_count();
+ int this_cpu = __smp_processor_id();
+ cpumask_t this_mask;
+
+ if (likely(preempt_count))
+ goto out;
+
+ if (irqs_disabled())
+ goto out;
+
+ /*
+ * Kernel threads bound to a single CPU can safely use
+ * smp_processor_id():
+ */
+ this_mask = cpumask_of_cpu(this_cpu);
+
+ if (cpus_equal(current->cpus_allowed, this_mask))
+ goto out;
+
+ /*
+ * It is valid to assume CPU-locality during early bootup:
+ */
+ if (system_state != SYSTEM_RUNNING)
+ goto out;
+
+ /*
+ * Avoid recursion:
+ */
+ preempt_disable();
+
+ if (!printk_ratelimit())
+ goto out_enable;
+
+ printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
+ print_symbol("caller is %s\n", (long)__builtin_return_address(0));
+ dump_stack();
+
+out_enable:
+ preempt_enable_no_resched();
+out:
+ return this_cpu;
+}
+
+EXPORT_SYMBOL(smp_processor_id);
+
+#endif /* PREEMPT && __smp_processor_id && DEBUG_PREEMPT */
+
+#ifdef CONFIG_PREEMPT_BKL
+/*
+ * The 'big kernel semaphore'
+ *
+ * This mutex is taken and released recursively by lock_kernel()
+ * and unlock_kernel(). It is transparently dropped and reaquired
+ * over schedule(). It is used to protect legacy code that hasn't
+ * been migrated to a proper locking design yet.
+ *
+ * Note: code locked by this semaphore will only be serialized against
+ * other code using the same locking facility. The code guarantees that
+ * the task remains on the same CPU.
+ *
+ * Don't use in new code.
+ */
+DECLARE_MUTEX(kernel_sem);
+
+/*
+ * Re-acquire the kernel semaphore.
+ *
+ * This function is called with preemption off.
+ *
+ * We are executing in schedule() so the code must be extremely careful
+ * about recursion, both due to the down() and due to the enabling of
+ * preemption. schedule() will re-check the preemption flag after
+ * reacquiring the semaphore.
+ */
+int __lockfunc __reacquire_kernel_lock(void)
+{
+ struct task_struct *task = current;
+ int saved_lock_depth = task->lock_depth;
+
+ BUG_ON(saved_lock_depth < 0);
+
+ task->lock_depth = -1;
+ preempt_enable_no_resched();
+
+ down(&kernel_sem);
+
+ preempt_disable();
+ task->lock_depth = saved_lock_depth;
+
+ return 0;
+}
+
+void __lockfunc __release_kernel_lock(void)
+{
+ up(&kernel_sem);
+}
+
+/*
+ * Getting the big kernel semaphore.
+ */
+void __lockfunc lock_kernel(void)
+{
+ struct task_struct *task = current;
+ int depth = task->lock_depth + 1;
+
+ if (likely(!depth))
+ /*
+ * No recursion worries - we set up lock_depth _after_
+ */
+ down(&kernel_sem);
+
+ task->lock_depth = depth;
+}
+
+void __lockfunc unlock_kernel(void)
+{
+ struct task_struct *task = current;
+
+ BUG_ON(task->lock_depth < 0);
+
+ if (likely(--task->lock_depth < 0))
+ up(&kernel_sem);
+}
+
+#else
/*
* The 'big kernel lock'
@@ -34,7 +169,7 @@ static spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
* (This works on UP too - _raw_spin_trylock will never
* return false in that case)
*/
-int __lockfunc get_kernel_lock(void)
+int __lockfunc __reacquire_kernel_lock(void)
{
while (!_raw_spin_trylock(&kernel_flag)) {
if (test_thread_flag(TIF_NEED_RESCHED))
@@ -45,7 +180,7 @@ int __lockfunc get_kernel_lock(void)
return 0;
}
-void __lockfunc put_kernel_lock(void)
+void __lockfunc __release_kernel_lock(void)
{
_raw_spin_unlock(&kernel_flag);
preempt_enable_no_resched();
@@ -122,5 +257,8 @@ void __lockfunc unlock_kernel(void)
__unlock_kernel();
}
+#endif
+
EXPORT_SYMBOL(lock_kernel);
EXPORT_SYMBOL(unlock_kernel);
+
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 5c78b2187ce26..2a4e7671eaf40 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -179,7 +179,7 @@ static inline int send_uevent(const char *signal, const char *obj,
#ifdef CONFIG_HOTPLUG
char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug";
u64 hotplug_seqnum;
-static spinlock_t sequence_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(sequence_lock);
/**
* kobject_hotplug - notify userspace by executing /sbin/hotplug
diff --git a/lib/string.c b/lib/string.c
index c1b1b58747fe0..4820e317f39b0 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -19,8 +19,6 @@
* - Kissed strtok() goodbye
*/
-#define IN_STRING_C 1
-
#include <linux/types.h>
#include <linux/string.h>
#include <linux/ctype.h>
diff --git a/mm/filemap.c b/mm/filemap.c
index b832d146f6c4f..4bfd5aafd90e0 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -802,11 +802,21 @@ readpage:
goto readpage_error;
if (!PageUptodate(page)) {
- wait_on_page_locked(page);
+ lock_page(page);
if (!PageUptodate(page)) {
+ if (page->mapping == NULL) {
+ /*
+ * invalidate_inode_pages got it
+ */
+ unlock_page(page);
+ page_cache_release(page);
+ goto find_page;
+ }
+ unlock_page(page);
error = -EIO;
goto readpage_error;
}
+ unlock_page(page);
}
/*
@@ -2237,7 +2247,8 @@ ssize_t generic_file_writev(struct file *file, const struct iovec *iov,
EXPORT_SYMBOL(generic_file_writev);
/*
- * Called under i_sem for writes to S_ISREG files
+ * Called under i_sem for writes to S_ISREG files. Returns -EIO if something
+ * went wrong during pagecache shootdown.
*/
ssize_t
generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
@@ -2247,12 +2258,23 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
struct address_space *mapping = file->f_mapping;
ssize_t retval;
+ /*
+ * If it's a write, unmap all mmappings of the file up-front. This
+ * will cause any pte dirty bits to be propagated into the pageframes
+ * for the subsequent filemap_write_and_wait().
+ */
+ if (rw == WRITE && mapping_mapped(mapping))
+ unmap_mapping_range(mapping, 0, -1, 0);
+
retval = filemap_write_and_wait(mapping);
if (retval == 0) {
retval = mapping->a_ops->direct_IO(rw, iocb, iov,
offset, nr_segs);
- if (rw == WRITE && mapping->nrpages)
- invalidate_inode_pages2(mapping);
+ if (rw == WRITE && mapping->nrpages) {
+ int err = invalidate_inode_pages2(mapping);
+ if (err)
+ retval = err;
+ }
}
return retval;
}
diff --git a/mm/highmem.c b/mm/highmem.c
index 21d2daa37eb08..c37d66cb1af12 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -53,7 +53,7 @@ static void page_pool_free(void *page, void *data)
#ifdef CONFIG_HIGHMEM
static int pkmap_count[LAST_PKMAP];
static unsigned int last_pkmap_nr;
-static spinlock_t kmap_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
pte_t * pkmap_page_table;
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 3e17acfb3ad16..4eb5ae3fbe10d 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -10,6 +10,7 @@
#include <linux/hugetlb.h>
#include <linux/sysctl.h>
#include <linux/highmem.h>
+#include <linux/nodemask.h>
const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
static unsigned long nr_huge_pages, free_huge_pages;
@@ -17,7 +18,7 @@ unsigned long max_huge_pages;
static struct list_head hugepage_freelists[MAX_NUMNODES];
static unsigned int nr_huge_pages_node[MAX_NUMNODES];
static unsigned int free_huge_pages_node[MAX_NUMNODES];
-static spinlock_t hugetlb_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(hugetlb_lock);
static void enqueue_huge_page(struct page *page)
{
@@ -54,10 +55,10 @@ static struct page *alloc_fresh_huge_page(void)
struct page *page;
page = alloc_pages_node(nid, GFP_HIGHUSER|__GFP_COMP|__GFP_NOWARN,
HUGETLB_PAGE_ORDER);
- nid = (nid + 1) % numnodes;
+ nid = (nid + 1) % num_online_nodes();
if (page) {
nr_huge_pages++;
- nr_huge_pages_node[page_zone(page)->zone_pgdat->node_id]++;
+ nr_huge_pages_node[page_to_nid(page)]++;
}
return page;
}
diff --git a/mm/memory.c b/mm/memory.c
index ad9407594ba55..9e7f1ca3aa951 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -612,19 +612,11 @@ static void unmap_page_range(struct mmu_gather *tlb,
tlb_end_vma(tlb, vma);
}
-/* Dispose of an entire struct mmu_gather per rescheduling point */
-#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
-#define ZAP_BLOCK_SIZE (FREE_PTE_NR * PAGE_SIZE)
-#endif
-
-/* For UP, 256 pages at a time gives nice low latency */
-#if !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
-#define ZAP_BLOCK_SIZE (256 * PAGE_SIZE)
-#endif
-
+#ifdef CONFIG_PREEMPT
+# define ZAP_BLOCK_SIZE (8 * PAGE_SIZE)
+#else
/* No preempt: go for improved straight-line efficiency */
-#if !defined(CONFIG_PREEMPT)
-#define ZAP_BLOCK_SIZE (1024 * PAGE_SIZE)
+# define ZAP_BLOCK_SIZE (1024 * PAGE_SIZE)
#endif
/**
@@ -663,7 +655,8 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
unsigned long tlb_start = 0; /* For tlb_finish_mmu */
int tlb_start_valid = 0;
int ret = 0;
- int atomic = details && details->atomic;
+ spinlock_t *i_mmap_lock = details? details->i_mmap_lock: NULL;
+ int fullmm = tlb_is_full_mm(*tlbp);
for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) {
unsigned long start;
@@ -701,16 +694,29 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
zap_bytes -= block;
if ((long)zap_bytes > 0)
continue;
- if (!atomic && need_resched()) {
- int fullmm = tlb_is_full_mm(*tlbp);
- tlb_finish_mmu(*tlbp, tlb_start, start);
- cond_resched_lock(&mm->page_table_lock);
- *tlbp = tlb_gather_mmu(mm, fullmm);
- tlb_start_valid = 0;
+
+ tlb_finish_mmu(*tlbp, tlb_start, start);
+
+ if (need_resched() ||
+ need_lockbreak(&mm->page_table_lock) ||
+ (i_mmap_lock && need_lockbreak(i_mmap_lock))) {
+ if (i_mmap_lock) {
+ /* must reset count of rss freed */
+ *tlbp = tlb_gather_mmu(mm, fullmm);
+ details->break_addr = start;
+ goto out;
+ }
+ spin_unlock(&mm->page_table_lock);
+ cond_resched();
+ spin_lock(&mm->page_table_lock);
}
+
+ *tlbp = tlb_gather_mmu(mm, fullmm);
+ tlb_start_valid = 0;
zap_bytes = ZAP_BLOCK_SIZE;
}
}
+out:
return ret;
}
@@ -924,6 +930,8 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
do {
struct page *map;
int lookup_write = write;
+
+ cond_resched_lock(&mm->page_table_lock);
while (!(map = follow_page(mm, start, lookup_write))) {
/*
* Shortcut for anonymous pages. We don't want
@@ -1359,17 +1367,112 @@ no_new_page:
}
/*
- * Helper function for unmap_mapping_range().
+ * Helper functions for unmap_mapping_range().
+ *
+ * __ Notes on dropping i_mmap_lock to reduce latency while unmapping __
+ *
+ * We have to restart searching the prio_tree whenever we drop the lock,
+ * since the iterator is only valid while the lock is held, and anyway
+ * a later vma might be split and reinserted earlier while lock dropped.
+ *
+ * The list of nonlinear vmas could be handled more efficiently, using
+ * a placeholder, but handle it in the same way until a need is shown.
+ * It is important to search the prio_tree before nonlinear list: a vma
+ * may become nonlinear and be shifted from prio_tree to nonlinear list
+ * while the lock is dropped; but never shifted from list to prio_tree.
+ *
+ * In order to make forward progress despite restarting the search,
+ * vm_truncate_count is used to mark a vma as now dealt with, so we can
+ * quickly skip it next time around. Since the prio_tree search only
+ * shows us those vmas affected by unmapping the range in question, we
+ * can't efficiently keep all vmas in step with mapping->truncate_count:
+ * so instead reset them all whenever it wraps back to 0 (then go to 1).
+ * mapping->truncate_count and vma->vm_truncate_count are protected by
+ * i_mmap_lock.
+ *
+ * In order to make forward progress despite repeatedly restarting some
+ * large vma, note the break_addr set by unmap_vmas when it breaks out:
+ * and restart from that address when we reach that vma again. It might
+ * have been split or merged, shrunk or extended, but never shifted: so
+ * restart_addr remains valid so long as it remains in the vma's range.
+ * unmap_mapping_range forces truncate_count to leap over page-aligned
+ * values so we can save vma's restart_addr in its truncate_count field.
*/
-static inline void unmap_mapping_range_list(struct prio_tree_root *root,
+#define is_restart_addr(truncate_count) (!((truncate_count) & ~PAGE_MASK))
+
+static void reset_vma_truncate_counts(struct address_space *mapping)
+{
+ struct vm_area_struct *vma;
+ struct prio_tree_iter iter;
+
+ vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, 0, ULONG_MAX)
+ vma->vm_truncate_count = 0;
+ list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared.vm_set.list)
+ vma->vm_truncate_count = 0;
+}
+
+static int unmap_mapping_range_vma(struct vm_area_struct *vma,
+ unsigned long start_addr, unsigned long end_addr,
+ struct zap_details *details)
+{
+ unsigned long restart_addr;
+ int need_break;
+
+again:
+ restart_addr = vma->vm_truncate_count;
+ if (is_restart_addr(restart_addr) && start_addr < restart_addr) {
+ start_addr = restart_addr;
+ if (start_addr >= end_addr) {
+ /* Top of vma has been split off since last time */
+ vma->vm_truncate_count = details->truncate_count;
+ return 0;
+ }
+ }
+
+ details->break_addr = end_addr;
+ zap_page_range(vma, start_addr, end_addr - start_addr, details);
+
+ /*
+ * We cannot rely on the break test in unmap_vmas:
+ * on the one hand, we don't want to restart our loop
+ * just because that broke out for the page_table_lock;
+ * on the other hand, it does no test when vma is small.
+ */
+ need_break = need_resched() ||
+ need_lockbreak(details->i_mmap_lock);
+
+ if (details->break_addr >= end_addr) {
+ /* We have now completed this vma: mark it so */
+ vma->vm_truncate_count = details->truncate_count;
+ if (!need_break)
+ return 0;
+ } else {
+ /* Note restart_addr in vma's truncate_count field */
+ vma->vm_truncate_count = details->break_addr;
+ if (!need_break)
+ goto again;
+ }
+
+ spin_unlock(details->i_mmap_lock);
+ cond_resched();
+ spin_lock(details->i_mmap_lock);
+ return -EINTR;
+}
+
+static inline void unmap_mapping_range_tree(struct prio_tree_root *root,
struct zap_details *details)
{
struct vm_area_struct *vma;
struct prio_tree_iter iter;
pgoff_t vba, vea, zba, zea;
+restart:
vma_prio_tree_foreach(vma, &iter, root,
details->first_index, details->last_index) {
+ /* Skip quickly over those we have already dealt with */
+ if (vma->vm_truncate_count == details->truncate_count)
+ continue;
+
vba = vma->vm_pgoff;
vea = vba + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) - 1;
/* Assume for now that PAGE_CACHE_SHIFT == PAGE_SHIFT */
@@ -1379,9 +1482,35 @@ static inline void unmap_mapping_range_list(struct prio_tree_root *root,
zea = details->last_index;
if (zea > vea)
zea = vea;
- zap_page_range(vma,
+
+ if (unmap_mapping_range_vma(vma,
((zba - vba) << PAGE_SHIFT) + vma->vm_start,
- (zea - zba + 1) << PAGE_SHIFT, details);
+ ((zea - vba + 1) << PAGE_SHIFT) + vma->vm_start,
+ details) < 0)
+ goto restart;
+ }
+}
+
+static inline void unmap_mapping_range_list(struct list_head *head,
+ struct zap_details *details)
+{
+ struct vm_area_struct *vma;
+
+ /*
+ * In nonlinear VMAs there is no correspondence between virtual address
+ * offset and file offset. So we must perform an exhaustive search
+ * across *all* the pages in each nonlinear VMA, not just the pages
+ * whose virtual address lies outside the file truncation point.
+ */
+restart:
+ list_for_each_entry(vma, head, shared.vm_set.list) {
+ /* Skip quickly over those we have already dealt with */
+ if (vma->vm_truncate_count == details->truncate_count)
+ continue;
+ details->nonlinear_vma = vma;
+ if (unmap_mapping_range_vma(vma, vma->vm_start,
+ vma->vm_end, details) < 0)
+ goto restart;
}
}
@@ -1420,32 +1549,25 @@ void unmap_mapping_range(struct address_space *mapping,
details.nonlinear_vma = NULL;
details.first_index = hba;
details.last_index = hba + hlen - 1;
- details.atomic = 1; /* A spinlock is held */
if (details.last_index < details.first_index)
details.last_index = ULONG_MAX;
+ details.i_mmap_lock = &mapping->i_mmap_lock;
spin_lock(&mapping->i_mmap_lock);
- /* Protect against page fault */
- atomic_inc(&mapping->truncate_count);
-
- if (unlikely(!prio_tree_empty(&mapping->i_mmap)))
- unmap_mapping_range_list(&mapping->i_mmap, &details);
- /*
- * In nonlinear VMAs there is no correspondence between virtual address
- * offset and file offset. So we must perform an exhaustive search
- * across *all* the pages in each nonlinear VMA, not just the pages
- * whose virtual address lies outside the file truncation point.
- */
- if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) {
- struct vm_area_struct *vma;
- list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
- shared.vm_set.list) {
- details.nonlinear_vma = vma;
- zap_page_range(vma, vma->vm_start,
- vma->vm_end - vma->vm_start, &details);
- }
+ /* Protect against page faults, and endless unmapping loops */
+ mapping->truncate_count++;
+ if (unlikely(is_restart_addr(mapping->truncate_count))) {
+ if (mapping->truncate_count == 0)
+ reset_vma_truncate_counts(mapping);
+ mapping->truncate_count++;
}
+ details.truncate_count = mapping->truncate_count;
+
+ if (unlikely(!prio_tree_empty(&mapping->i_mmap)))
+ unmap_mapping_range_tree(&mapping->i_mmap, &details);
+ if (unlikely(!list_empty(&mapping->i_mmap_nonlinear)))
+ unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details);
spin_unlock(&mapping->i_mmap_lock);
}
EXPORT_SYMBOL(unmap_mapping_range);
@@ -1728,7 +1850,7 @@ do_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
struct page * new_page;
struct address_space *mapping = NULL;
pte_t entry;
- int sequence = 0;
+ unsigned int sequence = 0;
int ret = VM_FAULT_MINOR;
int anon = 0;
@@ -1740,10 +1862,10 @@ do_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
if (vma->vm_file) {
mapping = vma->vm_file->f_mapping;
- sequence = atomic_read(&mapping->truncate_count);
+ sequence = mapping->truncate_count;
}
- smp_rmb(); /* Prevent CPU from reordering lock-free ->nopage() */
retry:
+ cond_resched();
new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, &ret);
/* no page was available -- either SIGBUS or OOM */
@@ -1775,9 +1897,8 @@ retry:
* invalidated this page. If unmap_mapping_range got called,
* retry getting the page.
*/
- if (mapping &&
- (unlikely(sequence != atomic_read(&mapping->truncate_count)))) {
- sequence = atomic_read(&mapping->truncate_count);
+ if (mapping && unlikely(sequence != mapping->truncate_count)) {
+ sequence = mapping->truncate_count;
spin_unlock(&mm->page_table_lock);
page_cache_release(new_page);
goto retry;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1c8cbaf596a5a..e22bd528bbb4a 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -489,7 +489,7 @@ asmlinkage long sys_get_mempolicy(int __user *policy,
if (flags & ~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR))
return -EINVAL;
- if (nmask != NULL && maxnode < numnodes)
+ if (nmask != NULL && maxnode < MAX_NUMNODES)
return -EINVAL;
if (flags & MPOL_F_ADDR) {
down_read(&mm->mmap_sem);
diff --git a/mm/mlock.c b/mm/mlock.c
index a75902f0485ef..0c41018fb37b9 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -204,7 +204,7 @@ asmlinkage long sys_munlockall(void)
* Objects with different lifetime than processes (SHM_LOCK and SHM_HUGETLB
* shm segments) get accounted against the user_struct instead.
*/
-static spinlock_t shmlock_user_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(shmlock_user_lock);
int user_shm_lock(size_t size, struct user_struct *user)
{
diff --git a/mm/mmap.c b/mm/mmap.c
index 25348d68fcb9f..cfa09ba8b826d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -308,8 +308,10 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma,
if (vma->vm_file)
mapping = vma->vm_file->f_mapping;
- if (mapping)
+ if (mapping) {
spin_lock(&mapping->i_mmap_lock);
+ vma->vm_truncate_count = mapping->truncate_count;
+ }
anon_vma_lock(vma);
__vma_link(mm, vma, prev, rb_link, rb_parent);
@@ -380,6 +382,7 @@ void vma_adjust(struct vm_area_struct *vma, unsigned long start,
again: remove_next = 1 + (end > next->vm_end);
end = next->vm_end;
anon_vma = next->anon_vma;
+ importer = vma;
} else if (end > next->vm_start) {
/*
* vma expands, overlapping part of the next:
@@ -405,7 +408,16 @@ again: remove_next = 1 + (end > next->vm_end);
if (!(vma->vm_flags & VM_NONLINEAR))
root = &mapping->i_mmap;
spin_lock(&mapping->i_mmap_lock);
+ if (importer &&
+ vma->vm_truncate_count != next->vm_truncate_count) {
+ /*
+ * unmap_mapping_range might be in progress:
+ * ensure that the expanding vma is rescanned.
+ */
+ importer->vm_truncate_count = 0;
+ }
if (insert) {
+ insert->vm_truncate_count = vma->vm_truncate_count;
/*
* Put into prio_tree now, so instantiated pages
* are visible to arm/parisc __flush_dcache_page
@@ -1484,6 +1496,9 @@ static void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *prev,
unsigned long last = end + PGDIR_SIZE - 1;
struct mm_struct *mm = tlb->mm;
+ if (last > TASK_SIZE || last < end)
+ last = TASK_SIZE;
+
if (!prev) {
prev = mm->mmap;
if (!prev)
diff --git a/mm/mremap.c b/mm/mremap.c
index daf4ac4f1b2a7..ebdf621984ac4 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -100,7 +100,7 @@ static inline pte_t *alloc_one_pte_map(struct mm_struct *mm, unsigned long addr)
static int
move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
- unsigned long new_addr)
+ struct vm_area_struct *new_vma, unsigned long new_addr)
{
struct address_space *mapping = NULL;
struct mm_struct *mm = vma->vm_mm;
@@ -116,6 +116,9 @@ move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
*/
mapping = vma->vm_file->f_mapping;
spin_lock(&mapping->i_mmap_lock);
+ if (new_vma->vm_truncate_count &&
+ new_vma->vm_truncate_count != vma->vm_truncate_count)
+ new_vma->vm_truncate_count = 0;
}
spin_lock(&mm->page_table_lock);
@@ -162,8 +165,8 @@ move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
}
static unsigned long move_page_tables(struct vm_area_struct *vma,
- unsigned long new_addr, unsigned long old_addr,
- unsigned long len)
+ unsigned long old_addr, struct vm_area_struct *new_vma,
+ unsigned long new_addr, unsigned long len)
{
unsigned long offset;
@@ -175,7 +178,8 @@ static unsigned long move_page_tables(struct vm_area_struct *vma,
* only a few pages.. This also makes error recovery easier.
*/
for (offset = 0; offset < len; offset += PAGE_SIZE) {
- if (move_one_page(vma, old_addr+offset, new_addr+offset) < 0)
+ if (move_one_page(vma, old_addr + offset,
+ new_vma, new_addr + offset) < 0)
break;
cond_resched();
}
@@ -206,14 +210,14 @@ static unsigned long move_vma(struct vm_area_struct *vma,
if (!new_vma)
return -ENOMEM;
- moved_len = move_page_tables(vma, new_addr, old_addr, old_len);
+ moved_len = move_page_tables(vma, old_addr, new_vma, new_addr, old_len);
if (moved_len < old_len) {
/*
* On error, move entries back from new area to old,
* which will succeed since page tables still there,
* and then proceed to unmap new area instead of old.
*/
- move_page_tables(new_vma, old_addr, new_addr, moved_len);
+ move_page_tables(new_vma, new_addr, vma, old_addr, moved_len);
vma = new_vma;
old_len = new_len;
old_addr = new_addr;
diff --git a/mm/msync.c b/mm/msync.c
index cf499f463626d..b387bac348f94 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -119,8 +119,8 @@ static inline int filemap_sync_pud_range(pgd_t *pgd,
return error;
}
-static int filemap_sync(struct vm_area_struct * vma, unsigned long address,
- size_t size, unsigned int flags)
+static int __filemap_sync(struct vm_area_struct *vma, unsigned long address,
+ size_t size, unsigned int flags)
{
pgd_t *pgd;
unsigned long end = address + size;
@@ -163,6 +163,31 @@ static int filemap_sync(struct vm_area_struct * vma, unsigned long address,
return error;
}
+#ifdef CONFIG_PREEMPT
+static int filemap_sync(struct vm_area_struct *vma, unsigned long address,
+ size_t size, unsigned int flags)
+{
+ const size_t chunk = 64 * 1024; /* bytes */
+ int error = 0;
+
+ while (size) {
+ size_t sz = min(size, chunk);
+
+ error |= __filemap_sync(vma, address, sz, flags);
+ cond_resched();
+ address += sz;
+ size -= sz;
+ }
+ return error;
+}
+#else
+static int filemap_sync(struct vm_area_struct *vma, unsigned long address,
+ size_t size, unsigned int flags)
+{
+ return __filemap_sync(vma, address, size, flags);
+}
+#endif
+
/*
* MS_SYNC syncs the entire file - including mappings.
*
diff --git a/mm/nommu.c b/mm/nommu.c
index 7ee66abb00bc1..9439b1cd44156 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -136,7 +136,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
return(i);
}
-rwlock_t vmlist_lock = RW_LOCK_UNLOCKED;
+DEFINE_RWLOCK(vmlist_lock);
struct vm_struct *vmlist;
void vfree(void *addr)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 3868e29e85bef..967958c7fae13 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -233,7 +233,7 @@ void out_of_memory(int gfp_mask)
* oom_lock protects out_of_memory()'s static variables.
* It's a global lock; this is not performance-critical.
*/
- static spinlock_t oom_lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(oom_lock);
static unsigned long first, last, count, lastkill;
unsigned long now, since;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fd6f8014689b8..5b8ebb16a07ca 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -37,13 +37,13 @@
#include <asm/tlbflush.h>
#include "internal.h"
-nodemask_t node_online_map = NODE_MASK_NONE;
+/* MCD - HACK: Find somewhere to initialize this EARLY, or make this initializer cleaner */
+nodemask_t node_online_map = { { [0] = 1UL } };
nodemask_t node_possible_map = NODE_MASK_ALL;
struct pglist_data *pgdat_list;
unsigned long totalram_pages;
unsigned long totalhigh_pages;
long nr_swap_pages;
-int numnodes = 1;
int sysctl_lower_zone_protection = 0;
EXPORT_SYMBOL(totalram_pages);
@@ -71,6 +71,10 @@ static int bad_range(struct zone *zone, struct page *page)
return 1;
if (page_to_pfn(page) < zone->zone_start_pfn)
return 1;
+#ifdef CONFIG_HOLES_IN_ZONE
+ if (!pfn_valid(page_to_pfn(page)))
+ return 1;
+#endif
if (zone != page_zone(page))
return 1;
return 0;
@@ -159,6 +163,45 @@ static void destroy_compound_page(struct page *page, unsigned long order)
#endif /* CONFIG_HUGETLB_PAGE */
/*
+ * function for dealing with page's order in buddy system.
+ * zone->lock is already acquired when we use these.
+ * So, we don't need atomic page->flags operations here.
+ */
+static inline unsigned long page_order(struct page *page) {
+ return page->private;
+}
+
+static inline void set_page_order(struct page *page, int order) {
+ page->private = order;
+ __SetPagePrivate(page);
+}
+
+static inline void rmv_page_order(struct page *page)
+{
+ __ClearPagePrivate(page);
+ page->private = 0;
+}
+
+/*
+ * This function checks whether a page is free && is the buddy
+ * we can do coalesce a page and its buddy if
+ * (a) the buddy is free &&
+ * (b) the buddy is on the buddy system &&
+ * (c) a page and its buddy have the same order.
+ * for recording page's order, we use page->private and PG_private.
+ *
+ */
+static inline int page_is_buddy(struct page *page, int order)
+{
+ if (PagePrivate(page) &&
+ (page_order(page) == order) &&
+ !PageReserved(page) &&
+ page_count(page) == 0)
+ return 1;
+ return 0;
+}
+
+/*
* Freeing function for a buddy system allocator.
*
* The concept of a buddy system is to maintain direct-mapped table
@@ -170,9 +213,10 @@ static void destroy_compound_page(struct page *page, unsigned long order)
* at the bottom level available, and propagating the changes upward
* as necessary, plus some accounting needed to play nicely with other
* parts of the VM system.
- * At each level, we keep one bit for each pair of blocks, which
- * is set to 1 iff only one of the pair is allocated. So when we
- * are allocating or freeing one, we can derive the state of the
+ * At each level, we keep a list of pages, which are heads of continuous
+ * free pages of length of (1 << order) and marked with PG_Private.Page's
+ * order is recorded in page->private field.
+ * So when we are allocating or freeing one, we can derive the state of the
* other. That is, if we allocate a small block, and both were
* free, the remainder of the region must be split into blocks.
* If a block is freed, and its buddy is also free, then this
@@ -182,44 +226,44 @@ static void destroy_compound_page(struct page *page, unsigned long order)
*/
static inline void __free_pages_bulk (struct page *page, struct page *base,
- struct zone *zone, struct free_area *area, unsigned int order)
+ struct zone *zone, unsigned int order)
{
- unsigned long page_idx, index, mask;
+ unsigned long page_idx;
+ struct page *coalesced;
+ int order_size = 1 << order;
- if (order)
+ if (unlikely(order))
destroy_compound_page(page, order);
- mask = (~0UL) << order;
+
page_idx = page - base;
- if (page_idx & ~mask)
- BUG();
- index = page_idx >> (1 + order);
- zone->free_pages += 1 << order;
+ BUG_ON(page_idx & (order_size - 1));
+ BUG_ON(bad_range(zone, page));
+
+ zone->free_pages += order_size;
while (order < MAX_ORDER-1) {
- struct page *buddy1, *buddy2;
+ struct free_area *area;
+ struct page *buddy;
+ int buddy_idx;
- BUG_ON(area >= zone->free_area + MAX_ORDER);
- if (!__test_and_change_bit(index, area->map))
- /*
- * the buddy page is still allocated.
- */
+ buddy_idx = (page_idx ^ (1 << order));
+ buddy = base + buddy_idx;
+ if (bad_range(zone, buddy))
+ break;
+ if (!page_is_buddy(buddy, order))
break;
-
/* Move the buddy up one level. */
- buddy1 = base + (page_idx ^ (1 << order));
- buddy2 = base + page_idx;
- BUG_ON(bad_range(zone, buddy1));
- BUG_ON(bad_range(zone, buddy2));
- list_del(&buddy1->lru);
+ list_del(&buddy->lru);
+ area = zone->free_area + order;
area->nr_free--;
- mask <<= 1;
+ rmv_page_order(buddy);
+ page_idx &= buddy_idx;
order++;
- area++;
- index >>= 1;
- page_idx &= mask;
}
- list_add(&(base + page_idx)->lru, &area->free_list);
- area->nr_free++;
+ coalesced = base + page_idx;
+ set_page_order(coalesced, order);
+ list_add(&coalesced->lru, &zone->free_area[order].free_list);
+ zone->free_area[order].nr_free++;
}
static inline void free_pages_check(const char *function, struct page *page)
@@ -257,12 +301,10 @@ free_pages_bulk(struct zone *zone, int count,
struct list_head *list, unsigned int order)
{
unsigned long flags;
- struct free_area *area;
struct page *base, *page = NULL;
int ret = 0;
base = zone->zone_mem_map;
- area = zone->free_area + order;
spin_lock_irqsave(&zone->lock, flags);
zone->all_unreclaimable = 0;
zone->pages_scanned = 0;
@@ -270,7 +312,7 @@ free_pages_bulk(struct zone *zone, int count,
page = list_entry(list->prev, struct page, lru);
/* have to delete it as __free_pages_bulk list manipulates */
list_del(&page->lru);
- __free_pages_bulk(page, base, zone, area, order);
+ __free_pages_bulk(page, base, zone, order);
ret++;
}
spin_unlock_irqrestore(&zone->lock, flags);
@@ -299,8 +341,6 @@ void __free_pages_ok(struct page *page, unsigned int order)
free_pages_bulk(page_zone(page), 1, &list, order);
}
-#define MARK_USED(index, order, area) \
- __change_bit((index) >> (1+(order)), (area)->map)
/*
* The order of subdivision here is critical for the IO subsystem.
@@ -318,7 +358,7 @@ void __free_pages_ok(struct page *page, unsigned int order)
*/
static inline struct page *
expand(struct zone *zone, struct page *page,
- unsigned long index, int low, int high, struct free_area *area)
+ int low, int high, struct free_area *area)
{
unsigned long size = 1 << high;
@@ -329,7 +369,7 @@ expand(struct zone *zone, struct page *page,
BUG_ON(bad_range(zone, &page[size]));
list_add(&page[size].lru, &area->free_list);
area->nr_free++;
- MARK_USED(index + size, high, area);
+ set_page_order(&page[size], high);
}
return page;
}
@@ -384,7 +424,6 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order)
struct free_area * area;
unsigned int current_order;
struct page *page;
- unsigned int index;
for (current_order = order; current_order < MAX_ORDER; ++current_order) {
area = zone->free_area + current_order;
@@ -393,12 +432,10 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order)
page = list_entry(area->free_list.next, struct page, lru);
list_del(&page->lru);
+ rmv_page_order(page);
area->nr_free--;
- index = page - zone->zone_mem_map;
- if (current_order != MAX_ORDER-1)
- MARK_USED(index, current_order, area);
zone->free_pages -= 1UL << order;
- return expand(zone, page, index, order, current_order, area);
+ return expand(zone, page, order, current_order, area);
}
return NULL;
@@ -1220,13 +1257,13 @@ static int __init build_zonelists_node(pg_data_t *pgdat, struct zonelist *zoneli
}
#ifdef CONFIG_NUMA
-#define MAX_NODE_LOAD (numnodes)
+#define MAX_NODE_LOAD (num_online_nodes())
static int __initdata node_load[MAX_NUMNODES];
/**
* find_next_best_node - find the next node that should appear in a given
* node's fallback list
* @node: node whose fallback list we're appending
- * @used_node_mask: pointer to the bitmap of already used nodes
+ * @used_node_mask: nodemask_t of already used nodes
*
* We use a number of factors to determine which is the next node that should
* appear on a given node's fallback list. The node should not have appeared
@@ -1237,24 +1274,24 @@ static int __initdata node_load[MAX_NUMNODES];
* on them otherwise.
* It returns -1 if no node is found.
*/
-static int __init find_next_best_node(int node, void *used_node_mask)
+static int __init find_next_best_node(int node, nodemask_t *used_node_mask)
{
int i, n, val;
int min_val = INT_MAX;
int best_node = -1;
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
cpumask_t tmp;
/* Start from local node */
- n = (node+i)%numnodes;
+ n = (node+i) % num_online_nodes();
/* Don't want a node to appear more than once */
- if (test_bit(n, used_node_mask))
+ if (node_isset(n, *used_node_mask))
continue;
/* Use the local node if we haven't already */
- if (!test_bit(node, used_node_mask)) {
+ if (!node_isset(node, *used_node_mask)) {
best_node = node;
break;
}
@@ -1278,7 +1315,7 @@ static int __init find_next_best_node(int node, void *used_node_mask)
}
if (best_node >= 0)
- set_bit(best_node, used_node_mask);
+ node_set(best_node, *used_node_mask);
return best_node;
}
@@ -1288,7 +1325,7 @@ static void __init build_zonelists(pg_data_t *pgdat)
int i, j, k, node, local_node;
int prev_node, load;
struct zonelist *zonelist;
- DECLARE_BITMAP(used_mask, MAX_NUMNODES);
+ nodemask_t used_mask;
/* initialize zonelists */
for (i = 0; i < GFP_ZONETYPES; i++) {
@@ -1299,10 +1336,10 @@ static void __init build_zonelists(pg_data_t *pgdat)
/* NUMA-aware ordering of nodes */
local_node = pgdat->node_id;
- load = numnodes;
+ load = num_online_nodes();
prev_node = local_node;
- bitmap_zero(used_mask, MAX_NUMNODES);
- while ((node = find_next_best_node(local_node, used_mask)) >= 0) {
+ nodes_clear(used_mask);
+ while ((node = find_next_best_node(local_node, &used_mask)) >= 0) {
/*
* We don't want to pressure a particular node.
* So adding penalty to the first node in same
@@ -1358,11 +1395,17 @@ static void __init build_zonelists(pg_data_t *pgdat)
* zones coming right after the local ones are those from
* node N+1 (modulo N)
*/
- for (node = local_node + 1; node < numnodes; node++)
- j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
- for (node = 0; node < local_node; node++)
- j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
-
+ for (node = local_node + 1; node < MAX_NUMNODES; node++) {
+ if (!node_online(node))
+ continue;
+ j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
+ }
+ for (node = 0; node < local_node; node++) {
+ if (!node_online(node))
+ continue;
+ j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
+ }
+
zonelist->zones[j] = NULL;
}
}
@@ -1373,9 +1416,9 @@ void __init build_all_zonelists(void)
{
int i;
- for(i = 0 ; i < numnodes ; i++)
+ for_each_online_node(i)
build_zonelists(NODE_DATA(i));
- printk("Built %i zonelists\n", numnodes);
+ printk("Built %i zonelists\n", num_online_nodes());
}
/*
@@ -1467,49 +1510,12 @@ void __init memmap_init_zone(unsigned long size, int nid, unsigned long zone,
}
}
-/*
- * Page buddy system uses "index >> (i+1)", where "index" is
- * at most "size-1".
- *
- * The extra "+3" is to round down to byte size (8 bits per byte
- * assumption). Thus we get "(size-1) >> (i+4)" as the last byte
- * we can access.
- *
- * The "+1" is because we want to round the byte allocation up
- * rather than down. So we should have had a "+7" before we shifted
- * down by three. Also, we have to add one as we actually _use_ the
- * last bit (it's [0,n] inclusive, not [0,n[).
- *
- * So we actually had +7+1 before we shift down by 3. But
- * (n+8) >> 3 == (n >> 3) + 1 (modulo overflows, which we do not have).
- *
- * Finally, we LONG_ALIGN because all bitmap operations are on longs.
- */
-unsigned long pages_to_bitmap_size(unsigned long order, unsigned long nr_pages)
-{
- unsigned long bitmap_size;
-
- bitmap_size = (nr_pages-1) >> (order+4);
- bitmap_size = LONG_ALIGN(bitmap_size+1);
-
- return bitmap_size;
-}
-
-void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone, unsigned long size)
+void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
+ unsigned long size)
{
int order;
- for (order = 0; ; order++) {
- unsigned long bitmap_size;
-
+ for (order = 0; order < MAX_ORDER ; order++) {
INIT_LIST_HEAD(&zone->free_area[order].free_list);
- if (order == MAX_ORDER-1) {
- zone->free_area[order].map = NULL;
- break;
- }
-
- bitmap_size = pages_to_bitmap_size(order, size);
- zone->free_area[order].map =
- (unsigned long *) alloc_bootmem_node(pgdat, bitmap_size);
zone->free_area[order].nr_free = 0;
}
}
diff --git a/mm/pdflush.c b/mm/pdflush.c
index 1e682bed9a5ee..21b7f127b7d30 100644
--- a/mm/pdflush.c
+++ b/mm/pdflush.c
@@ -45,7 +45,7 @@ static void start_one_pdflush_thread(void);
* All the pdflush threads. Protected by pdflush_lock
*/
static LIST_HEAD(pdflush_list);
-static spinlock_t pdflush_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pdflush_lock);
/*
* The count of currently-running pdflush threads. Protected
diff --git a/mm/rmap.c b/mm/rmap.c
index 8e198864146a4..4ff8183fa18e9 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -121,14 +121,7 @@ int anon_vma_prepare(struct vm_area_struct *vma)
void __anon_vma_merge(struct vm_area_struct *vma, struct vm_area_struct *next)
{
- if (!vma->anon_vma) {
- BUG_ON(!next->anon_vma);
- vma->anon_vma = next->anon_vma;
- list_add(&vma->anon_vma_node, &next->anon_vma_node);
- } else {
- /* if they're both non-null they must be the same */
- BUG_ON(vma->anon_vma != next->anon_vma);
- }
+ BUG_ON(vma->anon_vma != next->anon_vma);
list_del(&next->anon_vma_node);
}
diff --git a/mm/shmem.c b/mm/shmem.c
index 2a97375d5ecea..c34e131967a91 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -189,7 +189,7 @@ static struct backing_dev_info shmem_backing_dev_info = {
};
static LIST_HEAD(shmem_swaplist);
-static spinlock_t shmem_swaplist_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(shmem_swaplist_lock);
static void shmem_free_blocks(struct inode *inode, long pages)
{
diff --git a/mm/slab.c b/mm/slab.c
index 12bf28e2b9cfc..478a6cdbf2c75 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2836,7 +2836,7 @@ static void cache_reap(void *unused)
next_unlock:
spin_unlock_irq(&searchp->spinlock);
next:
- ;
+ cond_resched();
}
check_irq_on();
up(&cache_chain_sem);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 479015ed0b2f6..5a00ea3612008 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -32,7 +32,7 @@
#include <asm/tlbflush.h>
#include <linux/swapops.h>
-spinlock_t swaplock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(swaplock);
unsigned int nr_swapfiles;
long total_swap_pages;
static int swap_overflow;
diff --git a/mm/thrash.c b/mm/thrash.c
index 985b6bbe964de..735a91baa6ff3 100644
--- a/mm/thrash.c
+++ b/mm/thrash.c
@@ -13,7 +13,7 @@
#include <linux/sched.h>
#include <linux/swap.h>
-static spinlock_t swap_token_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(swap_token_lock);
static unsigned long swap_token_timeout;
unsigned long swap_token_check;
struct mm_struct * swap_token_mm = &init_mm;
diff --git a/mm/truncate.c b/mm/truncate.c
index 7cd2ed501bb2f..a1b4a442d90dc 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -45,6 +45,7 @@ static inline void truncate_partial_page(struct page *page, unsigned partial)
static void
truncate_complete_page(struct address_space *mapping, struct page *page)
{
+ BUG_ON(page_mapped(page));
if (page->mapping != mapping)
return;
@@ -64,6 +65,8 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
* be marked dirty at any time too. So we re-check the dirtiness inside
* ->tree_lock. That provides exclusion against the __set_page_dirty
* functions.
+ *
+ * Returns non-zero if the page was successfully invalidated.
*/
static int
invalidate_complete_page(struct address_space *mapping, struct page *page)
@@ -81,10 +84,6 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
}
BUG_ON(PagePrivate(page));
- if (page_count(page) != 2) {
- spin_unlock_irq(&mapping->tree_lock);
- return 0;
- }
__remove_from_page_cache(page);
spin_unlock_irq(&mapping->tree_lock);
ClearPageUptodate(page);
@@ -243,50 +242,67 @@ unsigned long invalidate_inode_pages(struct address_space *mapping)
EXPORT_SYMBOL(invalidate_inode_pages);
/**
- * invalidate_inode_pages2 - remove all unmapped pages from an address_space
+ * invalidate_inode_pages2 - remove all pages from an address_space
* @mapping - the address_space
*
- * invalidate_inode_pages2() is like truncate_inode_pages(), except for the case
- * where the page is seen to be mapped into process pagetables. In that case,
- * the page is marked clean but is left attached to its address_space.
+ * Any pages which are found to be mapped into pagetables are unmapped prior to
+ * invalidation.
*
- * The page is also marked not uptodate so that a subsequent pagefault will
- * perform I/O to bringthe page's contents back into sync with its backing
- * store.
- *
- * FIXME: invalidate_inode_pages2() is probably trivially livelockable.
+ * Returns -EIO if any pages could not be invalidated.
*/
-void invalidate_inode_pages2(struct address_space *mapping)
+int invalidate_inode_pages2(struct address_space *mapping)
{
struct pagevec pvec;
pgoff_t next = 0;
int i;
+ int ret = 0;
+ int did_full_unmap = 0;
pagevec_init(&pvec, 0);
- while (pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
- for (i = 0; i < pagevec_count(&pvec); i++) {
+ while (!ret && pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
+ for (i = 0; !ret && i < pagevec_count(&pvec); i++) {
struct page *page = pvec.pages[i];
+ int was_dirty;
lock_page(page);
- if (page->mapping == mapping) { /* truncate race? */
- wait_on_page_writeback(page);
- next = page->index + 1;
- if (page_mapped(page)) {
- clear_page_dirty(page);
- ClearPageUptodate(page);
+ if (page->mapping != mapping) { /* truncate race? */
+ unlock_page(page);
+ continue;
+ }
+ wait_on_page_writeback(page);
+ next = page->index + 1;
+ while (page_mapped(page)) {
+ if (!did_full_unmap) {
+ /*
+ * Zap the rest of the file in one hit.
+ * FIXME: invalidate_inode_pages2()
+ * should take start/end offsets.
+ */
+ unmap_mapping_range(mapping,
+ page->index << PAGE_CACHE_SHIFT,
+ -1, 0);
+ did_full_unmap = 1;
} else {
- if (!invalidate_complete_page(mapping,
- page)) {
- clear_page_dirty(page);
- ClearPageUptodate(page);
- }
+ /*
+ * Just zap this page
+ */
+ unmap_mapping_range(mapping,
+ page->index << PAGE_CACHE_SHIFT,
+ (page->index << PAGE_CACHE_SHIFT)+1,
+ 0);
}
}
+ was_dirty = test_clear_page_dirty(page);
+ if (!invalidate_complete_page(mapping, page)) {
+ if (was_dirty)
+ set_page_dirty(page);
+ ret = -EIO;
+ }
unlock_page(page);
}
pagevec_release(&pvec);
cond_resched();
}
+ return ret;
}
-
EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f8c46383a9100..e0fa3b39f2d12 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -20,7 +20,7 @@
#include <asm/tlbflush.h>
-rwlock_t vmlist_lock = RW_LOCK_UNLOCKED;
+DEFINE_RWLOCK(vmlist_lock);
struct vm_struct *vmlist;
static void unmap_area_pte(pmd_t *pmd, unsigned long address,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1062a30258a95..69217c5bb02de 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -361,6 +361,8 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
int may_enter_fs;
int referenced;
+ cond_resched();
+
page = lru_to_page(page_list);
list_del(&page->lru);
@@ -369,14 +371,14 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
BUG_ON(PageActive(page));
- if (PageWriteback(page))
- goto keep_locked;
-
sc->nr_scanned++;
/* Double the slab pressure for mapped and swapcache pages */
if (page_mapped(page) || PageSwapCache(page))
sc->nr_scanned++;
+ if (PageWriteback(page))
+ goto keep_locked;
+
referenced = page_referenced(page, 1, sc->priority <= 0);
/* In active use or really unfreeable? Activate it. */
if (referenced && page_mapping_inuse(page))
@@ -710,6 +712,7 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
reclaim_mapped = 1;
while (!list_empty(&l_hold)) {
+ cond_resched();
page = lru_to_page(&l_hold);
list_del(&page->lru);
if (page_mapped(page)) {
diff --git a/net/core/sock.c b/net/core/sock.c
index 8312e839dd632..6d90ed0a870ef 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -942,6 +942,15 @@ static void __release_sock(struct sock *sk)
skb->next = NULL;
sk->sk_backlog_rcv(sk, skb);
+
+ /*
+ * We are in process context here with softirqs
+ * disabled, use cond_resched_softirq() to preempt.
+ * This is safe to do because we've taken the backlog
+ * queue private:
+ */
+ cond_resched_softirq();
+
skb = next;
} while (skb != NULL);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6c5b44af65b27..4febfd8c8c528 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2220,7 +2220,10 @@ static void *established_get_first(struct seq_file *seq)
struct sock *sk;
struct hlist_node *node;
struct tcp_tw_bucket *tw;
-
+
+ /* We can reschedule _before_ having picked the target: */
+ cond_resched_softirq();
+
read_lock(&tcp_ehash[st->bucket].lock);
sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) {
if (sk->sk_family != st->family) {
@@ -2267,6 +2270,10 @@ get_tw:
}
read_unlock(&tcp_ehash[st->bucket].lock);
st->state = TCP_SEQ_STATE_ESTABLISHED;
+
+ /* We can reschedule between buckets: */
+ cond_resched_softirq();
+
if (++st->bucket < tcp_ehash_size) {
read_lock(&tcp_ehash[st->bucket].lock);
sk = sk_head(&tcp_ehash[st->bucket].chain);
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 2a697c37135ed..6d411169bfa62 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -2,19 +2,17 @@
# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
# Released under the terms of the GNU GPL
#
-# Generate a newline separated list of entries from the file/directory pointed
-# out by the environment variable: CONFIG_INITRAMFS_SOURCE
+# Generate a newline separated list of entries from the file/directory
+# supplied as an argument.
#
-# If CONFIG_INITRAMFS_SOURCE is non-existing then generate a small dummy file.
+# If a file/directory is not supplied then generate a small dummy file.
#
-# The output is suitable for gen_init_cpio as found in usr/Makefile.
+# The output is suitable for gen_init_cpio built from usr/gen_init_cpio.c.
#
-# TODO: Add support for symlinks, sockets and pipes when gen_init_cpio
-# supports them.
-simple_initramfs() {
+default_initramfs() {
cat <<-EOF
- # This is a very simple initramfs
+ # This is a very simple, default initramfs
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
@@ -25,12 +23,19 @@ simple_initramfs() {
filetype() {
local argv1="$1"
- if [ -f "${argv1}" ]; then
+ # symlink test must come before file test
+ if [ -L "${argv1}" ]; then
+ echo "slink"
+ elif [ -f "${argv1}" ]; then
echo "file"
elif [ -d "${argv1}" ]; then
echo "dir"
elif [ -b "${argv1}" -o -c "${argv1}" ]; then
echo "nod"
+ elif [ -p "${argv1}" ]; then
+ echo "pipe"
+ elif [ -S "${argv1}" ]; then
+ echo "sock"
else
echo "invalid"
fi
@@ -52,10 +57,15 @@ print_mtime() {
parse() {
local location="$1"
local name="${location/${srcdir}//}"
+ # change '//' into '/'
+ name="${name//\/\///}"
local mode="$2"
local uid="$3"
local gid="$4"
local ftype=$(filetype "${location}")
+ # remap uid/gid to 0 if necessary
+ [ "$uid" -eq "$root_uid" ] && uid=0
+ [ "$gid" -eq "$root_gid" ] && gid=0
local str="${mode} ${uid} ${gid}"
[ "${ftype}" == "invalid" ] && return 0
@@ -79,6 +89,11 @@ parse() {
fi
str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}"
;;
+ "slink")
+ local target=$(LC_ALL=C ls -l "${location}" | \
+ gawk '{print $11}')
+ str="${ftype} ${name} ${target} ${str}"
+ ;;
*)
str="${ftype} ${name} ${str}"
;;
@@ -89,30 +104,100 @@ parse() {
return 0
}
-if [ -z "$1" ]; then
- simple_initramfs
-elif [ -f "$1" ]; then
- print_mtime "$1"
- cat "$1"
-elif [ -d "$1" ]; then
- srcdir=$(echo "$1" | sed -e 's://*:/:g')
- dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null)
-
- # If $dirlist is only one line, then the directory is empty
- if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
- print_mtime "$1"
+usage() {
+ printf "Usage:\n"
+ printf "$0 [ [-u <root_uid>] [-g <root_gid>] [-d | <cpio_source>] ] . . .\n"
+ printf "\n"
+ printf -- "-u <root_uid> User ID to map to user ID 0 (root).\n"
+ printf " <root_uid> is only meaningful if <cpio_source>\n"
+ printf " is a directory.\n"
+ printf -- "-g <root_gid> Group ID to map to group ID 0 (root).\n"
+ printf " <root_gid> is only meaningful if <cpio_source>\n"
+ printf " is a directory.\n"
+ printf "<cpio_source> File list or directory for cpio archive.\n"
+ printf " If <cpio_source> is not provided then a\n"
+ printf " a default list will be output.\n"
+ printf -- "-d Output the default cpio list. If no <cpio_source>\n"
+ printf " is given then the default cpio list will be output.\n"
+ printf "\n"
+ printf "All options may be repeated and are interpreted sequentially\n"
+ printf "and immediately. -u and -g states are preserved across\n"
+ printf "<cpio_source> options so an explicit \"-u 0 -g 0\" is required\n"
+ printf "to reset the root/group mapping.\n"
+}
+
+build_list() {
+ printf "\n#####################\n# $cpio_source\n"
+
+ if [ -f "$cpio_source" ]; then
+ print_mtime "$cpio_source"
+ cat "$cpio_source"
+ elif [ -d "$cpio_source" ]; then
+ srcdir=$(echo "$cpio_source" | sed -e 's://*:/:g')
+ dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null)
+
+ # If $dirlist is only one line, then the directory is empty
+ if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
+ print_mtime "$cpio_source"
- echo "${dirlist}" | \
- while read x; do
- parse ${x}
- done
+ echo "${dirlist}" | \
+ while read x; do
+ parse ${x}
+ done
+ else
+ # Failsafe in case directory is empty
+ default_initramfs
+ fi
else
- # Failsafe in case directory is empty
- simple_initramfs
+ echo " $0: Cannot open '$cpio_source'" >&2
+ exit 1
fi
-else
- echo " $0: Cannot open '$1' (CONFIG_INITRAMFS_SOURCE)" >&2
- exit 1
-fi
+}
+
+
+root_uid=0
+root_gid=0
+
+while [ $# -gt 0 ]; do
+ arg="$1"
+ shift
+ case "$arg" in
+ "-u")
+ root_uid="$1"
+ shift
+ ;;
+ "-g")
+ root_gid="$1"
+ shift
+ ;;
+ "-d")
+ default_list="$arg"
+ default_initramfs
+ ;;
+ "-h")
+ usage
+ exit 0
+ ;;
+ *)
+ case "$arg" in
+ "-"*)
+ printf "ERROR: unknown option \"$arg\"\n" >&2
+ printf "If the filename validly begins with '-', then it must be prefixed\n" >&2
+ printf "by './' so that it won't be interpreted as an option." >&2
+ printf "\n" >&2
+ usage >&2
+ exit 1
+ ;;
+ *)
+ cpio_source="$arg"
+ build_list
+ ;;
+ esac
+ ;;
+ esac
+done
+
+# spit out the default cpio list if a source hasn't been specified
+[ -z "$cpio_source" -a -z "$default_list" ] && default_initramfs
exit 0
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 4596883648ff0..ea71f581962b7 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -711,7 +711,7 @@ static int __devinit snd_opl3sa2_probe(int dev,
chip->single_dma = 1;
if ((err = snd_opl3sa2_detect(chip)) < 0)
goto __error;
- if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2/3", (void *)chip)) {
+ if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) {
snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq);
err = -ENODEV;
goto __error;
diff --git a/sound/oss/ac97.c b/sound/oss/ac97.c
index d79ff77540471..3ba6d91e891d2 100644
--- a/sound/oss/ac97.c
+++ b/sound/oss/ac97.c
@@ -133,7 +133,7 @@ ac97_reset (struct ac97_hwint *dev)
/* Return the contents of register REG; use the cache if the value in it
is valid. Returns a negative error code on failure. */
-int
+static int
ac97_get_register (struct ac97_hwint *dev, u8 reg)
{
if (reg > 127 || (reg & 1))
@@ -226,7 +226,7 @@ ac97_scale_from_oss_val (int value, int maxval, int is_stereo, int inv)
}
}
-int
+static int
ac97_set_mixer (struct ac97_hwint *dev, int oss_channel, u16 oss_value)
{
int scaled_value;
@@ -262,7 +262,7 @@ ac97_set_mixer (struct ac97_hwint *dev, int oss_channel, u16 oss_value)
return result;
}
-int
+static int
ac97_get_mixer_scaled (struct ac97_hwint *dev, int oss_channel)
{
struct ac97_chn_desc *channel = ac97_find_chndesc (dev, oss_channel);
@@ -292,7 +292,7 @@ ac97_get_mixer_scaled (struct ac97_hwint *dev, int oss_channel)
channel->is_inverted);
}
-int
+static int
ac97_get_recmask (struct ac97_hwint *dev)
{
int recReg = ac97_get_register (dev, AC97_RECORD_SELECT);
@@ -309,7 +309,7 @@ ac97_get_recmask (struct ac97_hwint *dev)
}
}
-int
+static int
ac97_set_recmask (struct ac97_hwint *dev, int oss_recmask)
{
int x;
@@ -439,10 +439,7 @@ ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, void __user *arg)
EXPORT_SYMBOL(ac97_init);
EXPORT_SYMBOL(ac97_set_values);
-EXPORT_SYMBOL(ac97_set_mixer);
-EXPORT_SYMBOL(ac97_get_register);
EXPORT_SYMBOL(ac97_put_register);
-EXPORT_SYMBOL(ac97_get_mixer_scaled);
EXPORT_SYMBOL(ac97_mixer_ioctl);
EXPORT_SYMBOL(ac97_reset);
MODULE_LICENSE("GPL");
diff --git a/sound/oss/ac97.h b/sound/oss/ac97.h
index 3353c84b556f8..77d454ea3202e 100644
--- a/sound/oss/ac97.h
+++ b/sound/oss/ac97.h
@@ -184,26 +184,10 @@ extern int ac97_init (struct ac97_hwint *dev);
extern int ac97_set_values (struct ac97_hwint *dev,
struct ac97_mixer_value_list *value_list);
-/* Sets one mixer channel OSS_CHANNEL to the scaled value OSS_VALUE.
- Returns the resulting (rescaled) value, or a negative value
- representing an error code.
-
- Stereo channels have two values in OSS_VALUE (the left value is in the
- lower 8 bits, the right value is in the upper 8 bits). */
-extern int ac97_set_mixer (struct ac97_hwint *dev, int oss_channel,
- u16 oss_value);
-
-/* Return the contents of the specified AC97 register REG; it uses the
- last-written value if it is available. */
-extern int ac97_get_register (struct ac97_hwint *dev, u8 reg);
-
/* Writes the specified VALUE to the AC97 register REG in the mixer.
Takes care of setting the last-written cache as well. */
extern int ac97_put_register (struct ac97_hwint *dev, u8 reg, u16 value);
-/* Returns the last OSS value written to the OSS_CHANNEL mixer channel. */
-extern int ac97_get_mixer_scaled (struct ac97_hwint *dev, int oss_channel);
-
/* Default ioctl. */
extern int ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd,
void __user * arg);
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
index c883411dacaf8..d21fdd5393938 100644
--- a/sound/oss/ac97_codec.c
+++ b/sound/oss/ac97_codec.c
@@ -52,6 +52,7 @@
#include <linux/errno.h>
#include <linux/bitops.h>
#include <linux/delay.h>
+#include <linux/pci.h>
#include <linux/ac97_codec.h>
#include <asm/uaccess.h>
@@ -128,6 +129,9 @@ static const struct {
{0x41445348, "Analog Devices AD1881A", &null_ops},
{0x41445360, "Analog Devices AD1885", &default_ops},
{0x41445361, "Analog Devices AD1886", &ad1886_ops},
+ {0x41445370, "Analog Devices AD1981", &null_ops},
+ {0x41445372, "Analog Devices AD1981A", &null_ops},
+ {0x41445374, "Analog Devices AD1981B", &null_ops},
{0x41445460, "Analog Devices AD1885", &default_ops},
{0x41445461, "Analog Devices AD1886", &ad1886_ops},
{0x414B4D00, "Asahi Kasei AK4540", &null_ops},
@@ -1453,5 +1457,92 @@ void ac97_unregister_driver(struct ac97_driver *driver)
}
EXPORT_SYMBOL_GPL(ac97_unregister_driver);
+
+static int swap_headphone(int remove_master)
+{
+ struct list_head *l;
+ struct ac97_codec *c;
+ if (remove_master) {
+ down(&codec_sem);
+ list_for_each(l, &codecs)
+ {
+ c = list_entry(l, struct ac97_codec, list);
+ if (supported_mixer(c, SOUND_MIXER_PHONEOUT))
+ c->supported_mixers &= ~SOUND_MASK_PHONEOUT;
+ }
+ up(&codec_sem);
+ } else
+ ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO;
+
+ /* Scale values already match */
+ ac97_hw[SOUND_MIXER_VOLUME].offset = AC97_MASTER_VOL_MONO;
+ return 0;
+}
+
+static int apply_quirk(int quirk)
+{
+ switch (quirk) {
+ case AC97_TUNE_NONE:
+ return 0;
+ case AC97_TUNE_HP_ONLY:
+ return swap_headphone(1);
+ case AC97_TUNE_SWAP_HP:
+ return swap_headphone(0);
+ case AC97_TUNE_SWAP_SURROUND:
+ return -ENOSYS; /* not yet implemented */
+ case AC97_TUNE_AD_SHARING:
+ return -ENOSYS; /* not yet implemented */
+ case AC97_TUNE_ALC_JACK:
+ return -ENOSYS; /* not yet implemented */
+ }
+ return -EINVAL;
+}
+
+/**
+ * ac97_tune_hardware - tune up the hardware
+ * @pdev: pci_dev pointer
+ * @quirk: quirk list
+ * @override: explicit quirk value (overrides if not AC97_TUNE_DEFAULT)
+ *
+ * Do some workaround for each pci device, such as renaming of the
+ * headphone (true line-out) control as "Master".
+ * The quirk-list must be terminated with a zero-filled entry.
+ *
+ * Returns zero if successful, or a negative error code on failure.
+ */
+
+int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override)
+{
+ int result;
+
+ if (!quirk)
+ return -EINVAL;
+
+ if (override != AC97_TUNE_DEFAULT) {
+ result = apply_quirk(override);
+ if (result < 0)
+ printk(KERN_ERR "applying quirk type %d failed (%d)\n", override, result);
+ return result;
+ }
+
+ for (; quirk->vendor; quirk++) {
+ if (quirk->vendor != pdev->subsystem_vendor)
+ continue;
+ if ((! quirk->mask && quirk->device == pdev->subsystem_device) ||
+ quirk->device == (quirk->mask & pdev->subsystem_device)) {
+#ifdef DEBUG
+ printk("ac97 quirk for %s (%04x:%04x)\n", quirk->name, ac97->subsystem_vendor, pdev->subsystem_device);
+#endif
+ result = apply_quirk(quirk->type);
+ if (result < 0)
+ printk(KERN_ERR "applying quirk type %d for %s failed (%d)\n", quirk->type, quirk->name, result);
+ return result;
+ }
+ }
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(ac97_tune_hardware);
+
MODULE_LICENSE("GPL");
diff --git a/sound/oss/aci.c b/sound/oss/aci.c
index e686eaa4d1bab..3928c2802cc43 100644
--- a/sound/oss/aci.c
+++ b/sound/oss/aci.c
@@ -83,18 +83,18 @@ static struct semaphore aci_sem;
#ifdef MODULE
static int reset;
-MODULE_PARM(reset,"i");
+module_param(reset, bool, 0);
MODULE_PARM_DESC(reset,"When set to 1, reset aci mixer.");
#else
static int reset = 1;
#endif
static int ide=-1;
-MODULE_PARM(ide,"i");
+module_param(ide, int, 0);
MODULE_PARM_DESC(ide,"1 enable, 0 disable ide-port - untested"
" default: do nothing");
static int wss=-1;
-MODULE_PARM(wss,"i");
+module_param(wss, int, 0);
MODULE_PARM_DESC(wss,"change between ACI/WSS-mixer; use 0 and 1 - untested"
" default: do nothing; for PCM1-pro only");
diff --git a/sound/oss/ad1816.c b/sound/oss/ad1816.c
index 442506444b418..22dae5d0fda3f 100644
--- a/sound/oss/ad1816.c
+++ b/sound/oss/ad1816.c
@@ -1215,16 +1215,16 @@ static int __initdata dma2 = -1;
/* use isapnp for configuration */
static int isapnp = 1;
static int isapnpjump;
-MODULE_PARM(isapnp, "i");
-MODULE_PARM(isapnpjump, "i");
+module_param(isapnp, bool, 0);
+module_param(isapnpjump, int, 0);
#endif
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma2,"i");
-MODULE_PARM(ad1816_clockfreq,"i");
-MODULE_PARM(options,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma2, int, 0);
+module_param(ad1816_clockfreq, int, 0);
+module_param(options, int, 0);
#ifdef __ISAPNP__
static struct {
@@ -1245,8 +1245,9 @@ static struct {
MODULE_DEVICE_TABLE(isapnp, isapnp_ad1816_list);
-void __init ad1816_config_pnp_card(struct pnp_card *card, unsigned short vendor,
- unsigned short function)
+static void __init ad1816_config_pnp_card(struct pnp_card *card,
+ unsigned short vendor,
+ unsigned short function)
{
struct address_info cfg;
struct pnp_dev *card_dev = pnp_find_dev(card, vendor, function, NULL);
@@ -1270,7 +1271,7 @@ void __init ad1816_config_pnp_card(struct pnp_card *card, unsigned short vendor,
}
}
-void __init ad1816_config_pnp_cards(void)
+static void __init ad1816_config_pnp_cards(void)
{
int nr_pnp_cfg;
int i;
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index c78a5a11d5c1c..4384dac3f7949 100644
--- a/sound/oss/ad1848.c
+++ b/sound/oss/ad1848.c
@@ -123,9 +123,9 @@ ad1848_port_info;
static struct address_info cfg;
static int nr_ad1848_devs;
-int deskpro_xl;
-int deskpro_m;
-int soundpro;
+static int deskpro_xl;
+static int deskpro_m;
+static int soundpro;
static volatile signed char irq2dev[17] = {
-1, -1, -1, -1, -1, -1, -1, -1,
@@ -2905,24 +2905,24 @@ static int __initdata dma = -1;
static int __initdata dma2 = -1;
static int __initdata type = 0;
-MODULE_PARM(io, "i"); /* I/O for a raw AD1848 card */
-MODULE_PARM(irq, "i"); /* IRQ to use */
-MODULE_PARM(dma, "i"); /* First DMA channel */
-MODULE_PARM(dma2, "i"); /* Second DMA channel */
-MODULE_PARM(type, "i"); /* Card type */
-MODULE_PARM(deskpro_xl, "i"); /* Special magic for Deskpro XL boxen */
-MODULE_PARM(deskpro_m, "i"); /* Special magic for Deskpro M box */
-MODULE_PARM(soundpro, "i"); /* More special magic for SoundPro chips */
+module_param(io, int, 0); /* I/O for a raw AD1848 card */
+module_param(irq, int, 0); /* IRQ to use */
+module_param(dma, int, 0); /* First DMA channel */
+module_param(dma2, int, 0); /* Second DMA channel */
+module_param(type, int, 0); /* Card type */
+module_param(deskpro_xl, bool, 0); /* Special magic for Deskpro XL boxen */
+module_param(deskpro_m, bool, 0); /* Special magic for Deskpro M box */
+module_param(soundpro, bool, 0); /* More special magic for SoundPro chips */
#ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "i");
-MODULE_PARM(isapnpjump, "i");
-MODULE_PARM(reverse, "i");
+module_param(isapnp, int, 0);
+module_param(isapnpjump, int, 0);
+module_param(reverse, bool, 0);
MODULE_PARM_DESC(isapnp, "When set to 0, Plug & Play support will be disabled");
MODULE_PARM_DESC(isapnpjump, "Jumps to a specific slot in the driver's PnP table. Use the source, Luke.");
MODULE_PARM_DESC(reverse, "When set to 1, will reverse ISAPnP search order");
-struct pnp_dev *ad1848_dev = NULL;
+static struct pnp_dev *ad1848_dev = NULL;
/* Please add new entries at the end of the table */
static struct {
diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c
index 607a07a5930fb..b767c621fd090 100644
--- a/sound/oss/ad1889.c
+++ b/sound/oss/ad1889.c
@@ -82,20 +82,6 @@ static inline void ad1889_set_wav_rate(ad1889_dev_t *dev, int rate)
ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0);
}
-static inline void ad1889_set_adc_rate(ad1889_dev_t *dev, int rate)
-{
- struct ac97_codec *ac97_codec = dev->ac97_codec;
-
- DBG("Setting ADC rate to %d\n", rate);
- dev->state[AD_ADC_STATE].dmabuf.rate = rate;
- AD1889_WRITEW(dev, AD_DSRES, rate);
-
- /* Cycle the ADC to enable the new rate */
- ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0x0100);
- WAIT_10MS();
- ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0);
-}
-
static inline void ad1889_set_wav_fmt(ad1889_dev_t *dev, int fmt)
{
u16 tmp;
@@ -308,8 +294,8 @@ static inline void ad1889_trigger_playback(ad1889_dev_t *dev)
ad1889_start_wav(&dev->state[AD_WAV_STATE]);
}
-int ad1889_read_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int ad1889_read_proc (char *page, char **start, off_t off,
+ int count, int *eof, void *data)
{
char *out = page;
int len, i;
diff --git a/sound/oss/adlib_card.c b/sound/oss/adlib_card.c
index 46e9deb63ae42..6414ceb8f0724 100644
--- a/sound/oss/adlib_card.c
+++ b/sound/oss/adlib_card.c
@@ -31,7 +31,7 @@ static struct address_info cfg;
static int __initdata io = -1;
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
static int __init init_adlib(void)
{
diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c
index 109383a30f5a7..a246289d4dd77 100644
--- a/sound/oss/aedsp16.c
+++ b/sound/oss/aedsp16.c
@@ -438,7 +438,7 @@ struct d_hcfg {
int cdrombase;
};
-struct d_hcfg decoded_hcfg __initdata = {0, };
+static struct d_hcfg decoded_hcfg __initdata = {0, };
#endif /* CONFIG_SC6600 */
@@ -610,7 +610,7 @@ void __init aedsp16_pinfo(void) {
}
#endif
-void __init aedsp16_hard_decode(void) {
+static void __init aedsp16_hard_decode(void) {
DBG((" aedsp16_hard_decode: 0x%x, 0x%x\n", hard_cfg[0], hard_cfg[1]));
@@ -654,7 +654,7 @@ void __init aedsp16_hard_decode(void) {
DBG(("success.\n"));
}
-void __init aedsp16_hard_encode(void) {
+static void __init aedsp16_hard_encode(void) {
DBG((" aedsp16_hard_encode: 0x%x, 0x%x\n", hard_cfg[0], hard_cfg[1]));
@@ -1252,7 +1252,7 @@ static void __init uninit_aedsp16_mpu(void)
DBG(("done.\n"));
}
-int __init init_aedsp16(void)
+static int __init init_aedsp16(void)
{
int initialized = FALSE;
@@ -1294,7 +1294,7 @@ int __init init_aedsp16(void)
return initialized;
}
-void __init uninit_aedsp16(void)
+static void __init uninit_aedsp16(void)
{
if (ae_config.mss_base != -1)
uninit_aedsp16_mss();
@@ -1311,17 +1311,17 @@ static int __initdata mpu_irq = -1;
static int __initdata mss_base = -1;
static int __initdata mpu_base = -1;
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "I/O base address (0x220 0x240)");
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(irq, "IRQ line (5 7 9 10 11)");
-MODULE_PARM(dma, "i");
+module_param(dma, int, 0);
MODULE_PARM_DESC(dma, "dma line (0 1 3)");
-MODULE_PARM(mpu_irq, "i");
+module_param(mpu_irq, int, 0);
MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ line (5 7 9 10 0)");
-MODULE_PARM(mss_base, "i");
+module_param(mss_base, int, 0);
MODULE_PARM_DESC(mss_base, "MSS emulation I/O base address (0x530 0xE80)");
-MODULE_PARM(mpu_base, "i");
+module_param(mpu_base, int, 0);
MODULE_PARM_DESC(mpu_base,"MPU-401 I/O base address (0x300 0x310 0x320 0x330)");
MODULE_AUTHOR("Riccardo Facchetti <fizban@tin.it>");
MODULE_DESCRIPTION("Audio Excel DSP 16 Driver Version " VERSION);
diff --git a/sound/oss/ali5455.c b/sound/oss/ali5455.c
index a331e87112fca..a48be23dabfc1 100644
--- a/sound/oss/ali5455.c
+++ b/sound/oss/ali5455.c
@@ -3651,12 +3651,13 @@ static int ali_pm_resume(struct pci_dev *dev)
MODULE_AUTHOR("");
MODULE_DESCRIPTION("ALI 5455 audio support");
MODULE_LICENSE("GPL");
-MODULE_PARM(clocking, "i");
-MODULE_PARM(strict_clocking, "i");
-MODULE_PARM(codec_pcmout_share_spdif_locked, "i");
-MODULE_PARM(codec_independent_spdif_locked, "i");
-MODULE_PARM(controller_pcmout_share_spdif_locked, "i");
-MODULE_PARM(controller_independent_spdif_locked, "i");
+module_param(clocking, int, 0);
+/* FIXME: bool? */
+module_param(strict_clocking, uint, 0);
+module_param(codec_pcmout_share_spdif_locked, uint, 0);
+module_param(codec_independent_spdif_locked, uint, 0);
+module_param(controller_pcmout_share_spdif_locked, uint, 0);
+module_param(controller_independent_spdif_locked, uint, 0);
#define ALI5455_MODULE_NAME "ali5455"
static struct pci_driver ali_pci_driver = {
.name = ALI5455_MODULE_NAME,
diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c
index c80d97c55df7f..d2b9beda8ace8 100644
--- a/sound/oss/awe_wave.c
+++ b/sound/oss/awe_wave.c
@@ -207,8 +207,8 @@ static awe_chan_info channels[AWE_MAX_CHANNELS];
#define AWE_DEFAULT_MEM_SIZE -1 /* autodetect */
#endif
-int io = AWE_DEFAULT_BASE_ADDR; /* Emu8000 base address */
-int memsize = AWE_DEFAULT_MEM_SIZE; /* memory size in Kbytes */
+static int io = AWE_DEFAULT_BASE_ADDR; /* Emu8000 base address */
+static int memsize = AWE_DEFAULT_MEM_SIZE; /* memory size in Kbytes */
#ifdef CONFIG_PNP
static int isapnp = -1;
#else
@@ -219,11 +219,11 @@ MODULE_AUTHOR("Takashi Iwai <iwai@ww.uni-erlangen.de>");
MODULE_DESCRIPTION("SB AWE32/64 WaveTable driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "base i/o port of Emu8000");
-MODULE_PARM(memsize, "i");
+module_param(memsize, int, 0);
MODULE_PARM_DESC(memsize, "onboard DRAM size in Kbytes");
-MODULE_PARM(isapnp, "i");
+module_param(isapnp, bool, 0);
MODULE_PARM_DESC(isapnp, "use ISAPnP detection");
/* DRAM start offset */
@@ -6113,12 +6113,12 @@ awe_detect(void)
return 0;
}
-int __init attach_awe(void)
+static int __init attach_awe(void)
{
return awe_detect() ? 0 : -ENODEV;
}
-void __exit unload_awe(void)
+static void __exit unload_awe(void)
{
pnp_unregister_driver(&awe_pnp_driver);
awe_dettach_device();
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index 67f8652d018fc..7f9a30a9e8d42 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -1113,15 +1113,15 @@ static void btaudio_cleanup_module(void)
module_init(btaudio_init_module);
module_exit(btaudio_cleanup_module);
-MODULE_PARM(dsp1,"i");
-MODULE_PARM(dsp2,"i");
-MODULE_PARM(mixer,"i");
-MODULE_PARM(debug,"i");
-MODULE_PARM(irq_debug,"i");
-MODULE_PARM(digital,"i");
-MODULE_PARM(analog,"i");
-MODULE_PARM(rate,"i");
-MODULE_PARM(latency,"i");
+module_param(dsp1, int, S_IRUGO);
+module_param(dsp2, int, S_IRUGO);
+module_param(mixer, int, S_IRUGO);
+module_param(debug, int, S_IRUGO | S_IWUSR);
+module_param(irq_debug, int, S_IRUGO | S_IWUSR);
+module_param(digital, int, S_IRUGO);
+module_param(analog, int, S_IRUGO);
+module_param(rate, int, S_IRUGO);
+module_param(latency, int, S_IRUGO);
MODULE_PARM_DESC(latency,"pci latency timer");
MODULE_DEVICE_TABLE(pci, btaudio_pci_tbl);
diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c
index 16ff7f094c200..72e1a6fd02726 100644
--- a/sound/oss/cmpci.c
+++ b/sound/oss/cmpci.c
@@ -479,17 +479,17 @@ static int use_line_as_bass = 0;
static int use_mic_as_bass = 0;
static int mic_boost = 0;
static int hw_copy = 0;
-MODULE_PARM(mpuio, "i");
-MODULE_PARM(fmio, "i");
-MODULE_PARM(joystick, "i");
-MODULE_PARM(spdif_inverse, "i");
-MODULE_PARM(spdif_loop, "i");
-MODULE_PARM(spdif_out, "i");
-MODULE_PARM(use_line_as_rear, "i");
-MODULE_PARM(use_line_as_bass, "i");
-MODULE_PARM(use_mic_as_bass, "i");
-MODULE_PARM(mic_boost, "i");
-MODULE_PARM(hw_copy, "i");
+module_param(mpuio, int, 0);
+module_param(fmio, int, 0);
+module_param(joystick, bool, 0);
+module_param(spdif_inverse, bool, 0);
+module_param(spdif_loop, bool, 0);
+module_param(spdif_out, bool, 0);
+module_param(use_line_as_rear, bool, 0);
+module_param(use_line_as_bass, bool, 0);
+module_param(use_mic_as_bass, bool, 0);
+module_param(mic_boost, bool, 0);
+module_param(hw_copy, bool, 0);
MODULE_PARM_DESC(mpuio, "(0x330, 0x320, 0x310, 0x300) Base of MPU-401, 0 to disable");
MODULE_PARM_DESC(fmio, "(0x388, 0x3C8, 0x3E0) Base of OPL3, 0 to disable");
MODULE_PARM_DESC(joystick, "(1/0) Enable joystick interface, still need joystick driver");
@@ -1162,15 +1162,6 @@ static inline void enable_dac_unlocked(struct cm_state *s)
enable_adc(s);
}
-static inline void enable_dac(struct cm_state *s)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&s->lock, flags);
- enable_dac_unlocked(s);
- spin_unlock_irqrestore(&s->lock, flags);
-}
-
static inline void stop_adc_unlocked(struct cm_state *s)
{
if (s->enable & ENADC) {
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index 1d0f6edc21ae1..6ec308f5d9352 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -54,7 +54,6 @@
#include "sound_config.h"
-#include "cs4232.h"
#include "ad1848.h"
#include "mpu401.h"
@@ -78,7 +77,7 @@ static int mpu_base, mpu_irq;
static int synth_base, synth_irq;
static int mpu_detected;
-int probe_cs4232_mpu(struct address_info *hw_config)
+static int probe_cs4232_mpu(struct address_info *hw_config)
{
/*
* Just write down the config values.
@@ -363,25 +362,25 @@ MODULE_DESCRIPTION("CS4232 based soundcard driver");
MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis");
MODULE_LICENSE("GPL");
-MODULE_PARM(io,"i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io,"base I/O port for AD1848");
-MODULE_PARM(irq,"i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(irq,"IRQ for AD1848 chip");
-MODULE_PARM(dma,"i");
+module_param(dma, int, 0);
MODULE_PARM_DESC(dma,"8 bit DMA for AD1848 chip");
-MODULE_PARM(dma2,"i");
+module_param(dma2, int, 0);
MODULE_PARM_DESC(dma2,"16 bit DMA for AD1848 chip");
-MODULE_PARM(mpuio,"i");
+module_param(mpuio, int, 0);
MODULE_PARM_DESC(mpuio,"MPU 401 base address");
-MODULE_PARM(mpuirq,"i");
+module_param(mpuirq, int, 0);
MODULE_PARM_DESC(mpuirq,"MPU 401 IRQ");
-MODULE_PARM(synthio,"i");
+module_param(synthio, int, 0);
MODULE_PARM_DESC(synthio,"Maui WaveTable base I/O port");
-MODULE_PARM(synthirq,"i");
+module_param(synthirq, int, 0);
MODULE_PARM_DESC(synthirq,"Maui WaveTable IRQ");
-MODULE_PARM(isapnp,"i");
+module_param(isapnp, bool, 0);
MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)");
-MODULE_PARM(bss,"i");
+module_param(bss, bool, 0);
MODULE_PARM_DESC(bss,"Enable Bose Sound System Support (default 0)");
/*
diff --git a/sound/oss/cs4232.h b/sound/oss/cs4232.h
deleted file mode 100644
index a5a00292c5f32..0000000000000
--- a/sound/oss/cs4232.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-int probe_cs4232_mpu (struct address_info *hw_config);
-void attach_cs4232_mpu (struct address_info *hw_config);
diff --git a/sound/oss/cs4281/cs4281_wrapper-24.c b/sound/oss/cs4281/cs4281_wrapper-24.c
index ffa6200f2521d..bd61a45983dd1 100644
--- a/sound/oss/cs4281/cs4281_wrapper-24.c
+++ b/sound/oss/cs4281/cs4281_wrapper-24.c
@@ -26,8 +26,8 @@
#include <linux/spinlock.h>
-int cs4281_resume_null(struct pci_dev *pcidev) { return 0; }
-int cs4281_suspend_null(struct pci_dev *pcidev, u32 state) { return 0; }
+static int cs4281_resume_null(struct pci_dev *pcidev) { return 0; }
+static int cs4281_suspend_null(struct pci_dev *pcidev, u32 state) { return 0; }
#define free_dmabuf(state, dmabuf) \
pci_free_consistent(state->pcidev, \
diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
index 947e5f9ee15cd..5fff9c331f548 100644
--- a/sound/oss/cs4281/cs4281m.c
+++ b/sound/oss/cs4281/cs4281m.c
@@ -111,7 +111,7 @@ static void start_adc(struct cs4281_state *s);
// rather than 64k as some of the games work more responsively.
// log base 2( buff sz = 32k).
static unsigned long defaultorder = 3;
-MODULE_PARM(defaultorder, "i");
+module_param(defaultorder, ulong, 0);
//
// Turn on/off debugging compilation by commenting out "#define CSDEBUG"
@@ -159,8 +159,8 @@ MODULE_PARM(defaultorder, "i");
#if CSDEBUG
static unsigned long cs_debuglevel = 1; // levels range from 1-9
static unsigned long cs_debugmask = CS_INIT | CS_ERROR; // use CS_DBGOUT with various mask values
-MODULE_PARM(cs_debuglevel, "i");
-MODULE_PARM(cs_debugmask, "i");
+module_param(cs_debuglevel, ulong, 0);
+module_param(cs_debugmask, ulong, 0);
#endif
#define CS_TRUE 1
#define CS_FALSE 0
@@ -197,7 +197,7 @@ static const char invalid_magic[] =
})
//LIST_HEAD(cs4281_devs);
-struct list_head cs4281_devs = { &cs4281_devs, &cs4281_devs };
+static struct list_head cs4281_devs = { &cs4281_devs, &cs4281_devs };
struct cs4281_state;
@@ -1019,7 +1019,7 @@ static void printpipelines(struct cs4281_state *s)
* Suspend - save the ac97 regs, mute the outputs and power down the part.
*
****************************************************************************/
-void cs4281_ac97_suspend(struct cs4281_state *s)
+static void cs4281_ac97_suspend(struct cs4281_state *s)
{
int Count,i;
@@ -1070,7 +1070,7 @@ void cs4281_ac97_suspend(struct cs4281_state *s)
* Resume - power up the part and restore its registers..
*
****************************************************************************/
-void cs4281_ac97_resume(struct cs4281_state *s)
+static void cs4281_ac97_resume(struct cs4281_state *s)
{
int Count,i;
@@ -1143,7 +1143,7 @@ HWAC97codec::SavePowerState(void)
} // SavePowerState
*/
-void cs4281_SuspendFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
+static void cs4281_SuspendFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
{
/*
* We need to save the contents of the BASIC FIFO Registers.
@@ -1151,7 +1151,7 @@ void cs4281_SuspendFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
pl->u32FCRn_Save = readl(s->pBA0 + pl->u32FCRnAddress);
pl->u32FSICn_Save = readl(s->pBA0 + pl->u32FSICnAddress);
}
-void cs4281_ResumeFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
+static void cs4281_ResumeFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
{
/*
* We need to restore the contents of the BASIC FIFO Registers.
@@ -1159,7 +1159,7 @@ void cs4281_ResumeFIFO(struct cs4281_state *s, struct cs4281_pipeline *pl)
writel(pl->u32FCRn_Save,s->pBA0 + pl->u32FCRnAddress);
writel(pl->u32FSICn_Save,s->pBA0 + pl->u32FSICnAddress);
}
-void cs4281_SuspendDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
+static void cs4281_SuspendDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
{
//
// We need to save the contents of the BASIC DMA Registers.
@@ -1171,7 +1171,7 @@ void cs4281_SuspendDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
pl->u32DCCn_Save = readl(s->pBA0 + pl->u32DCCnAddress);
pl->u32DCAn_Save = readl(s->pBA0 + pl->u32DCAnAddress);
}
-void cs4281_ResumeDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
+static void cs4281_ResumeDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
{
//
// We need to save the contents of the BASIC DMA Registers.
@@ -1184,7 +1184,7 @@ void cs4281_ResumeDMAengine(struct cs4281_state *s, struct cs4281_pipeline *pl)
writel( pl->u32DCAn_Save, s->pBA0 + pl->u32DCAnAddress);
}
-int cs4281_suspend(struct cs4281_state *s)
+static int cs4281_suspend(struct cs4281_state *s)
{
int i;
u32 u32CLKCR1;
@@ -1340,7 +1340,7 @@ int cs4281_suspend(struct cs4281_state *s)
return 0;
}
-int cs4281_resume(struct cs4281_state *s)
+static int cs4281_resume(struct cs4281_state *s)
{
int i;
unsigned temp1;
@@ -1695,7 +1695,7 @@ static void start_adc(struct cs4281_state *s)
#define DMABUF_MINORDER 1 // ==> min buffer size = 8K.
-void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db)
+static void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db)
{
struct page *map, *mapend;
@@ -4112,7 +4112,7 @@ static struct initvol {
#ifndef NOT_CS4281_PM
-void __devinit cs4281_BuildFIFO(
+static void __devinit cs4281_BuildFIFO(
struct cs4281_pipeline *p,
struct cs4281_state *s)
{
@@ -4159,7 +4159,7 @@ void __devinit cs4281_BuildFIFO(
}
-void __devinit cs4281_BuildDMAengine(
+static void __devinit cs4281_BuildDMAengine(
struct cs4281_pipeline *p,
struct cs4281_state *s)
{
@@ -4229,7 +4229,7 @@ void __devinit cs4281_BuildDMAengine(
}
-void __devinit cs4281_InitPM(struct cs4281_state *s)
+static void __devinit cs4281_InitPM(struct cs4281_state *s)
{
int i;
struct cs4281_pipeline *p;
@@ -4459,7 +4459,7 @@ static struct pci_device_id cs4281_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, cs4281_pci_tbl);
-struct pci_driver cs4281_pci_driver = {
+static struct pci_driver cs4281_pci_driver = {
.name = "cs4281",
.id_table = cs4281_pci_tbl,
.probe = cs4281_probe,
@@ -4468,7 +4468,7 @@ struct pci_driver cs4281_pci_driver = {
.resume = CS4281_RESUME_TBL,
};
-int __init cs4281_init_module(void)
+static int __init cs4281_init_module(void)
{
int rtn = 0;
CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO
@@ -4483,7 +4483,7 @@ int __init cs4281_init_module(void)
return rtn;
}
-void __exit cs4281_cleanup_module(void)
+static void __exit cs4281_cleanup_module(void)
{
pci_unregister_driver(&cs4281_pci_driver);
#ifndef NOT_CS4281_PM
@@ -4503,9 +4503,3 @@ MODULE_LICENSE("GPL");
module_init(cs4281_init_module);
module_exit(cs4281_cleanup_module);
-#ifndef MODULE
-int __init init_cs4281(void)
-{
- return cs4281_init_module();
-}
-#endif
diff --git a/sound/oss/cs4281/cs4281pm-24.c b/sound/oss/cs4281/cs4281pm-24.c
index faa091b8cb0df..d2a453aff0aa1 100644
--- a/sound/oss/cs4281/cs4281pm-24.c
+++ b/sound/oss/cs4281/cs4281pm-24.c
@@ -30,8 +30,8 @@
#define cs_pm_register(a, b, c) pm_register((a), (b), (c));
#define cs_pm_unregister_all(a) pm_unregister_all((a));
-int cs4281_suspend(struct cs4281_state *s);
-int cs4281_resume(struct cs4281_state *s);
+static int cs4281_suspend(struct cs4281_state *s);
+static int cs4281_resume(struct cs4281_state *s);
/*
* for now (12/22/00) only enable the pm_register PM support.
* allow these table entries to be null.
@@ -41,7 +41,7 @@ int cs4281_resume(struct cs4281_state *s);
#define CS4281_SUSPEND_TBL cs4281_suspend_null
#define CS4281_RESUME_TBL cs4281_resume_null
-int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+static int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
{
struct cs4281_state *state;
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
index a4141e3c02b01..bc4941cb8b11f 100644
--- a/sound/oss/cs46xx.c
+++ b/sound/oss/cs46xx.c
@@ -175,24 +175,24 @@
#if CSDEBUG
static unsigned long cs_debuglevel=1; /* levels range from 1-9 */
-MODULE_PARM(cs_debuglevel, "i");
+module_param(cs_debuglevel, ulong, 0644);
static unsigned long cs_debugmask=CS_INIT | CS_ERROR; /* use CS_DBGOUT with various mask values */
-MODULE_PARM(cs_debugmask, "i");
+module_param(cs_debugmask, ulong, 0644);
#endif
static unsigned long hercules_egpio_disable; /* if non-zero set all EGPIO to 0 */
-MODULE_PARM(hercules_egpio_disable, "i");
+module_param(hercules_egpio_disable, ulong, 0);
static unsigned long initdelay=700; /* PM delay in millisecs */
-MODULE_PARM(initdelay, "i");
+module_param(initdelay, ulong, 0);
static unsigned long powerdown=-1; /* turn on/off powerdown processing in driver */
-MODULE_PARM(powerdown, "i");
+module_param(powerdown, ulong, 0);
#define DMABUF_DEFAULTORDER 3
static unsigned long defaultorder=DMABUF_DEFAULTORDER;
-MODULE_PARM(defaultorder, "i");
+module_param(defaultorder, ulong, 0);
static int external_amp;
-MODULE_PARM(external_amp, "i");
+module_param(external_amp, bool, 0);
static int thinkpad;
-MODULE_PARM(thinkpad, "i");
+module_param(thinkpad, bool, 0);
/*
* set the powerdown module parm to 0 to disable all
@@ -219,7 +219,7 @@ struct cs_channel
#define CS46XX_ARCH "32" //architecture key
#endif
-struct list_head cs46xx_devs = { &cs46xx_devs, &cs46xx_devs };
+static struct list_head cs46xx_devs = { &cs46xx_devs, &cs46xx_devs };
/* magic numbers to protect our data structures */
#define CS_CARD_MAGIC 0x43525553 /* "CRUS" */
@@ -391,30 +391,9 @@ static void cs461x_clear_serial_FIFOs(struct cs_card *card, int type);
static int cs46xx_suspend_tbl(struct pci_dev *pcidev, u32 state);
static int cs46xx_resume_tbl(struct pci_dev *pcidev);
-static inline unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}
+#ifndef CS46XX_ACPI_SUPPORT
+static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
+#endif
#if CSDEBUG
@@ -426,7 +405,7 @@ static inline unsigned ld2(unsigned int x)
#define SOUND_MIXER_CS_SETDBGMASK _SIOWR('M',123, int)
#define SOUND_MIXER_CS_APM _SIOWR('M',124, int)
-void printioctl(unsigned int x)
+static void printioctl(unsigned int x)
{
unsigned int i;
unsigned char vidx;
@@ -964,7 +943,7 @@ static struct InitStruct
* "SetCaptureSPValues()" -- Initialize record task values before each
* capture startup.
*/
-void SetCaptureSPValues(struct cs_card *card)
+static void SetCaptureSPValues(struct cs_card *card)
{
unsigned i, offset;
CS_DBGOUT(CS_FUNCTION, 8, printk("cs46xx: SetCaptureSPValues()+\n") );
@@ -3490,7 +3469,7 @@ static void printpm(struct cs_card *s)
* Suspend - save the ac97 regs, mute the outputs and power down the part.
*
****************************************************************************/
-void cs46xx_ac97_suspend(struct cs_card *card)
+static void cs46xx_ac97_suspend(struct cs_card *card)
{
int Count,i;
struct ac97_codec *dev=card->ac97_codec[0];
@@ -3561,7 +3540,7 @@ void cs46xx_ac97_suspend(struct cs_card *card)
* Resume - power up the part and restore its registers..
*
****************************************************************************/
-void cs46xx_ac97_resume(struct cs_card *card)
+static void cs46xx_ac97_resume(struct cs_card *card)
{
int Count,i;
struct ac97_codec *dev=card->ac97_codec[0];
@@ -4149,7 +4128,6 @@ match:
return 0;
}
-void __exit cs46xx_cleanup_module(void);
static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
@@ -5719,7 +5697,7 @@ static struct pci_device_id cs46xx_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, cs46xx_pci_tbl);
-struct pci_driver cs46xx_pci_driver = {
+static struct pci_driver cs46xx_pci_driver = {
.name = "cs46xx",
.id_table = cs46xx_pci_tbl,
.probe = cs46xx_probe,
@@ -5728,7 +5706,7 @@ struct pci_driver cs46xx_pci_driver = {
.resume = CS46XX_RESUME_TBL,
};
-int __init cs46xx_init_module(void)
+static int __init cs46xx_init_module(void)
{
int rtn = 0;
CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO
@@ -5746,7 +5724,7 @@ int __init cs46xx_init_module(void)
return rtn;
}
-void __exit cs46xx_cleanup_module(void)
+static void __exit cs46xx_cleanup_module(void)
{
pci_unregister_driver(&cs46xx_pci_driver);
cs_pm_unregister_all(cs46xx_pm_callback);
@@ -5757,7 +5735,8 @@ void __exit cs46xx_cleanup_module(void)
module_init(cs46xx_init_module);
module_exit(cs46xx_cleanup_module);
-int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+#ifndef CS46XX_ACPI_SUPPORT
+static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
{
struct cs_card *card;
@@ -5792,6 +5771,7 @@ int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
return 0;
}
+#endif
#if CS46XX_ACPI_SUPPORT
static int cs46xx_suspend_tbl(struct pci_dev *pcidev, u32 state)
diff --git a/sound/oss/cs46xx_wrapper-24.h b/sound/oss/cs46xx_wrapper-24.h
index baf476840ddcb..f68e01181a7c4 100644
--- a/sound/oss/cs46xx_wrapper-24.h
+++ b/sound/oss/cs46xx_wrapper-24.h
@@ -30,7 +30,7 @@
#define CS_OWNER .owner =
#define CS_THIS_MODULE THIS_MODULE,
-void cs46xx_null(struct pci_dev *pcidev) { return; }
+static inline void cs46xx_null(struct pci_dev *pcidev) { return; }
#define cs4x_mem_map_reserve(page) SetPageReserved(page)
#define cs4x_mem_map_unreserve(page) ClearPageReserved(page)
diff --git a/sound/oss/cs46xxpm-24.h b/sound/oss/cs46xxpm-24.h
index f1aed86c721a7..7402cb76e43a8 100644
--- a/sound/oss/cs46xxpm-24.h
+++ b/sound/oss/cs46xxpm-24.h
@@ -48,6 +48,5 @@ static int cs46xx_resume_tbl(struct pci_dev *pcidev);
#define CS46XX_SUSPEND_TBL cs46xx_null
#define CS46XX_RESUME_TBL cs46xx_null
#endif
-int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
#endif
diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c
index 9cf30ab2ff429..cde4d59d54306 100644
--- a/sound/oss/emu10k1/audio.c
+++ b/sound/oss/emu10k1/audio.c
@@ -49,6 +49,9 @@
static void calculate_ofrag(struct woinst *);
static void calculate_ifrag(struct wiinst *);
+static void emu10k1_waveout_bh(unsigned long refdata);
+static void emu10k1_wavein_bh(unsigned long refdata);
+
/* Audio file operations */
static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
{
@@ -1032,7 +1035,7 @@ static struct page *emu10k1_mm_nopage (struct vm_area_struct * vma, unsigned lon
return dmapage;
}
-struct vm_operations_struct emu10k1_mm_ops = {
+static struct vm_operations_struct emu10k1_mm_ops = {
.nopage = emu10k1_mm_nopage,
};
@@ -1191,7 +1194,7 @@ match:
wiinst->mmapped = 0;
wiinst->total_recorded = 0;
wiinst->blocks = 0;
- wiinst->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&wiinst->lock);
tasklet_init(&wiinst->timer.tasklet, emu10k1_wavein_bh, (unsigned long) wave_dev);
wave_dev->wiinst = wiinst;
emu10k1_wavein_setformat(wave_dev, &wiinst->format);
@@ -1235,7 +1238,7 @@ match:
woinst->total_copied = 0;
woinst->total_played = 0;
woinst->blocks = 0;
- woinst->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&woinst->lock);
tasklet_init(&woinst->timer.tasklet, emu10k1_waveout_bh, (unsigned long) wave_dev);
wave_dev->woinst = woinst;
emu10k1_waveout_setformat(wave_dev, &woinst->format);
@@ -1506,7 +1509,7 @@ static void calculate_ifrag(struct wiinst *wiinst)
return;
}
-void emu10k1_wavein_bh(unsigned long refdata)
+static void emu10k1_wavein_bh(unsigned long refdata)
{
struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) refdata;
struct wiinst *wiinst = wave_dev->wiinst;
@@ -1537,7 +1540,7 @@ void emu10k1_wavein_bh(unsigned long refdata)
return;
}
-void emu10k1_waveout_bh(unsigned long refdata)
+static void emu10k1_waveout_bh(unsigned long refdata)
{
struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) refdata;
struct woinst *woinst = wave_dev->woinst;
diff --git a/sound/oss/emu10k1/audio.h b/sound/oss/emu10k1/audio.h
index 5b2f104780ac1..26ee81bbd6c64 100644
--- a/sound/oss/emu10k1/audio.h
+++ b/sound/oss/emu10k1/audio.h
@@ -41,7 +41,4 @@ struct emu10k1_wavedevice
u16 enablebits;
};
-void emu10k1_waveout_bh(unsigned long);
-void emu10k1_wavein_bh(unsigned long);
-
#endif /* _AUDIO_H */
diff --git a/sound/oss/emu10k1/cardmi.c b/sound/oss/emu10k1/cardmi.c
index 7a6439457a11d..0545814cc67dc 100644
--- a/sound/oss/emu10k1/cardmi.c
+++ b/sound/oss/emu10k1/cardmi.c
@@ -38,6 +38,26 @@
#include "cardmi.h"
#include "irqmgr.h"
+
+static int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid);
+
+static int sblive_miStateInit(struct emu10k1_mpuin *);
+static int sblive_miStateEntry(struct emu10k1_mpuin *, u8);
+static int sblive_miStateParse(struct emu10k1_mpuin *, u8);
+static int sblive_miState3Byte(struct emu10k1_mpuin *, u8);
+static int sblive_miState3ByteKey(struct emu10k1_mpuin *, u8);
+static int sblive_miState3ByteVel(struct emu10k1_mpuin *, u8);
+static int sblive_miState2Byte(struct emu10k1_mpuin *, u8);
+static int sblive_miState2ByteKey(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysCommon2(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysCommon3(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysExNorm(struct emu10k1_mpuin *, u8);
+static int sblive_miStateSysReal(struct emu10k1_mpuin *, u8);
+
+
static struct {
int (*Fn) (struct emu10k1_mpuin *, u8);
} midistatefn[] = {
@@ -69,6 +89,7 @@ static struct {
sblive_miStateSysReal} /* 0xF4 - 0xF6 ,0xF8 - 0xFF */
};
+
/* Installs the IRQ handler for the MPU in port */
/* and initialize parameters */
@@ -269,7 +290,7 @@ int emu10k1_mpuin_reset(struct emu10k1_card *card)
/* Passes the message with the data back to the client */
/* via IRQ & DPC callbacks to Ring 3 */
-int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid)
+static int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid)
{
unsigned long timein;
struct midi_queue *midiq;
@@ -374,7 +395,7 @@ int emu10k1_mpuin_irqhandler(struct emu10k1_card *card)
/*****************************************************************************/
/* FIXME: This should be a macro */
-int sblive_miStateInit(struct emu10k1_mpuin *card_mpuin)
+static int sblive_miStateInit(struct emu10k1_mpuin *card_mpuin)
{
card_mpuin->status = 0; /* For MIDI running status */
card_mpuin->fstatus = 0; /* For 0xFn status only */
@@ -388,12 +409,12 @@ int sblive_miStateInit(struct emu10k1_mpuin *card_mpuin)
}
/* FIXME: This should be a macro */
-int sblive_miStateEntry(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateEntry(struct emu10k1_mpuin *card_mpuin, u8 data)
{
return midistatefn[card_mpuin->curstate].Fn(card_mpuin, data);
}
-int sblive_miStateParse(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateParse(struct emu10k1_mpuin *card_mpuin, u8 data)
{
switch (data & 0xf0) {
case 0x80:
@@ -457,7 +478,7 @@ int sblive_miStateParse(struct emu10k1_mpuin *card_mpuin, u8 data)
return midistatefn[card_mpuin->curstate].Fn(card_mpuin, data);
}
-int sblive_miState3Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miState3Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
{
u8 temp = data & 0xf0;
@@ -473,8 +494,7 @@ int sblive_miState3Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
return midistatefn[STIN_PARSE].Fn(card_mpuin, data);
}
-int sblive_miState3ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miState3ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 1 */
{
unsigned long tmp;
@@ -502,8 +522,7 @@ int sblive_miState3ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
return CTSTATUS_NEXT_BYTE;
}
-int sblive_miState3ByteVel(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miState3ByteVel(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 2 */
{
unsigned long tmp;
@@ -539,7 +558,7 @@ int sblive_miState3ByteVel(struct emu10k1_mpuin *card_mpuin, u8 data)
return 0;
}
-int sblive_miState2Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miState2Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
{
u8 temp = data & 0xf0;
@@ -556,8 +575,7 @@ int sblive_miState2Byte(struct emu10k1_mpuin *card_mpuin, u8 data)
return midistatefn[STIN_PARSE].Fn(card_mpuin, data);
}
-int sblive_miState2ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miState2ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 1 */
{
unsigned long tmp;
@@ -590,7 +608,7 @@ int sblive_miState2ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data)
return 0;
}
-int sblive_miStateSysCommon2(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateSysCommon2(struct emu10k1_mpuin *card_mpuin, u8 data)
{
card_mpuin->fstatus = data;
card_mpuin->curstate = STIN_SYS_COMMON_2_KEY;
@@ -598,8 +616,7 @@ int sblive_miStateSysCommon2(struct emu10k1_mpuin *card_mpuin, u8 data)
return CTSTATUS_NEXT_BYTE;
}
-int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 1 */
{
unsigned long tmp;
@@ -632,7 +649,7 @@ int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *card_mpuin, u8 data)
return 0;
}
-int sblive_miStateSysCommon3(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateSysCommon3(struct emu10k1_mpuin *card_mpuin, u8 data)
{
card_mpuin->fstatus = data;
card_mpuin->curstate = STIN_SYS_COMMON_3_KEY;
@@ -640,8 +657,7 @@ int sblive_miStateSysCommon3(struct emu10k1_mpuin *card_mpuin, u8 data)
return CTSTATUS_NEXT_BYTE;
}
-int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 1 */
{
unsigned long tmp;
@@ -670,8 +686,7 @@ int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *card_mpuin, u8 data)
return CTSTATUS_NEXT_BYTE;
}
-int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *card_mpuin, u8 data)
-
+static int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *card_mpuin, u8 data)
/* byte 2 */
{
unsigned long tmp;
@@ -708,7 +723,7 @@ int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *card_mpuin, u8 data)
return 0;
}
-int sblive_miStateSysExNorm(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateSysExNorm(struct emu10k1_mpuin *card_mpuin, u8 data)
{
unsigned long flags;
@@ -809,7 +824,7 @@ int sblive_miStateSysExNorm(struct emu10k1_mpuin *card_mpuin, u8 data)
return CTSTATUS_NEXT_BYTE;
}
-int sblive_miStateSysReal(struct emu10k1_mpuin *card_mpuin, u8 data)
+static int sblive_miStateSysReal(struct emu10k1_mpuin *card_mpuin, u8 data)
{
emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INDATA, data, 1);
diff --git a/sound/oss/emu10k1/cardmi.h b/sound/oss/emu10k1/cardmi.h
index bd922c0175d2d..d12c24116307e 100644
--- a/sound/oss/emu10k1/cardmi.h
+++ b/sound/oss/emu10k1/cardmi.h
@@ -91,24 +91,7 @@ int emu10k1_mpuin_start(struct emu10k1_card *);
int emu10k1_mpuin_stop(struct emu10k1_card *);
int emu10k1_mpuin_reset(struct emu10k1_card *);
-int sblive_miStateInit(struct emu10k1_mpuin *);
-int sblive_miStateEntry(struct emu10k1_mpuin *, u8);
-int sblive_miStateParse(struct emu10k1_mpuin *, u8);
-int sblive_miState3Byte(struct emu10k1_mpuin *, u8);
-int sblive_miState3ByteKey(struct emu10k1_mpuin *, u8);
-int sblive_miState3ByteVel(struct emu10k1_mpuin *, u8);
-int sblive_miState2Byte(struct emu10k1_mpuin *, u8);
-int sblive_miState2ByteKey(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysCommon2(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysCommon3(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysExNorm(struct emu10k1_mpuin *, u8);
-int sblive_miStateSysReal(struct emu10k1_mpuin *, u8);
-
int emu10k1_mpuin_irqhandler(struct emu10k1_card *);
void emu10k1_mpuin_bh(unsigned long);
-int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid);
#endif /* _CARDMI_H */
diff --git a/sound/oss/emu10k1/cardwi.c b/sound/oss/emu10k1/cardwi.c
index a6b0495eb52f9..8bbf44b881b40 100644
--- a/sound/oss/emu10k1/cardwi.c
+++ b/sound/oss/emu10k1/cardwi.c
@@ -42,7 +42,7 @@
* This function will return a valid sound format as close
* to the requested one as possible.
*/
-void query_format(int recsrc, struct wave_format *wave_fmt)
+static void query_format(int recsrc, struct wave_format *wave_fmt)
{
switch (recsrc) {
diff --git a/sound/oss/emu10k1/efxmgr.c b/sound/oss/emu10k1/efxmgr.c
index 1f1d5b85dd85b..7d5865de4c2e4 100644
--- a/sound/oss/emu10k1/efxmgr.c
+++ b/sound/oss/emu10k1/efxmgr.c
@@ -101,8 +101,8 @@ void emu10k1_set_control_gpr(struct emu10k1_card *card, int addr, s32 val, int f
#define VOLCTRL_STEP_SIZE 5
//An internal function for setting OSS mixer controls.
-void emu10k1_set_oss_vol(struct emu10k1_card *card, int oss_mixer,
- unsigned int left, unsigned int right)
+static void emu10k1_set_oss_vol(struct emu10k1_card *card, int oss_mixer,
+ unsigned int left, unsigned int right)
{
extern char volume_params[SOUND_MIXER_NRDEVICES];
diff --git a/sound/oss/emu10k1/hwaccess.c b/sound/oss/emu10k1/hwaccess.c
index 698c35414ecba..2dc16a841fa1a 100644
--- a/sound/oss/emu10k1/hwaccess.c
+++ b/sound/oss/emu10k1/hwaccess.c
@@ -105,31 +105,6 @@ u32 srToPitch(u32 sampleRate)
return 0; /* Should never reach this point */
}
-/* Returns an attenuation based upon a cumulative volume value */
-
-/* Algorithm calculates 0x200 - 0x10 log2 (input) */
-u8 sumVolumeToAttenuation(u32 value)
-{
- u16 count = 16;
- s16 ans;
-
- if (value == 0)
- return 0xFF;
-
- /* Find first SET bit. This is the integer part of the value */
- while ((value & 0x10000) == 0) {
- value <<= 1;
- count--;
- }
-
- /* The REST of the data is the fractional part. */
- ans = (s16) (0x110 - ((count << 4) + ((value & 0x0FFFFL) >> 12)));
- if (ans > 0xFF)
- ans = 0xFF;
-
- return (u8) ans;
-}
-
/*******************************************
* write/read PCI function 0 registers *
********************************************/
@@ -160,6 +135,7 @@ void emu10k1_writefn0(struct emu10k1_card *card, u32 reg, u32 data)
return;
}
+#ifdef DBGEMU
void emu10k1_writefn0_2(struct emu10k1_card *card, u32 reg, u32 data, int size)
{
unsigned long flags;
@@ -177,6 +153,7 @@ void emu10k1_writefn0_2(struct emu10k1_card *card, u32 reg, u32 data, int size)
return;
}
+#endif /* DBGEMU */
u32 emu10k1_readfn0(struct emu10k1_card * card, u32 reg)
{
@@ -340,17 +317,6 @@ void emu10k1_irq_disable(struct emu10k1_card *card, u32 irq_mask)
return;
}
-void emu10k1_set_stop_on_loop(struct emu10k1_card *card, u32 voicenum)
-{
- /* Voice interrupt */
- if (voicenum >= 32)
- sblive_writeptr(card, SOLEH | ((0x0100 | (voicenum - 32)) << 16), 0, 1);
- else
- sblive_writeptr(card, SOLEL | ((0x0100 | voicenum) << 16), 0, 1);
-
- return;
-}
-
void emu10k1_clear_stop_on_loop(struct emu10k1_card *card, u32 voicenum)
{
/* Voice interrupt */
diff --git a/sound/oss/emu10k1/hwaccess.h b/sound/oss/emu10k1/hwaccess.h
index eca206e6626a5..104223a192aa1 100644
--- a/sound/oss/emu10k1/hwaccess.h
+++ b/sound/oss/emu10k1/hwaccess.h
@@ -212,7 +212,6 @@ void emu10k1_set_volume_gpr(struct emu10k1_card *, int, s32, int);
#define TIMEOUT 16384
u32 srToPitch(u32);
-u8 sumVolumeToAttenuation(u32);
extern struct list_head emu10k1_devs;
@@ -232,7 +231,6 @@ u32 sblive_readptr(struct emu10k1_card *, u32 , u32 );
void emu10k1_irq_enable(struct emu10k1_card *, u32);
void emu10k1_irq_disable(struct emu10k1_card *, u32);
-void emu10k1_set_stop_on_loop(struct emu10k1_card *, u32);
void emu10k1_clear_stop_on_loop(struct emu10k1_card *, u32);
/* AC97 Codec register access function */
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 8f6f2df002d5b..9b905bae423eb 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -309,8 +309,8 @@ static void emu10k1_unregister_devices(struct emu10k1_card *card)
unregister_sound_dsp(card->audio_dev);
}
-int emu10k1_info_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int emu10k1_info_proc (char *page, char **start, off_t off,
+ int count, int *eof, void *data)
{
struct emu10k1_card *card = data;
int len = 0;
@@ -524,7 +524,7 @@ static void __devinit timer_init(struct emu10k1_card *card)
{
INIT_LIST_HEAD(&card->timers);
card->timer_delay = TIMER_STOPPED;
- card->timer_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&card->timer_lock);
}
static void __devinit addxmgr_init(struct emu10k1_card *card)
@@ -873,7 +873,7 @@ static int __devinit fx_init(struct emu10k1_card *card)
sblive_writeptr(card, DBG, 0, 0);
}
- mgr->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&mgr->lock);
// Set up Volume controls, try to keep this the same for both Audigy and Live
diff --git a/sound/oss/emu10k1/voicemgr.c b/sound/oss/emu10k1/voicemgr.c
index c27f4a5f7e598..d88b602c07c2c 100644
--- a/sound/oss/emu10k1/voicemgr.c
+++ b/sound/oss/emu10k1/voicemgr.c
@@ -39,7 +39,8 @@
#define PITCH_67882 0x00005a82
#define PITCH_57081 0x00004c1c
-u32 emu10k1_select_interprom(struct emu10k1_card *card, struct emu_voice *voice)
+static u32 emu10k1_select_interprom(struct emu10k1_card *card,
+ struct emu_voice *voice)
{
if(voice->pitch_target==PITCH_48000)
return CCCA_INTERPROM_0;
diff --git a/sound/oss/es1370.c b/sound/oss/es1370.c
index df8f0e334ffce..52cc8bf5abf56 100644
--- a/sound/oss/es1370.c
+++ b/sound/oss/es1370.c
@@ -2525,9 +2525,9 @@ static int micbias[NR_DEVICE];
static unsigned int devindex;
-MODULE_PARM(lineout, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(lineout, bool, NULL, 0);
MODULE_PARM_DESC(lineout, "if 1 the LINE input is converted to LINE out");
-MODULE_PARM(micbias, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(micbias, bool, NULL, 0);
MODULE_PARM_DESC(micbias, "sets the +5V bias for an electret microphone");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
index b6d943e7b0b89..0fc6334d4f637 100644
--- a/sound/oss/es1371.c
+++ b/sound/oss/es1371.c
@@ -2741,11 +2741,11 @@ static int amplifier[NR_DEVICE];
static unsigned int devindex;
-MODULE_PARM(spdif, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(spdif, bool, NULL, 0);
MODULE_PARM_DESC(spdif, "if 1 the output is in S/PDIF digital mode");
-MODULE_PARM(nomix, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(nomix, bool, NULL, 0);
MODULE_PARM_DESC(nomix, "if 1 no analog audio is mixed to the digital output");
-MODULE_PARM(amplifier, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(amplifier, bool, NULL, 0);
MODULE_PARM_DESC(amplifier, "Set to 1 if the machine needs the amp control enabling (many laptops)");
MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
diff --git a/sound/oss/forte.c b/sound/oss/forte.c
index 9f15f305fcf8f..8406bc90c4ff7 100644
--- a/sound/oss/forte.c
+++ b/sound/oss/forte.c
@@ -238,7 +238,7 @@ forte_ac97_wait (struct forte_chip *chip)
* @reg: register to read
*/
-u16
+static u16
forte_ac97_read (struct ac97_codec *codec, u8 reg)
{
u16 ret = 0;
@@ -283,7 +283,7 @@ forte_ac97_read (struct ac97_codec *codec, u8 reg)
* @val: value to write
*/
-void
+static void
forte_ac97_write (struct ac97_codec *codec, u8 reg, u16 val)
{
struct forte_chip *chip = codec->private_data;
diff --git a/sound/oss/gus_card.c b/sound/oss/gus_card.c
index e0111a7b6b4c9..dbb29771e2bb6 100644
--- a/sound/oss/gus_card.c
+++ b/sound/oss/gus_card.c
@@ -218,17 +218,17 @@ static int __initdata dma = -1;
static int __initdata dma16 = -1; /* Set this for modules that need it */
static int __initdata type = 0; /* 1 for PnP */
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(dma, "i");
-MODULE_PARM(dma16, "i");
-MODULE_PARM(type, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma16, int, 0);
+module_param(type, int, 0);
#ifdef CONFIG_SOUND_GUSMAX
-MODULE_PARM(no_wave_dma, "i");
+module_param(no_wave_dma, int, 0);
#endif
#ifdef CONFIG_SOUND_GUS16
-MODULE_PARM(db16, "i");
-MODULE_PARM(gus16, "i");
+module_param(db16, int, 0);
+module_param(gus16, int, 0);
#endif
MODULE_LICENSE("GPL");
diff --git a/sound/oss/gus_wave.c b/sound/oss/gus_wave.c
index 2cc924d7b7f81..dfa1cb5871db0 100644
--- a/sound/oss/gus_wave.c
+++ b/sound/oss/gus_wave.c
@@ -94,7 +94,7 @@ static int recording_active;
static int only_read_access;
static int only_8_bits;
-int iw_mode = 0;
+static int iw_mode = 0;
int gus_wave_volume = 60;
int gus_pcm_volume = 80;
int have_gus_max = 0;
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index 295e4e9feac9e..a588ed529cc0a 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -111,6 +111,7 @@ static int ftsodell;
static int strict_clocking;
static unsigned int clocking;
static int spdif_locked;
+static int ac97_quirk = AC97_TUNE_DEFAULT;
//#define DEBUG
//#define DEBUG2
@@ -481,6 +482,124 @@ struct i810_card {
#define CIV_TO_LVI(card, port, off) \
I810_IOWRITEB(MODULOP2(GET_CIV((card), (port)) + (off), SG_LEN), (card), (port) + OFF_LVI)
+static struct ac97_quirk ac97_quirks[] __devinitdata = {
+ {
+ .vendor = 0x0e11,
+ .device = 0x00b8,
+ .name = "Compaq Evo D510C",
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1028,
+ .device = 0x00d8,
+ .name = "Dell Precision 530", /* AD1885 */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1028,
+ .device = 0x0126,
+ .name = "Dell Optiplex GX260", /* AD1981A */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1028,
+ .device = 0x012d,
+ .name = "Dell Precision 450", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ { /* FIXME: which codec? */
+ .vendor = 0x103c,
+ .device = 0x00c3,
+ .name = "Hewlett-Packard onboard",
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x103c,
+ .device = 0x12f1,
+ .name = "HP xw8200", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x103c,
+ .device = 0x3008,
+ .name = "HP xw4200", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x10f1,
+ .device = 0x2665,
+ .name = "Fujitsu-Siemens Celsius", /* AD1981? */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x10f1,
+ .device = 0x2885,
+ .name = "AMD64 Mobo", /* ALC650 */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x110a,
+ .device = 0x0056,
+ .name = "Fujitsu-Siemens Scenic", /* AD1981? */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x11d4,
+ .device = 0x5375,
+ .name = "ADI AD1985 (discrete)",
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1462,
+ .device = 0x5470,
+ .name = "MSI P4 ATX 645 Ultra",
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1734,
+ .device = 0x0088,
+ .name = "Fujitsu-Siemens D1522", /* AD1981 */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x8086,
+ .device = 0x4856,
+ .name = "Intel D845WN (82801BA)",
+ .type = AC97_TUNE_SWAP_HP
+ },
+ {
+ .vendor = 0x8086,
+ .device = 0x4d44,
+ .name = "Intel D850EMV2", /* AD1885 */
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x8086,
+ .device = 0x4d56,
+ .name = "Intel ICH/AD1885",
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x1028,
+ .device = 0x012d,
+ .name = "Dell Precision 450", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x103c,
+ .device = 0x3008,
+ .name = "HP xw4200", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ {
+ .vendor = 0x103c,
+ .device = 0x12f1,
+ .name = "HP xw8200", /* AD1981B*/
+ .type = AC97_TUNE_HP_ONLY
+ },
+ { } /* terminator */
+};
+
static struct i810_card *devs = NULL;
static int i810_open_mixdev(struct inode *inode, struct file *file);
@@ -3043,6 +3162,9 @@ static int __devinit i810_ac97_init(struct i810_card *card)
card->ac97_codec[num_ac97] = codec;
}
+ /* tune up the primary codec */
+ ac97_tune_hardware(card->pci_dev, ac97_quirks, ac97_quirk);
+
/* pick the minimum of channels supported by ICHx or codec(s) */
card->channels = (card->channels > total_channels)?total_channels:card->channels;
diff --git a/sound/oss/mad16.c b/sound/oss/mad16.c
index 4c5db81ed3c14..40f6b1e27407c 100644
--- a/sound/oss/mad16.c
+++ b/sound/oss/mad16.c
@@ -874,19 +874,19 @@ static int __initdata cddma = -1;
static int __initdata opl4 = 0;
static int __initdata joystick = 0;
-MODULE_PARM(mpu_io, "i");
-MODULE_PARM(mpu_irq, "i");
-MODULE_PARM(io,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma16,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(cdtype,"i");
-MODULE_PARM(cdirq,"i");
-MODULE_PARM(cdport,"i");
-MODULE_PARM(cddma,"i");
-MODULE_PARM(opl4,"i");
-MODULE_PARM(joystick,"i");
-MODULE_PARM(debug,"i");
+module_param(mpu_io, int, 0);
+module_param(mpu_irq, int, 0);
+module_param(io, int, 0);
+module_param(dma, int, 0);
+module_param(dma16, int, 0);
+module_param(irq, int, 0);
+module_param(cdtype, int, 0);
+module_param(cdirq, int, 0);
+module_param(cdport, int, 0);
+module_param(cddma, int, 0);
+module_param(opl4, int, 0);
+module_param(joystick, bool, 0);
+module_param(debug, bool, 0644);
static int __initdata dma_map[2][8] =
{
diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c
index 84fe23d8270cc..52d2db4bc312f 100644
--- a/sound/oss/maestro.c
+++ b/sound/oss/maestro.c
@@ -262,11 +262,11 @@ MODULE_DESCRIPTION("ESS Maestro Driver");
MODULE_LICENSE("GPL");
#ifdef M_DEBUG
-MODULE_PARM(debug,"i");
+module_param(debug, bool, 0644);
#endif
-MODULE_PARM(dsps_order,"i");
-MODULE_PARM(use_pm,"i");
-MODULE_PARM(clocking, "i");
+module_param(dsps_order, int, 0);
+module_param(use_pm, int, 0);
+module_param(clocking, int, 0);
/* --------------------------------------------------------------------- */
#define DRIVER_VERSION "0.15"
@@ -344,7 +344,7 @@ enum {
/* these masks indicate which units we care about at
which states */
-u16 acpi_state_mask[] = {
+static u16 acpi_state_mask[] = {
[ACPI_D0] = ACPI_ALL,
[ACPI_D1] = ACPI_SLEEP,
[ACPI_D2] = ACPI_SLEEP,
@@ -610,7 +610,7 @@ static u16 maestro_ac97_get(struct ess_card *card, u8 cmd)
be sure to fill it in if you add oss mixers
to anyone's supported mixer defines */
- unsigned int mixer_defaults[SOUND_MIXER_NRDEVICES] = {
+static unsigned int mixer_defaults[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_VOLUME] = 0x3232,
[SOUND_MIXER_BASS] = 0x3232,
[SOUND_MIXER_TREBLE] = 0x3232,
@@ -3363,7 +3363,7 @@ maestro_config(struct ess_card *card)
/* this guy tries to find the pci power management
* register bank. this should really be in core
* code somewhere. 1 on success. */
-int
+static int
parse_power(struct ess_card *card, struct pci_dev *pcidev)
{
u32 n;
@@ -3629,7 +3629,7 @@ static struct pci_driver maestro_pci_driver = {
.remove = maestro_remove,
};
-int __init init_maestro(void)
+static int __init init_maestro(void)
{
int rc;
@@ -3666,7 +3666,7 @@ static int maestro_notifier(struct notifier_block *nb, unsigned long event, void
/* --------------------------------------------------------------------- */
-void cleanup_maestro(void) {
+static void cleanup_maestro(void) {
M_printk("maestro: unloading\n");
pci_unregister_driver(&maestro_pci_driver);
pm_unregister_all(maestro_pm_callback);
diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c
index d2573bb0b4d1f..17d4f0792d382 100644
--- a/sound/oss/maestro3.c
+++ b/sound/oss/maestro3.c
@@ -378,7 +378,7 @@ static int m3_notifier(struct notifier_block *nb, unsigned long event, void *buf
static int m3_suspend(struct pci_dev *pci_dev, u32 state);
static void check_suspend(struct m3_card *card);
-struct notifier_block m3_reboot_nb = {
+static struct notifier_block m3_reboot_nb = {
.notifier_call = m3_notifier,
};
@@ -1024,8 +1024,8 @@ static void set_dmac(struct m3_state *s, unsigned int addr, unsigned int count)
DPRINTK(DPINT,"set_dmac??\n");
}
-u32 get_dma_pos(struct m3_card *card,
- int instance_addr)
+static u32 get_dma_pos(struct m3_card *card,
+ int instance_addr)
{
u16 hi = 0, lo = 0;
int retry = 10;
@@ -1047,7 +1047,7 @@ u32 get_dma_pos(struct m3_card *card,
return lo | (hi<<16);
}
-u32 get_dmaa(struct m3_state *s)
+static u32 get_dmaa(struct m3_state *s)
{
u32 offset;
@@ -1059,7 +1059,7 @@ u32 get_dmaa(struct m3_state *s)
return offset;
}
-u32 get_dmac(struct m3_state *s)
+static u32 get_dmac(struct m3_state *s)
{
u32 offset;
@@ -2102,7 +2102,7 @@ static int m3_ac97_wait(struct m3_card *card)
return i == 0;
}
-u16 m3_ac97_read(struct ac97_codec *codec, u8 reg)
+static u16 m3_ac97_read(struct ac97_codec *codec, u8 reg)
{
u16 ret = 0;
struct m3_card *card = codec->private_data;
@@ -2129,7 +2129,7 @@ out:
return ret;
}
-void m3_ac97_write(struct ac97_codec *codec, u8 reg, u16 val)
+static void m3_ac97_write(struct ac97_codec *codec, u8 reg, u16 val)
{
struct m3_card *card = codec->private_data;
@@ -2187,7 +2187,7 @@ static struct file_operations m3_mixer_fops = {
.release = m3_release_mixdev,
};
-void remote_codec_config(int io, int isremote)
+static void remote_codec_config(int io, int isremote)
{
isremote = isremote ? 1 : 0;
@@ -2571,7 +2571,7 @@ static struct file_operations m3_audio_fops = {
};
#ifdef CONFIG_PM
-int alloc_dsp_suspendmem(struct m3_card *card)
+static int alloc_dsp_suspendmem(struct m3_card *card)
{
int len = sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH);
@@ -2580,7 +2580,7 @@ int alloc_dsp_suspendmem(struct m3_card *card)
return 0;
}
-void free_dsp_suspendmem(struct m3_card *card)
+static void free_dsp_suspendmem(struct m3_card *card)
{
if(card->suspend_mem)
vfree(card->suspend_mem);
@@ -2919,10 +2919,10 @@ MODULE_DESCRIPTION("ESS Maestro3/Allegro Driver");
MODULE_LICENSE("GPL");
#ifdef M_DEBUG
-MODULE_PARM(debug,"i");
+module_param(debug, int, 0);
#endif
-MODULE_PARM(external_amp,"i");
-MODULE_PARM(gpio_pin, "i");
+module_param(external_amp, int, 0);
+module_param(gpio_pin, int, 0);
static struct pci_driver m3_pci_driver = {
.name = "ess_m3_audio",
diff --git a/sound/oss/maestro3.h b/sound/oss/maestro3.h
index ebfe5c5cc99a2..dde29862c5720 100644
--- a/sound/oss/maestro3.h
+++ b/sound/oss/maestro3.h
@@ -695,7 +695,7 @@
* DSP Code images
*/
-u16 assp_kernel_image[] = {
+static u16 assp_kernel_image[] = {
0x7980, 0x0030, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x00FB, 0x7980, 0x00DD, 0x7980, 0x03B4,
0x7980, 0x0332, 0x7980, 0x0287, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4,
0x7980, 0x031A, 0x7980, 0x03B4, 0x7980, 0x022F, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4,
@@ -782,7 +782,7 @@ u16 assp_kernel_image[] = {
* Mini sample rate converter code image
* that is to be loaded at 0x400 on the DSP.
*/
-u16 assp_minisrc_image[] = {
+static u16 assp_minisrc_image[] = {
0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0412,
0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0403, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
diff --git a/sound/oss/maui.c b/sound/oss/maui.c
index 0c0d53e877d90..05cf194eda6b1 100644
--- a/sound/oss/maui.c
+++ b/sound/oss/maui.c
@@ -420,8 +420,8 @@ static struct address_info cfg;
static int __initdata io = -1;
static int __initdata irq = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
/*
* Install a Maui card. Needs mpu401 loaded already.
diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c
index 73c3ce32a69de..b66f53fa8db03 100644
--- a/sound/oss/mpu401.c
+++ b/sound/oss/mpu401.c
@@ -1770,8 +1770,8 @@ static struct address_info cfg;
static int io = -1;
static int irq = -1;
-MODULE_PARM(irq, "i");
-MODULE_PARM(io, "i");
+module_param(irq, int, 0);
+module_param(io, int, 0);
static int __init init_mpu401(void)
{
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index 9f18b40374267..6ba03f89fc436 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1603,24 +1603,6 @@ MODULE_AUTHOR ("Andrew Veliath <andrewtv@usa.net>");
MODULE_DESCRIPTION ("Turtle Beach " LONGNAME " Linux Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM (io, "i");
-MODULE_PARM (irq, "i");
-MODULE_PARM (mem, "i");
-MODULE_PARM (write_ndelay, "i");
-MODULE_PARM (fifosize, "i");
-MODULE_PARM (calibrate_signal, "i");
-#ifndef MSND_CLASSIC
-MODULE_PARM (digital, "i");
-MODULE_PARM (cfg, "i");
-MODULE_PARM (reset, "i");
-MODULE_PARM (mpu_io, "i");
-MODULE_PARM (mpu_irq, "i");
-MODULE_PARM (ide_io0, "i");
-MODULE_PARM (ide_io1, "i");
-MODULE_PARM (ide_irq, "i");
-MODULE_PARM (joystick_io, "i");
-#endif
-
static int io __initdata = -1;
static int irq __initdata = -1;
static int mem __initdata = -1;
@@ -1726,6 +1708,23 @@ static int
calibrate_signal __initdata = CONFIG_MSND_CALSIGNAL;
#endif /* MODULE */
+module_param (io, int, 0);
+module_param (irq, int, 0);
+module_param (mem, int, 0);
+module_param (write_ndelay, int, 0);
+module_param (fifosize, int, 0);
+module_param (calibrate_signal, int, 0);
+#ifndef MSND_CLASSIC
+module_param (digital, bool, 0);
+module_param (cfg, int, 0);
+module_param (reset, int, 0);
+module_param (mpu_io, int, 0);
+module_param (mpu_irq, int, 0);
+module_param (ide_io0, int, 0);
+module_param (ide_io1, int, 0);
+module_param (ide_irq, int, 0);
+module_param (joystick_io, int, 0);
+#endif
static int __init msnd_init(void)
{
diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c
index 228ce6a00bc82..b70e3a137315c 100644
--- a/sound/oss/nm256_audio.c
+++ b/sound/oss/nm256_audio.c
@@ -157,7 +157,7 @@ static int samplerates[9] = {
* attempted.
*/
-int
+static int
nm256_setInfo (int dev, struct nm256_info *card)
{
int x;
@@ -1673,17 +1673,17 @@ MODULE_DEVICE_TABLE(pci, nm256_pci_tbl);
MODULE_LICENSE("GPL");
-struct pci_driver nm256_pci_driver = {
+static struct pci_driver nm256_pci_driver = {
.name = "nm256_audio",
.id_table = nm256_pci_tbl,
.probe = nm256_probe,
.remove = nm256_remove,
};
-MODULE_PARM (usecache, "i");
-MODULE_PARM (buffertop, "i");
-MODULE_PARM (nm256_debug, "i");
-MODULE_PARM (force_load, "i");
+module_param(usecache, bool, 0);
+module_param(buffertop, int, 0);
+module_param(nm256_debug, bool, 0644);
+module_param(force_load, bool, 0);
static int __init do_init_nm256(void)
{
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c
index 9789c5ab29cd1..a31734b7842fc 100644
--- a/sound/oss/opl3.c
+++ b/sound/oss/opl3.c
@@ -1202,7 +1202,7 @@ static int me;
static int io = -1;
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
static int __init init_opl3 (void)
{
diff --git a/sound/oss/opl3sa.c b/sound/oss/opl3sa.c
index 99f4ed66fd9f6..b830aa6afdda2 100644
--- a/sound/oss/opl3sa.c
+++ b/sound/oss/opl3sa.c
@@ -245,12 +245,12 @@ static int __initdata dma2 = -1;
static int __initdata mpu_io = -1;
static int __initdata mpu_irq = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma2,"i");
-MODULE_PARM(mpu_io,"i");
-MODULE_PARM(mpu_irq,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma2, int, 0);
+module_param(mpu_io, int, 0);
+module_param(mpu_irq, int, 0);
static int __init init_opl3sa(void)
{
diff --git a/sound/oss/opl3sa2.c b/sound/oss/opl3sa2.c
index 7d7a981734fc2..cfeaebd4883ff 100644
--- a/sound/oss/opl3sa2.c
+++ b/sound/oss/opl3sa2.c
@@ -177,9 +177,6 @@ static int __initdata loopback = -1;
static int __initdata isapnp = 1;
static int __initdata multiple = 1;
-/* PnP devices */
-struct pnp_dev* opl3sa2_dev[OPL3SA2_CARDS_MAX];
-
/* Whether said devices have been activated */
static int opl3sa2_activated[OPL3SA2_CARDS_MAX];
#else
@@ -192,35 +189,35 @@ MODULE_AUTHOR("Scott Murray <scott@spiteful.org>");
MODULE_LICENSE("GPL");
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
MODULE_PARM_DESC(io, "Set I/O base of OPL3-SA2 or SA3 card (usually 0x370. Address must be even and must be from 0x100 to 0xFFE)");
-MODULE_PARM(mss_io, "i");
+module_param(mss_io, int, 0);
MODULE_PARM_DESC(mss_io, "Set MSS (audio) I/O base (0x530, 0xE80, or other. Address must end in 0 or 4 and must be from 0x530 to 0xF48)");
-MODULE_PARM(mpu_io, "i");
+module_param(mpu_io, int, 0);
MODULE_PARM_DESC(mpu_io, "Set MIDI I/O base (0x330 or other. Address must be even and must be from 0x300 to 0x334)");
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0);
MODULE_PARM_DESC(mss_irq, "Set MSS (audio) IRQ (5, 7, 9, 10, 11, 12)");
-MODULE_PARM(dma, "i");
+module_param(dma, int, 0);
MODULE_PARM_DESC(dma, "Set MSS (audio) first DMA channel (0, 1, 3)");
-MODULE_PARM(dma2, "i");
+module_param(dma2, int, 0);
MODULE_PARM_DESC(dma2, "Set MSS (audio) second DMA channel (0, 1, 3)");
-MODULE_PARM(ymode, "i");
+module_param(ymode, int, 0);
MODULE_PARM_DESC(ymode, "Set Yamaha 3D enhancement mode (0 = Desktop/Normal, 1 = Notebook PC (1), 2 = Notebook PC (2), 3 = Hi-Fi)");
-MODULE_PARM(loopback, "i");
+module_param(loopback, int, 0);
MODULE_PARM_DESC(loopback, "Set A/D input source. Useful for echo cancellation (0 = Mic Rch (default), 1 = Mono output loopback)");
#ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "i");
+module_param(isapnp, bool, 0);
MODULE_PARM_DESC(isapnp, "When set to 0, ISA PnP support will be disabled");
-MODULE_PARM(multiple, "i");
+module_param(multiple, bool, 0);
MODULE_PARM_DESC(multiple, "When set to 0, will not search for multiple cards");
#endif
@@ -775,7 +772,7 @@ static void __exit unload_opl3sa2(struct address_info* hw_config, int card)
}
#ifdef CONFIG_PNP
-struct pnp_device_id pnp_opl3sa2_list[] = {
+static struct pnp_device_id pnp_opl3sa2_list[] = {
{.id = "YMH0021", .driver_data = 0},
{.id = ""}
};
diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c
index 4aa0bc66569ce..cb235fcd4805d 100644
--- a/sound/oss/pas2_card.c
+++ b/sound/oss/pas2_card.c
@@ -240,8 +240,6 @@ static int __init config_pas_hw(struct address_info *hw_config)
mix_write(0x80 | 5, 0x078B);
mix_write(5, 0x078B);
-#if !defined(DISABLE_SB_EMULATION)
-
{
struct address_info *sb_config;
@@ -279,9 +277,6 @@ static int __init config_pas_hw(struct address_info *hw_config)
else
pas_write(0x00, 0xF788);
}
-#else
- pas_write(0x00, 0xF788);
-#endif
if (!ok)
printk(KERN_WARNING "PAS16: Driver not enabled\n");
@@ -349,11 +344,6 @@ static void __init attach_pas_card(struct address_info *hw_config)
if (config_pas_hw(hw_config))
{
pas_pcm_init(hw_config);
-
-#if !defined(MODULE) && !defined(DISABLE_SB_EMULATION)
- sb_dsp_disable_midi(pas_sb_base); /* No MIDI capability */
-#endif
-
pas_midi_init();
pas_init_mixer();
}
@@ -393,19 +383,19 @@ static int __initdata sb_irq = -1;
static int __initdata sb_dma = -1;
static int __initdata sb_dma16 = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma16,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma16, int, 0);
-MODULE_PARM(sb_io,"i");
-MODULE_PARM(sb_irq,"i");
-MODULE_PARM(sb_dma,"i");
-MODULE_PARM(sb_dma16,"i");
+module_param(sb_io, int, 0);
+module_param(sb_irq, int, 0);
+module_param(sb_dma, int, 0);
+module_param(sb_dma16, int, 0);
-MODULE_PARM(joystick,"i");
-MODULE_PARM(symphony,"i");
-MODULE_PARM(broken_bus_clock,"i");
+module_param(joystick, bool, 0);
+module_param(symphony, bool, 0);
+module_param(broken_bus_clock, bool, 0);
MODULE_LICENSE("GPL");
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index af3f96ad02ca8..55a8c8cfc39f9 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -118,9 +118,9 @@
/* If compiled into kernel, it enable or disable pss mixer */
#ifdef CONFIG_PSS_MIXER
-static unsigned char pss_mixer = 1;
+static int pss_mixer = 1;
#else
-static unsigned char pss_mixer;
+static int pss_mixer;
#endif
@@ -649,7 +649,7 @@ static struct mixer_operations pss_mixer_operations =
.ioctl = pss_mixer_ioctl
};
-void disable_all_emulations(void)
+static void disable_all_emulations(void)
{
outw(0x0000, REG(CONF_PSS)); /* 0x0400 enables joystick */
outw(0x0000, REG(CONF_WSS));
@@ -658,7 +658,7 @@ void disable_all_emulations(void)
outw(0x0000, REG(CONF_CDROM));
}
-void configure_nonsound_components(void)
+static void configure_nonsound_components(void)
{
/* Configure Joystick port */
@@ -1153,29 +1153,29 @@ static int pss_no_sound __initdata = 0; /* Just configure non-sound components *
static int pss_keep_settings = 1; /* Keep hardware settings at module exit */
static char *pss_firmware = "/etc/sound/pss_synth";
-MODULE_PARM(pss_io, "i");
+module_param(pss_io, int, 0);
MODULE_PARM_DESC(pss_io, "Set i/o base of PSS card (probably 0x220 or 0x240)");
-MODULE_PARM(mss_io, "i");
+module_param(mss_io, int, 0);
MODULE_PARM_DESC(mss_io, "Set WSS (audio) i/o base (0x530, 0x604, 0xE80, 0xF40, or other. Address must end in 0 or 4 and must be from 0x100 to 0xFF4)");
-MODULE_PARM(mss_irq, "i");
+module_param(mss_irq, int, 0);
MODULE_PARM_DESC(mss_irq, "Set WSS (audio) IRQ (3, 5, 7, 9, 10, 11, 12)");
-MODULE_PARM(mss_dma, "i");
+module_param(mss_dma, int, 0);
MODULE_PARM_DESC(mss_dma, "Set WSS (audio) DMA (0, 1, 3)");
-MODULE_PARM(mpu_io, "i");
+module_param(mpu_io, int, 0);
MODULE_PARM_DESC(mpu_io, "Set MIDI i/o base (0x330 or other. Address must be on 4 location boundaries and must be from 0x100 to 0xFFC)");
-MODULE_PARM(mpu_irq, "i");
+module_param(mpu_irq, int, 0);
MODULE_PARM_DESC(mpu_irq, "Set MIDI IRQ (3, 5, 7, 9, 10, 11, 12)");
-MODULE_PARM(pss_cdrom_port, "i");
+module_param(pss_cdrom_port, int, 0);
MODULE_PARM_DESC(pss_cdrom_port, "Set the PSS CDROM port i/o base (0x340 or other)");
-MODULE_PARM(pss_enable_joystick, "i");
+module_param(pss_enable_joystick, bool, 0);
MODULE_PARM_DESC(pss_enable_joystick, "Enables the PSS joystick port (1 to enable, 0 to disable)");
-MODULE_PARM(pss_no_sound, "i");
+module_param(pss_no_sound, bool, 0);
MODULE_PARM_DESC(pss_no_sound, "Configure sound compoents (0 - no, 1 - yes)");
-MODULE_PARM(pss_keep_settings, "i");
+module_param(pss_keep_settings, bool, 0);
MODULE_PARM_DESC(pss_keep_settings, "Keep hardware setting at driver unloading (0 - no, 1 - yes)");
-MODULE_PARM(pss_firmware, "s");
+module_param(pss_firmware, charp, 0);
MODULE_PARM_DESC(pss_firmware, "Location of the firmware file (default - /etc/sound/pss_synth)");
-MODULE_PARM(pss_mixer, "b");
+module_param(pss_mixer, bool, 0);
MODULE_PARM_DESC(pss_mixer, "Enable (1) or disable (0) PSS mixer (controlling of output volume, bass, treble, synth volume). The mixer is not available on all PSS cards.");
MODULE_AUTHOR("Hannu Savolainen, Vladimir Michl");
MODULE_DESCRIPTION("Module for PSS sound cards (based on AD1848, ADSP-2115 and ESC614). This module includes control of output amplifier and synth volume of the Beethoven ADSP-16 card (this may work with other PSS cards).");
diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
index 96cc75acffffa..76774bbc14368 100644
--- a/sound/oss/rme96xx.c
+++ b/sound/oss/rme96xx.c
@@ -68,7 +68,7 @@ TODO:
#define NR_DEVICE 2
static int devices = 1;
-MODULE_PARM(devices, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param(devices, int, 0);
MODULE_PARM_DESC(devices, "number of dsp devices allocated by the driver");
@@ -339,7 +339,7 @@ typedef struct _rme96xx_info {
/* fiddling with the card (first level hardware control) */
-inline void rme96xx_set_ctrl(rme96xx_info* s,int mask)
+static inline void rme96xx_set_ctrl(rme96xx_info* s,int mask)
{
s->control_register|=mask;
@@ -347,7 +347,7 @@ inline void rme96xx_set_ctrl(rme96xx_info* s,int mask)
}
-inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask)
+static inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask)
{
s->control_register&=(~mask);
@@ -355,7 +355,7 @@ inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask)
}
-inline int rme96xx_get_sample_rate_status(rme96xx_info* s)
+static inline int rme96xx_get_sample_rate_status(rme96xx_info* s)
{
int val;
u32 status;
@@ -366,7 +366,7 @@ inline int rme96xx_get_sample_rate_status(rme96xx_info* s)
return val;
}
-inline int rme96xx_get_sample_rate_ctrl(rme96xx_info* s)
+static inline int rme96xx_get_sample_rate_ctrl(rme96xx_info* s)
{
int val;
val = (s->control_register & RME96xx_freq) ? 48000 : 44100;
@@ -539,7 +539,7 @@ static inline int rme96xx_spdif_sample_rate (rme96xx_info *s, int *spdifrate)
/* the function returns the hardware pointer in bytes */
#define RME96xx_BURSTBYTES -64 /* bytes by which hwptr could be off */
-inline int rme96xx_gethwptr(rme96xx_info* s,int exact)
+static inline int rme96xx_gethwptr(rme96xx_info* s,int exact)
{
unsigned long flags;
if (exact) {
@@ -557,7 +557,7 @@ inline int rme96xx_gethwptr(rme96xx_info* s,int exact)
return (s->hwbufid ? s->fragsize : 0);
}
-inline void rme96xx_setlatency(rme96xx_info* s,int l)
+static inline void rme96xx_setlatency(rme96xx_info* s,int l)
{
s->latency = l;
s->fragsize = 1<<(8+l);
@@ -626,7 +626,7 @@ static int rme96xx_startcard(rme96xx_info *s,int stop)
}
-inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp)
+static inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp)
{
int cnt;
int swptr;
@@ -643,7 +643,7 @@ inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp)
return cnt;
}
-inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp)
+static inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp)
{
int cnt;
int swptr;
@@ -661,7 +661,7 @@ inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp)
}
-inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop)
+static inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop)
{
int swptr = dma->writeptr;
switch (dma->format) {
@@ -710,7 +710,7 @@ inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,in
}
/* The count argument is the number of bytes */
-inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop)
+static inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop)
{
int swptr = dma->readptr;
switch (dma->format) {
@@ -793,7 +793,7 @@ static irqreturn_t rme96xx_interrupt(int irq, void *dev_id, struct pt_regs *regs
PCI detection and module initialization stuff
----------------------------------------------------------------------------*/
-void* busmaster_malloc(int size) {
+static void* busmaster_malloc(int size) {
int pg; /* 2 s exponent of memory size */
char *buf;
@@ -819,7 +819,7 @@ void* busmaster_malloc(int size) {
return NULL;
}
-void busmaster_free(void* ptr,int size) {
+static void busmaster_free(void* ptr,int size) {
int pg;
struct page* page, *last_page;
@@ -866,7 +866,7 @@ static int rme96xx_dmabuf_init(rme96xx_info * s,struct dmabuf* dma,int ioffset,i
}
-int rme96xx_init(rme96xx_info* s)
+static int rme96xx_init(rme96xx_info* s)
{
int i;
int status;
diff --git a/sound/oss/sb.h b/sound/oss/sb.h
index 54c86c94fdad3..77e8891ce3337 100644
--- a/sound/oss/sb.h
+++ b/sound/oss/sb.h
@@ -176,11 +176,8 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right);
int sb_audio_open(int dev, int mode);
void sb_audio_close(int dev);
-extern sb_devc *last_sb;
-
/* From sb_common.c */
void sb_dsp_disable_midi(int port);
-void sb_dsp_disable_recording(int port);
int probe_sbmpu (struct address_info *hw_config, struct module *owner);
void unload_sbmpu (struct address_info *hw_config);
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index 07191b3ae706f..de3fd492d0b0b 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -52,7 +52,7 @@ static int __initdata esstype = 0; /* ESS chip type */
static int __initdata acer = 0; /* Do acer notebook init? */
static int __initdata sm_games = 0; /* Logitech soundman games? */
-struct sb_card_config *legacy = NULL;
+static struct sb_card_config *legacy = NULL;
#ifdef CONFIG_PNP
static int __initdata pnp = 1;
diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c
index e33a50e822299..092492d131bf9 100644
--- a/sound/oss/sb_common.c
+++ b/sound/oss/sb_common.c
@@ -81,7 +81,7 @@ static int smw_ucodeLen;
#endif
-sb_devc *last_sb; /* Last sb loaded */
+static sb_devc *last_sb; /* Last sb loaded */
int sb_dsp_command(sb_devc * devc, unsigned char val)
{
@@ -521,7 +521,7 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
DDB(printk("sb_dsp_detect(%x) entered\n", hw_config->io_base));
- devc->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&devc->lock);
devc->type = hw_config->card_subtype;
devc->base = hw_config->io_base;
@@ -876,14 +876,6 @@ int sb_dsp_init(struct address_info *hw_config, struct module *owner)
return 1;
}
-void sb_dsp_disable_midi(int io_base)
-{
-}
-
-void sb_dsp_disable_recording(int io_base)
-{
-}
-
/* if (sbmpu) below we allow mpu401 to manage the midi devs
otherwise we have to unload them. (Andrzej Krzysztofowicz) */
@@ -1292,7 +1284,6 @@ void unload_sbmpu(struct address_info *hw_config)
EXPORT_SYMBOL(sb_dsp_init);
EXPORT_SYMBOL(sb_dsp_detect);
EXPORT_SYMBOL(sb_dsp_unload);
-EXPORT_SYMBOL(sb_dsp_disable_midi);
EXPORT_SYMBOL(sb_be_quiet);
EXPORT_SYMBOL(probe_sbmpu);
EXPORT_SYMBOL(unload_sbmpu);
diff --git a/sound/oss/sb_ess.c b/sound/oss/sb_ess.c
index f02dbf0a731ba..fae05fe3de430 100644
--- a/sound/oss/sb_ess.c
+++ b/sound/oss/sb_ess.c
@@ -1696,7 +1696,7 @@ void ess_mixer_reload (sb_devc *devc, int dev)
sb_common_mixer_set(devc, dev, left, right);
}
-int es_rec_set_recmask(sb_devc * devc, int mask)
+static int es_rec_set_recmask(sb_devc * devc, int mask)
{
int i, i_mask, cur_mask, diff_mask;
int value, left, right;
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 038bf7fd31eae..ceb8ca6ae12b6 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -1091,7 +1091,7 @@ int sequencer_open(int dev, struct file *file)
return 0;
}
-void seq_drain_midi_queues(void)
+static void seq_drain_midi_queues(void)
{
int i, n;
diff --git a/sound/oss/sgalaxy.c b/sound/oss/sgalaxy.c
index 16cc9ab505b53..3f32d4674371b 100644
--- a/sound/oss/sgalaxy.c
+++ b/sound/oss/sgalaxy.c
@@ -153,11 +153,11 @@ static int __initdata dma = -1;
static int __initdata dma2 = -1;
static int __initdata sgbase = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma2,"i");
-MODULE_PARM(sgbase,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma2, int, 0);
+module_param(sgbase, int, 0);
static int __init init_sgalaxy(void)
{
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 70c91ddd4d761..432bf4965b413 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -2453,7 +2453,7 @@ static int wavetable[NR_DEVICE];
static unsigned int devindex;
-MODULE_PARM(reverb, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(reverb, bool, NULL, 0);
MODULE_PARM_DESC(reverb, "if 1 enables the reverb circuitry. NOTE: your card must have the reverb RAM");
#if 0
MODULE_PARM(wavetable, "1-" __MODULE_STRING(NR_DEVICE) "i");
diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c
index 7c9b5d41bbb2d..08b52658012e7 100644
--- a/sound/oss/sscape.c
+++ b/sound/oss/sscape.c
@@ -1400,13 +1400,13 @@ static int __initdata io = -1;
static int __initdata mpu_irq = -1;
static int __initdata mpu_io = -1;
-MODULE_PARM(dma, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM(io, "i");
-MODULE_PARM(spea, "i"); /* spea=0/1 set the old_hardware */
-MODULE_PARM(mpu_irq, "i");
-MODULE_PARM(mpu_io, "i");
-MODULE_PARM(mss, "i");
+module_param(dma, int, 0);
+module_param(irq, int, 0);
+module_param(io, int, 0);
+module_param(spea, int, 0); /* spea=0/1 set the old_hardware */
+module_param(mpu_irq, int, 0);
+module_param(mpu_io, int, 0);
+module_param(mss, int, 0);
static int __init init_sscape(void)
{
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index 47b129f3abf12..8395501af2ae1 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -4014,7 +4014,8 @@ ali_free_other_states_resources(struct trident_state *state)
}
}
-struct proc_dir_entry *res;
+static struct proc_dir_entry *res;
+
static int
ali_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data)
{
diff --git a/sound/oss/trix.c b/sound/oss/trix.c
index 13c3d79396a5f..d1f1f154dcce5 100644
--- a/sound/oss/trix.c
+++ b/sound/oss/trix.c
@@ -413,16 +413,16 @@ static int __initdata sb_irq = -1;
static int __initdata mpu_io = -1;
static int __initdata mpu_irq = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
-MODULE_PARM(dma,"i");
-MODULE_PARM(dma2,"i");
-MODULE_PARM(sb_io,"i");
-MODULE_PARM(sb_dma,"i");
-MODULE_PARM(sb_irq,"i");
-MODULE_PARM(mpu_io,"i");
-MODULE_PARM(mpu_irq,"i");
-MODULE_PARM(joystick, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
+module_param(dma, int, 0);
+module_param(dma2, int, 0);
+module_param(sb_io, int, 0);
+module_param(sb_dma, int, 0);
+module_param(sb_irq, int, 0);
+module_param(mpu_io, int, 0);
+module_param(mpu_irq, int, 0);
+module_param(joystick, bool, 0);
static int __init init_trix(void)
{
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index 3c004ab762c47..f051ca0a69b21 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -316,8 +316,8 @@ static struct address_info cfg_mpu;
static int __initdata io = -1;
static int __initdata irq = -1;
-MODULE_PARM(io,"i");
-MODULE_PARM(irq,"i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
static int __init init_uart6850(void)
{
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 58da28a9c089d..b387e1e524859 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -62,11 +62,6 @@
}
#endif
-#if defined(CONFIG_PROC_FS) && \
- defined(CONFIG_SOUND_VIA82CXXX_PROCFS)
-#define VIA_PROC_FS 1
-#endif
-
#define VIA_SUPPORT_MMAP 1 /* buggy, for now... */
#define MAX_CARDS 1
@@ -366,18 +361,6 @@ static void via_chan_clear (struct via_info *card, struct via_channel *chan);
static void via_chan_pcm_fmt (struct via_channel *chan, int reset);
static void via_chan_buffer_free (struct via_info *card, struct via_channel *chan);
-#ifdef VIA_PROC_FS
-static int via_init_proc (void);
-static void via_cleanup_proc (void);
-static int via_card_init_proc (struct via_info *card);
-static void via_card_cleanup_proc (struct via_info *card);
-#else
-static inline int via_init_proc (void) { return 0; }
-static inline void via_cleanup_proc (void) {}
-static inline int via_card_init_proc (struct via_info *card) { return 0; }
-static inline void via_card_cleanup_proc (struct via_info *card) {}
-#endif
-
/****************************************************************
*
@@ -2179,7 +2162,7 @@ static int via_mm_swapout (struct page *page, struct file *filp)
#endif /* VM_RESERVED */
-struct vm_operations_struct via_mm_ops = {
+static struct vm_operations_struct via_mm_ops = {
.nopage = via_mm_nopage,
#ifndef VM_RESERVED
@@ -3484,21 +3467,12 @@ static int __devinit via_init_one (struct pci_dev *pdev, const struct pci_device
}
/*
- * per-card /proc info
- */
- rc = via_card_init_proc (card);
- if (rc) {
- printk (KERN_ERR PFX "card-specific /proc init failed, aborting\n");
- goto err_out_have_dsp;
- }
-
- /*
* init and turn on interrupts, as the last thing we do
*/
rc = via_interrupt_init (card);
if (rc) {
printk (KERN_ERR PFX "interrupt init failed, aborting\n");
- goto err_out_have_proc;
+ goto err_out_have_dsp;
}
printk (KERN_INFO PFX "board #%d at 0x%04lX, IRQ %d\n",
@@ -3538,9 +3512,6 @@ static int __devinit via_init_one (struct pci_dev *pdev, const struct pci_device
DPRINTK ("EXIT, returning 0\n");
return 0;
-err_out_have_proc:
- via_card_cleanup_proc (card);
-
err_out_have_dsp:
via_dsp_cleanup (card);
@@ -3582,7 +3553,6 @@ static void __devexit via_remove_one (struct pci_dev *pdev)
#endif
free_irq (card->pdev->irq, card);
- via_card_cleanup_proc (card);
via_dsp_cleanup (card);
via_ac97_cleanup (card);
@@ -3615,15 +3585,8 @@ static int __init init_via82cxxx_audio(void)
DPRINTK ("ENTER\n");
- rc = via_init_proc ();
- if (rc) {
- DPRINTK ("EXIT, returning %d\n", rc);
- return rc;
- }
-
rc = pci_register_driver (&via_driver);
if (rc) {
- via_cleanup_proc ();
DPRINTK ("EXIT, returning %d\n", rc);
return rc;
}
@@ -3638,7 +3601,6 @@ static void __exit cleanup_via82cxxx_audio(void)
DPRINTK ("ENTER\n");
pci_unregister_driver (&via_driver);
- via_cleanup_proc ();
DPRINTK ("EXIT\n");
}
@@ -3651,181 +3613,3 @@ MODULE_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("DSP audio and mixer driver for Via 82Cxxx audio devices");
MODULE_LICENSE("GPL");
-
-#ifdef VIA_PROC_FS
-
-/****************************************************************
- *
- * /proc/driver/via/info
- *
- *
- */
-
-static int via_info_read_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
-#define YN(val,bit) (((val) & (bit)) ? "yes" : "no")
-#define ED(val,bit) (((val) & (bit)) ? "enable" : "disable")
-
- int len = 0;
- u8 r40, r41, r42, r44;
- struct via_info *card = data;
-
- DPRINTK ("ENTER\n");
-
- assert (card != NULL);
-
- len += sprintf (page+len, VIA_CARD_NAME "\n\n");
-
- pci_read_config_byte (card->pdev, 0x40, &r40);
- pci_read_config_byte (card->pdev, 0x41, &r41);
- pci_read_config_byte (card->pdev, 0x42, &r42);
- pci_read_config_byte (card->pdev, 0x44, &r44);
-
- len += sprintf (page+len,
- "Via 82Cxxx PCI registers:\n"
- "\n"
- "40 Codec Ready: %s\n"
- " Codec Low-power: %s\n"
- " Secondary Codec Ready: %s\n"
- "\n"
- "41 Interface Enable: %s\n"
- " De-Assert Reset: %s\n"
- " Force SYNC high: %s\n"
- " Force SDO high: %s\n"
- " Variable Sample Rate On-Demand Mode: %s\n"
- " SGD Read Channel PCM Data Out: %s\n"
- " FM Channel PCM Data Out: %s\n"
- " SB PCM Data Out: %s\n"
- "\n"
- "42 Game port enabled: %s\n"
- " SoundBlaster enabled: %s\n"
- " FM enabled: %s\n"
- " MIDI enabled: %s\n"
- "\n"
- "44 AC-Link Interface Access: %s\n"
- " Secondary Codec Support: %s\n"
-
- "\n",
-
- YN (r40, VIA_CR40_AC97_READY),
- YN (r40, VIA_CR40_AC97_LOW_POWER),
- YN (r40, VIA_CR40_SECONDARY_READY),
-
- ED (r41, VIA_CR41_AC97_ENABLE),
- YN (r41, (1 << 6)),
- YN (r41, (1 << 5)),
- YN (r41, (1 << 4)),
- ED (r41, (1 << 3)),
- ED (r41, (1 << 2)),
- ED (r41, (1 << 1)),
- ED (r41, (1 << 0)),
-
- YN (r42, VIA_CR42_GAME_ENABLE),
- YN (r42, VIA_CR42_SB_ENABLE),
- YN (r42, VIA_CR42_FM_ENABLE),
- YN (r42, VIA_CR42_MIDI_ENABLE),
-
- YN (r44, VIA_CR44_AC_LINK_ACCESS),
- YN (r44, VIA_CR44_SECOND_CODEC_SUPPORT)
-
- );
-
- DPRINTK ("EXIT, returning %d\n", len);
- return len;
-
-#undef YN
-#undef ED
-}
-
-
-/****************************************************************
- *
- * /proc/driver/via/... setup and cleanup
- *
- *
- */
-
-static int __init via_init_proc (void)
-{
- DPRINTK ("ENTER\n");
-
- if (!proc_mkdir ("driver/via", 0))
- return -EIO;
-
- DPRINTK ("EXIT, returning 0\n");
- return 0;
-}
-
-
-static void via_cleanup_proc (void)
-{
- DPRINTK ("ENTER\n");
-
- remove_proc_entry ("driver/via", NULL);
-
- DPRINTK ("EXIT\n");
-}
-
-
-static int __devinit via_card_init_proc (struct via_info *card)
-{
- char s[32];
- int rc;
-
- DPRINTK ("ENTER\n");
-
- sprintf (s, "driver/via/%d", card->card_num);
- if (!proc_mkdir (s, 0)) {
- rc = -EIO;
- goto err_out_none;
- }
-
- sprintf (s, "driver/via/%d/info", card->card_num);
- if (!create_proc_read_entry (s, 0, 0, via_info_read_proc, card)) {
- rc = -EIO;
- goto err_out_dir;
- }
-
- sprintf (s, "driver/via/%d/ac97", card->card_num);
- if (!create_proc_read_entry (s, 0, 0, ac97_read_proc, card->ac97)) {
- rc = -EIO;
- goto err_out_info;
- }
-
- DPRINTK ("EXIT, returning 0\n");
- return 0;
-
-err_out_info:
- sprintf (s, "driver/via/%d/info", card->card_num);
- remove_proc_entry (s, NULL);
-
-err_out_dir:
- sprintf (s, "driver/via/%d", card->card_num);
- remove_proc_entry (s, NULL);
-
-err_out_none:
- DPRINTK ("EXIT, returning %d\n", rc);
- return rc;
-}
-
-
-static void via_card_cleanup_proc (struct via_info *card)
-{
- char s[32];
-
- DPRINTK ("ENTER\n");
-
- sprintf (s, "driver/via/%d/ac97", card->card_num);
- remove_proc_entry (s, NULL);
-
- sprintf (s, "driver/via/%d/info", card->card_num);
- remove_proc_entry (s, NULL);
-
- sprintf (s, "driver/via/%d", card->card_num);
- remove_proc_entry (s, NULL);
-
- DPRINTK ("EXIT\n");
-}
-
-#endif /* VIA_PROC_FS */
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
index ce519a9a9d2cb..265423054cafd 100644
--- a/sound/oss/vwsnd.c
+++ b/sound/oss/vwsnd.c
@@ -256,7 +256,7 @@ static int __init li_create(lithium_t *lith, unsigned long baseaddr)
{
static void li_destroy(lithium_t *);
- lith->lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&lith->lock);
lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
@@ -3380,13 +3380,13 @@ static int __init attach_vwsnd(struct address_info *hw_config)
init_MUTEX(&devc->io_sema);
init_MUTEX(&devc->mix_sema);
devc->open_mode = 0;
- devc->rport.lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&devc->rport.lock);
init_waitqueue_head(&devc->rport.queue);
devc->rport.swstate = SW_OFF;
devc->rport.hwstate = HW_STOPPED;
devc->rport.flags = 0;
devc->rport.swbuf = NULL;
- devc->wport.lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&devc->wport.lock);
init_waitqueue_head(&devc->wport.queue);
devc->wport.swstate = SW_OFF;
devc->wport.hwstate = HW_STOPPED;
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c
index 4875565a05583..b72db329d1a60 100644
--- a/sound/oss/wavfront.c
+++ b/sound/oss/wavfront.c
@@ -157,14 +157,14 @@ int wf_raw; /* we normally check for "raw state" to firmware
board and load the firmware anyway.
*/
-int fx_raw = 1; /* if this is zero, we'll leave the FX processor in
- whatever state it is when the driver is loaded.
- The default is to download the microprogram and
- associated coefficients to set it up for "default"
- operation, whatever that means.
- */
-
-int debug_default; /* you can set this to control debugging
+static int fx_raw = 1; /* if this is zero, we'll leave the FX processor in
+ whatever state it is when the driver is loaded.
+ The default is to download the microprogram and
+ associated coefficients to set it up for "default"
+ operation, whatever that means.
+ */
+
+static int debug_default; /* you can set this to control debugging
during driver loading. it takes any combination
of the WF_DEBUG_* flags defined in
wavefront.h
@@ -172,44 +172,46 @@ int debug_default; /* you can set this to control debugging
/* XXX this needs to be made firmware and hardware version dependent */
-char *ospath = "/etc/sound/wavefront.os"; /* where to find a processed
- version of the WaveFront OS
- */
+static char *ospath = "/etc/sound/wavefront.os"; /* where to find a processed
+ version of the WaveFront OS
+ */
-int wait_polls = 2000; /* This is a number of tries we poll the status register
- before resorting to sleeping. WaveFront being an ISA
- card each poll takes about 1.2us. So before going to
- sleep we wait up to 2.4ms in a loop.
- */
+static int wait_polls = 2000; /* This is a number of tries we poll the
+ status register before resorting to sleeping.
+ WaveFront being an ISA card each poll takes
+ about 1.2us. So before going to
+ sleep we wait up to 2.4ms in a loop.
+ */
-int sleep_length = HZ/100; /* This says how long we're going to sleep between polls.
- 10ms sounds reasonable for fast response.
- */
+static int sleep_length = HZ/100; /* This says how long we're going to
+ sleep between polls.
+ 10ms sounds reasonable for fast response.
+ */
-int sleep_tries = 50; /* Wait for status 0.5 seconds total. */
+static int sleep_tries = 50; /* Wait for status 0.5 seconds total. */
-int reset_time = 2; /* hundreths of a second we wait after a HW reset for
+static int reset_time = 2; /* hundreths of a second we wait after a HW reset for
the expected interrupt.
*/
-int ramcheck_time = 20; /* time in seconds to wait while ROM code
- checks on-board RAM.
- */
-
-int osrun_time = 10; /* time in seconds we wait for the OS to
- start running.
- */
-
-MODULE_PARM(wf_raw,"i");
-MODULE_PARM(fx_raw,"i");
-MODULE_PARM(debug_default,"i");
-MODULE_PARM(wait_polls,"i");
-MODULE_PARM(sleep_length,"i");
-MODULE_PARM(sleep_tries,"i");
-MODULE_PARM(ospath,"s");
-MODULE_PARM(reset_time,"i");
-MODULE_PARM(ramcheck_time,"i");
-MODULE_PARM(osrun_time,"i");
+static int ramcheck_time = 20; /* time in seconds to wait while ROM code
+ checks on-board RAM.
+ */
+
+static int osrun_time = 10; /* time in seconds we wait for the OS to
+ start running.
+ */
+
+module_param(wf_raw, int, 0);
+module_param(fx_raw, int, 0);
+module_param(debug_default, int, 0);
+module_param(wait_polls, int, 0);
+module_param(sleep_length, int, 0);
+module_param(sleep_tries, int, 0);
+module_param(ospath, charp, 0);
+module_param(reset_time, int, 0);
+module_param(ramcheck_time, int, 0);
+module_param(osrun_time, int, 0);
/***************************************************************************/
@@ -2036,7 +2038,7 @@ wavefront_oss_ioctl (int devno, unsigned int cmd, void __user * arg)
}
}
-int
+static int
wavefront_oss_load_patch (int devno, int format, const char __user *addr,
int offs, int count, int pmgr_flag)
{
@@ -2165,7 +2167,7 @@ wavefrontintr(int irq, void *dev_id, struct pt_regs *dummy)
7 Unused
*/
-int
+static int
wavefront_interrupt_bits (int irq)
{
@@ -2193,7 +2195,7 @@ wavefront_interrupt_bits (int irq)
return bits;
}
-void
+static void
wavefront_should_cause_interrupt (int val, int port, int timeout)
{
@@ -2895,16 +2897,6 @@ int __init detect_wffx (void)
return 0;
}
-int __init attach_wffx (void)
-{
- if ((dev.fx_mididev = sound_alloc_mididev ()) < 0) {
- printk (KERN_WARNING LOGNAME "cannot install FX Midi driver\n");
- return -1;
- }
-
- return 0;
-}
-
void
wffx_mute (int onoff)
@@ -3490,8 +3482,8 @@ static int irq = -1;
MODULE_AUTHOR ("Paul Barton-Davis <pbd@op.net>");
MODULE_DESCRIPTION ("Turtle Beach WaveFront Linux Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM (io,"i");
-MODULE_PARM (irq,"i");
+module_param (io, int, 0);
+module_param (irq, int, 0);
static int __init init_wavfront (void)
{
diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
index f552f304ae788..00f387c8c22fa 100644
--- a/sound/oss/ymfpci.c
+++ b/sound/oss/ymfpci.c
@@ -124,11 +124,6 @@ MODULE_DEVICE_TABLE(pci, ymf_id_tbl);
* common I/O routines
*/
-static inline u8 ymfpci_readb(ymfpci_t *codec, u32 offset)
-{
- return readb(codec->reg_area_virt + offset);
-}
-
static inline void ymfpci_writeb(ymfpci_t *codec, u32 offset, u8 val)
{
writeb(val, codec->reg_area_virt + offset);
@@ -2504,8 +2499,8 @@ static int ymf_ac97_init(ymfpci_t *unit, int num_ac97)
# ifdef MODULE
static int mpu_io;
static int synth_io;
-MODULE_PARM(mpu_io, "i");
-MODULE_PARM(synth_io, "i");
+module_param(mpu_io, int, 0);
+module_param(synth_io, int, 0);
# else
static int mpu_io = 0x330;
static int synth_io = 0x388;
diff --git a/usr/Makefile b/usr/Makefile
index f269a5f7701f5..248d5551029d5 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -5,40 +5,60 @@ hostprogs-y := gen_init_cpio
clean-files := initramfs_data.cpio.gz initramfs_list
-# If you want a different list of files in the initramfs_data.cpio
-# then you can either overwrite the cpio_list in this directory
-# or set INITRAMFS_LIST to another filename.
-INITRAMFS_LIST := $(obj)/initramfs_list
-
# initramfs_data.o contains the initramfs_data.cpio.gz image.
# The image is included using .incbin, a dependency which is not
# tracked automatically.
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
-# initramfs-y are the programs which will be copied into the CPIO
-# archive. Currently, the filenames are hardcoded in gen_init_cpio,
-# but we need the information for the build as well, so it's duplicated
-# here.
+ifdef CONFIG_INITRAMFS_ROOT_UID
+gen_initramfs_args += -u $(CONFIG_INITRAMFS_ROOT_UID)
+endif
+
+ifdef CONFIG_INITRAMFS_ROOT_GID
+gen_initramfs_args += -g $(CONFIG_INITRAMFS_ROOT_GID)
+endif
-# Commented out for now
-# initramfs-y := $(obj)/root/hello
+# The $(shell echo $(CONFIG_INITRAMFS_SOURCE)) is to remove the
+# gratuitous begin and end quotes from the Kconfig string type.
+# Internal, escaped quotes in the Kconfig string will loose the
+# escape and become active quotes.
+quotefixed_initramfs_source := $(shell echo $(CONFIG_INITRAMFS_SOURCE))
filechk_initramfs_list = $(CONFIG_SHELL) \
- $(srctree)/scripts/gen_initramfs_list.sh $(CONFIG_INITRAMFS_SOURCE)
-
+ $(srctree)/scripts/gen_initramfs_list.sh $(gen_initramfs_args) $(quotefixed_initramfs_source)
+
$(obj)/initramfs_list: FORCE
$(call filechk,initramfs_list)
quiet_cmd_cpio = CPIO $@
cmd_cpio = ./$< $(obj)/initramfs_list > $@
+
+# Check if the INITRAMFS_SOURCE is a cpio archive
+ifneq (,$(findstring .cpio,$(quotefixed_initramfs_source)))
+
+# INITRAMFS_SOURCE has a cpio archive - verify that it's a single file
+ifneq (1,$(words $(quotefixed_initramfs_source)))
+$(error Only a single file may be specified in CONFIG_INITRAMFS_SOURCE (="$(quotefixed_initramfs_source)") when a cpio archive is directly specified.)
+endif
+# Now use the cpio archive directly
+initramfs_data_cpio = $(quotefixed_initramfs_source)
+targets += $(quotefixed_initramfs_source)
+
+else
+
+# INITRAMFS_SOURCE is not a cpio archive - create one
$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio \
$(initramfs-y) $(obj)/initramfs_list FORCE
$(call if_changed,cpio)
targets += initramfs_data.cpio
+initramfs_data_cpio = $(obj)/initramfs_data.cpio
+
+endif
+
-$(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE
+$(obj)/initramfs_data.cpio.gz: $(initramfs_data_cpio) FORCE
$(call if_changed,gzip)
targets += initramfs_data.cpio.gz
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 7672fbb8db1f6..10bb8f8895196 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -10,13 +10,19 @@
#include <ctype.h>
#include <limits.h>
+/*
+ * Original work by Jeff Garzik
+ *
+ * External file lists, symlink, pipe and fifo support by Thayne Harbaugh
+ */
+
#define xstr(s) #s
#define str(s) xstr(s)
static unsigned int offset;
static unsigned int ino = 721;
-struct file_type {
+struct file_handler {
const char *type;
int (*handler)(const char *line);
};
@@ -80,7 +86,7 @@ static void cpio_trailer(void)
0, /* minor */
0, /* rmajor */
0, /* rminor */
- (unsigned)strlen(name) + 1, /* namesize */
+ (unsigned)strlen(name)+1, /* namesize */
0); /* chksum */
push_hdr(s);
push_rest(name);
@@ -91,7 +97,55 @@ static void cpio_trailer(void)
}
}
-static int cpio_mkdir(const char *name, unsigned int mode,
+static int cpio_mkslink(const char *name, const char *target,
+ unsigned int mode, uid_t uid, gid_t gid)
+{
+ char s[256];
+ time_t mtime = time(NULL);
+
+ sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+ "%08X%08X%08X%08X%08X%08X%08X",
+ "070701", /* magic */
+ ino++, /* ino */
+ S_IFLNK | mode, /* mode */
+ (long) uid, /* uid */
+ (long) gid, /* gid */
+ 1, /* nlink */
+ (long) mtime, /* mtime */
+ (unsigned)strlen(target)+1, /* filesize */
+ 3, /* major */
+ 1, /* minor */
+ 0, /* rmajor */
+ 0, /* rminor */
+ (unsigned)strlen(name) + 1,/* namesize */
+ 0); /* chksum */
+ push_hdr(s);
+ push_string(name);
+ push_pad();
+ push_string(target);
+ push_pad();
+ return 0;
+}
+
+static int cpio_mkslink_line(const char *line)
+{
+ char name[PATH_MAX + 1];
+ char target[PATH_MAX + 1];
+ unsigned int mode;
+ int uid;
+ int gid;
+ int rc = -1;
+
+ if (5 != sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) "s %o %d %d", name, target, &mode, &uid, &gid)) {
+ fprintf(stderr, "Unrecognized dir format '%s'", line);
+ goto fail;
+ }
+ rc = cpio_mkslink(name, target, mode, uid, gid);
+ fail:
+ return rc;
+}
+
+static int cpio_mkgeneric(const char *name, unsigned int mode,
uid_t uid, gid_t gid)
{
char s[256];
@@ -101,7 +155,7 @@ static int cpio_mkdir(const char *name, unsigned int mode,
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
ino++, /* ino */
- S_IFDIR | mode, /* mode */
+ mode, /* mode */
(long) uid, /* uid */
(long) gid, /* gid */
2, /* nlink */
@@ -118,7 +172,33 @@ static int cpio_mkdir(const char *name, unsigned int mode,
return 0;
}
-static int cpio_mkdir_line(const char *line)
+enum generic_types {
+ GT_DIR,
+ GT_PIPE,
+ GT_SOCK
+};
+
+struct generic_type {
+ const char *type;
+ mode_t mode;
+};
+
+static struct generic_type generic_type_table[] = {
+ [GT_DIR] = {
+ .type = "dir",
+ .mode = S_IFDIR
+ },
+ [GT_PIPE] = {
+ .type = "pipe",
+ .mode = S_IFIFO
+ },
+ [GT_SOCK] = {
+ .type = "sock",
+ .mode = S_IFSOCK
+ }
+};
+
+static int cpio_mkgeneric_line(const char *line, enum generic_types gt)
{
char name[PATH_MAX + 1];
unsigned int mode;
@@ -127,14 +207,31 @@ static int cpio_mkdir_line(const char *line)
int rc = -1;
if (4 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d", name, &mode, &uid, &gid)) {
- fprintf(stderr, "Unrecognized dir format '%s'", line);
+ fprintf(stderr, "Unrecognized %s format '%s'",
+ line, generic_type_table[gt].type);
goto fail;
}
- rc = cpio_mkdir(name, mode, uid, gid);
+ mode |= generic_type_table[gt].mode;
+ rc = cpio_mkgeneric(name, mode, uid, gid);
fail:
return rc;
}
+static int cpio_mkdir_line(const char *line)
+{
+ return cpio_mkgeneric_line(line, GT_DIR);
+}
+
+static int cpio_mkpipe_line(const char *line)
+{
+ return cpio_mkgeneric_line(line, GT_PIPE);
+}
+
+static int cpio_mksock_line(const char *line)
+{
+ return cpio_mkgeneric_line(line, GT_SOCK);
+}
+
static int cpio_mknod(const char *name, unsigned int mode,
uid_t uid, gid_t gid, char dev_type,
unsigned int maj, unsigned int min)
@@ -286,12 +383,16 @@ void usage(const char *prog)
"describe the files to be included in the initramfs archive:\n"
"\n"
"# a comment\n"
- "file <name> <location> <mode> <uid> <gid> \n"
+ "file <name> <location> <mode> <uid> <gid>\n"
"dir <name> <mode> <uid> <gid>\n"
"nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>\n"
+ "slink <name> <target> <mode> <uid> <gid>\n"
+ "pipe <name> <mode> <uid> <gid>\n"
+ "sock <name> <mode> <uid> <gid>\n"
"\n"
- "<name> name of the file/dir/nod in the archive\n"
+ "<name> name of the file/dir/nod/etc in the archive\n"
"<location> location of the file in the current filesystem\n"
+ "<target> link target\n"
"<mode> mode/permissions of the file\n"
"<uid> user id (0=root)\n"
"<gid> group id (0=root)\n"
@@ -309,7 +410,7 @@ void usage(const char *prog)
prog);
}
-struct file_type file_type_table[] = {
+struct file_handler file_handler_table[] = {
{
.type = "file",
.handler = cpio_mkfile_line,
@@ -320,6 +421,15 @@ struct file_type file_type_table[] = {
.type = "dir",
.handler = cpio_mkdir_line,
}, {
+ .type = "slink",
+ .handler = cpio_mkslink_line,
+ }, {
+ .type = "pipe",
+ .handler = cpio_mkpipe_line,
+ }, {
+ .type = "sock",
+ .handler = cpio_mksock_line,
+ }, {
.type = NULL,
.handler = NULL,
}
@@ -382,10 +492,10 @@ int main (int argc, char *argv[])
ec = -1;
}
- for (type_idx = 0; file_type_table[type_idx].type; type_idx++) {
+ for (type_idx = 0; file_handler_table[type_idx].type; type_idx++) {
int rc;
- if (! strcmp(line, file_type_table[type_idx].type)) {
- if ((rc = file_type_table[type_idx].handler(args))) {
+ if (! strcmp(line, file_handler_table[type_idx].type)) {
+ if ((rc = file_handler_table[type_idx].handler(args))) {
ec = rc;
fprintf(stderr, " line %d\n", line_nr);
}
@@ -393,7 +503,7 @@ int main (int argc, char *argv[])
}
}
- if (NULL == file_type_table[type_idx].type) {
+ if (NULL == file_handler_table[type_idx].type) {
fprintf(stderr, "unknown file type line %d: '%s'\n",
line_nr, line);
}